{"title":"Codeunit 60 Sales-Calc. Discount, extension points 29","url":"https://jonas-paprotka.de/ref/codeunit/60-sales-calc-discount/points/","author":"JOP-AL","license":"Metadata from Microsoft's symbol packages. AL source MIT, Copyright (c) Microsoft Corporation. Selection and wording © 2026 JOP-AL. https://jonas-paprotka.de/licenses/","subject":"Microsoft Dynamics 365 Business Central","checked":"2026-11-20","changed":"2026-10-05","object":{"type":"codeunit","id":60,"name":"Sales-Calc. Discount","app":"Base Application","url":"https://jonas-paprotka.de/ref/codeunit/60-sales-calc-discount/"},"major":29,"source":{"url":"https://jonas-paprotka.de/ref/codeunit/60-sales-calc-discount/source/","path":"src/Layers/W1/BaseApp/Sales/Document/SalesCalcDiscount.Codeunit.al","commit":"4303e5e584d3aa5d9e98cbc615525a5396ad6ed7","lines":"a line is <source url>#L<line>"},"steps":{"event":"[line, \"event\", name, handled]: raises an event of this object; handled 1 when it has an IsHandled parameter","call":"[line, \"call\", name, arguments]: calls a procedure of this object","ext":"[line, \"ext\", type, id, name, arguments]: calls a procedure of another object, through a variable declared with that type","write":"[line, \"write\", table id, method, 1 when called with true]: Insert, Modify, ModifyAll, Delete, DeleteAll or Rename","validate":"[line, \"validate\", table id, field name]","run":"[line, \"run\", type, id]: Codeunit.Run, Page.Run, Report.Run and their kin"},"objects":{"table:37":{"name":"Sales Line","url":"https://jonas-paprotka.de/ref/table/37-sales-line/"},"table:290":{"name":"VAT Amount Line","url":"https://jonas-paprotka.de/ref/table/290-vat-amount-line/"},"table:36":{"name":"Sales Header","url":"https://jonas-paprotka.de/ref/table/36-sales-header/"},"table:19":{"name":"Cust. Invoice Disc.","url":"https://jonas-paprotka.de/ref/table/19-cust-invoice-disc/"},"table:4":{"name":"Currency","url":"https://jonas-paprotka.de/ref/table/4-currency/"},"table:92":{"name":"Customer Posting Group","url":"https://jonas-paprotka.de/ref/table/92-customer-posting-group/"},"codeunit:65":{"name":"Discount Notification Mgt.","url":"https://jonas-paprotka.de/ref/codeunit/65-discount-notification-mgt/"},"codeunit:56":{"name":"Sales - Calc Discount By Type","url":"https://jonas-paprotka.de/ref/codeunit/56-sales-calc-discount-by-type/"}},"procs":[{"name":"OnRun","line":23,"kind":"trigger","steps":[[33,"event","OnRunOnBeforeCalculateInvoiceDiscount",1],[35,"call","CalculateInvoiceDiscount",2]]},{"name":"CalculateInvoiceDiscount","line":57,"kind":"procedure","access":"local","params":2,"steps":[[67,"event","OnBeforeCalculateInvoiceDiscount",0],[74,"event","OnBeforeCalcSalesDiscount",1],[92,"write",37,"Modify"],[94,"write",37,"Insert"],[102,"event","OnCalculateInvoiceDiscountOnBeforeSalesLine2FindFirst",0],[104,"ext","table",37,"CalcVATAmountLines",4],[106,"ext","table",290,"GetTotalInvDiscBaseAmount",2],[109,"ext","table",290,"GetTotalLineAmount",2],[113,"write",36,"Modify"],[120,"ext","table",19,"GetRecord",4],[122,"event","OnCalculateInvoiceDiscountOnBeforeCheckCustInvDiscServiceCharge",0],[124,"event","OnCalculateInvoiceDiscountOnBeforeCurrencyInitialize",0],[125,"ext","table",4,"Initialize",1],[127,"ext","table",37,"SetSalesHeader",1],[131,"call","SetSalesLineServiceCharge",2],[132,"write",37,"Modify"],[135,"event","OnCalculateInvoiceDiscountOnBeforeUpdateSalesLine2",1],[143,"ext","table",37,"SetSalesHeader",1],[147,"validate",37,"No."],[147,"ext","table",92,"GetServiceChargeAccount",0],[149,"validate",37,"Quantity"],[151,"event","OnAfterValidateSalesLine2Quantity",0],[156,"validate",37,"Return Qty. to Receive"],[158,"validate",37,"Qty. to Ship"],[159,"call","SetSalesLineServiceCharge",2],[160,"event","OnCalculateInvoiceDiscountOnBeforeSalesLineInsert",0],[161,"write",37,"Insert"],[164,"ext","table",37,"CalcVATAmountLines",4],[171,"event","OnCalculateInvoiceDiscountOnBeforeSalesLine2DeleteTrue",1],[173,"write",37,"Delete",1],[178,"event","OnCalculateInvoiceDiscountOnBeforeCustInvDiscRecExists",1],[182,"call","CustInvDiscRecExists",1],[184,"event","OnAfterCustInvDiscRecExists",0],[186,"ext","table",19,"GetRecord",4],[189,"ext","codeunit",65,"NotifyAboutMissingSetup",5],[193,"call","UpdateSalesHeaderInvoiceDiscount",3],[195,"ext","table",37,"SetSalesHeader",1],[196,"ext","table",37,"UpdateVATOnLines",4],[197,"call","UpdatePrepmtLineAmount",1],[200,"ext","codeunit",56,"ResetRecalculateInvoiceDisc",1],[201,"event","OnAfterCalcSalesDiscount",0]]},{"name":"UpdateSalesHeaderInvoiceDiscount","line":204,"kind":"procedure","access":"local","params":3,"steps":[[209,"event","OnBeforeUpdateSalesHeaderInvoiceDiscount",1],[216,"write",36,"Modify"],[218,"ext","table",290,"SetInvoiceDiscountPercent",5]]},{"name":"SetSalesLineServiceCharge","line":224,"kind":"procedure","access":"local","params":2,"steps":[[229,"event","OnBeforeSetSalesLineServiceCharge",1],[234,"validate",37,"Unit Price"],[238,"validate",37,"Unit Price"]]},{"name":"CustInvDiscRecExists","line":246,"kind":"procedure","params":1,"steps":[[252,"event","OnBeforeCustInvDiscRecExists",1]]},{"name":"CalculateWithSalesHeader","line":265,"kind":"procedure","params":2,"steps":[[271,"event","OnBeforeCalculateWithSalesHeader",1],[279,"call","CalculateInvoiceDiscount",2]]},{"name":"CalculateInvoiceDiscountOnLine","line":288,"kind":"procedure","params":1,"steps":[[294,"call","CalculateInvoiceDiscount",2]]},{"name":"CalculateIncDiscForHeader","line":303,"kind":"procedure","params":1,"steps":[[309,"event","OnBeforeCalculateIncDiscForHeader",1],[320,"call","CalculateInvoiceDiscount",2]]},{"name":"UpdatePrepmtLineAmount","line":327,"kind":"procedure","params":1,"steps":[[340,"ext","table",37,"ZeroAmountLine",1],[342,"write",37,"Modify"]]}]}