Report on sales
Admin and branch manager. Returns revenue, VAT, day and payment splits, top sellers, sales. Gross profit uses the cost frozen on each line, so a later cost change never rewrites it.
GET
/api/v1/reports/salesAuthorization
AuthorizationBearer token (JWT) · headerrequiredJWT from POST /api/v1/auth/login sent as Authorization Bearer.
Query parameters
from_datestringFirst day of the window, YYYY-MM-DD. Defaults to thirty days ago.
to_datestringLast day of the window, YYYY-MM-DD. Defaults to today.
branch_idstringScope the report to one branch. Empty reports every branch together.
Responses
200
The sales report
from_datestringrequiredto_datestringrequiredtotal_revenuestringrequiredtotal_vatstringrequiredtotal_countintegerrequiredmin -9007199254740991 · max 9007199254740991
by_dayobject[]requiredShow propertiesHide properties
Array of
objectdaystringrequiredtotalstringrequiredcountintegerrequiredmin -9007199254740991 · max 9007199254740991
by_paymentobject[]requiredShow propertiesHide properties
Array of
objectmethodstringrequiredcountintegerrequiredmin -9007199254740991 · max 9007199254740991
totalstringrequiredtop_sellingobject[]requiredShow propertiesHide properties
Array of
objectmedicine_idstringrequiredmedicine_namestringrequiredunits_soldintegerrequiredmin -9007199254740991 · max 9007199254740991
revenuestringrequiredtotal_coststringrequiredgross_profitstringrequiredmargin_pctnumberrequiredrecentobject[]requiredShow propertiesHide properties
Array of
objectidstringrequiredinvoice_numberstringrequiredtotal_amountstringrequiredvat_amountstringrequiredpayment_methodstringrequiredsold_atstringrequiredpharmacist_namestringrequired400
from_date or to_date is not a valid YYYY-MM-DD date, or from_date is after to_date
detailstringrequired401
Not authenticated
detailstringrequired403
Caller is not an admin, branch manager, or auditor
detailstringrequired