public function save() { //create Match $match = new ExtCorrelation(); $match->account_id = $this->account_id; $match->owner = Yii::$app->user->id; $match->save(); //bankbooks //print_r($this->Bankbooks); //print_r($this->Transactions); foreach ($this->Bankbooks['match'] as $bankbook => $true) { Yii::info("bank:" . $bankbook); $bankbook = Bankbook::findOne($bankbook); if ($bankbook !== null) { $bankbook->extCorrelation = $match->id; $bankbook->save(); } } //transaction foreach ($this->Transactions['match'] as $transaction => $true) { Yii::info("trans:" . $transaction); $transaction = Transactions::findOne($transaction); if ($transaction !== null) { $transaction->extCorrelation = $match->id; $transaction->save(); } } return $match->id; }
public function getBankbooks() { return $this->hasMany(Bankbook::className(), array('extCorrelation' => 'id')); }
public function registerc(Request $request) { $v = new Voucher(); $v->vnno = $request->input('vnno'); $v->vdate = CommonController::date_format($request->input('vdate')); $v->amount = $request->input('amount'); $v->amount = $request->input('camount'); $v->status = 1; $v->type = 3; $v->cid = $request->input('cid'); $v->userid = $request->input('userid'); $v->save(); $LastInsertId = $v->id; if ($LastInsertId != NULL) { $m = new Voucherbankreceive(); $m->vid = $LastInsertId; $m->baccid = $request->input('baccid'); $m->cid = $request->input('cid'); $m->checkno = $request->input('checkno'); $m->userid = $request->input('userid'); $m->save(); $b = new Bankbook(); $b->vid = $LastInsertId; $b->baccid = $request->input('baccid'); $b->cid = $request->input('cid'); $b->checkno = $request->input('checkno'); $b->dc = 1; $b->amount = $request->input('amount'); $b->userid = $request->input('userid'); $b->save(); } $c = new Customersledger(); $c->rv = $LastInsertId; $c->cid = $request->input('cid'); $c->amount = $request->input('camount'); $c->save(); return redirect('voucher'); }
public function banktobankregister(Request $request) { $v = new Voucher(); $v->vnno = $request->input('vnno'); $v->vdate = CommonController::date_format($request->input('vdate')); $v->status = 3; $v->type = 5; $v->amount = $request->input('amount'); $v->userid = $request->input('userid'); $v->save(); $LastInsertId = $v->id; //echo $LastInsertId; if ($LastInsertId != NULL) { $b = new Vouchercontra(); $b->vid = $LastInsertId; $b->baccid = $request->input('baccid'); $b->cashid = $request->input('cashid'); $b->checkno = $request->input('checkno'); $b->userid = $request->input('userid'); $b->save(); $b = new Bankbook(); $b->vid = $LastInsertId; $b->baccid = $request->input('baccid'); $b->dc = 1; $b->amount = $request->input('amount'); //$b->sid = $request->input('sid'); $b->checkno = $request->input('checkno'); $b->userid = $request->input('userid'); $b->save(); $b1 = new Bankbook(); $b1->vid = $LastInsertId; $b1->baccid = $request->input('cashid'); $b1->dc = 0; $b1->amount = $request->input('amount'); //$b->sid = $request->input('sid'); $b1->checkno = $request->input('checkno'); $b1->userid = $request->input('userid'); $b1->save(); } return redirect('contravoucher'); }
function readlineLeumi($line, $account) { //leumi wtf??? //if(strlen($line)==56) // return false; $refnum = ltrim(substr($line, 0, 7), '0'); if ($refnum > 0) { $bank = new Bankbook(); $bank->account_id = $account; $bank->refnum = $refnum; //ltrim(substr($line,22,7),' '); $bank->details = iconv("ISO-8859-8", "utf-8", hebrev(iconv("ibm862", "ISO-8859-8", substr($line, 16, 14)))); $bank->date = "20" . substr($line, 12, 2) . "-" . substr($line, 10, 2) . "-" . substr($line, 8, 2); $sighn = substr($line, 32, 1) . '1'; $value = ltrim(substr($line, 33, 12), '0 ') * $sighn; $bank->sum = $value; //$zachot-$hova; $sighn = substr($line, 46, 1) . '1'; $bank->total = ltrim(substr($line, 47, 12), '0 ') * $sighn; if (!$bank->searchBankbook()) { //mybe save output? num $bank->extCorrelation = 0; return $bank->save(); } } }