418
Sales & receivables
Accounts receivable
Who owes us money and how late it is. Amounts in THB at each invoice's rate.
Aging by customer
Click a customer for the statement| Name | Docs | Not due | 1-30 | 31-60 | 61-90 | 90+ | Total |
|---|---|---|---|---|---|---|---|
| Chao Phraya Logistics PLC | 2 | 243,960.00 | 243,960.00 | 0.00 | 0.00 | 0.00 | 487,920.00 |
| Rhine Software GmbH | 2 | 226,419.77 | 259,518.47 | 0.00 | 0.00 | 0.00 | 485,938.24 |
| Andaman Hotels Group Co., Ltd. | 1 | 385,200.00 | 0.00 | 0.00 | 0.00 | 0.00 | 385,200.00 |
| Siam Retail Co., Ltd. | 1 | 0.00 | 249,909.20 | 0.00 | 0.00 | 0.00 | 249,909.20 |
| Pacific Trading Pte. Ltd. | 1 | 0.00 | 227,538.45 | 0.00 | 0.00 | 0.00 | 227,538.45 |
| Northern Craft Co., Ltd. | 2 | 0.00 | 64,200.00 | 0.00 | 0.00 | 64,200.00 | 128,400.00 |
| Napat Wongsakul | 2 | 0.00 | 28,890.00 | 0.00 | 10,432.50 | 0.00 | 39,322.50 |
| Total | 11 | 855,579.77 | 1,074,016.12 | 0.00 | 10,432.50 | 64,200.00 | 2,004,228.39 |
Open invoices
| Invoice | Customer | Due | Status | Outstanding | |
|---|---|---|---|---|---|
| INV-2026-0032 | Northern Craft Co., Ltd. | 9 Jul 2026 123 d late | Open | 64,200.00 THB | Receive |
| INV-2026-0046 | Napat Wongsakul | 4 Sep 2026 66 d late | Partly paid | 10,432.50 THB | Receive |
| INV-2026-0048 | Chao Phraya Logistics PLC | 20 Oct 2026 20 d late | Open | 243,960.00 THB | Receive |
| INV-2026-0050 | Rhine Software GmbH | 26 Oct 2026 14 d late | Open | 6,700.00 EUR | Receive |
| INV-2026-0051 | Siam Retail Co., Ltd. | 1 Nov 2026 8 d late | Open | 249,909.20 THB | Receive |
| INV-2026-0057 | Napat Wongsakul | 4 Nov 2026 5 d late | Open | 28,890.00 THB | Receive |
| INV-2026-0053 | Pacific Trading Pte. Ltd. | 6 Nov 2026 3 d late | Open | 6,750.00 USD | Receive |
| INV-2026-0054 | Northern Craft Co., Ltd. | 8 Nov 2026 1 d late | Open | 64,200.00 THB | Receive |
| INV-2026-0056 | Andaman Hotels Group Co., Ltd. | 14 Nov 2026 | Open | 385,200.00 THB | Receive |
| INV-2026-0052 | Chao Phraya Logistics PLC | 19 Nov 2026 | Open | 243,960.00 THB | Receive |
| INV-2026-0055 | Rhine Software GmbH | 25 Nov 2026 | Open | 5,810.00 EUR | Receive |
Customers
| Siam Retail Co., Ltd.
C001 · THB · 30 days |
Invoice |
| Chao Phraya Logistics PLC
C002 · THB · 45 days |
Invoice |
| Northern Craft Co., Ltd.
C003 · THB · 30 days |
Invoice |
| Andaman Hotels Group Co., Ltd.
C004 · THB · 30 days |
Invoice |
| Pacific Trading Pte. Ltd.
C005 · USD · 30 days |
Invoice |
| Rhine Software GmbH
C006 · EUR · 45 days |
Invoice |
| Sakura Systems K.K.
C007 · JPY · 30 days |
Invoice |
| Napat Wongsakul
C008 · THB · 15 days · person |
Invoice |
How this works - feature 418 Who owes us what, and for how long.
Concepts
- Aging buckets: not due, 1-30, 31-60, 61-90, over 90 days late.
- CROSS APPLY computes days late once per row so the CASE expressions stay short.
- The customer statement uses a window function per currency for the running balance.
Read the code
service/TrackingService#arAgingservice/TrackingService#statement
SQL behind this page
SELECT p.id, p.code, p.name, COUNT(*) AS docs,
SUM(CASE WHEN x.days_late <= 0 THEN x.thb ELSE 0 END) AS not_due,
SUM(CASE WHEN x.days_late BETWEEN 1 AND 30 THEN x.thb ELSE 0 END) AS d1_30,
SUM(CASE WHEN x.days_late BETWEEN 31 AND 60 THEN x.thb ELSE 0 END) AS d31_60,
SUM(CASE WHEN x.days_late BETWEEN 61 AND 90 THEN x.thb ELSE 0 END) AS d61_90,
SUM(CASE WHEN x.days_late > 90 THEN x.thb ELSE 0 END) AS d90_plus,
SUM(x.thb) AS total
FROM invoice i
JOIN party p ON p.id = i.customer_id
CROSS APPLY (SELECT DATEDIFF(day, i.due_date, :today) AS days_late,
ROUND(i.outstanding * i.fx_rate, 2) AS thb) x
WHERE i.status IN ('ISSUED','PARTIAL')
GROUP BY p.id, p.code, p.name
ORDER BY total DESC