The web application allows calculating the cost of goods, knowing the cost of raw materials needed for their production. The cost of raw materials is calculated automatically when creating a specification for finished goods. The formula is individually composed by each user considering their requirements.

The formula is compiled using a **formula builder**. To launch the builder, select the **Formula** item in the top menu. In the builder, you can add various variables and coefficients to the formula that contribute to a more accurate calculation of the cost. For example, you can add: piece-rate labor payment, delivery cost, electricity, etc. However, the formula should not be overloaded with secondary parameters that can be avoided.

The formula is created once and subsequently applies to all your products. The formula can be changed, but this leads to the clearance of the price list and the orders section due to data being outdated. You will have to fill them in again.

Every formula contains a default variable **[mat]**. It displays the cost of raw materials necessary for the production of any of your product names. This cost is calculated automatically as soon as a specification is created for the product. It is impossible to remove this variable from the formula.

To the **[mat]** variable in the formula, you can add other variables and coefficients.

**Coefficient** - this is a certain fixed number (constant).

**Variable** - this is a variable, the value of which the user enters manually for each product.

Additional variables in the formula are used for:

- Flexible and more accurate cost calculation;

- Variables are summed up in orders. For example, if you entered a piece-rate labor payment variable for a product in the formula, you will see the sum of piece-rate wages in total for the order.

Let's look at the compilation of the formula using examples.

In this example, the cost is not calculated but is equated to the cost of materials. This is done to simplify the calculation of the price of finished goods. The actual costs of producing the goods flow into the trade markup.

This method works for public catering enterprises: restaurants, canteens, coffee shops, fast foods, etc. When a trade markup, for example, 300%, is applied to the cost of ingredients and products (raw materials), which includes the costs of preparing the products.

To create this formula, you need to go to the builder and without changing anything there, go through a few steps by clicking the "Next" -> "Test" -> "Save" button.

Sometimes a cost calculation formula is applicable, according to which the cost of materials is multiplied by a certain coefficient. For example, we accept the coefficient as 1.4. The cost calculation formula takes the following form:

**[mat] * 1.4**

If you pay a piecework salary for product manufacturing, you can enter this variable [pw] into the formula.

Piecework payment is usually proportional to the costs of a company for producing a unit of product. It's only necessary to compare the amount of piecework labor pay with the total volume of the organization's costs and calculate their ratio.

For example, it might turn out that in addition to the piecework labor pay [pw], the organization incurs additional costs that are on average equivalent to two more [pw].

It's easy to derive a universal formula:

**[mat] + [pw] * 3**

In the formula builder, you can independently create almost any formula that will allow you to get the cost based on the price of raw materials. The formula can contain up to 10 variables and any number of coefficients.

At the same time, it is not recommended to overload the formula with redundant variables. Here the principle is important: the simpler, the better. The main thing is that the transition from the price of materials to cost is as accurate as possible.

In the cost formula, you can use arithmetic operators +-/* and parentheses ().

Go to the formula builder page through the menu in the upper right corner:

Creating a cost calculation formula takes place in three steps:

- Click on the add button and enter the variable and its description.

- The variable is output in square brackets.

- It is advisable to indicate the units of measurement in the variable name. For example:
**[pw] - worker's salary**. After adding variables, we move on to the next step.

In this step, we compile a formula from the variables created in the previous step.

For example: **[mat]+[pw]*3**

Before saving the formula, you need to make sure it is calculated correctly. To do this, enter values into the available fields and press "Test". If the formula is successfully calculated, a corresponding message will appear, and the "Test" button will change to "Save". We recommend checking the formula several times, with different values.