Exemple #1
0
    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" },
                                          "库存流水账明细");
    }
Exemple #2
0
    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" },
                                          "库存流水账明细");
    }