How to use the accounting.formatMoney function in accounting

To help you get started, we’ve selected a few accounting examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kilbot / WooCommerce-POS / assets / js / src / lib / utilities / utils.js View on Github external
Utils.formatMoney = function( num, precision ) {
  if( precision === 'auto' ) {
    precision = Utils.decimalPlaces(num);
  }
  if( !_.isFinite( parseInt(precision, 10) ) ) {
    precision = accounting.settings.currency.precision;
  }
  // round the number to even
  num = Utils.round(num, precision);
  return accounting.formatMoney(num);
};
github kilbot / WooCommerce-POS / assets / js / src / lib / utilities / handlebars-helpers.js View on Github external
hbs.registerHelper('money', function(num, options){
  var defaultPrecision = accounting.settings.currency.precision,
      precision = options.hash.precision || defaultPrecision;

  if( precision === 'auto' ) {
    precision = Utils.decimalPlaces(num);
  }

  // round the number to even
  num = Utils.round(num, precision);

  if(options.hash.negative) {
    num = num * -1;
  }

  return accounting.formatMoney(num);
});
github gianlucadelgobbo / mongo-invoices / app / server / helpers / helpers.js View on Github external
exports.formatMoney = function formatMoney(result) {
  accounting.settings = global._config.accountingSettings;
  result.subtotal=accounting.formatMoney(result.subtotal);
  result.vat_amount=accounting.formatMoney(result.vat_amount);
  result.shipping_costs=accounting.formatMoney(result.shipping_costs);
  result.total=accounting.formatMoney(result.total);
  for (var item in result.items) {
    if (result.items[item]) {
      result.items[item].price=accounting.formatMoney(result.items[item].price);
      result.items[item].amount=accounting.formatMoney(result.items[item].amount);
    }
  }
  return result;
};
github gianlucadelgobbo / mongo-invoices / app / server / helpers / helpers.js View on Github external
exports.formatMoney = function formatMoney(result) {
  accounting.settings = global._config.accountingSettings;
  result.subtotal=accounting.formatMoney(result.subtotal);
  result.vat_amount=accounting.formatMoney(result.vat_amount);
  result.shipping_costs=accounting.formatMoney(result.shipping_costs);
  result.total=accounting.formatMoney(result.total);
  for (var item in result.items) {
    if (result.items[item]) {
      result.items[item].price=accounting.formatMoney(result.items[item].price);
      result.items[item].amount=accounting.formatMoney(result.items[item].amount);
    }
  }
  return result;
};
github gianlucadelgobbo / mongo-invoices / app / server / helpers / helpers.js View on Github external
exports.formatMoney = function formatMoney(result) {
  accounting.settings = global._config.accountingSettings;
  result.subtotal=accounting.formatMoney(result.subtotal);
  result.vat_amount=accounting.formatMoney(result.vat_amount);
  result.shipping_costs=accounting.formatMoney(result.shipping_costs);
  result.total=accounting.formatMoney(result.total);
  for (var item in result.items) {
    if (result.items[item]) {
      result.items[item].price=accounting.formatMoney(result.items[item].price);
      result.items[item].amount=accounting.formatMoney(result.items[item].amount);
    }
  }
  return result;
};
github gianlucadelgobbo / mongo-invoices / app / server / helpers / helpers.js View on Github external
exports.formatMoney = function formatMoney(result) {
  accounting.settings = global._config.accountingSettings;
  result.subtotal=accounting.formatMoney(result.subtotal);
  result.vat_amount=accounting.formatMoney(result.vat_amount);
  result.shipping_costs=accounting.formatMoney(result.shipping_costs);
  result.total=accounting.formatMoney(result.total);
  for (var item in result.items) {
    if (result.items[item]) {
      result.items[item].price=accounting.formatMoney(result.items[item].price);
      result.items[item].amount=accounting.formatMoney(result.items[item].amount);
    }
  }
  return result;
};
github paypal / appsforhere / lib / dust-helpers.js View on Github external
money: function (chunk, context, bodies, params) {
            var amt = dust.helpers.tap((params && params.key) ? params.key : bodies.block, chunk, context),
                cur = 'USD';
            if (params && params.code) {
                cur = dust.helpers.tap(params.code, chunk, context);
            }
            if (amt instanceof BigNumber) {
                amt = amt.toString();
            }
            return chunk.write(accounting.formatMoney(amt, Invoice.Currencies[cur].symbol));
        },
        currencySymbol: function (chunk, context, bodies, params) {
github AccountGo / accountgo / src / AccountGoWeb / Scripts / Purchasing / PurchaseInvoice.tsx View on Github external
render() {
        return (
            <div>
                <div>
                    <div>
                        <div><label>SubTotal: </label></div>
                        <div>{accounting.formatMoney(store.RTotal, { symbol: "", format: "%s%v" }) }</div>
                        <div><label>Tax: </label></div>
                        <div>{accounting.formatMoney(store.TTotal, { symbol: "", format: "%s%v" }) }</div>
                        <div><label>Total: </label></div>
                        <div>{accounting.formatMoney(store.GTotal, { symbol: "", format: "%s%v" }) }</div>
                    </div>
                </div>
            </div>
        );
    }
}
github AccountGo / accountgo / src / AccountGoWeb / Scripts / Quotations / SalesQuotation.tsx View on Github external
render() {
        return (
            <div>
                <div>
                    <div>
                        <div><label>SubTotal: </label></div>
                        <div>{accounting.formatMoney(store.RTotal, { symbol: "", format: "%s%v" }) }</div>
                        <div><label>Tax: </label></div>
                        <div>{accounting.formatMoney(store.TTotal, { symbol: "", format: "%s%v" }) }</div>
                        <div><label>Total: </label></div>
                        <div>{accounting.formatMoney(store.GTotal, { symbol: "", format: "%s%v" }) }</div>
                    </div>
                </div>
            </div>
        );
    }
}
github AccountGo / accountgo / src / AccountGoWeb / Scripts / Quotations / SalesQuotation.tsx View on Github external
render() {
        return (
            <div>
                <div>
                    <div>
                        <div><label>Running Total: </label></div>
                        <div>{accounting.formatMoney(store.RTotal, { symbol: "", format: "%s%v" }) }</div>
                        <div><label>Tax Total: </label></div>
                        <div>{accounting.formatMoney(store.TTotal, { symbol: "", format: "%s%v" }) }</div>
                        <div><label>Grand Total: </label></div>
                        <div>{accounting.formatMoney(store.GTotal, { symbol: "", format: "%s%v" }) }</div>
                    </div>
                </div>
            </div>
        );
    }
}

accounting

number, money and currency formatting library

MIT
Latest version published 10 years ago

Package Health Score

58 / 100
Full package analysis

Popular accounting functions