using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;

using System.Threading;

using Cosmos.BaseFrame;
using Cosmos.UserFrame;
using Cosmos.ServiceProvider;
using Cosmos.Common;
using Cosmos.CommonManager;

//#20180126 해피오더 당일픽업 건 보여주기 start,phj, 20180321

using System.Net;
using Newtonsoft.Json;
using System.IO;

//#20180126 해피오더 당일픽업 건 보여주기 end,phj, 20180321

//#20170918 기념일 배송 출력 start, 20180718
//'대상 멀티바이트 코드페이지에 유니코드 문자의 매핑이 없습니다. (exception from hresult: 0x80070459)'
//Marshal 클래스 사용하기 위해 using 추가
//변경
using System.Runtime.InteropServices;
//#20170918 기념일 배송 출력 end, 20180718

namespace Cosmos.Win
{
    public partial class frmPosMain : Form
    {
        private SManager sManager = new SManager();                                 //이 객체를 통해 업무 Service 호출
        private StateServer StateObject = (StateServer)StateServer.GetInstance();   //StateObject : StateServer Object(객체)
        private PosStatus m_cPosStatus = new PosStatus();                           //기본정보 참조
        private TranStatus m_cTrnStatus = new TranStatus();                         //거래정보 참조
        private IWatcherBack m_cBackgroundDown = null;

        private ICustDisplayUs m_cCustDisp = null;                                  //고객용 화면 관리

        private PosOLEDevice.DelegateOlePos delegatePos;                            //디바이스 델리게이터
        private IDataCommonUs m_cDataCommon = null;                                 // POS 공통함수 인터페이스
        private IDataServiceUs m_cPosNoticeCom = null;                              // 공지사항 공통    
        private ISvr2Tran m_cSvr2Tran = null;                                       // 서버시간 동기화 

        // Rhee, 2017.10.18 00077점포 매출 Text파일 다운로드 기능(매30분) Start
        private IDataSearch m_cDataSearch = null;
        private string m_sFilePutStoreCode = "00077";                               // 중국 filePut 점포코드
        //private string m_sFilePutStoreCode = "40045";                                 // Test filePut 점포코드
        // Rhee, 2017.10.18 00077점포 매출 Text파일 다운로드 기능(매30분) End

        bool bWebHidden = false;

        // 상단 Slide 메뉴 변수
        private Hashtable m_htMenuControls;                                         // 메뉴버튼 컨트롤 정보
        private ArrayList m_alMenuHead = new ArrayList();                           // 메뉴타이틀정의 배열
        private ArrayList m_alMenuProc = new ArrayList();                           // 메뉴정의 배열

        private string m_SlideMenuKey = string.Empty;                               // 슬라이드 메뉴키

        /// <summary>
        /// 메뉴상단표시위치
        /// </summary>
        private int m_nTopPos = 0;
        private string m_sPosMenuKeyIn = ""; 
        private int m_nTimeSyncFlag = 0;

        //#15058 해피오더 버튼 변경_20180612 start,phj
       
        /// <summary>
        /// 1분 카운트
        /// </summary>
        private int iCount = 0;
        /// <summary>
        /// 해피오더 신규버튼 (true: 활성화, false: 비활성화)
        /// </summary>
        private bool bPosMain = true;
   
        //#15058 해피오더 버튼 변경_20180612 end,phj

        //#20170918 기념일 배송 출력 start
        public struct COPYDATASTRUCT
        {
            public IntPtr dwData;
            public int cbData;
            //#20170918 기념일 배송 출력 start, 20180718
            //'대상 멀티바이트 코드페이지에 유니코드 문자의 매핑이 없습니다. (exception from hresult: 0x80070459)'
            //구조체(COPYDATASTRUCT) 데이터 형식 수정
            //기존
            //public string lpData;
            //변경
            public IntPtr lpData;
            //#20170918 기념일 배송 출력 end, 20180718
        }
        //#20170918 기념일 배송 출력 end

        //#20180605 해피오더 개선 start
        //즉시주문, 예약주문 알림
        //즉시픽업
        private int m_nTimeSync_HpOrd_Direct = 0;
        //즉시배달
        private int m_nTimeSync_HpOrd_Reserv = 0;
        //#20180605 해피오더 개선 end

        //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 start - #16368
        //기존
        /*
        //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 start
        /// <summary>
        /// 해피오더 실시간 재고 알림 디스플레이 상태 (true : 디스플레이 false: 미디스플레이)
        /// </summary>
        private bool bInventoryDispStat = false;
        /// <summary>
        /// 특별한 액션이 없을 때 (1분동안보여줌)
        /// </summary>
        private int iInventoryDispCnt = -1;
        //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 end
        */

        //변경
        /// <summary>
        /// true: 닫기, false: 열기 
        /// </summary>
        private bool bInventoryCancel = false;
        //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 end - #16368

        /// <summary>
        /// 시작 화면
        /// </summary>
        public Form frmMainStart = null;

        public frmPosMain()
        {
            InitializeComponent();

            base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);
            //this.UpdateStyles();

            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.DoubleBuffer, true);
            SetStyle(ControlStyles.UserPaint, true);

            m_cPosStatus = (PosStatus)StateObject.POS;          //POS 기본정보
            m_cTrnStatus = (TranStatus)StateObject.TRAN;        //POS 거래정보

            m_cCustDisp = (ICustDisplayUs)sManager.InitServiceInstance(ServiceLists.ASV_CUSTDISPLAY.DLL, ServiceLists.ASV_CUSTDISPLAY.CUST_DISPLAY);
            m_cDataCommon = (IDataCommonUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_COMMON);
            m_cPosNoticeCom = (IDataServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_BASIC.DLL, ServiceLists.BSV_BASIC.POS_NOTICE_COM);
            m_cSvr2Tran = (ISvr2Tran)sManager.InitServiceInstance(ServiceLists.BSV_SALE.DLL, ServiceLists.BSV_SALE.SVR2TRAN);

            // Rhee, 2017.10.18 00077점포 매출 Text파일 다운로드 기능(매30분) Start
            m_cDataSearch = (IDataSearch)sManager.InitServiceInstance(ServiceLists.BSV_ADMIN.DLL, ServiceLists.BSV_ADMIN.DATASEARCH);
            // Rhee, 2017.10.18 00077점포 매출 Text파일 다운로드 기능(매30분) End

            // 백그라운드 다운 데몬 기동
            m_cBackgroundDown = (IWatcherBack)sManager.InitServiceInstance(ServiceLists.AGENT_BACKGROUND_DOWN.DLL, ServiceLists.AGENT_BACKGROUND_DOWN.BACKGROUND_DOWN_MAIN);

            // OLE 입력 델리게이트 생성
            delegatePos = new PosOLEDevice.DelegateOlePos(OnDeviceEvent);

            InitControl();          // 폼 컨트롤 초기화

            DisplayTitle();

            GetNoticeEvent();


