not adding correctly

using the detail by client report i am getting incorrect hours totals.

ie a clients total on summary is 24.75 but in the detailed report i am getting 20.75 .

the report is showing all hours just not calculating .

Hi Randy

Thank you for sending the report template. I am looking at this report template right now, and as it will take a bit to go through all the changes you have done on this report, I will get back to you as soon as possible.

  • Joyce

Hi Randy

A lot of changes had been made to the original sample report template - I have attached a further customized report template based on the original sample report templateas I wasn’t quite sure I had got all the changes that were adversely affecting the outcome.

You had removed TaxA and Tax B from the labor Net totals, and added Billable Hours and NC Quantity, but did not configure the Properites or scripts for these added fields so that they would total at the end of each client, and the final totals were based on group sums -so some fields were summing and others were not.

What I did:

I took the original Sample Total Billable for Workorders Grouped by Client and customized further:

  • I edited the margins as was edited in your previous custom report template.

  • I set the Detail1 for the DetailReportItemLabor band property of Visible to True, and added the additional fields you had in your custom report template

  • added the Serial Number datafield into the Detail for the DetailReportItem band

  • In the script for the reportHeaderBand1 have added the following to identify that these are decimal fields so we can use them to total up all workorders and workorder items for a client. These were added to those that were already there.

decimal TotalQty = 0;
decimal TotalNC = 0;

-Have also added the following to the script for the GroupFooter1, which in escense zero’s them out each time before another client’s information is printed.

TotalQty = 0;
TotalNC = 0;

  • added additional Net fields to display in the GroupFooter2 for the DetailReportItemLabor band - to display the sum of Service Rate Quantity and the sum of No Charge Quantity for that workorder item. Note these datafields are set to Group Sum as this sums up the labor quantity for that workorder item.

  • Now because I want to do the same as with the other summed fields for labor - in that I want to keep a running total of these fields to total up at the bottom for this client, if I select the field xrTableCell70 which is Sum([Net]), select Properties, exapand Scripts, I will see that there is a script for OnSummaryCalculated. If I open the script editor, I see that for this field it is :

private void OnSummaryCalculated(object sender, DevExpress.XtraReports.UI.TextFormatEventArgs e)
{
if(e.Value != null)
NetLabor += Convert.ToDecimal(e.Value);
}

As I would want to do a similar script for the Sum ([Service Rate Quantity]) datafield I’ve copied this (as its already laid out for me), select the field xrTableCell2 which is for Sum ([Service Rate Quantity]), select Properties, expand Scripts , open the script editor for OnSummaryCalculated and replaced with above, but edited NetLabor to TotalQty

private void OnSummaryCalculated(object sender, DevExpress.XtraReports.UI.TextFormatEventArgs e)
{
if(e.Value != null)
TotalQty += Convert.ToDecimal(e.Value);
}

Than I did the same for the xrTableCell4 which is the Sum ([No Charge Quantity]) datafield

  • Now for the complete total at the bottom of the report template, I added additional fields to display in the GroupFooter1 area of the entire report where we display the complete totals of all workorders and workorder items for the client. Note that just like the other fields in the GroupFooter1 - these are NOT datafields - they use scripts to obtain the totals that have been adding up from the Net Totals above in the report template.

Named one of them xrTotalQty and the other xrTotalNC

To see how the other fields were obtaining their data, I selected xrNetLabor viewed its Properties, expanded Scripts and identified that there is a script for it for OnBeforePrint which I opened that has:

private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
xrNetLabor.Text = string.Format("{0:c2}", NetLabor);
}

So therefore, I selected xrTotalQty field I had made, opened script editor for OnBe

thanks for all the work . can i send you a bounty for correcting my errors.

randy