Axtra info on Account Statement

boolean fetch() { QueryRun queryRun_CustAccountStatementInt; boolean openingBalancePrinted; ; custVendTransDetails = new CustVendTransDetails(_custTrans, custAccountStatementIntReport.assessmentDate()); queryRun_CustAccountStatementInt = new QueryRun(this); if (queryRun_CustAccountStatementInt.prompt() && element.prompt()) { this.initCustTransQuery(); firstAccountPrinted = false; while (queryRun_CustAccountStatementInt.next()) { _custTable = queryRun_CustAccountStatementInt.get(tablenum(CustTable)); element.design().languageId(_custTable.languageId); custTransQueryRun.reset(); custTransQueryRun.Query().dataSourceTable(tablenum(CustTrans)).rangeField(fieldnum(CustTrans,AccountNum)).value(_custTable.accountNum); openingBalancePrinted = false; markForPaymentSchedulePrinted = false; if (custAccountStatementIntReport.parmWithoutTransact()) { this.printOpeningBalance(); openingBalancePrinted = true; } while(custTransQueryRun.next()) { if (custTransQueryRun.changed(tableNum(CustTrans))) { _custTrans = custTransQueryRun.get(tablenum(CustTrans)); _custTrans.transactionPerDate(custAccountStatementIntReport.assessmentDate()); if (custAccountStatementIntReport.parmOnlyOpen() && !this.printingAmountMST()) { continue; } custVendTransDetails.setCustVendTrans(_custTrans); tmpCustVendTransOpen = custVendTransDetails.tmpCustVendTransOpen(custAccountStatementIntReport.parmOnlyOpen()); numberOfTransOpen = custVendTransDetails.NumberOfTmpTransOpen(); if (! openingBalancePrinted) { this.printOpeningBalance(); openingBalancePrinted = true; } if ((numberOfTransOpen == 1) || (numberOfTransOpen > 1 && !custAccountStatementIntReport.parmPrintPaymentSchedule())) { if (custAccountStatementIntReport.parmPrintPaymentSchedule()) { select firstonly tmpCustVendTransOpen; } else { select maxOf(dueDate) from tmpCustVendTransOpen; } this.send(tmpCustVendTransOpen); } this.send(_custTrans); if (numberOfTransOpen > 1 && custAccountStatementIntReport.parmPrintPaymentSchedule()) { while select tmpCustVendTransOpen order by dueDate { this.send(tmpCustVendTransOpen); } } } } if (openingBalancePrinted) { this.printClosingBalance(); formLetterRemarks = FormLetterRemarks::find(_custTable.languageId,FormTextType::CustACStatement); this.send(formLetterRemarks); } } return true; } return false; } The above is the standard fetch method on version 2.5 Axapta on the Debtor Account Statement. As it does not use Queries as in version 3 I am completely lost in how I can get information regarding a field from the Sales table linked to this. I just need to show the Customer Reference from the SalesTable. The Table is related to the CustTrans Table but I am not sure where and how to bring it into the fetch method. Any ideas?

quote:


Originally posted by GerritC
boolean fetch() { QueryRun queryRun_CustAccountStatementInt; boolean openingBalancePrinted; ; custVendTransDetails = new CustVendTransDetails(_custTrans, custAccountStatementIntReport.assessmentDate()); queryRun_CustAccountStatementInt = new QueryRun(this); if (queryRun_CustAccountStatementInt.prompt() && element.prompt()) { this.initCustTransQuery(); firstAccountPrinted = false; while (queryRun_CustAccountStatementInt.next()) { _custTable = queryRun_CustAccountStatementInt.get(tablenum(CustTable)); element.design().languageId(_custTable.languageId); custTransQueryRun.reset(); custTransQueryRun.Query().dataSourceTable(tablenum(CustTrans)).rangeField(fieldnum(CustTrans,AccountNum)).value(_custTable.accountNum); openingBalancePrinted = false; markForPaymentSchedulePrinted = false; if (custAccountStatementIntReport.parmWithoutTransact()) { this.printOpeningBalance(); openingBalancePrinted = true; } while(custTransQueryRun.next()) { if (custTransQueryRun.changed(tableNum(CustTrans))) { _custTrans = custTransQueryRun.get(tablenum(CustTrans)); _custTrans.transactionPerDate(custAccountStatementIntReport.assessmentDate()); if (custAccountStatementIntReport.parmOnlyOpen() && !this.printingAmountMST()) { continue; } custVendTransDetails.setCustVendTrans(_custTrans); tmpCustVendTransOpen = custVendTransDetails.tmpCustVendTransOpen(custAccountStatementIntReport.parmOnlyOpen()); numberOfTransOpen = custVendTransDetails.NumberOfTmpTransOpen(); if (! openingBalancePrinted) { this.printOpeningBalance(); openingBalancePrinted = true; } if ((numberOfTransOpen == 1) || (numberOfTransOpen > 1 && !custAccountStatementIntReport.parmPrintPaymentSchedule())) { if (custAccountStatementIntReport.parmPrintPaymentSchedule()) { select firstonly tmpCustVendTransOpen; } else { select maxOf(dueDate) from tmpCustVendTransOpen; } this.send(tmpCustVendTransOpen); } this.send(_custTrans); if (numberOfTransOpen > 1 && custAccountStatementIntReport.parmPrintPaymentSchedule()) { while select tmpCustVendTransOpen order by dueDate { this.send(tmpCustVendTransOpen); } } } } if (openingBalancePrinted) { this.printClosingBalance(); formLetterRemarks = FormLetterRemarks::find(_custTable.languageId,FormTextType::CustACStatement); this.send(formLetterRemarks); } } return true; } return false; } The above is the standard fetch method on version 2.5 Axapta on the Debtor Account Statement. As it does not use Queries as in version 3 I am completely lost in how I can get information regarding a field from the Sales table linked to this. I just need to show the Customer Reference from the SalesTable. The Table is related to the CustTrans Table but I am not sure where and how to bring it into the fetch method. Any ideas?


Hi,[:)] I think the easiest thing you could do is create a display method under the methods from the body from CustTrans. In the display method read the salesReference field from custtrans record and return it. Create a new field in the body and refer to the display method. Another way to do the job is more complex: Add salesTable as a datasource in the query. In the fetch method read the concerning salestable record (in the custtrans loop) and send it to the design. Create a sectiongroup salestable with a body and at the field to it. I think you can find examples for both ways in several reports, especially external documents (quotation. invoice, packingslip etc) are a good source Maurice Ars, Pulse Automation Experts bv (NL)

Thanks Maurice Will give it a try