Przykłady: Wielkie Globalne Przepływy End-to-End
Cel: Pokazanie pełnych procesów biznesowych integrujących Invoice, Document (PZ/WZ), Location, Inventory, Product, Ledger i LedgerEntry.
Workflow I: Zakup → Przyjęcie → Faktura → Księgowanie
Scenariusz: Firma KAMSOFT S.A. kupuje 1.000 licencji oprogramowania od dostawcy TechSupply Ltd za €50.000. Proces od zamówienia do całkowitego rozliczenia.
Uczestnicy: - Dostawca: TechSupply Ltd (Party: techsupply-001, supplier) - Firma: KAMSOFT S.A. (Party: kamsoft-001, organization) - Pracownicy: - Czesław Brąz (Party: czeslawb-001) — Kierownik Zakupów - Katarzyna Zalewska (Party: katarzyna-z-001) — Pracownica WMS (przyjęcie) - Dominik Lewandowski (Party: dominik-l-001) — Księgowy - Magazyny: Centralny (Location: loc-wh-main-001)
Diagramy Procesu:
sequenceDiagram
participant CZ as Czesław Brąz<br/>(Kierownik Zakupów)
participant Sys as System ERP
participant KZ as Katarzyna Z.<br/>(WMS)
participant Dom as Dominik L.<br/>(Księgowy)
CZ->>Sys: Tworzy PZ (Purchase Order)
Sys->>Sys: Document.type=purchaseOrder<br/>position[1]: 1000 licencji × €50
Sys->>CZ: Potwierdzenie: PO-2026-001
CZ->>CZ: Wysyła do TechSupply<br/>(email + PDF)
par Procesy warunkowe
Sys->>Sys: Oczekiwanie na dostawę
and
CZ->>Sys: Monitoruje status (pending)
end
TechSupply->>Sys: Pakuje i wysyła (POD)
KZ->>Sys: Tworzy WZ (GoodsReceipt)<br/>Odniesienie do PO-2026-001
Sys->>Sys: Document.type=goodsReceipt<br/>position[1]: 1000 licencji<br/>sourceDocument: PO-2026-001
KZ->>Sys: Rejestruje w Location (wh-main)<br/>Inventory[oprogramowanie] += 1000
Sys->>Dom: Wysyła notyfikację: "GR-2026-001 otrzymane"
TechSupply->>Dom: Invoice (Faktura VAT #INV-2026-5001)
Dom->>Sys: Tworzy Invoice (in ERP)
Sys->>Sys: Document.type=invoice<br/>amount=50000 EUR<br/>sourceDocument: GR-2026-001
Dom->>Sys: Tworzy LedgerEntry (2 wpisy):
Sys->>Sys: Dr 1000 (Koszt Zakupów) EUR 50.000
Sys->>Sys: Cr 2110 (Zobowiązania Dostawcy) EUR 50.000
Dom->>Dom: Zatwierdzenie<br/>Invoice status=approved
Sys->>CZ: Email: "Invoice INV-2026-5001 rozliczony"
Sys->>KZ: Email: "Licencje dostępne w systemie"
Sys->>Dom: Email: "Booking zakończony"
Timeline Szczegółowy:
2026-02-20 09:00 Czesław tworzy PZ w systemie:
├─ Document.type: purchaseOrder
├─ Party (supplier): TechSupply Ltd
├─ position[1]: 1000 units, unit-price: €50
├─ amount: €50.000
└─ status: pending
↓
09:15 System generuje numer: PO-2026-001
↓
09:30 Czesław zatwierdza & wysyła PZ do dostawcy
↓
2026-02-25 14:00 TechSupply potwierdza: "Zamówienie przyjęte"
↓
2026-02-28 08:00 Paczka przychodzi do KAMSOFT
↓
09:30 Katarzyna rejestruje WZ (Goods Receipt):
├─ Document.type: goodsReceipt
├─ sourceDocument: PO-2026-001
├─ position[1]: 1000 licencji
├─ location: wh-main-001 (location ID)
└─ status: received
↓
09:45 System aktualizuje Inventory:
├─ Inventory.location: wh-main-001
├─ Inventory.product: oprogramowanie-lic-001
├─ quantityOnHand: 0 → 1000
└─ lastUpdated: 2026-02-28 09:45
↓
10:00 Dominik otrzymuje notyfikację z GR-2026-001
↓
2026-03-05 11:00 Dominik otrzymuje Invoice (papierowy / email):
├─ Invoice #INV-2026-5001
├─ Amount: €50.000 + 9.500 VAT = €59.500
├─ DueDate: 2026-04-05
└─ From: TechSupply Ltd
↓
11:30 Dominik wpisuje Invoice do systemu:
├─ Document.type: invoice
├─ Party (supplier): TechSupply Ltd
├─ amount: €50.000 (netto)
├─ sourceDocument: GR-2026-001
├─ sourcePositionNo: 1
└─ status: pending
↓
12:00 Dominik tworzy LedgerEntry (dekretacja):
Entry 1 — Koszt Zakupów (Wn):
├─ ledger: payroll-ledger
├─ account: 1000 (Koszt Zakupów)
├─ entrySide: debit
├─ amount: €50.000
├─ sourceDocument: Invoice (INV-2026-5001)
├─ sourcePositionNo: 1
└─ status: pending
Entry 2 — Zobowiązania Dostawcy (Ma):
├─ ledger: payroll-ledger
├─ account: 2110 (Zobowiązania Dostawcy)
├─ entrySide: credit
├─ amount: €50.000
├─ sourceDocument: Invoice (INV-2026-5001)
├─ sourcePositionNo: 1
└─ status: pending
↓
12:15 System wyświetla proforma GL:
┌──────────────────────────────────┐
│ Debit │ Credit │ Net │
├──────────────────────────────────┤
│ €50.000 │ │ €50.000 │
│ │ €50.000 │ │
├──────────────────────────────────┤
│ €50.000 │ €50.000 │ Zbalans.│
└──────────────────────────────────┘
↓
12:20 Dominik zatwierdza Book:
├─ Invoice.status: approved
├─ LedgerEntry 1.status: posted
├─ LedgerEntry 2.status: posted
└─ Ledger updated
↓
12:25 Notyfikacje wysłane:
├─ Czesław: "PO-2026-001 rozliczony"
├─ Katarzyna: "Licencje dostępne dla użytkowników"
└─ Dominik: "Invoice zaksiegowany — saldo 0"
↓
2026-04-05 Payment deadline — TechSupply wystawia nota obciążeniową
Struktura JSON: PurchaseOrder (PZ)
{
"resourceType": "Document",
"id": "po-2026-001",
"identifier": [{
"system": "https://api-erp.kamsoft.pl/ns/purchase-order",
"value": "PO-2026-001"
}],
"type": {
"coding": [{
"system": "https://api-erp.kamsoft.pl/ns/document-type",
"code": "purchaseOrder",
"display": "Zamówienie Zakupu"
}]
},
"issueDate": "2026-02-20",
"date": "2026-02-20",
"party": [
{
"name": "Customer",
"reference": { "reference": "Party/kamsoft-001" }
},
{
"name": "Supplier",
"reference": { "reference": "Party/techsupply-001" }
}
],
"position": [
{
"positionNo": 1,
"type": {
"coding": [{
"system": "https://api-erp.kamsoft.pl/ns/document-position-type",
"code": "order-line",
"display": "Linia Zamówienia"
}]
},
"product": { "reference": "ProductDefinition/oprogramowanie-lic-001" },
"quantity": {
"value": 1000,
"unit": "license"
},
"unitPrice": {
"value": 50,
"currency": "EUR"
},
"amount": {
"value": 50000,
"currency": "EUR"
}
}
],
"amount": {
"value": 50000,
"currency": "EUR"
},
"status": "approved",
"category": [
{
"coding": [{
"system": "https://api-erp.kamsoft.pl/ns/priority",
"code": "normal",
"display": "Normalna"
}]
}
]
}
Struktura JSON: GoodsReceipt (WZ)
{
"resourceType": "Document",
"id": "gr-2026-001",
"identifier": [{
"system": "https://api-erp.kamsoft.pl/ns/goods-receipt",
"value": "GR-2026-001"
}],
"type": {
"coding": [{
"system": "https://api-erp.kamsoft.pl/ns/document-type",
"code": "goodsReceipt",
"display": "Zaświadczenie o Przyjęciu"
}]
},
"issueDate": "2026-02-28",
"date": "2026-02-28",
"sourceDocument": { "reference": "Document/po-2026-001" },
"party": [
{
"name": "Receiver",
"reference": { "reference": "Party/kamsoft-001" }
},
{
"name": "Supplier",
"reference": { "reference": "Party/techsupply-001" }
}
],
"position": [
{
"positionNo": 1,
"sourceDocumentPositionNo": 1,
"product": { "reference": "ProductDefinition/oprogramowanie-lic-001" },
"quantity": {
"value": 1000,
"unit": "license"
},
"location": { "reference": "Location/loc-wh-main-001" },
"status": "received",
"receivedDate": "2026-02-28"
}
],
"status": "completed"
}
Struktura JSON: Invoice
{
"resourceType": "Document",
"id": "inv-2026-5001",
"identifier": [{
"system": "https://api-erp.kamsoft.pl/ns/invoice",
"value": "INV-2026-5001"
}],
"type": {
"coding": [{
"system": "https://api-erp.kamsoft.pl/ns/document-type",
"code": "invoice",
"display": "Faktura"
}]
},
"issueDate": "2026-03-05",
"date": "2026-03-05",
"dueDate": "2026-04-05",
"sourceDocument": { "reference": "Document/gr-2026-001" },
"party": [
{
"name": "Customer",
"reference": { "reference": "Party/kamsoft-001" }
},
{
"name": "Supplier",
"reference": { "reference": "Party/techsupply-001" }
}
],
"position": [
{
"positionNo": 1,
"sourceDocumentPositionNo": 1,
"product": { "reference": "ProductDefinition/oprogramowanie-lic-001" },
"quantity": {
"value": 1000,
"unit": "license"
},
"unitPrice": {
"value": 50,
"currency": "EUR"
},
"amount": {
"value": 50000,
"currency": "EUR"
},
"tax": {
"amount": {
"value": 9500,
"currency": "EUR"
},
"rate": 19
}
}
],
"amount": {
"value": 50000,
"currency": "EUR"
},
"taxAmount": {
"value": 9500,
"currency": "EUR"
},
"totalAmount": {
"value": 59500,
"currency": "EUR"
},
"status": "approved"
}
Struktura JSON: Inventory Update
{
"resourceType": "Inventory",
"id": "inv-oprogramowanie-wh-main",
"identifier": [{
"system": "https://api-erp.kamsoft.pl/ns/inventory-id",
"value": "INV-OPR-WH-MAIN"
}],
"location": { "reference": "Location/loc-wh-main-001" },
"product": { "reference": "ProductDefinition/oprogramowanie-lic-001" },
"quantityOnHand": 1000,
"lastUpdated": "2026-02-28T09:45:00Z",
"status": "active"
}
Struktura JSON: LedgerEntry (2 wpisy)
Entry 1 — Koszt Zakupów (Debit):
{
"resourceType": "LedgerEntry",
"id": "le-inv-2026-5001-dr",
"ledger": { "reference": "Ledger/general-ledger" },
"account": { "reference": "LedgerAccount/1000" },
"amount": { "value": 50000, "currency": "EUR" },
"entrySide": {
"coding": [{
"system": "https://api-erp.kamsoft.pl/ns/entry-side",
"code": "debit",
"display": "Wn"
}]
},
"date": "2026-03-05",
"sourceDocument": { "reference": "Document/inv-2026-5001" },
"sourcePositionNo": 1,
"comment": "Faktura INV-2026-5001 — Koszt Oprogramowania",
"status": "posted"
}
Entry 2 — Zobowiązania Dostawcy (Credit):
{
"resourceType": "LedgerEntry",
"id": "le-inv-2026-5001-cr",
"ledger": { "reference": "Ledger/general-ledger" },
"account": { "reference": "LedgerAccount/2110" },
"amount": { "value": 50000, "currency": "EUR" },
"entrySide": {
"coding": [{
"system": "https://api-erp.kamsoft.pl/ns/entry-side",
"code": "credit",
"display": "Ma"
}]
},
"date": "2026-03-05",
"sourceDocument": { "reference": "Document/inv-2026-5001" },
"sourcePositionNo": 1,
"comment": "Faktura INV-2026-5001 — Zobowiązania wobec TechSupply",
"status": "posted"
}
Workflow II: Liczenie Magazynu → Korekta Zapasów → Księgowanie
Scenariusz: Koniec okresu księgowego. Magazyn przeprowadza liczenie fizyczne (cycle count). Wyniki: brakuje 50 jednostek produktu (różnica: 50 pcs). Wytworzenie dokumentu korekty i księgowania rozbieżności.
Uczestnicy: - Pracownicy WMS: Jakub Górski (Party: jakub-g-001), Lech Nowak (Party: lech-n-001) - Kierownik WMS: Jakub Górski (Party: jakub-g-001) - Księgowy: Dominik Lewandowski (Party: dominik-l-001) - Produkty: Części zamienne (Part ID: part-001), Opakowania (Part ID: pack-001) - Magazyn: Centralny (Location: loc-wh-main-001)
Diagram Procesu:
flowchart TB
Start["🗂️ Liczenie Magazynu<br/>loc-wh-main-001"]
Start --> Count["📊 Pracownicy liczą fizycznie:<br/>part-001: 950 pcs (system: 1000)<br/>Różnica: -50"]
Count --> RegisterCount["📝 Rejestracja Wyniku<br/>InventoryCount dokument"]
RegisterCount --> Analyze["🔍 Analiza Rozbieżności<br/>Przyczyna: uszkodzenia, straty?"]
Analyze --> CreateAdj["➕ Tworzenie Dokumentu Korekty<br/>(Inventory Adjustment)<br/>Kwota: 50 pcs × €100 = €5.000"]
CreateAdj --> UpdateInv["⚙️ Aktualizacja Inventory<br/>quantityOnHand: 1000 → 950"]
UpdateInv --> GL["📖 Księgowanie Rozbieżności:<br/>Dr 7200 (Straty) €5.000<br/>Cr 1000 (Zapasy) €5.000"]
GL --> End["✅ Zamknięty Period"]
style Start fill:#e1f5ff
style End fill:#c8e6c9
Timeline Szczegółowy:
2026-02-28 09:00 Jakub i Lech rozpoczynają liczenie fizyczne:
└─ InventoryCount dokument otwarty
↓
09:00-16:00 Liczenie wszystkich pozycji w magazynie:
├─ part-001: 950 pcs (system: 1000)
├─ pack-001: 5.000 pcs (system: 5.000) ✓
└─ oprogramowanie-lic-001: 1.000 ✓
↓
16:30 Wynik liczenia:
├─ Rozbieżność znaleziona: part-001 -50 pcs
├─ Kwota: 50 × €100 = €5.000
└─ Przyczyna: do ustalenia
↓
17:00 Jakub wpisuje wynik do systemu:
├─ InventoryCount.location: loc-wh-main-001
├─ InventoryCount.item[1]:
│ ├─ product: part-001
│ ├─ physicalQuantity: 950
│ ├─ systemQuantity: 1000
│ └─ variance: -50
└─ status: completed
↓
17:30 System generuje Inventory Adjustment:
├─ Document.type: inventoryAdjustment
├─ sourceDocument: InventoryCount
├─ position[1]:
│ ├─ product: part-001
│ ├─ quantity: -50 (negative = loss)
│ └─ amount: €5.000
└─ status: pending
↓
18:00 Jakub zatwierdza Adjustment:
└─ status: approved
↓
18:15 System aktualizuje Inventory:
└─ Inventory[part-001]:
├─ quantityOnHand: 1000 → 950
├─ lastUpdated: 2026-02-28T18:15
└─ quantityReserved: 0
↓
2026-03-01 08:00 Dominik otrzymuje notyfikację:
└─ "Adjustment ADJ-2026-001 — wymagane księgowanie"
↓
09:00 Dominik tworzy Ledger Entries (dekretacja):
Entry 1 — Straty zapasów (Wn):
├─ account: 7200 (Straty)
├─ amount: €5.000
├─ entrySide: debit
├─ sourceDocument: ADJ-2026-001
└─ status: pending
Entry 2 — Zmniejszenie zapasów (Ma):
├─ account: 1000 (Zapasy)
├─ amount: €5.000
├─ entrySide: credit
├─ sourceDocument: ADJ-2026-001
└─ status: pending
↓
09:30 System wyświetla Adjustment Summary:
┌────────────────────────────────────┐
│ Period: 2026-02-01 → 2026-02-28 │
│ Location: Warehouse Main │
│ Items counted: 3 │
│ Variance items: 1 │
│ Total variance amount: €5.000 │
└────────────────────────────────────┘
↓
10:00 Dominik zatwierdza Book:
├─ Adjustment.status: posted
├─ LedgerEntry[1].status: posted
├─ LedgerEntry[2].status: posted
└─ Period: closed for inventory
↓
10:15 Notyfikacje:
├─ Jakub: "Adjustment ADJ-2026-001 zaksiężony"
├─ Kierownictwo: "Ubytek €5.000 wyjaśnić"
└─ Dominik: "Period Feb 2026 — Inventory closed"
Struktura JSON: InventoryCount
{
"resourceType": "InventoryDocument",
"id": "inv-count-2026-02-28",
"identifier": [{
"system": "https://api-erp.kamsoft.pl/ns/inventory-count",
"value": "COUNT-2026-02-28"
}],
"type": {
"coding": [{
"system": "https://api-erp.kamsoft.pl/ns/document-type",
"code": "inventoryCount",
"display": "Liczenie Magazynu"
}]
},
"date": "2026-02-28",
"location": { "reference": "Location/loc-wh-main-001" },
"position": [
{
"positionNo": 1,
"product": { "reference": "ProductDefinition/part-001" },
"systemQuantity": {
"value": 1000,
"unit": "pcs"
},
"physicalQuantity": {
"value": 950,
"unit": "pcs"
},
"variance": {
"value": -50,
"unit": "pcs"
},
"varianceAmount": {
"value": 5000,
"currency": "EUR"
}
},
{
"positionNo": 2,
"product": { "reference": "ProductDefinition/pack-001" },
"systemQuantity": {
"value": 5000,
"unit": "pcs"
},
"physicalQuantity": {
"value": 5000,
"unit": "pcs"
},
"variance": {
"value": 0,
"unit": "pcs"
}
}
],
"status": "completed"
}
Struktura JSON: Inventory Adjustment
{
"resourceType": "Document",
"id": "adj-2026-001",
"identifier": [{
"system": "https://api-erp.kamsoft.pl/ns/adjustment",
"value": "ADJ-2026-001"
}],
"type": {
"coding": [{
"system": "https://api-erp.kamsoft.pl/ns/document-type",
"code": "inventoryAdjustment",
"display": "Korekta Zapasów"
}]
},
"date": "2026-02-28",
"sourceDocument": { "reference": "InventoryDocument/inv-count-2026-02-28" },
"location": { "reference": "Location/loc-wh-main-001" },
"position": [
{
"positionNo": 1,
"product": { "reference": "ProductDefinition/part-001" },
"quantity": {
"value": -50,
"unit": "pcs"
},
"reason": {
"coding": [{
"system": "https://api-erp.kamsoft.pl/ns/adjustment-reason",
"code": "inventory-loss",
"display": "Strata Zapasów"
}]
},
"amount": {
"value": 5000,
"currency": "EUR"
}
}
],
"totalAmount": {
"value": 5000,
"currency": "EUR"
},
"status": "posted"
}
Struktura JSON: LedgerEntry (2 wpisy)
Entry 1 — Straty Zapasów (Debit):
{
"resourceType": "LedgerEntry",
"id": "le-adj-2026-001-dr",
"ledger": { "reference": "Ledger/general-ledger" },
"account": { "reference": "LedgerAccount/7200" },
"amount": { "value": 5000, "currency": "EUR" },
"entrySide": {
"coding": [{
"system": "https://api-erp.kamsoft.pl/ns/entry-side",
"code": "debit",
"display": "Wn"
}]
},
"date": "2026-03-01",
"sourceDocument": { "reference": "Document/adj-2026-001" },
"sourcePositionNo": 1,
"comment": "Adjustment ADJ-2026-001 — Strata part-001 (50 pcs)",
"status": "posted"
}
Entry 2 — Zmniejszenie Zapasów (Credit):
{
"resourceType": "LedgerEntry",
"id": "le-adj-2026-001-cr",
"ledger": { "reference": "Ledger/general-ledger" },
"account": { "reference": "LedgerAccount/1000" },
"amount": { "value": 5000, "currency": "EUR" },
"entrySide": {
"coding": [{
"system": "https://api-erp.kamsoft.pl/ns/entry-side",
"code": "credit",
"display": "Ma"
}]
},
"date": "2026-03-01",
"sourceDocument": { "reference": "Document/adj-2026-001" },
"sourcePositionNo": 1,
"comment": "Adjustment ADJ-2026-001 — Zmniejszenie zapasów",
"status": "posted"
}
Struktura JSON: Updated Inventory
{
"resourceType": "Inventory",
"id": "inv-part-001-wh-main",
"identifier": [{
"system": "https://api-erp.kamsoft.pl/ns/inventory-id",
"value": "INV-PART-001-WH-MAIN"
}],
"location": { "reference": "Location/loc-wh-main-001" },
"product": { "reference": "ProductDefinition/part-001" },
"quantityOnHand": 950,
"quantityReserved": 0,
"quantityAvailable": 950,
"lastUpdated": "2026-02-28T18:15:00Z",
"status": "active"
}
Podsumowanie Integracji Obiektów
| Workflow | Invoice | Document (PZ/WZ) | Location | Inventory | Product | Ledger | LedgerEntry |
|---|---|---|---|---|---|---|---|
| I | ✅ Invoice | ✅ PO, GR | ✅ WH-Main | ✅ On-Hand | ✅ Oprogram. | ✅ GL | ✅ Dr/Cr |
| II | ❌ - | ✅ Adjustment | ✅ WH-Main | ✅ Count, Adjust | ✅ part-001 | ✅ GL | ✅ Dr/Cr |
Lekcje: 1. Dokumenty (Invoice, PZ/WZ, Adjustment) są źródłem dla LedgerEntry (sourceDocument) 2. Inventory odzwierciedla transakcje (przyjęcia, korekt) 3. Location określa miejsce przechowywania 4. Product/ProductDefinition jest referencją wspólną 5. Ledger + LedgerEntry tworzą ścieżkę audytu finansową 6. Przepływ: Document → Inventory → Ledger Entry (finansowe wyniki biznesowe)