Edit Report:Supplier Sales Out with Invoice Numbers
Menu Anchors
'customers', 'orders', 'sales', 'payables', 'warehouse', 'dispatching', 'receivables', 'payables-dash', 'inventory', 'purchases', 'generallendger', 'users',-- Supplier Sales Out with Invoice Numbers
-- PLACE HOLDER REPORT DESCRIPTION
-- PLACE HOLDER REPORT FILTERS AND DRILL DOWN
-- VARIABLE: {
-- name: "range",
-- display: "Report Range",
-- type: "daterange",
-- default: { start: "first day of last month", end: "yesterday" }
-- }
-- VARIABLE: {
-- name: "supplierno",
-- display: "Supplier Code",
-- type: "text",
-- }
-- VARIABLE: {
-- name: "categoryid",
-- display: "Category",
-- type: "text",
-- }
SELECT
loccode,
trandate,
transno,
s.debtorno,
s.branchcode,
s.brname,
s.stockid,
s.description,
s.lineid,
s.categoryid,
s.supplierno,
p.suppliers_partno,
sum( qty * -1) AS totalsold,
CAST(AVG( s.price ) AS DECIMAL ( 10, 2 )) AS avgprice,
sum(discountedlinetotal * -1 ) AS totalsales
FROM
stocktrans s
inner join purchdata p on s.stockid = p.stockid
WHERE
s.supplierno like '{{ supplierno }}%'
and s.categoryid like '{{ categoryid }}%'
and trandate BETWEEN '{{ range.start }}' AND '{{ range.end }}'
AND loccode IN ( '00', '01', '02', '03', '04', '05', '06','07','08', '09' )
GROUP BY s.stockid, loccode
order by loccode asc