On this page
The mobile application creates orders, payments and store-checks. It sends the selected fields through an exchange profile, and the accounting system receives XML documents from inbox. Debts move in the other direction: from the accounting system to the device.
Document tables
| Document | Header | Table section | Direction |
|---|---|---|---|
| Order | doc_orders | doc_orders_products | Device → accounting system; named order in the standard profile. |
| Payment | doc_invoices | None. | Device → accounting system; named invoice in the standard profile. |
| Store-check | doc_storechecks | doc_storechecks_products | Device → accounting system; named storecheck in the standard profile. |
| Debt | doc_debts | doc_debts_products | Accounting system → device. |
This page describes fields in the application's tables. The fields included in output XML are configured separately in exchange.xml. They may be a subset of the full schema.
Common header fields
| Field | Type | Purpose |
|---|---|---|
number | TEXT | Document number. |
date_time | INT64 | Document date and time: milliseconds since 1970-01-01T00:00:00Z. |
save_date_time | INT64 | Save date and time in the same format. |
customer_code | TEXT | Customer code from ref_customers.code. |
customer_name | TEXT | Customer name saved in the document. |
info | TEXT | Comment. |
Orders, payments and store-checks also have:
| Field | Type | Purpose |
|---|---|---|
send_status | INTEGER | Send status. In the standard profile, 0 — not sent, 1 — sent. |
latitude, longitude | REAL | Coordinates recorded by the application, if available. |
Empty coordinates are not a format error. Their availability depends on location permissions and settings.
Orders
Header — doc_orders
The following are added to the common fields:
| Field | Type | Purpose |
|---|---|---|
trade_point | TEXT | Trade point code from vl_trade_points.value. |
cat_price | TEXT | Price category code. |
pay_type | TEXT | Payment type code. |
delivery | INT64 | Delivery date in milliseconds since the Unix epoch. |
delivery_type | TEXT | Delivery type code. |
sum_no_discount | REAL | Amount before discount. |
discount | REAL | Document discount amount. |
sum | REAL | Total after discount. |
weight | REAL | Total product weight, if product weights are provided. |
Lines — doc_orders_products
| Field | Type | Purpose |
|---|---|---|
doc_id | INTEGER | Link to the order header on the device. |
num | INTEGER | Line number. |
code | TEXT | Product code from ref_products.code. |
name | TEXT | Product name in the document. |
count | REAL | Entered quantity. |
koef | REAL | Base units per entered unit. Use 1 when selecting individual units. |
price | REAL | Price per base unit before discount. |
price_discount | REAL | Price per base unit after discount. |
sum_no_discount | REAL | Line amount before discount: count × koef × price, rounded to monetary precision. |
discount | REAL | Line discount amount. |
sum | REAL | Line amount after discount. |
weight | REAL | Total product weight in the line. |
For a price of 42.5, quantity of 2, factor of 1 and discount of 5, the amount before discount is 85, and the amount after discount is 80. Here, discount is a monetary amount, not a percentage.
Payment — doc_invoices
In addition to the common fields, a payment contains sum of type REAL — the payment amount, and base_doc of type TEXT — the number of the selected base document.
The name invoice in an exchange profile represents a payment. Do not replace it with payment in the standard profile: the accounting system must recognize the actual <docs name="invoice"> value.
A payment has no table section.
Store-check
doc_storechecks contains the common header fields and trade_point of type TEXT — the trade point code.
Lines are stored in doc_storechecks_products:
| Field | Type | Purpose |
|---|---|---|
doc_id | INTEGER | Link to the store-check header on the device. |
num | INTEGER | Line number. |
code | TEXT | Product code. |
name | TEXT | Product name. |
price | REAL | Recorded price. |
count | REAL | Recorded quantity. |
Debts
The accounting system prepares doc_debts.xml and doc_debts_products.xml. Both tables are included in the Завантажити дані (Download data) profile in the standard exchange.xml.
Header — doc_debts
The schema must contain the common fields number, date_time, save_date_time, customer_code, customer_name and info, plus:
| Field | Type | Purpose |
|---|---|---|
sum | REAL | Document amount. |
trade_point | TEXT | Trade point code. |
cat_price | TEXT | Price category code. |
pay_type | TEXT | Payment type code. |
delivery | INT64 | Delivery date in milliseconds since the Unix epoch. |
delivery_type | TEXT | Delivery type code. |
If needed, add debt of type REAL — the document's outstanding balance. When this field is not used, the document amount remains in sum.
Lines — doc_debts_products
The schema contains doc_id and num of type INTEGER, code and name of type TEXT, and price, count, koef, discount and sum of type REAL.
doc_id must match the header's identifier in doc_debts on the device. For XML exports, header identifiers follow record order: the first <record> is 1, the second is 2, and so on. Lines of the first debt therefore have doc_id=1.
Prepare both files as one consistent set and transfer them together. If you change header order, recalculate doc_id in the lines. An accounting-system code in the first id or _id field does not replace this numbering.
Example of a consistent set: doc_debts.xml and doc_debts_products.xml. It contains two debts for customer C-001, each with one line for product P-001. The line with doc_id=1 belongs to document РН-001; the line with doc_id=2 belongs to РН-002. The customer and product match the examples in References and routes.
What to send to the accounting system
The integrator selects header fields in <docHead> and line fields in <docTable>. For example, to send the line discount and total to the accounting system, add these fields to the existing order <docTable>:
<docTable tableName="doc_orders_products">
<!-- Other table section fields -->
<field name="discount"/>
<field name="sum"/>
</docTable>
In output XML, nesting links lines to their header: <row> elements are inside their own <doc>. You do not need to send doc_id solely to reconstruct this relationship.
See Documents from devices for import rules and duplicate prevention.
