Codeunit 5790 Available to Promise:
di function QtyAvailabletoPromise:
IF (UPPERCASE(USERID)='YOURNAME') THEN
MESSAGE('%1**%2**%3**%4',Item.Inventory,Item."Reserved Qty. on Inventory", ScheduledReceipt,GrossRequirement);
ATAU, di function CalcGrossRequirement:
IF (UPPERCASE(USERID)='YOURNAME') THEN BEGIN
MESSAGE('%1**%2',Item."Scheduled Need (Qty.)",Item."Res. Qty. on Prod. Order Comp.");
MESSAGE('%1**%2**%3',Item."Planning Issues (Qty.)",Item."Qty. on Sales Order",Item."Reserved Qty. on Sales Orders");
MESSAGE('%1**%2**%3',Item."Trans. Ord. Shipment (Qty.)",Item."Res. Qty. on Outbound Transfer", QtyOnPurchReturn);
Yang pernah terjadi adalah banyak PRO outstanding dimana hal tsb tidak diperhitungkan (tidak tampak) bila dilihat dari menu/form "Item Availibility"
Related
--------
Rumus utk kolom "Projected Available Balance" di report "Item Availibility":
Inventory | + | PlannedOrderReceipt | + | ScheduledReceipt | - | GrossRequirement |
= Planning Receipt (Qty.) + | = ("Scheduled Receipt (Qty.)" - "Reserved Qty. on Prod. Order") + | = ("Scheduled Need (Qty.)" - "Res. Qty. on Prod. Order Comp.") + | ||||
Planned Order Receipt (Qty.) + | ( Purch. Req. Receipt (Qty.) - "Res. Qty. on Req. Line") + | Planning Issues (Qty.) + | ||||
Purch. Req. Receipt (Qty.) | ("Qty. on Purch. Order" - "Reserved Qty. on Purch. Orders") + | ("Qty. on Sales Order" - "Reserved Qty. on Sales Orders") + | ||||
("Trans. Ord. Receipt (Qty.)" - "Res. Qty. on Inbound Transfer") + | ("Qty. on Service Order" - "Res. Qty. on Service Orders") + | |||||
"Qty. in Transit" + | ("Trans. Ord. Shipment (Qty.)" - "Res. Qty. on Outbound Transfer") + | |||||
QtyOnSalesReturn | QtyOnPurchReturn |
Qty. on Purch. Order | Sum("Purchase Line"."Outstanding Qty. (Base)" WHERE (Document Type=CONST(Order),Type=CONST(Item),No.=FIELD(No.),Shortcut Dimension 1 Code=FIELD(Global Dimension 1 Filter),Shortcut Dimension 2 Code=FIELD(Global Dimension 2 Filter),Location Code=FIELD(Location Filter),Drop Shipment=FIELD(Drop Shipment Filter),Variant Code=FIELD(Variant Filter),Expected Receipt Date=FIELD(Date Filter))) | |
Reserved Qty. on Purch. Orders | Sum("Reservation Entry"."Quantity (Base)" WHERE (Item No.=FIELD(No.),Source Type=CONST(39),Source Subtype=CONST(1),Reservation Status=CONST(Reservation),Location Code=FIELD(Location Filter),Variant Code=FIELD(Variant Filter),Expected Receipt Date=FIELD(Date Filter))) | |
Res. Qty. on Outbound Transfer | -Sum("Reservation Entry"."Quantity (Base)" WHERE (Item No.=FIELD(No.),Source Type=CONST(5741),Source Subtype=CONST(0),Reservation Status=CONST(Reservation),Location Code=FIELD(Location Filter),Variant Code=FIELD(Variant Filter),Shipment Date=FIELD(Date Filter))) | |
Scheduled Receipt (Qty.) | Sum("Prod. Order Line"."Remaining Qty. (Base)" WHERE (Status=FILTER(Planned..Released),Item No.=FIELD(No.),Variant Code=FIELD(Variant Filter),Shortcut Dimension 1 Code=FIELD(Global Dimension 1 Filter),Shortcut Dimension 2 Code=FIELD(Global Dimension 2 Filter),Location Code=FIELD(Location Filter),Due Date=FIELD(Date Filter))) | |
Scheduled Need (Qty.) | Sum("Prod. Order Component"."Remaining Qty. (Base)" WHERE (Status=FILTER(Planned..Released),Item No.=FIELD(No.),Variant Code=FIELD(Variant Filter),Shortcut Dimension 1 Code=FIELD(Global Dimension 1 Filter),Shortcut Dimension 2 Code=FIELD(Global Dimension 2 Filter),Location Code=FIELD(Location Filter),Due Date=FIELD(Date Filter))) | |
Reserved Qty. on Prod. Order | Sum("Reservation Entry"."Quantity (Base)" WHERE (Item No.=FIELD(No.),Source Type=CONST(5406),Source Subtype=FILTER(1..3),Reservation Status=CONST(Reservation),Location Code=FIELD(Location Filter),Variant Code=FIELD(Variant Filter),Expected Receipt Date=FIELD(Date Filter))) | |
Res. Qty. on Prod. Order Comp. | -Sum("Reservation Entry"."Quantity (Base)" WHERE (Item No.=FIELD(No.),Source Type=CONST(5407),Source Subtype=FILTER(1..3),Reservation Status=CONST(Reservation),Location Code=FIELD(Location Filter),Variant Code=FIELD(Variant Filter),Shipment Date=FIELD(Date Filter))) | |
Res. Qty. on Req. Line | Sum("Reservation Entry"."Quantity (Base)" WHERE (Item No.=FIELD(No.),Source Type=CONST(246),Source Subtype=FILTER(0),Reservation Status=CONST(Reservation),Location Code=FIELD(Location Filter),Variant Code=FIELD(Variant Filter),Expected Receipt Date=FIELD(Date Filter))) | |
Qty. in Transit | Sum("Transfer Line"."Qty. in Transit (Base)" WHERE (Derived From Line No.=CONST(0),Item No.=FIELD(No.),Transfer-to Code=FIELD(Location Filter),Variant Code=FIELD(Variant Filter),Shortcut Dimension 1 Code=FIELD(Global Dimension 1 Filter),Shortcut Dimension 2 Code=FIELD(Global Dimension 2 Filter),Receipt Date=FIELD(Date Filter))) | |
Trans. Ord. Receipt (Qty.) | Sum("Transfer Line"."Outstanding Qty. (Base)" WHERE (Derived From Line No.=CONST(0),Item No.=FIELD(No.),Transfer-to Code=FIELD(Location Filter),Variant Code=FIELD(Variant Filter),Shortcut Dimension 1 Code=FIELD(Global Dimension 1 Filter),Shortcut Dimension 2 Code=FIELD(Global Dimension 2 Filter),Receipt Date=FIELD(Date Filter))) | |
Planning Issues (Qty.) | Sum("Planning Component"."Expected Quantity (Base)" WHERE (Item No.=FIELD(No.),Due Date=FIELD(Date Filter),Location Code=FIELD(Location Filter),Variant Code=FIELD(Variant Filter),Shortcut Dimension 1 Code=FIELD(Global Dimension 1 Filter),Shortcut Dimension 2 Code=FIELD(Global Dimension 2 Filter),Planning Line Origin=CONST(" "))) | |
Planning Receipt (Qty.) | Sum("Requisition Line"."Quantity (Base)" WHERE (Type=CONST(Item),No.=FIELD(No.),Due Date=FIELD(Date Filter),Location Code=FIELD(Location Filter),Variant Code=FIELD(Variant Filter),Shortcut Dimension 1 Code=FIELD(Global Dimension 1 Filter),Shortcut Dimension 2 Code=FIELD(Global Dimension 2 Filter))) | |
Planned Order Receipt (Qty.) | Sum("Prod. Order Line"."Remaining Qty. (Base)" WHERE (Status=CONST(Planned),Item No.=FIELD(No.),Variant Code=FIELD(Variant Filter),Shortcut Dimension 1 Code=FIELD(Global Dimension 1 Filter),Shortcut Dimension 2 Code=FIELD(Global Dimension 2 Filter),Location Code=FIELD(Location Filter),Due Date=FIELD(Date Filter))) | |
Purch. Req. Receipt (Qty.) | Sum("Requisition Line"."Quantity (Base)" WHERE (Type=CONST(Item),No.=FIELD(No.),Variant Code=FIELD(Variant Filter),Location Code=FIELD(Location Filter),Shortcut Dimension 1 Code=FIELD(Global Dimension 1 Filter),Shortcut Dimension 2 Code=FIELD(Global Dimension 2 Filter),Due Date=FIELD(Date Filter),Planning Line Origin=CONST(" "))) | |
Reserved Qty. on Inventory | Sum("Reservation Entry"."Quantity (Base)" WHERE (Item No.=FIELD(No.),Source Type=CONST(32),Source Subtype=CONST(0),Reservation Status=CONST(Reservation),Serial No.=FIELD(Serial No. Filter),Lot No.=FIELD(Lot No. Filter),Location Code=FIELD(Location Filter),Variant Code=FIELD(Variant Filter))) | |
// Qty. on Sales Return | ||
WITH SalesLine DO BEGIN | ||
SETCURRENTKEY("Document Type",Type,"No.","Variant Code","Drop Shipment","Location Code","Shipment Date"); | ||
SETRANGE("Document Type","Document Type"::"Return Order"); | ||
SETRANGE(Type,Type::Item); | ||
SETRANGE("No.",Item."No."); | ||
SETFILTER("Location Code",Item.GETFILTER("Location Filter")); | ||
SETFILTER("Drop Shipment",Item.GETFILTER("Drop Shipment Filter")); | ||
SETFILTER("Variant Code",Item.GETFILTER("Variant Filter")); | ||
SETRANGE("Shipment Date",Item.GETRANGEMIN(Item."Date Filter"),Item.GETRANGEMAX(Item."Date Filter")); | ||
CALCSUMS("Outstanding Qty. (Base)"); | ||
QtyOnSalesReturn := "Outstanding Qty. (Base)"; | ||
RESET; | ||
END; | ||
WITH ReservationEntry DO BEGIN | ||
SETCURRENTKEY( | ||
"Item No.","Source Type","Source Subtype","Reservation Status", | ||
"Location Code","Variant Code","Shipment Date","Expected Receipt Date"); | ||
SETRANGE("Item No.",Item."No."); | ||
SETRANGE("Source Type",DATABASE::"Sales Line"); | ||
SETRANGE("Source Subtype",5); | ||
SETRANGE("Reservation Status","Reservation Status"::Reservation); | ||
SETFILTER("Location Code",Item.GETFILTER("Location Filter")); | ||
SETFILTER("Variant Code",Item.GETFILTER("Variant Filter")); | ||
SETRANGE("Shipment Date",Item.GETRANGEMIN(Item."Date Filter"),Item.GETRANGEMAX(Item."Date Filter")); | ||
CALCSUMS("Quantity (Base)"); | ||
QtyOnSalesReturn -= "Quantity (Base)"; | ||
RESET; | ||
END; | ||
// Qty. on Purchase Return | ||
WITH PurchLine DO BEGIN | ||
SETCURRENTKEY("Document Type",Type,"No.","Variant Code","Drop Shipment","Location Code","Expected Receipt Date"); | ||
SETRANGE("Document Type","Document Type"::"Return Order"); | ||
SETRANGE(Type,Type::Item); | ||
SETRANGE("No.",Item."No."); | ||
SETFILTER("Location Code",Item.GETFILTER("Location Filter")); | ||
SETFILTER("Drop Shipment",Item.GETFILTER("Drop Shipment Filter")); | ||
SETFILTER("Variant Code",Item.GETFILTER("Variant Filter")); | ||
SETRANGE("Expected Receipt Date",Item.GETRANGEMIN(Item."Date Filter"),Item.GETRANGEMAX(Item."Date Filter")); | ||
CALCSUMS("Outstanding Qty. (Base)"); | ||
QtyOnPurchReturn := "Outstanding Qty. (Base)"; | ||
RESET; | ||
END; | ||
WITH ReservationEntry DO BEGIN | ||
SETCURRENTKEY( | ||
"Item No.","Source Type","Source Subtype","Reservation Status", | ||
"Location Code","Variant Code","Shipment Date","Expected Receipt Date"); | ||
SETRANGE("Item No.",Item."No."); | ||
SETRANGE("Source Type",DATABASE::"Purchase Line"); | ||
SETRANGE("Source Subtype",5); | ||
SETRANGE("Reservation Status","Reservation Status"::Reservation); | ||
SETFILTER("Location Code",Item.GETFILTER("Location Filter")); | ||
SETFILTER("Variant Code",Item.GETFILTER("Variant Filter")); | ||
SETRANGE("Expected Receipt Date",Item.GETRANGEMIN(Item."Date Filter"),Item.GETRANGEMAX(Item."Date Filter")); | ||
CALCSUMS("Quantity (Base)"); | ||
QtyOnPurchReturn += "Quantity (Base)"; | ||
RESET; | ||
END; |
No comments:
Post a Comment