Edit Report:Brand Report
Menu Anchors
'customers', 'orders', 'sales', 'payables', 'warehouse', 'dispatching', 'receivables', 'payables-dash', 'inventory', 'purchases', 'generallendger', 'users',-- Brand Report
--
-- ^payables
-- VARIABLE: {
-- name: "range",
-- display: "Report Range",
-- type: "daterange",
-- format: "Y-m-d",
-- default: { start: "first day of this month", end: "yesterday" },
-- }
-- VARIABLE: {
-- name: "brand",
-- display: "Brand",
-- type: "select",
-- database_options: { table: "manufacturer", display: "name", column: "manufacturer_id", order:{ column: "name" , order: "ASC"} },
-- multiple:true,
-- empty:true,
-- }
-- ROLLUP: {
-- columns: {
-- "TOTAL": "Total: {{sum}}",
-- "QTY": "Total: {{sum}}"
-- }
-- }
-- FILTER: {
-- filter: "class",
-- column: "QTY",
-- params: {
-- class: "text-center"
-- }
-- }
-- FILTER: {
-- filter: "class",
-- column: "TOTAL",
-- params: {
-- class: "text-right"
-- }
-- }
SELECT
CASE WHEN brand is null then 'Not on File' else brand end as BRAND,
CAST(sum( qty * - 1 ) as DECIMAL(10,0)) AS QTY,
CAST(sum( discountedlinetotal * - 1 ) as DECIMAL(10,2)) as TOTAL
FROM
stocktrans
left join mfgpartbrandtostockid on stocktrans.stockid = mfgpartbrandtostockid.stockid
WHERE
1
and date(trandate) between date("{{ range.start }}") AND date("{{ range.end }}")
{% if brand[0] != '' %}
{% if brand|length > 0 %}
and mfgpartbrandtostockid.brandid in (
{% for m in brand %}
'{{ m }}'
{{ not loop.last ? ',' }}
{% endfor %})
{% endif %}
{% endif %}
group by brand
order by brand asc