Sample Part Profit / Loss report template

Below is link to a sample Part Profit / Loss report template for the Parts grid in the Service navigation pane.

This sample report template is expected to be used after filtering the grid by a specific client.

Part Profit Loss Report Template

ReportHeader band has a OnBeforePrint script to identify the items we will use in this report template

decimal TotalPartNetCost = 0;
decimal TotalPartNetPrice = 0;
decimal PartProfitLoss = 0;

This report template is grouped by the client that you have filtered by and displays the workorder number associtated with the part record, quantity, cost per part, price per part, total cost for that record, total net price (no taxes) for that record.

Total cost for the partrecord is obtained via an OnBeforePrint script for the field determining the value of cost multiplied by quantity, and also keeping a running total of this for the profit / loss as well as summary

private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
//this gets the value of the cost of the part and multiples it by the quantity to display in this field what the Net Cost is

xrLabel19.Text = string.Format("{0:c2}", (Convert.ToDouble(GetCurrentColumnValue(“LT_WorkorderItemPart_Label_Cost”))) * (Convert.ToDouble(GetCurrentColumnValue(“LT_WorkorderItemPart_Label_Quantity”))));

//this keeps a running total of the net cost for display in the groupfooter
TotalPartNetCost += Convert.ToDecimal((Convert.ToDouble(GetCurrentColumnValue(“LT_WorkorderItemPart_Label_Cost”))) * (Convert.ToDouble(GetCurrentColumnValue(“LT_WorkorderItemPart_Label_Quantity”))));
}

The total net for the part also has an OnBeforePrint script to keep a running total used for the report profit / loss as well as summary

private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{

//this keeps a running total of the net price charges for display in the groupfooter and use in determining profit / loss
TotalPartNetPrice += Convert.ToDecimal(Convert.ToDouble(GetCurrentColumnValue(“LT_UI_Label_NetValue”)));
}

The summary Cost field is obtained by an OnBeforePrint script calling that running total

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

As is the summary Net field

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

And than it displays a Part Profit / (Loss) at the end of the report which is determined by an OnBeforePrint script which mulitples the cost from the net

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

As always, feel free to customize this samplereport template or refer to it when creating your own.

The original sample report template as per above, was developed for printing AFTER the grid had been filtered for a specific client.

Whereas if you would like to run this report template against the grid that has NOT been filtered by a specific client, I have provided a new sample report template with additional scripts and fields so that subtotals for each client are displayed as well as the running totals at the very bottom.

Download, extract, import into your AyaNova 7 the report template AyaNova 7 Part Profit Loss Customized For Mulitple Clients Report Template

Below is the steps that were taken if you would like to customize the original report template:

  • create a copy of the original sample report template

  • move the existing fields xrTotalPartNetPrice and xrTotalPartNetCost to the reportFooterBand1

  • drag over the Price datafield and set its Property for Summary for group, sum and format for currency (this is so that the sum of the groups prices are shown)

  • and because the Cost field is actually derived from a script that multiples the Cost by the quantity, will need a new label and its own script to display the summary for each client.

  • view Scripts,

  • add so that when the report first runs, the ClientPartNetCost is declared

decimal ClientPartNetCost = 0;

  • edit the existing script for xrLabel19_BeforePrint adding the below so that a running total is maintained specifically for showing the client’s net clost

//this keeps a running total of the net cost for display in the groupfooter
ClientPartNetCost += Convert.ToDecimal((Convert.ToDouble(GetCurrentColumnValue(“LT_WorkorderItemPart_Label_Cost”))) * (Convert.ToDouble(GetCurrentColumnValue(“LT_WorkorderItemPart_Label_Quantity”))));

  • Drag over a new label (will be called label2), via Properties for this label, add a Before Print script and enter in the following:

private void label2_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
//this displays the client’s total of cost
label2.Text = string.Format("{0:c2}", ClientPartNetCost);
}

  • add a After Print script for label 2

private void label2_AfterPrint(object sender, System.EventArgs e)
{
//this zeros out the groupfooter’s field for the cost of all parts for that specific client before starting the next
ClientPartNetCost = 0;
}

  • I also, to keep data about one client separate from another, set the Property for Page Break for the groupFooterBand1 to After the Band so that a new page is started if displays for another client.

  • Joyce