Example #1
0
 /**
  *
  * @param mixed $docid  Документ  должен  быть  показан  в  просмотре
  * @return DocList
  */
 public function __construct($docid = 0)
 {
     parent::__construct();
     $filter = Filter::getFilter("SupplierOrderList");
     $this->add(new Form('filter'))->setSubmitHandler($this, 'filterOnSubmit');
     $this->filter->add(new DropDownChoice('statelist', SupplierOrder::getStatesList()));
     $this->filter->add(new DropDownChoice('supplierlist', Customer::findArray('customer_name')));
     $this->filter->add(new CheckBox('notpayed'));
     if (strlen($filter->state) > 0) {
         $this->filter->statelist->setValue($filter->state);
     }
     if (strlen($filter->supplier) > 0) {
         $this->filter->supplierlist->setValue($filter->supplier);
     }
     $this->filter->notpayed->setChecked($filter->notpayed);
     $doclist = $this->add(new DataView('doclist', new DocSODataSource(), $this, 'doclistOnRow'));
     $doclist->setSelectedClass('success');
     $doclist->Reload();
     $this->add(new \ZippyERP\ERP\Blocks\DocView('docview'))->setVisible(false);
     if ($docid > 0) {
         $this->docview->setVisible(true);
         $this->docview->setDoc(Document::load($docid));
         $this->doclist->setSelectedRow($docid);
         $doclist->Reload();
     }
     $this->add(new \Zippy\Html\DataList\Paginator('pag', $doclist));
 }
Example #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'))->setDate(time());
     $this->docform->add(new Date('timeline'))->setDate(time() + 3 * 24 * 3600);
     $this->docform->add(new AutocompleteTextInput('supplier'))->setAutocompleteHandler($this, "OnAutoCont");
     $this->docform->add(new DropDownChoice('orderstate', \ZippyERP\ERP\Entity\Doc\SupplierOrder::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->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');
     if ($docid > 0) {
         //загружаем   содержимок  документа настраницу
         $this->_doc = Document::load($docid);
         $this->docform->document_number->setText($this->_doc->document_number);
         $this->docform->total->setText(H::fm($this->_doc->total));
         $this->docform->timeline->setDate($this->_doc->headerdata['timeline']);
         $this->docform->document_date->setDate($this->_doc->document_date);
         $this->docform->supplier->setKey($this->_doc->headerdata['supplier']);
         $this->docform->supplier->setText($this->_doc->headerdata['suppliername']);
         $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('SupplierOrder');
     }
     $this->docform->add(new DataView('detail', new \Zippy\Html\DataList\ArrayDataSource(new \Zippy\Binding\PropertyBinding($this, '_itemlist')), $this, 'detailOnRow'))->Reload();
 }