class CrosstabReport(ReportView):
report_title = _("Cross tab Report")
report_description = _("A basic crosstab: clients as rows, products as columns. "
"Each cell holds the sales value for that client–product combination, "
"with a total column on the right.")
report_model = SalesTransaction
group_by = "client"
# date_field = "date"
columns = [
"name",
# You can customize where the crosstab columns are displayed in relation to the other columns
"__crosstab__",
# This is the same as the calculation in the crosstab,
# but this one will be on the whole set. IE total value.
ComputationField.create(Sum, "value", verbose_name=_("Total Value")),
]
crosstab_field = "product"
crosstab_columns = [
ComputationField.create(Sum, "value", verbose_name=_("Value")),
]