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

1558 lines
84 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 frmGift : Form
{
#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_cGift = 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 string m_sAppYN = "0";
/// <summary>
/// 승인서버구분
/// </summary>
private string m_sAppSvrID = "";
/// <summary>
/// 권종
/// </summary>
private string m_GiftType = "";
/// <summary>
/// 해피머니상품권 여부
/// </summary>
private string m_HappyGifType = "";
/// <summary>
/// 거스름 지불 여부
/// </summary>
private string m_sCHANGE_PAYMNT_YN = "";
/// <summary>
/// 필수입력 여부
/// </summary>
private string m_sMNDTRY_INPUT_YN = "";
/// <summary>
/// 잔액교환권 금액
/// </summary>
private double nExchangeTicketAmt = 0;
/// <summary>
/// 잔액교환권 발행구분
/// </summary>
private string sExchange_Ticket_Type = "";
/// <summary>
/// 잔액교환권 번호
/// </summary>
private string sExchange_Ticket_No = "";
/// <summary>
/// 승인번호
/// </summary>
private string m_sAppNo = "";
/// <summary>
/// 승인일자
/// </summary>
private string m_sAppDate = "";
/// <summary>
/// 승인시간
/// </summary>
private string m_sAppTime = "";
/// <summary>
/// 상품권명
/// </summary>
private string m_sGiftNM = "";
#endregion
#region & &
public frmGift()
{
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_cGift = (IPaymentUs)sManager.InitServiceInstance(ServiceLists.BSV_PAYMENT.DLL, ServiceLists.BSV_PAYMENT.GIFT);
}
private void frmGift_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 frmGift_Activated(object sender, EventArgs e)
{
}
private void frmGift_Deactivate(object sender, EventArgs e)
{
PosOLEDevice.SetEventHandle(null);
}
private void frmGift_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
{
// 이미지 로딩 처리
this.Size = new Size(800, 578);
this.Location = new Point(1024 - 800 - 10, 768 - 600);
picBack.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.POP_SIZE_800X578);
picBack.Location = new Point(0, 0);
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);
//버튼이미지 적용
btnAllUp.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_14X9_UP2_BASIC);
btnAllUp.ImageAlign = ContentAlignment.MiddleCenter;
btnAllUp.BorderStyle = BorderStyle.None;
btnAllDw.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.NAVIBTN_14X9_DOWN2_BASIC);
btnAllDw.ImageAlign = ContentAlignment.MiddleCenter;
btnAllDw.BorderStyle = BorderStyle.None;
if (btnAllUp.Image != null) btnAllUp.Text = "";
if (btnAllDw.Image != null) btnAllDw.Text = "";
//테마색상 적용!
btnComplete.BackColor = CmUtil.GetColorToString(m_cPosStatus.ScnMst.ThemeColor);
padInPut.ThemeColor = m_cPosStatus.ScnMst.ThemeColor;
padInPut.ClearBtnText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0817);
padInPut.SearchBtnText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_1018);
btnExit.Image = ImageManager.GetImage(BaseCom.NxImgPath, ImageManager.BTN_CLOSE);
if (btnExit.Image != null) btnExit.Text = "";
// 타이틀
if (m_sPosMenuKey == PosKey.MENU_KEY.GIFT_CARD) lblTitle.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0268);
m_sPay_DC_Grp_Type = ItemConst.TR_ITEM_ID.GIFT_ITEM;
m_sPay_DC_CD = ItemConst.TR_ITEM_ID.GIFT.GIFT_COM;
lblCardNo.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0269);
lblCardNM.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0270);
lblAmount.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0271);
lblQty.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0272);
lblPayAmt.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0037);
lblSaleAmt.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0267);
btnAdd.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0224); // 추가
btnDelete.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0021); // 삭제
btnComplete.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0263); // 결제
btnExchangeTicket.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0266); // 교환권
btnHappyGifHelp.Text = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0797); // 해피머니 상품권 도움말
txtCardNo.Text = "";
txtCardNM.Text = "";
txtAmount.Text = "0";
txtQty.Text = "0";
txtPayAmt.Text = m_cPosStatus.Global.NumericTOCurrency(m_cTrnStatus.Sale.RemainPayAmt); // 받을금액
txtSaleAmt.Text = "0";
m_sInPutType = ""; // 입력구분
m_sInPutData = ""; // 입력데이터
m_sInEncData = ""; // 카드데이터
nExchangeTicketAmt = 0; // 잔액교환권 금액
sExchange_Ticket_Type = ""; // 잔액교환권 발행구분
sExchange_Ticket_No = ""; // 잔액교환권 번호
m_sAppNo = ""; // 승인번호
m_sAppDate = ""; // 승인일자
m_sAppTime = ""; // 승인시간
m_sAppSvrID = ""; // 승인서버ID
m_sAppYN = "0"; // 인증여부
m_GiftType = ""; // 권종
m_sGiftNM = ""; // 상품권명
m_HappyGifType = "0"; // 해피머니상품권 여부
m_sCHANGE_PAYMNT_YN = "0"; // 거스름 지불 여부
m_sMNDTRY_INPUT_YN = "0"; // 필수 입력 여부
bNotDoubleClik = false;
// 한국인 경우만 잔액교환권 활성화
btnExchangeTicket.Visible = true;
DataGridSetting(0); // 그리드 초기화
LoadFuncMaster(); // 기능키 설정
// 해외인 경우 수량 변경 가능
txtQty.ReadOnly = true;
txtCardNo.ReadOnly = false;
if (m_cPosStatus.Mst.CntryDiv != ItemConst.CNTRY_DIV.KR)
{
btnExchangeTicket.Visible = false;
txtQty.ReadOnly = false;
txtCardNo.ReadOnly = true;
txtQty.Select();
txtQty.SelectText();
}
else
{
//#20170825 국내는 수량 수정안되도록 수정 PHJ, start
if (m_cPosStatus.Mst.CntryDiv == ItemConst.CNTRY_DIV.KR)
{
dgvData.Columns[3].ReadOnly = true;
}
//#20170825 국내는 수량 수정안되도록 수정 PHJ, end
txtCardNo.Select();
txtCardNo.SelectText();
}
}
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 ((UI.CsmButton)sender == btnAllUp) // 상단 그리드 Up
{
if (dgvData.Rows.Count == 0)
{
bNotDoubleClik = false;
return;
}
if (dgvData.CurrentRow.Index > 0)
{
for (int iLoop = dgvData.CurrentRow.Index - 1; iLoop >= 0; iLoop--)
{
if (dgvData.Rows[iLoop].Visible == false) continue;
dgvData.Rows[iLoop].Selected = true;
dgvData.Rows[iLoop].Cells[dgvData.CurrentCell.ColumnIndex].Selected = true;
break;
}
}
}
else if ((UI.CsmButton)sender == btnAllDw) // 상단 그리드 Down
{
if (dgvData.Rows.Count == 0)
{
bNotDoubleClik = false;
return;
}
if (dgvData.CurrentRow.Index < dgvData.Rows.Count - 1)
{
for (int iLoop = dgvData.CurrentRow.Index + 1; iLoop <= dgvData.Rows.Count - 1; iLoop++)
{
if (dgvData.Rows[iLoop].Visible == false) continue;
dgvData.Rows[iLoop].Selected = true;
dgvData.Rows[iLoop].Cells[dgvData.CurrentCell.ColumnIndex].Selected = true;
break;
}
}
}
else if (((Cosmos.UI.CsmButton)sender) == btnAdd) // 추가
{
// 추가
DataGridSetting(1);
}
else if (((Cosmos.UI.CsmButton)sender) == btnDelete) // 삭제
{
// 삭제
DataGridSetting(2);
}
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 (((Cosmos.UI.CsmButton)sender) == btnHappyGifHelp) // 해피머니상품권 도움말
{
frmHappyGifHelp fForm = (frmHappyGifHelp)FormManager.GetForm(FormManager.FORM_PAY_HAPPY_GIF_HELP);
if (fForm == null)
{
fForm = new frmHappyGifHelp();
FormManager.AddForm(FormManager.FORM_PAY_HAPPY_GIF_HELP, fForm);
}
if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
}
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>
/// <returns>성공/실패</returns>
public bool LoadFuncMaster()
{
bool bHappyGiftYn = false;
try
{
btnHappyGifHelp.Visible = bHappyGiftYn;
btnMenu.ClearMenuButtonInfo();
// 상품권 List 조회
DataTable dtMemu = m_cDataCommon.SeletGiftFuncKey(m_sPay_DC_Grp_Type, m_sPay_DC_CD);
if (dtMemu == null || dtMemu.Rows.Count <= 0)
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0059); // 메뉴키 마스터가 없습니다
return false;
}
// 우측 상단 기능키 초기화
btnMenu.BackColor = CmUtil.GetColorToString("223223223");
//if (dtMemu.Rows.Count == 12)
// btnMenu.VisibleUpDown = false;
//else
btnMenu.VisibleUpDown = true;
btnMenu.BackColorUpDown = Color.White;
btnMenu.ForeColorUpDown = Color.Black;
btnMenu.ClearMenuButtonInfo(); // 설정된 메뉴정보 초기화
int index = 1;
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------
// 인증 상품권/ 해피머니 만 표시
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------
for (int iLoop = 0; iLoop < dtMemu.Rows.Count; iLoop++)
{
DataRow dr = dtMemu.Rows[iLoop];
string sGifCD = CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.GIFT_CD).Trim();
string sApprType = CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.APPR_TYPE).Trim();
if (sApprType != "1" )
if (sGifCD != "90" && sGifCD != "91") continue; // 인증이 아닌경우 또는 해피머니가 아닌경우 Skip
//#20171102 판매POS 옵션(해피머니 상품권 사용유무)에 따라 해피머니 상품권 표시/미표시 start
if (PosMstManager.GetPosOption(POS_OPTION.OPT329) == "0")
{
if (sGifCD == "90" || sGifCD == "91") continue;
}
//#20171102 판매POS 옵션(해피머니 상품권 사용유무)에 따라 해피머니 상품권 표시/미표시 end
Cosmos.UI.CsmMenu.MenuBtnInfo cMenuInfo = new Cosmos.UI.CsmMenu.MenuBtnInfo();
//cMenuInfo.nSeqNo = CmUtil.GetDataRowInt(dr, PosMst.MST_GIFT_KEY.DATA.SEQ); // SEQ
cMenuInfo.nSeqNo = index++;
cMenuInfo.sClassCode = CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.STOR_CD); // 점포코드
cMenuInfo.sGroupCode = "1"; // SUB 그룹
string sMenuCode = null;
sMenuCode = CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.APPR_TYPE), 1) // 인증여부
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.HPPOINT_TYPE), 1) // 해패포인트 적립여부
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.MNDTRY_INPUT_YN), 1) // 필수 입력 여부
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.APPR_SVR_DIV), 1) // 승인서버구분
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.GIFT_CD), 40) // 코드
+ CmUtil.LPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.GIFT_AMT), 20) // 금액
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.GIFT_NM), 80) // 명
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.BRAN_CD), 4) // 고정브랜드코드
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.HPY_GIF_DIV), 1) // 해피머니상품권여부
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.CHANGE_PAYMNT_YN), 1); // 거스름 지불여부
cMenuInfo.sMenuCode = sMenuCode; // 메뉴 코드
cMenuInfo.sMenuName = CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.GIFT_NM); // 메뉴 명
cMenuInfo.sMenuPrice = m_cPosStatus.Global.NumericTOCurrency(CmUtil.GetDataRowDouble(dr, PosMst.MST_GIFT_KEY.DATA.GIFT_AMT)); // 메뉴 가격
cMenuInfo.cBackColor = CmUtil.GetColorToString(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.BACKGR_COLOR)); // 버튼 BACK 컬러
cMenuInfo.cForeColorName = Color.FromArgb(51, 51, 51); // 메뉴명 컬러
cMenuInfo.cForeColorPrice = Color.Red; //Color.FromArgb(102, 102, 102); // 메뉴가격 컬러
cMenuInfo.fFontSizeName = CmUtil.GetDataRowFloat(dr, PosMst.MST_GIFT_KEY.DATA.FONT_SIZE); // 메뉴명 폰트 사이즈
cMenuInfo.fFontSizePrice = CmUtil.GetDataRowFloat(dr, PosMst.MST_GIFT_KEY.DATA.FONT_SIZE); // 메뉴 가격 폰트 사이즈
cMenuInfo.nButtonSize = CmUtil.GetDataRowInt(dr, PosMst.MST_GIFT_KEY.DATA.BTN_SIZE); // 메뉴버튼 사이즈(0:일반,1:가로확대,2:세로확대,3:가로세로확대)
cMenuInfo.sMenuEtc = "";
if (CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.APPR_TYPE) == "1")
cMenuInfo.sMenuEtc = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0274);
else if (CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.MNDTRY_INPUT_YN) == "1")
cMenuInfo.sMenuEtc = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0999);
cMenuInfo.cForeColorEtc = Color.Blue;
cMenuInfo.fFontSizeEtc = CmUtil.GetDataRowFloat(dr, PosMst.MST_GIFT_KEY.DATA.FONT_SIZE) - 2;
cMenuInfo.cMenuImage = ""; // 버튼이미지
if (CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.BTN_ITEM_IMG) != "")
{
cMenuInfo.cMenuImage = BaseCom.NxCDPPath + @"ITEM\" + CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.BTN_ITEM_IMG); // 메뉴 이미지
//cMenuInfo.cMenuImage = CmUtil.LoadImage(BaseCom.NxCDPPath + @"ITEM\" + CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.BTN_ITEM_IMG)); // 메뉴 이미지
}
btnMenu.AddMenuButtonInfo(cMenuInfo);
if (CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.HPY_GIF_DIV) == "1")
{
bHappyGiftYn = true;
}
}
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------
// 미인증 상품권 만 표시
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------
if (index > 1 && index < 12) index = 12; // 다음 페이지에 표시
for (int iLoop = 0; iLoop < dtMemu.Rows.Count; iLoop++)
{
DataRow dr = dtMemu.Rows[iLoop];
string sGifCD = CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.GIFT_CD).Trim();
string sApprType = CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.APPR_TYPE).Trim();
if (sApprType == "1") continue; // 인증인 경우 Skip
if (sGifCD == "90" || sGifCD == "91") continue; // 해피머니 Skip
Cosmos.UI.CsmMenu.MenuBtnInfo cMenuInfo = new Cosmos.UI.CsmMenu.MenuBtnInfo();
//cMenuInfo.nSeqNo = CmUtil.GetDataRowInt(dr, PosMst.MST_GIFT_KEY.DATA.SEQ); // SEQ
cMenuInfo.nSeqNo = index++;
cMenuInfo.sClassCode = CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.STOR_CD); // 점포코드
cMenuInfo.sGroupCode = "1"; // SUB 그룹
string sMenuCode = null;
sMenuCode = CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.APPR_TYPE), 1) // 인증여부
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.HPPOINT_TYPE), 1) // 해패포인트 적립여부
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.MNDTRY_INPUT_YN), 1) // 필수 입력 여부
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.APPR_SVR_DIV), 1) // 승인서버구분
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.GIFT_CD), 40) // 코드
+ CmUtil.LPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.GIFT_AMT), 20) // 금액
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.GIFT_NM), 80) // 명
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.BRAN_CD), 4) // 고정브랜드코드
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.HPY_GIF_DIV), 1) // 해피머니상품권여부
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.CHANGE_PAYMNT_YN), 1); // 거스름 지불여부
cMenuInfo.sMenuCode = sMenuCode; // 메뉴 코드
cMenuInfo.sMenuName = CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.GIFT_NM); // 메뉴 명
cMenuInfo.sMenuPrice = m_cPosStatus.Global.NumericTOCurrency(CmUtil.GetDataRowDouble(dr, PosMst.MST_GIFT_KEY.DATA.GIFT_AMT)); // 메뉴 가격
cMenuInfo.cBackColor = CmUtil.GetColorToString(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.BACKGR_COLOR)); // 버튼 BACK 컬러
cMenuInfo.cForeColorName = Color.FromArgb(51, 51, 51); // 메뉴명 컬러
cMenuInfo.cForeColorPrice = Color.Red; //Color.FromArgb(102, 102, 102); // 메뉴가격 컬러
cMenuInfo.fFontSizeName = CmUtil.GetDataRowFloat(dr, PosMst.MST_GIFT_KEY.DATA.FONT_SIZE); // 메뉴명 폰트 사이즈
cMenuInfo.fFontSizePrice = CmUtil.GetDataRowFloat(dr, PosMst.MST_GIFT_KEY.DATA.FONT_SIZE); // 메뉴 가격 폰트 사이즈
cMenuInfo.nButtonSize = CmUtil.GetDataRowInt(dr, PosMst.MST_GIFT_KEY.DATA.BTN_SIZE); // 메뉴버튼 사이즈(0:일반,1:가로확대,2:세로확대,3:가로세로확대)
cMenuInfo.sMenuEtc = "";
if (CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.APPR_TYPE) == "1")
cMenuInfo.sMenuEtc = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0274);
else if (CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.MNDTRY_INPUT_YN) == "1")
cMenuInfo.sMenuEtc = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0999);
cMenuInfo.cForeColorEtc = Color.Blue;
cMenuInfo.fFontSizeEtc = CmUtil.GetDataRowFloat(dr, PosMst.MST_GIFT_KEY.DATA.FONT_SIZE) - 2;
cMenuInfo.cMenuImage = ""; // 버튼이미지
if (CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.BTN_ITEM_IMG) != "")
{
cMenuInfo.cMenuImage = BaseCom.NxCDPPath + @"ITEM\" + CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.BTN_ITEM_IMG); // 메뉴 이미지
//cMenuInfo.cMenuImage = CmUtil.LoadImage(BaseCom.NxCDPPath + @"ITEM\" + CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.BTN_ITEM_IMG)); // 메뉴 이미지
}
btnMenu.AddMenuButtonInfo(cMenuInfo);
if (CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.HPY_GIF_DIV) == "1")
{
bHappyGiftYn = true;
}
}
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------
// 해피머니 상품권 도움말
btnHappyGifHelp.Visible = bHappyGiftYn;
btnMenu.SetMenuButtonCount(4, 3);
btnMenu.DisplayMenuButton(m_cPosStatus.Base.StoreNo, "1"); // 버튼 표시
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="sMenuCode"></param>
private void btnMenu_MenuClickHandler(object sender, string sMenuCode)
{
string sRet = UserCom.RST_ERR;
try
{
if (sMenuCode == "") return;
//#15533 상품권(승인) 시 PREFIX 리딩을 통한 승인기능도입 요청 start
//기존
/*
txtCardNo.Text = "";
txtCardNM.Text = "";
txtAmount.Text = "0";
*/
//변경
if (sender != null)
{
txtCardNo.Text = "";
txtCardNM.Text = "";
txtAmount.Text = "0";
}
//#15533 상품권(승인) 시 PREFIX 리딩을 통한 승인기능도입 요청 end
// 메뉴 키 값 = 인증여부(1) + 해피포인트 적립여부(1) + 필수입력여부(1) + 승인서버구분(1) + 코드(40) + 금액(20) + 명(80) + 고정브랜드코드(4) + 해피머니상품권여부(1) + 거스름지불여부(1)
m_sAppYN = CmUtil.MidH(sMenuCode, 0, 1).Trim();
m_sMNDTRY_INPUT_YN = CmUtil.MidH(sMenuCode, 2, 1).Trim();
m_GiftType = CmUtil.MidH(sMenuCode, 4, 40).Trim();
m_sGiftNM = CmUtil.MidH(sMenuCode, 64, 80).Trim();
m_HappyGifType = CmUtil.MidH(sMenuCode, 148, 1).Trim();
m_sCHANGE_PAYMNT_YN = CmUtil.MidH(sMenuCode, 149, 1).Trim();
if (m_sAppYN == "1")
{
m_sAppSvrID = CmUtil.MidH(sMenuCode, 3, 1).Trim();
// -------------------------------------------------------------------------------------------
// 상품권 승인 팝업
// -------------------------------------------------------------------------------------------
string sGiftType = CmUtil.MidH(sMenuCode, 4, 40).Trim(); // 권종
//string sBrandCD = CmUtil.MidH(sMenuCode, 144, 4).Trim(); // 고정브랜드코드
string sApprSvrDiv = CmUtil.MidH(sMenuCode, 3, 1).Trim(); // 승인 서버 구분 (0:통합, 1:자체)
frmGiftApp fForm = (frmGiftApp)FormManager.GetForm(FormManager.FORM_PAY_GIFT_APP);
if (fForm == null)
{
fForm = new frmGiftApp();
FormManager.AddForm(FormManager.FORM_PAY_GIFT_APP, fForm);
}
fForm.SetPosMenuKey = m_sPosMenuKey;
//fForm.SetBrandCD = sBrandCD;
fForm.SetBrandCD = sApprSvrDiv;
fForm.SetGitftType = m_GiftType;
//#15533 상품권(승인) 시 PREFIX 리딩을 통한 승인기능도입 요청 start
fForm.SetGitftNo = txtCardNo.Text;
//#15533 상품권(승인) 시 PREFIX 리딩을 통한 승인기능도입 요청 end
this.Size = new Size(788, 402);
if (fForm.ShowDialog() == DialogResult.OK) sRet = UserCom.RST_OK;
this.Size = new Size(800, 578);
// -------------------------------------------------------------------------------------------
if (sRet != UserCom.RST_OK) return;
// 결제 내역 받아 오기
IPaymentUs cGiftApp = (IPaymentUs)sManager.InitServiceInstance(ServiceLists.BSV_PAYMENT.DLL, ServiceLists.BSV_PAYMENT.GIFT_APP);
Column.TR_PAYMENT.DATA alPayItem = (Column.TR_PAYMENT.DATA)cGiftApp.GetPayment(new string[] { });
txtCardNo.Value = alPayItem.OCCUR_ENTRY_01;
txtCardNM.Text = alPayItem.OCCUR_ENTRY_11;
txtAmount.Text = m_cPosStatus.Global.NumericTOCurrency(alPayItem.AMT_ENTRY_01);
//#20180409 미인증 상품권 수량 변경 가능 하도록 수정 start
txtQty.ReadOnly = true;
//#20180409 미인증 상품권 수량 변경 가능 하도록 수정 end
txtQty.Text = "1";
m_sPay_DC_Grp_Type = alPayItem.PAY_WAY_CD; ;
m_sPay_DC_CD = alPayItem.PAY_DTL_CD_01;
m_sAppNo = alPayItem.OCCUR_ENTRY_02;
m_sAppDate = alPayItem.OCCUR_ENTRY_03;
m_sAppTime = alPayItem.OCCUR_ENTRY_04;
m_sInPutType = alPayItem.OCCUR_ENTRY_05;
m_GiftType = alPayItem.OCCUR_ENTRY_15;
// 추가
DataGridSetting(1);
}
else
{
if (m_cPosStatus.Mst.CntryDiv == ItemConst.CNTRY_DIV.KR)
{
if (m_GiftType != "90" && m_GiftType != "91") // 미인증이고 해피머니가 아닌경우 알림 팝업 표시
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0689);
//#20170811, 상품권 화면에서 해피머니 선택 시 해피머니상품권 도움말 팝업 Start, srlee
else
btnProc_Click(btnHappyGifHelp, null);
//#20170811, 상품권 화면에서 해피머니 선택 시 해피머니상품권 도움말 팝업 End, srlee
}
if (m_sMNDTRY_INPUT_YN == "1")
{
// 번호필수
txtCardNo.Text = "";
txtCardNo.ReadOnly = false;
// -------------------------------------------------------------------------
// 수량 변경 가능 여부 판단될 위치가 아닌데 하고 있어 제거 20170830 goblin6
//txtQty.ReadOnly = true;
//txtQty.Text = "1";
// -------------------------------------------------------------------------
txtCardNo.Select();
txtCardNo.SelectText();
}
else
{
txtCardNo.ReadOnly = true;
// -------------------------------------------------------------------------
// 수량 변경 가능 여부 판단될 위치가 아닌데 하고 있어 제거 20170830 goblin6
//txtQty.ReadOnly = false;
//txtQty.Text = "0";
// -------------------------------------------------------------------------
txtQty.Select();
txtQty.SelectText();
}
if (m_cPosStatus.Mst.CntryDiv == ItemConst.CNTRY_DIV.KR)
{
txtCardNo.Value = "";
txtCardNo.ReadOnly = false;
//#20180409 미인증 상품권 수량 변경 가능 하도록 수정 start
//기존
//txtQty.ReadOnly = true;
//변경
txtQty.ReadOnly = false;
//#20180409 미인증 상품권 수량 변경 가능 하도록 수정 end
txtQty.Text = "1";
txtCardNo.Select();
txtCardNo.SelectText();
}
txtCardNM.Text = CmUtil.MidH(sMenuCode, 64, 80).Trim();
txtAmount.Text = m_cPosStatus.Global.NumericTOCurrency(m_cDataService.DoubleParse(CmUtil.MidH(sMenuCode, 44, 20).Trim()));
txtQty.Text = "1";
m_sAppNo = "";
m_sAppDate = "";
m_sAppTime = "";
m_sInPutType = "";
m_sAppSvrID = "";
m_sPay_DC_Grp_Type = ItemConst.TR_ITEM_ID.GIFT_ITEM;
if (m_HappyGifType == "0")
m_sPay_DC_CD = ItemConst.TR_ITEM_ID.GIFT.GIFT_COM;
else
m_sPay_DC_CD = ItemConst.TR_ITEM_ID.GIFT.GIFT_HP;
//if (m_cPosStatus.Mst.CntryDiv != ItemConst.CNTRY_DIV.KR)
//{
// txtQty.Select();
// txtQty.SelectText();
//}
//else
//{
// txtCardNo.Select();
// txtCardNo.SelectText();
//}
}
return;
}
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 )
{
//#15533 상품권(승인) 시 PREFIX 리딩을 통한 승인기능도입 요청 start
//기존
//DataGridSetting(1);
//변경
if (m_sInPutData.Length == 12)
{
if (CmUtil.MidH(txtCardNo.Value, 0, 1) == "3" || CmUtil.MidH(m_sInPutData, 0, 1) == "5")
{
txtCardNo.Value = "0" + txtCardNo.Value;
}
}
string sGiftCd = "";
if (CmUtil.MidH(txtCardNo.Value, 0, 4) == "0370" || CmUtil.MidH(m_sInPutData, 0, 4) == "0340")
{
sGiftCd = "03";
}
else if (CmUtil.MidH(txtCardNo.Value, 0, 4) == "0540" || CmUtil.MidH(m_sInPutData, 0, 4) == "0570")
{
sGiftCd = "06";
}
else if (CmUtil.MidH(txtCardNo.Value, 0, 4) == "1040" || CmUtil.MidH(m_sInPutData, 0, 4) == "5060")
{
sGiftCd = "50";
}
else if (CmUtil.MidH(txtCardNo.Value, 0, 4) == "0530")
{
sGiftCd = "05";
}
else if (CmUtil.MidH(txtCardNo.Value, 0, 4) == "1030")
{
sGiftCd = "10";
}
else
{
sGiftCd = "";
}
// 상품권 권종 조회
DataTable dtGift = m_cDataCommon.SeletGiftCd(sGiftCd);
if (dtGift == null || dtGift.Rows.Count <= 0)
{
DataGridSetting(1);
}
else
{
DataRow dr = dtGift.Rows[0];
string sMenuCode = null;
sMenuCode = CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.APPR_TYPE), 1) // 인증여부
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.HPPOINT_TYPE), 1) // 해패포인트 적립여부
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.MNDTRY_INPUT_YN), 1) // 필수 입력 여부
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.APPR_SVR_DIV), 1) // 승인서버구분
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.GIFT_CD), 40) // 코드
+ CmUtil.LPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.GIFT_AMT), 20) // 금액
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.GIFT_NM), 80) // 명
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.BRAN_CD), 4) // 고정브랜드코드
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.HPY_GIF_DIV), 1) // 해피머니상품권여부
+ CmUtil.RPadH(CmUtil.GetDataRowStr(dr, PosMst.MST_GIFT_KEY.DATA.CHANGE_PAYMNT_YN), 1); // 거스름 지불여부
btnMenu_MenuClickHandler(null, sMenuCode);
}
//#15533 상품권(승인) 시 PREFIX 리딩을 통한 승인기능도입 요청 end
}
}
else if (sFuncValue == PosKey.MENU_KEY.CLEAR)
{
if (((Cosmos.UI.CsmPosEditBox)sender) == txtCardNo)
{
txtCardNo.Value = "";
}
}
else if (sFuncValue == PosKey.MENU_KEY.ESC_PREVIOUS)
{
// 승인건 있을 경우 체크
for (int iLoop = 0; iLoop < dgvData.RowCount; iLoop++)
{
if (dgvData.Rows[iLoop].Cells[14].Value.ToString().Trim() != MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0076)) continue;
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0459);
return;
}
this.DialogResult = DialogResult.Cancel;
this.Close();
}
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
/// <summary>
/// 텍스트박스 활성화 처리
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void txtEditBox_EnterEvent(object sender, EventArgs e)
{
try
{
padInPut.SetActiveControl = (Control)sender;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
}
/// <summary>
/// 코드 변경시 초기화
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void txtCardNo_EditBoxTextChangedEvnet(object sender, EventArgs e)
{
m_sAppNo = ""; // 승인번호
m_sAppDate = ""; // 승인일자
m_sAppTime = ""; // 승인시간
m_sInPutType = ""; // 입력구분
m_sInPutData = ""; // 입력데이터
m_sInEncData = ""; // 카드데이터
}
#endregion
#region
/// <summary>
/// 텍스트박스 입력 유효성 체크
/// </summary>
/// <param name="sender"></param>
/// <returns></returns>
private bool CheckTxtInPut(object sender)
{
try
{
// 상품권 체크
if ((sender == null || ((Cosmos.UI.CsmPosEditBox)sender) == txtCardNo) && m_sMNDTRY_INPUT_YN == "1")
{
if (txtCardNo.Value.Length < 2)
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0189);
return false;
}
}
// 금액 체크
if (m_cDataService.DoubleParse(txtAmount.Text) <= 0)
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0191);
//if (m_cPosStatus.Mst.CntryDiv != ItemConst.CNTRY_DIV.KR)
//{
// txtQty.Select();
// txtQty.SelectText();
//}
//else
//{
// txtCardNo.Select();
// txtCardNo.SelectText();
//}
return false;
}
// 추가 금액 체크
//#20180410 상품권 추가 시 사용 가능한 수량 만큼만 추가 할수 있도록 수정 start
//기존
/*
if (m_cDataService.DoubleParse(txtSaleAmt.Text) >= m_cDataService.DoubleParse(txtPayAmt.Text))
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0208);
//if (m_cPosStatus.Mst.CntryDiv != ItemConst.CNTRY_DIV.KR)
//{
// txtQty.Select();
// txtQty.SelectText();
//}
//else
//{
// txtCardNo.Select();
// txtCardNo.SelectText();
//}
return false;
}
*/
//변경
//받을 금액 - 총 금액
double dTemp1 = CmUtil.DoubleSubtraction(m_cDataService.DoubleParse(txtPayAmt.Text), m_cDataService.DoubleParse(txtSaleAmt.Text));
//(받을 금액 - 총 금액) / 상품권 금액
double dTemp2 = CmUtil.DoubleDivision(dTemp1, m_cDataService.DoubleParse(txtAmount.Text));
// 올림 처리 (받을 금액 - 총 금액) / 상품권 금액 => 현재 선택된 상품권의 최대 사용 가능 수량
double dTemp3 = CmUtil.MathRounds(dTemp2, PosConst.MATH_ROUND.CEILING, 0);
if (dTemp3 < m_cDataService.DoubleParse(txtQty.Text))
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0208);
//if (m_cPosStatus.Mst.CntryDiv != ItemConst.CNTRY_DIV.KR)
//{
// txtQty.Select();
// txtQty.SelectText();
//}
//else
//{
// txtCardNo.Select();
// txtCardNo.SelectText();
//}
return false;
}
//#20180410 상품권 추가 시 사용 가능한 수량 만큼만 추가 할수 있도록 수정 end
// 해피머니 상품권여부
if (m_HappyGifType == "1")
{
if (txtCardNo.Value != "8809044851010" && txtCardNo.Value != "8809044859054")
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0189);
return false;
}
else if (txtCardNo.Value == "8809044851010" && m_cDataService.DoubleParse(txtAmount.Text) != 10000)
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0465);
return false;
}
else if (txtCardNo.Value == "8809044859054" && m_cDataService.DoubleParse(txtAmount.Text) != 5000)
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0465);
return false;
}
}
else
{
// 미인증이고 필수 입력이 아니면 Skip
if (m_sAppYN != "1" && m_sMNDTRY_INPUT_YN == "0") return true;
// 중복 등록 체크
for (int iLoop = 0; iLoop < dgvData.RowCount; iLoop++)
{
if (txtCardNo.Value.Trim() == dgvData.Rows[iLoop].Cells[4].Value.ToString().Trim())
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0210);
//if (m_cPosStatus.Mst.CntryDiv != ItemConst.CNTRY_DIV.KR)
//{
// txtQty.Select();
// txtQty.SelectText();
//}
//else
//{
// txtCardNo.Select();
// txtCardNo.SelectText();
//}
return false;
}
}
// 승인이 아닌 경우
if (m_sAppYN != "1")
{
// 파리인 경우만 권종과 상품권 첫 2자리 체크 - 미인증 대상
if (m_cPosStatus.Base.BrandCd.Trim() == "002")
{
if (((m_GiftType == "35") && (CmUtil.MidH(txtCardNo.Value, 0, 2) != "03"))
|| ((m_GiftType == "75") && (CmUtil.MidH(txtCardNo.Value, 0, 2) != "05"))
|| ((m_GiftType == "76") && (CmUtil.MidH(txtCardNo.Value, 0, 2) != "10"))
|| ((m_GiftType == "65") && (CmUtil.MidH(txtCardNo.Value, 0, 2) != "05"))
|| ((m_GiftType == "70") && (CmUtil.MidH(txtCardNo.Value, 0, 2) != "10"))
|| ((m_GiftType == "66") && (CmUtil.MidH(txtCardNo.Value, 0, 2) != "06")))
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0481);
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 string CompleteTxtInPut(bool bExchangeMode)
{
string sRet = UserCom.RST_ERR;
double nExchangeAmount = 0;
double nChangeMoney = 0;
string[] aRspRet = null;
bool bErrorCheck = false;
try
{
if (dgvData.RowCount <= 0) return sRet;
// 결제 수단 취소후 재승인 처리 (승인후 오류 상품권 삭제후 재 진행시 오류 방지)
//m_cGift.CancelPayment(new string[] { });
if (bExchangeMode == true)
{
// 잔액교환권
if (m_cDataService.DoubleParse(txtPayAmt.Text.ToString()) < m_cDataService.DoubleParse(txtSaleAmt.Text.ToString()))
{
// 잔액교환 가능한 금액 조회
nExchangeAmount = DataGridSetting(3);
if (nExchangeAmount <= 0)
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0209);
return sRet;
}
// 결제할 금액보다 금액이 큰경우 차액을 잔액교환권으로 생성한다.
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.GIFT.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.GIFT.PadLeft(1, '0');
// 잔액교환 금액
nExchangeTicketAmt = CmUtil.DoubleSubtraction(m_cDataService.DoubleParse(txtSaleAmt.Text.ToString()), m_cDataService.DoubleParse(txtPayAmt.Text.ToString()));
if (nExchangeTicketAmt > 0)
{
if (nExchangeTicketAmt > nExchangeAmount)
{
// 거스름 = 잔액교환할 금액 - 잔액교환 가능한금액
nChangeMoney = CmUtil.DoubleSubtraction(nExchangeTicketAmt, nExchangeAmount);
// 잔액교환권 금액 = 잔액교환 가능한 금액
nExchangeTicketAmt = nExchangeAmount;
}
else
{
// 거스름 0
nChangeMoney = 0;
}
sRet = m_cGift.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
{
// 거스름
nChangeMoney = 0;
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()));
}
sExchange_Ticket_Type = "";
}
// 결제
for (int iLoop = 0; iLoop < dgvData.RowCount; iLoop++)
{
string sGiftCD = dgvData.Rows[iLoop].Cells[4].Value.ToString(); // 코드
string sGiftQty = m_cDataService.LongParse(dgvData.Rows[iLoop].Cells[3].Value.ToString()).ToString(); // 수량
string sGiftAmt = m_cDataService.DoubleParse(dgvData.Rows[iLoop].Cells[2].Value.ToString()).ToString(); // 금액
//string sGiftAmt = CmUtil.DoubleMultiplication(nGiftAmt, nGiftQty).ToString();
string sPay_DC_Grp_Type = dgvData.Rows[iLoop].Cells[9].Value.ToString(); // 결제수단
string sPay_DC_CD = dgvData.Rows[iLoop].Cells[10].Value.ToString(); // 결제상세수단
string sWcc = dgvData.Rows[iLoop].Cells[8].Value.ToString(); // 입력구분
string sInqFlag = dgvData.Rows[iLoop].Cells[11].Value.ToString(); // 승인서버ID
string sAppNo = ""; // 승인번호
string sAppDate = ""; // 승인일자
string sAppYN = dgvData.Rows[iLoop].Cells[12].Value.ToString(); // 인증여부
string sGiftType = dgvData.Rows[iLoop].Cells[13].Value.ToString(); // 권종
string sGiftNM = dgvData.Rows[iLoop].Cells[1].Value.ToString(); // 상품권명
string sCHANGE_PAYMNT_YN = dgvData.Rows[iLoop].Cells[15].Value.ToString(); // 거스름가능여부
string sChangeMoney = "0";
string sExchange_Ticket_No_Save = "";
if (dgvData.Rows[iLoop].Cells[14].Value == MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0076)) continue;
if (m_cDataService.DoubleParse(sGiftAmt) >= nChangeMoney)
{
// 거스름
sChangeMoney = nChangeMoney.ToString();
nChangeMoney = 0;
}
string sMake_Type = ItemConst.EXCHANGE_TICKET_MAKE_TYPE.NORMAL;
if (sExchange_Ticket_No != "")
sMake_Type = ItemConst.EXCHANGE_TICKET_MAKE_TYPE.GIFT; // 잔액교환권 발생구분
// 잔액교환권 금액 체크
string sExchangeTicketAmt = "0";
if (m_cDataService.DoubleParse(sGiftAmt) >= nExchangeTicketAmt)
{
sExchange_Ticket_No_Save = sExchange_Ticket_No;
sExchangeTicketAmt = nExchangeTicketAmt.ToString();
}
// 저장
dgvData.Rows[iLoop].Cells[14].Value = "";
sRet = m_cGift.SetPayment(new string[] { ItemConst.IRT_INQ_TYPE.GIFT_APPROVE_INQ, sPay_DC_Grp_Type, sPay_DC_CD, sInqFlag, sWcc, sGiftCD, sGiftQty, sGiftAmt, sExchange_Ticket_Type, sExchange_Ticket_No_Save, sExchangeTicketAmt, sMake_Type, sAppNo, sAppDate, sChangeMoney, sAppYN, sGiftType, sGiftNM, sCHANGE_PAYMNT_YN });
if (sRet != UserCom.RST_OK)
{
dgvData.Rows[iLoop].Cells[14].Value = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0585);
dgvData.Rows[iLoop].DefaultCellStyle.ForeColor = Color.Red;
dgvData.Rows[iLoop].DefaultCellStyle.SelectionForeColor = Color.Red;
dgvData.Rows[iLoop].Cells[5].Value = ""; // 승인번호
dgvData.Rows[iLoop].Cells[6].Value = ""; // 승인일자
dgvData.Rows[iLoop].Cells[7].Value = ""; // 승인시간
bErrorCheck = true;
}
else
{
dgvData.Rows[iLoop].Cells[14].Value = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0076);
dgvData.Rows[iLoop].DefaultCellStyle.ForeColor = Color.Black;
dgvData.Rows[iLoop].DefaultCellStyle.SelectionForeColor = Color.Black;
// 결제 아이템 추가
ArrayList alPayItem = (ArrayList)StateObject.GetItemObject(Column.TR_PAYMENT.ITEM); // 결제 내역 받아 오기
Column.TR_PAYMENT.DATA m_cPayItem = (Column.TR_PAYMENT.DATA)alPayItem[alPayItem.Count-1];
dgvData.Rows[iLoop].Cells[5].Value = m_cPayItem.OCCUR_ENTRY_02 ; // 승인번호
dgvData.Rows[iLoop].Cells[6].Value = m_cPayItem.OCCUR_ENTRY_03; // 승인일자
dgvData.Rows[iLoop].Cells[7].Value = m_cPayItem.OCCUR_ENTRY_04; // 승인시간
}
dgvData.Refresh();
dgvData.Update();
if (sExchange_Ticket_No.Trim() != "" && sExchangeTicketAmt != "0")
{
// 잔액교환권 첫 상품권에만 저장하고 이후는 삭제
sMake_Type = ItemConst.EXCHANGE_TICKET_MAKE_TYPE.NORMAL;
sExchange_Ticket_Type = "";
sExchange_Ticket_No = "";
nExchangeTicketAmt = 0;
}
}
// 결제 합계금액 재계산 처리
m_cDataService.UpdatePayAmount();
txtSaleAmt.Text = m_cPosStatus.Global.NumericTOCurrency(DataGridSetting(4)); // 계
sRet = UserCom.RST_OK;
if (bErrorCheck == true) sRet = UserCom.RST_ERR;
}
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;
if (sScanData.Length > 0 && m_sInPutData == "")
{
m_sInPutType = PosConst.POS_VAN_MASTER.INPUT_TYPE.VAN_BARCODE;
m_sInPutData = sScanData;
txtCardNo.Value = m_sInPutData;
/// if (m_cTrnStatus.Head.TradeDiv == ItemConst.TRAN_DIV.NORMAL) SearchTxtInPut();
}
}
/// <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
private double DataGridSetting(int iWorkMode)
{
string sRet = UserCom.RST_ERR;
try
{
if (iWorkMode == 0)
{
// 초기화
dgvData.Rows.Clear();
dgvData.AllowUserToAddRows = false;
dgvData.EnableHeadersVisualStyles = false;
dgvData.RowsDefaultCellStyle.BackColor = Color.White;
dgvData.AlternatingRowsDefaultCellStyle.BackColor = Color.FromArgb(249, 249, 249);
dgvData.Font = this.Font;
dgvData.DefaultCellStyle.Font = new Font(m_cPosStatus.Base.FONT, 9.75f);
//dgvData.DefaultCellStyle.SelectionBackColor = Color.Transparent;
dgvData.Font = new Font(m_cPosStatus.Base.FONT, 9.75f);
dgvData.RowHeadersDefaultCellStyle.Font = new Font(m_cPosStatus.Base.FONT, 9.75f);
// 타이틀 설정
dgvData.Columns[0].HeaderText = "No";
dgvData.Columns[1].HeaderText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0270);
dgvData.Columns[2].HeaderText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0271);
dgvData.Columns[3].HeaderText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0017);
dgvData.Columns[4].HeaderText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0269);
dgvData.Columns[5].HeaderText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0275);
dgvData.Columns[14].HeaderText = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0421);//2017.12.21;"상테" 헤드 다국어 처리; girak.kim
}
else if (iWorkMode == 1)
{
// 추가
if (CheckTxtInPut(null) != true) return 0;
int iRow = dgvData.Rows.Add();
dgvData.Rows[iRow].Visible = true;
dgvData.Rows[iRow].Cells[0].ReadOnly = false;
dgvData.Rows[iRow].DefaultCellStyle.ForeColor = Color.Black;
dgvData.Rows[iRow].DefaultCellStyle.SelectionForeColor = Color.Black;
dgvData.Rows[iRow].HeaderCell.Value = (iRow + 1).ToString();
dgvData.Rows[iRow].Cells[0].Value = (iRow + 1).ToString(); // No
//dgvData.Rows[iRow].Cells[1].Value = m_sGiftNM; // txtCardNM.Text.Trim(); // 명칭
dgvData.Rows[iRow].Cells[1].Value = txtCardNM.Text.Trim(); // 명칭
double nSaleAmount = CmUtil.DoubleMultiplication(m_cDataService.DoubleParse(txtAmount.Text.Trim()), m_cDataService.LongParse(txtQty.Text.Trim()));
dgvData.Rows[iRow].Cells[2].Value = m_cPosStatus.Global.NumericTOCurrency(nSaleAmount); // 금액
dgvData.Rows[iRow].Cells[3].Value = m_cPosStatus.Global.NumericToQuantity(m_cDataService.LongParse(txtQty.Text.Trim())); // 수량
dgvData.Rows[iRow].Cells[4].Value = txtCardNo.Text.Trim(); // 코드
dgvData.Rows[iRow].Cells[5].Value = m_sAppNo; // 승인번호
dgvData.Rows[iRow].Cells[6].Value = m_sAppDate; // 승인일자
dgvData.Rows[iRow].Cells[7].Value = m_sAppTime; // 승인시간
dgvData.Rows[iRow].Cells[8].Value = m_sInPutType; // 입력구분
dgvData.Rows[iRow].Cells[9].Value = m_sPay_DC_Grp_Type; // 결제수단
dgvData.Rows[iRow].Cells[10].Value = m_sPay_DC_CD; // 결제상세코드
dgvData.Rows[iRow].Cells[11].Value = m_sAppSvrID; // 승인서버ID
dgvData.Rows[iRow].Cells[12].Value = m_sAppYN; // 인증여부
dgvData.Rows[iRow].Cells[13].Value = m_GiftType; // 권종
dgvData.Rows[iRow].Cells[14].Value = ""; // 상태
dgvData.Rows[iRow].Cells[15].Value = m_sCHANGE_PAYMNT_YN; // 거스름지불여부
dgvData.Rows[iRow].Cells[16].Value = m_sMNDTRY_INPUT_YN; // 필수입력 여부
}
else if (iWorkMode == 2)
{
// 삭제
if (dgvData.RowCount <= 0) return 0;
if (dgvData.CurrentCell.RowIndex < 0) return 0;
// ---------------------------------------------------------------------------------------------------------------------------------------
// 결제 수단 취소
// ---------------------------------------------------------------------------------------------------------------------------------------
string sGiftCD = dgvData.Rows[dgvData.CurrentCell.RowIndex].Cells[4].Value.ToString();
string sGiftType = dgvData.Rows[dgvData.CurrentCell.RowIndex].Cells[13].Value.ToString();
string sApprNo = dgvData.Rows[dgvData.CurrentCell.RowIndex].Cells[5].Value.ToString(); // 승인번호
string sApprDate = dgvData.Rows[dgvData.CurrentCell.RowIndex].Cells[6].Value.ToString(); // 승인일자
string sApprTime = dgvData.Rows[dgvData.CurrentCell.RowIndex].Cells[7].Value.ToString(); // 승인시간
sRet = m_cGift.CancelPayment(new string[] { sGiftCD, sGiftType, sApprNo, sApprDate, sApprTime });
if (sRet != UserCom.RST_ERR) dgvData.Rows.RemoveAt(dgvData.CurrentCell.RowIndex);
// ---------------------------------------------------------------------------------------------------------------------------------------
for (int iRow = 0; iRow < dgvData.RowCount; iRow++)
{
dgvData.Rows[iRow].HeaderCell.Value = (iRow + 1).ToString();
dgvData.Rows[iRow].Cells[0].Value = (iRow + 1).ToString(); // No
}
}
else if (iWorkMode == 3)
{
// 잔액교환권 가능 상품의 계
double nSumAmount = 0;
for (int iLoop = 0; iLoop < dgvData.RowCount; iLoop++)
{
// 잔액교환권 가능 여부 체크
//if (dgvGift.Rows[iLoop].Cells[5].Value.ToString() != "1") continue;
if (dgvData.Rows[iLoop].Cells[14].Value.ToString().Trim() == MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0585)) continue;
//long nQty = m_cDataService.LongParse(dgvData.Rows[iLoop].Cells[3].Value.ToString());
//double nAmount = m_cDataService.DoubleParse(dgvData.Rows[iLoop].Cells[2].Value.ToString());
//nSumAmount += CmUtil.DoubleMultiplication(nAmount, nQty);
nSumAmount = CmUtil.DoubleAdd(nSumAmount, m_cDataService.DoubleParse(dgvData.Rows[iLoop].Cells[2].Value.ToString()));
}
return nSumAmount;
}
else if (iWorkMode == 4)
{
// 계 조회
double nSumAmount = 0;
for (int iLoop = 0; iLoop < dgvData.RowCount; iLoop++)
{
if (dgvData.Rows[iLoop].Cells[14].Value.ToString().Trim() == MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0585)) continue;
//long nQty = m_cDataService.LongParse(dgvData.Rows[iLoop].Cells[3].Value.ToString());
//double nAmount = m_cDataService.DoubleParse(dgvData.Rows[iLoop].Cells[2].Value.ToString());
//nSumAmount += CmUtil.DoubleMultiplication(nAmount, nQty);
nSumAmount = CmUtil.DoubleAdd(nSumAmount, m_cDataService.DoubleParse(dgvData.Rows[iLoop].Cells[2].Value.ToString()));
}
return nSumAmount;
}
dgvData.Refresh();
txtCardNo.Text = "";
txtCardNM.Text = "";
txtAmount.Text = "0";
txtQty.Text = "0";
txtSaleAmt.Text = m_cPosStatus.Global.NumericTOCurrency(DataGridSetting(4)); // 계
return 0;
}
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 0;
}
#endregion
}
}