public function getOrderList($_item_type = '', $_account = '')
 {
     if (isset($this->_data['ajax'])) {
         if (!empty($this->_data['item_type'])) {
             $_item_type = $this->_data['item_type'];
         }
         if (!empty($this->_data['account'])) {
             $_account = $this->_data['account'];
         }
     }
     switch ($_item_type) {
         case 'PO':
             $order = new POrder();
             $field = 'plmaster_id';
             break;
         case 'SI':
             $order = new SInvoice();
             $field = 'slmaster_id';
             break;
     }
     $cc = new ConstraintChain();
     $cc->add(new Constraint($field, '=', $_account));
     $db = DB::Instance();
     $subquery = 'select item_id from project_costs_charges where item_type=' . $db->qstr($_item_type);
     $cc->add(new Constraint('id', 'not in', '(' . $subquery . ')'));
     $orders = $order->getAll($cc);
     if (isset($this->_data['ajax'])) {
         $output['item_id'] = array('data' => $orders, 'is_array' => true);
         $this->view->set('data', $output);
         $this->setTemplateName('ajax_multiple');
     } else {
         return $orders;
     }
 }
예제 #2
0
파일: WebEdi.php 프로젝트: uzerpllp/uzerp
 public function getInvoiceExportList($_definition_id = '')
 {
     $invoice = new SInvoice();
     $collection = new SInvoiceCollection($invoice);
     $cc = new ConstraintChain();
     $cc->add(new Constraint('transaction_type', '=', 'I'));
     $cc->add(new Constraint('status', '=', 'O'));
     $cc->add(new Constraint('despatch_date', 'is not', 'NULL'));
     $cc->add(new Constraint('print_count', '=', '0'));
     $cc->add(new Constraint('invoice_method', '=', 'D'));
     $cc->add(new Constraint('edi_invoice_definition_id', '=', $_definition_id));
     $translog = new EDITransactionLog();
     $cc1 = new ConstraintChain();
     $cc1->add(new Constraint('status', '=', 'C'));
     $cc1->add(new Constraint('action', '=', 'S'));
     $cc1->add(new Constraint('data_definition_id', '=', $_definition_id));
     $cc1->add(new Constraint('internal_id', '=', '(' . $collection->getViewName() . '.id)'));
     $cc->add(new Constraint('not', 'exists', '(select id from ' . $translog->getTableName() . ' where ' . $cc1->__toString() . ')'));
     $invoice->orderby = 'invoice_number';
     //		echo 'cc='.$cc->__toString().'<br>';
     return $invoice->getAll($cc, false, true);
 }