protected void btnClose_Click(object sender, EventArgs e) { CG_POOrderService POOrderSer = new CG_POOrderService(); System.Data.DataTable dt = DBHelp.getDataTable("select pono from CG_POOrder where IFZhui=0"); foreach (System.Data.DataRow dr in dt.Rows) { POOrderSer.GetOrder_ToInvoiceAndUpdatePoStatus(dr[0].ToString()); //POOrderSer.SellOrderUpdatePoStatus2(dr[0].ToString()); } base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('更新成功!');</script>"); }
protected void gvMain_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "select") { CG_POOrder model = new CG_POOrderService().GetModel(Convert.ToInt32(e.CommandArgument)); if (model != null) { txtPONo.Text = model.PONo; ttxPOName.Text = model.POName; } } }
protected void gvMain_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "select") { var pono = DBHelp.ExeScalar("select pono from Sell_OrderFP where id=" + e.CommandArgument); CG_POOrderService orderSer = new CG_POOrderService(); string sql = string.Format("select sum(Total) from Sell_OrderFP where pono='{0}' and Status='通过'", pono); try { lblTotal.Text = DBHelp.ExeScalar(sql).ToString(); } catch (Exception) { lblTotal.Text = "0"; } var list = orderSer.GetOrder_ToInvoice_1(string.Format(" PONo='{0}'", pono)); if (list.Count > 0) { lblPOTotal.Text = "项目(" + pono + ")---" + (list[0].POTotal - list[0].TuiTotal).ToString(); } else { lblPOTotal.Text = "0"; } List <Sell_OrderFPs> orders = ordersSer.GetListArray(" 1=1 and Sell_OrderFPs.id=" + e.CommandArgument); ViewState["Orders"] = orders; gvList.DataSource = orders; gvList.DataBind(); } else if (e.CommandName == "ReEdit") { //是否是此单据的申请人 var model = POSer.GetModel(Convert.ToInt32(e.CommandArgument)); if (Session["currentUserId"].ToString() != model.CreateUserId.ToString()) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('必须由原单据申请人 重新发起,其他人不能重新提交编辑!');</script>"); return; } //首先单子要先通过 if (model != null && model.Status == "执行中") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('此单据还在执行中不能编辑!');</script>"); return; } //string check = string.Format("select count(*) from Sell_OrderFPBack where FPNo in ( select FPNo from Sell_OrderFP where id={0})", model.Id); //if (Convert.ToInt32(DBHelp.ExeScalar(check)) > 0) //{ // base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('发票签回单需要删除!');</script>"); // return; //} // check = string.Format("select count(*) from TB_ToInvoice where FPId={0}", model.Id); //if (Convert.ToInt32(DBHelp.ExeScalar(check)) > 0) //{ // base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('此单据已经被用款单使用!');</script>"); // return; //} string type = "销售发票"; if (model.NowGuid != "") { type = "销售发票修改"; } string sql = string.Format("select pro_Id from A_ProInfo where pro_Type='{0}'", type); string efromId = string.Format("select id from tb_EForm where alle_id={0} and proId=(select pro_Id from A_ProInfo where pro_Type='{1}')", e.CommandArgument, type); string url = "~/JXC/WFSell_OrderFP.aspx?ProId=" + DBHelp.ExeScalar(sql) + "&allE_id=" + e.CommandArgument + "&EForm_Id=" + DBHelp.ExeScalar(efromId) + "&&ReAudit=true"; Response.Redirect(url); } else if (e.CommandName == "Del") { //是否是此单据的申请人 var model = POSer.GetModel(Convert.ToInt32(e.CommandArgument)); if (Session["currentUserId"].ToString() != model.CreateUserId.ToString()) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('必须由原单据申请人 重新发起,其他人不能重新提交编辑!');</script>"); return; } //首先单子要先通过 if (model != null && model.Status == "执行中") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('此单据还在执行中不能编辑!');</script>"); return; } string check = string.Format("select count(*) from TB_ToInvoice where FPId={0} AND State<>'不通过'", model.Id); if (Convert.ToInt32(DBHelp.ExeScalar(check)) > 0) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('有到款记录,请先删除到款!');</script>"); return; } check = string.Format(" select count(*) from TB_ToInvoice where FPNo = '{0}' AND State<>'不通过'", model.FPNo); if (Convert.ToInt32(DBHelp.ExeScalar(check)) > 0) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('有到款记录,请先删除到款!');</script>"); return; } //string check = string.Format("select count(*) from Sell_OrderFPBack where FPNo in ( select FPNo from Sell_OrderFP where id={0})", model.Id); //if (Convert.ToInt32(DBHelp.ExeScalar(check)) > 0) //{ // base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('发票签回单需要删除!');</script>"); // return; //} // check = string.Format("select count(*) from TB_ToInvoice where FPId={0}", model.Id); //if (Convert.ToInt32(DBHelp.ExeScalar(check)) > 0) //{ // base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('此单据已经被用款单使用!');</script>"); // return; //} string type = "销售发票"; if (model.NowGuid != "") { type = "销售发票修改"; } string sql = string.Format("select pro_Id from A_ProInfo where pro_Type='{0}'", type); string efromId = string.Format("select id from tb_EForm where alle_id={0} and proId=(select pro_Id from A_ProInfo where pro_Type='{1}')", e.CommandArgument, type); var id = DBHelp.ExeScalar(efromId).ToString(); var aa = DBHelp.ExeScalar(string.Format("select top 1 id from tb_EForm where allE_id={0} and proId=37", model.Id)); if (aa != null && aa != DBNull.Value) { id = aa.ToString(); } string url = "~/JXC/WFSell_OrderFP.aspx?ProId=37&allE_id=" + e.CommandArgument + "&EForm_Id=" + id + "&&IsDelete=true"; Response.Redirect(url); } }
protected void gvMain_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "select") { var pono = DBHelp.ExeScalar("select pono from Sell_OrderFP where id=" + e.CommandArgument); CG_POOrderService orderSer = new CG_POOrderService(); string sql = string.Format("select sum(Total) from Sell_OrderFP where pono='{0}' and Status='通过'", pono); try { lblTotal.Text = DBHelp.ExeScalar(sql).ToString(); } catch (Exception) { lblTotal.Text = "0"; } var list = orderSer.GetOrder_ToInvoice_1(string.Format(" PONo='{0}'", pono)); if (list.Count > 0) { lblPOTotal.Text = "项目(" + pono + ")---" + (list[0].POTotal - list[0].TuiTotal).ToString(); } else { lblPOTotal.Text = "0"; } List <Sell_OrderFPs> orders = ordersSer.GetListArray(" 1=1 and Sell_OrderFPs.id=" + e.CommandArgument); ViewState["Orders"] = orders; gvList.DataSource = orders; gvList.DataBind(); } else if (e.CommandName == "ReEdit") { //是否是此单据的申请人 var model = POSer.GetModel(Convert.ToInt32(e.CommandArgument)); if (Session["currentUserId"].ToString() != model.CreateUserId.ToString()) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('必须由原单据申请人 重新发起,其他人不能重新提交编辑!');</script>"); return; } //首先单子要先通过 if (model != null && model.Status == "通过") { } else { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('此单据必须已经审批通过才能重新编辑!');</script>"); return; } string check = string.Format("select count(*) from TB_ToInvoice where FPId={0}", model.Id); if (Convert.ToInt32(DBHelp.ExeScalar(check)) > 0) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('此单据已经被用款单使用!');</script>"); return; } string sql = "select pro_Id from A_ProInfo where pro_Type='销售发票'"; string efromId = string.Format("select id from tb_EForm where alle_id={0} and proId=(select pro_Id from A_ProInfo where pro_Type='销售发票')", e.CommandArgument); string url = "~/JXC/WFSell_OrderFP.aspx?ProId=" + DBHelp.ExeScalar(sql) + "&allE_id=" + e.CommandArgument + "&EForm_Id=" + DBHelp.ExeScalar(efromId) + "&&ReAudit=true&Tui=true"; Response.Redirect(url); //没有做过检验单 } }
public bool FormCheck() { #region 设置自己要判断的信息 if (txtName.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写姓名!');</script>"); txtName.Focus(); return(false); } if (txtDateTime.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写日期!');</script>"); txtDateTime.Focus(); return(false); } if (CommHelp.VerifesToDateTime(txtDateTime.Text.Trim()) == false) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('日期 格式错误!');</script>"); return(false); } if (Request["allE_id"] == null)//单据增加 { if (txtPONo.Text == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请选择项目信息!');</script>"); txtPONo.Focus(); return(false); } if (CG_POOrderService.IsClosePONO(txtPONo.Text)) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('此项目已经关闭!');</script>"); return(false); } } if (txtPostAddress.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写邮寄地址!');</script>"); txtPostAddress.Focus(); return(false); } if (ddlPers.Visible == false && ddlResult.SelectedItem != null && ddlResult.SelectedItem.Text == "通过") { if (txtWuliuName.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写物流名称!');</script>"); txtPostCode.Focus(); return(false); } if (txtPostCode.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写邮件编码!');</script>"); txtPostCode.Focus(); return(false); } } if (txtToPer.Text == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写收件人!');</script>"); txtToPer.Focus(); return(false); } if (ddlPers.Visible == true && ddlPers.SelectedItem == null) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请选择下一步审核人!');</script>"); ddlPers.Focus(); return(false); } if (DBHelp.ExeScalar(string.Format("select ID from tb_User where loginName='{0}'", txtName.Text)) == null) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('你填写的姓名在用户中不存在!');</script>"); txtName.Focus(); return(false); } #endregion if (plEmail.Visible == true && ddlResult.SelectedItem != null && ddlResult.SelectedItem.Text == "通过") { if (txtPostCode.Text == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写物流编号!');</script>"); txtPostCode.Focus(); return(false); } if (txtPostTotal.Text == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写金额!');</script>"); txtPostTotal.Focus(); return(false); } if (txtPostTotal.Text != "") { try { Convert.ToDecimal(txtPostTotal.Text); } catch (Exception) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('你填写的金额格式有误!');</script>"); txtPostTotal.Focus(); return(false); } } } return(true); }
public bool FormCheck() { if (this.txtBusCardDate.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写日期!');</script>"); this.txtBusCardDate.Focus(); return(false); } if (CommHelp.VerifesToDateTime(txtBusCardDate.Text.Trim()) == false) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('日期 格式错误!');</script>"); return(false); } if (this.txtUseTotal.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填金额!');</script>"); this.txtUseTotal.Focus(); return(false); } try { Convert.ToDecimal(txtUseTotal.Text); } catch (Exception) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('你填写的数字格式有误!');</script>"); txtUseTotal.Focus(); return(false); } if (txtPONo.Text == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请选择项目信息!');</script>"); txtPONo.Focus(); return(false); } if (new CG_POOrderService().ExistPONO(txtPONo.Text) == false) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('项目信息不存在!');</script>"); return(false); } if (CG_POOrderService.IsClosePONO(txtPONo.Text)) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('此项目已经关闭!');</script>"); return(false); } if (CG_POOrderService.IsSpecialPONO(txtPONo.Text, txtPOName.Text)) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('特殊订单无法计入费用!');</script>"); return(false); } return(true); }
public bool FormCheck() { if (txtPONo.Text == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请选择项目信息!');</script>"); txtPONo.Focus(); return(false); } #region 设置自己要判断的信息 if (txtDepartName.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写部门!');</script>"); txtDepartName.Focus(); return(false); } if (txtName.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写姓名!');</script>"); txtName.Focus(); return(false); } if (ddlUser.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写客户代表!');</script>"); ddlUser.Focus(); return(false); } if (txtForm.Text.Trim() == "" || txtTo.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写请假时间!');</script>"); txtForm.Focus(); return(false); } if (ddlPers.Visible == true && ddlPers.SelectedItem == null) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请选择下一步审核人!');</script>"); ddlPers.Focus(); return(false); } txtForm.Text = txtForm.Text.Trim().Replace(':', ':'); txtForm.Text = txtForm.Text.Trim().Replace('。', ':'); txtForm.Text = txtForm.Text.Trim().Replace('.', ':'); txtTo.Text = txtTo.Text.Trim().Replace(':', ':'); txtTo.Text = txtTo.Text.Trim().Replace('.', ':'); txtTo.Text = txtTo.Text.Trim().Replace('。', ':'); if (CommHelp.VerifesToDateTime(txtForm.Text.Trim()) == false) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请假时间 格式错误!');</script>"); return(false); } if (CommHelp.VerifesToDateTime(txtTo.Text.Trim()) == false) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请假时间 格式错误!');</script>"); return(false); } try { if (Convert.ToDateTime(txtForm.Text) >= Convert.ToDateTime(txtTo.Text)) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('开始时间不能大于结束时间!');</script>"); txtForm.Focus(); return(false); } } catch (Exception) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('你填写的时间格式有误!');</script>"); txtForm.Focus(); return(false); } if (DBHelp.ExeScalar(string.Format("select ID from tb_User where loginName='{0}'", txtName.Text)) == null) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('你填写申请用户不存在!');</script>"); txtForm.Focus(); return(false); } #endregion if (txtTotal.ReadOnly == false && txtTotal.Text == "" && ddlPers.Visible == false && ddlResult.Text == "通过") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写金额!');</script>"); txtForm.Focus(); return(false); } if (ddlResult.Text == "通过" && txtTotal.Text.Trim() != "") { try { Convert.ToDecimal(txtTotal.Text); } catch (Exception) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('你填写的金额有误!');</script>"); txtTotal.Focus(); return(false); } } if (CG_POOrderService.IsClosePONO(txtPONo.Text)) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('此项目已经关闭!');</script>"); return(false); } if (CG_POOrderService.IsSpecialPONO(txtPONo.Text, txtPOName.Text)) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('特殊订单无法计入费用!');</script>"); return(false); } return(true); }
private void LoadExcel(string fileAddress) { string strConn; strConn = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + fileAddress + "; Extended Properties='Excel 12.0 Xml;HDR=YES;IMEX=1'"; OleDbConnection conn = new OleDbConnection(strConn); conn.Open(); DataTable sheetNames = conn.GetOleDbSchemaTable (OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" }); int allSheets = 0; foreach (DataRow rowTable in sheetNames.Rows) { string sheetName = rowTable["TABLE_NAME"].ToString(); conn = new OleDbConnection(strConn); conn.Open(); OleDbCommand objCommand = new OleDbCommand(string.Format("select * from [" + sheetName + "]"), conn); int rowIndex = 1; BankFlowService bandFlowService = new BankFlowService(); PetitionsService petSer = new PetitionsService(); CG_POOrderService POSer = new CG_POOrderService(); CAI_POCaiService pocaiSer = new CAI_POCaiService(); using (SqlConnection sqlconn = DBHelp.getConn()) { sqlconn.Open(); SqlCommand sqlCommand = sqlconn.CreateCommand(); using (OleDbDataReader dataReader = objCommand.ExecuteReader()) { while (dataReader.Read()) { //if (rowIndex > 1) //{ // Petitions model = new Petitions(); // model.Number = dataReader[0].ToString(); // model.Type = dataReader[1].ToString(); // model.OldIndex = dataReader[2].ToString(); // var ojb = dataReader[3]; // if (ojb != null && ojb != DBNull.Value) // { // model.SignDate = Convert.ToDateTime(ojb); // } // model.PoNo = dataReader[4].ToString(); // model.Summary = dataReader[5].ToString(); // ojb = dataReader[6]; // if (ojb != null && ojb != DBNull.Value) // { // model.SumPages = Convert.ToInt32(ojb); // } // model.Local = dataReader[7].ToString(); // model.L_Year = Convert.ToInt32(dataReader[8]); // model.L_Month = Convert.ToInt32(dataReader[9]); // model.Remark = dataReader[10].ToString(); // model.SumCount = 1; // model.BCount = 1; // model.Handler = "王汉中"; // var poList = POSer.GetSimpListArray(string.Format("and pono='{0}'", model.PoNo), sqlCommand); // if (poList.Count > 0) // { // CG_POOrder poorderModel = poList[0]; // model.AE = poorderModel.AE; // model.GuestName = poorderModel.GuestName; // model.Name = poorderModel.POName; // //var supplierList = pocaiSer.GetLastSupplier(string.Format("'{0}'", model.PoNo), sqlCommand); // //model.SalesUnit = string.Join(",", supplierList.Select(t => t.Supplier).ToArray()); // //model.Total = supplierList.Sum(t => t.Total); // } // petSer.Add(model,sqlCommand); //} if (rowIndex > 8) { BankFlow model = new BankFlow(); model.TransactionType = dataReader[0].ToString(); if (model.TransactionType == "") { continue; } model.BusinessType = dataReader[1].ToString(); model.PayerAccountBank = dataReader[3].ToString(); model.DebitAccountNo = dataReader[4].ToString(); model.OutPayerName = dataReader[5].ToString(); model.BeneficiaryAccountBank = dataReader[7].ToString(); model.PayeeAccountNumber = dataReader[8].ToString(); model.InPayeeName = dataReader[9].ToString(); DateTime dt = DateTime.ParseExact(dataReader[10].ToString(), "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture); model.TransactionDate = Convert.ToDateTime(dt.ToString("yyyy-MM-dd") + " " + dataReader[11]); model.TradeCurrency = dataReader[12].ToString(); model.TradeAmount = Convert.ToDecimal(dataReader[13]); model.AfterTransactionBalance = Convert.ToDecimal(dataReader[14]); model.TransactionReferenceNumber = dataReader[17].ToString(); model.VoucherType = dataReader[20].ToString(); model.Reference = dataReader[23].ToString(); model.Purpose = dataReader[24].ToString(); model.Remark = dataReader[25].ToString(); model.Remarks = dataReader[26].ToString(); //判断是否重复 string sql = string.Format("SELECT top 1 ID FROM [BankFlow] WHERE TransactionReferenceNumber='{0}'", model.TransactionReferenceNumber); sqlCommand.CommandText = sql; var resultId = sqlCommand.ExecuteScalar(); if (!(resultId is DBNull) && resultId != null) { model.Id = Convert.ToInt32(resultId); bandFlowService.Update(model, sqlCommand); } else { bandFlowService.Add(model, sqlCommand); } } rowIndex++; } } sqlconn.Close(); } } }
protected void gvList_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "ReEdit") { //是否是此单据的申请人 var model = toInvoSerSer.GetModel(Convert.ToInt32(e.CommandArgument)); //首先单子要先通过 if (model != null && model.State == "通过") { } else { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('此单据必须已经审批通过才能重新编辑!');</script>"); return; } string sql = "select pro_Id from A_ProInfo where pro_Type='到款单'"; string efromId = string.Format("select id from tb_EForm where alle_id={0} and proId=(select pro_Id from A_ProInfo where pro_Type='到款单')", e.CommandArgument); string url = "~/EFrom/WFToInvoice.aspx?ProId=" + DBHelp.ExeScalar(sql) + "&allE_id=" + e.CommandArgument + "&EForm_Id=" + DBHelp.ExeScalar(efromId) + "&&ReAudit=true"; Response.Redirect(url); //没有做过检验单 } if (e.CommandName == "select") { string[] PONo_Id = e.CommandArgument.ToString().Split('_'); CG_POOrderService orderSer = new CG_POOrderService(); var list = orderSer.GetOrder_ToInvoice_1(string.Format(" PONo='{0}'", PONo_Id[0])); if (list.Count > 0) { lblPOTotal.Text = "项目(" + PONo_Id[0] + ")---" + string.Format("{0:n2}", list[0].POTotal - list[0].TuiTotal); lblWeiTotal.Text = string.Format("{0:n2}", list[0].WeiTotal); lblMess.Text = string.Format("{0:n2}", list[0].sumTotal); string sqlKaiPiao = "select isnull(sum(total),0) from Sell_OrderFP where Status='通过' and pono='" + PONo_Id[0] + "'"; lblKaiPiaoTotal.Text = string.Format("{0:n2}", DBHelp.ExeScalar(sqlKaiPiao)); if (list[0].POTotal - list[0].TuiTotal != 0) { lblWeiTotalBiLi.Text = string.Format("{0:n2}", list[0].WeiTotal / (list[0].POTotal - list[0].TuiTotal) * 100); } else { lblWeiTotalBiLi.Text = "0"; } string fpSQL = string.Format(" SELECT FPNo,RuTime,Total FROM Sell_OrderFP where Status='通过' and pono='{0}'", PONo_Id[0]); var fpList = DBHelp.getDataTable(fpSQL); //System.Text.StringBuilder sb = new System.Text.StringBuilder(); //int i = 1; //foreach (DataRow dr in fpList.Rows) //{ // sb.AppendFormat("{0} :{1} ", dr[0], dr[1]); // if (i % 5 == 0) // { // sb.Append(System.Environment.NewLine); // } // i++; //} //lblFPDetail.Text = sb.ToString(); ViewState["fpList"] = fpList; } else { lblPOTotal.Text = "0"; lblWeiTotal.Text = "0"; lblMess.Text = "0"; lblKaiPiaoTotal.Text = "0"; lblWeiTotalBiLi.Text = "0"; } string sql = "select PoNo,CreateUser,AppleDate,ZhangQi,Remark from TB_ToInvoice where id=" + PONo_Id[1]; gvDetail.DataSource = DBHelp.getDataTable(sql); gvDetail.DataBind(); //this.gvList.DataKeys[e.].Value.ToString() } if (e.CommandName == "Del") { //是否是此单据的申请人 var model = toInvoSerSer.GetModel(Convert.ToInt32(e.CommandArgument)); //if (Session["currentUserId"].ToString() != model.CreateUserId.ToString()) //{ // base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('必须由原单据申请人 重新发起,其他人不能重新提交编辑!');</script>"); // return; //} //首先单子要先通过 if (model != null && model.State == "执行中") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('此单据还在执行中不能删除!');</script>"); return; } string type = "到款单"; string sql = string.Format("select pro_Id from A_ProInfo where pro_Type='{0}'", type); string efromId = string.Format("select id from tb_EForm where alle_id={0} and proId=(select pro_Id from A_ProInfo where pro_Type='{1}')", e.CommandArgument, type); var id = DBHelp.ExeScalar(efromId).ToString(); var aa = DBHelp.ExeScalar(string.Format("select top 1 id from tb_EForm where allE_id={0} and proId=37", model.Id)); if (aa != null && aa != DBNull.Value) { id = aa.ToString(); } string url = "~/EFrom/WFToInvoice.aspx?ProId=38&allE_id=" + e.CommandArgument + "&EForm_Id=" + id + "&&IsDelete=true"; Response.Redirect(url); } }
public bool FormCheck() { #region 设置自己要判断的信息 if (txtName.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写姓名!');</script>"); txtName.Focus(); return(false); } if (txtDateTime.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写申请日期!');</script>"); txtDateTime.Focus(); return(false); } if (CommHelp.VerifesToDateTime(txtDateTime.Text.Trim()) == false) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('申请日期 格式错误!');</script>"); return(false); } if (txtgoAddress.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写出发地!');</script>"); txtgoAddress.Focus(); return(false); } if (txttoAddress.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写到达地!');</script>"); txttoAddress.Focus(); return(false); } if (txtgoTime.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写出发时间!');</script>"); txtgoTime.Focus(); return(false); } txtgoTime.Text = txtgoTime.Text.Trim().Replace(':', ':'); txtgoTime.Text = txtgoTime.Text.Trim().Replace('。', ':'); txtgoTime.Text = txtgoTime.Text.Trim().Replace('.', ':'); txtendTime.Text = txtendTime.Text.Trim().Replace(':', ':'); txtendTime.Text = txtendTime.Text.Trim().Replace('.', ':'); txtendTime.Text = txtendTime.Text.Trim().Replace('。', ':'); User user = Session["userInfo"] as User; if ((user.Zhiwu == "总经理" || user.Zhiwu == "副总经理") && ddlResult.SelectedItem.Text == "通过") { if (txtOiLXiShu.Text == "0") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写油价系数!');</script>"); txtOiLXiShu.Focus(); return(false); } } if (ddlPers.Visible == false && ddlResult.SelectedItem != null && ddlResult.SelectedItem.Text == "通过") { //if (txtOiLXiShu.Text == "0") //{ // base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写油价系数!');</script>"); // txtOiLXiShu.Focus(); // return false; //} //if (txtroadLong.Text == "") //{ // base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写路程!');</script>"); // txtroadLong.Focus(); // return false; //} try { if (txtroadLong.Text == "") { txtroadLong.Text = "0"; } if (Convert.ToDecimal(txtroadLong.Text) < 0) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写路程!');</script>"); txtroadLong.Focus(); return(false); } } catch (Exception) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('你填写的路程格式有误!');</script>"); txtroadLong.Focus(); return(false); } if (txtgoTime.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写出发时间!');</script>"); txtgoTime.Focus(); return(false); } if (txtendTime.Text.Trim() == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请填写结束时间!');</script>"); txtgoTime.Focus(); return(false); } } if (Request["allE_id"] == null)//单据增加 { if (txtPONo.Text == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请选择项目信息!');</script>"); txtPONo.Focus(); return(false); } } if (ddlPers.Visible == true && ddlPers.SelectedItem == null) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请选择下一步审核人!');</script>"); ddlPers.Focus(); return(false); } try { if (txtgoTime.Text != "") { Convert.ToDateTime(txtgoTime.Text); } if (txtendTime.Text != "") { Convert.ToDateTime(txtendTime.Text); //try //{ // TimeSpan ts = Convert.ToDateTime(txtDateTime.Text) - Convert.ToDateTime(txtendTime.Text); // if (ts.Days != 0) // { // base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('回来时间要与申请时间要在同一天!');</script>"); // txtendTime.Focus(); // return false; // } //} //catch (Exception) //{ // base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('你填写的时间格式有误!');</script>"); // txtendTime.Focus(); // return false; //} } if (txtendTime.Text != "" && txtgoTime.Text != "") { if (Convert.ToDateTime(txtgoTime.Text) >= Convert.ToDateTime(txtendTime.Text)) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('外出时间不能大于回来时间!');</script>"); txtgoTime.Focus(); return(false); } } } catch (Exception) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('你填写的时间格式有误!');</script>"); txtgoTime.Focus(); return(false); } try { if (txtroadLong.Text == "") { txtroadLong.Text = "0"; } Convert.ToDecimal(txtroadLong.Text); } catch (Exception) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('你填写的实际里程数格式有误!');</script>"); txtgoTime.Focus(); return(false); } if (DBHelp.ExeScalar(string.Format("select ID from tb_User where loginName='{0}'", txtName.Text)) == null) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('你填写申请用户不存在!');</script>"); txtName.Focus(); return(false); } #endregion if (new CG_POOrderService().ExistPONO(txtPONo.Text) == false) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('项目信息不存在!');</script>"); return(false); } if (CG_POOrderService.IsClosePONO(txtPONo.Text)) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('此项目已经关闭!');</script>"); return(false); } if (CG_POOrderService.IsSpecialPONO(txtPONo.Text, txtPOName.Text)) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('特殊订单无法计入费用!');</script>"); return(false); } return(true); }