示例#1
0
    public void Bind()
    {
        int    pageCount = 0;
        int    Counts    = 0;
        string strwhere  = string.Empty;

        if (ViewState["strwhere"] != null)
        {
            strwhere += ViewState["strwhere"].ToString();
        }
        if (!IsPostBack)
        {
            if (!string.IsNullOrEmpty(Request["IsAnswer"]) && Request["IsAnswer"].ToString() == "1")
            {
                strwhere         += " and IsAnswer=1";
                dllisanswer.Value = "1";
            }
        }
        strwhere += " and isnull(dr,0)=0 and Stype=0 and DisUserID=" + this.UserID;

        if (this.txtPager.Value.Trim().ToString() != "")
        {
            if (this.txtPager.Value.Trim().Length < 4)
            {
                Pager.PageSize = int.Parse(this.txtPager.Value.Trim());
            }
            else
            {
                this.txtPager.Value = "12";
                this.Pager.PageSize = 12;
            }
        }

        List <Hi.Model.DIS_Suggest> suggest = new Hi.BLL.DIS_Suggest().GetList(Pager.PageSize, Pager.CurrentPageIndex, "ts", true, strwhere, out pageCount, out Counts);

        this.rptmessage.DataSource = suggest;
        this.rptmessage.DataBind();
        Pager.RecordCount = Counts;
        page = Pager.CurrentPageIndex.ToString();
    }
示例#2
0
    public void DataBinds()
    {
        int    pageCount = 0;
        int    Counts    = 0;
        string strwhere  = " and compid=" + this.CompID;

        if (ViewState["strwhere"] != null)
        {
            strwhere += ViewState["strwhere"].ToString();
        }
        if (this.txtPageSize.Value.ToString() != "")
        {
            if (this.txtPageSize.Value.Trim().Length >= 5)
            {
                Pager.PageSize         = 100;
                this.txtPageSize.Value = "100";
            }
            else
            {
                Pager.PageSize = this.txtPageSize.Value.Trim().ToInt(0);
            }
        }
        if (!IsPostBack)
        {
            if (Request.QueryString["type"] + "" == "2")
            {
                strwhere += " and IsAnswer=0";
                this.ddrlRep.SelectedValue = "0";
            }
        }

        List <Hi.Model.DIS_Suggest> LDis = new Hi.BLL.DIS_Suggest().GetList(Pager.PageSize, Pager.CurrentPageIndex, "Createdate", false, strwhere, out pageCount, out Counts);

        this.Rpt_Role.DataSource = LDis;
        this.Rpt_Role.DataBind();
        Pager.RecordCount = Counts;
        page = Pager.CurrentPageIndex.ToString();
    }
示例#3
0
    public void Bind()
    {
        int    pageCount = 0;
        int    Counts    = 0;
        string strwhere  = string.Empty;

        if (ViewState["strwhere"] != null)
        {
            strwhere += ViewState["strwhere"].ToString();
        }
        strwhere += " and isnull(dr,0)=0 and Stype=0 and DisUserID=" + this.UserID + " and not exists(select 1 from DIS_Suggest s where s.suggest=DIS_Suggest.suggest and DIS_Suggest.id<s.id)";

        if (this.txtPager.Value.Trim().ToString() != "")
        {
            Pager.PageSize = int.Parse(this.txtPager.Value.Trim());
        }

        List <Hi.Model.DIS_Suggest> suggest = new Hi.BLL.DIS_Suggest().GetList(Pager.PageSize, Pager.CurrentPageIndex, "ts", true, strwhere, out pageCount, out Counts);

        this.rptmessage.DataSource = suggest;
        this.rptmessage.DataBind();
        Pager.RecordCount = Counts;
        page = Pager.CurrentPageIndex.ToString();
    }
