Esempio n. 1
0
        private void of_bindGetmain()
        {
            int li_PageIndex = 1;

            try { li_PageIndex = Convert.ToInt32(Lbl_PageIndex.Text); }
            catch { }

            PageInfo Page = new PageInfo();

            Page.IPage     = li_PageIndex;
            Page.IPageSize = gi_PageSize;
            Page.StrIndex  = "getmain.orderno";
            Page.StrOrder  = "getmain.getorderdate desc";
            Page.StrTable  = "getmain,(select orderno,sum(num*price) as totalmoney from getdetail group by orderno) as getdetail";
            Page.StrText   = "getmain.orderno,getorderdate,isorder,orderstatus," +
                             "getdetail.totalmoney,memo,checkman, " +
                             "(select settle from settlekind where settlekind.settlekind=getmain.settlekind) as settle ";
            Page.StrWhere = "and getmain.orderno =getdetail.orderno " +
                            "and ( isnull(getmain.islogout,'n')='n') " +
                            "and getmain.cus_code=@cus_code " +
                            "and totalmoney is not null";
            List <GysoftParameter> ll_Pa = new List <GysoftParameter>();
            GysoftParameter        Pa1   = new GysoftParameter("@cus_code", as_Cus_Code);

            ll_Pa.Add(Pa1);

            #region 订单查询最小日期限制
            //DateTime ld_OrderBeginDate = DateTime.MinValue;
            //try
            //{
            //    string ls_OrderBeginDate = publicfuns.of_GetMySysSet("商城参数" + WebSet.os_WebHost, "OrderBeginDate");
            //    if (ls_OrderBeginDate != "")
            //    {
            //        int li_OrderBeginDate = Convert.ToInt32(ls_OrderBeginDate);
            //        if (li_OrderBeginDate > 0)
            //        {
            //            Lbl_DateMessage.Text = "只能查询 " + li_OrderBeginDate + "天前的订单";
            //            ld_OrderBeginDate = DateTime.Now.AddDays(0 - li_OrderBeginDate);
            //        }
            //    }
            //}
            //catch { }

            //if (Txt_TimeBegin.Text.Trim() == "")
            //{
            //    if (ld_OrderBeginDate <= DateTime.Now.AddMonths(-3))
            //    {
            //        ld_OrderBeginDate = DateTime.Now.AddMonths(-3);
            //    }
            //    Txt_TimeBegin.Text = ld_OrderBeginDate.ToString("yyyy-MM-dd");
            //}
            //else
            //{
            //    try
            //    {
            //        DateTime ld_Time = Convert.ToDateTime(Txt_TimeBegin.Text.Trim());
            //        if (ld_Time >= ld_OrderBeginDate)
            //        { ld_OrderBeginDate = ld_Time; }
            //        else
            //        {
            //            ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('请输入正确的开始时间')", true);
            //            return;
            //        }
            //    }
            //    catch
            //    {
            //        ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('请输入正确的开始时间')", true);
            //        return;
            //    }
            //}


            //Page.StrWhere += " and getorderdate>=@begionTime ";
            //ll_Pa.Add(new GysoftParameter("@begionTime", ld_OrderBeginDate));
            #endregion
            if (Txt_TimeBegin.Text.Trim() != "")
            {
                DateTime ld_TimeEnd;
                try
                { ld_TimeEnd = Convert.ToDateTime(Txt_TimeBegin.Text.Trim()); }
                catch
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('请输入正确的开始时间')", true);
                    return;
                }
                Page.StrWhere += " and getorderdate>=@begionTime ";
                GysoftParameter Pa = new GysoftParameter("@begionTime", ld_TimeEnd);
                ll_Pa.Add(Pa);
            }
            if (Txt_TimeEnd.Text.Trim() != "")
            {
                DateTime ld_TimeEnd;
                try
                { ld_TimeEnd = Convert.ToDateTime(Txt_TimeEnd.Text.Trim()); }
                catch
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('请输入正确的结束时间')", true);
                    return;
                }
                Page.StrWhere += " and getorderdate<@TimeEnd ";
                GysoftParameter Pa = new GysoftParameter("@TimeEnd", ld_TimeEnd);
                ll_Pa.Add(Pa);
            }

            int       Count = 0;
            DataTable dt    = PageDAL.Page(Page, GysoftParameter.ChangeParameter(ll_Pa), out Count);

            if (Count % gi_PageSize != 0)
            {
                Lbl_PageCount.Text = ((Count / gi_PageSize) + 1).ToString();
            }
            else
            {
                Lbl_PageCount.Text = (Count / gi_PageSize).ToString();
            }

            GV_Getmain.DataSource = dt;
            GV_Getmain.DataBind();
        }
Esempio n. 2
0
        private void of_bindOutOne()
        {
            int li_PageIndex = 1;

            try { li_PageIndex = Convert.ToInt32(Lbl_PageIndex.Text); }
            catch { }

            PageInfo Page = new PageInfo();

            Page.IPage     = li_PageIndex;
            Page.IPageSize = gi_PageSize;
            Page.StrIndex  = "outone.out_no";
            Page.StrOrder  = "outone.out_date desc";
            Page.StrTable  = "outone,customer,outtraffic";
            Page.StrText   = "outone.out_no,outone.out_date,outone.human," +
                             "outone.remark,outone.haveout,outone.discountrate,outone.haveoutstock," +
                             "outone.saleman,outone.haveoutstock,outone.stockcode,outone.settlekind," +
                             "isnull(outtraffic.trafficmemo,'')+isnull(outtraffic.address,'') as trafficmemo," +
                             "outone.trafficno,outone.sendNO,outone.driverman,outone.driverdate";
            Page.StrWhere = "and outone.cus_code = customer.cus_code " +
                            "and outone.out_no=outtraffic.out_no " +
                            "and  outone.cus_code=@cus_code";

            List <GysoftParameter> ll_Pa = new List <GysoftParameter>();
            GysoftParameter        Pa1   = new GysoftParameter("@cus_code", as_Cus_code);

            ll_Pa.Add(Pa1);

            DateTime ld_TimeBegin = Convert.ToDateTime("1900-01-01");

            if (Txt_TimeBegin.Text.Trim() != "")
            {
                try
                { ld_TimeBegin = Convert.ToDateTime(Txt_TimeBegin.Text.Trim()); }
                catch
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('请输入正确的开始时间')", true);
                    return;
                }
                Page.StrWhere += " and outone.out_date>=@TimeBegin ";
                GysoftParameter Pa = new GysoftParameter("@TimeBegin", ld_TimeBegin);
                ll_Pa.Add(Pa);
            }
            if (Txt_TimeEnd.Text.Trim() != "")
            {
                DateTime ld_TimeEnd;
                try
                { ld_TimeEnd = Convert.ToDateTime(Txt_TimeEnd.Text.Trim()); }
                catch
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('请输入正确的结束时间')", true);
                    return;
                }
                Page.StrWhere += " and outone.out_date<@TimeEnd ";
                GysoftParameter Pa = new GysoftParameter("@TimeEnd", ld_TimeEnd);
                ll_Pa.Add(Pa);
            }

            int       Count = 0;
            DataTable dt    = PageDAL.Page(Page, GysoftParameter.ChangeParameter(ll_Pa), out Count);

            if (Count % gi_PageSize != 0)
            {
                Lbl_PageCount.Text = ((Count / gi_PageSize) + 1).ToString();
            }
            else
            {
                Lbl_PageCount.Text = (Count / gi_PageSize).ToString();
            }

            GV_OutOne.DataSource = dt;
            GV_OutOne.DataBind();
        }