spc-kiosk-pb/Window/WinPayment/frmSeverancePay.cs

943 lines
40 KiB
C#
Raw Permalink Normal View History

2019-06-16 05:12:09 +00:00
using System;
using System.Text;
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;
/*-----------------------------------------------------------------------------------------------*/
// 설 명 : 세브란스 결제
// 작 성 자 :
// 변경 이력 :
/*-----------------------------------------------------------------------------------------------*/
namespace Cosmos.Win
{
public partial class frmSeverancePay : 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 ISignPadUs m_cDeviceSignPad = null; // 서명패드
private PosOLEDevice.DelegateOlePos delegatePos;
private IDataProcessUs m_cDataService = null;
private IPaymentUs m_cSeveranceDC = null;
private IICReaderUs m_cDeviceICReader = null;
private ISalePluItemUs m_cPluService = null; // 판매 등록 관리
private bool bNotDoubleClik = false; // 더블 클릭 방지용
private string m_sPosMenuKey; // SPC 임직원 결제
/// <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 double nPayAmount = 0;
/// <summary>
/// 직원식 상품 정보
/// </summary>
private string[] m_aRetData;
#endregion
#region & &
public frmSeverancePay()
{
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_cDevStatus = (DeviceStatus)StateObject.DEVICE;
m_cDataService = (IDataProcessUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_SERVICE);
m_cDeviceICReader = (IICReaderUs)sManager.InitServiceInstance(ServiceLists.AGENT_OLEDEVICE.DLL, ServiceLists.AGENT_OLEDEVICE.DEVICE_ICREADER);
m_cPluService = (ISalePluItemUs)sManager.InitServiceInstance(ServiceLists.BSV_SALE.DLL, ServiceLists.BSV_SALE.SALE_PLU_ITEM);
m_cSeveranceDC = (IPaymentUs)sManager.InitServiceInstance(ServiceLists.BSV_PAYMENT.DLL, ServiceLists.BSV_PAYMENT.SEVERANCEDC);
m_cDeviceSignPad = (ISignPadUs)sManager.InitServiceInstance(ServiceLists.AGENT_OLEDEVICE.DLL, ServiceLists.AGENT_OLEDEVICE.DEVICE_SIGNPAD);
delegatePos = new PosOLEDevice.DelegateOlePos(OnDeviceEvent);
}
private void frmSeverancePay_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 frmSeverancePay_Activated(object sender, EventArgs e)
{
PosOLEDevice.SetEventHandle(delegatePos);
}
private void frmSeverancePay_Deactivate(object sender, EventArgs e)
{
PosOLEDevice.SetEventHandle(null);
}
private void frmSeverancePay_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 = "";
//테마색상 적용!
btnEnter.BackColor = CmUtil.GetColorToString(m_cPosStatus.ScnMst.ThemeColor);
// 세브란스병원 임직원 결제
if (m_sPosMenuKey == PosKey.MENU_KEY.SEVERANCE_PAYMENTS) lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0389);
lblCardNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0051);
lblUsetNM.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0183);
lblUserType.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0184);
lblPayAmt.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0049);
btnSearch.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0004);
btnEnter.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0263);
btnMenu1.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0580);
btnMenu2.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0097);
lblInfo1.Text = string.Format(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0390), 0);
lblInfo2.Text = string.Format(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0391), 0);
lblInfo1.Font = new Font(m_cPosStatus.Base.FONT, 12);
lblInfo2.Font = new Font(m_cPosStatus.Base.FONT, 12);
txtCardNo.Text = "";
txtUserNM.Text = "";
txtUserType.Text = "";
txtPayAmt.Text = "0";
txtSaleAmt.Text = m_cPosStatus.Global.NumericTOCurrency(m_cTrnStatus.Sale.RemainPayAmt); // 받을금액
// mot
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_2, "");
// 기능 버튼 설정 체크
FormManager.SetbtnMenu(txtCardNo, m_cDevStatus.ICReader.UseYn, btnMenu1, btnMenu2, btnMenu3, btnMenu4);
m_sInPutType = ""; // 입력구분
m_sInPutData = ""; // 입력데이터
m_sInEncData = ""; // 카드데이터
bNotDoubleClik = false;
nPayAmount = 0;
m_aRetData = null;
EmployeeiTemCheck(ref m_aRetData);
txtCardNo.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)
{
try
{
if (bNotDoubleClik) return;
bNotDoubleClik = true;
if (((Cosmos.UI.CsmButton)sender) == btnMenu1) // 카드 등록
{
// if (GetIcCardData() == true)
SearchTxtInPut();
bNotDoubleClik = false;
return;
}
else if (((Cosmos.UI.CsmButton)sender) == btnSearch) // 조회
{
SearchTxtInPut();
bNotDoubleClik = false;
return;
}
else if (((Cosmos.UI.CsmButton)sender) == btnEnter) // 승인
{
CompleteTxtInPut();
bNotDoubleClik = false;
return;
}
else if (((Cosmos.UI.CsmButton)sender) == btnMenu1) // RF카드입력
{
if (GetRfCardData() == true)
{
bNotDoubleClik = false;
txtEditBox_EditBoxKeyDownEvent(txtCardNo, PosKey.MENU_KEY.ENTER);
}
}
else if (((Cosmos.UI.CsmButton)sender) == btnMenu2) // 핀패드
{
if (GetPinPadData() == true)
{
bNotDoubleClik = false;
txtEditBox_EditBoxKeyDownEvent(txtCardNo, PosKey.MENU_KEY.ENTER);
}
}
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) == txtCardNo || ((Cosmos.UI.CsmPosEditBox)sender) == txtPayAmt)
{
if (txtCardNo.Text == "")
{
SearchTxtInPut();
return;
}
if (txtUserNM.Text == "")
{
SearchTxtInPut();
return;
}
if (m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.NORMAL)
{
CompleteTxtInPut(); // 승인 처리
}
}
}
else if (sFuncValue == PosKey.MENU_KEY.CLEAR)
{
if (((Cosmos.UI.CsmPosEditBox)sender).ReadOnly == false) ((Cosmos.UI.CsmPosEditBox)sender).Text = "";
if (((Cosmos.UI.CsmPosEditBox)sender) == txtCardNo)
{
m_sInPutType = "";
m_sInPutData = "";
m_sInEncData = "";
txtCardNo.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);
}
}
/// <summary>
/// RF 카드 정보 입력 처리
/// </summary>
/// <returns></returns>
private bool GetRfCardData()
{
string sRsvStr = "";
try
{
txtCardNo.Value = "";
//카드 정보 입력
if (m_cDeviceICReader.GetSpcEmpCardInfo(ref sRsvStr) == false)
{
//WinManager.ErrorMessage(sRsvStr);
return false;
}
m_sInPutData = CmUtil.MidH(sRsvStr, 1, 16).Trim();
m_sInPutType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_RF;
txtCardNo.Value = m_sInPutData;
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);
}
finally
{
// 여전법 대응////////////////////////////////////////////////////////////////////
CmUtil.ZeroFillClear(ref sRsvStr);
//////////////////////////////////////////////////////////////////////////////////
}
return false;
}
/// <summary>
/// 핀패드 입력
/// </summary>
/// <returns></returns>
private bool GetPinPadData()
{
try
{
txtCardNo.Value = "";
string sRsvStr = "";
if (m_cDeviceSignPad.GetMsg_SignPad(false, MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0051), ref sRsvStr) == false)
{
return false;
}
txtCardNo.Value = sRsvStr;
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="sender"></param>
/// <param name="e"></param>
private void txtCardNo_EditBoxTextChangedEvnet(object sender, EventArgs e)
{
txtUserNM.Text = "";
txtUserType.Text = "";
txtPayAmt.Text = "0";
m_sInPutType = ""; // 입력구분
m_sInPutData = ""; // 입력데이터
m_sInEncData = ""; // 카드데이터
}
#endregion
#region
/// <summary>
/// 텍스트박스 입력 유효성 체크
/// </summary>
/// <param name="sender"></param>
/// <returns></returns>
private bool CheckTxtInPut(object sender, bool bSearchMode)
{
try
{
// 특정 문자값 제거
try
{
if (m_cDevStatus.Msr.STX != "" && txtCardNo.Value.StartsWith(m_cDevStatus.Msr.STX)) txtCardNo.Value = txtCardNo.Value.Substring(1);
int iLastEtx = txtCardNo.Value.LastIndexOf(m_cDevStatus.Msr.ETX);
if (m_cDevStatus.Msr.ETX != "" && iLastEtx > 0) txtCardNo.Value = CmUtil.MidH(txtCardNo.Value, 0, iLastEtx);
}
catch { }
// 카드번호 길이 체크
if (sender == null || ((Cosmos.UI.CsmPosEditBox)sender) == txtCardNo)
{
if (txtCardNo.Value.Length < 6)
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0037);
txtCardNo.Focus();
return false;
}
}
if (bSearchMode == false)
{
if (txtUserNM.Text.Trim() == "")
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0043);
txtCardNo.Focus();
return false;
}
if (txtPayAmt.Value.Length > 10 || m_cDataService.LongParse(txtPayAmt.Value) <= 0)
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0036);
txtPayAmt.Focus();
return false;
}
if (CmUtil.AmountCut(m_cDataService.DoubleParse(txtPayAmt.Value), CmUtil.IntParse(m_cPosStatus.Mst.PayRudDwLoc)) != m_cDataService.DoubleParse(txtPayAmt.Value))
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0036);
txtPayAmt.Focus();
return false;
}
if (m_cDataService.DoubleParse(txtPayAmt.Text) > m_cDataService.DoubleParse(txtSaleAmt.Text))
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0039);
txtPayAmt.Focus();
return false;
}
if (m_cDataService.DoubleParse(txtPayAmt.Text) > nPayAmount)
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0260);
txtPayAmt.Focus();
return false;
}
if (m_cDataService.DoubleParse(txtSaleAmt.Text) < nPayAmount)
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0260);
txtPayAmt.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>
/// <param name="nFlowMode"></param>
/// <returns></returns>
private bool CompleteTxtInPut()
{
string sRet = UserCom.RST_ERR;
string sInPutType = "";
string sInPutData = "";
string sInEncData = "";
string sPassWord = "";
try
{
if (CheckTxtInPut(null, false) == false) return false;
sInPutType = m_sInPutType;
sInPutData = m_sInPutData;
sInEncData = m_sInEncData;
sPassWord = "";
if (m_sInEncData == "")
{
if (m_sInPutData == "")
{
sInPutType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_KEYIN;
sInPutData = txtCardNo.Value;
}
///EncryptedCardNo(sInPutData, ref sInEncData, ref sInPutData);
}
if (m_cDeviceSignPad.GetMsg_SignPad(false, MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0074), ref sPassWord) != true)
{
//WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0074);
return false;
}
// 처리
sRet = m_cSeveranceDC.SetPayment(new string[] { m_sPosMenuKey, sInPutType, sInPutData, txtCardNo.Text, m_cDataService.DoubleParse(txtPayAmt.Value).ToString(), "", "",
m_aRetData[0], m_aRetData[1], m_aRetData[2], m_aRetData[3], m_aRetData[4], m_aRetData[5], m_aRetData[6], sPassWord });
if (sRet != UserCom.RST_OK) return false;
Column.TR_PAYMENT.DATA m_cPayItem = (Column.TR_PAYMENT.DATA)m_cSeveranceDC.GetPayment(new string[] { });
this.DialogResult = DialogResult.OK;
this.Close();
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);
}
finally
{
//여전법 대응!
//////////////////////////////////////////////////////////////////////////////////
CmUtil.ZeroFillClear(ref sInPutData);
CmUtil.ZeroFillClear(ref sInEncData);
CmUtil.ZeroFillClear(ref sPassWord);
//////////////////////////////////////////////////////////////////////////////////
}
return false;
}
/// <summary>
/// 조회 처리
/// </summary>
/// <returns></returns>
private bool SearchTxtInPut()
{
string sRet = UserCom.RST_ERR;
string sInPutType = "";
string sInPutData = "";
string sInEncData = "";
try
{
if (CheckTxtInPut(null, true) == false) return false;
sInPutType = m_sInPutType;
sInPutData = m_sInPutData;
sInEncData = m_sInEncData;
if (m_sInEncData == "")
{
if (m_sInPutData == "")
{
sInPutType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_KEYIN;
sInPutData = txtCardNo.Value;
}
///EncryptedCardNo(sInPutData, ref sInEncData, ref sInPutData);
}
// 조회
string[] saRecvdData = null;
sRet = m_cSeveranceDC.SearchPayment(new string[] { m_sPosMenuKey, sInPutType, sInPutData, txtCardNo.Text, m_cDataService.DoubleParse(txtPayAmt.Value).ToString(), "", "",
m_aRetData[0], m_aRetData[1], m_aRetData[2], m_aRetData[3], m_aRetData[4], m_aRetData[5], m_aRetData[6], ""}, ref saRecvdData );
if (sRet != UserCom.RST_OK) return false;
Column.TR_PAYMENT.DATA m_cPayItem = (Column.TR_PAYMENT.DATA)m_cSeveranceDC.GetPayment(new string[] { });
txtUserNM.Text = "";
txtUserType.Text = "";
txtPayAmt.Text = "0";
nPayAmount = 0;
// if (m_cPayItem.AMT_ENTRY_01 <= 0) return false;
txtCardNo.Text = m_cPayItem.OCCUR_ENTRY_09; // 직원카드번호
txtUserNM.Text = m_cPayItem.OCCUR_ENTRY_10; // 직원명
if (m_cPayItem.OCCUR_ENTRY_10 == "24")
txtUserType.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0182); //"전공의";
else if (m_cPayItem.OCCUR_ENTRY_10 == "25")
txtUserType.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0940); //"수련직";
else if (m_cPayItem.OCCUR_ENTRY_10.Trim().Length > 0)
txtUserType.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0959); //"임직원";
lblInfo1.Text = string.Format(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0390), m_cPayItem.QTY_ENTRY_01);
lblInfo2.Text = string.Format(MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0391), m_cPayItem.QTY_ENTRY_02);
nPayAmount = m_cPayItem.AMT_ENTRY_05; // 직원식 결제금액
txtPayAmt.Select();
txtPayAmt.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);
}
finally
{
//여전법 대응!
//////////////////////////////////////////////////////////////////////////////////
CmUtil.ZeroFillClear(ref sInPutData);
CmUtil.ZeroFillClear(ref sInEncData);
//////////////////////////////////////////////////////////////////////////////////
}
return false;
}
#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)
{
string sMsrData = "";
try
{
sMsrData = m_cDevStatus.Msr.Track2Data;
if (sMsrData.Length > 0 && m_sInPutData == "")
{
m_sInPutType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_SWIP;
m_sInPutData = sMsrData;
txtCardNo.Text = m_sInPutData;
//txtCardNo.ReadOnly = true;
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);
}
finally
{
//여전법 대응!
//////////////////////////////////////////////////////////////////////////////////
CmUtil.ZeroFillClear(ref sMsrData);
//////////////////////////////////////////////////////////////////////////////////
}
}
/// <summary>
/// 스캐너 이벤트 처리
/// </summary>
/// <param name="source"></param>
/// <param name="e"></param>
private void OnScannerEvent(object source, EventArgs e)
{
try
{
string sScanData = m_cDevStatus.Scanner.DataLabel;
if (sScanData.Length > 0 && m_sInPutData == "")
{
m_sInPutType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_BARCODE_SH;
m_sInPutData = sScanData;
txtCardNo.Text = m_sInPutData;
//txtCardNo.ReadOnly = true;
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
{
sEncData = m_cDeviceICReader.GetEncryptedCardNo(sInData).Trim();
if (CmUtil.MidH(sEncData, 0, 2) == "00")
{
sCardData = CmUtil.MidH(sEncData, 2, 512).Trim();
sCardNo = CmUtil.MidH(sEncData, 514, sEncData.Length - 514).Trim();
}
else
{
//암호화 처리 실패!
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Fail =>" + sInData);
}
}
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
{
m_sInPutType = "";
m_sInPutData = "";
m_sInEncData = "";
txtCardNo.Value = "";
txtCardNo.ReadOnly = false;
string sRsvStr = "";
if (m_cDeviceICReader.GetCardInfo_ICReader(PosConst.IC_READER_TRAN_TYPE.POINT, 1, ref sRsvStr) == true)
{
if (CmUtil.MidH(sRsvStr, 0, 2) == "00")
{
m_sInEncData = CmUtil.MidH(sRsvStr, 6, 512).Trim();
m_sInPutData = CmUtil.MidH(sRsvStr, 1030, 37).Trim();
m_sInPutType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_SWIP;
txtCardNo.Value = m_sInPutData;
//txtCardNo.ReadOnly = true;
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;
}
#endregion
#region
private string EmployeeiTemCheck(ref string[] aRetData)
{
string sRet = UserCom.RST_ERR;
string siTemCD = "";
string siTemNM = "";
double nEmployeeiTemAmount = 0;
double nEmployeeiTemQty = 0;
double nNormalAmount = 0;
double nNormalQty = 0;
try
{
siTemCD = "";
siTemNM = "";
nEmployeeiTemAmount = 0;
nEmployeeiTemQty = 0;
nNormalAmount = 0;
nNormalQty = 0;
// 상품정보
ArrayList aSaleItem = (ArrayList)StateObject.GetItemObject(Column.TR_PLU.ITEM);
for (int iRow = 0; iRow < aSaleItem.Count; iRow++)
{
Column.TR_PLU.DATA cSaleItem = (Column.TR_PLU.DATA)aSaleItem[iRow];
if (cSaleItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL || cSaleItem.CANCEL_DIV_MAIN == PosConst.CANCEL_DIV.CANCEL) continue;// 지정취소
if (cSaleItem.DC_DIV == ItemConst.PLU_DC_DIV.FREE) continue; // 서비스(무료)
if (cSaleItem.NONSALES_RSN_CD != "0") continue; // 비매출구분
if (cSaleItem.BILLSPR_NO != m_cTrnStatus.Sale.BillSplitNo) continue; // 빌분리번호
if (cSaleItem.BILL_AMT <= 0) continue; // 영수금액
if (cSaleItem.ITEM_DIV == ItemConst.PLU_ITEM_DIV.NORMAL)
{
siTemCD = cSaleItem.ITEM_PLU_CD;
siTemNM = cSaleItem.ITEM_NAME;
}
if (cSaleItem.SEVERANCE_MENU_DIV == "1" )
{
// 직원식 상품
nEmployeeiTemQty = CmUtil.DoubleAdd(nEmployeeiTemQty, cSaleItem.SALE_QTY);
nEmployeeiTemAmount = CmUtil.DoubleAdd(nEmployeeiTemAmount, cSaleItem.BILL_AMT);
}
else
{
// 일반 상품
if (cSaleItem.DC_PRMT_YN != "0") continue; // 할인가능 여부
nNormalQty = CmUtil.DoubleAdd(nNormalQty, cSaleItem.SALE_QTY);
nNormalAmount = CmUtil.DoubleAdd(nNormalAmount, cSaleItem.BILL_AMT);
}
}
aRetData = new string[] {"0", "0", "0", "0", "", "", "0" };
aRetData[0] = nEmployeeiTemQty.ToString(); // 직원식 상품 수량
aRetData[1] = nEmployeeiTemAmount.ToString(); // 직원식 상품 금액
aRetData[2] = nNormalQty.ToString(); // 일반 상품 수량
aRetData[3] = nNormalAmount.ToString(); // 일반 상품 금액
aRetData[4] = siTemCD; // 대표코드
aRetData[5] = siTemNM; // 대표명
aRetData[6] = CmUtil.DoubleSubtraction(nNormalQty, 1).ToString(); // 일반 상품 수량 - 1
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);
sRet = UserCom.RST_ERR;
}
return sRet;
}
#endregion
#region
/// <summary>
/// ZeroFill 초기화
/// </summary>
private void InDataToZeroFill()
{
try
{
//여전법 대응!
//////////////////////////////////////////////////////////////////////////////////
CmUtil.ZeroFillClear(ref m_sInPutData);
CmUtil.ZeroFillClear(ref m_sInEncData);
//////////////////////////////////////////////////////////////////////////////////
txtCardNo.Value = string.Empty;
}
catch (Exception) { }
}
#endregion
}
}