//private void Gridview7_BL() //{ // Decimal TotalMoney = 0; // for (int i = 0; i < Gridview7.Rows.Count; i++) // { // TotalMoney += Convert.ToDecimal(this.Gridview7.Rows[i].Cells[11].Text.ToString()); // } // this.label_TotalMoney.Text = Convert.ToString(TotalMoney); //} //重置 protected void Button_Reset1(object sender, EventArgs e) { BindGridview1(""); UpdatePanel_PayBill.Update(); TextBox_Factory.Text = ""; TextBox1.Text = ""; TextBox2.Text = ""; UpdatePanel_SPayBillSearch.Update(); }
protected void Button_Sh2(object sender, EventArgs e) { string condition = Getcondition(); BindGridview1(condition); UpdatePanel_PayBill.Update(); Panel_NewPayBill.Visible = false; UpdatePanel_NewPayBill.Update(); Panel_Supply.Visible = false; UpdatePanel_Supply.Update(); Panel_Pay.Visible = false; UpdatePanel_Pay.Update(); Panel_NewPay.Visible = false; UpdatePanel_NewPay.Update(); }
protected void Page_Load(object sender, EventArgs e) { if (!(Session["UserRole"].ToString().Contains("采购付款"))) { Response.Redirect("~/Default.aspx"); } if (!IsPostBack) { Title = "采购付款"; BindGridview1(""); foreach (GridViewRow item in Gridview1.Rows) { PMPaymentBillinfo.PMPB_ID = new Guid(Gridview1.DataKeys[item.RowIndex]["PMPB_ID"].ToString()); PMPaymentBillinfo.PMSI_ID = new Guid(Gridview1.DataKeys[item.RowIndex]["PMSI_ID"].ToString()); ppb.UpdatePMPaymentBill(PMPaymentBillinfo); } BindGridview1(""); UpdatePanel_PayBill.Update(); } }
//提交新增 protected void Button_Rocky(object sender, EventArgs e) { string condition = "and PMPaymentBill.PMSI_ID='" + label_SupplyID.Text.ToString() + "'"; DataSet ds = ppb.SelectPMPaymentBill(condition); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { ScriptManager.RegisterClientScriptBlock(UpdatePanel_NewPayBill, GetType(), "aa", "alert('该供应商已存在!')", true); return; } else { PMPaymentBillinfo.PMSI_ID = new Guid(label_SupplyID.Text.ToString()); PMPaymentBillinfo.PMPB_Due = 0; //应付款 PMPaymentBillinfo.PMPB_TotalDebt = 0; //总欠款 PMPaymentBillinfo.PMPB_TotalBill = 0; //开票总额 PMPaymentBillinfo.PMPB_TotalPaided = 0; //已付款 ppb.InsertPMPaymentBill(PMPaymentBillinfo); BindGridview1(""); foreach (GridViewRow item in Gridview1.Rows) { PMPaymentBillinfo.PMPB_ID = new Guid(Gridview1.DataKeys[item.RowIndex]["PMPB_ID"].ToString()); PMPaymentBillinfo.PMSI_ID = new Guid(Gridview1.DataKeys[item.RowIndex]["PMSI_ID"].ToString()); ppb.UpdatePMPaymentBill(PMPaymentBillinfo); } BindGridview1(""); UpdatePanel_PayBill.Update(); TextBox6.Text = ""; Panel_NewPayBill.Visible = false; UpdatePanel_NewPayBill.Update(); ScriptManager.RegisterClientScriptBlock(UpdatePanel_NewPayBill, GetType(), "aa", "alert('新增成功!')", true); return; } }
//提交付款 protected void Button_Kity(object sender, EventArgs e) { if (TextBox3.Text != "") { PMPaymentBillinfo.PMPD_Pay = Convert.ToDecimal(TextBox3.Text.ToString()); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel_NewPay, GetType(), "alert", "alert('请填写付款金额!')", true); return; } if (DropDownList1.SelectedValue != "请选择") { PMPaymentBillinfo.PMPD_PayWay = DropDownList1.SelectedValue.ToString(); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel_NewPay, GetType(), "alert", "alert('请选择付款方式!')", true); return; } if (TextBox5.Text != "") { PMPaymentBillinfo.PMPD_PayTime = Convert.ToDateTime(TextBox5.Text.ToString()); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel_NewPay, GetType(), "alert", "alert('请填写付款日期!')", true); return; } bool temp = false; Decimal dl = 0; Decimal dml = Convert.ToDecimal(TextBox3.Text.ToString()); //foreach (GridViewRow item in Gridview5.Rows) //{ //CheckBox rb = item.FindControl("CheckBoxMarry") as CheckBox; //if (rb.Checked) //{ dl = Convert.ToDecimal(Gridview7.Rows[Gridview7.SelectedIndex].Cells[6].Text.ToString()); temp = true; if (dml == dl) //金额相等 { label_PurchaseOrderID.Text = Gridview7.DataKeys[Gridview7.SelectedIndex].Value.ToString(); PMPaymentBillinfo.PMPO_PurchaseOrderID = new Guid(label_PurchaseOrderID.Text); PMPaymentBillinfo.PMPO_AlreadyPay = "是"; PMPaymentBillinfo.PMPO_ResidueMoney = 0; ppb.UpdatePMPO_AlreadyPay(PMPaymentBillinfo); } if (dml < dl) //付款金额小于勾选订单的剩余付款 { label_PurchaseOrderID.Text = Gridview7.DataKeys[Gridview7.SelectedIndex].Value.ToString(); PMPaymentBillinfo.PMPO_PurchaseOrderID = new Guid(label_PurchaseOrderID.Text); PMPaymentBillinfo.PMPO_AlreadyPay = "否"; PMPaymentBillinfo.PMPO_ResidueMoney = dl - dml; ppb.UpdatePMPO_AlreadyPay(PMPaymentBillinfo); } if (dml > dl) //付款金额大于采购订单的剩余付款 { ScriptManager.RegisterClientScriptBlock(Page, GetType(), "aa", "alert('付款金额大于采购订单剩余付款金额!')", true); return; } //dml = dml - dl; //} //} string stg = "and PMPO_PurchaseOrderID='" + new Guid(Gridview7.DataKeys[Gridview7.SelectedIndex].Value.ToString()) + "'"; DataSet dss = ppb.SelectPMPurchaseOrder(stg); DataTable dtt = dss.Tables[0]; if (dtt.Rows.Count > 0) { label_SupplyID.Text = dtt.Rows[0][1].ToString(); } string condition = "and PMPaymentBill.PMSI_ID='" + new Guid(label_SupplyID.Text) + "'"; DataSet ds = ppb.SelectPMPaymentBill(condition); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { label_PayBillID.Text = dt.Rows[0][0].ToString(); } PMPaymentBillinfo.PMPB_ID = new Guid(label_PayBillID.Text); if (label_Pay.Text == "新增") { //if (!temp) //{ // ScriptManager.RegisterClientScriptBlock(this.UpdatePanel_NewPay, this.GetType(), "aa", "alert('请选择采购订单')", true); // return; //} //else //{ ppb.UpdatePMPaymentBill_Payment(PMPaymentBillinfo); PMPaymentBillinfo.PMPD_Man = Session["UserName"].ToString(); ppb.InsertPMPaymentIDetail(PMPaymentBillinfo); //} } if (label_Pay.Text == "修改") { PMPaymentBillinfo.PMPD_ID = new Guid(label_PayID.Text); PMPaymentBillinfo.PMPB_ID = new Guid(label_PayBillID.Text); BindGridview2(PMPaymentBillinfo); UpdatePanel_Pay.Update(); PMPaymentBillinfo.PMPD_Pay = Convert.ToDecimal(Convert.ToDecimal(TextBox3.Text.ToString()) - Convert.ToDecimal(label_PayMoney.Text)); ppb.UpdatePMPaymentIDetail(PMPaymentBillinfo); } TextBox3.Text = ""; DropDownList1.SelectedValue = "请选择"; TextBox5.Text = ""; Panel_NewPay.Visible = false; UpdatePanel_NewPay.Update(); BindGridview1(""); UpdatePanel_PayBill.Update(); BindGridview7(""); UpdatePanel3.Update(); }