Example #1
0
 public function backtolistOnClick($sender)
 {
     App::RedirectBack();
 }
Example #2
0
 public function savedocOnClick($sender)
 {
     if ($this->docform->customer->getKey() <= 0) {
         $this->setError('Не выбран  контрагент');
         return;
     }
     $this->_doc->headerdata = array('customer' => $this->docform->customer->getKey(), 'customername' => $this->docform->customer->getText(), 'bankaccount' => $this->docform->bankaccount->getValue(), 'tax' => $this->docform->tax->getValue(), 'notes' => $this->docform->notes->getText(), 'basedoc' => $this->docform->basedoc->getKey(), 'basedocname' => $this->docform->basedoc->getText(), 'nds' => $this->docform->nds->getValue() * 100, 'amount' => $this->docform->amount->getValue() * 100);
     $this->_doc->amount = 100 * $this->docform->amount->getText();
     $this->_doc->document_number = $this->docform->document_number->getText();
     $this->_doc->document_date = strtotime($this->docform->document_date->getText());
     $isEdited = $this->_doc->document_id > 0;
     $conn = \ZCL\DB\DB::getConnect();
     $conn->BeginTrans();
     try {
         $this->_doc->save();
         if ($sender->id == 'execdoc') {
             $this->_doc->updateStatus(Document::STATE_EXECUTED);
         } else {
             $this->_doc->updateStatus($isEdited ? Document::STATE_EDITED : Document::STATE_NEW);
         }
         if ($this->_basedocid > 0) {
             $this->_doc->AddConnectedDoc($this->_basedocid);
             $this->_basedocid = 0;
         }
         $conn->CommitTrans();
         App::RedirectBack();
     } catch (\ZippyERP\System\Exception $ee) {
         $conn->RollbackTrans();
         $this->setError($ee->message);
     } catch (\Exception $ee) {
         $conn->RollbackTrans();
         throw new \Exception($ee->message);
     }
 }
Example #3
0
 public function backtolistOnClick($sender)
 {
     // App::Redirect("\\ZippyERP\\ERP\\Pages\\Register\\DocList");
     App::RedirectBack();
 }
Example #4
0
 public function savedocOnClick($sender)
 {
     $this->_doc->document_date = strtotime($this->docform->document_date->getText());
     $this->_doc->document_number = $this->docform->document_number->getText();
     $this->_doc->headerdata['entry'] = base64_encode(serialize($this->_entryarr));
     $this->_doc->headerdata['emp'] = base64_encode(serialize($this->_emparr));
     $this->_doc->headerdata['item'] = base64_encode(serialize($this->_itemarr));
     $this->_doc->headerdata['c'] = base64_encode(serialize($this->_carr));
     $this->_doc->headerdata['f'] = base64_encode(serialize($this->_farr));
     $this->_doc->headerdata['description'] = $this->docform->description->getText();
     $conn = \ZCL\DB\DB::getConnect();
     $conn->BeginTrans();
     try {
         $this->_doc->save();
         if ($sender->id == 'execdoc') {
             $this->_doc->updateStatus(Document::STATE_EXECUTED);
         } else {
             $this->_doc->updateStatus($this->_edited ? Document::STATE_EDITED : Document::STATE_NEW);
         }
         $conn->CommitTrans();
         App::RedirectBack();
     } catch (\ZippyERP\System\Exception $ee) {
         $conn->RollbackTrans();
         $this->setError($ee->message);
     } catch (\Exception $ee) {
         $conn->RollbackTrans();
         throw new \Exception($ee->message);
     }
 }
Example #5
0
 public function savedocOnClick($sender)
 {
     $basedocid = $this->docform->basedoc->getKey();
     $this->_doc->headerdata = array('optype' => $this->docform->optype->getValue(), 'opdetail' => $this->docform->opdetail->getKey(), 'opdetailname' => $this->docform->opdetail->getText(), 'amount' => $this->docform->amount->getValue() * 100, 'basedoc' => $basedocid, 'notes' => $this->docform->notes->getText());
     $this->_doc->amount = 100 * $this->docform->amount->getText();
     $this->_doc->document_number = $this->docform->document_number->getText();
     $this->_doc->document_date = $this->docform->document_date->getDate();
     $isEdited = $this->_doc->document_id > 0;
     $conn = \ZCL\DB\DB::getConnect();
     $conn->BeginTrans();
     try {
         $this->_doc->save();
         if ($sender->id == 'execdoc') {
             $this->_doc->updateStatus(Document::STATE_EXECUTED);
         } else {
             $this->_doc->updateStatus($isEdited ? Document::STATE_EDITED : Document::STATE_NEW);
         }
         if ($basedocid > 0) {
             $this->_doc->AddConnectedDoc($basedocid);
         }
         $conn->CommitTrans();
         App::RedirectBack();
     } catch (\ZippyERP\System\Exception $ee) {
         $conn->RollbackTrans();
         $this->setError($ee->message);
     } catch (\Exception $ee) {
         $conn->RollbackTrans();
         throw new \Exception($ee->message);
     }
 }
Example #6
0
 public function cancelOnClick($sender)
 {
     App::RedirectBack();
 }