You are here: Development Standards > Routines > General Routines > GENTAX.PUB

# GENTAX.PUB

GENTAX.PUB calculates sales tax based on the tax group, tax class, and price.

`0025 ENTER FILE[ALL],GROUP$,CLASS$,AMOUNT,TAX[ALL],TYPE$,ERATE,RMGC,RMTH,RMTD`

Variable | Description
FILE[ALL] | Standard FILE[] array
GROUP$ | Tax group
CLASS$ | Tax class
AMOUNT | The sale or purchase price
TAX[ALL] | The tax array—DIM TAX[1:5,1:4] (values are returned by GENTAX.PUB)
TYPE$ | S for a sale or P for a purchase. Can add F for Freight, M for Misc., and A for Adjustment.
ERATE | Effective tax rate (returned by GENTAX.PUB)
RMGC | File index value for the RMGC file
RMTH | File index value for the RMTH file
RMTD | File index value for the RMTD file

Exit Points | Explanation
EXIT | GENTAX.PUB does not return an error.

The routine returns the TAX[ALL] array with the results of the calculation. The first DIMension of the array corresponds to the tax level (1–5) of each location in the group. The second DIMension contains four numeric values:

Elements | Value
1 | Sales Tax Calculated
2 | Refundable Amount Calculated
3 | Taxable Sales/Purchases
4 | Nontaxable Sales/Purchases

GENTAX.PUB also returns ERATE containing the effective tax percentage after all calculations.