To ensure the exchange of data between the application Barcode Terminal
Hosting and accounting system uses a pair of xml-files
InventoryListToTCD.xml and InventoryListFromTCD.xml
File InventoryListToTCD.xml need to record data on goods from
accounting system into the data collection terminal. Usually this is the simpliest
list of goods stored in the following fields:
- BarCode - bar code have a numeric or alpha-numeric values
- Description - description of goods
- Quantity - quantity of goods in the accounting system
- Price - unit price
We briefly describe step by step how the goods written into the data collection terminal.
- from the accounting system, we must write to the file
InventoryListToTCD.xml.
- When the data collection terminal accessed through Web-service to the application
BarCode Terminal Hosting for the goods list, Barcode Terminal
Hosting will return the contents of InventoryListToTCD.xml into the data collection terminal.
Once we made the stocktaking and entered actual inventory rests into the data collection terminal, our task - to transmit the data to the accounting system. We describe
the process of uploading data from the terminal in steps.
- data collection terminal accesses Barcode Terminal Hosting and
send information about the actual inventory rests through the Web-service.
- Barcode Terminal Hosting writes inventory rests data into the file
InventoryFromTCD.xml.
- accounting system reads the file InventoryListFromTCD.xml and takes into
actual balances itself. The data can be loaded into
documents of various types. Data can be downloaded into the inventory act (stocktaking), into purchase invoice or sales invoice
File Structure InventoryListFromTCD.xml completely identical to the file
InventoryToTCD.xml, only the data they transmit in opposite
directions. More details about the data exchange can be read article
Once the system has been developed exchange, but to put it
demands absolute universality and the possibility of interfacing with any
accounting system, the question of simplifying the programmers who
will match records system BarCode Terminal Hosting. The simplest and correct solution - to create OLE-components, ActiveX
library that implements the data exchange with the methods of reading and
record. This library is called BarCodeHosting.dll
and comes together with the application BarCode
Terminal Hosting. During installation, the application library
located in the Windows\System32 folder and is automatically registered.
Describe classes, properties and methods that implement this
Library.
-
InventoryItem.A simple class that implements the four properties
describing the goods:
-
Properties:
- BarCode (type String) - bar code in numeric or in
alpha numeric form
- Description (type String) - name of the product
- Quantity (type Double) - quantity of goods in the accounting system
- Price (type Double) - unit price
-
Writer- a class that implements a data record in the file
InventoryToTCD.xml from your system.
-
Methods:
- Public Sub OpenWriter (ByVal Path As String) - opens
object in writing to the file InventoryListToTCD.xml, which
Located on the way to the variable Path
- Public Sub AddItem (BarCode As String, Description As
String, Quantity As Double, Price As Double) - adds to the
the list of goods new product with the parameters specified in
variables BarCode, Description, Quantity and Price
- Public Sub WriteData () - writes a list of commodities in
file InventoryListToTCD.xml. For re-entry is required
reopen the facility to record and add a method OpenWriter
Product list.
-
Properties:
- Subclass Recordset lets you directly access the data
for more advanced programming.
Example of using class Writer (from the sample application).
-
'Use BarCodeHosting.dll for write
data to InventoryListToTCD.xml file
-
Dim Writer As New
BarCodeHosting.Writer 'create New Writer
object
-
Writer.OpenWriter Me.txtExchangePath.Text 'standby for write data to file
-
Dim i As Long
-
For i = 1 To Me.lstDataToTerminal.ListItems.Count 'Read List Items from ListView control and add it to
the Writer object
-
Writer.AddItem Me.lstDataToTerminal.ListItems(i).Text,
Me.lstDataToTerminal.ListItems(i).SubItems(1),
Me.lstDataToTerminal.ListItems(i).SubItems(2),
Me.lstDataToTerminal.ListItems(i).SubItems(3)
-
Next i
-
Writer.WriteData
-
Set Writer = Nothing
-
MsgBox
"Data was written to file " &
Me.txtExchangePath.Text &
"\InventoryListToTCD.xml"
-
Reader- a class that implements the data read from the file
InventoryFromTCD.xml the accounting system.
-
Methods:
- Public Sub OpenReader (ByVal Path As String) - reads
data from the file InventoryListFromTCD.xml a collection of objects
InventoryItem. File InventoryListFromTCD.xml should be
in the folder passed in the variable Path
- Public Sub MoveNext() - allows you to move to the next
InventoryItem element in the collection
- Public Sub MoveFirst() - returns you to the first
InventoryItem element in the collection
-
Properties:
- Public Property RecordCount() As Long - a property that
returns the number of loaded commercial records from file
InventoryFromTCD.xml
- Public Property Get Item() As InventoryItem - a reference to the
the current item in the collection of trade accounts
- Public Property Get EOF() As Boolean - returns true
if the latter commodity reached a record in the collection
- Subclass Recordset lets you directly access the data
for more advanced programming.
Example of use. In this example, we read data from file
InventoryFromTCD.xml and add them to the cycle in the object
lstDataFromTerminal (Class ListView), to view the form.
-
'Use BarCodeHosting.dll for read
data from InventoryFromTCD.xml file
-
Dim Reader As New
BarCodeHosting.Reader 'create New Reader
object
-
Reader.OpenReader Me.txtExchangePath.Text 'read
data to Reader object from file InventoryFromTCD.xml by path
was sets in txtExchangePath field
-
Me.lstDataFromTerminal.ListItems.Clear
'clear ListView
-
While Not Reader.EOF 'from reader
fill the listview in cycle
-
Me.lstDataFromTerminal.ListItems.Add ,
"k" & Me.lstDataFromTerminal.ListItems.Count,
Reader.Item.BarCode
-
Me.lstDataFromTerminal.ListItems.Item(Me.lstDataFromTerminal.ListItems.Count).SubItems(1)
= Reader.Item.Description
-
Me.lstDataFromTerminal.ListItems.Item(Me.lstDataFromTerminal.ListItems.Count).SubItems(2)
= Reader.Item.Quantity
-
Me.lstDataFromTerminal.ListItems.Item(Me.lstDataFromTerminal.ListItems.Count).SubItems(3)
= Reader.Item.Price
-
Reader.MoveNext
-
Wend
It must be noted that the Reader and Writer classes are wrappers around
ADODB.Recordset class to simplify the programming, because
specific and limited tasks.
Library BarCodeHosting.dll can be downloaded in source code
with Training
example. It is free to explore and modifications to
discretion of the developers of systems interfaces.
The library was deliberately implemented in Visual Basic 6,
as this development environment currently provides the most
simple implementation of the ActiveX DLL, which is very promotes the study and
understanding.