From 4a484866c2b4de16066044026be6b0412798332a Mon Sep 17 00:00:00 2001 From: Asif Date: Mon, 9 Apr 2018 17:31:18 +0800 Subject: [PATCH 1/6] final --- .../modul-js/common/dashboard/dashboard.so.js | 24 +++++++++++ modul/common/dashboard/dashboard.so.list.php | 4 ++ modul/common/dashboard/init.php | 42 ++++++++++++++++++- 3 files changed, 69 insertions(+), 1 deletion(-) diff --git a/assets/modul-js/common/dashboard/dashboard.so.js b/assets/modul-js/common/dashboard/dashboard.so.js index 73ae66a..67a0dc5 100755 --- a/assets/modul-js/common/dashboard/dashboard.so.js +++ b/assets/modul-js/common/dashboard/dashboard.so.js @@ -104,7 +104,31 @@ $(document).ready(function() { jQuery("#previewMarking").modal('show'); } }); + }); + + $(document).on("click", ".soDelete", function() { + var id = $(this).data('id'); + var dataStringg = 'id=' + id; + $.ajax({ + type: "POST", + url: "/dashboard/shipping-order/delete", + cache: false, + data: dataStringg, + success: function(data, statusText, xhr) { + if (xhr.status === 200){ + // alert + alert('success'); + location.reload(); + } + else if(xhr.status === 201){ + alert('failed'); + location.reload(); + } + + } + }); }); + }); $().ready(function() { $('.modal.printable1').on('shown.bs.modal', function() { diff --git a/modul/common/dashboard/dashboard.so.list.php b/modul/common/dashboard/dashboard.so.list.php index 780061a..567719f 100755 --- a/modul/common/dashboard/dashboard.so.list.php +++ b/modul/common/dashboard/dashboard.so.list.php @@ -64,6 +64,10 @@ $requestData= $_REQUEST;
  • Print Marking
  • +
  • + Delete +
  • + '; diff --git a/modul/common/dashboard/init.php b/modul/common/dashboard/init.php index af759bf..770da9e 100755 --- a/modul/common/dashboard/init.php +++ b/modul/common/dashboard/init.php @@ -92,7 +92,47 @@ function the_dashboard(){ $curpage = $request->get('page'); include 'dashboard.so.list.php'; return ''; - }); + }); + + $app->post('/dashboard/shipping-order/delete', function(Request $request) { + global $db; + + $so_id = $request->get('id'); + $db->bind("so_id",$so_id); + $result=$db->query('DELETE FROM shipping_orders where so_id = :so_id'); + + + + //return new Response('success', 200); + + + + + + $db->bind("so_id",$so_id); + $result2 = $db->query('DELETE FROM shipping_order_items WHERE so_id = :so_id'); + + + + if($result && $result2){ + + return new Response('Success', 200); + + } + else{ + return new Response('failed', 201) ;} + + // return new Response(print_r(array_values($order_items)), 201); + // if(result&&) + // { + //$orderselection['id']; + + + // } + + // } + + }); } include 'dashboard.func.php'; \ No newline at end of file From 0cf0a5f8fa0c680b2860a107de4a6769133ab9af Mon Sep 17 00:00:00 2001 From: jack Date: Wed, 11 Apr 2018 15:22:43 +0800 Subject: [PATCH 2/6] temporary remove messenger and notice --- assets/modul-js/admin/help.js | 2 +- .../warehouse-arrangement/create.js | 8 ++++---- assets/modul-js/common/messenger/general.js | 2 +- assets/modul-js/common/messenger/help.js | 2 +- assets/modul-js/common/messenger/order.js | 2 +- assets/modul-js/common/messenger/order.min.js | 2 +- includes/tpl/footer.php | 2 +- modul/arrangements/warehouse/init.php | 17 ++++++++++++----- modul/arrangements/warehouse/warehouse.func.php | 10 +++++----- modul/common/dashboard/dashboard.func.php | 3 +++ 10 files changed, 30 insertions(+), 20 deletions(-) diff --git a/assets/modul-js/admin/help.js b/assets/modul-js/admin/help.js index 66a782a..1869af2 100755 --- a/assets/modul-js/admin/help.js +++ b/assets/modul-js/admin/help.js @@ -102,7 +102,7 @@ var Script = function() { }; }; $(function() { - startRefresh(); + //startRefresh(); // getSide(); }); diff --git a/assets/modul-js/arrangements/warehouse-arrangement/create.js b/assets/modul-js/arrangements/warehouse-arrangement/create.js index bc625c5..30969a7 100755 --- a/assets/modul-js/arrangements/warehouse-arrangement/create.js +++ b/assets/modul-js/arrangements/warehouse-arrangement/create.js @@ -196,13 +196,13 @@ var FormWizard = function () { $("#wait").hide(); $("#suksesupdate").show(); //$("#gagalupdate").hide(); - location.reload(); + //location.reload(); }else{ $("#finish").show(); $("#wait").hide(); //$("#suksesupdate").show(); $("#gagalupdate").show(); - location.reload(); + //location.reload(); } } @@ -227,13 +227,13 @@ var FormWizard = function () { $("#wait").hide(); $("#suksesupdate").show(); //$("#gagalupdate").hide(); - location.reload(); + //location.reload(); }else{ $("#finish").show(); $("#wait").hide(); //$("#suksesupdate").show(); $("#gagalupdate").show(); - location.reload(); + //location.reload(); } } diff --git a/assets/modul-js/common/messenger/general.js b/assets/modul-js/common/messenger/general.js index d70494f..dfda39b 100755 --- a/assets/modul-js/common/messenger/general.js +++ b/assets/modul-js/common/messenger/general.js @@ -49,7 +49,7 @@ var Script = function() { }; $(function() { - startRefresh(); + //startRefresh(); }); }(); \ No newline at end of file diff --git a/assets/modul-js/common/messenger/help.js b/assets/modul-js/common/messenger/help.js index 69ab23b..87bb021 100755 --- a/assets/modul-js/common/messenger/help.js +++ b/assets/modul-js/common/messenger/help.js @@ -98,7 +98,7 @@ var Script = function() { }; $(function() { - startRefresh(); + //startRefresh(); }); }(); \ No newline at end of file diff --git a/assets/modul-js/common/messenger/order.js b/assets/modul-js/common/messenger/order.js index efa0804..4777f1b 100755 --- a/assets/modul-js/common/messenger/order.js +++ b/assets/modul-js/common/messenger/order.js @@ -243,7 +243,7 @@ var Script = function() { }; $(function() { - startRefresh(); + //startRefresh(); }); }(); diff --git a/assets/modul-js/common/messenger/order.min.js b/assets/modul-js/common/messenger/order.min.js index bf3fac3..4e5ff85 100755 --- a/assets/modul-js/common/messenger/order.min.js +++ b/assets/modul-js/common/messenger/order.min.js @@ -356,7 +356,7 @@ var Script = function() { }; $(function() { - startRefresh(); + //startRefresh(); }); }(); diff --git a/includes/tpl/footer.php b/includes/tpl/footer.php index d2b5bb6..f49125d 100755 --- a/includes/tpl/footer.php +++ b/includes/tpl/footer.php @@ -84,7 +84,7 @@ timeout(); }, 3000); } - timeout(); + //timeout(); diff --git a/modul/arrangements/warehouse/init.php b/modul/arrangements/warehouse/init.php index 2cb6ac1..e1e77cc 100755 --- a/modul/arrangements/warehouse/init.php +++ b/modul/arrangements/warehouse/init.php @@ -200,6 +200,8 @@ function the_warehouse_arrangement(){ $warehousearrangementsCreate = $db->query("INSERT INTO warehouse_arrangements (receive_on, transport_company_name, consignment_note_no, warehouse_receive_note_no, receiving_person, remarks, status, so_id, user_id, company_id) VALUES (:receive_on, :transport_company_name, :consignment_note_no, :warehouse_receive_note_no, :receiving_person, :remarks, :status, :so_id, :user_id, :company_id);"); $warehouse_arrangement_id = $db->lastInsertId(); $unmatch_count = 0; + + if($warehousearrangementsCreate){ foreach ($warehouse_arrangement_items as $key => $warehouse_arrangement_item) { $db->bind("actual_ctn", $warehouse_arrangement_item['actual_ctn']); @@ -214,25 +216,30 @@ function the_warehouse_arrangement(){ $db->bind("so_item_id", $warehouse_arrangement_item['so_item_id']); $db->bind("warehouse_arrangement_id", $warehouse_arrangement_id); - $warehouse_arrangement_itemsCreate = $db->query("INSERT INTO warehouse_arrangement_items (actual_ctn, actual_measurement_ctn, actual_weight_ctn, actual_height_ctn, actual_width_ctn, actual_depth_ctn, status, isDamaged, image, so_item_id, warehouse_arrangement_id) VALUES (:actual_ctn, :actual_measurement_ctn, :actual_weight_ctn, :actual_height_ctn, :actual_width_ctn, :actual_depth_ctn, :status, :isDamaged, :image, :so_item_id, :warehouse_arrangement_id);"); - + if($warehouse_arrangement_item['status'] == 1 || $warehouse_arrangement_item['isDamaged'] == 1){ $unmatch_count++; } } } + else{ + return new Response("Warehouse arrangement create failed", 201); + } + // ** HOW DO YOU CHECK FOREACH USING THIS IF ELSE ** if ($warehouse_arrangement_itemsCreate) { //update so status $db->bind("status", "1"); $db->bind("so_id", $so_id); - $soUpdate = $db->query("UPDATE `shipping_orders` SET `status`=:status WHERE so_id = :so_id"); + $soUpdate = $db->query("UPDATE `shipping_orders` SET `status`=:status WHERE so_id = :so_id"); + + return new Response('UPDATE `shipping_orders` SET `status`='.$status.' WHERE so_id = '.$so_id.'"', 201); //create messages $db->bind("message", "Your Warehouse Receive Note have been created."); @@ -278,10 +285,10 @@ function the_warehouse_arrangement(){ if($soUpdate){ return new Response("SUCCESS", 200); }else{ - return new Response('FAILED', 201); + return new Response('Shipping order update failed', 201); } } else { - return new Response('FAILED', 201); + return new Response('Warehouse arrangement item update failed', 201); } }); diff --git a/modul/arrangements/warehouse/warehouse.func.php b/modul/arrangements/warehouse/warehouse.func.php index 0d823c8..5014aec 100755 --- a/modul/arrangements/warehouse/warehouse.func.php +++ b/modul/arrangements/warehouse/warehouse.func.php @@ -49,6 +49,7 @@ function getItemBalanceFromSOID($so_id){ } } +// get shipping order if warehouse not received function getAllSOWithoutWarehouse(){ global $db; @@ -57,11 +58,10 @@ function getAllSOWithoutWarehouse(){ $PO = ""; foreach ($data as $key => $value) { - // Fix display all shipping order - // if(getItemBalanceFromSOID($value['so_id']) <> 0){ - // $PO .= "'; - // } - $PO .= "'; + if(getItemBalanceFromSOID($value['so_id']) <> 0){ + $PO .= "'; + } + //$PO .= "'; } return $PO; diff --git a/modul/common/dashboard/dashboard.func.php b/modul/common/dashboard/dashboard.func.php index 8fc90e1..7170a5b 100755 --- a/modul/common/dashboard/dashboard.func.php +++ b/modul/common/dashboard/dashboard.func.php @@ -39,6 +39,9 @@ function getGeneralStatus($so_id){ }elseif($daStatus == 5){ return "Delivery Request Rejected"; } + elseif($soStatus == 4 ){ + return "Order Canceled"; + } }else{ return "Order Created"; } From a062374850d0f9cbc1bbc8f574c1d83f5a1ca0b8 Mon Sep 17 00:00:00 2001 From: jack Date: Wed, 11 Apr 2018 16:08:45 +0800 Subject: [PATCH 3/6] added order cancelation --- .../modul-js/common/dashboard/dashboard.so.js | 4 +- modul/common/dashboard/dashboard.func.php | 7 ++-- modul/common/dashboard/dashboard.so.list.php | 19 ++++++--- modul/common/dashboard/init.php | 40 ------------------- modul/orders/shipping-order/init.php | 22 +++++++++- 5 files changed, 41 insertions(+), 51 deletions(-) diff --git a/assets/modul-js/common/dashboard/dashboard.so.js b/assets/modul-js/common/dashboard/dashboard.so.js index 67a0dc5..616596f 100755 --- a/assets/modul-js/common/dashboard/dashboard.so.js +++ b/assets/modul-js/common/dashboard/dashboard.so.js @@ -106,12 +106,12 @@ $(document).ready(function() { }); }); - $(document).on("click", ".soDelete", function() { + $(document).on("click", ".soCancel", function() { var id = $(this).data('id'); var dataStringg = 'id=' + id; $.ajax({ type: "POST", - url: "/dashboard/shipping-order/delete", + url: "/dashboard/shipping-order/cancel", cache: false, data: dataStringg, success: function(data, statusText, xhr) { diff --git a/modul/common/dashboard/dashboard.func.php b/modul/common/dashboard/dashboard.func.php index 7170a5b..7e340af 100755 --- a/modul/common/dashboard/dashboard.func.php +++ b/modul/common/dashboard/dashboard.func.php @@ -39,10 +39,11 @@ function getGeneralStatus($so_id){ }elseif($daStatus == 5){ return "Delivery Request Rejected"; } - elseif($soStatus == 4 ){ - return "Order Canceled"; } - }else{ + elseif($soStatus == 4 ){ + return "Canceled"; + } + else{ return "Order Created"; } } \ No newline at end of file diff --git a/modul/common/dashboard/dashboard.so.list.php b/modul/common/dashboard/dashboard.so.list.php index 567719f..0517d95 100755 --- a/modul/common/dashboard/dashboard.so.list.php +++ b/modul/common/dashboard/dashboard.so.list.php @@ -48,26 +48,35 @@ $requestData= $_REQUEST; -