Formula defined invoicing for any business.

The Invoicer app help you generate sale or purchase invoices. The items to be invoiced and their price details are obtained from the Stocks app.

Invoicer app works with formulas to arrive at a total. Any invoice can either use the generic formula or a formula specific to that invoice. You can add and edit any formulas if you have the corresponding permissions to do so. More details at formulas sections.

This app maintains all your invoices and helps your search invoices with multiple filters.


Formulas are simple rules that any one can write, to arrive at the total of the invoice. Each business has their own pattern of invoicing. Hence, enabling the users to change the pattern at their will offers a great flexibility for a business.

The formulas uses a set of built-in functions and additional addons glued together by arithmetic symbols. Example,

sum(price(items())) + (1.5 * (quantity(items()))

In the above formula, + and * are arithmetic symbols and sum, price, quantity and items are the built-in functions

Aritmetic symbols:

Following are the list of arithmetic symbols you can use in your formulas.

  • + : Adds two numbers
  • - : Subtracts two numbers
  • / : Divides two numbers
  • * : Multiplies two numbers
  • % : Give the remainder from the division of two numbers. Ex 5 % 3 = 2

Built-in functions:

Built-in functions are letters followed by ( ). It accepts an input that are given within ( ), and returns a result. The input and output for any function is of a fixed format. If a function is given an input which is not of the correct format, you would see some errors, and the formula will be rejected.

Following are the list of supported functions.

  • sum

    Input - List of numbers.
    Output - Sum of all the numbers in the input list.

  • quantity

    Input - List of items.
    Output - List of quantity of all the items in the input list for the invoice on which this formula is applied

  • price

    Input - List of items.
    Output - List of after discount price of all the items in the input list.

  • items

    Input - No input.
    Output - List of all the items in the invoice.

  • items_of_ids

    Input - Comma separated item ids. Ex. items_of_ids(1) or items_of_ids(1, 2, 3, 100).
    Output - List of all items matching the ids in the input.

  • items_of_types

    Input - Comma separated type ids. Ex. items_of_types(1) or items_of_types(1, 2, 3, 100).
    Output - List of all items matching the type ids in the input.

  • discount

    Input - Accepts two numbers separated by comma. First number is percentile, and the second number is total for which discount should be applied. Example, discount(20, sum(price(items_of_ids(1,3,4,5)))) means discount of 20% on sum of prices of items matching ids of 1 or 3 or 4 or 5.
    Output - A number which is the after discount value.

As we can see from the above, output value of either sum or discount alone could be used with the arithmetic symbols, as one these two functions returns numbers.


When you have a formula like the one in the first example sum(price(items())) + (1.5 * (quantity(items())), which mean sum of all the items in the invoice added with 1.5 time the sum of quantity of items with type_id matching 1 (let's call it labout charge). But there won't be any explanation for the additional amount (the labour charge). To tag those charges, addons are used.

How to use addons?
Addons are created with a
  • name - This is the name that will appear in the invoice.
  • formula - The format of the formula is the same as used for the totalling.

Addons can be used in the the total formulas or in other addons by putting the name of the addon in {{ }}. For example, the above example we create an addon with name Labour charges @ ₹1.5 per sack and a formula (1.5 * (quantity(items())). Now the total can be written as

sum(price(items())) + {{Labour charges @ ₹1.5 per sack}}

Now the invoice will have an additional row with Labour charges @ ₹1.5 per sack which would tally the total visually


Example Formulas

Service charges:

Service charges are usually levied as a percentage of the total price of items. Following formula and addon can be used to do that.


  • Service Charges @ 15%

    Addon formula = 0.15 * sum(price(items()))

Total Formula:

sum(price(items())) + {{Service Charges @ 15%}}

Service taxes on service charges:

Following addons and formula can be used to include service taxes that are a percentile of the service charges.


  • Service Charges @ 15%

    Addon formula = 0.15 * sum(price(items()))

  • Service tax @ 12.34% on Service charges

    Addon formula = 0.1234*{{Service Charges @ 15%}}

Total Formula:

sum(price(items())) + {{Service Charges @ 15%}} + {{Service tax @ 12.34% on Service charges}}

Service tax on labour charges

For a business like a mechanical workshop, service tax is a percentile on the sum of all labour charges. For such a requirement, you can create an Item type named Service and add all the labour oriented item charges under that category. With this, following addons and formula can be used.


  • Service tax @ 12.34% on service items

    Addon formula = 0.1234 * sum(price(items_of_types()))

Total Formula:

sum(price(items())) + {{Service tax @ 12.34% on service items}}