protected void query_Click(object sender, EventArgs e) { Label2.Text = ""; Label2.Visible = false; ProfitBudgetAdapter pba = new ProfitBudgetAdapter(); T_ProfitBudget item = new T_ProfitBudget(); sale_bill_no = this.txt_sale_bill_no.Text.Trim(); //判断是否提交过 DataSet ds = pba.getProfitBudgetSummaryByID(sale_bill_no); if (ds.Tables[0].Rows.Count > 0) { Label2.Text = "该销售订单号已经提交过利润预算!"; Label2.Visible = true; return; } item.SaleBillNo = sale_bill_no; ds = pba.getSEOrderInfo(item); if (ds.Tables[0].Rows.Count > 0) { finterid = Int32.Parse(ds.Tables[0].Rows[0][0].ToString()); show(ds); } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //翻译是否含税 bool sale_rate = e.Row.Cells[6].Text.Trim() == "True" ? true : false; if (sale_rate) { e.Row.Cells[6].Text = "是"; } else { e.Row.Cells[6].Text = "否"; } bool buy_rate = e.Row.Cells[8].Text.Trim() == "True" ? true : false; if (buy_rate) { e.Row.Cells[8].Text = "是"; } else { e.Row.Cells[8].Text = "否"; } //翻译业务部门和业务员 ProfitBudgetAdapter pba = new ProfitBudgetAdapter(); string dept_id = e.Row.Cells[1].Text.Trim(); string emp_id = e.Row.Cells[2].Text.Trim(); if (!string.IsNullOrEmpty(dept_id) && dept_id != " ") { string dept_name = pba.getDeptNameById(dept_id); if (!string.IsNullOrEmpty(dept_name)) { e.Row.Cells[1].Text = dept_name; } } if (!string.IsNullOrEmpty(emp_id) && emp_id != " ") { string emp_name = pba.getEmpNameById(emp_id); if (!string.IsNullOrEmpty(emp_name)) { e.Row.Cells[2].Text = emp_name; } } Label lbCommission = e.Row.Cells[20].FindControl("lbl_commission") as Label; decimal commission = 0; if (!string.IsNullOrEmpty(lbCommission.Text)) { commission = Decimal.Parse(lbCommission.Text); } commissionforAll += commission; } else if (e.Row.RowType == DataControlRowType.Footer) { e.Row.Cells[20].Text = commissionforAll.ToString("f3"); } }
protected void GridView2_SelectedIndexChanged(object sender, EventArgs e) { sale_bill_no = GridView2.SelectedRow.Cells[1].Text; this.txt_extra_charges.Text = GridView2.SelectedRow.Cells[2].Text; finterid = Int32.Parse((GridView2.SelectedRow.Cells[0].FindControl("hdf_finter_id") as HiddenField).Value); ProfitBudgetAdapter pba = new ProfitBudgetAdapter(); DataSet ds = pba.getProfitBudgetByID(finterid, sale_bill_no); show(GridView1, ds); }
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridView1.PageIndex = e.NewPageIndex; ProfitBudgetAdapter pba = new ProfitBudgetAdapter(); T_ProfitBudget item = new T_ProfitBudget(); sale_bill_no = this.txt_sale_bill_no.Text.Trim(); item.SaleBillNo = sale_bill_no; show(pba.getSEOrderInfo(item)); }
protected void btn_query_Click(object sender, EventArgs e) { string queryStr = this.txt_sale_bill_no.Text.Trim(); ProfitBudgetAdapter pba = new ProfitBudgetAdapter(); if (String.IsNullOrEmpty(queryStr)) { show(GridView2, pba.getProfitBudgetSummary()); } else { show(GridView2, pba.getProfitBudgetSummaryByID(queryStr)); } }
private string getEmpName(string emp_id) { string result = emp_id; ProfitBudgetAdapter pba = new ProfitBudgetAdapter(); if (!string.IsNullOrEmpty(emp_id) && emp_id != " ") { string emp_name = pba.getEmpNameById(emp_id); if (!string.IsNullOrEmpty(emp_name)) { result = emp_name; } } return(result); }
private string getDeptName(string dept_id) { string result = dept_id; ProfitBudgetAdapter pba = new ProfitBudgetAdapter(); if (!string.IsNullOrEmpty(dept_id) && dept_id != " ") { string dept_name = pba.getDeptNameById(dept_id); if (!string.IsNullOrEmpty(dept_name)) { result = dept_name; } } return(result); }
private void setData(string id) { if (string.IsNullOrEmpty(id)) { return; } ProfitBudgetAdapter pba = new ProfitBudgetAdapter(); DataSet head = pba.getProfitBudgetSummaryByID(id); lblt_sale_bill_no.Text = id; lbl_extra_charges.Text = Decimal.Parse(head.Tables[0].Rows[0]["extra_charges"].ToString()).ToString("f2"); DataSet list = pba.getProfitBudgetList(id); gridviewBind(list); }
protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e) { GridViewRow row = null; if (e.CommandName == "Delete") { string sale_bill_no = e.CommandArgument.ToString(); //获取当前行 Control cmdControl = e.CommandSource as Control; row = cmdControl.NamingContainer as GridViewRow; finterid = Int32.Parse((row.Cells[0].FindControl("hdf_finter_id") as HiddenField).Value); ProfitAccountingAdapter paa = new ProfitAccountingAdapter(); DataSet ds = paa.getProfitBudgetByID(finterid, sale_bill_no); List <T_ProfitBudgetList> lists = new List <T_ProfitBudgetList>(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { T_ProfitBudgetList list = new T_ProfitBudgetList(); DataRow dr = ds.Tables[0].Rows[i]; list.BuyFentryid = Int32.Parse(dr["Buy_FEntryID"].ToString()); list.SaleBillNo = dr["SEOrderID"].ToString(); list.BuyBillNo = dr["buy_bill_no"].ToString(); list.UnAccountingQty = decimal.Parse(dr["sale_qty"].ToString()); list.CheckStatus = false; lists.Add(list); } ProfitBudgetAdapter pba = new ProfitBudgetAdapter(); try { paa.deleteBySaleBillNo(sale_bill_no); pba.AddUnAccountingQtyBecauseDelete(lists); GridViewBind(); clean(); GridView1.DataSource = ""; GridView1.DataBind(); Label2.Visible = true; Label2.Text = "删除成功"; } catch (Exception ex) { Label2.Text = ex.Message; } } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //翻译是否含税 bool sale_rate = e.Row.Cells[6].Text.Trim() == "True" ? true : false; if (sale_rate) { e.Row.Cells[6].Text = "是"; } else { e.Row.Cells[6].Text = "否"; } bool buy_rate = e.Row.Cells[8].Text.Trim() == "True" ? true : false; if (buy_rate) { e.Row.Cells[8].Text = "是"; } else { e.Row.Cells[8].Text = "否"; } //翻译业务部门和业务员 ProfitBudgetAdapter pba = new ProfitBudgetAdapter(); string dept_id = e.Row.Cells[1].Text.Trim(); string emp_id = e.Row.Cells[2].Text.Trim(); if (!string.IsNullOrEmpty(dept_id)) { string dept_name = pba.getDeptNameById(dept_id); if (!string.IsNullOrEmpty(dept_name)) { e.Row.Cells[1].Text = dept_name; } } if (!string.IsNullOrEmpty(emp_id)) { string emp_name = pba.getEmpNameById(emp_id); if (!string.IsNullOrEmpty(emp_name)) { e.Row.Cells[2].Text = emp_name; } } } }
protected void btn_approve_Click(object sender, EventArgs e) { Button bt = sender as Button; string args = bt.CommandArgument.ToString(); GridViewRow row = bt.Parent.Parent as GridViewRow; string sale_bill_no = row.Cells[1].Text.ToString(); ProfitBudgetAdapter pba = new ProfitBudgetAdapter(); if (args == "Y") { pba.audit(sale_bill_no, true); } else { pba.audit(sale_bill_no, false); } GridViewBind(); }
protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Delete") { string sale_bill_no = e.CommandArgument.ToString(); ProfitBudgetAdapter pba = new ProfitBudgetAdapter(); try { pba.deleteBySaleBillNo(sale_bill_no); GridViewBind(); clean(); GridView1.DataSource = ""; GridView1.DataBind(); Label2.Visible = true; Label2.Text = "删除成功"; } catch (Exception ex) { Label2.Text = ex.Message; } } }
protected void submit_Click(object sender, EventArgs e) { ProfitBudgetAdapter pba = new ProfitBudgetAdapter(); //收集利润核算表头信息 T_ProfitAccounting item = new T_ProfitAccounting(); item.UpdateTime = DateTime.Now; decimal extra_charges = 0; if (!string.IsNullOrEmpty(txt_extra_charges.Text.Trim())) { extra_charges += Decimal.Parse(txt_extra_charges.Text.Trim()); } if (!string.IsNullOrEmpty(txt_extra_charges_lists_all.Text.Trim())) { extra_charges += Decimal.Parse(txt_extra_charges_lists_all.Text.Trim()); } item.ExtraCharges = extra_charges; item.FInterID = finterid; item.SaleBillNo = sale_bill_no; item.AuditState = false; item.IsActualAudit = false; //收集利润核算表体信息 List <T_ProfitAccountingList> lists = new List <T_ProfitAccountingList>(); List <T_ProfitBudgetList> pbls = new List <T_ProfitBudgetList>(); for (int i = 0; i <= GridView1.Rows.Count - 1; i++) { T_ProfitAccountingList list = new T_ProfitAccountingList(); T_ProfitBudgetList pbl = new T_ProfitBudgetList(); list.FInterID = Int32.Parse(((HiddenField)GridView1.Rows[i].Cells[18].FindControl("hdf_finter_id")).Value); list.SaleFentryid = Int32.Parse(((HiddenField)GridView1.Rows[i].Cells[18].FindControl("hdf_sale_fentry_id")).Value); list.BuyFentryid = Int32.Parse(((HiddenField)GridView1.Rows[i].Cells[18].FindControl("hdf_buy_fentry_id")).Value); list.FItemID = Int32.Parse(((HiddenField)GridView1.Rows[i].Cells[18].FindControl("hdf_fitem_id")).Value); list.SaleBillNo = sale_bill_no; list.BuyBillNo = GridView1.Rows[i].Cells[0].Text; list.FName = GridView1.Rows[i].Cells[1].Text; list.FNumber = GridView1.Rows[i].Cells[2].Text; list.DeptId = Int32.Parse(((HiddenField)GridView1.Rows[i].Cells[18].FindControl("hdf_dept_id")).Value); list.EmpId = Int32.Parse(((HiddenField)GridView1.Rows[i].Cells[18].FindControl("hdf_emp_id")).Value); list.SalePrice = Decimal.Parse(GridView1.Rows[i].Cells[3].Text); list.Currency = GridView1.Rows[i].Cells[4].Text; TextBox txt_exchange_rate = (TextBox)GridView1.Rows[i].Cells[5].FindControl("txt_exchange_rate"); if (string.IsNullOrEmpty(txt_exchange_rate.Text)) { list.ExchangeRate = 0; } else { list.ExchangeRate = Decimal.Parse(txt_exchange_rate.Text); } list.BuyPrice = Decimal.Parse(GridView1.Rows[i].Cells[7].Text); list.SaleQty = Decimal.Parse(GridView1.Rows[i].Cells[9].Text); list.BuyQty = Decimal.Parse(GridView1.Rows[i].Cells[10].Text); list.Accessory = (GridView1.Rows[i].Cells[11].FindControl("txt_accessory") as TextBox).Text; TextBox txt_accessory_price = GridView1.Rows[i].Cells[12].FindControl("txt_accessory_price") as TextBox; if (!String.IsNullOrEmpty(txt_accessory_price.Text)) { list.AccessoryPrice = Decimal.Parse(txt_accessory_price.Text); } else { list.AccessoryPrice = 0; } string length = (GridView1.Rows[i].Cells[13].FindControl("txt_length") as TextBox).Text; if (string.IsNullOrEmpty(length)) { list.Length = 0; } else { list.Length = Decimal.Parse(length); } string width = (GridView1.Rows[i].Cells[13].FindControl("txt_width") as TextBox).Text; if (string.IsNullOrEmpty(width)) { list.Width = 0; } else { list.Width = Decimal.Parse(width); } string height = (GridView1.Rows[i].Cells[13].FindControl("txt_height") as TextBox).Text; if (string.IsNullOrEmpty(height)) { list.Height = 0; } else { list.Height = Decimal.Parse(height); } string capacity = (GridView1.Rows[i].Cells[16].FindControl("txt_capacity") as TextBox).Text; if (string.IsNullOrEmpty(capacity)) { list.Capacity = 0; } else { list.Capacity = Decimal.Parse(capacity); } string estimate_freight_charge = (GridView1.Rows[i].Cells[15].FindControl("txt_estimate_freight_charge") as TextBox).Text; if (string.IsNullOrEmpty(estimate_freight_charge)) { list.EstimateFreightCharge = 0; } else { list.EstimateFreightCharge = Decimal.Parse(estimate_freight_charge); } string tax_rate = (GridView1.Rows[i].Cells[17].FindControl("txt_tax_rate") as TextBox).Text; if (string.IsNullOrEmpty(tax_rate)) { list.TaxRate = 0; } else { list.TaxRate = Decimal.Parse(tax_rate); } list.SaleRate = GridView1.Rows[i].Cells[6].Text == "是" ? true : false; list.BuyRate = GridView1.Rows[i].Cells[8].Text == "是" ? true : false; string profit = (GridView1.Rows[i].Cells[19].FindControl("lbl_profit") as Label).Text; if (string.IsNullOrEmpty(profit)) { list.Profit = 0; } else { list.Profit = Decimal.Parse(profit); } string volume = (GridView1.Rows[i].Cells[14].FindControl("lbl_volume") as Label).Text; if (string.IsNullOrEmpty(volume)) { list.Volume = 0; } else { list.Volume = Decimal.Parse(volume); } string return_rate = (GridView1.Rows[i].Cells[18].FindControl("txt_return_rate") as TextBox).Text; if (string.IsNullOrEmpty(return_rate)) { list.ReturnRate = 0; } else { list.ReturnRate = Decimal.Parse(return_rate); } Label lbCommission = GridView1.Rows[i].Cells[20].FindControl("lbl_commission") as Label; list.Commission = Decimal.Parse(lbCommission.Text); list.SEOrderID = GridView1.Rows[i].Cells[21].Text; lists.Add(list); pbl.BuyFentryid = list.BuyFentryid; pbl.SaleBillNo = list.SEOrderID; pbl.BuyBillNo = list.BuyBillNo; DataSet ds = pba.getProfitBudgetList(pbl); decimal un_accounting_qty = Decimal.Parse(ds.Tables[0].Rows[0]["un_accounting_qty"].ToString()); pbl.UnAccountingQty = un_accounting_qty - list.SaleQty; if (un_accounting_qty - list.SaleQty == 0) { pbl.CheckStatus = true; } else { pbl.CheckStatus = false; } pbls.Add(pbl); } try { //更新check_status字段为true,如果表体相关记录check_status字段全为true //var query1 = (from tt in pbls // where tt.CheckStatus == true // select tt.SaleBillNo).Distinct().ToList(); //var query2 = (from tt in pbls // where tt.CheckStatus == false // select tt.SaleBillNo).Distinct().ToList(); //var query = query1.Except(query2).ToList(); ProfitAccountingAdapter paa = new ProfitAccountingAdapter(); paa.addProfitBudgetHead(item); paa.addProfitBudgetList(lists); pba.updateList(pbls); Label2.Text = "保存成功!"; Label2.Visible = true; } catch (Exception ex) { Label2.Text = ex.Message; Label2.Visible = true; return; } }
private void GridViewBind() { ProfitBudgetAdapter pba = new ProfitBudgetAdapter(); show(GridView2, pba.getProfitBudgetSummary()); }
protected void submit_Click(object sender, EventArgs e) { //收集利润预算表头信息 T_ProfitBudget item = new T_ProfitBudget(); item.UpdateTime = DateTime.Now; decimal extra_charges = 0; if (!string.IsNullOrEmpty(txt_extra_charges.Text.Trim())) { extra_charges = Decimal.Parse(txt_extra_charges.Text.Trim()); } item.ExtraCharges = extra_charges; item.FInterID = finterid; item.SaleBillNo = sale_bill_no; item.AuditState = false; //收集利润预算表体信息 List <T_ProfitBudgetList> lists = new List <T_ProfitBudgetList>(); for (int i = 0; i <= GridView1.Rows.Count - 1; i++) { T_ProfitBudgetList list = new T_ProfitBudgetList(); list.FInterID = Int32.Parse(((HiddenField)GridView1.Rows[i].Cells[18].FindControl("hdf_finter_id")).Value); list.SaleFentryid = Int32.Parse(((HiddenField)GridView1.Rows[i].Cells[18].FindControl("hdf_sale_fentry_id")).Value); list.BuyFentryid = Int32.Parse(((HiddenField)GridView1.Rows[i].Cells[18].FindControl("hdf_buy_fentry_id")).Value); list.FItemID = Int32.Parse(((HiddenField)GridView1.Rows[i].Cells[18].FindControl("hdf_fitem_id")).Value); list.SaleBillNo = sale_bill_no; list.BuyBillNo = GridView1.Rows[i].Cells[0].Text; list.DeptId = Int32.Parse(GridView1.Rows[i].Cells[1].Text); list.EmpId = Int32.Parse(GridView1.Rows[i].Cells[2].Text); list.SalePrice = Decimal.Parse(GridView1.Rows[i].Cells[3].Text); list.Currency = GridView1.Rows[i].Cells[4].Text; TextBox txt_exchange_rate = (TextBox)GridView1.Rows[i].Cells[5].FindControl("txt_exchange_rate"); if (string.IsNullOrEmpty(txt_exchange_rate.Text)) { list.ExchangeRate = 0; } else { list.ExchangeRate = Decimal.Parse(txt_exchange_rate.Text); } list.BuyPrice = Decimal.Parse(GridView1.Rows[i].Cells[7].Text); list.SaleQty = Decimal.Parse(GridView1.Rows[i].Cells[9].Text); list.BuyQty = Decimal.Parse(GridView1.Rows[i].Cells[10].Text); list.Accessory = (GridView1.Rows[i].Cells[11].FindControl("txt_accessory") as TextBox).Text; TextBox txt_accessory_price = GridView1.Rows[i].Cells[12].FindControl("txt_accessory_price") as TextBox; if (!String.IsNullOrEmpty(txt_accessory_price.Text)) { list.AccessoryPrice = Decimal.Parse(txt_accessory_price.Text); } else { list.AccessoryPrice = 0; } string length = (GridView1.Rows[i].Cells[13].FindControl("txt_length") as TextBox).Text; if (string.IsNullOrEmpty(length)) { list.Length = 0; } else { list.Length = Decimal.Parse(length); } string width = (GridView1.Rows[i].Cells[13].FindControl("txt_width") as TextBox).Text; if (string.IsNullOrEmpty(width)) { list.Width = 0; } else { list.Width = Decimal.Parse(width); } string height = (GridView1.Rows[i].Cells[13].FindControl("txt_height") as TextBox).Text; if (string.IsNullOrEmpty(height)) { list.Height = 0; } else { list.Height = Decimal.Parse(height); } string capacity = (GridView1.Rows[i].Cells[16].FindControl("txt_capacity") as TextBox).Text; if (string.IsNullOrEmpty(capacity)) { list.Capacity = 0; } else { list.Capacity = Decimal.Parse(capacity); } string estimate_freight_charge = (GridView1.Rows[i].Cells[15].FindControl("txt_estimate_freight_charge") as TextBox).Text; if (string.IsNullOrEmpty(estimate_freight_charge)) { list.EstimateFreightCharge = 0; } else { list.EstimateFreightCharge = Decimal.Parse(estimate_freight_charge); } string tax_rate = (GridView1.Rows[i].Cells[17].FindControl("txt_tax_rate") as TextBox).Text; if (string.IsNullOrEmpty(tax_rate)) { list.TaxRate = 0; } else { list.TaxRate = Decimal.Parse(tax_rate); } list.SaleRate = GridView1.Rows[i].Cells[6].Text == "是" ? true : false; list.BuyRate = GridView1.Rows[i].Cells[8].Text == "是" ? true : false; string profit = (GridView1.Rows[i].Cells[18].FindControl("lbl_profit") as Label).Text; if (string.IsNullOrEmpty(profit)) { list.Profit = 0; } else { list.Profit = Decimal.Parse(profit); } string volume = (GridView1.Rows[i].Cells[14].FindControl("lbl_volume") as Label).Text; if (string.IsNullOrEmpty(volume)) { list.Volume = 0; } else { list.Volume = Decimal.Parse(volume); } string return_rate = (GridView1.Rows[i].Cells[18].FindControl("txt_return_rate") as TextBox).Text; if (string.IsNullOrEmpty(return_rate)) { list.ReturnRate = 0; } else { list.ReturnRate = Decimal.Parse(return_rate); } lists.Add(list); } try { ProfitBudgetAdapter pba = new ProfitBudgetAdapter(); pba.updateProfitBudgetHead(item); pba.updateProfitBudgetList(lists); Label2.Text = "保存成功!"; Label2.Visible = true; GridViewBind(); GridView2.SelectedIndex = -1; } catch (Exception ex) { Label2.Text = ex.Message; Label2.Visible = true; return; } }