?? supplierreportform.aspx.cs
字號:
?//文件名:SupplierReportForm.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class ClientManage_SupplierReportForm : System.Web.UI.Page
{
private static string MyDate;
private static string MySQL;
protected void Page_Load(object sender, EventArgs e)
{
string MyForbidString = Session["MyForbid"].ToString();
if (MyForbidString.IndexOf("A2") > 1)
{
Server.Transfer("~/SystemManage/AllErrorHelp.aspx");
}
}
protected void Button1_Click(object sender, EventArgs e)
{//查詢指定供應客戶
DataTable MyQueryTable = new System.Data.DataTable();
SqlConnection MyConnection = new SqlConnection();
MyConnection.ConnectionString = ConfigurationManager.ConnectionStrings["MySaleDBConnectionString"].ConnectionString;
MyConnection.Open();
MySQL = "SELECT 入庫日期,采購單號,應付金額,實付金額,支付方式,應付賬款,經辦人員,補充說明 FROM 采購信息 WHERE 入庫日期 BETWEEN '" + this.TextBox1.Text + "' AND '" + this.TextBox2.Text + "' AND 客戶名稱 LIKE '" + this.DropDownList1.SelectedValue.ToString() + "' ";
MyDate = "客戶名稱:" + this.DropDownList1.SelectedValue.ToString() + " 開始日期:" + this.TextBox1.Text + " 結束日期:" + this.TextBox2.Text;
SqlDataAdapter MyAdapter = new SqlDataAdapter(MySQL, MyConnection);
MyAdapter.Fill(MyQueryTable);
this.GridView1.DataSource=MyQueryTable;
this.GridView1.DataBind();
if (MyConnection.State == ConnectionState.Open)
{
MyConnection.Close();
}
}
protected void Button2_Click(object sender, EventArgs e)
{//查詢全部供應客戶
DataTable MyQueryTable = new System.Data.DataTable();
SqlConnection MyConnection = new SqlConnection();
MyConnection.ConnectionString = ConfigurationManager.ConnectionStrings["MySaleDBConnectionString"].ConnectionString;
MyConnection.Open();
MySQL = "SELECT 客戶名稱,入庫日期,采購單號,應付金額,實付金額,支付方式,應付賬款,經辦人員,補充說明 FROM 采購信息 WHERE 入庫日期 BETWEEN '" + this.TextBox1.Text + "' AND '" + this.TextBox2.Text + "'";
MyDate = "客戶名稱:公司全部供應客戶 開始日期:" + this.TextBox1.Text + " 結束日期:" + this.TextBox2.Text;
SqlDataAdapter MyAdapter = new SqlDataAdapter(MySQL, MyConnection);
MyAdapter.Fill(MyQueryTable);
this.GridView1.DataSource = MyQueryTable;
this.GridView1.DataBind();
if (MyConnection.State == ConnectionState.Open)
{
MyConnection.Close();
}
}
public string MyPrintSQL
{//設置要傳遞到打印頁的數據
get
{
return MySQL;
}
}
public String MyPrintDate
{//設置要傳遞到打印頁的數據
get
{
return MyDate;
}
}
public String MyPrintTitle
{//設置要傳遞到打印頁的數據
get
{
return Session["MyCompanyName"].ToString() + "供應客戶資金往來統計表";
}
}
protected void Button3_Click(object sender, EventArgs e)
{//打印供應客戶信息
Server.Transfer("~/ClientManage/SupplierReportPrint.aspx");
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -