Skip to main content

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​

FieldDescriptionRequiredValues and rules
File name boxThe path of the text file that contains the bills.YesExample: 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 textStarts 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.

FieldDescriptionRequiredValues and rules
FormThe bill form of the bills that the program imports.YesA 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 lineThe number of the first line of bills in the file, so you can skip a header line.YesA number greater than zero. The default is 2 every time. The program does not save it.
Fields gridThe 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 barIt 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.

FieldWhat the program reads from itRequiredValues and rules
Bill NoThe bill number.YesA 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 DateThe bill date.YesThe 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 NameThe 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 NameThe customer.If the bill form forces a customerThe 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 NameThe warehouse.Yes (one of them)Code, name or Latin name. You cannot choose both.
Branch Code and Branch NameThe 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 NameThe 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 CodeThe currency of the bill.NoCode, 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 RateThe exchange rate.NoA 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 TypeCash or credit.No0 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 DateThe due date of a credit bill.NoIt 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 NotesThe notes of the bill.NoText. Taken from the first line of the bill.
Line-Item NotesThe notes of the item.NoText.
Material Code and Material NameThe material.Yes (one of them)Code, name or Latin name. You cannot choose both.
QtyThe quantity of the item.YesA number. An item with zero or less makes the bill ignored.
Quantity 2 and Quantity 3The quantity of the item in the second and third units.NoA number.
Unit 2 and Unit 3They appear in the lists.NoThe program does not read them, so choosing them changes nothing.
PriceThe unit price.NoA 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.
UnitThe unit of the item.NoThe 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 QuantityThe free quantity.NoA number. A negative quantity makes the bill ignored.
Percentage Discount and Discount ValueThe discount on the item.NoA 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 ValueThe addition on the item.NoA number. You cannot choose both. The same rule.
Expiry DateThe expiry date of the item.NoKept only if the material has an expiry date.
CategoryThe category of the item.NoText. 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:

  1. Start line is greater than zero.
  2. No field appears for two columns.
  3. 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.
  4. 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.
  5. 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 0 or 1. 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:

  1. The program reads at most the first 10000 non-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.
  2. 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.
  3. 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.
  4. On success the message "Import is completed successfully" appears with "Imported invoices count : n" and "Ignored invoices count : n" under it.
  5. 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".

ItemDescriptionRequiredValues and rules
Show invoices that have been importedAdds the imported bills to the report.NoTicked when the window opens.
Show invoices that have been ignoredAdds the ignored bills to the report.NoTicked 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:

ColumnDescription
Bill numberThe number in the file.
Bill DateIts date.
BranchThe branch name as in the file, empty if you did not import branches.
CustomerThe customer name as in the file, empty if you did not choose the customer column.
CurrencyThe currency name as in the file, or the name of the default currency if you did not choose a column.
Items CountThe number of lines that were joined into the bill.
OperationAdd for an imported bill and Ignore for an ignored one.
NotesThe 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.

FieldDescriptionRequiredValues and rules
SourceThe list of the sources available.YesIt 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.
ButtonWhat 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.
OkSaves 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.
CancelCloses the window without reading.

The title according to what opened the window:

TitleOpened 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​

MessageWhy it appearsWhat 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 itBill 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 itThe 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.

This page applies to alameen ERP 10, version 10.1.79.764.