public function addUserAction() { if ($this->getRequest()->isPost()) { $db = new RsvAcl_Model_DbTable_DbUser(); $post = $this->getRequest()->getPost(); if (!$db->ifUserExist($post['username'])) { $id = $db->insertUser($post); $tr = Application_Form_FrmLanguages::getCurrentlanguage(); $this->_redirect('/rsvAcl/user/index'); } else { Application_Form_FrmMessage::message('User had existed already'); } } $form = new RsvAcl_Form_FrmUser(); $this->view->form = $form; Application_Model_Decorator::removeAllDecorator($form); $items = new Application_Model_GlobalClass(); $locationRows = $items->getLocationAssign(); $this->view->locations = $locationRows; $popup = new Application_Form_FrmPopup(); $frm_poup = $popup->popuLocation(null); Application_Model_Decorator::removeAllDecorator($frm_poup); $this->view->popup_location = $frm_poup; }
public function productAlertAction() { $db = new Application_Model_DbTable_DbGlobal(); if ($this->getRequest()->isPost()) { try { $post = $this->getRequest()->getPost(); $dbprice = new Product_Model_DbTable_DbPrice(); $dbprice->addMessageAlertItem($post); if ($post['add_new'] == "Save New") { Application_Form_FrmMessage::message("Product has been set price success!"); } else { $this->_redirect("/product/index/itemalert"); } } catch (Exception $e) { } //$this->_redirect("product/index/index"); } $items = new Application_Model_GlobalClass(); $itemRows = $items->getProductOption(); $this->view->items = $itemRows; $getOption = new Application_Model_GlobalClass(); $price_type = $getOption->getTypePriceOption(); $this->view->price_option = $price_type; //for add product; $formpopup = new Application_Form_FrmPopup(null); $formprice = $formpopup->AddClassPrice(null); Application_Model_Decorator::removeAllDecorator($formprice); $this->view->frm_price = $formprice; }
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 updateSalesAction() { $id = $this->getRequest()->getParam('id') ? $this->getRequest()->getParam('id') : '0'; if ($this->getRequest()->isPost()) { //just block only but can use other version $data = $this->getRequest()->getPost(); // if($data["status"]!=="Paid"){ // if(@$data['payment']!==''){ // $update_payment_order = new sales_Model_DbTable_DbSalesOrder(); // $update_payment_order->updateCustomerOrderPayment($data); // } // elseif(@$data['Update']=='Update'){ // $update_order = new sales_Model_DbTable_DbSalesOrder(); // //not yet dork stock in table inventory // $update_order->updateCustomerOrder($data); // } // } // else{ // Application_Form_FrmMessage::message("Cann't Edit!Sales Order Has Been Payment Already"); // Application_Form_FrmMessage::redirectUrl("/sales/sales-order/index"); // } //for new version $sale_order = new sales_Model_DbTable_DbCustomerOrder(); if (isset($data["payment"])) { if ($data["oldStatus"] == 6) { $addOrder = new sales_Model_DbTable_DbSalesOrder(); $addOrder->CustomerAddOrderPayment($data); Application_Form_FrmMessage::message("You has been Re-Order successe!"); Application_Form_FrmMessage::redirectUrl("/sales/sales-order/index"); } else { $sale_order->updateCustomerOrder($data); Application_Form_FrmMessage::message("You have been Update customer order success! "); Application_Form_FrmMessage::redirectUrl("/sales/sales-order/index"); } } elseif (isset($data["cancel_order"])) { //for cancel customer order if ($data["oldStatus"] != 6) { $sale_order->cancelCustomerOrder($data); Application_Form_FrmMessage::message("You have been cancel customer order success! "); Application_Form_FrmMessage::redirectUrl("/sales/sales-order/index"); } else { Application_Form_FrmMessage::message("Can not cancel again!Becuase You have been cancel customer order already!"); Application_Form_FrmMessage::redirectUrl("/sales/sales-order/index"); } // $sale_order->cancelCustomerOrder($data); // Application_Form_FrmMessage::message("You have been cancel customer order success! "); // Application_Form_FrmMessage::redirectUrl("/sales/sales-order/index"); } } $user = $this->GetuserInfoAction(); if ($user["level"] != 1 and $user["level"] != 2) { $gb = new Application_Model_DbTable_DbGlobal(); $exist = $gb->userSaleOrderExist($id, $user["location_id"]); if ($exist == "") { $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\t\to.remark,o.net_total,o.discount_type,o.discount_value,o.paid,o.all_total,o.balance,\n\t\t\tc.contact_name,c.phone,c.add_name,c.add_remark\n\t\t\tFROM tb_sales_order AS o\n\t\t\tINNER JOIN tb_customer AS c ON c.customer_id= o.customer_id\n\t\t\tINNER JOIN tb_sales_order_item AS so ON so.order_id=o.order_id\n\t\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); Application_Model_Decorator::removeAllDecorator($formStockEdit); // omit default zend html tag $this->view->form = $formStockEdit; $this->view->status_so = $row['status']; if ($row['status'] == 1) { $this->_redirect("sales/sales-order/update-customer-quote/id/{$id}"); } //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(); $this->view->itemsOption = $itemRows; $items = new Application_Model_GlobalClass(); $itemRows = $items->getProductOption(); $this->view->items = $itemRows; // $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_product = $formproduct; //for customer $formpopup = $formpopup->popupCustomer(null); Application_Model_Decorator::removeAllDecorator($formpopup); $this->view->form_customer = $formpopup; //for add location $formAdd = $formpopup->popuLocation(null); Application_Model_Decorator::removeAllDecorator($formAdd); $this->view->form_addstock = $formAdd; $form_agent = $formpopup->popupSaleAgent(null); Application_Model_Decorator::removeAllDecorator($form_agent); $this->view->form_agent = $form_agent; }
public function adjustPriceAction() { $db = new Application_Model_DbTable_DbGlobal(); if ($this->getRequest()->isPost()) { $post = $this->getRequest()->getPost(); if ($post['save'] !== "") { $adjust_price = new Product_Model_DbTable_DbAdjustStock(); $db_result = $adjust_price->adjustPricing($post); } $this->_redirect("product/index/index"); } $session_stock = new Zend_Session_Namespace('stock'); ///view on select location form table $getOption = new Application_Model_GlobalClass(); $locationRows = $getOption->getLocationOption($session_stock->stockID); $this->view->locationOption = $locationRows; ///view on select location form table $itemRows = $getOption->getProductOption($session_stock->stockID); $this->view->productOption = $itemRows; //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; }
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 updateSaleAgentAction() { $session_stock = new Zend_Session_Namespace('stock'); $id = $this->getRequest()->getParam('id') ? $this->getRequest()->getParam('id') : '0'; $db = new Application_Model_DbTable_DbGlobal(); if ($this->getRequest()->isPost()) { $data = $this->getRequest()->getPost(); if ($data["submit_update"]) { $update_agent = new sales_Model_DbTable_DbSalesAgent(); $update_agent->updateSalesAgent($data); $this->_redirect("sales/sale-agent/index"); } else { $this->_redirect("sales/sale-agent/index"); } } // show form with value $sql = "SELECT * FROM tb_sale_agent where agent_id=" . $id; $rows = $db->getGlobalDbRow($sql); $formAgent = new sales_Form_FrmStock(null); $formShowAgent = $formAgent->showSaleAgentForm($rows, $session_stock->stockID); Application_Model_Decorator::removeAllDecorator($formShowAgent); $this->view->form_agent = $formShowAgent; $formpopup = new Application_Form_FrmPopup(null); //for add location $formAdd = $formpopup->popuLocation(null); Application_Model_Decorator::removeAllDecorator($formAdd); $this->view->form_addstock = $formAdd; }