public function testAction() { //echo "this is testing only "; // $this->_helper->layout()->disableLayout(); if ($this->getRequest()->getPost()) { $data = $this->getRequest()->getPost(); print_r($data); exit; } $formProduct = new Application_Form_FrmProduct(null); $formStockAdd = $formProduct->AddProductForm(null); Application_Model_Decorator::removeAllDecorator($formStockAdd); $this->view->form = $formStockAdd; //control $formAddProdcut = new Application_Form_FrmAction(null); $FrmAdd = $formAddProdcut->AllAction(null); Application_Model_Decorator::removeAllDecorator($FrmAdd); $this->view->control = $FrmAdd; ///view on select form $items = new Application_Model_GlobalClass(); $locationRows = $items->getLocationOption(); $this->view->locations = $locationRows; //for add location $formpopup = new Application_Form_FrmPopup(null); $formAdd = $formpopup->popuLocation(null); Application_Model_Decorator::removeAllDecorator($formAdd); $this->view->form_addstock = $formAdd; $form_catory = $formpopup->popupCategory(null); Application_Model_Decorator::removeAllDecorator($form_catory); $this->view->form_category = $form_catory; }
public function updateCustomerQuoteAction() { $session_stock = new Zend_Session_Namespace('stock'); $id = $this->getRequest()->getParam('id') ? $this->getRequest()->getParam('id') : '0'; if ($this->getRequest()->isPost()) { $data = $this->getRequest()->getPost(); $update_to_quote = new sales_Model_DbTable_DbSalesOrder(); if (@$data["quote"] != "") { $update_to_quote->updateCustomerQuote($data); } elseif (@$data['Update'] != "") { $update_to_quote->quoteUpdate($data); } $this->_redirect("sales/sales-order/index"); } $sql = "SELECT o.order_id,o.customer_id,o.LocationId,o.order,o.sales_ref,o.date_order,o.status,o.payment_method,o.currency_id,\n\t\to.remark,o.net_total,o.discount_type,o.discount_value,o.paid,o.all_total,o.balance,\n\t\tc.contact_name,c.phone,c.add_name,c.add_remark\n\t\tFROM tb_sales_order AS o\n\t\tINNER JOIN tb_customer AS c ON c.customer_id= o.customer_id\n\t\tINNER JOIN tb_sales_order_item AS so ON so.order_id=o.order_id\n\t\tWHERE o.order_id=" . $id; $db = new Application_Model_DbTable_DbGlobal(); $row = $db->getGlobalDbRow($sql); $formStock = new Application_Form_purchase(); $formStockEdit = $formStock->SalesOrder($row, $session_stock->stockID); Application_Model_Decorator::removeAllDecorator($formStockEdit); // omit default zend html tag $this->view->form = $formStockEdit; //get item of this lost $orderModel = new sales_Model_DbTable_DbOrder(); $orderDetail = $orderModel->getSalesOderID($id); $this->view->rowsOrder = $orderDetail; // item option in select $items = new Application_Model_GlobalClass(); $itemRows = $items->getProductOption($session_stock->stockID); $this->view->itemsOption = $itemRows; $formControl = new Application_Form_FrmAction(null); $formViewControl = $formControl->AllAction(null); Application_Model_Decorator::removeAllDecorator($formViewControl); $this->view->control = $formViewControl; //for search left $search = new purchase_Form_FrmSearch(); $frmsearch = $search->formSearch(); Application_Model_Decorator::removeAllDecorator($frmsearch); $this->view->get_frmsearch = $frmsearch; //for add product; $formpopup = new Application_Form_FrmPopup(null); $formproduct = $formpopup->popuProduct(null, $session_stock->stockID); Application_Model_Decorator::removeAllDecorator($formproduct); $this->view->form_product = $formproduct; //for customer $formpopup = $formpopup->popupCustomer(null, $session_stock->stockID); Application_Model_Decorator::removeAllDecorator($formpopup); $this->view->form_customer = $formpopup; //for add location $formAdd = $formpopup->popuLocation(null, $session_stock->stockID); Application_Model_Decorator::removeAllDecorator($formAdd); $this->view->form_addstock = $formAdd; }
public function checkInAction() { try { $db = new Application_Model_DbTable_DbGlobal(); if ($this->getRequest()->isPost()) { $data = $this->getRequest()->getPost(); $recieve_order = new purchase_Model_DbTable_DbPurchaseVendor(); if (isset($data['SaveNew'])) { try { $recieve_order->RecievedPurchaseOrder($data); Application_Form_FrmMessage::message("Purchase has been received!"); } catch (Exception $e) { echo $e->getMessage(); } //Application_Form_FrmMessage::redirectUrl("/purchase/index/check-in"); //$this->_redirect("purchase/index/add-purchase"); } else { $recieve_order->RecievedPurchaseOrder($data); $this->_redirect("/purchase/index/index"); } //not yet use in this version // elseif(@$data['Save']=='Save'){ // $payment_purchase_order = new purchase_Model_DbTable_DbPurchaseVendor(); // $payment_purchase_order -> VendorOrder($data); // $this->_redirect("purchase/index/index"); // } // elseif(@$data['New']=='New'){ // $this->_redirect("purchase/index/add-purchase"); // } } $user = $this->GetuserInfoAction(); if ($user["level"] != 1 and $user["level"] != 2) { $this->_redirect("purchase/index/index"); } $frm_purchase = new Application_Form_FrmCheckIn(null); $form_add_purchase = $frm_purchase->productOrder(null); Application_Model_Decorator::removeAllDecorator($form_add_purchase); $this->view->form_purchase = $form_add_purchase; // item option in select $items = new Application_Model_GlobalClass(); $itemRows = $items->getProductOption(); $this->view->items = $itemRows; //get control $formControl = new Application_Form_FrmAction(null); $formViewControl = $formControl->AllAction(null); Application_Model_Decorator::removeAllDecorator($formViewControl); $this->view->control = $formViewControl; // //for search // $search = new purchase_Form_FrmSearch(); // $frmsearch= $search->formSearch(); // Application_Model_Decorator::removeAllDecorator($frmsearch); // $this->view->get_frmsearch= $frmsearch; //for view left purchase order $vendor_sql = "SELECT p.order, p.all_total,p.paid,p.balance\n\t\tFROM tb_purchase_order AS p INNER JOIN tb_vendor AS v ON v.vendor_id=p.vendor_id ORDER BY p.timestamp DESC "; $rows = $db->getGlobalDb($vendor_sql); $this->view->list = $rows; //for add product; $formpopup = new Application_Form_FrmPopup(null); $formproduct = $formpopup->popuProduct(null); Application_Model_Decorator::removeAllDecorator($formproduct); $this->view->form = $formproduct; //for add vendor $formStockAdd = $formpopup->popupVendor(null); Application_Model_Decorator::removeAllDecorator($formStockAdd); $this->view->form_vendor = $formStockAdd; //for add location $formAdd = $formpopup->popuLocation(null); Application_Model_Decorator::removeAllDecorator($formAdd); $this->view->form_addstock = $formAdd; } catch (Exception $e) { Application_Form_FrmMessage::messageError("INSERT_ERROR", $err = $e->getMessage()); } }
public function updateReturnItemInAction() { try { $session_stock = new Zend_Session_Namespace('stock'); $id = $this->getRequest()->getParam('id') ? $this->getRequest()->getParam('id') : '0'; if ($this->getRequest()->isPost()) { $data = $this->getRequest()->getPost(); if ($data['Save']) { $update_return = new purchase_Model_DbTable_DbReturnItem(); $update_return->updateReturnItemIn($data); $this->_redirect("/purchase/return/return-in"); Application_Form_FrmMessage::message("Update Success full"); } } // $purchase = new purchase_Model_DbTable_DbPurchaseOrder(); // $rows = $purchase->purchaseInfo($id); // $db = new Application_Model_DbTable_DbGlobal(); $returnModel = new purchase_Model_DbTable_DbSQLReturnItem(); $row_info = $returnModel->returnVendorInfoIn($id); $get_form = new Application_Form_FrmReturnItem(); $session_stock = new Zend_Session_Namespace('stock'); $frm_return = $get_form->returnItemInFrm($row_info); Application_Model_Decorator::removeAllDecorator($frm_return); $this->view->form_return = $frm_return; //get qty of return item $getReturnItem = $returnModel->getReturnItemIn($id); $this->view->returnItemDetail = $getReturnItem; //print_r($getReturnItem);exit(); //get return item $getOption = new Application_Model_GlobalClass(); $locationRows = $getOption->getLocationOption(); $this->view->locationOption = $locationRows; //print_r($locationRows);exit(); $itemRows = $getOption->getProductOption(); $this->view->productOption = $itemRows; //print_r($itemRows);exit(); $formControl = new Application_Form_FrmAction(null); $formViewControl = $formControl->AllAction(null); Application_Model_Decorator::removeAllDecorator($formViewControl); $this->view->control = $formViewControl; //for add product; $formpopup = new Application_Form_FrmPopup(null); $formproduct = $formpopup->popuProduct(null); Application_Model_Decorator::removeAllDecorator($formproduct); $this->view->form_add_product = $formproduct; //for add vendor $formvendor = $formpopup->popupVendor(null); Application_Model_Decorator::removeAllDecorator($formvendor); $this->view->form_vendor = $formvendor; //for add location $formAdd = $formpopup->popuLocation(null); Application_Model_Decorator::removeAllDecorator($formAdd); $this->view->form_addstock = $formAdd; //for link advane $this->view->getorder_id = $id; } catch (Exception $e) { echo $e->getMessage(); } }
public function advanceAction() { $db = new Application_Model_DbTable_DbGlobal(); $id = $this->getRequest()->getParam('id') ? $this->getRequest()->getParam('id') : '0'; // $r = new purchase_Model_DbTable_DbPurchaseVendor(); // $r->updatePurcaheToInProgress($id); if ($this->getRequest()->isPost()) { $data = $this->getRequest()->getPost(); //print_r($data); if (isset($data["payment"]) == "UPDATE") { $update_purchase = new purchase_Model_DbTable_DbAdvance(); $get_result = $update_purchase->updatePurchaseOrder($data); } elseif (isset($data["recieve_paid"])) { $recieve_paid = new purchase_Model_DbTable_DbAdvance(); $result = $recieve_paid->receivePaidOrder($data); Application_Form_FrmMessage::message("Product have been recieved Success!!"); Application_Form_FrmMessage::redirectUrl("/purchase/advance/advance/id/" . $id); } elseif (isset($data["reorder"])) { $reorder = new purchase_Model_DbTable_DbAdvance(); $update_reoder = $reorder->rePurchaseOrder($data); Application_Form_FrmMessage::message("Product have been reoder Success!!"); } } ///link left not yet get from DbpurchaseOrder // $session_vendor_info = new Zend_Session_Namespace('vendor_info'); // $rows= $session_vendor_info->vendorinfo; // print_r($rows);exit(); $purchase = new purchase_Model_DbTable_DbPurchaseOrder(); $rows = $purchase->purchaseInfo($id); $formStock = new Application_Form_purchase(); $formpurchase_info = $formStock->productOrder($rows); Application_Model_Decorator::removeAllDecorator($formpurchase_info); // omit default zend html tag $this->view->form_purchase = $formpurchase_info; $this->view->status = $rows["status"]; //get item of this order // $orderModel = new purchase_Model_DbTable_DbPurchaseOrder(); // $orderDetail = $orderModel->getPurchaseID($id); // $this->view->rowsOrder = $orderDetail; $session_record_order = new Zend_Session_Namespace('record_order'); //create in update purchase order in page indexcontroller action update $orderDetail = $session_record_order->orderDetail; $this->view->rowsOrder = $orderDetail; $sql = "SELECT si.order_id,CONCAT(p.item_name,' (',p.item_code,' )') AS item_name,p.qty_perunit ,p.pro_id,si.remark as pi_remark,si.qty_order,si.price,si.total_befor,si.disc_type,\n\t\tsi.disc_value,si.is_free,si.sub_total,s.discount_value,s.`remark`,s.`discount_value`,s.`paid`,s.net_total,s.`all_total`,s.`balance`\n\t\tFROM tb_purchase_order_item AS si,tb_product AS p ,tb_purchase_order AS s\n\t\t WHERE p.pro_id = si.pro_id AND si.order_id = s.order_id AND si.order_id={$id}"; $result = $db->getGlobalDb($sql); $this->view->orderItem = $result; // if($rows['status']==4){ // Application_Form_FrmMessage::message("You Can't Access Advance! Order Is Payment Already"); // //$this->_redirect("/purchase/index/detail-purchase-order/id/".$id); // } //for get item receive qty order $qty_receive = new purchase_Model_DbTable_DbPurchaseAdvance(); $row_receive = $qty_receive->getProductReceived($id); //print_r($row_receive); $this->view->rowsreceived = $row_receive; // item option in select $items = new Application_Model_GlobalClass(); $itemRows = $items->getProductOption(); $this->view->itemsOption = $itemRows; $items = new Application_Model_GlobalClass(); $itemRows = $items->getProductOption(); $this->view->items = $itemRows; //get control $formControl = new Application_Form_FrmAction(null); $formViewControl = $formControl->AllAction(null); Application_Model_Decorator::removeAllDecorator($formViewControl); $this->view->control = $formViewControl; //for add product; $formpopup = new Application_Form_FrmPopup(null); $formproduct = $formpopup->popuProduct(null); Application_Model_Decorator::removeAllDecorator($formproduct); $this->view->form = $formproduct; //for add vendor $formStockAdd = $formpopup->popupVendor(null); Application_Model_Decorator::removeAllDecorator($formStockAdd); $this->view->form_vendor = $formStockAdd; //for add location $formAdd = $formpopup->popuLocation(null); Application_Model_Decorator::removeAllDecorator($formAdd); $this->view->form_addstock = $formAdd; // item option in select // $items = new Application_Model_GlobalClass(); // $itemRows = $items->getProductOption(); // $this->view->itemsOption = $itemRows; }
public function advanceTestAction() { $db = new Application_Model_DbTable_DbGlobal(); $id = $this->getRequest()->getParam('id') ? $this->getRequest()->getParam('id') : '0'; $r = new purchase_Model_DbTable_DbPurchaseVendor(); $r->updatePurcaheToInProgress($id); if ($this->getRequest()->isPost()) { $data = $this->getRequest()->getPost(); } ///link left not yet get from DbpurchaseOrder $session_vendor_info = new Zend_Session_Namespace('vendor_info'); $rows = $session_vendor_info->vendorinfo; // print_r($rows);exit(); // $purchase = new purchase_Model_DbTable_DbPurchaseOrder(); // $rows = $purchase->purchaseInfo($id); $formStock = new Application_Form_purchase(); $formpurchase_info = $formStock->productOrder($rows); Application_Model_Decorator::removeAllDecorator($formpurchase_info); // omit default zend html tag $this->view->form_purchase = $formpurchase_info; //get item of this order // $orderModel = new purchase_Model_DbTable_DbPurchaseOrder(); // $orderDetail = $orderModel->getPurchaseID($id); // $this->view->rowsOrder = $orderDetail; $session_record_order = new Zend_Session_Namespace('record_order'); //create in update purchase order in page indexcontroller action update $orderDetail = $session_record_order->orderDetail; $this->view->rowsOrder = $orderDetail; if ($rows['status'] == 4) { Application_Form_FrmMessage::message("You Can't Access Advance! Order Is Payment Already"); //$this->_redirect("/purchase/index/detail-purchase-order/id/".$id); } //for get item receive qty order $qty_receive = new purchase_Model_DbTable_DbPurchaseAdvance(); $row_receive = $qty_receive->getProductReceived($id); //print_r($row_receive); $this->view->rowsreceived = $row_receive; // item option in select $items = new Application_Model_GlobalClass(); $itemRows = $items->getProductOption(); $this->view->itemsOption = $itemRows; $items = new Application_Model_GlobalClass(); $itemRows = $items->getProductOption(); $this->view->items = $itemRows; //get control $formControl = new Application_Form_FrmAction(null); $formViewControl = $formControl->AllAction(null); Application_Model_Decorator::removeAllDecorator($formViewControl); $this->view->control = $formViewControl; //for add product; $formpopup = new Application_Form_FrmPopup(null); $formproduct = $formpopup->popuProduct(null); Application_Model_Decorator::removeAllDecorator($formproduct); $this->view->form = $formproduct; //for add vendor $formStockAdd = $formpopup->popupVendor(null); Application_Model_Decorator::removeAllDecorator($formStockAdd); $this->view->form_vendor = $formStockAdd; //for add location $formAdd = $formpopup->popuLocation(null); Application_Model_Decorator::removeAllDecorator($formAdd); $this->view->form_addstock = $formAdd; // item option in select $items = new Application_Model_GlobalClass(); $itemRows = $items->getProductOption(); $this->view->itemsOption = $itemRows; }
public function updateCustomerAction() { if ($this->getRequest()->isPost()) { try { $post = $this->getRequest()->getPost(); $customer = new sales_Model_DbTable_DbCustomer(); $customer->updateCustomer($post); $this->_redirect('/sales/customer/index'); } catch (Exception $e) { Application_Form_FrmMessage::message("Update customer failed !"); } } $id = $this->getRequest()->getParam('id') ? $this->getRequest()->getParam('id') : '0'; $sql = "SELECT c.customer_id,c.type_price,c.cust_name, c.add_remark, c.contact_name,c.add_name, c.phone, \n\t\t\t\t\tc.fax,c.email, c.website,c.customer_remark,c.is_active\n\t\t\t\t\tFROM tb_customer AS c,tb_price_type as tp\n\t\t\t\t\tWHERE tp.type_id=c.type_price\n\t\t\t\t\tAND c.customer_id = " . $id . " LIMIT 1"; $db = new Application_Model_DbTable_DbGlobal(); $row = $db->getGlobalDbRow($sql); // lost item info $formStock = new sales_Form_FrmVendor($row); $formStockEdit = $formStock->AddCustomerForm($row); Application_Model_Decorator::removeAllDecorator($formStockEdit); // omit default zend html tag $this->view->customer_frm = $formStockEdit; //control action $formControl = new Application_Form_FrmAction(null); $formViewControl = $formControl->AllAction(null); Application_Model_Decorator::removeAllDecorator($formViewControl); $this->view->control = $formViewControl; }
public function addAction() { if ($this->getRequest()->isPost()) { $post = $this->getRequest()->getPost(); try { if (@$post['Save'] != "") { $vendor = new purchase_Model_DbTable_DbAddVendor(); $vendor->addVendor($post); $this->_redirect("purchase/vendor/index"); } if (@$post['SaveNew'] != "") { $vendor = new purchase_Model_DbTable_DbAddVendor(); $vendor->addVendor($post); $this->_redirect("purchase/vendor/add"); } elseif (@$post['btn_new'] == 'New') { $this->_redirect('/purchase/vendor/add'); } } catch (Exception $e) { Application_Form_FrmMessage::message("You have Error" . $e->getMessage()); } } /////////////////for veiw form $formStock = new purchase_Form_FrmVendor(null); $formStockAdd = $formStock->AddVendorForm(null); Application_Model_Decorator::removeAllDecorator($formStockAdd); $this->view->form = $formStockAdd; //.end controller $formControl = new Application_Form_FrmAction(null); $formViewControl = $formControl->AllAction(null); Application_Model_Decorator::removeAllDecorator($formViewControl); $this->view->control = $formViewControl; }