protected void btnImport_Click(object sender, ImageClickEventArgs e) { int pageIndex = 1; int pageCount = 10000; int totalCount = 0; string orderBy = txtorderBy.Value; if (!string.IsNullOrEmpty(orderBy)) { if (orderBy.Split('_')[1] == "a") { orderBy = orderBy.Split('_')[0] + " asc"; } else { orderBy = orderBy.Split('_')[0] + " desc"; } } string EFindex = hiddenEFIndex.Value.Trim(); string EFDesc = hiddenEFDesc.Value.Trim(); string EFName = hiddenEFIndexName.Value; string extQueryStr = string.Empty; if (!string.IsNullOrEmpty(EFindex) && !string.IsNullOrEmpty(EFDesc)) { extQueryStr = " b.ExtField" + EFindex + " LIKE '%" + EFDesc + "%' " + "@b.ExtField" + EFindex; } string sidex = "ExtField" + EFindex; //设置查询条件 string ddlStorage, txtProductNo, ProductID, StartDate, EndDate, ProviderID, ckbIsM, SourceNo = ""; string CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; ddlStorage = this.ddlStorage.SelectedValue; //txtProductName = this.txtProductName.Value; txtProductNo = this.txtProductNo.Value; ProductID = this.hiddenProductID.Value; StartDate = this.txtStartDate.Text; EndDate = this.txtEndDate.Text; ProviderID = this.txtProviderID.Value; SourceNo = this.txtSourceNo.Text; if (this.ckbIsM.Checked) { ckbIsM = "1"; } else { ckbIsM = "0"; } string BatchNo = this.ddlBatchNo.SelectedValue; string ListID = StorageBus.GetStorageIDStr(((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeID, ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD); DataTable dt = new DataTable(); if (string.IsNullOrEmpty(ProviderID)) { string QueryStr = " and CompanyCD='" + CompanyCD + "' "; if (ddlStorage.Trim().Length > 0 && ddlStorage.Trim().Length > 0) { QueryStr += " and StorageID= '"; QueryStr += ddlStorage; QueryStr += "' "; } if (ProductID.Trim().Length > 0 && ProductID.Trim().Length > 0) { QueryStr += " and ProductID= '"; QueryStr += ProductID; QueryStr += "' "; } if (StartDate.Trim().Length > 0) { QueryStr += " and HappenDate >='"; QueryStr += StartDate + " 00:00:00"; QueryStr += "' "; } if (EndDate.Trim().Length > 0) { QueryStr += " and HappenDate <='"; QueryStr += EndDate + " 23:59:59"; QueryStr += "' "; } if (BatchNo != "0") { if (BatchNo == "未设置批次") { QueryStr += " and ( BatchNo is null or BatchNo='') "; } else { QueryStr += " and BatchNo='" + BatchNo + "' "; } } if (SourceNo.Trim().Length > 0 && SourceNo != "0") { if (ckbIsM == "0") { QueryStr += " and BillNo= '"; QueryStr += SourceNo; QueryStr += "' "; } else { QueryStr += " and BillNo like '%"; QueryStr += SourceNo; QueryStr += "%' "; } } dt = StrongeJournalBus.GetSumStrongJournal(QueryStr, extQueryStr, pageIndex, pageCount, " ProductID asc ", ref totalCount); if (!string.IsNullOrEmpty(EFindex) && !string.IsNullOrEmpty(EFDesc)) { OutputToExecl.ExportToTableFormat(this, dt, new string[] { "仓库编号", "仓库名称", "批次", "物品编号", "物品名称", "规格型号", "尺寸", "产地", "入库总量", "出库总量", "现有存量", EFName }, new string[] { "StorageNo", "StorageName", "BatchNo", "ProdNo", "ProductName", "Specification", "ProductSize", "FromAddr", "InProductCount", "OutProductCount", "NowProductCount", sidex }, "库存流水账列表"); } else { OutputToExecl.ExportToTableFormat(this, dt, new string[] { "仓库编号", "仓库名称", "批次", "物品编号", "物品名称", "规格型号", "尺寸", "产地", "入库总量", "出库总量", "现有存量" }, new string[] { "StorageNo", "StorageName", "BatchNo", "ProdNo", "ProductName", "Specification", "ProductSize", "FromAddr", "InProductCount", "OutProductCount", "NowProductCount" }, "库存流水账列表"); } } else { string QueryStr = " and a.CompanyCD='" + CompanyCD + "' and c.ProviderID='" + ProviderID + "' "; if (ddlStorage.Trim().Length > 0 && ddlStorage.Trim().Length > 0) { QueryStr += " and b.StorageID= '"; QueryStr += ddlStorage; QueryStr += "' "; } if (ProductID.Trim().Length > 0 && ProductID.Trim().Length > 0) { QueryStr += " and b.ProductID= '"; QueryStr += ProductID; QueryStr += "' "; } if (StartDate.Trim().Length > 0) { QueryStr += " and a.EnterDate >='"; QueryStr += StartDate + " 00:00:00"; QueryStr += "' "; } if (EndDate.Trim().Length > 0) { QueryStr += " and a.EnterDate <='"; QueryStr += EndDate + " 23:59:59"; QueryStr += "' "; } if (BatchNo != "0") { if (BatchNo == "未设置批次") { QueryStr += " and ( b.BatchNo is null or b.BatchNo='') "; } else { QueryStr += " and b.BatchNo='" + BatchNo + "' "; } } //查询数据 //DataTable dt = AcountBookBus.GetAcountBookInfo(QueryStr); dt = StrongeJournalBus.GetStrongJournalByPro(QueryStr, extQueryStr, pageIndex, pageCount, " ProductID asc ", ref totalCount); if (!string.IsNullOrEmpty(EFindex) && !string.IsNullOrEmpty(EFDesc)) { OutputToExecl.ExportToTableFormat(this, dt, new string[] { "仓库编号", "仓库名称", "批次", "物品编号", "物品名称", "规格型号", "尺寸", "产地", "入库总量", EFName }, new string[] { "StorageNo", "StorageName", "BatchNo", "ProdNo", "ProductName", "Specification", "ProductSize", "FromAddr", "ProductCount", sidex }, "库存流水账列表"); } else { OutputToExecl.ExportToTableFormat(this, dt, new string[] { "仓库编号", "仓库名称", "批次", "物品编号", "物品名称", "规格型号", "尺寸", "产地", "入库总量" }, new string[] { "StorageNo", "StorageName", "BatchNo", "ProdNo", "ProductName", "Specification", "ProductSize", "FromAddr", "ProductCount" }, "库存流水账列表"); } } }
protected void btnImport_Click(object sender, ImageClickEventArgs e) { int pageIndex = 1; int pageCount = 10000; int totalCount = 0; string CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; //设置查询条件 string ddlStorage, ProductID, StartDate, EndDate, ProviderID, BatchNo = ""; ddlStorage = Request.QueryString["SID"].Trim().ToString(); ProductID = Request.QueryString["PID"].Trim().ToString(); StartDate = Request.QueryString["SD"].Trim().ToString(); EndDate = Request.QueryString["ED"].Trim().ToString(); ProviderID = Request.QueryString["ProviderID"].Trim().ToString(); BatchNo = Request.QueryString["BNo"].ToString(); DataTable dt = new DataTable(); if (string.IsNullOrEmpty(ProviderID)) { string QueryStr = " a.CompanyCD='" + CompanyCD + "' "; if (ddlStorage.Trim().Length > 0 && ddlStorage.Trim().Length > 0) { QueryStr += " and a.StorageID= '"; QueryStr += ddlStorage; QueryStr += "' "; } if (ProductID.Trim().Length > 0 && ProductID.Trim().Length > 0) { QueryStr += " and a.ProductID= '"; QueryStr += ProductID; QueryStr += "' "; } if (StartDate.Trim().Length > 0) { QueryStr += " and a.HappenDate >='"; QueryStr += StartDate + " 00:00:00"; QueryStr += "' "; } if (EndDate.Trim().Length > 0) { QueryStr += " and a.HappenDate <='"; QueryStr += EndDate + " 23:59:59"; QueryStr += "' "; } if (BatchNo != "0") { if (BatchNo == "未设置批次" || string.IsNullOrEmpty(BatchNo)) { QueryStr += " and ( a.BatchNo is null or a.BatchNo='') "; } else { QueryStr += " and a.BatchNo='" + BatchNo + "' "; } } dt = StrongeJournalBus.GetDetailStrongJournal(QueryStr, pageIndex, pageCount, " ProductID desc ", ref totalCount); } else { string QueryStr = " and a.CompanyCD='" + CompanyCD + "' and c.ProviderID='" + ProviderID + "' "; if (ddlStorage.Trim().Length > 0 && ddlStorage.Trim().Length > 0) { QueryStr += " and e.StorageID= '"; QueryStr += ddlStorage; QueryStr += "' "; } if (ProductID.Trim().Length > 0 && ProductID.Trim().Length > 0) { QueryStr += " and e.ProductID= '"; QueryStr += ProductID; QueryStr += "' "; } if (StartDate.Trim().Length > 0) { QueryStr += " and a.EnterDate >='"; QueryStr += StartDate + " 00:00:00"; QueryStr += "' "; } if (EndDate.Trim().Length > 0) { QueryStr += " and a.EnterDate <='"; QueryStr += EndDate + " 23:59:59"; QueryStr += "' "; } if (BatchNo != "0") { if (BatchNo == "未设置批次") { QueryStr += " and ( e.BatchNo is null or e.BatchNo='') "; } else { QueryStr += " and e.BatchNo='" + BatchNo + "' "; } } dt = StrongeJournalBus.GetDetailStrongJournalByPro(QueryStr, pageIndex, pageCount, " ProductID desc ", ref totalCount); } OutputToExecl.ExportToTableFormat(this, dt, new string[] { "仓库编号", "仓库名称", "批次", "物品编号", "物品名称", "规格型号", "颜色", "尺寸", "产地", "出入库时间", "出入库数量" }, new string[] { "StorageNo", "StorageName", "BatchNo", "ProdNo", "ProductName", "Specification", "ColorName", "ProductSize", "FromAddr", "EnterDate", "ProductCount" }, "库存流水账明细"); }
protected void btnImport_Click(object sender, ImageClickEventArgs e) { int pageIndex = 1; int pageCount = 10000; int totalCount = 0; string CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; //设置查询条件 string ddlStorage, SourceType, SourceNo, CreatorID, ProductID, StartDate, EndDate, BatchNo, EFindex, EFDesc, Specification, ColorID, Material, Manufacturer, Size, FromAddr, BarCode, ckbIsM = ""; ddlStorage = this.ddlStorage.SelectedValue; ProductID = this.hiddenProductID.Value; StartDate = this.txtStartDate.Text; EndDate = this.txtEndDate.Text; BatchNo = this.hiddenBatchNo.Value; SourceType = this.ddlSourceType.SelectedValue; SourceNo = this.txtSourceNo.Text; CreatorID = this.txtCreatorID.Value; EFindex = hiddenEFIndex.Value.Trim(); EFDesc = hiddenEFDesc.Value.Trim(); Specification = this.txt_Specification.Value; ColorID = this.sel_ColorID.SelectedValue; Material = this.sel_Material.SelectedValue; Manufacturer = this.txt_Manufacturer.Text; Size = this.txt_Size.Value; FromAddr = this.txt_FromAddr.Text; BarCode = this.txt_BarCode.Value; if (this.ckbIsM.Checked) { ckbIsM = "1"; } else { ckbIsM = "0"; } DataTable dt = new DataTable(); string QueryStr = " a.CompanyCD='" + CompanyCD + "' "; if (ddlStorage.Trim().Length > 0 && ddlStorage != "0") { QueryStr += " and a.StorageID= '"; QueryStr += ddlStorage; QueryStr += "' "; } if (ProductID.Trim().Length > 0) { QueryStr += " and a.ProductID= '"; QueryStr += ProductID; QueryStr += "' "; } if (StartDate.Trim().Length > 0) { QueryStr += " and a.HappenDate >='"; QueryStr += StartDate + " 00:00:00"; QueryStr += "' "; } if (EndDate.Trim().Length > 0) { QueryStr += " and a.HappenDate <='"; QueryStr += EndDate + " 23:59:59"; QueryStr += "' "; } if (BatchNo != "0") { if (BatchNo == "未设置批次" || string.IsNullOrEmpty(BatchNo)) { QueryStr += " and ( a.BatchNo is null or a.BatchNo='') "; } else { QueryStr += " and a.BatchNo='" + BatchNo + "' "; } } if (SourceType.Trim().Length > 0 && SourceType != "0") { QueryStr += " and a.BillType= '"; QueryStr += SourceType; QueryStr += "' "; } if (SourceNo.Trim().Length > 0 && SourceNo != "0") { if (ckbIsM == "0") { QueryStr += " and a.BillNo= '"; QueryStr += SourceNo; QueryStr += "' "; } else { QueryStr += " and a.BillNo like '%"; QueryStr += SourceNo; QueryStr += "%' "; } } if (CreatorID.Trim().Length > 0 && CreatorID != "0") { QueryStr += " and a.Creator= '"; QueryStr += CreatorID; QueryStr += "' "; } if (!string.IsNullOrEmpty(EFindex) && !string.IsNullOrEmpty(EFDesc)) { QueryStr += " and b.ExtField" + EFindex + " LIKE '%" + EFDesc + "%' "; } if (!string.IsNullOrEmpty(Specification)) { QueryStr += " and b.Specification LIKE '%" + Specification + "%' "; } if (!string.IsNullOrEmpty(ColorID) && ColorID != "0") { QueryStr += " and b.ColorID= '" + ColorID + "' "; } if (!string.IsNullOrEmpty(Material) && Material != "0") { QueryStr += " and b.Material = '" + Material + "' "; } if (!string.IsNullOrEmpty(Manufacturer)) { QueryStr += " and b.Manufacturer LIKE '%" + Manufacturer + "%' "; } if (!string.IsNullOrEmpty(Size)) { QueryStr += " and b.Size LIKE '%" + Size + "%' "; } if (!string.IsNullOrEmpty(FromAddr)) { QueryStr += " and b.FromAddr LIKE '%" + FromAddr + "%' "; } if (!string.IsNullOrEmpty(BarCode)) { QueryStr += " and b.BarCode LIKE '%" + BarCode + "%' "; } //查询数据 //DataTable dt = AcountBookBus.GetAcountBookInfo(QueryStr); dt = StrongeJournalBus.GetDetailStrongJournal(QueryStr, pageIndex, pageCount, " ProductID desc", ref totalCount); OutputToExecl.ExportToTableFormat(this, dt, new string[] { "单据编号", "单据类别", "仓库编号", "仓库名称", "批次", "物品编号", "物品名称", "单位", "规格型号", "颜色", "尺寸", "产地", "出入库时间", "出入库数量", "结存量", "创建人", "备注" }, new string[] { "BillNo", "typeflag", "StorageNo", "StorageName", "BatchNo", "ProdNo", "ProductName", "CodeName", "Specification", "ColorName", "ProductSize", "FromAddr", "EnterDate", "ProductCount", "NowProductCount", "CreatorName", "ReMark" }, "库存流水账明细"); }