salegatheringform.aspx.cs
来自「基于w/s模式的资产管理系统,可以参考参考,忘了什么时候从网络下的,还可以」· CS 代码 · 共 162 行
CS
162 行
//文件名:SaleGatheringForm.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 SaleManage_SaleGatheringForm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string MyForbidString = Session["MyForbid"].ToString();
if (MyForbidString.IndexOf("D3") > 1)
{
Server.Transfer("~/SystemManage/AllErrorHelp.aspx");
}
this.Button3.OnClientClick = "return confirm('请检查收到销售商品货款信息是否正确,一旦保存就无法修改,是否继续?')";
}
protected void Button1_Click(object sender, EventArgs e)
{//新增收款单
String MySQLConnectionString = ConfigurationManager.ConnectionStrings["MySaleDBConnectionString"].ConnectionString;
SqlConnection MyConnection = new SqlConnection(MySQLConnectionString);
MyConnection.Open();
string MySQL = "Select * From 销售信息 Where 销售单号='" + this.TextBox1.Text + "'";
SqlCommand MyCommand = new SqlCommand(MySQL, MyConnection);
if (MyCommand.ExecuteScalar() != null)
{
this.Page.RegisterStartupScript("msgOnlyAlert", "<script>alert('商品销售收款单号已经存在!')</script>");
this.TextBox1.Text = "";
}
if (MyConnection.State == ConnectionState.Open)
{
MyConnection.Close();
}
this.TextBox5.Text = "";
}
protected void Button3_Click(object sender, EventArgs e)
{//保存收款单
if (this.TextBox1.Text == "" || this.TextBox5.Text == "")
return;
String MySQLConnectionString = ConfigurationManager.ConnectionStrings["MySaleDBConnectionString"].ConnectionString;
string MySQL = "INSERT INTO 销售信息(销售单号,客户名称,应收金额,实收金额,收款方式,经办人员,出库日期,补充说明)VALUES('";
MySQL += this.TextBox1.Text + "','";
MySQL += this.TextBox5.Text + "','";
MySQL += "0','";
MySQL += this.TextBox3.Text + "','";
MySQL += this.DropDownList1.SelectedValue.ToString() + "','";
MySQL += this.TextBox4.Text + "','";
MySQL += this.TextBox2.Text + "','";
MySQL += this.TextBox9.Text + "');";
SqlConnection MyConnection = new SqlConnection(MySQLConnectionString);
MyConnection.Open();
SqlCommand MyCommand = MyConnection.CreateCommand();
MyCommand.CommandText = MySQL;
MyCommand.ExecuteNonQuery();
if (MyConnection.State == ConnectionState.Open)
{
MyConnection.Close();
}
this.TextBox1.Text = "";
this.TextBox5.Text = "";
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{//显示客户的收款银行及账户
this.TextBox5.Text = this.GridView1.SelectedRow.Cells[1].Text.ToString();
this.TextBox6.Text = this.GridView1.SelectedRow.Cells[7].Text.ToString();
this.TextBox7.Text = this.GridView1.SelectedRow.Cells[8].Text.ToString();
//获取应收货款总额
SqlConnection MyConnection = new SqlConnection();
MyConnection.ConnectionString = ConfigurationManager.ConnectionStrings["MySaleDBConnectionString"].ConnectionString;
MyConnection.Open();
string MySQL = "Select SUM(应收账款) From 销售信息 WHERE 客户名称='" + this.GridView1.SelectedRow.Cells[1].Text.ToString() + "'";
SqlCommand MyCommand = new SqlCommand(MySQL, MyConnection);
this.TextBox8.Text = MyCommand.ExecuteScalar().ToString();
if (MyConnection.State == ConnectionState.Open)
{
MyConnection.Close();
}
}
public String MyPrint销售收款单号
{//设置要传递到打印页的数据
get
{
return this.TextBox1.Text;
}
}
public String MyPrint客户名称
{//设置要传递到打印页的数据
get
{
return this.TextBox5.Text;
}
}
public String MyPrint应收金额
{//设置要传递到打印页的数据
get
{
return this.TextBox8.Text;
}
}
public String MyPrint实收金额
{//设置要传递到打印页的数据
get
{
return this.TextBox3.Text;
}
}
public String MyPrint收款方式
{//设置要传递到打印页的数据
get
{
return this.DropDownList1.SelectedValue.ToString();
}
}
public String MyPrint经办人员
{//设置要传递到打印页的数据
get
{
return this.TextBox4.Text;
}
}
public String MyPrint收款日期
{//设置要传递到打印页的数据
get
{
return this.TextBox2.Text;
}
}
public String MyPrint补充说明
{//设置要传递到打印页的数据
get
{
return this.TextBox9.Text;
}
}
public String MyPrint开户银行
{//设置要传递到打印页的数据
get
{
return this.TextBox6.Text;
}
}
public String MyPrint银行账号
{//设置要传递到打印页的数据
get
{
return this.TextBox7.Text;
}
}
protected void Button2_Click(object sender, EventArgs e)
{//打印收款单
Server.Transfer("~/SaleManage/SaleGatheringPrint.aspx");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?