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

1671 lines
72 KiB
C#

using System;
using System.Drawing;
using System.Windows.Forms;
using System.Text;
using Cosmos.BaseFrame;
using Cosmos.UserFrame;
using Cosmos.ServiceProvider;
using Cosmos.Common;
using Cosmos.CommonManager;
using System.Collections;
//결제완료 시점에 현금영수증 승인버튼 누르면 음성 플레이 되는 기능 --> 무조건 결제완료 시점에 플레이 되도록 수정! - #20180212 start,phj
//#13753 POS MOT음성 기능 추가 개발요청 start,phj
//using System.Data;
//#13753 POS MOT음성 기능 추가 개발요청 end,phj
//결제완료 시점에 현금영수증 승인버튼 누르면 음성 플레이 되는 기능 --> 무조건 결제완료 시점에 플레이 되도록 수정! - #20180212 end,phj
namespace Cosmos.Win
{
public partial class frmCashBill : frm_PayMainBack
{
#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 IPaymentUs m_cCashBill = null;
private IICReaderUs m_cDeviceICReader = null; // IC리더기 오브젝트
private ISignPadUs m_cSignPad = null; // 사인패드
private IDataCommonUs m_cDataCommon = null; // POS 공통함수 인터페이스
private string m_sApptype; //정상,취소 구분(0:정상,1:취소/반품)
private DeviceStatus m_cDevStatus = new DeviceStatus(); // 디바이스 관리
private PosOLEDevice.DelegateOlePos delegatePos;
private PosOLEDevice.DelegateIcReader delegateReader; // IC리더 콜백
//#20170918 IC 콜백 함수 변경 start
//포인트창에서 해피제휴 신용카드 리딩시 IC 우선 거래로 인해 '카드를 읽혀 주세요' 팝업 나오는 현상 수정.
/*
private PosOLEDevice.CallbackIc delegateReaderCardInfo; // IC리더 콜백(CardInfo)
private bool m_bCardInPut; //카드 입력 중복 방지
private string m_sIcChip; //IC CHIP DATA(EMV)
private string m_sFallDiv; //FallBack구분
private string m_sServiceCode; //서비스코드
*/
//#20170918 IC 콜백 함수 변경 end
private string m_InputType; //PosConst.POS_VAN_MASTER.VAN_KEYIN; //입력구분
private bool m_bApproval; // 이중승인 막음
private bool m_bDoubleInput; // 중복 입력 막음
private string m_sCashBillAmt;
private string m_sCardNo; // 암호화 카드 번호
private string m_sCashTaxAmt;
private string m_sMaskingCardNo; // 마스킹 카드 번호
private string m_sInPutData; // 암호화 당시 입력 데이터
private string m_sPosMenuKey;
private readonly string m_sDefualtNo = "0100001234"; //자진발급 번호
public string SetAppType { set { this.m_sApptype = value; } } // 수동 승인 구분
public string SetCashBillAmt { set { this.m_sCashBillAmt = value; } } // 현금영수증 승인금액 설정
public string SetCashTaxAmt { set { this.m_sCashTaxAmt = value; } } // TaxAmt
public string SetPosMenuKey { set { this.m_sPosMenuKey = value; } } // POS 기능키
#endregion
#region &
public frmCashBill()
{
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_cCashBill = (IPaymentUs)sManager.InitServiceInstance(ServiceLists.BSV_PAYMENT.DLL, ServiceLists.BSV_PAYMENT.CASHBILL);
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_cSignPad = (ISignPadUs)sManager.InitServiceInstance(ServiceLists.AGENT_OLEDEVICE.DLL, ServiceLists.AGENT_OLEDEVICE.DEVICE_SIGNPAD);
m_cDataCommon = (IDataCommonUs)sManager.InitServiceInstance(ServiceLists.ASV_DATA_PROCESS.DLL, ServiceLists.ASV_DATA_PROCESS.DATA_COMMON);
delegatePos = new PosOLEDevice.DelegateOlePos(OnDeviceEvent);
delegateReader = new PosOLEDevice.DelegateIcReader(OnIcReaderCallBack); // IC리더 콜백
//#20170918 IC 콜백 함수 변경 start
//포인트창에서 해피제휴 신용카드 리딩시 IC 우선 거래로 인해 '카드를 읽혀 주세요' 팝업 나오는 현상 수정.
//delegateReaderCardInfo = new PosOLEDevice.CallbackIc(OnIcReaderCallBackCardInfo); // IC리더 콜백(CardInfo)
//#20170918 IC 콜백 함수 변경 end
padInPut.ClearBtnText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0817);
padInPut.SearchBtnText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1018);
}
private void frmCashBill_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();
//CardDataDisplay();
if (string.IsNullOrEmpty(m_sApptype)) m_sApptype = ItemConst.SALE_APP_DIV.APP_NORMAL;
tmrIcCard.Tag = "";
tmrIcCard.Enabled = true; // IC리더 콜백 설정
}
private void frmCashBill_FormClosing(object sender, FormClosingEventArgs e)
{
tmrIcCard.Tag = "CLOSE";
UnRegIcCallback(); // IC리더 콜백 해지
InDataToZeroFill();
if (m_sPosMenuKey != PosKey.MENU_KEY.CASH_APPROVAL) FormManager.SetFormAllControlMove(this, 216, 123);
UserLog.WriteLogFile(UserCom.LOG_IOS, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", lblTitle.Text);
}
private void frmCashBill_Activated(object sender, EventArgs e)
{
PosOLEDevice.SetEventHandle(delegatePos);
}
private void frmCashBill_Deactivate(object sender, EventArgs e)
{
PosOLEDevice.SetEventHandle(null);
}
#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);
btnExit.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BTN_CLOSE);
if (btnExit.Image != null) btnExit.Text = "";
if (m_sPosMenuKey == PosKey.MENU_KEY.CASH_APPROVAL)
{
this.Location = new Point(0, 50);
this.Size = new Size(1024, 525);
picBack.Size = new Size(1024, 525);
//#20181015 결제창 엑박 관련 이미지 미사용 처리 start
//기존
//picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.PAY_MAIN_BACKGROUND);
//#20181015 결제창 엑박 관련 이미지 미사용 처리 end
lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0065);
btnUnissued.Visible = true;
btnExit.Visible = true;
}
else
{
this.Size = new Size(788, 402);
FormManager.SetFormAllControlMove(this, -216, -123);
//#20181015 결제창 엑박 관련 이미지 미사용 처리 start
//기존
//this.picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_SIZE_S);
//#20181015 결제창 엑박 관련 이미지 미사용 처리 end
FormManager.MovePopUpForm(this, false, m_cPosStatus.Sale.ScreenSizeUser);
lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0264);
btnUnissued.Visible = false;
btnExit.Visible = true;
}
lblTradDiv.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0067);
lblCardNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0068);
lblPayAmt.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0066);
lblApprNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0053);
btnMenu1.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0132);
btnMenu2.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0097);
//btnUnissued.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0896);
//btnVoluntary.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0897);
btnCatApp.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0854);
btnVoluntary.Visible = true;
//자진발급 옵션
if (PosMstManager.GetPosOption(POS_OPTION.OPT006) == "0")
{
btnVoluntary.Visible = false;
}
btnAppPers.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0145);
btnAppBiz.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0146);
txtCardNo.Text = "";
txtPayAmt.Text = "";
txtApprNo.Text = "";
m_InputType = "";
m_sCardNo = "";
m_sMaskingCardNo = "";
m_sInPutData = "";
txtPayAmt.Enabled = true;
txtApprNo.Enabled = true;
//btnUnissued.Enabled = true;
m_bDoubleInput = false;
m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_KEYIN;
txtAppDiv.Value = "0";
btnAppPers.BackColor = Color.FromArgb(22, 187, 238);
btnAppBiz.BackColor = Color.FromArgb(153, 153, 153);
//SetSelectColor("");
txtApprNo.Enabled = true;
if (m_cDevStatus.CatTerminal.UseYn == false)
btnCatApp.Visible = false;
else
btnCatApp.Visible = true;
if (m_cDevStatus.ICReader.UseYn != true) // 여신전문금융업법 적용여부 체크
{
txtCardNo.MaxLengthForKeyIn = 40;
}
InitPayMainBack(m_cPosStatus, m_cDataCommon, m_sPosMenuKey, PosConst.MOT_MSG_TYPE.PAY_STEP_3, "");
// 기능 버튼 설정 체크
FormManager.SetbtnMenu(null, m_cDevStatus.ICReader.UseYn, btnMenu1, btnMenu2, btnMenu3, btnMenu4);
//#20170920 해피포인트 등록 시 현금영수증 등록창에 해피포인트 번호/핸드폰번호 자동 표시 start
// 해피포인트 카드 등록 여부 체크
ArrayList alTrEtc = (ArrayList)StateObject.GetItemObject(Column.TR_ETC.ITEM);
foreach (Column.TR_ETC.DATA cEtcItem in alTrEtc)
{
if (cEtcItem.CANCEL_DIV == PosConst.CANCEL_DIV.CANCEL) continue;
if (cEtcItem.ETC_WAY_CD == ItemConst.TR_ITEM_ID.ETC_INFO_ITEM && cEtcItem.ETC_DTL_CD_01 == ItemConst.TR_ITEM_ID.ETC_INFO.SAVEPOINT)
{
if (cEtcItem.CanFiller3 != "")
{
//#20171024 START, PHJ
//기존
//txtCardNo.Value = cEtcItem.CanFiller3;
//변경
//특수문자가 붙은 해피포인트 번호를 잘라서 보여준다.
//그게아니면(전화번호 또는 마스킹 처리된 번호), 그대로보여준다.
if ((cEtcItem.CanFiller3.Length > 16) &&
(CmUtil.IsNumber(cEtcItem.CanFiller3.Substring(16, 1)) == false) &&
(cEtcItem.CanFiller3.StartsWith(PosConst.HP_CARD_PRIFIX)) &&
(cEtcItem.CanFiller3.IndexOf("*") < 0)
)
{
txtCardNo.Value = cEtcItem.CanFiller3.Substring(0, 16);
}
else
{
txtCardNo.Value = cEtcItem.CanFiller3;
}
//#20171024 END, PHJ
}
}
}
//#20170920 해피포인트 등록 시 현금영수증 등록창에 해피포인트 번호/핸드폰번호 자동 표시 end
if (m_sPosMenuKey == PosKey.MENU_KEY.CASH_APPROVAL_LATER)
{
//수동 승인시
txtApprNo.Enabled = false;
txtPayAmt.ReadOnly = false;
txtPayAmt.Select();
}
else
{
txtPayAmt.Value = m_sCashBillAmt;
txtPayAmt.ReadOnly = true;
if (m_cDevStatus.CatTerminal.UseYn == true)
{
txtAppDiv.Select();
}
else
{
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 Control Event
#region
/// <summary>
/// 버튼 입력 처리
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnProc_Click(object sender, EventArgs e)
{
try
{
if (m_bDoubleInput == true) return;
m_bDoubleInput = true;
if (((Cosmos.UI.CsmButton)sender) == btnUnissued) // 미발행
{
m_bDoubleInput = false;
txtEditBox_EditBoxKeyDownEvent(null, PosKey.MENU_KEY.UNISSUED);
}
else if (((Cosmos.UI.CsmButton)sender) == btnVoluntary) // 자진발행
{
m_bDoubleInput = false;
txtEditBox_EditBoxKeyDownEvent(null, PosKey.MENU_KEY.VOLUNTARY_ISSUED);
}
else if (((Cosmos.UI.CsmButton)sender) == btnEnter) // 승인
{
m_bDoubleInput = false;
txtEditBox_EditBoxKeyDownEvent(null, PosKey.MENU_KEY.APPROVAL);
}
else if (((Cosmos.UI.CsmButton)sender) == btnCatApp) // CAT단말기 승인
{
m_bDoubleInput = false;
txtEditBox_EditBoxKeyDownEvent(null, PosKey.MENU_KEY.CAT_TERMINAL);
}
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);
}
m_bDoubleInput = false;
}
/// <summary>
/// 버튼 선택 색상 변경
/// </summary>
/// <param name="sBtnName"></param>
private void SetFuncSelectColor(object sender, bool bSelected)
{
try
{
if (bSelected == true)
{
((UI.CsmButton)sender).BackColor = Color.FromArgb(70, 86, 98);
((UI.CsmButton)sender).ForeColor = Color.White;
}
else
{
((UI.CsmButton)sender).BackColor = Color.White;
((UI.CsmButton)sender).ForeColor = Color.FromArgb(70, 86, 98);
}
}
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="sBtnName"></param>
//private void SetSelectColor(string sBtnName)
//{
// try
// {
// foreach (Control c in this.Controls)
// {
// if (c is Cosmos.UI.CsmButton)
// {
// if (c.Name.StartsWith("btnMenu"))
// {
// if (c.Name == sBtnName)
// {
// c.BackColor = Color.FromArgb(70, 86, 98);
// c.ForeColor = Color.White;
// }
// else
// {
// c.BackColor = Color.White;
// c.ForeColor = Color.FromArgb(70, 86, 98);
// }
// }
// }
// }
// }
// 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 btnMenu_Click(object sender, EventArgs e)
{
try
{
if (((Cosmos.UI.CsmButton)sender).Text == "") return;
if (m_bDoubleInput == true) return;
m_bDoubleInput = true;
//SetFuncSelectColor(sender, true);
if (((Cosmos.UI.CsmButton)sender) == btnMenu1) // IC카드
{
if (GetCardInfo(e != null ? true : false) != true)
{
m_bDoubleInput = false;
return;
}
// 승인처리
if (CompleteTxtInPut(1) == true) return;
}
if (((Cosmos.UI.CsmButton)sender) == btnMenu2) // 핀패드
{
m_bDoubleInput = false;
txtEditBox_EditBoxKeyDownEvent(null, PosKey.MENU_KEY.RE_TRY);
}
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);
}
m_bDoubleInput = false;
//finally
//{
// SetFuncSelectColor(sender, false);
//}
}
#endregion
#region
/// <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
#region
/// <summary>
/// 텍스트박스 키 입력 이벤트 처리
/// </summary>
/// <param name="sender"></param>
/// <param name="sFuncValue"></param>
private void txtEditBox_EditBoxKeyDownEvent(object sender, string sFuncValue)
{
try
{
if (m_bDoubleInput == true) return;
m_bDoubleInput = true;
if (sFuncValue == PosKey.MENU_KEY.ENTER)
{
if (((Cosmos.UI.CsmPosEditBox)sender) == txtPayAmt)
{
if (CheckTxtInPut(txtPayAmt) == false)
{
m_bDoubleInput = false;
return;
}
txtCardNo.Select();
}
else if (((Cosmos.UI.CsmPosEditBox)sender) == txtAppDiv)
{
if (CheckTxtInPut(txtAppDiv) == false)
{
m_bDoubleInput = false;
return;
}
txtCardNo.Select();
}
else if (((Cosmos.UI.CsmPosEditBox)sender) == txtCardNo)
{
if (txtCardNo.Text == "")
{
if (GetCardInfo(true) != true)
{
m_bDoubleInput = false;
return;
}
}
else
{
if (CheckTxtInPut(txtCardNo) == false)
{
m_bDoubleInput = false;
return;
}
if (m_sCardNo == "")
{
m_sCardNo = EncryptedCardNo(txtCardNo.Value);
}
//if (m_cDevStatus.Msr.STX != "" && txtCardNo.Value.StartsWith(m_cDevStatus.Msr.STX)) txtCardNo.Value = txtCardNo.Value.Substring(1);
}
if (m_sCardNo != "")
{
CompleteTxtInPut(1);
}
}
}
else if (sFuncValue == PosKey.MENU_KEY.CAT_TERMINAL)
{
if (((Cosmos.UI.CsmPosEditBox)sender) == txtPayAmt)
{
if (CheckTxtInPut(txtPayAmt) == false)
{
m_bDoubleInput = false;
return;
}
txtCardNo.Select();
}
else if (((Cosmos.UI.CsmPosEditBox)sender) == txtAppDiv)
{
if (CheckTxtInPut(txtAppDiv) == false)
{
m_bDoubleInput = false;
return;
}
}
CompleteTxtInPut(3);
}
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) tmrIcCard.Enabled = true;
}
}
else if (sFuncValue == PosKey.MENU_KEY.ESC_PREVIOUS)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
return;
}
else if (sFuncValue == PosKey.MENU_KEY.UNISSUED)
{
this.DialogResult = DialogResult.OK;
this.Close();
return;
}
else if (sFuncValue == PosKey.MENU_KEY.APPROVAL)
{
CompleteTxtInPut(1);
}
else if (sFuncValue == PosKey.MENU_KEY.VOLUNTARY_ISSUED)
{
//자진발급
txtAppDiv.Value = "0";
if (m_cDevStatus.CatTerminal.UseYn == false)
{
m_sCardNo = EncryptedCardNo(m_sDefualtNo);
if (m_sCardNo == "")
{
m_bDoubleInput = false;
return;
}
m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_KEYIN;
}
CompleteTxtInPut(2);
}
else if (sFuncValue == PosKey.MENU_KEY.RE_TRY)
{
UnRegIcCallback(); // IC리더 콜백 해지
if (GetPinPad() == true)
{
//#20171109 서명패드로 번호 입력시 자동승인 안되도록 수정 start
//기존
//CompleteTxtInPut(1);
//#20171109 서명패드로 번호 입력시 자동승인 안되도록 수정 end
}
else
{
if (txtCardNo.Value == "") tmrIcCard.Enabled = true;
}
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
m_bDoubleInput = false;
}
#endregion
#region
/// <summary>
/// 텍스트박스 입력 유효성 체크
/// </summary>
/// <param name="sender"></param>
/// <returns></returns>
private bool CheckTxtInPut(object sender)
{
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) == txtPayAmt)
{
if (m_cDataService.DoubleParse(txtPayAmt.Value) == 0)
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0038);
return false;
}
}
if (sender == null || ((Cosmos.UI.CsmPosEditBox)sender) == txtAppDiv)
{
if (m_cDataService.DoubleParse(txtAppDiv.Value) == 0)
{
txtAppDiv.Value = "0";
}
}
// 카드번호 길이 체크
if (sender == null || ((Cosmos.UI.CsmPosEditBox)sender) == txtCardNo)
{
if (m_InputType == PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_KEYIN)
{
if (txtCardNo.Value.Length < 6)
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0037);
txtCardNo.Text = "";
return false;
}
}
if (txtCardNo.Value != CmUtil.MidH(m_sInPutData, 0, txtCardNo.Value.Length))
{
//#20171024 START, PHJ
//기존
//m_sCardNo = EncryptedCardNo(txtCardNo.Value);
//변경
//리딩한 카드번호가 해피포인트 번호 일 때.
//해피포인트 앱 또는 카드 리딩 시 카드번호 뒤에 특수문자가 들어간다. (17번째자리부터)
if ((txtCardNo.Value.Length > 16) &&
(CmUtil.IsNumber(txtCardNo.Value.Substring(16, 1)) == false) &&
(txtCardNo.Value.StartsWith(PosConst.HP_CARD_PRIFIX)))
{
txtCardNo.Value = txtCardNo.Value.Substring(0, 16);
}
//#20171024 END, PHJ
m_sCardNo = EncryptedCardNo(txtCardNo.Value);
}
}
}
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(int nFlowMode)
{
string sRet = UserCom.RST_ERR;
try
{
string sDefaultYN = "0"; // 자진발급 여부
if (nFlowMode != 3 && nFlowMode != 2)
{
if (CheckTxtInPut(null) == false) return false;
}
// 중복 승인 방지 체크
if (m_bApproval == true) return false;
m_bApproval = true;
//결제완료 시점에 현금영수증 승인버튼 누르면 음성 플레이 되는 기능 --> 무조건 결제완료 시점에 플레이 되도록 수정! - #20180212 start,phj
/*
//#13753 POS MOT음성 기능 추가 개발요청 start,phj
//결제 완료되는 시점에 PCKR이고 직영점이면
//현금영수증 승인버튼 누를 때 음성파일 플레이되도록 수정!
if (m_cTrnStatus.Head.CmpCd == "PCKR" && // PCKR 이고 직영점일 때
m_cTrnStatus.Sale.RemainPayAmt == 0 &&
m_sPosMenuKey == PosKey.MENU_KEY.CASH_APPROVAL &&
//#13753 POS MOT음성 기능 추가 개발요청 - 20180222 음성MOT 옵션처리 start,phj
PosMstManager.GetPosOption(POS_OPTION.OPT331) == "1" &&
//#13753 POS MOT음성 기능 추가 개발요청 - 20180222 음성MOT 옵션처리 end,phj
(m_cTrnStatus.Head.TradeKind == ItemConst.TRAN_KIND.NORMAL.SALE && CmUtil.IsNull(PosMstManager.GetPosOption(POS_OPTION.OPT309), "1") == "2"))
{
SetPlayMotMsg(PosConst.MOT_MSG_TYPE.DSP_SCN_MSG, PosKey.MENU_KEY.PHRASE_RECEIPT_INPUT, "");
}
//#13753 POS MOT음성 기능 추가 개발요청 end,phj
*/
//결제완료 시점에 현금영수증 승인버튼 누르면 음성 플레이 되는 기능 --> 무조건 결제완료 시점에 플레이 되도록 수정! - #20180212 end,phj
if (nFlowMode == 2) //승인 처리
{
sDefaultYN = "1";
}
if (nFlowMode == 3 || (m_cDevStatus.CatTerminal.UseYn == true && nFlowMode == 2))
{
//단말기 승인 처리!
sRet = CatTerminalApproval(sDefaultYN);
}
else
{
if (m_sCardNo == "")
{
m_sCardNo = EncryptedCardNo(txtCardNo.Value);
m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_KEYIN;
}
sRet = Approval(sDefaultYN);
}
if (sRet != UserCom.RST_OK)
{
padInPut.SetActiveFocus();
return false;
}
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
{
m_bApproval = false;
}
return false;
}
#endregion
/// <summary>
/// 소득공제 타입 설정
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnAppType_Click(object sender, EventArgs e)
{
try
{
if (((Cosmos.UI.CsmButton)sender) == btnAppPers)
{
txtAppDiv.Text = "0";
btnAppPers.BackColor = Color.FromArgb(22, 187, 238);
btnAppBiz.BackColor = Color.FromArgb(153, 153, 153);
}
else
{
txtAppDiv.Text = "1";
btnAppPers.BackColor = Color.FromArgb(153, 153, 153);
btnAppBiz.BackColor = Color.FromArgb(22, 187, 238);
}
}
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 Control Event
#region User Method
#region
/// <summary>
/// 카드데이터 화면 표시
/// </summary>
/// <returns></returns>
private void CardDataDisplay()
{
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
#region
/// <summary>
/// 카드번호 조회
/// <param name="sCardData"></param>
/// <param name="bMenual"></param>
/// <param name="sUniEtcData"></param>
/// </summary>
/// <returns></returns>
private bool CardSearch(string sCardData, bool bMenual, string sUniEtcData, bool bNFCCard)
{
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;
}
return true;
}
#endregion
#region
/// <summary>
/// 승인 처리
/// <param name=""></param>
/// </summary>
/// <returns></returns>
private string Approval(string sDefaultYN)
{
string sRet = UserCom.RST_ERR;
try
{
double dNetAmt = 0;
//수동 발급 일때
if (m_sPosMenuKey == PosKey.MENU_KEY.CASH_APPROVAL_LATER)
{
double dtmp = CmUtil.DoubleSubtraction(m_cDataService.DoubleParse(txtPayAmt.Value), CmUtil.DoubleDivision(m_cDataService.DoubleParse(txtPayAmt.Value), 1.1));
m_sCashTaxAmt = CmUtil.MathRounds(dtmp, m_cPosStatus.Mst.VatRudDwLocMethd, CmUtil.IntParse(m_cPosStatus.Mst.VatRudDwLoc)).ToString();
}
//NetSale금액
dNetAmt = CmUtil.DoubleSubtraction(m_cDataService.DoubleParse(txtPayAmt.Value), m_cDataService.DoubleParse(m_sCashTaxAmt));
string sIssueType = "0";
if (m_sPosMenuKey == PosKey.MENU_KEY.CASH_APPROVAL_LATER || m_sPosMenuKey == PosKey.MENU_KEY.CASH_APPROVAL_LATER_RECEIPT)
sIssueType = "1";
// Del, 2017.09.05, IC버전일때 마스킹 데이터 오류로 인해 원복 처리하고 EncryptedCardNo 함수에서 변경처리.
// Add, 2017.08.31, 신분확인번호 마스킹 변경
// 전화번호/사업자번호 뒷 4자리만 마스킹 처리 / 카드번호 앞6자리 외 마스킹
//var len = m_sCardNo.Trim().Length;
//if (len == 10 || len == 11)
//{
// m_sMaskingCardNo = CmUtil.LeftH(m_sCardNo, len - 4) + new string('*', 4);
//}
//else if (len > 11)
//{
// m_sMaskingCardNo = CmUtil.LeftH(m_sCardNo, 6) + new string('*', len - 6);
//}
sRet = m_cCashBill.SetPayment(new string[] { m_InputType, m_sCardNo, dNetAmt.ToString(), m_sCashTaxAmt, "0", m_cDataService.DoubleParse(txtPayAmt.Value).ToString(), txtAppDiv.Value, sIssueType, "", "", "", "", "", "", m_sMaskingCardNo, sDefaultYN });
if (sRet != UserCom.RST_OK)
{
WinManager.ErrorMessage(sRet);
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return sRet;
}
/// <summary>
/// CAT 단말기 승인
/// </summary>
/// <param name="sDefaultYN"></param>
/// <returns></returns>
private string CatTerminalApproval(string sDefaultYN)
{
string sRet = UserCom.RST_ERR;
try
{
if (CheckTxtInPut(txtPayAmt) == false) return sRet;
double dNetAmt = 0;
//수동 발급 일때
if (m_sPosMenuKey == PosKey.MENU_KEY.CASH_APPROVAL_LATER)
{
double dtmp = CmUtil.DoubleSubtraction(m_cDataService.DoubleParse(txtPayAmt.Value), CmUtil.DoubleDivision(m_cDataService.DoubleParse(txtPayAmt.Value), 1.1));
m_sCashTaxAmt = CmUtil.MathRounds(dtmp, m_cPosStatus.Mst.VatRudDwLocMethd, CmUtil.IntParse(m_cPosStatus.Mst.VatRudDwLoc)).ToString();
}
//NetSale금액
dNetAmt = CmUtil.DoubleSubtraction(m_cDataService.DoubleParse(txtPayAmt.Value), m_cDataService.DoubleParse(m_sCashTaxAmt));
string sIssueType = "0";
if (m_sPosMenuKey == PosKey.MENU_KEY.CASH_APPROVAL_LATER || m_sPosMenuKey == PosKey.MENU_KEY.CASH_APPROVAL_LATER_RECEIPT)
sIssueType = "1";
//InParam
// 0.전문구분,1.거래유형, 2.할부개월, 3.승인금액 , 4.봉사료, 5.세금, 6.원승인번호, 7.원거래일자, 8.포인트거래구분, 9.상품코드,
//10.전표인쇄여부, 11.추가항목, 12.사후처리구분, 13.없음, 14.예비1, 15.예비2
//승인처리 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
sRet = m_cCashBill.SetPayment(new string[] { PosConst.POS_CAT_MASTER.TRAN_TYPE, PosConst.POS_CAT_MASTER.TRADE_ID.CAT_CASH_AGREE, sDefaultYN == "1" ? "02" : txtAppDiv.Value.PadLeft(2, '0'), txtPayAmt.Value, "0", m_sCashTaxAmt, "", "", "", "", "", "", sIssueType, "", "", "" });
//if (sRet != UserCom.RST_OK)
//{
// WinManager.ErrorMessage(sRet);
//}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return sRet;
}
#endregion
#region
/// <summary>
/// 임의 등록 처리
/// <param name=""></param>
/// </summary>
/// <returns></returns>
private string MenualApproval()
{
string sRet = UserCom.RST_ERR;
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 sRet;
}
return sRet;
}
#endregion
private string EncryptedCardNo(string sIndata)
{
string tmpEnc = "";
try
{
if (m_cDevStatus.ICReader.UseYn == true) // 여전법 인증여부(0:MSR, 1:IC)
{
UnRegIcCallback(); // IC리더 콜백 해지
}
if (sIndata.Length == 18 && sIndata.StartsWith("15442020") == true)
{
sIndata = sIndata + "=";
}
//#20171024 START, PHJ
//DeviceICReader.cs로 결제코드,상세코드를 넘기기 위해서.
//해피포인트로 현금영수증 승인하는지 구분하기 위해서.
m_cDeviceICReader.PAY_WAY_CD = ItemConst.TR_ITEM_ID.ETC_INFO_ITEM;
m_cDeviceICReader.PAY_DTL_CD = ItemConst.TR_ITEM_ID.ETC_INFO.CASHBILL;
//#20171024 END, PHJ
//카드번호 처리 부분 임시 주석 2016-06-15
//#20170913 현금영수증, 포인트카드 마스킹 미적용 start
// "0"인 경우 마스킹 미처리
//기존
//tmpEnc = m_cDeviceICReader.GetEncryptedCardNo(sIndata).Trim();
//변경
tmpEnc = m_cDeviceICReader.GetEncryptedCardNo(sIndata, "0").Trim();
//#20170913 현금영수증, 포인트카드 마스킹 미적용 end
if (CmUtil.MidH(tmpEnc, 0, 2) == "00")
{
//#20170913 현금영수증, 포인트카드 마스킹 미적용 start
//기존
/*
// Mod, 2017.09.05, 전화번호 마스킹 변경 처리
//m_sMaskingCardNo = CmUtil.MidH(tmpEnc, 514, 37).Trim();
if (sIndata.Length == 10 || sIndata.Length == 11)
{
m_sMaskingCardNo = CmUtil.LeftH(sIndata, sIndata.Length - 4) + new string('*', 4);
}
else
{
m_sMaskingCardNo = CmUtil.MidH(tmpEnc, 514, 37).Trim();
}
*/
//변경
m_sMaskingCardNo = CmUtil.MidH(tmpEnc, 514, 37).Trim();
//#20170913 현금영수증, 포인트카드 마스킹 미적용 end
txtCardNo.Value = m_sMaskingCardNo;
m_sInPutData = m_sMaskingCardNo;
//#20180426 현금영수증 마스킹 변경 및 영수증 문구 변경 start
//기존
/*
//#20170913 현금영수증, 포인트카드 마스킹 미적용 start
if (sIndata.Length == 10 || sIndata.Length == 11)
{
//#20171121 전화번호 길이와 마스킹 된 값의 길이와 다름. start, phj
//기존
//m_sMaskingCardNo = CmUtil.LeftH(m_sMaskingCardNo, m_sMaskingCardNo.Length - 4) + new string('*', 4);
//변경
m_sMaskingCardNo = CmUtil.LeftH(sIndata, 6) + new string('*', sIndata.Length - 6);
//#20171121 전화번호 길이와 마스킹 된 값의 길이와 다름. end, phj
}
else
{
m_sMaskingCardNo = CmUtil.MidH(m_sMaskingCardNo, 0, 6) + "********";
}
//#20170913 현금영수증, 포인트카드 마스킹 미적용 end
*/
//#20180426 현금영수증 마스킹 변경 및 영수증 문구 변경 end
//#20171024 지출증빙으로 발행시 입력한 자리수까지만 영수증상에 표시 되도록 수정 start
//10자리 입력시 spcnpos.dll로 암호화 처리시 6자리+'******' 로 변환이 되어 11자리 입력 한 것으로 보임
if (txtAppDiv.Text == "1")
{
m_sMaskingCardNo = CmUtil.MidH(m_sMaskingCardNo, 0, sIndata.Length);
}
//#20171024 지출증빙으로 발행시 입력한 자리수까지만 영수증상에 표시 되도록 수정 end
tmpEnc = CmUtil.MidH(tmpEnc, 2, 512).Trim();
if (sIndata.Length == 19 && CmUtil.MidH(sIndata, 0, 8) == "15442020")
{
m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_SWIP;
}
else
{
if (m_cDevStatus.ICReader.UseYn == true) // 여신전문금융업법 적용여부 체크
{
//#20171024 START, PHJ
//기존
//m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_KEYIN;
//변경
//현금영수증에 넘어온 해피포인트 번호는 16자리.
//혹시 해피포인트를 리딩하더라도 사전에 특수문자는 짜르므로 괜찮. 16자리.
if (sIndata.Length == 16 && (sIndata.StartsWith(PosConst.HP_CARD_PRIFIX)))
m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_SWIP;
else
m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_KEYIN;
//#20171024 END, PHJ
}
else if (sIndata.Length > 16 && sIndata.IndexOf("=") > 0)
m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_SWIP;
else
{
//#20171024 START, PHJ
//기존
//m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_KEYIN;
//변경
//현금영수증에 넘어온 해피포인트 번호는 16자리.
//혹시 해피포인트를 리딩하더라도 사전에 특수문자는 짜르므로 괜찮. 16자리.
if (sIndata.Length == 16 && (sIndata.StartsWith(PosConst.HP_CARD_PRIFIX)))
m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_SWIP;
else
m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_KEYIN;
//#20171024 END, PHJ
}
}
}
else
{
tmpEnc = "";
//암호화 처리 실패!
UserLog.WriteLogFile(UserCom.LOG_ERROR, System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", "Fail =>" + sIndata);
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0280);
}
if (m_cDevStatus.ICReader.UseYn == true) // 여전법 인증여부(0:MSR, 1:IC)
{
if (txtCardNo.Value == "") tmrIcCard.Enabled = true; // IC리더 콜백 설정
}
}
catch (Exception ex)
{
tmpEnc = "";
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return tmpEnc;
}
/// <summary>
/// 카드 정보 입력 처리
/// </summary>
/// <returns></returns>
private bool GetCardInfo(bool bCancelCallBack)
{
bool bRet = false;
string sRsvStr = "";
try
{
//if (m_bDoubleInput == true) return false;
//m_bDoubleInput = true;
if (bCancelCallBack == true) UnRegIcCallback(); // IC리더 콜백 해지
txtCardNo.Value = "";
m_sCardNo = "";
m_InputType = "";
m_sMaskingCardNo = "";
if (m_cDeviceICReader.GetCardInfo_ICReader(PosConst.IC_READER_TRAN_TYPE.CASHBILL, CmUtil.IntParse(txtPayAmt.Value), ref sRsvStr) == true)
{
if (CmUtil.MidH(sRsvStr, 0, 2) == "00")
{
m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_SWIP;
m_sCardNo = CmUtil.MidH(sRsvStr, 6, 512).Trim();
m_sMaskingCardNo = CmUtil.MidH(sRsvStr, 1030, 37).Trim();
m_sInPutData = m_sMaskingCardNo;
txtCardNo.Value = m_sMaskingCardNo;
//if (CmUtil.MidH(sRsvStr, 4, 2).Trim() == "02")
//{
// m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_SWIP;
//}
//else
//{
// m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_IC;
//}
//m_sInPutData = m_sMaskingCardNo;
bRet = true;
}
}
else if (sRsvStr != "")
{
WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0095));
}
//m_bDoubleInput = false;
if (txtCardNo.Value == "") tmrIcCard.Enabled = true; // IC리더 콜백 설정
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
//m_bDoubleInput = false;
}
finally
{
CmUtil.ZeroFillClear(ref sRsvStr);
}
return bRet;
}
/// <summary>
/// 핀패드 사용자 정보 입력
/// </summary>
/// <returns></returns>
private bool GetPinPad()
{
bool bRet = false;
try
{
//if (m_bDoubleInput == true) return bRet;
//m_bDoubleInput = true;
string sRecvData = "";
m_sCardNo = "";
m_InputType = "";
m_sMaskingCardNo = "";
txtCardNo.Value = "";
if (m_cSignPad.GetMsg_SignPad(false, MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0065), ref sRecvData, 13) == true)
{
m_sCardNo = EncryptedCardNo(sRecvData);
if (m_sCardNo != "")
{
m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_KEYIN;
//txtCardNo.Value = m_sMaskingCardNo;
//txtCardNo.Select();
bRet = true;
}
}
//else
//{
// WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0095));
//}
//m_bDoubleInput = 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);
//m_bDoubleInput = false;
}
return bRet;
}
/// <summary>
/// ZeroFill 초기화
/// </summary>
private void InDataToZeroFill()
{
try
{
//여전법 대응!
//////////////////////////////////////////////////////////////////////////////////
CmUtil.ZeroFillClear(ref m_sCardNo); //Card
CmUtil.ZeroFillClear(ref m_sMaskingCardNo); //Card
//////////////////////////////////////////////////////////////////////////////////
txtCardNo.Value = string.Empty;
}
catch (Exception) { }
}
//결제완료 시점에 현금영수증 승인버튼 누르면 음성 플레이 되는 기능 --> 무조건 결제완료 시점에 플레이 되도록 수정! - #20180212 start,phj
/*
//#13753 POS MOT음성 기능 추가 개발요청 start,phj
public bool SetPlayMotMsg(string sMsgTp, string sMsgFlag, string sSeqNo)
{
try
{
DataTable dtHead = m_cDataCommon.SelectMOT(PosMst.MST_MOT_MSG.TABLE_NAME, sMsgTp, sMsgFlag, sSeqNo);
if (dtHead != null && dtHead.Rows.Count > 0)
{
// 음성 사용 유무(0:미사용, 1:사용)
if (PosMstManager.GetPosOption(POS_OPTION.OPT309) == "2")
{
DataRow dr = dtHead.Rows[0];
if (CmUtil.GetDataRowStr(dr, PosMst.MST_MOT_MSG.DATA.SOUND_FILE_DIV) == "01") // 00(없음), 01(WAVE), 02(TTS)
{
string sFilePath = BaseCom.NxCDPPath + PosConst.MST_IMG_PATH.CDP_COM + CmUtil.GetDataRowStr(dr, PosMst.MST_MOT_MSG.DATA.SOUND_FILE_NM);
CmUtil.PlaySound(sFilePath);
}
else if (CmUtil.GetDataRowStr(dr, PosMst.MST_MOT_MSG.DATA.SOUND_FILE_DIV) == "02") // 00(없음), 01(WAVE), 02(TTS)
{
CmUtil.SpeakByTTSEngine(m_cPosStatus.Base.Country, CmUtil.GetDataRowStr(dr, PosMst.MST_MOT_MSG.DATA.TTS_DSCRP), 150);
}
}
}
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;
}
}
//#13753 POS MOT음성 기능 추가 개발요청 end,phj
*/
//결제완료 시점에 현금영수증 승인버튼 누르면 음성 플레이 되는 기능 --> 무조건 결제완료 시점에 플레이 되도록 수정! - #20180212 end,phj
#endregion User Method
#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
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 DeviceEvent
#region IC리더
/// <summary>
/// IC리더 콜백 설정
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void tmrIcCard_Tick(object sender, EventArgs e)
{
try
{
if (m_cDevStatus.ICReader.UseYn != true) // 여전법 인증여부(0:MSR, 1:IC)
{
tmrIcCard.Enabled = false;
return;
}
if (tmrIcCard.Tag == null || tmrIcCard.Tag.ToString() == "")
{
// IC리더 콜백 설정
if (m_bDoubleInput) return;
tmrIcCard.Enabled = false;
//#20170918 IC 콜백 함수 변경 start
//포인트창에서 해피제휴 신용카드 리딩시 IC 우선 거래로 인해 '카드를 읽혀 주세요' 팝업 나오는 현상 수정.
//기존
m_cDeviceICReader.RegIcCallback(delegateReader);
//변경
//string sApprID = PosMstManager.GetMstVan(ItemConst.TR_ITEM_ID.CREDITCARD_ITEM, ItemConst.TR_ITEM_ID.CREDITCARD.CREDIT_CARD, PosMst.MST_VAN.DATA.APPR_ID);
//m_cDeviceICReader.RegIcCallbackCardInfo(sApprID, m_cDataService.IntParse(txtPayAmt.Value), delegateReaderCardInfo);
//#20170918 IC 콜백 함수 변경 end
}
else if (tmrIcCard.Tag.ToString() == "MSR")
{
// MSR 카드 읽기
tmrIcCard.Enabled = false;
tmrIcCard.Tag = "";
tmrIcCard.Interval = 500;
m_bDoubleInput = false;
// 승인처리
if (CompleteTxtInPut(1) == true) return;
tmrIcCard.Enabled = true;
}
else if (tmrIcCard.Tag.ToString() == "IC")
{
// IC리더 카드 읽기
tmrIcCard.Enabled = false;
tmrIcCard.Tag = "";
tmrIcCard.Interval = 500;
m_bDoubleInput = false;
btnMenu_Click(btnMenu1, null);
}
else
tmrIcCard.Enabled = 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);
}
}
delegate void DelegateIcReaderCallBack(int rc, StringBuilder str);
/// <summary>
/// IC리더 콜백 함수
/// </summary>
/// <param name="num"></param>
/// <param name="str"></param>
public void OnIcReaderCallBack(int num, StringBuilder str)
{
try
{
if (txtCardNo.InvokeRequired)
{
DelegateIcReaderCallBack d = new DelegateIcReaderCallBack(OnIcReaderCallBack);
this.Invoke(d, new object[] { num, str });
}
else
{
if (m_bDoubleInput) return;
m_bDoubleInput = true;
if (num == 1)
{
// IC 카드
tmrIcCard.Tag = "IC";
tmrIcCard.Interval = 100;
}
else
{
// MSR 카드
if (str.ToString().StartsWith("EN") == true)
{
m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_SWIP;
m_sCardNo = CmUtil.MidH(str.ToString(), 0, 512).Trim();
m_sMaskingCardNo = CmUtil.MidH(str.ToString(), 512, 40).Trim();
m_sInPutData = m_sMaskingCardNo;
txtCardNo.Value = m_sMaskingCardNo;
tmrIcCard.Tag = "MSR";
tmrIcCard.Interval = 100;
}
else
{
tmrIcCard.Interval = 500;
}
}
tmrIcCard.Enabled = true;
m_bDoubleInput = 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);
}
}
///// <summary>
///// IC리더 콜백 Event
///// </summary>
///// <param name="source"></param>
///// <param name="e"></param>
//private void OnIcReaderEvent(object source, EventArgs e)
//{
// try
// {
// tmrIcCard.Tag = "READ";
// tmrIcCard.Enabled = true;
// //m_bDoubleInput = false;
// //btnMenu_Click(btnMenu1, null);
// }
// 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>
/// IC리더 콜백 해지
/// </summary>
private void UnRegIcCallback()
{
try
{
if (m_cDevStatus.ICReader.UseYn == true) // 여신전문금융업법 적용여부 체크
{
tmrIcCard.Enabled = false;
//#20170918 IC 콜백 함수 변경 start
//포인트창에서 해피제휴 신용카드 리딩시 IC 우선 거래로 인해 '카드를 읽혀 주세요' 팝업 나오는 현상 수정.
//기존
m_cDeviceICReader.UnRegIcCallback();
//변경
//m_cDeviceICReader.UnRegIcCallbackCardInfo();
//#20170918 IC 콜백 함수 변경 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);
}
}
//#20170918 IC 콜백 함수 변경 start
//포인트창에서 해피제휴 신용카드 리딩시 IC 우선 거래로 인해 '카드를 읽혀 주세요' 팝업 나오는 현상 수정.
/*
delegate void DelegateWriteLog(int returnValue, StringBuilder returnData);
/// <summary>
/// IC리더 콜백 함수(CardInfo)
/// </summary>
/// <param name="returnValue"></param>
/// <param name="returnData"></param>
public void OnIcReaderCallBackCardInfo(int returnValue, StringBuilder returnData)
{
if (txtCardNo.InvokeRequired)
{
DelegateWriteLog d = new DelegateWriteLog(OnIcReaderCallBackCardInfo);
this.Invoke(d, new object[] { returnValue, returnData });
}
else
{
if (m_bCardInPut) return;
m_bCardInPut = true;
if (returnValue > 0)
{
string sRsvStr = returnData.ToString();
if (CmUtil.MidH(sRsvStr, 0, 2) == "00")
{
m_sCardNo = CmUtil.MidH(sRsvStr, 6, 512).Trim();
txtCardNo.Value = CmUtil.MidH(sRsvStr, 1030, 37).Trim();
m_sIcChip = CmUtil.MidH(sRsvStr, 518, 512).Trim();
if (CmUtil.MidH(sRsvStr, 4, 2).Trim() == "02")
{
m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_SWIP;
}
else
{
m_InputType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_IC;
}
m_sServiceCode = CmUtil.MidH(sRsvStr, 1067, 5).Trim();
m_sFallDiv = CmUtil.MidH(sRsvStr, 3, 1); // == "3" ? "0" : "1";
// IC 카드(CardInfo)
tmrIcCard.Tag = "ICREADER";
tmrIcCard.Interval = 100;
tmrIcCard.Enabled = true;
m_bCardInPut = false;
}
}
}
}
*/
//#20170918 IC 콜백 함수 변경 end
#endregion
}
}