
Data Export
2 Seiten
Stand: 6. November 2026
Inhalt
SQL Views
When you need direct SQL access to the POS — usually because APRO is installed on-premise alongside existing systems — the cash register database exposes a stable set of read-only views. They are intentionally shaped for the two most common consumers:
- On-premise integrations — accounting bridges, kitchen displays, stock management, loyalty engines — anything that runs inside the same network and wants a low-latency feed without going through REST.
- Existing BI workflows — Power BI, Tableau, Qlik, Metabase, Excel, native SQL Server Analysis Services — any tool that already understands SQL Server connections. Point the connector at the views and you get receipts, line items, payments and product master in the shape a data warehouse expects.
Views are read-only, queryable over the standard SQL Server protocol, and never join to operational tables that mutate under load — they are safe to drive dashboards and scheduled ETL jobs against.
Tip: SQL Views or Revenue API?
The SQL views and the Revenue API expose the same
underlying data — pick whichever fits the runtime:
- SQL Views (this page) — flat, relational, on-premise.
Perfect for ETL, Power BI / Tableau / Qlik / Metabase connectors and
any workflow that wants bulk access via SQL.
- Revenue API — served over the cloud endpointmy.apro.at, returns
a hierarchical JSON document with positions, payments and tax
already nested per receipt. Better for real-time system-to-system
integration, SaaS consumers and anything outside the local network.
Note
The read-only SQL user is provisioned per deployment. Ask your APRO
account manager to enable access for your tenant and to share the
server name, database, and credentials.
Overview
View | What it contains |
|---|---|
One row per business transaction. | |
Line items. Join on | |
Payments. Join on | |
Light transaction index. | |
Transaction-type lookup. | |
Denormalized receipt × item + payment summary — start here for Power BI. | |
Product master with category. |
1. vw_Receipts
One row per business transaction. The TransactionType column distinguishes what the row represents; amounts are signed — reversal transactions (TransactionType = 4) return the booking with a negated amount so a plain SUM(TotalAmount) already nets them out.
Column | Type | Description |
|---|---|---|
| GUID | Unique transaction record ID. |
| GUID | Transaction ID (join key for |
| enum | See Transaction types. |
| string | Human-readable transaction type. |
| string | Receipt / invoice number. |
| decimal | Gross total (signed — negative on reversals). |
| decimal | Tip (signed). |
| decimal | Discount applied to the whole receipt (signed). |
| datetime | Booking timestamp. |
| date | Virtual fiscal business day. |
| GUID | null | Predecessor receipt (e.g. retrieved settlement → original). |
| integer | null | Payment group ID (e.g. Umsatzwirksam). |
| string | null | Payment group name — useful as a turnover filter. |
| integer | Operating company ID. |
| string | Operating company name. |
| integer | Table ID. |
| integer | Table number. |
| string | Table label. |
| integer | Area / section ID ( |
| integer | Area number. |
| string | Area name (e.g. Restaurant, Bar, Terrasse). |
| integer | Staff ID. |
| integer | Personnel number. |
| string | Staff name. |
| integer | Customer ID. |
| integer | Customer number. |
| string | Customer name. |
| integer | Device that performed the transaction. |
Transaction types
Only transactions with a TransactionType in (1, 2, 3, 4, 5, 14, 24, 25) are exposed through this view. The authoritative mapping lives in vw_TransactionTypes and is also joined onto every row via TransactionTypeName.
| Meaning |
|---|---|
| Booking — order at the table or self-service. |
| Move — table change. |
| Settlement — paid receipt. |
| Reversal — undoes a booking (amounts negated). |
| Retrieve receipt — undoes a settlement. |
| Outgoing invoice created. |
| Outgoing invoice — ancillary (see |
| Outgoing invoice paid. |
2. vw_Receipt_Items
Line items. Join to vw_Receipts on ReceiptId / TransactionId. Values are signed the same way as the parent receipt.
Column | Type | Description |
|---|---|---|
| GUID | Transaction ID. |
| GUID | Receipt ID (join to |
| GUID | Unique line item ID. |
| GUID | Underlying booking ID (shared by bookings and their reversals). |
| datetime | Booking timestamp. |
| integer | Category (Sparte) ID. |
| integer | Category number. |
| string | Category name. |
| string | Accounting account number for the category. |
| integer | Product ID. |
| integer | Product number. |
| string | Product name. |
| decimal | Quantity (signed on reversals / retrievals). |
| decimal | Unit price at the time of sale (signed on reversals). |
| decimal | Discounted unit price (signed on reversals). |
| decimal |
|
| decimal |
|
| decimal | Discount amount in money (signed on reversals / retrievals). |
| decimal | Discount as % of the original price. |
| string |
|
| integer | Tax rate ID. |
| string | Tax rate name. |
| decimal | Tax rate as decimal. |
| enum | Same codes as |
3. vw_Payments
Payments recorded against receipts. Only settlements and their reversals are exposed (TransactionType in (3, 4, 5, 14, 24, 25)).
Column | Type | Description |
|---|---|---|
| GUID | Transaction ID. |
| GUID | Receipt ID. |
| GUID | Unique payment ID. |
| decimal | Amount paid (signed). |
| integer | Payment method ID. |
| integer | Payment method number. |
| string | Payment method name (e.g. Bar, Kreditkarte, Gutschein). |
| datetime | Payment timestamp. |
| GUID | null | When a settlement is retrieved, the original receipt it cancels. |
| string | null | Free-form payment metadata (e.g. card masked PAN, voucher code). |
4. vw_Transactions
Light index of every transaction. Useful for watermark-based ETL (pulling only new rows since the last checkpoint).
Column | Type | Description |
|---|---|---|
| GUID | Transaction ID. |
| enum | Transaction type. |
| string | Human-readable name. |
| datetime | Timestamp of the transaction. |
| integer | Device that performed it. |
5. vw_TransactionTypes
Lookup for every transaction type the POS emits.
Column | Type | Description |
|---|---|---|
| integer | Transaction-type ID. |
| string | Human-readable name (German). |
6. vw_Bi_Export
The one-stop view for BI tools. Denormalized join of every turnover-relevant receipt with every line item, plus a comma-separated summary of the payment methods used on the receipt. Point Power BI or Tableau at this view and you have everything needed for revenue, margin, mix and payment-method dashboards without writing joins.
Columns are the union of vw_Receipts and vw_Receipt_Items (minus TransactionTypeId, which lives only on the receipt side), plus:
Column | Type | Description |
|---|---|---|
| string | Comma-separated list of |
Power BI example
- Get data → SQL Server database — server + database as provided.
- Import or DirectQuery mode, using the read-only user.
- Pick
dbo.vw_Bi_Exportas the fact table. - Optionally add
dbo.vw_Transactions,dbo.vw_Payments,dbo.vw_products_and_categoriesas companion tables and relate onTransactionId/ProductId.
Import mode is normally sufficient — the views are already aggregated to transaction grain and refresh in seconds for a typical venue.
7. vw_products_and_categories
Product master with category. Useful as a dimension alongside vw_Bi_Export when the BI tool wants product names to stay stable even if historical rows predate a rename.
Column | Type | Description |
|---|---|---|
| integer | Product ID. |
| integer | Product number. |
| string | Product name. |
| integer | Category ID. |
| integer | Category number. |
| string | Category name. |
| decimal | Current list price ( |
Only products where Geloescht = 0 (not soft-deleted) are included.
Example queries
Turnover per business day, split by tax rate — for a monthly KPI chart:
SELECT
r.BusinessDay,
ri.TaxName,
SUM(ri.EffectiveAmount) AS net_turnover
FROM vw_Receipts AS r
JOIN vw_Receipt_Items AS ri ON ri.ReceiptId = r.Id
WHERE r.TransactionType IN (3, 4, 5) -- settlements + reversals net out
AND r.BusinessDay BETWEEN @from AND @to
GROUP BY r.BusinessDay, ri.TaxName
ORDER BY r.BusinessDay, ri.TaxName;Top-10 products for the current month, using the BI view directly:
SELECT TOP 10
ProductName,
SUM(Quantity) AS units_sold,
SUM(EffectiveAmount) AS net_turnover
FROM vw_Bi_Export
WHERE BusinessDay >= DATEFROMPARTS(YEAR(GETDATE()), MONTH(GETDATE()), 1)
AND TransactionType IN (3, 4, 5)
GROUP BY ProductName
ORDER BY net_turnover DESC;Cash vs. card split for a single business day:
SELECT
PaymentTypeName,
SUM(TotalAmount) AS total
FROM vw_Payments
WHERE CAST(DateTime AS date) = @businessDay
GROUP BY PaymentTypeName;