    //2018.01.17; 미국 동부의 경우 WEB 메뉴 히든 처리; girak.kim
            if (m_cPosStatus.Base.CmpCd.ToUpper().Equals(PosConst.POS_COMPANY_CODE.PCUS) && m_cPosStatus.Base.BrandCd.ToUpper().Equals(PosConst.MST_BRAND_CODE.PC_UY))
            {
                lblWeb.Visible = false;
                picWeb.Visible = false;
            }


        }

        private void frmPosMain_Load(object sender, EventArgs e)
        {
            UserLog.WriteLogFile(UserCom.LOG_IOS, 
                                 System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                 System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + 
                                 System.Reflection.MethodBase.GetCurrentMethod().Name + 
                                 "()", 
                                 "");

            //m_cCustDisp.StartCustDisplay();     // 고객용화면 시작  - 20161020 frmPosMainStart 로 이동함

            m_cPosStatus.Sale.ScreenSaverTime = DateTime.Now.ToString("yyyyMMddHHmmss");    //화면보호기 대기시간 설정

            // 프로그램 버전정보 표시
            lblPgmVersion.Text = string.Format("VER:{0}", m_cPosStatus.Ver.ProgramVer == "" ? "2016011000001" : m_cPosStatus.Ver.ProgramVer);
            if (m_cPosStatus.Base.MstDownDate.Trim() != "") lblDBVersion.Text = "MST:" + m_cPosStatus.Base.MstDownDate;

            //#20171011 영업일, 시스템일시 위치 변경 start
            // 개점일자 표기
            //lblSaleDate.Text = string.Format("SaleDate : {0}", m_cPosStatus.Base.SaleDate == "" ? m_cPosStatus.Global.DateToCulture("20000101") : m_cPosStatus.Global.DateToCulture(m_cPosStatus.Base.SaleDate));
            //#20171011 영업일, 시스템일시 위치 변경 end

            // 시작화면 숨김 처리(2017.07.11)
            if (frmMainStart != null) frmMainStart.Top = 2048;

            // 시스템오픈(실가동) 전 연습모드 처리 
            if (m_cPosStatus.Base.SysOpenDate.Trim().Length == 8)
            {
                if ((CmUtil.IntParse(m_cPosStatus.Base.SysOpenDate) > CmUtil.IntParse(DateTime.Now.ToString("yyyyMMdd")))
                    || (CmUtil.IntParse(m_cPosStatus.Base.SysOpenDate) == CmUtil.IntParse(DateTime.Now.ToString("yyyyMMdd")) && CmUtil.LongParse(System.DateTime.Now.ToString("HH")) < 4))
                {
                    var msg = string.Format(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0595)
                                          , m_cPosStatus.Base.SysOpenDate.Substring(0, 4)
                                          , m_cPosStatus.Base.SysOpenDate.Substring(4, 2)
                                          , m_cPosStatus.Base.SysOpenDate.Substring(6, 2));

                    var orgOpenClose = m_cPosStatus.Base.OpenClose;
                    var orgSaleDate = m_cPosStatus.Base.SaleDate;

                    m_cPosStatus.Base.OpenClose = "1";
                    m_cPosStatus.Base.SaleDate = DateTime.Now.ToString("yyyyMMdd");
                    m_cPosStatus.Base.TrainingFlag = ItemConst.TRAINING_FLAG.TRAINING_YES;
                    
                    // 판매시작 
                    PosSaleProc();

                    m_cPosStatus.Base.OpenClose = orgOpenClose;
                    m_cPosStatus.Base.SaleDate = orgSaleDate;
                    m_cPosStatus.Base.TrainingFlag = ItemConst.TRAINING_FLAG.TRAINING_NO;

                    // 프로그램 종료
                    PosExitProc();
                    return;
                }
            }

            // 초기화면 생략 옵션이면 판매등록 화면으로 이동
            if (PosMstManager.GetPosOption(POS_OPTION.OPT011) == "1")
            {
                //if (m_cPosStatus.Base.OpenClose == "1")
                //{
                //    // 전일자 마감 처리 여부 체크
                //    if (CmUtil.LongParse(m_cPosStatus.Base.SaleDate) < CmUtil.LongParse(System.DateTime.Now.ToString("yyyyMMdd")))
                //    {
                //        // 마감화면으로 이동
                //        WinOpenClose.ShowForm(new string[] { FormManager.FORM_ACC_SALE_END, PosKey.MENU_KEY.SALE_CLOSE, ItemConst.TRAN_KIND.STATEMENT.ADJUSTMENT, ItemConst.TRAN_DIV.NORMAL });
                //    }
                //}

                if (m_cPosStatus.Base.OpenClose != "1")
                {
                    // 영업개시가 처리 되지 않았다면 영업개시 처리
                    PosMainProc(PosKey.MENU_KEY.SALE_OPEN);
                }
                else if (m_cPosStatus.Base.OpenClose == "1")
                {
                    // 판매 화면으로 이동 처리
                    PosMainProc(PosKey.MENU_KEY.POS_SALE);
                }
            }

            //#16366 해피오더 당월누적주문내역 + 당일 해피오더주문 상세내역 자동 출력기능 start
            //기존
            /*
            //타이머 호출
            tmrMainTimer.Enabled = true;
            tmrDateTime.Enabled = true;
            // Rhee, 2017.10.18 00077점포 매출 Text파일 다운로드 기능(매30분) Start
            if (m_cPosStatus.Base.CmpCd.ToUpper().Equals("PCCN") && m_cPosStatus.Base.StoreNo == m_sFilePutStoreCode)
            {
                tmrFilePutTimer.Enabled = true;
                tmrFilePutTimer.Start();
            }
            else
            {
                tmrFilePutTimer.Enabled = false;
            }
            // Rhee, 2017.10.18 00077점포 매출 Text파일 다운로드 기능(매30분) End
            */
            //변경
           
            //타이머 호출
            tmrFilePutTimer.Enabled = false;
            tmrMainTimer.Enabled = false;
            tmrDateTime.Enabled = false;

            //#16366 해피오더 당월누적주문내역 + 당일 해피오더주문 상세내역 자동 출력기능 start
            HappyOrderAutoPrint();
            //#16366 해피오더 당월누적주문내역 + 당일 해피오더주문 상세내역 자동 출력기능 end

            //#17142 [해피오더]POS로그인 시 영수증프린터로 장부재고 자동 출력 start
            BookInventoryAutoPrint();
            //#17142 [해피오더]POS로그인 시 영수증프린터로 장부재고 자동 출력 end

            tmrMainTimer.Enabled = true;
            tmrDateTime.Enabled = true;
            
            //#16366 해피오더 당월누적주문내역 + 당일 해피오더주문 상세내역 자동 출력기능 end
        }

        //#16366 해피오더 당월누적주문내역 + 당일 해피오더주문 상세내역 자동 출력기능 start
        #region ini 값 가져오기 
        private string GetConfigInfo(CmMessage cCfgInfo, string sGroup, string sValueName)
        {
            return GetConfigInfo(cCfgInfo, sGroup, sValueName, "");
        }
        private string GetConfigInfo(CmMessage cCfgInfo, string sGroup, string sValueName, string sDefault)
        {
            try
            {
                string sValue = cCfgInfo.GetMessage(sGroup).GetMessageValue(sValueName);

                if (sValue == null)
                    return sDefault;
                else
                    return sValue;
            }
            catch { }

            return sDefault;
        }
        #endregion
        //#16366 해피오더 당월누적주문내역 + 당일 해피오더주문 상세내역 자동 출력기능 end

        //#16366 해피오더 당월누적주문내역 + 당일 해피오더주문 상세내역 자동 출력기능 start
        #region 해피오더 당월누계, 당일픽업 건 자동 출력함수 
        /// <summary>
        /// 해피오더 자동출력 여부 
        /// 당월누계 건 1장 출력
        /// 당일픽업 건 2장씩 출력 
        /// 새벽 4시 이 후 첫 로깅 시에만 각각 옵션에 따라 출력함.
        /// </summary>
        private void HappyOrderAutoPrint()
        {
            try
            {
                //현재일시
                string sNowdate = DateTime.Now.ToString("yyyyMMddHHmmss");

                //ini 값 
                CmMessage m_PosSaleInfo = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo);
                string sHappyOrderAutoPrint_MM = CmUtil.StringNullEmpty(GetConfigInfo(m_PosSaleInfo, "POSOPEN", "HappyOrderAutoPrint_MM"));
                string sHappyOrderAutoPrint_DD = CmUtil.StringNullEmpty(GetConfigInfo(m_PosSaleInfo, "POSOPEN", "HappyOrderAutoPrint_DD"));

                if (CmUtil.IntParse(CmUtil.MidH(sNowdate, 8, 2)) >= 04)
                {
                    IHappyOrderList m_cHappyOrderList = null;
                    m_cHappyOrderList = (IHappyOrderList)sManager.InitServiceInstance(ServiceLists.BSV_SALE.DLL, ServiceLists.BSV_SALE.HAPPY_ORDER_LIST);


                    // 당월 누계 건 1장 출력
                    if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT519),"0") == "1")
                    {
                        if (string.IsNullOrEmpty(sHappyOrderAutoPrint_MM.Trim()) == true ||
                            (CmUtil.IntParse(CmUtil.MidH(sNowdate, 0, 8)) > CmUtil.IntParse(CmUtil.MidH(sHappyOrderAutoPrint_MM, 0, 8))))
                        {
                            bool bHappyOrderAutoPrint_MM = false;
                            bHappyOrderAutoPrint_MM = m_cHappyOrderList.HappyOrderToMonthPrint(true);

                            if (bHappyOrderAutoPrint_MM == true)
                            {
                                UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                                     System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
                                                     System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
                                                     "당월누계 건 출력 완료!");

                                System.Threading.Thread.Sleep(1000);

                                // 위의 프로세스 진행 시 ini 이력 저장 
                                CmMessage cmPosSaleInfo = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo);
                                cmPosSaleInfo.GetMessage("POSOPEN".Trim()).MakeMessageOverWrite("HappyOrderAutoPrint_MM".Trim(), DateTime.Now.ToString("yyyyMMddHHmmss"));
                                cmPosSaleInfo.MakeFileFromMessage(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo);
                            }
                        }
                    }

                    // 당일 픽업 건 2장씩 출력
                    if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT520), "0") == "1")
                    {
                        if (string.IsNullOrEmpty(sHappyOrderAutoPrint_DD.Trim()) == true ||
                            (CmUtil.IntParse(CmUtil.MidH(sNowdate, 0, 8)) > CmUtil.IntParse(CmUtil.MidH(sHappyOrderAutoPrint_DD, 0, 8))))
                        {
                            bool bHappyOrderAutoPrint_DD = false;
                            bHappyOrderAutoPrint_DD = m_cHappyOrderList.HappyOrderTodayPrint(true);

                            if (bHappyOrderAutoPrint_DD == true)
                            {
                                UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                                     System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
                                                     System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
                                                     "당일픽업 건 출력 완료!");

                                System.Threading.Thread.Sleep(1000);

                                // 위의 프로세스 진행 시 ini 이력 저장 
                                CmMessage cmPosSaleInfo = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo);
                                cmPosSaleInfo.GetMessage("POSOPEN".Trim()).MakeMessageOverWrite("HappyOrderAutoPrint_DD".Trim(), DateTime.Now.ToString("yyyyMMddHHmmss"));
                                cmPosSaleInfo.MakeFileFromMessage(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                            System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
                                            System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
                                            ex.Message);
            }
        } 
        
        #endregion
        //#16366 해피오더 당월누적주문내역 + 당일 해피오더주문 상세내역 자동 출력기능 end

        //#17142 [해피오더]POS로그인 시 영수증프린터로 장부재고 자동 출력 start
        #region 최초 로그인 시 장부재고 1이상인 품목 영수증 출력
        private void BookInventoryAutoPrint()
        {
            try
            {
                //현재일시
                string sNowdate = DateTime.Now.ToString("yyyyMMddHHmmss");

                //ini 값 
                CmMessage m_PosSaleInfo = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo);
                string sBookInventoryPrint = CmUtil.StringNullEmpty(GetConfigInfo(m_PosSaleInfo, "POSOPEN", "BookInventoryPrint"));

                // 최초 로그인 시 장부재고 1이상인 품목 영수증 출력
                if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT557), "0") == "1")
                {
                    if (string.IsNullOrEmpty(sBookInventoryPrint.Trim()) == true || (CmUtil.IntParse(CmUtil.MidH(sNowdate, 0, 8)) > CmUtil.IntParse(CmUtil.MidH(sBookInventoryPrint, 0, 8))))
                    {
                        string sBookInventoryData = "";

                        // 서버통신 
                        string sRet = BookInventoryDataGet(out sBookInventoryData);
                        if (sRet == UserCom.RST_OK)
                        {
                            if (sBookInventoryData != "")
                            {
                                // 데이터 파싱및 프린트 내용 작성 
                                bool bBookInventoryPrint = BookInventoryDataParsing(sBookInventoryData);
                                if (bBookInventoryPrint == true)
                                {
                                    System.Threading.Thread.Sleep(1000);

                                    UserLog.WriteLogFile(UserCom.LOG_IOS,
                                                         System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                                         System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
                                                         System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
                                                         "최초 로그인 시 장부재고 1이상인 품목 영수증 출력 완료!");

                                    // 위의 프로세스 진행 시 ini 이력 저장 
                                    CmMessage cmPosSaleInfo = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo);
                                    cmPosSaleInfo.GetMessage("POSOPEN".Trim()).MakeMessageOverWrite("BookInventoryPrint".Trim(), DateTime.Now.ToString("yyyyMMddHHmmss"));
                                    cmPosSaleInfo.MakeFileFromMessage(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                            System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
                                            System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
                                            ex.Message);
            }
        }
        #endregion
        //#17142 [해피오더]POS로그인 시 영수증프린터로 장부재고 자동 출력 end

        //#17142 [해피오더]POS로그인 시 영수증프린터로 장부재고 자동 출력 start
        #region IQ_BOOK_INVENTORY 최초 로그인 시 장부재고 1이상인 품목 영수증 출력
        /// <summary>
        /// 서버에서 장부재고 데이터 가져오기 
        /// </summary>
        private string BookInventoryDataGet(out string sBookInventoryData)
        {
            string sRet = UserCom.RST_ERR;
            string sResData = "";

            if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT557), "0") != "1")
            {
                sBookInventoryData = "";
                return sRet;
            }

            try
            {
                Hashtable htRecvData = new Hashtable();
                Hashtable htSendData = new Hashtable();

                htRecvData.Clear();
                htSendData.Clear();

                htSendData.Add(Column.IQ_BOOK_INVENTORY.DATA.INQ_TYPE, ItemConst.IRT_INQ_TYPE.BOOK_INVENTORY);
                htSendData.Add(Column.IQ_BOOK_INVENTORY.DATA.SALE_DT, "");
                htSendData.Add(Column.IQ_BOOK_INVENTORY.DATA.RES_CD, "");
                htSendData.Add(Column.IQ_BOOK_INVENTORY.DATA.RES_DATA, "");

                sRet = m_cDataCommon.ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, m_cPosStatus.Base.CommSvrIp, (int)m_cPosStatus.Base.BizInqPort, 5000, htSendData, ref htRecvData, false);

                if (sRet == UserCom.RST_OK)
                {
                    if (htRecvData[Column.IQ_BOOK_INVENTORY.DATA.RES_CD].ToString() == "00")
                    {
                        //장부재고 데이터 
                        if (htRecvData[Column.IQ_BOOK_INVENTORY.DATA.RES_DATA].ToString() != "")
                        {
                            sRet = UserCom.RST_OK;

                            sResData = htRecvData[Column.IQ_BOOK_INVENTORY.DATA.RES_DATA].ToString();

                            UserLog.WriteLogFile(UserCom.LOG_IOS,
                                                 System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                                 System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
                                                 System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sResData.Trim());
                        }
                        else
                        {
                            UserLog.WriteLogFile(UserCom.LOG_IOS,
                                                 System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                                 System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
                                                 System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "장부재고 데이터가 없습니다. ");
                        }
                    }
                    else
                    {
                        UserLog.WriteLogFile(UserCom.LOG_IOS,
                                             System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                             System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
                                             System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "정상적으로 응답받지 못했습니다.");
                    }
                }
                else
                {
                    UserLog.WriteLogFile(UserCom.LOG_IOS,
                                         System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                         System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
                                         System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "서버와 통신하지 못했습니다. ");
                }

                //test
                //sResData = "케익류|231444|벨기에화이트1|3#~케익류|231444|벨기에화이트2|3#~케익류|231444|벨기에화이트3|3";
                //sRet = UserCom.RST_OK;

                sBookInventoryData = sResData;
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                            System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
                                            System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
                                            ex.Message);
                sBookInventoryData = "";
            }
            return sRet;
        }

        /// <summary>
        /// 장부재고 데이터 파싱 및 영수증 포맷 생성 
        /// </summary>
        private bool BookInventoryDataParsing(string pBookInventoryData)
        {
            bool bRet = false;
            if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT557), "0") != "1") return bRet;
            try
            {
                ISaleCompleteUs m_cRecService = (ISaleCompleteUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.SALE_COMPLETE);

                string sRet = m_cRecService.BookInventoryPrint(pBookInventoryData);

                if (sRet == UserCom.RST_OK)
                {
                    bRet = true;
                }
            }
            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 bRet;
        }
        #endregion IQ_BOOK_INVENTORY 최초 로그인 시 장부재고 1이상인 품목 영수증 출력
        //#17142 [해피오더]POS로그인 시 영수증프린터로 장부재고 자동 출력 end

        // 시작화면 숨김을 Activated 이벤트에서 처리하지 않고 Load 에서 처리 하도록 수정(2017.07.11)
        //private void frmPosMain_Activated(object sender, EventArgs e)
        //{
        //    try
        //    {
        //        if (frmMainStart != null) frmMainStart.Top = 2048;
        //    }
        //    catch (Exception ex)
        //    {
        //        WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
        //            System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
        //    }
        //}

        private void frmPosMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            GetTopMsgMode("");

            tmrMainTimer.Enabled = false;
            tmrDateTime.Enabled = false;
            // Rhee, 2017.10.18 00077점포 매출 Text파일 다운로드 기능(매30분) Start
            if (m_cPosStatus.Base.CmpCd.ToUpper().Equals("PCCN") && m_cPosStatus.Base.StoreNo == m_sFilePutStoreCode)
            {
                tmrFilePutTimer.Stop();
                tmrFilePutTimer.Enabled = false;
            }
            // Rhee, 2017.10.18 00077점포 매출 Text파일 다운로드 기능(매30분) End

            UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "");
        }
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);
            if (m_cPosStatus.Base.TrainingFlag == ItemConst.TRAINING_FLAG.TRAINING_NO)
            {
                // 준비점검 공지사항
                WinOpenClose.EndStoreCheck(PosConst.POS_CHECK_ALARM_TYPE.CHECK_TYPE_LOGIN, PosKey.MENU_KEY.LOG_ON);
            }

        }


        /// <summary>
        /// 폼 컨트롤 초기화
        /// </summary>
        private void InitControl()
        {
            try
            {
                this.SuspendLayout();

                FormManager.SetFormAllControlFont(this, m_cPosStatus.Base.FONT);

                //picTopBg.BackgroundImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MAIN_TOP_BG);
                //picFooterBg.BackgroundImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MAIN_FOOTER_BG);

                picMainBack.Image = ImageManager.GetImage(BaseCom.NxCDPPath + PosConst.MST_IMG_PATH.CDP_COM, m_cPosStatus.ScnMst.MainImg);
                if (picMainBack.Image != null)
                    CmUtil.FileCopy(BaseCom.NxCDPPath + PosConst.MST_IMG_PATH.CDP_COM + m_cPosStatus.ScnMst.MainImg, BaseCom.NxCDPPath + PosConst.MST_IMG_PATH.CDP_COM + ImageManager.INTRO_BACK, false);
                else
                    picMainBack.Image = ImageManager.GetImage(BaseCom.NxCDPPath + PosConst.MST_IMG_PATH.CDP_COM, ImageManager.INTRO_BACK);

                picContents.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.INTRO_CONTENTS);

                #region
                btnMenu01.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.INTRO_OPEN);
                btnMenu01.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.INTRO_OPEN_PRESS);
                btnMenu01.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0001) + PosConst.CRLF + PosConst.CRLF;
                btnMenu01.Tag = PosKey.MENU_KEY.SALE_OPEN;

                btnMenu02.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.INTRO_SELL);
                btnMenu02.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.INTRO_SELL_PRESS);
                btnMenu02.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0002) + PosConst.CRLF + PosConst.CRLF;
                btnMenu02.Tag = PosKey.MENU_KEY.POS_SALE;

                btnMenu03.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.INTRO_CLOSE);
                btnMenu03.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.INTRO_CLOSE_PRESS);
                btnMenu03.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0003) + PosConst.CRLF + PosConst.CRLF;
                btnMenu03.Tag = PosKey.MENU_KEY.POS_CLOSE;

                btnMenu04.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.INTRO_SEARCH);
                btnMenu04.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.INTRO_SEARCH_PRESS);
                btnMenu04.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0004) + PosConst.CRLF + PosConst.CRLF;
                btnMenu04.Tag = PosKey.MENU_KEY.POS_SEARCH;

                btnMenu05.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.INTRO_SETTING);
                btnMenu05.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.INTRO_SETTING_PRESS);
                btnMenu05.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0005) + PosConst.CRLF + PosConst.CRLF;
                btnMenu05.Tag = PosKey.MENU_KEY.POS_SETTING;

                btnMenu06.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.INTRO_TRAINING);
                btnMenu06.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.INTRO_TRAINING_PRESS);
                btnMenu06.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0458) + PosConst.CRLF + PosConst.CRLF;
                btnMenu06.Tag = PosKey.MENU_KEY.POS_EDU;
                //btnMenu06.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0006);
                //btnMenu06.Tag = PosKey.MENU_KEY.POS_TRAINING;

                btnMenu07.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.INTRO_ETC);
                btnMenu07.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.INTRO_ETC_PRESS);
                btnMenu07.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0007) + PosConst.CRLF + PosConst.CRLF;
                btnMenu07.Tag = PosKey.MENU_KEY.POS_ETC;

                btnMenu08.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.INTRO_END);
                btnMenu08.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.INTRO_END_PRESS);
                btnMenu08.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0008) + PosConst.CRLF + PosConst.CRLF;
                btnMenu08.Tag = PosKey.MENU_KEY.PROGRAM_EXIT;

                //MoonSeokWoo 2017.09.04
                //btnMenu09.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.);
                //btnMenu09.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.INTRO_END_PRESS);
                btnMenu09.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0313);
                btnMenu09.Tag = PosKey.MENU_KEY.PGM_DOWNLOAD;
                // Rhee, 2017.09.14 메세지 번역 누락 Start
                lblMasterAll.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0787);
                lblMasterUpdate.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0788);
                lblCampaignMasterAll.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1026);
                // Rhee, 2017.09.14 메세지 번역 누락 End


                #endregion

                picWeb.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.WEB_ICON);
                picWeb.Tag = "ON";
                lblWeb.Tag = "0";

                lblNoticeTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0393);
                lblCampaignTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0400);

                lblSaleStatus.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0045);

                lblOffLine.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1020);

                if (string.IsNullOrEmpty(lblOffLine.Text) == true)
                    lblOffLine.Text = "The currently offline. Please check your nework.";


                //// 해피오더 주문건수 알림 사용 여부
                //if(CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT035), "0") == "0")
                //{
                //    lblIFStatus1.Visible = false;
                //}
                //// 빚은몰 주문건수 알림 사용 여부
                //if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT036), "0") == "0")
                //{
                //    lblIFStatus2.Visible = false;
                //}
                //// 이지웰 주문건수 알림 사용 여부
                //if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT037), "0") == "0")
                //{
                //    lblIFStatus3.Visible = false;
                //}

                lblTopMsgMode.csmMoveFont = new Font(m_cPosStatus.Base.FONT, 21);
                pnlTopBg.BackColor = Color.FromArgb(34, 34, 34);
                pnlIFStatus4.BackColor = Color.FromArgb(34, 34, 34);

                if (m_cPosStatus.Sale.ScreenSizeUser == 800)
                {
                    #region
                    this.Size = new Size(800, 600);
                    FormManager.SetControlSize(pnlTopBg, 0, 0, 800, 50);
                    FormManager.SetControlSize(picMainBack, 0, 50, 800, 250);
                    FormManager.SetControlSize(picContents, 0, 300, 800, 278);
                    FormManager.SetControlSize(picFooterBg, 0, 578, 800, 22);

                    FormManager.SetControlSize(btnMenu01, 270, 300, 130, 136, 16);
                    FormManager.SetControlSize(btnMenu02, 403, 300, 130, 136, 16);
                    FormManager.SetControlSize(btnMenu03, 536, 300, 130, 136, 16);
                    FormManager.SetControlSize(btnMenu04, 669, 300, 130, 136, 16);
                    FormManager.SetControlSize(btnMenu05, 270, 440, 130, 136, 16);
                    FormManager.SetControlSize(btnMenu06, 403, 440, 130, 136, 16);
                    FormManager.SetControlSize(btnMenu07, 536, 440, 130, 136, 16);
                    FormManager.SetControlSize(btnMenu08, 669, 440, 130, 136, 16);

                    FormManager.SetControlSize(btnMenu09, 669, 279, 135, 22, 12);

                    FormManager.SetControlSize(lblPgmVersion, 448, 579, 190, 20, 10);
                    FormManager.SetControlSize(lblDBVersion, 616, 579, 190, 20, 10);

                    FormManager.SetControlSize(lblTopMsgMode, 95, 0, 705, 50, 21);
                    FormManager.SetControlSize(lblSaleStatus, 0, 0, 95, 50, 14);
                    FormManager.SetControlSize(lblStoreNm, 101, 2, 98, 21, 10);
                    FormManager.SetControlSize(lblPosNo, 203, 2, 63, 21, 10);
                    FormManager.SetControlSize(lblTranNo, 270, 2, 78, 21, 10);
                    FormManager.SetControlSize(lblCashier, 353, 2, 69, 21, 10);
                    FormManager.SetControlSize(btnAdmin, 426, 2, 69, 21, 10);
                    FormManager.SetControlSize(lblDateTime, 499, 2, 152, 21, 10);
                    FormManager.SetControlSize(lblDeviceState, 654, 14, 20, 21, 15);
                    FormManager.SetControlSize(lblEtc, 675, 2, 48, 44, 10);
                    FormManager.SetControlSize(picWeb, 727, 16, 15, 14);
                    FormManager.SetControlSize(lblWeb, 742, 2, 56, 44, 10);

                    FormManager.SetControlSize(lblIFStatus1, 220, 25, 136, 21, 10); 
                    FormManager.SetControlSize(lblIFStatus2, 360, 25, 76, 21, 10);
                    FormManager.SetControlSize(lblIFStatus3, 440, 25, 76, 21, 10);
                    FormManager.SetControlSize(pnlIFStatus4, 520, 25, 106, 21, 10);


                    //#15058 해피오더 버튼 변경_20180612 start,phj
                    FormManager.SetControlSize(PnlNewHPOrd_Disp, 220, 0, 136, 50, 21);
                    //#15058 해피오더 버튼 변경_20180612 end,phj



                    FormManager.SetControlSize(lblTemperature01, 0, 0, 35, 21, 9.75f);
                    FormManager.SetControlSize(lblTemperature02, 36, 0, 35, 21, 9.75f);
                    FormManager.SetControlSize(lblTemperature03, 72, 0, 35, 21, 9.75f);
                    FormManager.SetControlSize(lblOwnerPart, 630, 25, 134, 21, 10);
                    FormManager.SetControlSize(lblAnniv, 773, 25, 147, 21, 10);

                    FormManager.SetControlSize(pnlMenuSlide, 0, 50, 800, 90, 11);
                    FormManager.SetControlSize(picMenuSlide, 0, 0, 800, 90, 11);
                    FormManager.SetControlSize(lblSlideMenu01, 47, 14, 116, 62, 11);
                    FormManager.SetControlSize(lblSlideMenu02, 165, 14, 116, 62, 11);
                    FormManager.SetControlSize(lblSlideMenu03, 283, 14, 116, 62, 11);
                    FormManager.SetControlSize(lblSlideMenu04, 401, 14, 116, 62, 11);
                    FormManager.SetControlSize(lblSlideMenu05, 519, 14, 116, 62, 11);
                    FormManager.SetControlSize(lblSlideMenu06, 637, 14, 116, 62, 11);
                    FormManager.SetControlSize(btnUp, 0, 0, 40, 90, 20);
                    FormManager.SetControlSize(btnDown, 760, 0, 40, 90, 20);

                    FormManager.SetControlSize(pnlTempInfo, 0, 50, 800, 90, 11);
                    FormManager.SetControlSize(picTempInfo, 0, 0, 800, 90, 11);
                    FormManager.SetControlSize(lblTemp1, 21, 5, 239, 80, 14);
                    FormManager.SetControlSize(lblTemp2, 280, 5, 239, 80, 14);
                    FormManager.SetControlSize(lblTemp3, 540, 5, 239, 80, 14);

                    FormManager.SetControlSize(lblNoticeTitle, 25, 315, 204, 23, 16);
                    FormManager.SetControlSize(lblNoticeAll, 232, 316, 22, 24, 14);
                    FormManager.SetControlSize(lblNoticeDtl01, 25, 348, 231, 23, 12);
                    FormManager.SetControlSize(lblNoticeDtl02, 25, 379, 231, 23, 12);
                    FormManager.SetControlSize(lblNoticeDtl03, 25, 409, 231, 23, 12);

                    FormManager.SetControlSize(lblCampaignTitle, 25, 456, 204, 23, 16);
                    FormManager.SetControlSize(lblCampainAll, 232, 457, 22, 24, 14);
                    FormManager.SetControlSize(lblCampaignDtl01, 25, 490, 231, 23, 12);
                    FormManager.SetControlSize(lblCampaignDtl02, 25, 520, 231, 23, 12);
                    FormManager.SetControlSize(lblCampaignDtl03, 25, 550, 231, 23, 12);

                    FormManager.SetControlSize(lblOffLine, 263, 24, 385, 25, 12);

                    FormManager.SetControlSize(pnlShortCut, 400, 305, 372, 90, 11);
                    FormManager.SetControlSize(picShortCut, 0, 0, 467, 90, 11);
                    FormManager.SetControlSize(lblMasterAll, 9, 14, 116, 62, 11);
                    FormManager.SetControlSize(lblMasterUpdate, 161, 14, 116, 62, 11);
                    FormManager.SetControlSize(lblCampaignMasterAll, 313, 14, 116, 62, 11);

                    #endregion
                }
                else
                {
                    #region
                    this.Size = new Size(1024, 768);
                    FormManager.SetControlSize(pnlTopBg, 0, 0, 1024, 50);
                    FormManager.SetControlSize(picFooterBg, 0, 747, 1024, 22);
                    FormManager.SetControlSize(picMainBack, 0, 50, 1024, 332);
                    FormManager.SetControlSize(picContents, 0, 382, 1024, 362);

                    FormManager.SetControlSize(btnMenu01, 348, 386, 165, 175, 18);
                    FormManager.SetControlSize(btnMenu02, 516, 386, 165, 175, 18);
                    FormManager.SetControlSize(btnMenu03, 685, 386, 165, 175, 18);
                    FormManager.SetControlSize(btnMenu04, 854, 386, 165, 175, 18);
                    FormManager.SetControlSize(btnMenu05, 347, 565, 165, 175, 18);
                    FormManager.SetControlSize(btnMenu06, 516, 565, 165, 175, 18);
                    FormManager.SetControlSize(btnMenu07, 685, 565, 165, 175, 18);
                    FormManager.SetControlSize(btnMenu08, 854, 565, 165, 175, 18);
                    
                    FormManager.SetControlSize(btnMenu09, 852, 350, 172, 30, 12);

                    FormManager.SetControlSize(lblPgmVersion, 647, 747, 190, 20, 10);
                    FormManager.SetControlSize(lblDBVersion, 838, 747, 190, 20, 10);

                    FormManager.SetControlSize(lblTopMsgMode, 125, 0, 898, 50, 21);
                    FormManager.SetControlSize(lblSaleStatus, 0, 0, 125, 50, 14);
                    FormManager.SetControlSize(lblStoreNm, 131, 2, 118, 21, 11);
                    FormManager.SetControlSize(lblPosNo, 263, 2, 66, 21, 11);
                    FormManager.SetControlSize(lblTranNo, 343, 2, 106, 21, 11);
                    FormManager.SetControlSize(lblCashier, 463, 2, 89, 21, 11);
                    FormManager.SetControlSize(btnAdmin, 562, 2, 89, 21, 11);
                    FormManager.SetControlSize(lblDateTime, 655, 2, 206, 21, 11);
                    FormManager.SetControlSize(lblDeviceState, 863, 2, 22, 40, 15);
                    FormManager.SetControlSize(lblEtc, 889, 2, 53, 44, 11);
                    FormManager.SetControlSize(picWeb, 950, 16, 15, 15);
                    FormManager.SetControlSize(lblWeb, 958, 2, 66, 44, 11);

                    //FormManager.SetControlSize(lblIFStatus1, 273, 25, 186, 21, 11);
                    FormManager.SetControlSize(lblIFStatus1, 273, 25, 260, 21, 10);
                    //FormManager.SetControlSize(lblIFStatus2, 460, 25, 116, 21, 11);
                    FormManager.SetControlSize(lblIFStatus2, 460, 25, 95, 21, 10);
                    //FormManager.SetControlSize(lblIFStatus3, 577, 25, 116, 21, 11);
                    FormManager.SetControlSize(lblIFStatus3, 577, 25, 95, 21, 10);
                    FormManager.SetControlSize(pnlIFStatus4, 692, 25, 118, 21, 11);

                    //#15058 해피오더 버튼 변경_20180612 start,phj
                    FormManager.SetControlSize(PnlNewHPOrd_Disp, 273, 0, 260, 50, 21);
                    //#15058 해피오더 버튼 변경_20180612 end,phj

                    FormManager.SetControlSize(lblTemperature01, 0, 0, 35, 21, 9.75f);
                    FormManager.SetControlSize(lblTemperature02, 36, 0, 35, 21, 9.75f);
                    FormManager.SetControlSize(lblTemperature03, 72, 0, 35, 21, 9.75f);
                    //FormManager.SetControlSize(lblOwnerPart, 811, 25, 169, 21, 11);
                    FormManager.SetControlSize(lblOwnerPart, 811, 25, 182, 21, 11);
                    //FormManager.SetControlSize(lblAnniv, 974, 25, 192, 21, 11);
                    FormManager.SetControlSize(lblAnniv, 974, 25, 118, 21, 11);

                    FormManager.SetControlSize(pnlMenuSlide, 0, 50, 1024, 90, 11);
                    FormManager.SetControlSize(picMenuSlide, 0, 0, 1024, 90, 11);
                    FormManager.SetControlSize(lblSlideMenu01, 58, 14, 145, 62, 11);
                    FormManager.SetControlSize(lblSlideMenu02, 210, 14, 145, 62, 11);
                    FormManager.SetControlSize(lblSlideMenu03, 363, 14, 145, 62, 11);
                    FormManager.SetControlSize(lblSlideMenu04, 516, 14, 145, 62, 11);
                    FormManager.SetControlSize(lblSlideMenu05, 668, 14, 145, 62, 11);
                    FormManager.SetControlSize(lblSlideMenu06, 820, 14, 145, 62, 11);
                    FormManager.SetControlSize(btnUp, 0, 0, 49, 90, 20);
                    FormManager.SetControlSize(btnDown, 972, 0, 49, 90, 20);

                    FormManager.SetControlSize(pnlTempInfo, 0, 50, 1024, 90, 11);
                    FormManager.SetControlSize(picTempInfo, 0, 0, 1024, 90, 11);
                    FormManager.SetControlSize(lblTemp1, 31, 5, 308, 80, 14);
                    FormManager.SetControlSize(lblTemp2, 358, 5, 308, 80, 14);
                    FormManager.SetControlSize(lblTemp3, 682, 5, 308, 80, 14);

                    FormManager.SetControlSize(lblNoticeTitle, 30, 417, 272, 23, 14);
                    FormManager.SetControlSize(lblNoticeAll, 298, 417, 22, 24, 12);
                    FormManager.SetControlSize(lblNoticeDtl01, 30, 456, 299, 23, 12);
                    FormManager.SetControlSize(lblNoticeDtl02, 30, 493, 299, 23, 12);
                    FormManager.SetControlSize(lblNoticeDtl03, 30, 528, 299, 23, 12);

                    FormManager.SetControlSize(lblCampaignTitle, 30, 591, 272, 23, 14);
                    FormManager.SetControlSize(lblCampainAll, 298, 592, 22, 24, 12);
                    FormManager.SetControlSize(lblCampaignDtl01, 30, 630, 299, 23, 12);
                    FormManager.SetControlSize(lblCampaignDtl02, 30, 667, 299, 23, 12);
                    FormManager.SetControlSize(lblCampaignDtl03, 30, 702, 299, 23, 12);

                    FormManager.SetControlSize(lblOffLine, 263, 24, 572, 25, 12);

                    FormManager.SetControlSize(pnlShortCut, 556, 382, 467, 90, 11);
                    FormManager.SetControlSize(picShortCut, 0, 0, 467, 90, 11);
                    FormManager.SetControlSize(lblMasterAll, 9, 14, 145, 62, 11);
                    FormManager.SetControlSize(lblMasterUpdate, 161, 14, 145, 62, 11);
                    FormManager.SetControlSize(lblCampaignMasterAll, 313, 14, 145, 62, 11);

                    #endregion
                } 

                TopMenuLocation();

                lblCampaignDtl01.Text = "";
                lblCampaignDtl02.Text = "";
                lblCampaignDtl03.Text = "";
                lblNoticeDtl01.Text = "";
                lblNoticeDtl02.Text = "";
                lblNoticeDtl03.Text = "";
                lblCampaignDtl01.Tag = "";
                lblCampaignDtl02.Tag = "";
                lblCampaignDtl03.Tag = "";
                lblNoticeDtl01.Tag = "";
                lblNoticeDtl02.Tag = "";
                lblNoticeDtl03.Tag = "";

                lblAnniv.Text = "";
                lblAnniv.Tag = "";
                                
                if (m_cPosStatus.Mst.CorpDiv == ItemConst.CORP_DIV.PC)
                {
                    lblIFStatus1.Text = string.Format(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0459), 0, 0, 0);
                }
                else
                {
                    lblIFStatus1.Text = string.Format(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1009), 0, 0, 0);
                }
                lblIFStatus2.Text = string.Format(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0464), 0);
                lblIFStatus3.Text = string.Format(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0465), 0);

                SlideSetMenuBtn();
                //pnlMenuSlide.Location = new Point(0, 50);
                pnlMenuSlide.Visible = false;

                picTempInfo.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MENUSLIDE_BG);
                //pnlTempInfo.Location = new Point(0, 50);
                pnlTempInfo.Visible = false;

                SetOwnPartDiv(false);

                GetClientPOSVersion();//실행파일 버젼 표시; girak.kim; 20173.08.22.001
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
            finally
            {
                this.ResumeLayout(false);
            }
        }

        /// <summary>
        /// 상단 표시 메뉴 처리
        /// </summary>
        private void TopMenuLocation()
        {
            int iBasciLocation = 0;

            try
            {

                if (m_cPosStatus.Sale.ScreenSizeUser == 800)
                {
                    //800
                    iBasciLocation = 220;
                }
                else
                {
                    //1024
                    iBasciLocation = 263;
                }

                //온도표시
                if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT039), "0") != "1")
                {
                    pnlIFStatus4.Visible = false;
                }
                else
                {
                    pnlIFStatus4.Visible = true;

                    pnlIFStatus4.Location = new Point(iBasciLocation, 25);

                    iBasciLocation = iBasciLocation + pnlIFStatus4.Width;
                }

                //#15058 해피오더 버튼 변경_20180612 start,phj
                NewHPOrd_Disp.Visible = false;
                NewHPOrd_Disp2.Visible = false;
                PnlNewHPOrd_Disp.Visible = false;
                //#15058 해피오더 버튼 변경_20180612 end,phj

                //해피오더 
                if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT035), "0") == "0")
                {
                    lblIFStatus1.Visible = false;
                    //#15058 해피오더 버튼 변경_20180612 start,phj
                    bPosMain = false;
                    //#15058 해피오더 버튼 변경_20180612 end,phj
                }
                else
                {
                    if(m_cPosStatus.Mst.CorpDiv == ItemConst.CORP_DIV.PC)
                    {
                        lblIFStatus1.Size = new Size(260, 21);
                    }
                    else
                    {
                        lblIFStatus1.Size = new Size(260, 21);
                    }

                    lblIFStatus1.Visible = true;

                    lblIFStatus1.Location = new Point(iBasciLocation, 25);

                    iBasciLocation = iBasciLocation + lblIFStatus1.Width;


                    //#15058 해피오더 버튼 변경_20180612 start,phj
                    PnlNewHPOrd_Disp.Width = lblIFStatus1.Width;
                    PnlNewHPOrd_Disp.Left = lblIFStatus1.Left;
                    PnlNewHPOrd_Disp.Top = 0;
                    PnlNewHPOrd_Disp.Height = 50;

                    bPosMain = true;
                    //#15058 해피오더 버튼 변경_20180612 end,phj

                }

                //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 start - #16368
                //기존
                /*
                //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 start
                iInventoryDispCnt = -1;
                bInventoryDispStat = false;
                lb_HPOInventoryAlram.Visible = false;
                lb_HPOInventoryAlram2.Visible = false;
                Pnl_HPOInventoryAlram.Visible = false;

                if (PosMstManager.GetPosOption(POS_OPTION.OPT518) == "1")
                {
                    if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT035), "0") == "0")
                    {
                        Pnl_HPOInventoryAlram.Location = new Point(iBasciLocation, 25);
                        Pnl_HPOInventoryAlram.Size = new Size(260, 21);
                        Pnl_HPOInventoryAlram.Width = lblIFStatus1.Width; // lblIFStatus1.Width;
                        Pnl_HPOInventoryAlram.Left = lblIFStatus1.Left;
                        Pnl_HPOInventoryAlram.Top = 0;
                        Pnl_HPOInventoryAlram.Height = 50;
                    }
                    else
                    {
                        Pnl_HPOInventoryAlram.Size = new Size(260, 21);
                        Pnl_HPOInventoryAlram.Width = PnlNewHPOrd_Disp.Width;
                        Pnl_HPOInventoryAlram.Left = PnlNewHPOrd_Disp.Left + PnlNewHPOrd_Disp.Width;
                        Pnl_HPOInventoryAlram.Top = 0;
                        Pnl_HPOInventoryAlram.Height = 50;
                    }
                }
                //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 end
                */

                //변경
                bInventoryCancel = false;

                lb_HPOInventoryAlram.Visible = false;
                lb_HPOInventoryAlram2.Visible = false;
                Pnl_HPOInventoryAlram.Visible = false;

                if (PosMstManager.GetPosOption(POS_OPTION.OPT518) == "1")
                {
                    if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT035), "0") == "0")
                    {
                        Pnl_HPOInventoryAlram.Location = new Point(iBasciLocation, 25);
                        Pnl_HPOInventoryAlram.Size = new Size(260, 21);
                        Pnl_HPOInventoryAlram.Width = lblIFStatus1.Width; // lblIFStatus1.Width;
                        Pnl_HPOInventoryAlram.Left = lblIFStatus1.Left;
                        Pnl_HPOInventoryAlram.Top = 0;
                        Pnl_HPOInventoryAlram.Height = 50;
                    }
                    else
                    {
                        Pnl_HPOInventoryAlram.Size = new Size(260, 21);
                        Pnl_HPOInventoryAlram.Width = PnlNewHPOrd_Disp.Width;
                        Pnl_HPOInventoryAlram.Left = PnlNewHPOrd_Disp.Left + PnlNewHPOrd_Disp.Width;
                        Pnl_HPOInventoryAlram.Top = 0;
                        Pnl_HPOInventoryAlram.Height = 50;
                    }
                }
                //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 end - #16368

                //빚은몰
                if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT036), "0") == "0")
                {
                    lblIFStatus2.Visible = false;
                }
                else
                {
                    lblIFStatus2.Visible = true;

                    lblIFStatus2.Location = new Point(iBasciLocation, 25);

                    iBasciLocation = iBasciLocation + lblIFStatus2.Width;

                }

                //이지웰
                if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT037), "0") == "0")
                {
                    lblIFStatus3.Visible = false;
                }
                else
                {
                    lblIFStatus3.Visible = true;

                    lblIFStatus3.Location = new Point(iBasciLocation, 25);

                    iBasciLocation = iBasciLocation + lblIFStatus3.Width;

                }

                //점주 알바 점수 표시
                if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT019), "1") == "1")
                {

                    if (m_cPosStatus.Mst.CorpDiv == ItemConst.CORP_DIV.BR)
                    {
                        lblOwnerPart.Size = new Size(182, 21);
                        lblOwnerPart.Text = string.Format("{0}:0{2}/{1}:0{2}", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0733), MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0732), MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0734));
                    }
                    else
                    {
                        lblOwnerPart.Size = new Size(95, 21);
                        lblOwnerPart.Text = string.Format("{0}:0{1}", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0732), MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0734));
                    }

                    lblOwnerPart.Visible = true;
                    lblOwnerPart.Location = new Point(iBasciLocation, 25);
                    iBasciLocation = iBasciLocation + lblOwnerPart.Width;
                }
                else
                {
                    lblOwnerPart.Visible = false;
                    lblOwnerPart.Text = "";
                }

                //기념일 배송
                if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT020), "0") != "0")
                {
                    lblAnniv.Text = string.Format("{0}:0", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0742));
                    lblAnniv.Visible = true;

                    lblAnniv.Location = new Point(iBasciLocation, 25);
                    iBasciLocation = iBasciLocation + lblAnniv.Width;
                }
                else
                {
                    lblAnniv.Visible = false;
                    lblAnniv.Text = "";
                }


            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }


        #region 점주알바점수, 유해상품, 입고등록, 배송정보, 기념일배송 처리
        /// <summary>
        /// 점주알바점수, 유해상품, 입고등록, 배송정보, 기념일배송 처리
        /// </summary>
        private void SelectEtcNoticeCom()
        {
            string[] aOutParam = new string[] { "0", "0" };

            try
            {
                string sDpsStr = string.Empty;

                //점주 알바 점수 표시
                if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT019), "1") == "1")
                {
                    if (m_cPosStatus.Mst.CorpDiv == ItemConst.CORP_DIV.BR)
                    {
                        sDpsStr = string.Format("{0}:#1{2}/{1}:#2{2}", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0733), MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0732), MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0734));
                    }
                    else
                    {
                        sDpsStr = string.Format("{0}:#1{1}", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0732), MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0734));
                    }


                    //01 - 점주알바모드
                    if (m_cDataCommon.GetEtcNoticeProcess("01", ref aOutParam) == false)
                    {
                        aOutParam = new string[] { "0", "0" };
                    }

                    lblOwnerPart.Text = sDpsStr.Replace("#1", aOutParam[0]).Replace("#2", aOutParam[1]);
                }

                //02 - 유해상품
                //03 - 입고등록 확인
                //04 - 배송정보
                //05 - 기념일 배송
                m_cDataCommon.GetEtcNoticeProcess("02", ref aOutParam);

                //기념일 배송
                if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT020), "0") != "0")
                {
                    m_cDataCommon.GetEtcNoticeProcess("05", ref aOutParam);

                    if (aOutParam == null || aOutParam[0] == "0")
                    {
                        lblAnniv.Text = string.Format("{0}:0", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0742));
                        lblAnniv.Tag = "";
                    }
                    else
                    {
                        lblAnniv.Text = string.Format("{0}:{1}", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0742), aOutParam[0]);
                        lblAnniv.Tag = "1";
                    }

                }

            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                   System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);

            }
        }

        ///// <summary>
        ///// 점주 알바 웹 호출
        ///// </summary>
        //private void ShowOwnerPartWeb(string sKeyCode)
        //{
        //    try
        //    {
        //        //WEB 링크 조회

        //        IDataServiceUs cWebBiz = (IDataServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_BASIC.DLL, ServiceLists.BSV_BASIC.WEB_POS);

        //        if (cWebBiz != null)
        //        {

        //            string sUrl = string.Empty;

        //            sUrl = (string)cWebBiz.GetData(new string[] { sKeyCode });

        //            if (sUrl != UserCom.ERROR && sUrl != null)
        //            {
        //                System.Diagnostics.Process.Start("iexplore.exe", CmUtil.MidH(sUrl, 31, CmUtil.LenH(sUrl)));
        //            }
        //        }


        //    }
        //    catch (Exception ex)
        //    {
        //        WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
        //           System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
        //    }
        //}

        #endregion 점주알바점수, 유해상품, 입고등록, 배송정보, 기념일배송 처리

        /// <summary>
        /// 메인 타이틀 표시
        /// </summary>
        private void DisplayTitle()
        {
            try
            {
                lblStoreNm.Text = CmUtil.GetDataRowStr(PosMstManager.GetMstStore(), PosMst.MST_STORE.DATA.STORNM);    //점포명
                lblPosNo.Text = "POS " + m_cPosStatus.Base.PosNo;
                lblTranNo.Text = m_cPosStatus.Base.TradeNo;
                lblCashier.Text = m_cPosStatus.Base.CashierName;
                lblEtc.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0038);
                lblWeb.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0039);
                GetNoticeEvent();
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

        /// <summary>
        /// 업무 선택
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnMenu_Click(object sender, EventArgs e)
        {
            try
            {
                m_cPosStatus.Sale.ScreenSaverTime = "";                                         //화면보호기 대기시간 설정
                PosMainProc(((Cosmos.UI.CsmButton)sender).Tag.ToString());
                m_cPosStatus.Sale.ScreenSaverTime = DateTime.Now.ToString("yyyyMMddHHmmss");    //화면보호기 대기시간 설정
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

        /// <summary>
        /// 메인 업무 실행
        /// </summary>
        /// <param name="sMenuKey"></param>
        private void PosMainProc(string sMenuKey)
        {
            try
            {
                tmrMainTimer.Enabled = false;

                // SLIDE메뉴 들어갈 시에도 권한체크(2017.07.07)
                // 키 그룹 판매원 권한 체크
                if (sMenuKey == PosKey.MENU_KEY.SALE_OPEN ||
                   sMenuKey == PosKey.MENU_KEY.POS_CLOSE ||
                   sMenuKey == PosKey.MENU_KEY.POS_SEARCH ||
                   sMenuKey == PosKey.MENU_KEY.POS_EDU ||
                   sMenuKey == PosKey.MENU_KEY.POS_ETC)
                {
                    if (WinBasic.CheckMenuKeyAuth(sMenuKey) == false) return;
                }

                switch (sMenuKey)
                {
                    //MoonSeokWoo
                    case PosKey.MENU_KEY.PGM_DOWNLOAD:
                            
                        lblMasterAll.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MENUSLIDE_CATEGORY_BTN_DEFAULT);
                        lblMasterUpdate.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MENUSLIDE_CATEGORY_BTN_DEFAULT);
                        lblCampaignMasterAll.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MENUSLIDE_CATEGORY_BTN_DEFAULT);

                        picShortCut.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MENUSLIDE_BG);

                        if (pnlShortCut.Visible.Equals(true))
                        {
                            pnlShortCut.Visible = false;
                        }
                        else
                        {
                            pnlShortCut.Visible = true;
                        }
                        break;  
                    case PosKey.MENU_KEY.SALE_OPEN:

                        //#20180126 해피오더 당일픽업 건 보여주기 start,phj
                        //기존
                        //영업개시
                        //PosOpenProc();
                        //변경
                        bool bRet = false;
                        bRet = PosOpenProc();
                        if (bRet == true)
                        {
                            //#20180126 해피오더 당일픽업 건 보여주기 start,phj, 20180321
                            //기존
                            /*
                            string sRet = string.Empty;
                            sRet = WinSale.ShowForm(new string[] { FormManager.FORM_SAL_HPORD, "01", "Y" });
                            if (sRet == UserCom.RST_OK)
                            {
                                System.Diagnostics.Debug.WriteLine("PicupSearch From0 : " + sRet.ToString());
                            }
                            */
                            //변경
                            
                            if (PosMstManager.GetPosOption(POS_OPTION.OPT035) == "1")
                            {
                                int iHpOrderCnt = 0;
                                //해피오더 당일 픽업 건 조회

                                //#20180605 해피오더 개선 start
                                
                                //즉시주문, 예약주문 알림
                                //기존
                                //iHpOrderCnt = HappyOrderCntChk();
                                //변경
                                iHpOrderCnt = m_cSvr2Tran.HappyOrderCntChk(m_cPosStatus.Base.SaleDate);
                                
                                //#20180605 해피오더 개선 end

                                if (iHpOrderCnt > 0)
                                {
                                    WinSale.ShowForm(new string[] { FormManager.FORM_SAL_HPORD, "01", "Y" });
                                }
                            }
                            
                            //#20180126 해피오더 당일픽업 건 보여주기 end,phj, 20180321

                        }
                        //#20180126 해피오더 당일픽업 건 보여주기 end,phj

                        break;
                    case PosKey.MENU_KEY.POS_SALE:
                        // 판매
                        if (m_cPosStatus.Mst.TestStorYn == "1")
                        {
                            if (WinManager.QuestionMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0311)) == false)
                            {
                                return;
                            }
                        }

                        m_cPosStatus.Base.TrainingFlag = ItemConst.TRAINING_FLAG.TRAINING_NO;
                        PosSaleProc();
                        break;
                    case PosKey.MENU_KEY.POS_TRAINING:  //연습모드
                        // 판매
                        m_cPosStatus.Base.TrainingFlag = ItemConst.TRAINING_FLAG.TRAINING_YES;
                        PosSaleProc();
                        break;
                    case PosKey.MENU_KEY.POS_ETC:       //기타메뉴
                    case PosKey.MENU_KEY.POS_CLOSE:     //입출금 정산
                    case PosKey.MENU_KEY.POS_SETTING:   //관리
                    case PosKey.MENU_KEY.POS_SEARCH:    //조회
                    case PosKey.MENU_KEY.POS_EDU:       //교육
                        // 메뉴(팝업) 표시
                        DispayMenuSubProc(sMenuKey);    
                        break;
                    case PosKey.MENU_KEY.PROGRAM_EXIT:
                        // 프로그램 종료
                        if (WinManager.QuestionMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0651)) == true)
                        {
                            PosExitProc();
                        }
                        break;
                }

                DisplayTitle();
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
            finally
            {
                //this.picMainBack.Height = 332;
                this.picMainBack.Visible = true;
                this.picMainBack.Update();

                if (sMenuKey != PosKey.MENU_KEY.PROGRAM_EXIT && m_cPosStatus.Sale.SysShutDown == "")
                    tmrMainTimer.Enabled = true;

                // 프로그램 종료
                if (m_cPosStatus.Sale.SysShutDown != "") PosExitProc();
            }
        }

        /// <summary>
        /// 이벤트 공지사항 조회
        /// </summary>
        private void GetNoticeEvent()
        {
            try
            {
                DataTable dt = null;

                //이벤트
                dt = (DataTable)m_cPosNoticeCom.GetData(new string[] { PosMst.MST_CPI.TABLE_NAME, "", "", "" });

                if (!(dt == null || dt.Rows.Count == 0))
                {
                    int icnt = 1;

                    foreach (DataRow dr in dt.Rows)
                    {
                        if (icnt == 1)
                        {
                            lblCampaignDtl01.Tag = CmUtil.GetDataRowStr(dr, PosMst.MST_CPI.DATA.CPI_CD);
                            lblCampaignDtl01.Text = CmUtil.GetDataRowStr(dr, PosMst.MST_CPI.DATA.CPI_NM);
                        }
                        else if (icnt == 2)
                        {
                            lblCampaignDtl02.Tag = CmUtil.GetDataRowStr(dr, PosMst.MST_CPI.DATA.CPI_CD);
                            lblCampaignDtl02.Text = CmUtil.GetDataRowStr(dr, PosMst.MST_CPI.DATA.CPI_NM);
                        }
                        else if (icnt == 3)
                        {
                            lblCampaignDtl03.Tag = CmUtil.GetDataRowStr(dr, PosMst.MST_CPI.DATA.CPI_CD);
                            lblCampaignDtl03.Text = CmUtil.GetDataRowStr(dr, PosMst.MST_CPI.DATA.CPI_NM);
                            break;
                        }
                        icnt++;
                    }
                }

                //공지사항
                dt = (DataTable)m_cPosNoticeCom.GetData(new string[] { PosMst.MST_EMG_NOTE.TABLE_NAME, ItemConst.NOTE_MSG_DIV.NRL, "", "" });

                if (!(dt == null || dt.Rows.Count == 0))
                {
                    int icnt = 1;

                    foreach (DataRow dr in dt.Rows)
                    {

                        string sTag = string.Format("{0}^{1}", CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_CODE), CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_DIV));

                        if (icnt == 1)
                        {
                            lblNoticeDtl01.Tag = sTag;
                            lblNoticeDtl01.Text = CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_TITLE);
                        }
                        else if (icnt == 2)
                        {
                            lblNoticeDtl02.Tag = sTag;
                            lblNoticeDtl02.Text = CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_TITLE);
                        }
                        else if (icnt == 3)
                        {
                            lblNoticeDtl03.Tag = sTag;
                            lblNoticeDtl03.Text = CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_TITLE);
                            break;
                        }
                        icnt++;
                    }
                }

            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }


        /// <summary>
        /// 영업개시 처리
        /// </summary>
        private bool PosOpenProc()
        {
            string sRet = UserCom.RST_ERR;

            try
            {
                string sSysDate = System.DateTime.Now.ToString("yyyyMMdd");
                string sOrgDate = m_cPosStatus.Base.SaleDate;

                if (m_cPosStatus.Base.OpenClose == "1")
                {
                    // 영업개시 처리됨
                    if (CmUtil.LongParse(sOrgDate) >= CmUtil.LongParse(sSysDate))
                    {
                        WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0203));
                    }
                    else
                    {
                        WinManager.ErrorMessage(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0242) + " : " + m_cPosStatus.Global.DateToCulture(sOrgDate) + ", "
                            + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0516) + " : " + m_cPosStatus.Global.DateToCulture(sSysDate) + PosConst.CRLF
                            + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0184));

                        // 마감화면으로 이동
                        sRet = WinOpenClose.ShowForm(new string[] { FormManager.FORM_ACC_SALE_END, PosKey.MENU_KEY.SALE_CLOSE, ItemConst.TRAN_KIND.STATEMENT.ADJUSTMENT, ItemConst.TRAN_DIV.NORMAL });
                    }
                    return false;
                }
                else
                {
                    // 영업마감 됨
                    if (CmUtil.LongParse(sOrgDate) >= CmUtil.LongParse(sSysDate))
                    {
                        if (PosMstManager.GetPosOption(POS_OPTION.OPT302) == "0")
                        {
                            WinManager.ErrorMessage(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0242) + " : " + m_cPosStatus.Global.DateToCulture(sOrgDate) + ", "
                            + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0516) + " : " + m_cPosStatus.Global.DateToCulture(sSysDate) + PosConst.CRLF
                            + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0185));
                            return false;
                        }
                        else
                        {
                            WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0573));
                        }
                    }
                }

                // 영업개시 처리
                sRet = WinOpenClose.ShowForm(new string[] { FormManager.FORM_SOD_SALE });
                if (sRet != UserCom.RST_OK) return false;

                // 영업개시 완료 후 처리
                if (PosMstManager.GetPosOption(POS_OPTION.OPT311) == "1")
                {
                    // 판매등록 처리
                    PosMainProc(PosKey.MENU_KEY.POS_SALE);
                }

                ////string sSysDate = System.DateTime.Now.ToString("yyyy-MM-dd");

                //// 마감여부 확인(INI 파일 확인)
                //// PosConst 에 선언해도 되는지 확인
                //// 영업일자와 시스템일자가 같지 않고 POS 설정 상태에서 마감 여부가 CLOSE 가 아닐 경우 전일자 마감이 안됐다고 본다.
                //// 아래 마감 여부 체크와 같은 if 문에 넣지 않은 이유는 일자가 달라도 판매진행 할 수 있을 경우를 대비
                //if (sSysDate != sOrgDate)
                //{
                //    if (m_cPosStatus.Base.OpenClose != "CLOSE")
                //    {
                //        // 아래에 직접 쓰면 "\r\n" 이게 안먹는다... 메세지 안에 썼을 경우...
                //        string sMag1 = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0184);
                //        string sMsg2 = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0185);

                //        WinManager.ErrorMessage("영업일자 : " + sOrgDate.Substring(0, 4) + "-" + sOrgDate.Substring(4, 2)
                //            + "-" + sOrgDate.Substring(6, 2) + "\r\n시스템일자 : " + sSysDate.Substring(0, 4) + "-" + sSysDate.Substring(4, 2)
                //            + "-" + sSysDate.Substring(6, 2) + "\r\n" + sMag1 + "\r\n" + sMsg2);

                //        // 나중에는 반드시 풀어줘야 함
                //        return false;
                //    }
                //}
                //else if (sSysDate == sOrgDate)
                //{
                //    if (m_cPosStatus.Base.OpenClose == "OPEN")
                //    {
                //        WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0203));
                //        return false;
                //    }
                //}

                //sRet = WinOpenClose.ShowForm(new string[] { FormManager.FORM_SOD_SALE });
                //if (sRet == UserCom.RST_OK)
                //{
                //    WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0204));

                //    // 5초 대기
                //    //Thread.Sleep(5000);
                //    RestartProc();

                //}
                //else if (sRet == UserCom.RST_IGNORE)
                //{
                //    WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0206));
                //}
                //else if (sRet == UserCom.RST_ERR)
                //{
                //    WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0205));
                //}

            }
            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 false;
            }
            return true;
        }

        /// <summary>
        /// 판매 등록
        /// </summary>
        /// <returns></returns>
        private bool PosSaleProc()
        {
            string sRet = UserCom.RST_ERR;
            bool bAnswer = false;

            try
            {
                string sSysDate = System.DateTime.Now.ToString("yyyyMMdd");
                if (m_cPosStatus.Base.OpenClose == "1")
                {
                    // 영업일자 체크
                    if (CmUtil.LongParse(m_cPosStatus.Base.SaleDate) < CmUtil.LongParse(sSysDate) && CmUtil.LongParse(System.DateTime.Now.ToString("HH")) > 5)
                    {
                        //WinManager.ErrorMessage(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0242) + " : " + m_cPosStatus.Global.DateToCulture(m_cPosStatus.Base.SaleDate) + ", "
                        //    + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0516) + " : " + m_cPosStatus.Global.DateToCulture(sSysDate) + PosConst.CRLF
                        //    + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0184));

                        //// 마감화면으로 이동
                        //sRet = WinOpenClose.ShowForm(new string[] { FormManager.FORM_ACC_SALE_END, PosKey.MENU_KEY.SALE_CLOSE, ItemConst.TRAN_KIND.STATEMENT.ADJUSTMENT, ItemConst.TRAN_DIV.NORMAL });

                        //return false;

                        var ret = false;
                        if (m_cPosStatus.Base.PosType == PosConst.POS_TYPE.DEFERRED_PAYMENT && m_cPosStatus.Base.PosCommunicationType == PosConst.MAIN_POS_DIV.MAIN_POS)
                        {
                            var tableSvr = (ITableUs)sManager.InitServiceInstance(ServiceLists.BSV_TABLE.DLL, ServiceLists.BSV_TABLE.TABLE_SERVICE);
                            var cnt = tableSvr.GetOrderDataCount();
                            if (tableSvr.GetOrderDataCount() > 0)
                            {
                                var msg = string.Format(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0671), cnt);
                                ret = WinManager.QuestionMessage(msg);
                            }
                        }
                        if (ret == false) 
                        {
                            WinManager.ErrorMessage(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0242) + " : " + m_cPosStatus.Global.DateToCulture(m_cPosStatus.Base.SaleDate) + ", "
                                + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0516) + " : " + m_cPosStatus.Global.DateToCulture(sSysDate) + PosConst.CRLF
                                + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0184));

                            // 마감화면으로 이동
                            sRet = WinOpenClose.ShowForm(new string[] { FormManager.FORM_ACC_SALE_END, PosKey.MENU_KEY.SALE_CLOSE, ItemConst.TRAN_KIND.STATEMENT.ADJUSTMENT, ItemConst.TRAN_DIV.NORMAL });

                            return false;
                        }
                    }
                }
                else
                {
                    // 영업일자 체크
                    // 마감상태일 경우 시스템일자와 현재 영업일자가 같거나 미래일 경우에는 익일 개점 허용여부 옵션을 체크하여
                    // 개점을 진행하거나 하지 않는다.
                    // 시스템일자보다 과거 일자의 경우 무조건 팝업창을 표시해준다.
                    if (CmUtil.LongParse(m_cPosStatus.Base.SaleDate) >= CmUtil.LongParse(sSysDate))
                    {
                        // 익일 개점 허용 여부 옵션 체크
                        if (PosMstManager.GetPosOption(POS_OPTION.OPT302) != "0")
                        {
                            bAnswer = WinManager.QuestionMessage(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0242) + " : " + m_cPosStatus.Global.DateToCulture(m_cPosStatus.Base.SaleDate)
                                                                  + " " + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0627));

                            if (bAnswer == true)
                            {
                                // 미사용이 아닐 경우 개점화면 표시
                                sRet = WinOpenClose.ShowForm(new string[] { FormManager.FORM_SOD_SALE });

                                //#20180126 해피오더 당일픽업 건 보여주기 start,phj, 20180321
                                //기존
                                /*
                                string sRrt = string.Empty;
                                sRrt = WinSale.ShowForm(new string[] { FormManager.FORM_SAL_HPORD, "01", "Y" });
                                if (sRrt == UserCom.RST_OK)
                                {
                                    System.Diagnostics.Debug.WriteLine("PicupSearch From1 : " + sRrt.ToString());
                                }
                                */
                                //변경
                                
                                if (PosMstManager.GetPosOption(POS_OPTION.OPT035) == "1")
                                {
                                    int iHpOrderCnt = 0;
                                    //해피오더 당일 픽업 건 조회

                                    //#20180605 해피오더 개선 start
                                    //즉시주문, 예약주문 알림
                                    //기존
                                    //iHpOrderCnt = HappyOrderCntChk();
                                    //변경
                                    iHpOrderCnt = m_cSvr2Tran.HappyOrderCntChk(m_cPosStatus.Base.SaleDate);
                                    //#20180605 해피오더 개선 end

                                    if (iHpOrderCnt > 0)
                                    {
                                        WinSale.ShowForm(new string[] { FormManager.FORM_SAL_HPORD, "01", "Y" });
                                    }
                                }
                                
                                //#20180126 해피오더 당일픽업 건 보여주기 end,phj, 20180321
                            }

                            return false;
                        }
                        else
                        {
                            WinManager.ErrorMessage(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0242) + " : " + m_cPosStatus.Global.DateToCulture(m_cPosStatus.Base.SaleDate) + ", "
                             + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0516) + " : " + m_cPosStatus.Global.DateToCulture(sSysDate) + PosConst.CRLF
                             + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0185));
                            return false;
                        }
                    }
                    else
                    {
                        bAnswer = WinManager.QuestionMessage(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0242) + " : " + m_cPosStatus.Global.DateToCulture(m_cPosStatus.Base.SaleDate)
                                                              + " " + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0627));

                        if (bAnswer == true)
                        {
                            // 미사용이 아닐 경우 개점화면 표시
                            sRet = WinOpenClose.ShowForm(new string[] { FormManager.FORM_SOD_SALE });

                            //#20180126 해피오더 당일픽업 건 보여주기 start,phj, 20180321
                            //기존
                            /*
                            string sRrt = string.Empty;
                            sRrt = WinSale.ShowForm(new string[] { FormManager.FORM_SAL_HPORD, "01", "Y" });
                            if (sRrt == UserCom.RST_OK)
                            {
                                System.Diagnostics.Debug.WriteLine("PicupSearch From2 : " + sRrt.ToString());
                            }
                            */
                            //변경
                            
                            if (PosMstManager.GetPosOption(POS_OPTION.OPT035) == "1")
                            {
                                int iHpOrderCnt = 0;
                                //해피오더 당일 픽업 건 조회

                                //#20180605 해피오더 개선 start
                                //즉시주문, 예약주문 알림
                                //기존
                                //iHpOrderCnt = HappyOrderCntChk();
                                //변경
                                iHpOrderCnt = m_cSvr2Tran.HappyOrderCntChk(m_cPosStatus.Base.SaleDate);
                                //#20180605 해피오더 개선 end

                                if (iHpOrderCnt > 0)
                                {
                                    WinSale.ShowForm(new string[] { FormManager.FORM_SAL_HPORD, "01", "Y" });
                                }
                            }
                            
                            //#20180126 해피오더 당일픽업 건 보여주기 end,phj, 20180321
                        }

                        return false;
                    }
                }

                //this.picMainBack.Visible = false;
                //this.Update();

                // 점포 마스터 유무 체크
                DataRow dr = PosMstManager.GetMstStore();
                if (dr == null)
                {
                    // 점포 마스터가 설정되어 있지 않습니다. 고객센터로 연락하여 주세요.
                    WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0579);
                    return false;
                }

                switch (m_cPosStatus.Base.PosType)
                {
                    case PosConst.POS_TYPE.PRE_PAYMENT:
                        // 판매화면 진행
                        sRet = WinSale.ShowForm(new string[] { FormManager.FORM_SAL_MAIN });
                        break;
                    case PosConst.POS_TYPE.DEFERRED_PAYMENT:
                        // Mod, 2017.03.05, 후불 연습모드 적용
                        //if (m_cPosStatus.Base.TrainingFlag == ItemConst.TRAINING_FLAG.TRAINING_YES)
                        //{
                        //    // 판매화면 진행 => 연습모드에서는 테이블 화면으로 진행 안함.
                        //    sRet = WinSale.ShowForm(new string[] { FormManager.FORM_SAL_MAIN });
                        //}
                        //else
                        //{
                        //    // 테이블 화면 진행
                        //    sRet = WinSale.ShowForm(new string[] { FormManager.FORM_TBL_REG });
                        //}
                        // 테이블 화면 진행
                        sRet = WinSale.ShowForm(new string[] { FormManager.FORM_TBL_REG });
                        break;
                    default:
                        // 환경설정오류 메시지 
                        WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0378);
                        break;
                }
                this.Top = 0;

                if (m_cPosStatus.Sale.SysShutDown != "") PosExitProc();     // 프로그램 종료 처리

            }
            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 false;
            }
            finally
            {
                this.picMainBack.Visible = false;
            }
            return true;
        }

        /// <summary>
        /// 메뉴(팝업) 화면 표시
        /// </summary>
        private void DispayMenuSubProc(string sMenuKey)
        {
            try
            {
                string sRet = WinBasic.ShowForm(new string[] { FormManager.FORM_BIZ_MAIN, sMenuKey });

                if (sRet != UserCom.RST_ERR)
                {
                    if (sRet == PosKey.MENU_KEY.POS_TRAINING)  //연습모드
                    {

                        if (PosMstManager.GetPosOption(POS_OPTION.OPT301) == "1")
                        {
                            // 판매
                            m_cPosStatus.Base.TrainingFlag = ItemConst.TRAINING_FLAG.TRAINING_YES;
                            PosSaleProc();
                        }
                        else
                        {
                            WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0414);
                        }
                    }
                    else if (sRet == PosKey.MENU_KEY.ENVIRONMENT_SETTING)  //환경설정
                    {
                        string sFilePath = string.Empty;
                        if (m_cPosStatus.Mst.CntryDiv == ItemConst.CNTRY_DIV.KR)
                        {
                            sFilePath = BaseCom.NxBinPath + "PosConfiguration.exe";
                        }
                        else
                        {
                            sFilePath = BaseCom.NxBinPath + "PosConfigurationEng.exe";
                        }

                        if (CmUtil.Exists(sFilePath) == true)
                        {   
                            CmUtil.ExecuteWaitProcess(sFilePath, "POS");

                            System.Threading.Thread.Sleep(1000);

                            // 환경설정 파일 읽기
                            SManager sManager = new SManager();        //이 객체를 통해 업무 Service 호출
                            IServiceUs cReadCfgSrv = (IServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.READ_CONFIGINFO);
                            cReadCfgSrv.Execute(new string[] { });     // POS 환경설정 파일 읽기
                        }
                        else
                        {
                            WinManager.ErrorMessage("File Not Found!");
                        }
                    }
                    else if (sRet == PosKey.MENU_KEY.WEB_SCH_APPROVAL)          //카드승인내역조회
                    {
                        WinBasic.ShowWebPos(PosKey.MENU_KEY.WEB_SCH_APPROVAL);
                        //ShowOwnerPartWeb(PosKey.MENU_KEY.WEB_SCH_APPROVAL);
                    }
                    else if (sRet == PosKey.MENU_KEY.HAPPY_KOK) //시연회 임시 해피콕
                    {
                        ProcessStartInfo startInfo = new ProcessStartInfo("Chrome.exe");
                        startInfo.WindowStyle = ProcessWindowStyle.Maximized;
                        startInfo.Arguments = "https://store.happypointcard.co.kr/";

                        System.Diagnostics.Process.Start(startInfo);
                    }
                    else
                    {
                        if (sRet == PosKey.MENU_KEY.TEST_MODE || sRet == PosKey.MENU_KEY.TEST_MODE_SEARCH)
                        {
                            if ( m_cPosStatus.Sale.ScreenSizeUser == 800)
                            {
                                // 800 화면 시험모드는 지원 하지 않음.
                                WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0364);
                                return;
                            }
                        }
                        WinSale.ExecuteBinessRun(sRet);
                    }

                    // 프로그램 종료
                    if (m_cPosStatus.Sale.SysShutDown != "")
                    {
                        PosExitProc();
                    }
                    else
                    {
                        if (sRet != PosKey.MENU_KEY.POS_TRAINING) DispayMenuSubProc(sMenuKey);
                    }
                }
                else
                {
                    if (m_cPosStatus.Sale.WebPosAfterDown != "")
                    {
                        frmWebMasterDown fForm = new frmWebMasterDown();
                        fForm.PosMenuKey = "MEMUKEY";
                        fForm.ShowDialog();

                        m_cPosStatus.Sale.WebPosAfterDown = "";
                    }
                }

            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

        /// <summary>
        /// 프로그램 종료 처리
        /// </summary>
        private void PosExitProc()
        {
            try
            {
                //m_cCustDisp.CloseCustDisplay();     // 고객용화면 종료 - 20161020 frmPosMainStart 로 이동함 

                MissTranCheck();        // 결락조회

                this.DialogResult = DialogResult.Cancel;
                this.Close();
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }


        public void OnDeviceEvent(string sDevice, string sData1, string sData2, string sData3)
        {
            try
            {

            }
            catch (Exception ex)
            {

            }
        }

        /// <summary>
        /// 상단 기타 업무 및 WEB 기능 호출
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lblEtc_Click(object sender, EventArgs e)
        {
            try
            {
                m_cPosStatus.Sale.ScreenSaverTime = "";    //화면보호기 대기시간 설정

                if ((UI.CsmLabel)sender == lblEtc)
                {

                      //2018.01.17; 미국 동부의 경우 WEB 메뉴 히든 처리; girak.kim
                    if (m_cPosStatus.Base.CmpCd.ToUpper().Equals(PosConst.POS_COMPANY_CODE.PCUS) && m_cPosStatus.Base.BrandCd.ToUpper().Equals(PosConst.MST_BRAND_CODE.PC_UY))
                    {
                        pnlMenuSlide.Visible = false;
                    }
                    else
                    {
                        //ETC 메뉴
                        //WinSale.ExecuteBinessRun(PosKey.MENU_KEY.TOP_MENU_ETC);
                        if (pnlMenuSlide.Visible != true)
                        {
                            m_SlideMenuKey = "";
                            m_sPosMenuKeyIn = PosKey.MENU_KEY.TOP_MENU_ETC;
                            pnlMenuSlide.Visible = true;
                            MenuSlideList();
                            SlideInitControl();
                            pnlMenuSlide.BringToFront();
                        }
                        else
                        {
                            pnlMenuSlide.Visible = false;
                        }
                    }
                }
                else
                {
                    //WEB 메뉴
                    //WinSale.ExecuteBinessRun(PosKey.MENU_KEY.TOP_MENU_WEB);

                    if (pnlMenuSlide.Visible != true)
                    {
                        m_SlideMenuKey = "";
                        m_sPosMenuKeyIn = PosKey.MENU_KEY.TOP_MENU_WEB;
                        pnlMenuSlide.Visible = true;
                        MenuSlideList();
                        SlideInitControl();
                        pnlMenuSlide.BringToFront();
                    }
                    else
                    {
                        pnlMenuSlide.Visible = false;
                    }
                }

                m_cPosStatus.Sale.ScreenSaverTime = DateTime.Now.ToString("yyyyMMddHHmmss");    //화면보호기 대기시간 설정
            }
            catch (Exception ex)
            {

                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }

        }

        ///// <summary>
        ///// Restart Procedure
        ///// </summary>
        //private void RestartProc()
        //{
        //    try
        //    {
        //        // 종료화면 표시

        //        // EOD와 동일한 작업 진행 필요 (TRAN/MST 정리 등등...)

        //        // Framework에 대한 중지 작업이 필요할 경우 작업 필요



        //        // POS 시작 프로그램 강제 종료
        //        //Process[] arPosPgm = Process.GetProcessesByName("PosMain");
        //        //foreach (Process pPosPgm in arPosPgm)
        //        //{
        //        //    pPosPgm.Kill();
        //        //    Thread.Sleep(1000);
        //        //}

        //        // 옵션에 따라 재기동을 할것인지 아니면 판매등록 화면으로 바로 갈것인지 처리 해야 한다.
        //        // 브랜드에 따라 달라질 수도 있는거 같음
        //        // POS의 환경설정 파일 기록은 마스터 다운로드 받은 후 기록된다.
        //        // POS Start
        //        // 준비금이 권종별 입력 옵션일 경우 표시함
        //        if (PosMstManager.GetPosOption(POS_OPTION.OPT006) != "1")
        //        {
        //            PosMainProc(PosKey.MENU_KEY.POS_SALE);
        //        }
        //        else
        //        {
        //            //// Timer 중지에 대한 작업 필요
        //            ////TimerStartKillProc(true);

        //            //// POS System Close
        //            ////this.Close();

        //            ////System.Diagnostics.Process.Start(BaseCom.NxBinPath + "PosStart.exe");
        //            ////System.Diagnostics.Process.Start(BaseCom.NxBinPath + "PosMain.exe");

        //            ///PosSaleProc();
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
        //                            System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
        //    }
        //}

        private void tmrMainTimer_Tick(object sender, EventArgs e)
        {
            try
            {
                tmrMainTimer.Enabled = false;

                if (Form.ActiveForm == this)
                {
                    // 화면보호기 처리
                    if (m_cCustDisp.ScreenSaverDisplay() == true)
                    {
                        //스크린세이버 기능(0: 사용안함. 1:사용함, 2:사용함(LOGOFF))
                        if (PosMstManager.GetPosOption(POS_OPTION.OPT013) == "2")
                        {
                            string sRet = WinBasic.ShowForm(new string[] { FormManager.FORM_LOG_ON, PosKey.MENU_KEY.SIMPLE_LOG_ON });
                            if (sRet == UserCom.RST_ERR)
                            {
                                m_cPosStatus.Sale.SysShutDown = PosConst.SYS_SHUTDOWN.PGMQUIT;
                                PosExitProc();
                                return;
                            }
                        }
                        SetOwnPartDiv(false);
                    }

                    //기타 공지 1분마다
                    if (DateTime.Now.ToString("ss") == "00")
                    {
                        SelectEtcNoticeCom();
                    }

                    //긴급공지 체크(10초마다)
                    if (CmUtil.IntParse(DateTime.Now.ToString("ss")) % 10 == 0)
                    {
                        GetTopMsgMode("1");
                    }

                    //#20180605 해피오더 개선 start
                     
                    //즉시주문, 예약주문 알림
                    if (PosMstManager.GetPosOption(POS_OPTION.OPT510) == "1")
                    {
                        // 즉시주문 30초 마다 표시
                        
                        //#20180605 해피오더 개선 start - 20180618
                        //기존
                        //if (m_nTimeSync_HpOrd_Direct >= 30)
                        //변경
                        if (m_nTimeSync_HpOrd_Direct >= 30 || m_cPosStatus.Sale.bPayCompleteYN == true)
                        //#20180605 해피오더 개선 end - 20180618
                        {
                            // Count 초기화
                            m_nTimeSync_HpOrd_Direct = 0;

                            //#20180605 해피오더 개선 start - 20180618
                            m_cPosStatus.Sale.bPayCompleteYN = false;
                            //#20180605 해피오더 개선 end - 20180618

                            //주문접수 건이 1건 이상인 경우
                            int DirectCnt = int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDirectCnt, "0")) +
                                            int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderReservCnt, "0"));

                            //DirectCnt = 10; //TEST DELETE
                            if (DirectCnt >= 1)
                            {
                                //해피오더 리스트 팝업(Y:당일픽업, A:즉시주문, B:예약주문)
                                WinSale.ShowForm(new string[] { FormManager.FORM_SAL_HPORD, "01", "A" });

                                //해피오더 리스트 팝업 종료 후 해피오더 주문건수 재조회 후 건수 갱신
                                m_cSvr2Tran.HappyOrderCntChk();
                            }
                        }
                        else
                        {
                            m_nTimeSync_HpOrd_Direct++;
                        }

                        // 예약주문 30분 마다 표시
                        if (m_nTimeSync_HpOrd_Reserv >= 60 * 30)
                        {
                            // Count 초기화
                            m_nTimeSync_HpOrd_Reserv = 0;
                            //주문접수 건이 1건 이상인 경우
                            int ReservCnt = int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderTotRegCnt, "0")) -
                                            int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDirectCnt, "0")) -
                                            int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderReservCnt, "0"));
                            if (ReservCnt >= 1)
                            {
                                //해피오더 리스트 팝업(Y:당일픽업, A:즉시주문, B:예약주문)
                                WinSale.ShowForm(new string[] { FormManager.FORM_SAL_HPORD, "01", "B" });

                                //해피오더 리스트 팝업 종료 후 해피오더 주문건수 재조회 후 건수 갱신
                                m_cSvr2Tran.HappyOrderCntChk();
                            }
                        }
                        else
                        {
                            m_nTimeSync_HpOrd_Reserv++;
                        }

                    }
                    
                    //#20180605 해피오더 개선 end


                    SelectBrPopUp();
                }

                // 서버 시간 동기화 30분 마다(2017.07.12)
                if (DateTime.Now.ToString("ss") == "00")
                {
                    m_nTimeSyncFlag++;

                    if (m_nTimeSyncFlag == 30)
                    {
                        m_cSvr2Tran.ServerSysDateTime();
                        m_nTimeSyncFlag = 0;
                    }                    
                }

                // 시간 처리
                //lblDateTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                lblCashier.Text = m_cPosStatus.Base.CashierName;
                lblTranNo.Text = m_cPosStatus.Base.TradeNo;

                // 해피오더 주문 건수 갱신
                if (PosMstManager.GetPosOption(POS_OPTION.OPT035) == "1")
                {
                    //// 해피오더 신규주문
                    //int iCnt01 = int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderRegCnt, "0"));
                    //// 해피오더 배달미처리
                    //int iCnt02 = int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryRequestCnt, "0"))
                    //           + int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryRegCnt, "0"))
                    //           + int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryingCnt, "0"));
                    //lblIFStatus1.Text = string.Format(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0459), iCnt01, iCnt02);
                    if (m_cPosStatus.Mst.CorpDiv == ItemConst.CORP_DIV.PC)
                    {
                        // 해피오더 신규주문(일반주문건수 + 배달주문건수 + 예약주문건수)
                        int iCnt01 = int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderTotRegCnt, "0"));
                        if (iCnt01 > 99) iCnt01 = 99;
                        // 해피오더 픽업미처리
                        int iCnt02 = int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderProductReadyCnt, "0")) + int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderPickupWaitCnt, "0"));
                        if (iCnt02 > 99) iCnt02 = 99;
                        // 해피오더 배달미처리
                        //#20180328 직접배달 처리 후 배달완료시 매출 생성 안되는 증상 수정 start
                        //기존
                        /*
                        int iCnt03 = int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryRequestCnt, "0"))
                                   + int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryRegCnt, "0"))
                                   + int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryingCnt, "0"));
                        */
                        //변경
                        int iCnt03 = int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryRequestCnt, "0"))
                                   + int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryRegCnt, "0"))
                                   
                                   //#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 start
                                   //기존
                                   //+ int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryingCnt, "0"))
                                   //#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 end

                                   //#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 start
                                   + int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryProductReadyCnt, "0"))
                                   //#20180910 배달의 상품준비가 픽업 건들으로 집계되는 현상 수정 end

                                   + int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryDirectCnt, "0"));
                        //#20180328 직접배달 처리 후 배달완료시 매출 생성 안되는 증상 수정 end

                        lblIFStatus1.Text = string.Format(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0459), iCnt01, iCnt02, iCnt03);
                    }
                    else
                    {
                        // 해피오더 일반
                        int iCnt01 = int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderRegCnt, "0"));
                        if (iCnt01 > 99) iCnt01 = 99;
                        // 해피오더 배달
                        int iCnt02 = int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderDeliveryOrderRegCnt, "0"));
                        if (iCnt02 > 99) iCnt02 = 99;
                        // 해피오더 예약
                        int iCnt03 = int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderReservedRegCnt, "0"));
                        if (iCnt03 > 99) iCnt03 = 99;

                        lblIFStatus1.Text = string.Format(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1009), iCnt01, iCnt02, iCnt03);
                    }
                }

                // 빚은몰 주문 건수 갱신
                if (PosMstManager.GetPosOption(POS_OPTION.OPT036) == "1")
                {
                    lblIFStatus2.Text = string.Format(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0464), int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.BizeunOrderCnt, "0")));
                }

                // 이지웰 주문 건수 갱신
                if (PosMstManager.GetPosOption(POS_OPTION.OPT037) == "1")
                {
                    lblIFStatus3.Text = string.Format(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0465), int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.EzwelOrderCnt, "0")));
                }

                // 해피오더 주문접수 알람

                //#20170913 해피오더 알림 팝업 여부 옵션 처리 start
                //기존
                //if (m_cPosStatus.Sale.HappyOrderAlarm == true)
                //변경
                if ((m_cPosStatus.Sale.HappyOrderAlarm == true) && (PosMstManager.GetPosOption(POS_OPTION.OPT510) == "1"))
                //#20170913 해피오더 알림 팝업 여부 옵션 처리 end
                {
                    // 개점된 상황에서만 해피오더 주문접수 알람 표시
                    if (CheckOpenStoreYn() == true)
                    {
                        m_cPosStatus.Sale.HappyOrderAlarm = false;

                        //#20180615 해피오더 팝업 수정 start
                        //기존
                        //WinSale.ShowForm(new string[] { FormManager.FORM_SAL_HPORD_POPUP, "ALARM" });
                        //변경
                        WinSale.ShowForm(new string[] { FormManager.FORM_SAL_HPORD, "01", "C" });
                        //#20180615 해피오더 팝업 수정 end

                    }
                }

                // 온도정보 갱신
                if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT039), "0") == "1")
                {
                    #region 온도정보 색상
                    // 우선 순위      : 미수신 > 알람 > 경고
                    //- 녹색(정상)   : 알람-N, 경고-N, 미수신-N
                    //- 회색(미수신) : 미수신-Y  미수신이 Y이면 알람, 경고는 체크 하지 않음
                    //- 적색(알람)   : 미수신-N, 알람-Y  알람이 Y이면 경고는 체크 하지 않음
                    //- 황색(경고)   : 미수신-N, 알람-N, 경고-Y
                    // [센서ID|온도계명|측정온도|알람YN|경고YN|미수신YN|최종수신시간]

                    lblTemperature01.Text = CmUtil.IsNull(m_cPosStatus.Temp.Temperature1, "-");
                    lblTemperature02.Text = CmUtil.IsNull(m_cPosStatus.Temp.Temperature2, "-");
                    lblTemperature03.Text = CmUtil.IsNull(m_cPosStatus.Temp.Temperature3, "-");

                    // 첫번째 온도 정보
                    if (m_cPosStatus.Temp.Alarm1 == "N" && m_cPosStatus.Temp.Warning1 == "N" && m_cPosStatus.Temp.receiveYN1 == "N")
                    {
                        // 녹색
                        lblTemperature01.BackColor = Color.Green;
                    }
                    else
                    {
                        if (m_cPosStatus.Temp.receiveYN1 == "Y" || CmUtil.IsNull(m_cPosStatus.Temp.Temperature1) == true)
                        {
                            // 회색
                            lblTemperature01.BackColor = Color.DarkGray;
                        }
                        else if (m_cPosStatus.Temp.receiveYN1 == "N")
                        {
                            if (m_cPosStatus.Temp.Alarm1 == "Y")
                            {
                                // 레드
                                lblTemperature01.BackColor = Color.Red;
                            }
                            else if (m_cPosStatus.Temp.Alarm1 == "N")
                            {
                                // 황색
                                lblTemperature01.BackColor = Color.DarkOrange;
                            }
                        }
                    }

                    // 두번째 온도 정보
                    if (m_cPosStatus.Temp.Alarm2 == "N" && m_cPosStatus.Temp.Warning2 == "N" && m_cPosStatus.Temp.receiveYN2 == "N")
                    {
                        // 녹색
                        lblTemperature02.BackColor = Color.Green;
                    }
                    else
                    {
                        if (m_cPosStatus.Temp.receiveYN2 == "Y" || CmUtil.IsNull(m_cPosStatus.Temp.Temperature2) == true)
                        {
                            // 회색
                            lblTemperature02.BackColor = Color.DarkGray;
                        }
                        else if (m_cPosStatus.Temp.receiveYN2 == "N")
                        {
                            if (m_cPosStatus.Temp.Alarm2 == "Y")
                            {
                                // 레드
                                lblTemperature02.BackColor = Color.Red;
                            }
                            else if (m_cPosStatus.Temp.Alarm2 == "N")
                            {
                                // 황색
                                lblTemperature02.BackColor = Color.DarkOrange;
                            }
                        }
                    }

                    // 세번째 온도 정보
                    if (m_cPosStatus.Temp.Alarm3 == "N" && m_cPosStatus.Temp.Warning3 == "N" && m_cPosStatus.Temp.receiveYN3 == "N")
                    {
                        // 녹색
                        lblTemperature03.BackColor = Color.Green;
                    }
                    else
                    {
                        if (m_cPosStatus.Temp.receiveYN3 == "Y" || CmUtil.IsNull(m_cPosStatus.Temp.Temperature3) == true)
                        {
                            // 회색
                            lblTemperature03.BackColor = Color.DarkGray;
                        }
                        else if (m_cPosStatus.Temp.receiveYN3 == "N")
                        {
                            if (m_cPosStatus.Temp.Alarm3 == "Y")
                            {
                                // 레드
                                lblTemperature03.BackColor = Color.Red;
                            }
                            else if (m_cPosStatus.Temp.Alarm3 == "N")
                            {
                                // 황색
                                lblTemperature03.BackColor = Color.DarkOrange;
                            }
                        }
                    }
                    #endregion 온도정보 색상
                }

                //기념일 배송
                if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT020), "0") != "0")
                {
                    if (lblAnniv.Tag != null && lblAnniv.Tag.ToString().Equals("1"))
                    {
                        if (lblAnniv.BackColor == Color.FromArgb(34, 34, 34))
                        {
                            lblAnniv.BackColor = Color.Red;
                        }
                        else
                        {
                            lblAnniv.BackColor = Color.FromArgb(34, 34, 34);
                        }
                    }
                }

                // 주변장치 상태 표시
                lblDeviceState.ForeColor = m_cDataCommon.GS_DeviceStatus();

                //if (DateTime.Now.ToString("ss") == "10")
                //{
                //네트워크 온오프 체크
                OnLinecheck();
                //}
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
            finally
            {
                tmrMainTimer.Enabled = true;
            }
        }

        // Rhee, 2017.10.18 00077점포 매출 Text파일 다운로드 기능(매30분) Start
        private void tmrFilePutTimer_Tick(object sender, EventArgs e)
        {
            try
            {
                tmrFilePutTimer.Enabled = false;

                // 서버 시간 동기화 30분 마다
                // System.Diagnostics.Debug.WriteLine("DateTime.Now SS : " + DateTime.Now.ToString("ss"));
                if (Convert.ToInt16( DateTime.Now.ToString("ss") ) >= 59)
                {
                    //FilePutDownload();                                  // 1분마다 실행
                    m_nTimeSyncFlag++;
                    System.Diagnostics.Debug.WriteLine("m_nTimeSyncFlag : " + m_nTimeSyncFlag.ToString());
                    if (m_nTimeSyncFlag >= 30)
                    {                        
                        FilePutDownload();
                        m_nTimeSyncFlag = 0;
                    }
                }                
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
            finally
            {
                tmrFilePutTimer.Enabled = true;
            }
        }

        /// <summary>
        /// 00077점포 매출 Text파일 다운로드
        /// </summary>
        private void FilePutDownload()
        {
            DataTable dtData = null;
            string sPath = @"C:\file_put\upload";                                                           // 디렉토리            
            string sFileName = DateTime.Now.ToString("yyyyMMdd") + m_cPosStatus.Base.PosNo + ".txt";        // 파일명
            string sFileFullName = sPath + @"\" + sFileName;
            string saveDataPayAmt = "";            

            // 폴더 체크(생성)
            if (CmUtil.FindFolder(sPath) == false)
            {
                CmUtil.MakeDir(sPath);
            }

            // 파일 체크(삭제)
            if (CmUtil.FindFile(sPath, sFileName) == true)
            {
                CmUtil.FileDelete(sFileFullName);
            }

            // 결제 내역 조회            
            dtData = m_cDataSearch.SelectPayAmtFilePut(m_sFilePutStoreCode, DateTime.Now.ToString("yyyyMMdd"));
            if (dtData != null) { 
                foreach (DataRow dr in dtData.Rows)
                {
                    saveDataPayAmt = saveDataPayAmt + DateTime.Now.ToString("yyMMdd ") + m_cPosStatus.Base.PosNo + " " + CmUtil.GetDataRowDouble(dr, "PAY_AMT");
                }
            }
            else
            {
                saveDataPayAmt = saveDataPayAmt + DateTime.Now.ToString("yyMMdd ") + m_cPosStatus.Base.PosNo + " 0";
            }
            // 파일 저장
            CmUtil.WriteTextFile(sFileFullName, saveDataPayAmt);
        }
        // Rhee, 2017.10.18 00077점포 매출 Text파일 다운로드 기능(매30분) End

        /// <summary>
        /// BR팝업 업무 조회
        /// </summary>
        private void SelectBrPopUp()
        {
            DataTable dt = null;

            try
            {
                if (m_cPosStatus.Mst.CorpDiv == ItemConst.CORP_DIV.BR)
                {
                    dt = m_cDataCommon.GetBrPopUpBizMst();

                    if (dt == null || dt.Rows.Count == 0)
                    {
                        //처리 없음!
                    }
                    else
                    {
                        foreach (DataRow dr in dt.Rows)
                        {

                            string sRet = "";

                            if (dr["CMM_GRP_CD"].Equals(PosConst.COMMON_CODE_GROUP.Z0016))
                            {
                                //BR) 품질관리 집중시간
                                sRet = WinBasic.ShowForm(new string[] { FormManager.FORM_POPUP_COM, PosConst.MSG_BOX_TYPE.CONFIRM, dr["SHOW_MSG1"].ToString(), dr["SHOW_MSG2"].ToString(), dr["SHOW_MSG3"].ToString(), "T", "0", "", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0128) });
                            }
                            else if (dr["CMM_GRP_CD"].Equals(PosConst.COMMON_CODE_GROUP.Z0015))
                            {
                                //TO-BE 처리 없음!
                            }
                            else if (dr["CMM_GRP_CD"].Equals(PosConst.COMMON_CODE_GROUP.Z0018))
                            {
                                //DD) 재고율정보 알림
                                sRet = WinBasic.ShowForm(new string[] { FormManager.FORM_POPUP_COM, PosConst.MSG_BOX_TYPE.QUESTION, dr["SHOW_MSG1"].ToString(), dr["SHOW_MSG2"].ToString(), dr["SHOW_MSG3"].ToString(), "F", "0", "", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0131) });
                                if (sRet == UserCom.RST_OK)
                                {
                                    WinBasic.ShowForm(new string[] { FormManager.FORM_WEB_LINK, PosKey.MENU_KEY.PRODUCE_REG });
                                }
                            }
                            else if (dr["CMM_GRP_CD"].Equals(PosConst.COMMON_CODE_GROUP.Z0019))
                            {
                                //DD) 주말 행사정보 팝업
                                sRet = WinBasic.ShowForm(new string[] { FormManager.FORM_POPUP_COM, PosConst.MSG_BOX_TYPE.QUESTION, dr["SHOW_MSG1"].ToString(), dr["SHOW_MSG2"].ToString(), dr["SHOW_MSG3"].ToString(), "F", "0", "", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0392) });

                                if (sRet != UserCom.RST_OK)
                                {
                                    //주말 행사 정보 추후 WEB POS 확정되면 처리해야함!
                                    //WinBasic.ShowForm(new string[] { FormManager.FORM_WEB_LINK, "" });
                                }
                            }

                            m_cDataCommon.BrPopupUpdate(dr);

                        }

                        m_cPosStatus.Sale.ScreenSaverTime = DateTime.Now.ToString("yyyyMMddHHmmss");    //화면보호기 대기시간 설정
                    }
                }
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }


        /// <summary>
        /// 점주/알바 모드 클릭
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAdmin_Click(object sender, EventArgs e)
        {
            try
            {
                SetOwnPartDiv(true);

                m_cPosStatus.Sale.ScreenSaverTime = DateTime.Now.ToString("yyyyMMddHHmmss");    //화면보호기 대기시간 설정
            }
            catch (Exception ex)
            {

                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }

        }

        /// <summary>
        /// 점주/알바 모드 셋팅
        /// </summary>
        /// <param name="bOwnPartDivChange"></param>
        private void SetOwnPartDiv(bool bOwnPartDivChange)
        {

            try
            {
                if (bOwnPartDivChange == true)
                {
                    if (m_cPosStatus.Base.OwnPartDiv == PosConst.OWN_PART_DIV.PART_DIV)
                    {
                        m_cPosStatus.Base.OwnPartDiv = PosConst.OWN_PART_DIV.OWN_DIV;
                    }
                    else
                    {
                        m_cPosStatus.Base.OwnPartDiv = PosConst.OWN_PART_DIV.PART_DIV;
                    }

                    //전송데이터 저장
                    m_cDataCommon.SaveServerRequestTransactionData(PosConst.RE_TRANSACTIONDATA.OWNER_MODE, new string[] { m_cPosStatus.Base.OwnPartDiv });
                }

                if (m_cPosStatus.Base.OwnPartDiv == PosConst.OWN_PART_DIV.PART_DIV)
                {
                    btnAdmin.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0033);
                }
                else
                {
                    m_cPosStatus.Base.OwnPartDiv = PosConst.OWN_PART_DIV.OWN_DIV;
                    btnAdmin.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0034);
                }

                ////전송데이터 저장
                //m_cDataCommon.SaveServerRequestTransactionData(PosConst.RE_TRANSACTIONDATA.OWNER_MODE, new string[] { m_cPosStatus.Base.OwnPartDiv });
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

        /// <summary>
        /// Pos Main 실행파일 버젼 (클라이언트)표시
        /// girak.kim; 20173.08.22.001
        /// </summary>
        private void GetClientPOSVersion()
        {            
            try
            {
                lblRealVer.Text = WinBasic.ClientPOSVersion.ToString();
                //resource.resx 에서 참조하는 프로젝트가 두 곳으로 늘어나서 전역 변수 사용함.
                //lblRealVer.Text = Cosmos.Win.Properties.Resources.PosMainVersion.ToString();//Resource.resx 파일에 설정
                // 응용프로그램 매니페스트에서 FileVersion Info 를 숨겨 나타 나지 않고, Assembly Version 만 사용 가능
                /*
                System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
                System.Diagnostics.FileVersionInfo asblyFileInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location);
                assembly.GetName().Version.ToString() ,  asblyFileInfo.FileVersion ,asblyFileInfo.ProductVersion              
                */
                
                
            }
            catch(Exception ex)
            {
                lblRealVer.Text = "0.0.0.0";
            }
        }

        private void picWeb_Click(object sender, EventArgs e)
        {
            try
            {
                m_cPosStatus.Sale.ScreenSaverTime = "";    //화면보호기 대기시간 설정

                tmrMainTimer.Stop();

                if (pnlMenuSlide.Visible != true)
                {
                    m_sPosMenuKeyIn = PosKey.MENU_KEY.TOP_MENU_WEB;
                    pnlMenuSlide.Visible = true;
                    MenuSlideList();
                    SlideInitControl();
                    pnlMenuSlide.BringToFront();
                }
                else
                {
                    pnlMenuSlide.Visible = false;
                }

                m_cPosStatus.Sale.ScreenSaverTime = DateTime.Now.ToString("yyyyMMddHHmmss");    //화면보호기 대기시간 설정
            }
            catch (Exception ex)
            {

                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
            finally
            {
                tmrMainTimer.Start();
            }
        }

        /// <summary>
        /// 캠페인 조회 전체
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lblCampainAll_Click(object sender, EventArgs e)
        {
            try
            {
                tmrMainTimer.Stop();

                WinBasic.ShowForm(new string[] { FormManager.FORM_CAMPAIGN_INFO, "" });

                m_cPosStatus.Sale.ScreenSaverTime = DateTime.Now.ToString("yyyyMMddHHmmss");    //화면보호기 대기시간 설정
            }
            catch (Exception ex)
            {

                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
            finally 
            {
                tmrMainTimer.Start();
            }
        }

        /// <summary>
        /// 캠페인 상세 클릭
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lblCampaignDtl_Click(object sender, EventArgs e)
        {
            try
            {
                tmrMainTimer.Stop();

                if (((UI.CsmLabel)sender).Tag.ToString() != "")
                {
                    //이벤트 확인 화면 호출!
                    WinBasic.ShowForm(new string[] { FormManager.FORM_CAMPAIGN_INFO, ((UI.CsmLabel)sender).Tag.ToString() });
                }
                m_cPosStatus.Sale.ScreenSaverTime = DateTime.Now.ToString("yyyyMMddHHmmss");    //화면보호기 대기시간 설정
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
            finally
            {
                tmrMainTimer.Start();
            }
        }
        /// <summary>
        /// 공지사항 웹 호출(전체)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lblNoticeAll_Click(object sender, EventArgs e)
        {
            try
            {
                tmrMainTimer.Stop();

                //공지사항 조회 화면 호출!
                WinBasic.ShowForm(new string[] { FormManager.FORM_NOTICE_SEARCH, "" });

                m_cPosStatus.Sale.ScreenSaverTime = DateTime.Now.ToString("yyyyMMddHHmmss");    //화면보호기 대기시간 설정

            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);

            }
            finally
            {
                tmrMainTimer.Start();
            }
        }
        /// <summary>
        /// 공지사항 웹 호출(단일)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lblNoticeDtl_Click(object sender, EventArgs e)
        {
            try
            {
                m_cPosStatus.Sale.ScreenSaverTime = DateTime.Now.ToString("yyyyMMddHHmmss");    //화면보호기 대기시간 설정

                tmrMainTimer.Stop();

                string sTag = ((UI.CsmLabel)sender).Tag.ToString().Trim();
                if (sTag == "") return;

                string[] aParam = sTag.Split(new string[] { "^" }, StringSplitOptions.None);

                if (aParam.Length != 2) return;

                //if (aParam[0] == ItemConst.NOTE_MSG_DIV.NRL)
                //{
                //    //공지사항 웹페이지 호출!
                //}
                //else
                //{
                    //공지사항 조회 화면 호출!
                    WinBasic.ShowForm(new string[] { FormManager.FORM_NOTICE_SEARCH, sTag });
                //}
                m_cPosStatus.Sale.ScreenSaverTime = DateTime.Now.ToString("yyyyMMddHHmmss");    //화면보호기 대기시간 설정
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);

            }
            finally
            {
                tmrMainTimer.Start();
            }
        }

        /// <summary>
        /// Timer Start or Kill
        /// </summary>
        /// <param name="bKillFlag"></param>
        private void TimerStartKillProc(bool bKillFlag)
        {
            try
            {
                if (bKillFlag == true)
                {
                    tmrMainTimer.Enabled = false;
                    tmrMainTimer.Stop();
                }
                else
                {
                    tmrMainTimer.Enabled = true;
                    tmrMainTimer.Start();
                }
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

        private bool CheckOpenStoreYn()
        {
            bool bAnswer = false;
            string sRet = "";

            try
            {
                string sSysDate = System.DateTime.Now.ToString("yyyyMMdd");
                if (m_cPosStatus.Base.OpenClose == "1")
                {
                    // 영업일자 체크
                    if (CmUtil.LongParse(m_cPosStatus.Base.SaleDate) < CmUtil.LongParse(sSysDate))
                    {
                        // 전일자 마감처리되지 않았습니다. 전일 마감 후 개점처리 하십시오.
                        return false;
                    }
                }
                else
                {
                    // 이미 마감
                    return false;
                }
            }
            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 false;
            }

            return true;
        }

        private bool CheckOpenStore()
        {
            bool bAnswer = false;
            string sRet = "";

            try
            {
                string sSysDate = System.DateTime.Now.ToString("yyyyMMdd");
                if (m_cPosStatus.Base.OpenClose == "1")
                {
                    // 영업일자 체크
                    if (CmUtil.LongParse(m_cPosStatus.Base.SaleDate) < CmUtil.LongParse(sSysDate))
                    {
                        WinManager.ErrorMessage(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0242) + " : " + m_cPosStatus.Global.DateToCulture(m_cPosStatus.Base.SaleDate) + ", "
                            + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0516) + " : " + m_cPosStatus.Global.DateToCulture(sSysDate) + PosConst.CRLF
                            + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0184));

                        // 마감화면으로 이동
                        sRet = WinOpenClose.ShowForm(new string[] { FormManager.FORM_ACC_SALE_END, PosKey.MENU_KEY.SALE_CLOSE, ItemConst.TRAN_KIND.STATEMENT.ADJUSTMENT, ItemConst.TRAN_DIV.NORMAL });

                        return false;
                    }
                }
                else
                {
                    // 영업일자 체크
                    // 마감상태일 경우 시스템일자와 현재 영업일자가 같거나 미래일 경우에는 익일 개점 허용여부 옵션을 체크하여
                    // 개점을 진행하거나 하지 않는다.
                    // 시스템일자보다 과거 일자의 경우 무조건 팝업창을 표시해준다.
                    if (CmUtil.LongParse(m_cPosStatus.Base.SaleDate) >= CmUtil.LongParse(sSysDate))
                    {
                        // 익일 개점 허용 여부 옵션 체크
                        if (PosMstManager.GetPosOption(POS_OPTION.OPT302) != "0")
                        {
                            bAnswer = WinManager.QuestionMessage(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0242) + " : " + m_cPosStatus.Global.DateToCulture(m_cPosStatus.Base.SaleDate)
                                                                  + " " + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0627));

                            if (bAnswer == true)
                            {
                                // 미사용이 아닐 경우 개점화면 표시
                                sRet = WinOpenClose.ShowForm(new string[] { FormManager.FORM_SOD_SALE });
                            }

                            return false;
                        }
                        else
                        {
                            WinManager.ErrorMessage(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0242) + " : " + m_cPosStatus.Global.DateToCulture(m_cPosStatus.Base.SaleDate) + ", "
                             + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0516) + " : " + m_cPosStatus.Global.DateToCulture(sSysDate) + PosConst.CRLF
                             + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0185));
                            return false;
                        }
                    }
                    else
                    {
                        bAnswer = WinManager.QuestionMessage(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0242) + " : " + m_cPosStatus.Global.DateToCulture(m_cPosStatus.Base.SaleDate)
                                                              + " " + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0627));

                        if (bAnswer == true)
                        {
                            // 미사용이 아닐 경우 개점화면 표시
                            sRet = WinOpenClose.ShowForm(new string[] { FormManager.FORM_SOD_SALE });
                        }

                        return false;
                    }
                }
            }
            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 false;
            }

            return true;
        }

        private void lblIFStatus_Click(object sender, EventArgs e)
        {
            try
            {
                string sMenuKey = string.Empty;
                if ((Cosmos.UI.CsmLabel)sender == lblIFStatus1)          // 해피오더
                {
                    if (CheckOpenStore() == false) return;
                    sMenuKey = "";
                }
                else if ((Cosmos.UI.CsmLabel)sender == lblIFStatus2)     // 빚은몰
                {
                    sMenuKey = PosKey.MENU_KEY.WEB_BIZEUN_MALL;
                }
                else if ((Cosmos.UI.CsmLabel)sender == lblIFStatus3)     // 이지웰
                {
                    sMenuKey = PosKey.MENU_KEY.WEB_EZWELL;
                }

                if (WinBasic.CheckMenuKeyAuth(sMenuKey) == false) return;      // 기능키 판매원 권한 체크
                //string sMngAuth = PosMstManager.GetMstPicAuth(m_cPosStatus.Base.CashierNo + sMenuKey);

                //switch (sMngAuth)
                //{
                //    case PosConst.MNG_AUTH_DIV.NON_PERMISSION:
                //        WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0308), MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0505), false);
                //        return;
                //    case PosConst.MNG_AUTH_DIV.PERMISSION:
                //        break;
                //    case PosConst.MNG_AUTH_DIV.SUPERVISOR:
                //        if (WinBasic.ShowForm(new string[] { FormManager.FORM_LOG_ON, PosKey.MENU_KEY.REGISTER_ADMIN }) == UserCom.RST_ERR) return;
                //        //string sRet = WinBasic.ShowForm(new string[] { FormManager.FORM_CASHIER_INPUT, "Supervisor" });
                //        //if (sRet != UserCom.RST_OK)
                //        //{
                //        //    return;
                //        //}
                //        break;
                //}

                if ((Cosmos.UI.CsmLabel)sender == lblIFStatus1)          // 해피오더
                {
                    if (PosMstManager.GetPosOption(POS_OPTION.OPT035) == "1")
                    {
                        tmrMainTimer.Stop();

                        //#20180615 해피오더 팝업 수정 start
                        //기존
                        //WinSale.ShowForm(new string[] { FormManager.FORM_SAL_HPORD_POPUP, "NORMAL" });
                        //변경
                        WinSale.ShowForm(new string[] { FormManager.FORM_SAL_HPORD, "01", "C" });
                        //#20180615 해피오더 팝업 수정 end

                        tmrMainTimer.Start();
                    }
                }
                else if ((Cosmos.UI.CsmLabel)sender == lblIFStatus2)     // 빚은몰
                {
                    if (PosMstManager.GetPosOption(POS_OPTION.OPT036) == "1")
                    {
                        WinBasic.ShowWebPos(PosKey.MENU_KEY.WEB_BIZEUN_MALL, true);
                        //WinBasic.ShowForm(new string[] { FormManager.FORM_WEB_BIZEUN, PosKey.MENU_KEY.WEB_BIZEUN_MALL });
                    }
                }
                else if ((Cosmos.UI.CsmLabel)sender == lblIFStatus3)     // 이지웰
                {
                    if (PosMstManager.GetPosOption(POS_OPTION.OPT037) == "1")
                    {
                        WinBasic.ShowWebPos(PosKey.MENU_KEY.WEB_EZWELL);
                        //WinBasic.ShowForm(new string[] { FormManager.FORM_WEB_EZWELW, PosKey.MENU_KEY.WEB_EZWELL });
                    }
                }
                else if ((Cosmos.UI.CsmLabel)sender == lblOwnerPart)     // 점주알바WEB
                {
                    WinBasic.ShowWebPos(PosKey.MENU_KEY.OWNER_WEB);
                    //ShowOwnerPartWeb(PosKey.MENU_KEY.OWNER_WEB);
                }
                else if ((Cosmos.UI.CsmLabel)sender == lblAnniv)        // 기념일배송
                {
                    lblAnniv.Tag = "";
                    lblAnniv.BackColor = Color.FromArgb(34, 34, 34);
                    //디비업데이트

                    m_cDataCommon.UpdateEtcNoticeProcess("05", null);
                    WinBasic.ShowWebPos(PosKey.MENU_KEY.REMB_ORDER_PRINT);
                    //ShowOwnerPartWeb(PosKey.MENU_KEY.REMB_ORDER_PRINT);
                }

                m_cPosStatus.Sale.ScreenSaverTime = DateTime.Now.ToString("yyyyMMddHHmmss");    //화면보호기 대기시간 설정
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

        #region  SLIDE 메뉴 함수
        /// <summary>
        /// SLIDE 메뉴
        /// </summary>
        /// <param name="sPosMenuKeyIn"></param>
        private void MenuSlideList()
        {
            try
            {
                m_alMenuHead = new ArrayList();
                m_alMenuProc = new ArrayList();

                DataTable dtFuncKey = null;

                // SLIDE메뉴 들어갈 시에도 권한체크(2017.07.07)
                // 키 그룹 판매원 권한 체크
                if (WinBasic.CheckMenuKeyAuth(m_sPosMenuKeyIn) == false) return;

                ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                //헤더 로드
                dtFuncKey = m_cDataCommon.SeletFuncKey(m_sPosMenuKeyIn);
                if (dtFuncKey == null || dtFuncKey.Rows.Count <= 0)
                {
                    //return;
                }
                else
                {
                    foreach (DataRow dr in dtFuncKey.Rows)
                    {
                        string sPosName = CmUtil.GetDataRowStr(dr, PosMst.MST_FUNC_KEY.DATA.FUNC_NM);         // 기능명
                        m_alMenuHead.Add(new string[] { m_sPosMenuKeyIn, sPosName });
                    }
                }

                ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                if (m_SlideMenuKey == PosKey.MENU_KEY.FOREIGNERS_RESPONSE)
                {
                    dtFuncKey = m_cDataCommon.SeletCommonCode(PosConst.COMMON_CODE_GROUP.Z0017, "");
                    if (dtFuncKey == null || dtFuncKey.Rows.Count <= 0)
                    {
                        return;
                    }
                    else
                    {
                        foreach (DataRow dr in dtFuncKey.Rows)
                        {
                            string sDispSeq = CmUtil.GetDataRowStr(dr, PosMst.MST_COMMON.DATA.DISP_SEQ);    // 표시순번
                            string sPosName = CmUtil.GetDataRowStr(dr, PosMst.MST_COMMON.DATA.CD_NM);       // 기능명
                            string sPosKey = CmUtil.GetDataRowStr(dr, PosMst.MST_COMMON.DATA.CMM_CD);       // 기능키

                            //if (CmUtil.GetDataRowStr(dr, PosMst.MST_COMMON.DATA.CHAR_VAL_TITLE_VAL_01) == "1")
                            m_alMenuProc.Add(new string[] { m_sPosMenuKeyIn, sDispSeq, sPosName, sPosKey });   //배열저장
                        }
                    }
                }
                else if (m_sPosMenuKeyIn == PosKey.MENU_KEY.TOP_MENU_WEB)
                {
                    dtFuncKey = m_cDataCommon.SeletMstWebLinkMst("");
                    if (dtFuncKey == null || dtFuncKey.Rows.Count <= 0)
                    {
                        return;
                    }
                    else
                    {
                        int seqIndex = 0;
                        foreach (DataRow dr in dtFuncKey.Rows)
                        {
                            //string sDispSeq = CmUtil.GetDataRowStr(dr, PosMst.MST_WEB_LINKAGE.DATA.DISP_SEQ);     // 표시순번
                            string sPosName = CmUtil.GetDataRowStr(dr, PosMst.MST_WEB_LINKAGE.DATA.MENU_NM);      // 기능명
                            string sPosKey = CmUtil.GetDataRowStr(dr, PosMst.MST_WEB_LINKAGE.DATA.FUNC_ID);       // 기능키

                            //if (CmUtil.GetDataRowStr(dr, PosMst.MST_WEB_LINKAGE.DATA.DIV) == "2")
                            {
                                seqIndex = seqIndex + 1;
                                string sDispSeq = Convert.ToString(seqIndex);     // 표시순번
                                m_alMenuProc.Add(new string[] { m_sPosMenuKeyIn, sDispSeq, sPosName, sPosKey });   //배열저장
                            }


                        }
                    }
                }
                else
                {
                    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    // 기타(상단메뉴) 기능키 로딩
                    dtFuncKey = m_cDataCommon.SeletFuncKeyGroup(m_sPosMenuKeyIn);
                    if (dtFuncKey == null || dtFuncKey.Rows.Count <= 0)
                    {
                        return;
                    }
                    else
                    {
                        foreach (DataRow dr in dtFuncKey.Rows)
                        {
                            string sDispSeq = CmUtil.GetDataRowStr(dr, PosMst.MST_FUNC_KEY_GRP.DATA.DISP_SEQ);        // 표시순번
                            string sPosName = CmUtil.GetDataRowStr(dr, PosMst.MST_FUNC_KEY_GRP.DATA.FUNC_NM);         // 기능명
                            string sPosKey = CmUtil.GetDataRowStr(dr, PosMst.MST_FUNC_KEY_GRP.DATA.FUNC_ID);          // 기능키

                            m_alMenuProc.Add(new string[] { m_sPosMenuKeyIn, sDispSeq, sPosName, sPosKey });           //배열저장

                        }
                    }
                }

            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

        /// <summary>
        /// SLIDE 메뉴 컨트롤 초기화
        /// </summary>
        private void SlideInitControl()
        {
            try
            {
                // 메뉴 타이틀 출력
                foreach (string[] aMenu in m_alMenuHead)
                {
                    if (aMenu[0] == m_sPosMenuKeyIn)
                    {
                        //lblTitle.Text = aMenu[1];
                        break;
                    }
                }

                m_nTopPos = 0;
                SlideMenuDisplay();      //화면에 메뉴 표시
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }


        /// <summary>
        /// SLIDE 화면에 메뉴 표시
        /// </summary>
        private void SlideMenuDisplay()
        {
            try
            {
                int nMax = 0;

                // 메뉴 상세 초기화
                foreach (object obj in m_htMenuControls.Values)
                {
                    Cosmos.UI.CsmLabel btnCtl = (Cosmos.UI.CsmLabel)obj;
                    btnCtl.Text = "";
                    btnCtl.Tag = "";
                    // btnCtl.Visible = false;
                }

                //0:메뉴항목, 1:위치, 2:표시텍스트, 3:기능키값
                foreach (string[] aMenu in m_alMenuProc)
                {
                    if (aMenu[0] == m_sPosMenuKeyIn)
                    {
                        nMax = m_htMenuControls.Count;

                        int nPos = int.Parse(aMenu[1]);      // 표시위치
                        if (nPos > m_nTopPos && nPos <= m_nTopPos + nMax)
                        {
                            Cosmos.UI.CsmLabel btnCtl = (Cosmos.UI.CsmLabel)m_htMenuControls[(nPos - 1) % nMax];

                            btnCtl.Text = aMenu[2];
                            btnCtl.Tag = aMenu[3];
                            //btnCtl.Visible = true;
                        }
                    }
                }

                SlideSetNavigationBtn(m_alMenuProc.Count);

            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

        /// <summary>
        /// 네비게이션 표시 변경
        /// </summary>
        /// <param name="nMax"></param>
        private void SlideSetNavigationBtn(int nMax)
        {
            try
            {
                if (m_nTopPos == 0)
                    btnUp.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MENUSLIDE_PAGEBTN_LEFT_DEFAULT);
                //btnUp.Text = "■";
                else
                    btnUp.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MENUSLIDE_PAGEBTN_LEFT_DIM);
                //btnUp.Text = "◀";

                if (m_nTopPos + 7 < nMax)
                    btnDown.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MENUSLIDE_PAGEBTN_RIGHT_DIM);
                //btnDown.Text = "▶";
                else
                    btnDown.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MENUSLIDE_PAGEBTN_RIGHT_DEFAULT);
                //btnDown.Text = "■";
            }
            catch (Exception ex)
            {

                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }

        }

        private void SlideSetMenuBtn()
        {
            try
            {
                #region 메뉴버튼
                // 메뉴버튼 
                m_htMenuControls = new Hashtable();
                m_htMenuControls.Add(m_htMenuControls.Count, lblSlideMenu01);
                m_htMenuControls.Add(m_htMenuControls.Count, lblSlideMenu02);
                m_htMenuControls.Add(m_htMenuControls.Count, lblSlideMenu03);
                m_htMenuControls.Add(m_htMenuControls.Count, lblSlideMenu04);
                m_htMenuControls.Add(m_htMenuControls.Count, lblSlideMenu05);
                m_htMenuControls.Add(m_htMenuControls.Count, lblSlideMenu06);
                //m_htMenuControls.Add(m_htMenuControls.Count, lblSlideMenu07);

                picMenuSlide.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MENUSLIDE_BG);

                lblSlideMenu01.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MENUSLIDE_CATEGORY_BTN_DEFAULT);
                lblSlideMenu02.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MENUSLIDE_CATEGORY_BTN_DEFAULT);
                lblSlideMenu03.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MENUSLIDE_CATEGORY_BTN_DEFAULT);
                lblSlideMenu04.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MENUSLIDE_CATEGORY_BTN_DEFAULT);
                lblSlideMenu05.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MENUSLIDE_CATEGORY_BTN_DEFAULT);
                lblSlideMenu06.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MENUSLIDE_CATEGORY_BTN_DEFAULT);

                picMenuSlide.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MENUSLIDE_BG);
                btnUp.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MENUSLIDE_PAGEBTN_LEFT_DEFAULT);
                btnDown.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MENUSLIDE_PAGEBTN_RIGHT_DEFAULT);

                #endregion
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);

            }


        }

        /// <summary>
        /// 기능 버튼 입력 처리
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSlideFuncProc_Click(object sender, EventArgs e)
        {
            try
            {
                UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ((Cosmos.UI.CsmLabel)sender).Text.ToString());

                //if (((Cosmos.UI.CsmLabel)sender) == btnExit)
                //{
                //    PosMenuKeyOut = "";
                //    this.DialogResult = DialogResult.Cancel;
                //    this.Close();
                //}
                if (((Cosmos.UI.CsmLabel)sender) == btnUp)
                {
                    int nMax = m_htMenuControls.Count;
                    if (m_nTopPos > 0)
                    {
                        m_nTopPos -= nMax;
                        SlideMenuDisplay();
                    }
                }
                if (((Cosmos.UI.CsmLabel)sender) == btnDown)
                {
                    int nMax = m_htMenuControls.Count;

                    foreach (string[] aMenu in m_alMenuProc)
                    {
                        if (aMenu[0] == m_sPosMenuKeyIn)
                        {
                            if (int.Parse(aMenu[1]) > m_nTopPos + nMax)
                            {
                                m_nTopPos += nMax;
                                SlideMenuDisplay();
                                break;
                            }
                        }
                    }
                }

                m_cPosStatus.Sale.ScreenSaverTime = DateTime.Now.ToString("yyyyMMddHHmmss");    //화면보호기 대기시간 설정
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

        private void btnSlidePage_MouseDown(object sender, MouseEventArgs e)
        {
            try
            {
                UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ((Cosmos.UI.CsmLabel)sender).Text.ToString());

                if (((Cosmos.UI.CsmLabel)sender) == btnUp)
                {
                    btnUp.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MENUSLIDE_PAGEBTN_LEFT_PRESS);
                }
                if (((Cosmos.UI.CsmLabel)sender) == btnDown)
                {
                    btnDown.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MENUSLIDE_PAGEBTN_RIGHT_PRESS);
                }
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

        private void btnSlidePage_MouseUp(object sender, MouseEventArgs e)
        {
            SlideSetNavigationBtn(m_alMenuProc.Count);
        }

        private void btnMenu_MouseUp(object sender, MouseEventArgs e)
        {
            ((Cosmos.UI.CsmLabel)sender).Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MENUSLIDE_CATEGORY_BTN_DEFAULT);
        }

        private void btnMenu_MouseDown(object sender, MouseEventArgs e)
        {
            ((Cosmos.UI.CsmLabel)sender).Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MENUSLIDE_CATEGORY_BTN_PRESS);
        }

        private void btnSlideMenu_Click(object sender, EventArgs e)
        {

            tmrMainTimer.Enabled = false;

            try
            {
                if (((Cosmos.UI.CsmLabel)sender).Tag.ToString() != "")
                {
                    UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                        System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ((Cosmos.UI.CsmLabel)sender).Text.ToString());

                    m_SlideMenuKey = ((Cosmos.UI.CsmLabel)sender).Tag.ToString();

                    if (m_SlideMenuKey != PosKey.MENU_KEY.FOREIGNERS_RESPONSE)
                    {
                        this.pnlMenuSlide.Visible = false;
                    }

                    if (m_sPosMenuKeyIn == PosKey.MENU_KEY.TOP_MENU_WEB)
                    {
                        if (m_SlideMenuKey == PosKey.MENU_KEY.WEB_BIZEUN_MALL)
                        {
                            WinBasic.ShowWebPos(m_SlideMenuKey, true);
                        }
                        else
                        {
                            WinBasic.ShowWebPos(m_SlideMenuKey);
                        }
                    }
                    else
                    {
                        if (m_SlideMenuKey == PosKey.MENU_KEY.FOREIGNERS_RESPONSE)
                        {
                            MenuSlideList();
                            SlideInitControl();
                        }
                        else
                        {
                            // 외국인 대응에 대한 경우에만 직접 보여준다.
                            if (m_SlideMenuKey == "001" || m_SlideMenuKey == "002" || m_SlideMenuKey == "003")
                            {
                                WinBasic.ShowForm(new string[] { FormManager.FORM_SAL_FOREIGNERS_RESPONSE, m_SlideMenuKey });
                            }
                            else
                            {
                                WinSale.ExecuteBinessRun(m_SlideMenuKey);
                            }
                        }
                    }
                }

                m_cPosStatus.Sale.ScreenSaverTime = DateTime.Now.ToString("yyyyMMddHHmmss");    //화면보호기 대기시간 설정
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
            finally
            {
                tmrMainTimer.Enabled = true;
            }

            
        }

        #endregion  SLIDE 메뉴 함수

        private void lblSaleStatus_Click(object sender, EventArgs e)
        {
            try
            {
                m_cPosStatus.Sale.ScreenSaverTime = "";

                this.WindowState = FormWindowState.Minimized;
                FormManager.m_HideFormIndex = 0;
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

        /// <summary>
        /// 간편로그인 호출
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lblCashier_Click(object sender, EventArgs e)
        {
            try
            {
                string sRet = WinBasic.ShowForm(new string[] { FormManager.FORM_LOG_ON, PosKey.MENU_KEY.SIMPLE_LOG_ON });
                if (sRet != UserCom.RST_ERR && sRet != "")
                {
                    lblCashier.Text = m_cPosStatus.Base.CashierName;
                }
                m_cPosStatus.Sale.ScreenSaverTime = DateTime.Now.ToString("yyyyMMddHHmmss");    //화면보호기 대기시간 설정
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

        private void lblTemperature_Click(object sender, EventArgs e)
        {
            try
            {
                if (pnlTempInfo.Visible != true)
                {
                    pnlTempInfo.Visible = true;
                }
                else
                {
                    pnlTempInfo.Visible = false;
                }

                if (m_cPosStatus.Temp.Temperature1 != null && m_cPosStatus.Temp.Temperature1 != "")
                {
                    #region 온도정보 색상
                    // 우선 순위      : 미수신 > 알람 > 경고
                    //- 녹색(정상)   : 알람-N, 경고-N, 미수신-N
                    //- 회색(미수신) : 미수신-Y  미수신이 Y이면 알람, 경고는 체크 하지 않음
                    //- 적색(경고)   : 미수신-N, 알람-Y  알람이 Y이면 경고는 체크 하지 않음
                    //- 황색(알람)   : 미수신-N, 알람-N, 경고-Y
                    // [센서ID|온도계명|측정온도|알람YN|경고YN|미수신YN|최종수신시간]

                    // 첫번째 온도 정보
                    if (m_cPosStatus.Temp.Alarm1 == "N" && m_cPosStatus.Temp.Warning1 == "N" && m_cPosStatus.Temp.receiveYN1 == "N")
                    {
                        // 녹색
                        lblTemp1.Text = string.Format(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0653), m_cPosStatus.Temp.Name1, m_cPosStatus.Temp.Temperature1);
                        lblTemp1.ForeColor = Color.Green;
                    }
                    else
                    {
                        if (m_cPosStatus.Temp.receiveYN1 == "Y")
                        {
                            // 회색
                            lblTemp1.Text = string.Format(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0654), m_cPosStatus.Temp.Name1, m_cPosStatus.Temp.Temperature1);
                            lblTemp1.ForeColor = Color.DarkGray;
                        }
                        else if (m_cPosStatus.Temp.receiveYN1 == "N")
                        {
                            if (m_cPosStatus.Temp.Alarm1 == "Y")
                            {
                                // 레드
                                lblTemp1.Text = string.Format(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0655), m_cPosStatus.Temp.Name1, m_cPosStatus.Temp.Temperature1);
                                lblTemp1.ForeColor = Color.Red;
                            }
                            else if (m_cPosStatus.Temp.Alarm1 == "N")
                            {
                                // 황색
                                lblTemp1.Text = string.Format(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0656), m_cPosStatus.Temp.Name1, m_cPosStatus.Temp.Temperature1);
                                lblTemp1.ForeColor = Color.DarkOrange;
                            }
                        }
                    }
                }
                else
                {
                    lblTemp1.ForeColor = Color.Black;
                    lblTemp1.Text = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0657);
                }

                if (m_cPosStatus.Temp.Temperature2 != null && m_cPosStatus.Temp.Temperature2 != "")
                {
                    // 두번째 온도 정보
                    if (m_cPosStatus.Temp.Alarm2 == "N" && m_cPosStatus.Temp.Warning2 == "N" && m_cPosStatus.Temp.receiveYN2 == "N")
                    {
                        // 녹색
                        lblTemp2.Text = string.Format(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0653), m_cPosStatus.Temp.Name2, m_cPosStatus.Temp.Temperature2);
                        lblTemp2.ForeColor = Color.Green;
                    }
                    else
                    {
                        if (m_cPosStatus.Temp.receiveYN2 == "Y")
                        {
                            // 회색
                            lblTemp2.Text = string.Format(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0654), m_cPosStatus.Temp.Name2, m_cPosStatus.Temp.Temperature2);
                            lblTemp2.ForeColor = Color.DarkGray;
                        }
                        else if (m_cPosStatus.Temp.receiveYN2 == "N")
                        {
                            if (m_cPosStatus.Temp.Alarm2 == "Y")
                            {
                                // 레드
                                lblTemp2.Text = string.Format(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0655), m_cPosStatus.Temp.Name2, m_cPosStatus.Temp.Temperature2);
                                lblTemp2.ForeColor = Color.Red;
                            }
                            else if (m_cPosStatus.Temp.Alarm2 == "N")
                            {
                                // 황색
                                lblTemp2.Text = string.Format(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0656), m_cPosStatus.Temp.Name2, m_cPosStatus.Temp.Temperature2);
                                lblTemp2.ForeColor = Color.DarkOrange;
                            }
                        }
                    }
                }
                else
                {
                    lblTemp2.ForeColor = Color.Black;
                    lblTemp2.Text = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0657);
                }

                if (m_cPosStatus.Temp.Temperature3 != null && m_cPosStatus.Temp.Temperature3 != "")
                {
                    // 세번째 온도 정보
                    if (m_cPosStatus.Temp.Alarm3 == "N" && m_cPosStatus.Temp.Warning3 == "N" && m_cPosStatus.Temp.receiveYN3 == "N")
                    {
                        // 녹색
                        lblTemp3.Text = string.Format(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0653), m_cPosStatus.Temp.Name3, m_cPosStatus.Temp.Temperature3);
                        lblTemp3.ForeColor = Color.Green;
                    }
                    else
                    {
                        if (m_cPosStatus.Temp.receiveYN3 == "Y")
                        {
                            // 회색
                            lblTemp3.Text = string.Format(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0654), m_cPosStatus.Temp.Name3, m_cPosStatus.Temp.Temperature3);
                            lblTemp3.ForeColor = Color.DarkGray;
                        }
                        else if (m_cPosStatus.Temp.receiveYN3 == "N")
                        {
                            if (m_cPosStatus.Temp.Alarm3 == "Y")
                            {
                                // 레드
                                lblTemp3.Text = string.Format(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0655), m_cPosStatus.Temp.Name3, m_cPosStatus.Temp.Temperature3);
                                lblTemp3.ForeColor = Color.Red;
                            }
                            else if (m_cPosStatus.Temp.Alarm3 == "N")
                            {
                                // 황색
                                lblTemp3.Text = string.Format(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0656), m_cPosStatus.Temp.Name3, m_cPosStatus.Temp.Temperature3);
                                lblTemp3.ForeColor = Color.DarkOrange;
                            }
                        }
                    }
                }
                else
                {
                    lblTemp3.ForeColor = Color.Black;
                    lblTemp3.Text = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0657);
                }
                    #endregion 온도정보 색상

                m_cPosStatus.Sale.ScreenSaverTime = DateTime.Now.ToString("yyyyMMddHHmmss");    //화면보호기 대기시간 설정
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

        /// <summary>
        /// 디바이스 정보 클릭
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lblDeviceState_Click(object sender, EventArgs e)
        {
            try
            {
                // 주변장치 상태 관리 화면
                string sRet = WinSale.ShowForm(new string[] { FormManager.FORM_DEVICE_STATUS_SEARCH, PosKey.MENU_KEY.DEVICE_STATUS_SEARCH });

                m_cPosStatus.Sale.ScreenSaverTime = DateTime.Now.ToString("yyyyMMddHHmmss");    //화면보호기 대기시간 설정
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

        private void TempInfo_Click(object sender, EventArgs e)
        {
            try
            {
                if (pnlTempInfo.Visible != true)
                {
                    pnlTempInfo.Visible = true;
                }
                else
                {
                    pnlTempInfo.Visible = false;
                }

                m_cPosStatus.Sale.ScreenSaverTime = DateTime.Now.ToString("yyyyMMddHHmmss");    //화면보호기 대기시간 설정
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

        /// <summary>
        /// 프로그램 버전 더블클릭(원격 웹사이트)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lblPgmVersion_DoubleClick(object sender, EventArgs e)
        {
            string sRet = UserCom.RST_ERR;
            try
            {
                IDataServiceUs m_cWebBiz = (IDataServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_BASIC.DLL, ServiceLists.BSV_BASIC.WEB_POS);

                string sUrl = string.Empty;

                sUrl = (string)m_cWebBiz.GetData(new string[] { PosKey.MENU_KEY.REMOTE_URL });
                if (sUrl == null || sUrl == "") return;

                if (sUrl.StartsWith("2") == true)           // 1: WEB POS, 2:WEB LINK
                {
                    System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo("IExplore.exe");
                    startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized;
                    startInfo.Arguments = CmUtil.MidH(sUrl, 31, 100).Trim() + CmUtil.MidH(sUrl, 131, 100).Trim();

                    System.Diagnostics.Process.Start(startInfo);
                }

                m_cPosStatus.Sale.ScreenSaverTime = DateTime.Now.ToString("yyyyMMddHHmmss");    //화면보호기 대기시간 설정
                return;
            }
            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;
        }

        /// <summary>
        /// 네트워크 온오프 체크
        /// </summary>
        private void OnLinecheck()
        {

            try
            {
                //NW ON/OFF
                if (CmUtil.IsNetConnection() == 1)
                {
                    if (picWeb.Tag.ToString() != "ON")
                    {
                        picWeb.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.WEB_ICON);
                        picWeb.Tag = "ON";
                        lblWeb.Tag = "0";


                        lblWeb.Text = "WEB";
                        lblWeb.ForeColor = Color.White;
                    }

                    lblOffLine.Visible = false;
                }
                else
                {
                    if (picWeb.Tag.ToString() != "OFF")
                    {
                        picWeb.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.WEB_ICON_ERROR);
                        picWeb.Tag = "OFF";
                    }

                    //lblOffLine.Text = "";

                    lblOffLine.Visible = true;

                    //// WEB 글자색 변경!
                    //if (lblWeb.ForeColor == Color.White)
                    //{
                    //    lblWeb.ForeColor = CmUtil.GetRainbowColor(lblWeb.Tag.ToString());

                    //    if (lblWeb.Tag.ToString() == "7") lblWeb.Tag = "0";
                    //    lblWeb.Tag = (CmUtil.IntParse(lblWeb.Tag.ToString()) + 1).ToString();
                    //    lblWeb.Text = "OFF LINE";
                    //}
                    //else
                    //{
                    //    lblWeb.ForeColor = Color.White;
                    //    lblWeb.Text = "WEB";
                    //}

                }

            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

        private void MenuSlide_Click(object sender, EventArgs e)
        {
            try
            {
                if (pnlMenuSlide.Visible != true)
                {
                    pnlMenuSlide.Visible = true;
                    pnlMenuSlide.BringToFront();
                }
                else
                {
                    pnlMenuSlide.Visible = false;
                }

                m_cPosStatus.Sale.ScreenSaverTime = DateTime.Now.ToString("yyyyMMddHHmmss");    //화면보호기 대기시간 설정
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

        #region 상단 일자 시간 표시
        private delegate void SetDatetimeCallback();
        /// <summary>
        /// 일자시간 표시
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tmrDateTime_Tick(object sender, EventArgs e)
        {
            try
            {
                tmrDateTime.Stop();
                SetDateTime();
                tmrDateTime.Start();

                //#15058 해피오더 버튼 변경_20180612 start,phj
                if (PosMstManager.GetPosOption(POS_OPTION.OPT035) == "1")
                {
                    if (CheckOpenStoreYn() == true)
                    {
                        if (bPosMain == true)
                        {
                            NewHPOrdDisplay();
                        }

                        if (bPosMain == false)
                        {
                            iCount = iCount + 1;

                            if (iCount >= 60)
                            {
                                iCount = 0;
                                bPosMain = true;
                            }
                        }
                    } 
                }
                //#15058 해피오더 버튼 변경_20180612 end,phj

                //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 start - #16368
                //기존
                /*
                //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 start
                if (PosMstManager.GetPosOption(POS_OPTION.OPT518) == "1")
                {
                    iInventoryDispCnt = iInventoryDispCnt + 1;
                    if (bInventoryDispStat == true)
                    {
                        HappyOrderInventoryAlram();
                        if (iInventoryDispCnt % 60 == 0)
                        {
                            HappyOrderInventoryAlram_StatChange(false);
                        }
                    }
                    else
                    {
                        if (iInventoryDispCnt == 0 || iInventoryDispCnt >= 60 * 10)
                        {
                            HappyOrderInventoryAlram();
                        }
                    }
                }
                //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 end
                */

                //변경
                //--------------------------------------------------
                //레드마인: #16368 
                //요청일자: 2018/08/22
                //요청자  : SPC 안병석 과장
                //내용    : 1. 알람 표시시간
                //          [기존] 제한없음
                //          [변경] 오후2시이후부터 표시
                //          2. 알람 자동 표시 시간
                //          [기존] 닫기버튼 클릭 시 10분마다 자동 표시
                //          [변경] 매시간 30분마다 자동 표시 후 5분간 표시
                //          단, 닫기 버튼 클릭 시 알람 닫기
                //      예) 14:00~14:05 재고알람 표시
                //      14:30~14:35 재고알람 표시
                //--------------------------------------------------

                //if (Int32.Parse(DateTime.Now.ToString("HH")) >= 14)
                //{
                //    iInventoryDispCnt = iInventoryDispCnt + 1;
                //    if (bInventoryDispStat == true)
                //    {
                //        HappyOrderInventoryAlram();
                //        if (iInventoryDispCnt % (60 * 5) == 0)
                //        {
                //            HappyOrderInventoryAlram_StatChange(false);
                //        }
                //    }
                //    else
                //    {
                //        if (iInventoryDispCnt == 0 || iInventoryDispCnt >= 60 * 25)
                //        {
                //            HappyOrderInventoryAlram();
                //        }
                //    }
                //}

                if ((CmUtil.IntParse(DateTime.Now.ToString("HH")) >= 14) &&
                    ((CmUtil.IntParse(DateTime.Now.ToString("mm")) >= 0 && CmUtil.IntParse(DateTime.Now.ToString("mm")) <= 5) ||
                    (CmUtil.IntParse(DateTime.Now.ToString("mm")) >= 30 && CmUtil.IntParse(DateTime.Now.ToString("mm")) <= 35)))
                {
                    if (bInventoryCancel == false)
                    {
                        HappyOrderInventoryAlram();
                    }
                }
                else
                {
                    bInventoryCancel = false;

                    lb_HPOInventoryAlram.Visible = false;
                    lb_HPOInventoryAlram2.Visible = false;
                    Pnl_HPOInventoryAlram.Visible = false;
                }
                
                //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 end - #16368 
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

        /// <summary>
        /// Date 처리
        /// </summary>
        /// <param name="text"></param>
        private void SetDateTime()
        {
            try
            {
                if (this.lblDateTime.InvokeRequired)
                {
                    SetDatetimeCallback d = new SetDatetimeCallback(SetDateTime);
                    this.Invoke(d);
                }
                else
                {
                    //#20171011 영업일, 시스템일시 위치 변경 start
                    //기존
                    /*
                    this.lblDateTime.Text = m_cPosStatus.Global.DateToCulture(DateTime.Now.ToString("yyyyMMdd")) + " " + DateTime.Now.ToString("HH:mm:ss");
                    // 개점일자 표기
                    lblSaleDate.Text = string.Format("SaleDate : {0}", m_cPosStatus.Base.SaleDate == "" ? m_cPosStatus.Global.DateToCulture("20000101") : m_cPosStatus.Global.DateToCulture(m_cPosStatus.Base.SaleDate));
                    */
                    //변경
                    string WeekDays = WeekDay(DateTime.Now);
                    string WeekDaySaleDate = WeekDay(Convert.ToDateTime(m_cPosStatus.Global.DateToCulture(m_cPosStatus.Base.SaleDate)));
                    this.lblDateTime.Text = string.Format(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0242) + " : {0}" + "({1})",
                                            m_cPosStatus.Base.SaleDate == "" ? m_cPosStatus.Global.DateToCulture("20000101") : m_cPosStatus.Global.DateToCulture(m_cPosStatus.Base.SaleDate), WeekDaySaleDate);
                    lblSaleDate.Text = string.Format(m_cPosStatus.Global.DateToCulture(DateTime.Now.ToString("yyyyMMdd")) + "({0})" + " " + DateTime.Now.ToString("HH:mm:ss"), WeekDays);
                    //#20171011 영업일, 시스템일시 위치 변경 end
                }
            }
            catch (Exception ex)
            {
                UserLog.WriteLogFile(UserCom.ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.ToString());
            }
        }

        private string WeekDay(DateTime dateTime)
        {
            string tempWeekDay = "";

            var dt = dateTime.DayOfWeek;

            switch (dt)
            {
                case DayOfWeek.Monday: //월
                    tempWeekDay = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1063);
                    break;

                case DayOfWeek.Tuesday: //화
                    tempWeekDay = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1064);
                    break;

                case DayOfWeek.Wednesday: //수
                    tempWeekDay = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1065);
                    break;

                case DayOfWeek.Thursday: //목
                    tempWeekDay = MessageManager.GetLabelMessage((POS_MESSAGE.LABEL.MSG_1066));
                    break;

                case DayOfWeek.Friday: //금
                    tempWeekDay = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1067);
                    break;

                case DayOfWeek.Saturday: //토
                    tempWeekDay = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1068);
                    break;

                case DayOfWeek.Sunday: //일
                    tempWeekDay = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1062);
                    break;
            }
            return tempWeekDay;
        } 


        #endregion

        #region 상단 메세지 관련
        /// <summary>
        /// 상단 메세지 설정(연습모드, 긴급메세지)
        /// </summary>
        /// <param name="sType"></param>
        private void GetTopMsgMode(string sType)
        {
            try
            {
                if (sType == "1")
                {
                    EmgNoticeProcess();

                    // 백그라운드 프로그램 적용 확인 메시지
                    POSProgramApplyCheck();
                }
                else
                {
                    //중지
                    lblTopMsgMode.MpStop();
                    lblTopMsgMode.Visible = false;
                }

            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                   System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);

            }
        }

        /// <summary>
        /// 긴급공지 처리 프로세스
        /// </summary>
        private void EmgNoticeProcess()
        {

            DataTable dt = null;

            try
            {

                // 긴급 공지 설정
                if (lblTopMsgMode.MpStatus() == false)
                {
                    //내역 조회
                    dt = (DataTable)m_cPosNoticeCom.GetData(new string[] { PosMst.MST_EMG_NOTE.TABLE_NAME, ItemConst.NOTE_MSG_DIV.ROL, "", "" });

                    if (dt == null || dt.Rows.Count == 0)
                    {
                        //처리 없음!
                    }
                    else
                    {

                        foreach (DataRow dr in dt.Rows)
                        {
                            
                            //변수 담기
                            Cosmos.UI.CsmPosMovePanel.MovePanelInfo cMoveInfo = new Cosmos.UI.CsmPosMovePanel.MovePanelInfo();

                            cMoveInfo.BackColor = Color.Red;
                            cMoveInfo.ForeColor = Color.Yellow;
                            cMoveInfo.MoveKind = "1";   //0:좌->우, 1:우->좌, 4:깜박임
                            cMoveInfo.MoveText = CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_CONTENTS).Replace("\n", "");
                            cMoveInfo.ResvCode = string.Format("{0}^{1}^{2}^{3}", CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_CODE), CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_DIV), CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_TYPE), CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.POS_EXEC_TYPE));

                            lblTopMsgMode.MpAdd(cMoveInfo);

                            if (CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.READ_YN) == "0")
                            {
                                //DB 업데이트
                                UpdateNotice(CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.START_DT), CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_CODE), CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_DIV), PosConst.MST_EMG_NOTE_READ_FLAG.FINSH);
                            }
                            
                        }

                        lblTopMsgMode.MpIntervalMove(5);    //타이머 시간 설정: 최초 디폴트 10

                        //시작
                        lblTopMsgMode.Visible = true;
                        lblTopMsgMode.MpStart();

                    }
                }

                //팝업 공지 체크

                dt = (DataTable)m_cPosNoticeCom.GetData(new string[] { PosMst.MST_EMG_NOTE.TABLE_NAME, ItemConst.NOTE_MSG_DIV.POP, "", "" });
                if (dt == null || dt.Rows.Count == 0)
                {
                    //처리 없음!
                }
                else
                {

                    foreach (DataRow dr in dt.Rows)
                    {
                        string sRet = "";

                        //즉시 적용 체크
                        string sMsgType = CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_TYPE);

                        if (sMsgType == "1")   //1:마스터, 2:프로그램
                        {
                            //프로그램 이면 다운로드 완료 확인!
                            if (CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.DOWN_YN) == "1")    //다운로드 완료 확인
                            {
                                sRet = WinBasic.ShowForm(new string[] { FormManager.FORM_SAL_EMERGENCY_NOTICE, PosConst.MSG_BOX_TYPE.QUESTION, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0682), CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_CONTENTS) });


                                if (sRet == UserCom.RST_OK)
                                {
                                    //2.읽은 DB UPDATE
                                    UpdateNotice(CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.START_DT), CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_CODE), CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_DIV), PosConst.MST_EMG_NOTE_READ_FLAG.FINSH);

                                    // 재기동!
                                    m_cPosStatus.Sale.SysShutDown = PosConst.SYS_SHUTDOWN.PGMRESTART;
                                    PosExitProc();
                                    break;
                                }
                                else
                                {
                                    UpdateNotice(CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.START_DT), CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_CODE), CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_DIV), PosConst.MST_EMG_NOTE_READ_FLAG.SHOW);
                                }
                            }

                        }
                        else
                        {

                            // 경과 시간 체크!
                            if (CmUtil.LongParse(CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.FNSH_HOUR)) >= CmUtil.LongParse(DateTime.Now.ToString("yyyyMMddHHmmss")))
                            {

                                ////마스터면....
                                //if (sMsgType == "1")
                                //{
                                //    sRet = WinBasic.ShowForm(new string[] { FormManager.FORM_SAL_EMERGENCY_NOTICE, PosConst.MSG_BOX_TYPE.QUESTION, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0682), CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_CONTENTS) });
                                //    if (sRet == UserCom.RST_OK)
                                //    {
                                //        //2.읽은 DB UPDATE
                                //        UpdateNotice(CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.START_DT), CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_CODE), CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_DIV), PosConst.MST_EMG_NOTE_READ_FLAG.FINSH);

                                //        // 재기동!
                                //        m_cPosStatus.Sale.SysShutDown = PosConst.SYS_SHUTDOWN.PGMRESTART;
                                //        PosExitProc();
                                //        break;
                                //    }
                                //    else
                                //    {
                                //        UpdateNotice(CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.START_DT), CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_CODE), CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_DIV), PosConst.MST_EMG_NOTE_READ_FLAG.SHOW);
                                //    }
                                //}
                                //else
                                //{
                                    sRet = WinBasic.ShowForm(new string[] { FormManager.FORM_SAL_EMERGENCY_NOTICE, PosConst.MSG_BOX_TYPE.CONFIRM, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0682), CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_CONTENTS) });

                                    //1-2.즉시 적용 않일때
                                    //WinManager.ConfirmMessage(CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_CONTENTS).Replace("\n", ""));
                                    //2.읽은 DB UPDATE
                                    UpdateNotice(CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.START_DT), CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_CODE), CmUtil.GetDataRowStr(dr, PosMst.MST_EMG_NOTE.DATA.MSG_DIV), PosConst.MST_EMG_NOTE_READ_FLAG.FINSH);
                                //}
                            }
                            
                        }
                    }

                }

            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

        /// <summary>
        /// 공지사항 업데이트
        /// </summary>
        /// <param name="sMsgCd"></param>
        /// <param name="sMsgDiv"></param>
        private void UpdateNotice(string sStartDt, string sMsgCd, string sMsgDiv, string sReadFlag)
        {
            try
            {
                string sRet = m_cPosNoticeCom.Execute(new string[] { sStartDt, sMsgCd, sMsgDiv, sReadFlag });
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }



        /// <summary>
        /// 클릭 이벤트
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="sCode"></param>
        private void lblTopMsgMode_MpClickHandler(object sender, string sCode)
        {
            try
            {
                //현업 요청으로 클릭하면 안보이기!
                if (m_cPosStatus.Base.TrainingFlag != "1" && lblTopMsgMode.Visible == true)
                {
                    //연습모드가 아니고
                    lblTopMsgMode.Visible = false;
                    //lblTopMsgMode.MpStop();
                }

            }
            catch (Exception ex)
            {

                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }

        #endregion


        #region 백그라운드 프로그램 적용 확인 메시지
        /// <summary>
        /// 백그라운드 프로그램 적용 확인 메시지
        /// </summary>
        private void POSProgramApplyCheck()
        {
            string sRet = UserCom.RST_ERR;
            try
            {
                // 프로그램 적용을 위한 재기동 여부 체크
                if (m_cBackgroundDown.PGMReBootCheck() == true)
                {
                    sRet = WinBasic.ShowForm(new string[] { FormManager.FORM_SAL_EMERGENCY_NOTICE, PosConst.MSG_BOX_TYPE.QUESTION, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0682), MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0281) });
                }

                if (sRet == UserCom.RST_OK)
                {
                    // 재기동!
                    m_cPosStatus.Sale.SysShutDown = PosConst.SYS_SHUTDOWN.PGMRESTART;
                    PosExitProc();
                }
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }
        #endregion

        #region 결락 조회
        /// <summary>
        /// 결락 조회
        /// </summary>
        /// <returns></returns>
        private bool MissTranCheck()
        {
            bool bRet = false;

            try
            {
                frmMissTranCheck fForm = (frmMissTranCheck)FormManager.GetForm(FormManager.FORM_MISSTRAN_CHECK);
                if (fForm == null)
                {
                    fForm = new frmMissTranCheck();
                    FormManager.AddForm(FormManager.FORM_MISSTRAN_CHECK, fForm);
                }

                fForm.ShowDialog();
            }
            catch (Exception ex)
            {

                UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.ToString());
            }

            return bRet;

        }
        #endregion 


        //#20180905 즉시픽업,즉시배달 제외 start

        #region 기존소스
        //#20180126 해피오더 당일픽업 건 보여주기 start,phj, 20180321
        #region 해피오더 당일 픽업 건수 조회 적용시 주석 해제

        #region 해피오더 당일 픽업 건수 조회
        ///// <summary>
        ///// 해피오더 당일 픽업 건수 조회
        ///// </summary>
        ///// <returns></returns>
        //private int HappyOrderCntChk()
        //{
        //    string sReqData = string.Empty;
        //    string sRespData = string.Empty;
        //    string sReturn = string.Empty;
        //    string m_sHappyOrderURL = string.Empty;
        //
        //    int iOrderCnt = 0;
        //
        //    int iRet = 0;
        //    //grayber@20180306 해피오더 주문가능 상태 추가 start - HashTable 추가
        //    Hashtable htRspData = null;
        //    //grayber@20180306 해피오더 주문가능 상태 추가 end 
        //    try
        //    {
        //        // 승인업체 코드 조회
        //        string sVanCD = PosMstManager.GetMstPayDc(ItemConst.TR_ITEM_ID.ORDER_ITEM, ItemConst.TR_ITEM_ID.ORDER.HAPPYORDER_PAY, PosMst.MST_PAY_DC.DATA.APPR_VEND_CD);
        //        // 승인 URL 조회
        //        m_sHappyOrderURL = PosMstManager.GetMstVan(sVanCD, PosMst.MST_VAN.DATA.IP);
        //
        //        sReqData = string.Format("storeCode={0}&deviceType=POS&orderDate={1}", m_cPosStatus.Base.StoreNo, m_cPosStatus.Base.SaleDate);
        //        //sReqData = string.Format("storeCode={0}&deviceType=POS", "11101");
        //
        //        //#20180605 해피오더 개선 start - 20180618
        //        //기존
        //        /*
        //        //grayber@20180306 해피오더 주문가능 상태 추가 start - 공통사용 함수가 아닌 NetworkCheckOver class 의 함수를 사용를 수정
        //        // 기존
        //        //iRet = this.HttpJsonGET_SendReceive(m_sHappyOrderURL, ItemConst.HAPPYORDER_WORK_TYPE.SELECT_STATUS_COUNT, sReqData, ref sRespData);
        //        // 변경
        //        iRet = this.HttpJsonGET_SendReceive(m_sHappyOrderURL, ItemConst.HAPPYORDER_WORK_TYPE.SELECT_STATUS_COUNT, sReqData, ref sRespData, ref htRspData);
        //        //grayber@20180306 해피오더 주문가능 상태 추가 end
        //        */
        //
        //        //변경
        //        if (m_cPosStatus.Base.BrandCd == PosConst.MST_BRAND_CODE.PC_PB)
        //        {
        //            iRet = this.HttpJsonGET_SendReceive(m_sHappyOrderURL, ItemConst.HAPPYORDER_WORK_TYPE.SELECT_STATUS_COUNT_PB, sReqData, ref sRespData, ref htRspData);
        //        }
        //        else
        //        {
        //            iRet = this.HttpJsonGET_SendReceive(m_sHappyOrderURL, ItemConst.HAPPYORDER_WORK_TYPE.SELECT_STATUS_COUNT, sReqData, ref sRespData, ref htRspData);
        //        }
        //        //#20180605 해피오더 개선 end - 20180618
        //
        //
        //        if (iRet == BaseCom.OK)
        //        {
        //            //grayber@20180306 해피오더 주문가능 상태 추가 start - 함수 HashTable 값 추가
        //            //기존
        //            //sReturn = m_cCheckOverDetail.SelectHappyOrderCountByOrderStatus(JsonConvert.DeserializeObject<Hashtable[]>(sRespData));
        //            //변경
        //            iOrderCnt = this.SelectHappyOrderCountByOrderStatus(JsonConvert.DeserializeObject<Hashtable[]>(sRespData), ref htRspData);
        //            //grayber@20180306 해피오더 주문가능 상태 추가 end
        //        }
        //    }
        //    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 iOrderCnt;
        //}
        #endregion

        #region Http 전송 모듈
        ///// <summary>
        ///// 해피오더 GET방식 Request
        ///// </summary>
        ///// <param name="sUrl">URL</param>
        ///// <param name="sWorkType">메시지 타입</param>
        ///// <param name="sReqData">요청Data</param>
        ///// <param name="sRespJsonData">응답Data(Json)</param>
        ///// <returns></returns>
        /////grayber@20180306 해피오더 주문가능 상태 추가 start - 함수 인자 추가 NetworkCheckOver.HttpJsonGET_SendReceive 함수 HashTable 인자추가
        ///// 기존
        ///// public int HttpJsonGET_SendReceive(string sUrl, string sWorkType, string sReqData, ref string sRespJsonData)
        ///// 변경
        //public int HttpJsonGET_SendReceive(string sUrl, string sWorkType, string sReqData, ref string sRespJsonData, ref Hashtable htRspData)
        ////grayber@20180306 해피오더 주문가능 상태 추가 end
        //{
        //    int iRet = BaseCom.NG;
        //    string sRespString = string.Empty;
        //
        //    try
        //    {
        //        if (sUrl.Trim() == "") return iRet;
        //
        //        HttpWebRequest req = (HttpWebRequest)WebRequest.Create(sUrl + sWorkType + "?" + sReqData);
        //        req.Method = "GET";
        //
        //        using (HttpWebResponse resp = (HttpWebResponse)req.GetResponse())
        //        {
        //            Stream stream = resp.GetResponseStream();
        //            StreamReader streamReader = new StreamReader(stream, Encoding.GetEncoding("UTF-8"));
        //            sRespString = streamReader.ReadToEnd();
        //        }
        //
        //        //건수 조회 응답값 로그 추가
        //        UserLog.WriteLogFile(UserCom.LOG_DEBUG,
        //                            UserCom.WARNING_LEVEL,
        //                            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 (함수명))
        //                            sRespString);
        //
        //        Hashtable temp = JsonConvert.DeserializeObject<Hashtable>(sRespString);
        //
        //        foreach (string key in temp.Keys)
        //        {
        //            string jsonString = temp[key].ToString();
        //            if (key.Equals("status"))
        //            {
        //                Hashtable htHeader = JsonConvert.DeserializeObject<Hashtable>(jsonString);
        //                if (htHeader["status"].ToString().Equals("200"))
        //                {
        //                    iRet = BaseCom.OK;
        //                }
        //            }
        //            //grayber@20180306 해피오더 주문가능 상태 추가 start - deliverySupport 처리 추가
        //
        //            // 20180306 수신 데이터 sample
        //            // http://api.celectory.com/api/ // 리얼
        //            // {"status":{"status":200,"code":"20000","message":"조회 완료","devMessage":"success","moreInfo":null,"orderNum":null},"orderStatusCount":[{"status":"0","count":1,"type":"5"},{"status":"8","count":110,"type":"1"},{"status":"8","count":453,"type":"2"},{"status":"8","count":223,"type":"3"},{"status":"8","count":122,"type":"6"},{"status":"2000","count":2,"type":"5"},{"status":"2008","count":31,"type":"2"},{"status":"2008","count":10,"type":"3"},{"status":"2008","count":46,"type":"6"},{"status":"9007","count":8,"type":"5"},{"status":"9009","count":126,"type":"5"},{"status":"300000","count":42,"type":"1"},{"status":"300000","count":177,"type":"2"},{"status":"300000","count":501,"type":"3"},{"status":"300000","count":279,"type":"5"},{"status":"300000","count":110,"type":"6"}]}
        //            // http://121.254.240.198:8092/api/ // 개발
        //            // {"status":{"status":200,"code":"20000","message":"조회 완료","devMessage":"success","moreInfo":null,"orderNum":null},"orderStatusCount":[{"status":"8","count":1,"type":"3"},{"status":"2008","count":1,"type":"3"},{"status":"9007","count":3,"type":"5"},{"status":"9009","count":12,"type":"5"},{"status":"300000","count":25,"type":"3"},{"status":"300000","count":8,"type":"5"}],"deliverySupport":"Y"}
        //
        //            // 기존
        //            //else
        //            //{
        //            //    sRespJsonData = jsonString;
        //            //}
        //            // 변경
        //            else if (key.Equals("deliverySupport"))
        //            {
        //                if (CmUtil.IsNull(htRspData))
        //                {
        //                    htRspData = new Hashtable();
        //                }
        //                htRspData.Add(key.ToString(), temp[key].ToString());
        //            }
        //            else if (key.Equals("orderStatusCount"))
        //            {
        //                sRespJsonData = jsonString;
        //            }
        //            //grayber@20180306 해피오더 주문가능 상태 추가 end
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        UserLog.WriteLogFile(UserCom.LOG_ERROR,
        //                             System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
        //                             System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
        //                             ex.ToString());
        //    }
        //
        //    return iRet;
        //}
        #endregion

        #region 해피오더 주문 건수 파싱
        ///// <summary>
        ///// 해피오더 주문 건수 파싱
        ///// </summary>
        ///// <param name="sRespData"></param>
        ///// <returns></returns>
        /////grayber@20180306 해피오더 주문가능 상태 추가 start - 함수 인자 추가 SelectHappyOrderCountByOrderStatus HashTable 인자추가
        ///// 기존
        /////public string SelectHappyOrderCountByOrderStatus(Hashtable[] htOrderStatus)
        ///// 변경
        //public int SelectHappyOrderCountByOrderStatus(Hashtable[] htOrderStatus, ref Hashtable htRspData)
        ////grayber@20180306 해피오더 주문가능 상태 추가 end
        //{
        //    // 주문접수-일반
        //    int iOrderRegNormalCnt = 0;
        //    // 주문접수-배달
        //    int iOrderRegDeliveryCnt = 0;
        //    // 주문접수-예약
        //    int iOrderRegReservedCnt = 0;
        //    // 총 주문접수 건수
        //    int iTotOrderRegCnt = 0;
        //    int iProductReadyCnt = 0;
        //    int iPreReservedCnt = 0;
        //    int iPickupWaitCnt = 0;
        //    int iPickupDelayCnt = 0;
        //    int iNoPickupAndDelayCnt = 0;
        //    int iDeliveryRequestCnt = 0;
        //    int iDeliveryRegCnt = 0;
        //    int iDeliveryingCnt = 0;
        //
        //    try
        //    {
        //        foreach (Hashtable htData in htOrderStatus)
        //        {
        //            string sOrderType = htData["type"].ToString();
        //
        //            switch (htData["status"].ToString())
        //            {
        //                case ItemConst.HAPPYORDER_STATUS.ORDER_REG:             // "4" : 주문접수
        //                    // 일반 주문건수 계산
        //                    if (sOrderType == ItemConst.ORDER_TYPE.SHOP_DIRECT ||
        //                       sOrderType == ItemConst.ORDER_TYPE.SHOP_TIME)
        //                    {
        //                        iOrderRegNormalCnt += int.Parse(htData["count"].ToString());
        //                    }
        //                    // 배달 주문건수 계산
        //                    else if (sOrderType == ItemConst.ORDER_TYPE.INNER_DELIVERY ||
        //                            sOrderType == ItemConst.ORDER_TYPE.OUTTER_DELIVERY)
        //                    {
        //                        iOrderRegDeliveryCnt += int.Parse(htData["count"].ToString());
        //                    }
        //                    // 예약 주문건수 계산
        //                    else if (sOrderType == ItemConst.ORDER_TYPE.RESERVED_ORDER ||
        //                            sOrderType == ItemConst.ORDER_TYPE.PRE_RESERVED)
        //                    {
        //                        iOrderRegReservedCnt += int.Parse(htData["count"].ToString());
        //                    }
        //                    break;
        //                case ItemConst.HAPPYORDER_STATUS.PRODUCT_READY:         // "5" : 상품준비
        //                    //#20180905 즉시픽업,즉시배달 제외 start
        //                    if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
        //                    //#20180905 즉시픽업,즉시배달 제외 end
        //                    iProductReadyCnt += int.Parse(htData["count"].ToString());
        //                    break;
        //                case ItemConst.HAPPYORDER_STATUS.PRE_RESERVED:          // "6" : 사전예약
        //                    //#20180905 즉시픽업,즉시배달 제외 start
        //                    if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
        //                    //#20180905 즉시픽업,즉시배달 제외 end
        //                    iPreReservedCnt += int.Parse(htData["count"].ToString());
        //                    break;
        //                case ItemConst.HAPPYORDER_STATUS.PICKUP_WAIT:           // "7" : 픽업대기
        //                    //#20180905 즉시픽업,즉시배달 제외 start
        //                    if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
        //                    //#20180905 즉시픽업,즉시배달 제외 end
        //                    iPickupWaitCnt += int.Parse(htData["count"].ToString());
        //                    break;
        //                case ItemConst.HAPPYORDER_STATUS.PICKUP_DELAY:          // "2000" : 픽업지연
        //                    //#20180905 즉시픽업,즉시배달 제외 start
        //                    if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
        //                    //#20180905 즉시픽업,즉시배달 제외 end
        //                    iPickupDelayCnt += int.Parse(htData["count"].ToString());
        //                    break;
        //                case ItemConst.HAPPYORDER_STATUS.NO_PICKUP_AND_DELAY:   // "2018" : 픽업지연미픽업
        //                    //#20180905 즉시픽업,즉시배달 제외 start
        //                    if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
        //                    //#20180905 즉시픽업,즉시배달 제외 end
        //                    iNoPickupAndDelayCnt += int.Parse(htData["count"].ToString());
        //                    break;
        //                case ItemConst.HAPPYORDER_STATUS.DELIVERY_REQ:          // "9004" : 배달요청
        //                    //#20180905 즉시픽업,즉시배달 제외 start
        //                    if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
        //                    //#20180905 즉시픽업,즉시배달 제외 end
        //                    iDeliveryRequestCnt += int.Parse(htData["count"].ToString());
        //                    break;
        //                case ItemConst.HAPPYORDER_STATUS.DELIVERY_REG:          // "9005" : 배달접수
        //                    //#20180905 즉시픽업,즉시배달 제외 start
        //                    if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
        //                    //#20180905 즉시픽업,즉시배달 제외 end
        //                    iDeliveryRegCnt += int.Parse(htData["count"].ToString());
        //                    break;
        //                case ItemConst.HAPPYORDER_STATUS.DELIVERY_ING:          // "9007" : 배달중
        //                    //#20180905 즉시픽업,즉시배달 제외 start
        //                    if ((sOrderType == ItemConst.ORDER_TYPE.DIRECT_ORDER) || (sOrderType == ItemConst.ORDER_TYPE.RESERV_ORDER)) continue;
        //                    //#20180905 즉시픽업,즉시배달 제외 end
        //                    iDeliveryingCnt += int.Parse(htData["count"].ToString());
        //                    break;
        //            }
        //        }
        //
        //        iTotOrderRegCnt = iOrderRegNormalCnt + iOrderRegDeliveryCnt + iOrderRegReservedCnt +
        //                          iProductReadyCnt + iPreReservedCnt + iPickupWaitCnt + iPickupDelayCnt +
        //                          iNoPickupAndDelayCnt + iDeliveryRequestCnt + iDeliveryRegCnt + iDeliveryingCnt;
        //    }
        //    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 iTotOrderRegCnt;
        //}
        #endregion

        #endregion
        //#20180126 해피오더 당일픽업 건 보여주기 end,phj, 20180321
        #endregion

        //#20180905 즉시픽업,즉시배달 제외 end

        //#20170918 기념일 배송 출력 start
        private void AnniversaryPrint(string param)
        {
            string sRet = UserCom.RST_ERR;
             
            try
            {
                ISaleCompleteUs m_cRecService = (ISaleCompleteUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.SALE_COMPLETE);              
                sRet = m_cRecService.ExecuteAnniversary(param);

                if (sRet != UserCom.RST_OK)
                {
                    UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                        System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", sRet);
                }
                else
                {
                    sRet = UserCom.RST_OK;
                }
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }

        }
        //#20170918 기념일 배송 출력 end

        protected override void WndProc(ref Message m)
        {
            try
            {
                base.WndProc(ref m);


                //#20170918 기념일 배송 출력 start
                switch (m.Msg)
                {
                    case PosConst.WM_COPYDATA:
                        COPYDATASTRUCT cds = (COPYDATASTRUCT)m.GetLParam(typeof(COPYDATASTRUCT));

                        //#20170918 기념일 배송 출력 start, 20180718
                        //'대상 멀티바이트 코드페이지에 유니코드 문자의 매핑이 없습니다. (exception from hresult: 0x80070459)'
                        //기존
                        //AnniversaryPrint(cds.lpData);
                        //변경
                        //COPYDATASTRUCT cds = (COPYDATASTRUCT)Marshal.PtrToStructure(m.LParam, typeof(COPYDATASTRUCT)); //GetLParam(T) 동일                         
                        UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "cds.cbData: " + cds.cbData);

                        if (cds.cbData > 0)
                        {
                            byte[] data = new byte[cds.cbData];
                            Marshal.Copy(cds.lpData, data, 0, cds.cbData);
                            char[] myString = Encoding.ASCII.GetChars(data);
                            string returnText = new string(myString);

                            AnniversaryPrint(returnText);
                        }
                        //#20170918 기념일 배송 출력 end, 20180718
                        break;
                    default:
                        base.WndProc(ref m);
                        break;
                }
                //#20170918 기념일 배송 출력 end

                if (m.Msg == 6 && m.WParam.ToInt32() == 1)          // Trap WM_ACTIVATE when we get active
                {
                    if (Control.FromHandle(m.LParam) == null)
                    {
                        if (FormManager.m_HideFormIndex == 1)      // 판매화면
                        {
                            Form fMainForm = (Form)FormManager.GetForm(FormManager.FORM_POS_MAIN);
                            if (fMainForm != null) fMainForm.Top = 0;

                            Form fTableForm = (Form)FormManager.GetForm(FormManager.FORM_TBL_REG);
                            if (fTableForm != null) fTableForm.Top = 0;

                            Form fSaleForm = (Form)FormManager.GetForm(FormManager.FORM_SAL_MAIN);
                            if (fSaleForm != null)
                            {
                                fSaleForm.WindowState = FormWindowState.Normal;
                            }
                        }
                        else if (FormManager.m_HideFormIndex == 2) // 테이블화면
                        {
                            Form fMainForm = (Form)FormManager.GetForm(FormManager.FORM_POS_MAIN);
                            if (fMainForm != null) fMainForm.Top = 0;

                            Form fTableForm = (Form)FormManager.GetForm(FormManager.FORM_TBL_REG);
                            if (fTableForm != null)
                            {
                                fTableForm.WindowState = FormWindowState.Normal;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }
        private void btnShortCutMenu_Click(object sender, EventArgs e)
        {
            if (sender.Equals(lblMasterAll))
            {
                // 마스터 DB 수신
                string sType = PosConst.MASTER_DOWN_OP.ALL;
                WinBasic.ShowForm(new string[] { FormManager.FORM_PROGRAM_START, sType, PosConst.POS_PERIPHERAL_CHECK.NO_CHECK, "K" });

                // POS 마스터 로딩
                IServiceUs cLoadMstSrv = (IServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.LOAD_MASTER_INFO);
                cLoadMstSrv.Execute(new string[] { });
                
                WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0621));

                if (pnlShortCut.Visible.Equals(true))
                    pnlShortCut.Visible = false;
            }
            else if (sender.Equals(lblMasterUpdate))
            {
                // 마스터 DB 수신
                string sType = PosConst.MASTER_DOWN_OP.CHANGED;
                WinBasic.ShowForm(new string[] { FormManager.FORM_PROGRAM_START, sType, PosConst.POS_PERIPHERAL_CHECK.NO_CHECK, "K" });

                // POS 마스터 로딩
                IServiceUs cLoadMstSrv = (IServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.LOAD_MASTER_INFO);
                cLoadMstSrv.Execute(new string[] { });

                WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0621));
                if (pnlShortCut.Visible.Equals(true))
                    pnlShortCut.Visible = false;
            }
            else
            {
                // 캠페인 마스터 수신
                string sType = PosConst.MASTER_DOWN_OP.ALL_CAMPAIGN;
                WinBasic.ShowForm(new string[] { FormManager.FORM_PROGRAM_START, sType, PosConst.POS_PERIPHERAL_CHECK.NO_CHECK, "K" });

                // POS 마스터 로딩
                IServiceUs cLoadMstSrv = (IServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.LOAD_MASTER_INFO);
                cLoadMstSrv.Execute(new string[] { });

                WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0621));
                if (pnlShortCut.Visible.Equals(true))
                    pnlShortCut.Visible = false;
            }

        }

        //#15058 해피오더 버튼 변경_20180612 start,phj
        #region 해피오더 신규주문 건 수 표시 패널

        private void NewHPOrdDisplay()
        {
            try
            {
                // 해피오더 신규주문(일반주문건수 + 배달주문건수 + 예약주문건수)
                int iNewOrdCnt = int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderTotRegCnt, "0"));
                if (iNewOrdCnt > 99) { iNewOrdCnt = 99; }
                
                if (iNewOrdCnt > 0)
                {
                    if (CmUtil.IntParse(DateTime.Now.ToString("ss")) % 2 == 0)
                    {
                        NewHPOrd_Disp.Text = "";
                        NewHPOrd_Disp2.Text = "";
                    }
                    else
                    {
                        PnlNewHPOrd_Disp.BorderStyle = BorderStyle.None;
                        PnlNewHPOrd_Disp.BackColor = Color.Red;

                        NewHPOrd_Disp.Text = "";
                        NewHPOrd_Disp.Font = new Font(m_cPosStatus.Base.FONT, 15, FontStyle.Bold);
                        NewHPOrd_Disp.TextAlign = ContentAlignment.MiddleCenter;
                        NewHPOrd_Disp.BorderStyle = BorderStyle.None;
                        NewHPOrd_Disp.AutoSize = true;
                        NewHPOrd_Disp.ForeColor = Color.Yellow;
                        NewHPOrd_Disp.BackColor = Color.Red;
                        NewHPOrd_Disp.Text = "해피오더 신규(" + iNewOrdCnt.ToString() + ")";
                        NewHPOrd_Disp.BringToFront();


                        NewHPOrd_Disp2.Text = "";
                        NewHPOrd_Disp2.Font = new Font(m_cPosStatus.Base.FONT, 15, FontStyle.Bold);
                        NewHPOrd_Disp2.TextAlign = ContentAlignment.MiddleCenter;
                        NewHPOrd_Disp2.BorderStyle = BorderStyle.None;
                        NewHPOrd_Disp2.AutoSize = true;
                        NewHPOrd_Disp2.ForeColor = Color.Black;
                        NewHPOrd_Disp2.BackColor = Color.Red;
                        NewHPOrd_Disp2.Text = "[닫기]";
                        NewHPOrd_Disp2.BringToFront();

                        int iWidth = NewHPOrd_Disp.Width + NewHPOrd_Disp2.Width;
                        NewHPOrd_Disp.Left = (PnlNewHPOrd_Disp.Width - iWidth) / 2;
                        NewHPOrd_Disp2.Left = NewHPOrd_Disp.Left + NewHPOrd_Disp.Width;

                        int iFill = 3;
                        NewHPOrd_Disp.Top = ((PnlNewHPOrd_Disp.Height - NewHPOrd_Disp.Height) / 2) - iFill;
                        NewHPOrd_Disp2.Top = NewHPOrd_Disp.Top;
                    }


                    NewHPOrd_Disp.Visible = true;
                    NewHPOrd_Disp2.Visible = true;
                    PnlNewHPOrd_Disp.Visible = true;
                }
                else
                {
                    NewHPOrd_Disp.Visible = false;
                    NewHPOrd_Disp2.Visible = false;
                    PnlNewHPOrd_Disp.Visible = false;
                }
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                            System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
                                            System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
                                            ex.Message);
            }
        }

        private void NewHPOrd_Disp_Click(object sender, EventArgs e)
        {
            try
            {
                iCount = 0;
                bPosMain = false;

                NewHPOrd_Disp.Visible = false;
                NewHPOrd_Disp2.Visible = false;
                PnlNewHPOrd_Disp.Visible = false;

                //#20180615 해피오더 팝업 수정 start
                //기존
                //WinSale.ShowForm(new string[] { FormManager.FORM_SAL_HPORD, "01", "" });
                //변경
                WinSale.ShowForm(new string[] { FormManager.FORM_SAL_HPORD, "01", "C" });
                //#20180615 해피오더 팝업 수정 end
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                            System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
                                            System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
                                            ex.Message);
            }
        }

        private void NewHPOrd_Disp2_Click(object sender, EventArgs e)
        {
            try
            {
                iCount = 0;
                bPosMain = false;

                NewHPOrd_Disp.Visible = false;
                NewHPOrd_Disp2.Visible = false;
                PnlNewHPOrd_Disp.Visible = false;
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                            System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
                                            System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
                                            ex.Message);
            }
        }
        
        #endregion
        //#15058 해피오더 버튼 변경_20180612 end,phj


        //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 start
        #region 해피오더 추가재고 실시간 알람 (10분마다 1분동안 보임)
        private void HappyOrderInventoryAlram()
        {
            if (PosMstManager.GetPosOption(POS_OPTION.OPT518) != "1") return;

            try
            {
                // Y: 미등록 재고존재 / N: 미등록 재고없음 
                if (m_cPosStatus.Sale.HappyOrderInventoryYN == "Y")
                {
                    if (CmUtil.IntParse(DateTime.Now.ToString("ss")) % 2 == 0)
                    {
                        lb_HPOInventoryAlram.Text = "";
                        lb_HPOInventoryAlram2.Text = "";
                    }
                    else
                    {
                        Pnl_HPOInventoryAlram.BorderStyle = BorderStyle.None;
                        Pnl_HPOInventoryAlram.BackColor = Color.Red;

                        lb_HPOInventoryAlram.Text = "";
                        lb_HPOInventoryAlram.Font = new Font(m_cPosStatus.Base.FONT, 15, FontStyle.Bold);
                        lb_HPOInventoryAlram.TextAlign = ContentAlignment.MiddleCenter;
                        lb_HPOInventoryAlram.BorderStyle = BorderStyle.None;
                        lb_HPOInventoryAlram.AutoSize = true;
                        lb_HPOInventoryAlram.ForeColor = Color.Yellow;
                        lb_HPOInventoryAlram.BackColor = Color.Red;
                        lb_HPOInventoryAlram.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1179); //20180821
                        lb_HPOInventoryAlram.BringToFront();


                        lb_HPOInventoryAlram2.Text = "";
                        lb_HPOInventoryAlram2.Font = new Font(m_cPosStatus.Base.FONT, 15, FontStyle.Bold);
                        lb_HPOInventoryAlram2.TextAlign = ContentAlignment.MiddleCenter;
                        lb_HPOInventoryAlram2.BorderStyle = BorderStyle.None;
                        lb_HPOInventoryAlram2.AutoSize = true;
                        lb_HPOInventoryAlram2.ForeColor = Color.Black;
                        lb_HPOInventoryAlram2.BackColor = Color.Red;
                        lb_HPOInventoryAlram2.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1180); //20180821
                        lb_HPOInventoryAlram2.BringToFront();

                        int iWidth = lb_HPOInventoryAlram.Width + lb_HPOInventoryAlram2.Width;
                        lb_HPOInventoryAlram.Left = (Pnl_HPOInventoryAlram.Width - iWidth) / 2;
                        lb_HPOInventoryAlram2.Left = lb_HPOInventoryAlram.Left + lb_HPOInventoryAlram.Width;

                        int iFill = 3;
                        lb_HPOInventoryAlram.Top = ((Pnl_HPOInventoryAlram.Height - lb_HPOInventoryAlram.Height) / 2) - iFill;
                        lb_HPOInventoryAlram2.Top = lb_HPOInventoryAlram.Top;
                    }

                    HappyOrderInventoryAlram_StatChange(true);
                }
                else
                {
                    HappyOrderInventoryAlram_StatChange(false);
                }
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                            System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
                                            System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
                                            ex.Message);
            }
        }
        #endregion
        //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 end

        //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 start
        #region 해피오더 추가재고 실시간 알람 클릭
        private void lb_HPOInventoryAlram_Click(object sender, EventArgs e)
        {
            try
            {
                HappyOrderInventoryAlram_StatChange(false);

                if (sender.GetType().Equals(typeof(Cosmos.UI.CsmLabel)))
                {
                    if (((Cosmos.UI.CsmLabel)sender).Name == "lb_HPOInventoryAlram")
                    {
                        WinBasic.ShowWebPos(PosKey.MENU_KEY.HPO_INVENTORY_ALRAM);
                    }
                }
                else if (sender.GetType().Equals(typeof(System.Windows.Forms.Panel)))
                {
                    if (((System.Windows.Forms.Panel)sender).Name == "Pnl_HPOInventoryAlram")
                    {
                        WinBasic.ShowWebPos(PosKey.MENU_KEY.HPO_INVENTORY_ALRAM);
                    }
                }
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                            System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
                                            System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
                                            ex.Message);
            }
        }
        #endregion 해피오더 추가재고 실시간 알람 클릭
        //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 end

        //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 start
        #region 해피오더 추가재고 실시간 알람 초기화
        private void HappyOrderInventoryAlram_StatChange(bool bStat)
        {
            try
            {
                //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 start - #16368
                //기존
                /*
                if (bStat == true)
                {
                    bInventoryDispStat = true;
                    lb_HPOInventoryAlram.Visible = true;
                    lb_HPOInventoryAlram2.Visible = true;
                    Pnl_HPOInventoryAlram.Visible = true;
                }
                else
                {
                    iInventoryDispCnt = 0; 
                    bInventoryDispStat = false;
                    lb_HPOInventoryAlram.Visible = false;
                    lb_HPOInventoryAlram2.Visible = false;
                    Pnl_HPOInventoryAlram.Visible = false;
                }
                */

                //변경
                if (bStat == true)
                {
                    lb_HPOInventoryAlram.Visible = true;
                    lb_HPOInventoryAlram2.Visible = true;
                    Pnl_HPOInventoryAlram.Visible = true;
                }
                else
                {
                    bInventoryCancel = true;
                    lb_HPOInventoryAlram.Visible = false;
                    lb_HPOInventoryAlram2.Visible = false;
                    Pnl_HPOInventoryAlram.Visible = false;
                }
                //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 end - #16368
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                            System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
                                            System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
                                            "HappyOrderInventoryAlram [" + bStat + "]" + ex.Message);
            }
        }
        #endregion 해피오더 추가재고 실시간 알람 초기화
        //#15884 해피오더 실시간 추가재고 등록메뉴 및 알람기능 개발 end             

    }
}
