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

1102 lines
48 KiB
C#

using System;
using System.Drawing;
using System.Windows.Forms;
using Cosmos.BaseFrame;
using Cosmos.UserFrame;
using Cosmos.ServiceProvider;
using Cosmos.Common;
using Cosmos.CommonManager;
using System.Data;
namespace Cosmos.Win
{
public partial class frmReservedFinsh : Form
{
#region Variable
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 IDataProcessUs m_cDataService = null;
private ISalePluItemUs m_cPluService = null; //판매 등록 관리
private IDataCommonUs m_cDataCommon = null; // POS 공통함수 인터페이스
private ISaleReserved m_cSaleBasic = null;
private DeviceStatus m_cDevStatus = new DeviceStatus(); // 디바이스 관리
private PosOLEDevice.DelegateOlePos delegatePos;
private DataTable m_dtItemInit; // 조회 상품 리스트
private string m_sPosMenuKeyOut;
public string PosMenuKeyOut { set { m_sPosMenuKeyOut = value; } get { return m_sPosMenuKeyOut; } }
#endregion
#region &
public frmReservedFinsh()
{
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_cPluService = (ISalePluItemUs)sManager.InitServiceInstance(ServiceLists.BSV_SALE.DLL, ServiceLists.BSV_SALE.SALE_PLU_ITEM);
m_cSaleBasic = (ISaleReserved)sManager.InitServiceInstance(ServiceLists.BSV_SALE.DLL, ServiceLists.BSV_SALE.RESERVATION);
delegatePos = new PosOLEDevice.DelegateOlePos(OnDeviceEvent);
m_cDevStatus = (DeviceStatus)StateObject.DEVICE;
ComboBoxInit();
}
/// <summary>
/// 폼로드
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void frmReservedFinsh_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();
}
/// <summary>
/// 폼클로즈
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void frmReservedFinsh_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 + "()", "");
}
/// <summary>
/// 폼엑티브
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void frmReservedFinsh_Activated(object sender, EventArgs e)
{
PosOLEDevice.SetEventHandle(delegatePos);
}
/// <summary>
/// 폼디엑티브
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void frmReservedFinsh_Deactivate(object sender, EventArgs e)
{
PosOLEDevice.SetEventHandle(null);
}
#endregion &
#region
/// <summary>
/// 폼 컨트롤 초기화
/// </summary>
private void InitControl()
{
try
{
// 이미지 로딩 처리
picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_SIZE_800X600);
//this.Size = new Size(800, 600);
//this.Location = new Point(170, 173);
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);
//테마색상 적용!
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);
btnDw.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_14X9_DOWN1_BASIC);
if (btnUp.Image != null) btnUp.Text = "";
if (btnDw.Image != null) btnDw.Text = "";
btnExit.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BTN_CLOSE);
if (btnExit.Image != null) btnExit.Text = "";
btnDate.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.ICON_DATE_BASIC);
if (btnDate.Image != null) btnDate.Text = "";
lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0078);
lblReservedDate.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0189);
lblReservedType.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0067);
lblReservedCustNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0279);
lblReservOnOff.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0494); //주문구분
ckbOn.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0495); //온라인
ckbOff.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0496); //오프라인
//lblReservedAdvan.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0282);
//lblReservedBalan.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0281);
btnDel.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0291);
btnLoad.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0078);
BtnPrt.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0257);
btnSearch.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0004);
//dtpReservedDate.Value = DateTime.ParseExact(m_cPosStatus.Base.SaleDate, "yyyyMMdd", null);
txtSaleDate.InputTypeFormat = m_cPosStatus.Global.m_stCultureMaster.strDatePattern;
txtSaleDate.Text = m_cPosStatus.Global.DateToCulture(m_cPosStatus.Base.SaleDate);
//dtpReservedDate.Value = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day);
InitializeGrid();
txtPrtData.Text = "";
txtPrtData.Tag = "";
m_sPosMenuKeyOut = "";
txtReservedCustNo.Text = "";
ckbOn.Checked = true;
ckbOff.Checked = false;
//ReservedSearch();
vScrollbar.Attach(txtPrtData);
txtReservedCustNo.Select();
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
/// <summary>
/// 그리드 초기화
/// </summary>
private void InitializeGrid()
{
try
{
// 상품권 등록정보 표시 그리드
grdSearchItem.CsmGridColumnHeadersVisible = true; //DataGridView 자체의 컬럼 헤더 Visible 여부
grdSearchItem.CsmGridColumnHeadersHeight = 37; //DataGridView 자체의 컬럼 헤더 높이
grdSearchItem.CsmGridRowsHeight = 38;
grdSearchItem.CsmGridColumnCount = 19; //그리드의 컬럼수
grdSearchItem.CsmGridShowPageRowsCount = 3; //그리드의 한 화면에 보이는 로우수
grdSearchItem.CsmGridSetHeaderBackColor(236, 238, 239); //그리드 헤더 배경색
grdSearchItem.CsmGridDefaultRowBackColor = Color.FromArgb(255, 255, 255); //그리드 홀수(Default)행의 배경색 지정
grdSearchItem.CsmGridAlternateRowBackColor = Color.FromArgb(251, 253, 255); //그리드 짝수(Alternate)행의 배경색 지정
grdSearchItem.CsmGridBackGroundColor = Color.FromArgb(251, 253, 255); //기본 백그라운드 컬러
grdSearchItem.CsmGridHighlightColor = Color.FromArgb(255, 251, 211); //그리드 선택 백 컬러
grdSearchItem.CsmGridHighlightTextColor = Color.Black; //그리드 선택 글자 컬러
grdSearchItem.CsmGridSetColumnWidth(new int[] { 30, 90, 90, 90, 80, 80, 70, 60, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); //컬럼넓이 지정(726)
grdSearchItem.CsmGridAlignment(new int[] { 2, 1, 1, 1, 2, 2, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }); //컬럼 정렬 0:왼쪽, 1:가운데, 2:오른쪽
//각 컬럼별 이름 지정
grdSearchItem.CsmGridColumnName(0, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0014));
grdSearchItem.CsmGridColumnName(1, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0292));
grdSearchItem.CsmGridColumnName(2, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0294));
grdSearchItem.CsmGridColumnName(3, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0279));
grdSearchItem.CsmGridColumnName(4, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0282));
grdSearchItem.CsmGridColumnName(5, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0281));
grdSearchItem.CsmGridColumnName(6, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0067));
grdSearchItem.CsmGridColumnName(7, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0278));
grdSearchItem.CsmGridColumnName(8, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0177));
grdSearchItem.CsmGridColumnName(9, "SALE_AMT");
grdSearchItem.CsmGridColumnName(10, "CMP_CD");
grdSearchItem.CsmGridColumnName(11, "SALE_DT");
grdSearchItem.CsmGridColumnName(12, "STOR_CD");
grdSearchItem.CsmGridColumnName(13, "POS_NO");
grdSearchItem.CsmGridColumnName(14, "TRADE_NO");
grdSearchItem.CsmGridColumnName(15, "RESERV_NO");
grdSearchItem.CsmGridColumnName(16, "FNS_FLG");
grdSearchItem.CsmGridColumnName(17, "FNS_SALE_DT");
grdSearchItem.CsmGridColumnName(18, "FNS_POS_NO");
grdSearchItem.CsmGridColumnName(19, "FNS_TRADE_NO");
//그리드 초기화 테이블
m_dtItemInit = new DataTable("INIT");
m_dtItemInit.Columns.Add(new DataColumn("NO", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("REG_DT", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("RESERV_DT", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("PHONE", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("AFTER", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("BEFORE", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("STAT", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("NAME", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("MEMO", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("SALE_AMT", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("CMP_CD", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("SALE_DT", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("POS_NO", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("TRADE_NO", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("RESERV_NO", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("FNS_FLG", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("FNS_SALE_DT", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("FNS_POS_NO", typeof(string)));
m_dtItemInit.Columns.Add(new DataColumn("FNS_TRADE_NO", typeof(string)));
m_dtItemInit.Clear();
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
/// <summary>
/// 콤보박스 초기화
/// </summary>
private void ComboBoxInit()
{
try
{
//상품 유형 셋팅
cbReservedType.Items.Add("0-" + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0291)); //취소
cbReservedType.Items.Add("1-" + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0077)); //등록
//#Rhee, 20180119 검색조건 픽업완료와 예약완료 구분 Start
// 기존
//cbReservedType.Items.Add("3-" + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0078)); //완료
//cbReservedType.Items.Add("4-" + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0226)); //전체
//cbReservedType.Items.Add("5-" + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0213)); //부분결제
//cbReservedType.Items.Add("6-" + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0214)); //전체결제
// 변경
cbReservedType.Items.Add("3-" + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0426)); //완료(픽업)
cbReservedType.Items.Add("4-" + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0078)); //전체(예약)
cbReservedType.Items.Add("5-" + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0213)); //부분결제
cbReservedType.Items.Add("6-" + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0214)); //전체결제
cbReservedType.Items.Add("7-" + MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0226)); //전체
//#Rhee, 20180119 검색조건 픽업완료와 예약완료 구분 End
cbReservedType.SelectedIndex = 3;
}
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 Control Event
#region
/// <summary>
/// 버튼 입력 처리
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnProc_Click(object sender, EventArgs e)
{
try
{
if (((Cosmos.UI.CsmButton)sender) == btnDel) // 취소
{
CancelReserved();
}
else if (((Cosmos.UI.CsmButton)sender) == btnLoad) // 불러오기
{
//#Rhee, 20170117 예약완료(잔금 없을 경우-픽업전)인 경우 픽업 진행 추가 Start
string sStat = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 16);
double dBeforeAmt = Convert.ToDouble(grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 5));
if((sStat == "4") || (sStat == "1" && dBeforeAmt == 0.0))
{
PickupReserved();
}
// 기존
//if(LoadReserved() == true)
// 변경
else if (LoadReserved() == true)
//#Rhee, 20170117 예약완료(잔금 없을 경우-픽업전)인 경우 픽업 진행 추가 Start
{
this.DialogResult = DialogResult.OK;
this.Close();
}
}
else if (((Cosmos.UI.CsmButton)sender) == BtnPrt) // 프린트
{
PrintReserved();
}
else if (((Cosmos.UI.CsmButton)sender) == btnSearch) // 조회
{
ReservedSearch();
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
#endregion
/// <summary>
/// 조회 그리드 업/다운 클릭 이벤트
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnSelProc_Click(object sender, EventArgs e)
{
try
{
if ((UI.CsmButton)sender == btnUp)
{
grdSearchItem.CsmGridScroll("UP");
}
else if ((UI.CsmButton)sender == btnDw)
{
grdSearchItem.CsmGridScroll("DOWN");
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
/// <summary>
/// 그리드 클릭 이벤트
/// </summary>
/// <param name="sender"></param>
/// <param name="rowIndex"></param>
private void grdSearchItem_GridClickEvent(object sender, string rowIndex)
{
try
{
string sSaleData = string.Empty;
string sPosNo = string.Empty;
string sTradeNo = string.Empty;
string sJnlData = string.Empty;
DataTable dt = null;
if (grdSearchItem.CsmGridRowsCount == 0)
{
return;
}
//#Rhee, 20180119 미주 예약 관련 영수증 최종 결제금액 기준 표기 수정 Start
// 기존
//sSaleDatarchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 13);
//sTradeNo = grdS = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 11);
//sPosNo = grdSeaearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 14);
string sStat = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 16);
if (sStat == "3" || sStat == "4")
{
sSaleData = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 17);
sPosNo = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 18);
sTradeNo = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 19);
}
else
{
sSaleData = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 11);
sPosNo = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 13);
sTradeNo = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 14);
}
//#Rhee, 20180119 미주 예약 관련 영수증 최종 결제금액 기준 표기 수정 end
dt = m_cSaleBasic.SearchReservedFinshPrint(sSaleData, sPosNo, sTradeNo);
if (dt == null || dt.Rows.Count == 0)
{
txtPrtData.Text = "";
txtPrtData.Tag = "";
}
else
{
foreach (DataRow dr in dt.Rows)
{
sJnlData = dr[0].ToString();
txtPrtData.Text = PrintDispCuting(sJnlData);
txtPrtData.Tag = sJnlData;
break;
}
}
//#Rhee, 20180108 픽업전 후 번튼 변경 Start
double dBefore = Convert.ToDouble(grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 5));
//string sStat = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 16);
if ((sStat == "3" || sStat == "4") || (sStat == "1" && dBefore == 0.0))
{
btnLoad.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0426);
}
else
{
btnLoad.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0078);
}
//#Rhee, 20180108 픽업전 후 번튼 변경 End
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
/// <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)
{
//조회
ReservedSearch();
}
else if (sFuncValue == PosKey.MENU_KEY.SAVE)
{
}
else if (sFuncValue == PosKey.MENU_KEY.CLEAR)
{
if (((Cosmos.UI.CsmPosEditBox)sender).ReadOnly == false) ((Cosmos.UI.CsmPosEditBox)sender).Text = "";
}
else if (sFuncValue == PosKey.MENU_KEY.ESC_PREVIOUS)
{
m_sPosMenuKeyOut = "";
m_cDataService.TranComplete();
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);
}
}
/// <summary>
/// 종료
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnExit_Click(object sender, EventArgs e)
{
txtEditBox_EditBoxKeyDownEvent(null, PosKey.MENU_KEY.ESC_PREVIOUS);
}
/// <summary>
/// 콤보박스 이벤트
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void dtpReservedDate_TextChanged(object sender, EventArgs e)
{
try
{
//조회
//ReservedSearch();
}
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 User Method
/// <summary>
/// 예약 데이터 조회
/// </summary>
private void ReservedSearch()
{
try
{
DataTable dt = null;
string sSaleDate = m_cPosStatus.Global.CultureToDate(txtSaleDate.Text);
dt = m_cSaleBasic.SearchReservedFinshList(sSaleDate, cbReservedType.Text.Substring(0, 1), txtReservedCustNo.Text, ckbOn.Checked == true ? "0" : "1");
if(dt == null || dt.Rows.Count == 0)
{
//데이터 없음!
grdSearchItem.CsmGridDataSource = m_dtItemInit;
txtPrtData.Text = "";
txtPrtData.Tag = "";
WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0302));
}
else
{
string sData ="";
string sTime = "";
foreach (DataRow dr in dt.Rows)
{
sData = m_cPosStatus.Global.DateToCulture(CmUtil.MidH(dr["RESERV_DT"].ToString(),0,8));
sTime = CmUtil.StrToTime(CmUtil.MidH(dr["RESERV_DT"].ToString(),8,6));
dr["RESERV_DT"] = string.Format("{0} \n{1}", sData, sTime);
sData = m_cPosStatus.Global.DateToCulture(CmUtil.MidH(dr["REG_RESERV_DT"].ToString(),0,8));
sTime = CmUtil.StrToTime(CmUtil.MidH(dr["REG_RESERV_DT"].ToString(),8,6));
dr["REG_RESERV_DT"] = string.Format("{0} \n{1}", sData, sTime);
dr["AFTER"] = m_cPosStatus.Global.NumericTOCurrency(m_cDataService.DoubleParse(dr["AFTER"].ToString()));
dr["BEFORE"] = m_cPosStatus.Global.NumericTOCurrency(m_cDataService.DoubleParse(dr["BEFORE"].ToString()));
}
//그리드 적용!
grdSearchItem.CsmGridDataSource = dt;
grdSearchItem.CsmGridSelectRow(0);
grdSearchItem_GridClickEvent(null, null);
}
txtReservedCustNo.Select();
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
/// <summary>
/// 저널 데이터 컷팅
/// </summary>
/// <param name="sPrtData"></param>
/// <returns></returns>
private string PrintDispCuting(string sPrtData)
{
string sRecvData = string.Empty;
int iDataLen = 0;
try
{
while(iDataLen <= sPrtData.Length)
{
sRecvData += CmUtil.MidH(sPrtData, iDataLen + 5, 42) + PosConst.CRLF;
iDataLen += 47;
}
}
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 sRecvData;
}
/// <summary>
/// 예약영수증 불러오기
/// </summary>
/// <returns></returns>
private bool LoadReserved()
{
bool bRet = false;
try
{
if (grdSearchItem.CsmGridRowsCount == 0)
{
return bRet;
}
if(grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 16) != "1" )
{
return bRet;
}
string sSaleDate = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 11);
string sPosNo = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 13);
string sTradeNo = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 14);
string sAfterAmt = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 4);
////매출 데이터 조회
//if (m_cSaleBasic.SetTrItem(sSaleData, sPosNo, sTradeNo, sAfterAmt) == UserCom.RST_OK)
//{
// bRet = true;
//}
//매출 데이터 조회
if (m_cSaleBasic.LoadLocalTran(sSaleDate, sPosNo, sTradeNo, false) == true)
{
// 원거래 정보 설정
m_cTrnStatus.Head.OrgSaleDate = sSaleDate;
m_cTrnStatus.Head.OrgPosNo = sPosNo;
m_cTrnStatus.Head.OrgTradeNo = sTradeNo;
bRet = true;
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return bRet;
}
//#Rhee, 20180117 예약완료(잔금 없을경우 - 픽업전)인 경우 픽업 진행 추가 Start
/// <summary>
/// 예약 픽업
/// </summary>
/// <returns></returns>
private string PickupReserved()
{
bool bRet = false;
string sRet = UserCom.RST_ERR;
string sCmpCd = "", sStorCd = "", sSaleDate = "", sPosNo = "", sTradeNo = "", sStat = "";
double dBeforeAmt = 0.0;
try
{
if (grdSearchItem.CsmGridRowsCount == 0)
{
return sRet;
}
sStat = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 16);
dBeforeAmt = Convert.ToDouble(grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 5));
sCmpCd = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 10);
sStorCd = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 12);
if (WinManager.QuestionMessage(POS_MESSAGE.ERROR.MSG_0769) != true) return sRet;
if (sStat == "4")
{
sSaleDate = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 17);
sPosNo = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 18);
sTradeNo = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 19);
// 부분(선금+잔금)결제 후 픽업처리
sRet = m_cSaleBasic.PickupReservedCom(sCmpCd, sStorCd, sSaleDate, sPosNo, sTradeNo, "0");
// 거래데이터 완료 후 데이터 초기화 처리
bool bIncTradeNo = m_cDataCommon.TradeNoAddCheck("");
m_cDataService.TranComplete();
m_cDataService.SetMsgNoInc(true, !bIncTradeNo, bIncTradeNo); // 거래번호 증가
}
else if(sStat == "1" && (dBeforeAmt == 0.0))
{
sSaleDate = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 11);
sPosNo = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 13);
sTradeNo = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 14);
// 전액결제 후 픽업진행시 예약완료 처리
bRet = PickupReservedComFirst(sCmpCd, sStorCd, sSaleDate, sPosNo, sTradeNo, sStat);
if (bRet == false) return UserCom.RST_ERR;
//픽업처리
sTradeNo = m_cTrnStatus.Head.TradeNo; // 예약완료된 거래번호 가져오기
sRet = m_cSaleBasic.PickupReservedCom(sCmpCd, sStorCd, sSaleDate, sPosNo, sTradeNo, "0");
}
ReservedSearch();
}
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;
}
private bool PickupReservedComFirst(string sCmpCd, string sStorCd, string sSaleDate, string sPosNo, string sTradeNo, string sStat)
{
bool bRet = false;
try
{
//ISaleRefundUs m_cSaleRefund = (ISaleRefundUs)sManager.InitServiceInstance(ServiceLists.BSV_SALE.DLL, ServiceLists.BSV_SALE.SALE_REFUND);
//// 거래데이터 로딩 처리
//bRet = m_cSaleRefund.LoadLocalTran(sSaleDate, sPosNo, sTradeNo);
bRet = m_cSaleBasic.LoadLocalTran(sSaleDate, sPosNo, sTradeNo, true);
if (bRet == false) return bRet;
// 거래구분 설정 => 정상
m_cTrnStatus.Head.TradeDiv = "0";
// 원거래 정보 설정
m_cTrnStatus.Head.OrgSaleDate = sSaleDate;
m_cTrnStatus.Head.OrgPosNo = sPosNo;
m_cTrnStatus.Head.OrgTradeNo = sTradeNo;
m_cTrnStatus.Head.TradeKind = ItemConst.TRAN_KIND.UNDECIDED.RESERVATION_COMPLETE;
// 거래 완료 처리(거래번호 증가처리)
ISaleCompleteUs m_cSaleComplete = (ISaleCompleteUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.SALE_COMPLETE);
string sRet = m_cSaleComplete.PosSaleExecute(new string[] { });
if (sRet != UserCom.RST_OK) return bRet;
bRet = true;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return bRet;
}
//#Rhee, 20180117 예약완료(잔금 없을경우 - 픽업전)인 경우 픽업 진행 추가 End
/// <summary>
/// 예약 취소
/// </summary>
/// <returns></returns>
private bool CancelReserved()
{
bool bRet = false;
string sSaleDate = "", sPosNo = "", sTradeNo = "", sStat = "";
try
{
if (grdSearchItem.CsmGridRowsCount == 0)
{
return bRet;
}
sStat = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 16);
//#Rhee, 20180118 예약완료(픽업전) 상태로 반품 처리 Start
// 기존
//if (!(sStat == "1" || sStat == "3"))
// 변경
if (!(sStat == "1" || sStat == "3" || sStat == "4"))
//#Rhee, 20180118 예약완료(픽업전) 상태로 반품 처리 End
{
return bRet;
}
if (WinManager.QuestionMessage(POS_MESSAGE.ERROR.MSG_0253) != true) return bRet;
if (sStat == "3")
{
sSaleDate = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 17);
sPosNo = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 18);
sTradeNo = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 19);
bRet = CancelReservedCom(sSaleDate, sPosNo, sTradeNo, sStat);
// 예약 등록 내역까지 취소 하시겠습니까?
if (WinManager.QuestionMessage(POS_MESSAGE.ERROR.MSG_0586) == false)
{
ReservedSearch();
return bRet;
}
sStat = "1";
}
sSaleDate = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 11);
sPosNo = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 13);
sTradeNo = grdSearchItem.CsmGridGetCell(grdSearchItem.CsmGridSelectedRowIndex, 14);
bRet = CancelReservedCom(sSaleDate, sPosNo, sTradeNo, sStat);
ReservedSearch();
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return bRet;
}
private bool CancelReservedCom(string sSaleDate, string sPosNo, string sTradeNo, string sStats)
{
bool bRet = false;
try
{
//ISaleRefundUs m_cSaleRefund = (ISaleRefundUs)sManager.InitServiceInstance(ServiceLists.BSV_SALE.DLL, ServiceLists.BSV_SALE.SALE_REFUND);
//// 거래데이터 로딩 처리
//bRet = m_cSaleRefund.LoadLocalTran(sSaleDate, sPosNo, sTradeNo);
bRet = m_cSaleBasic.LoadLocalTran(sSaleDate, sPosNo, sTradeNo, true);
if (bRet == false) return bRet;
// 반품 사유코드 등록
frmSelReasonCode fForm = (frmSelReasonCode)FormManager.GetForm(FormManager.FORM_REASON_CODE);
if (fForm == null)
{
fForm = new frmSelReasonCode();
FormManager.AddForm(FormManager.FORM_REASON_CODE, fForm);
}
fForm.ReasonGroup = PosConst.COMMON_CODE_GROUP.Z0008; // 사유 그룹코드
if (fForm.ShowDialog() != DialogResult.OK)
{
m_cDataService.TranComplete();
return false;
}
m_cTrnStatus.Head.RtnReasonCd = fForm.ReasonCode; // 선택된 사유코드
m_cTrnStatus.Head.RtnReasonMemo = fForm.ReasonName; // 선택된 사유명
// 거래구분 설정 => 반품
m_cTrnStatus.Head.TradeDiv = ItemConst.TRAN_DIV.REFUND;
// 원거래 정보 설정
m_cTrnStatus.Head.OrgSaleDate = sSaleDate;
m_cTrnStatus.Head.OrgPosNo = sPosNo;
m_cTrnStatus.Head.OrgTradeNo = sTradeNo;
//#Rhee, 20180118 픽업대기 반품시 등록상태로 변경 Srart
// 기존
//if (sStats == "1")
// 변경
if (sStats == "1" || sStats == "4")
//#Rhee, 20180118 픽업대기 반품시 등록상태로 변경 End
{
m_cTrnStatus.Head.TradeKind = ItemConst.TRAN_KIND.UNDECIDED.RESERVATION_REG;
}
else if (sStats == "3")
{
m_cTrnStatus.Head.TradeKind = ItemConst.TRAN_KIND.UNDECIDED.RESERVATION_COMPLETE;
}
// 영수증 반품
frmRefundPay fFormPay = (frmRefundPay)FormManager.GetForm(FormManager.FORM_SAL_RETURN_RECEIPT_PAY);
if (fFormPay == null)
{
fFormPay = new frmRefundPay();
FormManager.AddForm(FormManager.FORM_SAL_RETURN_RECEIPT_PAY, fFormPay);
}
if (fFormPay.ShowDialog() != DialogResult.OK)
{
m_cDataService.TranComplete();
return false;
}
// 거래 완료 처리
ISaleCompleteUs m_cSaleComplete = (ISaleCompleteUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.SALE_COMPLETE);
string sRet = m_cSaleComplete.PosSaleExecute(new string[] { });
if (sRet != UserCom.RST_OK) return bRet;
bRet = true;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return bRet;
}
/// <summary>
/// 예약 영수증 출력
/// </summary>
/// <returns></returns>
private bool PrintReserved()
{
bool bRet = false;
try
{
if (txtPrtData.Tag.ToString().Trim() == "")
{
return bRet;
}
m_cSaleBasic.PrintReservedFinsh(txtPrtData.Tag.ToString());
//bRet = m_cSaleBasic.PrintReserved(txtPrtData.Tag.ToString());
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return bRet;
}
#endregion
#region DeviceEvent
/// <summary>
/// DeviceEvent 관련
/// </summary>
/// <param name="sDevice"></param>
/// <param name="sData1"></param>
/// <param name="sData2"></param>
/// <param name="sData3"></param>
public void OnDeviceEvent(string sDevice, string sData1, string sData2, string sData3)
{
try
{
switch (sDevice)
{
case PosConst.OPOS_DEVICE.MSR:
this.Invoke(new EventHandler(OnMSREvent));
break;
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
#region MSR Event
/// <summary>
/// MSR Event
/// </summary>
/// <param name="source"></param>
/// <param name="e"></param>
private void OnMSREvent(object source, EventArgs e)
{
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);
}
}
#endregion MSR Event
#endregion DeviceEvent
private void btnDate_Click(object sender, EventArgs e)
{
try
{
string sDate = WinBasic.ShowForm(new string[] { FormManager.FORM_CALENDAR });
if (sDate != "" && sDate.Length == 8)
{
txtSaleDate.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 ckbOn_Click(object sender, EventArgs e)
{
ckbOff.Checked = !ckbOn.Checked;
}
private void ckbOff_Click(object sender, EventArgs e)
{
ckbOn.Checked = !ckbOff.Checked;
}
}
}