Esempio n. 1
0
        /// <summary>
        /// 获取区域销售统计合计
        /// </summary>
        /// <param name="companyId">公司编号</param>
        /// <param name="startTime">开始时间(出团时间)</param>
        /// <param name="entTime">结束时间(出团时间)</param>
        /// <param name="deptId">部门编号</param>
        /// <param name="searchInfo">查询信息</param>
        /// <param name="tourType">团队类型</param>
        /// <param name="heJi">合计数</param>
        public void GetQuYuXiaoShouTongJiHeJi(int companyId, DateTime?startTime, DateTime?entTime, int deptId
                                              , Model.StatisticStructure.AreaSoldStatSearch searchInfo, Model.EnumType.TourStructure.TourType?tourType
                                              , out int heJi)
        {
            heJi = 0;
            StringBuilder cmdText = new StringBuilder();

            cmdText.Append(" SELECT SUM(PeopleNumber-LeaguePepoleNum) FROM tbl_TourOrder AS A ");
            cmdText.AppendFormat(" INNER JOIN tbl_Customer AS B ON A.BuyCompanyId=B.Id AND B.CompanyId={0} ", companyId);
            if (searchInfo != null)
            {
                if (!string.IsNullOrEmpty(searchInfo.CityIds))
                {
                    cmdText.AppendFormat(" AND B.CityId IN({0})", searchInfo.CityIds);
                }
                if (!string.IsNullOrEmpty(searchInfo.SalerIds))
                {
                    cmdText.AppendFormat(" AND B.SaleId IN({0}) ", searchInfo.SalerIds);
                }
            }
            cmdText.AppendFormat(" AND B.CityId>0 ");
            cmdText.AppendFormat(" INNER JOIN tbl_CompanyUser AS C ON C.Id=A.PerTimeSellerId AND C.DepartId={0} ", deptId);
            cmdText.Append(" WHERE A.OrderState NOT IN(3,4) AND A.IsDelete='0' ");
            cmdText.AppendFormat(" AND A.SellCompanyId={0} ", companyId);
            //出团时间
            if (startTime.HasValue || entTime.HasValue)
            {
                if (startTime.HasValue)
                {
                    cmdText.AppendFormat(" AND A.LeaveDate > '{0}' ", startTime.Value.ToShortDateString());
                }
                if (entTime.HasValue)
                {
                    cmdText.AppendFormat(" AND A.LeaveDate < '{0}' ", entTime.Value.ToShortDateString());
                }
            }
            if (tourType.HasValue)
            {
                cmdText.AppendFormat(" and A.TourClassId = {0} ", (int)tourType.Value);
            }

            DbCommand cmd = _db.GetSqlStringCommand(cmdText.ToString());

            using (IDataReader rdr = DbHelper.ExecuteReader(cmd, _db))
            {
                if (rdr.Read())
                {
                    if (!rdr.IsDBNull(0))
                    {
                        heJi = rdr.GetInt32(0);
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 获取区域销售统计合计
        /// </summary>
        /// <param name="companyId">公司编号</param>
        /// <param name="startTime">开始时间(出团时间)</param>
        /// <param name="entTime">结束时间(出团时间)</param>
        /// <param name="deptId">部门编号</param>
        /// <param name="searchInfo">查询信息</param>
        /// <param name="tourType">团队类型</param>
        /// <param name="heJi">合计数</param>
        public void GetQuYuXiaoShouTongJiHeJi(int companyId, DateTime?startTime, DateTime?entTime, int deptId
                                              , Model.StatisticStructure.AreaSoldStatSearch searchInfo, Model.EnumType.TourStructure.TourType?tourType
                                              , out int heJi)
        {
            heJi = 0;
            if (companyId < 1 || deptId < 1)
            {
                return;
            }

            idal.GetQuYuXiaoShouTongJiHeJi(companyId, startTime, entTime, deptId, searchInfo, tourType, out heJi);
        }