totalize
v1.0.21
Published
A package to calculate total of line sent
Downloads
60
Readme
EXAMPLE ES5 var totalize = require('totalize');
totalize.getTotals([{ qty: 1, unit_price: 99.99, unit_discount: 20, iva_percentage: 16 }, { qty: 1, unit_price: 99.99, iva_percentage: 16 }]);
EXAMPLE ES56
import { totalize } from 'totalize';
totalize.getTotals([{ qty: 1, unit_price: 99.99, unit_discount: 20, iva_percentage: 16 }, { qty: 1, unit_price: 99.99, iva_percentage: 16 }]);
Output:
{ lines: [ { qty: 1, unit_price: 99.99, unit_discount: 20, iva_percentage: 16, iva: '12.80' }, { qty: 1, unit_price: 99.99, iva_percentage: 16, iva: '16.00' } ], subtotal: '199.98', discount: '20.00', iva: '28.80', total: '208.78' }