예제 #1
0
 public function __construct($docid = 0)
 {
     parent::__construct();
     $this->add(new Form('docform'));
     $this->docform->add(new TextInput('document_number'));
     $this->docform->add(new TextInput('amount'));
     $this->docform->add(new Date('created', time()));
     $this->docform->add(new DropDownChoice('customer', Customer::findArray("customer_name", "")));
     $this->docform->add(new Date('startdate', time()));
     $this->docform->add(new Date('enddate', time()));
     $this->docform->add(new TextArea('description'));
     $this->docform->add(new SubmitButton('submit'))->setClickHandler($this, 'submitOnClick');
     $this->docform->add(new Button('cancel'))->setClickHandler($this, 'cancelOnClick');
     if ($docid > 0) {
         //загружаем   содержимок  документа настраницу
         $this->_doc = Document::load($docid);
         $this->docform->document_number->setText($this->_doc->document_number);
         $this->docform->created->setDate($this->_doc->document_date);
         $this->docform->startdate->setDate($this->_doc->headerdata['startdate']);
         $this->docform->enddate->setDate($this->_doc->headerdata['enddate']);
         $this->docform->description->setText($this->_doc->headerdata['description']);
         $this->docform->amount->setText(H::fm($this->_doc->headerdata['amount']));
         $this->docform->customer->setValue($this->_doc->headerdata['customer']);
     } else {
         $this->_doc = Document::create('Contract');
         $this->docform->document_number->setText($this->_doc->nextNumber());
     }
 }
예제 #2
0
 public function __construct($docid = 0)
 {
     parent::__construct();
     $this->add(new Form('docform'));
     $this->docform->add(new TextInput('document_number'));
     $this->docform->add(new Date('document_date', time()));
     $this->docform->add(new DropDownChoice('store'))->setChangeHandler($this, 'OnChangeStore');
     $this->docform->store->setOptionList(Store::findArray("storename", "store_type=" . Store::STORE_TYPE_RET));
     $this->docform->add(new SubmitLink('addrow'))->setClickHandler($this, 'addrowOnClick');
     $this->docform->add(new SubmitButton('savedoc'))->setClickHandler($this, 'savedocOnClick');
     $this->docform->add(new SubmitButton('execdoc'))->setClickHandler($this, 'savedocOnClick');
     $this->docform->add(new Button('backtolist'))->setClickHandler($this, 'backtolistOnClick');
     $this->add(new Form('editdetail'))->setVisible(false);
     $this->editdetail->add(new AutocompleteTextInput('edititem'))->setAutocompleteHandler($this, 'OnAutocompleteItem');
     $this->editdetail->edititem->setChangeHandler($this, 'OnChangeItem');
     $this->editdetail->add(new TextInput('editprice'))->setText("0");
     $this->editdetail->add(new Label('qtystock'));
     $this->editdetail->add(new SubmitButton('saverow'))->setClickHandler($this, 'saverowOnClick');
     $this->editdetail->add(new Button('cancelrow'))->setClickHandler($this, 'cancelrowOnClick');
     if ($docid > 0) {
         //загружаем   содержимок  документа на страницу
         $this->_doc = Document::load($docid);
         $this->docform->document_number->setText($this->_doc->document_number);
         $this->docform->document_date->setDate($this->_doc->document_date);
         $this->docform->store->setValue($this->_doc->headerdata['store']);
         foreach ($this->_doc->detaildata as $item) {
             $stock = new Stock($item);
             $this->_itemlist[$stock->stock_id] = $stock;
         }
     } else {
         $this->_doc = Document::create('RevaluationRet');
     }
     $this->docform->add(new DataView('detail', new \Zippy\Html\DataList\ArrayDataSource(new \Zippy\Binding\PropertyBinding($this, '_itemlist')), $this, 'detailOnRow'))->Reload();
 }
예제 #3
0
 public function __construct($docid = 0)
 {
     parent::__construct();
     $this->add(new Form('docform'));
     $this->docform->add(new TextInput('document_number'));
     $this->docform->add(new Date('document_date'))->setDate(time());
     $this->docform->add(new SubmitButton('execdoc'))->setClickHandler($this, 'savedocOnClick');
     $this->docform->add(new Button('backtolist'))->setClickHandler($this, 'backtolistOnClick');
     $this->docform->add(new DropDownChoice('store', Store::findArray("storename", "store_type = " . Store::STORE_TYPE_RET_SUM)))->setAjaxChangeHandler($this, 'ajaxUpdateActual');
     $this->docform->add(new DropDownChoice('type'));
     $this->docform->add(new TextInput('summa'));
     $this->docform->add(new Label('actual'));
     if ($docid > 0) {
         //загружаем   содержимок  документа настраницу
         $this->_doc = Document::load($docid);
         if ($this->_doc == null) {
             App::RedirectError('Докумен не найден');
         }
         $this->docform->document_number->setText($this->_doc->document_number);
         $this->docform->document_date->setDate($this->_doc->document_date);
         $this->docform->store->setValue($this->_doc->headerdata['store_id']);
         $this->docform->type->setValue($this->_doc->headerdata['type']);
         $this->docform->summa->setText(H::fm($this->_doc->headerdata['summa']));
         $this->updateActual();
     } else {
         $this->_doc = Document::create('RevaluationRetSum');
         $this->docform->document_number->setText($this->_doc->nextNumber());
     }
 }
예제 #4
0
 public function __construct($docid = 0, $basedocid = 0)
 {
     parent::__construct();
     $this->add(new Form('docform'));
     $this->docform->add(new TextInput('document_number'));
     $this->docform->add(new Date('document_date'))->setDate(time());
     $this->docform->add(new DropDownChoice('store', Store::findArray("storename", "store_type = " . Store::STORE_TYPE_RET)))->setChangeHandler($this, 'OnChangeStore');
     $this->docform->add(new AutocompleteTextInput('customer'))->setAutocompleteHandler($this, "OnAutoContragent");
     $this->docform->add(new SubmitLink('addrow'))->setClickHandler($this, 'addrowOnClick');
     $this->docform->add(new SubmitButton('savedoc'))->setClickHandler($this, 'savedocOnClick');
     $this->docform->add(new SubmitButton('execdoc'))->setClickHandler($this, 'savedocOnClick');
     $this->docform->add(new Button('backtolist'))->setClickHandler($this, 'backtolistOnClick');
     $this->docform->add(new Label('totalnds'));
     $this->docform->add(new Label('total'));
     $this->add(new Form('editdetail'))->setVisible(false);
     $this->editdetail->add(new TextInput('editquantity'))->setText("1");
     $this->editdetail->add(new TextInput('editprice'));
     $this->editdetail->add(new AutocompleteTextInput('edittovar'))->setAutocompleteHandler($this, "OnAutoItem");
     $this->editdetail->edittovar->setChangeHandler($this, 'OnChangeItem');
     $this->editdetail->add(new Button('cancelrow'))->setClickHandler($this, 'cancelrowOnClick');
     $this->editdetail->add(new SubmitButton('submitrow'))->setClickHandler($this, 'saverowOnClick');
     if ($docid > 0) {
         //загружаем   содержимок  документа настраницу
         $this->_doc = Document::load($docid);
         $this->docform->document_number->setText($this->_doc->document_number);
         $this->docform->totalnds->setText(H::fm($this->_doc->headerdata['totalnds']));
         $this->docform->document_date->setDate($this->_doc->document_date);
         $this->docform->store->setValue($this->_doc->headerdata['store']);
         $this->docform->customer->setKey($this->_doc->headerdata['customer']);
         $this->docform->customer->setText($this->_doc->headerdata['customername']);
         foreach ($this->_doc->detaildata as $item) {
             $item = new Item($item);
             $this->_tovarlist[$item->item_id] = $item;
         }
     } else {
         $this->_doc = Document::create('ReturnRetailIssue');
         $this->docform->document_number->setText($this->_doc->nextNumber());
         if ($basedocid > 0) {
             //создание на  основании
             $basedoc = Document::load($basedocid);
             if ($basedoc instanceof Document) {
                 $this->_basedocid = $basedocid;
                 if ($basedoc->meta_name == 'RetailIssue') {
                     $this->docform->customer->setKey($basedoc->headerdata['customer']);
                     $this->docform->customer->setText($basedoc->headerdata['customername']);
                     foreach ($basedoc->detaildata as $_item) {
                         $item = new Item($_item);
                         $this->_tovarlist[$item->item_id] = $item;
                     }
                 }
             }
         }
     }
     $this->docform->add(new DataView('detail', new \Zippy\Html\DataList\ArrayDataSource(new \Zippy\Binding\PropertyBinding($this, '_tovarlist')), $this, 'detailOnRow'))->Reload();
 }
