Beispiel #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));
 }
Beispiel #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 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());
     }
 }
Beispiel #3
0
 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}%' ");
     }
 }
Beispiel #4
0
 public function OnAutoCont($sender)
 {
     $text = $sender->getValue();
     return Customer::findArray('customer_name', "customer_name like '%{$text}%' and ( cust_type=" . Customer::TYPE_BUYER . " or cust_type= " . Customer::TYPE_BUYER_SELLER . " )");
 }
Beispiel #5
0
 public function OnAutoContragent($sender)
 {
     $text = $sender->getValue();
     return Customer::findArray('customer_name', "customer_name like '%{$text}%' ");
 }
Beispiel #6
0
 public function OnAutoContragent($sender)
 {
     $type = $this->editdetail->editoptype->getValue();
     $text = $sender->getValue();
     $where = "";
     if ($type == BS::IN) {
         //если  приход то  продавцы
         $where = "  and ( cust_type=" . Customer::TYPE_BUYER . " or cust_type= " . Customer::TYPE_BUYER_SELLER . " )";
     }
     if ($type == BS::OUT) {
         //если  расход  то  покупатели
         $where = "  and ( cust_type=" . Customer::TYPE_SELLER . " or cust_type= " . Customer::TYPE_BUYER_SELLER . " )";
     }
     if ($type == BS::TAX) {
         // оплата  налогов  и  сборов
         $where = "  and  cust_type=" . Customer::TYPE_GOV;
     }
     return Customer::findArray('customer_name', "customer_name like '%{$text}%'  " . $where);
 }