Report Script: Filter Overdue Letter with specific age that is due

From AutoCount Resource Center
Revision as of 07:03, 24 October 2018 by DanielY (talk | contribs) (Created page with "==Introduction== ==Task in this tutorial== * ==Product== AutoCount Accounting 1.8 / 1.9<br/> Applicable to AutoCount Accounting 2.0 (require to manual modify some code) {{...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Introduction

Task in this tutorial


Product

AutoCount Accounting 1.8 / 1.9
Applicable to AutoCount Accounting 2.0 (require to manual modify some code)

[ Download Report Template] (AutoCount Accounting 1.8 / 1.9)

Coming soon...


Report Script

Add using directive

  1. Add directive at the top of Scripts, if has not already added.
    • using System.Data;

Add function of FilterDueAge

This function will remove record that is not in the filter range of Age.

private void FilterDueAge(int fromAge, int toAge)
{
	//Get table of documents that are due (Detail table)
	DataTable dtDetail = (__report.DataSource as DataSet).Tables["Detail"];

	//Find document record that the age is not in the age range
	DataRow[] rows = dtDetail.Select(string.Format("Age < {0} OR Age > {1}", fromAge, toAge));

	//Delete document record
	foreach (DataRow row in rows)
	{ row.Delete(); }

	//Above execution may render to debtor has no overdue document,
	//below function is to remove debtor record that has no overdue document.
	RemoveEmptyMaster();
}

Add function of RemoveEmptyMaster

private void RemoveEmptyMaster()
{
	DataTable dtMaster = (__report.DataSource as DataSet).Tables["Master"];
	DataTable dtDetail = (__report.DataSource as DataSet).Tables["Detail"];
	string debtorCode;
	foreach (DataRow rowM in dtMaster.Rows)
	{
		debtorCode = rowM["AccNo"].ToString();
		DataRow[] selectRows = dtDetail.Select(string.Format("DebtorCode='{0}'", debtorCode));
		if (selectRows.Length == 0)
		{
			rowM.Delete();
		}
	}
}



Go to menu

Go to top
Resources For AutoCount Software Developers