using System;
using System.Text;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using System.Collections;
 
using Cosmos.BaseFrame;
using Cosmos.UserFrame;
using Cosmos.ServiceProvider;
using Cosmos.Common;
using Cosmos.CommonManager; 

/*-----------------------------------------------------------------------------------------------*/
// 설      명 : 선불카드 판매 - 중국
// 작  성  자 : 
// 변경  이력 : 
/*-----------------------------------------------------------------------------------------------*/
namespace Cosmos.Win
{
    public partial class frmSalePreCard_China : Form
    {

        #region 변수 선언

        private SManager sManager = new SManager();                                 // 이 객체를 통해 업무 Service 호출
        private StateServer StateObject = (StateServer)StateServer.GetInstance();   // StateObject : StateServer Object (객체)
        private PosStatus m_cPosStatus = new PosStatus();                           // 기본정보 참조
        private TranStatus m_cTrnStatus = new TranStatus();                         // 거래정보 참조        
        private DeviceStatus m_cDevStatus = new DeviceStatus();                     // 디바이스 관리

        private IDataCommonUs m_cDataCommon = null;                                 // POS 공통함수 인터페이스
        private IDataProcessUs m_cDataService = null;
        private IPaymentUs m_cSalePreCard = null;

        private string m_sPosMenuKeyIn;
        public string PosMenuKeyIn { set { m_sPosMenuKeyIn = value; } get { return m_sPosMenuKeyIn; } }
        private string m_sPosMenuKeyOut;
        public string PosMenuKeyOut { set { m_sPosMenuKeyOut = value; } get { return m_sPosMenuKeyOut; } }

        private bool bNotDoubleClik = false;                                        // 더블 클릭 방지용

        private string m_sPosMenuKey;                                               // 입력코드
        /// <summary>
        /// 할인 구분
        /// </summary>
        public string SetPosMenuKey { set { this.m_sPosMenuKey = value; } }

        private string m_sPrePaidCardNo;                                            // 카드번호
        /// <summary>
        /// 카드번호
        /// </summary>
        public string GetPrePaidCardNo { set { this.m_sPrePaidCardNo = value; } get { return m_sPrePaidCardNo; } }

        private DataTable m_dPripadItem;                                            // 등록 카드 정보
        /// <summary>
        /// 등록 카드 정보
        /// </summary>
        public DataTable GetPripadItem { set { this.m_dPripadItem = value; } get { return m_dPripadItem; } }

        /// <summary>
        /// 입력구분
        /// </summary>
        private string m_sInPutType = "";
        /// <summary>
        /// 입력데이터
        /// </summary>
        private string m_sInPutData = "";
        /// <summary>
        /// 카드데이터
        /// </summary>
        private string m_sInEncData = ""; 

        #endregion 변수 선언

        #region 생성자 & 소멸자 & 폼초기화
        public frmSalePreCard_China()
        {
            InitializeComponent();

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

            m_cPosStatus = (PosStatus)StateObject.POS;      // POS 기본정보
            m_cTrnStatus = (TranStatus)StateObject.TRAN;    // POS 거래정보 
            m_cDataService = (IDataProcessUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_SERVICE);
            m_cDataCommon = (IDataCommonUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_COMMON);
            m_cSalePreCard = (IPaymentUs)sManager.InitServiceInstance(ServiceLists.BSV_SALE.DLL, ServiceLists.BSV_SALE.SALEPRECARD);
        }

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

        private void frmSalePreCard_China_Activated(object sender, EventArgs e)
        { 
        }

        private void frmSalePreCard_China_Deactivate(object sender, EventArgs e)
        {
            PosOLEDevice.SetEventHandle(null);
        }

        private void frmSalePreCard_China_FormClosing(object sender, FormClosingEventArgs e)
        {
            UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                 System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", lblTitle.Text);
        }

