Exemplo n.º 1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Bankbook();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Bankbook'])) {
         $model->attributes = $_POST['Bankbook'];
         if ($model->save()) {
             $this->redirect(array('bankbook/admin/' . $model->account_id));
         }
     }
     $this->render('create', array('model' => $model));
 }
Exemplo n.º 2
0
 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();
         }
     }
 }