using System; using System.Text; using System.Data; using System.Drawing; using System.Windows.Forms; using System.Collections; using Cosmos.Win; using Cosmos.BaseFrame; using Cosmos.UserFrame; using Cosmos.ServiceProvider; using Cosmos.Common; using Cosmos.CommonManager; using Cosmos.UI; /*-----------------------------------------------------------------------------------------------*/ // 설 명 : 영업 공지사항 조회 // 작 성 자 : // 변경 이력 : /*-----------------------------------------------------------------------------------------------*/ namespace Cosmos.Win { public partial class frmBusiNotice : 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 IDataSearch m_cDataSearch = null; private ISaleCompleteUs m_cSaleComplete = null; private ISaleRefundUs m_cSaleRefund = null; // 반품처리 private ArrayList m_sPrintData; private ISvr2Tran m_cSvr2Tran = null; private bool bNotDoubleClik = false; // 더블 클릭 방지용 private string m_sPosMenuKey; // 입력코드 /// /// 할인 구분 /// public string SetPosMenuKey { set { this.m_sPosMenuKey = value; } } /// /// 조회구분 (1:자료조회, 2:매출조회, 3:영수증메모조회) /// private string m_sSearchType; /// /// 영수증 리스트 /// private DataTable m_dtSearchList; /// /// 입력구분 /// private string m_sInPutType = ""; /// /// 입력데이터 /// private string m_sInPutData = ""; /// /// 카드데이터 /// private string m_sInEncData = ""; /// /// 조회 선택 구분 /// private string m_sSearchDiv = ""; #endregion 변수 선언 #region 생성자 & 소멸자 & 폼초기화 public frmBusiNotice() { 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_cDataSearch = (IDataSearch)sManager.InitServiceInstance(ServiceLists.BSV_ADMIN.DLL, ServiceLists.BSV_ADMIN.DATASEARCH); m_cSaleComplete = (ISaleCompleteUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.SALE_COMPLETE); m_cSaleRefund = (ISaleRefundUs)sManager.InitServiceInstance(ServiceLists.BSV_SALE.DLL, ServiceLists.BSV_SALE.SALE_REFUND); m_cSvr2Tran = (ISvr2Tran)sManager.InitServiceInstance(ServiceLists.BSV_SALE.DLL, ServiceLists.BSV_SALE.SVR2TRAN); } private void frmBusiNotice_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 frmBusiNotice_Activated(object sender, EventArgs e) { } private void frmBusiNotice_Deactivate(object sender, EventArgs e) { PosOLEDevice.SetEventHandle(null); } private void frmBusiNotice_FormClosing(object sender, FormClosingEventArgs e) { 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 + "()", lblTitle.Text); } /// /// 폼 컨트롤 초기화 /// private void InitControl() { try { if (m_cPosStatus.Sale.ScreenSizeUser == 1024) { // 이미지 로딩 처리 picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_FULL_SIZE); //this.Size = new Size(1024, 696); //this.Location = new Point(0, 50); FormManager.SetControlSize(picBack, 0, 0, 1024, 696); FormManager.SetControlSize(this, 0, 50, picBack.Size.Width, picBack.Size.Height); FormManager.SetControlSize(this.lblTitle, 16, 1, 950, 50); FormManager.SetControlSize(this.btnExit, 965, 1, 58, 50); FormManager.SetControlSize(this.btnPrint, 550, 67, 100, 40); FormManager.SetControlSize(this.txtPrtData, 663, 281, 322, 399); FormManager.SetControlSize(this.btnSearch1, 244, 67, 100, 40); FormManager.SetControlSize(this.btnSearch2, 346, 67, 100, 40); FormManager.SetControlSize(this.btnSearch3, 448, 67, 100, 40); FormManager.SetControlSize(this.picNotice, 717, 67, 290, 208); FormManager.SetControlSize(this.grdSearchList, 16, 121, 606, 559); FormManager.SetControlSize(this.btnDw2, 621, 539, 29, 141); FormManager.SetControlSize(this.btnDw, 621, 400, 29, 140); FormManager.SetControlSize(this.btnUp, 621, 261, 29, 140); FormManager.SetControlSize(this.btnUp2, 621, 121, 29, 141); FormManager.SetControlSize(this.vScrollbar, 967, 281, 40, 399); FormManager.SetControlSize(this.label2, 16, 120, 634, 2); } else { // 이미지 로딩 처리 picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_SIZE_800X600); FormManager.SetControlSize(picBack, 0, 0, 800, 600); FormManager.SetControlSize(this, 0, 0, picBack.Size.Width, picBack.Size.Height); FormManager.SetControlSize(this.lblTitle, 16, 1, 728, 50); FormManager.SetControlSize(this.btnExit, 741, 1, 58, 50); FormManager.SetControlSize(this.btnPrint, 320, 67, 100, 40); FormManager.SetControlSize(this.txtPrtData, 433, 281, 322, 297); FormManager.SetControlSize(this.btnSearch1, 14, 67, 100, 40); FormManager.SetControlSize(this.btnSearch2, 116, 67, 100, 40); FormManager.SetControlSize(this.btnSearch3, 218, 67, 100, 40); FormManager.SetControlSize(this.picNotice, 487, 67, 290, 208); FormManager.SetControlSize(this.grdSearchList, 22, 121, 370, 457); FormManager.SetControlSize(this.btnDw2, 391, 463, 29, 115); FormManager.SetControlSize(this.btnDw, 391, 349, 29, 115); FormManager.SetControlSize(this.btnUp, 391, 235, 29, 115); FormManager.SetControlSize(this.btnUp2, 391, 121, 29, 115); FormManager.SetControlSize(this.vScrollbar, 737, 281, 40, 297); FormManager.SetControlSize(this.label2, 22, 120, 398, 2); } // 이미지 로딩 처리 //picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_FULL_SIZE); //this.Size = new Size(1024, 696); //this.Location = new Point(0, 50); picNotice.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_BUSI_NOTICE); btnExit.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BTN_CLOSE); if (btnExit.Image != null) btnExit.Text = ""; btnUp2.Image = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.NAVIBTN_14X9_UP2_BASIC); btnUp.Image = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.NAVIBTN_14X9_UP1_BASIC); btnDw.Image = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.NAVIBTN_14X9_DOWN1_BASIC); btnDw2.Image = CmUtil.LoadImage(BaseCom.NxImgPath + ImageManager.NAVIBTN_14X9_DOWN2_BASIC); if (btnUp2.Image != null) btnUp2.Text = ""; if (btnUp.Image != null) btnUp.Text = ""; if (btnDw.Image != null) btnDw.Text = ""; if (btnDw2.Image != null) btnDw2.Text = ""; 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); txtPrtData.Font = new Font(m_cPosStatus.Base.FONT_FIX, txtPrtData.Font.Size, txtPrtData.Font.Style); lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0540); btnSearch1.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0541); // 본사 btnSearch2.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0542); // 식품안전 btnSearch3.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0989); // 점포 btnPrint.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0257); // 출력 txtPrtData.Text = ""; m_sSearchDiv = "51"; m_sPrintData = new ArrayList(); bNotDoubleClik = false; InitializeGrid(); btnProc_Click(btnSearch1, null); vScrollbar.Attach(txtPrtData); } 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 버튼 입력 처리 /// /// 버튼 입력 처리 /// /// /// private void btnProc_Click(object sender, EventArgs e) { string sRet = UserCom.RST_ERR; try { if (bNotDoubleClik) return; bNotDoubleClik = true; if ((UI.CsmButton)sender == btnUp2) { grdSearchList.CsmGridScroll("PAGE UP"); } else if ((UI.CsmButton)sender == btnUp) { grdSearchList.CsmGridScroll("UP"); } else if ((UI.CsmButton)sender == btnDw) { grdSearchList.CsmGridScroll("DOWN"); } else if ((UI.CsmButton)sender == btnDw2) { grdSearchList.CsmGridScroll("PAGE DOWN"); } else if (((Cosmos.UI.CsmButton)sender) == btnSearch1) // 본사 { txtPrtData.ReadOnly = true; sRet = ExSelect("01"); bNotDoubleClik = false; if (sRet != UserCom.RST_OK) return; } else if (((Cosmos.UI.CsmButton)sender) == btnSearch2) // 식품안전 { txtPrtData.ReadOnly = true; sRet = ExSelect("02"); bNotDoubleClik = false; if (sRet != UserCom.RST_OK) return; } else if (((Cosmos.UI.CsmButton)sender) == btnSearch3) // 점포 { txtPrtData.ReadOnly = false; sRet = ExSelect("03"); bNotDoubleClik = false; if (sRet != UserCom.RST_OK) return; } else if (((Cosmos.UI.CsmButton)sender) == btnPrint) // 출력 { sRet = ExPrint(); bNotDoubleClik = false; if (sRet != UserCom.RST_OK) 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); bNotDoubleClik = false; } bNotDoubleClik = false; } /// /// 닫기 /// /// /// 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 텍스트박스 키 입력 이벤트 처리 /// /// 텍스트박스 키 입력 이벤트 처리 /// /// /// private void txtEditBox_EditBoxKeyDownEvent(object sender, string sFuncValue) { try { if (sFuncValue == PosKey.MENU_KEY.ENTER) { } else if (sFuncValue == PosKey.MENU_KEY.CLEAR) { } 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); } } /// /// 텍스트박스 활성화 처리 /// /// /// private void txtEditBox_EnterEvent(object sender, EventArgs e) { } #endregion #region 텍스트박스 입력 유효성 체크 /// /// 텍스트박스 입력 유효성 체크 /// /// /// private bool CheckTxtInPut(object sender) { try { //if (sender == null || ((Cosmos.UI.CsmPosEditBox)sender) == txtCardNo) //{ // WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0189); // 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 조회 처리 /// /// 조회 처리 /// /// private string ExSelect(string sSearchMode) { string sRet = UserCom.RST_ERR; string sTitle = ""; try { DataTable dtData = null; m_dtSearchList.Clear(); txtPrtData.Text = ""; txtPrtData.Tag = ""; // 조회선택구분 m_sSearchDiv = (CmUtil.IntParse(sSearchMode) + 50).ToString(); // 타이틀 btnSearch1.BackColor = Color.FromArgb(101, 115, 126); btnSearch2.BackColor = Color.FromArgb(101, 115, 126); btnSearch3.BackColor = Color.FromArgb(101, 115, 126); if (m_sSearchDiv == "51") { btnSearch1.BackColor = Color.FromArgb(22, 187, 238); sTitle = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0541); // 본사 } else if (m_sSearchDiv == "52") { btnSearch2.BackColor = Color.FromArgb(22, 187, 238); sTitle = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0542); // 식품안전 } else if (m_sSearchDiv == "53") { btnSearch3.BackColor = Color.FromArgb(22, 187, 238); sTitle = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0989); // 점포 } lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0540) + " (" + sTitle + ")"; // 조회 dtData = m_cDataSearch.SelectBusiNotice(new string[] { sSearchMode }); if (dtData != null && dtData.Rows.Count > 0) { foreach (DataRow dr in dtData.Rows) { DataRow drNewRow = m_dtSearchList.NewRow(); drNewRow["CODE"] = CmUtil.GetDataRowStr(dr, "CODE"); drNewRow["START_DT"] = string.Format("{0:0000/00/00}", m_cDataService.DoubleParse(CmUtil.GetDataRowStr(dr, "START_DT"))); drNewRow["END_DT"] = string.Format("{0:0000/00/00}", m_cDataService.DoubleParse(CmUtil.GetDataRowStr(dr, "END_DT"))); drNewRow["MSG"] = CmUtil.GetDataRowStr(dr, "MSG"); drNewRow["MSG_TITLE"] = CmUtil.GetDataRowStr(dr, "MSG_TITLE"); m_dtSearchList.Rows.Add(drNewRow); } } else { //WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0302); } //그리드 적용 grdSearchList.CsmGridDataSource = m_dtSearchList; grdSearchList.CsmGridIndicateForeColor = Color.Red; grdSearchItem_GridClickEvent(null, "0"); grdSearchList.CsmGridSelectRow(0); if (dtData != null && dtData.Rows.Count > 0) { // 상태 전송 sRet = m_cSvr2Tran.PGMUpdate_Complete(m_sSearchDiv, "01", "", "", m_cPosStatus.Base.CashierNo, "", DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("HHmmss")); } 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 출력 처리 /// /// 출력 처리 /// /// private string ExPrint() { string sRet = UserCom.RST_ERR; try { ArrayList aPrintData = new ArrayList(); // 상단 이미지 출력 if (PosMstManager.GetPosOption(POS_OPTION.OPT409) != "0") AddPrintData(PosConst.PRT_HDR.PRT_TBM, PosConst.PRT_FMT.F100, new string[] { "" }, ref aPrintData); // 상단 문구 출력 AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, new string[] { MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0160) + m_cPosStatus.Mst.StorName }, ref aPrintData); AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, new string[] { MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0161) + m_cPosStatus.Mst.StorAddr }, ref aPrintData); AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, new string[] { MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0162) + m_cPosStatus.Mst.StorOwnName }, ref aPrintData); AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, new string[] { MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0163) + m_cPosStatus.Mst.StorBizPsnNo + " (" + m_cPosStatus.Mst.StorTelNo + ")" }, ref aPrintData); AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, new string[] { MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0164) + CmUtil.MidH(m_cPosStatus.Base.CashierName, 0, 12) + " POS NO:" + m_cPosStatus.Base.PosNo }, ref aPrintData); AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, new string[] { MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0165) + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") }, ref aPrintData); //AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, new string[] { "-" }, ref aPrintData); // 공지사항 출력 if (m_sSearchDiv == "53") { // 점포 m_sPrintData = new ArrayList(); string sPrtData = txtPrtData.Text; if (sPrtData.Trim() == "") return sRet; string[] aPrtData = sPrtData.Split(new string[] { PosConst.CRLF }, StringSplitOptions.None); AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, new string[] { "=" }, ref m_sPrintData); AddPrintData(PosConst.PRT_HDR.PRT_VER, PosConst.PRT_FMT.F103, new string[] { MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0989) }, ref m_sPrintData); AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, new string[] { "=" }, ref m_sPrintData); for (int iLoop = 0; iLoop < aPrtData.Length; iLoop++) { // 데이터 AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, new string[] { aPrtData[iLoop] }, ref m_sPrintData); } } if (m_sPrintData.Count <= 0) return sRet; aPrintData.AddRange(m_sPrintData); // 하단 이미지 출력 if (PosMstManager.GetPosOption(POS_OPTION.OPT410) != "0") AddPrintData(PosConst.PRT_HDR.PRT_BBM, PosConst.PRT_FMT.F100, new string[] { "" }, ref aPrintData); // cut AddPrintData(PosConst.PRT_HDR.PRT_CUT, PosConst.PRT_FMT.F100, new string[] { " " }, ref aPrintData); if (aPrintData.Count == 0) return sRet; bool bReturn = m_cDataSearch.PosDataPrint(aPrintData); if (bReturn == true) { // 상태 전송 sRet = m_cSvr2Tran.PGMUpdate_Complete(m_sSearchDiv, "02", "", "", m_cPosStatus.Base.CashierNo, "", DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("HHmmss")); 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 영수증 출력데이터 생성 /// /// 영수증 출력데이터 생성 /// /// 출력형태 /// 출력포맷 /// Data private void AddPrintData(string sPrtHead, string sPrtFmt, string[] aData, ref ArrayList aPrintData) { try { string sPrtData = ""; if (sPrtFmt == PosConst.PRT_FMT.F100) // 선귿기 { for (int i = 1; i <= 42; i++) sPrtData += aData[0]; } else if (sPrtFmt == PosConst.PRT_FMT.F101) // 왼쪽정렬 { sPrtData = aData[0]; } else if (sPrtFmt == PosConst.PRT_FMT.F102) // 오른쪽 정렬 { sPrtData = CmUtil.LPadH(aData[0], 42); } else if (sPrtFmt == PosConst.PRT_FMT.F103) // 중앙정렬 { if (sPrtHead == PosConst.PRT_HDR.PRT_HOR || sPrtHead == PosConst.PRT_HDR.PRT_BIG) { if (CmUtil.LenH(aData[0]) <= 21) sPrtData = CmUtil.LPadH("", 10 - (CmUtil.LenH(aData[0]) / 2)) + aData[0]; } else { if (CmUtil.LenH(aData[0]) <= 42) sPrtData = CmUtil.LPadH("", 21 - (CmUtil.LenH(aData[0]) / 2)) + aData[0]; } } else { switch (aData.Length) { case 5: sPrtData = CmUtil.RPadH(aData[0].ToString(), 10) + CmUtil.RPadH(aData[1].ToString(), 12) + CmUtil.LPadH(aData[2].ToString(), 6) + CmUtil.LPadH(aData[3].ToString(), 10) + CmUtil.LPadH(aData[4].ToString(), 4); break; case 4: sPrtData = CmUtil.RPadH(aData[0].ToString(), 12) + CmUtil.RPadH(aData[1].ToString(), 12) + CmUtil.LPadH(aData[2].ToString(), 7) + CmUtil.LPadH(aData[3].ToString(), 11); break; case 3: sPrtData = CmUtil.RPadH(aData[0].ToString(), 23) + CmUtil.LPadH(aData[1].ToString(), 7) + CmUtil.LPadH(aData[2].ToString(), 11); break; default: sPrtData = aData[0].ToString(); break; } } aPrintData.Add(sPrtHead + sPrtData); } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, // Project Name (프로젝트명) System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + // Class Name (Class Name (클래스명)) System.Reflection.MethodBase.GetCurrentMethod().Name + "()", // Function Name (Function Name (함수명)) ex.Message); } } #endregion #region DeviceEvent 관련 /// /// DeviceEvent 관련 /// /// /// /// /// 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); } } /// /// MSR Event /// /// /// private void OnMSREvent(object source, EventArgs e) { } /// /// 스캐너 이벤트 처리 /// /// /// private void OnScannerEvent(object source, EventArgs e) { string sScanData = m_cDevStatus.Scanner.DataLabel; if (sScanData.Length > 0 && m_sInPutData == "") { m_sInPutType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_BARCODE; m_sInPutData = sScanData; //txtCardNo.Text = m_sInPutData; /// if (m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.NORMAL) SearchTxtInPut(); } } /// /// 카드 번호 암호화 /// /// /// /// /// 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; } /// /// IC 카드 정보 입력 처리 /// /// 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 void InitializeGrid() { try { grdSearchList.CsmGridColumnHeadersVisible = true; //DataGridView 자체의 컬럼 헤더 Visible 여부 grdSearchList.CsmGridColumnHeadersFont = new Font(m_cPosStatus.Base.FONT, 12); grdSearchList.CsmGridColumnCount = 5; //그리드의 컬럼수 grdSearchList.CsmGridSetHeaderBackColor(236, 238, 239); //그리드 헤더 배경색 grdSearchList.CsmGridDefaultRowBackColor = Color.FromArgb(255, 255, 255); //그리드 홀수(Default)행의 배경색 지정 grdSearchList.CsmGridAlternateRowBackColor = Color.FromArgb(251, 253, 255); //그리드 짝수(Alternate)행의 배경색 지정 grdSearchList.CsmGridBackGroundColor = Color.FromArgb(251, 253, 255); //기본 백그라운드 컬러 grdSearchList.CsmGridHighlightColor = Color.FromArgb(255, 251, 211); //그리드 선택 백 컬러 grdSearchList.CsmGridHighlightTextColor = Color.Black; //그리드 선택 글자 컬러 grdSearchList.CsmGridAlignment(new int[] { 1, 1, 1, 0, 0 }); //컬럼 정렬 0:왼쪽, 1:가운데, 2:오른쪽 grdSearchList.CsmGridSetSortMode(new int[] { 1, 1, 1, 1, 1 }); if (m_cPosStatus.Sale.ScreenSizeUser == 1024) { grdSearchList.CsmGridColumnHeadersHeight = 39; //DataGridView 자체의 컬럼 헤더 높이 grdSearchList.CsmGridRowsHeight = 37; grdSearchList.CsmGridShowPageRowsCount = 14; //그리드의 한 화면에 보이는 로우수 grdSearchList.CsmGridSetColumnWidth(new int[] { 0, 130, 130, 0, 346 }); //컬럼넓이 지정 (606) } else { grdSearchList.CsmGridColumnHeadersHeight = 37; //DataGridView 자체의 컬럼 헤더 높이 grdSearchList.CsmGridRowsHeight = 38; grdSearchList.CsmGridShowPageRowsCount = 11; //그리드의 한 화면에 보이는 로우수 grdSearchList.CsmGridSetColumnWidth(new int[] { 0, 95, 95, 0, 180 }); //컬럼넓이 지정 (370) } //각 컬럼별 이름 지정(영업일자,POS번호,판매금액,거래번호,거래시간,거래구분,) grdSearchList.CsmGridColumnName(0, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0522)); grdSearchList.CsmGridColumnName(1, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0141)); grdSearchList.CsmGridColumnName(2, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0142)); grdSearchList.CsmGridColumnName(3, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0540)); grdSearchList.CsmGridColumnName(4, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0540)); //그리드 초기화 테이블 m_dtSearchList = new DataTable("INIT"); m_dtSearchList.Columns.Add(new DataColumn("CODE", typeof(string))); m_dtSearchList.Columns.Add(new DataColumn("START_DT", typeof(string))); m_dtSearchList.Columns.Add(new DataColumn("END_DT", typeof(string))); m_dtSearchList.Columns.Add(new DataColumn("MSG", typeof(string))); m_dtSearchList.Columns.Add(new DataColumn("MSG_TITLE", typeof(string))); m_dtSearchList.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); } } #endregion #region 그리드 클릭 이벤트 /// /// 그리드 클릭 이벤트 /// /// /// private void grdSearchItem_GridClickEvent(object sender, string rowIndex) { DataTable dtData = new DataTable(); string sDate = ""; string sTitle = ""; string sDate2 = ""; string sTitle2 = ""; try { txtPrtData.Text = ""; txtPrtData.Tag = ""; if (grdSearchList.CsmGridRowsCount == 0) return; int nRow = grdSearchList.CsmGridSelectedRowIndex; if (nRow < 0) return; string sNotice = grdSearchList.CsmGridGetCell(nRow, 3); if (sNotice.Length <= 0) return; string[] aRecvData = sNotice.Split(new string[] { "#~" }, StringSplitOptions.None); m_sPrintData = new ArrayList(); // 타이틀 AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, new string[] { "=" }, ref m_sPrintData); AddPrintData(PosConst.PRT_HDR.PRT_VER, PosConst.PRT_FMT.F103, new string[] { grdSearchList.CsmGridGetCell(nRow, 4) }, ref m_sPrintData); AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, new string[] { "=" }, ref m_sPrintData); AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, new string[] { "" }, ref m_sPrintData); // 시작일 sDate = grdSearchList.CsmGridGetCell(nRow, 1); sTitle = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0141); // 종료일 sDate2 = grdSearchList.CsmGridGetCell(nRow, 2); sTitle2 = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0142); AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, new string[] { sTitle + ":" + sDate + " ~ " + sTitle2 + ":" + sDate2 }, ref m_sPrintData); AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, new string[] { "" }, ref m_sPrintData); // 분해 for (int iLoop = 0; iLoop < aRecvData.Length; iLoop++) { // 데이터 AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F101, new string[] { aRecvData[iLoop] }, ref m_sPrintData); } AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, new string[] { " " }, ref m_sPrintData); //AddPrintData(PosConst.PRT_HDR.PRT_CUT, PosConst.PRT_FMT.F100, new string[] { " " }, ref m_sPrintData); // 화면에 표시 txtPrtData.Text = ""; for (int nLoop = 0; nLoop < m_sPrintData.Count; nLoop++) { txtPrtData.AppendText(CmUtil.MidH(m_sPrintData[nLoop].ToString(), 5, CmUtil.LenH(m_sPrintData[nLoop].ToString())).ToString() + PosConst.CRLF); } txtPrtData.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); } } #endregion } }