Adding Calculated Fields to Order Forms
If you have a current copy of CCRQInvoice you can add calculated fields to the form. Today I’ll give a brief demonstration on how to create fields that involve simple calculations based on other fields. In my example, I want to add a “deposit” statement that tells my client that they need to provide a 50% deposit on the order.
I’ll start by editing the standard form template in CCRQInvoice – selecting Forms and then Edit Order Forms. I select the “standard” form and click Edit.
What I want to do is to add a statement “A 50% deposit (deposit) of the total (total) is required”. I’m going to place this in the footer, removing the customer message block that already exists. Clicking on the CustomerMsg field in the form, press the delete key to remove it.
Drag a Label control from the Standard Control window on to the form. Stretch it out to the right size, double click on it and type “A 50% deposit ( ) of the total ( ) is required”. You will have to leave enough room in the parentheses for the largest number you anticipate.
Click on the Field List tab, which is usually in the upper right corner. Right click on InvoiceData to get a popup menu.
Select Add Calculated Field, which will add a field named calculatedField1 to the list of fields. The property grid will show the field. I recommend changing the name to something that makes sense, like CalculatedDeposit. Note that the name must be unique, and it must not have any spaces or special characters in it.
Change the Field Type to “Double”. Click on the Expression field, and then click on the ellipsis (…) that appears in the field. This opens the Expression Editor.
In the large box at the top, type in .5 * and then click on the Fields item in the box below. Select [AmountTotal] from the list of fields in the center box. You should see the “formula” appear in the top box, as shown below. Click OK to save the formula
Drag two more label controls to the form, placing them over the blank spots in the parentheses that we left in the discount statement. Select the first label, and click on the pip in the upper right corner. In the Data Binding field, locate the calculatedDeposit field.
Click on the other label and select the AmountTotal field for the data binding value.
Save the form and exit the editor, and exit the Edit Reports window.
Select Order Processing from the main menu, load an invoice, select the Printing tab and located the form that you just created.
Select the invoice to print (try just one for a test) and click Process Selected. As you can see, the form has the calculated values that we want. We can improve this by adding some formatting (displaying values as currency, for example)
Let me know if this explanation is clear, or if you have any questions.








