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

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

namespace Cosmos.Win
{
    /// <summary>
    /// 
    /// </summary>
    public partial class frmTableMain : Form
    {
        private SManager sManager = new SManager();                                                                     // 이 객체를 통해 업무 Service 호출
        private StateServer StateObject = (StateServer)StateServer.GetInstance();                                       // StateObject : StateServer Object(객체)

        PosStatus m_cPosStatus = null;                                                                                  // 기본정보 참조                                                                           
        TranStatus m_cTrnStatus = null;                                                                                 // 거래정보 참조
        DeviceStatus m_cDevStatus = null;                                                                               // 장치정보 참조 
                                                                                                                        
        private IDataProcessUs m_cDataSrv = null;                                                                       // 거래데이터 합계금액 계산 및 관리
        private ICustDisplayUs m_cCustDisp = null;                                                                      // 고객용 화면 관리
        private ITableUs m_cTableSvr = null;                                                                            // 테이블 서비스 관리
        private IReservationUs m_cReserveUs = null;                                                                     // 예약 관리
        private IDataCommonUs m_cDataCommon = null;                                                                     // POS 공통함수 인터페이스
        private IDataServiceUs m_cPosNoticeCom = null;                                                                  // 공지사항 공통
        private IWatcherBack m_cBackgroundDown = null;
        private ISvr2Tran m_cSvr2Tran = null;                                                                           // 서버시간 동기화                                              
                                                
        private SaleMainProcess m_cSaleMainProc = null;                                                                 // 판매화면 기능 관리

        private int m_nTimeSyncFlag = 0;


        //#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>
        private class FuncInfo
        {
            /// <summary>
            /// 디스플레이 순서 
            /// </summary>
            public int DispSeq { get; private set; }
            /// <summary>
            /// 그룹키 (MainKey)
            /// </summary>
            public string GroupKey { get; private set; }
            /// <summary>
            /// 기능키 (ID)
            /// </summary>
            public string FuncKey { get; private set; }
            /// <summary>
            /// 메뉴명
            /// </summary>
            public string Name { get; private set; }
            /// <summary>
            /// Default BackColor
            /// </summary>
            public Color DefaultBackColor { get; private set; }
            /// <summary>
            /// Default ForeColor
            /// </summary>
            public Color DefaultForeColor { get; private set; }
            /// <summary>
            /// Click BackColor
            /// </summary>
            public Color ClickBackColor { get; private set; }
            /// <summary>
            /// Click ForeColor
            /// </summary>
            public Color ClickForeColor { get; private set; }
            /// <summary>
            /// FontSize
            /// </summary>
            public float FontSize { get; private set; }

            public FuncInfo(string groupKey, string funcKey, string name, int dispSeq
                , string defaultBackColor = "", string defaultForeColor = ""
                , string clickBackColor = "", string clickForeColor = "", float fontSize = 10)
            {
                defaultBackColor = (defaultBackColor.Length != 9) ? "045061074" : defaultBackColor;
                defaultForeColor = (defaultForeColor.Length != 9) ? "255255255" : defaultForeColor;
                clickBackColor = (clickBackColor.Length != 9) ? "115143165" : clickBackColor;
                clickForeColor = (clickForeColor.Length != 9) ? "255255255" : clickForeColor;

                this.GroupKey = groupKey;
                this.FuncKey = funcKey;
                this.DispSeq = dispSeq;
                this.Name = name;
                this.DefaultBackColor = CmUtil.GetColorToString(defaultBackColor);
                this.DefaultForeColor = CmUtil.GetColorToString(defaultForeColor);
                this.ClickBackColor = CmUtil.GetColorToString(clickBackColor);
                this.ClickForeColor = CmUtil.GetColorToString(clickForeColor);
                this.FontSize = fontSize;
            }
        }
        /// <summary>
        /// 기능메뉴정보 목록
        /// </summary>
        private List<FuncInfo> m_funcList;
        /// <summary>
        /// 기능메뉴버튼 목록 
        /// </summary>
        private List<CsmButton> m_btnFuncList;

        /// <summary>
        /// Floor Master Buffer
        /// </summary>
        private Hashtable m_htFloor;
        /// <summary>
        /// Floor Button Constrl List
        /// </summary>
        private List<CsmButton> m_btnFloorList;
        /// <summary>
        /// Current Floor Code
        /// </summary>
        private string m_sCurrentFloorCd;
        /// <summary>
        /// Total Floor Page
        /// </summary>
        private int m_nTotalFloorPage = 0;
        /// <summary>
        /// Current Floor Page
        /// </summary>
        private int m_nCurrentFloorPage = -1;
        /// <summary>
        /// Floor Button Default BackColor 
        /// </summary>
        private Color m_FloorDefaultBackColor = Color.FromArgb(115, 143, 165);  //Color.FromArgb(236, 241, 249);
        /// <summary>
        /// Floor Button Default ForeColor 
        /// </summary>
        private Color m_FloorDefaultForeColor = Color.White;                    //Color.FromArgb(64, 64, 64);
        /// <summary>
        /// Floor Button Select BackColor
        /// </summary>
        private Color m_FloorSelectBackColor = Color.FromArgb(22, 187, 238);    //Color.FromArgb(101, 115, 126);
        /// <summary>
        /// Floor Button Select ForeColor
        /// </summary>
        private Color m_FloorSelectForeColor = Color.White;
        /// <summary>
        /// Max Floor Count
        /// </summary>
        private const int MAX_FLOOR_COUNT = 10;

        /// <summary>
        /// Table Master Buffer
        /// </summary>
        private Hashtable m_htTable;
        /// <summary>
        /// TableButton Control List
        /// </summary>
        private Dictionary<string, CsmButtonTable> m_btnTableList = new Dictionary<string, CsmButtonTable>();
        /// <summary>
        /// Table Color 
        /// </summary>
        private Color m_TblDefaultColor = Color.FromArgb(187, 201, 222);
        private Color m_TblSelectColor = Color.FromArgb(188, 106, 246);
        private Color m_TblClickColor = Color.FromArgb(188, 106, 246);
        private Color m_TblOrderColor = Color.FromArgb(75, 140, 229);
        private Color m_TblGroupColor = Color.FromArgb(50, 201, 128);

        private Color m_TblDeactiveBackColor = Color.FromArgb(236, 241, 249);
        private Color m_TblActiveBackColor = Color.FromArgb(249, 248, 236);


        //#15058 해피오더 버튼 변경_20180612 start,phj

        /// <summary>
        /// 1분 카운트
        /// </summary>
        private int iCount = 0;
        /// <summary>
        /// 해피오더 신규버튼 (true: 활성화, false: 비활성화)
        /// </summary>
        private bool bTableMain = true;

        //#15058 해피오더 버튼 변경_20180612 end,phj

        /// <summary>
        /// Table Group Color List
        /// </summary>
        private List<Color> m_GroupColorList;

        /// <summary>
        /// Current Table Operation Flag
        /// </summary>
        private PosConst.TABLE_OPERATION_FLAG m_enCurrentTableOperationFlag = PosConst.TABLE_OPERATION_FLAG.TABLE_NONE;

        /// <summary>
        /// Table Operation Floor Code
        /// </summary>
        private string m_sOperationFloorCd = "";
        /// <summary>
        /// Table Operation Table No
        /// </summary>
        private string m_sOperationTableNo = "";

        /// <summary>
        /// 테이블 점유구분 기준 설정
        /// </summary>
        private int[] m_nTablePayWaitMaxTime = new int[] { 30, 60, 90, 120 };

        /// <summary>
        /// Table Auto Display Count
        /// </summary>
        private int m_nTableAutoDisplayCount = 0;

        /// <summary>
        /// 매장공지사항 Source
        /// </summary>
        private DataTable dtNoticeData;

        // 상단 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 = "";

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