예제 #5
0
 public function __construct($docid = 0, $basedocid = 0)
 {
     parent::__construct();
     $this->add(new Form('docform'));
     $this->docform->add(new TextInput('document_number'));
     $this->docform->add(new Date('document_date'))->setDate(time());
     $this->docform->add(new TextInput('customer'));
     $this->docform->add(new SubmitLink('addrow'))->setClickHandler($this, 'addrowOnClick');
     $this->docform->add(new SubmitButton('savedoc'))->setClickHandler($this, 'savedocOnClick');
     $this->docform->add(new SubmitButton('execdoc'))->setClickHandler($this, 'savedocOnClick');
     $this->docform->add(new Button('backtolist'))->setClickHandler($this, 'backtolistOnClick');
     $this->add(new Form('editdetail'))->setVisible(false);
     $this->editdetail->add(new TextInput('editquantity'))->setText("1");
     $this->editdetail->add(new TextInput('editprice'));
     $this->editdetail->add(new TextInput('editsn'));
     $this->editdetail->add(new TextInput('editwarranty'));
     $this->editdetail->add(new AutocompleteTextInput('edittovar'))->setAutocompleteHandler($this, "OnAutoItem");
     $this->editdetail->add(new Button('cancelrow'))->setClickHandler($this, 'cancelrowOnClick');
     $this->editdetail->add(new SubmitButton('submitrow'))->setClickHandler($this, 'saverowOnClick');
     if ($docid > 0) {
         //загружаем   содержимок  документа настраницу
         $this->_doc = Document::load($docid);
         if ($this->_doc == null) {
             App::RedirectError('Докумен не найден');
         }
         $this->docform->document_number->setText($this->_doc->document_number);
         $this->docform->customer->setText($this->_doc->headerdata['customer']);
         $this->docform->document_date->setDate($this->_doc->document_date);
         foreach ($this->_doc->detaildata as $item) {
             $item = new Item($item);
             $this->_tovarlist[$item->item_id] = $item;
         }
     } else {
         $this->_doc = Document::create('Warranty');
         $this->docform->document_number->setText($this->_doc->nextNumber());
         if ($basedocid > 0) {
             //создание на  основании
             $basedoc = Document::load($basedocid);
             if ($basedoc instanceof Document) {
                 $this->_basedocid = $basedocid;
                 if ($basedoc->meta_name == 'RetailIssue' || $basedoc->meta_name == 'GoodsIssue') {
                     $this->docform->customer->setText($basedoc->headerdata['customername']);
                     foreach ($basedoc->detaildata as $item) {
                         $item = new Item($item);
                         $this->_tovarlist[$item->item_id] = $item;
                     }
                 }
             }
         }
     }
     $this->docform->add(new DataView('detail', new \Zippy\Html\DataList\ArrayDataSource(new \Zippy\Binding\PropertyBinding($this, '_tovarlist')), $this, 'detailOnRow'))->Reload();
 }
예제 #6
0
 public function __construct($docid = 0, $basedocid = 0)
 {
     parent::__construct();
     $this->add(new Form('docform'));
     $this->docform->add(new TextInput('document_number'));
     $this->docform->add(new Date('document_date', time()));
     $this->docform->add(new DropDownChoice('bankaccount', \ZippyERP\ERP\Entity\MoneyFund::findArray('title', "ftype=1")));
     $this->docform->add(new CheckBox('tax'));
     $this->docform->add(new AutocompleteTextInput('customer'))->setAutocompleteHandler($this, "OnAutoContragent");
     $this->docform->add(new TextInput('amount'));
     $this->docform->add(new TextInput('nds'));
     $this->docform->add(new AutocompleteTextInput('basedoc'))->setAutocompleteHandler($this, 'OnAutocomplete');
     $this->docform->add(new TextArea('notes'));
     $this->docform->add(new Button('backtolist'))->setClickHandler($this, 'backtolistOnClick');
     $this->docform->add(new SubmitButton('savedoc'))->setClickHandler($this, 'savedocOnClick');
     $this->docform->add(new SubmitButton('execdoc'))->setClickHandler($this, 'savedocOnClick');
     if ($docid > 0) {
         //загружаем   содержимок  документа настраницу
         $this->_doc = Document::load($docid);
         if ($this->_doc == null) {
             App::RedirectError('Докумен не найден');
         }
         $this->docform->amount->setText($this->_doc->amount / 100);
         $this->docform->document_number->setText($this->_doc->document_number);
         $this->docform->document_date->setDate($this->_doc->document_date);
         $this->docform->nds->setText($this->_doc->headerdata['nds'] / 100);
         $this->docform->notes->setText($this->_doc->headerdata['notes']);
         $this->docform->bankaccount->setValue($this->_doc->headerdata['bankaccount']);
         $this->docform->tax->setValue($this->_doc->headerdata['tax']);
         $this->docform->basedoc->setKey($this->_doc->headerdata['basedoc']);
         $this->docform->basedoc->setText($this->_doc->headerdata['basedocname']);
         $this->docform->customer->setKey($this->_doc->headerdata['customer']);
         $this->docform->customer->setText($this->_doc->headerdata['customername']);
     } else {
         $this->_doc = Document::create('TransferOrder');
         $this->docform->document_number->setText($this->_doc->nextNumber());
         if ($basedocid > 0) {
             //создание на  основании
             $basedoc = Document::load($basedocid);
             if ($basedoc instanceof Document) {
                 $this->_basedocid = $basedocid;
             }
         }
     }
 }
