lbx-invoice
Version:
Provides functionality around generating invoices.
61 lines (60 loc) • 3.08 kB
TypeScript
import { BigNumber } from './big-number.utilities';
import { BaseInvoice, InvoiceItem, Vat } from '../models';
/**
* Provides functionality around calculating invoices/prices.
*/
export declare abstract class InvoiceCalcUtilities {
/**
* Gets the total price of an item before tax.
* @param item - The invoice item to get the price from.
* @returns The amount of the item times its price.
*/
static getItemTotalPriceBeforeTax(item: InvoiceItem): BigNumber;
/**
* Gets the total price of an item after tax.
* @param item - The invoice item to get the price from.
* @returns The total price before tax times 1 + tax/100.
*/
static getItemTotalPriceAfterTax(item: InvoiceItem): BigNumber;
/**
* Gets the total tax for the given item.
* @param item - The item to get the total tax from.
* @returns The total price before tax times tax/100.
*/
static getItemTotalTax(item: InvoiceItem): BigNumber;
/**
* Gets the total price of an invoice before tax.
* @param invoice - The invoice to get the price from.
* @returns The addition of the total price before tax of all items in the invoice. If this would be negative this returns 0.
*/
static getTotalBeforeTax<Invoice extends BaseInvoice>(invoice: Invoice): BigNumber;
/**
* Gets the total price of an invoice after tax.
* @param invoice - The invoice to get the price from.
* @returns The addition of the total price before tax and the total tax of the invoice.
*/
static getTotalAfterTax<Invoice extends BaseInvoice>(invoice: Invoice): BigNumber;
/**
* Gets the total tax of the invoice.
* @param invoice - The invoice to get the total tax from.
* @returns The addition of the tax of all items of the invoice.
*/
static getTotalTax<Invoice extends BaseInvoice>(invoice: Invoice): BigNumber;
/**
* Gets the total tax for a specific tax group (eg. 19%).
* @param invoice - The invoice to get the total tax from.
* @param group - The tax group for which the total tax should be calculated.
* @param groupOnlyByRate - Whether or not VAT groups are only determined by rate and not by category code.
* @returns The addition of the tax of all items that are in the provided tax group.
*/
static getTotalTaxForTaxGroup<Invoice extends BaseInvoice>(invoice: Invoice, group: Vat, groupOnlyByRate: boolean): BigNumber;
/**
* Gets the total price of an invoice before tax.
* @param invoice - The invoice to get the price from.
* @param group - The tax group to get the total before from.
* @param groupOnlyByRate - Whether or not VAT groups are only determined by rate and not by category code.
* @returns The addition of the total price before tax of all items in the invoice. If this would be negative this returns 0.
*/
static getTotalBeforeTaxForTaxGroup<Invoice extends BaseInvoice>(invoice: Invoice, group: Vat, groupOnlyByRate: boolean): BigNumber;
private static getItemsForTaxGroup;
}