コード例 #1
0
ファイル: FormExtmatch.php プロジェクト: hkhateb/linet3
 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::log("bank:" . $bankbook, 'info', 'app');
         $bankbook = Bankbook::model()->findByPk($bankbook);
         if ($bankbook !== null) {
             $bankbook->extCorrelation = $match->id;
             $bankbook->save();
         }
     }
     //transaction
     foreach ($this->Transactions['match'] as $transaction => $true) {
         Yii::log("trans:" . $transaction, 'info', 'app');
         $transaction = Transactions::model()->findByPk($transaction);
         if ($transaction !== null) {
             $transaction->extCorrelation = $match->id;
             $transaction->save();
         }
     }
     return $match->id;
 }
コード例 #2
0
ファイル: Bankbook.php プロジェクト: hkhateb/linet3
 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();
         }
     }
 }
コード例 #3
0
ファイル: BankbookController.php プロジェクト: hkhateb/linet3
 public function loadModel($id)
 {
     $model = Bankbook::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }