retailAdId: 4c5099c5-9dad-47cb-9816-ae4adf77de42
Country: PL | Currency: PLN | VAT Type: 1053 | VAT Rate: 0.23
Retail Ready Date: 2025-07-07
EUR/PLN Rate: 4.2248 (derived from stored GP values)
GP = Net Sell Price + Tax Advantage
- Net Buy Price - Production Cost
- Special Tax - De-Registration - Legal Registration
- Diff Tax - Warranty Claims - WS Consumables (pricing)
Production cost is NOT simply the refurbishment budget. It uses max(estimated, actual):
Estimated = Refurbishment Budget + Exit Check + Workshop Consumable
Actual = sum(PnL INVOICE amounts) - sum(PnL CREDIT_NOTE amounts)
(only category=Refurbishment, itemType=COST, deleted=false)
Production Cost = max(Estimated, Actual)
For this stock:
- Estimated = 11,609.01 (budget) + 0 (exit check) + 187.16 (workshop) = 11,796.17 PLN
- Actual = 7,967 + 127,315 + 12,500 - 3,314 = 144,468 minor units = 1,444.68 PLN
- max(11,796, 1,445) = 11,796 → estimated wins
| # | Component | PLN | EUR | Source | DB Table |
|---|---|---|---|---|---|
| + | Net Sell Price | 72,300.00 | 17,113.70 | grossPrice from retail-ad-service. vatType=1053 so no VAT deduction: netSell = grossSell | Feign call (runtime) |
| + | Tax Advantage | 0 | 0 | pricing_cost_item (costType=tax-advantage) | retail_gross_profit.pricing_cost_item |
| - | Net Buy Price | 55,302.97 | 13,089.00 | 1,308,900 EUR cents converted to PLN at runtime | retail_gross_profit.ad_price |
| - | Production Cost | 11,796.17 | 2,792.71 | max(estimated, actual) — see breakdown below | Computed |
| — Refurb Budget | 11,609.01 | 2,748.41 | ACTIVE refurb, totalCostBudgetMinorUnits = 1,160,901 | retail_gross_profit.refurbishment |
|
| — Exit Check | 0 | 0 | No exit checks | retail_gross_profit.exit_check |
|
| — Workshop Consumable | 187.16 | 44.30 | PL/2025_07 = 4,430 EUR cents, converted to PLN | retail_gross_profit.workshop_consumable_cost |
|
| — Actual PnL Cost | 1,444.68 | 342.00 | 4 invoices (INVOICE) - 0 (CREDIT_NOTE) | retail_gross_profit.pnl_item |
|
| — Winner | Estimated | 11,796 > 1,445 | |||
| - | Special Tax | 1,748.00 | 413.78 | pricing_cost_item (costType=special-tax) | retail_gross_profit.pricing_cost_item |
| - | De-Registration | 495.00 | 117.17 | pricing_cost_item (costType=de-registration) | retail_gross_profit.pricing_cost_item |
| - | Legal Registration | 145.00 | 34.32 | pricing_cost_item (costType=legal-registration) | retail_gross_profit.pricing_cost_item |
| - | Diff Tax | 3,178.25 | 752.53 | (72,300 - 55,302.97) x 0.23 / 1.23. Applies because vatType=1053 and grossSell > grossBuy | Computed from ad_price + adDetail |
| - | Warranty Claims | 681.00 | 161.20 | pricing_cost_item (costType=legal-warranty-and-non-warranty-claims) | retail_gross_profit.pricing_cost_item |
| - | WS Consumables | 0 | 0 | Not present in pricing_cost_item for this ad | retail_gross_profit.pricing_cost_item |
| = | Gross Profit | -1,045.39 | -251.81 | Stored as -25,181 EUR / -106,384.68 PLN minor units | retail_gross_profit.gross_profit |
| PLN | % of Sell Price | |
|---|---|---|
| Raw Margin (Sell - Buy) | 16,997.03 | 23.5% |
| Production Cost | -11,796.17 | 16.3% |
| Diff Tax | -3,178.25 | 4.4% |
| Other Costs | -3,069.00 | 4.2% |
| GP | -1,045.39 | -1.4% |
Production cost (driven by refurbishment budget) consumes 69.4% of the raw margin.
Estimated refurb budget = 11,609 PLN vs actual PnL invoices = 1,445 PLN (8x difference).
Since max(estimated, actual) = estimated, the budget drives the GP negative.
SELECT gross_profit_minor_unit, local_currency_gross_profit_amount_minor_unit
FROM retail_gross_profit.gross_profit
WHERE retail_ad_id = '4c5099c5-9dad-47cb-9816-ae4adf77de42';
-- Result: -25,181 EUR | -106,384.68 PLNSELECT price_type, amount_minor_unit, currency
FROM retail_gross_profit.ad_price
WHERE retail_ad_id = '4c5099c5-9dad-47cb-9816-ae4adf77de42';
-- Result: NET_BUY_PRICE 1,308,900 EUR | GROSS_BUY_PRICE 1,308,900 EURSELECT state, total_cost_budget_minor_units, currency_code
FROM retail_gross_profit.refurbishment
WHERE retail_ad_id = '4c5099c5-9dad-47cb-9816-ae4adf77de42';
-- Result: ACTIVE, 1,160,901 PLNSELECT amount_in_minor_units, currency
FROM retail_gross_profit.workshop_consumable_cost
WHERE country = 'PL' AND year_month = '2025_07';
-- Result: 4,430 EUR cents (44.30 EUR)SELECT cost_type, amount_minor_unit, currency
FROM retail_gross_profit.pricing_cost_item
WHERE retail_ad_id = '4c5099c5-9dad-47cb-9816-ae4adf77de42';
-- Key items used in GP formula:
-- special-tax: 174,800 PLN cents
-- tax-advantage: 0
-- de-registration: 49,500 PLN cents
-- legal-registration: 14,500 PLN cents
-- legal-warranty-and-non-warranty-claims: 68,100 PLN cents
-- workshop-consumables: not present (defaults to 0)SELECT category, item_type, invoice_type, net_amount_minor_units, currency_code, deleted
FROM retail_gross_profit.pnl_item
WHERE retail_ad_id = '4c5099c5-9dad-47cb-9816-ae4adf77de42';
-- 4 refurbishment INVOICE items totaling 144,468 PLN cents (1,444.68 PLN)
-- Filtered by: deleted=false, category=Refurbishment, itemType=COST
-- INVOICE amounts summed, CREDIT_NOTE amounts subtractedSELECT item_type, item_state, amount_minor_units, currency_code
FROM retail_gross_profit.exit_check
WHERE retail_ad_id = '4c5099c5-9dad-47cb-9816-ae4adf77de42';
-- Result: noneSELECT *
FROM retail_gross_profit.gross_profit_input_context
WHERE retail_ad_id = '4c5099c5-9dad-47cb-9816-ae4adf77de42';