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.Infrastructure.Query;
|
using CY.Infrastructure.Common;
|
using CY.BLL.Sys;
|
using CY.Model;
|
|
namespace CY.WebForm.Pages.member
|
{
|
public partial class AccountRecordNew : BasePage
|
{
|
Pay_IncExpRecordBLL bll_Pay_IncExpRecordBLL = null;
|
Sys_DictionaryBLL _sys_DictionaryBLL = null;
|
|
public string Province { get; set; }
|
public string City { get; set; }
|
public string County { get; set; }
|
|
public AccountRecordNew()
|
{
|
bll_Pay_IncExpRecordBLL = new Pay_IncExpRecordBLL();
|
_sys_DictionaryBLL = new Sys_DictionaryBLL();
|
}
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
UCPager1.AspNetPager.PageChanged += AspNetPager1_PageChanged;
|
if (!IsPostBack)
|
{
|
Province = CY.Config.WebInfo.Instance.WebProvinceName;
|
City = CY.Config.WebInfo.Instance.WebCityName;
|
this.hidFirmId.Value = this.CurrentUser.MemberId.ToString();
|
BindDropDownList();
|
BindList();
|
}
|
}
|
|
private void BindDropDownList()
|
{
|
IsNotExsit(4);
|
IEnumerable<Sys_Dictionary> dicList = null;
|
dicList = _sys_DictionaryBLL.GetDataByType("收支科目").Where(p => IsNotExsit(p.MeanValue.Value));
|
this.ddlBalanceAccount.DataSource = dicList;
|
this.ddlBalanceAccount.DataTextField = "Name";
|
this.ddlBalanceAccount.DataValueField = "MeanValue";
|
this.ddlBalanceAccount.DataBind();
|
this.ddlBalanceAccount.Items.Insert(0,new ListItem("请选择","-1"));
|
|
this.ddlMemberType.DataSource = _sys_DictionaryBLL.GetDataByType("会员类型").Where(p=>p.MeanValue!=0);
|
this.ddlMemberType.DataTextField = "Name";
|
this.ddlMemberType.DataValueField = "Name";
|
this.ddlMemberType.DataBind();
|
this.ddlMemberType.Items.Insert(0, new ListItem("请选择", ""));
|
}
|
|
private bool IsNotExsit(int meanValue)
|
{
|
bool isNotExsit = true;
|
IList<int> list = null;
|
if (CurrentUser.MemberType == "管理员")
|
{
|
list = new List<int>()
|
{
|
2,4,5,6,11
|
};
|
}
|
else if (CurrentUser.MemberType == "印刷厂商" || CurrentUser.MemberType == "个人网店")
|
{
|
list = new List<int>()
|
{
|
7,8
|
};
|
}
|
else //买家会员
|
{
|
list = new List<int>()
|
{
|
3,7,8,10,12
|
};
|
}
|
if (list.Contains(meanValue))
|
{
|
isNotExsit = false;
|
}
|
return isNotExsit;
|
}
|
|
/// <summary>
|
/// 收入
|
/// </summary>
|
/// <param name="meanValue"></param>
|
/// <returns></returns>
|
public bool IsExsitByIn(int meanValue)
|
{
|
bool isExsit = false;
|
IList<int> list = null;
|
if (CurrentUser.MemberType == "管理员")
|
{
|
list = new List<int>()
|
{
|
12,13,15,7,3,10,14
|
};
|
}
|
else if (CurrentUser.MemberType == "印刷厂商" || CurrentUser.MemberType == "个人网店")
|
{
|
list = new List<int>()
|
{
|
0,1,2,4,5,6,9,11,15
|
};
|
}
|
else //买家会员
|
{
|
list = new List<int>()
|
{
|
0,1,2,9,11,15
|
};
|
}
|
if (list.Contains(meanValue))
|
{
|
isExsit = true;
|
}
|
return isExsit;
|
}
|
|
/// <summary>
|
/// 支出
|
/// </summary>
|
/// <param name="meanValue"></param>
|
/// <returns></returns>
|
public bool IsExsitByOut(int meanValue)
|
{
|
bool isExsit = false;
|
IList<int> list = null;
|
if (CurrentUser.MemberType == "管理员")
|
{
|
list = new List<int>()
|
{
|
0,8,1,16,9
|
};
|
}
|
else if (CurrentUser.MemberType == "印刷厂商" || CurrentUser.MemberType == "个人网店")
|
{
|
list = new List<int>()
|
{
|
3,4,5,6,10,12,13,14,16
|
};
|
}
|
else //买家会员
|
{
|
list = new List<int>()
|
{
|
4,5,6,13,14,16
|
};
|
}
|
if (list.Contains(meanValue))
|
{
|
isExsit = true;
|
}
|
return isExsit;
|
}
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
private void BindList()
|
{
|
Pagination pa = new Pagination();
|
pa.PageSize = UCPager1.AspNetPager.PageSize;
|
pa.PageIndex = UCPager1.AspNetPager.CurrentPageIndex;
|
string startDate = this.txtBeginData.Value.ToString();
|
string endDate=string.Empty;
|
if (!string.IsNullOrEmpty(this.txtEndDate.Value.ToString()))
|
{
|
endDate = DateTime.Parse(this.txtEndDate.Value.ToString()).AddDays(1).ToString();
|
}
|
int tradingType = ddlTradingType.SelectedValue.ToString().ToInt32().Value;
|
int balanceAccount = ddlBalanceAccount.SelectedValue.ToString().ToInt32().Value;
|
string memberType = ddlMemberType.SelectedValue.ToString();
|
string memberName = this.txtMemberName.Text;
|
if (Request["selectProvince"] != null)
|
{
|
Province = Request["selectProvince"].ToString();
|
}
|
if (Request["selectCity"] != null)
|
{
|
City = Request["selectCity"].ToString();
|
}
|
if (Request["selectCounty"] != null)
|
{
|
County = Request["selectCounty"].ToString();
|
}
|
|
this.RepClientList.DataSource = bll_Pay_IncExpRecordBLL.SelectAllModelByPaging(pa, CurrentPayAccount.Keyid,startDate,endDate,tradingType,balanceAccount,memberType,memberName,Province,City,County);
|
this.RepClientList.DataBind();
|
UCPager1.AspNetPager.RecordCount = pa.RecordCount;
|
|
}
|
|
//分页事件
|
protected void AspNetPager1_PageChanged(object src, EventArgs e)
|
{
|
BindList();
|
}
|
|
protected void btn_Query_Click(object sender, EventArgs e)
|
{
|
BindList();
|
}
|
|
protected void btnReSet_Click(object sender, EventArgs e)
|
{
|
this.txtBeginData.Value = string.Empty;
|
this.txtEndDate.Value = string.Empty;
|
this.ddlTradingType.SelectedValue = "0";
|
this.ddlBalanceAccount.SelectedValue = "-1";
|
this.ddlMemberType.SelectedValue = "";
|
this.txtMemberName.Text = string.Empty;
|
UCPager1.AspNetPager.CurrentPageIndex = 1;
|
Province = CY.Config.WebInfo.Instance.WebProvinceName;
|
City = CY.Config.WebInfo.Instance.WebCityName;
|
BindList();
|
}
|
|
protected void ddlTradingType_SelectedIndexChanged(object sender, EventArgs e)
|
{
|
IEnumerable<Sys_Dictionary> dicList = null;
|
if(ddlTradingType.SelectedValue=="0")
|
{
|
dicList = _sys_DictionaryBLL.GetDataByType("收支科目").Where(p=>IsNotExsit(p.MeanValue.Value));
|
}
|
else if (ddlTradingType.SelectedValue == "1")
|
{
|
dicList = _sys_DictionaryBLL.GetDataByType("收支科目").Where(p => IsExsitByIn(p.MeanValue.Value));
|
}
|
else
|
{
|
dicList = _sys_DictionaryBLL.GetDataByType("收支科目").Where(p => IsExsitByOut(p.MeanValue.Value));
|
}
|
this.ddlBalanceAccount.DataSource = dicList;
|
this.ddlBalanceAccount.DataTextField = "Name";
|
this.ddlBalanceAccount.DataValueField = "MeanValue";
|
this.ddlBalanceAccount.DataBind();
|
this.ddlBalanceAccount.Items.Insert(0, new ListItem("请选择", "-1"));
|
BindList();
|
}
|
|
protected void ddlBalanceAccount_SelectedIndexChanged(object sender, EventArgs e)
|
{
|
BindList();
|
}
|
|
protected void ddlMemberType_SelectedIndexChanged(object sender, EventArgs e)
|
{
|
BindList();
|
}
|
|
protected void txtMemberName_TextChanged(object sender, EventArgs e)
|
{
|
BindList();
|
}
|
}
|
}
|