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 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()); } }
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 ddocOnClick($sender) { $item = $sender->getOwner()->getDataItem(); $this->doclist->dlist->setSelectedRow($item->getID()); $this->doclist->dlist->Reload(); $this->docview->setVisible(true); $this->docview->setDoc(\ZippyERP\ERP\Entity\Doc\Document::load($item->document_id)); }
public function showOnClick($sender) { $item = $sender->owner->getDataItem(); $this->docview->setVisible(true); $this->docview->setDoc(\ZippyERP\ERP\Entity\Doc\Document::load($item->document_id)); $this->entrylist->setSelectedRow($item->entry_id); $this->entrylist->Reload(); }
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($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(); }
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 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()); } }
public function generateReport() { $i = 1; $detail = array(); $total = 0; foreach ($this->detaildata as $value) { $detail[] = array("no" => $i++, "date" => "", "tovar_name" => $value['itemname'], "tovar_code" => "", "measure_name" => $value['measure_name'], "measure_code" => $value['measure_code'], "quantity" => $value['quantity'] / 1000, "price" => H::fm($value['price']), "pricends" => H::fm($value['pricends']), "amount" => H::fm($value['quantity'] / 1000 * $value['price'])); $total += $value['quantity'] / 1000 * $value['price']; } $firm = System::getOptions("firmdetail"); $customer = \ZippyERP\ERP\Entity\Customer::load($this->headerdata["customer"]); $contract = Document::load($this->headerdata["contract"]); if ($contract instanceof Document) { $contractnumber = $contract->document_number; $contractname = $contract->meta_desc; $contractdate = date('dmY', $contract->document_date); } $header = array('date' => date('dmY', $this->document_date), "firmname" => $firm['name'], "firmcode" => H::addSpaces($firm['inn']), "customername" => $customer->customer_name, "customercode" => H::addSpaces($customer->inn), "saddress" => $firm['street'] . ',' . $firm['city'], "baddress" => $customer->street . ',' . $customer->city, "sphone" => H::addSpaces($firm['phone']), "bphone" => H::addSpaces($customer->phone), "contractname" => $contractname, "contractdate" => H::addSpaces($contractdate), "contractnumber" => $contractnumber, "paytype" => $this->headerdata["paytype"], "document_number" => $this->document_number, "totalnds" => H::fm($this->headerdata["totalnds"]), "total" => H::fm($total), "totalall" => H::fm($total + $this->headerdata["totalnds"])); $report = new \ZippyERP\ERP\Report('taxinvoice.tpl'); $html = $report->generate($header, $detail); return $html; }
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(); }
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'); } }
public function editOnClick($sender) { $this->_project = $sender->owner->getDataItem(); $this->edittab->editform->editprojectname->setText($this->_project->projectname); $this->edittab->editform->editdesc->setText($this->_project->description); $this->edittab->editform->editbase->setKey($this->_project->doc_id); $this->edittab->editform->editbase->setValue(Document::load($this->_project->doc_id)->document_number); if ($this->_project->start_date > 0) { $this->edittab->editform->editstartdate->setText(date('Y-m-d', $this->_project->start_date)); } else { $this->edittab->editform->editstartdate->setText(''); } if ($this->_project->end_date > 0) { $this->edittab->editform->editenddate->setText(date('Y-m-d', $this->_project->end_date)); } else { $this->edittab->editform->editenddate->setText(''); } $this->listtab->setVisible(false); $this->edittab->setVisible(true); $this->updateFiles(); $this->updateMessages(); }
protected function init() { parent::init(); }
public function OnAutoContract($sender) { $text = $sender->getValue(); return Document::findArray('document_number', "document_number like '%{$text}%' and ( meta_name='Contract' or meta_name='SupplierOrder' )"); }
public function getItems($start, $count, $sortfield = null, $asc = null) { return Document::find($this->getWhere(), "created ", "desc"); }
public function OnDocChange($sender) { $id = $sender->getKey(); $doc = Document::load($id); if ($doc instanceof Document) { $this->editdetail->editamount->setText(H::fm($doc->amount)); $this->editdetail->editnds->setText(H::fm($doc->headerdata['nds'])); } $this->updateAjax(array('editnds', 'editamount')); }
protected function init() { parent::init(); $this->datatag = 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()); } }
protected function init() { parent::init(); $this->datatag = 0; //контрагент }
/** * Возвращает следующий номер при автонумерации * */ public function nextNumber() { $class = explode("\\", get_called_class()); $metaname = $class[count($class) - 1]; $doc = Document::getFirst("meta_name='" . $metaname . "'", "document_id desc"); if ($doc == null) { return ''; } $prevnumber = $doc->document_number; if (strlen($prevnumber) == 0) { return ''; } $number = preg_replace('/[^0-9]/', '', $prevnumber); if (strlen($number) == 0) { $number = 0; } $letter = preg_replace('/[0-9]/', '', $prevnumber); return $letter . sprintf("%05d", ++$number); }
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); }
public function invoiceOnClick($sender) { $customer = $sender->getOwner()->getDataItem(); $this->invoicelist->custname2->setText($customer->customer_name); $this->_ilist = Document::find('datatag=' . $customer->customer_id . " and (meta_name='Invoice' or meta_name='PurchaseInvoice') and state <> " . Document::STATE_CLOSED . " and state <> " . Document::STATE_EXECUTED, 'document_id asc'); $this->invoicelist->ilist->Reload(); $this->clistpanel->setVisible(false); $this->invoicelist->setVisible(true); }
public function saverowOnClick($sender) { $id = $this->editdetail->edititem->getKey(); if ($id == 0) { $this->setError("Не выбран ТМЦ"); return; } $stock = Stock::load($id); $stock->quantity = 1000 * $this->editdetail->editquantity->getText(); $stock->price = 100 * $this->editdetail->editprice->getText(); $stock->type = $this->editdetail->edittype->getValue(); $doc = Document::getFirst("meta_name ='MoveItem' and state=" . Document::STATE_EXECUTED . " and content like '%<item_id>{$stock->item_id}</item_id>%'"); if ($doc == null) { $this->setWarn('Не найден документ перемещения со склада с таким ТМЦ'); } $store = Store::load($this->docform->storefrom->getValue()); // $fromstock = Stock::getStock($this->docform->storefrom->getValue(),$stock->item_id,$stock->price,false); $stockfrom = Stock::getFirst("store_id={$store->store_id} and item_id={$stock->item_id} and price={$stock->price} and partion={$stock->partion} and closed <> 1"); if ($stockfrom == null && $store->store_type == Store::STORE_TYPE_RET) { $this->setError('Товар с такой ценой и партией не найден в магазине'); return; } $this->_itemlist[$stock->stock_id] = $stock; $this->editdetail->setVisible(false); $this->docform->setVisible(true); $this->docform->detail->Reload(); //очищаем форму $this->editdetail->edititem->setKey(0); $this->editdetail->edititem->setText(''); $this->editdetail->editquantity->setText("1"); $this->editdetail->editprice->setText(""); }
public function getItems($start, $count, $sortfield = null, $asc = null) { $docs = Document::find($this->getWhere(), "created ", "desc", $count, $start); //$l = Traversable::from($docs); //$l = $l->where(function ($doc) {return $doc->document_id == 169; }) ; //$l = $l->select(function ($doc) { return $doc; })->asArray() ; return $docs; }