I have calculated opening balance of customer successfully in highlited code but opening balance populates with every row... i want to calculate opening balance of customer outside of the while loop how can i get accountnum field while it is selected dynamically in query parameter. my code is as below and my contract class has only two parameters from date and to date .
queryRun = new QueryRun(query);
while(queryRun.next())
{
tmpTable.clear();
custTable = queryRun.get(tableNum(CustTable));
custTrans = queryRun.get(tableNum(custTrans));
custInvoiceTrans = queryRun.get(tableNum(CustInvoiceTrans));
tmpTable.AccountNum = custTable.AccountNum;
tmpTable.CustName = custTable.name();
tmpTable.Address = custTable.address();
tmpTable.TransDate = custTrans.TransDate;
tmpTable.Description = custTrans.Txt;
tmpTable.Debit = custTrans.AmountMST > 0 ? custTrans.AmountMST : 0;
tmpTable.Credit = custTrans.AmountMST < 0 ? abs(custTrans.AmountMST) : 0;
tmpTable.Voucher = custTrans.Voucher;
tmpTable.InvoiceId = custTrans.Invoice;
tmpTable.ItemId = custInvoiceTrans.ItemId;
tmpTable.Name = custInvoiceTrans.Name;
tmpTable.Qty = custInvoiceTrans.Qty;
tmpTable.SalesPrice = custInvoiceTrans.SalesPrice;
TmpTable.OpeningBalance = this.CalcOpening(custTable.AccountNum,contract.parmDateFrom());
tmpTable.insert();
}
*This post is locked for comments
I have the same question (0)