Table of Contents

KVSADVFinalInvAmountCalcLib

Summary: Library codeunit for calculating the final invoice amount considering advance closingcredit memos.

Procedures

CalcAmounts(Record Sales Invoice Header, Decimal, Decimal) :

Summary: Calculates the due payable amount and the total prepaid amount for a sales invoice.

procedure CalcAmounts(var SalesInvoiceHeader: Record "Sales Invoice Header"; var DuePayableAmount: Decimal; var TotalPrepaidAmount: Decimal): 

Parameters:

  • SalesInvoiceHeader: The sales invoice header for which to calculate the amounts.
  • DuePayableAmount: The calculated due payable amount for the sales invoice.
  • TotalPrepaidAmount: The calculated total prepaid amount for the sales invoice.

Remarks: Calculates the prepaid amount from advance closing credit memos and subtracts it from the invoice total.

CalcAdvClosCreditMemoTotalAmountForPostedInvoice(Record Sales Invoice Header) : Decimal

Summary: Calculates the total amount of advance closing credit memos for a posted invoice.

procedure CalcAdvClosCreditMemoTotalAmountForPostedInvoice(var SalesInvoiceHeader: Record "Sales Invoice Header"): Decimal

Parameters:

  • SalesInvoiceHeader: The posted sales invoice header for which to calculate the total advance closing credit memo amount.

Returns: The total amount of advance closing credit memos applied to the posted invoice.

Remarks: This procedure calculates the total amount of advance closing credit memos for a posted sales invoice. It iterates through all relevant credit memos and sums their amounts.

Events

OnAfterSetFilterForPOstedClosCreditMemo(Code[20], Record Sales Cr.Memo Header) :

Summary: Event raised after setting the filter for posted closing credit memos.

[IntegrationEvent(false, false)]
local procedure OnAfterSetFilterForPOstedClosCreditMemo(InvoiceNo: Code[20]; var CreditMemos: Record "Sales Cr.Memo Header"): 

Parameters:

  • InvoiceNo: The invoice number for which the filter is set.
  • CreditMemos: The record of sales credit memos with the applied filter.

OnAfterCalcAdvClosCreditMemoTotalAmountForPostedInvoice(Record Sales Invoice Header, Record Sales Cr.Memo Header, Decimal) :

Summary: Event raised after calculating the total amount of advance closing credit memos for a posted invoice.

[IntegrationEvent(false, false)]
local procedure OnAfterCalcAdvClosCreditMemoTotalAmountForPostedInvoice(var DocumentHeader: Record "Sales Invoice Header"; var ClosCreditMemo: Record "Sales Cr.Memo Header"; var TotalClosCrMemoAmount: Decimal): 

Parameters:

  • DocumentHeader: The posted sales invoice header for which the calculation was performed.
  • ClosCreditMemo: The record of the closing credit memo being considered in the calculation.
  • TotalClosCrMemoAmount: The total amount of advance closing credit memos calculated for the posted invoice.