I do the same thing for AR Statements to customers.
One variable in the report header looks like this:
shared numbervar ar_intrate;
ar_intrate := 0.12;
second variable in the detail section looks like this:
shared numbervar ar_intrate;
shared numbervar int30;
if {JrnlHdr.MainAmount} - {JrnlHdr.AmountPaid} > 1 and
{JrnlHdr.TransactionDate}+30 <{?par_ReportDate} then
int30 := ACCRINTM({JrnlHdr.TransactionDate}+30,{?par_ReportDate},ar_intrate,{JrnlHdr.MainAmount}-{JrnlHdr.AmountPaid},1)
else
int30 := 0;
Simply if the MainAmount - CustomerPayments > 1 &
the InvoiceDate is more then 30 days old
THEN
int30 := Interest Amount
or
int30 := 0
so in essence I think you need to use the ACCRINTM formula
I share the int30 because I set up columns to show how much interest is being charged on different invoices and total them later.