Get Sales Report
Closed sales for the dashboard's map and the listing beside it.
"Closed sale" here is Viatura.fechado = 1 AND Contratos.IDestado = 2 — a car actually sold on a closed contract, both flags written atomically by close_vehicle_with_contract. It is NOT the CRM's "lead ganha": a lead cannot be won without a contract, but plenty of sales (walk-ins, imported history) never had a lead at all, and those are sales too.
Takes the dashboard's own filters (year, month, PV, team), all multi-select and all "empty means everything".
Returns {items, summary}. Nothing is filtered out — a sale whose buyer has no readable postal code is still a sale; it lands in the "Desconhecido" bucket, appears in the listing, and is counted in the totals (and in summary.sem_localizacao). Hiding it would make this card disagree with the sales figures on the rest of the dashboard.
Not cached — same reason as the /detail endpoints above: items is an unbounded fetchall() and a large entry evicts the auth cache.
Query parameters
Headers
Response
Successful Response
Changes
Changed in 1 of the 15 revisions of this API.1
- ○
endpoint added
endpoint-added
- ○