product-tax

1.0.5 • Public • Published

Getting Started

<script src="https://unpkg.com/product-tax"></script>

Usage

var taxPercent = 20
var discount = 30
var finalPrice = 29.4

var basePrice = tax.final.discount.percent(taxPercent, discount, finalPrice)
// => 35

This will calculate the base price from the final price with tax and discount percent applied

Examples

git clone https://github.com/sambarrowclough/fws-product-tax.git
cd fws-product-tax
npm i
npm start

Test

npm test

Formulas

From base with tax, discount applied

@params net (base), rate (tax), percent (discountPercent)

discount = (net/100) * percent

sub = net - discount # 2dp

vat = (sub/100) * rate # 2dp

gross = Number(sub) + Number(vat) # 2dp

Readme

Keywords

none

Package Sidebar

Install

npm i product-tax

Weekly Downloads

2

Version

1.0.5

License

ISC

Unpacked Size

47.7 kB

Total Files

14

Last publish

Collaborators

  • sambarrowclough