Esempio n. 1
0
 function populate()
 {
     $orders = new POrderLineCollection();
     $orders->setParams();
     $sh = new SearchHandler($orders, false);
     $sh->addConstraint(new Constraint('status', 'in', "('A','P')"));
     $sh->addConstraint(new Constraint('order_status', '!=', "X"));
     $sh->addConstraint(new Constraint('due_delivery_date', '<', fix_date(date(DATE_FORMAT))));
     $this->setSearchLimit($sh);
     $sh->setOrderBy(array('due_delivery_date', 'id'));
     $orders->load($sh);
     $this->contents = $orders;
 }
 public function viewAwaitingDelivery()
 {
     $s_data = array();
     // Set context from calling module
     if (isset($this->_data['plmaster_id'])) {
         $s_data['plmaster_id'] = $this->_data['plmaster_id'];
     }
     if (isset($this->_data['stitem_id'])) {
         $s_data['stitem_id'] = $this->_data['stitem_id'];
     }
     if (isset($this->_data['order_id'])) {
         $s_data['order_id'] = $this->_data['order_id'];
     }
     $this->setSearch('pogoodsreceivedSearch', 'confirmReceipt', $s_data);
     $s_data['plmaster_id'] = $this->search->getValue('plmaster_id');
     $s_data['stitem_id'] = $this->search->getValue('stitem_id');
     $s_data['order_id'] = $this->search->getValue('order_id');
     $orderlines = new POrderLineCollection(DataObjectFactory::Factory('POrderLine'));
     if ($s_data['plmaster_id'] > 0 || $s_data['stitem_id'] > 0 || $s_data['order_id'] > 0) {
         if (isset($this->_data['orderby'])) {
             $sh = new SearchHandler($orderlines, true);
         } else {
             $sh = new SearchHandler($orderlines, false);
         }
         $sh->extract();
         $sh->setLimit('');
         $sh->addConstraint(new Constraint('status', 'in', "('A','P')"));
         if ($s_data['plmaster_id'] > 0) {
             $sh->addConstraint(new Constraint('plmaster_id', '=', $s_data['plmaster_id']));
         }
         if ($s_data['stitem_id'] > 0) {
             $sh->addConstraint(new Constraint('stitem_id', '=', $s_data['stitem_id']));
         }
         if ($s_data['order_id'] > 0) {
             $sh->addConstraint(new Constraint('order_id', '=', $s_data['order_id']));
         }
         $DisplayFields = array('id');
         foreach ($orderlines->getFields() as $field => $attr) {
             if (!$attr->ignoreField) {
                 $DisplayFields[] = $field;
             }
         }
         $DisplayFields[] = 'receive_action';
         $sh->setFields($DisplayFields);
         $orderlines->load($sh);
         $this->view->set('num_records', $orderlines->num_records);
         foreach ($orderlines as $orderline) {
             $orderline->getAction();
             $orderline->whaction_id = $orderline->receive_action;
             $orderline->from_location_id = $orderline->getFromLocation($orderline->receive_action);
             $orderline->to_location_id = $orderline->getToLocation($orderline->receive_action);
             $whlocation = DataObjectFactory::Factory('WHLocation');
             $whlocation->load($orderline->to_location_id);
             if ($whlocation->isLoaded()) {
                 $orderline->to_location = $whlocation->whstore . '/' . $whlocation->description;
             } else {
                 $orderline->to_location = '';
             }
             $orderline->to_bin_list = $orderline->getToBin($orderline->receive_action);
         }
     }
     $this->_templateName = $this->getTemplateName('confirmreceipt');
     $this->view->set('porderlines', $orderlines);
     $sidebar = new SidebarController($this->view);
     $actions = array();
     $actions['viewnotes'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'index'), 'tag' => 'view goods received notes');
     $sidebar->addList('Actions', $actions);
     $this->view->set('page_title', $this->getPageName('Confirm Delivery of Order', ''));
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
     // Override output button - there is no point to it here
     $this->printaction = '';
 }
Esempio n. 3
0
 public function getPOstructures()
 {
     // This gets all Purchase Order Lines
     if ($this->postructures) {
         return $this->postructures;
     }
     $polines = new POrderLineCollection();
     $polines->_tablename = 'po_structure_lines';
     $sh = new SearchHandler($polines, false);
     $sh->addConstraint(new Constraint('ststructure_id', '=', $this->id));
     $sh->addConstraint(new Constraint('status', 'in', "('A', 'N', 'O', 'P')"));
     $sh->setOrderby('due_delivery_date');
     $polines->load($sh);
     if ($polines) {
         $this->postructures = $polines;
         return $this->postructures;
     } else {
         return array();
     }
 }