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.OA;
|
using CY.Infrastructure.Common;
|
using CY.Infrastructure.Query;
|
using CY.BLL.Sys;
|
using System.Data;
|
|
namespace CY.WebForm.Pages.financial
|
{
|
//吴辉
|
//采购付款
|
public partial class PurchasePayments : BasePage
|
{
|
Sys_DictionaryBLL _Sys_DictionaryBLL = null;
|
OA_SuppliersBLL _OA_SuppliersBLL = null;
|
OA_CommodityBLL _OA_CommodityBLL = null;
|
OA_GoodsInfoBLL _OA_GoodsInfoBLL = null;
|
OA_ProcurementBLL _OA_ProcurementBLL = null;
|
OA_Procurement Procuremet = null;
|
|
//初始化
|
public PurchasePayments()
|
{
|
Procuremet = new OA_Procurement();
|
_OA_CommodityBLL = new OA_CommodityBLL();
|
_Sys_DictionaryBLL = new Sys_DictionaryBLL();
|
_OA_SuppliersBLL = new OA_SuppliersBLL();
|
_OA_GoodsInfoBLL = new OA_GoodsInfoBLL();
|
_OA_ProcurementBLL = new OA_ProcurementBLL();
|
}
|
|
//页面加载
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
|
UCPager1.AspNetPager.PageChanged += AspNetPager1_PageChanged;
|
if (!IsPostBack)
|
{
|
}
|
|
if (!IsPostBack)
|
{
|
|
if (Request["Keyid"].ToInt32() > 0) //如果keyid>0 则删除对应对象
|
{
|
Procuremet = _OA_ProcurementBLL.SelectSingleModel(Request["Keyid"].ToString2());
|
if (_OA_ProcurementBLL.DeleteModel(Procuremet))
|
{
|
JavaScript.MessageBox("删除成功", this);
|
BindList();
|
}
|
else
|
{
|
JavaScript.MessageBox("删除失败", this);
|
BindList();
|
}
|
}
|
else
|
{
|
|
BindList();
|
InitialData();
|
}
|
}
|
|
}
|
|
//加载收入list数据
|
protected void BindList()
|
{
|
DateTime? beginTime = null;
|
DateTime? endTime = null;
|
Pagination pa = new Pagination();
|
pa.PageIndex = UCPager1.AspNetPager.CurrentPageIndex;
|
pa.PageSize = UCPager1.AspNetPager.PageSize;
|
ReProcurentList.DataSource = _OA_ProcurementBLL.getModelList(pa, CurrentUser.MemberId, "", this.selPurchaseStatus.Value, this.selClearingStatus.Value, this.selSuppliers.Value, this.selGoodsName.Value, this.dwCommity.SelectedValue, string.IsNullOrEmpty(this.txtRegTimeStart.Value) ? beginTime : Convert.ToDateTime(this.txtRegTimeStart.Value), string.IsNullOrEmpty(this.txtRegTimeEnd.Value) ? endTime : MyConvert.GetDateTime(this.txtRegTimeEnd.Value), this.txtBrandName.Value, this.txtPaperWeight.Value);
|
ReProcurentList.DataBind();
|
UCPager1.AspNetPager.RecordCount = pa.RecordCount;
|
|
OA_Procurement m_OA_Procurement = _OA_ProcurementBLL.SumMoney(pa, CurrentUser.MemberId, "", this.selPurchaseStatus.Value, this.selClearingStatus.Value, this.selSuppliers.Value, this.selGoodsName.Value, this.dwCommity.SelectedValue, string.IsNullOrEmpty(this.txtRegTimeStart.Value) ? beginTime : Convert.ToDateTime(this.txtRegTimeStart.Value), string.IsNullOrEmpty(this.txtRegTimeEnd.Value) ? endTime : MyConvert.GetDateTime(this.txtRegTimeEnd.Value), this.txtBrandName.Value, this.txtPaperWeight.Value);
|
if (m_OA_Procurement != null && m_OA_Procurement.AllMoney > 0)
|
{
|
this.AllMoney.InnerHtml = m_OA_Procurement.AllMoney.Value.ToString("0.00");
|
this.PayMoney.InnerHtml = m_OA_Procurement.ReceiveMoney.Value.ToString("0.00");
|
this.OweMoney.InnerHtml = (m_OA_Procurement.AllMoney - m_OA_Procurement.ReceiveMoney).Value.ToString("0.00");
|
}
|
}
|
|
//加载查询条件
|
protected void InitialData()
|
{
|
//采购状态
|
this.selPurchaseStatus.DataSource = _Sys_DictionaryBLL.GetDataByType("采购状态");
|
this.selPurchaseStatus.DataBind();
|
this.selPurchaseStatus.Items.Insert(0, new ListItem("全部", ""));
|
|
//结账状态
|
this.selClearingStatus.DataSource = _Sys_DictionaryBLL.GetDataByType("结账状态");
|
this.selClearingStatus.DataBind();
|
this.selClearingStatus.Items.Insert(0, new ListItem("全部", ""));
|
|
//供应商
|
this.selSuppliers.DataSource = _OA_SuppliersBLL.getSupplierTable(CurrentUser.MemberId);
|
this.selSuppliers.DataBind();
|
this.selSuppliers.Items.Insert(0, new ListItem("全部", ""));
|
|
//货品名称
|
this.selGoodsName.DataSource = _OA_GoodsInfoBLL.SelectTableList(CurrentUser.MemberId);
|
this.selGoodsName.DataBind();
|
this.selGoodsName.Items.Insert(0, new ListItem("全部", ""));
|
|
//产品类别
|
DataTable ds = _OA_CommodityBLL.SelectModelPage(CurrentUser.MemberId, "", "true");
|
GetDataByLevel(this.dwCommity, ds, 0, 0);
|
this.dwCommity.Items.Insert(0, new ListItem("全部", ""));
|
}
|
|
//产品类别
|
public static void GetDataByLevel(System.Web.UI.WebControls.DropDownList dwCommity, DataTable data, int parentId, int level)
|
{
|
|
if (data == null || data.Rows.Count == 0)
|
return;
|
DataRow[] result = data.Select(string.Format("ParentId={0}", parentId));
|
int i = -1;
|
while (++i < result.Length)
|
{
|
dwCommity.Items.Add(new ListItem(GetSplitChar(level) + result[i]["CommodityName"].ToString2(), result[i]["Keyid"].ToString2()));
|
GetDataByLevel(dwCommity, data, result[i]["Keyid"].ToInt32().Value, level + 1);
|
|
}
|
}
|
|
//隔位符
|
public static string GetSplitChar(int level)
|
{
|
string splitchar = "";
|
int i = -1;
|
while (++i < level)
|
{
|
splitchar += ".";
|
}
|
return splitchar;
|
}
|
|
//分页事件
|
protected void AspNetPager1_PageChanged(object src, EventArgs e)
|
{
|
BindList();
|
}
|
|
//查询事件
|
protected void btn_Register_Click(object sender, EventArgs e)
|
{
|
BindList();
|
}
|
}
|
}
|