public static function confirmReceipt($search_data = null, &$errors = array(), $defaults = null) { $search = new pogoodsreceivedSearch($defaults); // Search by Customer $search->addSearchField('plmaster_id', 'Supplier', 'select', 0); $supplier = new PLSupplier(); $options = array('0' => 'Select Supplier'); $suppliers = $supplier->getAll(null, false, true); $options += $suppliers; $search->setOptions('plmaster_id', $options); // Search by Stock Item $search->addSearchField('stitem_id', 'Stock Item', 'select', 0); $stitems = new STItem(); $options = array('0' => 'All'); $stitems = $stitems->getAll(); $options += $stitems; $search->setOptions('stitem_id', $options); // Search by Order Number $search->addSearchField('order_id', 'order_number', 'select', 0); $orderlines = new POrder(); $cc = new ConstraintChain(); $cc->add(new Constraint('status', 'in', "('A','O','P')")); $orderlines->orderby = 'order_number'; $options = array('0' => 'All'); $orderlines = $orderlines->getAll($cc); $options += $orderlines; $search->setOptions('order_id', $options); $search->setSearchData($search_data, $errors, 'confirmReceipt'); // Do not save the order_id // - if the order is confirmed, then it will not be in the list on re-query if (isset($_SESSION['searches'][get_class($search)]['confirmReceipt']['order_id'])) { unset($_SESSION['searches'][get_class($search)]['confirmReceipt']['order_id']); } return $search; }
public static function purchaseOrders($search_data = null, &$errors, $defaults = null) { $search = new ProjectcostchargeSearch($defaults); $search->addSearchField('project_id', 'project_id', 'hidden', '', 'hidden', false); $search->addSearchField('plmaster_id', 'Supplier', 'select'); $account = new PLSupplier(); $accounts = $account->getAll(); $options = array('' => 'All'); $options += $accounts; $search->setOptions('plmaster_id', $options); $search->addSearchField('order_id', 'Orders', 'select'); $unassigned_list = new POrderLine(); $unassigned_list->idField = 'order_id'; $unassigned_list->identifierField = 'order_number'; $cc = new ConstraintChain(); $subquery = "select item_id from project_costs_charges where item_type='PO'"; $cc->add(new Constraint('id', 'not in', '(' . $subquery . ')')); $search->setOptions('order_id', $unassigned_list->getAll($cc, false, true)); $search->setSearchData($search_data, $errors); return $search; }