Documentation/Data formats

For administrators

Document schemas

Fields in orders, payments, store-checks and debts, and how headers relate to lines.

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

DocumentHeaderTable sectionDirection
Orderdoc_ordersdoc_orders_productsDevice → accounting system; named order in the standard profile.
Paymentdoc_invoicesNone.Device → accounting system; named invoice in the standard profile.
Store-checkdoc_storechecksdoc_storechecks_productsDevice → accounting system; named storecheck in the standard profile.
Debtdoc_debtsdoc_debts_productsAccounting 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

FieldTypePurpose
numberTEXTDocument number.
date_timeINT64Document date and time: milliseconds since 1970-01-01T00:00:00Z.
save_date_timeINT64Save date and time in the same format.
customer_codeTEXTCustomer code from ref_customers.code.
customer_nameTEXTCustomer name saved in the document.
infoTEXTComment.

Orders, payments and store-checks also have:

FieldTypePurpose
send_statusINTEGERSend status. In the standard profile, 0 — not sent, 1 — sent.
latitude, longitudeREALCoordinates 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:

FieldTypePurpose
trade_pointTEXTTrade point code from vl_trade_points.value.
cat_priceTEXTPrice category code.
pay_typeTEXTPayment type code.
deliveryINT64Delivery date in milliseconds since the Unix epoch.
delivery_typeTEXTDelivery type code.
sum_no_discountREALAmount before discount.
discountREALDocument discount amount.
sumREALTotal after discount.
weightREALTotal product weight, if product weights are provided.

Lines — doc_orders_products

FieldTypePurpose
doc_idINTEGERLink to the order header on the device.
numINTEGERLine number.
codeTEXTProduct code from ref_products.code.
nameTEXTProduct name in the document.
countREALEntered quantity.
koefREALBase units per entered unit. Use 1 when selecting individual units.
priceREALPrice per base unit before discount.
price_discountREALPrice per base unit after discount.
sum_no_discountREALLine amount before discount: count × koef × price, rounded to monetary precision.
discountREALLine discount amount.
sumREALLine amount after discount.
weightREALTotal 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:

FieldTypePurpose
doc_idINTEGERLink to the store-check header on the device.
numINTEGERLine number.
codeTEXTProduct code.
nameTEXTProduct name.
priceREALRecorded price.
countREALRecorded 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:

FieldTypePurpose
sumREALDocument amount.
trade_pointTEXTTrade point code.
cat_priceTEXTPrice category code.
pay_typeTEXTPayment type code.
deliveryINT64Delivery date in milliseconds since the Unix epoch.
delivery_typeTEXTDelivery 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.