        /// <summary>
        /// 생성자
        /// </summary>
        public frmTableMain()
        {
            try
            {
                InitializeComponent();

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

                m_cPosStatus = (PosStatus)StateObject.POS;
                m_cTrnStatus = (TranStatus)StateObject.TRAN;
                m_cDevStatus = (DeviceStatus)StateObject.DEVICE;

                m_cDataSrv = (IDataProcessUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_SERVICE);
                m_cCustDisp = (ICustDisplayUs)sManager.InitServiceInstance(ServiceLists.ASV_CUSTDISPLAY.DLL, ServiceLists.ASV_CUSTDISPLAY.CUST_DISPLAY);
                m_cTableSvr = (ITableUs)sManager.InitServiceInstance(ServiceLists.BSV_TABLE.DLL, ServiceLists.BSV_TABLE.TABLE_SERVICE);
                m_cReserveUs = (IReservationUs)sManager.InitServiceInstance(ServiceLists.BSV_TABLE.DLL, ServiceLists.BSV_TABLE.RESERVATION_SERVICE);
                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);

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

                m_cSaleMainProc = new SaleMainProcess();

                #region 층버튼 컨트롤 목록 생성
                m_btnFloorList = new List<CsmButton>();

                m_btnFloorList.Add(this.btnFloor1);
                m_btnFloorList.Add(this.btnFloor2);
                m_btnFloorList.Add(this.btnFloor3);
                m_btnFloorList.Add(this.btnFloor4);
                m_btnFloorList.Add(this.btnFloor5);
                m_btnFloorList.Add(this.btnFloor6);
                m_btnFloorList.Add(this.btnFloor7);
                m_btnFloorList.Add(this.btnFloor8);
                m_btnFloorList.Add(this.btnFloor9);
                m_btnFloorList.Add(this.btnFloor10);
                #endregion

                #region 기능버튼 컨트롤 목록 생성
                m_btnFuncList = new List<CsmButton>();

                m_btnFuncList.Add(this.btnOperation1);
                m_btnFuncList.Add(this.btnOperation2);
                m_btnFuncList.Add(this.btnOperation3);
                m_btnFuncList.Add(this.btnOperation4);
                m_btnFuncList.Add(this.btnOperation5);
                m_btnFuncList.Add(this.btnOperation6);
                m_btnFuncList.Add(this.btnOperation7);
                m_btnFuncList.Add(this.btnOperation8);
                m_btnFuncList.Add(this.btnOperation9);
                m_btnFuncList.Add(this.btnOperation10);
                #endregion

                #region 테이블그룹 컬러목록 정의
                m_GroupColorList = new List<Color>();

                m_GroupColorList.Add(Color.FromArgb(79, 98, 40));
                m_GroupColorList.Add(Color.FromArgb(128, 100, 162));
                m_GroupColorList.Add(Color.FromArgb(247, 150, 70));
                m_GroupColorList.Add(Color.FromArgb(99, 37, 35));
                m_GroupColorList.Add(Color.FromArgb(155, 187, 89));
                m_GroupColorList.Add(Color.FromArgb(218, 150, 148));
                m_GroupColorList.Add(Color.FromArgb(31, 73, 125));
                m_GroupColorList.Add(Color.FromArgb(192, 80, 77));
                m_GroupColorList.Add(Color.FromArgb(148, 138, 84));
                m_GroupColorList.Add(Color.FromArgb(75, 172, 198)); 
                #endregion
                
                // ViewMode 초기화
                btnViewChange.Tag = 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);
            }
        }

        private void Form_Load(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 + "()", "");

                // TableService DBConnection 
                m_cTableSvr.DBConnection();

                // 후불 연습모드 테이블 생성 
                m_cTableSvr.CreateTrainingTable();

                // 화면초기화 
                InitControl();
                SetGridData();

                // Top Information Display (상단 정보 표시)
                DisplayTopInfo();

                // Table Operation Flag
                m_enCurrentTableOperationFlag = PosConst.TABLE_OPERATION_FLAG.TABLE_NONE;

                // Table Operation Floor Code & Table No
                m_sOperationFloorCd = string.Empty;
                m_sOperationTableNo = string.Empty;

                // Table Auto Display Count 초기화
                m_nTableAutoDisplayCount = 0;

                // Guide Message 초기화
                SetGuideMessage(string.Empty);

                // Display Change Amount
                DisplayChangeAmount(false);

                // Floor Master Load 
                if (SelectFloorMaster() == false)
                {
                    OrderCloseProc();
                    return;
                }

                // Set Floor Button
                m_nCurrentFloorPage = -1;
                SetFloorButton(0);

                // Display Table Sale Information
                DisplayTableSaleInfo();

                // 거래 초기화
                m_cDataSrv.InitTranHeader();
                m_cDataSrv.DeleteTranItem();

                if (m_cPosStatus.Base.TrainingFlag == ItemConst.TRAINING_FLAG.TRAINING_YES)
                    GetTopMsgMode("0");
                else
                    GetTopMsgMode("");

                // 타이머 호출
                tmrSaleTimer.Enabled = true;
                tmrDateTime.Enabled = 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);
            }
        }

        private void Form_Closing(object sender, FormClosingEventArgs e)
        {
            try
            {
                tmrSaleTimer.Enabled = false;
                tmrChangeAmount.Enabled = false;
                tmrDateTime.Enabled = false;

                vScrollbar.Attach(null);

                UserLog.WriteLogFile(UserCom.LOG_IOS,
                                     System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                     System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
                                     System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "");
            }
            catch { }
        }

        /// <summary>
        /// 화면컨트롤 초기화 
        /// </summary>
        private void InitControl()
        {
            try
            {
                // Form 초기화
                this.Size = new Size(1024, 768);
                this.Location = new Point(0, 0);
                FormManager.SetFormAllControlFont(this, m_cPosStatus.Base.FONT);

                lblTopMsgMode.Location = new Point(125, 0);
                lblTopMsgMode.csmMoveFont = new Font(m_cPosStatus.Base.FONT, 21);
                lblTopMsgMode.BringToFront();

                // 테이블사용 강제 해제는 메인포스에만..
                //btnTableUseClear.Visible = m_cPosStatus.Base.PosCommunicationType == PosConst.MAIN_POS_DIV.MAIN_POS ? true : false; 

                // Set Image (이미지 설정)
                SetImage();

                // Set Message (메시지 설정)
                SetMessage();

                // 후불판매 메뉴 버튼 초기화 및 로드
                LoadFuncMaster();
                DisplayFuncMenu();

                // 매장공지사항 Panel 초기화
                pnStoreNotice.SetBounds(543, 144, 481, 550);

                // 매장공지사항Hidden Panel 초기화
                pnStoreNoticeShow.SetBounds(992, 144, 32, 550);

                // 매장공지사항 Grid 초기화
                InitializeGrid();

                // 연습 모드 및 긴급 메세지 초기화
                lblTopMsgMode.Visible = false;

                // 프로그램 버전정보 표시
                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;

                pnlSelectView.Location = new Point(16, 702);
                pnlSelectView.Visible = false; 

                vScrollbar.Attach(tbContents);

                // WEB / 기타업무 초기화
                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);

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

                // 상단 온도 정보
                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);

                picTempInfo.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MENUSLIDE_BG);
                pnlTempInfo.Visible = false;

                // 거래유형 화면표시(2017.06.23)
                WinSale.SetTradType(lblSaleStatus, pnlTopBg, ItemConst.TRAN_DIV.NORMAL, ItemConst.TRAN_KIND.NORMAL.SALE);
            }
            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>
        /// <returns></returns>
        private bool LoadFuncMaster()
        {
            try
            {
                // 기능메뉴목록 초기화 
                m_funcList = new List<FuncInfo>();

                // 후불 테이블 기능키 그룹 로딩
                DataTable dtData = m_cDataCommon.SeletFuncKeyGroup(PosKey.MENU_KEY.TABLE_MENU);
                if (dtData == null || dtData.Rows.Count <= 0)
                {
                    return false;
                }
                foreach (DataRow dr in dtData.Rows)
                {
                    FuncInfo func = null;
                    switch (CmUtil.GetDataRowStr(dr, PosMst.MST_FUNC_KEY_GRP.DATA.FUNC_ID))
                    { 
                        case PosKey.MENU_KEY.TABLE_RESERV :
                        case PosKey.MENU_KEY.TABLE_MEMO:
                        case PosKey.MENU_KEY.TABLE_ETC_MENU :
                        case PosKey.MENU_KEY.TABLE_PAYMENT :
                            func = new FuncInfo(string.Empty
                                               , CmUtil.GetDataRowStr(dr, PosMst.MST_FUNC_KEY_GRP.DATA.FUNC_ID)
                                               , CmUtil.GetDataRowStr(dr, PosMst.MST_FUNC_KEY_GRP.DATA.FUNC_NM)
                                               , m_funcList.Count, "255191036", "045061074");
                            break; 
                        case  PosKey.MENU_KEY.TABLE_EXIT:
                            func = new FuncInfo(string.Empty
                                               , CmUtil.GetDataRowStr(dr, PosMst.MST_FUNC_KEY_GRP.DATA.FUNC_ID)
                                               , CmUtil.GetDataRowStr(dr, PosMst.MST_FUNC_KEY_GRP.DATA.FUNC_NM)
                                               , m_funcList.Count, m_cPosStatus.ScnMst.ThemeColor, "255255255");
                            break; 
                        default:
                            func = new FuncInfo(string.Empty
                                               , CmUtil.GetDataRowStr(dr, PosMst.MST_FUNC_KEY_GRP.DATA.FUNC_ID)
                                               , CmUtil.GetDataRowStr(dr, PosMst.MST_FUNC_KEY_GRP.DATA.FUNC_NM)
                                               , m_funcList.Count);
                            break; 
                    }

                    m_funcList.Add(func);
                }

                // 기타메뉴 하위 기능키 (하드코딩)
                //m_funcList.Add(new FuncInfo(PosKey.MENU_KEY.TABLE_ETC_MENU, PosKey.MENU_KEY.TABLE_NO_ORDER_SALE, "판매", 0));
                m_funcList.Add(new FuncInfo(PosKey.MENU_KEY.TABLE_ETC_MENU, PosKey.MENU_KEY.TABLE_NO_ORDER_SALE, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0002), 0));
                m_funcList.Add(new FuncInfo(PosKey.MENU_KEY.TABLE_ETC_MENU, PosKey.MENU_KEY.EXCHANGE, GetFuncName(PosKey.MENU_KEY.EXCHANGE, "환전"), 1));
                m_funcList.Add(new FuncInfo(PosKey.MENU_KEY.TABLE_ETC_MENU, PosKey.MENU_KEY.RETURN_RECEIPT, GetFuncName(PosKey.MENU_KEY.RETURN_RECEIPT, "영수증 반품"), 3));
                m_funcList.Add(new FuncInfo(PosKey.MENU_KEY.TABLE_ETC_MENU, PosKey.MENU_KEY.RECEIPT_REPRINT, GetFuncName(PosKey.MENU_KEY.RECEIPT_REPRINT, "영수증 재발행"), 4));
                if (m_cPosStatus.Base.PosCommunicationType == PosConst.MAIN_POS_DIV.MAIN_POS)
                {
                    if (PosMstManager.GetPosOption(POS_OPTION.OPT315) == "1")
                        m_funcList.Add(new FuncInfo(PosKey.MENU_KEY.TABLE_ETC_MENU, PosKey.MENU_KEY.CASH_APPROVAL_LATER, GetFuncName(PosKey.MENU_KEY.CASH_APPROVAL_LATER, "현금영수증\n추후승인"), 5));
                    if (PosMstManager.GetPosOption(POS_OPTION.OPT316) == "1" || PosMstManager.GetPosOption(POS_OPTION.OPT316) == "2")
                        m_funcList.Add(new FuncInfo(PosKey.MENU_KEY.TABLE_ETC_MENU, PosKey.MENU_KEY.HPP_APPROVAL_LATER, GetFuncName(PosKey.MENU_KEY.HPP_APPROVAL_LATER, "해피포인트\n추후적립"), 6));
                }
                m_funcList.Add(new FuncInfo(PosKey.MENU_KEY.TABLE_ETC_MENU, PosKey.MENU_KEY.ESC_PREVIOUS, GetFuncName(PosKey.MENU_KEY.ESC_PREVIOUS, "이전"), 9, m_cPosStatus.ScnMst.ThemeColor, "255255255"));

                // 테이블 그룹 모드 기능키 (다중선택)
                m_funcList.Add(new FuncInfo(PosKey.MENU_KEY.TABLE_GROUP_MODE, PosKey.MENU_KEY.ENTER, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0009), 8));
                m_funcList.Add(new FuncInfo(PosKey.MENU_KEY.TABLE_GROUP_MODE, PosKey.MENU_KEY.ESC_PREVIOUS, GetFuncName(PosKey.MENU_KEY.ESC_PREVIOUS, "이전"), 9, m_cPosStatus.ScnMst.ThemeColor, "255255255"));

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

        private string GetFuncName(string funcKey, string defalut = "")
        {
            try
            {
                DataTable dtData = m_cDataCommon.SeletFuncKey(funcKey);
                if (dtData == null || dtData.Rows.Count <= 0) return defalut;

                string retValue = CmUtil.GetDataRowStr(dtData.Rows[0], PosMst.MST_FUNC_KEY.DATA.FUNC_NM);
                return string.IsNullOrWhiteSpace(retValue) ? defalut : retValue;
            }
            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 defalut;
            }
        }

        private bool DisplayFuncMenu(string groupKey = "")
        {
            try
            {
                // 메뉴버튼 초기화 
                for (var i = 0; i < m_btnFuncList.Count; i++)
                {
                    m_btnFuncList[i].Tag = string.Empty;
                    m_btnFuncList[i].Text = string.Empty;
                    m_btnFuncList[i].Visible = false;
                }

                // 기능키 설정 
                for (var i = 0; i < m_funcList.Count; i++)
                {
                    if (m_funcList[i].GroupKey != groupKey) continue;

                    int idx = m_funcList[i].DispSeq;

                    // 기능키 정보 Index 
                    m_btnFuncList[idx].Tag = i.ToString();

                    m_btnFuncList[idx].Text = m_funcList[i].Name.Replace("\n", Environment.NewLine).Replace("\\n", Environment.NewLine);
                    m_btnFuncList[idx].BackColor = m_funcList[i].DefaultBackColor;
                    m_btnFuncList[idx].ForeColor = m_funcList[i].DefaultForeColor;
                    m_btnFuncList[idx].Font = new Font(m_cPosStatus.Base.FONT, m_funcList[i].FontSize, FontStyle.Bold);
                    m_btnFuncList[idx].Visible = true;
                }

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

        /// <summary>
        /// Grid 초기화
        /// </summary>
        private void InitializeGrid()
        {
            try
            {
                gridNotice.CsmGridColumnHeadersVisible = true;
                gridNotice.CsmGridColumnHeadersHeight = 38;
                gridNotice.CsmGridColumnHeadersFont = new Font(m_cPosStatus.Base.FONT, (float)10, FontStyle.Bold);

                gridNotice.CsmGridColumnCount = 4;
                gridNotice.CsmGridDefaultRowBackColor = Color.White;
                gridNotice.CsmGridAlternateRowBackColor = Color.FromArgb(251, 253, 255);
                gridNotice.CsmGridHighlightColor = Color.FromArgb(255, 254, 239);
                gridNotice.CsmGridHighlightTextColor = Color.Black;

                gridNotice.CsmGridShowPageRowsCount = 6;
                gridNotice.CsmGridRowsHeight = 34;

                //컬럼별 정렬 기준 설정(0:왼쪽, 1:가운데, 2:오른쪽)
                gridNotice.CsmGridAlignment(new int[] { 1, 0, 1, 1 });
                //컬럼 넓이 지정
                gridNotice.CsmGridSetColumnWidth(new int[] { 40, 380, 0, 0 });
                //특정컬럼 Visible 여부 설정
                gridNotice.CsmGridColumnShowHide(2, false);
                gridNotice.CsmGridColumnShowHide(3, false);

                //각 컬럼별 이름 설정
                gridNotice.CsmGridColumnName(0, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0014));        // No
                gridNotice.CsmGridColumnName(1, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0152));        // Title
                gridNotice.CsmGridColumnName(2, "SEQ");                                                             // Seq
                gridNotice.CsmGridColumnName(3, string.Empty);

                dtNoticeData = new DataTable();
                dtNoticeData.Columns.Add(new DataColumn("NO", typeof(string)));
                dtNoticeData.Columns.Add(new DataColumn("TITLE", typeof(string)));
                dtNoticeData.Columns.Add(new DataColumn("SEQ", typeof(int)));
                dtNoticeData.Columns.Add(new DataColumn("DUMMY", typeof(string)));

                gridNotice.CsmGridDataSource = dtNoticeData;
            }
            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 SetGridData()
        {
            try
            {
                dtNoticeData.Clear();

                DataTable dtData = null;
                string sReturn = (string)m_cTableSvr.SelectStoreNotice(new string[] { PosConst.QueryTagDef.QueryStoreNoticeDef.ALL_SEARCH }, out dtData);
                if (sReturn == UserCom.RST_OK)
                {
                    for (int nLoop = 0; nLoop < dtData.Rows.Count; nLoop++)
                    {
                        DataRow drNewRow = dtNoticeData.NewRow();
                        drNewRow["NO"] = (nLoop + 1).ToString();
                        drNewRow["TITLE"] = CmUtil.GetDataRowStr(dtData.Rows[nLoop], "TITLE");
                        drNewRow["SEQ"] = CmUtil.GetDataRowInt(dtData.Rows[nLoop], "SEQ");
                        drNewRow["DUMMY"] = string.Empty;

                        dtNoticeData.Rows.Add(drNewRow);
                    }
                    gridNotice.CsmGridSelectRow(0);
                    gridNotice.Refresh();
                }
                gridNotice.Focus();
            }
            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 string GetGuideMessage()
        {
            return lblGuideMsg.Text;
        }
        private string GetGuideMessageTag()
        {
            return lblGuideMsg.Tag.ToString();
        }

        /// <summary>
        /// Guide Message 설정
        /// </summary>
        /// <param name="sMessage"></param>
        /// <param name="sTagValue"></param>
        private void SetGuideMessage(string sMessage, string sTagValue = "")
        {
            try
            {
                lblGuideMsg.Text = sMessage;
                lblGuideMsg.Tag = sTagValue;
            }
            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 AppendGuideMessage(string sMessage, string sTagValue = "")
        {
            try
            {
                lblGuideMsg.Text += sMessage;
                lblGuideMsg.Tag += sTagValue;
            }
            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="message"></param>
        /// <param name="tagValue"></param>
        private void SetSelectMessage(string message = "", string tagValue = "")
        {
            try
            {
                lblSelectList.Text = message;
                lblSelectList.Tag = tagValue;
            }
            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 DisplayTableSaleInfo()
        {
            try
            {
                // Select Table Sale Information
                DataTable dtData;
                string sReturn = m_cTableSvr.SelectTableSaleInfo(out dtData);
                if (sReturn != UserCom.RST_OK)
                {
                    return;
                }

                if (dtData.Rows.Count == 1)
                {
                    //lblOrderCount.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0115) + " " + string.Format("{0:D2}", CmUtil.GetDataRowInt(dtData.Rows[0], "ORDER_COUNT"));
                    //lblReservation.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0125) + " " + string.Format("{0:D2}", CmUtil.GetDataRowInt(dtData.Rows[0], "RESERVED_COUNT"));
                    lblOrderCount.Text = string.Format("{0} {1}  {2} {3}  {4} {5}"
                                                     , MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0115), CmUtil.GetDataRowInt(dtData.Rows[0], "ORDER_COUNT")
                                                     , MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0137), CmUtil.GetDataRowInt(dtData.Rows[0], "CUST_CNT")
                                                     , MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0019), m_cPosStatus.Global.NumericTOCurrency(CmUtil.GetDataRowDouble(dtData.Rows[0], "ORDER_AMT")));
                    lblReservation.Text = string.Format("{0} {1}", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0125), CmUtil.GetDataRowInt(dtData.Rows[0], "RESERVED_COUNT"));
                }
                else
                {
                    lblOrderCount.Text = string.Empty;
                    lblReservation.Text = string.Empty;
                }
            }
            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 AlarmReservation()
        {
            try
            {
                string ret = UserCom.RST_ERR;
                DataTable dtData = null;

                ret = m_cReserveUs.SelectData(new string[] { PosConst.TABLE_RESERVE_SEARCH_TYPE.TABLE_RESERVE_ALRAM }, out dtData);
                if (ret != UserCom.RST_OK) return;
                if (dtData == null || dtData.Rows.Count == 0) return;

                DateTime nowTime = DateTime.Now;

                List<string> alramList = new List<string>();
                foreach (DataRow dr in dtData.Rows)
                {
                    if (dr["RESERV_DT"].ToString() != m_cPosStatus.Base.SaleDate) continue;
                    if (dr["ALARM_YN"].ToString() != "Y") continue;
                    if (dr["CONFIRM"].ToString() == "Y") continue;

                    DateTime resTime;
                    bool r = DateTime.TryParseExact(m_cPosStatus.Base.SaleDate + dr["RESERV_TM"], "yyyyMMddHHmm"
                                                  , new System.Globalization.CultureInfo("ko-KR")
                                                  , System.Globalization.DateTimeStyles.None, out resTime);
                    if (r == false) continue;
                    if (nowTime > resTime) continue;

                    double term = 0;
                    switch (dr["ALARM_TM"].ToString())
                    {
                        case "0": term = 30; break;         // 30분전 
                        case "1": term = 60; break;         // 60분전 
                        case "2": term = 90; break;         // 90분전
                        default: term = 120; break;        // 120분전
                    }
                    if (term == 0) continue;

                    DateTime alramTime = resTime.AddMinutes(-1 * term);
                    if (nowTime >= alramTime)
                    {
                        alramList.Add(dr["RESERV_NO"].ToString());
                    }
                }

                if (alramList.Count == 0) return;
                if (WinManager.QuestionMessage(POS_MESSAGE.ERROR.MSG_0566) == false) return;

                DisplayChangeAmount(false);
                ReservationProc();

                m_cReserveUs.UpdateAlarmComfrim(string.Join("|", alramList.ToArray()));
            }
            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>
        /// Order Close Procedure
        /// </summary>
        private void OrderCloseProc()
        {
            try
            {
                // Timer End
                tmrSaleTimer.Enabled = false;

                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);
            }
        }

        private void SetFloorButton(int nTargetFloorPage)
        {
            try
            {
                if (m_htFloor.Count == 0) return;
                if (m_btnFloorList.Count == 0) return;
                if (m_nCurrentFloorPage == nTargetFloorPage) return;
                m_nCurrentFloorPage = nTargetFloorPage;

                // 층버튼 초기화 
                for (var i = 0; i < this.m_btnFloorList.Count; i++)
                {
                    this.m_btnFloorList[i].BackColor = this.m_FloorDefaultBackColor;
                    this.m_btnFloorList[i].ForeColor = this.m_FloorDefaultForeColor;
                    this.m_btnFloorList[i].BorderStyle = BorderStyle.FixedSingle;

                    this.m_btnFloorList[i].Text = string.Empty;
                    this.m_btnFloorList[i].Tag = string.Empty;
                    this.m_btnFloorList[i].Enabled = false;
                }

                int strIdx = nTargetFloorPage * MAX_FLOOR_COUNT;
                int endIdx = strIdx + MAX_FLOOR_COUNT;
                int btnIdx = 0;
                for (var i = strIdx; i < endIdx; i++)
                {
                    if (i >= this.m_htFloor.Count) break;

                    Column.MST_FLOOR.FLOOR_DATA cFloor = (Column.MST_FLOOR.FLOOR_DATA)m_htFloor[i];

                    this.m_btnFloorList[btnIdx].Text = cFloor.FLOOR_NM;
                    this.m_btnFloorList[btnIdx].Tag = cFloor.FLOOR_CD;
                    this.m_btnFloorList[btnIdx].Enabled = true;

                    btnIdx++;
                }

                // Floor Button Select
                SelectFloorButton(this.m_btnFloorList[0].Tag.ToString(), this.m_btnFloorList[0].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 SelectFloorButton(string sFloorCD, string sFloorNM)
        {
            try
            {
                for (var i = 0; i < this.m_btnFloorList.Count; i++)
                {
                    if (sFloorCD == this.m_btnFloorList[i].Tag.ToString())
                    {
                        this.m_btnFloorList[i].BackColor = this.m_FloorSelectBackColor;
                        this.m_btnFloorList[i].ForeColor = this.m_FloorSelectForeColor;
                        this.m_btnFloorList[i].BorderStyle = BorderStyle.FixedSingle;
                    }
                    else
                    {
                        this.m_btnFloorList[i].BackColor = this.m_FloorDefaultBackColor;
                        this.m_btnFloorList[i].ForeColor = this.m_FloorDefaultForeColor;
                        this.m_btnFloorList[i].BorderStyle = BorderStyle.FixedSingle;
                    }
                }

                lblFloorInfo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0175) + " : " + sFloorNM;
                SelectTableMaster(sFloorCD);
            }
            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>
        /// Set Image (이미지 설정)
        /// </summary>
        private void SetImage()
        {
            try
            {
                //this.picTopBg.BackgroundImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MAIN_TOP_BG);
                //this.picTopBg.Location = new Point(0, 0);
                //this.picTopBg.Size = new Size(1024, 50);
                
                this.pnlTopBg.Location = new Point(0, 0);
                this.pnlTopBg.Size = new Size(1024, 50);
                
                this.picFooterBg.BackgroundImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.MAIN_FOOTER_BG);
                this.picFooterBg.Location = new Point(0, 747);
                this.picFooterBg.Size = new Size(1024, 22);

                this.btnViewChange.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BUTTON_CHG_VIEW);
                this.btnViewChange.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BUTTON_CHG_VIEW_CLICK);

                this.picWeb.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.WEB_ICON);
                this.picWeb.Tag = "ON";
                this.lblWeb.Tag = "0";
                this.pnlChangeAmount.BackgroundImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.CHANGE_POPUP);
                this.pnlChangeAmount.BringToFront();

                this.pnStoreNotice.Visible = false;
                this.pnStoreNoticeShow.Visible = true;

                btnGridUp.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_210X48_UP1_BASIC);
                btnGridUp.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_210X48_UP1_PRESS);

                btnGridDn.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_210X48_DOWN1_BASIC);
                btnGridDn.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_210X48_DOWN1_PRESS);

                if (m_cPosStatus.ScnMst.ThemeColor.Trim().Length == 9)
                    btnStoreNoticeDel.BackColor = CmUtil.GetColorToString(m_cPosStatus.ScnMst.ThemeColor);

                pnlTable.Visible = true;

                TablePanelControlClear();
            }
            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 SetMessage()
        {
            try
            {
                lblFloorInfo.Text = string.Empty;

                this.btnFloor1.Text = string.Empty;
                this.btnFloor2.Text = string.Empty;
                this.btnFloorPre.Text = "◀";
                this.btnFloorNext.Text = "▶";

                this.btnViewChange.Text = string.Empty;

                this.btnKeyHide.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0153);
                this.btnKeyShow.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0499);

                this.btnStoreNoticeOk.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0126);
                this.btnStoreNoticeDel.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0021);

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

                //#Rhee, 20180201 잠금해제 메시지 번역 누락 추가 Start
                this.btnTableUseClear.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1086);
                //#Rhee, 20180201 잠금해제 메시지 번역 누락 추가 End

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

            }
            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>
        /// Top Information Display (상단 정보 표시)
        /// </summary>
        private void DisplayTopInfo()
        {
            try
            {
                // 거래유형 => 거래종별 변경 안함(2017.06.23)
                WinSale.SetTradType(lblSaleStatus, pnlTopBg, "", "");

                // 점포명
                lblStoreNm.Text = CmUtil.GetDataRowStr(PosMstManager.GetMstStore(), PosMst.MST_STORE.DATA.STORNM);

                // POS No
                lblPosNo.Text = "POS " + m_cPosStatus.Base.PosNo;

                // Tran No
                lblTranNo.Text = m_cPosStatus.Base.RegNo + "-" + m_cPosStatus.Base.TradeNo;

                // Cashier No
                lblCashier.Text = m_cPosStatus.Base.CashierName;

                // 기타
                lblEtc.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0038);

                // Web
                lblWeb.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0039);

                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);

                lblAnniv.Text = "";
                lblAnniv.Tag = "";

                TopMenuLocation();
            }
            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 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
                PnlNewHPOrd_Disp.Visible = false;
                NewHPOrd_Disp2.Visible = false;
                NewHPOrd_Disp.Visible = false;
                //#15058 해피오더 버튼 변경_20180612 end,phj

                //해피오더 
                if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT035), "0") == "0")
                {
                    lblIFStatus1.Visible = false;

                    //#15058 해피오더 버튼 변경_20180612 start,phj
                    bTableMain = 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
                    if (PosMstManager.GetPosOption(POS_OPTION.OPT035) == "1")
                    {
                        //#20180605 해피오더 개선 start - 20180618
                        //기존
                        /*
                        PnlNewHPOrd_Disp.Size = new Size(260, 21);
                        PnlNewHPOrd_Disp.Width = lblIFStatus1.Width;
                        PnlNewHPOrd_Disp.Height = 50; //lblIFStatus1.Height;
                        PnlNewHPOrd_Disp.Top = 0; //lblIFStatus1.Top;
                        PnlNewHPOrd_Disp.Left = lblIFStatus1.Left;
                        PnlNewHPOrd_Disp.Location = lblIFStatus1.Location; // new Point(iBasciLocation, 25); 
                        PnlNewHPOrd_Disp.Visible = false;
                        */

                        //변경
                        PnlNewHPOrd_Disp.Size = new Size(260, 21);
                        PnlNewHPOrd_Disp.Width = lblIFStatus1.Width;
                        PnlNewHPOrd_Disp.Left = lblIFStatus1.Left;
                        PnlNewHPOrd_Disp.Top = 0;
                        PnlNewHPOrd_Disp.Height = 50;

                        bTableMain = true;
                        //#20180605 해피오더 개선 start - 20180618
                    }
                    //#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")
                {
                    lblOwnerPart.Visible = true;
                    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.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);
            }
        }

        /// <summary>
        /// Table Panel Control Clear
        /// </summary>
        private void TablePanelControlClear()
        {
            try
            {
                this.pnlTable.Controls.Clear();
                this.m_btnTableList.Clear();
            }
            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>
        /// Table Button Click Event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="tableKey"></param>
        private void TableButtonClickEvent(object sender, string tableKey)
        {
            try
            {
                // Display Change Amount
                DisplayChangeAmount(false);

                string floorCd = ((Column.MST_TABLE.TABLE_DATA)m_htTable[CmUtil.IntParse(tableKey)]).FLOOR_CD;
                string tableNo = ((Column.MST_TABLE.TABLE_DATA)m_htTable[CmUtil.IntParse(tableKey)]).TABLE_NO;

                var logMsg = string.Format("TABLE SELECTED ==> Floor:{0}, Table:{1}, TRAING TYPE:{2}", floorCd, tableNo, m_cPosStatus.Base.TrainingFlag);
                UserLog.WriteLogFile(UserCom.LOG_IOS,
                                    System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." +
                                    System.Reflection.MethodBase.GetCurrentMethod().Name + "()",
                                    logMsg);

                Column.MST_TABLE.TABLE_DATA cTable = new Column.MST_TABLE.TABLE_DATA();
                if (SelectFloorTable(new string[] { floorCd, tableNo }, ref cTable) == false) return;

                // Table Operation Procedure
                switch (m_enCurrentTableOperationFlag)
                {
                    case PosConst.TABLE_OPERATION_FLAG.TABLE_ADD:                                                       // 합석
                        TableAddProc(sender, cTable);
                        break;
                    case PosConst.TABLE_OPERATION_FLAG.TABLE_MOVE:                                                      // 이동
                        TableMoveProc(sender, cTable);
                        break;
                    case PosConst.TABLE_OPERATION_FLAG.TABLE_ITEM_MOVE:                                                 // 메뉴이동
                        TableItemMoveProc(sender, cTable);
                        break;
                    case PosConst.TABLE_OPERATION_FLAG.TABLE_MEMO:                                                      // 테이블메모
                        TableMemoProc(sender, cTable);
                        break;
                    case PosConst.TABLE_OPERATION_FLAG.TABLE_NOT_USE:                                                   // 테이블사용 강제 해제 처리  
                        TableUseClearProc(sender, cTable);
                        break;
                    case PosConst.TABLE_OPERATION_FLAG.TABLE_GROUP:                                                     // 테이블 그룹
                        TableGroupSelect(sender, cTable);
                        break;
                    case PosConst.TABLE_OPERATION_FLAG.TABLE_GROUP_CLEAR:                                               // 테이블 그룹 해제 
                        TableGroupSelectClear(cTable);
                        break;
                    case PosConst.TABLE_OPERATION_FLAG.TABLE_PAYMENT:                                                   // 테이블 결제 
                        TablePaymentProc(cTable);
                        break;
                    case PosConst.TABLE_OPERATION_FLAG.TABLE_COMPLETE_PAYMENT:                                          // 테이블 결제 완료 
                        break;
                    case PosConst.TABLE_OPERATION_FLAG.TABLE_NO_ORDER_SALE:                                             // 테이블 판매모드 
                        break;
                    default:                                                                                            // 테이블 주문
                        TableOrderProc(cTable);
                        break;
                }

                // Select Table
                if (m_enCurrentTableOperationFlag != PosConst.TABLE_OPERATION_FLAG.TABLE_GROUP)
                {
                    SelectTableMaster(m_sCurrentFloorCd);
                }
            }
            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="cTable">선택테이블정보</param>
        private void TableOrderProc(Column.MST_TABLE.TABLE_DATA cTable)
        {
            try
            {
                // 빈테이블 영업일확인 
                if (cTable.ORDER_AMT == 0)
                {
                    if (CheckSaleDate() == false) return; 
                }

                // Timer Kill
                tmrSaleTimer.Enabled = false;
                tmrSaleTimer.Stop();

                var sFloorCd = cTable.FLOOR_CD;
                var sTableNo = cTable.TABLE_NO;
                var sOrgFloorCd = cTable.FLOOR_CD;
                var sOrgTableNo = cTable.TABLE_NO;

                // Table Use Check
                if (IsTableUsed(sFloorCd, sTableNo) == true) return;
                // Update Table Used
                if (UpdateTableUsed(sFloorCd, sTableNo, PosConst.TABLE_USE_FLAG.YES_USE) != 0) return;

                // 거래 초기화
                m_cDataSrv.TranComplete();
                m_cTrnStatus.Head.OrderFlag = PosConst.ORDER_TYPE.NORMAL;

                // 층 및 테이블 정보 설정
                m_cTrnStatus.Head.FloorCd = m_cPosStatus.Sale.SelectFloorCd = sFloorCd;
                m_cTrnStatus.Head.TableNo = m_cPosStatus.Sale.SelectTableNo = sTableNo;
                m_cTrnStatus.Head.FloorNm = m_cPosStatus.Sale.SelectFloorNm = GetFloorName(m_cTrnStatus.Head.FloorCd);
                m_cTrnStatus.Head.TableNm = m_cPosStatus.Sale.SelectTableNm = GetTableName(m_cTrnStatus.Head.FloorCd, m_cTrnStatus.Head.TableNo);
                m_cPosStatus.Sale.TableInfo = string.Empty;
                m_cPosStatus.Sale.EtcOperateMode = PosConst.ETC_OPERATION_MODE.NORMAL;

                //#16569 파스쿠찌 드라이브 스루 기능 개발 요청 start
                //DMBIF 사용, PAS DT 사용, 후불, 정상매출만 처리
                if (m_cPosStatus.Base.DmbIf == "1" &&
                    PosMstManager.GetPosOption(POS_OPTION.OPT554) == "1" &&
                    m_cPosStatus.Base.PosType == PosConst.POS_TYPE.DEFERRED_PAYMENT &&
                    m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.NORMAL &&
                    m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.NORMAL.SALE &&
                    m_cPosStatus.Sale.EtcOperateMode == PosConst.ETC_OPERATION_MODE.NORMAL)
                {
                    // 디지털메뉴보드 I/F
                    IDataServiceUs cDigitalMenuBoard = (IDataServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_BASIC.DLL, ServiceLists.BSV_BASIC.DMB_IF);

                    // 판매완료 
                    cDigitalMenuBoard.Execute(new string[] { ItemConst.DT_IRT_ID.SALE_BEGIN });

                }
                //#16569 파스쿠찌 드라이브 스루 기능 개발 요청 end

                // Order Form Show
                WinSale.ShowForm(new string[] { FormManager.FORM_SAL_MAIN, PosConst.SAL_MAIN_FORM_CALLER_TYPE.TABLE_SVC });
                this.Top = 0;

                // Update Table Not Used
                UpdateTableUsed(sFloorCd, sTableNo, PosConst.TABLE_USE_FLAG.NO_USE);
            }
            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
            {
                // Display Chagne Amount
                DisplayChangeAmount(true);
                DisplayTableSaleInfo();

                // 판매부가정보 초기화 
                m_cPosStatus.Sale.TableInfo = string.Empty;
                m_cPosStatus.Sale.EtcOperateMode = PosConst.ETC_OPERATION_MODE.NORMAL;
                m_cPosStatus.Sale.SelectFloorCd = string.Empty;
                m_cPosStatus.Sale.SelectTableNo = string.Empty;
                m_cPosStatus.Sale.SelectFloorNm = string.Empty;
                m_cPosStatus.Sale.SelectTableNm = string.Empty;

                // Table Operation Clear
                TableOperationProc(null, PosConst.TABLE_OPERATION_FLAG.TABLE_NONE);
                SetGuideMessage(string.Empty);
                
                // Timer Start
                tmrSaleTimer.Enabled = true;
                tmrSaleTimer.Start();
            }
        }

        private void TableNoOrderSaleProc()
        {
            try
            {
                // 영업일확인 
                if (CheckSaleDate() == false) return; 

                // Timer Kill
                tmrSaleTimer.Enabled = false;
                tmrSaleTimer.Stop();

                // 거래 초기화
                m_cDataSrv.TranComplete();
                m_cTrnStatus.Head.OrderFlag = PosConst.ORDER_TYPE.NORMAL;

                // 층 및 테이블 정보 설정
                m_cTrnStatus.Head.FloorCd = string.Empty;
                m_cTrnStatus.Head.TableNo = string.Empty;
                m_cTrnStatus.Head.FloorNm = string.Empty;
                m_cTrnStatus.Head.TableNm = string.Empty;
                m_cPosStatus.Sale.TableInfo = string.Empty;
                m_cPosStatus.Sale.EtcOperateMode = PosConst.ETC_OPERATION_MODE.NO_ORDER_SALE;

                // Order Form Show
                WinSale.ShowForm(new string[] { FormManager.FORM_SAL_MAIN, PosConst.SAL_MAIN_FORM_CALLER_TYPE.TABLE_SVC });
                this.Top = 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
            {
                // Display Chagne Amount
                DisplayChangeAmount(true);

                // 판매부가정보 초기화 
                m_cPosStatus.Sale.TableInfo = string.Empty;
                m_cPosStatus.Sale.EtcOperateMode = PosConst.ETC_OPERATION_MODE.NORMAL;
                m_cPosStatus.Sale.SelectFloorCd = string.Empty;
                m_cPosStatus.Sale.SelectTableNo = string.Empty;
                m_cPosStatus.Sale.SelectFloorNm = string.Empty;
                m_cPosStatus.Sale.SelectTableNm = string.Empty;

                // Table Operation Clear
                TableOperationProc(null, PosConst.TABLE_OPERATION_FLAG.TABLE_NONE);
                SetGuideMessage(string.Empty);

                // Timer Start
                tmrSaleTimer.Enabled = true;
                tmrSaleTimer.Start();
            }
        }

        /// <summary>
        /// 테이블 결제 처리 
        /// </summary>
        /// <param name="cTable">선택테이블정보</param>
        private void TablePaymentProc(Column.MST_TABLE.TABLE_DATA cTable)
        {
            try
            {
                // Timer Kill
                tmrSaleTimer.Enabled = false;
                tmrSaleTimer.Stop();

                bool groupCheck = false;
                string msg = string.Empty;

                string sFloorCd = cTable.FLOOR_CD;
                string sTableNo = cTable.TABLE_NO;

                if (cTable.ORDER_AMT == 0)
                {
                    WinManager.ErrorMessage(string.Format(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0291), "0"));
                    return;
                }

                if (cTable.OP_FLAG == PosConst.TABLE_OP_FLAG.OP_GROUP)
                {
                    groupCheck = WinManager.QuestionMessage(POS_MESSAGE.ERROR.MSG_0429);
                    if (groupCheck)
                    {
                        sFloorCd = cTable.OP_FLOOR_CD;
                        sTableNo = cTable.OP_TABLE_NO;
                    }
                }

                // 테이블 사용여부 확인
                if (IsTableUsed(sFloorCd, sTableNo, groupCheck) == true) return;
                if (UpdateTableUsed(sFloorCd, sTableNo, PosConst.TABLE_USE_FLAG.YES_USE, groupCheck) != 0) return;

                // 거래 초기화
                m_cDataSrv.TranComplete();
                m_cTrnStatus.Head.OrderFlag = PosConst.ORDER_TYPE.NORMAL;

                // 층 및 테이블 정보 설정
                m_cTrnStatus.Head.FloorCd = m_cPosStatus.Sale.SelectFloorCd = groupCheck ? cTable.OP_FLOOR_CD : sFloorCd;
                m_cTrnStatus.Head.TableNo = m_cPosStatus.Sale.SelectTableNo = groupCheck ? cTable.OP_TABLE_NO : sTableNo;
                m_cTrnStatus.Head.FloorNm = m_cPosStatus.Sale.SelectFloorNm = GetFloorName(m_cTrnStatus.Head.FloorCd);
                m_cTrnStatus.Head.TableNm = m_cPosStatus.Sale.SelectTableNm = GetTableName(m_cTrnStatus.Head.FloorCd, m_cTrnStatus.Head.TableNo);
                m_cPosStatus.Sale.TableInfo = string.Empty;
                m_cPosStatus.Sale.EtcOperateMode = groupCheck ? PosConst.ETC_OPERATION_MODE.TABLE_GROUP_PAY
                                                              : PosConst.ETC_OPERATION_MODE.NORMAL;

                //#16569 파스쿠찌 드라이브 스루 기능 개발 요청 start
                //DMBIF 사용, PAS DT 사용, 후불, 정상매출만 처리
                if (m_cPosStatus.Base.DmbIf == "1" &&
                    PosMstManager.GetPosOption(POS_OPTION.OPT554) == "1" &&
                    m_cPosStatus.Base.PosType == PosConst.POS_TYPE.DEFERRED_PAYMENT &&
                    m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.NORMAL &&
                    m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.NORMAL.SALE &&
                    m_cPosStatus.Sale.EtcOperateMode == PosConst.ETC_OPERATION_MODE.NORMAL)
                {
                    // 디지털메뉴보드 I/F
                    IDataServiceUs cDigitalMenuBoard = (IDataServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_BASIC.DLL, ServiceLists.BSV_BASIC.DMB_IF);

                    // 판매완료 
                    cDigitalMenuBoard.Execute(new string[] { ItemConst.DT_IRT_ID.SALE_BEGIN });

                }
                //#16569 파스쿠찌 드라이브 스루 기능 개발 요청 end

                // Order Form Show
                WinSale.ShowForm(new string[] { FormManager.FORM_SAL_MAIN, PosConst.SAL_MAIN_FORM_CALLER_TYPE.TABLE_SVC });
                this.Top = 0;

                // Update Table Not Used
                UpdateTableUsed(sFloorCd, sTableNo, PosConst.TABLE_USE_FLAG.NO_USE, groupCheck);
            }
            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
            {
                // Display Chagne Amount
                DisplayChangeAmount(true);

                // 판매부가정보 초기화 
                m_cPosStatus.Sale.TableInfo = string.Empty;
                m_cPosStatus.Sale.EtcOperateMode = PosConst.ETC_OPERATION_MODE.NORMAL;
                m_cPosStatus.Sale.SelectFloorCd = string.Empty;
                m_cPosStatus.Sale.SelectTableNo = string.Empty;
                m_cPosStatus.Sale.SelectFloorNm = string.Empty;
                m_cPosStatus.Sale.SelectTableNm = string.Empty;

                // Table Operation Clear
                TableOperationProc(null, PosConst.TABLE_OPERATION_FLAG.TABLE_NONE);
                SetGuideMessage(string.Empty);

                // Timer Start
                tmrSaleTimer.Enabled = true;
                tmrSaleTimer.Start();
            }
        }

        /// <summary>
        /// 테이블 그룹 (다중선택)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="cTable"></param>
        private void TableGroupSelect(object sender, Column.MST_TABLE.TABLE_DATA cTable)
        {
            try
            {
                // 사용 중 테이블 확인
                if (cTable.USE_FLAG == PosConst.TABLE_USE_FLAG.YES_USE)
                {
                    WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0422);
                    return;
                }
                // 그룹설정 테이블 확인
                if (cTable.OP_FLAG == PosConst.TABLE_OP_FLAG.OP_GROUP)
                {
                    WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0423);
                    return; 
                }

                string sFloorCd = cTable.FLOOR_CD;
                string sTableNo = cTable.TABLE_NO;
                string sFloorNm = this.GetFloorName(sFloorCd);

                string selTbl = string.Format("{0}-{1},", sFloorNm, sTableNo);
                string selTag = string.Format("{0}-{1},", sFloorCd, sTableNo);

                string selectedTbl = lblSelectList.Text.Trim();
                string selectedTag = lblSelectList.Tag.ToString().Trim();

                // 이미 선택된 테이블 확인
                int idx = selectedTbl.IndexOf(selTbl);
                if (idx >= 0)
                {
                    // 이미 선택된 테이블이면, 선택취소
                    selectedTbl = selectedTbl.Replace(selTbl, "");
                    selectedTag = selectedTag.Replace(selTag, "");

                    // 버튼선택효과 취소
                    ((CsmButtonTable)sender).DefaultColor = this.m_TblDefaultColor;
                    ((CsmButtonTable)sender).Update();
                }
                else
                {
                    // 선택 테이블 추가 
                    selectedTbl += selTbl;
                    selectedTag += selTag; 

                    // 버튼선택효과
                    ((CsmButtonTable)sender).DefaultColor = this.m_TblSelectColor;
                    ((CsmButtonTable)sender).Update();
                }
                SetSelectMessage(selectedTbl, selectedTag);
                
            }
            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="cTable"></param>
        private void TableGroupSelectClear(Column.MST_TABLE.TABLE_DATA cTable)
        {
            try
            {
                // Table Group Check
                if (cTable.OP_FLAG != PosConst.TABLE_OP_FLAG.OP_GROUP)
                {
                    WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0428);
                    return;
                }

                string floorCd = cTable.FLOOR_CD;
                string tableNo = cTable.TABLE_NO;
                string groupFloorCd = cTable.OP_FLOOR_CD;
                string groupTableNo = cTable.OP_TABLE_NO;
                string floorNm = this.GetFloorName(floorCd);

                // Guide Message 백업
                string oldGuideMessage = GetGuideMessage();
                string oldGuideMessageTag = lblGuideMsg.Tag.ToString();

                // Guide Message 출력
                string guideMessage = string.Format("{0}-{1}", floorNm, tableNo);
                string guideMessageTag = string.Format("{0}-{1}", floorCd, tableNo);
                this.SetGuideMessage(guideMessage, guideMessageTag);

                // Table Group Clear Confirm
                if (WinManager.QuestionMessage(POS_MESSAGE.ERROR.MSG_0426) != true)
                {
                    SetGuideMessage(oldGuideMessage, oldGuideMessageTag);
                    return;
                }

                string ret = m_cTableSvr.UpdateTableGroupClear(groupFloorCd, groupTableNo);
                if (ret != UserCom.RST_OK)
                {
                    WinManager.ConfirmMessage(ret);
                    return;
                }

                TableOperationProc(null, PosConst.TABLE_OPERATION_FLAG.TABLE_NONE);
            }
            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="command"></param>
        private bool TableGroupComplete(string command)
        {
            try
            {
                // Talbe Group Complete
                if (m_enCurrentTableOperationFlag == PosConst.TABLE_OPERATION_FLAG.TABLE_GROUP && command == PosKey.MENU_KEY.ENTER)
                {
                    string selectedTables = lblSelectList.Tag.ToString().Trim();
                    if (selectedTables.Substring(selectedTables.Length - 1, 1) == ",")
                    {
                        selectedTables = selectedTables.Substring(0, selectedTables.Length - 1);
                    }
                    string ret = m_cTableSvr.UpdateTableGroup(selectedTables);
                    if (ret != UserCom.RST_OK)
                    {
                        WinManager.ConfirmMessage(ret);
                        return false;
                    }
                }

                // Talbe Group mode Clear
                m_sOperationFloorCd = string.Empty;
                m_sOperationTableNo = string.Empty;
                
                SetGuideMessage(string.Empty, string.Empty);
                SetSelectMessage(string.Empty, string.Empty);
                lblSelectTitle.Text = string.Empty;
                pnlSelectView.Visible = false;

                TableOperationProc(null, PosConst.TABLE_OPERATION_FLAG.TABLE_GROUP);
                SelectTableMaster(m_sCurrentFloorCd);

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

        /// <summary>
        /// 테이블 합석
        /// </summary>
        /// <param name="sender">선택테이블버튼</param>
        /// <param name="cTable">선택테이블정보</param>
        private void TableAddProc(object sender, Column.MST_TABLE.TABLE_DATA cTable)
        {
            string sRet = UserCom.RST_ERR;
            string sGuideMessage = string.Empty;
            string sGuideMessageTag = string.Empty;
            string sOldGuideMessage = string.Empty;
            string sOldGuideMessageTag = string.Empty;

            try
            {
                string sFloorCd = cTable.FLOOR_CD;
                string sTableNo = cTable.TABLE_NO;
                string sFloorNm = this.GetFloorName(sFloorCd);

                // Floor & Table Check
                if (m_sOperationFloorCd == sFloorCd && m_sOperationTableNo == sTableNo)
                {
                    WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0100);
                    return;
                }
                // Table Use Check
                if (IsTableUsed(sFloorCd, sTableNo, false, false) == true)
                {
                    WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0102);
                    return;
                }
                // Amount Check
                if (cTable.ORDER_AMT == 0 && cTable.CUST_CNT == 0 && string.IsNullOrWhiteSpace(cTable.FIRST_ORDER_TIME))
                {
                    WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0101);
                    return;
                }
                // Table Group Check 
                if (cTable.OP_FLAG == PosConst.TABLE_OP_FLAG.OP_GROUP)
                {
                    WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0645);
                    return;
                }

                if (string.IsNullOrWhiteSpace(m_sOperationTableNo))
                {
                    m_sOperationFloorCd = sFloorCd;
                    m_sOperationTableNo = sTableNo;

                    // Guide Message 출력
                    sGuideMessage = string.Format("{0}-{1}", sFloorNm, sTableNo);
                    sGuideMessageTag = string.Format("{0}-{1}", sFloorCd, sTableNo);
                    this.SetGuideMessage(sGuideMessage, sGuideMessageTag);

                    // 버튼선택효과
                    ((CsmButtonTable)sender).DefaultColor = this.m_TblSelectColor;
                    ((CsmButtonTable)sender).Update();
                }
                else
                {
                    // Select Table
                    Column.MST_TABLE.TABLE_DATA cTableAdd = new Column.MST_TABLE.TABLE_DATA();
                    if (SelectFloorTable(new string[] { m_sOperationFloorCd, m_sOperationTableNo }, ref cTableAdd) == false)
                    {
                        WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0104);
                        return;
                    }

                    // Guide Message 백업
                    sOldGuideMessage = GetGuideMessage();
                    sOldGuideMessageTag = lblGuideMsg.Tag.ToString();

                    // Guide Message 출력
                    sGuideMessage = string.Format("{0}-{1}", sFloorNm, sTableNo);
                    sGuideMessageTag = string.Format("{0}-{1}", sFloorCd, sTableNo);
                    this.AppendGuideMessage(sGuideMessage, sGuideMessageTag);

                    // 버튼선택효과
                    ((CsmButtonTable)sender).DefaultColor = this.m_TblSelectColor;
                    ((CsmButtonTable)sender).Update();

                    // Table Add Confirm
                    if (WinManager.QuestionMessage(POS_MESSAGE.ERROR.MSG_0105) != true)
                    {
                        SetGuideMessage(sOldGuideMessage, sOldGuideMessageTag);
                        return;
                    }

                    if (IsTableUsed(m_sOperationFloorCd, m_sOperationTableNo, false, true) == true) return;
                    if (IsTableUsed(sFloorCd, sTableNo, false, true) == true) return;

                    // Update Table Add
                    m_cDataSrv.InitTranHeader();
                    sRet = m_cTableSvr.UpdateTableAdd(m_sOperationFloorCd, m_sOperationTableNo, sFloorCd, sTableNo);
                    if (sRet != UserCom.RST_OK)
                    {
                        WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0104);
                        SetGuideMessage(sOldGuideMessage, sOldGuideMessageTag);
                        return;
                    }

                    // Table Opertaion Clear
                    TableOperationProc(null, PosConst.TABLE_OPERATION_FLAG.TABLE_NONE);
                    SetGuideMessage(string.Empty);
                }
            }
            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="cTable">선택테이블정보</param>
        private void TableMoveProc(object sender, Column.MST_TABLE.TABLE_DATA cTable)
        {
            string sRet = UserCom.RST_ERR;
            string sGuideMessage = string.Empty;
            string sGuideMessageTag = string.Empty;
            string sOldGuideMessage = string.Empty;
            string sOldGuideMessageTag = string.Empty;

            try
            {
                string sFloorCd = cTable.FLOOR_CD;
                string sTableNo = cTable.TABLE_NO;
                string sFloorNm = this.GetFloorName(sFloorCd);

                // Floor & Table Check
                if (m_sOperationFloorCd == sFloorCd && m_sOperationTableNo == sTableNo)
                {
                    WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0109);
                    return;
                }
                // Table Use Check
                if (IsTableUsed(sFloorCd, sTableNo, false, false) == true)
                {
                    WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0107);
                    return;
                }
                // Table Group Check 
                if (cTable.OP_FLAG == PosConst.TABLE_OP_FLAG.OP_GROUP)
                {
                    WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0644);
                    return;
                }

                if (m_sOperationTableNo == string.Empty)
                {
                    // Amount Check
                    if (cTable.ORDER_AMT == 0 && cTable.CUST_CNT == 0 && string.IsNullOrWhiteSpace(cTable.FIRST_ORDER_TIME))
                    {
                        WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0106);
                        return;
                    }

                    // First Selected Table
                    m_sOperationFloorCd = sFloorCd;
                    m_sOperationTableNo = sTableNo;

                    // Guide Message 출력
                    sGuideMessage = string.Format("{0}-{1}", sFloorNm, sTableNo);
                    sGuideMessageTag = string.Format("{0}-{1}", sFloorCd, sTableNo);
                    this.SetGuideMessage(sGuideMessage, sGuideMessageTag);
                }
                else
                {
                    // Select Table
                    Column.MST_TABLE.TABLE_DATA cTableMove = new Column.MST_TABLE.TABLE_DATA();
                    if (SelectFloorTable(new string[] { m_sOperationFloorCd, m_sOperationTableNo }, ref cTableMove) == false)
                    {
                        WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0110);
                        return;
                    }

                    // Guide Message 백업
                    sOldGuideMessage = GetGuideMessage();
                    sOldGuideMessageTag = lblGuideMsg.Tag.ToString();

                    // Guide Message 출력
                    sGuideMessage = string.Format("{0}-{1}", sFloorNm, sTableNo);
                    sGuideMessageTag = string.Format("{0}-{1}", sFloorCd, sTableNo);
                    this.AppendGuideMessage(sGuideMessage, sGuideMessageTag);

                    // 버튼선택효과
                    ((CsmButtonTable)sender).DefaultColor = this.m_TblSelectColor;
                    ((CsmButtonTable)sender).Update();

                    // Table Move Confirm
                    if (WinManager.QuestionMessage(POS_MESSAGE.ERROR.MSG_0111) != true)
                    {
                        SetGuideMessage(sOldGuideMessage, sOldGuideMessageTag);
                        return;
                    }

                    if (IsTableUsed(m_sOperationFloorCd, m_sOperationTableNo, false, true) == true) return;
                    if (IsTableUsed(sFloorCd, sTableNo, false, true) == true) return;

                    // Update Table Move
                    m_cDataSrv.InitTranHeader();
                    sRet = m_cTableSvr.UpdateTableMove(m_sOperationFloorCd, m_sOperationTableNo, sFloorCd, sTableNo);
                    if (sRet != UserCom.RST_OK)
                    {
                        WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0110);
                        SetGuideMessage(sOldGuideMessage, sOldGuideMessageTag);
                        return;
                    }

                    // Table Operation Clear
                    TableOperationProc(null, PosConst.TABLE_OPERATION_FLAG.TABLE_NONE);
                    SetGuideMessage(string.Empty);
                }
            }
            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="cTable">선택테이블정보</param>
        private void TableItemMoveProc(object sender, Column.MST_TABLE.TABLE_DATA cTable)
        {
            string sRet = UserCom.RST_ERR;
            string sGuideMessage = string.Empty;
            string sGuideMessageTag = string.Empty;
            string sOldGuideMessage = string.Empty;
            string sOldGuideMessageTag = string.Empty;

            try
            {
                string sFloorCd = cTable.FLOOR_CD;
                string sTableNo = cTable.TABLE_NO;
                string sFloorNm = this.GetFloorName(sFloorCd);

                if (string.IsNullOrWhiteSpace(m_sOperationTableNo))
                {
                    // Amount Check
                    if (cTable.ORDER_AMT == 0 && cTable.CUST_CNT == 0 && cTable.FIRST_ORDER_TIME.Trim().Length == 0)
                    {
                        WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0116);
                        return;
                    }
                    // Table Use Check
                    if (IsTableUsed(sFloorCd, sTableNo, false, false) == true)
                    {
                        WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0117);
                        return;
                    }

                    m_sOperationFloorCd = sFloorCd;
                    m_sOperationTableNo = sTableNo;

                    m_sOperationFloorCd = sFloorCd;
                    m_sOperationTableNo = sTableNo;

                    // Guide Message 출력
                    sGuideMessage = string.Format("{0}-{1}", sFloorNm, sTableNo);
                    sGuideMessageTag = string.Format("{0}-{1}", sFloorCd, sTableNo);
                    this.SetGuideMessage(sGuideMessage, sGuideMessageTag);
                }
                else
                {
                    // Floor & Table Check
                    if (m_sOperationFloorCd == sFloorCd && m_sOperationTableNo == sTableNo)
                    {
                        WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0119);
                        return;
                    }
                    // Use Check
                    if (IsTableUsed(sFloorCd, sTableNo, false, false) == true)
                    {
                        WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0117);
                        return;
                    }
                    if (IsTableUsed(m_sOperationFloorCd, m_sOperationTableNo, false, true) == true)
                    {
                        return;
                    }

                    // Guide Message 백업
                    sOldGuideMessage = GetGuideMessage();
                    sOldGuideMessageTag = lblGuideMsg.Tag.ToString();

                    // Guide Message 출력
                    sGuideMessage = string.Format("{0}-{1}", sFloorNm, sTableNo);
                    sGuideMessageTag = string.Format("{0}-{1}", sFloorCd, sTableNo);
                    this.AppendGuideMessage(sGuideMessage, sGuideMessageTag);

                    // 버튼선택효과
                    ((CsmButtonTable)sender).DefaultColor = this.m_TblSelectColor;
                    ((CsmButtonTable)sender).Update();

                    // 거래초기화 
                    m_cDataSrv.InitTranHeader();

                    // 메뉴이동 화면
                    if (UpdateTableUsed(sFloorCd, sTableNo, PosConst.TABLE_USE_FLAG.YES_USE) != 0) return;
                    if (UpdateTableUsed(m_sOperationFloorCd, m_sOperationTableNo, PosConst.TABLE_USE_FLAG.YES_USE) != 0) return;

                    sRet = WinTable.ShowForm(new string[] { FormManager.FORM_ETC_TABLE_ITEM_MOVE, m_sOperationFloorCd, m_sOperationTableNo, sFloorCd, sTableNo });

                    UpdateTableUsed(sFloorCd, sTableNo, PosConst.TABLE_USE_FLAG.NO_USE);
                    UpdateTableUsed(m_sOperationFloorCd, m_sOperationTableNo, PosConst.TABLE_USE_FLAG.NO_USE);

                    if (sRet != UserCom.RST_OK)
                    {
                        if (sRet != UserCom.RST_IGNORE)
                        {
                            WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0398);
                        }
                        SetGuideMessage(sOldGuideMessage, sOldGuideMessageTag);
                        return;
                    }

                    // Table Operation Clear
                    TableOperationProc(null, PosConst.TABLE_OPERATION_FLAG.TABLE_NONE);
                    SetGuideMessage(string.Empty);
                }
            }
            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>
        /// <param name="sender">선택테이블버튼</param>
        /// <param name="cTable">선택테이블정보</param>        
        private void TableMemoProc(object sender, Column.MST_TABLE.TABLE_DATA cTable)
        {
            try
            {
                if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT205), "0") == "0")
                {
                    WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0414);
                    return;
                }
                // Amount Check
                if (cTable.CUST_CNT == 0 && cTable.ORDER_AMT == 0 && cTable.FIRST_ORDER_TIME.Trim().Length == 0)
                {
                    WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0128);
                    return;
                }

                // 거래 초기화
                m_cDataSrv.InitTranHeader();
                m_cDataSrv.DeleteTranItem();

                // 층 및 테이블 정보 설정
                m_cTrnStatus.Head.FloorCd = cTable.FLOOR_CD;
                m_cTrnStatus.Head.TableNo = cTable.TABLE_NO;
                m_cTrnStatus.Head.TableNm = cTable.TABLE_NM;
                m_cTrnStatus.Head.OrderFlag = PosConst.ORDER_TYPE.NORMAL;

                // 주방출력대상 상품이 존재해야 좌석메모가 가능하다.
                int ret = m_cTableSvr.GetKtchDiveceCount(PosConst.PLU_ORDER_OK_FLAG.ORDER_OK, cTable.FLOOR_CD, cTable.TABLE_NO, string.Empty);
                if (ret > 0)
                {
                    m_cTableSvr.SelectMenuOrder();

                    // 좌석메모목록 조회 
                    string floorNm = GetFloorName(cTable.FLOOR_CD);
                    string tableDisp = GetDispTableName(cTable);
                    WinTable.ShowForm(new string[] { FormManager.FORM_ETC_TABLE_MEMO_LIST, cTable.FLOOR_CD, floorNm, cTable.TABLE_NO, tableDisp });
                }
                else
                {
                    WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0407);
                }

                // 거래 초기화
                m_cDataSrv.InitTranHeader();
                m_cDataSrv.DeleteTranItem();

                // Table Operation Clear
                TableOperationProc(null, PosConst.TABLE_OPERATION_FLAG.TABLE_NONE);

                SetGuideMessage(string.Empty);
            }
            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 ReservationProc()
        {
            try
            {
                if (m_enCurrentTableOperationFlag != PosConst.TABLE_OPERATION_FLAG.TABLE_NONE)
                {
                    TableOperationProc(null, PosConst.TABLE_OPERATION_FLAG.TABLE_NONE);
                    m_sOperationFloorCd = string.Empty;
                    m_sOperationTableNo = string.Empty;
                }

                WinTable.ShowForm(new string[] { FormManager.FORM_ETC_RESERV_MAIN });
            }
            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="cTable">선택테이블정보</param>
        private void TableUseClearProc(object sender, Column.MST_TABLE.TABLE_DATA cTable)
        {
            try
            {
                if (m_enCurrentTableOperationFlag != PosConst.TABLE_OPERATION_FLAG.TABLE_NOT_USE) return;

                string sFloorCd = cTable.FLOOR_CD;
                string sTableNo = cTable.TABLE_NO;

                // Table Use Check
                if (cTable.USE_FLAG != PosConst.TABLE_USE_FLAG.YES_USE)
                {
                    WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0399);
                    return;
                }

                // 강제해제 여부 확인 
                if (WinManager.QuestionMessage(POS_MESSAGE.ERROR.MSG_0400) == false) return;

                // 강제해제 처리
                int ret = UpdateTableUsed(sFloorCd, sTableNo, PosConst.TABLE_USE_FLAG.NO_USE, cTable.FIRST_ORDER_TIME, cTable.CUST_CNT, 0);
                if (ret < 0)
                {
                    WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0401);
                }
                else
                {
                    WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0402);
                }
            }
            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
            {
                TableOperationProc(sender, PosConst.TABLE_OPERATION_FLAG.TABLE_NONE);
            }
        }

        private bool SelectFloorTable(string[] aParam, ref Column.MST_TABLE.TABLE_DATA cTable)
        {
            return SelectFloorTable(aParam, ref cTable, true);
        }

        private bool SelectFloorTable(string[] aParam, ref Column.MST_TABLE.TABLE_DATA cTable, bool isShowMsg)
        {
            try
            {
                // Select Table Master
                DataTable dtData;
                string sReturn = m_cTableSvr.SelectTable(new string[] { PosConst.QueryTagDef.QueryTableDef.TABLE_NO_FLOOR_CD_SEARCH, aParam[0], aParam[1] }, out dtData);

                if (sReturn != UserCom.RST_OK)
                {
                    if (isShowMsg == true)
                    {
                        WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0081));
                    }
                    return false;
                }

                if (dtData.Rows.Count == 1)
                {
                    m_cTableSvr.SetTableInfo(dtData.Rows[0], ref cTable);
                }
                else
                {
                    if (isShowMsg == true)
                    {
                        WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0082));
                    }
                    return false;
                }

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

        /// <summary>
        /// Update Table Used
        /// </summary>
        /// <param name="sFloorCd"></param>
        /// <param name="sTableNo"></param>
        /// <param name="useFlag"></param>
        /// <param name="groupCheck"></param>
        /// <returns></returns>
        private int UpdateTableUsed(string sFloorCd, string sTableNo, string useFlag, bool groupCheck = false)
        {
            return UpdateTableUsed(sFloorCd, sTableNo, useFlag, "", 0, 0, groupCheck);
        }

        /// <summary>
        /// Update Table Used
        /// </summary>
        /// <param name="sFloorCd"></param>
        /// <param name="sTableNo"></param>
        /// <param name="sUseFlag"></param>
        /// <param name="sFirstOrderTm"></param>
        /// <param name="nCustCount"></param>
        /// <param name="nDrderAmount"></param>
        /// <param name="groupCheck"></param>
        /// <returns>
        ///  0:성공
        /// -1:업데이트 실패 
        /// -2:테이블 사용중 
        /// </returns>
        private int UpdateTableUsed(string sFloorCd, string sTableNo, string sUseFlag, string sFirstOrderTm , int nCustCount, double nDrderAmount, bool groupCheck = false)
        {
            try
            {
                for (var i = 0; i < 5; i++)
                {
                    var ret = m_cTableSvr.UpdateTableUse(sFloorCd, sTableNo, m_cPosStatus.Base.PosNo, sUseFlag, sFirstOrderTm, nCustCount, nDrderAmount, groupCheck);
                    if (ret == UserCom.RST_OK) break;

                    if (sUseFlag == PosConst.TABLE_USE_FLAG.YES_USE)
                    {
                        WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0083));
                        return -2;
                    }
                    else
                    {
                        if (i == 4)
                        {
                            WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0086));
                            return -1;
                        }

                        System.Threading.Thread.Sleep(500);
                    }
                }

                return 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);
                return -99;
            }
        }

        /// <summary>
        /// Table Use Check
        /// </summary>
        /// <param name="sFloorCd"></param>
        /// <param name="sTableNo"></param>
        /// <param name="groupCheck">테이블그룹 체크 포함 여부</param>
        /// <param name="isShowMsg"></param>
        /// <returns></returns>
        private bool IsTableUsed(string sFloorCd, string sTableNo, bool groupCheck = false, bool isShowMsg = true)
        {
            try
            {
                // Select Table
                Column.MST_TABLE.TABLE_DATA cTable = new Column.MST_TABLE.TABLE_DATA();
                if (SelectFloorTable(new string[] { sFloorCd, sTableNo }, ref cTable, isShowMsg) == false)
                {
                    return false;
                }

                // Use Check
                if (cTable.USE_FLAG == PosConst.TABLE_USE_FLAG.YES_USE)
                {
                    if (isShowMsg)
                    {
                        var msg = MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0083) + "\n"
                                + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0176) + ":"
                                + GetFloorName(sFloorCd) + "-" + GetTableName(sFloorCd, sTableNo);
                        WinManager.ConfirmMessage(msg);
                    }
                    return true;
                }

                #region (주석) 결제완료 업무 미사용
                // 결제완료
                //if (cTable.PAY_COMPLETE_FLAG == "1")
                //{
                //    if (WinManager.QuestionMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0084)) == true)
                //    {
                //        // Update Table Complete Payment
                //        string sReturn = m_cTableSvr.UpdateTableCompletePayment(new string[] { sFloorCd, sTableNo, "0" });
                //        if (sReturn != UserCom.RST_OK)
                //        {
                //            WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0085));
                //            return true;
                //        }
                //        return false;
                //    }
                //    else
                //    {
                //        return true;
                //    }
                //} 
                #endregion

                // 그룹 경우 그룹된 테이블 모두 사용여부 확인 
                if (groupCheck && cTable.OP_FLAG == PosConst.TABLE_OP_FLAG.OP_GROUP)
                {
                    DataTable dt = null;
                    string ret = m_cTableSvr.SelectTable(new string[] { PosConst.QueryTagDef.QueryTableDef.TABLE_GROUP_SEARCH, cTable.OP_FLOOR_CD, cTable.OP_TABLE_NO }, out dt);
                    if (ret != UserCom.RST_OK || dt == null || dt.Rows.Count == 0)
                    {
                        return false;
                    }

                    string tables = string.Empty;
                    foreach (DataRow dr in dt.Rows)
                    {
                        cTable = new Column.MST_TABLE.TABLE_DATA();
                        m_cTableSvr.SetTableInfo(dr, ref cTable);

                        if (cTable.USE_FLAG == PosConst.TABLE_USE_FLAG.YES_USE)
                        {
                            tables += GetFloorName(cTable.FLOOR_CD) + "-" + cTable.TABLE_NO + " ";
                        }
                    }

                    if (string.IsNullOrWhiteSpace(tables) == false)
                    {
                        if (isShowMsg)
                            WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0083) + "\n(" + tables + ")");
                        return true; 
                    }
                }

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

        /// <summary>
        /// Select Floor
        /// </summary>
        private bool SelectFloorMaster()
        {
            try
            {
                m_htFloor = new Hashtable();

                // Select Floor Master
                DataTable dtData;
                string sReturn = (string)m_cTableSvr.SelectFloor(new string[] { PosConst.QueryTagDef.QueryFloorDef.FLOOR_ALL_SEARCH, string.Empty }, out dtData);
                if (sReturn == UserCom.RST_IGNORE)
                {
                    WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0079);
                    return false;
                }
                if (sReturn != UserCom.RST_OK)
                {
                    WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0078);
                    return false;
                }

                foreach (DataRow drData in dtData.Rows)
                {
                    Column.MST_FLOOR.FLOOR_DATA cFloor = new Column.MST_FLOOR.FLOOR_DATA();

                    cFloor.FLOOR_CD = CmUtil.GetDataRowStr(drData, "FLOOR_CD");
                    cFloor.FLOOR_NM = CmUtil.GetDataRowStr(drData, "FLOOR_NM");

                    m_htFloor.Add(m_htFloor.Count, cFloor);
                }

                // No Floor
                if (m_htFloor.Count == 0)
                {
                    WinManager.ConfirmMessage(POS_MESSAGE.ERROR.MSG_0079);
                    return false;
                }

                // Total Floor Page
                if ((m_htFloor.Count % MAX_FLOOR_COUNT) != 0)
                {
                    m_nTotalFloorPage = m_htFloor.Count / MAX_FLOOR_COUNT + 1;
                }
                else
                {
                    m_nTotalFloorPage = m_htFloor.Count / MAX_FLOOR_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);
                return false;
            }

            return true;
        }

        private void SelectTableMaster(string floorCd)
        {
            try
            {
                var isEqualFloor = false;
                var ret = UserCom.RST_ERR;

                // Table Hashtable Init
                m_htTable = new Hashtable();

                // Floor Cd Equal Check
                if (m_sCurrentFloorCd == floorCd)
                {
                    if (pnlTable.Controls.Count > 0) isEqualFloor = true;
                }
                else
                {
                    m_sCurrentFloorCd = floorCd;
                }

                // Select Table Master
                DataTable dtMstTbl;
                ret = m_cTableSvr.SelectTable(new string[] { PosConst.QueryTagDef.QueryTableDef.FLOOR_CD_SEARCH, m_sCurrentFloorCd }, out dtMstTbl);
                if (ret != UserCom.RST_OK)
                {
                    TablePanelControlClear();
                    return;
                }

                // Select Order Master 
                List<Column.MST_TABLE.TABLE_ITEM> tableItems = null;
                DataTable dtMstOrd;
                ret = m_cTableSvr.SelectTableOrderItem(new string[] { PosConst.ORDER_TYPE.NORMAL, m_sCurrentFloorCd, "" }, out dtMstOrd);
                if (ret == UserCom.RST_OK)
                {
                    tableItems = new List<Column.MST_TABLE.TABLE_ITEM>();

                    foreach (DataRow dr in dtMstOrd.Rows)
                    {
                        Column.MST_TABLE.TABLE_ITEM item = new Column.MST_TABLE.TABLE_ITEM();

                        item.FLOOR_CD = CmUtil.GetDataRowStr(dr, "FLOOR_CD").Trim();
                        item.TABLE_NO = CmUtil.GetDataRowStr(dr, "TBL_NO").Trim();
                        item.SEQ = CmUtil.GetDataRowInt(dr, "SEQ");
                        item.ITEM_PLU_CD = CmUtil.GetDataRowStr(dr, "ITEM_CD").Trim();
                        item.ITEM_NM = CmUtil.GetDataRowStr(dr, "SHTCUT_ITEMNM").Trim();
                        item.ITEM_DIV = CmUtil.GetDataRowStr(dr, "ITEM_DIV").Trim();
                        item.SET_MENU_CD = CmUtil.GetDataRowStr(dr, "SET_MENU_CD").Trim();
                        item.CANCEL_DIV = CmUtil.GetDataRowStr(dr, "CANCEL_DIV").Trim();
                        item.SALE_QTY = CmUtil.GetDataRowInt(dr, "SALE_QTY");

                        item.ORD_PIC_NO = CmUtil.GetDataRowStr(dr, "ORD_PIC_NO").Trim();
                        item.ORD_PIC_NM = CmUtil.GetDataRowStr(dr, "ORD_PIC_NM").Trim(); 

                        tableItems.Add(item);
                    }
                }

                // Select seat memo
                DataTable dtMemo = null;
                ret = m_cTableSvr.SelectKtchOrderMessage(string.Empty, string.Empty, out dtMemo);
                if (ret != UserCom.RST_OK) dtMemo = null;

                foreach (DataRow drData in dtMstTbl.Rows)
                {
                    Column.MST_TABLE.TABLE_DATA cTable = new Column.MST_TABLE.TABLE_DATA();

                    m_cTableSvr.SetTableInfo(drData, ref cTable);

                    // 주문금액, 고객수, 주문시간이 있으면 테이블 상품정보 가져오기 
                    var itemQty = 0;
                    var itemList = string.Empty; 
                    if (tableItems != null && tableItems.Count > 0)
                    {
                        foreach (var tmpList in from x in tableItems
                                                where x.FLOOR_CD == cTable.FLOOR_CD
                                                   && x.TABLE_NO == cTable.TABLE_NO
                                                   && x.CANCEL_DIV == PosConst.CANCEL_DIV.NORMAL
                                                   //&& (x.ITEM_DIV == ItemConst.PLU_ITEM_DIV.NORMAL || x.ITEM_DIV == ItemConst.PLU_ITEM_DIV.SET_MAIN)
                                                orderby x.FLOOR_CD, x.TABLE_NO, x.SEQ
                                                select x)
                        {
                            //if (tmpList.ITEM_DIV == ItemConst.PLU_ITEM_DIV.NORMAL || tmpList.ITEM_DIV == ItemConst.PLU_ITEM_DIV.SET_MAIN)
                            //{
                            //    itemQty += tmpList.SALE_QTY;
                            //    itemList += string.Format("{0} ({1})", tmpList.ITEM_NM.Trim(), tmpList.SALE_QTY) + Environment.NewLine;
                            //}
                            //else
                            //{
                            //    itemList += string.Format("{0}", tmpList.ITEM_NM.Trim()) + Environment.NewLine;
                            //}
                            itemQty += tmpList.SALE_QTY;
                            itemList += string.Format("{0} ({1})", tmpList.ITEM_NM.Trim(), tmpList.SALE_QTY) + Environment.NewLine;

                            if (string.IsNullOrWhiteSpace(tmpList.ORD_PIC_NM) == false)
                            {
                                cTable.ORD_PIC_NM = tmpList.ORD_PIC_NM;
                            }
                        }
                    }

                    // 메모 
                    //  A.FLOOR_CD, A.TBL_NO, COUNT(A.*) CNT
                    cTable.IsMemo = false;
                    if (dtMemo != null && dtMemo.Rows.Count > 0)
                    {
                        DataRow[] drs = dtMemo.Select("FLOOR_CD = '" + cTable.FLOOR_CD + "' AND TBL_NO = '" + cTable.TABLE_NO + "' ");
                        if (drs.Length > 0)
                        {
                            var cnt = CmUtil.GetDataRowInt(drs[0], "CNT");
                            cTable.IsMemo = cnt > 0 ? true : false;
                        }
                    }

                    cTable.SALE_QTY = itemQty;
                    cTable.ITEM_LIST = itemList;
                    m_htTable.Add(m_htTable.Count, cTable);
                }

                DisplayTableButton(isEqualFloor);
            }
            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="isEqualFloor"></param>
        private void DisplayTableButton(bool isEqualFloor)
        {
            try
            {
                this.pnlTable.SuspendLayout();
                this.pnlTable.Visible = false;

                List<string> groupTables = new List<string>();

                // 층변경이면, 테이블 판넬의 컨트롤 초기화 
                if (isEqualFloor == false) TablePanelControlClear();

                if (m_htTable.Count == 0) return;

                for (var i = 0; i < this.m_htTable.Count; i++)
                {
                    Column.MST_TABLE.TABLE_DATA cTable = (Column.MST_TABLE.TABLE_DATA)m_htTable[i];

                    int minutes = 0;
                    var tableKey = i.ToString();
                    var opTable = string.Empty;
                    var ordTime = this.GetOrderTime(cTable.FIRST_ORDER_TIME, out minutes);
                    var custCnt = (cTable.CUST_CNT <= 0) ? string.Empty : string.Format("{0}:{1}", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0137), cTable.CUST_CNT);
                    var amount = (cTable.ORDER_AMT <= 0) ? string.Empty : m_cPosStatus.Global.m_stCultureMaster.strCurrencySymbol + m_cPosStatus.Global.NumericTOCurrency(cTable.ORDER_AMT);
                    var itemCnt = (cTable.SALE_QTY <= 0) ? string.Empty : string.Format("{0}:{1}", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0755), cTable.SALE_QTY);
                    var memoFlag = (cTable.SALE_QTY <= 0) ? string.Empty : (cTable.IsMemo ? "[memo]" : "");
                    var items = cTable.ITEM_LIST;
                    var tableNm = GetDispTableName(cTable);

                    CsmButtonTable tableButton = null;
                    if (this.m_btnTableList.ContainsKey(tableKey))
                    {
                        tableButton = this.m_btnTableList[tableKey];
                    }
                    else
                    {
                        // Create ButtonTable
                        cTable.FONT_NM = string.IsNullOrWhiteSpace(cTable.FONT_NM) ? m_cPosStatus.Base.FONT : cTable.FONT_NM;
                        cTable.FONT_SIZE = cTable.FONT_SIZE < 7 ? 10 : cTable.FONT_SIZE;

                        tableButton = new CsmButtonTable();
                        tableButton.Name = string.Format("{0}-{1}", cTable.FLOOR_CD, cTable.TABLE_NO);
                        tableButton.TableKey = tableKey;
                        tableButton.DefaultColor = this.m_TblDefaultColor;
                        tableButton.ClickColor = this.m_TblClickColor;
                        tableButton.BackColor = this.m_TblDeactiveBackColor;
                        tableButton.Font = new Font(cTable.FONT_NM, cTable.FONT_SIZE);
                        tableButton.SetBounds(cTable.X_COORD, cTable.Y_COORD, cTable.WIDTH, cTable.HEIGHT);

                        // Click Event 
                        tableButton.ButtonClickHandler += new CsmButtonTable.ButtonClickEventHandler(TableButtonClickEvent);

                        this.m_btnTableList.Add(tableKey, tableButton);
                        this.pnlTable.Controls.Add(tableButton);
                    }

                    // 선택 테이블 확인
                    var isSelected = false;
                    if (string.IsNullOrWhiteSpace(lblGuideMsg.Tag.ToString()) == false)
                    {
                        if (lblGuideMsg.Tag.ToString().IndexOf(tableButton.Name) >= 0)
                        {
                            isSelected = true;
                        }
                    }
                    if (pnlSelectView.Visible &&  string.IsNullOrWhiteSpace(lblSelectList.Tag.ToString()) == false)
                    {
                        if (lblSelectList.Tag.ToString().IndexOf(tableButton.Name) >= 0)
                        {
                            isSelected = true;
                        }
                    }

                    // 테이블 색 
                    if (isSelected)
                    {
                        // 선택 테이블 
                        tableButton.DefaultColor = this.m_TblSelectColor;
                    }
                    else if (cTable.OP_FLAG == PosConst.TABLE_OP_FLAG.OP_GROUP)
                    {
                        // 그룹 테이블 
                        tableButton.DefaultColor = this.m_TblGroupColor;
                        tableButton.BackColor = this.m_TblActiveBackColor;

                        if (cTable.TABLE_GROUP_INDEX > 0)
                        {
                            var colorIndex = (cTable.TABLE_GROUP_INDEX - 1) % 10;
                            tableButton.DefaultColor = m_GroupColorList[colorIndex];
                        }
                        
                        // 층명가져오기 
                        string floorName = GetFloorName(cTable.OP_FLOOR_CD);
                        if (cTable.FLOOR_CD == cTable.OP_FLOOR_CD && cTable.TABLE_NO == cTable.OP_TABLE_NO)
                        {
                            tableNm = "ⓖ" + tableNm;
                            opTable = string.Empty;
                        }
                        else
                        {
                            opTable = string.Format("({0}-{1})", GetFloorName(cTable.OP_FLOOR_CD)
                                                               , GetTableName(cTable.OP_FLOOR_CD, cTable.OP_TABLE_NO));
                        }
                        tableButton.IsWaited = false; 
                    }
                    else if (cTable.ORDER_AMT != 0 || cTable.SALE_QTY != 0)
                    {
                        // 주문 테이블 
                        tableButton.DefaultColor = this.m_TblOrderColor;
                        tableButton.BackColor = this.m_TblActiveBackColor;
                        tableButton.IsWaited = false; 
                    }
                    else
                    {
                        // 대기 테이블
                        tableButton.DefaultColor = this.m_TblDefaultColor;
                        tableButton.BackColor = this.m_TblDeactiveBackColor;
                        tableButton.IsWaited = true; 
                    }

                    // 테이블 정보 
                    var title = string.Format("【{0}{1}】 {2} {3}", tableNm, opTable, cTable.ORD_PIC_NM.Trim(), ordTime);
                    tableButton.SetTableInfo(tableNm, title, custCnt, amount, itemCnt, items, memoFlag); 
                    tableButton.ItemVisible = (bool)btnViewChange.Tag;

                    // 점유율
                    var occupancyLevel = 0;
                    if (string.IsNullOrWhiteSpace(ordTime) == false)
                    {
                        for (var j = 0; j < this.m_nTablePayWaitMaxTime.Length; j++)
                        {
                            if (minutes <= this.m_nTablePayWaitMaxTime[j])
                            {
                                occupancyLevel = j + 1;
                                break;
                            }
                        }
                        if (occupancyLevel == 0) occupancyLevel = 4;
                    }
                    if (occupancyLevel != tableButton.OccupancyLevel)
                    {
                        tableButton.OccupancyLevel = occupancyLevel;
                    }
                }
            }
            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.pnlTable.Visible = true;
                this.pnlTable.ResumeLayout(false);
            }
        }

        /// <summary>
        /// 최초주문시간 및 경과시간 문자열 처리 
        /// </summary>
        /// <param name="orderTime"></param>
        /// <param name="minutes"></param>
        /// <returns></returns>
        private string GetOrderTime(string orderTime, out int minutes)
        {
            minutes = 0;

            try
            {
                if (orderTime.Trim().Length < 14) return string.Empty;

                var elapse = string.Empty;
                var ts = DateTime.Now - DateTime.ParseExact(orderTime, "yyyyMMddHHmmss", null);
                minutes = (int)ts.TotalMinutes;

                if (minutes > 1)
                    elapse = " " + string.Format(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0809), minutes.ToString()).Trim();

                return CmUtil.StrToTime(orderTime.Substring(8, 4)) + elapse;
            }
            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 string.Empty; 
            }
        }


        private void DisplayChangeAmount(bool bVisibleFlag)
        {
            try
            {
                tmrChangeAmount.Enabled = false;
                tmrChangeAmount.Stop();

                pnlChangeAmount.Visible = false;

                if (bVisibleFlag == true)
                {
                    if (m_cPosStatus.Base.PaymentCompleteFlag == "1" && m_cPosStatus.Sale.ChangeCashAmt > 0)
                    {
                        lblChangeAmount.Text = m_cPosStatus.Global.NumericTOCurrency(m_cPosStatus.Sale.ChangeCashAmt)
                                             + m_cPosStatus.Global.m_stCultureMaster.strCurrencyName;
                        pnlChangeAmount.Visible = true;

                        tmrChangeAmount.Enabled = true;
                        tmrChangeAmount.Start();

                        // 결제 미완료로 설정
                        m_cPosStatus.Base.PaymentCompleteFlag = "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
            {
                this.Update();
            }
        }

        private void TableOperationProc(object sender, PosConst.TABLE_OPERATION_FLAG enTableOperationFlag)
        {
            try
            {
                // 영업일확인 
                switch (enTableOperationFlag)
                { 
                    case PosConst.TABLE_OPERATION_FLAG.TABLE_NONE:
                    case PosConst.TABLE_OPERATION_FLAG.TABLE_NOT_USE:
                        break; 
                    default:
                        if (CheckSaleDate() == false) return;
                        break; 
                }

                // Table Operation Floor & Table No
                m_sOperationFloorCd = string.Empty;
                m_sOperationTableNo = string.Empty;

                // Function Button Initialize
                for (var i = 0; i < m_btnFuncList.Count; i++)
                {
                    int idx = -1;
                    if (int.TryParse(m_btnFuncList[i].Tag.ToString(), out idx))
                    {
                        m_btnFuncList[i].BackColor = m_funcList[idx].DefaultBackColor;
                        m_btnFuncList[i].ForeColor = m_funcList[idx].DefaultForeColor;
                    }
                }

                // Unlock Button Initialize
                btnTableUseClear.BackColor = Color.FromArgb(244, 244, 244);
                btnTableUseClear.ForeColor = Color.FromArgb(145, 145, 145);

                if (m_enCurrentTableOperationFlag != enTableOperationFlag)
                {
                    switch (enTableOperationFlag)
                    {
                        case PosConst.TABLE_OPERATION_FLAG.TABLE_ADD:                                                   // 테이블합석
                        case PosConst.TABLE_OPERATION_FLAG.TABLE_MOVE:                                                  // 테이블이동
                        case PosConst.TABLE_OPERATION_FLAG.TABLE_ITEM_MOVE:                                             // 테이블상품이동
                        case PosConst.TABLE_OPERATION_FLAG.TABLE_MEMO:                                                  // 테이블메모
                        case PosConst.TABLE_OPERATION_FLAG.TABLE_GROUP:                                                 // 테이블그룹 
                        case PosConst.TABLE_OPERATION_FLAG.TABLE_GROUP_CLEAR:                                           // 테이블그룹해제 
                        case PosConst.TABLE_OPERATION_FLAG.TABLE_PAYMENT:                                               // 테이블결제 
                            int funcIdx = int.Parse(((Cosmos.UI.CsmButton)sender).Tag.ToString());
                            SetGuideMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0142));
                            ((Cosmos.UI.CsmButton)sender).BackColor = m_funcList[funcIdx].ClickBackColor;
                            ((Cosmos.UI.CsmButton)sender).ForeColor = m_funcList[funcIdx].ClickForeColor;
                            break;
                        case PosConst.TABLE_OPERATION_FLAG.TABLE_NOT_USE:                                               // 테이블사용 강제 해제 
                            SetGuideMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0142));
                            btnTableUseClear.BackColor = Color.FromArgb(219, 219, 219);
                            btnTableUseClear.ForeColor = Color.Red;
                            break;
                        case PosConst.TABLE_OPERATION_FLAG.TABLE_NONE:
                            SetGuideMessage(string.Empty);
                            break;
                    }

                    // 테이블 다중선택 
                    switch (enTableOperationFlag)
                    {
                        case PosConst.TABLE_OPERATION_FLAG.TABLE_GROUP:                                                 // 테이블그룹
                            lblSelectTitle.Text = ((CsmButton)sender).Text.Trim();
                            m_sOperationFloorCd = string.Empty;
                            m_sOperationTableNo = string.Empty;
                            lblSelectList.Text = string.Empty;
                            lblSelectList.Tag = string.Empty;
                            pnlSelectView.Visible = true;

                            DisplayFuncMenu(PosKey.MENU_KEY.TABLE_GROUP_MODE);
                            break;
                    }

                    m_enCurrentTableOperationFlag = enTableOperationFlag;
                }
                else
                {
                    m_enCurrentTableOperationFlag = PosConst.TABLE_OPERATION_FLAG.TABLE_NONE;
                    SetGuideMessage(string.Empty);
                    DisplayTableButton(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);
            }
        }

        /// <summary>
        /// 테이블화면 종료 처리
        /// </summary>
        private void TableMainExit()
        {
            try
            {
                //긴급 공지, 연습모드 중지
                lblTopMsgMode.MpStop();

                // Timer 종료 처리
                tmrSaleTimer.Enabled = false;
                DisplayChangeAmount(false);

                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);
            }
        }

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

                // Display Change Amount
                DisplayChangeAmount(false);

                CsmButton btn = (CsmButton)sender;
                if (string.IsNullOrWhiteSpace(btn.Text) || string.IsNullOrWhiteSpace(btn.Tag.ToString()))
                {
                    // 테이블 화면 종료시 타이머 종료(2017.06.23)
                    tmrSaleTimer.Enabled = true;
                    return;
                }

                int idx = int.Parse(btn.Tag.ToString());
                string menuKey = m_funcList[idx].FuncKey;
                switch (menuKey)
                {
                    case PosKey.MENU_KEY.TABLE_ADD:
                        TableOperationProc(sender, PosConst.TABLE_OPERATION_FLAG.TABLE_ADD);
                        break;
                    case PosKey.MENU_KEY.TABLE_MOVE:
                        TableOperationProc(sender, PosConst.TABLE_OPERATION_FLAG.TABLE_MOVE);
                        break;
                    case PosKey.MENU_KEY.TABLE_ITEM_MOVE:
                        TableOperationProc(sender, PosConst.TABLE_OPERATION_FLAG.TABLE_ITEM_MOVE);
                        break;
                    case PosKey.MENU_KEY.TABLE_MEMO:
                        if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT205), "1") == "0")
                        {
                            WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0414);
                            break;
                        }
                        TableOperationProc(sender, PosConst.TABLE_OPERATION_FLAG.TABLE_MEMO);
                        break;
                    case PosKey.MENU_KEY.TABLE_RESERV:
                        ReservationProc();
                        break;
                    case PosKey.MENU_KEY.TABLE_EXIT:
                        TableMainExit();
                        // 테이블 화면 종료시 타이머 종료(2017.06.23)
                        return;
                    case PosKey.MENU_KEY.TABLE_GROUP:
                        TableOperationProc(sender, PosConst.TABLE_OPERATION_FLAG.TABLE_GROUP);
                        break;
                    case PosKey.MENU_KEY.TABLE_GROUP_CLEAR:
                        TableOperationProc(sender, PosConst.TABLE_OPERATION_FLAG.TABLE_GROUP_CLEAR);
                        break;
                    case PosKey.MENU_KEY.TABLE_PAYMENT:

                        //#16569 파스쿠찌 드라이브 스루 기능 개발 요청 start
                        //기존
                        //TableOperationProc(sender, PosConst.TABLE_OPERATION_FLAG.TABLE_PAYMENT);
                        //변경
                        if (PosMstManager.GetPosOption(POS_OPTION.OPT554) == "1" &&
                            m_cPosStatus.Base.PosType == PosConst.POS_TYPE.DEFERRED_PAYMENT)
                        {
                            string floorCd = "";
                            string tableNo = "";

                            GetDtTableInfo(ref floorCd, ref tableNo);

                            // Display Change Amount
                            DisplayChangeAmount(false);

                            Column.MST_TABLE.TABLE_DATA cTable = new Column.MST_TABLE.TABLE_DATA();
                            if (SelectFloorTable(new string[] { floorCd, tableNo }, ref cTable) == false) return;

                            TableOrderProc(cTable);
                        }
                        else
                        {
                            TableOperationProc(sender, PosConst.TABLE_OPERATION_FLAG.TABLE_PAYMENT);
                        }
                        //#16569 파스쿠찌 드라이브 스루 기능 개발 요청 end

                        break;
                    case PosKey.MENU_KEY.TABLE_ETC_MENU:
                        DisplayFuncMenu(PosKey.MENU_KEY.TABLE_ETC_MENU);
                        break;
                    case PosKey.MENU_KEY.ENTER:
                    case PosKey.MENU_KEY.ESC_PREVIOUS:
                        if (m_enCurrentTableOperationFlag == PosConst.TABLE_OPERATION_FLAG.TABLE_GROUP)
                        {
                            if (TableGroupComplete(menuKey) == false)
                            {
                                // 테이블 화면 종료시 타이머 종료(2017.06.23)
                                tmrSaleTimer.Enabled = true;
                                return;
                            }
                        }

                        // Table Operation Clear
                        TableOperationProc(null, PosConst.TABLE_OPERATION_FLAG.TABLE_NONE);

                        DisplayFuncMenu();
                        break;
                    case PosKey.MENU_KEY.TABLE_NO_ORDER_SALE:
                        TableNoOrderSaleProc();
                        break;

                    default:
                        // 기타메뉴 실행 
                        EtcMenuExcute(menuKey);
                        break;
                }

                // 테이블 화면 종료시 타이머 종료(2017.06.23)
                tmrSaleTimer.Enabled = 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);
            }
            //finally
            //{
            //    tmrSaleTimer.Enabled = true;
            //}
        }

        private void btnTableUseClear_Click(object sender, EventArgs e)
        {
            try
            {
                if (WinBasic.CheckMenuKeyAuth(PosKey.MENU_KEY.TABLE_USE_CLEAR) == false) return;
                TableOperationProc(sender, PosConst.TABLE_OPERATION_FLAG.TABLE_NOT_USE);
            }
            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 btnFloorClickEvent(object sender, EventArgs e)
        {
            try
            {
                tmrSaleTimer.Enabled = false;

                // Table Panel Control Clear
                //TablePanelControlClear();

                int targetPage = m_nCurrentFloorPage;

                if (sender == btnFloorPre)
                {
                    targetPage--;
                    if (targetPage < 0) targetPage = m_nTotalFloorPage - 1;

                    // Set Floor Button
                    SetFloorButton(targetPage);
                }
                else if (sender == btnFloorNext)
                {
                    targetPage++;
                    if (targetPage > m_nTotalFloorPage - 1) targetPage = 0;

                    // Set Floor Button
                    SetFloorButton(targetPage);
                }
                else
                {
                    CsmButton btn = (CsmButton)sender;
                    string floorCD = btn.Tag.ToString().Trim();
                    string floorNM = btn.Text.Trim();
                    SelectFloorButton(floorCD, floorNM);
                }
            }
            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
            {
                tmrSaleTimer.Enabled = true;
            }
        }

        private void tmrSaleTimer_Tick(object sender, EventArgs e)
        {
            try
            {
                int tableUpdateSec = 5;

                tmrSaleTimer.Enabled = false;

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

                lblTranNo.Text = m_cPosStatus.Base.RegNo + "-" + m_cPosStatus.Base.TradeNo;

                // 상단 정보 표시
                DisplayTopInfo();

                if (Form.ActiveForm == this && m_enCurrentTableOperationFlag == PosConst.TABLE_OPERATION_FLAG.TABLE_NONE)
                {
                    // Add, 2017.02.15, 영수증프린터로 주방 주문서/메시지 출력 처리
                    m_cSaleMainProc.KtchOrderSheetToBillPrint();

                    // 예약알람 (5분 마다)
                    if (DateTime.Now.Minute % 5 == 0)
                    {
                        // 0:30분전, 1:1시간전, 2:1시간30분전, 3:2시간전 
                        AlarmReservation();
                    }

                    SelectBrPopUp();

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

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

                    //#20170913 해피오더 알림 팝업 여부 옵션 처리 start
                    //기존
                    //if (m_cPosStatus.Sale.HappyOrderAlarm == true)
                    //변경
                    if ((m_cPosStatus.Sale.HappyOrderAlarm == true) && (PosMstManager.GetPosOption(POS_OPTION.OPT510) == "1"))
                    //#20170913 해피오더 알림 팝업 여부 옵션 처리 end
                    {
                        // 상품등록 대기 일 때만 해피오더 주문접수 알림창 강제 POP-UP
                        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
                    }

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

                    //#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"));

                            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


                }

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

                // 온도정보 갱신
                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 온도정보 색상
                }

                // 5초 마다 다시 표시
                if (m_nTableAutoDisplayCount >= tableUpdateSec)
                {
                    // Table Auto Display Count 초기화
                    m_nTableAutoDisplayCount = 0;

                    // Display Table Sale Information
                    DisplayTableSaleInfo();

                    // Select Table
                    // 테이블 다중선택 모드 일때는 테이블 업데이트 하지 않음.
                    if (Form.ActiveForm == this && pnlSelectView.Visible == false)
                    {
                        SelectTableMaster(m_sCurrentFloorCd);
                    }
                }
                else
                {
                    m_nTableAutoDisplayCount++;
                }

                // 해피오더 주문알림 처리
                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), CmUtil.IntParse(m_cPosStatus.Sale.BizeunOrderCnt));
                }

                // 이지웰 주문알림 처리
                if (PosMstManager.GetPosOption(POS_OPTION.OPT037) == "1")
                {
                    lblIFStatus3.Text = string.Format(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0465), CmUtil.IntParse(m_cPosStatus.Sale.EzwelOrderCnt));
                }

                //기념일 배송
                if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT020), "0") != "0")
                {
                    if (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);
            }
            tmrSaleTimer.Enabled = true;
        }


        /// <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>
        /// Change Amount Timer Event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tmChangeAmount_Tick(object sender, EventArgs e)
        {
            try
            {
                // Display Chagne Amount
                DisplayChangeAmount(false);
                pnlTable.Refresh();                
            }
            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 btnKeyHide_Click(object sender, EventArgs e)
        {
            try
            {
                this.SetGridData();
                this.pnStoreNoticeShow.Visible = true;
                this.pnStoreNotice.Visible = false;

                this.pnlTable.Refresh();
            }
            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 btnKeyShow_Click(object sender, EventArgs e)
        {
            try
            {
                this.pnStoreNotice.Visible = true;
                this.pnStoreNoticeShow.Visible = false;
                this.pnlTable.Update();
            }
            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 btnProc_Click(object sender, EventArgs e)
        {
            try
            {
                if (sender == btnStoreNoticeOk)
                {
                    string sRet = WinTable.ShowForm(new string[] { FormManager.FORM_ETC_STORE_NOTICE_REG });
                    if (sRet == UserCom.RST_OK)
                    {
                        SetGridData();
                    }
                }
                else if (sender == btnStoreNoticeDel)
                {
                    int iIdx = gridNotice.CsmGridSelectedRowIndex;
                    if (iIdx < dtNoticeData.Rows.Count)
                    {
                        int iSeq = CmUtil.GetDataRowInt(dtNoticeData.Rows[iIdx], "SEQ");
                        string sRet = m_cTableSvr.DeleteStoreNotice(new string[] { PosConst.QueryTagDef.QueryStoreNoticeDef.SEQ_DELETE, iSeq.ToString() });
                        if (sRet == UserCom.RST_OK)
                        {
                            tbContents.Text = string.Empty;
                            SetGridData();
                        }
                    }
                }
            }
            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 btnTableViewChangeClickEvent(object sender, EventArgs e)
        {
            try
            {
                // 테이블 주문상품목록 표시 여부 
                var isView = !(bool)btnViewChange.Tag;
                btnViewChange.Tag = isView;
                for (var i = 0; i < this.m_btnTableList.Count; i++)
                {
                    m_btnTableList[i.ToString()].ItemVisible = isView;
                    m_btnTableList[i.ToString()].Invalidate();
                }
            }
            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 ChangePopUpClickEvent(object sender, EventArgs e)
        {
            try
            {
                // 거스름돈 표시 패널 클릭 시 사라짐
                if (pnlChangeAmount.Visible == true)
                {
                    pnlChangeAmount.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 btnGrid_MouseDown(object sender, MouseEventArgs e)
        {
            try
            {
                ((Cosmos.UI.CsmButton)sender).BorderStyle = BorderStyle.FixedSingle;
            }
            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 btnGrid_MouseUp(object sender, MouseEventArgs e)
        {
            try
            {
                ((Cosmos.UI.CsmButton)sender).BorderStyle = BorderStyle.None;
            }
            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 btnGrid_Click(object sender, EventArgs e)
        {
            try
            {
                if ((Cosmos.UI.CsmButton)sender == btnGridUp)
                {
                    gridNotice.CsmGridScroll("UP");
                }
                else if ((Cosmos.UI.CsmButton)sender == btnGridDn)
                {
                    gridNotice.CsmGridScroll("DOWN");
                }
            }
            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 gridNotice_Click(object sender, string rowIndex)
        {
            DataTable dtData = null;
            try
            {
                tbContents.Text = string.Empty;

                int iSeq = CmUtil.GetDataRowInt(dtNoticeData.Rows[int.Parse(rowIndex)], "SEQ");

                string sReturn = (string)m_cTableSvr.SelectStoreNotice(new string[] { PosConst.QueryTagDef.QueryStoreNoticeDef.SEQ_SEATCH, iSeq.ToString() }, out dtData);
                if (sReturn != UserCom.RST_OK) return;
                if (dtData.Rows.Count > 0)
                {
                    tbContents.Text = "【" + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0156) + "】\r\n";
                    tbContents.Text += CmUtil.GetDataRowStr(dtData.Rows[0], "CONTENTS");
                }
            }
            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);
            }
            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>
        /// 상단 기타 업무 및 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)
                {
                    //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 메뉴
                    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);
            }

        }

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

                //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);
            }
        }

        private void lblIFStatus_Click(object sender, EventArgs e)
        {
            try
            {
                string sMenuKey = string.Empty;
                if ((Cosmos.UI.CsmLabel)sender == lblIFStatus1)          // 해피오더
                {
                    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;

                if ((Cosmos.UI.CsmLabel)sender == lblIFStatus1)          // 해피오더
                {
                    if (PosMstManager.GetPosOption(POS_OPTION.OPT035) == "1")
                    {
                        tmrSaleTimer.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

                        tmrSaleTimer.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 = "";
                    //디비업데이트

                    m_cDataCommon.UpdateEtcNoticeProcess("05", null);
                    WinBasic.ShowWebPos(PosKey.MENU_KEY.REMB_ORDER_PRINT);
                    //ShowOwnerPartWeb(PosKey.MENU_KEY.REMB_ORDER_PRINT);
                }
            }
            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="floorCd"></param>
        /// <returns></returns>
        private string GetFloorName(string floorCd)
        {
            string retValue = floorCd;
            try
            {
                for (var j = 0; j < this.m_htFloor.Count; j++)
                {
                    Column.MST_FLOOR.FLOOR_DATA cFloor = (Column.MST_FLOOR.FLOOR_DATA)m_htFloor[j];
                    if (cFloor.FLOOR_CD == floorCd)
                    {
                        retValue = cFloor.FLOOR_NM;
                        break;
                    }
                }
            }
            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 retValue;
        }

        /// <summary>
        /// 테이블명 가져오기 
        /// </summary>
        /// <param name="floorCd"></param>
        /// <param name="tableNo"></param>
        /// <returns></returns>
        private string GetTableName(string floorCd, string tableNo)
        {
            string retValue = tableNo;
            try
            {
                DataTable dtData = null;
                string ret = m_cTableSvr.SelectTable(new string[] { PosConst.QueryTagDef.QueryTableDef.TABLE_NO_FLOOR_CD_SEARCH, floorCd, tableNo }, out dtData);
                if (ret == UserCom.RST_OK && dtData != null && dtData.Rows.Count > 0)
                {
                    retValue = CmUtil.GetDataRowStr(dtData.Rows[0], "TBL_NM").Trim();
                }
            }
            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 retValue;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="floorCd"></param>
        /// <param name="tableNo"></param>
        /// <remarks>
        /// 2017.01.31, 테이블화면표시는 테이블명으로 고정한다.
        /// </remarks>
        private string GetDispTableName(Column.MST_TABLE.TABLE_DATA cTable)
        {
            string retValue = string.Empty;
            try
            {
                retValue = cTable.TABLE_NM.Trim();

                //switch (cTable.TABLE_DISP_FLAG)
                //{
                //    case PosConst.TABLE_DISP_FLAG.TABLE_NAME:
                //        retValue = cTable.TABLE_NM;
                //        break;
                //    case PosConst.TABLE_DISP_FLAG.TABLE_NO_NAME:
                //        retValue = cTable.TABLE_NO.Trim() + "【" + cTable.TABLE_NM.Trim() + "】";
                //        break;
                //    default:
                //        retValue = cTable.TABLE_NO;
                //        break;
                //}
            }
            catch { }
            return retValue;
        }

        /// <summary>
        /// 기타메뉴실행 처리
        /// </summary>
        /// <param name="menuKey"></param>
        private void EtcMenuExcute(string menuKey)
        {
            try
            {
                // Table Operation Clear
                TableOperationProc(null, PosConst.TABLE_OPERATION_FLAG.TABLE_NONE);
                SetGuideMessage(string.Empty);

                if (string.IsNullOrWhiteSpace(menuKey)) return;

                // 영업일확인
                switch (menuKey)
                {
                    case PosKey.MENU_KEY.RETURN_RECEIPT:
                    case PosKey.MENU_KEY.HPP_APPROVAL_LATER:
                    case PosKey.MENU_KEY.CASH_APPROVAL_LATER:
                        if (CheckSaleDate() == false) return;
                        break; 
                }

                // Timer Kill
                tmrSaleTimer.Enabled = false;
                tmrSaleTimer.Stop();
                
                // 거래 초기화
                m_cDataSrv.TranComplete();
                m_cTrnStatus.Head.OrderFlag = PosConst.ORDER_TYPE.NORMAL;

                // 판매부가정보 초기화
                m_cPosStatus.Sale.SaleFlow = PosConst.SALE_FLOW.SALE_WAIT;
                m_cPosStatus.Sale.SelectFloorCd = string.Empty;
                m_cPosStatus.Sale.SelectTableNo = string.Empty;
                m_cPosStatus.Sale.SelectFloorNm = string.Empty;
                m_cPosStatus.Sale.SelectTableNm = string.Empty;
                m_cPosStatus.Sale.TableInfo = string.Empty;
                m_cPosStatus.Sale.EtcOperateMode = PosConst.ETC_OPERATION_MODE.MENU_EXECUTE;

                switch (menuKey)
                {
                    case PosKey.MENU_KEY.RETURN_RECEIPT:
                    case PosKey.MENU_KEY.RECEIPT_REPRINT:
                    case PosKey.MENU_KEY.HPP_APPROVAL_LATER:
                    case PosKey.MENU_KEY.CASH_APPROVAL_LATER:
                    case PosKey.MENU_KEY.EXCHANGE:
                        SaleMainProcess saleMainProc = new SaleMainProcess();
                        saleMainProc.ExecuteSaleMainProcess(menuKey, "", "", "");
                        break;
                    default:
                        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);
            }
            finally
            {
                // 판매부가정보 초기화
                m_cPosStatus.Sale.SelectFloorCd = string.Empty;
                m_cPosStatus.Sale.SelectTableNo = string.Empty;
                m_cPosStatus.Sale.SelectFloorNm = string.Empty;
                m_cPosStatus.Sale.SelectTableNm = string.Empty;
                m_cPosStatus.Sale.TableInfo = string.Empty;
                m_cPosStatus.Sale.EtcOperateMode = string.Empty;

                // Timer Start
                tmrSaleTimer.Enabled = true;
                tmrSaleTimer.Start();
            }
        }

        /// <summary>
        /// 영업일자 확인
        /// (익일 새벽5시 까지 영업가능)
        /// </summary>
        /// <returns></returns>
        private bool CheckSaleDate()
        {
            try
            {
                var saleDate = string.Format("{0}-{1}-{2}", m_cPosStatus.Base.SaleDate.Substring(0, 4)
                                                          , m_cPosStatus.Base.SaleDate.Substring(4, 2)
                                                          , m_cPosStatus.Base.SaleDate.Substring(6, 2));
                var checkDate = CmUtil.LongParse(DateTime.Parse(saleDate).AddDays(1).ToString("yyyyMMdd") + "05");
                if (checkDate < CmUtil.LongParse(DateTime.Now.ToString("yyyyMMddHH")))
                {
                    WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0184);
                    return false;
                }
                else
                {
                    return 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 false; 
            }
        }


        #region 긴급 공지사항 처리

        /// <summary>
        /// 상단 메세지 설정(연습모드, 긴급메세지)
        /// </summary>
        /// <param name="sType"></param>
        private void GetTopMsgMode(string sType)
        {
            try
            {
                if (sType == "0")
                {
                    if (lblTopMsgMode.MpStatus() == false)
                    {

                        lblTopMsgMode.MpIntervalMove(20);

                        FormManager.SetControlSize(lblTopMsgMode, 125, 0, 820, 50, 21);

                        // 연습모드 설정
                        Cosmos.UI.CsmPosMovePanel.MovePanelInfo cMoveInfo = new Cosmos.UI.CsmPosMovePanel.MovePanelInfo();

                        cMoveInfo.BackColor = Color.Red;
                        cMoveInfo.ForeColor = Color.Yellow;
                        cMoveInfo.MoveKind = "4";   //0:좌->우, 1:우->좌, 4:깜박임
                        cMoveInfo.MoveText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0402);

                        lblTopMsgMode.MpAdd(cMoveInfo);
                        lblTopMsgMode.Visible = true;
                        lblTopMsgMode.BringToFront();
                        lblTopMsgMode.MpStart();
                    }
                }
                else 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

                        FormManager.SetControlSize(lblTopMsgMode, 125, 0, 898, 50, 21);

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

                //팝업 공지 체크
                if (m_enCurrentTableOperationFlag == PosConst.TABLE_OPERATION_FLAG.TABLE_NONE)
                {
                    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;
                                        TableMainExit();
                                        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;
                                    //        TableMainExit();
                                    //        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 != ItemConst.TRAINING_FLAG.TRAINING_YES && lblTopMsgMode.Visible == true)
                {
                    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>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lblTopMsgMode_Click(object sender, EventArgs e)
        {
            lblTopMsgMode_MpClickHandler(null, null);
        }

        #endregion 긴급 공지사항 처리

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

            try
            {
                string sDpsStr = string.Empty;

                if (lblOwnerPart.Visible == true)
                {
                    if (m_cPosStatus.Mst.CorpDiv == ItemConst.CORP_DIV.PC)
                    {
                        sDpsStr = string.Format("{0}:#1{1}", MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0732), MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0734));
                    }
                    else
                    {
                        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));
                    }


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

                // 주변장치 상태 관리 화면
                string sRet = WinSale.ShowForm(new string[] { FormManager.FORM_DEVICE_STATUS_SEARCH, PosKey.MENU_KEY.DEVICE_STATUS_SEARCH });
            }
            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)
        {
            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);
                }

                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.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);
            }
        }

        #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 (bTableMain == true)
                    {
                        NewHPOrdDisplay();
                    }
                    if (bTableMain == false)
                    {
                        iCount = iCount + 1;

                        if (iCount >= 60)
                        {
                            iCount = 0;
                            bTableMain = 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분간 표시
                //          단, 닫기 버튼 클릭 시 알람 닫기
                //--------------------------------------------------

                //if (PosMstManager.GetPosOption(POS_OPTION.OPT518) == "1")
                //{
                //    if (Int32.Parse(DateTime.Now.ToString("HH")) >= 14)
                //    {
                //        if (PosMstManager.GetPosOption(POS_OPTION.OPT518) == "1")
                //        {
                //            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));
                    */
                    //변경
                    this.lblDateTime.Text = string.Format(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0242) + " : {0}",
                                            m_cPosStatus.Base.SaleDate == "" ? m_cPosStatus.Global.DateToCulture("20000101") : m_cPosStatus.Global.DateToCulture(m_cPosStatus.Base.SaleDate));
                    lblSaleDate.Text = m_cPosStatus.Global.DateToCulture(DateTime.Now.ToString("yyyyMMdd")) + " " + DateTime.Now.ToString("HH:mm:ss");
                    //#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());
            }
        }
        #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;
                    TableMainExit(); // 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

        private void lblSaleStatus_Click(object sender, EventArgs e)
        {
            try
            {
                this.WindowState = FormWindowState.Minimized;

                Form fMainForm = (Form)FormManager.GetForm(FormManager.FORM_POS_MAIN);
                if (fMainForm != null) fMainForm.Top = 2048;

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

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

        //        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 fForm = (Form)FormManager.GetForm(FormManager.FORM_SAL_MAIN);
        //                    fForm.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);
        //    }
        //}

        #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;
            }


        }

        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);
            }
        }

        #endregion  SLIDE 메뉴 함수

        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);
            }
        }

        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);
            }
        }

        //#15058 해피오더 버튼 변경_20180612 start,phj
        #region 수정소스 
        private void NewHPOrdDisplay()
        {
            //#20180605 해피오더 개선 start - 20180618
            #region 기존
            /*
            try
            {
                int iNewOrdCnt = 0;
                iNewOrdCnt = int.Parse(CmUtil.IsNull(m_cPosStatus.Sale.HappyOrderTotRegCnt, "0"));
                if (iNewOrdCnt > 99) { iNewOrdCnt = 99; }
                
                if (iNewOrdCnt > 0)
                {
                    //NewHPOrd_Disp.Width = lblIFStatus1.Width;
                    //NewHPOrd_Disp.Left = lblIFStatus1.Left;
                    //NewHPOrd_Disp.Top = 0;// lblIFStatus1.Top;
                    //NewHPOrd_Disp.Height = 50; // lblIFStatus1.Height;

                    PnlNewHPOrd_Disp.Width = lblIFStatus1.Width;
                    PnlNewHPOrd_Disp.Left = lblIFStatus1.Left;
                    PnlNewHPOrd_Disp.Top = 0;// lblIFStatus1.Top;
                    PnlNewHPOrd_Disp.Height = 50; // lblIFStatus1.Height;

                    NewHPOrd_Disp.Visible = true;
                    NewHPOrd_Disp2.Visible = true;

                    NewHPOrd_Disp.Left = 0;
                    NewHPOrd_Disp.Top = 0;
                    NewHPOrd_Disp.Width = PnlNewHPOrd_Disp.Width - (PnlNewHPOrd_Disp.Width / 3);
                    NewHPOrd_Disp.Height = 50;

                    NewHPOrd_Disp2.Left = NewHPOrd_Disp.Width;
                    NewHPOrd_Disp2.Top = 0;
                    NewHPOrd_Disp2.Width = PnlNewHPOrd_Disp.Width - NewHPOrd_Disp.Width;
                    NewHPOrd_Disp2.Height = 50;
                
                    if (CmUtil.IntParse(DateTime.Now.ToString("ss")) % 2 == 0)
                    {
                        NewHPOrd_Disp.Text = "";
                        NewHPOrd_Disp2.Text = "";
                    }
                    else
                    {
                        string sStr = "";
                        string sClose = "";
                        int iStrtNum = 0;
                
                        NewHPOrd_Disp.Text = "";
                        NewHPOrd_Disp.ReadOnly = true;
                
                        NewHPOrd_Disp.SelectionFont = new Font(m_cPosStatus.Base.FONT, 16, FontStyle.Bold);
                        NewHPOrd_Disp.SelectionAlignment = HorizontalAlignment.Right;
                
                        sStr = "해피오더 신규 (" + iNewOrdCnt.ToString() + ")";
                
                        NewHPOrd_Disp.AppendText(sStr);
                        NewHPOrd_Disp.Select(iStrtNum, sStr.Length);
                        NewHPOrd_Disp.SelectionColor = Color.Yellow;
                
                        //sClose = " [닫기]";
                        //NewHPOrd_Disp.AppendText(sClose);
                        //NewHPOrd_Disp.Select(sStr.Length, sClose.Length);
                        //NewHPOrd_Disp.SelectionColor = Color.Black;
                
                        NewHPOrd_Disp.ReadOnly = true;
                        NewHPOrd_Disp.BringToFront();



                        NewHPOrd_Disp2.Text = "";

                        NewHPOrd_Disp2.SelectionFont = new Font(m_cPosStatus.Base.FONT, 16, FontStyle.Bold);
                        NewHPOrd_Disp2.SelectionAlignment = HorizontalAlignment.Left;

                        sClose = " [닫기]";
                        NewHPOrd_Disp2.AppendText(sClose);
                        NewHPOrd_Disp2.Select(0, sClose.Length);
                        NewHPOrd_Disp2.SelectionColor = Color.Black;

                        NewHPOrd_Disp2.ReadOnly = true;
                        NewHPOrd_Disp2.BringToFront();
                    }
                
                    //NewHPOrd_Disp.Visible = true;
                    PnlNewHPOrd_Disp.Visible = true;
                }
                else
                {
                    NewHPOrd_Disp.Visible = false;
                    NewHPOrd_Disp2.Visible = false;

                    //NewHPOrd_Disp.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

            #region 변경
            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);
            }
            #endregion
            //#20180605 해피오더 개선 end - 20180618
        }

        private void NewHPOrd_Disp_Click(object sender, EventArgs e)
        {
            try
            {
                iCount = 0;
                bTableMain = 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;
                bTableMain = 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

        //#16569 파스쿠찌 드라이브 스루 기능 개발 요청 start
        #region 결제 안된 우선 테이블 정보(floorCd, tableNo) 가져오기
        /// <summary>
        /// 결제 안된 우선 테이블 정보(floorCd, tableNo) 가져오기 
        /// </summary>
        /// <param name="floorCd"></param>
        /// <param name="tableNo"></param>
        /// <returns></returns>
        private bool GetDtTableInfo(ref string floorCd, ref string tableNo)
        {
            bool bret = false;
            try
            {
                DataTable dtData = null;
                string ret = m_cTableSvr.SelectTable(new string[] { PosConst.QueryTagDef.QueryTableDef.DT_TABLE_ORD_SEARCH }, out dtData);
                if (ret == UserCom.RST_OK && dtData != null && dtData.Rows.Count > 0)
                {
                    floorCd = CmUtil.GetDataRowStr(dtData.Rows[0], "FLOOR_CD").Trim();
                    tableNo = CmUtil.GetDataRowStr(dtData.Rows[0], "TBL_NO").Trim();
                }
            }
            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 결제 안된 우선 테이블 정보(floorCd, tableNo) 가져오기
        //#16569 파스쿠찌 드라이브 스루 기능 개발 요청 end

    }
}
