Using C# to pull the AR Aging data through Epicor Adapter

Hi Expert,
Is that possible to pull the AR Aging data by using custom code C# through adapter, I has run test on the BAQ and Query that still very difficult to match against Customer statement value.

If that’s the case why now I just call the business object/adapter if any in Epicor to generate this data which through Epicor internal calculation instead of preparing a mass template externally.

Dear @Vincent, I have called the AR Aging report on custom button click for your reference code is mentioned below and BAQ is also available.

ADD Custom Assemblies Reference:

Namespace:

using Erp.Adapters;
using Erp.Contracts;
using Ice.BO;
using Ice.UI;
using Ice.Lib;
using Ice.Adapters;

Code:

private void PreviewAgedReceivableReport(string CustNum)
{
try
{
ARAgedRecReportAdapter objAdapter = new ARAgedRecReportAdapter(oTrans);
objAdapter.BOConnect();
objAdapter.GetNewParameters();
objAdapter.ReportData.ARAgedRecReportParam[0].SelectBy = “ApplyDate”;//Apply Date- ApplyDate, Invoice Date- Date
objAdapter.ReportData.ARAgedRecReportParam[0].AgeBy = “DueDate”; //Due Date- DueDate, Invoice Date- InvDate
objAdapter.ReportData.ARAgedRecReportParam[0].AgingDate = DateTime.Now; //DateTime.Now.AddYears(-1);
objAdapter.ReportData.ARAgedRecReportParam[0].CustList = CustNum;
objAdapter.ReportData.ARAgedRecReportParam[0].SummaryOnly = false;
objAdapter.ReportData.ARAgedRecReportParam[0].AgingFormatCode = “ARSyst”;
objAdapter.ReportData.ARAgedRecReportParam[0].SortBy = “CUSTNAME”;
objAdapter.ReportData.ARAgedRecReportParam[0].CustType = “B”;//S- Sold To, B-Bill To
objAdapter.ReportData.ARAgedRecReportParam[0].CurrDesc = “OMR”;
objAdapter.ReportData.ARAgedRecReportParam[0].CurrencyCode = “OMR”;
objAdapter.ReportData.ARAgedRecReportParam[0].GLControlType = “AR Account”;
objAdapter.ReportData.ARAgedRecReportParam[0].GLControlTypeDesc = “AR Account”;
objAdapter.ReportData.ARAgedRecReportParam[0].SortGLControlType = “AR Account”;
objAdapter.ReportData.ARAgedRecReportParam[0].SortGLControlTypeDesc = “AR Account”;
objAdapter.ReportData.ARAgedRecReportParam[0].PrintSelCriteria = false;
objAdapter.ReportData.ARAgedRecReportParam[0].PrintLegNum = false;
objAdapter.ReportData.ARAgedRecReportParam[0].AutoAction = “SSRSPREVIEW”;
objAdapter.ReportData.ARAgedRecReportParam[0].AgentID = “SystemTaskAgent”;
objAdapter.ReportData.ARAgedRecReportParam[0].RecurringTask = false;
objAdapter.ReportData.ARAgedRecReportParam[0].ReportStyleNum = 2;
objAdapter.ReportData.ARAgedRecReportParam[0].WorkstationID = Ice.Lib.Report.EpiReportFunctions.GetWorkStationID((Ice.Core.Session)oTrans.Session);
objAdapter.ReportData.ARAgedRecReportParam[0].ArchiveCode = 0;
objAdapter.ReportData.ARAgedRecReportParam[0].SSRSRenderFormat = “PDF”;
objAdapter.ReportData.ARAgedRecReportParam[0].PrintReportParameters = false;
objAdapter.ReportData.ARAgedRecReportParam[0].SSRSEnableRouting = false;
objAdapter.ReportData.ARAgedRecReportParam[0].RowMod = “A”;
objAdapter.SubmitToAgent(“SystemTaskAgent”,0,0);
}
catch(Exception ex)
{
EpiMessageBox.Show(“An error occured trying to preview report.” + ex.Message);
}
}

1 Like

Thanks Dutt,
I actually saw your post in the forum and this is great, and is this possible for me to save the value as variable to be display?
Actually my intention is to display the amount separately in custom Email format for example as following:

Customer Name:
Terms:
Credit Limit:

Total Outstanding:
Future:
Current:
30Days:
60Days:
90Days:
120Days:

Thanks

@Vincent, Please find the attached baq and call it on script. By default this baq returns all customers detail. You have to define one more parameter in baq CustNum.

BAQ_AR_AGING_REPORT.baq (68.2 KB)

1 Like

Hi Dutt,
Is this possible to print by Email, and we could insert some note as Email content, so I think this could be solve my issue where I wold attach the statement instead of display the info.

Thus your BAQ is nice but the value still not match with the statement even follow change by Due date or Invoice date.

@Vincent, share your any-desk ID , I can explain you in detail how baq works.

1 Like

Hi Dutt, thanks for you kind assist and I think I know how to use your BAQ, and i get my answer already, the figure is correct now.
I will call your BAQ in code to pull the data.

Thanks.