This query is used to identify sales processed through our Epicor-Aconnex integrations and also to calculate the transaction fees for franchise billing.
--[Start] Billing
--This query will help identify the Aconnex transaction data in our sales records
declare @StartDate date = '2017-03-01'
declare @EndDate date = '2017-03-31'
select whsenumber [Whse], SUM (somtotal*0.0075)[Total]
from gxwizmo_10.dbo.gxsom
where SOMSalesman = 'ECMACONX'
and SOMDate >= @StartDate
and SOMDate <= @EndDate
group by WHSENumber
having SUM (somtotal*0.0075) != 0
--[End] Billing
--[Start] Reconcile
--This query will get the transaction detail
--declare @StartDate date = '2017-03-01'
--declare @EndDate date = '2017-03-31'
select whsenumber [Whse], SOMtotal, SOMso, SOMsalesman,somPID, SOMdatetime, SOMcustomerPO, SOMoriginalSO, SOMTotal*.0075 [Fee]
from gxwizmo_10.dbo.gxsom
where SOMSalesman = 'ECMACONX'
and SOMDate >= @StartDate
and SOMDate <= @EndDate
order by WHSENumber asc
--[End] Reconcile
/*
--extra stuff:
select * from _julian.[dbo].[AcononeXMonthlyBillingImport]
select top 10 * from gxwizmo_10.dbo.gxsom
select top 10 * from _julian.[dbo].[AcononeXMonthlyBillingImport]
join
--[Start] Julian
declare @StartDate date = '2017-03-01'
declare @EndDate date = '2017-03-31'
select b.customerID, b.companyName, b.city, b.state, b.companyID, b.whse
,a.transtotal, a.Partner_Name, a.transtotal*.0025[0.25%], a.transtotal*.0075 [0.75%]
from _julian.[dbo].[AcononeXMonthlyBillingImport] a
left join _julian.dbo.vw_customers b on a.buyer_custnum=b.customerID
where transxdate >= @StartDate
and transxdate <= @EndDate
--[End] Julian
--[Start] Accounting
--This query will simply break down the charges by warehouse
--This is based exclusivly on the Aconnex data
Select Whse[Warehouse #], SUM (transtotal*.0075)[Amount]
from _julian.[dbo].[AcononeXMonthlyBillingImport] a
left join _julian.dbo.vw_customers b on a.buyer_custnum=b.customerID
group by b.whse
--[End] Accounting
*/