{"title":"Codeunit 70 Purch.-Calc.Discount, extension points 29","url":"https://jonas-paprotka.de/ref/codeunit/70-purch-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":70,"name":"Purch.-Calc.Discount","app":"Base Application","url":"https://jonas-paprotka.de/ref/codeunit/70-purch-calc-discount/"},"major":29,"source":{"url":"https://jonas-paprotka.de/ref/codeunit/70-purch-calc-discount/source/","path":"src/Layers/W1/BaseApp/Purchases/Document/PurchCalcDiscount.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:39":{"name":"Purchase Line","url":"https://jonas-paprotka.de/ref/table/39-purchase-line/"},"table:290":{"name":"VAT Amount Line","url":"https://jonas-paprotka.de/ref/table/290-vat-amount-line/"},"table:38":{"name":"Purchase Header","url":"https://jonas-paprotka.de/ref/table/38-purchase-header/"},"table:4":{"name":"Currency","url":"https://jonas-paprotka.de/ref/table/4-currency/"},"table:93":{"name":"Vendor Posting Group","url":"https://jonas-paprotka.de/ref/table/93-vendor-posting-group/"},"codeunit:65":{"name":"Discount Notification Mgt.","url":"https://jonas-paprotka.de/ref/codeunit/65-discount-notification-mgt/"},"codeunit:66":{"name":"Purch - Calc Disc. By Type","url":"https://jonas-paprotka.de/ref/codeunit/66-purch-calc-disc-by-type/"},"table:24":{"name":"Vendor Invoice Disc.","url":"https://jonas-paprotka.de/ref/table/24-vendor-invoice-disc/"}},"procs":[{"name":"OnRun","line":19,"kind":"trigger","steps":[[27,"event","OnOnRunOnBeforeUpdateHeader",0],[29,"call","CalculateInvoiceDiscount",2]]},{"name":"CalculateInvoiceDiscount","line":47,"kind":"procedure","params":2,"steps":[[59,"event","OnBeforeCalcPurchaseDiscount",1],[78,"write",39,"Modify"],[80,"write",39,"Insert"],[88,"event","OnCalculateInvoiceDiscountOnBeforeFindForCalcVATAmountLines",0],[90,"ext","table",39,"CalcVATAmountLines",4],[92,"ext","table",290,"GetTotalInvDiscBaseAmount",2],[95,"ext","table",290,"GetTotalLineAmount",2],[99,"write",38,"Modify"],[106,"call","GetVendInvDisc",2],[108,"event","OnCalculateInvoiceDiscountOnBeforeCheckVendInvDiscServiceCharge",0],[110,"event","OnCalculateInvoiceDiscountOnBeforeCurrencyInitialize",0],[111,"ext","table",4,"Initialize",1],[113,"ext","table",39,"SetPurchHeader",1],[118,"validate",39,"Direct Unit Cost"],[124,"validate",39,"Direct Unit Cost"],[125,"write",39,"Modify"],[133,"ext","table",39,"SetPurchHeader",1],[136,"validate",39,"No."],[136,"ext","table",93,"GetServiceChargeAccount",0],[138,"validate",39,"Quantity"],[139,"event","OnCalculateInvoiceDiscountOnAfterPurchLine2ValidateQuantity",0],[143,"validate",39,"Return Qty. to Ship"],[145,"validate",39,"Qty. to Receive"],[147,"validate",39,"Direct Unit Cost"],[153,"validate",39,"Direct Unit Cost"],[155,"event","OnCalculateInvoiceDiscountOnbeforePurchLineInsert",0],[156,"write",39,"Insert"],[158,"ext","table",39,"CalcVATAmountLines",4],[165,"event","OnCalculateInvoiceDiscountOnBeforeDeletePurchaseLine",1],[167,"write",39,"Delete",1],[171,"call","VendInvDiscRecExists",1],[173,"call","GetVendInvDisc",2],[175,"ext","codeunit",65,"NotifyAboutMissingSetup",5],[182,"write",38,"Modify"],[184,"ext","table",290,"SetInvoiceDiscountPercent",5],[189,"ext","table",39,"UpdateVATOnLines",4],[190,"call","UpdatePrepmtLineAmount",1],[193,"ext","codeunit",66,"ResetRecalculateInvoiceDisc",1],[194,"event","OnAfterCalcPurchaseDiscount",0]]},{"name":"GetVendInvDisc","line":197,"kind":"procedure","access":"local","params":2,"steps":[[202,"event","OnBeforeGetVendInvDisc",1],[206,"ext","table",24,"GetRec",4]]},{"name":"CalculateIncDiscForHeader","line":217,"kind":"procedure","params":1,"steps":[[230,"event","OnCalculateIncDiscForHeaderOnBeforeCalculateInvoiceDiscount",1],[232,"call","CalculateInvoiceDiscount",2]]},{"name":"CalculateInvoiceDiscountOnLine","line":235,"kind":"procedure","params":1,"steps":[[243,"call","CalculateInvoiceDiscount",2]]},{"name":"UpdatePrepmtLineAmount","line":248,"kind":"procedure","access":"local","params":1,"steps":[[261,"ext","table",39,"ZeroAmountLine",1],[263,"write",39,"Modify"]]}]}