Ejemplo n.º 1
0
        public String Print()
        {
            string isbn        = Request["isbn"];
            string price       = Request["price"];
            string discount    = Request["discount"];
            string bookName    = Request["bookName"];
            string stockNumber = Request["stockNumber"];
            string strWhere    = groupType;
            string fileName    = name;

            if (isbn != null && isbn != "")
            {
                strWhere += " and isbn='" + isbn + "'";
            }
            if (price != "" && price != null)
            {
                string[] sArray = price.Split('于');
                string   type1  = sArray[0];
                string   number = sArray[1];
                if (strWhere == "" || strWhere == null)
                {
                    if (type1 == "小")
                    {
                        strWhere = "price < '" + number + "'";
                    }
                    else if (type1 == "等")
                    {
                        strWhere = "price = '" + number + "'";
                    }
                    else
                    {
                        strWhere = "price > '" + number + "'";
                    }
                }
                else
                {
                    if (type1 == "小")
                    {
                        strWhere += " and price < '" + number + "'";
                    }
                    else if (type1 == "等")
                    {
                        strWhere += " and price = '" + number + "'";
                    }
                    else
                    {
                        strWhere += " and price > '" + number + "'";
                    }
                }
            }
            //if (price != null && price != "")
            //{
            //    strWhere += " and uPrice=" + price;
            //}
            if (discount != null && discount != "")
            {
                strWhere += " and discount=" + discount;
            }
            if (bookName != null && bookName != "")
            {
                strWhere += " and bookName like '%" + bookName + "%'";
            }
            if (stockNumber != "" && stockNumber != null)
            {
                string[] sArray = stockNumber.Split('于');
                string   type   = sArray[0];
                string   number = sArray[1];
                if (strWhere == "" || strWhere == null)
                {
                    if (type == "小")
                    {
                        strWhere = " and stockNum < '" + number + "'";
                    }
                    else if (type == "等")
                    {
                        strWhere = " and stockNum = '" + number + "'";
                    }
                    else
                    {
                        strWhere = " and stockNum > '" + number + "'";
                    }
                }
                else
                {
                    if (type == "小")
                    {
                        strWhere += " and stockNum < '" + number + "'";
                    }
                    else if (type == "等")
                    {
                        strWhere += " and stockNum = '" + number + "'";
                    }
                    else
                    {
                        strWhere += " and stockNum > '" + number + "'";
                    }
                }
            }
            //DataTable printDt = stockBll.census(strWhere, groupType);
            //bookKinds = int.Parse(printDt.Rows[0]["品种数量"].ToString());
            //allBookCount = int.Parse(printDt.Rows[0]["总数"].ToString());
            DataTable     dt      = stockBll.ExportExcelDetail(strWhere, type);
            StringBuilder strb    = new StringBuilder();
            int           dscount = dt.Rows.Count;

            for (int i = 0; i < dscount; i++)
            {
                DataRow dr = dt.Rows[i];
                //序号 (i + 1 + ((currentPage - 1) * pageSize))
                strb.Append("<tr><td>" + (i + 1) + "</td>");
                strb.Append("<td>" + dr["ISBN"].ToString() + "</td>");
                //strb.Append("<td>" + dr["书号"].ToString() + "</td>");
                strb.Append("<td>" + dr["书名"].ToString() + "</td>");
                strb.Append("<td>" + dr["单价"].ToString() + "</td>");
                strb.Append("<td>" + dr["供应商"].ToString() + "</td>");
                strb.Append("<td>" + dr["数量"].ToString() + "</td>");
                strb.Append("<td>" + dr["进货折扣"].ToString() + "</td>");
                strb.Append("<td>" + dr["销售折扣"].ToString() + "</td>");
                strb.Append("<td>" + dr["组织名称"].ToString() + "</td></tr>");
            }
            Response.Write(strb.ToString());
            Response.End();
            return(strb.ToString());
        }