calculate_sales_totals
Calculate sales totals with filtering by date, status, location, customer, payment type, and amount. Returns revenue, tax, sale count, average value, and optional breakdowns for business analysis.
Instructions
Calculate sales totals with filtering by date range, status, location, customer, payment type, and amount. Returns total revenue, tax, sale count, average sale value, and optional breakdown by status, location, or date period.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | No | Filter by sale status | |
| location | No | Filter by location ID | |
| customer | No | Filter by customer account ID | |
| date_from | No | Filter sales created on or after this date (ISO 8601: YYYY-MM-DD) | |
| date_to | No | Filter sales created on or before this date (ISO 8601: YYYY-MM-DD) | |
| payment_type | No | Filter by payment type (cash, card, etc.) | |
| total_gte | No | Filter sales with total >= this value (in cents) | |
| total_lte | No | Filter sales with total <= this value (in cents) | |
| group_by | No | Group results by field for detailed breakdown | |
| date_interval | No | When group_by=date, aggregate by this interval (day, week, or month) |