summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/sale_monitoring.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-06-15 15:07:24 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-06-15 15:07:24 +0700
commitd32accf86a2baffcf7ce90554d1f8868ab518cf4 (patch)
treef321570f28647aba7710892750d291ca880fb902 /indoteknik_custom/models/sale_monitoring.py
parent64507a0c199721fee5e3fc8c808adec5a3ee6a5d (diff)
change logic of sales monitoring
Diffstat (limited to 'indoteknik_custom/models/sale_monitoring.py')
-rwxr-xr-xindoteknik_custom/models/sale_monitoring.py16
1 files changed, 6 insertions, 10 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