예제 #1
0
 public function printDetailes()
 {
     $model = PaymentType::findOne($this->type);
     //echo \yii\helpers\Json::encode("echo ".$model->value);
     if ($model->value == '') {
         echo JSON::encode(array($_POST['bill']['line'], false));
         Yii::$app->end();
     }
     $form = new $model->value();
     //$form->type=$id;
     //$form->sum=$_POST['bill']['sum'];
     //$form->line=$_POST['bill']['line'];
     $text = '';
     foreach ($form->printDetailes() as $field => $type) {
         $text .= $field . ':' . "value" . ", ";
     }
     return $text;
 }
예제 #2
0
 public function save()
 {
     //print_r($this->Deposit);
     $num = 0;
     //$linenum=1;
     $tranType = \app\helpers\Linet3Helper::getSetting('transactionType.chequedeposit');
     if ($this->refnum == '' || $this->date == '' || !is_array($this->Deposit)) {
         return false;
     }
     $accout = new Transactions();
     $accout->type = $tranType;
     $accout->refnum1 = '';
     //$this->refnum;
     $accout->refnum2 = $this->refnum;
     $accout->details = Yii::t('app', 'Deposit') . " #" . $this->refnum;
     $accout->valuedate = $this->date . $this->refnum;
     $accout->owner_id = Yii::$app->user->id;
     $accout->linenum = 1;
     $transaction = Yii::$app->db->beginTransaction(\yii\db\Transaction::READ_UNCOMMITTED);
     //-shuld start transaction here
     try {
         foreach ($this->Deposit as $line => $val) {
             list($a, $b) = explode(',', $line);
             $cheq = Doccheques::findOne(array("doc_id" => $a, "line" => $b));
             $oppt_acc = PaymentType::findOne($cheq->type)->oppt_account_id;
             $accout->currency_id = $cheq->currency_id;
             $accout->addDoubleLine($oppt_acc, $this->account_id, $cheq->sum);
             $cheq->bank_refnum = $num;
             $cheq->save();
         }
         $transaction->commit();
     } catch (\Exception $e) {
         $transaction->rollBack();
         $message = $e->getMessage();
         $this->addError('refnum', $message);
     }
     return true;
     //num
 }
예제 #3
0
 public function printDetails()
 {
     $model = PaymentType::findOne($this->type);
     $form = new $model->value();
     $attrs = DocchequesEav::find()->where(["doc_id" => $this->doc_id, "line" => $this->line])->All();
     //$text='';
     return $form->line($attrs);
 }
예제 #4
0
 public function loadModel($id)
 {
     $model = PaymentType::findOne($id);
     if ($model === null) {
         throw new \yii\web\HttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }