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; /*-----------------------------------------------------------------------------------------------*/ // 설 명 : 마감/중간마감 // 작 성 자 : // 변경 이력 : /*-----------------------------------------------------------------------------------------------*/ //************************************************************************************************ // 변경이력 : 마감화면에 [환전] 버튼 추가 //------------------------------------------------------------------------------------------------ // - 작 업 자 : 서광원B // - 작업일자 : 2017.11.08 // - 작업분류 : 2017-10-17 POS제안 판매 마감화면 // - 요청사항 : 마감화면에 [환전] 버튼 추가 // - 작업내용 : 기존의 마감화면에 환전 버튼(btnExchange)을 추가하고 // 버튼 클릭시 돈통을 연다. //************************************************************************************************ namespace Cosmos.Win { public partial class frmAccADMT : 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 IAccADMT m_cAccADMT = null; private ISaleCompleteUs m_cSaleComplete = null; private IDataServiceUs m_cSaleOpen = null; // 개점/마감 서비스 private IDataSearch m_cDataSearch = null; private IDatabaseSQL m_cSqlDbService = null; private IServiceUs m_cPosConfig = 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; // 입력코드 /// /// 할인 구분 /// public string SetPosMenuKey { set { this.m_sPosMenuKey = value; } } private string m_sTranKind; // 거래종별 /// /// 거래종별 /// public string SetTranKind { set { this.m_sTranKind = value; } } private string m_sTradeDiv; // 판매구분 /// /// 판매구분 /// public string SetTradeDiv { set { this.m_sTradeDiv = value; } } /// /// 입력구분 /// private string m_sInPutType = ""; /// /// 입력데이터 /// private string m_sInPutData = ""; /// /// 카드데이터 /// private string m_sInEncData = ""; private ArrayList m_sPrintData; private bool bSearchMode = false; private ArrayList m_alAccData = new ArrayList(); #endregion 변수 선언 #region 생성자 & 소멸자 & 폼초기화 public frmAccADMT() { 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_cAccADMT = (IAccADMT)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.ACC_ADMT); m_cSaleComplete = (ISaleCompleteUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.SALE_COMPLETE); m_cSaleOpen = (IDataServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.SALE_OPEN); m_cDataSearch = (IDataSearch)sManager.InitServiceInstance(ServiceLists.BSV_ADMIN.DLL, ServiceLists.BSV_ADMIN.DATASEARCH); m_cSqlDbService = (IDatabaseSQL)sManager.InitServiceInstance(ServiceLists.AGENT_DATABASE.DLL, ServiceLists.AGENT_DATABASE.DATABASE_MSSQL); m_cPosConfig = (IServiceUs)sManager.InitServiceInstance(ServiceLists.BSV_ADMIN.DLL, ServiceLists.BSV_ADMIN.POS_CONFIG); } private void frmAccADMT_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 frmAccADMT_Activated(object sender, EventArgs e) { //#20181026 #17412 PAS 대왕암공원 - 매출자료조회 frmADMT 오류창 팝업 start UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ""); //#20181026 #17412 PAS 대왕암공원 - 매출자료조회 frmADMT 오류창 팝업 end } private void frmAccADMT_Deactivate(object sender, EventArgs e) { //#20181026 #17412 PAS 대왕암공원 - 매출자료조회 frmADMT 오류창 팝업 start UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ""); //#20181026 #17412 PAS 대왕암공원 - 매출자료조회 frmADMT 오류창 팝업 end //PosOLEDevice.SetEventHandle(null); } private void frmAccADMT_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 { // 이미지 로딩 처리 picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_FULL_SIZE); this.Size = new Size(1024, 696); this.Location = new Point(0, 50); 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); txtPrtData.Font = new Font(m_cPosStatus.Base.FONT_FIX, txtPrtData.Font.Size, txtPrtData.Font.Style); vScrollbar.Attach(txtPrtData); //버튼이미지 적용 btnAllUp1.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_14X9_UP2_BASIC); btnAllUp1.ImageAlign = ContentAlignment.MiddleCenter; btnAllUp1.BorderStyle = BorderStyle.None; btnAllDw1.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_14X9_DOWN2_BASIC); btnAllDw1.ImageAlign = ContentAlignment.MiddleCenter; btnAllDw1.BorderStyle = BorderStyle.None; if (btnAllUp1.Image != null) btnAllUp1.Text = ""; if (btnAllDw1.Image != null) btnAllDw1.Text = ""; //버튼이미지 적용 btnAllUp2.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_14X9_UP2_BASIC); btnAllUp2.ImageAlign = ContentAlignment.MiddleCenter; btnAllUp2.BorderStyle = BorderStyle.None; btnAllDw2.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_14X9_DOWN2_BASIC); btnAllDw2.ImageAlign = ContentAlignment.MiddleCenter; btnAllDw2.BorderStyle = BorderStyle.None; if (btnAllUp2.Image != null) btnAllUp2.Text = ""; if (btnAllDw2.Image != null) btnAllDw2.Text = ""; btnExit.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BTN_CLOSE); if (btnExit.Image != null) btnExit.Text = ""; // 타이틀 m_sPosMenuKey == PosKey.MENU_KEY.SALE_CLOSE lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0503); lblTitle1.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0552); lblTitle2.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0384); lblSaleDate.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0242); lblUserNM.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0485); lblADMTAmount.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0556); lblOverCash.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0557); lblOverGift.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0558); ckbSimple.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0881); btnSelect.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0488); // 정산조회 btnPrint.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0257); // 출력 btnEnter.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0088); // 중간정산 btnComplete.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0503); // 업무마감 #region (2017.11.08) 마감화면에 환전 버튼 추가를 위한 버튼 설정 btnExchange.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1070); // 환전 btnExchange.Visible = true; #endregion txtSaleDate.Text = m_cPosStatus.Global.DateToCulture(m_cPosStatus.Base.SaleDate); txtUserNM.Text = m_cPosStatus.Base.CashierName; txtADMTAmount.Text = m_cPosStatus.Global.NumericTOCurrency(0); txtOverCash.Text = m_cPosStatus.Global.NumericTOCurrency(0); txtOverCash.Tag = "0"; txtOverGift.Text = m_cPosStatus.Global.NumericTOCurrency(0); txtOverGift.Tag = "0"; txtPrtData.Text = ""; m_sPrintData = new ArrayList(); // 시재입금 dgvinPay.Visible = true; btnAllUp1.Visible = true; btnAllDw1.Visible = true; // 결제내역 lblTitle2.Visible = true; dgvTender.Visible = true; btnAllUp2.Visible = true; btnAllDw2.Visible = true; label11.Visible = true; // 시재금총액 label4.Visible = true; label6.Visible = true; lblADMTAmount.Visible = true; txtADMTAmount.Visible = true; // 정산내역 vScrollbar.Visible = false; txtPrtData.Visible = false; txtPrtData.Location = new Point(108, 90); vScrollbar.Location = new Point(554, 105); lblTitle1.Location = new Point(10, 67); lblTitle2.Location = new Point(340, 67); bSearchMode = false; bNotDoubleClik = false; btnEnter.Visible = false; lblMidCloseSeq.Visible = false; // 중간정산 옵션값변경(2017.06.14) => 중간점검 사용 여부 (0:사용안함, 1: 사용함, 2:사용함[차수별]) if (PosMstManager.GetPosOption(POS_OPTION.OPT321) == "1" || PosMstManager.GetPosOption(POS_OPTION.OPT321) == "2") { lblMidCloseSeq.Visible = true; btnEnter.Visible = true; } dgvinPay.Rows.Clear(); dgvTender.Rows.Clear(); //테마색상 적용! if (m_cPosStatus.ScnMst.ThemeColor.Trim() != "") padInPut.ThemeColor = m_cPosStatus.ScnMst.ThemeColor; padInPut.ClearBtnText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0817); padInPut.SearchBtnText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1018); timer1.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 { WinManager.HideSearchMessage(this); } } #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 == btnAllUp1) // 좌측 그리드 Up { if (dgvinPay.Rows.Count == 0) { bNotDoubleClik = false; return; } if (dgvinPay.CurrentRow.Index > 0) { for (int iLoop = dgvinPay.CurrentRow.Index - 1; iLoop >= 0; iLoop--) { if (dgvinPay.Rows[iLoop].Visible == false) continue; dgvinPay.Rows[iLoop].Selected = true; dgvinPay.Rows[iLoop].Cells[dgvinPay.CurrentCell.ColumnIndex].Selected = true; break; } } } else if ((UI.CsmButton)sender == btnAllDw1) // 좌측 그리드 Down { if (dgvinPay.Rows.Count == 0) { bNotDoubleClik = false; return; } if (dgvinPay.CurrentRow.Index < dgvinPay.Rows.Count - 1) { for (int iLoop = dgvinPay.CurrentRow.Index + 1; iLoop <= dgvinPay.Rows.Count - 1; iLoop++) { if (dgvinPay.Rows[iLoop].Visible == false) continue; dgvinPay.Rows[iLoop].Selected = true; dgvinPay.Rows[iLoop].Cells[dgvinPay.CurrentCell.ColumnIndex].Selected = true; break; } } } else if ((UI.CsmButton)sender == btnAllUp2) // 우측 그리드 Up { if (dgvTender.Rows.Count == 0) { bNotDoubleClik = false; return; } if (dgvTender.CurrentRow.Index > 0) { for (int iLoop = dgvTender.CurrentRow.Index - 1; iLoop >= 0; iLoop--) { if (dgvTender.Rows[iLoop].Visible == false) continue; dgvTender.Rows[iLoop].Selected = true; dgvTender.Rows[iLoop].Cells[dgvTender.CurrentCell.ColumnIndex].Selected = true; break; } } } else if ((UI.CsmButton)sender == btnAllDw2) // 우측 그리드 Down { if (dgvTender.Rows.Count == 0) { bNotDoubleClik = false; return; } if (dgvTender.CurrentRow.Index < dgvTender.Rows.Count - 1) { for (int iLoop = dgvTender.CurrentRow.Index + 1; iLoop <= dgvTender.Rows.Count - 1; iLoop++) { if (dgvTender.Rows[iLoop].Visible == false) continue; dgvTender.Rows[iLoop].Selected = true; dgvTender.Rows[iLoop].Cells[dgvTender.CurrentCell.ColumnIndex].Selected = true; break; } } } else if (((Cosmos.UI.CsmButton)sender) == btnSelect) // 정산조회 { // 정산 조회 sRet = SelectADMT(); bNotDoubleClik = false; if (sRet != UserCom.RST_OK) return; } else if (((Cosmos.UI.CsmButton)sender) == btnComplete) // 업무마감 { UpdateCurrentCellValue(); // 업무마감 sRet = CompleteTxtInPut(ItemConst.TRAN_KIND.STATEMENT.ADJUSTMENT, (ckbSimple.Checked == true ? "1" : "0")); bNotDoubleClik = false; if (sRet != UserCom.RST_OK) return; SetBackupDatabase(); //디비백업! SetConfigToServer(); //환경설정파일백업! //#20181016 업무마감(일마감) 후 포스종료하기 start if (CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT558), "0") == "1") { m_cPosStatus.Sale.SysShutDown = PosConst.SYS_SHUTDOWN.PGMQUIT; } //#20181016 업무마감(일마감) 후 포스종료하기 end this.DialogResult = DialogResult.OK; this.Close(); return; } else if (((Cosmos.UI.CsmButton)sender) == btnEnter) // 중간마감 { UpdateCurrentCellValue(); // 중간마감 sRet = CompleteTxtInPut(ItemConst.TRAN_KIND.STATEMENT.MIDDLE_ADJUSTMENT, (ckbSimple.Checked == true ? "1" : "0")); bNotDoubleClik = false; if (sRet != UserCom.RST_OK) return; // 중간정산 횟수 조회 //DataTable dtData = m_cAccADMT.GetADMTCount(new string[] { "" }); //if (dtData != null && dtData.Rows.Count != 0) //{ // foreach (DataRow dr in dtData.Rows) // { // lblTitle3.Text = string.Format(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0554), m_cPosStatus.Global.NumericTOCurrency(m_cDataService.DoubleParse(dr["QTY"].ToString()))); // } //} DataGridSetting(0); // 그리드 초기화 } else if (((Cosmos.UI.CsmButton)sender) == btnPrint) // 출력 { if (PosMstManager.GetPosOption(POS_OPTION.OPT321) == "0" || m_cPosStatus.Base.OpenClose == "0") m_cTrnStatus.Head.TradeKind = ItemConst.TRAN_KIND.STATEMENT.ADJUSTMENT; else m_cTrnStatus.Head.TradeKind = ItemConst.TRAN_KIND.STATEMENT.MIDDLE_ADJUSTMENT; m_cTrnStatus.Head.TradeDiv = m_sTradeDiv; // 영수증 출력 데이터 생성 sRet = m_cSaleComplete.ExecuteADMTReceipt(new string[] { (ckbSimple.Checked == true ? "1" : "0") }); if (sRet != UserCom.RST_OK) { UserLog.WriteLogFile(UserCom.LOG_ERROR, UserCom.WARNING_LEVEL, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "() MakePrt.", sRet); } } 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); bNotDoubleClik = false; } bNotDoubleClik = false; } /// /// 닫기 /// /// /// private void btnExit_Click(object sender, EventArgs e) { try { // 이전 입력 데이터 저장 처리(2017.06.14) m_alAccData.Clear(); for(int i = 0 ; i < dgvinPay.RowCount; i++) { m_alAccData.Add(new string[]{dgvinPay.Rows[i].Cells[3].Value.ToString(), dgvinPay.Rows[i].Cells[1].Value.ToString(), dgvinPay.Rows[i].Cells[2].Value.ToString()}); } 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); } } #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) { 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 텍스트박스 입력 유효성 체크 /// /// 텍스트박스 입력 유효성 체크 /// /// /// 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 CompleteTxtInPut(string sKind, string sSimplePrint) { //#13559 PB 노은휴먼시아_마감에 간편출력체크하지않은 마감건도 동일하게 출력되는 증상에 대해 원인 및 확인 요청 start, phj UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "[CompleteTxtInPut] Kind : " + sKind + " , " + "Simple print :" + sSimplePrint); //#13559 PB 노은휴먼시아_마감에 간편출력체크하지않은 마감건도 동일하게 출력되는 증상에 대해 원인 및 확인 요청 end, phj string sRet = UserCom.RST_ERR; try { m_sTranKind = sKind; if (m_sTranKind == ItemConst.TRAN_KIND.STATEMENT.ADJUSTMENT) { // 업무마감 if (m_sTradeDiv == ItemConst.TRAN_DIV.NORMAL && m_cPosStatus.Base.OpenClose == "0") { // 이미 마감 처리 되어 있으면 Skip WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0319)); return sRet; } else if (m_sTradeDiv == ItemConst.TRAN_DIV.REFUND && m_cPosStatus.Base.OpenClose == "1") { // 이미 마감취소 처리 되어 있으면 Skip WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0320)); return sRet; } // Add, 2017.03.16, 후불 메인포스 업무마감(폐점) 조건 확인 if (m_sTradeDiv == ItemConst.TRAN_DIV.NORMAL) { if (m_cPosStatus.Base.PosType == PosConst.POS_TYPE.DEFERRED_PAYMENT && m_cPosStatus.Base.PosCommunicationType == PosConst.MAIN_POS_DIV.MAIN_POS) { var tableSvr = (ITableUs)sManager.InitServiceInstance(ServiceLists.BSV_TABLE.DLL, ServiceLists.BSV_TABLE.TABLE_SERVICE); var cnt = tableSvr.GetOrderDataCount(); if (cnt > 0) { var msg = string.Format(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0670), cnt); if (WinManager.QuestionMessage(msg) == false) return sRet; } } } } else if (m_cPosStatus.Base.OpenClose == "0") { // 이미 마감 처리 되어 있으면 Skip WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0319)); return sRet; } if (sKind == ItemConst.TRAN_KIND.STATEMENT.MIDDLE_ADJUSTMENT) { if (WinManager.QuestionMessage(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0724)) != true) { bNotDoubleClik = false; return sRet; } } else if (sKind == ItemConst.TRAN_KIND.STATEMENT.ADJUSTMENT) { if (WinManager.QuestionMessage(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0725)) != true) { bNotDoubleClik = false; return sRet; } } // 입금저장 DataTable dtData = new DataTable(); dtData.Columns.Add(new DataColumn("DPST_WTHDR_CD", typeof(string))); dtData.Columns.Add(new DataColumn("DPST_WTHDR_QTY", typeof(string))); dtData.Columns.Add(new DataColumn("DPST_WTHDR_AMT", typeof(string))); dtData.Columns.Add(new DataColumn("DPST_WTHDR_NM", typeof(string))); // 시재입금 for (int iLoop = 0; iLoop < dgvinPay.RowCount; iLoop++) { DataRow dr = dtData.NewRow(); dr["DPST_WTHDR_CD"] = dgvinPay.Rows[iLoop].Cells[3].Value.ToString(); dr["DPST_WTHDR_NM"] = dgvinPay.Rows[iLoop].Cells[0].Value.ToString(); //dr["DPST_WTHDR_QTY"] = CmUtil.IntParse(dgvinPay.Rows[iLoop].Cells[1].EditedFormattedValue.ToString()); dr["DPST_WTHDR_QTY"] = m_cDataService.LongParse(dgvinPay.Rows[iLoop].Cells[1].EditedFormattedValue.ToString()); dr["DPST_WTHDR_AMT"] = m_cDataService.DoubleParse(dgvinPay.Rows[iLoop].Cells[2].EditedFormattedValue.ToString()); dtData.Rows.Add(dr); } // 영업마감인 경우 차수 99로 설정 // 중간마감인 경우 최종 차수로 설정 if (m_sTranKind == ItemConst.TRAN_KIND.STATEMENT.ADJUSTMENT) { m_cPosStatus.Base.MidCloseSeq = "99"; } else { // 최종 중간마감 차수 로딩 string sQuery = ""; sQuery = " SELECT ISNULL(MAX(MID_CLOSE_SEQ),'0') MID_CLOSE_SEQ FROM POSLOG..TR_SALE_HEADER "; sQuery += " WHERE CMP_CD = '" + m_cPosStatus.Base.CmpCd + "' "; sQuery += " AND STOR_CD = '" + m_cPosStatus.Base.StoreNo + "' "; sQuery += " AND SALE_DT = '" + m_cPosStatus.Base.SaleDate + "' "; sQuery += " AND POS_NO = '" + m_cPosStatus.Base.PosNo + "' "; sQuery += " AND TRADE_KINDPER = '" + ItemConst.TRAN_KIND.STATEMENT.MIDDLE_ADJUSTMENT + "' "; sQuery += " AND ISNULL(MID_CLOSE_SEQ, '0') <> '99' "; IMasterUs m_cMstService = (IMasterUs)sManager.InitServiceInstance(ServiceLists.ASV_MASTER.DLL, ServiceLists.ASV_MASTER.POS_MASTER); DataTable dtMidCloseSeqInfo = m_cMstService.Select(new string[] { sQuery }); if (dtMidCloseSeqInfo != null && dtMidCloseSeqInfo.Rows.Count > 0) { DataRow dr = dtMidCloseSeqInfo.Rows[0]; int nMidCloseSeq = (int)CmUtil.LongParse(CmUtil.GetDataRowStr(dr, "MID_CLOSE_SEQ")); m_cPosStatus.Base.MidCloseSeq = string.Format("{0:00}", nMidCloseSeq + 1); } CmMessage m_PosSaleInfo = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo); m_PosSaleInfo.GetMessage("MSGNO").MakeMessageOverWrite("MidCloseSeq", m_cPosStatus.Base.MidCloseSeq.ToString()); m_PosSaleInfo.MakeFileFromMessage(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo); } // 마감시재 sRet = m_cAccADMT.SetData(new string[] { ItemConst.TRAN_KIND.STATEMENT.CLOSING_MONEY, m_sTradeDiv }, dtData, sSimplePrint); if (sRet != UserCom.RST_OK) WinManager.ErrorMessage(sRet); // 정산 WinManager.ShowSearchMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0361), this); sRet = m_cAccADMT.SetData(new string[] { m_sTranKind, m_sTradeDiv }, dtData, sSimplePrint); if (sRet == UserCom.RST_OK) { if (m_sTranKind == ItemConst.TRAN_KIND.STATEMENT.ADJUSTMENT) { // 폐점정보 생성 sRet = m_cAccADMT.SetData(new string[] { ItemConst.TRAN_KIND.LOG.POS_CLOSE, m_sTradeDiv }, null, sSimplePrint); if (sRet == UserCom.RST_OK) { if (m_sTradeDiv == ItemConst.TRAN_DIV.REFUND) { // 정산취소 WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0317)); m_cPosStatus.Base.OpenClose = "1"; } else { // 마감시간 저장 m_cPosStatus.Base.CloseDateTime = DateTime.Now.ToString("yyyyMMddHHmmss"); // 정산 //ReTry: //sRet = m_cSaleOpen.Execute(new string[] { m_cPosStatus.Base.SaleDate, m_cPosStatus.Base.CashierNo, "9" }); //if (sRet != UserCom.RST_OK) //{ // // 영업마감 요청 통신에 실패하였습니다. 재시도 하시겠습니까? // if (WinManager.QuestionMessage(sRet + "\r\n" + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0318)) != true) // { // if (WinManager.QuestionMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0397)) == true) // { // goto Skip_Next; // } // return sRet; // } // goto ReTry; //} //Skip_Next: //if (m_cPosStatus.Base.ExPos == "1") if (m_cPosStatus.Mst.ETC_IF_DIV == ItemConst.TranInterfaceOutside.IF_KOR_01) { // 고속도로 휴게소 입점 POS ICalDataIF cCalDataIF = (ICalDataIF)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.CAL_DATA_IF); cCalDataIF.Execute(new string[] { "EX", m_cPosStatus.Base.SaleDate }); } else if (m_cPosStatus.Mst.ETC_IF_DIV == ItemConst.TranInterfaceOutside.IF_KOR_02) //else if (m_cPosStatus.Base.KacPos == "1") { // 한국공항공사 관리 공항 입점 POS ICalDataIF cCalDataIF = (ICalDataIF)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.CAL_DATA_IF); cCalDataIF.Execute(new string[] { "KAC", m_cPosStatus.Base.SaleDate }); } //#20180322 휴게소pos매출연동 start,phj else if (m_cPosStatus.Mst.ETC_IF_DIV == ItemConst.TranInterfaceOutside.IF_KOR_03) { //고속도로 휴게소 입점 POS (2018) ICalDataIF cCalDataIF = (ICalDataIF)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.CAL_DATA_IF); cCalDataIF.Execute(new string[] { "EX2018", m_cPosStatus.Base.SaleDate }); } //#20180322 휴게소pos매출연동 end,phj WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0316)); m_cPosStatus.Base.OpenClose = "0"; } CmMessage m_PosSal = CmMessage.MakeMessageFromFile(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo); m_PosSal.GetMessage("POSOPEN").MakeMessageOverWrite("OpenClose", m_cPosStatus.Base.OpenClose); m_PosSal.GetMessage("POSOPEN").MakeMessageOverWrite("CloseDateTime", m_cPosStatus.Base.CloseDateTime); m_PosSal.MakeFileFromMessage(BaseCom.NxIniPath + PosConst.INI_FILE_NAME.PosSaleInfo); sRet = UserCom.RST_OK; } else { WinManager.ErrorMessage(sRet); } } else if (sKind != ItemConst.TRAN_KIND.STATEMENT.MIDDLE_ADJUSTMENT) { WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0303)); sRet = UserCom.RST_OK; } } else { //WinManager.ErrorMessage(sRet); } } catch (Exception ex) { WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message); } finally { WinManager.HideSearchMessage(this); } return sRet; } #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 double DataGridSetting(int iWorkMode) { DataTable dtData = new DataTable(); double nOverCash = 0; try { if (iWorkMode == 0) { // 초기화 - 입금 if (bSearchMode == true) { // 시재입금 btnSelect.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0488); // 정산조회 lblTitle1.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0552); // 시재입금 dgvinPay.Visible = true; btnAllUp1.Visible = true; btnAllDw1.Visible = true; // 결제내역 lblTitle2.Visible = true; dgvTender.Visible = true; btnAllUp2.Visible = true; btnAllDw2.Visible = true; label11.Visible = true; // 시재금총액 label4.Visible = true; label6.Visible = true; lblADMTAmount.Visible = true; txtADMTAmount.Visible = true; // 정산내역 vScrollbar.Visible = false; txtPrtData.Text = ""; txtPrtData.Update(); txtPrtData.Visible = false; txtPrtData.Location = new Point(124, 105); vScrollbar.Location = new Point(554, 105); lblTitle1.Location = new Point(10, 67); lblTitle2.Location = new Point(340, 67); //this.Refresh(); bSearchMode = false; } dgvinPay.Visible = false; dgvTender.Visible = false; dgvinPay.Rows.Clear(); WinManager.ShowSearchMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0361), this); dgvinPay.AllowUserToAddRows = false; dgvinPay.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; dgvinPay.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing; dgvinPay.Font = this.Font; dgvinPay.DefaultCellStyle.Font = new Font(m_cPosStatus.Base.FONT, 9); //dgvinPay.DefaultCellStyle.SelectionBackColor = Color.Transparent; dgvinPay.Font = new Font(m_cPosStatus.Base.FONT, 9); dgvinPay.RowHeadersDefaultCellStyle.Font = new Font(m_cPosStatus.Base.FONT, 9); // 타이틀 설정 dgvinPay.Columns[0].HeaderText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0240); dgvinPay.Columns[1].HeaderText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0241); dgvinPay.Columns[2].HeaderText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0019); // 초기화 - 결제 dgvTender.Rows.Clear(); dgvTender.AllowUserToAddRows = false; dgvTender.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; dgvTender.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing; dgvTender.Font = this.Font; dgvTender.DefaultCellStyle.Font = new Font(m_cPosStatus.Base.FONT, 9); dgvTender.Font = new Font(m_cPosStatus.Base.FONT, 9); dgvTender.RowHeadersDefaultCellStyle.Font = new Font(m_cPosStatus.Base.FONT, 9); // 타이틀 설정 dgvTender.Columns[1].HeaderText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0535); dgvTender.Columns[2].HeaderText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0017); dgvTender.Columns[3].HeaderText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0019); // 중간정산 횟수 조회 dtData = m_cAccADMT.GetADMTCount(new string[] { "" }); if (dtData != null && dtData.Rows.Count != 0) { foreach (DataRow dr in dtData.Rows) { lblMidCloseSeq.Text = string.Format(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0554), CmUtil.IntParse(dr["QTY"].ToString())); } } //lblMidCloseSeq.Text = string.Format(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0554), m_cPosStatus.Global.NumericTOCurrency(m_cDataService.DoubleParse(m_cPosStatus.Base.MidCloseSeq)-1)); // 현금과부족 조회 txtOverCash.Text = m_cPosStatus.Global.NumericTOCurrency(0); txtOverCash.Tag = "0"; // 상품권과부족 조회 txtOverGift.Text = m_cPosStatus.Global.NumericTOCurrency(0); txtOverGift.Tag = "0"; // 결제내역 조회 DataTable dtDataPay = m_cAccADMT.GetData_PayCheckList(new string[] { PosConst.COMMON_CODE_GROUP.Z0014, "0" }); dgvTender.Rows.Clear(); // 정산 점검지 생성 string sRet = m_cDataSearch.MakeAccADMTCheck(m_cPosStatus.Base.SaleDate, ref dtData, (ckbSimple.Checked == true ? "1" : "0")); //WinManager.HideSearchMessage(this); if (sRet != UserCom.RST_OK) { dgvinPay.Visible = true ; dgvTender.Visible = true; WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0302); return 0; } if (dtData != null && dtData.Rows.Count != 0) { foreach (DataRow dr in dtData.Rows) { string sSeqNo = dr["SEQ_NO"].ToString().Trim(); // 현금과부족 조회 if (sSeqNo == "7501") // 현금잔액 조회후 현금시재와 계산 { double nAmount = m_cDataService.DoubleParse(dr["AMT"].ToString()); txtOverCash.Tag = nAmount; txtOverCash.Text = m_cPosStatus.Global.NumericTOCurrency(nAmount); } // 상품권과부족 조회 if (sSeqNo == "8101") // 상품권매출 조회후 상품권시재와 계산 { double nAmount = m_cDataService.DoubleParse(dr["AMT"].ToString()); txtOverGift.Tag = nAmount; txtOverGift.Text = m_cPosStatus.Global.NumericTOCurrency(nAmount); } // 결제내역 조회 if (dtDataPay != null && dtDataPay.Rows.Count != 0) { foreach (DataRow dr2 in dtDataPay.Rows) { if (dr2["CMM_CD"].ToString().Trim() == sSeqNo) { int iRow = dgvTender.Rows.Add(); dgvTender.Rows[iRow].Visible = true; dgvTender.Rows[iRow].DefaultCellStyle.ForeColor = Color.Black; dgvTender.Rows[iRow].DefaultCellStyle.SelectionForeColor = Color.Black; dgvTender.Rows[iRow].HeaderCell.Value = (iRow + 1).ToString(); dgvTender.Rows[iRow].Cells[0].Value = dr2["DISP_SEQ"].ToString(); // disp seq dgvTender.Rows[iRow].Cells[1].Value = dr2["CD_NM"].ToString(); // 명칭 dgvTender.Rows[iRow].Cells[2].Value = m_cPosStatus.Global.NumericToQuantity(m_cDataService.LongParse(dr["QTY"].ToString())); // 매수 dgvTender.Rows[iRow].Cells[3].Value = m_cPosStatus.Global.NumericTOCurrency(m_cDataService.DoubleParse(dr["AMT"].ToString())); // 금액 dgvTender.Rows[iRow].Cells[1].Style.BackColor = Color.WhiteSmoke; dgvTender.Rows[iRow].Cells[2].Style.BackColor = Color.FromArgb(222, 222, 222); dgvTender.Rows[iRow].Cells[3].Style.BackColor = Color.FromArgb(222, 222, 222); break; } } } } } // 결제정보 Sort if (dgvTender.Rows.Count > 0) dgvTender.Sort(dgvTender.Columns["DISP_SEQ"], System.ComponentModel.ListSortDirection.Ascending); // 시재입금 표시 dtData = m_cAccADMT.GetData_PayList(new string[] { PosConst.COMMON_CODE_GROUP.Z0004, "6200" }); dgvinPay.Rows.Clear(); this.Refresh(); if (dtData != null && dtData.Rows.Count != 0) { foreach (DataRow dr in dtData.Rows) { int iRow = dgvinPay.Rows.Add(); dgvinPay.Rows[iRow].Visible = true; dgvinPay.Rows[iRow].DefaultCellStyle.ForeColor = Color.Black; dgvinPay.Rows[iRow].DefaultCellStyle.SelectionForeColor = Color.Black; dgvinPay.Rows[iRow].HeaderCell.Value = (iRow + 1).ToString(); dgvinPay.Rows[iRow].Cells[0].Value = dr["CD_NM"].ToString(); // 명칭 dgvinPay.Rows[iRow].Cells[3].Value = dr["CMM_CD"].ToString(); // 코드 dgvinPay.Rows[iRow].Cells[4].Value = m_cDataService.DoubleParse(dr[PosMst.MST_COMMON.DATA.CHAR_VAL_TITLE_VAL_01].ToString()); // 금액 (계산용) dgvinPay.Rows[iRow].Cells[5].Value = m_cDataService.DoubleParse(dr[PosMst.MST_COMMON.DATA.CHAR_VAL_TITLE_VAL_03].ToString()); // 시재금총액 계산여부 dgvinPay.Rows[iRow].Cells[6].Value = m_cDataService.DoubleParse(dr[PosMst.MST_COMMON.DATA.CHAR_VAL_TITLE_VAL_02].ToString()); // 준비금 여부 dgvinPay.Rows[iRow].Cells[7].Value = m_cDataService.DoubleParse(dr[PosMst.MST_COMMON.DATA.CHAR_VAL_TITLE_VAL_04].ToString()); // 권종구분 dgvinPay.Rows[iRow].Cells[1].Value = m_cPosStatus.Global.NumericToQuantity(m_cDataService.LongParse(dr["QTY"].ToString())); // 매수 dgvinPay.Rows[iRow].Cells[2].Value = m_cPosStatus.Global.NumericTOCurrency(m_cDataService.DoubleParse(dr["AMT"].ToString())); // 금액 if (m_cDataService.DoubleParse(dr[PosMst.MST_COMMON.DATA.CHAR_VAL_TITLE_VAL_01].ToString()) == 0) { dgvinPay.Rows[iRow].Cells[2].ReadOnly = false; //SeokWoo Moon 2017.09.14 //dgvinPay.Rows[iRow].Cells[2].Style.BackColor = Color.White; //dgvinPay.Rows[iRow].Cells[2].Style.BackColor = Color.Yellow; dgvinPay.Rows[iRow].Cells[2].Style.BackColor = Color.FromArgb(255, 255, 204); } else { dgvinPay.Rows[iRow].Cells[2].ReadOnly = true; dgvinPay.Rows[iRow].Cells[2].Style.BackColor = Color.FromArgb(222, 222, 222); } dgvinPay.Rows[iRow].Cells[0].Style.BackColor = Color.FromArgb(222, 222, 222); //SeokWoo Moon 2017.09.14 //dgvinPay.Rows[iRow].Cells[1].Style.BackColor = Color.White; //dgvinPay.Rows[iRow].Cells[1].Style.BackColor = Color.Yellow; dgvinPay.Rows[iRow].Cells[1].Style.BackColor = Color.FromArgb(255, 255, 204); } dgvinPay.CurrentCell = dgvinPay.Rows[0].Cells[1]; } dgvinPay.Visible = true; dgvTender.Visible = true; } else if (iWorkMode == 4) { // 계 조회 double nSumAmount = 0; double nGiftAmount = 0; for (int iLoop = 0; iLoop < dgvinPay.RowCount; iLoop++) { if (dgvinPay.Rows[iLoop].Cells[2].Value != null) { if (dgvinPay.Rows[iLoop].Cells[5].Value.ToString() == "1") nSumAmount = CmUtil.DoubleAdd(nSumAmount, m_cDataService.DoubleParse(dgvinPay.Rows[iLoop].Cells[2].Value.ToString())); //#20170809 마감 해피머니 금액 입력 시 상품권과부족 연동 수정 Start, srlee // 기존 // if (dgvinPay.Rows[iLoop].Cells[7].Value.ToString() == "1") if (dgvinPay.Rows[iLoop].Cells[7].Value.ToString() == "1" || dgvinPay.Rows[iLoop].Cells[7].Value.ToString() == "3") //#20170809 마감 해피머니 금액 입력 시 상품권과부족 연동 수정 End, srlee nGiftAmount = CmUtil.DoubleAdd(nGiftAmount, m_cDataService.DoubleParse(dgvinPay.Rows[iLoop].Cells[2].Value.ToString())); } } // 현금과부족 nOverCash = Math.Abs(m_cDataService.DoubleParse(txtOverCash.Tag.ToString())); // 현금과부족 부호 수정(20170531) //txtOverCash.Text = m_cPosStatus.Global.NumericTOCurrency(CmUtil.DoubleSubtraction(nOverCash, nSumAmount)); txtOverCash.Text = m_cPosStatus.Global.NumericTOCurrency(CmUtil.DoubleSubtraction(nSumAmount, nOverCash)); // 상품권과부족 nOverCash = Math.Abs(m_cDataService.DoubleParse(txtOverGift.Tag.ToString())); txtOverGift.Text = m_cPosStatus.Global.NumericTOCurrency(CmUtil.DoubleSubtraction(nGiftAmount, nOverCash)); return nSumAmount; } 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); } finally { WinManager.HideSearchMessage(this); } return 0; } #endregion #region 권종별 마감 입금 처리 /// /// 권종별 마감 입금 처리 /// /// /// private void dgvinPay_CellValueChanged(object sender, DataGridViewCellEventArgs e) { double nPayAmt = 0; long nQty = 0; double nSaleAmt = 0; try { if (dgvinPay.Rows.Count <= 0) return; if (e.ColumnIndex != 1 && e.ColumnIndex != 2) return; if (e.RowIndex < 0) return; int iRow = e.RowIndex; //if (CmUtil.IsNumber( m_cDataService.DoubleParse(dgvinPay.Rows[iRow].Cells[e.ColumnIndex].Value.ToString()).ToString()) != true && dgvinPay.Rows[iRow].Cells[e.ColumnIndex].Value.ToString() != "") if (e.ColumnIndex == 1) { if (dgvinPay.Rows[iRow].Cells[1].Value == null) { //WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0036); dgvinPay.Rows[iRow].Cells[1].Value = m_cPosStatus.Global.NumericToQuantity(0); dgvinPay.Rows[iRow].Cells[2].Value = m_cPosStatus.Global.NumericTOCurrency(0); return; } if (dgvinPay.Rows[iRow].Cells[1].Value != null) dgvinPay.Rows[iRow].Cells[1].Value = m_cPosStatus.Global.NumericToQuantity(m_cDataService.LongParse(dgvinPay.Rows[iRow].Cells[1].Value.ToString())); } else if (e.ColumnIndex == 2) { if (dgvinPay.Rows[iRow].Cells[2].Value == null) { //WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0036); dgvinPay.Rows[iRow].Cells[2].Value = m_cPosStatus.Global.NumericTOCurrency(0); return; } } nQty = m_cDataService.LongParse(dgvinPay.Rows[iRow].Cells[1].Value.ToString()); // 매수 nPayAmt = m_cDataService.DoubleParse(dgvinPay.Rows[iRow].Cells[4].Value.ToString()); // 금액 (계산용) if (nPayAmt > 0) { nSaleAmt = CmUtil.DoubleMultiplication(nQty, nPayAmt); // 금액 dgvinPay.Rows[iRow].Cells[2].Value = m_cPosStatus.Global.NumericTOCurrency(nSaleAmt); } else { if (dgvinPay.Rows[iRow].Cells[2].Value != null) dgvinPay.Rows[iRow].Cells[2].Value = m_cPosStatus.Global.NumericTOCurrency(m_cDataService.DoubleParse(dgvinPay.Rows[iRow].Cells[2].Value.ToString())); } dgvinPay.Update(); txtADMTAmount.Text = m_cPosStatus.Global.NumericTOCurrency(DataGridSetting(4)); // 계 } 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; } } private void dgvinPay_CellLeave(object sender, DataGridViewCellEventArgs e) { //dgvinPay_CellValueChanged(sender, e); } /// /// 그리드 최종 입력 데이터 반영(2017.06.15) /// private void UpdateCurrentCellValue() { double nPayAmt = 0; long nQty = 0; double nSaleAmt = 0; try { //#15580 관련 로그추가 Start - 20180703 UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "UpdateCurrentCellValue Start!"); //#15580 관련 로그추가 End - 20180703 int iRow = dgvinPay.CurrentRow.Index; //#15580 관련 로그추가 Start - 20180703 UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "▶ iRow :" + iRow.ToString()); //#15580 관련 로그추가 End - 20180703 if (iRow < 0) return; dgvinPay.EndEdit(); //#15580 관련 로그추가 Start - 20180703 UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "▶ Qty :" + dgvinPay.Rows[iRow].Cells[1].Value.ToString() + "▶ PayAmt :" + dgvinPay.Rows[iRow].Cells[4].Value.ToString()); //#15580 관련 로그추가 End - 20180703 nQty = m_cDataService.LongParse(dgvinPay.Rows[iRow].Cells[1].Value.ToString()); // 매수 nPayAmt = m_cDataService.DoubleParse(dgvinPay.Rows[iRow].Cells[4].Value.ToString()); // 금액 (계산용) if (nPayAmt > 0) { nSaleAmt = CmUtil.DoubleMultiplication(nQty, nPayAmt); // 금액 dgvinPay.Rows[iRow].Cells[2].Value = m_cPosStatus.Global.NumericTOCurrency(nSaleAmt); dgvinPay.Update(); txtADMTAmount.Text = m_cPosStatus.Global.NumericTOCurrency(DataGridSetting(4)); // 계 //#15580 관련 로그추가 Start - 20180703 UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "▶ ADMTAmount :" + txtADMTAmount.Text); //#15580 관련 로그추가 End - 20180703 } //#15580 관련 로그추가 Start - 20180703 UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "UpdateCurrentCellValue End!"); //#15580 관련 로그추가 End - 20180703 } 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 #region 영수증 출력데이터 생성 /// /// 영수증 출력데이터 생성 /// /// 출력형태 /// 출력포맷 /// Data private void AddPrintData(string sPrtHead, string sPrtFmt, string[] aData) { try { string sPrtData = ""; if (sPrtFmt == PosConst.PRT_FMT.F100) // 선귿기 { //if (sPrtFmt == PosConst.PRT_FMT.F100 && (aData[0] == "-" || aData[0] == "=")) // 선귿기 // -,=로 다시 표현해 달라고 하여 원복 20170830 GOBLIN6 //{ // if (sPrtHead == PosConst.PRT_HDR.PRT_BLD) // for (int i = 1; i <= 21; i++) sPrtData += "━"; // else // for (int i = 1; i <= 21; i++) sPrtData += "─"; //} //else //{ 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); sPrtData = CmUtil.RPadH(aData[0].ToString(), 22) + CmUtil.LPadH(aData[1].ToString(), 8) + CmUtil.LPadH(aData[2].ToString(), 11); break; default: sPrtData = aData[0].ToString(); break; } } m_sPrintData.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 정산조회 /// /// 정산조회 /// /// private string SelectADMT() { string sRet = UserCom.RST_ERR; bool bSubTitlePrint = false; string sSeq = ""; // 정산지 수량이 있는 경우만 출력 추가 20170830 goblin6 try { if (bSearchMode == true) { // 시재입금 btnSelect.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0488); // 정산조회 lblTitle1.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0552); // 시재입금 dgvinPay.Visible = true; btnAllUp1.Visible = true; btnAllDw1.Visible = true; // 결제내역 lblTitle1.Visible = true; lblTitle2.Visible = true; dgvTender.Visible = true; btnAllUp2.Visible = true; btnAllDw2.Visible = true; label11.Visible = true; // 시재금총액 label4.Visible = true; label6.Visible = true; lblADMTAmount.Visible = true; txtADMTAmount.Visible = true; // 정산내역 vScrollbar.Visible = false; txtPrtData.Text = ""; txtPrtData.Update(); txtPrtData.Visible = false; txtPrtData.Location = new Point(124, 105); vScrollbar.Location = new Point(554, 105); lblTitle1.Location = new Point(10, 67); //this.Refresh(); bSearchMode = false; return UserCom.RST_OK; } // 중간정산 카운트 string sTitleMsg = ""; if (PosMstManager.GetPosOption(POS_OPTION.OPT321) == "0" || m_cPosStatus.Base.OpenClose == "0") m_cTrnStatus.Head.TradeKind = ItemConst.TRAN_KIND.STATEMENT.ADJUSTMENT; else m_cTrnStatus.Head.TradeKind = ItemConst.TRAN_KIND.STATEMENT.MIDDLE_ADJUSTMENT; m_cTrnStatus.Head.TradeDiv = m_sTradeDiv; if (m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.STATEMENT.MIDDLE_ADJUSTMENT) { sTitleMsg = string.Format(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0484), "1"); // 중간정산 횟수 조회 DataTable dtData = m_cAccADMT.GetADMTCount(new string[] { "" }); if (dtData != null && dtData.Rows.Count != 0) { foreach (DataRow dr in dtData.Rows) { sTitleMsg = string.Format(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0484), m_cPosStatus.Global.NumericTOCurrency(CmUtil.DoubleParse(dr["QTY"].ToString()))); } } } else if (m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.STATEMENT.ADJUSTMENT) sTitleMsg = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0089); m_sPrintData = new ArrayList(); txtPrtData.Text = ""; WinManager.ShowSearchMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0361), this); //DataTable dtMemu = m_cAccADMT.GetData(new string[] { m_sTranKind }); DataTable dtMemu = null; sRet = m_cDataSearch.MakeAccADMTCheck(m_cPosStatus.Base.SaleDate, ref dtMemu, (ckbSimple.Checked == true ? "1" : "0")); // 메뉴정보 설정 if (dtMemu != null || dtMemu.Rows.Count > 0) { // 타이틀 string[] sSubTitle = new string[] { MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0535) , MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0017) , MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0019) }; // 정산 수량이 없는 경우 그룹별 '내용없음' 표시로 변경 20170830 goblin6 int[] aDataPrint = new int[10]; string sPrevCd = ""; foreach (DataRow dr in dtMemu.Rows) { if (sPrevCd == "" || sPrevCd != CmUtil.LeftH(CmUtil.GetDataRowStr(dr, "SEQ_NO"), 1)) { sPrevCd = CmUtil.LeftH(CmUtil.GetDataRowStr(dr, "SEQ_NO"), 1); } aDataPrint[CmUtil.IntParse(sPrevCd)] += CmUtil.GetDataRowInt(dr, "QTY"); } // 정산 수량이 없는 경우 그룹별 '내용없음' 표시로 변경 20170830 goblin6 // 데이터 foreach (DataRow dr in dtMemu.Rows) { // #20170915 분류별 정산 내역 추가 start, phj //기존 //string[] aRecvData = new string[3]; //변경 string[] aRecvData = new string[4]; // #20170915 분류별 정산 내역 추가 end, phj string sTitle = ""; // 현금반품 내역 추가 20170830 goblin6 aRecvData[0] = CmUtil.GetDataRowStr(dr, "BILL_TYPE_TAG"); sTitle = aRecvData[0].Trim().ToString(); if (aRecvData[0].Trim().ToString() == "" || aRecvData[0].Trim().ToString() == "" || aRecvData[0].Trim().ToString() == "" || aRecvData[0].Trim().ToString() == "" // 현금반품 내역 추가 20170830 goblin6 ) { // 상품별/분류별/결제별 집계 DataTable dtMemu2 = m_cAccADMT.SelectiTemClass(new string[] { aRecvData[0].Trim().ToUpper() }); if (dtMemu2 != null && dtMemu2.Rows.Count > 0) { // 타이틀 if (sTitle.ToString() == "") aRecvData[0] = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0601); else if (sTitle.ToString() == "") // #20170915 분류별 정산 내역 추가 start, phj //기존 //aRecvData[0] = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0602); //변경 aRecvData[0] = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1033); // #20170915 분류별 정산 내역 추가 end, phj else if (sTitle.ToString() == "") aRecvData[0] = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0603); else if (sTitle.ToString() == "") // 현금반품 내역 추가 20170830 goblin6 aRecvData[0] = MessageManager.GetPrintMessage(POS_MESSAGE.PRINT.MSG_0207); AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F103, aRecvData); // SUB 타이틀 출력 if (sTitle.ToString() == "") // 현금반품 내역 추가 20170830 goblin6 { aRecvData[0] = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0346); aRecvData[1] = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0446); aRecvData[2] = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0019); } // #20170915 분류별 정산 내역 추가 start, phj else if (sTitle.ToString() == "") { // 분류, 수량, 금액 aRecvData[0] = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1032); aRecvData[1] = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0017); aRecvData[2] = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0019); } // #20170915 분류별 정산 내역 추가 end, phj else { aRecvData[0] = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0500); aRecvData[1] = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0017); aRecvData[2] = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0019); } AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, new string[] { "-" }); //AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F301, aRecvData); // 현금반품 내역 추가 20170830 goblin6 AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F302, aRecvData); AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, new string[] { "-" }); //aRecvData[0] = CmUtil.GetDataRowStr(dr, "MSG"); //aRecvData[1] = m_cPosStatus.Global.NumericTOCurrency(CmUtil.GetDataRowDouble(dr, "QTY")); //aRecvData[2] = m_cPosStatus.Global.NumericTOCurrency(CmUtil.GetDataRowDouble(dr, "AMT")); //AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F301, aRecvData); // #20170915 분류별 정산 내역 추가 start, phj double dtotNetAmt = 0; if (sTitle.ToString() == "") { // 총시재매출 foreach (DataRow dr1 in dtMemu2.Rows) { // 2 - 합계row if (CmUtil.GetDataRowStr(dr1, "LEVEL_GB").ToString() == "2") { dtotNetAmt = CmUtil.GetDataRowDouble(dr1, "BILL_AMT"); break; } } } // #20170915 분류별 정산 내역 추가 end, phj foreach (DataRow dr2 in dtMemu2.Rows) { if (sTitle.ToString() == "") // 현금반품 내역 추가 20170830 goblin6 { aRecvData[0] = CmUtil.GetDataRowStr(dr2, "ITEM_NM").ToString(); // 명칭 aRecvData[1] = CmUtil.GetDataRowStr(dr2, "SALE_QTY").ToString(); // 시간 aRecvData[2] = m_cPosStatus.Global.NumericTOCurrency(CmUtil.GetDataRowDouble(dr2, "SALE_AMT")); // 금액 } // #20170915 분류별 정산 내역 추가 start, phj else if (sTitle.ToString() == "") { aRecvData[0] = CmUtil.GetDataRowStr(dr2, "ITEM_NM").ToString(); // 명칭 aRecvData[1] = m_cPosStatus.Global.NumericTOCurrency(CmUtil.GetDataRowDouble(dr2, "SALE_QTY")); // 수량 aRecvData[2] = m_cPosStatus.Global.NumericTOCurrency(CmUtil.GetDataRowDouble(dr2, "BILL_AMT")); // 금액 aRecvData[3] = (CmUtil.MathRounds(((Convert.ToDouble(aRecvData[2]) * 100) / dtotNetAmt), PosConst.MATH_ROUND.ROUND, 0)).ToString(); } // #20170915 분류별 정산 내역 추가 end, phj else { aRecvData[0] = CmUtil.GetDataRowStr(dr2, "ITEM_NM").ToString(); // 명칭 aRecvData[1] = m_cPosStatus.Global.NumericTOCurrency(CmUtil.GetDataRowDouble(dr2, "SALE_QTY")); // 수량 aRecvData[2] = m_cPosStatus.Global.NumericTOCurrency(CmUtil.GetDataRowDouble(dr2, "SALE_AMT")); // 금액 } if (aRecvData[0].Trim() == "#SUM#") { aRecvData[0] = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0501); AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, new string[] { "-" }); } // #20170915 분류별 정산 내역 추가 start, phj //기존 //AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F301, aRecvData); //변경 if (sTitle.ToString() == "") { string temp = string.Empty; temp = CmUtil.RPadH(aRecvData[0], 20) + CmUtil.LPadH(aRecvData[3], 3); aRecvData[0] = temp; AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F301, aRecvData); } else { AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F301, aRecvData); } // #20170915 분류별 정산 내역 추가 end, phj } AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, new string[] { "-" }); //AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, new string[] { " " }); } } else if (aRecvData[0] == "") { sSeq = CmUtil.GetDataRowStr(dr, "SEQ_NO"); // 정산지 수량이 있는 경우만 출력 추가 20170830 goblin6 aRecvData[0] = CmUtil.GetDataRowStr(dr, "MSG"); aRecvData[1] = m_cPosStatus.Global.NumericTOCurrency(CmUtil.GetDataRowDouble(dr, "QTY")); aRecvData[2] = m_cPosStatus.Global.NumericTOCurrency(CmUtil.GetDataRowDouble(dr, "AMT")); // 정산 수량이 없는 경우 그룹별 '내용없음' 표시로 변경 20170830 goblin6 if ((CmUtil.IntParse(sSeq) >= 2100 && CmUtil.IntParse(sSeq) < 6100 || CmUtil.IntParse(sSeq) >= 8701 && CmUtil.IntParse(sSeq) <= 8704) && CmUtil.IntParse(sSeq) != 3800 && CmUtil.IntParse(sSeq) != 3801 && CmUtil.IntParse(sSeq) != 4300 && CmUtil.IntParse(sSeq) != 4301 ) { if (CmUtil.IntParse(aRecvData[1]) > 0) { AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F301, aRecvData); } else { sPrevCd = CmUtil.LeftH(CmUtil.GetDataRowStr(dr, "SEQ_NO"), 1); if (aDataPrint[CmUtil.IntParse(sPrevCd)] == 0) { aDataPrint[CmUtil.IntParse(sPrevCd)] = 1; aRecvData[0] = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0570); AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F103, aRecvData); //AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, new string[] { " " }); } } } else { AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F301, aRecvData); } // 정산 수량이 없는 경우 그룹별 '내용없음' 표시로 변경 20170830 goblin6 } else { aRecvData[0] = CmUtil.GetDataRowStr(dr, "BILL_TYPE_TAG"); // 입력된 문구 출력 if (bSubTitlePrint != true) { // 타이틀 AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F103, new string[] { sTitleMsg }); //AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, new string[] { " " }); //bSubTitlePrint = true; } AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, new string[] { "-" }); //if (bSubTitlePrint == true) AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, new string[] { " " }); if (bSubTitlePrint != true) { bSubTitlePrint = true; } AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F103, aRecvData); AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, new string[] { "-" }); AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F301, sSubTitle); AddPrintData(PosConst.PRT_HDR.PRT_NOR, PosConst.PRT_FMT.F100, new string[] { "-" }); } Application.DoEvents(); } } // 화면에 표시 string sData = ""; txtPrtData.Text = ""; txtPrtData.Visible = false ; if (m_sPrintData != null) { for (int nLoop = 0; nLoop < m_sPrintData.Count; nLoop++) { if (m_sPrintData[nLoop].ToString().Trim() != "") { sData += m_sPrintData[nLoop].ToString().Substring(5).TrimEnd() + PosConst.CRLF; //sData += CmUtil.MidH(m_sPrintData[nLoop].ToString(), 5, CmUtil.LenH(m_sPrintData[nLoop].ToString()) - 5).ToString() + PosConst.CRLF; //txtPrtData.AppendText(CmUtil.MidH(m_sPrintData[nLoop].ToString(), 5, CmUtil.LenH(m_sPrintData[nLoop].ToString())).ToString() + PosConst.CRLF); } } } txtPrtData.Text = sData; txtPrtData.Update(); txtPrtData.Select(0, 0); txtPrtData.ScrollToCaret(); txtPrtData.Visible = true; vScrollbar.Visible = true; vScrollbar.Attach(txtPrtData); if (bSearchMode != true) { // 정산조회 btnSelect.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0555); // 정산조회 lblTitle1.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0553); // 시재입금 dgvinPay.Visible = false; btnAllUp1.Visible = false; btnAllDw1.Visible = false; // 결제내역 lblTitle2.Visible = false; dgvTender.Visible = false; btnAllUp2.Visible = false; btnAllDw2.Visible = false; label11.Visible = false; // 시재금총액 label4.Visible = false; label6.Visible = false; lblADMTAmount.Visible = false; txtADMTAmount.Visible = false; // 정산내역 vScrollbar.Visible = true; txtPrtData.Visible = true; txtPrtData.Location = new Point(124, 105); vScrollbar.Location = new Point(554, 105); lblTitle1.Location = new Point(121, 67); this.Refresh(); bSearchMode = true; } 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); } finally { WinManager.HideSearchMessage(this); dgvinPay.Refresh(); dgvTender.Refresh(); this.Refresh(); } return sRet; } #endregion #region 데이터 베이스 백업 /// /// 데이터 베이스 백업 /// /// private bool SetBackupDatabase() { bool bRet = false; try { //메인포스만 백업함! if (m_cPosStatus.Base.PosCommunicationType == PosConst.MAIN_POS_DIV.MAIN_POS) { frmDatabaseBackup fForm = (frmDatabaseBackup)FormManager.GetForm(FormManager.FORM_MASTER_BACKUP); if (fForm == null) { fForm = new frmDatabaseBackup(); FormManager.AddForm(FormManager.FORM_MASTER_BACKUP, fForm); } fForm.ShowDialog(); } } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.ToString()); } return bRet; } #endregion 데이터 베이스 백업 #region 마감시재 입력 dgvinPay_CellClick private void dgvinPay_CellClick(object sender, DataGridViewCellEventArgs e) { try { int iCol = e.ColumnIndex; if (e.ColumnIndex == 1) { if (dgvinPay.Rows[e.RowIndex].Cells[e.ColumnIndex].ReadOnly != false) iCol = 1; } else if (e.ColumnIndex == 2) { if (dgvinPay.Rows[e.RowIndex].Cells[e.ColumnIndex].ReadOnly != false) iCol = 1; } else iCol = 1; dgvinPay.EditMode = DataGridViewEditMode.EditOnEnter; dgvinPay.Rows[e.RowIndex].Cells[iCol].Selected = true; dgvinPay.BeginEdit(true); } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.ToString()); } } #endregion #region 환경 설정 서버 송신 /// /// 환경 설정 서버 송신 /// private void SetConfigToServer() { try { //회사코드, 점포코드, 포스번호, 서버아이피, 서버 포트 유무 체크 if (m_cPosStatus.Base.CmpCd != "" && m_cPosStatus.Base.StoreNo != "" && m_cPosStatus.Base.PosNo != "" && m_cPosStatus.Base.CommSvrIp.Trim() != "" && (int)m_cPosStatus.Base.BizInqPort != 0) m_cPosConfig.Execute(new string[] { ItemConst.POS_CONFIG_TYPE.SAVE, "" }); } catch (Exception) { } } #endregion #region 타이머 private void timer1_Tick(object sender, EventArgs e) { try { timer1.Enabled = false; DataGridSetting(0); // 그리드 초기화 // 이전 입력 데이터 화면표시 처리(2017.06.14) for (int i = 0; i < dgvinPay.RowCount; i++) { foreach(string[] sAccData in m_alAccData) { if (dgvinPay.Rows[i].Cells[3].Value.ToString() == sAccData[0]) { dgvinPay.Rows[i].Cells[1].Value = sAccData[1]; dgvinPay.Rows[i].Cells[2].Value = sAccData[2]; break; } } } m_alAccData.Clear(); } catch (Exception ex) { UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.ToString()); } } #endregion //********************************************** // (2017.11.08) 마감화면에 환전 버튼 추가를 위한 // 버튼 클릭 이벤트 함수 //********************************************** #region 그리드 클릭 이벤트 함수 private void btnExchange_Click(object sender, EventArgs e) { try { if (m_cPosStatus.Base.TrainingFlag == "1") //연습모드이면... { WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0491); } else { m_cSaleComplete.OpenManualCashdrawer(); } } 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 } }