Dear all,
I'm trying to print CustInvocieJour header and CustInvoiceTrans details. Its printing correct but every time repeating CustInvocieJOur header values along with custinvoicetrans item details. I need CustInvoiceJour as single line print and its related transactions with CustInvoiceTrans. Please check below job and advice.
static void custInvoiceTran(Args _args)
{
CustInvoiceJour custInvoiceJour;
CustInvoiceTrans custInvoiceTrans;
while select *from custInvoiceTrans join custInvoiceJour where custInvoiceJour.InvoiceId == custInvoiceTrans.InvoiceId
&& custInvoiceJour.InvoiceId == "SI-0000033659"
{
info(strFmt("Invoice date %1, InvoieId %2, SalesId %3, DeliveryName %4, totalDiscountAmount %5, totalSalesAmount %6, netAmount %7, totalAmount %8, totalItemsDiscountAmount %9",
custInvoiceJour.InvoiceDate,
custInvoiceJour.InvoiceId,
custInvoiceJour.SalesId,
custInvoiceJour.DeliveryName,
custInvoiceJour.SumLineDisc,
custInvoiceJour.SalesBalance,
custInvoiceJour.SalesBalance - custInvoiceJour.SumLineDisc,
custInvoiceJour.InvoiceAmount,
custInvoiceJour.SumLineDisc));
info(strFmt("ItemName %1, ItemId %2, Salesunit %3, SalesQty %4, SalesTotal %5 ",
custInvoiceTrans.itemName(),
custInvoiceTrans.ItemId,
custInvoiceTrans.SalesUnit,
custInvoiceTrans.Qty,
custInvoiceTrans.Qty * custInvoiceTrans.SalesPrice,
));
}
}