780 lines
34 KiB
C#
780 lines
34 KiB
C#
using System;
|
|
using System.Text;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
using System.Collections;
|
|
|
|
using Cosmos.Win;
|
|
using Cosmos.BaseFrame;
|
|
using Cosmos.UserFrame;
|
|
using Cosmos.ServiceProvider;
|
|
using Cosmos.Common;
|
|
using Cosmos.CommonManager;
|
|
using Cosmos.UI;
|
|
|
|
/*-----------------------------------------------------------------------------------------------*/
|
|
// 설 명 : 잔액교환권
|
|
// 작 성 자 :
|
|
// 변경 이력 :
|
|
/*-----------------------------------------------------------------------------------------------*/
|
|
namespace Cosmos.Win
|
|
{
|
|
public partial class frmExchangeTicket : frm_PayMainBack
|
|
{
|
|
|
|
#region 변수 선언
|
|
|
|
private SManager sManager = new SManager(); // 이 객체를 통해 업무 Service 호출
|
|
private StateServer StateObject = (StateServer)StateServer.GetInstance(); // StateObject : StateServer Object (객체)
|
|
private PosStatus m_cPosStatus = new PosStatus(); // 기본정보 참조
|
|
private TranStatus m_cTrnStatus = new TranStatus(); // 거래정보 참조
|
|
private DeviceStatus m_cDevStatus = new DeviceStatus(); // 디바이스 관리
|
|
|
|
private IDataCommonUs m_cDataCommon = null; // POS 공통함수 인터페이스
|
|
private IDataProcessUs m_cDataService = null;
|
|
private IPaymentUs m_cExchangeTicket = null;
|
|
|
|
private string m_sPosMenuKeyIn;
|
|
public string PosMenuKeyIn { set { m_sPosMenuKeyIn = value; } get { return m_sPosMenuKeyIn; } }
|
|
private string m_sPosMenuKeyOut;
|
|
public string PosMenuKeyOut { set { m_sPosMenuKeyOut = value; } get { return m_sPosMenuKeyOut; } }
|
|
|
|
private bool bNotDoubleClik = false; // 더블 클릭 방지용
|
|
|
|
private string m_sPosMenuKey; // 입력코드
|
|
/// <summary>
|
|
/// 할인 구분
|
|
/// </summary>
|
|
public string SetPosMenuKey { set { this.m_sPosMenuKey = value; } }
|
|
|
|
/// <summary>
|
|
/// 입력구분
|
|
/// </summary>
|
|
private string m_sInPutType = "";
|
|
/// <summary>
|
|
/// 입력데이터
|
|
/// </summary>
|
|
private string m_sInPutData = "";
|
|
/// <summary>
|
|
/// 카드데이터
|
|
/// </summary>
|
|
private string m_sInEncData = "";
|
|
/// <summary>
|
|
/// 결제구분
|
|
/// </summary>
|
|
private string m_sPay_DC_Grp_Type = "";
|
|
/// <summary>
|
|
/// 결제상세구분
|
|
/// </summary>
|
|
private string m_sPay_DC_CD = "";
|
|
|
|
/// <summary>
|
|
/// 잔액교환권 금액
|
|
/// </summary>
|
|
private double nExchangeTicketAmt = 0;
|
|
/// <summary>
|
|
/// 잔액교환권 발행구분
|
|
/// </summary>
|
|
private string sExchange_Ticket_Type = "";
|
|
/// <summary>
|
|
/// 잔액교환권 번호
|
|
/// </summary>
|
|
private string sExchange_Ticket_No = "";
|
|
|
|
#endregion 변수 선언
|
|
|
|
#region 생성자 & 소멸자 & 폼초기화
|
|
public frmExchangeTicket()
|
|
{
|
|
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_cExchangeTicket = (IPaymentUs)sManager.InitServiceInstance(ServiceLists.BSV_PAYMENT.DLL, ServiceLists.BSV_PAYMENT.EXCHANGETICKET);
|
|
}
|
|
|
|
private void frmExchangeTicket_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 frmExchangeTicket_Activated(object sender, EventArgs e)
|
|
{
|
|
}
|
|
|
|
private void frmExchangeTicket_Deactivate(object sender, EventArgs e)
|
|
{
|
|
PosOLEDevice.SetEventHandle(null);
|
|
}
|
|
|
|
private void frmExchangeTicket_FormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", lblTitle.Text);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 폼 컨트롤 초기화
|
|
/// </summary>
|
|
private void InitControl()
|
|
{
|
|
try
|
|
{
|
|
// 이미지 로딩 처리
|
|
//picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_SIZE_S);
|
|
//this.Size = new Size(788, 402);
|
|
//this.Location = new Point(216, 173);
|
|
//picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_SIZE_S);
|
|
this.Location = new Point(0, 50);
|
|
this.Size = new Size(1024, 525);
|
|
//this.BackColor = Color.FromArgb(114, 114, 114);
|
|
|
|
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);
|
|
|
|
btnExit.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BTN_CLOSE);
|
|
if (btnExit.Image != null) btnExit.Text = "";
|
|
|
|
IDataCommonUs m_cDataCommon = (IDataCommonUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_COMMON);
|
|
InitPayMainBack(m_cPosStatus, m_cDataCommon, m_sPosMenuKey, PosConst.MOT_MSG_TYPE.PAY_STEP_3, "");
|
|
|
|
|
|
//테마색상 적용!
|
|
btnComplete.BackColor = CmUtil.GetColorToString(m_cPosStatus.ScnMst.ThemeColor);
|
|
|
|
// 타이틀
|
|
if (m_sPosMenuKey == PosKey.MENU_KEY.BALANCE_VOUCHER) lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0265);
|
|
|
|
m_sPay_DC_Grp_Type = ItemConst.TR_ITEM_ID.PAYETC_ITEM;
|
|
m_sPay_DC_CD = ItemConst.TR_ITEM_ID.PAYETC.BALANCE_VOUCHER;
|
|
|
|
lblPayAmt.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0037);
|
|
lblExchangeTicketNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0276);
|
|
lblExchangeTicketAmt.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0277);
|
|
//lblSaleAmt.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0049);
|
|
|
|
btnSearch.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0004); // 조회
|
|
btnComplete.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0263); // 결제
|
|
btnExchangeTicket.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0266); // 교환권
|
|
|
|
txtPayAmt.Text = m_cPosStatus.Global.NumericTOCurrency(m_cTrnStatus.Sale.RemainPayAmt); // 받을금액
|
|
txtExchangeTicketNo.Text = "";
|
|
//txtSaleAmt.Text = "0";
|
|
txtExchangeTicketAmt.Text = "";
|
|
|
|
m_sInPutType = ""; // 입력구분
|
|
m_sInPutData = ""; // 입력데이터
|
|
m_sInEncData = ""; // 카드데이터
|
|
|
|
nExchangeTicketAmt = 0; // 잔액교환권 금액
|
|
sExchange_Ticket_Type = ""; // 잔액교환권 발행구분
|
|
sExchange_Ticket_No = ""; // 잔액교환권 번호
|
|
|
|
//SetAmountPay(); // 금액 단축키 설정
|
|
|
|
bNotDoubleClik = false;
|
|
|
|
// 기능 버튼 설정 체크
|
|
FormManager.SetbtnMenu(null, m_cDevStatus.ICReader.UseYn, btnMenu1, btnMenu2, btnMenu3, btnMenu4);
|
|
|
|
txtExchangeTicketNo.Select();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 버튼 입력 처리
|
|
/// <summary>
|
|
/// 버튼 입력 처리
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void btnProc_Click(object sender, EventArgs e)
|
|
{
|
|
string sRet = UserCom.RST_ERR;
|
|
try
|
|
{
|
|
if (bNotDoubleClik) return;
|
|
bNotDoubleClik = true;
|
|
|
|
if (((Cosmos.UI.CsmButton)sender) == btnSearch) // 조회
|
|
{
|
|
// 조회
|
|
SearchTxtInPut();
|
|
|
|
bNotDoubleClik = false;
|
|
return;
|
|
}
|
|
if (((Cosmos.UI.CsmButton)sender) == btnExchangeTicket) // 교환권
|
|
{
|
|
// 잔액교환권
|
|
sRet = CompleteTxtInPut(true);
|
|
|
|
bNotDoubleClik = false;
|
|
if (sRet != UserCom.RST_OK) return;
|
|
|
|
this.DialogResult = DialogResult.OK;
|
|
this.Close();
|
|
return;
|
|
}
|
|
else if (((Cosmos.UI.CsmButton)sender) == btnComplete) // 결제
|
|
{
|
|
// 결제
|
|
sRet = CompleteTxtInPut(false);
|
|
|
|
bNotDoubleClik = false;
|
|
if (sRet != UserCom.RST_OK) return;
|
|
|
|
this.DialogResult = DialogResult.OK;
|
|
this.Close();
|
|
return;
|
|
}
|
|
else if (((UI.CsmButton)sender).Tag.ToString().StartsWith("0") == true) // 금액 설정
|
|
{
|
|
//txtSaleAmt.Value = ((UI.CsmButton)sender).Tag.ToString().Substring(1);
|
|
//txtEditBox_EditBoxKeyDownEvent(txtSaleAmt, PosKey.MENU_KEY.ENTER);
|
|
}
|
|
else
|
|
{
|
|
//txtSaleAmt.Value = CmUtil.DoubleAdd(m_cDataService.DoubleParse(txtSaleAmt.Value), m_cDataService.DoubleParse(((UI.CsmButton)sender).Tag.ToString().Substring(1))).ToString();
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 닫기
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void btnExit_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
txtEditBox_EditBoxKeyDownEvent(null, PosKey.MENU_KEY.ESC_PREVIOUS);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 텍스트박스 키 입력 이벤트 처리
|
|
/// <summary>
|
|
/// 텍스트박스 키 입력 이벤트 처리
|
|
/// </summary>
|
|
/// <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) == txtExchangeTicketNo)
|
|
{
|
|
SearchTxtInPut();
|
|
}
|
|
|
|
}
|
|
//else if (sFuncValue == PosKey.MENU_KEY.ENTER)
|
|
//{
|
|
// if (((Cosmos.UI.CsmPosEditBox)sender) == txtSaleAmt)
|
|
// {
|
|
// SearchTxtInPut();
|
|
// }
|
|
|
|
//}
|
|
else if (sFuncValue == PosKey.MENU_KEY.CLEAR)
|
|
{
|
|
if (((Cosmos.UI.CsmPosEditBox)sender) == txtExchangeTicketNo)
|
|
{
|
|
txtExchangeTicketNo.Text = "";
|
|
}
|
|
}
|
|
else if (sFuncValue == PosKey.MENU_KEY.ESC_PREVIOUS)
|
|
{
|
|
this.DialogResult = DialogResult.Cancel;
|
|
this.Close();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 텍스트박스 활성화 처리
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void txtEditBox_EnterEvent(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
padInPut.SetActiveControl = (Control)sender;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
}
|
|
|
|
private void txtExchangeTicketNo_EditBoxTextChangedEvnet(object sender, EventArgs e)
|
|
{
|
|
//txtSaleAmt.Value = "0";
|
|
txtExchangeTicketAmt.Text = "";
|
|
|
|
m_sInPutType = ""; // 입력구분
|
|
m_sInPutData = ""; // 입력데이터
|
|
m_sInEncData = ""; // 카드데이터
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 텍스트박스 입력 유효성 체크
|
|
/// <summary>
|
|
/// 텍스트박스 입력 유효성 체크
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <returns></returns>
|
|
private bool CheckTxtInPut(object sender, bool bSearchMode)
|
|
{
|
|
try
|
|
{
|
|
// 체크
|
|
if (sender == null || ((Cosmos.UI.CsmPosEditBox)sender) == txtExchangeTicketNo)
|
|
{
|
|
if (txtExchangeTicketNo.Text.Length <= 0)
|
|
{
|
|
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0211);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
//string aaa = CmUtil.MidH(txtExchangeTicketNo.Text.Trim(), 4, 10);
|
|
//if (CmUtil.MidH(txtExchangeTicketNo.Text.Trim(), 4, 10) != m_cPosStatus.Base.StoreNo.PadLeft(10, '0'))
|
|
//{
|
|
// WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0454);
|
|
// return false;
|
|
//}
|
|
|
|
if (bSearchMode == false)
|
|
{
|
|
//if (m_cDataService.DoubleParse(txtSaleAmt.Value.ToString()) <= 0)
|
|
//{
|
|
// WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0036);
|
|
// txtSaleAmt.Focus();
|
|
// return false;
|
|
//}
|
|
|
|
//if (m_cDataService.DoubleParse(txtSaleAmt.Value.ToString()) > m_cDataService.DoubleParse(txtPayAmt.Text.ToString()))
|
|
//{
|
|
// WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0039);
|
|
// txtSaleAmt.Focus();
|
|
// return false;
|
|
//}
|
|
|
|
if (txtExchangeTicketAmt.Text.Length <= 0)
|
|
{
|
|
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0043);
|
|
txtExchangeTicketNo.Focus();
|
|
return false;
|
|
}
|
|
|
|
//if (m_cDataService.DoubleParse(txtSaleAmt.Value.ToString()) > m_cDataService.DoubleParse(txtExchangeTicketAmt.Text.ToString()))
|
|
//{
|
|
// WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0036);
|
|
// txtSaleAmt.Focus();
|
|
// return false;
|
|
//}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
#endregion
|
|
|
|
#region 텍스트박스 입력 완료 처리
|
|
|
|
/// <summary>
|
|
/// 조회 처리
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private bool SearchTxtInPut()
|
|
{
|
|
string sRet = UserCom.RST_ERR;
|
|
try
|
|
{
|
|
if (CheckTxtInPut(null, true) == false) return false;
|
|
|
|
if (m_sInPutData == "")
|
|
{
|
|
m_sInPutType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_KEYIN_GIFT;
|
|
m_sInPutData = txtExchangeTicketNo.Value;
|
|
}
|
|
|
|
// 조회
|
|
string[] aRspRet = null;
|
|
txtExchangeTicketAmt.Text = "";
|
|
|
|
string sExchange_Ticket_Type = ItemConst.EXCHANGE_TICKET_ISSUE_TYPE.SEARCH ;
|
|
sRet = m_cExchangeTicket.SearchPayment(new string[] { ItemConst.IRT_INQ_TYPE.EXCHANGE_TICKET_INQ, m_sPay_DC_Grp_Type, m_sPay_DC_CD, sExchange_Ticket_Type, m_sInPutData, "0" }, ref aRspRet);
|
|
if (sRet != UserCom.RST_OK) return false;
|
|
|
|
Column.TR_PAYMENT.DATA m_cPayItem = (Column.TR_PAYMENT.DATA)m_cExchangeTicket.GetPayment(new string[] { });
|
|
txtExchangeTicketAmt.Text = m_cPosStatus.Global.NumericTOCurrency(m_cPayItem.AMT_ENTRY_03);
|
|
txtExchangeTicketNo.Select();
|
|
txtExchangeTicketNo.SelectText();
|
|
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 결제 처리
|
|
/// </summary>
|
|
/// <param name="nFlowMode"></param>
|
|
/// <returns></returns>
|
|
private string CompleteTxtInPut(bool bExchangeMode)
|
|
{
|
|
string sRet = UserCom.RST_ERR;
|
|
double nChangeMoney = 0;
|
|
double nExchangeTicketAmt = 0;
|
|
|
|
string[] aRspRet = null;
|
|
|
|
try
|
|
{
|
|
if (CheckTxtInPut(null, false) != true) return sRet;
|
|
|
|
if (m_sInPutData == "")
|
|
{
|
|
m_sInPutType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_KEYIN_GIFT;
|
|
m_sInPutData = txtExchangeTicketNo.Value;
|
|
}
|
|
|
|
// 거스름
|
|
nChangeMoney = 0;
|
|
|
|
if (bExchangeMode == true)
|
|
{
|
|
// 잔액교환권
|
|
if (m_cDataService.DoubleParse(txtExchangeTicketAmt.Text.ToString()) > m_cDataService.DoubleParse(txtPayAmt.Text.ToString()))
|
|
{
|
|
// 결제할 금액보다 식권금액이 큰경우 차액을 잔액교환권으로 생성한다.
|
|
sExchange_Ticket_Type = ItemConst.EXCHANGE_TICKET_ISSUE_TYPE.MAKE;
|
|
// 잔액교환권번호 = 일자 + 점코드 + posno + 시간(초+1/100초) + 발행구분(1)
|
|
//sExchange_Ticket_No = CmUtil.RightH(m_cPosStatus.Base.SaleDate, 4) + m_cPosStatus.Base.StoreNo.PadLeft(10, '0') + m_cPosStatus.Base.PosNo.PadLeft(2, '0') + string.Format("{0:00000}", DateTime.Now.ToString("ssfff")) + ItemConst.EXCHANGE_TICKET_MAKE_TYPE.EXCHANGE_TICKET.PadLeft(1, '0');
|
|
sExchange_Ticket_No = m_cPosStatus.Base.SaleDate.PadLeft(8, '0') + m_cPosStatus.Base.PosNo.PadLeft(2, '0') + string.Format("{0:00000}", DateTime.Now.ToString("ssfff")) + ItemConst.EXCHANGE_TICKET_MAKE_TYPE.EXCHANGE_TICKET.PadLeft(1, '0');
|
|
// 잔액교환 금액
|
|
nExchangeTicketAmt = CmUtil.DoubleSubtraction(m_cDataService.DoubleParse(txtExchangeTicketAmt.Text.ToString()), m_cDataService.DoubleParse(txtPayAmt.Text.ToString()));
|
|
|
|
if (nExchangeTicketAmt <= 0)
|
|
{
|
|
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0209);
|
|
return sRet;
|
|
}
|
|
|
|
sRet = m_cExchangeTicket.SearchPayment(new string[] { ItemConst.IRT_INQ_TYPE.EXCHANGE_TICKET_INQ, m_sPay_DC_Grp_Type, m_sPay_DC_CD, sExchange_Ticket_Type, sExchange_Ticket_No, nExchangeTicketAmt.ToString() }, ref aRspRet);
|
|
if (sRet != UserCom.RST_OK)
|
|
{
|
|
sExchange_Ticket_Type = "";
|
|
sExchange_Ticket_No = "";
|
|
nExchangeTicketAmt = 0;
|
|
return sRet;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0209);
|
|
return sRet;
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
// 거스름
|
|
//if (m_cDataService.DoubleParse(txtPayAmt.Text.ToString()) < m_cDataService.DoubleParse(txtSaleAmt.Text.ToString()))
|
|
//{
|
|
// nChangeMoney = CmUtil.DoubleSubtraction(m_cDataService.DoubleParse(txtSaleAmt.Text.ToString()), m_cDataService.DoubleParse(txtPayAmt.Text.ToString()));
|
|
//}
|
|
if (m_cDataService.DoubleParse(txtExchangeTicketAmt.Text.ToString()) > m_cDataService.DoubleParse(txtPayAmt.Text.ToString()))
|
|
{
|
|
nChangeMoney = CmUtil.DoubleSubtraction(m_cDataService.DoubleParse(txtExchangeTicketAmt.Text.ToString()), m_cDataService.DoubleParse(txtPayAmt.Text.ToString()));
|
|
}
|
|
sExchange_Ticket_Type = "";
|
|
}
|
|
|
|
// 사용처리
|
|
string sInqType = ItemConst.EXCHANGE_TICKET_ISSUE_TYPE.USE;
|
|
|
|
string sMake_Type = ItemConst.EXCHANGE_TICKET_MAKE_TYPE.NORMAL;
|
|
if (sExchange_Ticket_No != "")
|
|
sMake_Type = ItemConst.EXCHANGE_TICKET_MAKE_TYPE.EXCHANGE_TICKET; // 잔액교환권 발생구분
|
|
string sAppNo = "";
|
|
string sAppDate = "";
|
|
|
|
// 저장
|
|
sRet = m_cExchangeTicket.SetPayment(new string[] { ItemConst.IRT_INQ_TYPE.EXCHANGE_TICKET_INQ, m_sPay_DC_Grp_Type, m_sPay_DC_CD, sInqType, m_sInPutType, m_sInPutData, "1"
|
|
, m_cDataService.DoubleParse(txtExchangeTicketAmt.Text).ToString(), sExchange_Ticket_Type, sExchange_Ticket_No, nExchangeTicketAmt.ToString(), sMake_Type, sAppNo, sAppDate, nChangeMoney.ToString(), "", "" });
|
|
if (sRet != UserCom.RST_OK) return sRet;
|
|
|
|
if (sExchange_Ticket_No.Trim() != "")
|
|
{
|
|
// 잔액교환권 첫 식권에만 저장하고 이후는 삭제
|
|
sExchange_Ticket_Type = "";
|
|
sExchange_Ticket_No = "";
|
|
nExchangeTicketAmt = 0;
|
|
}
|
|
|
|
// 결제 합계금액 재계산 처리
|
|
m_cDataService.UpdatePayAmount();
|
|
|
|
sRet = UserCom.RST_OK;
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
return sRet;
|
|
}
|
|
#endregion
|
|
|
|
#region DeviceEvent 관련
|
|
/// <summary>
|
|
/// DeviceEvent 관련
|
|
/// </summary>
|
|
/// <param name="sDevice"></param>
|
|
/// <param name="sData1"></param>
|
|
/// <param name="sData2"></param>
|
|
/// <param name="sData3"></param>
|
|
public void OnDeviceEvent(string sDevice, string sData1, string sData2, string sData3)
|
|
{
|
|
try
|
|
{
|
|
switch (sDevice)
|
|
{
|
|
case PosConst.OPOS_DEVICE.MSR:
|
|
this.Invoke(new EventHandler(OnMSREvent));
|
|
break;
|
|
case PosConst.OPOS_DEVICE.SCANNER:
|
|
this.Invoke(new EventHandler(OnScannerEvent));
|
|
break;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// MSR Event
|
|
/// </summary>
|
|
/// <param name="source"></param>
|
|
/// <param name="e"></param>
|
|
private void OnMSREvent(object source, EventArgs e)
|
|
{
|
|
|
|
}
|
|
/// <summary>
|
|
/// 스캐너 이벤트 처리
|
|
/// </summary>
|
|
/// <param name="source"></param>
|
|
/// <param name="e"></param>
|
|
private void OnScannerEvent(object source, EventArgs e)
|
|
{
|
|
string sScanData = m_cDevStatus.Scanner.DataLabel;
|
|
|
|
try
|
|
{
|
|
if (sScanData.Length > 0 && m_sInPutData == "")
|
|
{
|
|
m_sInPutType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_BARCODE_GIFT;
|
|
m_sInPutData = sScanData;
|
|
|
|
txtExchangeTicketNo.Text = m_sInPutData;
|
|
|
|
/// if (m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.NORMAL) SearchTxtInPut();
|
|
}
|
|
}
|
|
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="sInData"></param>
|
|
/// <param name="sCardData"></param>
|
|
/// <param name="sCardNo"></param>
|
|
/// <returns></returns>
|
|
private string EncryptedCardNo(string sInData, ref string sCardData, ref string sCardNo)
|
|
{
|
|
string sEncData = sInData;
|
|
|
|
try
|
|
{
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
return sEncData;
|
|
}
|
|
|
|
/// <summary>
|
|
/// IC 카드 정보 입력 처리
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private bool GetIcCardData()
|
|
{
|
|
try
|
|
{
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
|
|
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
|
|
}
|
|
return false;
|
|
}
|
|
#endregion
|
|
|
|
#region 금액 단축키 설정
|
|
|
|
/// <summary>
|
|
/// 금액 단축키 설정
|
|
/// </summary>
|
|
private void SetAmountPay()
|
|
{
|
|
int nRow = 0;
|
|
try
|
|
{
|
|
string sPayamt = m_cPosStatus.Global.NumericTOCurrency(m_cTrnStatus.Sale.RemainPayAmt);
|
|
//txtSaleAmt.Text = "0"; // sPayamt; // 결제 대상 금액
|
|
|
|
btnPay1.Text = sPayamt; // 결제 대상 금액
|
|
btnPay1.Tag = "0" + m_cTrnStatus.Sale.RemainPayAmt.ToString();
|
|
|
|
btnPay2.Visible = false;
|
|
btnPay3.Visible = false;
|
|
btnPay4.Visible = false;
|
|
btnPay5.Visible = false;
|
|
btnPay6.Visible = false;
|
|
|
|
// 0:pay, 1:Add
|
|
DataTable dtData = m_cDataCommon.SeletCommonCode(PosConst.COMMON_CODE_GROUP.Z0001, "");
|
|
nRow = 0;
|
|
if (dtData != null && dtData.Rows.Count > 0)
|
|
{
|
|
foreach (DataRow dr in dtData.Rows)
|
|
{
|
|
nRow++;
|
|
if (nRow == 1)
|
|
{
|
|
double nCashCeiling = CmUtil.MathRounds(m_cTrnStatus.Sale.RemainPayAmt, PosConst.MATH_ROUND.CEILING, CmUtil.GetDataRowInt(dr, PosMst.MST_COMMON.DATA.CHAR_VAL_TITLE_VAL_01));
|
|
|
|
btnPay2.Text = m_cPosStatus.Global.NumericTOCurrency(nCashCeiling);
|
|
btnPay2.Tag = "0" + nCashCeiling.ToString();
|
|
btnPay2.Visible = true;
|
|
}
|
|
if (nRow == 2)
|
|
{
|
|
double nCashCeiling = CmUtil.MathRounds(m_cTrnStatus.Sale.RemainPayAmt, PosConst.MATH_ROUND.CEILING, CmUtil.GetDataRowInt(dr, PosMst.MST_COMMON.DATA.CHAR_VAL_TITLE_VAL_01));
|
|
|
|
btnPay3.Text = m_cPosStatus.Global.NumericTOCurrency(nCashCeiling);
|
|
btnPay3.Tag = "0" + nCashCeiling.ToString();
|
|
btnPay3.Visible = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
dtData = m_cDataCommon.SeletCommonCode(PosConst.COMMON_CODE_GROUP.Z0002, "");
|
|
nRow = 0;
|
|
if (dtData != null && dtData.Rows.Count > 0)
|
|
{
|
|
foreach (DataRow dr in dtData.Rows)
|
|
{
|
|
nRow++;
|
|
if (nRow == 1)
|
|
{
|
|
btnPay4.Text = "+" + CmUtil.GetDataRowStr(dr, PosMst.MST_COMMON.DATA.CD_NM);
|
|
btnPay4.Tag = "1" + CmUtil.GetDataRowStr(dr, PosMst.MST_COMMON.DATA.CHAR_VAL_TITLE_VAL_01);
|
|
btnPay4.Visible = true;
|
|
}
|
|
if (nRow == 2)
|
|
{
|
|
btnPay5.Text = "+" + CmUtil.GetDataRowStr(dr, PosMst.MST_COMMON.DATA.CD_NM);
|
|
btnPay5.Tag = "1" + CmUtil.GetDataRowStr(dr, PosMst.MST_COMMON.DATA.CHAR_VAL_TITLE_VAL_01);
|
|
btnPay5.Visible = true;
|
|
}
|
|
if (nRow == 3)
|
|
{
|
|
btnPay6.Text = "+" + CmUtil.GetDataRowStr(dr, PosMst.MST_COMMON.DATA.CD_NM);
|
|
btnPay6.Tag = "1" + CmUtil.GetDataRowStr(dr, PosMst.MST_COMMON.DATA.CHAR_VAL_TITLE_VAL_01);
|
|
btnPay6.Visible = 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);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|