public function OnAutoEmp($sender) { $text = $sender->getValue(); return Employee::findArray('fullname', "fullname like '%{$text}%' "); }
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 static function getAssignedList() { // return \ZippyERP\System\User::findArray('userlogin'); return \ZippyERP\ERP\Entity\Employee::findArray('shortname'); }
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); }