Edit Report:Branch Sales by Vendor (PH)
Menu Anchors
'customers', 'orders', 'sales', 'payables', 'warehouse', 'dispatching', 'receivables', 'payables-dash', 'inventory', 'purchases', 'generallendger', 'users',-- Branch Sales by Vendor (PH)
-- Salesman or Store
-- ^purchases
-- VARIABLE: {
-- name: "range",
-- display: "Report Range",
-- type: "daterange",
-- default: { start: "first day of last month", end: "last day of last month" }
-- }
-- VARIABLE: {
-- name: "salesperson",
-- display: "Salesperson",
-- type: "select",
-- database_options: { table: "salesman", display: "salesmanname", column: "salesmancode", order:{ column: "salesmancode" , order: "ASC"} },
-- multiple:true,
-- empty:true,
-- }
-- VARIABLE: {
-- name: "vendor",
-- display: "Vendor",
-- type: "select",
-- database_options: { table: "purchdata", display: "supplierno", column: "supplierno", order:{ column: "supplierno" , order: "ASC"} },
-- multiple:true,
-- empty:true,
-- }
--
select loccode as `Branch`, salesperson as `Salesperson`, CAST( sum(discountedlinetotal * -1) AS DECIMAL(10,2)) as `Total Sales`, CAST( sum(qty * -1) AS DECIMAL(10,2)) as `Total Qty`
from stocktrans where trandate between "{{ range.start }}" AND "{{ range.end }}"
and supplierid like '%{{ vendor }}%' and salesperson like '%{{ salesperson }}%'
and enteredby != 'WO' group by loccode, stocktrans.supplierid, salesperson
order by loccode, supplierid, salesperson ASC;