I have created 2 fields by extending the Sales Line table.
These two fields will be shown on the Sales Order Subform and will function like how Line Discount % works. It is just that, it will add the Premium Amount value to the Line Amount instead how Discount % subtracts Line Discount Amount from Line Amount.
Here is the code I have written on the Sales Order Subform;
layout { addafter("Line Discount %") { field("Premium %"; "Premium %") { ApplicationArea = All; BlankZero = true; trigger OnValidate() begin Update_Premium_Amount(); end; } field("Premium Amount"; "Premium Amount") { ApplicationArea = All; BlankZero = true; trigger OnValidate() begin Update_Premium_Percentage(); end; } } } local procedure Update_Premium_Amount() var percValue: Decimal; begin Clear(percValue); percValue := rec."Premium %" / 100; rec."Premium Amount" := rec."Line Amount" * percValue; rec."Line Amount" := rec."Line Amount" rec."Premium Amount"; CurrPage.Update(); UpdateAmounts(); CalcLineAmount(); end; local procedure Update_Premium_Percentage() begin if rec."Line Amount" <> 0 then begin rec."Premium %" := (rec."Premium Amount" * 100) / rec."Line Amount"; rec."Line Amount" := rec."Line Amount" rec."Premium Amount"; end; CurrPage.Update(); UpdateAmounts(); CalcLineAmount(); end;
My Subtotal Excl. VAT on the Subform gets updated, however, Total Excl VAT and Total Incl. VAT remains unchanged. Now I can't figure out how solve this.
Try validating the Line Amount field instead of assigning the value, are you referring the Amount Including VAT on the line? what is the VAT Calculation Type on the line?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156