예제 #7
0
 public function __construct($docid = 0)
 {
     parent::__construct();
     $this->add(new Form('docform'));
     $this->docform->add(new Date('document_date', time()));
     $this->docform->add(new TextInput('document_number'));
     $this->docform->add(new DropDownChoice('bankaccount', \ZippyERP\ERP\Entity\MoneyFund::findArray('title', "ftype=1")));
     $this->docform->add(new SubmitLink('addrow'))->setClickHandler($this, 'addrowOnClick');
     $this->docform->add(new SubmitButton('savedoc'))->setClickHandler($this, 'savedocOnClick');
     $this->docform->add(new SubmitButton('execdoc'))->setClickHandler($this, 'savedocOnClick');
     $this->docform->add(new Button('backtolist'))->setClickHandler($this, 'backtolistOnClick');
     $this->add(new Form('editdetail'))->setVisible(false);
     $this->editdetail->add(new DropDownChoice('editoptype', BS::getTypes()))->setChangeHandler($this, 'typeOnClick');
     $this->editdetail->add(new AutocompleteTextInput('editcustomer'))->setAutocompleteHandler($this, "OnAutoContragent");
     $this->editdetail->add(new DropDownChoice('editpayment'))->setOptionList(\ZippyERP\ERP\Consts::getTaxesList());
     $this->editdetail->editpayment->setVisible(false);
     $docinput = $this->editdetail->add(new AutocompleteTextInput('editdoc'));
     $docinput->setAutocompleteHandler($this, 'OnDocAutocomplete');
     $docinput->setAjaxChangeHandler($this, 'OnDocChange');
     $this->editdetail->add(new TextInput('editamount'))->setText("1");
     $this->editdetail->add(new TextInput('editnds'))->setText("0");
     $this->editdetail->add(new TextInput('editcomment'));
     $this->editdetail->add(new CheckBox('editnoentry'));
     $this->editdetail->add(new Button('cancelrow'))->setClickHandler($this, 'cancelrowOnClick');
     $this->editdetail->add(new SubmitButton('submitrow'))->setClickHandler($this, 'saverowOnClick');
     if ($docid > 0) {
         //загружаем   содержимок  документа на страницу
         $this->_doc = Document::load($docid);
         $this->docform->document_number->setText($this->_doc->document_number);
         $this->docform->bankaccount->setValue($this->_doc->headerdata['bankaccount']);
         $this->docform->document_date->setText(date('Y-m-d', $this->_doc->document_date));
         foreach ($this->_doc->detaildata as $item) {
             $entry = new Entry($item);
             $this->_list[$entry->entry_id] = $entry;
         }
         $this->docform->document_date->setText(date('Y-m-d', $this->_doc->document_date));
     } else {
         $this->_doc = Document::create('BankStatement');
     }
     $this->docform->add(new DataView('detail', new \Zippy\Html\DataList\ArrayDataSource(new \Zippy\Binding\PropertyBinding($this, '_list')), $this, 'detailOnRow'));
     $this->docform->detail->Reload();
 }
예제 #8
0
 public function __construct($docid = 0)
 {
     parent::__construct();
     $this->add(new Form('docform'));
     $this->docform->add(new TextInput('document_number'));
     $this->docform->add(new Date('created'))->setDate(time());
     $this->docform->add(new SubmitButton('execdoc'))->setClickHandler($this, 'savedocOnClick');
     $this->docform->add(new Button('backtolist'))->setClickHandler($this, 'backtolistOnClick');
     if ($docid > 0) {
         //загружаем   содержимок  документа настраницу
         $this->_doc = Document::load($docid);
         if ($this->_doc == null) {
             App::RedirectError('Докумен не найден');
         }
         $this->docform->document_number->setText($this->_doc->document_number);
         $this->docform->created->setDate($this->_doc->document_date);
     } else {
         $this->_doc = Document::create('FinResult');
         $this->docform->document_number->setText($this->_doc->nextNumber());
     }
 }
예제 #9
0
 public function __construct($docid = 0)
 {
     parent::__construct();
     $this->add(new Form('docform'));
     $this->docform->add(new TextInput('document_number'));
     $this->docform->add(new Date('document_date', time()));
     $this->docform->add(new DropDownChoice('optype', CRIN::getTypes(), 1))->setChangeHandler($this, 'optypeOnChange');
     $this->docform->add(new Label('lblopdetail'));
     $this->docform->add(new AutocompleteTextInput('opdetail'))->setAutocompleteHandler($this, 'opdetailOnAutocomplete');
     $this->docform->add(new TextInput('amount'));
     $this->docform->add(new TextInput('nds'));
     $this->docform->add(new AutocompleteTextInput('basedoc'))->setAutocompleteHandler($this, 'basedocOnAutocomplete');
     $this->docform->add(new TextArea('notes'));
     $this->docform->add(new Button('backtolist'))->setClickHandler($this, 'backtolistOnClick');
     $this->docform->add(new SubmitButton('savedoc'))->setClickHandler($this, 'savedocOnClick');
     $this->docform->add(new SubmitButton('execdoc'))->setClickHandler($this, 'savedocOnClick');
     $this->optypeOnChange(null);
     if ($docid > 0) {
         //загружаем   содержимое  документа на страницу
         $this->_doc = Document::load($docid);
         $this->docform->document_number->setText($this->_doc->document_number);
         $this->docform->document_date->setDate($this->_doc->document_date);
         $this->docform->amount->setText($this->_doc->amount / 100);
         $this->docform->optype->setValue($this->_doc->headerdata['optype']);
         $this->optypeOnChange(null);
         $this->docform->opdetail->setKey($this->_doc->headerdata['opdetail']);
         $this->docform->opdetail->setText($this->_doc->headerdata['opdetailname']);
         $this->docform->nds->setText($this->_doc->headerdata['nds'] / 100);
         $this->docform->notes->setText($this->_doc->headerdata['notes']);
         $basedocid = $this->_doc->headerdata['basedoc'];
         if ($basedocid > 0) {
             $base = Document::load($basedocid);
             $this->docform->basedoc->setKey($basedocid);
             $this->docform->basedoc->setValue($base->document_number);
         }
     } else {
         $this->_doc = Document::create('CashReceiptIn');
     }
 }
