07 · Sales — sales, delivery, and field visits
Updated
Solution(2) layer. Depends on Common, Organization, Accounting, Tax, Inventory, and Costing. This is the largest model in the contour: goods issue, customer receivables, delivery, and field sales.
Purpose#
Sales manages the chain from sales order to money and to the buyer's door. An order reserves goods, the realization writes them off from the picking cell and recognizes revenue, and a payment clears the receivable. The same model also covers delivery trips, routes, drivers, vehicles, and field visits by sales agents.
Transaction terms do not live on the document. They live on the contract, and the contract belongs to the outlet. Without a contract, the order cannot be saved or posted.
For the process view, see Sales and purchasing. This page is the object-level reference.
What is created#
| Kind | Name | Purpose |
|---|---|---|
| Model | Sales |
Module model, Solution(2) layer |
| Dictionary | SalesContract |
Contract: currency, settlement type, payment term, Incoterms, price type, limit, date window |
| Dictionary | SalesPerson |
Sales agent |
| Dictionary | DeliveryRoute, DeliveryRouteStop, DeliverySchedule |
Delivery route, route stops, and schedule |
| Dictionary | Driver, Vehicle |
Driver and vehicle |
| Dictionary | AbcProfile, AbcClassBand |
ABC/XYZ profile and class boundaries |
| Dictionary | SalesSettings |
Module settings (singleton) |
| Document | SalesOrder |
Sales order |
| Document | SalesRealization |
Realization: issue, revenue, and output tax |
| Document | CustomerPayment |
Customer payment |
| Document | SalesReturn |
Return |
| Document | SalesCreditNote, SalesDebitNote |
Credit note and debit note |
| Document | DeliveryTrip |
Delivery trip |
| Document | VisitRoute, AgentVisit |
Visit route and agent visit |
| Register | Receivable |
Receivable |
| Register | ReservedStock |
Reservation |
| Register | Revenue |
Revenue |
| Register | AbcClassification |
ABC/XYZ classification |
| Register | AgentGpsLog |
Agent track (information register) |
| Register | MobileCommandReceipt |
Mobile command idempotency (information register) |
| Service | SalesLinePricing |
Line pricing |
| Service | SalesContractService |
Contract selection |
| Service | SalesFulfillmentService |
Reservation and fulfillment |
| Service | DeliveryService |
Trip assembly |
| Service | GrossMarginService |
Gross margin |
| Service | AbcClassifier |
ABC/XYZ class calculation |
| LinkTable | SalesContractPrice, SalesContractQtyBreak |
Contract prices and quantity breaks |
| Enum | SettlementKind, StopOutcome, VehicleKind, Weekday |
Settlement type, stop outcome, vehicle type, day of week |
| Job | RecalcAbcClassifications |
Recalculation |
| Menu | menu.json |
Sales tab |
| Reused | Item, Customer, CustomerOutlet, Store, StoreCell, Stock, PricingService (Inventory); PaymentTerm, DeliveryTerm, Currency (Common); LegalEntity (Organization); Tax Engine (Tax) |
Do not create them here |
Total: 10 dictionaries, 9 documents, 6 registers, 6 services, 2 link tables, 4 enums, 21 commands, and 1 job.
model.json#
Solution(2) layer. Dependencies: Accounting, Common, Inventory, Organization, Tax, and Costing.
The dependency on Costing points from Sales to Costing because Sales computes margin in GrossMarginService. A reverse edge would create a cycle. See 10 · Costing.
Number sequences#
One sequence per object: SalesOrderSeq, SalesRealizationSeq, SalesReturnSeq, SalesCreditNoteSeq, SalesDebitNoteSeq, CustomerPaymentSeq, DeliveryTripSeq, VisitRouteSeq, AgentVisitSeq, SalesContractSeq, SalesPersonSeq, DeliveryRouteSeq, DeliveryRouteStopSeq, DeliveryScheduleSeq, DriverSeq, VehicleSeq, AbcProfileSeq, AbcClassBandSeq, SalesSettingsSeq.
SalesInvoiceLinesandSalesInvoiceReserveTxare historical physical names, and this is not an error. The document isSalesRealization(menu Sales realizations). The sequence isSalesRealizationSeq. The table part stayedSalesInvoiceLines/TP_SalesInvoiceLines. Renaming it would replace the physical table. Tax calculations still key by the reason prefix"Sales invoice <id>".
Table parts#
SalesOrderLines, SalesInvoiceLines (realization lines), SalesReturnLines, SalesCreditNoteLines, SalesDebitNoteLines, CustomerPaymentLines, DeliveryTripLines, and VisitRouteStops.
EDT#
References: RefSalesContract, RefSalesPerson, RefDeliveryRoute, RefDriver, RefVehicle, RefAbcProfile. Enums: SettlementKindEdt, StopOutcomeEdt, VehicleKindEdt, WeekdayEdt. Scalars: AbcClassCode, AbcManualFlag, AbcSubjectKey, GeoValue, BatteryLevel, IdempotencyKey, MobileActionName, MobileEntityRef, MobileStatusCode, MobileResponseText.
Dictionaries#
SalesContract#
SalesContract is the center of the model. It belongs to a customer outlet: CustomerOutlet is required, and the buyer is copied from the outlet, not selected separately. The contract carries currency, settlement type (SettlementKind), payment term (PaymentTerm), delivery term (DeliveryTerm, Incoterms), price type, credit limit, and effective date window.
Contract prices are entered in link tables. SalesContractPrice stores the price per item. SalesContractQtyBreak stores volume discounts. They are not fields because one contract can have many dated prices and breaks.
Routes and delivery#
DeliveryRoute is the route. DeliveryRouteStop stores its stops in order. DeliverySchedule stores the weekdays (Weekday) when the route runs. Driver and Vehicle (VehicleKind) store who drives and what vehicle is used.
ABC/XYZ#
AbcProfile sets calculation parameters, and AbcClassBand sets class boundaries. The result is written to AbcClassification. RecalcAbcClassifications recalculates it.
Documents#
SalesOrder#
Subtypes: Draft → Submitted → Confirmed. Confirmation reserves goods in ReservedStock and creates a realization.
Commands: SubmitSalesOrder, ApproveSalesOrder, RejectSalesOrder, CancelSalesOrder, and FillSalesPrices.
A line price is not copied directly from a price record. It is calculated through PricingService from Inventory, subject to the contract. The price origin remains visible, so the manager can see why the amount was selected.
SalesRealization#
Subtypes: Reserved … Issued. Stock, receivable, output tax, and loyalty are posted only in Issued. Intermediate subtypes do not move anything.
Commands: StartPicking, MarkPacked, MarkShipped, MarkDelivered, IssueInvoice, and ReleaseRealization.
Paid and Voided are not realization states. Payment is a separate CustomerPayment document. Cancellation is a SalesReturn or SalesCreditNote.
CustomerPayment, SalesReturn, SalesCreditNote, SalesDebitNote#
Payment clears Receivable. Returns and notes adjust revenue and tax. Commands: ReceiveCustomerPayment, MarkPaid, PostSalesReturn, PostSalesCreditNote, and PostSalesDebitNote.
Exchange differences: ExchangeRate, ReceivableRevaluation#
A contract may be in a currency other than its legal entity's. SalesRealization stamps ExchangeRate (contract currency to the entity's, on the invoice date) when it moves to Issued and refuses without a rate; SalesCreditNote, SalesDebitNote and SalesReturn take the original invoice's rate. Receivable keeps Amount in the contract's currency and AmountFunc in the entity's; Revenue, the ledger legs and the output-tax base are amount × rate. CustomerPayment lines stamp the payment-date ExchangeRate and the CarryingAmount they settle (the slice's average carrying value), and CustomerPaymentGLTx books the gap to FxGainAccountCode / FxLossAccountCode.
ReceivableRevaluation (Draft → Posted) books the unrealised difference at period end. Commands: FillReceivableRevaluation (every open foreign-currency slice of the legal entity, at the rate on the document date), PostReceivableRevaluation, CancelReceivableRevaluation. ReceivableRevaluationTx moves AmountFunc by the difference; ReceivableRevaluationGLTx books gains and losses as two sums. The revalued value is not reversed; the next payment measures its difference against it. ISalesFx (SalesFx) answers the rate for a contract, the functional amount and the carrying value. A contract's Currency cannot change while its slice is open. With AccountingSettings.RevalueFxOnPeriodClose on, closing a FiscalPeriod first posts the receivable and payable revaluations dated its last day (FiscalPeriodSalesFxEventHandler, FiscalPeriodPurchaseFxEventHandler); a failure keeps the period open. Process view: exchange differences.
DeliveryTrip, VisitRoute, AgentVisit#
A trip is assembled from a route with FillTripFromRoute, dispatched with DispatchTrip, and completed with CompleteTrip. An agent visit is opened and closed by CheckInVisit and CheckOutVisit. The stop result is StopOutcome.
Example#
Outlet Outlet-1 has a SalesContract in USD. Item Widget is in picking cell Cell-1. Before the scenario, stock is 100 pcs. SalesLinePricing returns a price of 15.00 per unit. Tax and cost are omitted to keep the table readable; the realization really posts output tax and entries in ItemCostFifo/InventoryValue. See Costing.
| Document | Action | Stock (Cell-1, Widget) |
ReservedStock (Cell-1, Widget) |
Revenue (Outlet-1, Widget) |
Receivable (Outlet-1) |
|---|---|---|---|---|---|
| — | starting point | 100 | 0 | 0.00 | 0.00 |
SalesOrder SO-1 |
Confirmed: reserve 10 units at 15.00 |
100 | 10 | 0.00 | 0.00 |
SalesRealization INV-1 |
Issued: write-off, revenue recognition, receivable recognition |
90 | 0 | 150.00 | 150.00 |
CustomerPayment PAY-1 |
payment 100.00 | 90 | 0 | 150.00 | 50.00 |
SalesReturn RET-1 |
return 2 pcs; reverse revenue and debt for that amount | 92 | 0 | 120.00 | 20.00 |
SalesCreditNote CN-1 |
retrospective discount 10.00 without goods movement | 92 | 0 | 120.00 | 10.00 |
SalesDebitNote DN-1 |
additional delivery charge 5.00 | 92 | 0 | 120.00 | 15.00 |
Scenario result: the buyer still owes 15.00. The picking cell has 8 pcs less than at the start (100 → 92). Recognized revenue is 120.00: 150.00 sale minus 30.00 return minus 10.00 credit note. The 5.00 debit note does not change the Revenue column in this example because it charges a delivery service, not goods.
Registers#
Register dimensions and resources: see Receivable, ReservedStock, Revenue, AbcClassification, AgentGpsLog, and MobileCommandReceipt in Objects below.
ReservedStock uses the same coordinates as Stock in Inventory: cell and item. Otherwise free = Stock - Reserved would not make sense. The reserve is released in the SalesRealization example: Confirmed added 10, and Issued took them back to 0 in the same movement that wrote off Stock.
AgentGpsLog and MobileCommandReceipt are information registers, not accumulation registers. The first stores track points over time. The second stores a response by idempotency key so a repeated mobile command does not create a second document.
Example slice of AbcClassification. With the default profile and three products by period turnover: Widget has the highest turnover, so AbcClass=A; its demand is stable, so XyzClass=X. A medium item has average turnover and volatile demand, so B/Y. A rare item has rare sales, so C/Z. The scheduled job RecalcAbcClassifications rewrites AbcClass, XyzClass, Score, Share, and Cv, but does not touch ManualAbc or ManualXyz. If an analyst manually raises a rare item to B with ManualAbc, recalculation does not erase it.
Services#
SalesLinePricingcalculates the line price and records its origin.SalesContractServiceselects the contract applicable on a date.SalesFulfillmentServicehandles reservation and fulfillment.DeliveryServiceassembles trips and stop order.GrossMarginServicecalculates gross margin. It lives here, not in Costing, to avoid a dependency cycle.AbcClassifiercalculates classes by profile.SalesFxgives a contract's exchange rate on a date, functional amounts, and the carrying value a payment settles.
Business logic and invariants#
The contract is required. An order is not saved without a contract. The contract is tied to the outlet and copies the buyer from it. This is not duplication; it protects sales when one customer has several outlets.
Reserve is released by subtype rollback. ReservedStock grows on Confirmed and decreases when you roll back. Free balance is counted by cell, not by store.
Postings run only on the target subtype. A command performs the transition, not a dropdown list. The subtype's full tx script list runs by executionOrder.
Manual classification survives recalculation. ManualAbc and ManualXyz on AbcClassification are not overwritten by the scheduled job.
Menu#
Sales tab: Documents (orders, realizations, payments, returns, notes, trips, visits) · Dictionaries (contracts, sales agents, routes, drivers, vehicles) · Registers (receivable, revenue, reserve, classification) · Settings (SalesSettings, ABC profiles).
Customers and outlets are placed here in the menu although the objects belong to Inventory. The menu entry lives where users need it.
Links with other modules#
- Outgoing: Inventory for items, store, stock, and prices; Tax for Tax Engine; Accounting for ledger posting; Costing for margin cost; Common for currency, payment terms, and delivery terms.
- Incoming: CRM builds leads and KPIs over orders and accrues loyalty on
Issued; localizations extend realization and build electronic invoices, for example 21 · Saudi Arabia; sales, returns, payments and cost of sales are posted to the ledger by Sales itself (SalesRevenueGLTx,SalesReturnGLTx,CustomerPaymentGLTx, cost of sales inSalesRealizationEventHandler; see Who writes the general ledger).
Objects#
Generated from workspace metadata by node tools/gen-reference.mjs; edit the metadata, not this block.
Dictionaries#
AbcClassBand — ABC class bands
One class interval of a profile on the ABC or XYZ axis. Unique Profile+Axis+ClassCode.
| Field | Caption | Type | Required |
|---|---|---|---|
Axis |
Axis | String(8) | Yes |
BoundFrom |
From | Money |
Yes |
BoundTo |
To | Money |
No |
ClassCode |
Class | AbcClassCode |
Yes |
ID |
Code | String(50) | Yes |
Profile |
Profile | → AbcProfile |
Yes |
AbcPolicyCell — ABC replenishment cells
One AX…CZ cell of a profile: class pair plus keep-stock or buy-to-order. Letters are data, not hardcoded.
| Field | Caption | Type | Required |
|---|---|---|---|
AbcClass |
ABC | AbcClassCode |
Yes |
CoverDays |
Cover, days | Integer | No |
ID |
Code | String(50) | Yes |
Mode |
Mode | AbcStockModeEdt |
No |
Profile |
Profile | → AbcProfile |
Yes |
XyzClass |
XYZ | AbcClassCode |
No |
AbcProfile — ABC profiles
Configurable ABC/XYZ scheme: subject, measure, window and methods. Bands live in AbcClassBand.
| Field | Caption | Type | Required |
|---|---|---|---|
AbcMethod |
ABC method | String(32) | Yes |
BucketCount |
XYZ buckets | Integer | Yes |
ID |
ID | String(50) | Yes |
IsDisabled |
Disabled | Boolean | No |
ItemGroup |
Item group | → ItemGroup |
No |
Measure |
Measure | String(32) | Yes |
Name |
Name | String(100) | Yes |
Subject |
Subject | String(32) | Yes |
WindowMonths |
Window, months | Integer | Yes |
XyzMethod |
XYZ method | String(32) | Yes |
DeliveryRoute — Delivery route
| Field | Caption | Type | Required |
|---|---|---|---|
ArriveRadiusMeters |
Arrive radius, m | Integer | No |
DefaultDriver |
Default driver | → Driver |
No |
DefaultVehicle |
Default vehicle | → Vehicle |
No |
Depot |
Depot | → Store |
No |
ID |
ID | String(50) | Yes |
IsDisabled |
Disabled | Boolean | No |
Name |
Name | String(256) | Yes |
DeliveryRouteStop — Route stops
Ordered outlet on a delivery route.
| Field | Caption | Type | Required |
|---|---|---|---|
DwellMinutes |
Dwell, min | Integer | No |
ID |
ID | String(50) | Yes |
IsDisabled |
Disabled | Boolean | No |
Lat |
Latitude | Decimal(18,6) | No |
Lng |
Longitude | Decimal(18,6) | No |
Outlet |
Outlet | → CustomerOutlet |
Yes |
Route |
Route | → DeliveryRoute |
Yes |
Sequence |
Sequence | Integer | Yes |
WindowFromMinutes |
Window from, min | Integer | No |
WindowToMinutes |
Window to, min | Integer | No |
DeliverySchedule — Delivery schedules
Recurring weekday wave: route, depart time, default crew.
| Field | Caption | Type | Required |
|---|---|---|---|
DepartHour |
Depart hour | Integer | No |
DepartMinute |
Depart minute | Integer | No |
Driver |
Driver | → Driver |
No |
ID |
Code | String(50) | Yes |
IsDisabled |
Disabled | Boolean | No |
Name |
Name | String(160) | Yes |
Route |
Route | → DeliveryRoute |
Yes |
Vehicle |
Vehicle | → Vehicle |
No |
Weekday |
Weekday | WeekdayEdt |
Yes |
Driver — Drivers
Delivery driver. Not a sales agent and not an HR employee.
| Field | Caption | Type | Required |
|---|---|---|---|
ID |
Code | String(50) | Yes |
IsDisabled |
Disabled | Boolean | No |
LicenseNumber |
License | String(40) | No |
Name |
Name | String(160) | Yes |
Phone |
Phone | String(32) | No |
LegacyBasis — Legacy settlement bases
Order of the predecessor system with open debt, not migrated as a document. MetaId equals the Basis used in ReceivableByBasis.
| Field | Caption | Type | Required |
|---|---|---|---|
Customer |
Customer | → Customer |
Yes |
DocumentDate |
Document date | DateTime | Yes |
ID |
Code | String(50) | Yes |
Number |
Number | String(50) | No |
SalesContract |
Sales contract | → SalesContract |
No |
Source |
Source | String(100) | No |
SourceKey |
Source key | String(100) | No |
SalesContract — Sales contracts
Commercial terms of an outlet: currency, settlement, payment term, price type, dated window.
| Field | Caption | Type | Required |
|---|---|---|---|
CreditLimit |
Credit limit | Money |
No |
Currency |
Currency | → Currency |
Yes |
Customer |
Customer | → Customer |
Yes |
DeliveryTerm |
Delivery term | → DeliveryTerm |
No |
EffectiveFrom |
Effective from | DateTime | Yes |
EffectiveTo |
Effective to | DateTime | No |
ID |
ID | String(50) | Yes |
IsDisabled |
Disabled | Boolean | No |
LegalEntity |
Selling legal entity | → LegalEntity |
No |
Name |
Name | String(160) | Yes |
Outlet |
Outlet | → CustomerOutlet |
No |
PaymentTerm |
Payment term | → PaymentTerm |
No |
PriceType |
Price type | → PriceType |
No |
SettlementKind |
Settlement | SettlementKindEdt |
Yes |
SalesPerson — Sales person
| Field | Caption | Type | Required |
|---|---|---|---|
ID |
ID | String(50) | Yes |
Login |
Login | String(100) | No |
Name |
Name | String(256) | Yes |
UserId |
Login user | Guid | No |
SalesSettings — Sales settings
| Field | Caption | Type | Required |
|---|---|---|---|
AllowBackorder |
Allow backorder | Boolean | No |
BlockOverdueOrders |
Block orders with overdue debt | Boolean | No |
ConfirmOrderOnSubmit |
Confirm order on submit | Boolean | No |
DefaultPaymentTerm |
Default payment term | → PaymentTerm |
No |
DefaultPaymentTermDays |
Default payment term (days) | Integer | No |
ID |
ID | String(50) | Yes |
OverdueGraceDays |
Overdue grace days | Integer | No |
PriceMismatchPercent |
Mobile price mismatch, % | Decimal(5,2) | No |
RouteAverageSpeedKmh |
Average route speed, km/h | Decimal(5,2) | No |
Vehicle — Vehicles
Delivery vehicle: plate, kind, capacity.
| Field | Caption | Type | Required |
|---|---|---|---|
CapacityKg |
Capacity kg | Decimal(18,3) | No |
CapacityQty |
Capacity qty | Qty |
No |
ID |
Code | String(50) | Yes |
IsDisabled |
Disabled | Boolean | No |
Kind |
Kind | VehicleKindEdt |
Yes |
Name |
Name | String(160) | Yes |
PlateNumber |
Plate | String(32) | Yes |
Documents#
AgentTask — Agent task
Call, collect, or other work assigned to a sales person. Not a visit stop and not a payment.
Header fields:
| Field | Caption | Type | Required |
|---|---|---|---|
Agent |
Agent | → SalesPerson |
Yes |
Customer |
Customer | → Customer |
No |
DueDate |
Due date | DateTime | Yes |
ID |
Number | String(50) | Yes |
Kind |
Kind | String(16) | Yes |
Notes |
Notes | String(512) | No |
Outlet |
Outlet | → CustomerOutlet |
No |
Route |
Visit route | Guid | No |
Subtypes:
| Subtype | Caption |
|---|---|
Open |
Open |
Done |
Done |
Cancelled |
Cancelled |
Commands:
| Command | Caption | Target subtype |
|---|---|---|
CompleteTask |
Complete | — |
CancelTask |
Cancel | — |
AgentVisit — Agent visit
Header fields:
| Field | Caption | Type | Required |
|---|---|---|---|
Accuracy |
Accuracy, m | Decimal(18,6) | No |
CheckedInAt |
Checked in at | DateTime | No |
CheckedOutAt |
Checked out at | DateTime | No |
Customer |
Customer | → Customer |
Yes |
GeoStatus |
Geo status | String(16) | No |
ID |
Number | String(50) | Yes |
Lat |
Latitude | Decimal(18,6) | No |
Lng |
Longitude | Decimal(18,6) | No |
Outlet |
Outlet | → CustomerOutlet |
No |
Route |
Visit route | Guid | No |
SkipReason |
Skip reason | String(256) | No |
StopSequence |
Stop | Integer | No |
Subtypes:
| Subtype | Caption |
|---|---|
Draft |
Draft |
Open |
Open |
Closed |
Closed |
Commands:
| Command | Caption | Target subtype |
|---|---|---|
CheckOutVisit |
Check out | — |
CustomerPayment — Customer payment
Header fields:
| Field | Caption | Type | Required |
|---|---|---|---|
BankAccount |
Bank account | → BankAccount |
No |
CashDesk |
Cash desk | → CashDesk |
No |
ID |
Number | String(50) | Yes |
LegalEntity |
Legal entity | → LegalEntity |
No |
Notes |
Notes | String(2000) | No |
Subtypes:
| Subtype | Caption |
|---|---|
Draft |
Draft |
Paid |
Paid |
Commands:
| Command | Caption | Target subtype |
|---|---|---|
ReceiveCustomerPayment |
Receive payment | — |
CustomerRefund — Customer refund
Money paid back to a customer from a cash desk or a bank account (overpayment, returned goods). Posting raises the customer's receivable on the contract and basis, lowers the desk or account balance and debits receivables against its ledger account.
Header fields:
| Field | Caption | Type | Required |
|---|---|---|---|
Amount |
Amount | Money |
Yes |
BankAccount |
Bank account | → BankAccount |
No |
Basis |
Basis | Guid | No |
CashDesk |
Cash desk | → CashDesk |
No |
Contract |
Contract | → SalesContract |
Yes |
Customer |
Customer | → Customer |
Yes |
ExchangeRate |
Exchange rate | Decimal(18,8) | No |
ID |
Number | String(50) | Yes |
LegalEntity |
Legal entity | → LegalEntity |
Yes |
Notes |
Notes | String(2000) | No |
Subtypes:
| Subtype | Caption |
|---|---|
Draft |
Draft |
Paid |
Paid |
Commands:
| Command | Caption | Target subtype |
|---|---|---|
PayCustomerRefund |
Pay refund | — |
DeliveryTrip — Delivery trip
Header fields:
| Field | Caption | Type | Required |
|---|---|---|---|
ActualComplete |
Actual completion | DateTime | No |
ActualDepart |
Actual departure | DateTime | No |
DeliveryDate |
Delivery date | DateTime | Yes |
Depot |
Depot | → Store |
No |
Driver |
Driver | → Driver |
No |
ID |
Number | String(50) | Yes |
PlannedDepart |
Planned departure | DateTime | No |
Route |
Route | → DeliveryRoute |
No |
Vehicle |
Vehicle | → Vehicle |
No |
Subtypes:
| Subtype | Caption |
|---|---|
Draft |
Draft |
Dispatched |
Dispatched |
Completed |
Completed |
Archived |
Archived |
Commands:
| Command | Caption | Target subtype |
|---|---|---|
FillTripFromRoute |
Fill from route | — |
CompleteTrip |
Complete trip | — |
DispatchTrip |
Dispatch trip | — |
OptimiseTripStops |
Optimise stop order | — |
ReceivableRevaluation — Receivable revaluation
Period-end revaluation of foreign-currency receivables. Fill revaluation lists every open contract slice of the legal entity whose contract currency is not the entity's own, at the rate on the document date; Post revaluation moves Receivable.AmountFunc to the revalued amount and books the unrealised exchange difference. The revalued carrying value stays: the next payment's realised difference is measured against it.
Header fields:
| Field | Caption | Type | Required |
|---|---|---|---|
ID |
Number | String(50) | Yes |
LegalEntity |
Legal entity | → LegalEntity |
Yes |
Subtypes:
| Subtype | Caption |
|---|---|
Draft |
Draft |
Posted |
Posted |
Commands:
| Command | Caption | Target subtype |
|---|---|---|
CancelReceivableRevaluation |
Cancel revaluation | — |
FillReceivableRevaluation |
Fill revaluation | — |
PostReceivableRevaluation |
Post revaluation | — |
SalesCreditNote — Sales credit note
Header fields:
| Field | Caption | Type | Required |
|---|---|---|---|
Contract |
Contract | → SalesContract |
Yes |
Customer |
Customer | → Customer |
Yes |
ExchangeRate |
Exchange rate | Decimal(18,8) | No |
ID |
Number | String(50) | Yes |
LegalEntity |
Selling legal entity | → LegalEntity |
No |
OriginalInvoice |
Original invoice | Guid | No |
Outlet |
Outlet | → CustomerOutlet |
No |
TaxRateApplied |
Applied tax rate | TaxRateValue |
No |
Subtypes:
| Subtype | Caption |
|---|---|
Draft |
Draft |
Posted |
Posted |
Commands:
| Command | Caption | Target subtype |
|---|---|---|
PostSalesCreditNote |
Post sales credit note | — |
SalesDebitNote — Sales debit note
Header fields:
| Field | Caption | Type | Required |
|---|---|---|---|
Contract |
Contract | → SalesContract |
Yes |
Customer |
Customer | → Customer |
Yes |
ExchangeRate |
Exchange rate | Decimal(18,8) | No |
ID |
Number | String(50) | Yes |
LegalEntity |
Selling legal entity | → LegalEntity |
No |
OriginalInvoice |
Original invoice | Guid | No |
Outlet |
Outlet | → CustomerOutlet |
No |
TaxRateApplied |
Applied tax rate | TaxRateValue |
No |
Subtypes:
| Subtype | Caption |
|---|---|
Draft |
Draft |
Posted |
Posted |
Commands:
| Command | Caption | Target subtype |
|---|---|---|
PostSalesDebitNote |
Post sales debit note | — |
SalesOrder — Sales order
Process B: Draft → Submitted → Confirmed (Approved) → Delivered. Confirmed creates a realization invoice in Reserved; its walk to Issued closes the order as Delivered. When that invoice leaves Issued (back to Draft, cancelled, deleted), the order returns to Confirmed (SalesFulfillmentService.ReopenSourceOrderAsync from the invoice's OnBeforeUnpostAsync); another Issued invoice of the order keeps it Delivered.
Header fields:
| Field | Caption | Type | Required |
|---|---|---|---|
Agent |
Agent | → SalesPerson |
No |
Contact |
Contact | → CustomerContact |
No |
Contract |
Contract | → SalesContract |
Yes |
Customer |
Customer | → Customer |
Yes |
DeliveryDate |
Delivery date | DateTime | Yes |
DeliveryTerm |
Delivery term | → DeliveryTerm |
No |
DiscountPercent |
Discount, % | Percent |
No |
ID |
Number | String(50) | Yes |
Location |
Ship-from location | → StoreCell |
Yes |
Notes |
Notes | String(2000) | No |
Outlet |
Outlet | → CustomerOutlet |
No |
OverdueReleasedAmount |
Released overdue debt | Decimal(18,2) | No |
PaymentTerm |
Payment term | → PaymentTerm |
No |
RejectReason |
Reject reason | String(500) | No |
Route |
Route | → DeliveryRoute |
No |
SourceQuotation |
Source quotation | Guid | No |
Visit |
Visit | Guid | No |
Subtypes:
| Subtype | Caption |
|---|---|
Draft |
Draft |
Submitted |
Submitted |
Confirmed |
Approved |
Delivered |
Delivered |
Cancelled |
Cancelled |
Commands:
| Command | Caption | Target subtype |
|---|---|---|
SubmitSalesOrder |
Submit order | — |
ApproveSalesOrder |
Approve order | — |
MarkDelivered |
Mark delivered | — |
CancelSalesOrder |
Cancel order | — |
RejectSalesOrder |
Reject order | — |
ReleaseOverdueBlock |
Release overdue block | — |
SalesRealization — Sales realization
Header fields:
| Field | Caption | Type | Required |
|---|---|---|---|
Contact |
Contact | → CustomerContact |
No |
Contract |
Contract | → SalesContract |
Yes |
Customer |
Customer | → Customer |
Yes |
DeliveryTerm |
Delivery term | → DeliveryTerm |
No |
DiscountPercent |
Discount, % | Percent |
No |
DueDate |
Due date | DateTime | No |
ExchangeRate |
Exchange rate | Decimal(18,8) | No |
ID |
Number | String(50) | Yes |
KeepDueDate |
Keep due date | Boolean | No |
LegalEntity |
Selling legal entity | → LegalEntity |
No |
Location |
Ship-from location | → StoreCell |
Yes |
Notes |
Notes | String(2000) | No |
Outlet |
Outlet | → CustomerOutlet |
No |
PaymentTerm |
Payment term | → PaymentTerm |
No |
SourceOrder |
Source order | Guid | No |
TaxRateApplied |
Applied tax rate | TaxRateValue |
No |
Subtypes:
| Subtype | Caption |
|---|---|
Draft |
Draft |
Reserved |
Reserved |
Picking |
Picking |
Packing |
Packing |
Shipped |
Shipped |
Issued |
Released |
Paid |
Paid |
Cancelled |
Cancelled |
Commands:
| Command | Caption | Target subtype |
|---|---|---|
FillSalesPrices |
Fill prices | — |
IssueInvoice |
Issue realization | — |
MarkPaid |
Mark as paid (disabled) | — |
StartPicking |
Start picking | — |
MarkPacked |
Mark packed | — |
MarkShipped |
Mark shipped | — |
ReleaseRealization |
Release realization | — |
SalesReturn — Sales return
Header fields:
| Field | Caption | Type | Required |
|---|---|---|---|
Contract |
Contract | → SalesContract |
Yes |
Customer |
Customer | → Customer |
Yes |
ExchangeRate |
Exchange rate | Decimal(18,8) | No |
ID |
Number | String(50) | Yes |
Location |
Return location | → StoreCell |
Yes |
Notes |
Notes | String(2000) | No |
OriginalInvoice |
Original invoice | Guid | No |
Outlet |
Outlet | → CustomerOutlet |
No |
Subtypes:
| Subtype | Caption |
|---|---|
Draft |
Draft |
Posted |
Posted |
Commands:
| Command | Caption | Target subtype |
|---|---|---|
PostSalesReturn |
Post sales return | — |
VisitRoute — Visit route
Header fields:
| Field | Caption | Type | Required |
|---|---|---|---|
Agent |
Agent | → SalesPerson |
Yes |
ID |
Number | String(50) | Yes |
RouteDate |
Route date | DateTime | Yes |
Template |
Template route | → DeliveryRoute |
No |
Subtypes:
| Subtype | Caption |
|---|---|
Draft |
Draft |
Open |
Open |
Closed |
Closed |
Commands:
| Command | Caption | Target subtype |
|---|---|---|
CheckInVisit |
Check in | — |
Registers#
AbcClassification — ABC classification
SliceLast by Profile + Subject (Item or Customer Guid). Recalc writes Period=asOf; ManualAbc/ManualXyz keep a class across runs.
Dimensions:
| Dimension | Caption | Type | Required |
|---|---|---|---|
Profile |
Profile | → AbcProfile |
— |
Subject |
Subject | AbcSubjectKey |
— |
Resources:
| Resource | Caption | Type | Required |
|---|---|---|---|
AbcClass |
ABC | AbcClassCode |
— |
Cv |
CV | Money |
— |
ManualAbc |
Manual ABC | AbcManualFlag |
— |
ManualXyz |
Manual XYZ | AbcManualFlag |
— |
Score |
Score | Money |
— |
Share |
Share, % | Money |
— |
XyzClass |
XYZ | AbcClassCode |
— |
AbcSuggestion — ABC replenishment suggestion
SliceLast by Profile + Item. Written by IAbcPolicy. A purchase draft is a separate command and does not post stock.
Dimensions:
| Dimension | Caption | Type | Required |
|---|---|---|---|
Profile |
Profile | → AbcProfile |
— |
Subject |
Item | AbcSubjectKey |
— |
Resources:
| Resource | Caption | Type | Required |
|---|---|---|---|
AbcClass |
ABC | AbcClassCode |
— |
CoverDays |
Cover, days | Money |
— |
IssuedQty |
Issued qty | Qty |
— |
Mode |
Mode | AbcClassCode |
— |
OnHandQty |
On hand | Qty |
— |
SuggestQty |
Suggest qty | Qty |
— |
XyzClass |
XYZ | AbcClassCode |
— |
AgentGpsLog — Agent GPS log
Dimensions:
| Dimension | Caption | Type | Required |
|---|---|---|---|
Agent |
Agent | → SalesPerson |
— |
Resources:
| Resource | Caption | Type | Required |
|---|---|---|---|
Accuracy |
Accuracy, m | GeoValue |
— |
Battery |
Battery, % | BatteryLevel |
— |
Lat |
Latitude | GeoValue |
— |
Lng |
Longitude | GeoValue |
— |
Speed |
Speed | GeoValue |
— |
MobileCommandReceipt — Mobile command receipt
Dimensions:
| Dimension | Caption | Type | Required |
|---|---|---|---|
Key |
Idempotency key | IdempotencyKey |
— |
Resources:
| Resource | Caption | Type | Required |
|---|---|---|---|
Action |
Action | MobileActionName |
— |
Entity |
Entity | MobileEntityRef |
— |
Response |
Response | MobileResponseText |
— |
Status |
Status | MobileStatusCode |
— |
Receivable — Receivable
Resources:
| Resource | Caption | Type | Required |
|---|---|---|---|
Amount |
Amount | Money |
— |
AmountFunc |
Amount in functional currency | Money |
— |
Analytics:
| Analytic | Caption | Type | Required |
|---|---|---|---|
Receivable-Customer |
Receivable-Customer | — | Yes |
Receivable-SalesContract |
Receivable-SalesContract | — | Yes |
ReceivableBasis — Receivable by basis
Companion of Receivable: the same debt, sliced by the document it settles against (Basis). Customer x contract x basis. The sum over bases equals the Receivable balance of the same customer and contract.
Dimensions:
| Dimension | Caption | Type | Required |
|---|---|---|---|
Basis |
Basis | SettlementBasisKey |
— |
Customer |
Customer | → Customer |
— |
SalesContract |
Sales contract | → SalesContract |
— |
Resources:
| Resource | Caption | Type | Required |
|---|---|---|---|
Amount |
Amount | Money |
— |
ReceivableByBasis — Receivable by basis
Companion of Receivable: the same debt, sliced by the document it settles against (Basis). Customer x contract x basis. The sum over bases equals the Receivable balance of the same customer and contract.
Dimensions:
| Dimension | Caption | Type | Required |
|---|---|---|---|
Basis |
Basis | SettlementBasisKey |
— |
Customer |
Customer | → Customer |
— |
SalesContract |
Sales contract | → SalesContract |
— |
Resources:
| Resource | Caption | Type | Required |
|---|---|---|---|
Amount |
Amount | Money |
— |
ReservedStock — Reserved stock
Resources:
| Resource | Caption | Type | Required |
|---|---|---|---|
Qty |
Qty | Qty |
— |
Analytics:
| Analytic | Caption | Type | Required |
|---|---|---|---|
ReservedStock-Cell |
ReservedStock-Cell | — | Yes |
ReservedStock-Item |
ReservedStock-Item | — | Yes |
Revenue — Revenue
Recognized sales revenue by item, customer and contract: amount in the legal entity currency and quantity in the item base unit. Optional legal entity and outlet cuts.
Resources:
| Resource | Caption | Type | Required |
|---|---|---|---|
Amount |
Amount | Money |
— |
Qty |
Qty | Qty |
— |
Analytics:
| Analytic | Caption | Type | Required |
|---|---|---|---|
Revenue-Customer |
Revenue-Customer | — | Yes |
Revenue-CustomerOutlet |
Revenue-CustomerOutlet | — | No |
Revenue-Item |
Revenue-Item | — | Yes |
Revenue-LegalEntity |
Revenue-LegalEntity | — | No |
Revenue-SalesContract |
Revenue-SalesContract | — | Yes |
Table parts#
CustomerPaymentLines — Lines
Used by: CustomerPayment.
| Field | Caption | Type | Required |
|---|---|---|---|
Amount |
Amount | Money |
Yes |
Basis |
Basis | Guid | No |
CarryingAmount |
Carrying amount | Decimal(18,2) | No |
Contract |
Contract | → SalesContract |
Yes |
Customer |
Customer | → Customer |
Yes |
ExchangeRate |
Exchange rate | Decimal(18,8) | No |
DeliveryTripLines — Stops
Used by: DeliveryTrip.
| Field | Caption | Type | Required |
|---|---|---|---|
ActualLat |
Actual latitude | Decimal(18,6) | No |
ActualLng |
Actual longitude | Decimal(18,6) | No |
ArrivedAt |
Arrived at | DateTime | No |
DepartedAt |
Departed at | DateTime | No |
DwellMinutes |
Dwell, min | Integer | No |
Outcome |
Outcome | StopOutcomeEdt |
No |
Outlet |
Outlet | → CustomerOutlet |
No |
PlannedFromMinutes |
Window from, min | Integer | No |
PlannedLat |
Planned latitude | Decimal(18,6) | No |
PlannedLng |
Planned longitude | Decimal(18,6) | No |
PlannedToMinutes |
Window to, min | Integer | No |
QtyShipped |
Shipped qty | Qty |
No |
SalesOrder |
Sales order | Guid | Yes |
StopSequence |
Stop | Integer | No |
ReceivableRevaluationLines — Lines
Used by: ReceivableRevaluation.
| Field | Caption | Type | Required |
|---|---|---|---|
AmountCur |
Open amount | Decimal(18,2) | No |
Carrying |
Carrying amount | Decimal(18,2) | No |
Contract |
Contract | → SalesContract |
Yes |
Currency |
Currency | → Currency |
Yes |
Customer |
Customer | → Customer |
Yes |
Difference |
Difference | Decimal(18,2) | No |
Rate |
Rate | Decimal(18,8) | No |
Revalued |
Revalued amount | Decimal(18,2) | No |
SalesCreditNoteLines — Lines
Used by: SalesCreditNote.
| Field | Caption | Type | Required |
|---|---|---|---|
Item |
Item | → Item |
Yes |
Quantity |
Quantity | Qty |
Yes |
TaxAmount |
VAT amount | Money |
No |
TaxCode |
VAT rate | → TaxCode |
No |
UnitPrice |
Unit price | Money |
Yes |
SalesDebitNoteLines — Lines
Used by: SalesDebitNote.
| Field | Caption | Type | Required |
|---|---|---|---|
Item |
Item | → Item |
Yes |
Quantity |
Quantity | Qty |
Yes |
TaxAmount |
VAT amount | Money |
No |
TaxCode |
VAT rate | → TaxCode |
No |
UnitPrice |
Unit price | Money |
Yes |
SalesInvoiceLines — Lines
Used by: SalesRealization.
| Field | Caption | Type | Required |
|---|---|---|---|
Amount |
Amount | Money |
No |
BaseQuantity |
Qty in base unit | Qty |
No |
DiscountPercent |
Discount, % | Percent |
No |
Item |
Item | → Item |
Yes |
Location |
Warehouse cell | → StoreCell |
No |
PackQty |
Packages | Qty |
No |
PackUnit |
Package unit | → UnitOfMeasure |
No |
PriceExplanation |
Price origin | String(500) | No |
Quantity |
Quantity | Qty |
Yes |
SourceOrder |
Sales order | Guid | No |
TaxAmount |
VAT amount | Money |
No |
TaxCode |
VAT rate | → TaxCode |
No |
Unit |
Unit | → UnitOfMeasure |
No |
UnitPrice |
Unit price | Money |
Yes |
SalesOrderLines — Lines
Used by: SalesOrder.
| Field | Caption | Type | Required |
|---|---|---|---|
Amount |
Amount | Money |
No |
BaseQuantity |
Qty in base unit | Qty |
No |
DiscountPercent |
Discount, % | Percent |
No |
Item |
Item | → Item |
Yes |
PackQty |
Packages | Qty |
No |
PackUnit |
Package unit | → UnitOfMeasure |
No |
PriceExplanation |
Price origin | String(500) | No |
QtyDelivered |
Delivered qty | Qty |
No |
Quantity |
Quantity | Qty |
Yes |
TaxAmount |
VAT amount | Money |
No |
TaxCode |
VAT rate | → TaxCode |
No |
Unit |
Unit | → UnitOfMeasure |
No |
UnitPrice |
Unit price | Money |
Yes |
SalesReturnLines — Lines
Used by: SalesReturn.
| Field | Caption | Type | Required |
|---|---|---|---|
Amount |
Amount | Money |
No |
BaseQuantity |
Qty in base unit | Qty |
No |
DiscountPercent |
Discount, % | Percent |
No |
Item |
Item | → Item |
Yes |
Location |
Warehouse cell | → StoreCell |
No |
OriginalInvoice |
Realization | Guid | No |
PackQty |
Packages | Qty |
No |
PackUnit |
Package unit | → UnitOfMeasure |
No |
Quantity |
Quantity | Qty |
Yes |
SourceOrder |
Sales order | Guid | No |
TaxAmount |
VAT amount | Money |
No |
TaxCode |
VAT rate | → TaxCode |
No |
Unit |
Unit | → UnitOfMeasure |
No |
UnitPrice |
Unit price | Money |
Yes |
VisitRouteStops — Stops
Used by: VisitRoute.
| Field | Caption | Type | Required |
|---|---|---|---|
Customer |
Customer | → Customer |
Yes |
Outlet |
Outlet | → CustomerOutlet |
No |
Sequence |
Order | Integer | No |
StopStatus |
Stop status | String(16) | No |
WindowFrom |
Window from | DateTime | No |
WindowTo |
Window to | DateTime | No |