using System; using System.Data; using System.Collections; using Cosmos.UserFrame; using Cosmos.ServiceProvider; using Cosmos.Common; using Cosmos.CommonManager; /*-----------------------------------------------------------------------------------------------*/ // 설 명 : 자료조회 // 작 성 자 : // 변경 이력 : /*-----------------------------------------------------------------------------------------------*/ namespace Cosmos.Service { public class DataSearch : IDataSearch { #region 변수 선언 private SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출 private PosStatus m_cPosStatus = new PosStatus(); //기본정보 참조 private IMasterUs m_cMstService = null; // 마스터 인터페이스 private StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체) private IDataProcessUs m_cDataService = null; private TranStatus m_cTrnStatus = new TranStatus(); //거래정보 참조 private ISaleCompleteUs m_cSaleComplete = null; // 거래완료처리 private IDatabaseSQL m_cSqlDbService = null; // 데이터베이스 관리 private IDataCommonUs m_cDataCommon = null; // POS 공통함수 인터페이스 private IPosPrinterUs m_cPrinterUs = null; private IMakeAccADMT m_cTranService = null; public DataSearch() { m_cPosStatus = (PosStatus)StateObject.POS; // POS 기본정보 m_cTrnStatus = (TranStatus)StateObject.TRAN; // POS 거래정보 m_cMstService = (IMasterUs)sManager.InitServiceInstance(ServiceLists.ASV_MASTER.DLL, ServiceLists.ASV_MASTER.POS_MASTER); m_cDataService = (IDataProcessUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_SERVICE); m_cSaleComplete = (ISaleCompleteUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.SALE_COMPLETE); m_cSqlDbService = (IDatabaseSQL)sManager.InitServiceInstance(ServiceLists.AGENT_DATABASE.DLL, ServiceLists.AGENT_DATABASE.DATABASE_MSSQL); m_cDataCommon = (IDataCommonUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_COMMON); m_cPrinterUs = (IPosPrinterUs)sManager.InitServiceInstance(ServiceLists.AGENT_OLEDEVICE.DLL, ServiceLists.AGENT_OLEDEVICE.DEVICE_POSPRINTER); m_cTranService = (IMakeAccADMT)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.MAKE_TRANLOG); } #endregion #region 조회 대상 그룹 조회 /// /// 조회 대상 그룹 조회 /// /// /// public DataTable SelectGroupList(string[] aParam) { string sSql = ""; try { sSql = ""; sSql += " SELECT \n"; sSql += " CMM_CD \n"; sSql += " , ISNULL(ENTRY_NM, '') ENTRY_NM \n"; sSql += " , ISNULL(CHAR_VAL_TITLE_VAL_04, '') TODATE_USE \n"; sSql += " , ISNULL(CHAR_VAL_TITLE_VAL_02, '') SUB_CMM_CD1 \n"; sSql += " , ISNULL(CHAR_VAL_TITLE_VAL_03, '') SUB_CMM_CD2 \n"; sSql += " , ISNULL(CHAR_VAL_TITLE_VAL_05, '') POSNO_USE \n"; sSql += " , ISNULL(CHAR_VAL_TITLE_VAL_06, '') SIMPLE_USE \n"; sSql += "FROM POSMST..MST_CMM \n"; sSql += "WHERE \n"; sSql += " CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n"; sSql += "AND CMM_GRP_CD = '" + aParam[0] + "' \n"; sSql += "AND CHAR_VAL_TITLE_VAL_01 = '" + aParam[1] + "' \n"; sSql += "AND LANG_TYPE = '" + m_cPosStatus.Base.Country + "' \n"; sSql += "AND USE_YN = '1' \n"; sSql += "ORDER BY DISP_SEQ \n"; sSql = sSql.Replace("\t", " "); DataTable dtDataInfo = m_cMstService.Select(new string[] { sSql }); return dtDataInfo; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } return null; } #endregion #region POS번호 조회 /// /// POS번호 조회 /// /// /// public DataTable SelectPosNo(string[] aParam) { string sSql = ""; try { sSql = ""; //sSql += "SELECT DISTINCT \n"; //sSql += " POS_NO CMM_CD \n"; //sSql += ", CASE WHEN POS_NO = '00' THEN '전체' ELSE 'POS' END ENTRY_NM \n"; //sSql += "FROM ( \n"; //sSql += " SELECT \n"; //sSql += " '00' POS_NO \n"; //sSql += " UNION ALL \n"; //sSql += " SELECT \n"; //sSql += " POS_NO \n"; //sSql += " FROM POSMST..MST_POS \n"; //sSql += " WHERE \n"; //sSql += " CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n"; //sSql += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n"; //sSql += " AND USE_YN = '1' \n"; //sSql += ") MM \n"; //sSql += "ORDER BY 1 \n"; sSql += " SELECT \n"; sSql += " POS_NO CMM_CD \n"; sSql += " , 'POS' ENTRY_NM \n"; sSql += " FROM POSMST..MST_POS \n"; sSql += " WHERE \n"; sSql += " CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n"; sSql += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n"; sSql += " AND USE_YN = '1' \n"; sSql += "ORDER BY 1 \n"; sSql = sSql.Replace("\t", " "); DataTable dtDataInfo = m_cMstService.Select(new string[] { sSql }); return dtDataInfo; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } return null; } #endregion #region Host 조회 실행 /// /// Host 조회 실행 /// /// /// /// /// /// /// /// /// public string ExecuteHostIrt(string sIRTType, string sPosNo, string sStartDate, string sEndDate, string sChasu, string siTemGroup, ref string[] aRet) { int iRecvTimeOut = 10000; string sRet = UserCom.RST_ERR; Hashtable htSendData = new Hashtable(); Hashtable htRecvData = new Hashtable(); try { // 조회 htSendData.Add(Column.IQ_DATA_SEARCH_REQ.DATA.INQ_TYPE, ItemConst.IRT_INQ_TYPE.SERVER_INTERFACE_SCH); htSendData.Add(Column.IQ_DATA_SEARCH_REQ.DATA.STOR_CD, m_cPosStatus.Base.StoreNo); htSendData.Add(Column.IQ_DATA_SEARCH_REQ.DATA.POS_NO, sPosNo); htSendData.Add(Column.IQ_DATA_SEARCH_REQ.DATA.STOR_TY, m_cPosStatus.Mst.DrtFrcsDiv); htSendData.Add(Column.IQ_DATA_SEARCH_REQ.DATA.PRT_DIV, sIRTType); htSendData.Add(Column.IQ_DATA_SEARCH_REQ.DATA.START_DT, sStartDate); htSendData.Add(Column.IQ_DATA_SEARCH_REQ.DATA.END_DT, sEndDate); htSendData.Add(Column.IQ_DATA_SEARCH_REQ.DATA.ORD_SEQ, sChasu); htSendData.Add(Column.IQ_DATA_SEARCH_REQ.DATA.ORD_GRP, siTemGroup); htSendData.Add(Column.IQ_DATA_SEARCH_REQ.DATA.DATA_CNT, "0"); htSendData.Add(Column.IQ_DATA_SEARCH_REQ.DATA.RES_DATA, ""); sRet = m_cDataCommon.ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, m_cPosStatus.Base.CommSvrIp, (int)m_cPosStatus.Base.BizInqPort, iRecvTimeOut, htSendData, ref htRecvData); if (sRet != UserCom.RST_OK) { WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0326)); sRet = UserCom.RST_ERR; return sRet; } if (CmUtil.DoubleParse(htRecvData[Column.IQ_DATA_SEARCH_REQ.DATA.DATA_CNT].ToString()) <= 0) { WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0302)); sRet = UserCom.RST_ERR; return sRet; } aRet = htRecvData[Column.IQ_DATA_SEARCH_REQ.DATA.RES_DATA].ToString().Split(new string[] { "#~" }, StringSplitOptions.None); sRet = UserCom.RST_OK; return sRet; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } return sRet; } #endregion #region 영수증 프린터 출력 /// /// 영수증 프린터 출력 /// /// /// public bool PosDataPrint(ArrayList alPrintData) { bool bReturn = false; try { string[] arPrintData = (string[])alPrintData.ToArray(typeof(string)); bReturn = m_cPrinterUs.ReceiptPrinter(arPrintData); } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } return bReturn; } #endregion #region 조회일 판매이력이 있는 담당자 조회 /// /// 조회일 판매이력이 있는 담당자 조회 /// /// /// public DataTable SelectTranCashier(string[] aParam) { string sSql = ""; try { sSql = ""; sSql += "SELECT \n"; sSql += " mm.CASHIER_ID CMM_CD \n"; sSql += " , mm.CASHIER_NM ENTRY_NM \n"; sSql += " , '' TODATE_USE \n"; sSql += " , '' SUB_CMM_CD1 \n"; sSql += " , '' SUB_CMM_CD2 \n"; sSql += " , '' POSNO_USE \n"; sSql += " , '1' SIMPLE_USE \n"; sSql += " , mm.SEQ SEQ \n"; sSql += "from ( \n"; sSql += "SELECT \n"; sSql += " '00' CASHIER_ID \n"; sSql += " , '" + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1025) + "' CASHIER_NM \n"; sSql += " , 1 SEQ \n"; sSql += "UNION ALL \n"; sSql += "SELECT \n"; sSql += " '' CASHIER_ID \n"; sSql += " , '" + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0226) + "' CASHIER_NM \n"; sSql += " , 2 SEQ \n"; sSql += "UNION ALL \n"; sSql += "SELECT DISTINCT \n"; sSql += " MU.CASHIER_ID \n"; sSql += " , ISNULL(MU.CASHIER_NM, '') CASHIER_NM \n"; sSql += " , 3 SEQ \n"; sSql += "FROM POSLOG..TR_SALE_HEADER TSH \n"; sSql += " LEFT JOIN POSMST..MST_USER MU \n"; sSql += " ON MU.CMP_CD = TSH.CMP_CD \n"; sSql += " AND MU.STOR_CD = TSH.STOR_CD \n"; sSql += " AND MU.CASHIER_ID = TSH.PIC_NO \n"; sSql += " AND MU.USE_YN = '1' \n"; sSql += "WHERE \n"; sSql += " TSH.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n"; sSql += "AND TSH.SALE_DT = '" + aParam[0] + "' \n"; sSql += "AND TSH.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n"; sSql += "AND TSH.TRAIN_MODE_YN = '0' \n"; sSql += "AND MU.CASHIER_ID IS NOT NULL \n"; sSql += ") mm \n"; sSql += "ORDER BY mm.SEQ, 1 \n"; sSql = sSql.Replace("\t", " "); DataTable dtDataInfo = m_cMstService.Select(new string[] { sSql }); return dtDataInfo; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } return null; } #endregion // Rhee, 2017.10.18 00077점포 매출 Text파일 다운로드 기능(매30분) Start #region 점포별 상품 판매금액 조회 public DataTable SelectPayAmtFilePut(string sStoreCd, string sDate) { string sSql = ""; try { if (sStoreCd != "" && sDate != "") { // 판매 금액 조회(반품 및 할인 금액 제외한 실매출액) sSql = ""; sSql += "SELECT SUM(CASE WHEN TRADE_DIV = '0' THEN NET_SALE_AMT ELSE 0 END) - SUM(CASE WHEN TRADE_DIV = '1' THEN NET_SALE_AMT ELSE 0 END) AS PAY_AMT "; sSql += " FROM POSLOG..TR_SALE_HEADER "; sSql += " WHERE CMP_CD = 'PCCN' "; sSql += " AND STOR_CD = '" + sStoreCd + "' "; sSql += " AND SALE_DT = '" + sDate + "' "; } DataTable dtDataInfo = m_cMstService.Select(new string[] { sSql }); return dtDataInfo; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } return null; } #endregion // Rhee, 2017.10.18 00077점포 매출 Text파일 다운로드 기능(매30분) End #region 담당자별 상품 판매 이력 조회 /// /// 담당자별 상품 판매 이력 조회 /// /// /// public DataTable SelectCashier_iTem(string[] aParam) { string sSql = ""; try { if (aParam[0] == "1") { // 품목별 정산 내역 조회 sSql = ""; sSql += "SELECT * FROM ( \n"; sSql += "SELECT \n"; sSql += " TSD.ITEM_PLU_CD \n"; sSql += " , ISNULL(MI.SHTCUT_ITEMNM, '') ITEM_NM \n"; sSql += " , ISNULL(SUM(CASE TSH.TRADE_DIV WHEN '0' THEN ISNULL(TSD.SALE_QTY, 0) \n"; sSql += " ELSE ISNULL(TSD.SALE_QTY, 0) * (-1) \n"; sSql += " END), 0) SALE_QTY \n"; sSql += " , ISNULL(SUM(CASE TSH.TRADE_DIV WHEN '0' THEN ISNULL(TSD.SALE_AMT, 0) \n"; sSql += " ELSE ISNULL(TSD.SALE_AMT, 0) * (-1) \n"; sSql += " END), 0) SALE_AMT \n"; sSql += "FROM POSLOG..TR_SALE_HEADER TSH \n"; sSql += " LEFT JOIN POSLOG..TR_SALE_DETAIL TSD \n"; sSql += " ON TSD.CMP_CD = TSH.CMP_CD \n"; sSql += " AND TSD.SALE_DT = TSH.SALE_DT \n"; sSql += " AND TSD.STOR_CD = TSH.STOR_CD \n"; sSql += " AND TSD.POS_NO = TSH.POS_NO \n"; sSql += " AND TSD.TRADE_NO = TSH.TRADE_NO \n"; sSql += " AND TSD.CANCEL_DIV = '0' \n"; sSql += " LEFT JOIN POSMST..MST_ITEM MI \n"; sSql += " ON TSD.CMP_CD = MI.CMP_CD \n"; sSql += " AND TSD.STOR_CD = MI.STOR_CD \n"; sSql += " AND TSD.SUB_SHOP_CD = MI.SUB_STOR_CD \n"; sSql += " AND TSD.ITEM_PLU_CD = MI.ITEM_CD \n"; sSql += "WHERE \n"; sSql += " TSH.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n"; sSql += "AND TSH.SALE_DT = '" + aParam[1] + "' \n"; sSql += "AND TSH.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n"; sSql += "AND TSH.TRAIN_MODE_YN = '0' \n"; sSql += "AND TSH.PIC_NO LIKE '" + aParam[2] + "' + '%' \n"; sSql += "AND TSD.ITEM_PLU_CD IS NOT NULL\n"; sSql += "GROUP BY TSD.ITEM_PLU_CD, MI.SHTCUT_ITEMNM \n"; sSql += ") MM \n"; sSql += "WHERE MM.SALE_AMT > 0 \n"; sSql += "ORDER BY MM.ITEM_PLU_CD \n"; } //#20171113 담당자별 매출 조회 분류별 제품 나오도록 수정 start,phj //기존 //else //변경 else if (aParam[0] == "2") //#20171113 담당자별 매출 조회 분류별 제품 나오도록 수정 end,phj { // 결제 내역 조회 sSql = ""; sSql += "SELECT * FROM ( \n"; sSql += "SELECT \n"; sSql += " TSP.PAY_WAY_CD, TSP.PAY_DTL_CD_01 \n"; sSql += " , ISNULL(MPD.PAY_DC_NM, '') ITEM_NM \n"; sSql += " , ISNULL(SUM(CASE TSH.TRADE_DIV WHEN '0' THEN ISNULL(TSP.QTY_ENTRY_01, 0) \n"; sSql += " ELSE ISNULL(TSP.QTY_ENTRY_01, 0) * (-1) \n"; sSql += " END), 0) SALE_QTY \n"; sSql += " , ISNULL(SUM(CASE TSH.TRADE_DIV WHEN '0' THEN ISNULL(TSP.PAY_AMT, 0) \n"; sSql += " ELSE ISNULL(TSP.PAY_AMT, 0) * (-1) \n"; sSql += " END), 0) SALE_AMT \n"; sSql += "FROM POSLOG..TR_SALE_HEADER TSH \n"; sSql += " LEFT JOIN POSLOG..TR_SALE_PAY TSP \n"; sSql += " ON TSP.CMP_CD = TSH.CMP_CD \n"; sSql += " AND TSP.SALE_DT = TSH.SALE_DT \n"; sSql += " AND TSP.STOR_CD = TSH.STOR_CD \n"; sSql += " AND TSP.POS_NO = TSH.POS_NO \n"; sSql += " AND TSP.TRADE_NO = TSH.TRADE_NO \n"; sSql += " AND TSP.CANCEL_DIV = '0' \n"; sSql += " LEFT JOIN POSMST..MST_PAY_DC MPD \n"; sSql += " ON TSP.CMP_CD = MPD.CMP_CD \n"; sSql += " AND TSP.STOR_CD = MPD.STOR_CD \n"; sSql += " AND TSP.PAY_WAY_CD = MPD.PAY_DC_GRP_TYPE \n"; sSql += " AND TSP.PAY_DTL_CD_01 = MPD.PAY_DC_CD \n"; sSql += " AND MPD.USE_YN = '1' \n"; sSql += "WHERE \n"; sSql += " TSH.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n"; sSql += "AND TSH.SALE_DT = '" + aParam[1] + "' \n"; sSql += "AND TSH.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n"; sSql += "AND TSH.TRAIN_MODE_YN = '0' \n"; sSql += "AND TSH.PIC_NO LIKE '" + aParam[2] + "' + '%' \n"; sSql += "AND TSP.PAY_WAY_CD IS NOT NULL \n"; sSql += "GROUP BY TSP.PAY_WAY_CD, TSP.PAY_DTL_CD_01, MPD.PAY_DC_NM \n"; sSql += ") MM \n"; sSql += "WHERE MM.SALE_AMT > 0 \n"; sSql += "ORDER BY MM.PAY_WAY_CD, MM.PAY_DTL_CD_01 \n"; } //#20171113 담당자별 매출 조회 분류별 제품 나오도록 수정 start,phj else if (aParam[0] == "3") { sSql = " SELECT isnull(MM.ITEM_CLSS_CD,'') ITEM_CLSS_CD, \n"; sSql += " CASE GROUPING(MM.ITEM_CLSS_NM) + GROUPING(MM.ITEM_CLSS_CD) + GROUPING(MM.ITEM_PLU_CD) + GROUPING(MM.ITEM_NM) WHEN 3 THEN '#SUB_SUM#' \n"; sSql += " WHEN 4 THEN '#TOT_SUM#' \n"; sSql += " ELSE MM.ITEM_CLSS_NM \n"; sSql += " END AS ITEM_CLSS_NM, \n"; sSql += " isnull(MM.ITEM_PLU_CD,'') ITEM_PLU_CD , \n"; sSql += " isnull(MM.ITEM_NM,'') ITEM_NM, \n"; sSql += " SUM(MM.BILL_AMT) SALE_AMT, \n"; sSql += " SUM(MM.SALE_QTY) SALE_QTY, \n"; sSql += " GROUPING(MM.ITEM_CLSS_NM) + GROUPING(MM.ITEM_CLSS_CD) + GROUPING(MM.ITEM_PLU_CD) + GROUPING(MM.ITEM_NM) AS LEVEL_GB \n"; sSql += " FROM \n"; sSql += " ( \n"; sSql += " SELECT TSH.CMP_CD, TSH.SALE_DT, TSH.STOR_CD, TSH.POS_NO, TSH.TRADE_NO, TSH.TRADE_DIV, \n"; sSql += " TSD.ITEM_PLU_CD, \n"; sSql += " CASE TSH.TRADE_DIV WHEN '0' THEN ISNULL(TSD.SALE_QTY, 0) \n"; sSql += " ELSE ISNULL(TSD.SALE_QTY, 0) * (-1) \n"; sSql += " END AS SALE_QTY, \n"; sSql += " CASE TSH.TRADE_DIV WHEN '0' THEN ISNULL(TSD.BILL_AMT, 0) \n"; sSql += " ELSE ISNULL(TSD.BILL_AMT, 0) * (-1) \n"; sSql += " END AS BILL_AMT, \n"; sSql += " MI.ITEM_NM, MI.L_CLSS , \n"; sSql += " ISNULL(MIC.ITEM_CLSS_NM, 'Non Registered') AS ITEM_CLSS_NM, MIC.ITEM_CLSS_CD \n"; sSql += " FROM POSLOG..TR_SALE_HEADER TSH \n"; sSql += " LEFT JOIN POSLOG..TR_SALE_DETAIL TSD \n"; sSql += " ON TSD.CMP_CD = TSH.CMP_CD \n"; sSql += " AND TSD.SALE_DT = TSH.SALE_DT \n"; sSql += " AND TSD.STOR_CD = TSH.STOR_CD \n"; sSql += " AND TSD.POS_NO = TSH.POS_NO \n"; sSql += " AND TSD.TRADE_NO = TSH.TRADE_NO \n"; sSql += " AND TSD.CANCEL_DIV = '0' \n"; sSql += " LEFT JOIN POSMST..MST_ITEM MI \n"; sSql += " ON TSD.CMP_CD = MI.CMP_CD \n"; sSql += " AND TSD.STOR_CD = MI.STOR_CD \n"; sSql += " AND TSD.SUB_SHOP_CD = MI.SUB_STOR_CD \n"; sSql += " AND TSD.ITEM_PLU_CD = MI.ITEM_CD \n"; sSql += " AND MI.USE_YN = '1' \n"; sSql += " LEFT JOIN POSMST..MST_ITEM_CLSS MIC \n"; sSql += " ON MI.CMP_CD = MIC.CMP_CD \n"; sSql += " AND MI.L_CLSS = MIC.ITEM_CLSS_CD \n"; sSql += " AND MIC.ITEM_CLSS_TYPE_CD = '00' \n"; sSql += " AND MIC.ITEM_CLSS_LVL_TYPE = 'L' \n"; sSql += " AND MIC.USE_YN = '1' \n"; sSql += " WHERE TSH.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n"; sSql += " AND TSH.SALE_DT = '" + aParam[1] + "' \n"; sSql += " AND TSH.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n"; sSql += " AND TSH.POS_NO = '" + m_cPosStatus.Base.PosNo + "' \n"; sSql += " AND TSH.PIC_NO LIKE '" + aParam[2] + "' + '%' \n"; sSql += " AND TSD.ITEM_PLU_CD IS NOT NULL \n"; sSql += " AND TSH.TRAIN_MODE_YN = '0' \n"; sSql += " ) MM \n"; sSql += " GROUP BY MM.ITEM_CLSS_CD, MM.ITEM_CLSS_NM, MM.ITEM_PLU_CD, MM.ITEM_NM WITH ROLLUP \n"; sSql += " HAVING ((GROUPING(MM.ITEM_CLSS_NM) + GROUPING(MM.ITEM_CLSS_CD) + GROUPING(MM.ITEM_PLU_CD) + GROUPING(MM.ITEM_NM) IN (0,3,4)) \n"; sSql += " AND SUM(MM.SALE_QTY) <> 0) \n"; sSql += " ORDER BY MM.ITEM_CLSS_CD DESC, MM.ITEM_PLU_CD DESC \n"; } //#20171113 담당자별 매출 조회 분류별 제품 나오도록 수정 end,phj sSql = sSql.Replace("\t", " "); DataTable dtDataInfo = m_cMstService.Select(new string[] { sSql }); return dtDataInfo; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } return null; } #endregion #region 점검지 생성 /// /// 점검지 생성 /// /// /// public string MakeAccADMTCheck(string sSaleDate, ref DataTable dtReturn, string bSimplePrint) { string sRet = UserCom.RST_ERR; try { sRet = m_cTranService.SaveAccADMT(ItemConst.TRAN_KIND.STATEMENT.CLOSING_MONEY, sSaleDate, ref dtReturn, bSimplePrint); } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } return sRet; } #endregion //#region 정산 점검지 조회 ///// ///// 정산 점검지 조회 ///// ///// ///// //public DataTable SelectAccADMTCheck(string[] aParam) //{ // string sSql = ""; // try // { // sSql = ""; // sSql += " SELECT \n"; // sSql += " ISNULL(MBT.BILL_TYPE_DIV, '') BILL_TYPE_DIV \n"; // sSql += " , ISNULL(MBT.SEQ_NO, 0) SEQ_NO \n"; // sSql += " , ISNULL(MBT.SORT_DIV, '2') SORT_DIV \n"; // sSql += " , ISNULL(MBT.SIZE_DIV, '0') SIZE_DIV \n"; // sSql += " , CASE WHEN SUBSTRING(MBT.BILL_TYPE_TAG, 1, 6) = '' THEN SUBSTRING(MBT.BILL_TYPE_TAG, 1, 6) ELSE ISNULL(MBT.BILL_TYPE_TAG, '') END BILL_TYPE_TAG \n"; // sSql += " , ISNULL(MM.QTY, 0) QTY \n"; // sSql += " , ISNULL(MM.AMT, 0) AMT \n"; // sSql += " , ISNULL(MM.MSG1, '') MSG \n"; // sSql += " FROM POSMST.dbo.MST_BILL_TYPE MBT \n"; // sSql += " LEFT JOIN ( \n"; // sSql += " SELECT \n"; // sSql += " MM.CMP_CD \n"; // sSql += " , MM.STOR_CD \n"; // sSql += " , MM.ADMT_CD \n"; // sSql += " , ISNULL(SUM(MM.QTY), 0) QTY \n"; // sSql += " , ISNULL(SUM(MM.AMT), 0) AMT \n"; // sSql += " , ISNULL(MM.MSG1, '') MSG1 \n"; // sSql += " FROM ( \n"; // sSql += " SELECT \n"; // sSql += " MBT.CMP_CD \n"; // sSql += " , MBT.STOR_CD \n"; // sSql += " , ISNULL(SUBSTRING(MBT.BILL_TYPE_TAG, 7, 4) , '') ADMT_CD \n"; // sSql += " , 0 QTY \n"; // sSql += " , 0 AMT \n"; // sSql += " , ISNULL(CMM.ENTRY_NM, '') MSG1 \n"; // sSql += " , ISNULL(CMM.DISP_SEQ, 0) DISP_SEQ \n"; // sSql += " FROM POSMST..MST_BILL_TYPE MBT \n"; // sSql += " INNER JOIN POSMST..MST_CMM CMM \n"; // sSql += " ON CMM.CMP_CD = MBT.CMP_CD \n"; // sSql += " AND CMM.CMM_GRP_CD = '" + PosConst.COMMON_CODE_GROUP.Z0013 + "' \n"; // sSql += " AND ISNULL(CMM.CHAR_VAL_TITLE_VAL_01, '') LIKE '" + sSimplePrint + "' + '%' \n"; // sSql += " AND CMM.CMM_CD = SUBSTRING(MBT.BILL_TYPE_TAG, 7, 4) \n"; // sSql += " AND CMM.LANG_TYPE = '" + m_cPosStatus.Base.Country + "' \n"; // sSql += " AND CMM.USE_YN = '1' \n"; // sSql += " WHERE \n"; // sSql += " MBT.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n"; // sSql += " AND MBT.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n"; // sSql += " AND MBT.BILL_TYPE_GRP_CD = '" + CmUtil.GetDataRowStr(PosMstManager.GetMstPos(), PosMst.MST_POS.DATA.BILL_TYPEGRP) + "' \n"; // sSql += " AND MBT.BILL_TYPE_DIV = '" + PosConst.BILL_TYPE_DIV.ADMT_TRAN + "' \n"; // sSql += " AND SUBSTRING(MBT.BILL_TYPE_TAG, 1, 6) = '' \n"; // sSql += " AND MBT.USE_YN = '1' \n"; // sSql += " \n"; // sSql += " UNION ALL \n"; // sSql += " \n"; // sSql += " SELECT \n"; // sSql += " TSH.CMP_CD \n"; // sSql += " , TSH.STOR_CD \n"; // sSql += " , TSA.ADMT_CD ADMT_CD \n"; // sSql += " , TSA.QTY \n"; // sSql += " , TSA.AMT \n"; // sSql += " , ISNULL(CMM.ENTRY_NM, '') MSG1 \n"; // sSql += " , ISNULL(CMM.DISP_SEQ, 0) DISP_SEQ \n"; // sSql += " FROM \n"; // sSql += " POSLOG..TR_SALE_HEADER TSH \n"; // sSql += " INNER JOIN POSLOG..TR_SALE_ADMT_CHECK TSA \n"; // sSql += " ON TSA.CMP_CD = TSH.CMP_CD \n"; // sSql += " AND TSA.SALE_DT = TSH.SALE_DT \n"; // sSql += " AND TSA.STOR_CD = TSH.STOR_CD \n"; // sSql += " AND TSA.POS_NO = TSH.POS_NO \n"; // sSql += " INNER JOIN POSMST..MST_POS MP \n"; // sSql += " ON MP.CMP_CD = TSH.CMP_CD \n"; // sSql += " AND MP.STOR_CD = TSH.STOR_CD \n"; // sSql += " AND MP.POS_NO IN ('00', TSH.POS_NO) \n"; // sSql += " AND MP.USE_YN = '1' \n"; // sSql += " RIGHT JOIN POSMST..MST_BILL_TYPE MBT \n"; // sSql += " ON MBT.CMP_CD = TSH.CMP_CD \n"; // sSql += " AND MBT.STOR_CD = TSH.STOR_CD \n"; // sSql += " AND MBT.BILL_TYPE_GRP_CD = MP.BILL_TYPEGRP \n"; // sSql += " AND MBT.BILL_TYPE_DIV = '" + PosConst.BILL_TYPE_DIV.ADMT_TRAN + "' \n"; // sSql += " AND SUBSTRING(MBT.BILL_TYPE_TAG, 1, 6) = '' \n"; // sSql += " AND SUBSTRING(MBT.BILL_TYPE_TAG, 7, 4) = TSA.ADMT_CD \n"; // sSql += " AND MBT.USE_YN = '1' \n"; // sSql += " LEFT JOIN POSMST..MST_CMM CMM \n"; // sSql += " ON CMM.CMP_CD = MBT.CMP_CD \n"; // sSql += " AND CMM.CMM_GRP_CD = '" + PosConst.COMMON_CODE_GROUP.Z0013 + "' \n"; // sSql += " AND ISNULL(CMM.CHAR_VAL_TITLE_VAL_01, '') LIKE '" + sSimplePrint + "' + '%' \n"; // sSql += " AND CMM.CMM_CD = SUBSTRING(MBT.BILL_TYPE_TAG, 7, 4) \n"; // sSql += " AND CMM.LANG_TYPE = '" + m_cPosStatus.Base.Country + "' \n"; // sSql += " AND CMM.USE_YN = '1' \n"; // sSql += " WHERE \n"; // sSql += " TSH.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n"; // sSql += " AND TSH.SALE_DT = '" + aParam[0] + "' \n"; // sSql += " AND TSH.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n"; // sSql += " AND TSH.POS_NO = '" + m_cPosStatus.Base.PosNo + "' \n"; // sSql += " AND TSH.TRADE_KINDPER IN ('" + ItemConst.TRAN_KIND.STATEMENT.MIDDLE_ADJUSTMENT + "', '" + ItemConst.TRAN_KIND.STATEMENT.ADJUSTMENT + "') \n"; // sSql += " AND TSH.TRADE_NO = (SELECT MAX(TSH1.TRADE_NO) \n"; // sSql += " FROM POSLOG..TR_SALE_HEADER TSH1 \n"; // sSql += " WHERE \n"; // sSql += " TSH1.CMP_CD = TSH.CMP_CD \n"; // sSql += " AND TSH1.SALE_DT = TSH.SALE_DT \n"; // sSql += " AND TSH1.STOR_CD = TSH.STOR_CD \n"; // sSql += " AND TSH1.POS_NO = TSH.POS_NO \n"; // sSql += " AND TSH1.TRAIN_MODE_YN = '0' \n"; // sSql += " AND TSH1.TRADE_KINDPER IN ('" + ItemConst.TRAN_KIND.STATEMENT.MIDDLE_ADJUSTMENT + "', '" + ItemConst.TRAN_KIND.STATEMENT.ADJUSTMENT + "')) \n"; // sSql += " ) MM \n"; // sSql += " GROUP BY MM.CMP_CD, MM.STOR_CD, MM.ADMT_CD, ISNULL(MM.MSG1, '') \n"; // sSql += " ) MM \n"; // sSql += " ON MBT.CMP_CD = MM.CMP_CD \n"; // sSql += " AND MBT.STOR_CD = MM.STOR_CD \n"; // sSql += " AND SUBSTRING(MBT.BILL_TYPE_TAG, 7, 4) = MM.ADMT_CD \n"; // sSql += " WHERE \n"; // sSql += " MBT.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n"; // sSql += " AND MBT.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n"; // sSql += " AND MBT.BILL_TYPE_GRP_CD = '" + CmUtil.GetDataRowStr(PosMstManager.GetMstPos(), PosMst.MST_POS.DATA.BILL_TYPEGRP) + "' \n"; // sSql += " AND MBT.BILL_TYPE_DIV = '" + PosConst.BILL_TYPE_DIV.ADMT_TRAN + "' \n"; // sSql += " AND MBT.USE_YN = '1' \n"; // sSql += " ORDER BY 1, 2 \n"; // sSql = sSql.Replace("\t", " "); // DataTable dtDataInfo = m_cMstService.Select(new string[] { sSql }); // return dtDataInfo; // } // catch (Exception ex) // { // WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); // } // return null; //} //#endregion #region 영업공지사항 조회 /// /// 영업공지사항 조회 /// /// /// public DataTable SelectBusiNotice(string[] aParam) { string sSql = ""; try { sSql = ""; // 영업공지사항 조회 sSql += "SELECT \n"; sSql += " ISNULL(MEN.MSG_CODE, '') CODE \n"; sSql += " , ISNULL(MEN.MSG_TITLE, '') MSG_TITLE \n"; sSql += " , ISNULL(MEN.MSG_CONTENTS, '') MSG \n"; sSql += " , ISNULL(MEN.START_DT, '') START_DT \n"; sSql += " , ISNULL(MEN.FNSH_HOUR, '') END_DT \n"; sSql += "FROM POSMST..MST_EMG_NOTE MEN \n"; sSql += "WHERE \n"; sSql += " MEN.CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' \n"; sSql += "AND MEN.STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' \n"; sSql += "AND MEN.POS_NO IN ('00', '" + m_cPosStatus.Base.PosNo + "') \n"; sSql += "AND '" + m_cPosStatus.Base.SaleDate + "' BETWEEN MEN.START_DT AND MEN.FNSH_HOUR \n"; sSql += "AND MEN.MSG_DIV = '" + ItemConst.NOTE_MSG_DIV.BIZ + "' \n"; sSql += "AND MEN.MSG_TYPE = '" + aParam[0] + "' \n"; sSql += "ORDER BY MEN.MSG_CODE DESC \n"; sSql = sSql.Replace("\t", " "); DataTable dtDataInfo = m_cMstService.Select(new string[] { sSql }); return dtDataInfo; } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } return null; } #endregion } }