예제 #10
0
 public function __construct($docid = 0)
 {
     parent::__construct();
     $this->add(new Form('docform'));
     $this->docform->add(new TextInput('document_number'));
     $this->docform->add(new Date('document_date'))->setDate(time());
     $this->docform->add(new Date('timeline'))->setDate(time() + 3 * 24 * 3600);
     $this->docform->add(new AutocompleteTextInput('customer'))->setAutocompleteHandler($this, "OnAutoCont");
     $this->docform->add(new DropDownChoice('orderstate', \ZippyERP\ERP\Entity\Doc\CustomerOrder::getStatesList()));
     $this->docform->add(new SubmitLink('addrow'))->setClickHandler($this, 'addrowOnClick');
     $this->docform->add(new Label('total'));
     $this->docform->add(new SubmitButton('savedoc'))->setClickHandler($this, 'savedocOnClick');
     $this->docform->add(new Button('backtolist'))->setClickHandler($this, 'backtolistOnClick');
     $this->add(new Form('editdetail'))->setVisible(false);
     $this->editdetail->add(new AutocompleteTextInput('edititem'))->setAutocompleteHandler($this, "OnAutoItem");
     $this->editdetail->edititem->setChangeHandler($this, 'OnChangeItem');
     $this->editdetail->add(new TextInput('editquantity'));
     $this->editdetail->add(new TextInput('editprice'));
     $this->editdetail->add(new SubmitButton('saverow'))->setClickHandler($this, 'saverowOnClick');
     $this->editdetail->add(new Button('cancelrow'))->setClickHandler($this, 'cancelrowOnClick');
     $this->editdetail->add(new Label('qtystore'));
     if ($docid > 0) {
         //загружаем   содержимок  документа настраницу
         $this->_doc = Document::load($docid);
         $this->docform->document_number->setText($this->_doc->document_number);
         $this->docform->document_date->setDate($this->_doc->document_date);
         $this->docform->timeline->setDate($this->_doc->headerdata['timeline']);
         $this->docform->customer->setKey($this->_doc->headerdata['customer']);
         $this->docform->customer->setText($this->_doc->headerdata['customername']);
         $this->docform->orderstate->setValue($this->_doc->headerdata['orderstate']);
         foreach ($this->_doc->detaildata as $item) {
             $item = new Item($item);
             $this->_itemlist[$item->item_id] = $item;
         }
     } else {
         $this->_doc = Document::create('CustomerOrder');
     }
     $this->docform->add(new DataView('detail', new \Zippy\Html\DataList\ArrayDataSource(new \Zippy\Binding\PropertyBinding($this, '_itemlist')), $this, 'detailOnRow'))->Reload();
 }
예제 #11
0
 public function __construct($docid = 0, $basedocid = 0)
 {
     parent::__construct();
     $this->add(new Form('docform'));
     $this->docform->add(new TextInput('document_number'));
     $this->docform->add(new Date('document_date'))->setDate(time());
     $this->docform->add(new AutocompleteTextInput('customer'))->setAutocompleteHandler($this, "OnAutoContragent");
     $this->docform->add(new AutocompleteTextInput('contract'))->setAutocompleteHandler($this, "OnAutoContract");
     $this->docform->add(new TextInput('author'));
     $this->docform->add(new TextInput('paytype'));
     $this->docform->add(new CheckBox('ernn'));
     $this->docform->add(new SubmitLink('addrow'))->setClickHandler($this, 'addrowOnClick');
     $this->docform->add(new SubmitButton('savedoc'))->setClickHandler($this, 'savedocOnClick');
     $this->docform->add(new Button('backtolist'))->setClickHandler($this, 'backtolistOnClick');
     $this->docform->add(new Label('totalnds'));
     $this->docform->add(new Label('total'));
     $this->add(new Form('editdetail'))->setVisible(false);
     $this->editdetail->add(new AutocompleteTextInput('edittovar'))->setAutocompleteHandler($this, "OnAutoItem");
     $this->editdetail->edittovar->setChangeHandler($this, 'OnChangeItem');
     $this->editdetail->add(new TextInput('editquantity'))->setText("1");
     $this->editdetail->add(new TextInput('editprice'));
     $this->editdetail->add(new TextInput('editpricends'));
     $this->editdetail->add(new Button('cancelrow'))->setClickHandler($this, 'cancelrowOnClick');
     $this->editdetail->add(new SubmitButton('submitrow'))->setClickHandler($this, 'saverowOnClick');
     if ($docid > 0) {
         //загружаем   содержимок  документа настраницу
         $this->_doc = Document::load($docid);
         $this->docform->document_number->setText($this->_doc->document_number);
         $this->docform->totalnds->setText(H::fm($this->_doc->headerdata['totalnds']));
         $this->docform->document_date->setDate($this->_doc->document_date);
         $this->docform->ernn->setChecked($this->_doc->headerdata['ernn']);
         $this->docform->paytype->setText($this->_doc->headerdata['paytype']);
         $this->docform->author->setText($this->_doc->headerdata['author']);
         $this->docform->contract->setKey($this->_doc->headerdata['contract']);
         $this->docform->contract->setText($this->_doc->headerdata['contractnumber']);
         $this->docform->customer->setKey($this->_doc->headerdata['customer']);
         $this->docform->customer->setText($this->_doc->headerdata['customername']);
         $basedoc = Document::load($this->_doc->headerdata['based']);
         foreach ($this->_doc->detaildata as $item) {
             $item = new Item($item);
             $this->_tovarlist[$item->item_id] = $item;
         }
     } else {
         $this->_doc = Document::create('TaxInvoice');
         $this->docform->document_number->setText($this->_doc->nextNumber());
         $user = System::getUser();
         $employee = \ZippyERP\ERP\Entity\Employee::find("login='******'");
         if ($employee instanceof \ZippyERP\ERP\Entity\Employee) {
             $this->docform->author->setText($employee->fullname);
         }
         if ($basedocid > 0) {
             //создание на  основании
             $basedoc = Document::load($basedocid);
             if ($basedoc instanceof Document) {
                 $this->_basedocid = $basedocid;
                 if ($basedoc->meta_name == 'GoodsIssue') {
                     $this->docform->customer->setKey($basedoc->headerdata['customer']);
                     $this->docform->customer->setText($basedoc->headerdata['customername']);
                     $this->docform->contract->setKey($basedoc->headerdata['contract']);
                     $this->docform->contract->setText($basedoc->headerdata['contractnumber']);
                     foreach ($basedoc->detaildata as $item) {
                         $item = new Item($item);
                         $this->_tovarlist[$item->item_id] = $item;
                     }
                 }
                 if ($basedoc->meta_name == 'Invoice') {
                     $this->docform->customer->setKey($basedoc->headerdata['customer']);
                     $this->docform->customer->setText($basedoc->headerdata['customername']);
                     $this->docform->contract->setKey($basedoc->headerdata['contract']);
                     $this->docform->contract->setText($basedoc->headerdata['contractnumber']);
                     foreach ($basedoc->detaildata as $item) {
                         $item = new Item($item);
                         $this->_tovarlist[$item->item_id] = $item;
                     }
                 }
             }
         }
     }
     $this->docform->add(new DataView('detail', new \Zippy\Html\DataList\ArrayDataSource(new \Zippy\Binding\PropertyBinding($this, '_tovarlist')), $this, 'detailOnRow'))->Reload();
 }
