Import Bills
The Import Bills wizard imports many bills at once from a text file whose columns are separated by a tab. It then shows the Imported Invoices window and a report of what was imported and what was ignored. This page explains each page of the wizard, each field and each message, then the window and the report, then the source window that appears when you read the items of a single bill from a file. For a complete worked example and the reasons a bill is ignored, see Import bills from a file.
Opening the wizard
- Open File > Import & Export. In the group titled "Import Different Types of Cards Exported from Text Files, whether Exported from alameensoft or Other Programs", click Import Bills. The button description is "Import invoices from a text file (to import from other programs) and also from Al-ameen". See File tab: Tools and Import & Export.
- The button shows when a file is open and the licence includes the import and export from files feature. Multi-files mode does not hide it.
- In Users Management the Import Bills option under Operations controls it, in the group headed "Al-Ameen Import/Export Utility". Another option with the same name exists under Operations in the online stores group. It does not control this wizard.
The wizard has three steps. You move between them with Next and Back, and the title bar of each one is Import Bills. In the last step Next is disabled and Start appears. When you click Cancel in any step the program asks: "Do you want to exit out importing customer cards". This is the wording of the question in this wizard too.
Step 1: Introduction
The page header is "Import Bills". It explains that the wizard helps you import bills in an easy, step by step way, that the text file you use must be of the type text (tab delimited), that it may be generated by alameen or by another program, and that Next moves to the next step, Back to the previous one and Cancel ends the process. It has no fields.
Step 2: Enter file name
| Field | Description | Required | Values and rules |
|---|---|---|---|
| File name box | The path of the text file that contains the bills. | Yes | Example: D:\data\bills.txt. The program shows the last file whose import succeeded, and the box is empty before the first successful import. |
| Browse button (small square next to the path) | Opens a file window with the filter Text files (*.txt) or all files. | — | Puts the chosen path in the box. |
| Required fields text | Starts with "Knowing that the required fields to import bills are", then lists: Bill No, Bill Date, Account Code or Name, Warehouse Code or Name, Branch name or code (if Branches system is enabled in the file to which you import ), Material Code or Name, Qty, Price. | — | Read-only text. It always names Price and the branch, but the real check is in the last step (see Checks). |
| Note | "Note: in case you specify Payment Method field, cash invoices must coded by 0 and credit invoices by 1. On the contrary if Payment Method field is not specified, all invoices will be considered as cash ones". | — | Read-only text. |
When you click Next the program checks that the file exists. If it does not, the message "The file doesn't exist" appears.
Step 3: File fields
The page header is "File Fields". It explains that you must choose the fields of the file content and the line to start the import from.
| Field | Description | Required | Values and rules |
|---|---|---|---|
| Form | The bill form of the bills that the program imports. | Yes | A list of the ordinary bill forms that you may browse, posted and unposted, sorted by bill type. When the step opens the program selects the second item of the list. If you choose a form and then go back and return, your choice stays. The program does not save the form for next time. |
| Start line | The number of the first line of bills in the file, so you can skip a header line. | Yes | A number greater than zero. The default is 2 every time. The program does not save it. |
| Fields grid | The first row holds a list for each column, where you choose what the column holds. Under it are the lines of the file split by the tab. The first row header is Fields, the column headers are Column and a number, and the line headers are Row and a number. | — | Up to 34 columns and 10000 lines. The grid shows the file from its first line whatever the Start line. The lists start from the choices saved after the last successful import. |
| Progress bar | It is at the bottom of the window. | — | It moves during the import (see Starting the import). |
Buttons: Start, Back and Cancel.
The fields you choose from
Each list shows None and then the fields below. You cannot choose the same field for two columns.
| Field | What the program reads from it | Required | Values and rules |
|---|---|---|---|
| Bill No | The bill number. | Yes | A whole number. Zero or a non-number stops the import with a message (see Checks). Consecutive lines with the same number, date and branch are one bill. |
| Bill Date | The bill date. | Yes | The program changes / into - and accepts 05-01-2026 and 2026-01-05. A value that cannot be read as a date stops the import. The date must fall within the file period or the bill is ignored. |
| Account Code and Account Name | The customer or supplier account the bill is recorded on. | Yes (one of them) | The program matches the value exactly to the account code, name or Latin name, whichever field you choose. You cannot choose both. |
| Customer Name | The customer. | If the bill form forces a customer | The program matches the name or the Latin name. A credit bill needs it. If you choose the column and its cell is empty on a line, the credit bill is ignored. On a cash bill whose form does not force a customer, a name that matches no customer is dropped and the bill is imported with no customer. |
| Warehouse Code and Warehouse Name | The warehouse. | Yes (one of them) | Code, name or Latin name. You cannot choose both. |
| Branch Code and Branch Name | The branch. | If the licence includes branches and the branches system is enabled in the file (one of them) | They show in the lists only in this case. Code, name or Latin name. |
| Cost Center Code and Cost Center Name | The cost center of the bill. | If the form forces a cost center (one of them) | Code, name or Latin name. If you choose the column and its cell is empty on a line, the bill is ignored, even when the form does not force a cost center. |
| Currency Code | The currency of the bill. | No | Code, name or Latin name of the currency. If you leave it out the default currency is used. If you choose the column and its cell is empty on a line, the bill is ignored. |
| Currency Rate | The exchange rate. | No | A number. It is used with the Currency Code column. If the rate the program knows for the bill date is not 1, and the number in the file is zero or less, exactly 1, or missing, the program uses its own rate. Otherwise it uses the number in the file. |
| Payment Type | Cash or credit. | No | 0 is cash and 1 is credit. Anything else stops the import. All bills are cash if you do not choose the column. A credit bill needs a customer. |
| Maturity Date | The due date of a credit bill. | No | It must not be before the bill date. If it is missing the program calculates it from the payment terms days of the customer, then of the form. It is used only when the form uses payment terms and the bill is credit. |
| Bill Notes | The notes of the bill. | No | Text. Taken from the first line of the bill. |
| Line-Item Notes | The notes of the item. | No | Text. |
| Material Code and Material Name | The material. | Yes (one of them) | Code, name or Latin name. You cannot choose both. |
| Qty | The quantity of the item. | Yes | A number. An item with zero or less makes the bill ignored. |
| Quantity 2 and Quantity 3 | The quantity of the item in the second and third units. | No | A number. |
| Unit 2 and Unit 3 | They appear in the lists. | No | The program does not read them, so choosing them changes nothing. |
| Price | The unit price. | No | A number in the currency of the bill, which the program multiplies by the currency rate. If you do not choose it the item price is zero. A negative price makes the bill ignored. |
| Unit | The unit of the item. | No | The name of one of the three units of the material. If you leave it out the default unit of the material is used. If you choose the column and its cell is empty on a line, the bill is ignored. A name that matches no unit of the material makes the bill ignored. |
| Gifts Quantity | The free quantity. | No | A number. A negative quantity makes the bill ignored. |
| Percentage Discount and Discount Value | The discount on the item. | No | A number. You cannot choose both. If the discount value is not zero it is the one used, and the percentage is calculated from it. |
| Addition % and Addition Value | The addition on the item. | No | A number. You cannot choose both. The same rule. |
| Expiry Date | The expiry date of the item. | No | Kept only if the material has an expiry date. |
| Category | The category of the item. | No | Text. Kept only if the material has categories. |
The program saves every imported bill with the lowest security level.
Checks when you click Start
The program checks in this order and stops at the first violation:
- Start line is greater than zero.
- No field appears for two columns.
- You did not choose two fields of the same pair: an account code with its name, and likewise warehouse, branch, cost center and material; a discount percentage with its value; an addition percentage with its value.
- The required fields exist, in this order: bill number, bill date, account, warehouse, material, quantity, then the customer if the form forces it, then the cost center if it forces it, then the branch if it shows in the lists.
- The program reads the lines of the file from Start line and checks in each line that Bill No is not zero, that Bill Date reads as a date, and that Payment Type is
0or1. At the first line that fails, the message appears with the field name under it, then "Row" and the line number in the file.
Starting the import
After the checks the program asks: "Do you want to start importing bills" (Yes/No, with No as the default). On Yes:
- The program reads at most the first
10000non-empty lines of the file and skips empty lines. Lines after that are not imported and no message says so, so split a larger file. Then it groups the lines into bills and looks up the accounts, warehouses, branches, materials and the rest by their values. - It reads the bill numbers that already exist in the form, then checks each bill. A bill that fails is ignored and its reason is recorded. The others are saved as if you had entered them in the bill window, and are posted and given their entry if the form is set to do that.
- The import runs as one transaction. If saving a bill fails the message "An error occurred while generating bills, cannot continue" appears and the program undoes the whole import.
- On success the message "Import is completed successfully" appears with "Imported invoices count : n" and "Ignored invoices count : n" under it.
- The Imported Invoices window then appears. After you close it the program saves the file and the chosen columns for the current Windows user on this computer.
The Imported Invoices window
The window asks: "Do you want to view data that has been imported or ignored".
| Item | Description | Required | Values and rules |
|---|---|---|---|
| Show invoices that have been imported | Adds the imported bills to the report. | No | Ticked when the window opens. |
| Show invoices that have been ignored | Adds the ignored bills to the report. | No | Ticked when the window opens. |
Buttons: Preview (Alt+P) opens the report in the report viewer, and Close closes the window. If you clear both options and click Preview, the message "Please select one option at least" appears.
The imported bills report
The Import Bills report opens in the report viewer. Its data comes from the import that has just finished. Its header shows Start Time and End Time (the time without the date), and its grid has eight columns:
| Column | Description |
|---|---|
| Bill number | The number in the file. |
| Bill Date | Its date. |
| Branch | The branch name as in the file, empty if you did not import branches. |
| Customer | The customer name as in the file, empty if you did not choose the customer column. |
| Currency | The currency name as in the file, or the name of the default currency if you did not choose a column. |
| Items Count | The number of lines that were joined into the bill. |
| Operation | Add for an imported bill and Ignore for an ignored one. |
| Notes | The reason for ignoring an ignored bill (see Why a bill is ignored), empty for an imported one. |
The right-click menu of a row has the command View Bill... to open the saved bill. The report has the usual features of the viewer, which are explained in the report viewer.
The source window when reading bill items
This is a different window from the wizard. The program uses it when it reads the items of a single bill from a file or a device through a source (a driver) that you choose. Its title changes according to what opened it.
| Field | Description | Required | Values and rules |
|---|---|---|---|
| Source | The list of the sources available. | Yes | It shows the descriptions of the drivers of the required type in the drivers folder, sorted alphabetically. The program selects the last source you used. A small window appears while the list is built. If there is no source the list stays empty. |
| Button | What it does |
|---|---|
Setup (Alt+S) | Saves your choice, then opens the setup window of that source. The windows are explained in Read Materials from File. |
| Ok | Saves your choice, loads the source and runs its reading. The window closes only if the reading ends successfully. If you did not choose a source nothing happens. |
| Cancel | Closes the window without reading. |
The title according to what opened the window:
| Title | Opened by |
|---|---|
| "Reading bill items" | The Import Bill command (Ctrl+R) in the menu of the bill items grid, the same command in the assembly and disassembly forms, and the stocktaking windows. |
| "Saving invoice items" | The Export Bill command (Ctrl+S). |
| "Import Serial Numbers" | Reading the serial numbers of an item in the bill. |
| "Import Entry" | The Import Entry command (Ctrl+R) in the entry window. |
| "Export Entry" | The Export Entry command (Ctrl+S) in the entry window. |
In the bill items grid, Import Bill needs the Import Bill Using Commands of Bill Grid Menu permission and Export Bill needs Export Bill Using Commands of Bill Grid Menu (under Operations in Users Management). The Ctrl+O shortcut reads with the last source without showing this window. See Bill.
Messages
| Message | Why it appears | What to do |
|---|---|---|
| "The file doesn't exist" | No file exists at the path, at Next in step 2. | Correct the path. |
| "Start line must be more than zero" | Start line is zero or empty. | Type 1 or more. |
| "Cannot insert … more than once in the table" | You chose the field named for two columns. | Choose None for one of them. |
| "Cannot insert … in same import process" | You chose two fields for one meaning, and their names are listed with "And" between them. | Use one of them. |
| "You must specify the field: …" | A required field is missing, and two names with "Or" between them can be shown. | Choose the column. |
| "Invalid value" with the field name, "Row" and a number under it | Bill No is zero or not a number, the date cannot be read, or Payment Type is neither 0 nor 1. | Correct the file at the line shown. |
| "Do you want to start importing bills" | You passed the checks. | Choose Yes to start. |
| "An error occurred while generating bills, cannot continue" | Saving a bill failed. | Nothing was saved. Check its data and try again. |
| "Import is completed successfully" with the two counts under it | The import finished. | Check the counts and open the report. |
| "Please select one option at least" | You cleared both options and clicked Preview. | Tick an option. |
| "Do you want to exit out importing customer cards" | You clicked Cancel. | Choose Yes to leave. |
| "Cannot import the bill ! you have no authority to change quantity in the current bill type!" | You imported bill items with Import Bill and you do not have the permission to change quantity in the form. | Ask for the permission. |
| "Can't import the invoice because the materials do not belong to the group specified in the form" | After reading, no line remains from the materials of the form group. | Use a file with materials of that group. |
| "No quantity found for the materials, cannot export" | Export Bill on a bill with no items. | Enter items. |
Related
This page applies to alameen ERP 10, version 10.1.79.764.