示例#4
0
    public string billys    = string.Empty; //本月账单应收

    /// <summary>
    /// 企业统计数据
    /// </summary>
    /// <param name="JSon"></param>
    /// <returns></returns>
    public ResultJSC GetCompNum(string JSon)
    {
        try
        {
            #region JSon取值

            string UserID = string.Empty;
            string CompID = string.Empty;

            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["UserID"].ToString() != "" && JInfo["CompID"].ToString() != "")
            {
                UserID = JInfo["UserID"].ToString();
                CompID = JInfo["CompID"].ToString();
            }
            else
            {
                return(new ResultJSC()
                {
                    Result = "F", Description = "参数异常"
                });
            }

            if (!new Common().IsLegitUser(int.Parse(UserID), out user, int.Parse(CompID)))
            {
                return new ResultJSC()
                       {
                           Result = "F", Description = "未找到用户信息"
                       }
            }
            ;

            comp = new Hi.BLL.BD_Company().GetModel(Convert.ToInt32(CompID));
            if (comp == null)
            {
                return new ResultJSC()
                       {
                           Result = "F", Description = "未找到企业信息"
                       }
            }
            ;


            #endregion

            //获取当前时间
            DateTime date = DateTime.Now;
            //当天的0点0分
            DateTime day0 = new DateTime(date.Year, date.Month, date.Day, 0, 0, 0);
            //当月第一天
            DateTime day1 = new DateTime(date.Year, date.Month, 1);
            //获取当前时间加一天
            DateTime Sday = date.AddDays(1);

            #region 销售订单

            //销售订单
            List <Hi.Model.DIS_Order> orderl = OrderBll.GetList("", " isnull(dr,0)=0 and Otype!=9 and CompID=" + comp.ID,
                                                                "");
            if (orderl != null)
            {
                if (orderl.Count > 0)
                {
                    //待审核订单个数
                    NotCount = orderl.FindAll(p => p.OState == (int)Enums.OrderState.待审核).Count;

                    //待发货订单个数
                    DeliveryCount =
                        orderl.FindAll(
                            p =>
                            p.OState == (int)Enums.OrderState.已审 && p.ReturnState == (int)Enums.ReturnState.未退货 &&
                            (p.PayState == (int)Enums.PayState.已支付 || p.PayState == (int)Enums.PayState.部分支付 ||
                             (p.PayState == (int)Enums.PayState.未支付 && p.Otype == (int)Enums.OType.赊销订单))).Count;

                    //当日订单数
                    DayOrderCount = orderl.FindAll(order =>
                                                   (order.ReturnState == (int)Enums.ReturnState.未退货 &&
                                                    order.OState >= (int)Enums.OrderState.待审核 &&
                                                    order.CreateDate >= day0)
                                                   ).Count;

                    //本月订单数
                    OrderCount =
                        orderl.FindAll(
                            p =>
                            p.ReturnState == (int)Enums.ReturnState.未退货 &&
                            (p.OState == (int)Enums.OrderState.已审 || p.OState == (int)Enums.OrderState.已发货 ||
                             p.OState == (int)Enums.OrderState.已到货) && p.CreateDate >= day1 && p.CreateDate <= Sday)
                        .Count;
                    //待收款订单
                    //PayOrder = orderl.FindAll(p => (p.OState == (int)Enums.OrderState.已审 || p.OState == (int)Enums.OrderState.已到货 || p.OState == (int)Enums.OrderState.已发货) && p.PayState == (int)Enums.PayState.未支付).Count;

                    PayOrder =
                        orderl.FindAll(
                            p =>
                            ((p.OState == (int)Enums.OrderState.已审 || p.OState == (int)Enums.OrderState.已到货 ||
                              p.OState == (int)Enums.OrderState.已发货) &&
                             (p.PayState == (int)Enums.PayState.未支付 || p.PayState == (int)Enums.PayState.部分支付) &&
                             p.Otype == (int)Enums.OType.赊销订单) ||
                            ((p.OState == (int)Enums.OrderState.已审 || p.OState == (int)Enums.OrderState.已到货 ||
                              p.OState == (int)Enums.OrderState.已发货) &&
                             (p.PayState == (int)Enums.PayState.未支付 || p.PayState == (int)Enums.PayState.部分支付) &&
                             p.Otype != (int)Enums.OType.赊销订单)).Count;
                }
            }

            #endregion

            #region 退货订单

            List <Hi.Model.DIS_OrderReturn> rOl = OrderReturnBll.GetList("", " isnull(dr,0)=0 and CompID=" + comp.ID,
                                                                         "");
            if (rOl != null)
            {
                if (rOl.Count > 0)
                {
                    //退货待审订单个数
                    ReturnCount = rOl.FindAll(R => R.ReturnState == 1).Count;
                    ReturnMoney = rOl.FindAll(R => R.ReturnState == 2).Count;
                }
            }

            #endregion

            #region 企业钱包审核

            List <Hi.Model.PAY_PrePayment> Exa = PaymentBLL.GetList("", " isnull(dr,0)=0 and CompID=" + comp.ID, "");
            if (Exa != null)
            {
                if (Exa.Count > 0)
                {
                    PaymentCount = Exa.FindAll(E => E.AuditState == 0 && E.Start == 1).Count;
                }
            }

            #endregion

            #region 经销商审核

            List <Hi.Model.BD_Distributor> disList = disBll.GetList("", " isnull(dr,0)=0 and CompID=" + comp.ID, "");

            if (disList != null)
            {
                if (disList.Count > 0)
                {
                    //经销商待审核个数
                    disCount = disList.FindAll(D => D.AuditState == 0).Count;

                    //总经销商总个数
                    CountSum = disList.Count;

                    //新增经销商个数
                    CountNew =
                        disList.FindAll(D => D.CreateDate >= day1 && D.CreateDate <= Sday && D.AuditState == 2).Count;
                }
            }

            #endregion

            #region 当天收款  当天销售额

            //收款
            string strDay =
                "SELECT SUM(Price) as Price FROM [dbo].[CompCollection_view] where OrderID not in(select ID from Dis_Order where ISNULL(dr,0)=0 and Otype=9 and CompID=" +
                comp.ID + ") and CompID=" + comp.ID +
                " and Date>='" + day0 + "' and Date<='" + Sday + "'";

            DataTable dtDay = SqlHelper.Query(SqlHelper.LocalSqlServer, strDay).Tables[0];
            if (dtDay != null)
            {
                if (dtDay.Rows.Count > 0)
                {
                    decimal Price = dtDay.Rows[0]["Price"].ToString() == ""
                        ? sum.ToString().ToDecimal()
                        : Convert.ToDecimal(dtDay.Rows[0]["Price"]);
                    dayPaggerSum = (Price / 10000).ToString();
                }
            }

            //销售额
            string daysql = "SELECT SUM(sumAmount) as sumAmount FROM [dbo].[MonthSaleRpt_view] where CompID=" +
                            comp.ID + " and CreateDate>='" + day0 + "' and CreateDate<='" + Sday +
                            "' and OState in (2,4,5)";

            DataTable dayDt = SqlHelper.Query(SqlHelper.LocalSqlServer, daysql).Tables[0];
            if (dayDt != null)
            {
                if (dayDt.Rows.Count > 0)
                {
                    decimal sumAmount = dayDt.Rows[0]["sumAmount"].ToString() == ""
                        ? sum.ToString().ToDecimal()
                        : Convert.ToDecimal(dayDt.Rows[0]["sumAmount"]);

                    DaySum = (sumAmount / 10000).ToString();
                }
            }


            #endregion

            #region 本月收款  本月应收  本月销售额

            //本月收款
            string paggersql =
                "SELECT SUM(Price) as Price FROM [dbo].[CompCollection_view] where OrderID not in(select ID from Dis_Order where ISNULL(dr,0)=0 and Otype=9 and CompID=" +
                comp.ID + ") and CompID=" + comp.ID +
                " and Date>='" + day1 + "' and Date<='" + Sday + "'";

            DataTable paggerdt = SqlHelper.Query(SqlHelper.LocalSqlServer, paggersql).Tables[0];
            if (paggerdt != null)
            {
                if (paggerdt.Rows.Count > 0)
                {
                    decimal Price = paggerdt.Rows[0]["Price"].ToString() == ""
                        ? sum.ToString().ToDecimal()
                        : Convert.ToDecimal(paggerdt.Rows[0]["Price"]);
                    paggerSum = (Price / 10000).ToString();
                }
            }

            //本月应收
            string ArrearageSql =
                "SELECT SUM(AuditAmount-PayedAmount) as AuditAmount FROM [dbo].[ArrearageRpt_view] where Otype!=9 and CompID=" +
                comp.ID +
                " and CreateDate>='" + day1 + "' and CreateDate<='" + Sday + "'";

            DataTable ArrearageDt = SqlHelper.Query(SqlHelper.LocalSqlServer, ArrearageSql).Tables[0];
            if (ArrearageDt != null)
            {
                if (ArrearageDt.Rows.Count > 0)
                {
                    decimal AuditAmount = ArrearageDt.Rows[0]["AuditAmount"].ToString() == ""
                        ? sum.ToString().ToDecimal()
                        : Convert.ToDecimal(ArrearageDt.Rows[0]["AuditAmount"]);
                    ArrearageSum = (AuditAmount / 10000).ToString();
                }
            }

            //本月销售额
            string monthsql = "SELECT SUM(sumAmount) as sumAmount FROM [dbo].[MonthSaleRpt_view] where  CompID=" +
                              comp.ID + " and CreateDate>='" + day1 + "' and CreateDate<='" + Sday +
                              "' and OState in(2,4,5)";

            DataTable monthDt = SqlHelper.Query(SqlHelper.LocalSqlServer, monthsql).Tables[0];
            if (monthDt != null)
            {
                if (monthDt.Rows.Count > 0)
                {
                    decimal sumAmount = monthDt.Rows[0]["sumAmount"].ToString() == ""
                        ? sum.ToString().ToDecimal()
                        : Convert.ToDecimal(monthDt.Rows[0]["sumAmount"]);

                    MonthSum = (sumAmount / 10000).ToString();
                }
            }


            #endregion

            #region 待回复留言

            List <Hi.Model.DIS_Suggest> LDis = new Hi.BLL.DIS_Suggest().GetList("",
                                                                                " isnull(dr,0)=0 and compid=" + comp.ID, "");

            if (LDis.Count > 0)
            {
                SuggectCount = LDis.FindAll(S => S.IsAnswer == 0).Count;
            }

            #endregion

            #region 本月账单收款,本月账单应收

            //账单收款
            string billsksql = string.Format(@"SELECT sum(Price)  as price FROM [dbo].[CompCollection_view] 
                             where OrderID  in(select ID from Dis_Order 
                             where ISNULL(dr,0)=0 and Otype=9 and CompID={0}) and CompID={0}", comp.ID);

            DataTable billskdt = SqlHelper.Query(SqlHelper.LocalSqlServer, billsksql).Tables[0];
            if (billskdt != null)
            {
                if (billskdt.Rows.Count > 0)
                {
                    decimal Price = billskdt.Rows[0]["Price"].ToString() == ""
                        ? sum.ToString().ToDecimal()
                        : Convert.ToDecimal(billskdt.Rows[0]["Price"]);
                    billskSum = (Price / 10000).ToString("N");
                }
            }
            //账单应收
            string billyssql =
                string.Format(
                    @"select sum(AuditAmount-PayedAmount) AuditAmount from(select * from [dbo].[ArrearageRpt_view] where  CompID={0} and Otype=9 )M  where compID={0}",
                    comp.ID);
            DataTable billysdt = SqlHelper.Query(SqlHelper.LocalSqlServer, billyssql).Tables[0];
            if (billysdt != null)
            {
                if (billysdt.Rows.Count > 0)
                {
                    decimal Price = billysdt.Rows[0]["AuditAmount"].ToString() == ""
                        ? sum.ToString().ToDecimal()
                        : Convert.ToDecimal(billysdt.Rows[0]["AuditAmount"]);
                    billys = (Price / 10000).ToString("N");
                }
            }

            #endregion

            return(new ResultJSC()
            {
                Result = "T",
                Description = "返回正确",
                MonthSum = MonthSum,
                OrderCount = OrderCount.ToString(),
                PaggerSum = paggerSum,
                ArrearageSum = ArrearageSum,
                CountSum = CountSum.ToString(),
                CountNew = CountNew.ToString(),
                DayPaggerSum = dayPaggerSum,
                DaySum = DaySum,
                DayCount = DayOrderCount.ToString(),
                billskSum = billskSum,
                billys = billys
            });
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "GetCompNum:" + JSon);
            return(null);
        }
    }