예제 #12
0
파일: invoice.php 프로젝트: Niqpue/zippyerp
 public function __construct($docid = 0, $basedocid = 0)
 {
     parent::__construct();
     $this->add(new Form('docform'));
     $this->docform->add(new TextInput('document_number'));
     $this->docform->add(new Date('document_date'))->setDate(time());
     $this->docform->add(new Date('paydate'))->setDate(strtotime("+7 day", time()));
     $this->docform->add(new CheckBox('isnds'))->setChangeHandler($this, 'onIsnds');
     $this->docform->add(new AutocompleteTextInput('customer'))->setAutocompleteHandler($this, "OnAutoContragent");
     $this->docform->add(new AutocompleteTextInput('contract'))->setAutocompleteHandler($this, "OnAutoContract");
     $this->docform->add(new SubmitLink('addrow'))->setClickHandler($this, 'addrowOnClick');
     $this->docform->add(new SubmitButton('savedoc'))->setClickHandler($this, 'savedocOnClick');
     $this->docform->add(new SubmitButton('execdoc'))->setClickHandler($this, 'savedocOnClick');
     $this->docform->add(new Button('backtolist'))->setClickHandler($this, 'backtolistOnClick');
     $this->docform->add(new Label('total'));
     $this->docform->add(new Label('totalnds'));
     $this->add(new Form('editdetail'))->setVisible(false);
     $this->editdetail->add(new TextInput('editquantity'))->setText("1");
     $this->editdetail->add(new TextInput('editprice'));
     $this->editdetail->add(new TextInput('editpricends'));
     $this->editdetail->add(new AutocompleteTextInput('edittovar'))->setAutocompleteHandler($this, "OnAutoItem");
     $this->editdetail->edittovar->setChangeHandler($this, 'OnChangeItem');
     $this->editdetail->add(new Button('cancelrow'))->setClickHandler($this, 'cancelrowOnClick');
     $this->editdetail->add(new SubmitButton('submitrow'))->setClickHandler($this, 'saverowOnClick');
     if ($docid > 0) {
         //загружаем   содержимок  документа настраницу
         $this->_doc = Document::load($docid);
         if ($this->_doc == null) {
             App::RedirectError('Докумен не найден');
         }
         $this->docform->document_number->setText($this->_doc->document_number);
         $this->docform->isnds->setChecked($this->_doc->headerdata['isnds']);
         $this->docform->document_date->setDate($this->_doc->document_date);
         $this->docform->paydate->setDate($this->_doc->headerdata['payment_date']);
         $this->docform->customer->setKey($this->_doc->headerdata['customer']);
         $this->docform->customer->setValue($this->_doc->headerdata['customername']);
         $this->docform->contract->setKey($this->_doc->headerdata['contract']);
         $this->docform->contract->setValue($this->_doc->headerdata['contractnumber']);
         foreach ($this->_doc->detaildata as $item) {
             $item = new Item($item);
             $this->_tovarlist[$item->item_id] = $item;
         }
         $this->calcTotal();
     } else {
         $this->_doc = Document::create('Invoice');
         $this->docform->document_number->setText($this->_doc->nextNumber());
         if ($basedocid > 0) {
             //создание на  основании
             $basedoc = Document::load($basedocid);
             if ($basedoc instanceof Document) {
                 $this->_basedocid = $basedocid;
                 $this->docform->base->setText($basedoc->meta_desc . " №" . $basedoc->document_number);
                 if ($basedoc->meta_name == 'CustomerOrder') {
                     $nds = H::nds(true);
                     // если  в  заказе   цена  с  НДС  получаем  базовую  цену
                     $this->docform->customer->setKey($basedoc->headerdata['customer']);
                     $this->docform->customer->setText($basedoc->headerdata['customername']);
                     $this->docform->contract->setKey($basedoc->document_id);
                     $this->docform->contract->setText($basedoc->document_number);
                     foreach ($basedoc->detaildata as $item) {
                         $item = new Item($item);
                         $item->pricends = $item->price;
                         $item->price = $item->price - $item->price * $nds;
                         $this->_tovarlist[$item->item_id] = $item;
                     }
                 }
                 if ($basedoc->meta_name == 'ReturnGoodsReceipt') {
                     $this->docform->customer->setKey($basedoc->headerdata['customer']);
                     $this->docform->customer->setText($basedoc->headerdata['customername']);
                     $this->docform->contract->setKey($basedoc->headerdata['contract']);
                     $this->docform->contract->setText($basedoc->headerdata['contractnumber']);
                     $this->docform->isnds->setChecked($basedoc->headerdata['isnds']);
                     foreach ($basedoc->detaildata as $item) {
                         $item = new Item($item);
                         $this->_tovarlist[$item->item_id] = $item;
                     }
                 }
             }
         }
     }
     $this->docform->add(new DataView('detail', new \Zippy\Html\DataList\ArrayDataSource(new \Zippy\Binding\PropertyBinding($this, '_tovarlist')), $this, 'detailOnRow'))->Reload();
 }
예제 #13
0
 public function __construct($docid = 0, $basedocid = 0)
 {
     parent::__construct();
     $this->add(new Form('docform'));
     $this->docform->add(new TextInput('document_number'));
     $this->docform->add(new Date('document_date'))->setDate(time());
     $this->docform->add(new AutocompleteTextInput('customer'))->setAutocompleteHandler($this, "OnAutoContragent");
     $this->docform->add(new CheckBox('ernn'));
     $this->docform->add(new AutocompleteTextInput('contract'))->setAutocompleteHandler($this, "OnAutoContract");
     $this->docform->add(new SubmitLink('addrow'))->setClickHandler($this, 'addrowOnClick');
     $this->docform->add(new SubmitButton('savedoc'))->setClickHandler($this, 'savedocOnClick');
     $this->docform->add(new SubmitButton('execdoc'))->setClickHandler($this, 'savedocOnClick');
     $this->docform->add(new Button('backtolist'))->setClickHandler($this, 'backtolistOnClick');
     $this->docform->add(new File('import'));
     $this->docform->add(new SubmitButton('importdoc'))->setClickHandler($this, 'importdocOnClick');
     $this->docform->add(new Label('totalnds'));
     $this->docform->add(new Label('total'));
     $this->add(new Form('editdetail'))->setVisible(false);
     $this->editdetail->add(new AutocompleteTextInput('edittovar'))->setAutocompleteHandler($this, "OnAutoItem");
     $this->editdetail->add(new TextInput('editquantity'))->setText("1");
     $this->editdetail->add(new TextInput('editprice'));
     $this->editdetail->add(new TextInput('editpricends'));
     $this->editdetail->add(new Button('cancelrow'))->setClickHandler($this, 'cancelrowOnClick');
     $this->editdetail->add(new SubmitButton('saverow'))->setClickHandler($this, 'saverowOnClick');
     if ($docid > 0) {
         //загружаем   содержимок  документа на страницу
         $this->_doc = Document::load($docid);
         $this->docform->document_number->setText($this->_doc->document_number);
         //      $this->docform->nds->setText($this->_doc->headerdata['nds'] / 100);
         $this->docform->document_date->setDate($this->_doc->document_date);
         $this->docform->contract->setKey($this->_doc->headerdata['contract']);
         $this->docform->contract->setText($this->_doc->headerdata['contractnumber']);
         $this->docform->customer->setKey($this->_doc->headerdata['customer']);
         $this->docform->customer->setText($this->_doc->headerdata['customername']);
         foreach ($this->_doc->detaildata as $item) {
             $item = new Item($item);
             $this->_tovarlist[$item->item_id] = $item;
         }
         $this->docform->import->setVisible(false);
     } else {
         $this->_doc = Document::create('TaxInvoiceIncome');
         $this->docform->document_number->setText($this->_doc->nextNumber());
         if ($basedocid > 0) {
             //создание на  основании
             $basedoc = Document::load($basedocid);
             if ($basedoc instanceof Document) {
                 $this->_basedocid = $basedocid;
                 // Создатся  на  основании  приходной  накладной
                 if ($basedoc->meta_name == 'GoodsReceipt') {
                     //  $this->docform->nds->setText($basedoc->headerdata['nds'] / 100);
                     $this->docform->customer->setKey($basedoc->headerdata['customer']);
                     $this->docform->customer->setText($basedoc->headerdata['customername']);
                     $this->docform->contract->setKey($basedoc->headerdata['contract']);
                     $this->docform->contract->setText($basedoc->headerdata['contractnumber']);
                     foreach ($basedoc->detaildata as $item) {
                         $item = new Item($item);
                         $this->_tovarlist[$item->item_id] = $item;
                     }
                 }
                 // Создать  на  основании  счета  входящего
                 if ($basedoc->meta_name == 'PurchaseInvoice') {
                     $this->docform->customer->setKey($basedoc->headerdata['customer']);
                     $this->docform->customer->setText($basedoc->headerdata['customername']);
                     $this->docform->contract->setKey($basedoc->headerdata['contract']);
                     $this->docform->contract->setText($basedoc->headerdata['contractnumber']);
                     foreach ($basedoc->detaildata as $item) {
                         $item = new Item($item);
                         $this->_tovarlist[$item->item_id] = $item;
                     }
                 }
                 // Создать  на  основании  Акта  выполненых услуг
                 if ($basedoc->meta_name == 'ServiceIncome') {
                     $this->docform->customer->setKey($basedoc->headerdata['customer']);
                     $this->docform->customer->setText($basedoc->headerdata['customername']);
                     $this->docform->contract->setKey($basedoc->headerdata['contract']);
                     $this->docform->contract->setText($basedoc->headerdata['contractnumber']);
                     foreach ($basedoc->detaildata as $item) {
                         $item = new Item($item);
                         $this->_tovarlist[$item->item_id] = $item;
                     }
                 }
             }
         }
     }
     $this->docform->add(new DataView('detail', new \Zippy\Html\DataList\ArrayDataSource(new \Zippy\Binding\PropertyBinding($this, '_tovarlist')), $this, 'detailOnRow'))->Reload();
 }
