Manual muliplication of quantity by part price via scripts

Had an interesting request from an AyaNova user - here is the scenerio:

They want to use the Discount field in the sub-section Parts in a Quote entry screen to “mark up” a price, instead of using it to decrease a price.

My suggestion todo this is to enter a negative amount into the Discount field:

For example, if you applied a discount of 20% (0.20) against a part price that is $3.75, the resulting price would be $3.00

Whereas if you applied a negative amount (-0.20) against a part price that is $3.75, the resulting price would be $4.50 - whichis ineffect marking up the price.

Now they also want to have a report for themselves so that they can compare the original price with no markup against what the customer would be charged with the markup.

As as example, I have provided below a specifc sample report template that is based off of the Sample Detailed Quote.

Sample Detailed Quote with No Markup compared Against Markup

Download, extract and import. Open up in the report designer and follow along to see where and how the original Sample Detailed Quote was edited to arrive at this report template

I added the following variables to the existing OnBeforeScript for the ReportHeaderBand1 as these will be used in scripts in this report template dir=ltr " ">

decimal TotalNetPartPrice = 0;
decimal TotalWOPartPrice = 0;

In GroupHeader3 band (the groupheader for the Parts section of this report template), I added an additional cell xrTableCell97and edited its text to show as Before MarkUp Net

I also edited the text for other fields in this groupheader identifiying which are not markup information, and which are (those that are have the markup (what isoriginally identfiied as the Discount field)percentage applied automatically by AyaNova)

In the Detail3 band area, I added an additional cell xrTableCell98 and edited its OnBeforeScript property with the following: dir=ltr " ">

private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
//this gets the value of the original price of the part and multiples it by the quantity to display in this field what the Net
//amount would be with no markup
xrTableCell98.Text = string.Format("{0:c2}", (Convert.ToDouble(DetailReportItemPart.GetCurrentColumnValue(“LT_WorkorderItemPart_Label_Price”))) * (Convert.ToDouble(DetailReportItemPart.GetCurrentColumnValue(“LT_WorkorderItemPart_Label_Quantity”))));

//this keeps a running total of the net price with no markup for display in the groupfooter
TotalNetPartPrice += Convert.ToDecimal((Convert.ToDouble(DetailReportItemPart.GetCurrentColumnValue(“LT_WorkorderItemPart_Label_Price”))) * (Convert.ToDouble(DetailReportItemPart.GetCurrentColumnValue(“LT_WorkorderItemPart_Label_Quantity”))));
}

In the GroupFooter2 band, I added an additional cell xrTableCell96 and edited its OnBeforeScript property with the following: dir=ltr " ">

private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
//this displays in this field the total net price if no markup was applied
xrTableCell96.Text = string.Format("{0:c2}", TotalNetPartPrice);

//this keeps a running total for display at the bottom of the report
TotalWOPartPrice += TotalNetPartPrice;

//this sets the variable back to 0 in case there are additional workorder items with parts so that amounts are added correctly
TotalNetPartPrice = 0;
}

I added to the existingReportFooter1 bands OnAfterPrint script the following so that if printing off multiple quotes at once, this is reset back t

Here is another rendition of this sample report template, but that also includes identifying the costs of the parts, and the total costs of parts for the quote - suggestion would be for internal use.

Sample Quote with Costs and With No Discount compared against Discounted Parts

This sample report uses the scripts identified above, but has had additional variables added for the Net cost variable and the Total workorder Part cost variable, as well as OnBeforeScripts for the Net Part Cost field in the groupfooter for parts, and the Workorder Part Costs field in the report footer; as well as showing how a subtraction is used in a script to subtract the total workorder No Discount amount from the Discounted part amount in the report footer.