using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.UI;
|
using System.Web.UI.WebControls;
|
using CY.BLL;
|
using CY.BLL.Sys;
|
using CY.Infrastructure.Query;
|
using CY.Infrastructure.Common;
|
using CY.Model;
|
using CY.BLL.OA;
|
|
namespace CY.WebForm.Pages.financial
|
{
|
//吴辉
|
//客户预付款存入
|
public partial class DepositsCustomer : BasePage
|
{
|
OA_CorporateClientsBLL bll_OA_CorporateClientsBLL = null;
|
Sys_DictionaryBLL _Sys_DictionaryBLL = null;
|
OA_AdvanceMoneyRecordBLL bll_OA_AdvanceMoneyRecordBLL = null;
|
OA_SubjectSetBLL _OA_SubjectSetBLL = null;
|
OA_FirmAccountBLL _OA_FirmAccountBLL = null;
|
OA_FirmAccountRecordBLL _OA_FirmAccountRecordBLL = null;
|
|
//初始化
|
public DepositsCustomer()
|
{
|
_Sys_DictionaryBLL = new Sys_DictionaryBLL();
|
bll_OA_CorporateClientsBLL = new OA_CorporateClientsBLL();
|
bll_OA_AdvanceMoneyRecordBLL = new OA_AdvanceMoneyRecordBLL();
|
_Sys_DictionaryBLL = new Sys_DictionaryBLL();
|
_OA_FirmAccountBLL = new OA_FirmAccountBLL();
|
_OA_FirmAccountRecordBLL = new OA_FirmAccountRecordBLL();
|
_OA_SubjectSetBLL = new OA_SubjectSetBLL();
|
}
|
|
//页面加载
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
if (!IsPostBack)
|
{
|
BindList();
|
}
|
}
|
|
//绑定数据
|
private void BindList()
|
{
|
try
|
{
|
//科目名称
|
//selSubject.DataSource = _OA_SubjectSetBLL.getAllSubject(CurrentUser.MemberId, "借");
|
//selSubject.DataBind();
|
//selSubject.Items.Insert(0, new ListItem("请选择", ""));
|
|
//账户类型
|
this.selAcoountType.DataSource = _Sys_DictionaryBLL.GetDataByType("账户类型");
|
this.selAcoountType.DataBind();
|
|
//账户信息
|
OA_CorporateClients m_OA_CorporateClients = bll_OA_CorporateClientsBLL.GetModel(Request["Keyid"].ToGuid2());
|
this.spanCustomName.InnerText = m_OA_CorporateClients.CompanyName;
|
this.spanCustomMoney.InnerText = "¥ " + m_OA_CorporateClients.Prepayments.ToDecimal2Yen();
|
|
//分页信息
|
Pagination pa = new Pagination();
|
DateTime? beginTime = null;
|
DateTime? endTime = null;
|
pa.PageSize = UCPager1.AspNetPager.PageSize;
|
pa.PageIndex = UCPager1.AspNetPager.CurrentPageIndex;
|
this.RepClientList.DataSource = bll_OA_AdvanceMoneyRecordBLL.GetModelPageListForCustomer(pa, Request["Keyid"].ToGuid2(),
|
string.IsNullOrEmpty(this.txtRegTimeStart.Value) ? beginTime : Convert.ToDateTime(this.txtRegTimeStart.Value),
|
string.IsNullOrEmpty(this.txtRegTimeEnd.Value) ? endTime : Convert.ToDateTime(this.txtRegTimeEnd.Value),
|
spanMoneyw.Value.ToString());
|
this.RepClientList.DataBind();
|
UCPager1.AspNetPager.RecordCount = pa.RecordCount;
|
}
|
catch (Exception ex)
|
{
|
PAGEHandleException(ex);
|
}
|
}
|
|
//分页事件
|
protected void AspNetPager1_PageChanged(object src, EventArgs e)
|
{
|
BindList();
|
}
|
|
//提交表单
|
protected void btn_Submit_Deposits(object sender, EventArgs e)
|
{
|
try
|
{
|
int? SubjectId = 0; // 客户预付款
|
string AccountType = this.selAcoountType.Value.ToString2();
|
int? AccountId = Request["selAccountName"].ToInt32();
|
decimal? money = this.txtOperatMoney.Value.ToDecimal2();
|
if (SubjectId == null || string.IsNullOrEmpty(AccountType) || AccountId == null || money == null)
|
JavaScript.MessageBox("操作失败", this);
|
else
|
{
|
//OA_SubjectSet m_OA_SubjectSet = _OA_SubjectSetBLL.getSingleSubject(SubjectId);
|
|
OA_FirmAccount m_OA_FirmAccount = _OA_FirmAccountBLL.getSingleSubject(AccountId);
|
if (money > 0)
|
{
|
m_OA_FirmAccount.AllIncome += money;
|
}
|
else
|
{
|
m_OA_FirmAccount.AllExpenses += money;
|
}
|
m_OA_FirmAccount.Balance += money;
|
m_OA_FirmAccount.LastUpdateTime = DateTime.Now;
|
m_OA_FirmAccount.Operator = CurrentUser.ShortName;
|
|
OA_CorporateClients m_OA_CorporateClients = bll_OA_CorporateClientsBLL.GetModel(Request["Keyid"].ToGuid2());
|
m_OA_CorporateClients.Prepayments += money;
|
m_OA_CorporateClients.Operator = CurrentUser.ShortName;
|
m_OA_CorporateClients.LastUpdateTime = DateTime.Now;
|
|
OA_FirmAccountRecord m_OA_FirmAccountRecord = new OA_FirmAccountRecord();
|
m_OA_FirmAccountRecord.AccountId = m_OA_FirmAccount.Keyid;
|
m_OA_FirmAccountRecord.RecordTypeId = money > 0 ? 1 : 2;//收入
|
m_OA_FirmAccountRecord.Money = Math.Abs(money.Value);
|
m_OA_FirmAccountRecord.SubjectId = 0;
|
m_OA_FirmAccountRecord.OperationalMatters = money > 0 ? "客户预付款存入" : "客户预付款存入(负)";
|
m_OA_FirmAccountRecord.PaymentUnit = m_OA_CorporateClients.CompanyName;
|
m_OA_FirmAccountRecord.LastUpdateTime = DateTime.Now;
|
m_OA_FirmAccountRecord.Operator = CurrentUser.ShortName.ToString2();
|
m_OA_FirmAccountRecord.Remark = this.txtRemark.Value.ToString2();
|
m_OA_FirmAccountRecord.ResidualAmount = m_OA_FirmAccount.Balance;
|
m_OA_FirmAccountRecord.Department = "";
|
|
OA_AdvanceMoneyRecord m_OA_AdvanceMoneyRecord = new OA_AdvanceMoneyRecord();
|
m_OA_AdvanceMoneyRecord.CustomerId = m_OA_CorporateClients.Keyid;
|
m_OA_AdvanceMoneyRecord.OperatTypeId = _Sys_DictionaryBLL.GetNameByMeanValue(1, "客户预付款明细类型");
|
m_OA_AdvanceMoneyRecord.OperatMoney = money;
|
m_OA_AdvanceMoneyRecord.SubjectName = money > 0 ? "预付款收入" : "预付款收入(负)";
|
m_OA_AdvanceMoneyRecord.AccountType = AccountType;
|
m_OA_AdvanceMoneyRecord.AccountName = m_OA_FirmAccount.AccountName + "-" + m_OA_FirmAccount.UserName;
|
m_OA_AdvanceMoneyRecord.LastUpdateTime = DateTime.Now;
|
m_OA_AdvanceMoneyRecord.Operator = CurrentUser.ShortName.ToString2();
|
m_OA_AdvanceMoneyRecord.Remark = this.txtRemark.Value.ToString2();
|
|
if (bll_OA_AdvanceMoneyRecordBLL.DepositsMoney(m_OA_FirmAccount, m_OA_CorporateClients, m_OA_FirmAccountRecord, m_OA_AdvanceMoneyRecord))
|
{
|
BindList();
|
JavaScript.MessageBox("存入成功", this, true, true);
|
}
|
else
|
JavaScript.MessageBox("操作失败", this);
|
}
|
}
|
catch (Exception ex)
|
{
|
PAGEHandleException(ex);
|
JavaScript.MessageBox("操作失败", this);
|
}
|
}
|
|
protected void btn_Query_Deposits(object sender, EventArgs e)
|
{
|
try
|
{
|
BindList();
|
}
|
catch (Exception ex)
|
{
|
PAGEHandleException(ex);
|
JavaScript.MessageBox("操作失败", this);
|
}
|
}
|
}
|
}
|