📄 pz_sh.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using com.unicafe.ui;
using com.unicafe.common;
using com.unicafe.security;
using com.ascs.plp.common;
using com.ascs.plp.publics;
namespace PLP.CWZZ.PZGL
{
/// <summary>
/// PZ_SH 的摘要说明。
/// </summary>
public class PZ_SH : com.unicafe.ui.UnicafePage
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.LinkButton LinkButton5;
protected System.Web.UI.WebControls.LinkButton LinkButton4;
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.Label Label4;
SqlConnection cn = new SqlConnection (com.unicafe.common.Configuration.GetDBConnectionString());
Com.Ascs.Plp.CW.CW_PZ CW_PZ = new Com.Ascs.Plp.CW.CW_PZ();
Com.Ascs.Plp.CW.CW_PZMgr CW_PZMgr = new Com.Ascs.Plp.CW.CW_PZMgr();
Com.Ascs.Plp.CW.CW_KMYE CW_KMYE = new Com.Ascs.Plp.CW.CW_KMYE();
Com.Ascs.Plp.CW.CW_KMYE CW_KMYEADD = new Com.Ascs.Plp.CW.CW_KMYE();
protected System.Web.UI.WebControls.DropDownList DDL_KJQJBH;
protected System.Web.UI.WebControls.DropDownList DDL_KJND;
protected System.Web.UI.WebControls.LinkButton LinkButton1;
protected System.Web.UI.WebControls.Panel PanelSH;
protected System.Web.UI.WebControls.LinkButton LinkButton2;
protected System.Web.UI.WebControls.Label Label6;
protected System.Web.UI.WebControls.Label Label7;
protected System.Web.UI.WebControls.Panel Panel1;
protected System.Web.UI.WebControls.Panel Panel2;
protected System.Web.UI.WebControls.Panel Panel3;
protected System.Web.UI.WebControls.Panel Panel4;
Com.Ascs.Plp.CW.CW_KMYEMgr CW_KMYEMgr = new Com.Ascs.Plp.CW.CW_KMYEMgr();
private void Page_Load(object sender, System.EventArgs e)
{
try
{
this.VerifyPage(); //登录检查
this.VerifyPage("zz_pzsh_mgr");
// 在此处放置用户代码以初始化页面
if(!this.IsPostBack) //判断第一次显示
{
this.Panel1.Visible=true;
this.Panel4.Visible=true;
this.Panel2.Visible=false;
this.Panel3.Visible=false;
ViewState["JGDM"]=this.CurrentJGXX.JGDM.ToString();
ViewState["EmployID"]=this.CurrentEmployee.EmplID;
this.Label1.Text=this.CurrentEmployee.EmplName;
ViewState["SH"]="0";
string[] DQKJ=this.GetDQKJQJ(this.CurrentJGXX.JGDM.ToString());
ViewState["KJND"]=DQKJ[1];
ViewState["KJQJBH"]=DQKJ[0];
ViewState["PZBH"]="0";
this.DDL_KJQJBHBind();
//ViewState["credit"] = credit; //首次加载时,将判断标志赋值给一个视图状态值保存在客户端z
ViewState["sql"]= string.Format("select * from CW_PZ where JGDM='{0}' and KJND ='{1}' and KJQJ='{2}' and GZBJ='0' and BZ='3' order by PZBH DESC",ViewState["JGDM"].ToString(),ViewState["KJND"].ToString(),ViewState["KJQJBH"].ToString()) ;
string sql = ViewState["sql"].ToString();
//处理DataGrid控件(绑定DataGrid控件 -> 检查是否需要定位 -> 给导航文本赋值)
if(CommonService.HandleDataGrid(this, sql, DataGrid1, "DataSH", Label2, Label3, Label4) == false)
this.Response.Redirect("../../publics/Error.aspx?errmsg=在处理数据时发生错误。");
}
else
{
//检查回发的请求操作是否是要进入上页或下页
if(CommonService.PageNavigate(this, DataGrid1, "DataSH", Label2, Label3, Label4) == false)
this.Response.Redirect("../../publics/Error.aspx?errmsg=在处理数据时发生错误。");
}
}
catch(Exception e1)
{
LogService.Write ("凭证显示时产生异常。");
LogService.Write (e1.Message);
Prompt.PromptError(this,"凭证显示时产生异常。");
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.DDL_KJND.SelectedIndexChanged += new System.EventHandler(this.DDL_KJND_SelectedIndexChanged);
this.DDL_KJQJBH.SelectedIndexChanged += new System.EventHandler(this.DDL_KJQJBH_SelectedIndexChanged);
this.LinkButton2.Click += new System.EventHandler(this.LinkButton2_Click);
this.LinkButton1.Click += new System.EventHandler(this.Linkbutton3_Click);
this.LinkButton5.Click += new System.EventHandler(this.LinkButton5_Click);
this.LinkButton4.Click += new System.EventHandler(this.LinkButton4_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Linkbutton3_Click(object sender, System.EventArgs e)
{
try
{
this.SH_Dispose(this.LinkButton1.Text.Trim());
}
catch(Exception e1)
{
string strErr=string.Format("{0}时产生异常。",this.LinkButton1.Text);
LogService.Write (strErr);
LogService.Write (e1.Message);
Prompt.PromptError(this,strErr);
}
}
private void DDL_KJNDBind(string KJND)
{
string strsql2=string.Format("SELECT KJND FROM CW_KJQJ where JGDM='{0}' GROUP BY KJND",ViewState["JGDM"].ToString());
DataTable dtKJND=this.CW_PZMgr.CreateDataTableFromSql(strsql2);
this.DDL_KJND.DataSource=dtKJND;
this.DDL_KJND.DataTextField="KJND";
this.DDL_KJND.DataValueField="KJND";
this.DDL_KJND.DataBind();
this.DDL_KJND.SelectedIndex=-1;
if(KJND.Trim()!=string.Empty)
this.DDL_KJND.Items.FindByValue(KJND.Trim()).Selected=true;
}
private void DDL_KJND_SelectedIndexChanged(object sender, System.EventArgs e)
{
try
{
ViewState["KJND"]=this.DDL_KJND.SelectedItem.ToString();
this.DDL_KJQJBH.SelectedIndex=0;
ViewState["KJQJBH"]=this.DDL_KJQJBH.SelectedItem.Value.ToString();
this.DDL_KJQJBHBind();
if(ViewState["SH"].ToString()=="0")
{
ViewState["sql"]=string.Format("select * from CW_PZ where JGDM='{0}' and KJND ='{1}' and KJQJ='{2}' and GZBJ='0' and BZ='3' order by PZBH DESC",ViewState["JGDM"].ToString(),ViewState["KJND"].ToString(),ViewState["KJQJBH"].ToString()) ;
}
else
{
ViewState["sql"]=string.Format("select * from CW_PZ where JGDM='{0}' and KJND ='{1}' and KJQJ='{2}' and GZBJ='1' order by PZBH DESC",ViewState["JGDM"].ToString(),ViewState["KJND"].ToString(),ViewState["KJQJBH"].ToString()) ;
}
//处理DataGrid控件(绑定DataGrid控件 -> 检查是否需要定位 -> 给导航文本赋值)
if(CommonService.HandleDataGrid(this, ViewState["sql"].ToString(), DataGrid1, "DataSH", Label2, Label3, Label4) == false)
this.Response.Redirect("../../publics/Error.aspx?errmsg=在处理数据时发生错误。");
}
catch(Exception e1)
{
LogService.Write ("会计年度选择时产生异常。");
LogService.Write (e1.Message);
Prompt.PromptError(this,"会计年度选择时产生异常。");
}
}
private void DDL_KJQJBHBind()
{
string strsql=string.Empty;
if(ViewState["KJND"]!=null)
{
strsql=string.Format(" Select * from CW_KJQJ where KJND='{0}' and JGDM='{1}' order by KSRQ",ViewState["KJND"].ToString(),ViewState["JGDM"].ToString());
this.DDL_KJNDBind(ViewState["KJND"].ToString());
}
DataTable dt=this.CW_KMYEMgr.CreateDataTableFromSql(strsql);
if(dt.Rows.Count>0)
{
this.DDL_KJQJBH.DataSource=dt;
this.DDL_KJQJBH.DataTextField="KJQJBH";
this.DDL_KJQJBH.DataValueField="KJQJBH";
this.DDL_KJQJBH.DataBind();
this.DDL_KJQJBH.SelectedIndex=-1;
if(ViewState["KJQJBH"]!=null&&ViewState["KJQJBH"].ToString().Trim()!=string.Empty)
this.DDL_KJQJBH.Items.FindByValue(ViewState["KJQJBH"].ToString().Trim()).Selected=true;
}
}
private void LinkButton4_Click(object sender, System.EventArgs e)
{
try
{
this.Panel1.Visible=false;
this.Panel4.Visible=false;
this.Panel2.Visible=true;
this.Panel3.Visible=true;
this.LinkButton1.Text="取消审核过帐";
ViewState["SH"]="1";
this.PanelSH.Visible=false;
ViewState["sql"]=string.Format("select * from CW_PZ where JGDM='{0}' and KJND ='{1}' and KJQJ='{2}' and GZBJ='1' order by PZBH DESC",ViewState["JGDM"].ToString(),ViewState["KJND"].ToString(),ViewState["KJQJBH"].ToString()) ;
//处理DataGrid控件(绑定DataGrid控件 -> 检查是否需要定位 -> 给导航文本赋值)
if(CommonService.ReBindDataGrid(this, ViewState["sql"].ToString(), DataGrid1, "DataSH", Label2, Label3, Label4) == false)
this.Response.Redirect("../../publics/Error.aspx?errmsg=在处理数据时发生错误。");
}
catch(Exception e1)
{
LogService.Write ("显示已审核过帐凭证时产生异常。");
LogService.Write (e1.Message);
Prompt.PromptError(this,"显示已审核过帐凭证时产生异常。");
}
}
private void LinkButton5_Click(object sender, System.EventArgs e)
{
try
{
this.Panel1.Visible=true;
this.Panel4.Visible=true;
this.Panel2.Visible=false;
this.Panel3.Visible=false;
this.LinkButton1.Text="审核过帐";
ViewState["SH"]="0";
this.PanelSH.Visible=true;
ViewState["sql"]=string.Format("select * from CW_PZ where JGDM='{0}' and KJND ='{1}' and KJQJ='{2}' and GZBJ='0' and BZ='3' order by PZBH DESC",ViewState["JGDM"].ToString(),ViewState["KJND"].ToString(),ViewState["KJQJBH"].ToString()) ;
//处理DataGrid控件(绑定DataGrid控件 -> 检查是否需要定位 -> 给导航文本赋值)
if(CommonService.ReBindDataGrid(this, ViewState["sql"].ToString(), DataGrid1, "DataSH", Label2, Label3, Label4) == false)
this.Response.Redirect("../../publics/Error.aspx?errmsg=在处理数据时发生错误。");
}
catch(Exception e1)
{
LogService.Write ("显示未审核过帐凭证时产生异常。");
LogService.Write (e1.Message);
Prompt.PromptError(this,"显示未审核过帐凭证时产生异常。");
}
}
private ArrayList GetPk(string CheckBoxName,string[] DataTypes,string[] Pk,DataGrid dg)
{
ArrayList ArPks=new ArrayList();
int n=0;
if(dg.Items.Count>0)
{
for (int i=0; i<dg.Items.Count; i++)
{
//将当前行赋值给一个DataGridItem对象
DataGridItem _item = dg.Items[i];
//判断当前行上的CheckBox控件赋值给一个CheckBox对象
CheckBox CheckFlag = (CheckBox)_item.FindControl(CheckBoxName);
//判断当前行上的复选框是否被选中,如果被选中则进行删除处理,否则不予处理
if(CheckFlag.Checked == true)
{
//获取关键字的值,逐个加入对象数组obj
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -