| Below is link to a sample Part Profit / Loss report template for the Parts grid in the Service navigation pane. 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 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 part record 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 sample report template or refer to it when creating your own.
- AyaNova Sales & Technical Support
- http://www.ayanova.com
|