Insert expiry dates in output bills
The Insert Expiry Date in Output Bill wizard puts expiry dates in the lines of output bills in which materials with expiry dates went out with no date, by distributing to them the quantities that came in with their dates. You need it when output bills were saved without expiry dates, so the expiry reports do not show the remaining quantities exactly. The wizard runs from the Files Maintenance window.
Before you begin
- The wizard shows in Files Maintenance when the file does not work in multi-file mode and phase 2 of Saudi e-invoicing is not on (Available maintenance).
- You need what Run files maintenance explains. The program checks no permission named after the operation when you run it from the Files Maintenance window, the favorites menu or Quick Launch. The Insert Expiry Date in Output Bill permission in Users Management > Operations only decides whether the operation's tile shows on the desktop.
- The operation processes only the materials in which the Expiry Date option is on in the material card (Material card). To learn how the dates are recorded and followed see Follow the expiry dates of materials.
- The input bills must have been recorded with expiry dates. The program does not invent a date: it only distributes the dates that were entered.
- Ask the other users to leave the file. If the program finds another user when you click Start, it refuses to run.
- Take a backup. You cannot undo the operation after it ends, and the lines of bills may split in two. The wizard itself shows the backup page first (Back up a company file).
Steps
Open the wizard and take the backup
-
Click File, then Tools, then Files Maintenance. Select Insert Expiry Date in Output Bill and click Run. The warning box "This operation is dangerous …" shows when you select the operation. The details are in Run files maintenance.
-
On the Make a Backup page choose the type of backup, then click Next:
- To Hard Disk: selected when the page opens.
- To Removable Disk: its page and steps are in Make a backup.
- Don't Make a Backup (not recommended): the program goes to the next page without asking anything.
If your key is a cloud subscription, a page with the same title replaces this one. It says that the files do not support the manual backup, tells you to request the backup from the service provider, and asks "Are you sure you want to continue maintenance process?". Click Next to continue.
-
If you chose the hard disk, the Make Backup Copy on Hard Disk page shows. The program fills the Notes field with the file, server, computer, user, program version and date. Change it or leave it, then click Start. When the copy ends the program shows "Operation completed successfully" and goes to the next page. If the copy fails you stay on the page. Next is disabled on it.
You can click Cancel before Start on any page. The program asks "Are you sure you want to exit and cancel the maintenance operation?". Click Yes to leave with no change to the bills.
Choose the materials and the warehouses
- The Insert Expiry Date in Output Bill page shows. It explains that the maintenance "inserts the materials expiry dates in output bills for specified materials and warehouses".
- To limit the operation to a material choose Material. To limit it to the materials of a group choose Group. To limit it to a warehouse choose Warehouse. The Materials Terms list is also there, but the program does not pass the chosen condition to the operation, so the run is not limited by it; do not rely on it to limit the materials. Leave a field empty to include everything. The program combines the material, group and warehouse fields you fill: a material enters the operation if it meets all of them.
- Click Next.
- A page shows that asks you to click Start to begin, with the progress bar.
After Start the program works at once and asks for no confirmation. It changes the saved lines of output bills, it may split a line in two, and there is no undo after the run ends. The operation is not limited by a period: it processes the output bills of all dates for the materials and warehouses you chose. Check your choices and make sure the backup is ready.
- Click Start. The progress bar shows. Cancel is disabled during the run, so you cannot stop it.
- On success the message "Operation successfully completed" shows and the wizard page closes, whether the operation changed something or not. You return to Files Maintenance. Close it so that the other users can sign in.
Fields
| Field | Description | Required | Values and rules |
|---|---|---|---|
| Material | Limits the operation to this material. | No | Empty means all the materials. It includes the materials that branch from the chosen material. |
| Group | Limits the operation to the materials of this group. | No | Empty means all the groups. |
| Warehouse | Limits the operation to this warehouse. | No | Empty means all the warehouses. |
| Materials Terms | List of the saved conditions on the materials. | No | The saved conditions on the materials. The grid under the list shows the terms of the chosen condition, but the program does not pass the condition to the operation, so the run is not limited by it. Saved conditions are explained in Saved conditions field. |
| Button | What it does |
|---|---|
| Next | Goes to the next page. Disabled on the last page and on the hard disk backup page. |
| Back | Returns to the previous page. |
| Start | Starts the operation on the last page. |
| Cancel | Asks "Are you sure you want to exit and cancel the maintenance operation?", then closes the wizard. Disabled during the run. |
How the program distributes the dates
The program goes through each material in which Expiry Date is on, within your choices, and in each warehouse on its own:
- It collects the quantities remaining under each expiry date: the quantities of the input bills with their dates, with the gifts, minus the quantities of output bills that already have a date.
- It takes the output lines that have no date, sorted by the date of the bill, then the order of its type, then its number.
- It gives the first line with no date the date that has a remaining quantity. If the remaining quantity covers the whole line (its quantity with its gifts), the program moves to the next line. If it does not, the line splits: the covered part stays with its quantity and the date, and a new line is added with the rest and no date. The new line has the same line number, price, and discount and addition rates as the original. The discount and addition of the two parts are calculated by the same rate. If the material and warehouse have more than one expiry date, the operation does not define which date is used first.
- It stops when the remaining quantities end. The remaining output lines stay with no date.
- It sets the currency and the exchange rate of any bill line in the file that has no currency, from its bill.
The program does not compare the date of the output bill with the date of the input bill, and does not calculate the quantities at a given date: it uses the quantities remaining under each expiry date in the whole file. Everything happens in one transaction: if the program stops because of an error, the file returns to its state before the run.
Example (not verified in the program): 100 units of a material came in with the expiry date 31-12-2027 in a warehouse. An output bill dated 10-2-2026 has a line of 60 units with no date, and a bill dated 15-2-2026 has a line of 70 units with no date, with no gifts. After the operation: the line of the first bill is 60 units with the date 31-12-2027. The line of the second bill becomes 40 units with the date 31-12-2027, and a line of 30 units with no date is added to it.
Lines the operation does not process
| Line | What happens |
|---|---|
| A line of a material in which Expiry Date is not on | Not touched. |
| An output line that has an expiry date | Not touched, but its quantity is subtracted from the quantity remaining under its date. |
| A line outside the chosen material, group, warehouse or condition | Not touched. |
| A line that the remaining quantities with dates do not cover | Stays with no date. |
What the program logs
If the program option Activate log file is on, the program adds, after the insertion succeeds, a log record with the note "Insert Expiry Date in Output Bill". The record is not saved if the database refused the command. It shows in the Log File, on the Maintenances Log page (Log File).
Result
- The output lines covered by the quantities carry the expiry dates. Open an output bill and check, and open the expiry report to see the remaining quantities.
- Some output bills may have more lines.
- You cannot undo the operation. To return to the state before it, restore the backup.
If something goes wrong
| Message | Why it shows | What to do |
|---|---|---|
| Database is Opened By Users : … Please check that all users logged out then try again. | Another user works on the file. The message lists their names. The message "An error was encountered while performing the operation." follows it. | Ask them to leave, then click Start again. |
| Error In Stored Proc: … | The database refused the insertion command. The message shows the text of the command. The message "An error was encountered while performing the operation." follows it. The file returns to its state. | Try again. If the error repeats, contact support and send the text of the message. |
| Are you sure you want to exit and cancel the maintenance operation? | You clicked Cancel before Start. | Click Yes to leave, or No to continue. |
The message "No movement found in the specified period" does not show in this operation. If the program finds nothing to process, "Operation successfully completed" shows and nothing changes.
Related
This page applies to alameen ERP 10, version 10.1.79.764.