Edit Report:GL CLass Report
Menu Anchors
'customers', 'orders', 'sales', 'payables', 'warehouse', 'dispatching', 'receivables', 'payables-dash', 'inventory', 'purchases', 'generallendger', 'users',-- GL CLass Report
--
--
--
-- VARIABLE: {
-- name: "range",
-- display: "Report Range",
-- type: "daterange",
-- default: { start: "first day of last month", end: "last day of last month" }
-- }
-- VARIABLE: {
-- name: "glclass",
-- display: "Gl Class Code",
-- type: "text",
-- }
-- ROLLUP: {
-- columns: {
-- "Sales Amt": "{{ sum }}",
-- "Cost": "{{ sum }}",
-- "Profit": "{{ sum }}",
-- "stockid": "{{ count }}"
-- }
--}
select
sm.glclass as `GL Class`,
g.name as Description,
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
JOIN stockmaster sm on sm.stockid = s.stockid
JOIN gl_class_desc g on g.code = sm.glclass
where s.trandate between "{{ range.start }}" AND "{{ range.end }}"
{% if glclass != '' %}
and sm.glclass = '{{ glclass }}'
{% endif %}
group by sm.glclass
order by sm.glclass