Wednesday 18 October 2017

Determining total amount for invoices applied to a payment in CAL code


Hello in one of my projects, i realized i needed to compute the totals for invoices that have been applied to a payment made by a customer.
I figured out i could do this by using flowfields.
Here is a summary

  • From the detailed Cust. Ledg. Entry table (379)
  • Identify the customer using there customer No.
  • The Document Type must be Payment
  • Entry Type must be Application
  • Identify the Document No for that specific payment

Sum credit Amount(LCY) field in this table using the criteria above.

Note

For me i wanted the totals field added to another table in my case Patient Payment Table.
Here is the formula i used to sum up my flowfield
Sum("Detailed Cust. Ledg. Entry"."Credit Amount (LCY)" WHERE (Customer No.=FIELD(Patient ID),Document Type=CONST(Payment),Document No.=FIELD(Receipt No.),Entry Type=CONST(Application),Initial Document Type=CONST(Invoice)))


GOOD LUCK!!