spc-kiosk-pb/Service/BsvPayment/VipLounge.cs
2019-06-16 14:12:09 +09:00

236 lines
9.0 KiB
C#

using System;
using System.Collections;
using System.Linq;
using System.Text;
using Cosmos.UserFrame;
using Cosmos.ServiceProvider;
using Cosmos.Common;
using Cosmos.CommonManager;
namespace Cosmos.Service
{
class VipLounge : IPaymentUs
{
#region
private SManager sManager = new SManager();
private StateServer StateObject = (StateServer)StateServer.GetInstance();
private PosStatus m_cPosStatus = new PosStatus();
private TranStatus m_cTrnStatus = new TranStatus();
private IDataProcessUs m_cDataSrv = null;
private IDataCommonUs m_cDataCommon = null;
#endregion
#region
public VipLounge()
{
m_cPosStatus = (PosStatus)StateObject.POS;
m_cTrnStatus = (TranStatus)StateObject.TRAN;
m_cDataSrv = (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);
}
#endregion
#region
/// <summary>
/// 결제 조회
/// </summary>
/// <param name="aParam"></param>
/// <param name="aRet"></param>
/// <returns></returns>
public string SearchPayment(string[] aParam, ref string[] aRet)
{
return UserCom.RST_ERR;
}
#endregion
#region
/// <summary>
/// 결제 정보 획득
/// </summary>
/// <param name="aParam"></param>
/// <returns></returns>
public object GetPayment(string[] aParam)
{
try
{
//return m_cPayItem;
}
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 null;
}
#endregion
#region
/// <summary>
/// 결제 등록
/// </summary>
/// <param name="aParam"></param>
/// <returns></returns>
public string SetPayment(string[] aParam)
{
string sRet = UserCom.RST_ERR;
string sCashRecvAmt = aParam[0]; // 현금(0)
string sCashKind = aParam[1]; // 현금(0) 메뉴키
if (m_cTrnStatus.Sale.RemainPayAmt == 0 && CmUtil.DoubleParse(sCashRecvAmt) > 0)
{
if (WinManager.QuestionMessage(POS_MESSAGE.ERROR.MSG_0516) == false) //받을 금액이 없습니다. 0원으로 결제 하시겠습니까?
{
return sRet;
}
else
{
sCashRecvAmt = "0";
}
}
if (sCashRecvAmt.Length > 10)
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0035); // 입력한 금액이 너무 큰 금액 입니다.
return sRet;
}
if (CmUtil.DoubleParse(sCashRecvAmt) == 0 && m_cTrnStatus.Sale.RemainPayAmt > 0)
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0036); // 입력한 금액은 입력 불가 단위 입니다.
return sRet;
}
if (CmUtil.AmountCut(CmUtil.DoubleParse(sCashRecvAmt), CmUtil.IntParse(m_cPosStatus.Mst.PayRudDwLoc)) != CmUtil.DoubleParse(sCashRecvAmt))
{
WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0036); // 입력한 금액은 입력 불가 단위 입니다.
return sRet;
}
var aPayItem = (ArrayList)StateObject.GetItemObject(Column.TR_PAYMENT.ITEM);
var m_cPayItem = new Column.TR_PAYMENT.DATA();
double nCashRecvAmt = CmUtil.DoubleParse(sCashRecvAmt); // 현금받은금액
double nCashPayAmt = nCashRecvAmt; // 현금결제금액
double nChangeAmt = 0; // 현금거스름금액
// 받은금액이 받을금액 보다 큰경우 거스름돈 설정 처리
if (nCashRecvAmt > m_cTrnStatus.Sale.RemainPayAmt)
{
nCashPayAmt = m_cTrnStatus.Sale.RemainPayAmt;
nChangeAmt = CmUtil.DoubleSubtraction(nCashRecvAmt, m_cTrnStatus.Sale.RemainPayAmt);
}
m_cPayItem.PAY_WAY_CD = ItemConst.TR_ITEM_ID.PAYETC_ITEM; //현금 결제 그룹 코드
m_cPayItem.PAY_DTL_CD_01 = ItemConst.TR_ITEM_ID.PAYETC.VIP_LOUNGE; //현금 결제 코드
//m_cPayItem.OCCUR_ENTRY_20 = MessageManager.GetLabelMessage(POS_MESSAGE.LABEL.MSG_0059);
m_cPayItem.OCCUR_ENTRY_20 = "VIP라운지";
m_cPayItem.BILLSPR_NO = m_cTrnStatus.Sale.BillSplitNo; // 빌분리 번호
m_cPayItem.OCCUR_ENTRY_21 = ItemConst.PAY_CASHBILL_DIV.YES;
m_cPayItem.PAY_AMT = nCashPayAmt; //결제 금액
m_cPayItem.AMT_ENTRY_01 = nCashRecvAmt; //받은돈
m_cPayItem.AMT_ENTRY_02 = nChangeAmt; //거스름
m_cPayItem.PAY_DTL_CD_05 = PosConst.PAY_DC_TYPE.PAY;
m_cPayItem.SEQ = aPayItem.Count + 1;
m_cPayItem.CANCEL_DIV = PosConst.CANCEL_DIV.NORMAL;
aPayItem.Add(m_cPayItem);
m_cPosStatus.Sale.ChangeCashAmt = nChangeAmt; //현금거스름
// 결제 금액 재 계산 처리
m_cDataSrv.UpdatePayAmount();
sRet = UserCom.RST_OK;
return sRet;
}
#endregion
#region
/// <summary>
/// 결제 취소
/// </summary>
/// <param name="aParam"></param>
/// <returns></returns>
public string CancelPayment(string[] aParam)
{
string sRet = UserCom.RST_ERR;
try
{
int nPayRow = CmUtil.IntParse(aParam[0]); // 취소할 행번호
// 결제 내역 받아 오기
ArrayList alPayItem = (ArrayList)StateObject.GetItemObject(Column.TR_PAYMENT.ITEM);
Column.TR_PAYMENT.DATA cPayItem = (Column.TR_PAYMENT.DATA)alPayItem[nPayRow];
cPayItem.CANCEL_DIV = PosConst.CANCEL_DIV.CANCEL;
//#20170830 거스름돈 발생시 결제취소 해도 거스름돈(AMT_ENTRY_02)이 취소가 안되어 계산함 start
//현금, 잔액교환권, 외화, 상품권, 식권
m_cPosStatus.Sale.ChangeCashAmt = CmUtil.DoubleSubtraction(m_cPosStatus.Sale.ChangeCashAmt, cPayItem.AMT_ENTRY_02);
//cPayItem.AMT_ENTRY_01 = 0;
//cPayItem.AMT_ENTRY_02 = 0;
//#20170830 거스름돈 발생시 결제취소 해도 거스름돈(AMT_ENTRY_02)이 취소가 안되어 계산함 end
// 결제 금액 재 계산 처리
m_cDataSrv.UpdateTranAmount();
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
/// <summary>
/// 결제 반품
/// </summary>
/// <param name="aParam"></param>
/// <returns></returns>
public string RefundPayment(string[] aParam)
{
string sRet = UserCom.RST_ERR;
try
{
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
public string SetMenualPayment(string[] aParam)
{
string sRet = UserCom.RST_ERR;
try
{
//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;
}
}
}