Profit Loss Report
profit-loss-report is the query behind the Financial Report applet’s top-level Profit and Loss Report menu item — not the “Financial Report” menu’s own P&L view, a different screen entirely. Unlike the other two pages in this section, this endpoint does not return raw GL rows: it builds the full statement structure — subtotals, GROSS PROFIT, margins and all — server-side, because the applet normally does that assembly in the browser and an external integration needs it done for it.
Path: POST /core2/tnt/dm/erp/fi/financial-reports/profit-loss-report/etl-ep
Request body: FinancialReportInputDto as JSON
Response envelope: ApiResponse — {"code": "OK_RESPONSE", "data": [ … ], "message": ""}, no paging fields. See the family page.
fi/ segment that the other two reports in this section don’t. SalesReportController and StockReportController sit under .../erp/reports/...; this one sits under .../erp/fi/financial-reports/.... Leaving out fi/ returns a generic “no static resource” 404 that looks like a routing problem rather than a typo in the path.See Applet Reports API for authentication.
Request fields
| Field | Type | Default | Notes |
|---|---|---|---|
date_from, date_to | ZonedDateTime | now | |
branch_guids | Set<UUID> | empty | Send this or one of the four below — not several at once; the applet’s Group By control decides which. |
gl_dimension_guids | Set<UUID> | empty | |
segment_guids | Set<UUID> | empty | |
profit_center_guids | Set<UUID> | empty | |
project_guids | Set<UUID> | empty | |
company_guids | Set<UUID> | empty | Never sent by the applet under any Group By choice. |
cost_type | enum string | cogs | One of cogs (MA), cogs_wa (WA), cogs_fifo (FIFO), cogs_lifo (LIFO), cogs_replacement (Replacement), cogs_manual (Manual) — the applet’s own label-to-value mapping. |
Sending more than one of the five group-by guid sets is not something the applet does and has not been tested; sending none of them at all also has not been tested — always send exactly one, matching the applet.
Filter dropdowns
The five group-by dropdowns:
POST /core2/tnt/dm/erp/drop-down/branch/etl-ep
POST /core2/tnt/dm/erp/drop-down/gl-dimension/etl-ep
POST /core2/tnt/dm/erp/drop-down/segment/etl-ep
POST /core2/tnt/dm/erp/drop-down/profit-center/etl-ep
POST /core2/tnt/dm/erp/drop-down/project/etl-epBody and response shape: see Applet Reports API → dropdowns.
Response: a pre-built statement, not raw GL rows
The raw GL rows this query reads (gl_section, gl_category, gl_code, gl_code_descr, debit, credit, code — the branch or dimension code, guid_branch, glcode_guid) are transformed server-side into 16 ordered line items per branch/dimension code, matching exactly what constructDataRow in the applet builds client-side: purchases and purchases returns GL categories are dropped entirely before anything else happens, the remaining rows are grouped by code, and each group produces the 16 lines below.
{
"index": 3,
"glSection": "Net Sales",
"glCategory": "Net Sales",
"glCode": "Net Sales",
"descr": "",
"amount": 412650.00,
"branch_code": "GS-KV-01",
"guid_branch": null,
"glcode_guid": null
}index gives the applet’s display order — sort/group by it to reconstruct the statement in the right sequence:
index | Line | Kind | Sign convention |
|---|---|---|---|
| 1 | Sales Revenue lines | raw GL | credit − debit |
| 2 | Sales Expenses lines | raw GL | credit − debit |
| 3 | Net Sales | computed subtotal | sum of 1 + 2 |
| 4 | Cost Of Goods Sold lines | raw GL | debit − credit |
| 5 | Cost of Goods Sold – Gains lines | raw GL | debit − credit |
| 6 | Cost of Goods Sold – Expenses lines | raw GL | debit − credit |
| 7 | Total Cost of Goods Sold | computed subtotal | sum of 4 + 5 + 6, sign flipped |
| 8 | GROSS PROFIT/(LOSS) | computed subtotal | 1 + 2 + 4 + 5 + 6, credit − debit convention |
| 9 | GROSS MARGIN | computed % | line 8 ÷ line 3 × 100 |
| 10 | General Expenses lines | raw GL | credit − debit |
| 11 | Other Revenues lines | raw GL | credit − debit |
| 12 | Other Expenses lines | raw GL | credit − debit |
| 13 | PROFIT BEFORE TAXES | computed subtotal | lines 1+2+4+5+6+10+11+12 |
| 14 | Tax Expenses lines | raw GL | credit − debit |
| 15 | NET PROFIT/(LOSS) | computed subtotal | lines 1+2+4+5+6+10+11+12+14 |
| 16 | PROFIT MARGIN | computed % | line 15 ÷ line 3 × 100 |
Raw-GL rows (indices 1, 2, 4, 5, 6, 10, 11, 12, 14) carry real glCategory, glCode, guid_branch and glcode_guid values, one row per GL code with activity in the period. Computed rows (3, 7, 8, 9, 13, 15, 16) carry the label in all three of glSection/glCategory/glCode and null for both GUID fields — filter on whether guid_branch is null if you need to separate the two kinds programmatically rather than matching on index.
To render a pivot table with branch (or dimension) codes as columns, the way the applet’s own grid does, group by (index, glSection, glCategory, glCode) and pivot branch_code into columns of amount.
branch_code in the response is enough to identify the row without it. Mentioned here only so its absence from this endpoint’s response isn’t mistaken for a gap.Example
curl -X POST "https://api-etl.akaun.com/core2/tnt/dm/erp/fi/financial-reports/profit-loss-report/etl-ep" \
-H "AccessId: YOUR_ACCESS_ID" \
-H "AccessKey: YOUR_ACCESS_KEY" \
-H "tenantCode: YOUR_TENANT_CODE" \
-H "Content-Type: application/json" \
-d '{
"branch_guids": ["3f2a7c10-9b4e-4d61-8a22-1c5e7f9d0b33", "6b8d1f42-7e35-4c09-ad81-1d4e8b2c5a70"],
"date_from": "2026-08-01T00:00:00+08:00",
"date_to": "2026-09-30T23:59:59+08:00",
"cost_type": "cogs_wa"
}'Related
- Applet Reports API — shared auth, envelope shapes, dropdowns
- Authentication
- Data API — hosts, headers, limits shared by every
etl-epcall