Edit Report:Cust Sales History (SHP2) (Details with cost)

Menu Anchors
'customers', 'orders', 'sales', 'payables', 'warehouse', 'dispatching', 'receivables', 'payables-dash', 'inventory', 'purchases', 'generallendger', 'users',
-- Cust Sales History (SHP2) (Details with cost) -- Customer Sales History Details with cost -- VARIABLE: { -- name: "range", -- display: "Report Range", -- type: "daterange", -- default: { start: "first day of last month", end: "last day of last month" } -- } -- VARIABLE: { -- name: "debtorno", -- display: "Cust Number", -- type: "text", -- } -- ROLLUP: { -- columns: { -- "Sales Amt": "{{ sum }}", -- "Cost": "{{ sum }}", -- "Qty Sld": "{{ sum }}", -- "Profit": "{{ sum }}", -- "stockid": "{{ count }}" -- } --} select s.debtorno as `CustNo`, d.name as `Cust Name`, s.trandate as`Date`, s.orderno as `Order`, s.transno as `Invoice`, stockid, CAST(sum(s.qty*-1) as DECIMAL(10,2)) as `Qty Sld`, CAST(sum(s.discountedlinetotal*-1) as DECIMAL(10,2)) as `Sales Amt`, CAST(sum(s.costtotal*-1) as DECIMAL(10,2)) as `Cost`, CAST(sum( (s.discountedlinetotal-s.costtotal) * - 1 ) as DECIMAL(10,2)) AS Profit, CAST(((sum(s.discountedlinetotal-s.costtotal)/sum( s.discountedlinetotal)) * 100 ) as DECIMAL(10,2))AS `Profit%` from stocktrans s left join debtorsmaster d on s.debtorno = d.debtorno where s.trandate between "{{ range.start }}" AND "{{ range.end }}" {% if debtorno != '' %} and s.debtorno = '{{ debtorno }}' {% endif %} group by s.transno, stockid, s.price order by s.debtorno, s.orderno, s.transno, stockid
Preview Save Changes Cancel

Preview Changes hide