Codeunit 56 "Sales - Calc Discount By Type"
Base Application · Microsoft.Sales.Document
Across versions
- BC23present
- BC242 events added
- BC252 procedures added, 1 procedures changed
- BC26-30unchanged
Neighbourhood 34 connected objects and pages
Base Application · Microsoft.Sales.Document · BC23-30 · source at ea08af5e · facts from BC29
Properties
| Property | Value |
|---|---|
| TableNo | Sales Line |
Events published
OnAfterResetRecalculateInvoiceDisc(var SalesHeader: Record "Sales Header")(integration)- subscribers: Codeunit 5477 “Sales Invoice Aggregator” OnAfterResetRecalculateInvoiceDisc, Codeunit 5496 “Graph Mgt - Sales Order Buffer” OnAfterResetRecalculateInvoiceDisc, Codeunit 5506 “Graph Mgt - Sales Quote Buffer” OnAfterResetRecalculateInvoiceDisc, Codeunit 5508 “Graph Mgt - Sal. Cr. Memo Buf.” OnAfterResetRecalculateCreditMemoDisc
OnBeforeApplyDefaultInvoiceDiscount(var SalesHeader: Record "Sales Header"; var IsHandled: Boolean; InvoiceDiscountAmount: Decimal)(integration)OnBeforeApplyInvDiscBasedOnAmt(InvoiceDiscountAmount: Decimal; var SalesHeader: Record "Sales Header")(integration)OnBeforeShouldRedistributeInvoiceDiscountAmount(var SalesHeader: Record "Sales Header"; var IsHandled: Boolean)(integration)OnGetCustInvoiceDiscountPctOnCaseInvDiscCalcPercent(var SkipCustInvDiscCheck: Boolean)+ BC24 (integration)OnShouldRedistributeInvoiceDiscountAmountOnCaseInvDiscCalculationNone(SalesHeader: Record "Sales Header"; var ShouldRedistributeInvDiscAmt: Boolean)+ BC24 (integration)
Procedures
ApplyDefaultInvoiceDiscount(InvoiceDiscountAmount: Decimal; var SalesHeader: Record "Sales Header"): Applies the default invoice discount to the sales header.ApplyDefaultInvoiceDiscount(InvoiceDiscountAmount: Decimal; var SalesHeader: Record "Sales Header"; ModifyBeforeApplying: Boolean)(internal)ApplyInvDiscBasedOnAmt(InvoiceDiscountAmount: Decimal; var SalesHeader: Record "Sales Header"): Applies invoice discount based on a specific amount.GetCustInvoiceDiscountPct(SalesLine: Record "Sales Line"): Decimal: Gets the customer invoice discount percentage for a sales line.ShouldRedistributeInvoiceDiscountAmount(var SalesHeader: Record "Sales Header"): Boolean: Determines whether the invoice discount amount should be redistributed.ResetRecalculateInvoiceDisc(SalesHeader: Record "Sales Header"): Resets the recalculate invoice discount flag on all sales lines.CustInvDiscRecExists(InvDiscCode: Code[20]): BooleanΔ BC25: Checks if a customer invoice discount record exists for the given code.InvoiceDiscIsAllowed(InvDiscCode: Code[20]): Boolean: Checks if invoice discount is allowed for the given discount code.CalcInvoiceDiscOnLine(CalcInvoiceDiscountOnLine: Boolean): Sets the flag to calculate invoice discount on a specific line.
Plus 4 local procedures.
Triggers
OnRun
Relations
- runs on Table 37 “Sales Line”
Calls
From the extracted call graph of BC29 (graphify-al on the snapshot checkout): calls whose target is known from a declared type or an Object::"Name" argument. Interface dispatch and calls through events are not counted, so the list is not complete.
- Codeunit 60 “Sales-Calc. Discount” (2 calls:
ApplyInvDiscBasedOnPct → (object),ApplyInvDiscBasedOnPct → CalculateInvoiceDiscountOnLine) - Codeunit 65 “Discount Notification Mgt.” (1 call:
ApplyInvDiscBasedOnAmt → NotifyAboutMissingSetup) - Codeunit 9179 “Application Area Mgmt. Facade” (1 call:
ShouldRedistributeInvoiceDiscountAmount → IsFoundationEnabled)
Called by
- Codeunit 57 “Document Totals” (3 calls:
SalesRedistributeInvoiceDiscountAmounts → (object),SalesUpdateTotalsControls → InvoiceDiscIsAllowed,SalesUpdateTotalsControls → ShouldRedistributeInvoiceDiscountAmount) - Codeunit 86 “Sales-Quote to Order” (2 calls:
OnRun → ResetRecalculateInvoiceDisc,OnRun → ShouldRedistributeInvoiceDiscountAmount) - Codeunit 87 “Blanket Sales Order to Order” (2 calls:
OnRun → ResetRecalculateInvoiceDisc,OnRun → ShouldRedistributeInvoiceDiscountAmount) - Page 95 “Sales Quote Subform” (2 calls:
UpdatePage → ApplyDefaultInvoiceDiscount,ValidateInvoiceDiscountAmount → ApplyInvDiscBasedOnAmt) - Codeunit 5341 “CRM Int. Table. Subscriber” (1 call:
ApplySalesOrderDiscounts → ApplyInvDiscBasedOnAmt) - Codeunit 5343 “CRM Sales Order to Sales Order” (1 call:
ApplySalesOrderDiscounts → ApplyInvDiscBasedOnAmt) - Codeunit 5348 “CRM Quote to Sales Quote” (1 call:
ApplyQuoteDiscounts → ApplyInvDiscBasedOnAmt) - Codeunit 5477 “Sales Invoice Aggregator” (1 call:
RedistributeInvoiceDiscounts → (object)) - Codeunit 5496 “Graph Mgt - Sales Order Buffer” (1 call:
RedistributeInvoiceDiscounts → (object)) - Codeunit 5506 “Graph Mgt - Sales Quote Buffer” (1 call:
RedistributeInvoiceDiscounts → (object)) - Codeunit 5508 “Graph Mgt - Sal. Cr. Memo Buf.” (1 call:
RedistributeCreditMemoDiscounts → (object)) - Codeunit 60 “Sales-Calc. Discount” (1 call:
CalculateInvoiceDiscount → ResetRecalculateInvoiceDisc) - Page 160 “Sales Statistics” (1 call:
OnClosePage → ResetRecalculateInvoiceDisc) - Page 20012 “APIV1 - Sales Invoices” (1 call:
UpdateDiscount → ApplyInvDiscBasedOnAmt) - Page 20028 “APIV1 - Sales Orders” (1 call:
UpdateDiscount → ApplyInvDiscBasedOnAmt) - Page 20037 “APIV1 - Sales Quotes” (1 call:
UpdateDiscount → ApplyInvDiscBasedOnAmt) - Page 20038 “APIV1 - Sales Credit Memos” (1 call:
UpdateDiscount → ApplyInvDiscBasedOnAmt) - Page 30012 “APIV2 - Sales Invoices” (1 call:
UpdateDiscount → ApplyInvDiscBasedOnAmt) - Page 30028 “APIV2 - Sales Orders” (1 call:
UpdateDiscount → ApplyInvDiscBasedOnAmt) - Page 30037 “APIV2 - Sales Quotes” (1 call:
UpdateDiscount → ApplyInvDiscBasedOnAmt) - Page 30038 “APIV2 - Sales Credit Memos” (1 call:
UpdateDiscount → ApplyInvDiscBasedOnAmt) - Page 402 “Sales Order Statistics” (1 call:
OnClosePage → ResetRecalculateInvoiceDisc) - Page 46 “Sales Order Subform” (1 call:
ValidateInvoiceDiscountAmount → ApplyInvDiscBasedOnAmt) - Page 47 “Sales Invoice Subform” (1 call:
ValidateInvoiceDiscountAmount → ApplyInvDiscBasedOnAmt) - Page 508 “Blanket Sales Order Subform” (1 call:
ValidateInvoiceDiscountAmount → ApplyInvDiscBasedOnAmt) - Page 6631 “Sales Return Order Subform” (1 call:
ValidateInvoiceDiscountAmount → ApplyInvDiscBasedOnAmt) - Page 96 “Sales Cr. Memo Subform” (1 call:
ValidateInvoiceDiscountAmount → ApplyInvDiscBasedOnAmt)
Ask your agent
Procedure bodies are not stored here (D10). The call sections above are our own, per object, from the BC29 call graph. For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: bcatlas_resolve_node(object_type: "codeunit", object_name: "Sales - Calc Discount By Type"), then bcatlas_get_procedure_body or bcatlas_get_neighbors on the returned id.