public function FrmSaleOrder($frm = null) { $db = new Application_Model_DbTable_DbGlobal(); $db_table = new saleorder_Model_DbTable_DbSaleOrder(); $rs_table = $db_table->getAllTable(); $option_table = array('0' => $this->tr->translate("CHOOSE_TABLE")); foreach ($rs_table as $row) { $option_table[$row["tab_id"]] = $row["name_en"] . "-" . $row["name_km"]; } $table = new Zend_Form_Element_Select("table"); $table->setAttribs(array('class' => 'select validate[required]', 'style' => 'width:100%')); $table->setMultiOptions($option_table); $c_date = date('Y-m-d'); $date = new Zend_Form_Element_Text('date'); $date->setAttribs(array('id' => 'datepicker', 'style' => 'float:left;width:100%', 'class' => 'form-control')); $date->setValue($c_date); $row_customer = $db->getCustomer(); foreach ($row_customer as $rs_customer) { $option_cu[$rs_customer["customer_id"]] = $rs_customer["name_kh"] . "-" . $rs_customer["name_en"]; } $customer = new Zend_Form_Element_Select("customer"); $customer->setAttribs(array('class' => 'select validate[required]', 'style' => 'width:100%')); $customer->setMultiOptions($option_cu); $saleorder_num = $db_table->getSaleOrderNo(); $saleorder_no = new Zend_Form_Element_Text("saleorder_no"); $saleorder_no->setAttribs(array('class' => 'validate[required]', 'readOnly' => 'readOnly', 'style' => 'color:red')); $saleorder_no->setValue($saleorder_num); $row_currency_setting = $db->getSettingByCode(1); $currency = new Zend_Form_Element_Select("currency"); $currency->setAttribs(array('class' => 'validate[required]', 'style' => 'width:100%', 'onChange' => 'getRate();')); $row_currency = $db->getAllCurrency(); foreach ($row_currency as $rs_currency) { $option_currency[$rs_currency["cu_id"]] = $rs_currency["cu_name_km"] . "-" . $rs_currency["cu_name_en"]; } $currency->setValue($row_currency_setting); $currency->setMultiOptions($option_currency); $grand_total = new Zend_Form_Element_Text("gran_total"); $grand_total->setAttribs(array('class' => 'validate[required]')); $grand_pay = new Zend_Form_Element_Text("gran_pay"); $grand_pay->setAttribs(array('class' => 'validate[required]', 'onChange' => "doBalance();")); $balance = new Zend_Form_Element_Text("balance"); $balance->setAttribs(array('class' => 'validate[required]')); $this->addElements(array($balance, $grand_pay, $grand_total, $currency, $customer, $table, $date, $saleorder_no)); if ($frm != "") { $saleorder_no->setValue($frm["order_no"]); $customer->setValue($frm["customer_id"]); $currency->setValue($frm["currency_id"]); $date->setValue($frm["date"]); } return $this; }
public function FrmSearch($data = null) { $request = Zend_Controller_Front::getInstance()->getRequest(); $db = new Application_Model_DbTable_DbGlobal(); $search = new Zend_Form_Element_Text("txt_search"); $search->setValue($request->getParam("txt_search")); $start_date = new Zend_Form_Element_Text("start_date"); $c_date = date('Y-m-d'); $start_date->setAttribs(array('id' => 'datepicker', 'style' => 'float:left;width:100%', 'class' => 'form-control')); $_date_s = $request->getParam("start_date"); if (empty($_date_s)) { $_date_s = date('Y-m-d'); } $start_date->setValue($_date_s); $end_date = new Zend_Form_Element_Text("end_date"); $end_date->setAttribs(array('class' => 'datepicker', 'style' => 'width:100% !important')); $_date_t = $request->getParam("end_date"); if (empty($_date_t)) { $_date_t = date('Y-m-d'); } $end_date->setValue($_date_t); $pay_status = new Zend_Form_Element_Select("pay_status"); $options = array('-1' => $this->tr->translate("SELECT"), '1' => $this->tr->translate("FULL_PAID"), '2' => $this->tr->translate("BALANCE")); $pay_status->setMultiOptions($options); $pay_status->setValue($request->getParam("pay_status")); $option = array('-1' => $this->tr->translate("SELECT"), '1' => $this->tr->translate("ACTIVE"), '0' => $this->tr->translate("DEACTIVE")); $status = new Zend_Form_Element_Select("status"); $status->setMultiOptions($option); $status->setValue($request->getParam("status")); // Product Blog $cat_id = new Zend_Form_Element_Select("cat_id"); $cat_id->setAttribs(array('class' => 'select', 'style' => 'width:100%')); $category = $db->getAllProCategories(); $option_category = array(0 => $this->tr->translate("CHOOSE_CATEGORY")); foreach ($category as $row_cat) { $option_category[$row_cat["cat_id"]] = $row_cat["cat_name_km"] . " - " . $row_cat["cat_name_en"]; } $cat_id->setMultiOptions($option_category); $cat_id->setValue($request->getParam("cat_id")); $brand = new Zend_Form_Element_Select("brand"); $brand->setAttribs(array('class' => 'select', 'style' => 'width:100%')); $row_brand = $db->getAllBrand(); $option_brand = array(0 => $this->tr->translate("CHOOSE_BRAND")); foreach ($row_brand as $rs) { $option_brand[$rs["brand_id"]] = $rs["name_kh"] . " - " . $rs["name_en"]; } $brand->setMultiOptions($option_brand); $brand->setValue($request->getParam("brand")); // Sale Blog $row_cu = $db->getCustomer(); $option_cu = array(0 => $this->tr->translate("CHOOSE_CUSTOMER")); foreach ($row_cu as $rs_cu) { $option_cu[$rs_cu["customer_id"]] = $rs_cu["name_kh"] . "-" . $rs_cu["name_en"]; } $customer = new Zend_Form_Element_Select("customer"); $customer->setAttribs(array('class' => 'select', 'style' => 'width:100%')); $customer->setMultiOptions($option_cu); $customer->setValue($request->getParam("customer")); $row_order = $db->getOrderNo(); $option_order = array(-1 => $this->tr->translate("CHOOSE_ORDER_NO")); foreach ($row_order as $rs_order) { $option_order[$rs_order["so_id"]] = $rs_order["order_no"]; } $invoice_no = new Zend_Form_Element_Select("invoice_no"); $invoice_no->setAttribs(array('class' => 'select', 'style' => 'width:100%')); $invoice_no->setMultiOptions($option_order); $invoice_no->setValue($request->getParam("invoice_no")); // Purchase Blog $supplier = new Zend_Form_Element_Select("supplier"); $dbv = new phurchase_Model_DbTable_DbVendor(); $vendors = $dbv->getAllCate(); $option_vendor = array("" => ' - - - ជ្រើរើសអ្នកផ្គត់ផ្គង - - - ', -1 => " + បន្ថែមអ្នកផ្គត់ផ្គង"); foreach ($vendors as $row_vendors) { $option_vendor[$row_vendors["vendor_id"]] = $row_vendors["v_name"]; } $supplier = new Zend_Form_Element_Select("supplier"); $supplier->setMultiOptions($option_vendor); $supplier->setValue($request->getParam("supplier")); $row_pu = $db->getPurchaseNo(); $options = array("-1" => ' - - - ជ្រើរើសអ្នកលេខវិក៍យបត្រ - - - '); foreach ($row_pu as $rs) { $options[$rs["order_id"]] = $rs["order"]; } $purchase_no = new Zend_Form_Element_Select("purchase_no"); $purchase_no->setAttribs(array('class' => 'select', 'style' => 'width:100%')); $purchase_no->setMultiOptions($options); $purchase_no->setValue($request->getParam("purchase_no")); if ($data != null) { } return $this->addElements(array($search, $start_date, $end_date, $pay_status, $status, $cat_id, $brand, $customer, $invoice_no, $supplier, $purchase_no)); }