예제 #14
0
 public function __construct($docid = 0)
 {
     parent::__construct();
     $this->add(new Form('docform'));
     $this->docform->add(new TextInput('document_number'));
     $this->docform->add(new TextArea('description'));
     $this->docform->add(new Date('document_date'));
     //проводки
     $this->docform->add(new DataView('acctable', new ArrayDataSource($this, '_entryarr'), $this, 'acctableOnRow'));
     $this->docform->add(new DropDownChoice('e_acclistd', Account::findArrayEx('acc_code not in(select acc_pid from erp_account_plan)', 'cast(acc_code as char)')));
     $this->docform->add(new DropDownChoice('e_acclistc', Account::findArrayEx('acc_code not in(select acc_pid from erp_account_plan)', 'cast(acc_code as char)')));
     $this->docform->add(new TextInput('e_accsumma'));
     $this->docform->add(new SubmitButton('addaccbtn'))->setClickHandler($this, 'addaccbtnOnClick');
     //ТМЦ
     $this->docform->add(new DataView('itemtable', new ArrayDataSource($this, '_itemarr'), $this, 'itemtableOnRow'));
     $this->docform->add(new DropDownChoice('e_storelist', Store::findArray('storename', 'store_type=' . Store::STORE_TYPE_OPT, 'storename')));
     $this->docform->add(new AutocompleteTextInput('e_itemlist'))->setAutocompleteHandler($this, "OnAutoItem");
     $this->docform->add(new TextInput('e_quantity'));
     $this->docform->add(new TextInput('e_price'));
     $this->docform->add(new DropDownChoice('e_itemop', new Bind($this, '_acclist')));
     $this->docform->add(new SubmitButton('additembtn'))->setClickHandler($this, 'additembtnOnClick');
     //Сотрудники
     $this->docform->add(new DataView('emptable', new ArrayDataSource($this, '_emparr'), $this, 'emptableOnRow'));
     $this->docform->add(new DropDownChoice('e_empop', new Bind($this, '_acclist')));
     $this->docform->add(new AutocompleteTextInput('e_emplist'))->setAutocompleteHandler($this, "OnAutoEmp");
     $this->docform->add(new TextInput('e_empamount'));
     $this->docform->add(new SubmitButton('addempbtn'))->setClickHandler($this, 'addempbtnOnClick');
     //контрагенты
     $this->docform->add(new DataView('ctable', new ArrayDataSource($this, '_carr'), $this, 'ctableOnRow'));
     $this->docform->add(new AutocompleteTextInput('e_сlist'))->setAutocompleteHandler($this, "OnAutoCont");
     $this->docform->add(new TextInput('e_сamount'));
     $this->docform->add(new SubmitButton('addсbtn'))->setClickHandler($this, 'addсbtnOnClick');
     $this->docform->add(new DropDownChoice('e_cop', new Bind($this, '_acclist')));
     //Денежные счета
     $this->docform->add(new DataView('ftable', new ArrayDataSource($this, '_farr'), $this, 'ftableOnRow'))->Reload();
     $this->docform->add(new DropDownChoice('e_flist', MoneyFund::findArray('title', '', 'title')));
     $this->docform->add(new TextInput('e_famount'));
     $this->docform->add(new SubmitButton('addfbtn'))->setClickHandler($this, 'addfbtnOnClick');
     $this->docform->add(new DropDownChoice('e_foper', new Bind($this, '_acclist')));
     $this->docform->add(new Button('backtolist'))->setClickHandler($this, 'backtolistOnClick');
     $this->docform->add(new SubmitButton('savedoc'))->setClickHandler($this, 'savedocOnClick');
     $this->docform->add(new SubmitButton('execdoc'))->setClickHandler($this, 'savedocOnClick');
     if ($docid > 0) {
         //загружаем   содержимок  документа на страницу
         $this->_edited = true;
         $this->_doc = Document::load($docid);
         $this->docform->document_number->setText($this->_doc->document_number);
         $this->docform->description->setText($this->_doc->headerdata['description']);
         $this->docform->document_date->setText(date('Y-m-d', $this->_doc->document_date));
         $this->_entryarr = unserialize(base64_decode($this->_doc->headerdata['entry']));
         $this->_itemarr = unserialize(base64_decode($this->_doc->headerdata['item']));
         $this->_emparr = unserialize(base64_decode($this->_doc->headerdata['emp']));
         $this->_carr = unserialize(base64_decode($this->_doc->headerdata['c']));
         $this->_farr = unserialize(base64_decode($this->_doc->headerdata['f']));
         $this->docform->acctable->Reload();
         $this->updateAccList();
         $this->docform->itemtable->Reload();
         $this->docform->emptable->Reload();
         $this->docform->ftable->Reload();
         $this->docform->ctable->Reload();
     } else {
         $this->_doc = Document::create('ManualEntry');
         $this->docform->document_date->setDate(time());
     }
 }
