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

Content added Content deleted
No edit summary
No edit summary
Line 100: Line 100:


===Calculate Total Overdue Amount after records in detail table is updated===
===Calculate Total Overdue Amount after records in detail table is updated===
This sample code, a method '''Compute(...)''' of DataTable object is used to calculate the sum of AmountDue.<br/>
Apply a method '''Compute(...)''' of DataTable object is used to calculate the sum of AmountDue.<br/>
*Add a local variable '''myOverdueMsg'''
<syntaxhighlight lang="csharp">
private string myOverdueMsg = null;
</syntaxhighlight>
*Insert script to '''xrLabelOverdueTitle_BeforePrint''' event
<syntaxhighlight lang="csharp">
<syntaxhighlight lang="csharp">
private void xrLabelOverdueTitle_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
private void xrLabelOverdueTitle_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
{
object oAccNo = GetCurrentColumnValue("AccNo");
object oAccNo = GetCurrentColumnValue("AccNo");
if (oAccNo == null) return;
if (oAccNo == null)
{

(sender as XRLabel).Text = "";
//Temporary store the original text of this label
return;
string orgText = (sender as XRLabel).Text;
}
//Store the original text of this label
if (myOverdueMsg == null)
{
myOverdueMsg = (sender as XRLabel).Text;
}


//Calculate the current debtor total overdue amount
//Calculate the current debtor total overdue amount
Line 116: Line 127:


//Assign 'total amount due' to this label, while format the decimal digit with currency formatting
//Assign 'total amount due' to this label, while format the decimal digit with currency formatting
(sender as XRLabel).Text = string.Format(orgText, __report.DecimalSetting.FormatCurrency(totalAmtDue));
(sender as XRLabel).Text = string.Format(myOverdueMsg, __report.DecimalSetting.FormatCurrency(totalAmtDue));
}
}
</syntaxhighlight>
</syntaxhighlight>