public function opdetailOnAutocomplete($sender) { $text = $sender->getValue(); $optype = $this->docform->optype->getValue(); if ($optype == CROUT::TYPEOP_CUSTOMER) { return Customer::findArray('customer_name', "customer_name like '%{$text}%' and ( cust_type=" . Customer::TYPE_SELLER . " or cust_type= " . Customer::TYPE_BUYER_SELLER . " )"); } if ($optype == CROUT::TYPEOP_BANK) { return MoneyFund::findArray('title', "title like '%{$text}%' "); } if ($optype == CROUT::TYPEOP_CASH) { return Employee::findArray('fullname', "fullname like '%{$text}%' "); } }
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; } } } }
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(); }
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()); } }