示例#5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!(Session["UserModel"] as LoginModel).IsExistRole)
        {
            Response.Redirect("~/Distributor/UserEdit.aspx", true);
        }

        //获取当前时间
        DateTime date = DateTime.Now;
        //当天0点0分
        DateTime day0 = new DateTime(date.Year, date.Month, date.Day, 0, 0, 0);
        //获取当前时间加一天
        DateTime Sday = day0.AddDays(1);

        //当月第一天
        DateTime day1 = new DateTime(date.Year, date.Month, 1);
        //本月  最后一天  多加一天
        DateTime mothday = day1.AddMonths(1);

        user = new Hi.BLL.SYS_Users().GetModel(this.UserID);

        orderl = new Hi.BLL.DIS_Order().GetList("", " isnull(dr,0)=0 and Otype<>9 and OState<>6  and CompID=" + this.CompID + " and DisID=" + this.DisID, " CreateDate desc");
        if (orderl != null)
        {
            #region

            //当天订单数
            dayOrderCount = orderl.FindAll(
                p => (p.OState == 2 || p.OState == 3 || p.OState == 4 || p.OState == 5 || p.OState == 7) && p.CreateDate >= day0 && p.CreateDate < Sday).Count;

            //本月订单数
            orderCount = orderl.FindAll(
                p => (p.OState == 2 || p.OState == 3 || p.OState == 4 || p.OState == 5 || p.OState == 7) && p.CreateDate >= day1 && p.CreateDate < mothday).Count;

            #endregion
            orderll = orderl.FindAll(p => (p.PayState == 0 || p.PayState == 1));
        }
        List <Hi.Model.DIS_Suggest> suggest = new Hi.BLL.DIS_Suggest().GetList("", " isnull(dr,0)=0 and Stype=0 and isanswer=1 and DisUserID=" + this.UserID, "");
        message = suggest.Count;
        if (message == 0)
        {
            //imessage.Attributes.Add("style", "display:none");
        }
        price = Convert.ToDecimal(new Hi.BLL.PAY_PrePayment().sums(this.DisID, this.CompID)).ToString("0.00");
        dis   = new Hi.BLL.BD_Distributor().GetModel(this.DisID);
        if (dis != null)//add by hgh  出现为null值
        {
            //if ( dis.CreditType == 0)
            //{
            //lisalesorder.Attributes.Add("style", "background-color:#fbfbfb");
            //}

            Hi.Model.BD_DisType distypemodel = new Hi.BLL.BD_DisType().GetModel(dis.DisTypeID);
            if (distypemodel != null)
            {
                disType = distypemodel.TypeName;
            }
            Hi.Model.BD_DisArea disaddrmodel = new Hi.BLL.BD_DisArea().GetModel(dis.AreaID);
            if (disaddrmodel != null)
            {
                disAreaID = disaddrmodel.AreaName;
            }
        }
        #region 促销商品

        string    Cx_sql = string.Format(@"SELECT count(1) num from BD_Goods
where ID in (SELECT GoodsID from BD_PromotionDetail where ProID in
(SELECT ID from BD_Promotion where compID={0} and ProStartTime<=getdate() 
and ProStartTime<=GETDATE() and DATEADD(D,1,ProEndTime)>= getDate() and IsEnabled=1	))and ID not in (	
select GoodsID from BD_GoodsAreas where	compID={0} and DisID={1} and isnull(dr,0)=0)
and compid= {0} and ISNULL(dr,0)=0 and IsEnabled = 1 and IsOffLine=1 ", this.CompID, this.DisID);
        DataTable Cx_Dt  = SqlHelper.Query(SqlHelper.LocalSqlServer, Cx_sql).Tables[0];
        if (Cx_Dt != null)
        {
            if (Cx_Dt.Rows.Count > 0)
            {
                decimal sum_CX = Convert.ToDecimal(Cx_Dt.Rows[0]["num"]);
                Cx_Sum = sum_CX.ToString();
            }
        }

        #endregion

        #region  快过期商品 goods_Sum
        //当前时间
        DateTime now = DateTime.Now;
        //快到期时间
        DateTime today = now.AddDays(30);

        string goods_sql = string.Format(@"select * from YZT_GoodsStock s where s.validDate<='" + today + "'" + " and DisID=" + DisID + " and dr=0 ");

        DataTable goods_Dt = SqlHelper.Query(SqlHelper.LocalSqlServer, goods_sql).Tables[0];
        if (goods_Dt != null && goods_Dt.Rows.Count > 0)
        {
            goods_Sum = goods_Dt.Rows.Count.ToString();
        }
        #endregion

        #region 当天订购额
        //add by hgh  //包含已退订单金额、退单处理
        string daysql = "SELECT SUM(AuditAmount) as AuditAmount FROM [dbo].[DIS_Order] where ostate in (2,3,4,5,7) and DisID=" +
                        this.DisID + " and CompID=" + this.CompID + " and CreateDate>='" + day0 + "' and CreateDate<'" + Sday + "'";
        DataTable dayDt = SqlHelper.Query(SqlHelper.LocalSqlServer, daysql).Tables[0];
        if (dayDt != null)
        {
            if (dayDt.Rows.Count > 0)
            {
                decimal sumAmount = dayDt.Rows[0]["AuditAmount"].ToString() == ""
                    ? sum.ToString().ToDecimal()
                    : Convert.ToDecimal(dayDt.Rows[0]["AuditAmount"]);
                DaySum = (sumAmount).ToString("N");
            }
        }
        #endregion

        #region 本月订购额
        string    monthsql = "SELECT SUM(AuditAmount) as AuditAmount FROM DIS_Order where OState in (2,3,4,5,7) and isnull(dr,0)=0 and Otype<>9 and DisID=" + this.DisID + " and CompID=" + this.CompID + " and CreateDate>='" + day1 + "' and CreateDate<'" + mothday + "'";
        DataTable monthDt  = SqlHelper.Query(SqlHelper.LocalSqlServer, monthsql).Tables[0];
        if (monthDt != null)
        {
            if (monthDt.Rows.Count > 0)
            {
                decimal sumAmount = monthDt.Rows[0]["AuditAmount"].ToString() == "" ? sum.ToString().ToDecimal() : Convert.ToDecimal(monthDt.Rows[0]["AuditAmount"]);
                MonthSum = (sumAmount).ToString("N");
            }
        }
        #endregion

        #region 当天付款额
        //付款额    add by hgh  CompCollection_view 状态   and status!=3
        string daypaggersql = "SELECT SUM(Price) as Price FROM [dbo].[CompCollection_view] where DisID=" + this.DisID +
                              "and CompID=" + this.CompID + " and status!=3 and Date>='" + day0 + "' and Date<'" + Sday + "' AND vedf9=1 ";

        DataTable daypaggerdt = SqlHelper.Query(SqlHelper.LocalSqlServer, daypaggersql).Tables[0];
        if (daypaggerdt != null)
        {
            if (daypaggerdt.Rows.Count > 0)
            {
                decimal Price = daypaggerdt.Rows[0]["Price"].ToString() == ""
                    ? sum.ToString().ToDecimal()
                    : Convert.ToDecimal(daypaggerdt.Rows[0]["Price"]);
                DayPaymentSum = (Price).ToString("N");
            }
        }

        #endregion

        #region 本月付款额
        //本月付款额    add by hgh  CompCollection_view 状态   and status!=3
        string paggersql = "SELECT SUM(Price) as Price FROM [dbo].[CompCollection_view] where OrderID not in (select ID from Dis_Order where ISNULL(dr,0)=0 and Otype=9) and DisID=" + this.DisID + "  and status!=3 and CompID=" + this.CompID + " and Date>='" + day1 + "' and Date<'" + mothday + "' AND vedf9=1 ";

        DataTable paggerdt = SqlHelper.Query(SqlHelper.LocalSqlServer, paggersql).Tables[0];
        if (paggerdt != null)
        {
            if (paggerdt.Rows.Count > 0)
            {
                decimal Price = paggerdt.Rows[0]["Price"].ToString() == "" ? sum.ToString().ToDecimal() : Convert.ToDecimal(paggerdt.Rows[0]["Price"]);
                PaymentSum = (Price).ToString("N");
            }
        }
        #endregion

        #region 本月应付额
        //本月应付额

        decimal AuditAmount = 0;
        decimal payAmount   = 0;
        decimal payyzf      = 0;

        //赊销订单  未支付的
        //string ArrearageSql = "SELECT SUM(AuditAmount) as AuditAmount FROM [dbo].[ArrearageRpt_view] where DisID=" + user.DisID + "and CompID=" + user.CompID + " and CreateDate>='" + day1 + "' and CreateDate<='" + Sday + "'";

        //DataTable ArrearageDt = SqlHelper.Query(SqlHelper.LocalSqlServer, ArrearageSql).Tables[0];
        //if (ArrearageDt != null)
        //{
        //    if (ArrearageDt.Rows.Count > 0)
        //    {
        //        AuditAmount = ArrearageDt.Rows[0]["AuditAmount"].ToString() == "" ? sum.ToString().ToDecimal() : Convert.ToDecimal(ArrearageDt.Rows[0]["AuditAmount"]);
        //    }
        //}

        //未支付订单金额
        //string paysql = "  select SUM(AuditAmount) as AuditAmount from DIS_Order where (( Otype=1 and OState not in (-1,0,1)  and PayState in (0,1) ) or( Otype<>1 and OState=2   and PayState in (0,1) )) and OState<>6 and ReturnState=0 and isnull(dr,0)=0 and Otype!=9 and CompID=" + this.CompID + " and DisID=" + this.DisID + " and CreateDate>='" + day1 + "' and CreateDate<='" + Sday + "'";

        //DataTable payDt = SqlHelper.Query(SqlHelper.LocalSqlServer, paysql).Tables[0];
        //if (payDt != null && payDt.Rows.Count > 0)
        //{
        //    payAmount = payDt.Rows[0]["AuditAmount"].ToString() == "" ? 0 : payDt.Rows[0]["AuditAmount"].ToString().ToDecimal(0);
        //}
        //paysql = "  select SUM(PayedAmount) as PayedAmount from DIS_Order where (( Otype=1 and OState not in (-1,0,1)  and PayState in (0,1) ) or( Otype<>1 and OState=2   and PayState in (0,1) )) and OState<>6 and ReturnState=0 and isnull(dr,0)=0 and Otype!=9 and CompID=" + this.CompID + " and DisID=" + this.DisID + " and CreateDate>='" + day1 + "' and CreateDate<='" + Sday + "'";
        //payDt = SqlHelper.Query(SqlHelper.LocalSqlServer, paysql).Tables[0];
        //if (payDt != null && payDt.Rows.Count > 0)
        //{
        //    payyzf = payDt.Rows[0]["PayedAmount"].ToString() == "" ? 0 : payDt.Rows[0]["PayedAmount"].ToString().ToDecimal(0);
        //}
        //PayableSum = (payAmount - payyzf + AuditAmount).ToString("N");


        //edit by hgh   正常合同 总额-已付
        string    paysql = "  select SUM(AuditAmount)-SUM(PayedAmount) as AuditAmount from DIS_Order where OState in(2,3,5) and isnull(dr,0)=0 and Otype!=9 and CompID=" + this.CompID + " and DisID=" + this.DisID + " and CreateDate>='" + day1 + "' and CreateDate<'" + Sday + "'";
        DataTable payDt  = SqlHelper.Query(SqlHelper.LocalSqlServer, paysql).Tables[0];
        if (payDt != null && payDt.Rows.Count > 0)
        {
            payAmount = payDt.Rows[0]["AuditAmount"].ToString() == "" ? 0 : payDt.Rows[0]["AuditAmount"].ToString().ToDecimal(0);
        }
        PayableSum = payAmount.ToString("N");
        #endregion

        #region 商家公告

        List <Hi.Model.BD_CompNews> LNew = new Hi.BLL.BD_CompNews().GetList("top 3 *", "isnull(dr,0)=0 and IsEnabled=1 and Compid=" + this.CompID + " ", " istop desc,createdate desc");
        string Html = "";
        if (LNew.Count > 0)
        {
            for (int i = 0; i < LNew.Count; i++)
            {
                if (LNew[i].ShowType == null)
                {
                    LNew[i].ShowType = "";
                }

                if (i <= 4)
                {
                    string type = LNew[i].ShowType == "1" ? "top" : LNew[i].ShowType == "2" ? "red" : LNew[i].ShowType == "1,2" ? "top red" : "";
                    Html += "<li class='" + type + "'><a title='" + LNew[i].NewsTitle + "' href=\"CompNewInfo.aspx?KeyID=" + Common.DesEncrypt(LNew[i].ID.ToString(), Common.EncryptKey) + "&Type=3\">【" + Common.GetCPNewStateName(LNew[i].NewsType) + "】" + (LNew[i].NewsTitle.Length > 16 ? LNew[i].NewsTitle.Substring(0, 16) + "..." : LNew[i].NewsTitle) + "</a>" + IsEnd(LNew[i].PmID) + (LNew[i].ShowType.IndexOf("1") >= 0 ? "<i class='newIcon'></i>" : "") + "<i class='date1'>" + LNew[i].CreateDate.ToString("yyyy-MM-dd") + "</i></li>";
                }
            }
            ULNewList.InnerHtml = Html;
        }
        else
        {
            //ULNewList.InnerHtml = "<li style='text-align:center'><span>暂无公告</span></li>";
            ULNewList.InnerHtml = "<div class='nomh-box'><i class='nomh-i'></i>暂无公告</div>";
        }
        #endregion

        if (!IsPostBack)
        {
            if (IsDisAdmin(this.UserID))
            {
                if (user.UserPwd == Util.md5("123456"))
                {
                    DisImport.Attributes.Add("style", "display:block");
                    zzc.Attributes.Add("style", "display:block");
                    return;
                }
            }
        }
    }