Ejemplo n.º 1
0
 public function purchaseAction()
 {
     $db = new report_Model_DbTable_DbReport();
     $db_global = new Application_Model_DbTable_DbGlobal();
     $form = new report_Form_FrmReport();
     $itemRows = $db_global->getProductOption();
     $this->view->itemsOption = $itemRows;
     $company_name = $db_global->getSettingByCode(4);
     $slogan = $db_global->getSettingByCode(5);
     $address = $db_global->getSettingByCode(2);
     $tel = $db_global->getSettingByCode(3);
     $qty_warning = $db_global->getSettingByCode(6);
     $this->view->company_name = $company_name;
     $this->view->slogan = $slogan;
     $this->view->address = $address;
     $this->view->tel = $tel;
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         $search = array('txt_search' => $data['txt_search'], 'start_date' => $data['start_date'], 'end_date' => $data['end_date'], 'status' => $data['status'], 'supplier' => $data['supplier'], 'pay_status' => $data['pay_status'], 'purchase_no' => $data['purchase_no']);
     } else {
         $search = array('txt_search' => '', 'start_date' => date('Y-m-d'), 'end_date' => date('Y-m-d'), 'status' => -1, 'supplier' => -1, 'pay_status' => -1, 'purchase_no' => -1);
     }
     $sale = $db->getPurchase($search);
     $this->view->sale = $sale;
     $this->view->frm = $form->FrmSearch();
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
 public function poseditAction()
 {
     $id = $this->getRequest()->getParam('id');
     $db = new saleorder_Model_DbTable_DbSaleOrder();
     $db_global = new Application_Model_DbTable_DbGlobal();
     $session = $session_user = new Zend_Session_Namespace('auth');
     $user_id = $session_user->fullname;
     $this->view->user = $user_id;
     $qty_warning = $db_global->getSettingByCode(6);
     $this->view->qty_warning = $qty_warning;
     $row_sale_order = $db_global->getSaleOrderById($id);
     $row_sale_order_detail = $db_global->getSaleOrderDetail($id);
     $this->view->data_sale_order = $row_sale_order_detail;
     $form = new saleorder_Form_FrmSaleOrder();
     $this->view->frm = $form->FrmSaleOrder($row_sale_order);
     $currency_setting = $db_global->getSettingByCode(1);
     $company_name = $db_global->getSettingByCode(4);
     $slogan = $db_global->getSettingByCode(5);
     $address = $db_global->getSettingByCode(2);
     $tel = $db_global->getSettingByCode(3);
     $this->view->currency_setting = $currency_setting;
     $this->view->company_name = $company_name;
     $this->view->slogan = $slogan;
     $this->view->address = $address;
     $this->view->tel = $tel;
     $itemRows = $db->getProductOption();
     $this->view->itemsOption = $itemRows;
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         if (isset($data["save"])) {
             // 				print_r($data);exit();
             $db->editOrder($data, $id);
             Application_Form_FrmMessage::redirectUrl('/index/pos');
         } elseif (isset($data["km"]) == 2) {
             $dbs = new Application_Model_DbTable_DbSiteLanguages();
             $ids = 2;
             $lang = $dbs->getbyid($ids);
             $session_lang = new Zend_Session_Namespace('lang');
             $session_lang->unlock();
             $session_lang->lang_id = $lang['id'];
             $session_lang->lang = $lang['language'];
             //print_r($lang);exit();
         } elseif (isset($data["en"]) == 1) {
             $dbs = new Application_Model_DbTable_DbSiteLanguages();
             $ids = 1;
             $lang = $dbs->getbyid($ids);
             $session_lang = new Zend_Session_Namespace('lang');
             $session_lang->unlock();
             $session_lang->lang_id = $lang['id'];
             $session_lang->lang = $lang['language'];
             //$this->_redirect('/login');
             //exit();
         }
     }
 }