First In First Out
This report answers the question: what did the goods I issued in each output bill cost if the goods that came in first go out first? For each output bill in the period it shows the quantity and the cost, and under it the cost of each material in it. In the conditions window a button Modify Bill price writes this cost into the prices of the output bills themselves (see The Modify Bill price button).
The report itself changes nothing. The button Modify Bill price rewrites the lines of output bills, posts them again and regenerates their entries, and there is no undo command. Read the warning before the steps of the button and back up the file before you use it.
Opening the report
- From the ribbon: Invoices > Tools > Invoices Tools > First In First Out. Open the menu of the Invoices Tools button and click the command.
- The command appears if your licence includes the extended reports and a file is open.
- The user needs the permission First In First Out in Users Management, on the Reports page.
The conditions window appears first. Set the conditions and click Preview to show the report. The buttons of the window are explained in Report parameter forms, and what follows the display in The viewer.
How the report calculates the cost
The program applies these steps to each material in each warehouse separately. It never uses the stock of one warehouse to price the output of another.
- Movements: it reads all the posted bills of the material from the start of the file to the To date, whatever their form. From and Report Sources do not affect this step: they only decide which output bills are shown.
- Order: it orders them by date. On the same date the bill form decides the order: opening inventory first, then input forms such as purchases, then transfers and transpositions (the output of each before its input), then output forms such as sales, then the raw materials of manufacturing; then the bill number.
- Layers: each input line forms a layer. Its quantity is the line quantity with its gifts, and its value is the unit price × (quantity + gifts). So the unit price of the layer is the unit price of the line, and the gifts add quantity at the same unit price.
- What enters the value of a layer:
- The value counts only if the input bill form has Affects Cost Price ticked. If not, the layer value is zero, so it adds quantity with no cost (a Sales Returns form starts with this option off). See Invoice forms.
- The line discount and its share of the discounts of the bill's grid are subtracted if the form has Discounts Affect Cost Price. If the form has Additions Affect Cost Price, the share of the line in all the additions of the bill (those of its lines and those of the additions grid together) is added, in proportion to its value.
- The value becomes zero if the security level of the bill is above your permission to read prices on its form.
- Matching: for each output line, in the same order, the program takes its quantity with its gifts and consumes it from the oldest layer that still has quantity of the same material in the same warehouse. If that layer is not enough it moves on to the next. The cost of the line is the sum of (quantity consumed from each layer × unit price of the layer).
- Unit cost: the cost of the line divided by the quantity of the line, without the gifts.
When there is not enough stock:
- If the material goes out before the goods that cover it come in, the program still consumes from the first later layer and treats the line as a negative output. The report shows nothing that says so. The Modify Bill price button refuses to work.
- If a line is larger than everything that came in up to the To date, the cost of the covered part only is counted, and the rest has no cost. The button refuses to work here too.
The test covers every material read (by the Material, Group, Warehouse and Materials Terms of the window), in all forms, from the start of the file to the To date, not only the chosen forms and period.
Parameters
The table follows the order of the window in the standard layout. You can change the layout to tabs in Report options. With Tabs the pages are General (it holds the Advanced Options group), Report Sources and Materials Terms. With Extended Tabs they are General, Advanced Options, Report Sources and Materials Terms. After the report is shown you can change some conditions in the Option List panel of the viewer, then click Apply. The panel has General (Material, Group, Warehouse and Use Unit), Period (the two dates) and Advanced Options (stock and service materials). It does not have % Multiply Factor, Currency, Report Sources or Materials Terms: to change them open the conditions window again. The panel is disabled while a workspace is in use, and after Refresh or Apply.
| Parameter | Description and effect | Default and rules |
|---|---|---|
| Material | Limits the calculation to this material. | Empty, that is all materials. |
| Group | Limits the calculation to the materials of this group and its sub-groups. | Empty, that is all groups. |
| Warehouse | Limits the calculation to this warehouse and its sub-warehouses. Layers and output are matched inside each warehouse itself. | Empty, that is all warehouses. |
| Date | Decides which output bills are shown and have their price modified. All movements are read from the start of the file to the To date. | From the start of the financial period if the program option "default start date is the start of the period" is on, otherwise from the first day of the current month, to today's date. |
| % Multiply Factor | A factor that multiplies the cost, not a percentage. 1 keeps the cost and 1.2 raises it by 20%. In the report it only changes the hidden column Total; in the Modify Bill price button it sets the new price. | 1. |
| Currency | The currency in which prices and cost are calculated. It shows if your licence allows more than one currency. | The default currency in the program options. The Modify Bill price button always uses the base currency. |
| Use Unit | The unit of the quantity and the cost: First Unit, Second Unit, Third Unit or Default Unit. The Modify Bill price button always uses the first unit. | Default Unit. |
| Materials Terms | Saved conditions on the material cards. The editor is explained in Report parameter forms. It shows if your licence includes material conditions in reports. | Without. |
| Report Sources | The bill forms that are shown and modified. The list shows output forms only, and leaves out the forms that have approvals activated. It is explained in Report parameter forms. | |
| Stock Materials (in Advanced Options) | Includes stock materials. | Ticked. |
| Service Materials (in Advanced Options) | Includes service materials. If you clear Stock Materials, the program reads service materials only, whether or not you tick this option. | Not ticked. |
The window has no cost center field, so the report is not limited by a cost center.
The report header shows the date range and the currency, then Branches if branches are enabled in the file.
The window shows the Modify Bill price button (see The button). It does not show in the viewer ribbon.
Columns
The main table has one row for each output bill. Click the arrow of a row to open the table of its lines. Add the hidden columns from the field list, see Report grid tools.
Bills
The program shows the posted output bills dated inside the period whose form is among the Report Sources, ordered by date, then form, then number. It does not leave out a bill whose security level is above your permission.
| Column | Meaning | When it shows | How it is calculated |
|---|---|---|---|
| Bill | The form abbreviation, a colon and the number, like S:31. | Always. | The Latin abbreviation in a non-Arabic interface, if there is one. |
| Date | The bill date. | Always. | |
| Quantity | The bill quantity. | Always. | The sum of the quantities of its lines in the chosen unit, without gifts. |
| Gifts | The quantity of gifts. | Hidden. | The sum of the gifts of the lines in the chosen unit. |
| Cost Price | The sum of the unit costs of the lines. | Always. | The sum of (cost of the line ÷ quantity of the line) over the lines of the bill. For a bill with one material it is the unit cost. For a bill with several materials it is the sum of their unit costs, even if their units differ. |
| Cost | The cost of the bill. | Always. | The sum of the cost of its lines by the matching. |
| Total | The cost after the factor. | Hidden. | Cost × % Multiply Factor. |
Bill lines
| Column | Meaning | When it shows | How it is calculated |
|---|---|---|---|
| Material Code and Material Name | The material. | Always. | From the material card. |
| Quantity | The quantity of the line. | Always. | In the chosen unit, without gifts. |
| Gifts | The gifts of the line. | Hidden. | In the chosen unit. |
| Cost Price | The unit cost. | Always. | Cost of the line ÷ quantity of the line. If the quantity is zero it is divided by 1. |
| Cost | The cost of the line. | Always. | By the matching. |
| Total | The cost after the factor. | Hidden. | Cost × % Multiply Factor. |
The cost price divides a cost that includes the gifts by a quantity that does not, so it is above the unit price when the line has gifts.
Worked example
The material M01 (rice) in the warehouse S01, all posted, the period 01-01-2026 to 31-01-2026, % Multiply Factor 1, Use Unit the first unit.
Input (each bill forms a layer):
| Layer | Bill | Date | Quantity | Price | Layer value |
|---|---|---|---|---|---|
| L1 | Purchase 1 | 02-01-2026 | 10 | 5.00 | 50.00 |
| L2 | Purchase 2 | 10-01-2026 | 20 | 6.00 | 120.00 |
| L3 | Sales Returns 3 (its form does not affect the cost price) | 18-01-2026 | 3 | 4.00 | 0.00 |
Output, and its cost by the matching:
| Bill | Date | Quantity | Layers consumed | Cost |
|---|---|---|---|---|
Sale 31 | 12-01-2026 | 8 | L1: 8 × 5.00 | 40.00 |
Sale 32 | 15-01-2026 | 7 | L1: 2 × 5.00 + L2: 5 × 6.00 | 10.00 + 30.00 = 40.00 |
Sale 33 | 20-01-2026 | 10 | L2: 10 × 6.00 | 60.00 |
Sale 34 | 22-01-2026 | 8 | L2: 5 × 6.00 + L3: 3 × 0.00 | 30.00 + 0.00 = 30.00 |
So the report shows:
| Bill | Date | Quantity | Cost Price | Cost |
|---|---|---|---|---|
S:31 | 12-01-2026 | 8.00 | 5.00 | 40.00 |
S:32 | 15-01-2026 | 7.00 | 5.71 | 40.00 |
S:33 | 20-01-2026 | 10.00 | 6.00 | 60.00 |
S:34 | 22-01-2026 | 8.00 | 3.75 | 30.00 |
The cost price of bill 32 is 40.00 ÷ 7 = 5.714…. The cost price of 34 is 30.00 ÷ 8 = 3.75: layer L3 added 3 units with no cost. The total cost is 170.00, and all the quantities were consumed (33 in and 33 out).
The Modify Bill price button
The button is in the conditions window, not in the viewer. It writes into the chosen output bills the unit cost found by the matching above, multiplied by % Multiply Factor, in place of their current prices.
Before you use it
- Back up the file.
- Choose Report Sources and Date carefully: the program modifies the posted output bills of the chosen forms between the two dates, and in some cases bills of other forms (see step 3 below).
- The button works in the base currency and the first unit whatever you chose in Currency and Use Unit. It respects Material, Group, Warehouse and Materials Terms.
Steps
Make a backup of the file first. The button changes the bills in the period and cannot be undone. It can also reach bills beyond the forms you chose (see step 3 of What the program does). When it finishes, review the totals of the modified bills, and audit the materials balances with Audit Materials Balances and Prices in Files Maintenance (see Available maintenance).
- Click Modify Bill price.
- The message "This operation will modify selected bills in report sources within specified period. Are you sure?" appears. Click Yes, or No to cancel.
- A wait window named Modify Bill price appears, then the message "Operation successfully completed".
The button does not check the sources. If you chose none, no bill changes and the success message still shows.
What the program does
-
It calculates the matching as in How the report calculates the cost. If it finds a negative output it stops without changing anything, and the message "Negative output found! Can't modify bills prices" appears.
-
For each output line in a bill dated inside the period whose form is among the sources, it finds its layers. If the user is not an administrator, it leaves out the bills whose security level is above the permission to modify their form.
-
It deletes from these bills the lines it read (by material, group, warehouse, materials terms and kind of material, stock or service), so other lines, such as services, stay with the starting options. A line whose quantity and gifts are both zero is deleted and not written again. It writes in their place one line for each layer consumed: the quantity consumed, and the price = the unit price of the layer × % Multiply Factor (at the unit price of the second or third unit if the bill line used it). The new line keeps the material, unit, warehouse, currency and its rate, and cost center, and takes the expiry date of the input line consumed. The other values of the old line, such as the line discount, addition, notes, tax and gifts (which are added to the quantity), are not carried over.
The bills it deletes can include bills of other forms. If a chosen form that has movements has sort number 4 (its number in the order of the forms), the button also rewrites the bills in the period of every form whose sort number is 3, of any kind, and with sort number 8, of every form whose sort number is 7. A normal bill of such a form can lose its lines. Change the order of the forms first, or do not choose such a form.
-
It extends the change to what is linked to them: the input bill that matches a transposition gets the same lines and prices. If the movements it read include the raw materials bill of a manufacturing operation, it also recalculates the prices of the products of every manufacturing operation in the file, from the materials of each operation multiplied by the factor.
-
It marks the bills as not posted and posts them again, and it regenerates the entries of the bills whose form is set to Generates Entry Automatically (and not Doesn't Generate Entry), or that already have an entry. The program does not take back the quantities of the first posting from the warehouses before it posts again, so after the button the quantities of the warehouses may not match the bills. Run Audit Materials Balances and Prices afterwards. That operation also recalculates the profits, so the profits of the next step change. If the user is not an administrator, a bill that has no entry and whose security level is above the permission to generate entries on its form is left out of this step: it is not posted again and gets no entry, although its lines were rewritten.
-
If % Multiply Factor is not
1, it sets the profit of each line = unit cost × (factor − 1) × quantity (for a line in the second or third unit, divided by the factor of that unit); otherwise it sets the profit to zero. The profit of the bill is the sum of the profits of its lines.
Example
With the data above and % Multiply Factor 1.2, bill 32 becomes two lines instead of one:
| Line | Quantity | Price | Value | Profit |
|---|---|---|---|---|
| Layer L1 | 2 | 5.00 × 1.2 = 6.00 | 12.00 | 2 × 5.00 × 0.2 = 2.00 |
| Layer L2 | 5 | 6.00 × 1.2 = 7.20 | 36.00 | 5 × 6.00 × 0.2 = 6.00 |
The lines add up to 48.00 = 40.00 × 1.2, and the profit is 8.00. The program does not recalculate the stored total of the bill, nor its discounts, additions and tax. Bill 34 becomes two lines: 5 at 7.20 and 3 at 0.00.
After the button, the lines of the modified bills lose what is not carried over. Check one bill of each form before you modify a long period.
Right-click menu
Right-click a row. The program adds the display commands for what the row is linked to automatically, and the report has no commands of its own.
| Command | Table | When it shows | What it does |
|---|---|---|---|
| Display Material Movement... | Materials | In a detail row, and you have the Material Movement permission. | Opens the conditions window of the material movement with the material of the row. |
| Display Daily Movement... | Materials | In a detail row, and you have the Daily Movement permission. | Opens the conditions window of the daily movement of the material. |
| Display Material Card... | Materials | In a detail row. | Opens the material card. |
| Display Bill... | Bills | In the main and the detail rows. In a main row it is the only command. | Opens the bill. |
Double-clicking a row runs the last command you used from the menu, or else the first one. So the first double-click on a detail row runs the first material command that you are allowed to use, not Display Bill....
Messages
| Message or state | Why it appears | What to do |
|---|---|---|
| This operation will modify selected bills in report sources within specified period. Are you sure? | You clicked Modify Bill price. | Yes runs it, No cancels. |
| Operation successfully completed | Modify Bill price finished. | Check a modified bill. |
| Negative output found! Can't modify bills prices | A material in the movements went out before the goods that cover it came in, or no goods ever came in to cover it (in any form, up to the To date). Nothing changed. | Fix the negative output, then try again. |
The messages of the conditions window are in Report parameter forms.
Related
This page applies to alameen ERP 10, version 10.1.79.764.