splitInclusive
function splitInclusive(gross, rate): | SalesTaxAmounts | null;Defined in: salestax.ts:183
Splits an amount that includes sales tax into its value and tax.
The value is rounded half up to the paisa, and the tax is the rest, so
net + tax is always gross.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
gross |
number |
Amount including tax, 0 to 1 trillion rupees |
rate |
number |
Percent, 0 to 100, at most 2 decimals |
Returns
Section titled “Returns”| SalesTaxAmounts
| null
The split, or null for an invalid amount or rate. Never throws.
Example
Section titled “Example”splitInclusive(1180, 18); // { net: 1000, tax: 180, gross: 1180, rate: 18 }