public function index() { $id = $this->_data['stitem_id']; $transaction = new STItem(); $transaction->load($id); $this->view->set('transaction', $transaction); $outside_ops = new MFOutsideOperationCollection($this->_templateobject); $sh = new SearchHandler($outside_ops, false); $cc = new ConstraintChain(); $cc->add(new Constraint('stitem_id', '=', $id)); $db = DB::Instance(); $date = Constraint::TODAY; $between = $date . ' BETWEEN ' . $db->IfNull('start_date', $date) . ' AND ' . $db->IfNull('end_date', $date); $cc->add(new Constraint('', '', '(' . $between . ')')); $sh->addConstraintChain($cc); $sh->setOrderby('op_no'); $outside_ops->load($sh); $this->view->set('outside_ops', $outside_ops); $this->view->set('linkfield', 'id'); $this->view->set('linkvaluefield', 'id'); $this->view->set('clickaction', 'view'); $this->view->set('clickcontroller', 'MFOutsideOperations'); $this->view->set('no_ordering', true); $sidebar = new SidebarController($this->view); $sidebar->addList('Show', array('allItems' => array('tag' => 'All Items', 'link' => array_merge($this->_modules, array('controller' => 'STItems', 'action' => 'index'))), 'thisItem' => array('tag' => 'Item Detail', 'link' => array_merge($this->_modules, array('controller' => 'STItems', 'action' => 'view', 'id' => $id))), 'addoperation' => array('tag' => 'Add Outside Operation', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'new', 'stitem_id' => $id))))); $this->view->register('sidebar', $sidebar); $this->view->set('sidebar', $sidebar); }
public static function getOutsideOperationCosts(ConstraintChain $cc, $type = 'latest') { $mfoutsideops = new MFOutsideOperationCollection(); $sh = new SearchHandler($mfoutsideops, false); $sh->addConstraintChain($cc); $fields = array('id', 'op_no', 'description', $type . '_osc'); $sh->setFields($fields); $sh->setOrderby('op_no'); $mfoutsideops->load($sh); return $mfoutsideops; }