From db3243fc53d45c355bd9ad75ca4f58bf0e0acbee Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Tue, 9 Dec 2025 15:47:21 +0700 Subject: (andri) status po to mr berdasarkan target tiap category product --- calculate_leadtime_po_to_mr.ktr | 210 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 199 insertions(+), 11 deletions(-) diff --git a/calculate_leadtime_po_to_mr.ktr b/calculate_leadtime_po_to_mr.ktr index 5067a75..d5c0904 100644 --- a/calculate_leadtime_po_to_mr.ktr +++ b/calculate_leadtime_po_to_mr.ktr @@ -486,6 +486,57 @@ + + dw bi indoteknik (localhost) + localhost + POSTGRESQL + Native + dw_bi_indoteknik + 5432 + postgres + Encrypted 2be98afc86aa7f2e4cb79ce10bec3fd89 + + + + + + FORCE_IDENTIFIERS_TO_LOWERCASE + N + + + FORCE_IDENTIFIERS_TO_UPPERCASE + N + + + IS_CLUSTERED + N + + + PORT_NUMBER + 5432 + + + PRESERVE_RESERVED_WORD_CASE + Y + + + QUOTE_ALL_FIELDS + N + + + SUPPORTS_BOOLEAN_DATA_TYPE + Y + + + SUPPORTS_TIMESTAMP_DATA_TYPE + N + + + USE_POOLING + N + + + Table input @@ -693,16 +744,58 @@ 0 Script 1 - //Script here -var po_to_arrival_status = 'not achieve'; -if (new_po_to_arrival <= 48) -{ - po_to_arrival_status = 'achieve' + var target_limit = 59; // Set Default Target + +var cat = parent_category; +if (cat == null) { + cat = ""; } -else{ - po_to_arrival_status = 'not achieve' + +switch (cat) { + case "Cairan Berbahan Kimia": + case "Komponen & Aksesoris": + case "Mesin Industrial": + target_limit = 46; + break; + + case "Pengaman, Kesehatan & Keamanan": + case "Peralatan Horeca & Food Service": + target_limit = 66; + break; + + case "Mesin Pembersih & Janitorial": + target_limit = 99; + break; + case "Mesin Pertanian & Perkebunan": + target_limit = 56; + break; + case "Peralatan Kantor & Stationery": + target_limit = 95; + break; + case "Peralatan Listrik & Elektronik": + target_limit = 71; + break; + case "Perkakas Tangan, Listrik & Pneumatic": + target_limit = 33; + break; + case "Perlengkapan Logistik & Gudang": + target_limit = 62; + break; + case "Perlengkapan Pengukuran & Pengujian": + target_limit = 41; + break; + + // --- DEFAULT () --- + default: + target_limit = 59; } - + +var po_to_arrival_status = 'not achieve'; +if (new_po_to_arrival != null) { + if (Math.floor(new_po_to_arrival) < target_limit) { + po_to_arrival_status = 'achieve'; + } +} @@ -786,18 +879,27 @@ else{ po_confirm_date + received_good_date + purchase_line_id + purchase_id + received_id + + + + parent_category + N @@ -829,21 +931,31 @@ else{ po_confirm_date + received_good_date + purchase_line_id + purchase_id + new_po_to_arrival + received_id + + + + parent_category + N @@ -1096,7 +1208,7 @@ else{ dw bi indoteknik (localhost) - select po_confirm_date, received_good_date, purchase_line_id, purchase_id, received_id + select po_confirm_date, received_good_date, purchase_line_id, purchase_id, received_id, parent_category from mv_leadtime_po_to_received --where purchase_id = 24864 and purchase_line_id = 140704 and received_id in (76715) 0 @@ -1107,7 +1219,7 @@ from mv_leadtime_po_to_received N - Timestamp + Date normal po_confirm_date 6 @@ -1130,7 +1242,7 @@ from mv_leadtime_po_to_received N - Timestamp + Date normal received_good_date 6 @@ -1221,6 +1333,29 @@ from mv_leadtime_po_to_received Asia/Bangkok N + + String + normal + parent_category + 2147483647 + -1 + Table input + parent_category + + . + , + + none + N + Y + 0 + N + N + N + en_US + Asia/Bangkok + N + @@ -1430,6 +1565,59 @@ FROM filtered_hours; Y + + Modified JavaScript value 2 + ScriptValueMod + + Y + + 1 + + none + + + N + 9 + + + 0 + Script 1 + //Script here +var po_to_arrival_status = 'not achieve'; +if (new_po_to_arrival <= 48) +{ + po_to_arrival_status = 'achieve' +} +else{ + po_to_arrival_status = 'not achieve' +} + + + + + + po_to_arrival_status + po_to_arrival_status + String + -1 + -1 + N + + + + + + + + + + + + 960 + 80 + Y + + -- cgit v1.2.3