Sample Detailed Workorder report template where totals derived from scripts

This report template is based off of the Sample Detailed Service Workorder with Grand Total with the differences:
-that the taxes and line totals derived from AyaNova are removed from the detail bands
-and the total taxes and Grand Total at the bottom are derived from scripts instead of the AyaNova tax amounts and line totals.

Sample NEW Detailed Service Workorder with totals via scripts

(AyaNova 6 and higher users download AyaNova 6 Sample Detailed Service Workorder with totals via scripts)

  1. Within the report template I removed data fields such as Tax A, Tax B and Line Total

  2. In the OnBeforePrint script for the ReportHeader I added the following

decimal TotalTaxX = 0;

and remove the following as not used in this report template:

decimal NetTaxA = 0;
decimal NetTaxB = 0;
decimal GrandTotal = 0;

  1. In ReportFooter1 OnBeforePrint script property I added the following which will reset the TotalTaxX back to 0 before the next workorder record prints.

TotalTaxX = 0;

and removed the following as no longer used in this report template:

NetTaxA = 0;
NetTaxB = 0;
GrandTotal = 0;

  1. In the ReportFooter1, I removed the fields xrNetTaxA, xrNetTaxB and xrGrandTotal as will not be using these

  2. I created a new label xrLabel18 and edited the OnBeforePrint property with the following so that 6% is multiplied by each of the total net amounts for Labor, Travel, Parts, Loans, Misc Expenses

private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
xrLabel18.Text = string.Format("{0:c2}", TotalTaxX += Convert.ToDecimal(.06 * Convert.ToDouble(NetLabor + NetTravel + NetPart + NetLoan + NetMiscExpense)));
}

If you do not have tax on a net amount then remove it from the OnBeforePrint script. For example, if you only charge tax on Parts and Loans, then edit the script so it instead shows as

private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
xrLabel18.Text = string.Format("{0:c2}", TotalTaxX += Convert.ToDecimal(.06 * Convert.ToDouble(NetPart + NetLoan)));
}

  1. I created a new label xrLabel19 and edited the OnBeforePrint property with the following so that the Grand Total is derived from adding the net of Labor, Travel, Parts, Loans, Misc Expenses and TotalTaxX from the xrlabel18 field.

private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
xrLabel19.Text = string.Format("{0:c2}", (NetLabor + NetTravel + NetPart + NetLoan + NetMiscExpense + TotalTaxX));
}