Пример #1
0
 public function OnChangeItem($sender)
 {
     $id = $sender->getKey();
     $stock = Stock::load($id);
     $item = Item::load($stock->item_id);
     $this->editdetail->editprice->setText(H::fm($stock->price));
     $this->editdetail->qtystock->setText(Stock::getQuantity($id, $this->docform->document_date->getDate()) / 1000 . ' ' . $stock->measure_name);
     $this->updateAjax(array('editprice', 'qtystock'));
 }
Пример #2
0
 public function itemlistOnRow($row)
 {
     $item = $row->getDataItem();
     $row->add(new Label('itemname', $item->itemname));
     $row->add(new Label('measure', $item->measure_name));
     $row->add(new Label('price', $item->price > 0 ? H::fm($item->price) : ''));
     $qty = Stock::getQuantity($item->stock_id, time());
     $f = Stock::getQuantityFuture($item->stock_id, time());
     $row->add(new Label('quantity', $qty / 1000));
     $row->add(new Label('quantityw', $f['w'] / 1000));
     $row->add(new Label('quantityr', $f['r'] / 1000));
     $row->add(new ClickLink('pcancel'))->setClickHandler($this, 'partionOnClick');
     $row->pcancel->setVisible(false);
     if ($qty == 0 && $f['w'] == 0 && $f['r'] == 0) {
         $row->pcancel->setVisible(true);
     }
 }
Пример #3
0
 public function updateActual()
 {
     $store_id = $this->docform->store->getValue();
     if ($store_id > 0) {
         $list = Stock::find("store_id = " . $store_id);
         //ишем  сток  со  спецтоваром
         foreach ($list as $stock) {
             $amount = Stock::getQuantity($stock->stock_id, $this->docform->document_date->getDate());
             $this->docform->actual->setText(H::fm($amount));
             $this->_doc->headerdata['stock_id'] = $stock->stock_id;
             return;
         }
     }
 }
Пример #4
0
 public function OnItemType($sender)
 {
     $stock_id = $this->editdetail->edittovar->getKey();
     $stock = Stock::load($stock_id);
     $this->editdetail->qtystock->setText(Stock::getQuantity($stock_id, $this->docform->document_date->getDate(), $this->editdetail->edittype->getValue()) / 1000 . ' ' . $stock->measure_name);
 }
Пример #5
0
 public function OnChangeItem($sender)
 {
     $stock_id = $sender->getKey();
     $stock = Stock::load($stock_id);
     $this->editdetail->qtystock->setText(Stock::getQuantity($stock_id, $this->docform->document_date->getDate(), $this->editdetail->edittype->getValue()) / 1000 . ' ' . $stock->measure_name);
     $store = Store::load($this->docform->storeto->getValue());
     if ($store->store_type == Store::STORE_TYPE_OPT) {
         // $this->editdetail->editprice->setText(H::fm($stock->price));
     } else {
         $item = Item::load($stock->item_id);
         $this->editdetail->editprice->setText(H::fm($item->priceret));
     }
     if ($store->store_type == Store::STORE_TYPE_RET) {
         //если  уже   есть  товар  в  магазине  берем  цену  оттуда
         $stock = Stock::getFirst("store_id={$store->store_id} and item_id={$stock->item_id} and closed <> 1");
         if ($stock instanceof Stock) {
             $this->editdetail->editprice->setText(H::fm($stock->price));
         }
     }
 }