本文整理汇总了PHP中Application_Form_FrmMessage::redirectUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Application_Form_FrmMessage::redirectUrl方法的具体用法?PHP Application_Form_FrmMessage::redirectUrl怎么用?PHP Application_Form_FrmMessage::redirectUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application_Form_FrmMessage
的用法示例。
在下文中一共展示了Application_Form_FrmMessage::redirectUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
//clear session from search session
//$this->clearSession();
$session_user = new Zend_Session_Namespace('auth');
$module = $request->getModuleName();
$controller = $request->getControllerName();
$action = $request->getActionName();
$url = $module . "/" . $controller . "/" . $action;
$_url = "";
//have login
if (isset($session_user->arr_acl)) {
$arr_acl = $session_user->arr_acl;
$valid_action = FALSE;
foreach ($arr_acl as $acl) {
if ($module == $acl["module"] && $controller == $acl["controller"]) {
$valid_action = TRUE;
break;
} elseif ($module === "rsvAcl" && $controller === "user" && $action === "change-password") {
//all user level can change password all
$valid_action = TRUE;
break;
} elseif ($module === "rsvAcl" && $session_user->level === "1") {
//user level 1 can access all action in module "rsvAcl"
$valid_action = TRUE;
break;
}
}
//redirect to homepage
if (!$valid_action) {
//just open block below
if ($url !== "default/index/index" && $url !== "default/error/error" && $url !== "default/index/changepassword" && $url !== "default/index/logout") {
$_url = '/';
}
$_have = false;
foreach ($this->_exception_url as $i => $val) {
if ($url === $val) {
$_have = true;
break;
}
}
if (!$_have) {
$_url = '/';
}
} else {
$_url = $this->rewriteUrl($url);
}
} else {
//no login
//redirect to login page
if ($url !== "default/index/index") {
$_url = "/";
}
}
if (!empty($_url)) {
// echo"url here". $_url;exit();
$_url = "/home";
Application_Form_FrmMessage::redirectUrl($_url);
}
}
示例2: editAction
public function editAction()
{
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost();
$db = new Callecterall_Model_DbTable_DbCallecterall();
try {
if (isset($data['btn_save'])) {
$db->updatcallecterall($data);
Application_Form_FrmMessage::message('ការបញ្ចូលជោគជ័យ');
}
if (isset($data['btn_save_close'])) {
$db->updatcallecterall($data);
Application_Form_FrmMessage::message('ការបញ្ចូលជោគជ័យ');
Application_Form_FrmMessage::redirectUrl('/callecterall/Callecterall');
}
} catch (Exception $e) {
Application_Form_FrmMessage::message("INSERT_FAIL");
$err = $e->getMessage();
Application_Model_DbTable_DbUserLog::writeMessageError($err);
}
}
$id = $this->getRequest()->getParam('id');
$db = new Callecterall_Model_DbTable_DbCallecterall();
$row = $db->getcallecterallbyid($id);
$fm = new Callecterall_Form_Frmcallecterall();
$frm = $fm->Frmcallecterall($row);
Application_Model_Decorator::removeAllDecorator($frm);
$this->view->Form_Frmcallecterall = $frm;
}
示例3: editAction
function editAction()
{
$db_deposite = new Capital_Model_DbTable_DbCapital();
if ($this->getRequest()->isPost()) {
$_data = $this->getRequest()->getPost();
try {
if (isset($_data["save"])) {
$db_deposite->updateCapital($_data);
Application_Form_FrmMessage::Sucessfull("ការបញ្ចូលជោគជ័យ !", '/capital/capital/add');
} elseif (isset($_data["save_close"])) {
$db_deposite->updateCapital($_data);
Application_Form_FrmMessage::Sucessfull("ការបញ្ចូលជោគជ័យ !", '/capital/capital');
} else {
Application_Form_FrmMessage::redirectUrl("/capital/capital");
}
} catch (Exception $e) {
Application_Form_FrmMessage::message("ការបញ្ចូលមិនជោគជ័យ");
$err = $e->getMessage();
Application_Model_DbTable_DbUserLog::writeMessageError($err);
}
}
$id = $this->getRequest()->getParam("id");
$row = $db_deposite->getpartnerById($id);
$deposite = new Capital_Form_FrmCapitale();
$frm = $deposite->frmCapital($row);
Application_Model_Decorator::removeAllDecorator($frm);
$this->view->frm = $frm;
}
示例4: editAction
public function editAction()
{
if($this->getRequest()->isPost()){
$data=$this->getRequest()->getPost();
$db = new Group_Model_DbTable_DbCallecteralltype();
try {
$db->updatcallecterall($data);
Application_Form_FrmMessage::message($this->tr->translate('EDIT_SUCCESS'));
Application_Form_FrmMessage::redirectUrl('/other/callecteralltype');
} catch (Exception $e) {
Application_Form_FrmMessage::message("INSERT_FAIL");
$err = $e->getMessage();
Application_Model_DbTable_DbUserLog::writeMessageError($err);
}
}
$id = $this->getRequest()->getParam('id');
$db = new Callecterall_Model_DbTable_DbCallecterall();
$row = $db->getcallecterallbyid($id);
$fm = new Callecterall_Form_Frmcallecterall();
$frm = $fm->Frmcallecterall($row);
Application_Model_Decorator::removeAllDecorator($frm);
$this->view->Form_Frmcallecterall = $frm;
}
示例5: addAction
public function addAction()
{
$db = new saleorder_Model_DbTable_DbSaleOrder();
$datas = $db->getAllProduct();
$saleorder = $db->getAllSaleOrder();
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost();
$db->addSaleOrder($data);
Application_Form_FrmMessage::redirectUrl('/saleorder/index/add');
}
$this->view->getdata = $datas;
$this->view->saleorder = $saleorder;
$form = new saleorder_Form_FrmSaleOrder();
$this->view->frm = $form->FrmSaleOrder();
$this->view->FrmSaleOrderUpdate = $form->FrmSaleOrderUpdate();
$itemRows = $db->getProductOption();
$this->view->itemsOption = $itemRows;
}
示例6: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
//clear session from search session
$this->clearSession();
$session_user = new Zend_Session_Namespace('auth');
$module = $request->getModuleName();
$controller = $request->getControllerName();
$action = $request->getActionName();
$url = $module . "/" . $controller . "/" . $action;
$_url = "";
//have login
if (isset($session_user->arr_acl)) {
$arr_acl = $session_user->arr_acl;
$valid_action = FALSE;
foreach ($arr_acl as $acl) {
if ($module == $acl["module"] && $controller == $acl["controller"]) {
$valid_action = TRUE;
break;
} elseif ($module === "rsvAcl" && $session_user->level === "1") {
//user level 1 can access all action in module "rsvAcl"
$valid_action = TRUE;
break;
}
}
//redirect to homepage
if (!$valid_action) {
if ($url !== "default/index/home" && $url !== "default/index/web-elements" && $url !== "default/error/error") {
$_url = '/default/index/home';
}
} else {
$_url = $this->rewriteUrl($url);
}
} else {
//no login
//redirect to login page
if ($url !== "default/index/index") {
$_url = "/default/index/index";
}
}
if (!empty($_url)) {
Application_Form_FrmMessage::redirectUrl($_url);
}
}
示例7: editAction
function editAction(){
if($this->getRequest()->isPost()){
$data=$this->getRequest()->getPost();
$db = new Group_Model_DbTable_DbClientBlackList();
try {
$db->updatClientBlackList($data);
Application_Form_FrmMessage::message($this->tr->translate('EDIT_SUCCESS'));
Application_Form_FrmMessage::redirectUrl('/group/Clientblacklist');
} catch (Exception $e) {
Application_Form_FrmMessage::message("EDIT_FAIL");
$err = $e->getMessage();
Application_Model_DbTable_DbUserLog::writeMessageError($err);
}
}
$db = new Group_Model_DbTable_DbClientBlackList();
$id = $this->getRequest()->getParam("id");
$row = $db->getBlackListById($id);
$fm = new Group_Form_FrmClientBlackList();
$frm = $fm->FrmClientBlackList($row);
Application_Model_Decorator::removeAllDecorator($frm);
$this->view->Form_client_blacklist = $frm;
}
示例8: editAction
public function editAction()
{
$id = $this->getRequest()->getParam('id');
$db = new Callecterall_Model_DbTable_DbCallecteralllist();
$row = $db->getcallecteralllistbyid($id);
$is_fund = $db->checkisFun($id);
if ($is_fund['is_fund'] == 0) {
Application_Form_FrmMessage::Sucessfull('កាបពាំ្ចនេះបានសងរួចហើយ', '/callecterall/Callecteralllist');
}
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost();
$db = new Callecterall_Model_DbTable_DbCallecteralllist();
//print_r($data);exit();
try {
if (isset($data['save_close'])) {
$db->updatcallecteralllist($data);
//print_r($data);exit();
Application_Form_FrmMessage::message('ការបញ្ចូលជោគជ័យ');
Application_Form_FrmMessage::redirectUrl('/callecterall/Callecteralllist/');
}
if (isset($data['save_new'])) {
$db->updatcallecteralllist($data);
Application_Form_FrmMessage::message('ការបញ្ចូលជោគជ័យ');
Application_Form_FrmMessage::redirectUrl('/callecterall/Callecteralllist/add');
}
} catch (Exception $e) {
Application_Form_FrmMessage::message("INSERT_FAIL");
$err = $e->getMessage();
Application_Model_DbTable_DbUserLog::writeMessageError($err);
}
}
$fm = new Callecterall_Form_Frmcallecteralllist();
$frm = $fm->callecteralllist($row);
Application_Model_Decorator::removeAllDecorator($frm);
$this->view->Form_Frmcallecterall = $frm;
}
示例9: deleteoweAction
public function deleteoweAction()
{
if ($this->getRequest()->isPost()) {
$_data = $this->getRequest()->getPost();
$_db = new Application_Model_DbTable_DbMoneyTransactions();
$_db->updateOwerbyTran($_data);
Application_Form_FrmMessage::redirectUrl('/reports/index/rptowe');
exit;
}
}
示例10: updatePurchaseOrder
public function updatePurchaseOrder($data)
{
try {
$db = $this->getAdapter();
$db->beginTransaction();
$db_global = new Application_Model_DbTable_DbGlobal();
$session_user = new Zend_Session_Namespace('auth');
$userName = $session_user->user_name;
$GetUserId = $session_user->user_id;
//for update order by id\
$id_order_update = $data['id'];
//print_r($id_order_update);exit();
//$recieved_id = $data["recieve_id"];
//update info of order in tb_purchase order
// Select all qty in tb_product and tb_purchase_order_item for compare product exist or not for update qty to old qty
$sql_itm = "SELECT\n\t\t\t\t\t\t(SELECT p.pro_id FROM tb_product AS p WHERE p.pro_id = po.`pro_id`) AS pro_id\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t,(SELECT p.qty_onorder FROM tb_product AS p WHERE p.pro_id = po.`pro_id`) AS qty_onorder\n\t\t\t\t\t\t\n\t\t\t\t\t\t,(SELECT p.qty_onhand \tFROM tb_product AS p WHERE p.pro_id = po.`pro_id`) AS qty_onhand\n\t\t\t\t\t\t\n\t\t\t\t\t\t,(SELECT p.qty_available \tFROM tb_product AS p WHERE p.pro_id = po.`pro_id`) AS qty_available\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t, SUM(po.`qty_order`) AS qty_order FROM\n\t\t\t\t\t\n\t\t\t\t\ttb_purchase_order_item AS po WHERE po.order_id = {$id_order_update} GROUP BY po.pro_id";
$rows_order = $db_global->getGlobalDb($sql_itm);
if ($rows_order) {
foreach ($rows_order as $row) {
$row_get = $db_global->porductLocationExist($row["pro_id"], $data["old_location"]);
$qty_onorder = $row["qty_onorder"] - $row["qty_order"];
$qty_available = $row["qty_available"] - $row["qty_order"];
$qty_onorder_prolo = $row_get["qty_onorder"] - $row["qty_order"];
$qty_available_prolo = $row_get["qty_avaliable"] - $row["qty_order"];
if ($qty_onorder <= 0 or $qty_onorder_prolo <= 0) {
Application_Form_FrmMessage::message("The Main Stock or Location Stock is Not enough ");
Application_Form_FrmMessage::redirectUrl("/purchase/advance/advance/id/" . $id_order_update);
exit;
} else {
$update_product = array("qty_onorder" => $qty_onorder, "qty_available" => $qty_available);
$this->_name = "tb_product";
$where = $this->getAdapter()->quoteInto("pro_id=?", $row["pro_id"]);
$this->update($update_product, $where);
unset($update_product);
$update_prolocation = array("qty_onorder" => $qty_onorder_prolo, "qty_avaliable" => $qty_available_prolo);
$this->_name = "tb_prolocation";
$where = $this->getAdapter()->quoteInto("ProLocationID=?", $row_get["ProLocationID"]);
$this->update($update_prolocation, $where);
}
}
}
$info_purchase_order = array("vendor_id" => $data['v_name'], "LocationId" => $data["LocationId"], "order" => $data['txt_order'], "date_order" => $data['order_date'], "status" => $data["status"], "remark" => $data['remark'], "user_mod" => $GetUserId, "timestamp" => new Zend_Date(), "discount_value" => $data["dis_value"], "discount_real" => $data["global_disc"], "paid" => $data['paid'], "net_total" => $data["net_total"], "all_total" => $data['all_total'], "payment_method" => $data["payment_name"], "currency_id" => $data["currency"], "balance" => $data['balance']);
$this->_name = "tb_purchase_order";
$where = $this->getAdapter()->quoteInto("order_id=?", $id_order_update);
$this->update($info_purchase_order, $where);
//$db_global->updateRecord($info_purchase_order,$id_order_update,"order_id","tb_purchase_order");
$sql = "DELETE FROM tb_purchase_order_item WHERE order_id IN ({$id_order_update})";
$db_global->deleteRecords($sql);
unset($sql);
$sql_history = "DELETE FROM tb_purchase_order_history WHERE `order` IN ({$id_order_update})";
$db_global->deleteRecords($sql_history);
unset($sql_history);
/// update
$ids = explode(',', $data['identities']);
// print_r($ids);
foreach ($ids as $i) {
if (@$data["pricefree_" . $i]) {
$is_free = 1;
} else {
$is_free = 0;
}
// Insert New purchase order item in old order_id
$data_item[$i] = array('order_id' => $id_order_update, 'pro_id' => $data['item_id_' . $i], 'qty_order' => $data['qty' . $i], 'price' => $data['price' . $i], 'sub_total' => $data['total' . $i], 'total_befor' => $data['total' . $i], 'remark' => $data['remark' . $i], 'disc_value' => $data['dis-value' . $i], 'is_free' => $is_free);
//print_r($data_item); echo "<br />";echo "<br />";
$db->insert("tb_purchase_order_item", $data_item[$i]);
unset($data_item[$i]);
$data_history[$i] = array('order' => $id_order_update, 'pro_id' => $data['item_id_' . $i], 'type' => 1, 'customer_id' => $data['v_name'], 'status' => $data["status"], 'order_total' => $data['total' . $i], 'qty' => $data['qty' . $i], 'unit_price' => $data['price' . $i], 'sub_total' => $data['total' . $i], 'last_update_date' => new Zend_Date());
//print_r($data_history);exit();
$db->insert("tb_purchase_order_history", $data_history[$i]);
unset($data_history[$i]);
$locationid = $data['LocationId'];
$itemId = $data['item_id_' . $i];
$qtyrecord = $data['qty' . $i];
//qty on 1 record
// Update stock in tb_product
$rows = $db_global->productLocationInventory($itemId, $locationid);
//to check product location
if ($rows) {
$update_prolo = array("qty_onorder" => $rows["qty_onorder"] + $qtyrecord, "qty_avaliable" => $rows["qty_avaliable"] + $qtyrecord, "last_mod_date" => new Zend_Date());
$this->_name = "tb_prolocation";
$where = $this->getAdapter()->quoteInto("ProLocationID=?", $rows["ProLocationID"]);
$this->update($update_prolo, $where);
unset($update_prolo);
$update_product = array("qty_onorder" => $rows["qty_onorder"] + $qtyrecord, "qty_available" => $rows["qty_available"] + $qtyrecord, "last_mod_date" => new Zend_Date());
$this->_name = "tb_product";
$where = $this->getAdapter()->quoteInto("pro_id=?", $itemId);
$this->update($update_product, $where);
} else {
$update_prolo = array("qty_onorder" => $rows["qty_onorder"] + $qtyrecord, "qty_avaliable" => $rows["qty_avaliable"] + $qtyrecord, "last_mod_date" => new Zend_Date());
$this->_name = "tb_prolocation";
$this->insert($update_prolo);
unset($update_prolo);
$update_product = array("qty_onorder" => $rows["qty_onorder"] + $qtyrecord, "qty_available" => $rows["qty_available"] + $qtyrecord, "last_mod_date" => new Zend_Date());
$this->_name = "tb_product";
$this->insert($update_product);
}
}
$db->commit();
} catch (Exception $e) {
$db->rollBack();
//.........这里部分代码省略.........
示例11: CustomerAddOrderPayment
public function CustomerAddOrderPayment($data)
{
try {
$db = $this->getAdapter();
$db->beginTransaction();
$db_global = new Application_Model_DbTable_DbGlobal();
$session_user = new Zend_Session_Namespace('auth');
$userName = $session_user->user_name;
$GetUserId = $session_user->user_id;
$ids = explode(',', $data['identity']);
//print_r($ids);exit();
//command below not yet use
// $idrecord=$data['customer_id'];
// $datainfo=array(
// "contact_name"=>$data['contact'],
// "phone" =>$data['txt_phone'],
// );
// //updage customer info
// $itemid=$db_global->updateRecord($datainfo, $idrecord, "customer_id","tb_customer");
// unset($datainfo);
if ($data['order'] == "") {
$date = new Zend_Date();
$order_add = "SO" . $date->get('hh-mm-ss');
} else {
$order_add = $data['order'];
}
$db->getProfiler()->setEnabled(true);
$info_order = array("customer_id" => $data['customer_id'], "LocationId" => $data['LocationId'], "order" => $order_add, "sales_ref" => $data['sales_ref'], "date_order" => $data['order_date'], "status" => $data['status'], "remark" => $data['remark'], "user_mod" => $GetUserId, "timestamp" => new Zend_Date(), "net_total" => $data['net_total'], "discount_value" => $data['dis_value'], "discount_real" => $data["global_disc"], "paid" => $data['paid'], "all_total" => $data['all_total'], "balance" => $data['remain']);
//and info of order
$id_order = $db_global->addRecord($info_order, "tb_sales_order");
unset($info_order);
Zend_Debug::dump($db->getProfiler()->getLastQueryProfile()->getQuery());
Zend_Debug::dump($db->getProfiler()->getLastQueryProfile()->getQueryParams());
$db->getProfiler()->setEnabled(false);
$ids = explode(',', $data['identity']);
foreach ($ids as $i) {
if (@$data["pricefree_" . $i]) {
$check = 1;
} else {
$check = 0;
}
$db->getProfiler()->setEnabled(true);
//add history order
$data_history = array('pro_id' => $data['item_id_' . $i], 'type' => 2, 'order' => $id_order, 'customer_id' => $data['customer_id'], 'date' => $data['order_date'], "status" => $data['status'], 'order_total' => $data['remain'], 'qty' => $data['qty' . $i], 'unit_price' => $data['price' . $i], 'sub_total' => $data['total' . $i]);
$db->insert("tb_order_history", $data_history);
unset($data_history);
Zend_Debug::dump($db->getProfiler()->getLastQueryProfile()->getQuery());
Zend_Debug::dump($db->getProfiler()->getLastQueryProfile()->getQueryParams());
$db->getProfiler()->setEnabled(false);
$db->getProfiler()->setEnabled(true);
$history = array('pro_id' => $data['item_id_' . $i], 'type' => 2, 'order' => $id_order, 'customer_id' => $data['customer_id'], 'date' => $data['order_date'], "status" => $data['status'], 'order_total' => $data['remain'], 'qty' => $data['qty' . $i], 'unit_price' => $data['price' . $i], 'sub_total' => $data['total' . $i], "dis_value" => $data['dis-value' . $i], "dis_amount" => $data["real-value" . $i], 'is_free' => $check);
$db->insert("tb_sale_order_history", $history);
unset($history);
Zend_Debug::dump($db->getProfiler()->getLastQueryProfile()->getQuery());
Zend_Debug::dump($db->getProfiler()->getLastQueryProfile()->getQueryParams());
$db->getProfiler()->setEnabled(false);
$db->getProfiler()->setEnabled(true);
$sale_history = array('pro_id' => $data['item_id_' . $i], 'type' => 2, 'order' => $id_order, 'customer_id' => $data['customer_id'], 'date' => $data['order_date'], "status" => $data['status'], 'order_total' => $data['remain'], 'qty' => $data['qty' . $i], 'unit_price' => $data['price' . $i], 'sub_total' => $data['total' . $i]);
$db->insert("tb_purchase_order_history", $sale_history);
unset($sale_history);
Zend_Debug::dump($db->getProfiler()->getLastQueryProfile()->getQuery());
Zend_Debug::dump($db->getProfiler()->getLastQueryProfile()->getQueryParams());
$db->getProfiler()->setEnabled(false);
$db->getProfiler()->setEnabled(true);
//$check = @$data["pricefree_".$i];
//print_r($check);
$data_item[$i] = array('order_id' => $id_order, 'pro_id' => $data['item_id_' . $i], 'qty_order' => $data['qty' . $i], 'price' => $data['price' . $i], 'total_befor' => $data['total' . $i], 'is_free' => $check, 'sub_total' => $data['total' . $i], "disc_value" => $data['dis-value' . $i], "disc_amount" => $data["real-value" . $i]);
$db->insert("tb_sales_order_item", $data_item[$i]);
unset($data_item[$i]);
Zend_Debug::dump($db->getProfiler()->getLastQueryProfile()->getQuery());
Zend_Debug::dump($db->getProfiler()->getLastQueryProfile()->getQueryParams());
$db->getProfiler()->setEnabled(false);
//check stock product location
$locationid = $data['LocationId'];
$itemId = $data['item_id_' . $i];
$qtyrecord = $data['qty' . $i];
//qty on 1 record
$db->getProfiler()->setEnabled(true);
$rows = $db_global->productLocationInventory($itemId, $locationid);
//to check product location
Zend_Debug::dump($db->getProfiler()->getLastQueryProfile()->getQuery());
Zend_Debug::dump($db->getProfiler()->getLastQueryProfile()->getQueryParams());
$db->getProfiler()->setEnabled(false);
//exit();
$qtyold = $rows['qty'];
$qty_avaliable = $rows["qty_avaliable"] - $qtyrecord;
$qty_available = $rows["qty_available"] - $qtyrecord;
$getrecord_id = $rows["ProLocationID"];
if ($rows) {
if ($qty_available <= 0) {
Application_Form_FrmMessage::message("The Qty onhanh is out of stock!!");
Application_Form_FrmMessage::redirectUrl("/sales/sales-order");
$db->rollBack();
break;
} elseif ($qty_avaliable <= 0) {
Application_Form_FrmMessage::message("The in your location is out of stock!!");
Application_Form_FrmMessage::redirectUrl("/sales/sales-order");
$db->rollBack();
break;
} else {
//.........这里部分代码省略.........
示例12: updateVendorStock
public function updateVendorStock($data)
{
try {
$db = $this->getAdapter();
$db->beginTransaction();
$db_global = new Application_Model_DbTable_DbGlobal();
$session_user = new Zend_Session_Namespace('auth');
$userName = $session_user->user_name;
$GetUserId = $session_user->user_id;
//for update order by id\
$id_order_update = $data['id'];
$recieved_id = $data["recieve_id"];
//update info of order in tb_purchase order
// Select all qty in tb_product and tb_purchase_order_item for compare product exist or not for update qty to old qty
$sql_itm = "SELECT\n\t\t\t\t\t\t\t(SELECT p.pro_id FROM tb_product AS p WHERE p.pro_id = po.`pro_id`) AS pro_id\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t,(SELECT p.qty_onorder FROM tb_product AS p WHERE p.pro_id = po.`pro_id`) AS qty_onorder\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t,(SELECT p.qty_onhand \tFROM tb_product AS p WHERE p.pro_id = po.`pro_id`) AS qty_onhand\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t,(SELECT p.qty_available \tFROM tb_product AS p WHERE p.pro_id = po.`pro_id`) AS qty_available\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t, SUM(po.`qty_order`) AS qty_order FROM\n\t\t\t\t\t\t\n\t\t\t\t\ttb_purchase_order_item AS po WHERE po.order_id = {$id_order_update} GROUP BY po.pro_id";
$rows_order = $db_global->getGlobalDb($sql_itm);
//print_r($rows_order);exit();
// if product in purchase order item
if ($rows_order) {
foreach ($rows_order as $row_order) {
//print_r($row_order);exit();
//update qty and qty_onorder to old qty in tb_prolocation
$row_get = $db_global->porductLocationExist($row_order["pro_id"], $data["old_location"]);
// Check product Location exit
//print_r($row_get);exit();
$qty_prolo = $row_get["qty"] - $row_order["qty_order"];
$qty_order_prolo = $row_get["qty_onorder"] - $row_order["qty_order"];
$qty = $row_order["qty_onhand"] - $row_order["qty_order"];
$qty_order = $row_order["qty_onorder"] - $row_order["qty_order"];
if ($row_get) {
if ($data["oldStatus"] == 5 or $data["oldStatus"] == 4) {
if ($qty_prolo < 0) {
Application_Form_FrmMessage::message("You can't update!! because qty stock in Location is less than Quality order");
Application_Form_FrmMessage::redirectUrl("/purchase/index/index");
} else {
$qty_on_location = array("qty" => $row_get["qty"] - $row_order["qty_order"], "last_usermod" => $GetUserId, "last_mod_date" => new Zend_Date());
}
$db_global->updateRecord($qty_on_location, $row_get["ProLocationID"], "ProLocationID", "tb_prolocation");
} else {
if ($qty_order_prolo < 0) {
Application_Form_FrmMessage::message("You can't update!! because qty order in Location is less than Quality order");
Application_Form_FrmMessage::redirectUrl("/purchase/index/index");
} else {
$qty_on_location = array("qty_onorder" => $row_get["qty_onorder"] - $row_order["qty_order"], "last_usermod" => $GetUserId, "last_mod_date" => new Zend_Date());
}
$db_global->updateRecord($qty_on_location, $row_get["ProLocationID"], "ProLocationID", "tb_prolocation");
}
}
if ($data["oldStatus"] == 5 or $data["oldStatus"] == 4) {
if ($qty < 0) {
Application_Form_FrmMessage::message("You can't update!! because qty in stock is less than Quality order");
Application_Form_FrmMessage::redirectUrl("/purchase/index/index");
} else {
$qty_on_order = array("qty_onhand" => $row_order["qty_onhand"] - $row_order["qty_order"], "qty_available" => $row_order["qty_available"] - $row_order["qty_order"], "last_mod_date" => new Zend_Date());
$db_global->updateRecord($qty_on_order, $row_order["pro_id"], "pro_id", "tb_product");
}
} else {
if ($qty_order < 0) {
Application_Form_FrmMessage::message("You can't update!! because QTY onorder in stock is less than Quality order");
Application_Form_FrmMessage::redirectUrl("/purchase/index/index");
} else {
$qty_on_order = array("qty_onorder" => $row_order["qty_onorder"] - $row_order["qty_order"], "last_mod_date" => new Zend_Date());
}
$db_global->updateRecord($qty_on_order, $row_order["pro_id"], "pro_id", "tb_product");
}
//update total stock
}
}
unset($rows_order);
$info_purchase_order = array("vendor_id" => $data['v_name'], "LocationId" => $data["LocationId"], "order" => $data['txt_order'], "date_order" => $data['order_date'], "status" => $data["status"], "remark" => $data['remark'], "user_mod" => $GetUserId, "timestamp" => new Zend_Date(), "paid" => $data['paid'], "all_total" => $data['totalAmoun'], "balance" => $data['remain']);
$db_global->updateRecord($info_purchase_order, $id_order_update, "order_id", "tb_purchase_order");
// end update info of order in tb_purchase order
$ids = explode(',', $data['identity']);
$sql_recieve = new purchase_Model_DbTable_DbPurchaseOrder();
$result = $sql_recieve->recieved_info($id_order_update);
$prifix = "SELECT * FROM tb_setting WHERE `code` =16";
$ro = $db_global->getGlobalDbRow($prifix);
$RO = $ro["key_value"];
$date = new Zend_Date();
$recieve_no = $RO . $date->get('hh-mm-ss');
if ($result) {
if ($data["oldStatus"] == 5 or $data["oldStatus"] == 4) {
if ($data["status"] == 5 or $data["status"] == 4) {
$data_recieved_order = array("recieve_type" => 1, "order_id" => $id_order_update, "order_no" => $data["txt_order"], "vendor_id" => $data['v_name'], "location_id" => $data["LocationId"], "date_recieve" => new Zend_Date(), "status" => $data['status'], "is_active" => 1, "paid" => $data['paid'], "all_total" => $data['totalAmoun'], "balance" => $data['remain'], "user_recieve" => $GetUserId);
$recieved_order = $db_global->updateRecord($data_recieved_order, $recieved_id, "recieve_id", "tb_recieve_order");
unset($data_recieved_order);
} else {
$data_recieved_order = array("recieve_type" => 1, "order_id" => $id_order_update, "order_no" => $data["txt_order"], "vendor_id" => $data['v_name'], "location_id" => $data["LocationId"], "date_recieve" => new Zend_Date(), "status" => $data['status'], "is_active" => 0, "paid" => $data['paid'], "all_total" => $data['totalAmoun'], "balance" => $data['remain'], "user_recieve" => $GetUserId);
$recieved_order = $db_global->updateRecord($data_recieved_order, $recieved_id, "recieve_id", "tb_recieve_order");
unset($data_recieved_order);
}
}
$sqls = "DELETE FROM tb_recieve_order_item WHERE recieve_id IN ({$recieved_id})";
$db_global->deleteRecords($sqls);
unset($sqls);
foreach ($ids as $i) {
$recieved_item[$i] = array("recieve_id" => $recieved_id, "pro_id" => $data['item_id_' . $i], "order_id" => $id_order_update, "qty_order" => $data['qty' . $i], "qty_recieve" => $data['qty' . $i], "price" => $data['price' . $i], "total_before" => $data['total' . $i], "sub_total" => $data['total' . $i]);
$db->insert("tb_recieve_order_item", $recieved_item[$i]);
unset($recieved_item[$i]);
}
//.........这里部分代码省略.........
示例13: editAction
public function editAction()
{
$id = $this->getRequest()->getParam("id");
$db = new phurchase_Model_DbTable_DbVendor();
$data = $db->getCateById($id);
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost();
//print_r($data);exit();
if (isset($data['save'])) {
$db->updatCat($data, $id);
Application_Form_FrmMessage::message("ការកែប្រែបានជោគជ័យ");
Application_Form_FrmMessage::redirectUrl('/phurchase/vendor/edit/id/' . $id);
} elseif (isset($data['save_add'])) {
$db->updatCat($data, $id);
Application_Form_FrmMessage::message("ការកែប្រែបានជោគជ័យ");
Application_Form_FrmMessage::redirectUrl('/phurchase/vendor/add');
} elseif (isset($data['save_close'])) {
$db->updatCat($data, $id);
Application_Form_FrmMessage::message("ការកែប្រែបានជោគជ័យ");
Application_Form_FrmMessage::redirectUrl('/phurchase/vendor');
}
}
$form = new phurchase_Form_FrmVendor();
$this->view->frmcate = $form->FrmProCate($data);
}
示例14: addRecieveAction
public function addRecieveAction()
{
$db = new Application_Model_DbTable_DbGlobal();
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost();
$payment_purchase_order = new purchase_Model_DbTable_DbPurchaseVendor();
$payment_purchase_order->vendorPurchaseOrderPayment($data);
Application_Form_FrmMessage::message("Purchase has been received!");
if ($data['payment'] == 'Save New') {
Application_Form_FrmMessage::redirectUrl("/purchase/index/add-purchase");
//$this->_redirect("purchase/index/add-purchase");
} else {
$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");
}
///link left not yet get from DbpurchaseOrder
$frm_purchase = new Application_Form_purchase(null);
$form_add_purchase = $frm_purchase->productOrder(null);
Application_Model_Decorator::removeAllDecorator($form_add_purchase);
$this->view->form_purchase = $form_add_purchase;
$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;
}
示例15: editAction
public function editAction()
{
$id = $this->getRequest()->getParam('id') ? $this->getRequest()->getParam('id') : '0';
$db = new phurchase_Model_DbTable_DbOrder();
$itemRows = $db->selectProductOption();
$this->view->items = $itemRows;
$orderDetail = $db->getSalesOderID($id);
$this->view->rowsOrder = $orderDetail;
$itemRowsGet = $db->getProductOption();
$this->view->itemsOption = $itemRowsGet;
$data = $db->getPhurchase($id);
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost();
//print_r($data);exit();
if (isset($data['save'])) {
$db->updatCat($data, $id);
Application_Form_FrmMessage::message("ការកែប្រែបានជោគជ័យ");
Application_Form_FrmMessage::redirectUrl('/product/index/edit/id/' . $id);
} elseif (isset($data['save_add'])) {
$db->updatCat($data, $id);
Application_Form_FrmMessage::message("ការកែប្រែបានជោគជ័យ");
Application_Form_FrmMessage::redirectUrl('/product/index/add');
} elseif (isset($data['save_close'])) {
$db->updatCat($data, $id);
Application_Form_FrmMessage::message("ការកែប្រែបានជោគជ័យ");
Application_Form_FrmMessage::redirectUrl('/product');
}
}
$form = new phurchase_Form_FrmPhurchaseOrder();
$this->view->frmcate = $form->FrmProCate($data);
}