Edit Report:Luxury Brand Manager Sales by Brand
Menu Anchors
'customers', 'orders', 'sales', 'payables', 'warehouse', 'dispatching', 'receivables', 'payables-dash', 'inventory', 'purchases', 'generallendger', 'users',-- Luxury Brand Manager Sales by Brand
-- Select Date Range. Select Sales Rep or All. Type Supplier No or Leave Blank.
-- ^Monthly Reports
-- VARIABLE: {
-- name: "range",
-- display: "Report Range",
-- type: "daterange",
-- default: { start: "first day of last month", end: "yesterday" }
-- }
-- VARIABLE: {
-- name: "salesman",
-- display: "Salesman",
-- type: "select",
-- database_options: { table: "salesman", display: "salesmanname", column: "salesmancode", where: " current = 1 and commissionrate2 = 5 " , order:{ column: "salesmanname" , order: "ASC"} },
-- multiple:true,
-- }
-- VARIABLE: {
-- name: "supplierno",
-- display: "Supplier Code",
-- type: "text",
-- }
-- ROLLUP: {
-- columns: {
-- "Total Sales": "Total: {{sum}}"
-- }
-- }
--
SELECT
loccode AS 'Location',
salesmanname AS 'Salesman',
salesperson AS 'Salesman No',
supplierno AS 'Supplier Code',
suppliername AS 'Supplier Name',
( SUM( discountedlinetotal )* - 1 ) AS 'Total Sales'
FROM
stocktrans
WHERE
1
AND trandate BETWEEN '{{ range.start }}' AND '{{ range.end }}'
AND supplierno IN ('OR','RC','SJ','AH', 'IF', 'MM', 'CBB')
{% if salesman|first != '' and salesman is not empty %}
and salesperson in (
{% for s1 in salesman %}
'{{ s1 }}'{% if not loop.last %}, {% endif %}
{% endfor %}
)
{% endif %}
GROUP BY
supplierno,
salesperson
ORDER BY
supplierno,
'Total Sales' ASC