The purchase order needs to calculate the appropriate state
and federal taxes. To do this, you create a field that shows the
tax rate and a calculated field that shows the tax amount.
To insert the State Tax % field
-
In the Object Library
palette, click the Standard category and then drag the Numeric Field
object
onto
the form below the Total field.
-
Select the caption text in the Numeric Field object and type
State Tax %
.
You
may want to resize the field to make it smaller.
-
In the Object palette, click the Field tab and select Solid
Box in the Appearance list.
-
Click the Patterns button and in the Pattern box, type
z9.99%
.
-
Click the Binding tab and type
stateTaxPercent
in
the Name box.
-
Click the Value tab and in the Default box, type
6
.
To insert the State Tax field
-
Copy the State Tax
% field and position the new field beside the State Tax % field.
-
Select the text and type
State Tax
.
-
In the Script Editor, select Calculate from the Show list.
-
Select FormCalc from the Language list and Client from the
Run At list.
-
In the Script Source field, type the following calculation:
(total * stateTaxPercent / 100)
-
Deselect the Numeric Field object to add the script to your
form, then select it again.
-
In the Object palette, click the Binding tab and type
stateTax
in
the Name box.
-
Click the Field tab, click the Patterns button and in the
Pattern box, type
$z,zz9.99
.
-
Click the Value tab and in the Type list, select Calculated
- Read Only.
To insert the Federal Tax % and Federal Tax fields
-
Repeat the procedure for inserting the State Tax % field.
-
Repeat the procedure for inserting the State Tax field.
-
Ensure the following changes to make the fields applicable
for Federal Tax:
-
Change all instances of the word
state
to
federal
.
-
Set the default value for the federal tax percent to 8.
-
Set the calculation for federalTax to:
(total * federalTaxPercent / 100)
Click
to continue:
Inserting the Shipping Charge field
|
|
|