//To update invoice discount++
SalesHeader2.Reset();
SalesHeader2.SetRange(/External Document No./, LocationGUID);
if SalesHeader2.FindSet() then begin
repeat
OrderDiscountAmt1 := 0;
SalespossierBridge5.Reset();
SalespossierBridge5.SetRange(/Sales Order No./, SalesHeader2./No./);
SalespossierBridge5.SetFilter(Discount_discounts, '<>%1', '');
if SalespossierBridge5.FindSet() then begin
repeat
Evaluate(OrderDiscountAmt, SalespossierBridge5.Discount_discounts);
OrderDiscountAmt1 += OrderDiscountAmt;
until SalespossierBridge5.Next() = 0;
SalesHeader2./Invoice Discount Calculation/ := SalesHeader2./Invoice Discount Calculation/::Amount;
SalesHeader2./Invoice Discount Value/ := OrderDiscountAmt1;
SalesHeader2.Modify();
end;
until SalesHeader2.Next() = 0;
end;
//