以下是引用片段:
其主要代码实现如下: protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { if (DropDownList1.SelectedValue != "" && TextBox2.Text.Trim() != "") { //计算总重量和相关费用 DataTable tmprs = new DataTable(); tmprs = DataBase.Get_Table("select * from 配送路程费用,路程收费 where 配送路程费用.路程编号=路程收费.路程编号 and 配送路程费用.路程费用编号=" + DropDownList1.SelectedValue + ""); if (tmprs.Rows.Count > 0) { decimal monryzl = 0; DataTable tmprs1 = new DataTable(); tmprs1 = DataBase.Get_Table("select * from 重量收费 where 重量下限<=" + TextBox2.Text + " and 重量上限>=" + TextBox2.Text + ""); if (tmprs1.Rows.Count > 0) { monryzl = Convert.ToDecimal(tmprs1.Rows[0]["收费金额"].ToString()); } this.TextBox1.Text = Convert.ToString((Convert.ToDecimal(tmprs.Rows[0]["收费金额"].ToString()) + monryzl)); this.TextBox3.Text = this.TextBox1.Text; } } } protected void Button2_Click(object sender, EventArgs e) { //保存单据信息 Guid bookID = Guid.NewGuid(); DataTable tmprs = new DataTable(); tmprs = DataBase.Get_Table("select * from 托送货物临时单 where 帐号='" + Session["khid"].ToString() + "'"); //循环保存分单 if (tmprs.Rows.Count > 0) { for (int i = 0; i < tmprs.Rows.Count; i++) { DataBase.ExecSql("insert into 托送货物分单(货物托送编号,货物名称,货物规格,货物重量,类别编号,货物数量) values('" + bookID + "','" + tmprs.Rows[i]["货物名称"] + "','" + tmprs.Rows[i]["货物规格"] + "'," + tmprs.Rows[i]["货物重量"] + "," + tmprs.Rows[i]["类别编号"] + "," + tmprs.Rows[i]["货物数量"] + ")"); } } //保存货物托运单 DataBase.ExecSql("insert into 货物托送单(货物托送编号,帐号,托送时间,总重量,应收金额,实际收费,路程费用编号,接收标志,托运标志,托运标志原因) values('" + bookID + "','" + Session["khid"].ToString() + "','" + txtXm.Text + "'," + TextBox2.Text + "," + TextBox1.Text + "," + TextBox3.Text + "," + DropDownList1.SelectedValue + ",'未接收','提交托运','')"); DataBase.ExecSql("delete from 托送货物临时单 where 帐号='" + Session["khid"].ToString() + "'"); Response. }
|