Merge Bills by Customer
This tool takes the bills of a customer that are recorded under one bill form and creates a new bill under another form that adds up their materials and values. It helps when a customer takes goods in several batches and is invoiced once. The tool does the work when you click Ok; it is not just a preview. Afterwards it shows the Group Materials By Customer report with what it created.
For the practical steps see Merge bills by customer.
The tool changes the file: it creates new bills, and it deletes the original bills if you tick Delete Merged Bills. There is no undo command. Back up the file before first use, and try a short period or one customer first. The tool creates the bills directly in the database, not through the bill window.
Opening the window
- From the ribbon: Invoices > Tools > Invoices Tools > Merge Bills by Customer. Open the menu of the Invoices Tools button and click the command.
- The command appears if a file is open and your licence includes the stock feature. It does not appear with the Syrian tax system.
- The user needs the permission Merge Bills by Customer in Users Management, on the Reports page.
- If the file has the replication system activated, the message "The tool cannot be used in a file that has the Replication system activated." appears and the window does not open.
- If you have no Add permission on any bill form (other than the forms excluded from both lists), the message "You don't have the authority to add bills" appears when the window opens. It appears again when you click Ok, and the program stops.
- Bill forms that have approvals activated do not appear in either list (see Require approvals on a form).
Fields
The window stays open after Ok. You can change the conditions and run the tool again. To keep your values, open the system menu and choose Save as Default (see Save dialog values as default).
| Field | Description | Required | Values and rules |
|---|---|---|---|
| Customer | Limits the bills to one customer. | No | A lookup box with the rules of lookup boxes. Empty at first. It is disabled if you choose Account. |
| Account | Limits the bills to the customers whose account is this account or one of its sub-accounts. | No | A lookup box. Empty at first. It is disabled if you choose Customer. |
| Cost Center | Limits the bills to this cost center and its sub-centers. | No | Empty at first. The field shows only if your licence includes cost centers. Choosing a center enables the two cost center options in Report Options. |
| Group | Limits the merge to the materials of this group and its sub-groups. | No | Empty at first. See Limited materials. |
| Bills to be Merged | The form of the original bills. | Yes | A list of the forms you may browse. The first form is selected. |
| Resulting Bills | The form of the new bill. | Yes | A list of the forms you may add bills to. The first form is selected. |
| Customers Terms | A saved condition on customer cards that limits the customers. | No | Without at first. The box is explained in Materials terms and works the same way with customer conditions. |
| Materials Terms | A saved condition on material cards that limits the merged materials. | No | Without at first. See Limited materials. |
| Invoice Terms | A saved condition on bills that limits the bills. | No | Without at first. |
| Date from - to | Limits the bills by date, both dates included. | Yes, if you choose this button | Selected each time you open the window. Default dates: from the start of the 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 (or the end of the period if today is after it). |
| Bill Number from - to | Limits the bills by number, both numbers included. | Yes, if you choose this button | The date fields are disabled and the number fields enabled. Enter whole numbers, such as 15 and 40. |
| Contain and Not contain (group Notes) | Keeps the bills whose notes contain (or do not contain) the text. | No | Empty at first. Do not type an apostrophe ' in them: it breaks the query. |
| Total and Detailed (group Assembling Method) | Decides how many new bills each customer gets. | Yes | Total is the default: one bill for the whole customer. Detailed: one bill for each day. See How the program merges. |
Report options
A list of check boxes. The values below are what the window starts with, before you save any default.
| Option | What it does | Default |
|---|---|---|
| Credit Bills | Merges credit bills. | Ticked |
| Cash Bills | Merges cash bills. Credit and cash bills are never merged into one bill. | Not ticked |
| Delete Merged Bills | Deletes the original bills after creating the new ones. The program asks you to confirm on Ok. It is disabled and unticked if the form to merge is a Saudi e-invoice form (a sale or sales return that generates an entry and is not a quotation) and the Saudi tax system is on. | Not ticked |
| Cost Center Belongs to Bill | Takes the bills whose cost center is the chosen Cost Center or one of its sub-centers. Disabled unless you choose a cost center. | Ticked |
| Cost Center Belongs to Bill Items | Takes the bills that have this cost center on their lines, and merges those lines only. Disabled unless you choose a cost center. | Not ticked |
| Post Bills that Automatically "Post to Warehouses" | Posts the new bills to the warehouses if their form is set to Auto Post to Warehouses. | Ticked |
| Process Bills with No Customers | Includes the bills that have no customer. With this option Customers Terms no longer excludes any bill, and Account matches the account of the bill itself, not its sub-accounts. | Not ticked |
- One of Credit Bills and Cash Bills always stays ticked: if you clear both, the program ticks the item you clicked.
- If you choose a cost center and neither cost center option is ticked, the program ticks Cost Center Belongs to Bill.
Buttons
| Button | What it does |
|---|---|
| Ok | Checks the conditions, then shows the bills for you to choose and does the merge as described in What happens after Ok. It does not close the window. |
| Cancel | Closes the window without a change. |
What happens after Ok
- If you ticked Delete Merged Bills, the program asks: "The original bills (Copied) will be deleted! Deletion can't be undone. Are you sure ?". Click Yes to continue, or No to return to the window without doing anything. (The text says "Copied" although this is a merge tool.)
- The program checks the conditions. The messages in Messages appear if something is missing, and for the customer and material conditions the messages of Materials terms.
- The program reads the bills without changing anything and shows the Bills to be Merged window.
- After Ok in that window: if the file works with the Gulf tax system, the message "Please note that the collected invoices will not appear in Tax Return until you implement tax modification on them." appears and the work continues.
- If you do not have the permission Re-Collect Collected Bills, the message "You don't have the authority to collect previously collected bills" appears, and the program leaves out every chosen bill that was merged before. The message appears on every run for a user without the permission, whether or not a chosen bill was merged before.
- If a chosen bill was merged before and its new bill still exists, the Collected Bills window appears.
- The program does the merge as in How the program merges and shows the report.
Bills to be Merged
A window with a list of the bills that matched the conditions. A bill whose security level is above your permission to browse its form does not appear. If no bill matched, the list is empty and nothing happens after Ok.
| Column | Meaning |
|---|---|
| Check box (no heading) | Ticks the bill to merge. All bills are ticked when the window opens. |
| Number | The bill number. |
| Date | The bill date. |
| Customer Name | The name of the bill customer (the Latin name when the interface is not Arabic). |
| Net invoice value | The bill value after discounts, additions and taxes. |
| Value Added | The tax value of the bill. |
| Maturity Date | The due date from the payment terms, for a credit bill whose form has payment terms. Empty otherwise. |
The bills are ordered by customer name, then date. You can sort them by clicking a column heading.
The program reads the ticks by the original order of the rows. Tick and untick before you change the order of the list by clicking a column heading, and check in the result report which bills were merged.
| Button | What it does |
|---|---|
| Ok | Accepts the ticked bills. If you ticked none, nothing happens. |
| Cancel | Closes the window without merging. |
Collected Bills
It appears when a chosen bill was merged before and the resulting bill still exists. The text is "There are previously collected bills. Do you want to collect them again". Under it a list has three columns.
| Column | Meaning |
|---|---|
| Customer Name | The customer name, on the first row of the customer only. |
| Bill | The number of the original bill, written with the form name of the earlier merged bill, a colon and the number. |
| Merged Bills | The earlier merged bill, written with its form name, a colon and the number. |
| Button | What it does |
|---|---|
| Yes | Merges these bills again with the others, if you have the permission Re-Collect Collected Bills. The earlier merged bills stay as they are. |
| No | Leaves out every bill that was merged before and merges the rest. |
The program treats a bill as merged before as long as its new bill exists. If you delete the merged bill and kept the original, the original is merged again without this question.
How the program merges
What it merges
The ticked bills are merged into one bill when they agree on all of this:
- The customer and the customer account on the bill.
- The currency and its exchange rate, the bill warehouse, the branch and the bill cost center.
- The payment method (credit or cash), the first payment, and the posting state (posted or not posted).
- The day, if you chose Detailed.
Two bills of the same customer with different warehouses, or a different first payment, or one posted and one not, give two new bills.
The new bill
| Item | What it gets |
|---|---|
| Form | Resulting Bills. |
| Number | Continues the last number of this form in the same branch, so the first new bill takes the next number, and so on. If the form has no bills in the branch, the new bills get numbers from 1 in the order they are created in the run. |
| Date | With Total: today's date, or the end of the period if that is earlier. With Detailed: the date of the day of the original bills. |
| Customer, account, currency, warehouse, branch, cost center, payment method and first payment | As in the original bills. |
| Notes | The original form name, the range of numbers and the count of bills, in the program language. In Arabic like "تسليم من5 إلى 9 عدد الفواتير المجمعة: 3", in English "Delivery from5 to 9 Count of Collected Bills: 3". The notes of the original bills are not carried over. |
| User and security level | The user who ran the tool, and security level 1. |
| Not carried over | Payment terms and due date, the salesman and distributor, the extra text fields, the custom fields and the payment links. Set them in the new bill if you need them. |
The lines
- Identical lines are merged into one line whose quantity, gifts, discount, addition, second and third quantities and tax are added up. Identical means the same material, unit, price, exchange rate, batch, production and expiry dates, dimensions, line notes, currency, warehouse, cost center and piece count.
- The price of a material is never changed or recalculated. If two bills have a different price, their lines are not merged.
- The bill discounts and additions (the discount grid) are added up by account, counter account, cost center and notes, and moved to the new bill.
- The program recalculates the totals of the new bill.
- The serial numbers on the lines of the original bills are copied to the matching new lines.
Limited materials
With Group or Materials Terms the program merges only the lines of the matching materials, and does not move the bill discounts and additions. If you also tick Delete Merged Bills, it deletes these lines from the original bills, and deletes the whole original bill if no line is left. A bill that keeps some lines is left without recalculating its totals or entry. The program has cancelled its posting and does not post it again: post it from the bill window.
What happens to the original bills and entries
| Case | Original bills | New bill |
|---|---|---|
| Delete Merged Bills not ticked | They stay as they are, with their posting, entries and links. | Created in addition to them. |
| Delete Merged Bills ticked | The program cancels their posting to the warehouses, then deletes them. With each bill it deletes its lines, discount grid, links to other bills, serial number links and entry. | Created before the deletion. |
- Entry: the program generates an entry for the new bill if its form is set to Generates Entry Automatically, with the accounts of the form. The entries of the original bills stay with them or are deleted with them.
- Posting: with Post Bills that Automatically "Post to Warehouses" ticked and the new form set to Auto Post to Warehouses, the new bill is posted. Otherwise it is saved unposted, and you post it from the bill window.
- Double effect: if you keep the original bills and both forms post to the warehouses or generate entries, the material quantities and the customer account count both bills. Use Delete Merged Bills, or choose an original form that neither posts nor generates entries.
- Bills you may not delete: the program deletes an original bill if its security level does not exceed your delete permission on its form. A bill you may not delete stays, but the program has already cancelled its posting. The message "Some bills were not deleted because you don't have the authority to delete them" appears.
- Payments: the program does not move payment links from the original bills to the new one. See Link payments to bills.
- Undo: there is no undo command. To cancel a merge, delete the new bills in the bill window. If you kept the original bills they can be merged again. If you deleted them, the program cannot bring them back; only the backup can.
- Log: if operations logging is on in the program options, the program writes a log record for each new bill and each deleted bill.
- Serial numbers: if the materials of the bills require serial numbers, they are copied to the new bill, so with the originals kept a number appears in two bills. The program checks this, stops the operation and rolls it back (see Messages).
Example
Bills of the customer "Ahmed" of the form "Delivery" (credit, same warehouse and exchange rate, not posted). The last number of the form "Sale" in the branch is 40. Today is 28-12-2026.
| Bill | Date | Lines |
|---|---|---|
5 | 05-12-2026 | Rice 10 at 2.00, sugar 5 at 3.00 |
6 | 07-12-2026 | Rice 4 at 2.00 |
9 | 20-12-2026 | Rice 6 at 2.50 |
With Total, one "Sale" bill is created, number 41, dated 28-12-2026, with the notes "Delivery from5 to 9 Count of Collected Bills: 3".
| Material | Quantity | Price | Value |
|---|---|---|---|
| Rice | 14 (10 + 4) | 2.00 | 28.00 |
| Rice | 6 | 2.50 | 15.00 |
| Sugar | 5 | 3.00 | 15.00 |
| Total | 58.00 |
The total equals the total of the original bills: 35.00 + 8.00 + 15.00 = 58.00. The first two lines were not merged because their price differs.
With Detailed, three new bills are created, numbered 41, 42 and 43, dated 05-12-2026, 07-12-2026 and 20-12-2026, each with the lines of its bill. The total does not change.
Messages
| Message | Why it appears | What to do |
|---|---|---|
| You don't have the authority to add bills | No form in the lists has an add permission for you. It appears when the window opens and on Ok. | Ask the administrator for an add permission on a form, or remove its approvals. |
| Must select "Between Dates" or select "from No. to No." | You chose Bill Number from - to and both numbers are 0 or less. | Enter a positive number in at least one field. |
| More than | You chose Bill Number from - to and the first number is greater than the last. The message shows with this phrase alone. | Correct the two numbers. |
| The original bills (Copied) will be deleted! Deletion can't be undone. Are you sure ? | You ticked Delete Merged Bills and clicked Ok. | Yes continues, No returns to the window. |
| Please note that the collected invoices will not appear in Tax Return until you implement tax modification on them. | The file works with the Gulf tax system. It appears after you choose the bills. | Run the tool that modifies bill taxes on the new bills. |
| You don't have the authority to collect previously collected bills | You do not have the permission Re-Collect Collected Bills in Users Management > Operations. | Ask for the permission, or accept that bills merged before are left out. |
| There are previously collected bills. Do you want to collect them again | A chosen bill was merged before and its new bill still exists. | Yes merges them again, No leaves them out. |
| Selected bills cannot be collected, this will result in duplicate Serial Numbers | After the merge a serial number would appear in two bills. The program rolled the merge back. | Tick Delete Merged Bills, or do not merge the bills of these materials. |
| Selected bills cannot be collected, they contain duplicate Serial Numbers | The chosen bills already contain a duplicate serial number before the merge. The program rolled back. | Correct the serial numbers in the bills. |
| No Bills Merged | The merge produced no bill. It may appear with Delete Merged Bills ticked, and the run may end without it. | Check your conditions and your answers about merging again. |
| Some bills were not deleted because you don't have the authority to delete them | The file has a bill whose security level is above your delete permission. It appears after every run, even without Delete Merged Bills. | Check the original bills in the report. |
If the run ends with no report and no message, check the last number of the resulting form before you try again, to see whether bills were created.
Related
This page applies to alameen ERP 10, version 10.1.79.764.