spc-kiosk-pb/Window/WinOpenClose/frmAccEtcInOut.cs
2019-06-16 14:12:09 +09:00

847 lines
42 KiB
C#

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Cosmos.UserFrame;
using Cosmos.BaseFrame;
using Cosmos.ServiceProvider;
using Cosmos.Common;
using Cosmos.CommonManager;
namespace Cosmos.Win
{
public partial class frmAccEtcInOut : Form
{
#region
private SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출
private IDataCommonUs m_cDataCommon = null; // POS 공통함수 인터페이스
private PosStatus m_cPosStatus = new PosStatus(); // 기본정보 참조
private StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체)
private IDataProcessUs m_cDataService = null;
private IAccEtc m_cAccEtcInout = null; // 기타 입출금 처리 서비스
private ICashdrawerUs m_cCashDrawer = null;
private Hashtable m_htTitleControls; // 메뉴버튼 컨트롤 정보
private ArrayList m_alMenuHead = new ArrayList(); // 메뉴타이틀정의 배열
// 저장을 위한 변수 선언
// 외상매입,거래처 일 경우 선택한 고객 ID 변수
private string sSelectCustID = string.Empty;
// 외상매입, 거래처 일 경우 고객명, 거래처 명 변수
private string sSelectCustNM = string.Empty;
private DataTable m_dtItemInit; // 조회 데이터 리스트
private DataTable m_dtItemInit2; // 조회 데이터 리스트
#endregion
#region &
public frmAccEtcInOut()
{
InitializeComponent();
base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);
//this.UpdateStyles();
m_cPosStatus = (PosStatus)StateObject.POS; // 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_cAccEtcInout = (IAccEtc)sManager.InitServiceInstance(ServiceLists.BSV_OPEN_CLOSE.DLL, ServiceLists.BSV_OPEN_CLOSE.ACC_ETC_INOUT);
m_cCashDrawer = (ICashdrawerUs)sManager.InitServiceInstance(ServiceLists.AGENT_OLEDEVICE.DLL, ServiceLists.AGENT_OLEDEVICE.DEVICE_CASHDRAWER);
}
private void frmAccEtcInout_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();
this.Tag = "START";
}
private void frmAccEtcInOut_Activated(object sender, EventArgs e)
{
if (this.Tag.ToString() == "START")
{
this.Tag = "";
// 업무구분 조회
GetAccInfo(1);
}
}
private void frmAccEtcInOut_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);
}
#endregion &
#region
/// <summary>
/// 폼 컨트롤 초기화
/// </summary>
private void InitControl()
{
try
{
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);
FormManager.MovePopUpForm(this, false, m_cPosStatus.Sale.ScreenSizeUser);
picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_FULL_SIZE);
//테마색상 적용!
padInPut.ThemeColor = m_cPosStatus.ScnMst.ThemeColor;
padInPut.ClearBtnText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0817);
padInPut.SearchBtnText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1018);
//버튼이미지 적용
btnUp.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_14X9_UP1_BASIC);
btnUp.ImageAlign = ContentAlignment.MiddleCenter;
btnUp.BorderStyle = BorderStyle.None;
btnDw.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_14X9_DOWN1_BASIC);
btnDw.ImageAlign = ContentAlignment.MiddleCenter;
btnDw.BorderStyle = BorderStyle.None;
if (btnUp.Image != null) btnUp.Text = "";
if (btnDw.Image != null) btnDw.Text = "";
btnUp2.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_14X9_UP1_BASIC);
btnUp2.ImageAlign = ContentAlignment.MiddleCenter;
btnUp2.BorderStyle = BorderStyle.None;
btnDw2.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_14X9_DOWN1_BASIC);
btnDw2.ImageAlign = ContentAlignment.MiddleCenter;
btnDw2.BorderStyle = BorderStyle.None;
if (btnUp2.Image != null) btnUp2.Text = "";
if (btnDw2.Image != null) btnDw2.Text = "";
btnExit.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BTN_CLOSE);
if (btnExit.Image != null) btnExit.Text = "";
// 라벨 이름 설정
lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0087);
lblWorkFlag.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0992);
lblSearchDate.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0354);
lblSaleDate.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0242);
lblCashier.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0485);
lblFlag.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0637);
lblAmout.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0758);
lblEtc.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0993);
btnDpst.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0486);
btnDmnt.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0524);
btnSearch.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0004);
btnPrint.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0257);
btnSave.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0225);
btnCancel.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0021);
txtSaleDate.InputTypeFormat = m_cPosStatus.Global.m_stCultureMaster.strDatePattern;
txtSaleDate.Text = m_cPosStatus.Global.DateToCulture(m_cPosStatus.Base.SaleDate);
txtCashier.Text = m_cPosStatus.Base.CashierName;
txtDpstWthdrNm.Text = "";
txtEtcReason.Text = "";
txtAmount.Text = "0";
// 영업일자로 기본 설정
txtDateFrom.InputTypeFormat = m_cPosStatus.Global.m_stCultureMaster.strDatePattern;
txtDateFrom.Value = m_cPosStatus.Global.DateToCulture(m_cPosStatus.Base.SaleDate);
txtDateTo.InputTypeFormat = m_cPosStatus.Global.m_stCultureMaster.strDatePattern;
txtDateTo.Value = m_cPosStatus.Global.DateToCulture(m_cPosStatus.Base.SaleDate);
txtAmount.Select();
// 코드 패널 그리드 초기화
SetCodeListColumn();
// 조회 패널 그리드 초기화
SetSearchListColumn();
}
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>
/// 저장 DataGridView 초기화
/// </summary>
private void SetCodeListColumn()
{
try
{
// 기타입출금 계정 정보
dgvData.CsmGridColumnHeadersVisible = true; //DataGridView 자체의 컬럼 헤더 Visible 여부
dgvData.CsmGridColumnHeadersHeight = 37; //DataGridView 자체의 컬럼 헤더 높이
dgvData.CsmGridColumnHeadersFont = new Font(m_cPosStatus.Base.FONT, 12, FontStyle.Bold); //DataGridView 자체의 컬럼 헤더 폰트
dgvData.CsmGridRowsHeight = 39;
dgvData.CsmGridColumnCount = 4; //그리드의 컬럼수
dgvData.CsmGridShowPageRowsCount = 4; //그리드의 한 화면에 보이는 로우수
dgvData.CsmGridSetHeaderBackColor(236, 238, 239); //그리드 헤더 배경색
dgvData.CsmGridDefaultRowBackColor = Color.FromArgb(255, 255, 255); //그리드 홀수(Default)행의 배경색 지정
dgvData.CsmGridAlternateRowBackColor = Color.FromArgb(251, 253, 255); //그리드 짝수(Alternate)행의 배경색 지정
dgvData.CsmGridBackGroundColor = Color.FromArgb(251, 253, 255); //기본 백그라운드 컬러
dgvData.CsmGridHighlightColor = Color.FromArgb(255, 251, 211); //그리드 선택 백 컬러
dgvData.CsmGridHighlightTextColor = Color.Black; //그리드 선택 글자 컬러
dgvData.CsmGridSetColumnWidth(new int[] { 289, 0, 0, 0 }); //컬럼넓이 지정(289)
dgvData.CsmGridAlignment(new int[] { 1, 1, 1, 1 }); //컬럼 정렬 0:왼쪽, 1:가운데, 2:오른쪽
//각 컬럼별 이름 지정
dgvData.CsmGridColumnName(0, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0489));
dgvData.CsmGridColumnName(1, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0525));
dgvData.CsmGridColumnName(2, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0526));
dgvData.CsmGridColumnName(3, "매입처코드");
//그리드 초기화 테이블
m_dtItemInit = new DataTable("INIT");
m_dtItemInit.Columns.Add(new DataColumn("DPST_WTHDR_ACC_NM", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("DPST_WTHDR_TYPE", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("DPST_WTHDR_ACC_CD", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("SPPLR_INPUT_TYPE", typeof(string)));
m_dtItemInit.Clear();
}
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);
}
}
/// <summary>
/// 조회 DataGridView 초기화
/// </summary>
private void SetSearchListColumn()
{
try
{
// 기타입출금 입력 정보
dgvDataList.CsmGridColumnHeadersVisible = true; //DataGridView 자체의 컬럼 헤더 Visible 여부
dgvDataList.CsmGridColumnHeadersHeight = 39; //DataGridView 자체의 컬럼 헤더 높이
dgvDataList.CsmGridColumnHeadersFont = new Font(m_cPosStatus.Base.FONT, 12, FontStyle.Bold); //DataGridView 자체의 컬럼 헤더 폰트
dgvDataList.CsmGridRowsHeight = 42;
dgvDataList.CsmGridColumnCount = 13; //그리드의 컬럼수
dgvDataList.CsmGridShowPageRowsCount = 6; //그리드의 한 화면에 보이는 로우수
dgvDataList.CsmGridSetHeaderBackColor(236, 238, 239); //그리드 헤더 배경색
dgvDataList.CsmGridDefaultRowBackColor = Color.FromArgb(255, 255, 255); //그리드 홀수(Default)행의 배경색 지정
dgvDataList.CsmGridAlternateRowBackColor = Color.FromArgb(251, 253, 255); //그리드 짝수(Alternate)행의 배경색 지정
dgvDataList.CsmGridBackGroundColor = Color.FromArgb(251, 253, 255); //기본 백그라운드 컬러
dgvDataList.CsmGridHighlightColor = Color.FromArgb(255, 251, 211); //그리드 선택 백 컬러
dgvDataList.CsmGridHighlightTextColor = Color.Black; //그리드 선택 글자 컬러
dgvDataList.CsmGridSetColumnWidth(new int[] { 52, 132, 122, 152, 142, 363, 0, 0, 0, 0, 0, 0, 0 }); //컬럼넓이 지정(963)
dgvDataList.CsmGridAlignment(new int[] { 1, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0 }); //컬럼 정렬 0:왼쪽, 1:가운데, 2:오른쪽
//각 컬럼별 이름 지정
dgvDataList.CsmGridColumnName(0, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0014));
dgvDataList.CsmGridColumnName(1, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0242));
dgvDataList.CsmGridColumnName(2, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0532));
dgvDataList.CsmGridColumnName(3, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0637));
dgvDataList.CsmGridColumnName(4, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0019));
dgvDataList.CsmGridColumnName(5, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0489));
// 취소를 위한 데이터
dgvDataList.CsmGridColumnName(6, "입출금구분코드");
dgvDataList.CsmGridColumnName(7, "입출금계정");
dgvDataList.CsmGridColumnName(8, "고객번호");
dgvDataList.CsmGridColumnName(9, "점포결제유형");
dgvDataList.CsmGridColumnName(10, "원거래 POS번호");
dgvDataList.CsmGridColumnName(11, "원 거래번호");
dgvDataList.CsmGridColumnName(12, "매입처 입력 유형");
//그리드 초기화 테이블
m_dtItemInit2 = new DataTable("INIT");
m_dtItemInit2.Columns.Add(new DataColumn("NO", typeof(string)));
m_dtItemInit2.Columns.Add(new DataColumn("SALE_DT", typeof(string)));
m_dtItemInit2.Columns.Add(new DataColumn("DPST_WTHDR_CD_NM", typeof(string)));
m_dtItemInit2.Columns.Add(new DataColumn("DPST_WTHDR_NM", typeof(string)));
m_dtItemInit2.Columns.Add(new DataColumn("DPST_WTHDR_AMT", typeof(string)));
m_dtItemInit2.Columns.Add(new DataColumn("ETC_REASON", typeof(string)));
m_dtItemInit2.Columns.Add(new DataColumn("DPST_WTHDR_CD", typeof(string)));
m_dtItemInit2.Columns.Add(new DataColumn("DPST_WTHDR_ACC_CD", typeof(string)));
m_dtItemInit2.Columns.Add(new DataColumn("CUST_NO", typeof(string)));
m_dtItemInit2.Columns.Add(new DataColumn("STOR_PAY_TYPE", typeof(string)));
m_dtItemInit2.Columns.Add(new DataColumn("POS_NO", typeof(string)));
m_dtItemInit2.Columns.Add(new DataColumn("TRADE_NO", typeof(string)));
m_dtItemInit2.Columns.Add(new DataColumn("SPPLR_INPUT_TYPE", typeof(string)));
m_dtItemInit2.Clear();
}
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 Control Event
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
#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) == txtSaleDate)
{
txtDpstWthdrNm.Select();
}
else if (((Cosmos.UI.CsmPosEditBox)sender) == txtDpstWthdrNm)
{
txtAmount.Select();
}
else if (((Cosmos.UI.CsmPosEditBox)sender) == txtAmount)
{
txtEtcReason.Select();
}
}
else if (sFuncValue == PosKey.MENU_KEY.CLEAR)
{
if (((Cosmos.UI.CsmPosEditBox)sender).ReadOnly == false) ((Cosmos.UI.CsmPosEditBox)sender).Text = "";
if (((Cosmos.UI.CsmPosEditBox)sender) == txtSaleDate)
{
txtSaleDate.ReadOnly = false;
}
}
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
private void btnPay_Click(object sender, EventArgs e)
{
if (((UI.CsmButton)sender) == btnDpst)
{
((UI.CsmButton)sender).BackColor = Color.Blue;
btnDpst.BackColor = Color.FromArgb(22, 187, 238);
btnDmnt.BackColor = Color.FromArgb(178, 178, 178);
GetAccInfo(1);
}
else if (((UI.CsmButton)sender) == btnDmnt)
{
((UI.CsmButton)sender).BackColor = Color.Blue;
btnDmnt.BackColor = Color.FromArgb(22, 187, 238);
btnDpst.BackColor = Color.FromArgb(178, 178, 178);
GetAccInfo(2);
}
}
private void btnSave_Click(object sender, EventArgs e)
{
string sRet = UserCom.RST_ERR;
string sDpstWthdrAccCd = string.Empty; // 입출금계정코드
string sDpstWthdrCd = string.Empty; // 입출금 유형
string sShopPayType = string.Empty; // 점포결제유형
string sSpplrInputType = string.Empty; // 매입처 입력 유형
string sEtc = "";
sSelectCustNM = "";
try
{
if (dgvData.CsmGridRowsCount <= 0)
return;
if (txtSaleDate.Text == "")
{
WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0445));
return;
}
if (txtCashier.Text == "")
{
WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0443));
return;
}
if (txtDpstWthdrNm.Text == "")
{
WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0444));
return;
}
if (txtAmount.Text == "" || txtAmount.Text == "0")
{
WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0446));
txtAmount.Text = "0";
txtAmount.Select();
return;
}
if (txtEtcReason.Text == "" || txtEtcReason.Text == null)
{
WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0447));
txtEtcReason.Focus();
return;
}
// 매입처 입력 유형
sSpplrInputType = dgvData.CsmGridGetCell(dgvData.CsmGridSelectedRowIndex, 3);
// 입출금 유형(입금/출금)
sDpstWthdrCd = dgvData.CsmGridGetCell(dgvData.CsmGridSelectedRowIndex, 1);
// 입출금 계정 코드(80:외상)
sDpstWthdrAccCd = dgvData.CsmGridGetCell(dgvData.CsmGridSelectedRowIndex, 2);
// 매입처 입력 유형(1:고객, 2:매입처, 0:미입력)
// "미입력" 일 경우 점포결제유형 팝업창을 표시해 준다.
if (sSpplrInputType == "1")
{
// 고객
frmCustBrowse fForm = (frmCustBrowse)FormManager.GetForm(FormManager.FORM_PAY_CUST_BROWSE);
if (fForm == null)
{
fForm = new frmCustBrowse();
FormManager.AddForm(FormManager.FORM_PAY_CUST_BROWSE, fForm);
}
if (fForm.ShowDialog() != DialogResult.OK) return;
sSelectCustID = fForm.PosMenuKeyOut;
sSelectCustNM = fForm.PosMenuKeyOut2;
// 고객
//frmCustSearch fForm = (frmCustSearch)FormManager.GetForm(FormManager.FORM_PAY_CUST_SEARCH);
//if (fForm == null)
//{
// fForm = new frmCustSearch();
// FormManager.AddForm(FormManager.FORM_PAY_CUST_SEARCH, fForm);
//}
//fForm.SearchCD = "ZZZZ";
//fForm.SearchType = ItemConst.IRT_INQ_TYPE.SALEONCREDIT_CUSTINQ;
//if (fForm.ShowDialog() != DialogResult.OK) return;
//sSelectCustID = fForm.PosMenuKeyOut;
//sSelectCustNM = fForm.PosMenuKeyOut2;
}
else if (sSpplrInputType == "2")
{
// 매입처
frmVenderSearch fForm = (frmVenderSearch)FormManager.GetForm(FormManager.FORM_VENDER_SEARCH);
if (fForm == null)
{
fForm = new frmVenderSearch();
FormManager.AddForm(FormManager.FORM_VENDER_SEARCH, fForm);
}
if (fForm.ShowDialog() != DialogResult.OK) return;
sSelectCustID = fForm.PosMenuKeyOut;
sSelectCustNM = fForm.PosMenuKeyOut2;
}
else
{
// 점포결제
frmShopPayType fForm = (frmShopPayType)FormManager.GetForm(FormManager.FORM_SHOP_PAY_TYPE);
if (fForm == null)
{
fForm = new frmShopPayType();
FormManager.AddForm(FormManager.FORM_SHOP_PAY_TYPE, fForm);
}
if (fForm.ShowDialog() != DialogResult.OK) return;
sShopPayType = fForm.PosMenuKeyOut;
}
// 기타사유에 고객명/매입처명을 합쳐서 보여준다.
if (sSelectCustNM != "")
{
sEtc = sSelectCustNM + " - " + txtEtcReason.Text.Trim();
}
else
{
sEtc = txtEtcReason.Text.Trim();
}
// 입출금 유형, 입출금 코드, 입출금 금액, 입출금 명, 고객번호, 여유필드01, 여유필드02, 여유필드03, 여유필드04, 여유필드05
// 매출(0), 영업일자(1), 입출금계정(2), 입출금구분코드(3), 금액(4), 구분(5), 고객번호(6),기타사유(7), 점포결제유형(8), 매입처입력유형(9)
sRet = m_cAccEtcInout.SetData(new string[] { ItemConst.TRAN_DIV.NORMAL, m_cPosStatus.Base.SaleDate, sDpstWthdrAccCd, sDpstWthdrCd, txtAmount.Value, "", sSelectCustID, sEtc.Replace("'", "\""), sShopPayType, sSpplrInputType });
if (sRet == UserCom.RST_OK)
{
m_cCashDrawer.OpenCashDrawer(); //돈통오픈
WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0415));
// 저장데이터 초기화
txtAmount.Text = "0";
txtDpstWthdrNm.Text = "";
txtEtcReason.Text = "";
sSelectCustID = "";
// 정상적으로 저장 되면 재조회 한다.
GetDpstWthdrList();
}
}
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);
}
}
#region /
/// <summary>
/// 조회 그리드 업/다운 클릭 이벤트
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnSelProc_Click(object sender, EventArgs e)
{
if ((UI.CsmButton)sender == btnUp)
{
dgvData.CsmGridScroll("UP");
}
else if ((UI.CsmButton)sender == btnDw)
{
dgvData.CsmGridScroll("DOWN");
}
else if ((UI.CsmButton)sender == btnUp2)
{
dgvDataList.CsmGridScroll("UP");
}
else if ((UI.CsmButton)sender == btnDw2)
{
dgvDataList.CsmGridScroll("DOWN");
}
}
#endregion /
/// <summary>
/// 기타 입출금 내역 조회
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnSearch_Click(object sender, EventArgs e)
{
try
{
GetDpstWthdrList();
}
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);
}
}
/// <summary>
/// 기타 입출금 취소
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnCancel_Click(object sender, EventArgs e)
{
string sRet = UserCom.RST_ERR;
try
{
if (dgvDataList.CsmGridRowsCount <= 0)
return;
// 일자
string sSaleDate = m_cPosStatus.Global.CultureToDate(dgvDataList.CsmGridGetCell(dgvDataList.CsmGridSelectedRowIndex, 1));
// sDpstWthdrAccCD (입출금계정)
string sDpstWthdrAccCd = dgvDataList.CsmGridGetCell(dgvDataList.CsmGridSelectedRowIndex, 7);
// sDpstWthdrCD (입출금구분코드)
string sDpstWthdrCd = dgvDataList.CsmGridGetCell(dgvDataList.CsmGridSelectedRowIndex, 6);
// 금액
string sAmount = dgvDataList.CsmGridGetCell(dgvDataList.CsmGridSelectedRowIndex, 4).Replace(m_cPosStatus.Global.m_stCultureMaster.strGroupingSymbol, "");
// 구분
//string sFlag = dgvDataList.CsmGridGetCell(dgvDataList.CsmGridSelectedRowIndex, 3);
string sFlag = "";
// 고객번호
sSelectCustID = dgvDataList.CsmGridGetCell(dgvDataList.CsmGridSelectedRowIndex, 8);
// 기타사유
string sEtc = dgvDataList.CsmGridGetCell(dgvDataList.CsmGridSelectedRowIndex, 5);
// 점포결제유형
string sShopPayType = dgvDataList.CsmGridGetCell(dgvDataList.CsmGridSelectedRowIndex, 9);
// POS 번호
string sOrgPosNo = dgvDataList.CsmGridGetCell(dgvDataList.CsmGridSelectedRowIndex, 10);
// 거래번호
string sOrgTradeNo = dgvDataList.CsmGridGetCell(dgvDataList.CsmGridSelectedRowIndex, 11);
// 매입처입력유형
string sSpplrInputType = dgvDataList.CsmGridGetCell(dgvDataList.CsmGridSelectedRowIndex, 12);
// 취소(0), 영업일자(1), 입출금계정(2), 입출금구분코드(3), 금액(4), 구분(5), 고객번호(6), 기타사유(7), 점포결제유형(8), 매입처입력유형(9), 원 POS 번호(10), 원거래번호(11)
sRet = m_cAccEtcInout.SetData(new string[] { ItemConst.TRAN_DIV.REFUND, sSaleDate, sDpstWthdrAccCd, sDpstWthdrCd, sAmount, sFlag, sSelectCustID, sEtc, sShopPayType, sSpplrInputType, sOrgPosNo, sOrgTradeNo });
if (sRet == UserCom.RST_OK)
{
WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0416));
GetDpstWthdrList();
}
}
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);
}
}
/// <summary>
/// 기타입출금 내역 출력
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnPrint_Click(object sender, EventArgs e)
{
string sRet = UserCom.RST_ERR;
DataTable dtData = new DataTable();
try
{
if (dgvDataList.CsmGridRowsCount <= 0)
return;
dtData.Columns.Add(new DataColumn("SALE_DT", typeof(string)));
dtData.Columns.Add(new DataColumn("DPST_WTHDR_CD", typeof(string)));
dtData.Columns.Add(new DataColumn("DPST_WTHDR_NM", typeof(string)));
dtData.Columns.Add(new DataColumn("DPST_WTHDR_AMT", typeof(string)));
dtData.Columns.Add(new DataColumn("ETC_REASON", typeof(string)));
for (int i = 0; i <= dgvDataList.CsmGridRowsCount - 1; i++)
{
DataRow dr = dtData.NewRow();
dr["SALE_DT"] = dgvDataList.CsmGridGetCell(i, 1);
dr["DPST_WTHDR_CD"] = dgvDataList.CsmGridGetCell(i, 6);
dr["DPST_WTHDR_NM"] = dgvDataList.CsmGridGetCell(i, 3);
dr["DPST_WTHDR_AMT"] = dgvDataList.CsmGridGetCell(i, 4);
dr["ETC_REASON"] = dgvDataList.CsmGridGetCell(i, 5);
dtData.Rows.Add(dr);
}
sRet = m_cAccEtcInout.AccEtcListPrt(dtData, m_cPosStatus.Global.CultureToDate(txtDateFrom.Text), m_cPosStatus.Global.CultureToDate(txtDateTo.Text));
if (sRet == UserCom.RST_OK)
{
WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0182));
}
}
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);
}
}
private void dgvData_GridClickEvent(object sender, string rowIndex)
{
string sRet = UserCom.RST_ERR;
if (dgvData.CsmGridRowsCount <= 0) return;
txtDpstWthdrNm.Text = dgvData.CsmGridGetCell(dgvData.CsmGridSelectedRowIndex, 0);
return;
}
#endregion Control Event
#region User Method
/// <summary>
/// 기타 입/출금 조회 DataGridView와 Data 연결
/// </summary>
public void GetDpstWthdrList()
{
try
{
DataTable dtData = new DataTable();
dtData = (DataTable)m_cAccEtcInout.GetData(new string[] { m_cPosStatus.Global.CultureToDate(txtDateFrom.Text), m_cPosStatus.Global.CultureToDate(txtDateTo.Text) });
if (dtData != null && dtData.Rows.Count > 0)
{
foreach (DataRow dr in dtData.Rows)
{
dr[PosEtc.ETC_SALE_DPST_WTHDR.DATA.SALE_DT] = m_cPosStatus.Global.DateToCulture(dr[PosEtc.ETC_SALE_DPST_WTHDR.DATA.SALE_DT].ToString());
dr[PosEtc.ETC_SALE_DPST_WTHDR.DATA.DPST_WTHDR_AMT] = m_cPosStatus.Global.NumericTOCurrency(m_cDataService.DoubleParse(dr[PosEtc.ETC_SALE_DPST_WTHDR.DATA.DPST_WTHDR_AMT].ToString()));
// 구분 처리
string sDpst_Wthdr_Flag = dr["DPST_WTHDR_CD_NM"].ToString();
if (sDpst_Wthdr_Flag == "01")
{
dr["DPST_WTHDR_CD_NM"] = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0486);
}
else if (sDpst_Wthdr_Flag == "02")
{
dr["DPST_WTHDR_CD_NM"] = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0524);
}
}
//그리드 적용!
dgvDataList.CsmGridDataSource = dtData;
dgvDataList.CsmGridSelectRow(0);
}
else
{
//데이터 없음!
dgvDataList.CsmGridDataSource = m_dtItemInit2;
WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0302));
}
}
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);
}
}
/// <summary>
/// 계정선택 DataGridView와 Data 연결
/// </summary>
public void GetAccInfo(int nFlag)
{
try
{
DataTable dtData = new DataTable();
if (nFlag == 1)
{
btnDpst.BackColor = Color.FromArgb(22, 187, 238);
btnDmnt.BackColor = Color.FromArgb(178, 178, 178);
dtData = m_cDataCommon.SeletMstDpstWthdrAccDtl("01", "31");
}
else
{
btnDmnt.BackColor = Color.FromArgb(22, 187, 238);
btnDpst.BackColor = Color.FromArgb(178, 178, 178);
dtData = m_cDataCommon.SeletMstDpstWthdrAccDtl("02", "31");
}
if (dtData != null && dtData.Rows.Count > 0)
{
//그리드 적용!
dgvData.CsmGridDataSource = dtData;
dgvData.CsmGridSelectRow(0);
}
else
{
//데이터 없음!
dgvData.CsmGridDataSource = m_dtItemInit;
}
}
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 User Method
private void btnDateFrom_Click(object sender, EventArgs e)
{
try
{
string sDate = WinBasic.ShowForm(new string[] { FormManager.FORM_CALENDAR });
if (sDate != "" && sDate.Length == 8)
{
txtDateFrom.Text = m_cPosStatus.Global.DateToCulture(sDate);
}
}
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 btnDateTo_Click(object sender, EventArgs e)
{
try
{
string sDate = WinBasic.ShowForm(new string[] { FormManager.FORM_CALENDAR });
if (sDate != "" && sDate.Length == 8)
{
txtDateTo.Text = m_cPosStatus.Global.DateToCulture(sDate);
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
}
}