/// <summary> /// 查询按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnConfirm_Click(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); int docTpyeId = Convert.ToInt32(QueryInStorageBLL.GetDocTypeIDEByDocTypeCode("BY")); sb.Append(" 1=1 and a.DocTypeID=" + docTpyeId); ////判断国家 //UserControl_Country cou = Page.FindControl("Country1") as UserControl_Country; //if (cou.CID > 0) //{ // sb.Append(" and b.ID=" + cou.CID); //} //仓库 if (Convert.ToInt32(ddlcangku.SelectedValue) > 0) { sb.Append(" and a.WareHouseID=" + ddlcangku.SelectedValue); } //库位 if (Convert.ToInt32(ddlkuwei.SelectedValue) > 0) { sb.Append(" and a.DepotSeatID=" + ddlkuwei.SelectedValue); } string colunmns = " a.ID,a.DocTypeID,a.DocID,a.DocMakeTime,a.DocMaker,a.Client,d.warehousename,a.TotalMoney,c.seatname,a.TotalPV,a.ExpectNum,a.Note,a.StateFlag,a.CloseFlag,a.CloseDate,a.BatchCode,a.OriginalDocID,a.Address,a.Flag,a.Charged,a.Reason"; string table = "InventoryDoc a left outer join warehouse d on d.warehouseid=a.WareHouseID left outer join DepotSeat c on a.DepotSeatID=c.depotseatid"; ViewState["SQLSTR"] = "select " + colunmns + " from " + table + " where " + sb.ToString() + " order by a.ID desc"; Pager1.PageBind(0, 10, table, colunmns, sb.ToString(), "a.ID", "givDoc"); }
/// <summary> /// 首次加载 无条件查询 /// </summary> public void getdata(object obj, EventArgs e) { string table = "InventoryDoc"; string columns = "ID,Client,DocID,ExpectNum,StateFlag,CloseFlag,Flag,TotalMoney,Charged,TotalPV,DocMakeTime,Note "; string sql = " 1=1 and doctypeid=" + QueryInStorageBLL.GetDocTypeIDEByDocTypeCode("TH") + " and Flag=" + this.ddlstatu.SelectedValue; string shi = GetTran("000233", "是"); string fou = GetTran("000235", "否"); string temp = "select Client,DocID,ExpectNum,StateFlag=case StateFlag when '0' then '" + fou + "' when '1' then '" + shi + "' end ,CloseFlag=case CloseFlag when '0' then '" + fou + "' when '1' then '" + shi + "' end,Flag=case Flag when '0' then '" + fou + "' when '1' then '" + shi + "' end , TotalMoney,Charged,TotalPV,DocMakeTime,Note from InventoryDoc where "; ViewState["sql"] = temp + sql; this.Pager1.ControlName = "gwmoney"; this.Pager1.key = "id"; this.Pager1.PageColumn = columns; this.Pager1.Pageindex = 0; this.Pager1.PageTable = table; this.Pager1.Condition = sql; this.Pager1.PageSize = 10; this.Pager1.PageCount = 0; this.Pager1.PageBind(); if (Convert.ToInt32(this.ddlstatu.SelectedValue) == 0) { gwmoney.Columns[1].Visible = false; gwmoney.Columns[0].Visible = true; } else { gwmoney.Columns[1].Visible = true; gwmoney.Columns[0].Visible = false; } Translations(); }
private void saveOrder() { DateTime dt = DateTime.Now.ToUniversalTime(); InventoryDocBLL invent = new InventoryDocBLL(); string availableOrderID = invent.GetNewOrderID(EnumOrderFormType.OneToAnother); // CommonDataBLL common = new CommonDataBLL(); string makeman = txtOperator.Text.Trim().Replace("'", "") == "" ? CommonDataBLL.GetNameByAdminID(Session["Company"].ToString()) : txtOperator.Text.Trim().Replace("'", ""); // QueryInStorageBLL qinstore = new QueryInStorageBLL(); int docTpyeId = Convert.ToInt32(QueryInStorageBLL.GetDocTypeIDEByDocTypeCode("DB"));//调拨单 //CountryBLL bl = new CountryBLL(); UserControl_Country countrys = Page.FindControl("Country1") as UserControl_Country; InventoryDocModel tobjopda_depotManageDoc = new InventoryDocModel (CommonDataBLL.GetNameByAdminID(Session["Company"].ToString()), CommonDataBLL.OperateIP, DateTime.UtcNow, CommonDataBLL.OperateBh, docTpyeId, availableOrderID, dt, makeman, 0, Session["Company"].ToString(), Convert.ToInt32(ddlinwareHouse.SelectedValue.Trim()), Convert.ToInt32(ddlintDepotSeatID.SelectedValue.Trim()), Convert.ToDouble(ViewState["zongPrice"]), Convert.ToDouble(ViewState["zongPv"]), "", (int)Application["maxqishu"], "DB", txtReamrk.Text, 1, DAL.CurrencyDAL.GetMoreCurrencyIDByCountryCode(DropCurrery.SelectedItem.Value)); tobjopda_depotManageDoc.OriginalDocID = txtoldDocID.Text.Trim().Replace("'", ""); //StorageInBLL.CreateNewBillofDocument(tobjopda_depotManageDoc); //AddReportDamageBLL.addReportDemage(CommonDataBLL.GetNameByAdminID(Session["Company"].ToString()), CommonDataBLL.OperateIP, CommonDataBLL.OperateBh, availableOrderID); //int exist; //string InsertStr = ""; //string result = ""; //foreach (InventoryDocDetailsModel opda_docDetail in (ArrayList)ViewState["list"]) //{ // opda_docDetail.DocID = availableOrderID; // string rt = InventoryDocBLL.SetDiaoBo(Convert.ToInt32(ddloutWareHouse.SelectedValue.Trim()), Convert.ToInt32(ddloutDepotSeatID.SelectedValue), Convert.ToInt32(ddlinwareHouse.SelectedValue.Trim()), Convert.ToInt32(ddlintDepotSeatID.SelectedValue), opda_docDetail.ProductQuantity, opda_docDetail.ProductID, opda_docDetail); // if (rt != "1") // result = result + "产品名称 " + ProductModeBLL.GetProductNameByID(opda_docDetail.ProductID) + " 调拨失败;"; // else // result = result + "产品名称 " + ProductModeBLL.GetProductNameByID(opda_docDetail.ProductID) + " 调拨成功;"; //} //int cID = Convert.ToInt32(DropCurrery.SelectedItem.Value); //gridBind(cID, Convert.ToInt32(ddloutWareHouse.SelectedValue), Convert.ToInt32(ddloutDepotSeatID.SelectedValue)); //ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + result + "');</script>"); //(inventoryDocDetailsModels, outWareHouse, outDepotSeatID, inWareHouse, inDepotSeatID, tobjopda_depotManageDoc); string rt = InventoryDocBLL.SetDiaoBo((ArrayList)ViewState["list"], Convert.ToInt32(ddlinwareHouse.SelectedValue.Trim()), Convert.ToInt32(ddlintDepotSeatID.SelectedValue), Convert.ToInt32(ddloutWareHouse.SelectedValue.Trim()), Convert.ToInt32(ddloutDepotSeatID.SelectedValue), tobjopda_depotManageDoc); if (rt == "1") { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("002001", "调拨成功") + "');</script>"); } else { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("002002", "调拨失败") + "');</script>"); } int cID = Convert.ToInt32(DropCurrery.SelectedItem.Value); gridBind(cID, Convert.ToInt32(ddloutWareHouse.SelectedValue), Convert.ToInt32(ddloutDepotSeatID.SelectedValue)); }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "LinkbtnXinxi") { int docTpyeId = Convert.ToInt32(QueryInStorageBLL.GetDocTypeIDEByDocTypeCode("DB")); //调拨单 int docTpyeId1 = Convert.ToInt32(QueryInStorageBLL.GetDocTypeIDEByDocTypeCode("CK")); //出库单 int docTpyeId2 = Convert.ToInt32(QueryInStorageBLL.GetDocTypeIDEByDocTypeCode("BS")); //报损单 string sqlSQL_WareHouseID = ""; if (ViewState["warehouseID"] != null && ViewState["DepotSeatID"] != null) { sqlSQL_WareHouseID = " and M.inwarehouseID=" + ViewState["warehouseID"].ToString() + " and M.inDepotSeatID=" + ViewState["DepotSeatID"].ToString(); } this.Panel1.Visible = false; this.Panel2.Visible = true; this.btn.Visible = false; StringBuilder sb = new StringBuilder(); sb.Append("SELECT D.ProductID, P.ProductName, D.ProductQuantity, D.UnitPrice,P.PreferentialPrice,sum(P.PreferentialPrice*D.ProductQuantity) as ProductTotal1,"); sb.Append("D.ProductTotal, M.DocAuditTime, M.Provider, M.DocAuditer,"); sb.Append("M.Note, M.BatchCode,U.ProductUnitName as UnitName "); sb.Append("FROM InventoryDocDetails D INNER JOIN "); sb.Append("Product P ON D.ProductID = P.ProductID INNER JOIN "); sb.Append("InventoryDoc M ON D.DocID = M.DocID " + sqlSQL_WareHouseID); sb.Append(" left outer join ProductUnit U on P.SmallProductunitID = U.ProductUnitID "); sb.Append(" WHERE P.Countrycode=" + System.Convert.ToInt32(this.DropDownList1.SelectedValue) + " and (M.DocTypeID =" + docTpyeId + " or M.DocTypeID=" + docTpyeId1 + " or M.DocTypeID=" + docTpyeId2 + ") And StateFlag='1' And CloseFlag='0' And DATEADD(day, DATEDIFF(day,0,M.DocAuditTime ), 0) between '" + this.TextBox2.Text + "' and '" + this.TextBox3.Text + "'"); GridViewRow row = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer; string PrID = ((HtmlInputHidden)row.FindControl("hidPrID")).Value; ViewState["PrID"] = PrID; sb.Append(" and D.ProductID=" + PrID + " group by D.ProductID, P.ProductName,D.DocDetailsID, D.ProductQuantity,M.DocTypeID, D.UnitPrice,P.PreferentialPrice,D.ProductTotal, M.DocAuditTime, M.Provider,M.DocAuditer, M.Note, M.BatchCode, U.ProductUnitName "); string table = "InventoryDocDetails as D, Product as P,InventoryDoc as M,ProductUnit as U"; StringBuilder sb3 = new StringBuilder(); sb3.Append("D.ProductID = P.ProductID and P.SmallProductunitID = U.ProductUnitID and D.DocID = M.DocID and M.inWareHouseID=" + ViewState["warehouseID"].ToString() + " and M.inDepotSeatID=" + ViewState["DepotSeatID"].ToString()); sb3.Append(" and P.Countrycode=" + System.Convert.ToInt32(this.DropDownList1.SelectedValue) + " and (M.DocTypeID =" + docTpyeId + " or M.DocTypeID=" + docTpyeId1 + "or M.DocTypeID=" + docTpyeId2 + ") And StateFlag='1' And CloseFlag='0' And DATEADD(day, DATEDIFF(day,0,M.DocAuditTime ), 0) between '" + this.TextBox2.Text + "' and '" + this.TextBox3.Text + "'" + " and D.ProductID=" + PrID + " group by D.ProductID, P.ProductName, D.ProductQuantity,M.DocTypeID, D.UnitPrice,P.PreferentialPrice,D.ProductTotal, M.DocAuditTime, M.Provider,M.DocAuditer,D.DocDetailsID, M.Note, M.BatchCode, U.ProductUnitName"); string key = "D.DocDetailsID"; string cloumns = " D.ProductID, P.ProductName, D.ProductQuantity, D.UnitPrice,D.ProductTotal,P.PreferentialPrice,sum(P.PreferentialPrice*D.ProductQuantity) as ProductTotal1, M.DocAuditTime, M.Provider, M.DocAuditer,M.Note, M.BatchCode,U.ProductUnitName as UnitName, case M.DocTypeID when 2 then '" + GetTran("000769", "出库单") + "' when 6 then '" + GetTran("000768", "报损单") + "' when 9 then '" + GetTran("000581", "调拨单") + "' else '' end as DocType "; Pager pager2 = Page.FindControl("Pager1") as Pager; pager2.Pageindex = 0; pager2.PageSize = 10; pager2.PageTable = table; pager2.Condition = sb3.ToString(); pager2.PageColumn = cloumns; pager2.ControlName = "GridView2"; pager2.key = key; pager2.PageCount = 0; pager2.PageBind(); ViewState["dt1"] = sb.ToString(); Translations(); } Translations2(); }
/// <summary> /// 确认 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSaveOrder_Click(object sender, EventArgs e) { string msg = ""; if (Session["storageList"] == null || Session["storageList"].ToString() == "") { Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("007154", "报损产品的数量不能全部是0!"))); return; } else { DateTime dt = DateTime.Now.ToUniversalTime(); string availableOrderID = InventoryDocDAL.GetNewOrderID(Model.Other.EnumOrderFormType.CheckOutStorage); var boolvalue = GetOrderInfo(out msg); if (!boolvalue) { Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(msg)); return; } string makeman = txtOperationPerson.Text.Trim().Replace("'", "") == "" ? CommonDataBLL.GetNameByAdminID(Session["Company"].ToString()) : txtOperationPerson.Text.Trim().Replace("'", ""); int docTpyeId = Convert.ToInt32(QueryInStorageBLL.GetDocTypeIDEByDocTypeCode("BS"));//报损单 // CountryBLL bl = new CountryBLL(); InventoryDocModel tobjopda_depotManageDoc = new InventoryDocModel (CommonDataBLL.GetNameByAdminID(Session["Company"].ToString()), CommonDataBLL.OperateIP, DateTime.UtcNow, CommonDataBLL.OperateBh, docTpyeId, availableOrderID, dt, makeman, 0, Session["Company"].ToString(), Convert.ToInt32(ddlWareHouse.SelectedValue.Trim()), Convert.ToInt32(ddlDepotSeat.SelectedValue.Trim()), Convert.ToDouble(ViewState["zongPrice"]), Convert.ToDouble(ViewState["totalPV"]), "", CommonDataBLL.getMaxqishu(), "BS", txtMemo.Text, 1, DAL.AddFreeOrderDAL.GetCurrenT()); tobjopda_depotManageDoc.OriginalDocID = txtOriginalDocID.Text.Trim().Replace("'", ""); string rt = AddReportDamageBLL.ProductReportEDamage_II(list, Convert.ToInt32(ddlWareHouse.SelectedValue.Trim()), Convert.ToInt32(ddlDepotSeat.SelectedValue.Trim()), "TotalOut", tobjopda_depotManageDoc); if (rt == "1") { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("001874", "报损成功") + "');location.href='ReportDamage.aspx'</script>"); } else { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("001880", "报损失败") + "" + "" + "');</script>"); } setProductMenu(ddlCountry.SelectedValue, ddlWareHouse.SelectedValue, ddlDepotSeat.SelectedValue); } }
/// <summary> /// 查找 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void butsele_Click(object sender, EventArgs e) { if (this.ddlItem.SelectedItem.Value == "Client" && this.txtvalue.Text.Trim().Length == 0) { getdata(null, null); } else if (this.txtvalue.Text.Trim().Length > 0) { InventoryDocModel inventory = new InventoryDocModel(); inventory.DocTypeID = QueryInStorageBLL.GetDocTypeIDEByDocTypeCode("TH"); int expectnum = -1; double totalmoney = -0; DateTime time = DateTime.Now; inventory.TotalMoney = -1; inventory.ExpectNum = -1; inventory.DocMakeTime = DateTime.Parse("0001-1-1 0:00:00"); switch (this.ddlItem.SelectedValue.Trim()) { case "Client": if (this.txtvalue.Text.Trim().Length > 0) { inventory.Client = DisposeString.DisString(this.txtvalue.Text.Trim(), "<,>,',-", "<,>,', ", ","); } //退货店铺 else { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("001063", "条件错误") + "');</script>"); return; }; break; case "ExpectNum": if (this.txtvalue.Text.Trim().Length > 0) { if (int.TryParse(this.txtvalue.Text.Trim(), out expectnum)) //期数 { inventory.ExpectNum = expectnum; } else { inventory.ExpectNum = CommonDataBLL.GetMaxqishu(); } } else { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("001063", "条件错误") + "');</script>"); return; }; break; case "TotalMoney": if (this.txtvalue.Text.Trim().Length > 0) //总价格 { if (double.TryParse(this.txtvalue.Text.Trim(), out totalmoney)) { inventory.TotalMoney = totalmoney; } else { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("001063", "条件错误") + "');</script>"); return; } } else { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("001063", "条件错误") + "');</script>"); return; }; break; case "DocMakeTime": if (this.txttime.Text.Trim().Length > 0) { if (DateTime.TryParse(this.txttime.Text.Trim(), out time)) { inventory.DocMakeTime = time.AddHours(BLL.other.Company.WordlTimeBLL.ConvertAddHours()); } } else { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("001063", "条件错误") + "');</script>"); return; }; break; //退货日期 } inventory.Flag = int.Parse(this.ddlstatu.SelectedValue); pagebind(inventory); } else { getdata(null, null); } Translations(); ViewState["FID"] = null; ViewState["Fdocid"] = null; }
protected void GridView1NmaeNiHao_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "LinkbtnXinxi") { int docTpyeId = Convert.ToInt32(QueryInStorageBLL.GetDocTypeIDEByDocTypeCode("RK")); //入库单 int docTpyeId1 = Convert.ToInt32(QueryInStorageBLL.GetDocTypeIDEByDocTypeCode("BY")); //报溢单 int docTpyeId2 = Convert.ToInt32(QueryInStorageBLL.GetDocTypeIDEByDocTypeCode("TH")); //退货单 int docTypeId3 = Convert.ToInt32(QueryInStorageBLL.GetDocTypeIDEByDocTypeCode("DB")); //调拨单 string sqlSQL_WareHouseID = ""; if (this.ddlWareHouse.SelectedValue != "-1") { sqlSQL_WareHouseID = " and M.warehouseID=" + this.ddlWareHouse.SelectedValue + " and M.DepotSeatID=" + this.ddlDepotSeat.SelectedValue; } this.Panel1.Visible = false; this.Panel2.Visible = true; this.btn.Visible = false; // this.Button2.Visible = true; StringBuilder sb = new StringBuilder(); sb.Append("SELECT D.ProductID, P.ProductName, D.ProductQuantity, D.UnitPrice,D.ProductTotal, M.DocAuditTime, M.Provider, M.DocAuditer,M.Note, M.BatchCode,U.ProductUnitName as UnitName, case M.DocTypeID when 1 then '" + GetTran("000579", "入库单") + "' when 4 then '" + GetTran("000584", "报溢单") + "' when 15 then '" + GetTran("000583", "退货单") + "' when 9 then '" + GetTran("000581", "调拨单") + "' else '' end as DocType "); sb.Append("D.ProductTotal, M.DocAuditTime, M.Provider, M.DocAuditer,"); sb.Append("M.Note, M.BatchCode,U.ProductUnitName as UnitName "); sb.Append("FROM InventoryDocDetails D INNER JOIN "); sb.Append("Product P ON D.ProductID = P.ProductID INNER JOIN "); sb.Append("InventoryDoc M ON D.DocID = M.DocID " + sqlSQL_WareHouseID); sb.Append(" left outer join ProductUnit U on P.SmallProductunitID = U.ProductUnitID "); sb.Append(" WHERE P.Countrycode=" + System.Convert.ToInt32(this.DropDownList1.SelectedValue) + " and (M.DocTypeID =" + docTpyeId + " or M.DocTypeID=" + docTpyeId1 + " or M.DocTypeID=" + docTpyeId2 + " or M.DocTypeID=" + docTypeId3 + ") And StateFlag='1' And CloseFlag='0' And DATEADD(day, DATEDIFF(day,0,M.DocAuditTime ), 0) between '" + this.TextBox2.Text + "' and '" + this.TextBox3.Text + "'"); GridViewRow row = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer; string PrID = ((HtmlInputHidden)row.FindControl("hidPrID")).Value; ViewState["PrID"] = PrID; sb.Append(" and D.ProductID=" + PrID); string table = "InventoryDocDetails as D, Product as P,InventoryDoc as M,ProductUnit as U"; StringBuilder sb3 = new StringBuilder(); sb3.Append("D.ProductID = P.ProductID and P.SmallProductunitID = U.ProductUnitID and D.DocID = M.DocID and M.WareHouseID=" + this.ddlWareHouse.SelectedValue + " and M.DepotSeatID=" + this.ddlDepotSeat.SelectedValue); sb3.Append(" and P.Countrycode=" + System.Convert.ToInt32(this.DropDownList1.SelectedValue) + " and (M.DocTypeID =" + docTpyeId + " or M.DocTypeID=" + docTpyeId1 + "or M.DocTypeID=" + docTpyeId2 + " or M.DocTypeID=" + docTypeId3 + ") And StateFlag='1' And CloseFlag='0' And DATEADD(day, DATEDIFF(day,0,M.DocAuditTime ), 0) between '" + this.TextBox2.Text + "' and '" + this.TextBox3.Text + "'" + " and D.ProductID=" + PrID); string key = "D.DocDetailsID"; string cloumns = " D.ProductID, P.ProductName, D.ProductQuantity, D.UnitPrice,D.ProductTotal, M.DocAuditTime, M.Provider, M.DocAuditer,M.Note, M.BatchCode,U.ProductUnitName as UnitName, case M.DocTypeID when 1 then '" + GetTran("000579", "入库单") + "' when 4 then '" + GetTran("000584", "报溢单") + "' when 15 then '" + GetTran("000583", "退货单") + "' when 9 then '" + GetTran("000581", "调拨单") + "' else '' end as DocType"; // Pager pagerT = Page.FindControl("Pager11") as Pager; Pager11.Pageindex = 0; Pager11.PageSize = 10; Pager11.PageTable = table; Pager11.Condition = sb3.ToString(); Pager11.PageColumn = cloumns; Pager11.ControlName = "GridView2"; Pager11.key = key; Pager11.PageCount = 0; Pager11.PageBind1(); // if (Pager11.PageCount > 0) // { this.Button2.Visible = true; this.img2.Style.Add("display", "block"); this.btn.Visible = false; this.img1.Style.Add("display", "none"); // } ViewState["dt1"] = "Select " + cloumns + " From " + table + " Where " + sb3.ToString() + " Order By D.DocDetailsID"; } Translations2(); }
protected void Button1_Click(object sender, EventArgs e) { int docTypeId = Convert.ToInt32(QueryInStorageBLL.GetDocTypeIDEByDocTypeCode("RK")); //入库单 int docTypeId1 = Convert.ToInt32(QueryInStorageBLL.GetDocTypeIDEByDocTypeCode("BY")); //报溢单 int docTypeId2 = Convert.ToInt32(QueryInStorageBLL.GetDocTypeIDEByDocTypeCode("TH")); //退货单 int docTypeId3 = Convert.ToInt32(QueryInStorageBLL.GetDocTypeIDEByDocTypeCode("DB")); //调拨单 try { DateTime dtTemp1 = Convert.ToDateTime(this.TextBox2.Text).AddHours(BLL.other.Company.WordlTimeBLL.ConvertAddHours()).ToUniversalTime(); DateTime dtTemp2 = Convert.ToDateTime(this.TextBox3.Text).AddHours(BLL.other.Company.WordlTimeBLL.ConvertAddHours()).ToUniversalTime(); if (dtTemp1 > dtTemp2) { msg = GetTran("000479", "开始时间不能大于结束时间") + "!"; } } catch { msg = GetTran("000485", "日期非法,请重新输入") + "!"; return; } string sqlSQL_WareHouseID = ""; if (this.ddlWareHouse.SelectedValue != "-1") { sqlSQL_WareHouseID = " and M.WareHouseID=" + this.ddlWareHouse.SelectedValue + " and M.DepotSeatID=" + this.ddlDepotSeat.SelectedValue; } StringBuilder sb1 = new StringBuilder(); sb1.Append("SELECT D.ProductID, P.ProductName, SUM(D.ProductQuantity)"); sb1.Append("AS ProductQuantity, SUM(D.ProductTotal) AS ProductTotal,U.ProductUnitName as UnitName "); sb1.Append("FROM InventoryDocDetails D INNER JOIN "); sb1.Append("Product P ON D.ProductID = P.ProductID INNER JOIN "); sb1.Append("InventoryDoc M ON D.DocID = M.DocID " + sqlSQL_WareHouseID); sb1.Append(" left outer join ProductUnit U on P.SmallProductUnitID = U.ProductUnitID "); sb1.Append("WHERE (M.DocTypeID =" + docTypeId + " or M.DocTypeID=" + docTypeId1 + " or M.DocTypeID=" + docTypeId1 + " or M.DocTypeID=" + docTypeId3 + ")"); sb1.Append("And StateFlag='1' And CloseFlag='0' And DATEADD(day, DATEDIFF(day,0,M.DocAuditTime ), 0) between '" + this.TextBox2.Text + "' and '" + this.TextBox3.Text + "'"); sb1.Append(" GROUP BY D.ProductID, P.ProductName,U.ProductUnitName"); ViewState["SQL1"] = sb1.ToString(); StringBuilder sb2 = new StringBuilder(); string key = "D.ProductID"; this.Panel1.Visible = true; this.Panel2.Visible = false; this.btn.Visible = true; this.img1.Style.Add("display", "block"); this.Button2.Visible = false; this.img2.Style.Add("display", "none"); sb2.Append("D.ProductID = P.ProductID and P.SmallProductUnitID = U.ProductUnitID and D.DocID = M.DocID and M.WareHouseID=" + this.ddlWareHouse.SelectedValue + "and M.DepotSeatID=" + this.ddlDepotSeat.SelectedValue); sb2.Append("and (M.DocTypeID =" + docTypeId + " or M.DocTypeID=" + docTypeId1 + " or M.DocTypeID=" + docTypeId2 + " or M.DocTypeID=" + docTypeId3 + ") And StateFlag='1' And CloseFlag='0' And DATEADD(day, DATEDIFF(day,0,M.DocAuditTime ), 0) between '" + this.TextBox2.Text + "' and '" + this.TextBox3.Text + "'"); sb2.Append(" GROUP BY D.ProductID, P.ProductName,U.ProductUnitName"); string table = "InventoryDocDetails as D, Product as P,InventoryDoc as M,ProductUnit as U"; string cloumns = "D.ProductID, P.ProductName, SUM(D.ProductQuantity) AS ProductQuantity, SUM(D.ProductTotal) AS ProductTotal,U.ProductUnitName as UnitName"; Pager pager = Page.FindControl("Pager1") as Pager; pager.Pageindex = 0; pager.PageSize = 10; pager.PageTable = table; pager.Condition = sb2.ToString(); pager.PageColumn = cloumns; pager.ControlName = "GridView1NmaeNiHao"; pager.PageCount = 0; pager.key = key; pager.InitBindData = true; //pager.PageBind(0, 10, pager.PageTable, pager.PageColumn, pager.Condition, pager.key, pager.ControlName); pager.PageBind1(); //if (pager.PageCount > 0) //{ this.Panel1.Visible = true; //this.GridView1NmaeNiHao.Visible = true; this.btn.Visible = true; this.img1.Style.Add("display", "block"); this.Button2.Visible = false; this.img2.Style.Add("display", "none"); this.label2.Text = "<p align=center>" + GetTran("000488", "统计信息"); //} //else //{ // this.Panel1.Visible = false; // //this.GridView1NmaeNiHao.Visible = false; // this.btn.Visible = false; // this.img1.Style.Add("display", "none"); // this.Button2.Visible = false; // this.img2.Style.Add("display", "none"); //} ViewState["SQL1"].ToString(); Translations(); }