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(); }
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()); } }
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(); }
public function __construct() { parent::__construct(); $this->add(new Form('filter'))->setSubmitHandler($this, 'OnSubmit'); $this->filter->add(new Date('from', time() - 7 * 24 * 3600)); $this->filter->add(new Date('to', time())); $this->filter->add(new DropDownChoice('store', Store::findArray("storename", ""))); $this->filter->add(new AutocompleteTextInput('item'))->setAutocompleteHandler($this, 'OnAutoItem'); $this->add(new Panel('detail'))->setVisible(false); $this->detail->add(new RedirectLink('print', "movereport")); $this->detail->add(new RedirectLink('html', "movereport")); $this->detail->add(new RedirectLink('word', "movereport")); $this->detail->add(new RedirectLink('excel', "movereport")); $this->detail->add(new Label('preview')); }
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()); } }
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(); }
public function opdetailOnAutocomplete($sender) { $text = $sender->getValue(); $optype = $this->docform->optype->getValue(); if ($optype == CRIN::TYPEOP_CUSTOMER) { return Customer::findArray('customer_name', "customer_name like '%{$text}%' and ( cust_type=" . Customer::TYPE_BUYER . " or cust_type= " . Customer::TYPE_BUYER_SELLER . " )"); } if ($optype == CRIN::TYPEOP_BANK) { return MoneyFund::findArray('title', "title like '%{$text}%' "); } if ($optype == CRIN::TYPEOP_CASH) { return Employee::findArray('fullname', "fullname like '%{$text}%' "); } if ($optype == CRIN::TYPEOP_RET) { return Store::findArray('storename', "storename like '%{$text}%' and (store_type = " . Store::STORE_TYPE_RET . ' or store_type=' . Store::STORE_TYPE_RET_SUM . ") "); } }
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); }