From d32accf86a2baffcf7ce90554d1f8868ab518cf4 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Thu, 15 Jun 2023 15:07:24 +0700 Subject: change logic of sales monitoring --- indoteknik_custom/models/sale_monitoring.py | 16 ++++++---------- indoteknik_custom/models/sale_monitoring_detail.py | 16 ++++++---------- indoteknik_custom/views/sale_monitoring.xml | 16 ++++++++-------- indoteknik_custom/views/sale_monitoring_detail.xml | 16 ++++++++-------- 4 files changed, 28 insertions(+), 36 deletions(-) diff --git a/indoteknik_custom/models/sale_monitoring.py b/indoteknik_custom/models/sale_monitoring.py index ea1e490c..e79ff9ab 100755 --- a/indoteknik_custom/models/sale_monitoring.py +++ b/indoteknik_custom/models/sale_monitoring.py @@ -39,16 +39,12 @@ class SaleMonitoring(models.Model): SUM(smd.qty_so_invoiced) AS qty_so_invoiced, sum(smd.qty_reserved) as qty_reserved, CASE - WHEN SUM(qty_so) = SUM(qty_reserved) then 'SIAP KIRIM' - WHEN SUM(qty_so) = SUM(qty_so_delivered) then 'Delivered' - WHEN SUM(qty_so) = SUM(qty_so_invoiced) then 'Done' - WHEN SUM(qty_reserved) < SUM(qty_so) and SUM(qty_reserved) > 0 THEN 'Belum PO full' - WHEN SUM(qty_reserved) = SUM(qty_so) THEN 'Belum PO sama sekali' - WHEN SUM(qty_po_received) < SUM(qty_so) AND SUM(qty_po_received) <= 0 THEN 'Belum Received sama sekali' - WHEN SUM(qty_po_received) < SUM(qty_so) THEN 'Belum Received full' - WHEN SUM(qty_to_delivered) = SUM(qty_so) THEN 'SIAP KIRIM' - WHEN SUM(qty_to_delivered) < SUM(qty_so) and SUM(qty_to_delivered) > 0 THEN 'KIRIM SISANYA' - ELSE 'Belum Invoiced' + when sum(qty_so_invoiced) = sum(qty_so) then 'Invoiced' + when sum(qty_so_delivered) = sum(qty_so) then 'Delivered' + when sum(qty_reserved) >= sum(qty_so) then 'Siap kirim' + when sum(qty_po) + sum(qty_reserved) - sum(qty_po_received) < sum(qty_so) then 'Belum/Kurang PO' + when sum(qty_po_received) = 0 then 'Belum terima' + when sum(qty_po_received) < sum(qty_po) then 'Terima sebagian' END AS status, get_po_number(smd.sale_order_id) as po_number FROM sale_monitoring_detail smd diff --git a/indoteknik_custom/models/sale_monitoring_detail.py b/indoteknik_custom/models/sale_monitoring_detail.py index 908ccb68..2bcda50c 100755 --- a/indoteknik_custom/models/sale_monitoring_detail.py +++ b/indoteknik_custom/models/sale_monitoring_detail.py @@ -30,16 +30,12 @@ class SaleMonitoringDetail(models.Model): SELECT *, CASE - WHEN qty_so = qty_reserved then 'SIAP KIRIM' - WHEN qty_so = qty_so_delivered then 'Delivered' - WHEN qty_so = qty_so_invoiced then 'Done' - WHEN qty_reserved < qty_so and qty_reserved > 0 THEN 'Belum PO full' - WHEN qty_reserved = qty_so THEN 'Belum PO sama sekali' - WHEN qty_po_received < qty_so and qty_po_received <= 0 THEN 'Belum Received sama sekali' - WHEN qty_po_received < qty_so THEN 'Belum Received full' - WHEN qty_to_delivered = qty_so THEN 'SIAP KIRIM' - WHEN qty_to_delivered < qty_so and qty_to_delivered > 0 THEN 'KIRIM SISANYA' - ELSE 'Belum Invoiced' + when qty_so_invoiced = qty_so then 'Invoiced' + when qty_so_delivered = qty_so then 'Delivered' + when qty_reserved >= qty_so then 'Siap kirim' + when qty_po + qty_reserved - qty_po_received < qty_so then 'Belum/Kurang PO' + when qty_po_received = 0 then 'Belum terima' + when qty_po_received < qty_po then 'Terima sebagian' END AS status FROM ( diff --git a/indoteknik_custom/views/sale_monitoring.xml b/indoteknik_custom/views/sale_monitoring.xml index fffd140f..956e4a24 100755 --- a/indoteknik_custom/views/sale_monitoring.xml +++ b/indoteknik_custom/views/sale_monitoring.xml @@ -20,10 +20,10 @@ @@ -42,10 +42,10 @@ diff --git a/indoteknik_custom/views/sale_monitoring_detail.xml b/indoteknik_custom/views/sale_monitoring_detail.xml index 78bb92c7..736920b3 100755 --- a/indoteknik_custom/views/sale_monitoring_detail.xml +++ b/indoteknik_custom/views/sale_monitoring_detail.xml @@ -18,10 +18,10 @@ @@ -41,10 +41,10 @@ -- cgit v1.2.3