using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.UI;
|
using System.Web.UI.WebControls;
|
using System.Data;
|
using System.Data.SqlClient;
|
using CY.Model;
|
using CY.BLL;
|
using CY.Infrastructure.Common;
|
using CY.Infrastructure.Query;
|
using CY.BLL.OA;
|
|
namespace CY.WebForm.Pages.adminclient
|
{
|
//吴辉
|
//软件订单收款
|
public partial class OrderReciveMoney : BasePage
|
{
|
Soft_SellRecordBLL bll_Soft_SellRecordBLL = null;
|
OA_SubjectSetBLL bll_OA_SubjectSetBLL = null;
|
OA_FirmAccountBLL bll_OA_FirmAccountBLL = null;
|
OA_FirmAccountRecordBLL bll_OA_FirmAccountRecordBLL = null;
|
|
//初始化
|
public OrderReciveMoney()
|
{
|
bll_Soft_SellRecordBLL = new Soft_SellRecordBLL();
|
bll_OA_FirmAccountBLL = new OA_FirmAccountBLL();
|
bll_OA_SubjectSetBLL = new OA_SubjectSetBLL();
|
bll_OA_FirmAccountRecordBLL = new OA_FirmAccountRecordBLL();
|
}
|
|
//页面加载
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
if (!IsPostBack)
|
{
|
InitData();
|
}
|
}
|
|
//数据加载
|
public void InitData()
|
{
|
//科目名称
|
this.selSubjects.DataSource = bll_OA_SubjectSetBLL.getAllSubject(CurrentUser.MemberId, "借");
|
this.selSubjects.DataBind();
|
this.selSubjects.Items.Insert(0, new ListItem("请选择", ""));
|
|
Soft_SellRecord m_Soft_SellRecord = bll_Soft_SellRecordBLL.GetModelByKeyid(Request["keyid"].ToInt32());
|
if (m_Soft_SellRecord != null)
|
{
|
this.spanClientName.InnerText = m_Soft_SellRecord.ClientName.ToString2();
|
this.spanAccountManagerId.InnerText = m_Soft_SellRecord.AccountManagerName.ToString2();
|
this.spanBusinessManagerId.InnerText = m_Soft_SellRecord.BusinessManagerName.ToString2();
|
this.spanSoftName.InnerText = m_Soft_SellRecord.SoftName.ToString2();
|
this.spanSoftQuantity.InnerText = m_Soft_SellRecord.SoftQuantity.ToString2();
|
this.spanSoftUnitprice.InnerText = m_Soft_SellRecord.SoftUnitprice.ToString2();
|
this.spanOrderMoney.InnerText = m_Soft_SellRecord.OrderMoney.ToString2();
|
this.spanOrderNum.InnerText = m_Soft_SellRecord.OrderNum.ToString2();
|
this.spanCreatTime.InnerText = m_Soft_SellRecord.CreatTime.ToString2();
|
this.txtOrderRemark.Value = m_Soft_SellRecord.OrderRemark;
|
this.spanRecive.InnerText = m_Soft_SellRecord.OrderReceiveMoney.ToString2();
|
this.txtReceiveMoney.Value = ((m_Soft_SellRecord.OrderMoney > m_Soft_SellRecord.OrderReceiveMoney) ? (m_Soft_SellRecord.OrderMoney - m_Soft_SellRecord.OrderReceiveMoney) : 0).ToString2();
|
this.spanBalance.InnerText = ((m_Soft_SellRecord.OrderMoney > m_Soft_SellRecord.OrderReceiveMoney) ? (m_Soft_SellRecord.OrderMoney - m_Soft_SellRecord.OrderReceiveMoney) : 0).ToString2();
|
}
|
else
|
{
|
JavaScript.MessageBox("操作错误", this, true, true);
|
return;
|
}
|
}
|
|
//收款操作
|
protected void btn_submit_form(object sender, EventArgs e)
|
{
|
try
|
{
|
|
OA_FirmAccountRecord m_OA_FirmAccountRecord = new OA_FirmAccountRecord();
|
OA_FirmAccount m_OA_FirmAccount = bll_OA_FirmAccountBLL.getSingleSubject(Request["selAccounts"].ToInt32());
|
Soft_SellRecord m_Soft_SellRecord = bll_Soft_SellRecordBLL.GetModelByKeyid(Request["keyid"].ToInt32());
|
|
m_Soft_SellRecord.OrderReceiveMoney = m_Soft_SellRecord.OrderReceiveMoney + this.txtReceiveMoney.Value.ToInt32();
|
m_Soft_SellRecord.OrderRemark = this.txtOrderRemark.Value;
|
|
m_OA_FirmAccountRecord.AccountId = m_OA_FirmAccount.Keyid;
|
m_OA_FirmAccountRecord.LastUpdateTime = DateTime.Now;
|
m_OA_FirmAccountRecord.Money = this.txtReceiveMoney.Value.ToDecimal2();
|
m_OA_FirmAccountRecord.OperationalMatters = "订单收款";
|
m_OA_FirmAccountRecord.Operator = CurrentUser.ShortName;
|
m_OA_FirmAccountRecord.PaymentUnit = this.spanClientName.InnerText;
|
m_OA_FirmAccountRecord.RecordTypeId = 1;//收入
|
m_OA_FirmAccountRecord.Remark = this.txtOrderRemark.Value;
|
m_OA_FirmAccountRecord.SubjectId = this.selSubjects.Value.ToInt32();
|
m_OA_FirmAccountRecord.ResidualAmount = m_OA_FirmAccount.Balance + this.txtReceiveMoney.Value.ToDecimal2();
|
m_OA_FirmAccountRecord.Department = "";
|
|
m_OA_FirmAccount.AllIncome = this.txtReceiveMoney.Value.ToDecimal2() + m_OA_FirmAccount.AllIncome;
|
m_OA_FirmAccount.Balance = m_OA_FirmAccount.Balance + this.txtReceiveMoney.Value.ToDecimal2();
|
|
if (bll_OA_FirmAccountRecordBLL.AddModel(m_OA_FirmAccountRecord, m_OA_FirmAccount))
|
{
|
if (bll_Soft_SellRecordBLL.UpdateModel(m_Soft_SellRecord))
|
{
|
JavaScript.MessageBox("收款成功", this, true, true);
|
}
|
else
|
{
|
JavaScript.MessageBox("收款失败", this, false, true);
|
}
|
}
|
else
|
{
|
JavaScript.MessageBox("操作失败", this, false, true);
|
}
|
}
|
catch (Exception ex)
|
{
|
PAGEHandleException(ex);
|
JavaScript.MessageBox("操作失败", this, false, true);
|
}
|
}
|
}
|
}
|