using System; using System.Data; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using SuperMap.RealEstate.CoreFrameWork; using SuperMap.RealEstate.Enums; using SuperMap.RealEstate.HighWay.Storage.Business; using SuperMap.RealEstate.Utility; using SuperMap.RealEstate.Web.UI.WebControls; using HWSB = SuperMap.RealEstate.HighWay.Storage.Business; using SuperMap.RealEstate.Finance.Common; namespace SuperMap.RealEstate.Finance.Modules.Statistics { public partial class Default : SuperMap.RealEstate.Web.UI.PageValid { //protected string USER_NAME = System.Configuration.ConfigurationManager.AppSettings["USER_NAME"].ToString(); //protected string QYUSER_NAME = System.Configuration.ConfigurationManager.AppSettings["QYUSER_NAME"].ToString(); public string QueryOperateType { get { try { return Request["OPERATION_TYPE"].ToString(); } catch { return null; } } } protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) return; try { ListItemEx _ListItemEx = new ListItemEx(); //流程状态 Prodef_Name Prodef_Name.Items.Clear(); Prodef_Name.Items.Add(new Web.UI.WebControls.ListItemEx() { Text = "全部", Value = "-1" }); foreach (WorkFlow.Support.Business.ProDef _ProDef in (new WorkFlow.Support.Business.ProDef(Transaction)).FillCollection( "WHERE OPERATION_TYPE IN (400100,400110,400200,400210,400300,400400,400500) AND PRODEF_STATUS = 1 ORDER BY PRODEF_INDEX,PRODEF_ID")) { _ListItemEx = new ListItemEx(); _ListItemEx.Value = _ProDef.ProDef_ID_Encrypt; _ListItemEx.Text = _ProDef.ProDef_Name; Prodef_Name.Items.Add(_ListItemEx); } //服务区 SERVERPART_ID.Clear(); SERVERPART_ID.Items.Add(new Web.UI.WebControls.ListItemEx() { Text = "全部", Value = "1=1" }); List _ListSERVERPART = (new HWSB.SERVERPART(this.Transaction)).GetPassportServerPart(this.PassportInfo.CityAuthority); foreach (SuperMap.RealEstate.HighWay.Storage.Business.SERVERPART _s in _ListSERVERPART) { _ListItemEx = new ListItemEx(); _ListItemEx.Text = _s.SERVERPART_NAME; _ListItemEx.Value = _s.SERVERPART_ID_Encrypt; SERVERPART_ID.Items.Add(_ListItemEx); } SERVERPART_ID.SelectedIndex = 1; LoadGridViewEx(); //设置回车焦点按钮 SetControlClientAction(ButtonSearch); } catch (Exception ex) { throw new Exception(ex.Message); } } void LoadGridViewEx() { GridViewEx1.SelectingWithInit(ObjectDataSource1, GridPageEx1, DictionaryHelper.GetDictionary("ProInst_Type"), DictionaryHelper.GetDictionary("ProInst_State"), DictionaryHelper.GetDictionary("ActInst_Type"), DictionaryHelper.GetDictionary("ActInst_State")); } //翻页事件 protected void GridPageEx1_CallBackPageChanged(object src, ClientSetEventArgs e) { GridViewEx1.Pagging(ObjectDataSource1, GridPageEx1); //设置UI变化 e.SetValue(GridViewEx1); } //异步查询 protected void ButtonSearch_CallBackClick(object sender, ClientSetEventArgs e) { //加载列表 LoadGridViewEx(); //设置UI变化 e.SetValue(GridViewEx1); e.SetValue(GridPageEx1); } #region GridViewEx1_SelectMethodParameters //查询参数 protected void GridViewEx1_SelectMethodParameters(object sender, SelectMethodParametersArgs e) { if (!IsPostBack) { e.AddAndParams("1", 2); } //搜索选项的搜索条件过滤 if (!string.IsNullOrEmpty(TextBox_Search.Text.Trim())) e.AddOrParams(LayoutButton_Search, TextBox_Search.Text.Trim(), CheckBoxExOrParams.Checked); e.AddAndParams("1", 1); if (Prodef_Name.SelectedIndex > 0) { e.AddAndParams("ProDef_ID", Prodef_Name.SelectedValue.ToDecrypt()); } else { e.SetOtherUserCustomWhereSqlString = " OPERATION_TYPE IN (400100,400110,400200,400210,400300,400400,400500)"; } //--只显示对应的办结信息 //if (ProInst_State.Value != "-1") //{ // e.AddAndParams("ProInst_State", ProInst_State.SelectedValue); //} //服务区选择 if (SERVERPART_ID.SelectedIndex > 0 && SERVERPART_ID.SelectedValue != "1=1") { e.AddAndParams("SERVERPART_ID", SERVERPART_ID.SelectedValue.ToDecrypt()); } //过滤用户 if (this.PassportInfo.UserName != "system") { e.AddAndParams("USER_ID", PassportInfo.ID); } //排序 e.AddOrderByParams(LayoutButton_OrderBy, CheckBoxExOrderBy.Checked); } #endregion protected void GridViewEx1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes["onclick"] = null; for (int i = 0; i < e.Row.Cells.Count; i++) { //未办结 if (!String.IsNullOrEmpty(GridViewEx1.DataKeys[e.Row.RowIndex]["ActInst_ID"].ToString()) && i != 1) e.Row.Cells[i].Attributes.Add("onclick", "return WorkFlowPlatform_Transact(event,\"?" + ("ActInst_ID=") + GridViewEx1.DataKeys[e.Row.RowIndex]["ActInst_ID"].ToEncrypt() + "\",false);"); else if (i != 1) { //办结的调用本地 e.Row.Cells[i].Attributes.Add("onclick", GridViewEx1.GetOpenPopDialogClientScript( "Main.aspx?ProInst_ID=" + GridViewEx1.DataKeys[e.Row.RowIndex]["ProInst_ID"].ToEncrypt())); } } FixProInstCode(e.Row); switch (e.Row.Cells[8].Text) { case "正在受理": e.Row.Cells[8].Text = "制单中"; break; case "正在办理": e.Row.Cells[8].Text = "待审核"; break; } } } #region FixProInstCode private void FixProInstCode(GridViewRow Row) { int _ProInst_Name_ColumnIndex = 5; string _DataKeyValue = GridViewEx1.DataKeys[Row.RowIndex]["ActInst_State"].ToString(); if (!String.IsNullOrEmpty(_DataKeyValue)) { Enums.ActInstState _ActInstState = EnumHelper.ParseByDescription(_DataKeyValue); switch (_ActInstState) { case ActInstState.Normal: break; case ActInstState.OverRule: FixProInstCode(Row, _ProInst_Name_ColumnIndex, "退", "red"); break; case ActInstState.TurnOver: FixProInstCode(Row, _ProInst_Name_ColumnIndex, "移"); break; } } _DataKeyValue = GridViewEx1.DataKeys[Row.RowIndex]["ProInst_Type"].ToString(); if (!String.IsNullOrEmpty(_DataKeyValue)) { Enums.ProInstType _ProInstType = EnumHelper.ParseByDescription(_DataKeyValue); switch (_ProInstType) { case Enums.ProInstType.Assigned: FixProInstCode(Row, _ProInst_Name_ColumnIndex, "交", "grean"); break; case Enums.ProInstType.GreenChannel: FixProInstCode(Row, _ProInst_Name_ColumnIndex, "绿", "grean"); break; case Enums.ProInstType.Urgent: FixProInstCode(Row, _ProInst_Name_ColumnIndex, "急", "red"); break; case Enums.ProInstType.Normal: break; default: throw new Exception("未处理的Enums.ProInstType对象:" + _ProInstType.ToDescription() + "_" + _ProInstType.ToValue()); } } } private void FixProInstCode(GridViewRow Row, int index, string value, string color = "#ff5c00") { Row.Cells[index].Text = "[" + value + "] " + Row.Cells[index].Text; } #endregion protected void ButtonExport_Click(object sender, EventArgs e) { string WhereSql = string.Empty; string StrSql = ""; if (this.PassportInfo.UserName != "system" ) { StrSql = "HIGHWAY_STORAGE.V_PROINST"; } else StrSql = "HIGHWAY_STORAGE.V_PROINSTALL"; StrSql = @"SELECT CASE WHEN EXPENSEBILL_STATE = 2000 THEN EXPENSEBILL_CODE || '【废】' WHEN EXPENSEBILL_STATE = 3000 THEN EXPENSEBILL_CODE || '【银行付讫】' WHEN EXPENSEBILL_STATE = 4000 THEN EXPENSEBILL_CODE || '【现金付讫】' END AS 单据号, SERVERPART_NAME as 服务区, APPLY_STAFF as 经办人, CASE WHEN EXPENSEBILL_TYPE = 1000 THEN '差旅费报销单' WHEN EXPENSEBILL_TYPE = 2000 THEN '付款审批单' WHEN EXPENSEBILL_TYPE = 3000 THEN '费用报销单' END as 报销类型, PAYMENT_LOWER as 报销金额,CASE WHEN ActInst_Type = 1 THEN '制单中' WHEN ActInst_Type = 2 THEN '待审核' ELSE '已审结' END as 总销售额, User_Name as 待审核人,ActInst_Name as 待审环节名称, ActInst_StartDate as 提交时间,Prodef_Name as 流程名称,ProInst_FinishDate as 审结时间 FROM " + StrSql + " WHERE 1 = 1"; if (SERVERPART_ID.SelectedValue != "1=1") { WhereSql += " AND SERVERPART_ID = " + SERVERPART_ID.SelectedValue.ToDecrypt(); } if (EXPENSEBILL_TYPE.SelectedIndex > 0) { WhereSql += " AND EXPENSEBILL_TYPE = " + EXPENSEBILL_TYPE.SelectedValue; } if (Prodef_Name.SelectedIndex > 0) { WhereSql += " AND ProDef_ID = " + Prodef_Name.SelectedValue.ToDecrypt(); } //--只显示对应的办结信息 if (ProInst_State.Value != "-1") { WhereSql += " AND ProInst_State = " + ProInst_State.SelectedValue; } //服务区选择 if (SERVERPART_ID.SelectedIndex > 0 && SERVERPART_ID.SelectedValue != "1=1") { WhereSql += " AND SERVERPART_ID = " + SERVERPART_ID.SelectedValue.ToDecrypt(); } //else if (this.PassportInfo.UserName != "system" && !USER_NAME.Contains(PassportInfo.Name)) //{ // WhereSql += " AND (Division_Code IN (" + PassportInfo.CityAuthority + ") OR Division_Code IS NULL)"; //} ////过滤用户 //if (this.PassportInfo.UserName != "system" && !USER_NAME.Contains(PassportInfo.Name) && // !QYUSER_NAME.Contains(PassportInfo.Name)) //{ // WhereSql += " AND ACTINST_USER_ID = " + PassportInfo.ID; //} if (ActInst_Type.SelectedValue == "1" || ActInst_Type.SelectedValue == "2") { WhereSql += " AND ActInst_Type = " + ActInst_Type.SelectedValue; } else if (ActInst_Type.SelectedValue == "3") { WhereSql += " AND ActInst_Type IS NULL"; } else if (ActInst_Type.SelectedValue == "4") { WhereSql += " AND ActInst_Type IS NULL AND EXPENSEBILL_STATE = 1000"; } else if (ActInst_Type.SelectedValue == "5") { WhereSql += " AND ActInst_Type IS NULL AND EXPENSEBILL_STATE IN (3000,4000)"; } else if (ActInst_Type.SelectedValue == "6") { WhereSql += " AND ActInst_Type IS NULL AND EXPENSEBILL_STATE = 2000"; } DataTable _DataTable = (new HWSB.COMMODITY(this.Transaction)).ExecuteDataTable(StrSql + WhereSql + " ORDER BY SERVERPART_NAME,ProInst_FinishDate DESC"); //ExcelHelper _ExcelHelper = new ExcelHelper(); //_ExcelHelper.DataTableToExcel("结账数据导出", _DataTable, "结账数据", true); HideClientMask("正在导出..."); } } }