Good morning,
I'm fairly new to MicrosDB and trying to create a report out of the Oracle database (micros 9700 version). I need to report Total Items sold, Gross Sales and Discounts per Revenue Center.
I'm having issues with the split checks. I'm not sure how to count the items or the revenue in these cases. I would really appreciate your help on this one.
This is the query I have so far.It think split checks are messing the numbers.
SELECT ch.CHECKID ,
ch.CHECKNUMBER ,
ch.TABLEOPEN ,
ch.CHECKOPEN ,
ch.CHECKCLOSE ,
ch.CHECKPOSTINGTIME ,
ch.STATUS ,
ch.SPLITFROMCHECKNUM ,
ch.SPLITOUT ,
ch.ADDEDTOREVCTRID ,
ch.ADDEDTOCHECKNUM ,
ch.ADDEDIN ,
ch.ORDTYPEID ,
st1.STRINGTEXT menuclass ,
st.STRINGTEXT menu ,
ms.OBJECTNUMBER ,
SUM(c.SALESCOUNT) salescount ,
SUM(CASE WHEN c.DETAILTYPE = 1 THEN c.TOTAL
ELSE 0
END) check_detail_total ,
SUM(CASE WHEN c.DETAILTYPE = 2 THEN c.TOTAL ELSE 0 END) check_discount_total
FROM dbo.CHECK_DETAIL c
LEFT JOIN dbo.MENU_ITEM_DETAIL m ON c.CHECKDETAILID = m.CHECKDETAILID
LEFT JOIN dbo.MENU_ITEM_DEFINITION d ON m.MENUITEMDEFID = d.MENUITEMDEFID
LEFT JOIN dbo.MENU_ITEM_MASTER ms ON d.MENUITEMMASTERID = ms.MENUITEMMASTERID
LEFT JOIN dbo.MENU_ITEM_CLASS mc ON d.MENUITEMCLASSID = mc.MENUITEMCLASSID
LEFT JOIN dbo.MENU_ITEM_PRICE mp ON m.MENUITEMPRICEID = mp.MENUITEMPRICEID
LEFT JOIN dbo.STRING_TABLE st ON ms.NAMEID = st.STRINGNUMBERID
LEFT JOIN dbo.DISCOUNT_DETAIL di ON c.CHECKDETAILID = di.CHECKDETAILID
LEFT JOIN dbo.CHECKS ch ON c.CHECKID = ch.CHECKID
LEFT JOIN dbo.STRING_TABLE st1 ON mc.NAMEID = st1.STRINGNUMBERID
WHERE ch.CHECKPOSTINGTIME >= '2017-06-04 10:43:01.000'
AND ch.CHECKPOSTINGTIME < '2017-06-05 05:24:01.000'
AND c.REVCTRID = 6
AND c.DETAILTYPE IN ( 1,2 )
AND mp.PRICE <> 0
GROUP BY ch.CHECKID ,
ch.CHECKNUMBER ,
ch.STATUS ,
ch.ORDTYPEID ,
st1.STRINGTEXT ,
st.STRINGTEXT ,
ms.OBJECTNUMBER ,
ch.CHECKID ,
ch.CHECKNUMBER ,
ch.TABLEOPEN ,
ch.CHECKOPEN ,
ch.CHECKCLOSE ,
ch.CHECKPOSTINGTIME ,
ch.STATUS ,
ch.SPLITFROMCHECKNUM ,
ch.SPLITOUT ,
ch.ADDEDTOREVCTRID ,
ch.ADDEDTOCHECKNUM ,
ch.ADDEDIN ,
ch.ORDTYPEID ,
st1.STRINGTEXT ,
st.STRINGTEXT ,
ms.OBJECTNUMBER
ORDER BY 1
I would really appreciate your help on this one. Thank you!!
I'm fairly new to MicrosDB and trying to create a report out of the Oracle database (micros 9700 version). I need to report Total Items sold, Gross Sales and Discounts per Revenue Center.
I'm having issues with the split checks. I'm not sure how to count the items or the revenue in these cases. I would really appreciate your help on this one.
This is the query I have so far.It think split checks are messing the numbers.
SELECT ch.CHECKID ,
ch.CHECKNUMBER ,
ch.TABLEOPEN ,
ch.CHECKOPEN ,
ch.CHECKCLOSE ,
ch.CHECKPOSTINGTIME ,
ch.STATUS ,
ch.SPLITFROMCHECKNUM ,
ch.SPLITOUT ,
ch.ADDEDTOREVCTRID ,
ch.ADDEDTOCHECKNUM ,
ch.ADDEDIN ,
ch.ORDTYPEID ,
st1.STRINGTEXT menuclass ,
st.STRINGTEXT menu ,
ms.OBJECTNUMBER ,
SUM(c.SALESCOUNT) salescount ,
SUM(CASE WHEN c.DETAILTYPE = 1 THEN c.TOTAL
ELSE 0
END) check_detail_total ,
SUM(CASE WHEN c.DETAILTYPE = 2 THEN c.TOTAL ELSE 0 END) check_discount_total
FROM dbo.CHECK_DETAIL c
LEFT JOIN dbo.MENU_ITEM_DETAIL m ON c.CHECKDETAILID = m.CHECKDETAILID
LEFT JOIN dbo.MENU_ITEM_DEFINITION d ON m.MENUITEMDEFID = d.MENUITEMDEFID
LEFT JOIN dbo.MENU_ITEM_MASTER ms ON d.MENUITEMMASTERID = ms.MENUITEMMASTERID
LEFT JOIN dbo.MENU_ITEM_CLASS mc ON d.MENUITEMCLASSID = mc.MENUITEMCLASSID
LEFT JOIN dbo.MENU_ITEM_PRICE mp ON m.MENUITEMPRICEID = mp.MENUITEMPRICEID
LEFT JOIN dbo.STRING_TABLE st ON ms.NAMEID = st.STRINGNUMBERID
LEFT JOIN dbo.DISCOUNT_DETAIL di ON c.CHECKDETAILID = di.CHECKDETAILID
LEFT JOIN dbo.CHECKS ch ON c.CHECKID = ch.CHECKID
LEFT JOIN dbo.STRING_TABLE st1 ON mc.NAMEID = st1.STRINGNUMBERID
WHERE ch.CHECKPOSTINGTIME >= '2017-06-04 10:43:01.000'
AND ch.CHECKPOSTINGTIME < '2017-06-05 05:24:01.000'
AND c.REVCTRID = 6
AND c.DETAILTYPE IN ( 1,2 )
AND mp.PRICE <> 0
GROUP BY ch.CHECKID ,
ch.CHECKNUMBER ,
ch.STATUS ,
ch.ORDTYPEID ,
st1.STRINGTEXT ,
st.STRINGTEXT ,
ms.OBJECTNUMBER ,
ch.CHECKID ,
ch.CHECKNUMBER ,
ch.TABLEOPEN ,
ch.CHECKOPEN ,
ch.CHECKCLOSE ,
ch.CHECKPOSTINGTIME ,
ch.STATUS ,
ch.SPLITFROMCHECKNUM ,
ch.SPLITOUT ,
ch.ADDEDTOREVCTRID ,
ch.ADDEDTOCHECKNUM ,
ch.ADDEDIN ,
ch.ORDTYPEID ,
st1.STRINGTEXT ,
st.STRINGTEXT ,
ms.OBJECTNUMBER
ORDER BY 1
I would really appreciate your help on this one. Thank you!!