select marked records on the form and get terms of payment days
for(custInvoiceJourLoc = CustInvoiceJour_ds.getFirst(true) ? CustInvoiceJour_ds.getFirst(true) : CustInvoiceJour_ds.cursor(); custInvoiceJourLoc; custInvoiceJourLoc = CustInvoiceJour_ds.getNext())
{
select custTransOpen
join custTrans where custTransOpen.AccountNum == custTrans.AccountNum
&& custTransOpen.RefRecId == custTrans.RecId
&& custTrans.Invoice == custInvoiceJourLoc.InvoiceId
&& custTrans.AccountNum == custInvoiceJourLoc.InvoiceAccount
&& custTrans.TransDate == custInvoiceJourLoc.InvoiceDate
&& custTrans.Voucher == custInvoiceJourLoc.LedgerVoucher;
salesTable = SalesTable::find(custInvoiceJourLoc.SalesId);
custDueDate = PaymTerm::find(salesTable.Payment).due(today());
info(strFmt("%1 , %2 , %3 %4", custInvoiceJourLoc.OrderAccount,custInvoiceJourLoc.LedgerVoucher,custTransOpen.DueDate,custDueDate));
}
for(custInvoiceJourLoc = CustInvoiceJour_ds.getFirst(true) ? CustInvoiceJour_ds.getFirst(true) : CustInvoiceJour_ds.cursor(); custInvoiceJourLoc; custInvoiceJourLoc = CustInvoiceJour_ds.getNext())
{
select custTransOpen
join custTrans where custTransOpen.AccountNum == custTrans.AccountNum
&& custTransOpen.RefRecId == custTrans.RecId
&& custTrans.Invoice == custInvoiceJourLoc.InvoiceId
&& custTrans.AccountNum == custInvoiceJourLoc.InvoiceAccount
&& custTrans.TransDate == custInvoiceJourLoc.InvoiceDate
&& custTrans.Voucher == custInvoiceJourLoc.LedgerVoucher;
salesTable = SalesTable::find(custInvoiceJourLoc.SalesId);
custDueDate = PaymTerm::find(salesTable.Payment).due(today());
info(strFmt("%1 , %2 , %3 %4", custInvoiceJourLoc.OrderAccount,custInvoiceJourLoc.LedgerVoucher,custTransOpen.DueDate,custDueDate));
}