using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.UI;
|
using System.Web.UI.WebControls;
|
using CY.Model;
|
using CY.BLL;
|
using CY.Infrastructure.Common;
|
using CY.BLL.Sys;
|
|
namespace CY.WebForm.Pages.webmanage
|
{
|
//吴辉
|
//提现审核
|
public partial class CashHandle : BasePage
|
{
|
Pay_CashApplyBLL bll_Pay_CashApplyBLL = null;
|
Sys_DictionaryBLL bll_Sys_DictionaryBLL = null;
|
Pay_PaymentAccountBLL bll_Pay_PaymentAccountBLL = null;
|
|
//初始化
|
public CashHandle()
|
{
|
bll_Pay_CashApplyBLL = new Pay_CashApplyBLL();
|
bll_Sys_DictionaryBLL = new Sys_DictionaryBLL();
|
bll_Pay_PaymentAccountBLL = new Pay_PaymentAccountBLL();
|
}
|
|
//页面加载
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
if (!IsPostBack)
|
{
|
BindData();
|
}
|
}
|
|
//绑定数据
|
public void BindData()
|
{
|
Pay_CashApply m_Pay_CashApply = bll_Pay_CashApplyBLL.GetModel(Request["Keyid"].ToInt32());
|
if (m_Pay_CashApply != null)
|
{
|
this.spanMemberName.InnerText = m_Pay_CashApply.MemberName;
|
this.spanCashType.InnerText = m_Pay_CashApply.CashTypeId.ToString() == "0" ? "账户提现" : (m_Pay_CashApply.CashTypeId.ToString() == "1" ? "推广提现" : (m_Pay_CashApply.CashTypeId.ToString() == "2" ? "申领代理佣金" : "报销推广费用"));
|
this.spanCashMoney.InnerText = m_Pay_CashApply.Money.Value.ToString("0");
|
this.spanCashCard.InnerText = m_Pay_CashApply.TargetBankId;
|
this.spanCashBank.InnerText = m_Pay_CashApply.TargetBankName;
|
this.spanCardholder.InnerText = m_Pay_CashApply.Cardholder;
|
this.divRemark.InnerHtml = m_Pay_CashApply.Remark;
|
|
if (m_Pay_CashApply.State == 0)
|
{
|
this.HandleNo.Visible = true;
|
this.HandleYes.Visible = false;
|
this.HandleOver.Visible = false;
|
}
|
else if (m_Pay_CashApply.State == 1)
|
{
|
this.HandleOver.Visible = true;
|
this.HandleNo.Visible = false;
|
this.HandleYes.Visible = false;
|
}
|
else
|
{
|
this.HandleNo.Visible = false;
|
this.HandleYes.Visible = true;
|
this.HandleOver.Visible = false;
|
this.spanState.InnerText = m_Pay_CashApply.CashStateName;
|
}
|
}
|
}
|
|
//提交事件
|
protected void btn_Submit_Click(object sender, EventArgs e)
|
{
|
Pay_CashApply m_Pay_CashApply = bll_Pay_CashApplyBLL.GetModel(Request["Keyid"].ToInt32());
|
Pay_PaymentAccount m_Pay_PaymentAccount = bll_Pay_PaymentAccountBLL.MergeBufferMoneyByMemberId(m_Pay_CashApply.MemberId);
|
CY.Model.Pay.Pay_Request m_Pay_Request = null;
|
Pay_PromotionRecord m_Pay_PromotionRecord = null;
|
|
if (m_Pay_CashApply != null && m_Pay_PaymentAccount !=null)
|
{
|
switch (m_Pay_CashApply.State)
|
{
|
case 0:
|
m_Pay_CashApply.State = this.selHandleState.Value.ToInt32();
|
break;
|
case 1:
|
m_Pay_CashApply.State = this.selOverState.Value.ToInt32();
|
break;
|
default:
|
JavaScript.MessageBox("操作失败", this);
|
return;
|
}
|
|
|
if (m_Pay_CashApply.State == 2)
|
{
|
m_Pay_CashApply.Remark = m_Pay_CashApply.Remark + "<br/>完成时间:" + DateTime.Now.ToString() + ",完成人:" + CurrentUser.ShortName + "," + this.txtOver.Value;
|
m_Pay_CashApply.CompleteTime = DateTime.Now;
|
m_Pay_CashApply.UPTime = DateTime.Now;
|
if (m_Pay_CashApply.CashTypeId == 0)
|
{
|
if (m_Pay_PaymentAccount.SurplusMoney < (m_Pay_CashApply.Money ?? 0))
|
{
|
JavaScript.MessageBox("账户余额不足", this);
|
return;
|
}
|
|
m_Pay_Request = new Model.Pay.Pay_Request();
|
m_Pay_Request.Payeeid = AdminAccount.Keyid.Value;
|
m_Pay_Request.Payerid = m_Pay_PaymentAccount.Keyid.Value;
|
m_Pay_Request.Paymoney = m_Pay_CashApply.Money ?? 0;
|
m_Pay_Request.Subject = "账户提现";
|
m_Pay_Request.BalanceAccount = 12;
|
m_Pay_Request.UsedCredit = -1;
|
}
|
else if (m_Pay_CashApply.CashTypeId == 1)
|
{
|
if (m_Pay_PaymentAccount.PromotionMoney < (m_Pay_CashApply.Money ?? 0))
|
{
|
JavaScript.MessageBox("推广金余额不足", this);
|
return;
|
}
|
m_Pay_PaymentAccount.PromotionMoney = m_Pay_PaymentAccount.PromotionMoney - m_Pay_CashApply.Money ?? 0;
|
|
m_Pay_PromotionRecord = new Pay_PromotionRecord();
|
m_Pay_PromotionRecord.TradingMoney = m_Pay_CashApply.Money ?? 0;
|
m_Pay_PromotionRecord.TradingName = "推广金提现";
|
m_Pay_PromotionRecord.CreateTime = DateTime.Now;
|
m_Pay_PromotionRecord.TradingType = -1;
|
m_Pay_PromotionRecord.PayId = m_Pay_PaymentAccount.Keyid;
|
m_Pay_PromotionRecord.ResidualMoney = m_Pay_PaymentAccount.PromotionMoney;
|
m_Pay_PromotionRecord.TradingState = -1;
|
m_Pay_PromotionRecord.Remark = m_Pay_CashApply.MemberId.ToString2();
|
m_Pay_PromotionRecord.TardingRemark = "推广金提现";
|
m_Pay_PromotionRecord.IsProxy = false;
|
m_Pay_PromotionRecord.SendMemberId = m_Pay_PaymentAccount.MemberId;
|
m_Pay_PromotionRecord.GetMemberId = m_Pay_PaymentAccount.MemberId;
|
m_Pay_PromotionRecord.DataType = "推广";
|
m_Pay_PromotionRecord.RewardType = "推广金";
|
}
|
else if (m_Pay_CashApply.CashTypeId == 2)
|
{
|
if (m_Pay_PaymentAccount.ProxyMoneyCash < (m_Pay_CashApply.Money ?? 0))
|
{
|
JavaScript.MessageBox("申领的代理佣金余额不足", this);
|
return;
|
}
|
m_Pay_PaymentAccount.ProxyMoney = m_Pay_PaymentAccount.ProxyMoney - m_Pay_CashApply.Money ?? 0;
|
m_Pay_PaymentAccount.ProxyMoneyCash = m_Pay_PaymentAccount.ProxyMoneyCash - m_Pay_CashApply.Money ?? 0;
|
|
m_Pay_PromotionRecord = new Pay_PromotionRecord();
|
m_Pay_PromotionRecord.TradingMoney = m_Pay_CashApply.Money ?? 0;
|
m_Pay_PromotionRecord.TradingName = "申领代理佣金";
|
m_Pay_PromotionRecord.CreateTime = DateTime.Now;
|
m_Pay_PromotionRecord.TradingType = -1;
|
m_Pay_PromotionRecord.PayId = m_Pay_PaymentAccount.Keyid;
|
m_Pay_PromotionRecord.ResidualMoney = m_Pay_PaymentAccount.ProxyMoneyCash;
|
m_Pay_PromotionRecord.TradingState = -1;
|
m_Pay_PromotionRecord.Remark = m_Pay_CashApply.MemberId.ToString2();
|
m_Pay_PromotionRecord.TardingRemark = "申领代理佣金";
|
m_Pay_PromotionRecord.IsProxy = false;
|
m_Pay_PromotionRecord.SendMemberId = m_Pay_PaymentAccount.MemberId;
|
m_Pay_PromotionRecord.GetMemberId = m_Pay_PaymentAccount.MemberId;
|
m_Pay_PromotionRecord.DataType = "代理";
|
m_Pay_PromotionRecord.RewardType = "代理金";
|
}
|
else if (m_Pay_CashApply.CashTypeId == 3)
|
{
|
if (m_Pay_PaymentAccount.ProxyMoneyAudit < (m_Pay_CashApply.Money ?? 0))
|
{
|
JavaScript.MessageBox("申请报销的推广费用余额不足", this);
|
return;
|
}
|
m_Pay_PaymentAccount.ProxyMoney = m_Pay_PaymentAccount.ProxyMoney - m_Pay_CashApply.Money ?? 0;
|
m_Pay_PaymentAccount.ProxyMoneyAudit = m_Pay_PaymentAccount.ProxyMoneyAudit - m_Pay_CashApply.Money ?? 0;
|
|
m_Pay_PromotionRecord = new Pay_PromotionRecord();
|
m_Pay_PromotionRecord.TradingMoney = m_Pay_CashApply.Money ?? 0;
|
m_Pay_PromotionRecord.TradingName = "报销推广费用";
|
m_Pay_PromotionRecord.CreateTime = DateTime.Now;
|
m_Pay_PromotionRecord.TradingType = -1;
|
m_Pay_PromotionRecord.PayId = m_Pay_PaymentAccount.Keyid;
|
m_Pay_PromotionRecord.ResidualMoney = m_Pay_PaymentAccount.ProxyMoneyAudit;
|
m_Pay_PromotionRecord.TradingState = -1;
|
m_Pay_PromotionRecord.Remark = m_Pay_CashApply.MemberId.ToString2();
|
m_Pay_PromotionRecord.TardingRemark = "报销推广费用";
|
m_Pay_PromotionRecord.IsProxy = false;
|
m_Pay_PromotionRecord.SendMemberId = m_Pay_PaymentAccount.MemberId;
|
m_Pay_PromotionRecord.GetMemberId = m_Pay_PaymentAccount.MemberId;
|
m_Pay_PromotionRecord.DataType = "代理";
|
m_Pay_PromotionRecord.RewardType = "代理金";
|
}
|
}
|
else
|
{
|
m_Pay_CashApply.Remark = m_Pay_CashApply.Remark + "<br/>审核时间:" + DateTime.Now.ToString() + ",审核人:" + CurrentUser.ShortName + "," + this.txtRemark.Value;
|
m_Pay_CashApply.AuditTime = DateTime.Now;
|
m_Pay_CashApply.UPTime = DateTime.Now;
|
}
|
if (bll_Pay_CashApplyBLL.HandleCash(m_Pay_CashApply, m_Pay_Request, m_Pay_PromotionRecord, m_Pay_PaymentAccount))
|
{
|
if (m_Pay_CashApply.State == 2)
|
{
|
JavaScript.MessageBox("操作成功", this, "top.frmright.ReLoad();top.Dialog.close();");
|
}
|
else
|
{
|
JavaScript.MessageBox("审核成功", this, "window.location='/Pages/webmanage/CashHandle.aspx?Keyid=" + m_Pay_CashApply .Keyid+ "'");
|
}
|
}
|
else
|
{
|
JavaScript.MessageBox("操作失败", this);
|
}
|
|
}
|
else
|
{
|
JavaScript.MessageBox("操作失败", this);
|
}
|
}
|
}
|
}
|