Skip to main content

Import bills from a file

Use these steps to enter many bills at once from a text file, such as bills that come from another system. The example imports two sales bills from a file with three lines and a header line. Each window of the wizard is explained on its own page: Import Bills.

Before you begin​

  • Make sure you have the permission Import Bills (under Operations in Users Management) and that the command shows in File > Import & Export.
  • Take a backup of the file. The import really saves the bills, and it posts them and generates their entries if the bill form is set to post automatically and to generate the entry automatically.
  • Prepare a text file whose columns are separated by a Tab character. The program reads the usual encodings (UTF-8, UTF-16 and UTF-32), so Arabic names are fine. It reads the first 10000 lines. Empty lines are skipped.
  • Write one line per item. The lines of one bill come one after the other, and the bill values (number, date, account, warehouse...) repeat on each. The program treats consecutive lines with the same number, date and branch as one bill, and takes the bill header from its first line. If the lines of a bill are separated in the file, they count as two bills and the second is ignored because its number is repeated.
  • The required columns are Bill No, Bill Date, Account Code or Account Name, Warehouse Code or Warehouse Name, Material Code or Material Name, and Qty. Add Customer Name if the bill form forces a customer, Cost Center Code or Cost Center Name if it forces a cost center, and Branch Code or Branch Name if the file uses branches. The file selection window lists Price among the required fields, but the program does not reject a file without a price: it imports the lines with a price of zero.
  • The program matches codes and names exactly: account, warehouse, branch, cost center, currency and material by code, name or Latin name, and the customer by name or Latin name. A unit matches the name of one of the three units of the material.
  • Write the date as day, month, year, for example 05-01-2026. The program also accepts year first, as in 2026-01-05, and turns a slash into a dash. The date must fall inside the file period.
  • If you choose a Payment Type column, write 0 for a cash bill and 1 for a credit bill on every line. Without it all bills count as cash. A credit bill needs a customer.

An example file with a header line and three lines (columns separated by a tab, the account 1212 is Alnakheel Est.):

No Date Account Warehouse Material Qty Price
101 05-01-2026 1212 Main Warehouse M01 10 12.00
101 05-01-2026 1212 Main Warehouse M02 4 7.50
102 06-01-2026 1212 Main Warehouse M01 5 12.00

Steps​

  1. Open File > Import & Export and click Import Bills. The introduction appears with a short explanation. Click Next.

  2. Type the file path in the box, or click the browse button and pick it (the file filter shows text files first). The window lists the required fields and explains that payment type 0 is cash and 1 is credit. Click Next. If the program cannot find the file it shows "The file doesn't exist".

  3. In the last step choose the Form, that is the bill form of the bills you are importing. The program lists the normal bill forms you may browse, and when the step opens it selects the second form in the list, not the first, so check it.

  4. Type in Start line the number of the first line of bills: 2 in the example, to skip the header line.

  5. The grid has a Fields row at the top, and under it the lines of the file (one grid column for each file column, and rows named "Row 1", "Row 2"...). In each column choose from its list what the column holds: Bill No, Bill Date, Account Code, Warehouse Code, Material Code, Qty and Price in the example. Leave None for the columns you do not import. The program remembers your choice from the last successful import.

  6. Click Start. The program checks your choices and the values of the lines. If something is missing or repeated a message names it (see If something goes wrong). Correct it and click Start again.

  7. Answer the question "Do you want to start importing bills".

    A progress bar runs, then the message "Import is completed successfully" appears with the number of bills imported and the number ignored under it. Close it.

  8. The Imported Invoices window appears. Leave both options ticked (Show invoices that have been imported and Show invoices that have been ignored) and click Preview to see the report of the operation, or click Close.

Result​

In the example bills 101 and 102 are imported with the numbers and dates in the file, for the account Alnakheel Est. and in the warehouse named, with the prices of the file. Bill 101 has two items with a total of 150.00 (10 × 12.00 and 4 × 7.50), and bill 102 has one item with 60.00. The report shows two lines with the operation Add. Its columns are Bill number, Bill Date, Branch, Customer, Currency, Items Count, Operation and Notes.

The program saves each bill as if you had entered it yourself in the bill window. According to the settings of the form it posts it to the warehouses and generates its entry. An imported bill has the lowest security level.

The import runs as one operation. If saving one bill fails, the message "An error occurred while generating bills, cannot continue" appears and the program undoes the whole import. Bills that the program's checks reject (a repeated number, for example) do not stop the import: only they are ignored, and the reason is written in the Notes column of the report.

After a successful import the program saves the file name and your column choices for the current Windows user on this computer and shows them next time. It does not save the form or the start line.

Why a bill is ignored​

The reason shows in the Notes column of the report, with the operation Ignore. The program checks a bill in this order and stops at the first reason.

NoteMeaning
Bill number already exists, or: The bill number is duplicated in same branchA bill with the same number already exists in this form (and in the same branch if branches are used), or it appeared earlier in the file.
The date is not within the file date rangeThe date is before the start or after the end of the file period.
Unknown Customer NameYou chose a Customer Name column, the program did not find it, and the bill is credit. In a cash bill the customer is left empty without rejection.
The customer is required, but no customer is selected in the invoice or the selected customer is unknownThe bill form forces a customer.
No customer found for the credit invoicePayment type 1 without a customer.
Unknown cost center name or code, or: Cost center is required...A cost center column is chosen and its value is unknown, or the form forces one and none was given.
Unknown account name or codeThe account does not exist.
Unknown warehouse name or codeThe warehouse does not exist.
Unknown branch name or codeThe branch does not exist, and the file uses branches.
Unknown currency codeA currency column is chosen and its value is unknown.
The due date must be later than or equal to the invoice date.Maturity Date is before the bill date.
Unknown material name or code ( name )The material does not exist.
There is an item or more with negative or zero quantityA quantity of zero or less in an item.
There is an item or more with negative quantity for giftsGifts Quantity is negative.
There is an item or more with a negative priceA negative price.
There is an item or more with unknown unit ( name )The unit name does not match the units of the material.

If something goes wrong​

MessageWhy it appearsWhat to do
The file doesn't existThe path is wrong or the file was deleted, at Next in the file step.Correct the path or pick the file with the browse button.
Start line must be more than zeroStart line is zero or empty.Type 1 or more.
Cannot insert … more than once in the tableYou chose the same field for two columns.Choose None for one of them.
Cannot insert … in same import processYou chose two fields for one meaning, such as Account Code and Account Name together.Use one of them.
You must specify the field: …No column is chosen for a required field (its name is shown, and two alternatives can be shown with "Or" between them).Choose the column.
Invalid value, with the field name, "Row" and a number under itA value is not valid: Bill No is zero or not a number, Bill Date cannot be read as a date, or Payment Type is not 0 or 1.Correct the value in the file at the line shown (its number counts from Start line) and run the wizard again.
An error occurred while generating bills, cannot continueSaving one of the bills failed.Nothing from this import was kept. Check the data of the bill that caused it and try again.
Please select one option at leastIn the Imported Invoices window you cleared both options and clicked Preview.Tick at least one option.

This page applies to alameen ERP 10, version 10.1.79.764.