Refeesh -
I went a different direction with this request. The following query reviews the Open and History files in Finance, Sales and Mfg to total the number of unique transactions and the number of lines in each of these data-sets. If you're interested in this approach, let me know, and I will complete the set by doing the same analysis for Purchases and Purchase Orders. You can use the variable set at the start of the query to change the run date for the query
DECLARE @Date as DATETIME
SET @Date = '04/12/2017'
/*Journal Entries*/
select sum(a.Journal_Entries) GL_Transactions from (
select count(c.GL_Transactions) Journal_Entries from (Select COUNT(jrnentry) GL_Transactions FROM GL20000 where TRXDATE = @Date group by JRNENTRY) c
Union All
select count(c.GL_Transactions) Journal_Entries from (Select COUNT(jrnentry) GL_Transactions FROM GL30000 where TRXDATE = @Date group by JRNENTRY) c ) a
/*GL Transaction Lines*/
select SUM(a.GL_Trx_Lines) GL_Trx_Lines from (
Select count(JRNENTRY) GL_Trx_Lines FROM GL20000 where TRXDATE = @Date group by TRXDATE
Union All
Select count(JRNENTRY) GL_Trx_Lines FROM GL30000 where TRXDATE = @Date group by TRXDATE) a
/*Sales Orders*/
select sum(a.Sales_Orders) Sales_Orders from
(Select count(s.Sales_Orders) Sales_Orders from (Select COUNT(sl.SOPNUMBE) Sales_Orders from SOP10100 SH
Inner Join SOP10200 SL
on SH.SOPNUMBE = SL.SOPNUMBE
and SH.SOPTYPE = SL.SOPTYPE
where sh.DOCDATE = @Date
group by SL.SOPNUMBE) S
Union All
Select count(s.Sales_Orders) Sales_Orders from (Select COUNT(sl.SOPNUMBE) Sales_Orders from SOP30200 SH
Inner Join SOP30300 SL
on SH.SOPNUMBE = SL.SOPNUMBE
and SH.SOPTYPE = SL.SOPTYPE
where sh.DOCDATE = @Date
group by SL.SOPNUMBE) S) a
/*Sales Lines*/
select sum(a.SOP_Lines) SOP_Lines from
(Select COUNT(SH.SOPNUMBE) SOP_Lines from SOP10100 SH
Inner Join SOP10200 SL
on SH.SOPNUMBE = SL.SOPNUMBE
and SH.SOPTYPE = SL.SOPTYPE
where sh.DOCDATE = @Date
Union All
Select COUNT(SH.SOPNUMBE) SOP_Lines from SOP30200 SH
Inner Join SOP30300 SL
on SH.SOPNUMBE = SL.SOPNUMBE
and SH.SOPTYPE = SL.SOPTYPE
where sh.DOCDATE = @Date) a
/* Work Orders */
Select COUNT(MANUFACTUREORDER_I) Released_MOs from WO010032 WO WHERE STRTDATE = @Date