Class InvoiceService

Hierarchy

Implements

Constructors

Properties

configService: ConfigService
db: Dexie
http: AxiosInstance
methodName: string = 'invoice'
moduleName: string = 'invoices'
printJobService: PrintJobService
printTemplateService: PrintTemplateService
printerService: PrinterService
sectionItemService: ISectionItemService
tillService: ITillService

Methods

  • Adds a discount to an invoice

    Parameters

    • invoice: IInvoice

      The invoice to add the discount to

    • discountType: CalcType

      The type of discount to add

    • amountOrPercent: number

      The amount or percent of the discount

    • calcFlow: CalcFlow = CalcFlow.AfterSubtotal

      The calculation flow to use for the discount

    Returns IInvoice

    The updated invoice with the added discount

  • Adds an item to an invoice line. If the item already exists in the invoice, the quantity is increased, otherwise a new line is created.

    Parameters

    • invoice: IInvoice

      The invoice to add the item to.

    • customer: ICustomer

      The customer associated with the invoice.

    • appConfig: IAppConfig

      The app configuration.

    • item: IItem

      The item to add to the invoice line.

    • modifiers: IInvoiceCoreLine[] = []

      An array of modifiers to apply to the item.

    • Optional lineOptions: LineOptions

      Additional options for the line.

    Returns IInvoice

    The updated invoice.

  • Calculate the total discount amount of an invoice and update grand total accordingly

    Parameters

    • invoice: IInvoice

      The invoice object containing discount details and lines

    • flow: CalcFlow

      The calculation of discount flow

    Returns void

    The updated invoice object with calculated discount and grand total

  • Calculates the rewarded credit for an invoice.

    Parameters

    • invoice: IInvoice

      The invoice to calculate the rewarded credit for.

    • aboveInvoiceAmount: number

      The minimum invoice amount required to be eligible for rewarded credit.

    • includeServiceCharge: boolean

      Whether to include the service charge in the calculation.

    • includeTax: any

      Whether to include the tax in the calculation.

    Returns void

  • Calculates and sets the rewarded points for the given invoice based on various conditions.

    Parameters

    • invoice: IInvoice

      The invoice to calculate rewarded points for.

    • aboveInvoiceAmount: number
    • includeServiceCharge: boolean
    • includeTax: boolean

    Returns void

    void

  • Calculates the rounding for an invoice based on the given parameters.

    Parameters

    • invoice: IInvoice

      The invoice to calculate the rounding for.

    • roundingBase: number

      The base value to round to.

    • roundingUp: boolean

      Whether to round up or down.

    • roundingCashless: boolean

      Whether to apply rounding only for cash payments.

    Returns void

  • Calculate and set the service charge for a given invoice. The method updates the service_charge and grand_total fields of the invoice.

    Parameters

    • invoice: IInvoice

      invoice to calculate the service charge for

    • rate: number

      service charge rate. e.g. 0.1 for 10%

    Returns void

  • Calculates the tax for an invoice based on the tax rate and tax method.

    Parameters

    • invoice: IInvoice

      The invoice to calculate the tax for.

    • taxRate: number

      The tax rate to apply.

    • taxMethod: TaxMethod

      The tax method to use (inclusive or exclusive).

    Returns void

Generated using TypeDoc