...
Cust@1001 : Record 18;
TempSalesLine@1002 : TEMPORARY Record 37;
Reservation@1005 : Form 498;
PrepmtMgt@1004 : Codeunit 441;
BEGIN
TESTFIELD("Document Type","Document Type"::"Blanket Order");
Cust.GET("Sell-to Customer No.");
Cust.CheckBlockedCustOnDocs(Cust,"Document Type"::Order,TRUE,FALSE);
...
...
Cust@1001 : Record 18;
TempSalesLine@1002 : TEMPORARY Record 37;
Reservation@1005 : Form 498;
PrepmtMgt@1004 : Codeunit 441;
// Add the following line.
Item@1006 : Record 27;
// End of the added line.
BEGIN
TESTFIELD("Document Type","Document Type"::"Blanket Order");
Cust.GET("Sell-to Customer No.");
Cust.CheckBlockedCustOnDocs(Cust,"Document Type"::Order,TRUE,FALSE);
...
...
SalesLine.SETRANGE("Blanket Order Line No.",BlanketOrderSalesLine."Line No.");
QuantityOnOrders := 0;
IF SalesLine.FINDSET THEN
REPEAT
IF SalesLine."Document Type" IN
[SalesLine."Document Type"::"Return Order",
SalesLine."Document Type"::"Credit Memo"]
THEN
...
...
SalesLine.SETRANGE("Blanket Order Line No.",BlanketOrderSalesLine."Line No.");
QuantityOnOrders := 0;
IF SalesLine.FINDSET THEN
REPEAT
// Add the following lines.
IF Item.GET(SalesLine."No.") THEN
Item.TESTFIELD(Blocked,FALSE);
// End of the added lines.
IF SalesLine."Document Type" IN
[SalesLine."Document Type"::"Return Order",
SalesLine."Document Type"::"Credit Memo"]
THEN
...
...
TempSalesLine.DELETEALL;
REPEAT
SalesLine.SETCURRENTKEY("Document Type","Blanket Order No.","Blanket Order Line No.");
SalesLine.SETRANGE("Blanket Order No.",BlanketOrderSalesLine."Document No.");
SalesLine.SETRANGE("Blanket Order Line No.",BlanketOrderSalesLine."Line No.");
// Delete the following lines.
SalesLine.SETFILTER(
"Document Type",'<>%1 & <>%2',SalesLine."Document Type"::Invoice,SalesLine."Document Type"::"Credit Memo");
// End of the deleted lines.
QuantityOnOrders := 0;
IF SalesLine.FINDSET THEN
REPEAT
IF Item.GET(SalesLine."No.") THEN
Item.TESTFIELD(Blocked,FALSE);
...
...
TempSalesLine.DELETEALL;
REPEAT
SalesLine.SETCURRENTKEY("Document Type","Blanket Order No.","Blanket Order Line No.");
SalesLine.SETRANGE("Blanket Order No.",BlanketOrderSalesLine."Document No.");
SalesLine.SETRANGE("Blanket Order Line No.",BlanketOrderSalesLine."Line No.");
QuantityOnOrders := 0;
IF SalesLine.FINDSET THEN
REPEAT
IF Item.GET(SalesLine."No.") THEN
Item.TESTFIELD(Blocked,FALSE);
...
...
QuantityOnOrders := 0;
IF SalesLine.FINDSET THEN
REPEAT
IF Item.GET(SalesLine."No.") THEN
Item.TESTFIELD(Blocked,FALSE);
// Delete the following lines.
IF SalesLine."Document Type" = SalesLine."Document Type"::"Return Order" THEN
QuantityOnOrders := QuantityOnOrders - SalesLine."Outstanding Qty. (Base)"
ELSE //Remove line
QuantityOnOrders := QuantityOnOrders + SalesLine."Outstanding Qty. (Base)";
// End of the deleted lines.
UNTIL SalesLine.NEXT = 0;
IF (ABS(BlanketOrderSalesLine."Qty. to Ship (Base)" + QuantityOnOrders +
BlanketOrderSalesLine."Qty. Shipped (Base)") >
ABS(BlanketOrderSalesLine."Quantity (Base)")) OR
(BlanketOrderSalesLine."Quantity (Base)" * BlanketOrderSalesLine."Outstanding Qty. (Base)" < 0)
...
...
QuantityOnOrders := 0;
IF SalesLine.FINDSET THEN
REPEAT
IF Item.GET(SalesLine."No.") THEN
Item.TESTFIELD(Blocked,FALSE);
// Add the following lines.
IF (SalesLine."Document Type" = SalesLine."Document Type"::"Return Order") OR
((SalesLine."Document Type" = SalesLine."Document Type"::"Credit Memo") AND
(SalesLine."Return Receipt No." = ''))
THEN
QuantityOnOrders := QuantityOnOrders - SalesLine."Outstanding Qty. (Base)"
ELSE
IF (SalesLine."Document Type" = SalesLine."Document Type"::Order) OR
((SalesLine."Document Type" = SalesLine."Document Type"::Invoice) AND
(SalesLine."Shipment No." = ''))
THEN
QuantityOnOrders := QuantityOnOrders + SalesLine."Outstanding Qty. (Base)";
// End of the added lines.
UNTIL SalesLine.NEXT = 0;
IF (ABS(BlanketOrderSalesLine."Qty. to Ship (Base)" + QuantityOnOrders +
BlanketOrderSalesLine."Qty. Shipped (Base)") >
ABS(BlanketOrderSalesLine."Quantity (Base)")) OR
(BlanketOrderSalesLine."Quantity (Base)" * BlanketOrderSalesLine."Outstanding Qty. (Base)" < 0)
...