Skip to main content

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.

warning

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).

FieldDescriptionRequiredValues and rules
CustomerLimits the bills to one customer.NoA lookup box with the rules of lookup boxes. Empty at first. It is disabled if you choose Account.
AccountLimits the bills to the customers whose account is this account or one of its sub-accounts.NoA lookup box. Empty at first. It is disabled if you choose Customer.
Cost CenterLimits the bills to this cost center and its sub-centers.NoEmpty at first. The field shows only if your licence includes cost centers. Choosing a center enables the two cost center options in Report Options.
GroupLimits the merge to the materials of this group and its sub-groups.NoEmpty at first. See Limited materials.
Bills to be MergedThe form of the original bills.YesA list of the forms you may browse. The first form is selected.
Resulting BillsThe form of the new bill.YesA list of the forms you may add bills to. The first form is selected.
Customers TermsA saved condition on customer cards that limits the customers.NoWithout at first. The box is explained in Materials terms and works the same way with customer conditions.
Materials TermsA saved condition on material cards that limits the merged materials.NoWithout at first. See Limited materials.
Invoice TermsA saved condition on bills that limits the bills.NoWithout at first.
Date from - toLimits the bills by date, both dates included.Yes, if you choose this buttonSelected 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 - toLimits the bills by number, both numbers included.Yes, if you choose this buttonThe 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.NoEmpty 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.YesTotal 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.

OptionWhat it doesDefault
Credit BillsMerges credit bills.Ticked
Cash BillsMerges cash bills. Credit and cash bills are never merged into one bill.Not ticked
Delete Merged BillsDeletes 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 BillTakes 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 ItemsTakes 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 CustomersIncludes 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​

ButtonWhat it does
OkChecks 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.
CancelCloses the window without a change.

What happens after Ok​

  1. 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.)
  2. 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.
  3. The program reads the bills without changing anything and shows the Bills to be Merged window.
  4. 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.
  5. 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.
  6. If a chosen bill was merged before and its new bill still exists, the Collected Bills window appears.
  7. 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.

ColumnMeaning
Check box (no heading)Ticks the bill to merge. All bills are ticked when the window opens.
NumberThe bill number.
DateThe bill date.
Customer NameThe name of the bill customer (the Latin name when the interface is not Arabic).
Net invoice valueThe bill value after discounts, additions and taxes.
Value AddedThe tax value of the bill.
Maturity DateThe 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.

note

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.

ButtonWhat it does
OkAccepts the ticked bills. If you ticked none, nothing happens.
CancelCloses 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.

ColumnMeaning
Customer NameThe customer name, on the first row of the customer only.
BillThe number of the original bill, written with the form name of the earlier merged bill, a colon and the number.
Merged BillsThe earlier merged bill, written with its form name, a colon and the number.
ButtonWhat it does
YesMerges these bills again with the others, if you have the permission Re-Collect Collected Bills. The earlier merged bills stay as they are.
NoLeaves 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​

ItemWhat it gets
FormResulting Bills.
NumberContinues 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.
DateWith 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 paymentAs in the original bills.
NotesThe 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 levelThe user who ran the tool, and security level 1.
Not carried overPayment 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​

CaseOriginal billsNew bill
Delete Merged Bills not tickedThey stay as they are, with their posting, entries and links.Created in addition to them.
Delete Merged Bills tickedThe 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.

BillDateLines
505-12-2026Rice 10 at 2.00, sugar 5 at 3.00
607-12-2026Rice 4 at 2.00
920-12-2026Rice 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".

MaterialQuantityPriceValue
Rice14 (10 + 4)2.0028.00
Rice62.5015.00
Sugar53.0015.00
Total58.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​

MessageWhy it appearsWhat to do
You don't have the authority to add billsNo 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 thanYou 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 billsYou 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 againA 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 NumbersAfter 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 NumbersThe chosen bills already contain a duplicate serial number before the merge. The program rolled back.Correct the serial numbers in the bills.
No Bills MergedThe 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 themThe 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.

This page applies to alameen ERP 10, version 10.1.79.764.