예제 #15
0
 public function __construct($docid = 0, $basedocid = 0)
 {
     parent::__construct();
     $this->add(new Form('docform'));
     $this->docform->add(new TextInput('document_number'));
     $this->docform->add(new Date('document_date'))->setDate(time());
     $this->docform->add(new AutocompleteTextInput('customer'))->setAutocompleteHandler($this, "OnAutoContragent");
     $this->docform->add(new AutocompleteTextInput('contract'))->setAutocompleteHandler($this, "OnAutoContract");
     $this->docform->add(new CheckBox('isnds'))->setChangeHandler($this, 'onIsnds');
     $this->docform->add(new CheckBox('cash'));
     $this->docform->add(new SubmitLink('addrow'))->setClickHandler($this, 'addrowOnClick');
     $this->docform->add(new Button('backtolist'))->setClickHandler($this, 'backtolistOnClick');
     $this->docform->add(new SubmitButton('savedoc'))->setClickHandler($this, 'savedocOnClick');
     $this->docform->add(new SubmitButton('execdoc'))->setClickHandler($this, 'savedocOnClick');
     $this->docform->add(new Label('totalnds'));
     $this->docform->add(new Label('total'));
     $this->add(new Form('editdetail'))->setVisible(false);
     $this->editdetail->add(new AutocompleteTextInput('edititem'))->setAutocompleteHandler($this, "OnAutoItem");
     $this->editdetail->add(new TextInput('editquantity'))->setText("1");
     $this->editdetail->add(new TextInput('editprice'));
     $this->editdetail->add(new TextInput('editpricends'));
     $this->editdetail->add(new Button('cancelrow'))->setClickHandler($this, 'cancelrowOnClick');
     $this->editdetail->add(new SubmitButton('saverow'))->setClickHandler($this, 'saverowOnClick');
     //$this->editdetail->add(new SubmitLink('additem'))->setClickHandler($this, 'addItemOnClick');
     if ($docid > 0) {
         //загружаем   содержимок  документа настраницу
         $this->_doc = Document::load($docid);
         $this->docform->document_number->setText($this->_doc->document_number);
         $this->docform->contract->setKey($this->_doc->headerdata['contract']);
         $this->docform->contract->setText($this->_doc->headerdata['contractnumber']);
         $this->docform->isnds->setChecked($this->_doc->headerdata['isnds']);
         $this->docform->cash->setChecked($this->_doc->headerdata['cash']);
         $this->docform->document_date->setDate($this->_doc->document_date);
         $this->docform->customer->setKey($this->_doc->headerdata['customer']);
         $this->docform->customer->setText($this->_doc->headerdata['customername']);
         foreach ($this->_doc->detaildata as $item) {
             $item = new Item($item);
             $this->_itemlist[$item->item_id] = $item;
         }
     } else {
         $this->_doc = Document::create('ServiceAct');
         if ($basedocid > 0) {
             //создание на  основании
             $basedoc = Document::load($basedocid);
             if ($basedoc instanceof Document) {
                 $this->_basedocid = $basedocid;
                 $this->docform->reference->setText($basedoc->meta_desc . " №" . $basedoc->document_number);
                 if ($basedoc->meta_name == 'Invoice') {
                     $this->docform->isnds->setChecked($basedoc->headerdata['isnds']);
                     $this->docform->customer->setKey($basedoc->headerdata['customer']);
                     $this->docform->customer->setText($basedoc->headerdata['customername']);
                     $this->docform->contract->setKey($basedoc->headerdata['contract']);
                     $this->docform->contract->setText($basedoc->headerdata['contractnumber']);
                     foreach ($basedoc->detaildata as $_item) {
                         $item = new Item($_item);
                         //$item->price = $item->pricends;
                         $this->_itemlist[$item->item_id] = $item;
                     }
                 }
             }
         }
     }
     $this->docform->add(new DataView('detail', new \Zippy\Html\DataList\ArrayDataSource(new \Zippy\Binding\PropertyBinding($this, '_itemlist')), $this, 'detailOnRow'))->Reload();
     $this->add(new \ZippyERP\ERP\Blocks\Item('itemdetail', $this, 'OnItem'))->setVisible(false);
 }
