{"title":"Codeunit 7002 Price Calculation - V16, extension points 29","url":"https://jonas-paprotka.de/ref/codeunit/7002-price-calculation-v16/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-23","object":{"type":"codeunit","id":7002,"name":"Price Calculation - V16","app":"Base Application","url":"https://jonas-paprotka.de/ref/codeunit/7002-price-calculation-v16/"},"major":29,"source":{"url":"https://jonas-paprotka.de/ref/codeunit/7002-price-calculation-v16/source/","path":"src/Layers/W1/BaseApp/Pricing/Calculation/PriceCalculationV16.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:7006":{"name":"Price Calculation Setup","url":"https://jonas-paprotka.de/ref/table/7006-price-calculation-setup/"},"codeunit:7008":{"name":"Price Calculation Buffer Mgt.","url":"https://jonas-paprotka.de/ref/codeunit/7008-price-calculation-buffer-mgt/"},"page:7010":{"name":"Get Price Line","url":"https://jonas-paprotka.de/ref/page/7010-get-price-line/"},"table:7001":{"name":"Price List Line","url":"https://jonas-paprotka.de/ref/table/7001-price-list-line/"},"codeunit:7011":{"name":"Price Source List","url":"https://jonas-paprotka.de/ref/codeunit/7011-price-source-list/"},"table:7005":{"name":"Price Source","url":"https://jonas-paprotka.de/ref/table/7005-price-source/"},"codeunit:7007":{"name":"Price Asset List","url":"https://jonas-paprotka.de/ref/codeunit/7007-price-asset-list/"},"table:7003":{"name":"Price Asset","url":"https://jonas-paprotka.de/ref/table/7003-price-asset/"},"codeunit:7001":{"name":"Price Calculation Mgt.","url":"https://jonas-paprotka.de/ref/codeunit/7001-price-calculation-mgt/"}},"procs":[{"name":"OnRun","line":16,"kind":"trigger","steps":[[21,"write",7006,"DeleteAll"],[22,"call","AddSupportedSetup",1],[23,"write",7006,"ModifyAll"]]},{"name":"ApplyDiscount","line":44,"kind":"procedure","params":0,"steps":[[51,"call","CheckSpecificReadPermissionAccess",2],[57,"call","FindLines",4],[58,"call","CalcBestAmount",3],[60,"event","OnApplyDiscountOnBeforeFillBestLine",0],[61,"ext","codeunit",7008,"FillBestLine",2]]},{"name":"ApplyPrice","line":66,"kind":"procedure","params":1,"steps":[[74,"call","CheckSpecificReadPermissionAccess",2],[78,"call","FindLines",4],[80,"call","CalcBestAmount",3],[82,"ext","codeunit",7008,"FillBestLine",2]]},{"name":"CountDiscount","line":88,"kind":"procedure","params":1,"steps":[[93,"call","FindPriceLines",3]]},{"name":"CountPrice","line":97,"kind":"procedure","params":1,"steps":[[102,"call","FindPriceLines",3]]},{"name":"FindPriceLines","line":106,"kind":"procedure","access":"local","params":3,"steps":[[111,"call","FindLines",4]]},{"name":"FindDiscount","line":114,"kind":"procedure","params":2,"steps":[[118,"call","FindPriceLines",3]]},{"name":"FindPrice","line":121,"kind":"procedure","params":2,"steps":[[125,"call","FindPriceLines",3]]},{"name":"CheckSpecificReadPermissionAccess","line":128,"kind":"procedure","access":"local","params":2,"steps":[[140,"call","GetAppName",0],[143,"call","GetAppName",0],[149,"call","GetAppName",0],[152,"call","GetAppName",0]]},{"name":"IsDiscountExists","line":157,"kind":"procedure","params":1,"steps":[[161,"call","FindDiscount",2]]},{"name":"IsPriceExists","line":164,"kind":"procedure","params":1,"steps":[[168,"call","FindPrice",2]]},{"name":"PickDiscount","line":171,"kind":"procedure","params":0,"steps":[[175,"call","Pick",2]]},{"name":"PickPrice","line":178,"kind":"procedure","params":0,"steps":[[182,"call","Pick",2]]},{"name":"Pick","line":185,"kind":"procedure","access":"local","params":2,"steps":[[192,"call","CheckSpecificReadPermissionAccess",2],[196,"call","FindLines",4],[197,"ext","codeunit",7008,"GetAssets",1],[198,"ext","page",7010,"SetDataCaptionExpr",1],[199,"ext","page",7010,"SetForLookup",3],[202,"ext","codeunit",7008,"IsInMinQty",1],[204,"ext","codeunit",7008,"VerifySelectedLine",1],[205,"ext","codeunit",7008,"ConvertAmount",2]]},{"name":"ShowPrices","line":213,"kind":"procedure","params":1,"steps":[[218,"event","OnBeforeShowPrices",0],[221,"ext","page",7010,"SetForLookup",3]]},{"name":"AddSupportedSetup","line":226,"kind":"procedure","access":"local","params":1,"steps":[[229,"validate",7006,"Implementation"],[231,"call","IsDisabled",0],[234,"write",7006,"Insert",1],[236,"write",7006,"Insert",1]]},{"name":"IsDisabled","line":239,"kind":"procedure","access":"local","params":0,"steps":[[241,"event","OnIsDisabled",0]]},{"name":"PickBestLine","line":244,"kind":"procedure","access":"local","params":4,"steps":[[251,"event","OnBeforePickBestLine",1],[257,"call","IsImprovedLine",2],[257,"call","IsDegradedLine",2],[259,"call","IsImprovedLine",2],[259,"call","IsDegradedLine",2],[266,"call","IsBetterLine",3],[271,"event","OnAfterPickBestLine",0]]},{"name":"IsDegradedLine","line":274,"kind":"procedure","params":2,"steps":[[277,"call","IsBlankedValue",2],[278,"call","IsBlankedValue",2],[280,"event","OnAfterIsDegradedLine",0]]},{"name":"IsImprovedLine","line":288,"kind":"procedure","params":2,"steps":[[291,"call","IsSetValue",2],[292,"call","IsSetValue",2],[294,"event","OnAfterIsImprovedLine",0]]},{"name":"IsBetterLine","line":302,"kind":"procedure","params":3,"steps":[[308,"ext","table",7001,"IsRealLine",0],[312,"call","IsBetterPrice",3],[314,"call","IsBetterPrice",3],[316,"event","OnAfterIsBetterLine",0]]},{"name":"IsBetterPrice","line":319,"kind":"procedure","access":"local","params":3,"steps":[[322,"ext","table",7001,"IsRealLine",0]]},{"name":"FindLines","line":327,"kind":"procedure","params":4,"steps":[[342,"event","OnBeforeFindLines",1],[351,"write",7001,"DeleteAll"],[353,"ext","codeunit",7008,"SetFiltersOnPriceListLine",3],[354,"ext","codeunit",7008,"GetAssets",1],[355,"ext","codeunit",7008,"GetSources",1],[356,"event","OnFindLinesOnBefoerPriceSourceListGetMinMaxLevel",0],[357,"ext","codeunit",7011,"GetMinMaxLevel",1],[360,"ext","codeunit",7011,"First",2],[362,"ext","table",7005,"IsForAmountType",1],[364,"call","CopyLinesBySource",4],[365,"ext","codeunit",7008,"RestoreFilters",1],[367,"ext","codeunit",7011,"Next",1],[371,"ext","codeunit",7008,"FillBestLine",2],[373,"event","OnAfterFindLines",0]]},{"name":"CopyLinesBySource","line":376,"kind":"procedure","params":4,"steps":[[386,"ext","codeunit",7007,"GetMinMaxLevel",1],[389,"ext","codeunit",7007,"First",2],[393,"ext","codeunit",7007,"Next",1]]},{"name":"CopyLinesBySource","line":396,"kind":"procedure","params":4,"steps":[[406,"ext","table",7005,"FilterPriceLines",1],[407,"ext","table",7003,"FilterPriceLines",1],[408,"ext","table",7001,"CopyFilteredLinesToTemporaryBuffer",1]]},{"name":"CalcBestAmount","line":414,"kind":"procedure","params":3,"steps":[[418,"event","OnBeforeCalcBestAmount",0],[422,"ext","codeunit",7008,"IsInMinQty",1],[423,"ext","codeunit",7008,"ConvertAmount",2],[424,"call","PickBestLine",4],[430,"event","OnAfterCalcBestAmount",0]]},{"name":"OnFindImplementationHandler","line":442,"kind":"procedure","access":"local","params":1,"steps":[[444,"call","AddSupportedSetup",1]]},{"name":"OnCompanyInitializeHandler","line":448,"kind":"procedure","access":"local","params":0,"steps":[[454,"call","AddSupportedSetup",1],[463,"run","codeunit",7001]]}]}