Edit Report:Moroccan Oil Customers (MOC)
Menu Anchors
'customers', 'orders', 'sales', 'payables', 'warehouse', 'dispatching', 'receivables', 'payables-dash', 'inventory', 'purchases', 'generallendger', 'users',-- Moroccan Oil Customers (MOC)
-- MOC Export
-- ^sales
-- VARIABLE: {
-- name: "range",
-- display: "Report Range",
-- type: "daterange",
-- default: { start: "first day of this month", end: "today" }
-- }
-- FILTER: {
-- filter: "number",
-- column: "Customer Number",
-- params: {decimals: 2, decimal_sep: '.', thousands_sep: ''}
-- }
--
SELECT distinct
concat(stocktrans.debtorno,".",stocktrans.branchcode) as `Customer Number`,
stocktrans.brname as `Customer Name`,
braddress1 as `Address 1`,
braddress2 as `Address 2`,
braddress3 as `City`,
braddress4 as `State`,
braddress5 as `Zip`,
'USA' as `Country`,
contactname as `Attn/Contact`,
phoneno as `Phone Number`,
email as `Email Address`
FROM stocktrans
INNER JOIN custbranch ON stocktrans.debtorno = custbranch.debtorno AND stocktrans.branchcode = custbranch.branchcode
WHERE (stocktrans.stockid like 'MOC%' OR stocktrans.stockid like 'MOD%' OR stocktrans.stockid like 'MOR%')
AND trandate >= '{{range.start}}' and trandate <= '{{range.end}}'
order by stocktrans.debtorno, stocktrans.branchcode ASC