buyerreportform.aspx.cs

来自「商品管理系统」· CS 代码 · 共 86 行

CS
86
字号
//文件名:BuyerReportForm.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_BuyerReportForm : 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("A4") > 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/BuyerReportPrint.aspx");
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?