예제 #16
0
 public function __construct($docid = 0, $basedocid = 0)
 {
     parent::__construct();
     $this->add(new Form('docform'));
     $this->docform->add(new TextInput('document_number'));
     $this->docform->add(new Date('document_date'))->setDate(time());
     $this->docform->add(new DropDownChoice('store', Store::findArray("storename", "store_type = " . Store::STORE_TYPE_OPT)))->setChangeHandler($this, 'OnChangeStore');
     $this->docform->add(new AutocompleteTextInput('customer'))->setAutocompleteHandler($this, "OnAutoContragent");
     $this->docform->add(new CheckBox('isnds', true))->setChangeHandler($this, 'onIsnds');
     $this->docform->add(new CheckBox('cash'));
     $this->docform->add(new AutocompleteTextInput('contract'))->setAutocompleteHandler($this, "OnAutoContract");
     $this->docform->add(new SubmitLink('addrow'))->setClickHandler($this, 'addrowOnClick');
     $this->docform->add(new SubmitButton('savedoc'))->setClickHandler($this, 'savedocOnClick');
     $this->docform->add(new SubmitButton('execdoc'))->setClickHandler($this, 'savedocOnClick');
     $this->docform->add(new Button('backtolist'))->setClickHandler($this, 'backtolistOnClick');
     $this->docform->add(new Label('total'));
     $this->docform->add(new Label('totalnds'));
     $this->add(new Form('editdetail'))->setVisible(false);
     $this->editdetail->add(new TextInput('editquantity'))->setText("1");
     $this->editdetail->add(new TextInput('editprice'));
     $this->editdetail->add(new TextInput('editpricends'));
     $this->editdetail->add(new AutocompleteTextInput('edittovar'))->setAutocompleteHandler($this, "OnAutoItem");
     $this->editdetail->edittovar->setChangeHandler($this, 'OnChangeItem');
     $this->editdetail->add(new DropDownChoice('edittype', $this->_itemtype))->setChangeHandler($this, "OnItemType");
     $this->editdetail->add(new Label('qtystock'));
     $this->editdetail->add(new Button('cancelrow'))->setClickHandler($this, 'cancelrowOnClick');
     $this->editdetail->add(new SubmitButton('submitrow'))->setClickHandler($this, 'saverowOnClick');
     if ($docid > 0) {
         //загружаем   содержимок  документа настраницу
         $this->_doc = Document::load($docid);
         $this->docform->document_number->setText($this->_doc->document_number);
         //  $this->docform->nds->setText($this->_doc->headerdata['nds'] / 100);
         $this->docform->document_date->setDate($this->_doc->document_date);
         $this->docform->store->setValue($this->_doc->headerdata['store']);
         $this->docform->isnds->setChecked($this->_doc->headerdata['isnds']);
         $this->docform->cash->setChecked($this->_doc->headerdata['cash']);
         $this->docform->customer->setKey($this->_doc->headerdata['customer']);
         $this->docform->customer->setText($this->_doc->headerdata['customername']);
         $this->docform->contract->setKey($this->_doc->headerdata['contract']);
         $this->docform->contract->setText($this->_doc->headerdata['contractnumber']);
         foreach ($this->_doc->detaildata as $item) {
             $stock = new Stock($item);
             $this->_tovarlist[$stock->stock_id] = $stock;
         }
     } else {
         $this->_doc = Document::create('GoodsIssue');
         $this->docform->document_number->setText($this->_doc->nextNumber());
         if ($basedocid > 0) {
             //создание на  основании
             $basedoc = Document::load($basedocid);
             if ($basedoc instanceof Document) {
                 $this->_basedocid = $basedocid;
                 $this->docform->based->setText($basedoc->meta_desc . " №" . $basedoc->document_number);
                 if ($basedoc->meta_name == 'Invoice') {
                     $this->docform->customer->setKey($basedoc->headerdata['customer']);
                     $this->docform->customer->setText($basedoc->headerdata['customername']);
                     $this->docform->contract->setKey($basedoc->headerdata['contract']);
                     $this->docform->contract->setText($basedoc->headerdata['contractnumber']);
                     $this->docform->isnds->setChecked($basedoc->headerdata['isnds']);
                     foreach ($basedoc->detaildata as $item) {
                         $item = new Item($item);
                         //находим  последнюю партию по  первому складу
                         $options = $this->docform->store->getOptionList();
                         $keys = array_keys($options);
                         $stock = Stock::getFirst("closed <> 1 and group_id={$item->group_id} and item_id={$item->item_id} and store_id=" . $keys[0], 'stock_id', 'desc');
                         if ($stock instanceof Stock) {
                             $stock->quantity = $item->quantity;
                             //  $stock->partion = $item->priceopt;
                             //   $stock->group_id = $item->group_id;
                             $stock->pricends = $item->pricends;
                             $stock->price = $item->price;
                             $this->_tovarlist[$stock->stock_id] = $stock;
                         } else {
                             $this->setError('Не найден на складе  товар ' . $item->itemname);
                         }
                     }
                 }
             }
         }
     }
     $this->docform->add(new DataView('detail', new \Zippy\Html\DataList\ArrayDataSource(new \Zippy\Binding\PropertyBinding($this, '_tovarlist')), $this, 'detailOnRow'))->Reload();
 }
예제 #17
0
 public function __construct($docid = 0, $basedocid = 0)
 {
     parent::__construct();
     $this->add(new Form('docform'));
     $this->docform->add(new TextInput('document_number'));
     $this->docform->add(new Date('document_date'))->setDate(time());
     $this->docform->add(new DropDownChoice('employee', Employee::findArray('shortname')));
     $this->docform->add(new DropDownChoice('store', Store::findArray("storename", "store_type=" . Store::STORE_TYPE_OPT)));
     $this->docform->add(new DropDownChoice('expensetype', \ZippyERP\ERP\Entity\Doc\ExpenseReport::expenceList()))->setChangeHandler($this, 'OnExpenseList');
     $this->docform->add(new TextInput('expenseamount'))->setVisible(false);
     $this->docform->add(new CheckBox('isnds'))->setChangeHandler($this, 'onIsnds');
     $this->docform->add(new SubmitLink('addrow'))->setClickHandler($this, 'addrowOnClick');
     $this->docform->add(new Button('backtolist'))->setClickHandler($this, 'backtolistOnClick');
     $this->docform->add(new SubmitButton('savedoc'))->setClickHandler($this, 'savedocOnClick');
     $this->docform->add(new SubmitButton('execdoc'))->setClickHandler($this, 'savedocOnClick');
     $this->docform->add(new Label('totalnds'));
     $this->docform->add(new Label('total'));
     $this->add(new Form('editdetail'))->setVisible(false);
     $this->editdetail->add(new AutocompleteTextInput('edititem'))->setAutocompleteHandler($this, 'OnAutoItem');
     $this->editdetail->add(new TextInput('editquantity'))->setText("1");
     $this->editdetail->add(new TextInput('editprice'));
     $this->editdetail->add(new TextInput('editpricends'));
     $this->editdetail->add(new Button('cancelrow'))->setClickHandler($this, 'cancelrowOnClick');
     $this->editdetail->add(new SubmitButton('saverow'))->setClickHandler($this, 'saverowOnClick');
     // $this->editdetail->add(new SubmitLink('additem'))->setClickHandler($this, 'addItemOnClick');
     if ($docid > 0) {
         //загружаем   содержимок  документа настраницу
         $this->_doc = Document::load($docid);
         $this->docform->document_number->setText($this->_doc->document_number);
         $this->docform->expenseamount->setText(H::fm($this->_doc->headerdata['expenseamount']));
         $this->docform->isnds->setChecked($this->_doc->headerdata['isnds']);
         $this->docform->document_date->setDate($this->_doc->document_date);
         $this->docform->employee->setValue($this->_doc->headerdata['employee']);
         $this->docform->store->setValue($this->_doc->headerdata['store']);
         $this->docform->expensetype->setValue($this->_doc->headerdata['expensetype']);
         foreach ($this->_doc->detaildata as $item) {
             $item = new Item($item);
             $this->_itemlist[$item->item_id] = $item;
         }
         $val = $this->_doc->headerdata['expensetype'];
         if ($val == 201 || $val == 22 || $val == 281) {
             $this->docform->expenseamount->setVisible(false);
             $this->docform->store->setVisible(true);
             $this->docform->addrow->setVisible(true);
         } else {
             $this->docform->expenseamount->setVisible(true);
             $this->docform->store->setVisible(false);
             $this->docform->addrow->setVisible(false);
         }
     } else {
         $this->_doc = Document::create('ExpenseReport');
         /* if ($basedocid > 0) {  //создание на  основании
                       $basedoc = Document::load($basedocid);
                       if ($basedoc instanceof Document) {
                       $this->_basedocid = $basedocid;
         
         
                       /*
                       if ($basedoc->meta_name == 'PurchaseInvoice') {
                       $this->docform->isnds->setChecked($basedoc->headerdata['isnds']);
                       $this->docform->employee->setValue($basedoc->headerdata['employee']);
         
                       foreach ($basedoc->detaildata as $_item) {
                       $item = new Item($_item);
                       $this->_itemlist[$item->item_id] = $item;
                       }
                       }
                       }
                       } */
     }
     $this->docform->add(new DataView('detail', new \Zippy\Html\DataList\ArrayDataSource(new \Zippy\Binding\PropertyBinding($this, '_itemlist')), $this, 'detailOnRow'))->Reload();
     $this->add(new \ZippyERP\ERP\Blocks\Item('itemdetail', $this, 'OnItem'))->setVisible(false);
 }