Edit Report:Sales By Product Line for a Customer (CPSLS)
Menu Anchors
'customers', 'orders', 'sales', 'payables', 'warehouse', 'dispatching', 'receivables', 'payables-dash', 'inventory', 'purchases', 'generallendger', 'users',-- Sales By Product Line for a Customer (CPSLS)
-- Product Line Sales for a Customer
-- PLACE HOLDER REPORT FILTERS AND DRILL DOWN
-- VARIABLE: {
-- name: "range",
-- display: "Report Range",
-- type: "daterange",
-- default: { start: "first day of this month", end: "last day of this month" }
-- }
-- VARIABLE: {
-- name: "CUSTOMERNO",
-- display: "Customer Number",
-- type: "text",
-- }
-- ROLLUP: {
-- columns: {
-- "SALES AMT ONLY": "Total: {{sum}}",
-- "QUANTITY": "Total: {{sum}}"
-- }
-- }
SELECT
s.debtorno AS CUSTOMERNO,
d.name AS CUSTOMER,
s.lineid AS LINEID,
p.line_description AS PRDLINE,
CAST(sum( discountedlinetotal * - 1 ) as DECIMAL(10,2)) AS `SALES AMT ONLY`,
CAST(sum( qty * - 1 ) as DECIMAL(10,0)) AS `QUANTITY`
FROM
stocktrans s
Left Join debtorsmaster d ON s.debtorno = d.debtorno
Left Join productlines p ON p.line_field = s.lineid
where trandate between "{{ range.start }}" AND "{{ range.end }}"
and s.debtorno like '{{ CUSTOMERNO }}'
group by s.debtorno, s.lineid
order by s.lineid asc