예제 #1
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 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());
     }
 }
예제 #2
0
 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();
 }
예제 #3
0
 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;
             }
         }
     }
 }
예제 #4
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('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());
     }
 }
예제 #5
0
파일: invoice.php 프로젝트: Niqpue/zippyerp
 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 Date('paydate'))->setDate(strtotime("+7 day", time()));
     $this->docform->add(new CheckBox('isnds'))->setChangeHandler($this, 'onIsnds');
     $this->docform->add(new AutocompleteTextInput('customer'))->setAutocompleteHandler($this, "OnAutoContragent");
     $this->docform->add(new AutocompleteTextInput('contract'))->setAutocompleteHandler($this, "OnAutoContract");
     $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('total'));
     $this->docform->add(new Label('totalnds'));
     $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('editpricends'));
     $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);
         if ($this->_doc == null) {
             App::RedirectError('Докумен не найден');
         }
         $this->docform->document_number->setText($this->_doc->document_number);
         $this->docform->isnds->setChecked($this->_doc->headerdata['isnds']);
         $this->docform->document_date->setDate($this->_doc->document_date);
         $this->docform->paydate->setDate($this->_doc->headerdata['payment_date']);
         $this->docform->customer->setKey($this->_doc->headerdata['customer']);
         $this->docform->customer->setValue($this->_doc->headerdata['customername']);
         $this->docform->contract->setKey($this->_doc->headerdata['contract']);
         $this->docform->contract->setValue($this->_doc->headerdata['contractnumber']);
         foreach ($this->_doc->detaildata as $item) {
             $item = new Item($item);
             $this->_tovarlist[$item->item_id] = $item;
         }
         $this->calcTotal();
     } else {
         $this->_doc = Document::create('Invoice');
         $this->docform->document_number->setText($this->_doc->nextNumber());
         if ($basedocid > 0) {
             //создание на  основании
             $basedoc = Document::load($basedocid);
             if ($basedoc instanceof Document) {
                 $this->_basedocid = $basedocid;
                 $this->docform->base->setText($basedoc->meta_desc . " №" . $basedoc->document_number);
                 if ($basedoc->meta_name == 'CustomerOrder') {
                     $nds = H::nds(true);
                     // если  в  заказе   цена  с  НДС  получаем  базовую  цену
                     $this->docform->customer->setKey($basedoc->headerdata['customer']);
                     $this->docform->customer->setText($basedoc->headerdata['customername']);
                     $this->docform->contract->setKey($basedoc->document_id);
                     $this->docform->contract->setText($basedoc->document_number);
                     foreach ($basedoc->detaildata as $item) {
                         $item = new Item($item);
                         $item->pricends = $item->price;
                         $item->price = $item->price - $item->price * $nds;
                         $this->_tovarlist[$item->item_id] = $item;
                     }
                 }
                 if ($basedoc->meta_name == 'ReturnGoodsReceipt') {
                     $this->docform->customer->setKey($basedoc->headerdata['customer']);
                     $this->docform->customer->setText($basedoc->headerdata['customername']);
                     $this->docform->contract->setKey($basedoc->headerdata['contract']);
                     $this->docform->contract->setText($basedoc->headerdata['contractnumber']);
                     $this->docform->isnds->setChecked($basedoc->headerdata['isnds']);
                     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();
 }