Exemplo n.º 1
0
 /**
  *
  * @param mixed $docid  Документ  должен  быть  показан  в  просмотре
  * @return DocList
  */
 public function __construct($docid = 0)
 {
     parent::__construct();
     $filter = Filter::getFilter("CustomerOrderList");
     $this->add(new Form('filter'))->setSubmitHandler($this, 'filterOnSubmit');
     $this->filter->add(new DropDownChoice('statelist', CustomerOrder::getStatesList()));
     $this->filter->add(new DropDownChoice('customerlist', Customer::findArray('customer_name')));
     $this->filter->add(new CheckBox('notpayed'));
     if (strlen($filter->state) > 0) {
         $this->filter->statelist->setValue($filter->state);
     }
     if (strlen($filter->customer) > 0) {
         $this->filter->customerlist->setValue($filter->customer);
     }
     $this->filter->notpayed->setChecked($filter->notpayed);
     $doclist = $this->add(new DataView('doclist', new DocCODataSource(), $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));
 }
Exemplo n.º 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('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();
 }