        /// <summary>
        /// 폼 컨트롤 초기화
        /// </summary>
        private void InitControl()
        {
            try
            {
                // 이미지 로딩 처리
                this.Size = new Size(800, 578);
                //this.Location = new Point(1024 - 800 - 10, 768 - 600);
                picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_SIZE_800X578);
                picBack.Location = new Point(0, 0);

                FormManager.SetFormAllControlFont(this, m_cPosStatus.Base.FONT);
                FormManager.SetTextBoxGlobalInfo(this, m_cPosStatus.Global.m_stCultureMaster.nGroupingDigits, m_cPosStatus.Global.m_stCultureMaster.strGroupingSymbol
                    , m_cPosStatus.Global.m_stCultureMaster.nDecimalDigits, m_cPosStatus.Global.m_stCultureMaster.strDecimalSymbol);

                ////테마색상 적용!
                //padInPut.ThemeColor = m_cPosStatus.ScnMst.ThemeColor;
                //padInPut.ClearBtnText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0817);

                //버튼이미지 적용
                btnAllUp.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_210X48_UP1_BASIC);
                btnAllUp.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_210X48_UP1_PRESS);
                btnAllDw.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_210X48_DOWN1_BASIC);
                btnAllDw.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_210X48_DOWN1_PRESS);

                btnAllUp2.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_210X48_UP1_BASIC);
                btnAllUp2.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_210X48_UP1_PRESS);
                btnAllDw2.DefaultImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_210X48_DOWN1_BASIC);
                btnAllDw2.ClickImage = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_210X48_DOWN1_PRESS);    
            
                btnExit.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BTN_CLOSE);
                if (btnExit.Image != null) btnExit.Text = "";

                // 타이틀
                lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0095);

                //lblCardID.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0240);
                //lblCardNM.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0531);
                lblAmount.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0348);
                lblCardNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0051);

                btnSearch.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0004);                        // 조회
                btnAdd.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0126);                           // 등록
                btnDelete.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0021);                        // 삭제
                btnComplete.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0248);                      // 완료

                txtCardID.Text = "";
                txtCardNM.Text = "";
                txtAmount.Text = "0";
                txtCardNo.Value = "";

                m_sInPutType = "";                                                                                  // 입력구분
                m_sInPutData = "";                                                                                  // 입력데이터
                m_sInEncData = "";                                                                                  // 카드데이터
                m_sPrePaidCardNo = "";

                m_dPripadItem = null;

                bNotDoubleClik = false;

                DataGridSetting(0, null);         // 그리드 초기화

                LoadFuncMaster();           // 기능키 설정

                txtCardNo.Tag = "0";        // 0:수기입력, 1:조회필요
                txtCardNo.Select();
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                     System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }
        #endregion

        #region 버튼 입력 처리
        /// <summary>
        /// 버튼 입력 처리
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnProc_Click(object sender, EventArgs e)
        {
            string sRet = UserCom.RST_ERR;
            try
            {
                if (bNotDoubleClik) return;
                bNotDoubleClik = true;

                if ((UI.CsmButton)sender == btnAllUp)                               // 좌측 그리드 Up
                {
                    if (dgvData.Rows.Count == 0)
                    { 
                        return;
                    }
                    if (dgvData.CurrentRow.Index > 0)
                    {
                        for (int iLoop = dgvData.CurrentRow.Index - 1; iLoop >= 0; iLoop--)
                        {
                            if (dgvData.Rows[iLoop].Visible == false) continue;

                            dgvData.Rows[iLoop].Selected = true;
                            dgvData.Rows[iLoop].Cells[dgvData.CurrentCell.ColumnIndex].Selected = true;
                            break;
                        }
                    }
                }
                else if ((UI.CsmButton)sender == btnAllDw)                          // 좌측 그리드 Down
                {
                    if (dgvData.Rows.Count == 0)
                    { 
                        return;
                    }
                    if (dgvData.CurrentRow.Index < dgvData.Rows.Count - 1)
                    {
                        for (int iLoop = dgvData.CurrentRow.Index + 1; iLoop <= dgvData.Rows.Count - 1; iLoop++)
                        {
                            if (dgvData.Rows[iLoop].Visible == false) continue;

                            dgvData.Rows[iLoop].Selected = true;
                            dgvData.Rows[iLoop].Cells[dgvData.CurrentCell.ColumnIndex].Selected = true;
                            break;
                        }
                    }
                }
                else if ((UI.CsmButton)sender == btnAllUp2)                               // 우측 그리드 Up
                {
                    if (dgvInsData.Rows.Count == 0)
                    { 
                        return;
                    }
                    if (dgvInsData.CurrentRow.Index > 0)
                    {
                        for (int iLoop = dgvInsData.CurrentRow.Index - 1; iLoop >= 0; iLoop--)
                        {
                            if (dgvInsData.Rows[iLoop].Visible == false) continue;

                            dgvInsData.Rows[iLoop].Selected = true;
                            dgvInsData.Rows[iLoop].Cells[dgvInsData.CurrentCell.ColumnIndex].Selected = true;
                            break;
                        }
                    }
                }
                else if ((UI.CsmButton)sender == btnAllDw2)                          // 우측 그리드 Down
                {
                    if (dgvInsData.Rows.Count == 0)
                    { 
                        return;
                    }
                    if (dgvInsData.CurrentRow.Index < dgvInsData.Rows.Count - 1)
                    {
                        for (int iLoop = dgvInsData.CurrentRow.Index + 1; iLoop <= dgvInsData.Rows.Count - 1; iLoop++)
                        {
                            if (dgvInsData.Rows[iLoop].Visible == false) continue;

                            dgvInsData.Rows[iLoop].Selected = true;
                            dgvInsData.Rows[iLoop].Cells[dgvInsData.CurrentCell.ColumnIndex].Selected = true;
                            break;
                        }
                    }
                }
                else if (((Cosmos.UI.CsmButton)sender) == btnSearch)          // 조회
                {           
                    sRet = SearchTxtInPut("1", "1");
                    if (sRet != UserCom.RST_OK) return;
                     
                    return;
                }
                else if (((Cosmos.UI.CsmButton)sender) == btnAdd)           // 추가
                {
                    if (txtCardNo.Tag.ToString() == "0")    // 0:수기입력, 1:조회필요
                    {
                        sRet = CompleteTxtInPut();
                        if (sRet != UserCom.RST_OK) return;
                    }
                    else
                    {
                        // 해당 선불 카드 상태 조회
                        sRet = SearchTxtInPut("0", "0");
                        if (sRet != UserCom.RST_OK) return;
                        // 승인요청
                        sRet = CompleteTxtInPut();                     
                        if (sRet != UserCom.RST_OK) return;

                        // 승인후 같은 그룹 조회
                        if (txtCardID.Text.Trim() != "")
                        {
                            sRet = SearchTxtInPut("1", "0");
                            if (sRet != UserCom.RST_OK) return;
                        }
                    }

                    //#2017/08/10 중국 선불카드번호 등록시 X-Box disable start
                    // Rhee, 2018/08/11
                    // 선불카드번호 등록시 X-Box disable
                    if (dgvInsData.RowCount > 0)
                    {
                        btnExit.Visible = false;
                    }
                    else
                    {
                        btnExit.Visible = true;
                    }
                    //#2017/08/10 중국 선불카드번호 등록시 X-Box disable end


                    txtCardNo.Tag = "0";
                    txtCardID.Text = "";
                    return;
                }
                else if (((Cosmos.UI.CsmButton)sender) == btnDelete)        // 삭제
                {
                    if (txtCardNo.Tag.ToString() == "1")    // 0:수기입력, 1:조회필요
                    {
                        sRet = DeleteTxtInPut();
                        if (sRet != UserCom.RST_OK) return;

                        // 취소후 같은 그룹 조회
                        if (txtCardID.Text.Trim() != "")
                        {
                            sRet = SearchTxtInPut("1", "0");
                            if (sRet != UserCom.RST_OK) return;
                        }
                    }
                    else
                    {
                        sRet = DeleteTxtInPut();
                        if (sRet != UserCom.RST_OK) return;
                    }

                    //#2017/08/10 중국 선불카드번호 등록시 X-Box disable start
                    // Rhee, 2018/08/11
                    // 선불카드번호 등록시 X-Box disable
                    if (dgvInsData.RowCount > 0)
                    {
                        btnExit.Visible = false;
                    }
                    else
                    {
                        btnExit.Visible = true;
                    }
                    //#2017/08/10 중국 선불카드번호 등록시 X-Box disable end


                    txtCardNo.Tag = "0";
                    txtCardID.Text = "";

                    return;
                }
                else if (((Cosmos.UI.CsmButton)sender) == btnComplete)      // 완료
                {
                    if (dgvInsData.RowCount > 0)
                    {
                        DataColumn dcCol = null;
                        DataRow driTem = null;
                        m_dPripadItem = new DataTable("PREPAIDCARD");

                        dcCol = new DataColumn();
                        dcCol.DataType = System.Type.GetType("System.String");
                        dcCol.ColumnName = "Seq";
                        dcCol.DefaultValue = "";
                        m_dPripadItem.Columns.Add(dcCol);

                        dcCol = new DataColumn();
                        dcCol.DataType = System.Type.GetType("System.String");
                        dcCol.ColumnName = "iTemCD";
                        dcCol.DefaultValue = "";
                        m_dPripadItem.Columns.Add(dcCol);

                        dcCol = new DataColumn();
                        dcCol.DataType = System.Type.GetType("System.String");
                        dcCol.ColumnName = "CardNo";
                        dcCol.DefaultValue = "";
                        m_dPripadItem.Columns.Add(dcCol);

                        dcCol = new DataColumn();
                        dcCol.DataType = System.Type.GetType("System.String");
                        dcCol.ColumnName = "Amount";
                        dcCol.DefaultValue = "";
                        m_dPripadItem.Columns.Add(dcCol);
                                                
                        // 선불카드권종 추가(2017.06.27)
                        m_dPripadItem.Columns.Add(new DataColumn("PreKind", typeof(string)));

                        for (int iLoop = 0; iLoop < dgvInsData.RowCount; iLoop++)
                        {
                            driTem = m_dPripadItem.NewRow();
                            driTem["Seq"] = (iLoop + 1).ToString();
                            driTem["iTemCD"] = dgvInsData.Rows[iLoop].Cells[4].Value.ToString();
                            driTem["CardNo"] = dgvInsData.Rows[iLoop].Cells[3].Value.ToString().Substring(1);
                            driTem["Amount"] = dgvInsData.Rows[iLoop].Cells[2].Value.ToString();

                            //#2017/08/25 중국 선불카드 권종코드 SLACK_FIELD 제외 start
                            // Rhee, 2017/08/25
                            // 기존::
                            // 선불카드권종 추가(2017.06.27)
                            ///driTem["PreKind"] = dgvInsData.Rows[iLoop].Cells[0].Value.ToString();

                            driTem["PreKind"] = "";
                            //#2017/08/25 중국 선불카드 권종코드 SLACK_FIELD 제외 end

                            m_dPripadItem.Rows.Add(driTem);
                        }

                        this.DialogResult = DialogResult.OK;
                    }
                    else
                        this.DialogResult = DialogResult.Ignore;

                    this.Close();
                    return;
                }                
                //padInPut.SetActiveFocus();
            }
            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
            {
                bNotDoubleClik = false;
            }
        }

        /// <summary>
        /// 닫기
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnExit_Click(object sender, EventArgs e)
        {
            try
            {
                txtEditBox_EditBoxKeyDownEvent(null, PosKey.MENU_KEY.ESC_PREVIOUS);
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                    System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }
        #endregion

        #region 기능키 컨트롤 초기화 및 기능키 마스터 로딩
        /// <summary>
        /// 기능키 컨트롤 초기화 및 기능키 마스터 로딩
        /// </summary>
        /// <returns>성공/실패</returns>
        public bool LoadFuncMaster()
        {
            string sMenuCode = null; 

            try
            {
                //#2017/08/10 중국 선불카드 MST_ITEM 생성 start
                // Rhee, 2017/08/10
                m_cDataCommon.PrecardSaveToMstItem();
                //#2017/08/10 중국 선불카드 MST_ITEM 생성 end


                // List 조회
                btnMenu.ClearMenuButtonInfo();                     // 설정된 메뉴정보 초기화
                btnMenu.DisplayMenuButton(m_cPosStatus.Base.StoreNo, "1");              // 버튼 표시

                DataTable dtMemu = m_cDataCommon.SeletSalePreCardFuncKey(0);
                if (dtMemu == null || dtMemu.Rows.Count <= 0)
                {
                    WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0294);
                    return false;
                }

                // 우측 상단 기능키 초기화
                btnMenu.BackColor = CmUtil.GetColorToString("223223223");
                btnMenu.VisibleUpDown = true;
                btnMenu.BackColorUpDown = Color.White;
                btnMenu.ForeColorUpDown = Color.Black;
                btnMenu.ClearMenuButtonInfo();                     // 설정된 메뉴정보 초기화 

                // 메뉴정보 설정
                foreach (DataRow dr in dtMemu.Rows)
                {
                    Cosmos.UI.CsmMenu.MenuBtnInfo cMenuInfo = new Cosmos.UI.CsmMenu.MenuBtnInfo();

                    cMenuInfo.nSeqNo = CmUtil.GetDataRowInt(dr, PosMst.MST_PRECARD_KEY.DATA.SEQ);                                                               // SEQ
                    cMenuInfo.sClassCode = CmUtil.GetDataRowStr(dr, PosMst.MST_PRECARD_KEY.DATA.STOR_CD);                                                       // 점포코드
                    cMenuInfo.sGroupCode = "1"; //                                                                                                                 // SUB 그룹

                    sMenuCode = "";
                    sMenuCode = CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_PRECARD_KEY.DATA.CODE), 2)                                                     // 권종
                              + CmUtil.LPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_PRECARD_KEY.DATA.AMOUNT), 20)                                                  // 금액
                              + CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_PRECARD_KEY.DATA.NAME), 80);                                                   // 명

                    cMenuInfo.sMenuCode = sMenuCode;                                                                                                            // 메뉴 코드
                    cMenuInfo.sMenuName = CmUtil.GetDataRowStr(dr, PosMst.MST_PRECARD_KEY.DATA.NAME);                                                           // 메뉴 명
                    cMenuInfo.sMenuPrice = m_cPosStatus.Global.NumericTOCurrency(CmUtil.GetDataRowDouble(dr, PosMst.MST_PRECARD_KEY.DATA.AMOUNT));              // 메뉴 가격

                    cMenuInfo.cBackColor = CmUtil.GetColorToString(CmUtil.GetDataRowStr(dr, PosMst.MST_PRECARD_KEY.DATA.BACKGR_COLOR));                         // 버튼 BACK 컬러
                    cMenuInfo.cForeColorName = Color.FromArgb(51, 51, 51);                                                                                      // 메뉴명 컬러
                    cMenuInfo.cForeColorPrice = Color.Blue; //Color.FromArgb(102, 102, 102);                                                                    // 메뉴가격 컬러
                    cMenuInfo.fFontSizeName = 12;                                                                                                               // 메뉴명 폰트 사이즈
                    cMenuInfo.fFontSizePrice = 12;                                                                                                              // 메뉴 가격 폰트 사이즈
                    cMenuInfo.nButtonSize = 0;                                                                                                                  // 메뉴버튼 사이즈(0:일반,1:가로확대,2:세로확대,3:가로세로확대)
                    cMenuInfo.sMenuEtc = "";
                    cMenuInfo.cForeColorEtc = Color.Black;
                    cMenuInfo.fFontSizeEtc = 10;

                    cMenuInfo.cMenuImage = "";

                    btnMenu.AddMenuButtonInfo(cMenuInfo);

                    //if (CmUtil.GetDataRowDouble(dr, PosMst.MST_PRECARD_KEY.DATA.AMOUNT) == m_nSaleAmt) sMenuCode2 = sMenuCode;
                }

                btnMenu.SetMenuButtonCount(3, 3);
                btnMenu.DisplayMenuButton(m_cPosStatus.Base.StoreNo, "1");              // 버튼 표시                 

                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="sMenuCode"></param>
        private void btnMenu_MenuClickHandler(object sender, string sMenuCode)
        {
            try
            {
                if (sMenuCode == "") return;

                // 메뉴 키 값 = 권종(2) + 금액(20) + 명(80) 
                txtCardNo.Text = "";
                txtCardID.Text = CmUtil.MidH(sMenuCode, 0, 2).Trim();
                txtCardNM.Text = CmUtil.MidH(sMenuCode, 22, 80).Trim();
                txtAmount.Text = m_cPosStatus.Global.NumericTOCurrency(m_cDataService.DoubleParse(CmUtil.MidH(sMenuCode, 2, 20).Trim()));
                txtCardNo.Select();

                btnProc_Click(btnSearch, null);
                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);
            }
        }

        #endregion

        #region 텍스트박스 키 입력 이벤트 처리
        /// <summary>
        /// 텍스트박스 키 입력 이벤트 처리
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="sFuncValue"></param>
        private void txtEditBox_EditBoxKeyDownEvent(object sender, string sFuncValue)
        {
            try
            {
                if (sFuncValue == PosKey.MENU_KEY.ENTER)
                {
                    if (((Cosmos.UI.CsmPosEditBox)sender) == txtCardNo)
                    {
                        btnProc_Click(btnAdd, null);
                        //SearchTxtInPut("1", "1");
                    }

                }
                else if (sFuncValue == PosKey.MENU_KEY.CLEAR)
                {
                    if (((Cosmos.UI.CsmPosEditBox)sender) == txtCardNo)
                    {
                        txtCardNo.Tag = "0";        // 0:수기입력, 1:조회필요
                        txtCardNo.Text = "";
                    }
                }
                else if (sFuncValue == PosKey.MENU_KEY.ESC_PREVIOUS)
                {
                    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);
            }
        }

        /// <summary>
        /// 텍스트박스 활성화 처리
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtEditBox_EnterEvent(object sender, EventArgs e)
        {
            try
            {
                //padInPut.SetActiveControl = (Control)sender;
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                     System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
            }
        }
        #endregion

        #region 텍스트박스 입력 유효성 체크
        /// <summary>
        /// 텍스트박스 입력 유효성 체크
        /// </summary>
        /// <param name="sender"></param>
        /// <returns></returns>
        private bool CheckTxtInPut(object sender, string sSearchMode)
        {
            try
            {
                // 특정 문자값 제거
                try
                {
                    if (m_cDevStatus.Msr.STX != "" && txtCardNo.Value.StartsWith(m_cDevStatus.Msr.STX)) txtCardNo.Value = txtCardNo.Value.Substring(1);

                    int iLastEtx = txtCardNo.Value.LastIndexOf(m_cDevStatus.Msr.ETX);
                    if (m_cDevStatus.Msr.ETX != "" && iLastEtx > 0) txtCardNo.Value = CmUtil.MidH(txtCardNo.Value, 0, iLastEtx);
                }
                catch { }

                // 체크
                if (sSearchMode == "0" && (sender == null || ((Cosmos.UI.CsmPosEditBox)sender) == txtCardNo))
                {
                    // 카드번호 길이 체크
                    if (txtCardNo.Text.Length < 10)
                    {
                        WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0037);
                        txtCardNo.Text = "";
                        txtCardNo.Focus();
                        return false;
                    }
                }
            }
            catch (Exception ex)
            {
                WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
                     System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
                return false;
            }
            return true;
        }
        #endregion

        #region 조회 처리
        /// <summary>
        /// 조회 처리
        /// </summary>
        /// <param name="sSearchMode"></param>
        /// <param name="sViewMode"></param>
        /// <returns></returns>
        private string SearchTxtInPut(string sSearchMode, string sViewMode)
        {
            string sRet = UserCom.RST_ERR;
            string[] aRet = null;
            try
            {

                if (CheckTxtInPut(null, sSearchMode) != true) return sRet;

                dgvData.Rows.Clear();

                // 조회
                sRet = m_cSalePreCard.SearchPayment(new string[] { (txtCardNo.Value.Trim() == "" ? "0" : "1"), (txtCardNo.Value.Trim() == "" ? txtCardID.Text.Trim() : txtCardNo.Value.Trim()), sViewMode }, ref aRet);
                if (sRet != UserCom.RST_OK) return sRet;

                if (aRet.Length > 0)
                {
                    if (sSearchMode == "1")
                    {
                        DataGridSetting(1, aRet);
                    }
                    else
                    {
                        for (int iLoop = 0; iLoop < aRet.Length; iLoop++)
                        {
                            string[] aRecvData = aRet[iLoop].Split(new string[] { "|" }, StringSplitOptions.None);

                            if (aRecvData.Length > 0)
                            {
                                txtCardID.Text = aRecvData[0].Trim();                                                                // 코드
                                txtAmount.Text = m_cPosStatus.Global.NumericTOCurrency(m_cDataService.DoubleParse(aRecvData[2].Trim()));     //  금액
                            }
                        }

                    }
                }
                else
                {
                    return UserCom.RST_ERR;
                }

                sRet = UserCom.RST_OK;

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

        #region 승인 처리
        /// <summary>
        /// 승인 처리
        /// </summary> 
        /// <returns></returns>
        private string CompleteTxtInPut()
        {
            string sRet = UserCom.RST_ERR; 

            try
            {
                if (CheckTxtInPut(null, "0") != true) return sRet;

                if (txtCardNo.Tag.ToString() == "1")    // 0:수기입력, 1:조회필요
                {
                    // 승인요청
                    sRet = m_cSalePreCard.SetPayment(new string[] { "0", txtCardNo.Value.Trim(), "1" });
                    if (sRet != UserCom.RST_OK) return sRet;
                }

                int iRow = dgvInsData.Rows.Add();

                dgvInsData.Rows[iRow].Visible = true;

                dgvInsData.Rows[iRow].DefaultCellStyle.ForeColor = Color.Black;
                dgvInsData.Rows[iRow].DefaultCellStyle.SelectionForeColor = Color.Black;

                dgvInsData.Rows[iRow].HeaderCell.Value = (iRow + 1).ToString();
                dgvInsData.Rows[iRow].Cells[0].Value = txtCardID.Text.Trim();                                                               // 코드
                //dgvInsData.Rows[iRow].Cells[1].Value = string.Format("{0}-{1}-{2}-{3}", CmUtil.MidH(txtCardNo.Value.Trim(), 0, 4), CmUtil.MidH(txtCardNo.Value.Trim(), 4, 4), CmUtil.MidH(txtCardNo.Value.Trim(), 8, 4), CmUtil.MidH(txtCardNo.Value.Trim(), 12, 4));       // 번호
                dgvInsData.Rows[iRow].Cells[1].Value = string.Format("{0}-{1}-{2}-{3}", CmUtil.MidH(txtCardNo.Value.Trim(), 0, 4), CmUtil.MidH(txtCardNo.Value.Trim(), 4, 4), "****", CmUtil.MidH(txtCardNo.Value.Trim(), 12, 4));       // 번호
                dgvInsData.Rows[iRow].Cells[2].Value = m_cPosStatus.Global.NumericTOCurrency(m_cDataService.DoubleParse(txtAmount.Text.Trim()));    // 금액
                dgvInsData.Rows[iRow].Cells[3].Value = txtCardNo.Tag.ToString() + txtCardNo.Value.Trim();                                                              // 번호
                dgvInsData.Rows[iRow].Cells[4].Value = SeletItemMst_PrePaidCard_Sale(m_cDataService.DoubleParse(txtAmount.Text.Trim()));            // 상품코드
                // Rhee, 2017/08/01 상품코드 대신 권종코드로 변경
                //dgvInsData.Rows[iRow].Cells[4].Value = txtCardID.Text.Trim();                                                               // 권종코드
                txtCardNo.Tag = "0";
                txtCardNo.Value = "";
                sRet = UserCom.RST_OK;

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

        #region 취소 처리
        /// <summary>
        /// 취소 처리
        /// </summary> 
        /// <returns></returns>
        private string DeleteTxtInPut()
        {
            string sRet = UserCom.RST_ERR;

            try
            {
                if (dgvInsData.RowCount <= 0) return sRet;

                txtCardNo.Tag = dgvInsData.SelectedRows[0].Cells[3].Value.ToString().Substring(0, 1);
                txtCardNo.Text = dgvInsData.SelectedRows[0].Cells[3].Value.ToString().Substring(1);
                txtCardID.Text = dgvInsData.SelectedRows[0].Cells[0].Value.ToString();
                txtAmount.Text = dgvInsData.SelectedRows[0].Cells[2].Value.ToString();

                if (CheckTxtInPut(null, "0") != true) return sRet;

                if (txtCardNo.Tag.ToString() == "1")    // 0:수기입력, 1:조회필요
                {
                    // 취소요청
                    sRet = m_cSalePreCard.CancelPayment(new string[] { "1", txtCardNo.Value.Trim(), "1" });
                    if (sRet != UserCom.RST_OK) return sRet;
                }

                // 삭제
                dgvInsData.Rows.RemoveAt(dgvInsData.CurrentCell.RowIndex);
                for (int iRow = 0; iRow < dgvInsData.RowCount; iRow++)
                {
                    dgvInsData.Rows[iRow].HeaderCell.Value = (iRow + 1).ToString();
                }

                txtCardNo.Tag = "0";
                txtCardNo.Value = "";
                
                sRet = UserCom.RST_OK;

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

        #region DeviceEvent 관련
        /// <summary>
        /// DeviceEvent 관련
        /// </summary>
        /// <param name="sDevice"></param>
        /// <param name="sData1"></param>
        /// <param name="sData2"></param>
        /// <param name="sData3"></param>
        public void OnDeviceEvent(string sDevice, string sData1, string sData2, string sData3)
        {
            try
            {
                switch (sDevice)
                {
                    case PosConst.OPOS_DEVICE.MSR:
                        this.Invoke(new EventHandler(OnMSREvent));
                        break;
                    case PosConst.OPOS_DEVICE.SCANNER:
                        this.Invoke(new EventHandler(OnScannerEvent));
                        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);
            }
        }

        /// <summary>
        /// MSR Event
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        private void OnMSREvent(object source, EventArgs e)
        {

        }
        /// <summary>
        /// 스캐너 이벤트 처리
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        private void OnScannerEvent(object source, EventArgs e)
        {

        }

        /// <summary>
        /// 카드 번호 암호화
        /// </summary>
        /// <param name="sInData"></param>
        /// <param name="sCardData"></param>
        /// <param name="sCardNo"></param>
        /// <returns></returns>
        private string EncryptedCardNo(string sInData, ref string sCardData, ref string sCardNo)
        {
            string sEncData = sInData;

            try
            {
                 
            }
            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 sEncData;
        }

        /// <summary>
        /// IC 카드 정보 입력 처리
        /// </summary>
        /// <returns></returns>
        private bool GetIcCardData()
        {
            try
            {
 
            }
            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;
        }
        #endregion

        #region 그리드 설정 및 사용
        private double DataGridSetting(int iWorkMode, string[] aRet)
        {
            try
            {
                if (iWorkMode == 0)
                {
                    // 초기화
                    dgvData.Rows.Clear();

                    dgvData.AllowUserToAddRows = false;
                    dgvData.EnableHeadersVisualStyles = false;
                    dgvData.RowsDefaultCellStyle.BackColor = Color.White;
                    dgvData.AlternatingRowsDefaultCellStyle.BackColor = Color.FromArgb(249, 249, 249);

                    dgvData.Font = new Font(m_cPosStatus.Base.FONT, 10);
                    dgvData.RowHeadersDefaultCellStyle.Font = new Font(m_cPosStatus.Base.FONT, 10);

                    // 타이틀 설정
                    dgvData.Columns[0].HeaderText ="PRECARDID";
                    dgvData.Columns[1].HeaderText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0051);
                    dgvData.Columns[2].HeaderText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0348);
                    dgvData.Refresh();

                    // 초기화
                    dgvInsData.Rows.Clear();

                    dgvInsData.AllowUserToAddRows = false;
                    dgvInsData.EnableHeadersVisualStyles = false;
                    dgvInsData.RowsDefaultCellStyle.BackColor = Color.White;
                    dgvInsData.AlternatingRowsDefaultCellStyle.BackColor = Color.FromArgb(249, 249, 249);

                    dgvInsData.Font = new Font(m_cPosStatus.Base.FONT, 10);
                    dgvInsData.RowHeadersDefaultCellStyle.Font = new Font(m_cPosStatus.Base.FONT, 10);

                    // 타이틀 설정
                    dgvInsData.Columns[0].HeaderText = "PRECARDID";
                    dgvInsData.Columns[1].HeaderText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0051);
                    dgvInsData.Columns[2].HeaderText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0348);
                    dgvInsData.Refresh();

                }
                else if (iWorkMode == 1)
                {
                    // 추가
                    dgvData.Rows.Clear();

                    for (int iLoop = 0; iLoop < aRet.Length; iLoop++)
                    {
                        string[] aRecvData = aRet[iLoop].Split(new string[] { "|" }, StringSplitOptions.None);

                        if (aRecvData.Length > 0)
                        {
                            int iRow = dgvData.Rows.Add();

                            dgvData.Rows[iRow].Visible = true;

                            dgvData.Rows[iRow].DefaultCellStyle.ForeColor = Color.Black;
                            dgvData.Rows[iRow].DefaultCellStyle.SelectionForeColor = Color.Black;

                            dgvData.Rows[iRow].HeaderCell.Value = (iRow + 1).ToString();
                            dgvData.Rows[iRow].Cells[0].Value = aRecvData[0].Trim();                                                                // 코드
                            //dgvData.Rows[iRow].Cells[1].Value = string.Format("{0}-{1}-{2}-{3}", CmUtil.MidH(aRecvData[1].Trim(), 0, 4), CmUtil.MidH(aRecvData[1].Trim(), 4, 4), CmUtil.MidH(aRecvData[1].Trim(), 8, 4), CmUtil.MidH(aRecvData[1].Trim(), 12, 4));       // 번호
                            dgvData.Rows[iRow].Cells[1].Value = string.Format("{0}-{1}-{2}-{3}", CmUtil.MidH(aRecvData[1].Trim(), 0, 4), CmUtil.MidH(aRecvData[1].Trim(), 4, 4), "****", CmUtil.MidH(aRecvData[1].Trim(), 12, 4));       // 번호
                            dgvData.Rows[iRow].Cells[2].Value = m_cPosStatus.Global.NumericTOCurrency(m_cDataService.DoubleParse(aRecvData[2].Trim()));     //  금액
                            dgvData.Rows[iRow].Cells[3].Value = aRecvData[1].Trim();                                                                // 번호
                        }
                    }

                    dgvData.Refresh(); 

                    //if (dgvData.RowCount == 1)
                    //{
                    //    txtCardNo.Value = dgvData.Rows[0].Cells[3].Value.ToString();
                    //    txtCardID.Text = dgvData.Rows[0].Cells[0].Value.ToString();
                    //    txtAmount.Text = m_cPosStatus.Global.NumericTOCurrency(m_cDataService.DoubleParse(dgvData.Rows[0].Cells[2].Value.ToString()));
                    //}
                    //else
                    //{
                    //    txtCardNo.Tag = "0";        // 0:수기입력, 1:조회필요
                    //    txtCardNo.Text = "";
                        
                    //}
                    txtCardNo.Tag = "0";        // 0:수기입력, 1:조회필요
                    txtCardNo.Text = "";
                }
                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 0;
        }

        #endregion

        #region 그리드 선택
        private void dgvData_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (dgvData.Rows.Count <= 0) return; 
                if (e.RowIndex < 0) return;

                int iRow = e.RowIndex;

                txtCardNo.Tag = "1";        // 0:수기입력, 1:조회필요
                txtCardNo.Value = dgvData.Rows[e.RowIndex].Cells[3].Value.ToString();
                txtCardID.Text = dgvData.Rows[e.RowIndex].Cells[0].Value.ToString();
                txtAmount.Text = m_cPosStatus.Global.NumericTOCurrency(m_cDataService.DoubleParse(dgvData.Rows[e.RowIndex].Cells[2].Value.ToString()));

                txtCardNo.Select();
                txtCardNo.SelectText();
            }
            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 dgvInsData_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (dgvInsData.Rows.Count <= 0) return;
                if (e.RowIndex < 0) return;

                int iRow = e.RowIndex;

                
                //txtCardNo.Value = dgvInsData.Rows[e.RowIndex].Cells[3].Value.ToString();
                //txtCardID.Text = dgvInsData.Rows[e.RowIndex].Cells[0].Value.ToString();
                //txtAmount.Text = m_cPosStatus.Global.NumericTOCurrency(m_cDataService.DoubleParse(dgvInsData.Rows[e.RowIndex].Cells[2].Value.ToString()));
            }
            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 txtCardNo_EditBoxTextChangedEvnet(object sender, EventArgs e)
        {
            //txtCardID.Text = "";
            ////txtCardNM.Text = "";
            //txtAmount.Text = "0";
        }

        #endregion

        #region 상품 마스터 조회(선불카드 금액으로 상품 검색)
        /// <summary>
        /// 상품 마스터 조회(선불카드 금액으로 상품 검색)
        /// </summary>
        /// <param name="nSaleAmt"></param>
        /// <returns></returns>
        public string SeletItemMst_PrePaidCard_Sale(double nSaleAmt)
        {
            string sQuery = "";
            IDatabaseSQL m_cSqlDbService = (IDatabaseSQL)sManager.InitServiceInstance(ServiceLists.AGENT_DATABASE.DLL, ServiceLists.AGENT_DATABASE.DATABASE_MSSQL);
            DataTable dtResult = null;
            string sResult = null;

            try
            {
                // 상품코드로 상품 마스터 조회
                sQuery = "";
                sQuery += "SELECT TOP 1 * FROM POSMST..MST_ITEM \n";
                sQuery += "WHERE \n";
                sQuery += "    CMP_CD       = '" + m_cPosStatus.Base.CmpCd + "' \n";
                sQuery += "AND STOR_CD      = '" + m_cPosStatus.Base.StoreNo + "' \n";
                sQuery += "AND SUB_STOR_CD  = '" + m_cPosStatus.Base.StoreNo + "' \n";
                sQuery += "AND '" + m_cPosStatus.Base.SaleDate + "' BETWEEN SALE_START_DT AND SALE_FNSH_DT \n";
                sQuery += "AND SALE_PRMT_YN = '" + PosConst.MST_USE_YN.YES + "' \n";
                if (PosMstManager.GetPosOption(POS_OPTION.OPT041) == "1")
                {
                    sQuery += "AND TAKE_OUT_SALE_AMT = " + nSaleAmt + " \n";
                }
                else
                {
                    sQuery += "AND TAKE_IN_SALE_AMT = " + nSaleAmt + " \n";
                }
                sQuery += "AND ITEM_TYPE    = '" + PosConst.ITEM_TYPE.PREPAID + "' \n";
                sQuery += "AND USE_YN       = '" + PosConst.MST_USE_YN.YES + "'\n";
                sQuery = sQuery.Replace("\t", " ");

                int iRet = m_cSqlDbService.DBSelect(sQuery, out dtResult);

                if (dtResult == null || dtResult.Rows.Count == 0)
                {
                    return "";
                }
                else
                {
                    // 해당 금액의 상품코드 리턴
                    DataRow drData = dtResult.Rows[0];
                    sResult = CmUtil.GetDataRowStr(drData, PosMst.MST_ITEM.DATA.ITEM_CD);
                }
                return sResult;
            }
            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 "";
        }
        #endregion 

        /// <summary>
        /// 선불카드번호 수기입력(2017.06.13)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCardNo_Click(object sender, EventArgs e)
        {
            try
            {
                frmInputDataMin fForm = new frmInputDataMin();
                fForm.PosMenuKeyIn = "PRECARD";
                if (fForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    string sCardNo = fForm.PosInPutData;
                    if (sCardNo.Length > 0) txtCardNo.Text = sCardNo;
                }
            }
            catch { };
        }
    }

}
