using System; using System.Collections; using System.Text; using Cosmos.UserFrame; using Cosmos.ServiceProvider; using Cosmos.Common; using Cosmos.CommonManager; using System.Data; /*-----------------------------------------------------------------------------------------------*/ // 설 명 : 결제할인 마스터 참고한 결제 할인 처리(카이스트할인, 해피오더사전예약할인) // 작 성 자 : // 변경 이력 : /*-----------------------------------------------------------------------------------------------*/ namespace Cosmos.Service { class PayDcMstToDc : PaymentBase, IPaymentUs { public PayDcMstToDc() { } #region SearchPayment 결제 조회 /// /// 결제 조회 /// /// /// /// public string SearchPayment(string[] aParam, ref string[] aRet) { string sRet = UserCom.RST_ERR; 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 { string sPosMenuKey = aParam[0]; // 메뉴키 double nDestAmt = m_cDataService.GetPluTagetAmount(sPosMenuKey); if (nDestAmt == 0) { WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0050); return sRet; } m_cPayItem = new Column.TR_PAYMENT.DATA(); // 결과 저장 변수 생성 m_cPayItem.PAY_WAY_CD = GetMenuKeyToPayWayCd(sPosMenuKey); m_cPayItem.PAY_DTL_CD_01 = GetMenuKeyToPayDtlCd(sPosMenuKey); // 결제 할인 금액 계산 double nDisAmt = m_cDataCommon.ExecTermCoopCmpPayDc(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01, "", nDestAmt); if (nDisAmt == 0) { WinManager.ErrorMessage(POS_MESSAGE.ERROR.MSG_0601); return sRet; } // 결제구분 (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(nDisAmt.ToString()); m_cPayItem.PAY_DTL_CD_03 = "0"; // 할인금액아이템적용여부 (0:미적용, 1:적용) m_cPayItem.PAY_DTL_CD_05 = PosConst.PAY_DC_TYPE.PAY; // 할인결제구분 (1:결제, 2:할인) m_cPayItem.AMT_ENTRY_01 = CmUtil.DoubleParse(nDisAmt.ToString()); // 받은돈 if (PosMstManager.GetMstPayDc(m_cPayItem.PAY_WAY_CD, m_cPayItem.PAY_DTL_CD_01, PosMst.MST_PAY_DC.DATA.PAY_DC_TYPE) == PosConst.PAY_DC_TYPE.DC) { m_cPayItem.PAY_DTL_CD_03 = "1"; // 할인금액아이템적용여부 (0:미적용, 1:적용) m_cPayItem.PAY_DTL_CD_05 = PosConst.PAY_DC_TYPE.DC; // 할인결제구분 (1:결제, 2:할인) m_cPayItem.AMT_ENTRY_02 = CmUtil.DoubleParse(nDisAmt.ToString()); // 할인금액 } m_cPayItem.AMT_ENTRY_03 = nDestAmt; // 받을금액 m_cPayItem.OCCUR_ENTRY_08 = ItemConst.PAY_APP_DIV.NORMAL; // 승인구분 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.CANCEL_DIV = ItemConst.PAY_CANCEL_DIV.NORMAL; // 취소여부 m_cPayItem.BILLSPR_NO = m_cTrnStatus.Sale.BillSplitNo; // 빌분리 번호 // 결제 아이템 추가 ArrayList alPayItem = (ArrayList)StateObject.GetItemObject(Column.TR_PAYMENT.ITEM); // 결제 내역 받아 오기 m_cPayItem.SEQ = alPayItem.Count + 1; alPayItem.Add(m_cPayItem); if (m_cPayItem.PAY_DTL_CD_05 == PosConst.PAY_DC_TYPE.DC) { // 상품아이템에 할인금액 설정 SetPluDiscountAmount(-1, m_cPayItem.PAY_WAY_CD + m_cPayItem.PAY_DTL_CD_01, "", m_cPayItem.PAY_AMT); } 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 CancelPayment(string[] aParam) { string sRet = UserCom.RST_ERR; try { // --------------------------------------------------------------------------------------------------------------------------------------- // 결제 수단 취소 // --------------------------------------------------------------------------------------------------------------------------------------- ArrayList alPayItem = (ArrayList)StateObject.GetItemObject(Column.TR_PAYMENT.ITEM); Column.TR_PAYMENT.DATA cPayItem = (Column.TR_PAYMENT.DATA)alPayItem[CmUtil.IntParse(aParam[0])]; if (m_cPayItem.PAY_DTL_CD_05 == PosConst.PAY_DC_TYPE.DC) { ClearPluDiscountAmount(m_cPayItem.PAY_WAY_CD + m_cPayItem.PAY_DTL_CD_01, ""); // 할인금액 삭제 } m_cDataService.UpdatePluAmount(); // 상품 합계금액 계산(거래해더) m_cDataService.UpdatePayAmount(); // 결제 금액 재 계산 처리 m_cPayItem.CANCEL_DIV = PosConst.CANCEL_DIV.CANCEL; 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 RefundPayment 결제 반품 /// /// 결제 반품 /// /// /// public string RefundPayment(string[] aParam) { string sRet = UserCom.RST_ERR; try { int nPayRow = CmUtil.IntParse(aParam[0]); // 취소할 행번호 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 SetMenualPayment public string SetMenualPayment(string[] aParam) { throw new NotImplementedException(); } #endregion } }