コード例 #1
0
 function populate()
 {
     $invoices = new PInvoiceCollection();
     $invoices->setParams();
     $sh = new SearchHandler($invoices, FALSE);
     $sh->addConstraint(new Constraint('status', '=', 'Q'));
     $this->setSearchLimit($sh);
     $sh->setOrderBy('due_date');
     $invoices->load($sh);
     $this->contents = $invoices;
     // set vars
     $this->vars['type_label'] = 'Supplier';
     $this->vars['type_field'] = 'supplier';
     $this->vars['module'] = 'purchase_invoicing';
     $this->vars['controller'] = 'pinvoices';
 }
コード例 #2
0
ファイル: PLSupplier.php プロジェクト: uzerpllp/uzerp
 public function hasCurrentActivity()
 {
     $db = DB::Instance();
     // Check that no orders/invoices have been raised
     $model = DataObjectFactory::Factory('POrder');
     $collection = new POrderCollection($model);
     $sh = new SearchHandler($collection, FALSE);
     $sh->addConstraint(new Constraint('plmaster_id', '=', $this->id));
     $sh->addConstraint(new Constraint('status', 'NOT IN', '(' . $db->qstr($model->cancelStatus()) . ', ' . $db->qstr($model->invoiceStatus()) . ')'));
     if (count($collection->load($sh, null, RETURN_ROWS)) > 0) {
         return TRUE;
     }
     $model = DataObjectFactory::Factory('PInvoice');
     $collection = new PInvoiceCollection($model);
     $sh = new SearchHandler($collection, FALSE);
     $sh->addConstraint(new Constraint('plmaster_id', '=', $this->id));
     $sh->addConstraint(new Constraint('status', '!=', $model->paidStatus()));
     if (count($collection->load($sh, null, RETURN_ROWS)) > 0) {
         return TRUE;
     }
     $model = DataObjectFactory::Factory('PLTransaction');
     $collection = new PLTransactionCollection($model);
     $sh = new SearchHandler($collection, FALSE);
     $sh->addConstraint(new Constraint('plmaster_id', '=', $this->id));
     $sh->addConstraint(new Constraint('status', '!=', $model->paid()));
     if (count($collection->load($sh, null, RETURN_ROWS)) > 0) {
         return TRUE;
     }
     return FALSE;
 }
コード例 #3
0
 public function view_invoices()
 {
     if (isset($this->_data['Search']['productline_header_id'])) {
         $this->_data['id'] = $this->_data['Search']['productline_header_id'];
     }
     if (!isset($this->_data['id'])) {
         $this->DataError();
         sendBack();
     }
     $s_data = array();
     // Set context from calling module
     $s_data['productline_header_id'] = $this->_data['id'];
     $this->setSearch('productlinesSearch', 'supplierInvoices', $s_data);
     $this->view();
     // Now load the required data
     $invoices = new PInvoiceCollection();
     $invoices->setViewName('po_product_invoices');
     $sh = $this->setSearchHandler($invoices);
     parent::index($invoices, $sh);
     $this->view->set('clickmodule', array('purchase_invoicing'));
     $this->view->set('clickcontroller', 'pinvoices');
     $this->view->set('clickaction', 'view');
     $this->view->set('related_collection', $invoices);
     $this->setTemplateName('view_related');
 }