using System;
using System.Collections;
using System.Text;
using Cosmos.UserFrame;
using Cosmos.ServiceProvider;
using Cosmos.Common;
using Cosmos.CommonManager;
using System.Data;
using Newtonsoft.Json;
/*-----------------------------------------------------------------------------------------------*/
// 설 명 : 식권
// 작 성 자 :
// 변경 이력 :
/*-----------------------------------------------------------------------------------------------*/
namespace Cosmos.Service
{
class MealTicket : PaymentBase, IPaymentUs
{
public MealTicket()
{
}
#region SearchPayment 결제 조회
///
/// 결제 조회
///
///
///
///
public string SearchPayment(string[] aParam, ref string[] aRet)
{
string sRet = UserCom.RST_ERR;
try
{
m_cPayItem = new Column.TR_PAYMENT.DATA(); // 결과 저장 변수 생성
string sPosMenuKey = aParam[0]; // 메뉴키
m_cPayItem.PAY_WAY_CD = aParam[1]; // 결제 그룹코드
m_cPayItem.PAY_DTL_CD_01 = aParam[2]; // 결제 상세코드
string siSsueType = aParam[3]; // 발행 구분 (00:발행 ,01.발행취소 02.조회 03:사용 , 04:사용 취소)
string sExchangeTicketNo = aParam[4]; // 잔액교환권 번호
double nExchangeTicketAmt = CmUtil.DoubleParse(aParam[5]); // 잔액교환권 금액
sRet = ExecuteHostIrt(PosConst.CANCEL_DIV.NORMAL, sExchangeTicketNo, siSsueType, nExchangeTicketAmt);
if (sRet != UserCom.RST_OK) return 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 GetPayment 결제 정보 획득
///
/// 결제 정보 획득
///
///
///
public object GetPayment(string[] aParam)
{
return m_cPayItem;
}
#endregion
#region SetPayment 결제 등록
///
/// 결제 등록
///
///
///
public string SetPayment(string[] aParam)
{
string sRet = UserCom.RST_ERR;
try
{
m_cPayItem = new Column.TR_PAYMENT.DATA(); // 결과 저장 변수 생성
string sPosMenuKey = aParam[0]; // 메뉴키
m_cPayItem.PAY_WAY_CD = aParam[1]; // 결제 그룹코드
m_cPayItem.PAY_DTL_CD_01 = aParam[2]; // 결제 상세코드
m_cPayItem.CANCEL_DIV = ItemConst.PAY_CANCEL_DIV.NORMAL; // 취소여부
string sMealTicketCD = aParam[3]; // 식권코드
double sMealTicketQty = CmUtil.DoubleParse(aParam[4]); // 수량
double sMealTicketAmt = CmUtil.DoubleParse(aParam[5]); // 금액
string sMakeType = aParam[6]; // 잔액교환권 발행여부 (0:미발행,1:발행)
string sExchangeTicketNo = aParam[7]; // 잔액교환권 번호
double nExchangeTicketAmt = CmUtil.DoubleParse(aParam[8]); // 잔액교환권 금액
string sMakeID = aParam[9]; // 잔액교환권 발생구분 (1:식권,2:상품권,3:잔액교환권)
string sChangeMoney = aParam[10]; // 거스름
string sChangePayYn = aParam[11]; // 거스름 가능 여부
string sMealTicketNM = aParam[12]; // 식권명
string sMNDTRY_INPUT_YN = aParam[13]; // 번호필수여부
string sMealTicketDiv = aParam[14]; // 식권권종
sRet = ExecuteIrt(sMealTicketCD, sMealTicketQty, sMealTicketAmt, sExchangeTicketNo, sMakeType, nExchangeTicketAmt, sMakeID, sChangeMoney, sChangePayYn, sMealTicketNM, sMNDTRY_INPUT_YN, sMealTicketDiv);
if (sRet != UserCom.RST_OK) return sRet;
if (sChangePayYn == "1" && CmUtil.DoubleParse(sChangeMoney) > 0)
m_cPosStatus.Sale.ChangeCashAmt = CmUtil.DoubleParse(sChangeMoney); // 거스름
// 결제 아이템 추가
ArrayList alPayItem = (ArrayList)StateObject.GetItemObject(Column.TR_PAYMENT.ITEM); // 결제 내역 받아 오기
m_cPayItem.SEQ = alPayItem.Count + 1;
alPayItem.Add(m_cPayItem);
m_cDataService.UpdatePluAmount(); // 상품 합계금액 계산(거래해더)
m_cDataService.UpdatePayAmount(); // 결제 금액 재 계산 처리
sRet = UserCom.RST_OK;
//WinManager.ConfirmMessage(sPointType + " " + MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0067));
}
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 결제 취소
///
/// 결제 취소
///
///
public string CancelPayment(string[] aParam)
{
string sRet = UserCom.RST_ERR;
try
{
// ---------------------------------------------------------------------------------------------------------------------------------------
// 결제 수단 취소
// ---------------------------------------------------------------------------------------------------------------------------------------
ArrayList alPayItem = (ArrayList)StateObject.GetItemObject(Column.TR_PAYMENT.ITEM);
for (int iRow = 0; iRow < alPayItem.Count; iRow++)
{
Column.TR_PAYMENT.DATA clPayItem = (Column.TR_PAYMENT.DATA)alPayItem[iRow];
// 취소구분
if (clPayItem.CANCEL_DIV == ItemConst.PAY_CANCEL_DIV.CANCEL) continue;
// 기타결제
if (clPayItem.PAY_WAY_CD != ItemConst.TR_ITEM_ID.PAYETC_ITEM) continue;
// 식권/ 잔액교환권
if (clPayItem.PAY_DTL_CD_01 != ItemConst.TR_ITEM_ID.PAYETC.MEAL_TIKET && clPayItem.PAY_DTL_CD_01 != ItemConst.TR_ITEM_ID.PAYETC.BALANCE_VOUCHER) continue;
// 결제 수단 취소
sRet = CancelPaymentSub(new string[] { iRow.ToString() });
if (sRet != UserCom.RST_OK) return sRet;
}
// ---------------------------------------------------------------------------------------------------------------------------------------
m_cDataService.UpdatePluAmount(); // 상품 합계금액 계산(거래해더)
m_cDataService.UpdatePayAmount(); // 결제 금액 재 계산 처리
sRet = UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return sRet;
}
#endregion
#region 결제 반품
///
/// 결제 반품
///
///
public string RefundPayment(string[] aParam)
{
string sRet = UserCom.RST_ERR;
try
{
//// ---------------------------------------------------------------------------------------------------------------------------------------
//// 결제 수단 반품
//// ---------------------------------------------------------------------------------------------------------------------------------------
//ArrayList alPayItem = (ArrayList)StateObject.GetItemObject(Column.TR_PAYMENT.ITEM);
//for (int iRow = 0; iRow < alPayItem.Count; iRow++)
//{
// Column.TR_PAYMENT.DATA clPayItem = (Column.TR_PAYMENT.DATA)alPayItem[iRow];
// // 취소구분
// if (clPayItem.CANCEL_DIV == ItemConst.PAY_CANCEL_DIV.CANCEL) continue;
// // 기타결제
// if (clPayItem.PAY_WAY_CD != ItemConst.TR_ITEM_ID.PAYETC_ITEM) continue;
// // 식권/ 잔액교환권
// if (clPayItem.PAY_DTL_CD_01 != ItemConst.TR_ITEM_ID.PAYETC.MEAL_TIKET && clPayItem.PAY_DTL_CD_01 != ItemConst.TR_ITEM_ID.PAYETC.BALANCE_VOUCHER) continue;
// 결제 수단 반품
sRet = RefundPaymentSub(new string[] { aParam[0].ToString() });
if (sRet != UserCom.RST_OK) return sRet;
//}
// ---------------------------------------------------------------------------------------------------------------------------------------
sRet = UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return sRet;
}
#endregion
#region RefundPaymentSub 결제 반품
///
/// 결제 반품
///
///
///
public string RefundPaymentSub(string[] aParam)
{
string sRet = UserCom.RST_ERR;
try
{
int nPayRow = CmUtil.IntParse(aParam[0]); // 취소할 행번호
// 결제 내역 받아 오기
ArrayList alPayItem = (ArrayList)StateObject.GetItemObject(Column.TR_PAYMENT.ITEM);
m_cPayItem = (Column.TR_PAYMENT.DATA)alPayItem[nPayRow];
if (m_cPayItem.OCCUR_ENTRY_08.ToString() != ItemConst.PAY_APP_DIV.NORMAL)
{
//임의 등록 이면 승인 없이 데이터 처리
//WinManager.ConfirmMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0240));
m_cPayItem.OCCUR_ENTRY_06 = m_cPayItem.OCCUR_ENTRY_02;
m_cPayItem.OCCUR_ENTRY_07 = m_cPayItem.OCCUR_ENTRY_03;
sRet = UserCom.RST_OK;
}
else
{
string sMealTicketCD = m_cPayItem.OCCUR_ENTRY_01; // 식권번호
double nMealTicketQty = m_cPayItem.QTY_ENTRY_01; // 수량
double nMealTicketAmt = m_cPayItem.AMT_ENTRY_01; // 대상금액
string sMakeType = m_cPayItem.OCCUR_ENTRY_10; // 잔액교환권 발행여부 (0:미발행,1:발행)
string sExchangeTicketNo = m_cPayItem.OCCUR_ENTRY_12; // 잔액교환권 번호
double nExchangeTicketAmt = m_cPayItem.AMT_ENTRY_03; // 잔액교환권 금액
string sMakeID = m_cPayItem.OCCUR_ENTRY_11; // 잔액교환권 발생구분 (1:식권,2:상품권,3:잔액교환권)
string sChangeMoney = m_cPayItem.AMT_ENTRY_02.ToString(); // 거스름
string sChangePayYn = m_cPayItem.OCCUR_ENTRY_09; // 거스름 가능 여부
string nExchangeTicketNM = m_cPayItem.OCCUR_ENTRY_19; // 식권명
string sMNDTRY_INPUT_YN = m_cPayItem.OCCUR_ENTRY_17; // 번호필수여부
string sMealTicketDiv = m_cPayItem.OCCUR_ENTRY_18; // 식권권종
// 잔액교환권 번호가 있을 경우 발행취소 요청
if (sExchangeTicketNo.Trim().Length > 0)
{
string siSsueType = ItemConst.EXCHANGE_TICKET_ISSUE_TYPE.MAKE_CANCEL;
// 발행취소
sRet = ExecuteHostIrt(PosConst.CANCEL_DIV.CANCEL_SUBTOT, sExchangeTicketNo, siSsueType, nExchangeTicketAmt);
if (sRet != UserCom.RST_OK) return sRet;
}
sRet = ExecuteIrt(sMealTicketCD, nMealTicketQty, nMealTicketAmt, sExchangeTicketNo, sMakeType, nExchangeTicketAmt, sMakeID, sChangeMoney, sChangePayYn, nExchangeTicketNM, sMNDTRY_INPUT_YN, sMealTicketDiv);
}
}
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 SetMenualPayment
public string SetMenualPayment(string[] aParam)
{
throw new NotImplementedException();
}
#endregion
#region CancelPaymentSub 결제 취소
///
/// 결제 취소
///
///
///
public string CancelPaymentSub(string[] aParam)
{
string sRet = UserCom.RST_ERR;
try
{
if (m_cTrnStatus.Head.TradeDiv != ItemConst.TRAN_DIV.NORMAL) return sRet;
int nPayRow = CmUtil.IntParse(aParam[0]); // 취소할 행번호
// 결제 내역 받아 오기
ArrayList alPayItem = (ArrayList)StateObject.GetItemObject(Column.TR_PAYMENT.ITEM);
m_cPayItem = (Column.TR_PAYMENT.DATA)alPayItem[nPayRow];
string sMealTicketCD = m_cPayItem.OCCUR_ENTRY_01; // 식권번호
double nMealTicketQty = m_cPayItem.QTY_ENTRY_01; // 수량
double nMealTicketAmt = m_cPayItem.AMT_ENTRY_01; // 대상금액
string sMakeType = m_cPayItem.OCCUR_ENTRY_10; // 잔액교환권 발행여부 (0:미발행,1:발행)
string sExchangeTicketNo = m_cPayItem.OCCUR_ENTRY_12; // 잔액교환권 번호
double nExchangeTicketAmt = m_cPayItem.AMT_ENTRY_03; // 잔액교환권 금액
string sMakeID = m_cPayItem.OCCUR_ENTRY_11; // 잔액교환권 발생구분 (1:식권,2:상품권,3:잔액교환권)
string sChangeMoney = m_cPayItem.AMT_ENTRY_02.ToString(); // 거스름
string sChangePayYn = m_cPayItem.OCCUR_ENTRY_09; // 거스름 가능 여부
string nExchangeTicketNM = m_cPayItem.OCCUR_ENTRY_19; // 식권명
string sMNDTRY_INPUT_YN = m_cPayItem.OCCUR_ENTRY_17; // 번호필수여부
string sMealTicketDiv = m_cPayItem.OCCUR_ENTRY_18; // 식권권종
// 잔액교환권 번호가 있을 경우 발행취소 요청
if (sExchangeTicketNo.Trim().Length > 0)
{
string siSsueType = ItemConst.EXCHANGE_TICKET_ISSUE_TYPE.MAKE_CANCEL;
// 발행취소
sRet = ExecuteHostIrt(PosConst.CANCEL_DIV.CANCEL, sExchangeTicketNo, siSsueType, nExchangeTicketAmt);
if (sRet != UserCom.RST_OK) return sRet;
}
sRet = ExecuteIrt(sMealTicketCD, nMealTicketQty, nMealTicketAmt, sExchangeTicketNo, sMakeType, nExchangeTicketAmt, sMakeID, sChangeMoney, sChangePayYn, nExchangeTicketNM, sMNDTRY_INPUT_YN, sMealTicketDiv);
if (sRet != UserCom.RST_OK) return sRet;
m_cPayItem.CANCEL_DIV = PosConst.CANCEL_DIV.CANCEL;
//#20170830 거스름돈 발생시 결제취소 해도 거스름돈(AMT_ENTRY_02)이 취소가 안되어 계산함 start
//현금, 잔액교환권, 외화, 상품권, 식권
m_cPosStatus.Sale.ChangeCashAmt = CmUtil.DoubleSubtraction(m_cPosStatus.Sale.ChangeCashAmt, m_cPayItem.AMT_ENTRY_02);
//m_cPayItem.AMT_ENTRY_01 = 0;
//m_cPayItem.AMT_ENTRY_02 = 0;
//#20170830 거스름돈 발생시 결제취소 해도 거스름돈(AMT_ENTRY_02)이 취소가 안되어 계산함 end
sRet = UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return sRet;
}
#endregion
#region 조회 실행
///
/// 조회 실행
///
public string ExecuteIrt(string sMealTicketCD, double nMealTicketQty, double nMealTicketAmt, string sExchangeTicketNo, string sMakeType, double nExchangeTicketAmt, string sMakeID, string sChangeMoney, string sChangePayYn, string sMealTicketNM, string sMNDTRY_INPUT_YN, string sMealTicketDiv)
{
string sRet = UserCom.RST_ERR;
try
{
// 연습모드이면 연습 데이터 설정
if (m_cPosStatus.Base.TrainingFlag == "1" || m_cPosStatus.Mst.TestStorYn == "1") return SetTrainingData(sMealTicketCD, nMealTicketQty, nMealTicketAmt, sExchangeTicketNo, sMakeType, nExchangeTicketAmt, sMakeID, sChangeMoney, sChangePayYn, sMealTicketNM, sMNDTRY_INPUT_YN, sMealTicketDiv);
// 결제구분 (1:결제, 2:할인)
DataRow dr = PosMstManager.GetMstPayDc(new string[] { m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01 });
m_cPayItem.PAY_AMT = CmUtil.DoubleParse(nMealTicketAmt.ToString());
m_cPayItem.PAY_AMT = CmUtil.DoubleSubtraction(m_cPayItem.PAY_AMT, nExchangeTicketAmt);
m_cPayItem.PAY_AMT = CmUtil.DoubleSubtraction(m_cPayItem.PAY_AMT, CmUtil.DoubleParse(sChangeMoney.ToString()));
m_cPayItem.PAY_DTL_CD_02 = ""; // 캠페인코드
m_cPayItem.PAY_DTL_CD_03 = "0"; // 할인금액 아이템 적용 여부 (0:미적용, 1:적용)
m_cPayItem.PAY_DTL_CD_04 = ""; // 상품코드
m_cPayItem.PAY_DTL_CD_05 = PosConst.PAY_DC_TYPE.PAY; // 할인결제구분 (1:결제, 2:할인)
m_cPayItem.QTY_ENTRY_01 = nMealTicketQty; // 받을금액
m_cPayItem.QTY_ENTRY_02 = 0;
m_cPayItem.QTY_ENTRY_03 = 0;
m_cPayItem.QTY_ENTRY_04 = 0;
m_cPayItem.QTY_ENTRY_05 = 0;
if (sChangePayYn == "1")
{
// 거스름 가능인 경우
m_cPayItem.AMT_ENTRY_01 = CmUtil.DoubleParse(nMealTicketAmt.ToString()); // 받은돈
m_cPayItem.AMT_ENTRY_02 = CmUtil.DoubleParse(sChangeMoney); // 거스름
m_cPayItem.AMT_ENTRY_05 = 0;
}
else
{
// 거스름 불가인 경우 받은금액은 결제금액으로 한다.
m_cPayItem.AMT_ENTRY_01 = m_cPayItem.PAY_AMT;
m_cPayItem.AMT_ENTRY_02 = 0;
m_cPayItem.AMT_ENTRY_05 = CmUtil.DoubleParse(nMealTicketAmt.ToString()); ; // 권종금액
}
//m_cPayItem.AMT_ENTRY_01 = m_cPayItem.PAY_AMT; // 받은돈
m_cPayItem.AMT_ENTRY_03 = nExchangeTicketAmt; // 잔액교환권 금액
m_cPayItem.AMT_ENTRY_04 = 0;
m_cPayItem.AMT_ENTRY_08 = 0;
m_cPayItem.AMT_ENTRY_09 = 0;
m_cPayItem.AMT_ENTRY_10 = 0;
m_cPayItem.OCCUR_ENTRY_01 = sMealTicketCD; // 카드번호
m_cPayItem.OCCUR_ENTRY_02 = ""; // 승인번호
m_cPayItem.OCCUR_ENTRY_03 = ""; // 승인일자
m_cPayItem.OCCUR_ENTRY_04 = ""; // 승인시간
m_cPayItem.OCCUR_ENTRY_05 = ""; // 입력 구분
m_cPayItem.OCCUR_ENTRY_06 = ""; // 원승인번호
m_cPayItem.OCCUR_ENTRY_07 = ""; // 원승인일자
m_cPayItem.OCCUR_ENTRY_08 = ItemConst.PAY_APP_DIV.NORMAL; // 승인구분
m_cPayItem.OCCUR_ENTRY_09 = sChangePayYn; // 거스름 가능 여부
m_cPayItem.OCCUR_ENTRY_10 = (sExchangeTicketNo.Trim() != "") ? "1" : "0"; // 잔액교환권 발행여부
m_cPayItem.OCCUR_ENTRY_11 = sMakeID; // 잔액교환권 발생구분
m_cPayItem.OCCUR_ENTRY_12 = sExchangeTicketNo; // 잔액교환권 번호
m_cPayItem.OCCUR_ENTRY_16 = CmUtil.GetDataRowStr(dr, PosMst.MST_PAY_DC.DATA.APPR_VEND_CD); // VAN 구분
m_cPayItem.OCCUR_ENTRY_17 = sMNDTRY_INPUT_YN; // 번호필수여부
m_cPayItem.OCCUR_ENTRY_18 = sMealTicketDiv; // 식권권종
m_cPayItem.OCCUR_ENTRY_19 = sMealTicketNM; // 식권명
m_cPayItem.OCCUR_ENTRY_20 = GetPayDtlCdToPayDtlName(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01); // 결제수단명
m_cPayItem.OCCUR_ENTRY_21 = CmUtil.GetDataRowStr(dr, PosMst.MST_PAY_DC.DATA.CASH_BILL_ISSUE_YN); // 현금영수증 발행여부
m_cPayItem.OCCUR_ENTRY_22 = "";
m_cPayItem.BILLSPR_NO = m_cTrnStatus.Sale.BillSplitNo; // 빌분리 번호
sRet = UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return sRet;
}
///
/// 연습 데이터 설정
///
public string SetTrainingData(string sMealTicketCD, double nMealTicketQty, double nMealTicketAmt, string sExchangeTicketNo, string sMakeType, double nExchangeTicketAmt, string sMakeID, string sChangeMoney, string sChangePayYn, string sMealTicketNM, string sMNDTRY_INPUT_YN, string sMealTicketDiv)
{
string sRet = UserCom.RST_ERR;
try
{
// 연습모드이면 연습 데이터 설정
// 결제구분 (1:결제, 2:할인)
DataRow dr = PosMstManager.GetMstPayDc(new string[] { m_cPosStatus.Base.CmpCd, m_cPosStatus.Base.StoreNo, m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01 });
m_cPayItem.PAY_AMT = CmUtil.DoubleParse(nMealTicketAmt.ToString());
m_cPayItem.PAY_AMT = CmUtil.DoubleSubtraction(m_cPayItem.PAY_AMT, nExchangeTicketAmt);
m_cPayItem.PAY_AMT = CmUtil.DoubleSubtraction(m_cPayItem.PAY_AMT, CmUtil.DoubleParse(sChangeMoney.ToString()));
m_cPayItem.PAY_DTL_CD_02 = ""; // 캠페인코드
m_cPayItem.PAY_DTL_CD_03 = "1"; // 할인금액 아이템 적용 여부 (0:미적용, 1:적용)
m_cPayItem.PAY_DTL_CD_04 = ""; // 상품코드
m_cPayItem.PAY_DTL_CD_05 = PosConst.PAY_DC_TYPE.PAY; // 할인결제구분 (1:결제, 2:할인)
m_cPayItem.QTY_ENTRY_01 = nMealTicketQty; // 수량
m_cPayItem.QTY_ENTRY_02 = 0;
m_cPayItem.QTY_ENTRY_03 = 0;
m_cPayItem.QTY_ENTRY_04 = 0;
if (sChangePayYn == "1")
{
// 거스름 가능인 경우
m_cPayItem.AMT_ENTRY_01 = CmUtil.DoubleParse(nMealTicketAmt.ToString()); // 받은돈
m_cPayItem.AMT_ENTRY_02 = CmUtil.DoubleParse(sChangeMoney); // 거스름
m_cPayItem.AMT_ENTRY_05 = 0;
}
else
{
// 거스름 불가인 경우 받은금액은 결제금액으로 한다.
m_cPayItem.AMT_ENTRY_01 = m_cPayItem.PAY_AMT;
m_cPayItem.AMT_ENTRY_02 = 0;
m_cPayItem.AMT_ENTRY_05 = CmUtil.DoubleParse(nMealTicketAmt.ToString()); ; // 권종금액
}
//m_cPayItem.AMT_ENTRY_01 = m_cPayItem.PAY_AMT; // 받은돈
m_cPayItem.AMT_ENTRY_03 = nExchangeTicketAmt; // 잔액교환권 금액
m_cPayItem.AMT_ENTRY_04 = 0;
m_cPayItem.AMT_ENTRY_08 = 0;
m_cPayItem.AMT_ENTRY_09 = 0;
m_cPayItem.AMT_ENTRY_10 = 0;
m_cPayItem.OCCUR_ENTRY_01 = sMealTicketCD; // 카드번호
m_cPayItem.OCCUR_ENTRY_02 = ""; // 승인번호
m_cPayItem.OCCUR_ENTRY_03 = ""; // 승인일자
m_cPayItem.OCCUR_ENTRY_04 = ""; // 승인시간
m_cPayItem.OCCUR_ENTRY_05 = ""; // 입력 구분
m_cPayItem.OCCUR_ENTRY_06 = ""; // 원승인번호
m_cPayItem.OCCUR_ENTRY_07 = ""; // 원승인일자
m_cPayItem.OCCUR_ENTRY_08 = ItemConst.PAY_APP_DIV.COMPULSION; // 승인구분
m_cPayItem.OCCUR_ENTRY_09 = sChangePayYn; // 거스름 가능 여부
m_cPayItem.OCCUR_ENTRY_10 = "0"; // 잔액교환권 발행여부
m_cPayItem.OCCUR_ENTRY_11 = ""; // 잔액교환권 발생구분
m_cPayItem.OCCUR_ENTRY_12 = ""; // 잔액교환권 번호
m_cPayItem.OCCUR_ENTRY_16 = CmUtil.GetDataRowStr(dr, PosMst.MST_PAY_DC.DATA.APPR_VEND_CD); // VAN 구분
m_cPayItem.OCCUR_ENTRY_17 = sMNDTRY_INPUT_YN; // 번호필수여부
m_cPayItem.OCCUR_ENTRY_18 = sMealTicketDiv; // 식권권종
m_cPayItem.OCCUR_ENTRY_19 = sMealTicketNM; // 식권명
m_cPayItem.OCCUR_ENTRY_20 = GetPayDtlCdToPayDtlName(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01); // 결제수단명
m_cPayItem.OCCUR_ENTRY_21 = CmUtil.GetDataRowStr(dr, PosMst.MST_PAY_DC.DATA.CASH_BILL_ISSUE_YN); // 현금영수증 발행여부
m_cPayItem.OCCUR_ENTRY_22 = "";
m_cPayItem.CANCEL_DIV = ItemConst.PAY_CANCEL_DIV.NORMAL; // 취소여부
m_cPayItem.BILLSPR_NO = m_cTrnStatus.Sale.BillSplitNo; // 빌분리 번호
sRet = UserCom.RST_OK;
}
catch (Exception ex)
{
WinManager.ExceptionMessage(System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name,
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()", ex.Message);
}
return sRet;
}
#endregion
#region Host 조회 실행
///
/// Host 조회 실행
///
public string ExecuteHostIrt(string sTradeDiv, string sExchangeTicketNo, string siSsueType, double nExchangeTicketAmt)
{
int iRecvTimeOut = 10000;
string sRet = UserCom.RST_ERR;
try
{
if (m_cPayItem.PAY_WAY_CD != ItemConst.TR_ITEM_ID.PAYETC_ITEM ) return null;
Hashtable htSendData = new Hashtable();
Hashtable htRecvData = new Hashtable();
htSendData.Add(Column.IQ_EXCHAGE_TICKET_REQ.DATA.INQ_TYPE, ItemConst.IRT_INQ_TYPE.EXCHANGE_TICKET_INQ);
htSendData.Add(Column.IQ_EXCHAGE_TICKET_REQ.DATA.STOR_CD, m_cPosStatus.Base.StoreNo);
htSendData.Add(Column.IQ_EXCHAGE_TICKET_REQ.DATA.SALE_DT, m_cPosStatus.Base.SaleDate);
htSendData.Add(Column.IQ_EXCHAGE_TICKET_REQ.DATA.POS_NO, m_cPosStatus.Base.PosNo);
htSendData.Add(Column.IQ_EXCHAGE_TICKET_REQ.DATA.ISSUE_TYPE, siSsueType);
htSendData.Add(Column.IQ_EXCHAGE_TICKET_REQ.DATA.TICKET_NO, sExchangeTicketNo);
htSendData.Add(Column.IQ_EXCHAGE_TICKET_REQ.DATA.TICKET_AMT, nExchangeTicketAmt);
htSendData.Add(Column.IQ_EXCHAGE_TICKET_REQ.DATA.USER_ID, m_cPosStatus.Base.CashierNo);
htSendData.Add(Column.IQ_EXCHAGE_TICKET_REQ.DATA.RES_CD, "");
htSendData.Add(Column.IQ_EXCHAGE_TICKET_REQ.DATA.RES_MSG, "");
// 요청 - 승인로그 저장 (판매구분, [0]결제수단, [1]결제상세코드, [2]전문구분, [3]요청구분, [4]카드번호, [5]결제금액, [6]승인번호, [7]승인일자, [8]승인시간, [9]응답상태값, [10]응답메시지, [11]전문)
m_cDataCommon.SetSaleApprLog(sTradeDiv, new string[] { m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01, htSendData[Column.IQ_EXCHAGE_TICKET_REQ.DATA.INQ_TYPE].ToString(), "S", sExchangeTicketNo, nExchangeTicketAmt.ToString(), "", "", "", "", "", JsonConvert.SerializeObject(htSendData) });
sRet = m_cDataCommon.ExecutePosIrt(ItemConst.COMM_MSG_TYPE.POSIRT, m_cPosStatus.Base.CommSvrIp, (int)m_cPosStatus.Base.PayInqPort, iRecvTimeOut, htSendData, ref htRecvData);
if (sRet != UserCom.RST_OK)
{
WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0187));
sRet = UserCom.RST_ERR;
return sRet;
}
// 응답 - 승인로그 저장 (판매구분, [0]결제수단, [1]결제상세코드, [2]전문구분, [3]요청구분, [4]카드번호, [5]결제금액, [6]승인번호, [7]승인일자, [8]승인시간, [9]응답상태값, [10]응답메시지, [11]전문)
m_cDataCommon.SetSaleApprLog(sTradeDiv, new string[] { m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01, htSendData[Column.IQ_EXCHAGE_TICKET_REQ.DATA.INQ_TYPE].ToString(), "R"
, sExchangeTicketNo, nExchangeTicketAmt.ToString()
, "", CmUtil.MidH(htRecvData[Column.IQ_EXCHAGE_TICKET_RSP.DATA.SALE_DT].ToString(), 0, 8), DateTime.Now.ToString("HHmmss")
, htRecvData[Column.IQ_EXCHAGE_TICKET_RSP.DATA.RES_CD].ToString()
, htRecvData[Column.IQ_EXCHAGE_TICKET_RSP.DATA.RES_MSG].ToString()
, JsonConvert.SerializeObject(htRecvData) });
if (htRecvData[Column.IQ_EXCHAGE_TICKET_RSP.DATA.RES_CD].ToString() != "00")
{
WinManager.ErrorMessage(MessageManager.GetErrorMessage(POS_MESSAGE.ERROR.MSG_0187) + " (" + htRecvData[Column.IQ_EXCHAGE_TICKET_RSP.DATA.RES_CD].ToString() + ")" + "\n\r" + htRecvData[Column.IQ_LOTTERY_NUMBERINQ_RSP.DATA.RES_MSG]);
sRet = UserCom.RST_ERR;
return sRet;
}
sRet = UserCom.RST_OK;
return 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
}
}