public static function useDefault($search_data = null, &$errors = array(), $defaults = null) { $search = new sodespatchSearch($defaults); // Search by Customer $search->addSearchField('slmaster_id', 'Customer', 'select', 0, 'advanced'); $customer = new SLCustomer(); $options = array('0' => 'All'); $customers = $customer->getAll(null, false, true); $options += $customers; $search->setOptions('slmaster_id', $options); // Search by Stock Item $search->addSearchField('stitem_id', 'Stock Item', 'select', 0, 'advanced'); $stitems = new STItem(); $options = array('0' => 'All'); $stitems = $stitems->getAll(); $options += $stitems; $search->setOptions('stitem_id', $options); // Search by Despatch Number $search->addSearchField('despatch_number', 'despatch_number', 'equal', '', 'advanced'); // Search by Order Number $search->addSearchField('order_number', 'order_number', 'equal', '', 'advanced'); // Search by Invoice Number $search->addSearchField('invoice_number', 'invoice_number', 'equal', '', 'advanced'); // Search by Despatch Date $search->addSearchField('despatch_date', 'despatch_date_between', 'between', '', 'advanced'); // Search by Status $search->addSearchField('status', 'status', 'select', 'N', 'basic'); $options = array('' => 'All', 'N' => 'New', 'D' => 'Despatched', 'X' => 'Cancelled'); $search->setOptions('status', $options); $search->setSearchData($search_data, $errors); return $search; }
private function default_fields($search_data) { $slcustomer = new SLCustomer(); // Name $this->addSearchField('name', 'name_contains', 'contains'); // Search by Active/Inactive Status $this->addSearchField('date_inactive', 'Show Customers', 'null', 'null', 'advanced'); $options = array('' => 'All', 'not null' => 'Inactive', 'null' => 'Active'); $this->setOptions('date_inactive', $options); // Currency $this->addSearchField('currency_id', 'currency', 'select', '', 'advanced'); $currency = new Currency(); $currency_list = $currency->getAll(); $options = array('' => 'All'); $options += $currency_list; $this->SetOptions('currency_id', $options); // Remittance $this->addSearchField('statement', 'statement', 'select', '', 'advanced'); $options = array('' => 'All', 'TRUE' => 'Yes', 'FALSE' => 'No'); $this->setOptions('statement', $options); // Invoice Method $this->addSearchField('invoice_method', 'invoice_method', 'select', '', 'advanced'); $options = array_merge(array('' => 'All'), $slcustomer->getEnumOptions('invoice_method')); $this->setOptions('invoice_method', $options); // Payment Type $this->addSearchField('payment_type_id', 'payment_type', 'select', '', 'advanced'); $payment_type = new PaymentType(); $options = array('' => 'All'); $options += $payment_type->getAll(); $this->setOptions('payment_type_id', $options); // Payment Terms $this->addSearchField('payment_term_id', 'payment_term', 'select', '', 'advanced'); $payment_term = new PaymentTerm(); $options = array('' => 'All'); $options = $payment_term->getAll(); asort($options); $options = array('' => 'All') + $options; $this->setOptions('payment_term_id', $options); // SL Anaylsis $this->addSearchField('sl_analysis_id', 'sl_analysis', 'select', '', 'advanced'); $sl_analysis = new SLAnalysis(); $options = array('' => 'All'); $options += $sl_analysis->getAll(); $this->setOptions('sl_analysis_id', $options); // Account Status $this->addSearchField('account_status', 'account_status', 'select', '', 'advanced'); $options = array_merge(array('' => 'All'), $slcustomer->getEnumOptions('account_status')); $this->setOptions('account_status', $options); }
function populate() { $pl = new PageList('my_customers'); $customers = new SLCustomerCollection(new SLCustomer()); // Either get data from a function that returns a collection // $customers->getUnassignedCompanies(); // Or construct a collection from a sql query $db = DB::Instance(); $query = 'select id, * from slmaster where usercompanyid=' . EGS_COMPANY_ID . ' limit 10'; $results = $db->getAssoc($query); foreach ($results as $id => $row) { $customer = new SLCustomer(); $customer->_data = $row; $customer->load($id); $customer->id = $id; $customers->add($customer); } $pl->addFromCollection($customers, array('module' => 'sales_ledger', 'controller' => 'slcustomers', 'action' => 'view'), array('id'), '', 'name'); $this->contents = $pl->getPages()->toArray(); }
public static function useDefault($search_data = null, &$errors = array(), $defaults = null) { $search = new SLDiscountSearch($defaults); // Customer $search->addSearchField('slmaster_id', 'Customer', 'select', 0, 'advanced'); $customer = new SLCustomer(); $options = array('0' => 'All'); $customers = $customer->getAll(null, false, true); $options += $customers; $search->setOptions('slmaster_id', $options); // Product Group $search->addSearchField('prod_group_id', 'Product Group', 'select', '', 'advanced'); $prodgroup = new STProductgroup(); $prodgroup_list = $prodgroup->getAll(); $options = array('' => 'All'); $options += $prodgroup_list; $search->setOptions('prod_group_id', $options); // Execute Search $search->setSearchData($search_data, $errors); return $search; }
public function getAccountList($_item_type = '', $_account = '') { if (isset($this->_data['ajax'])) { if (!empty($this->_data['item_type'])) { $_item_type = $this->_data['item_type']; } } switch ($_item_type) { case 'PO': $account = new PLSupplier(); break; case 'SI': $account = new SLCustomer(); break; } $accounts = $account->getAll(); if (isset($this->_data['ajax'])) { $output['account'] = array('data' => $accounts, 'is_array' => true); $this->view->set('data', $output); $this->setTemplateName('ajax_multiple'); } else { return $orders; } }