Skip to main content
Kofax

I have two tax amounts; and want to calculate a total for both tax amounts. How can I do this in KTM scripting? Is there an example?

12634

QAID # 12634 Published

Question / Problem:

I have two tax amounts, and want to calculate a total for both tax amounts.
How can I do this in KTM scripting?
Is there an example?

Answer / Solution:

Yes this is possible. One way to do this is the following:

Dim l_TaxAmount, l_TaxAmount1, l_TaxAmount2 As Double

DefaultAmountFormatter.FormatField (pXDoc.Fields.ItemByName("TaxAmount1"))
DefaultAmountFormatter.FormatField (pXDoc.Fields.ItemByName("TaxAmount2"))

Let l_TaxAmount1 = CDbl(pXDoc.Fields.ItemByName("TaxAmount1").Text)
Let l_TaxAmount2 = CDbl(pXDoc.Fields.ItemByName("TaxAmount2").Text)
Let l_TaxAmount = l_TaxAmount1 + l_TaxAmount2
Let pXDoc.Fields.ItemByName("TaxAmount").Text = Format(l_TaxAmount, "0.00")

DefaultAmountFormatter.FormatField (pXDoc.Fields.ItemByName("TaxAmount"))

The above code sample occurs in the afterfieldconfirmed event. This can also be done in other events/locations, such as after Extraction.

Applies to:

Product  Version  Category 
AXPRO 3.1 Project Builder
AXPRO 3.1 Validation
AXPRO 3.5 Project Builder
AXPRO 3.5 Validation
AXPRO 4.0 Project Builder
AXPRO 4.0 Validation