Exemple #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         //获取操作类型
         string setcont = Utils.GetFormValue("GetCont");
         if (setcont.Length <= 0)
         {
             #region 页面列表初始化
             iframeId.Value = Utils.GetQueryStringValue("iframeId");
             //实例化枚举
             EyouSoft.Model.EnumType.CompanyStructure.CommissionType type = new EyouSoft.Model.EnumType.CompanyStructure.CommissionType();
             //获取状态
             int types = Utils.GetInt(Utils.GetQueryStringValue("type"));
             //判断状态正确
             if (types > 0)
             {
                 #region 页面显示设定
                 //判断状态
                 type =
                     types == (int)EyouSoft.Model.EnumType.CompanyStructure.CommissionType.后返 ?
                     EyouSoft.Model.EnumType.CompanyStructure.CommissionType.后返 :
                     types == (int)EyouSoft.Model.EnumType.CompanyStructure.CommissionType.现返 ?
                     EyouSoft.Model.EnumType.CompanyStructure.CommissionType.现返 : EyouSoft.Model.EnumType.CompanyStructure.CommissionType.未确定;
                 //是否显示操作赋值
                 isnow = !(type == EyouSoft.Model.EnumType.CompanyStructure.CommissionType.后返);
                 #endregion
                 //获取客户单位编号
                 customerid = Utils.GetInt(Utils.GetQueryStringValue("customerid"));
                 //客户单位操作员编号
                 contactid = Utils.GetInt(Utils.GetQueryStringValue("contactid"));
                 if (customerid > 0 && contactid > 0)
                 {
                     //BLL
                     EyouSoft.BLL.StatisticStructure.BCommissionStat bll = new EyouSoft.BLL.StatisticStructure.BCommissionStat();
                     //qModel
                     MCommissionStatSeachInfo qModel = new MCommissionStatSeachInfo();
                     #region 查询实体
                     //单位名称
                     qModel.CustomerName = Utils.GetQueryStringValue("CustomerName");
                     //获取对方操作员转化成Int
                     int Contact = Utils.GetInt(Utils.GetQueryStringValue("czyId"));
                     //定义对方操作员int数组
                     int[] ContactId;
                     //对方操作员-存在
                     if (Contact > 0)
                     {
                         ContactId = new int[1];
                         //对方操作员Id赋值
                         ContactId[0] = Contact;
                     }
                     else
                     {
                         ContactId = null;
                     }
                     //我社操作员
                     string Operator = Utils.GetQueryStringValue("OperatorId");
                     //存在我社操作员
                     if (Operator.Length > 0)
                     {
                         //拆分我社操作员
                         string[] OperatorSTR = Operator.Split(',');
                         //更具拆分情况定义我蛇操作员ID数组
                         int[] OperatorId = new int[OperatorSTR.Length];
                         //循环赋值
                         for (int i = 0; i < OperatorSTR.Length; i++)
                         {
                             OperatorId[i] = Utils.GetInt(OperatorSTR[i]);
                         }
                         //查询实体赋值
                         qModel.OperatorId = OperatorId;
                     }
                     else
                     {
                         qModel.OperatorId = null;
                     }
                     #region 时间类型查询条件赋值
                     //出团时间-始
                     DateTime?LeaveDateStart = null;
                     if (Utils.GetQueryStringValue("LeaveDateStart").Length > 0)
                     {
                         LeaveDateStart = Utils.GetDateTime(Utils.GetQueryStringValue("LeaveDateStart"));
                     }
                     //出团时间-终
                     DateTime?LeaveDateEnd = null;
                     if (Utils.GetQueryStringValue("LeaveDateEnd").Length > 0)
                     {
                         LeaveDateEnd = Utils.GetDateTime(Utils.GetQueryStringValue("LeaveDateEnd"));
                     }
                     //下单时间-终
                     DateTime?OrderDateEnd = null;
                     if (Utils.GetQueryStringValue("OrderDateEnd").Length > 0)
                     {
                         OrderDateEnd = Utils.GetDateTime(Utils.GetQueryStringValue("OrderDateEnd"));
                     }
                     //下单时间-始
                     DateTime?OrderDateStart = null;
                     if (Utils.GetQueryStringValue("OrderDateStart").Length > 0)
                     {
                         OrderDateStart = Utils.GetDateTime(Utils.GetQueryStringValue("OrderDateStart"));
                     }
                     #endregion
                     //查询实体赋值
                     //对方操作元
                     qModel.ContactId = ContactId;
                     //出团时间-始
                     qModel.LeaveDateStart = LeaveDateStart;
                     //出团时间-终
                     qModel.LeaveDateEnd = LeaveDateEnd;
                     //下单时间-终
                     qModel.OrderDateEnd = OrderDateEnd;
                     //下单时间-始
                     qModel.OrderDateStart = OrderDateStart;
                     #endregion
                     //IList
                     IList <MCommissionDetailInfo> ls = new List <MCommissionDetailInfo>();
                     ls = bll.GetCommissionDetails(pageSize, pageIndex, ref recordCount, SiteUserInfo.CompanyID, customerid, contactid, type, qModel);
                     //绑定列表
                     rptList.DataSource = ls;
                     rptList.DataBind();
                     //绑定分页
                     BindPage();
                 }
             }
             #endregion
         }
         else
         {
             #region 提交支付信息
             //切割数据
             string[]      the    = setcont.Split(';');
             int           len    = the.Length;
             string[][]    result = new string[len][];
             StringBuilder msg    = new StringBuilder();
             //循环支付
             for (int i = 0; i < len; i++)
             {
                 result[i] = the[i].Split(',');
                 //支付实体
                 EyouSoft.Model.StatisticStructure.MPayCommissionInfo info = new MPayCommissionInfo();
                 //BLL
                 EyouSoft.BLL.StatisticStructure.BCommissionStat bll = new EyouSoft.BLL.StatisticStructure.BCommissionStat();
                 #region 支付实体赋值
                 //计划编号
                 info.TourId = result[i][0];
                 //支付金额
                 info.Amount = Utils.GetDecimal(result[i][1]);
                 //订单编号
                 info.OrderId = result[i][2];
                 //客户单位编号
                 info.BuyerCompanyId = Utils.GetInt(result[i][3]);
                 //公司编号
                 info.CompanyId = SiteUserInfo.CompanyID;
                 //支付时间
                 info.PayTime = DateTime.Now;
                 //支付人编号
                 info.PayerId = SiteUserInfo.ID;
                 #endregion
                 //执行支付
                 int ret = bll.PayCommission(info);
                 //int ret = 1;
                 //拼接支付结果
                 if (ret == 1)
                 {
                     msg.AppendFormat("{0} 支付成功!\\n", result[i][5]);
                 }
                 else
                 {
                     msg.AppendFormat("{0} 支付失败!\\n", result[i][5]);
                 }
             }
             //提示支付结果
             Utils.ShowMsgAndCloseBoxy(msg.ToString(), Utils.GetFormValue("iframeId"), false);
             #endregion
         }
     }
 }
Exemple #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!CheckGrant(global::Common.Enum.TravelPermission.客户关系管理_返佣统计_栏目))
         {
             Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.客户关系管理_返佣统计_栏目, true);
         }
         //线路区域
         string type = Utils.GetQueryStringValue("type");
         //获取操作员
         if (type == "teamSelect")
         {
             GroupUser();
         }
         //BLL
         EyouSoft.BLL.StatisticStructure.BCommissionStat bll = new EyouSoft.BLL.StatisticStructure.BCommissionStat();
         //实例化查询实体
         MCommissionStatSeachInfo qModel = new MCommissionStatSeachInfo();
         #region 查询实体
         //单位名称
         qModel.CustomerName = Utils.GetQueryStringValue("CustomerName");
         //查询条件-单位名称
         txtCustomerName.Text = qModel.CustomerName;
         //组团社Id
         hd_teamId = Utils.GetQueryStringValue("hd_teamId");
         //组团社名称
         txt_teamName = Utils.GetQueryStringValue("txt_teamName");
         //获取对方操作员转化成Int
         int Contact = Utils.GetInt(Utils.GetQueryStringValue("czyId"));
         //定义对方操作员int数组
         int[] ContactId;
         //对方操作员-存在
         if (Contact > 0)
         {
             ContactId = new int[1];
             //对方操作员Id赋值
             ContactId[0]       = Contact;
             hd_ContactId.Value = Contact.ToString();
         }
         else
         {
             ContactId = null;
         }
         //我社操作员
         string Operator = Utils.GetQueryStringValue("OperatorId");
         //存在我社操作员
         if (Operator.Length > 0)
         {
             //拆分我社操作员
             string[] OperatorSTR = Operator.Split(',');
             //更具拆分情况定义我蛇操作员ID数组
             int[] OperatorId = new int[OperatorSTR.Length];
             //循环赋值
             for (int i = 0; i < OperatorSTR.Length; i++)
             {
                 OperatorId[i] = Utils.GetInt(OperatorSTR[i]);
             }
             //查询实体赋值
             qModel.OperatorId        = OperatorId;
             selectOperator1.OperId   = Operator;
             selectOperator1.OperName = Utils.GetQueryStringValue("OperatorIdName");
         }
         else
         {
             qModel.OperatorId = null;
         }
         #region 时间类型查询条件赋值
         //出团时间-始
         DateTime?LeaveDateStart = null;
         if (Utils.GetQueryStringValue("LeaveDateStart").Length > 0)
         {
             LeaveDateStart         = Utils.GetDateTime(Utils.GetQueryStringValue("LeaveDateStart"));
             txtLeaveDateStart.Text = ((DateTime)LeaveDateStart).ToString("yyyy-MM-dd");
         }
         //出团时间-终
         DateTime?LeaveDateEnd = null;
         if (Utils.GetQueryStringValue("LeaveDateEnd").Length > 0)
         {
             LeaveDateEnd         = Utils.GetDateTime(Utils.GetQueryStringValue("LeaveDateEnd"));
             txtLeaveDateEnd.Text = ((DateTime)LeaveDateEnd).ToString("yyyy-MM-dd");
         }
         //下单时间-终
         DateTime?OrderDateEnd = null;
         if (Utils.GetQueryStringValue("OrderDateEnd").Length > 0)
         {
             OrderDateEnd         = Utils.GetDateTime(Utils.GetQueryStringValue("OrderDateEnd"));
             txtOrderDateEnd.Text = ((DateTime)OrderDateEnd).ToString("yyyy-MM-dd");
         }
         //下单时间-始
         DateTime?OrderDateStart = null;
         if (Utils.GetQueryStringValue("OrderDateStart").Length > 0)
         {
             OrderDateStart         = Utils.GetDateTime(Utils.GetQueryStringValue("OrderDateStart"));
             txtOrderDateStart.Text = ((DateTime)OrderDateStart).ToString("yyyy-MM-dd");
         }
         #endregion
         //查询实体赋值
         //对方操作元
         qModel.ContactId = ContactId;
         //出团时间-始
         qModel.LeaveDateStart = LeaveDateStart;
         //出团时间-终
         qModel.LeaveDateEnd = LeaveDateEnd;
         //下单时间-终
         qModel.OrderDateEnd = OrderDateEnd;
         //下单时间-始
         qModel.OrderDateStart = OrderDateStart;
         #endregion
         //IList
         IList <MCommissionStatInfo> ls = new List <MCommissionStatInfo>();
         ls = bll.GetCommissions(pageSize, pageIndex, ref recordCount, SiteUserInfo.CompanyID, qModel);
         //判断总记录条数
         if (recordCount == 0)
         {
             //数据为空的时候显示提示信息
             lblMsg.Visible = true;
         }
         else
         {
             lblMsg.Visible = false;
         }
         //绑定列表
         rptList.DataSource = ls;
         rptList.DataBind();
         //绑定分页
         BindPage();
     }
 }
Exemple #3
0
        /// <summary>
        /// 获取客户返佣统计信息
        /// </summary>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="pageIndex">当前页数</param>
        /// <param name="recordCount">总记录数</param>
        /// <param name="companyId">公司Id</param>
        /// <param name="queryModel">查询实体</param>
        /// <returns></returns>
        public IList <MCommissionStatInfo> GetCommissions(int pageSize, int pageIndex, ref int recordCount, int companyId, MCommissionStatSeachInfo queryModel)
        {
            if (companyId <= 0)
            {
                return(null);
            }

            IList <MCommissionStatInfo> list = new List <MCommissionStatInfo>();
            const string strTableName        = "tbl_tourorder";
            const string strPk       = "BuyerContactId";
            string       strOrderBy  = string.Empty;
            string       strSqlWhere = GetSqlWhereByQueryModel(companyId, queryModel, ref strOrderBy);

            strSqlWhere += " group by BuyCompanyID,BuyerContactId  ";
            var strFiled = new StringBuilder(" BuyCompanyID,BuyerContactId ");

            strFiled.Append(@" ,(select [Name] from tbl_Customer as b where b.ID = tbl_tourorder.BuyCompanyID) as BuyCompanyName ");
            strFiled.Append(@" ,(select [Name] from tbl_CustomerContactInfo as c where c.ID = tbl_tourorder.BuyerContactId) as BuyerContactName ");
            strFiled.Append(@" ,sum(case when CommissionType = 1 then CommissionPrice * PeopleNumber else 0 end) as BeforeAmount ");
            strFiled.Append(@" ,sum(case when CommissionType = 2 then CommissionPrice * PeopleNumber else 0 end) as AfterAmount ");

            using (IDataReader dr = DbHelper.ExecuteReader(_db, pageSize, pageIndex, ref recordCount, strTableName, strPk, strFiled.ToString(), strSqlWhere, strOrderBy, true))
            {
                while (dr.Read())
                {
                    var model = new MCommissionStatInfo
                    {
                        CustomerId   = dr.IsDBNull(0) ? 0 : dr.GetInt32(0),
                        ContactId    = dr.IsDBNull(1) ? 0 : dr.GetInt32(1),
                        CustomerName = dr.IsDBNull(2) ? string.Empty : dr.GetString(2),
                        ContactName  = dr.IsDBNull(3) ? string.Empty : dr.GetString(3),
                        BeforeAmount = dr.IsDBNull(4) ? 0 : dr.GetDecimal(4),
                        AfterAmount  = dr.IsDBNull(5) ? 0 : dr.GetDecimal(5)
                    };

                    list.Add(model);
                }
            }

            return(list);
        }
Exemple #4
0
        /// <summary>
        /// 获取客户返佣统计信息
        /// </summary>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="pageIndex">当前页数</param>
        /// <param name="recordCount">总记录数</param>
        /// <param name="companyId">公司Id</param>
        /// <param name="queryModel">查询实体</param>
        /// <returns></returns>
        public IList <MCommissionStatInfo> GetCommissions(int pageSize, int pageIndex, ref int recordCount, int companyId, MCommissionStatSeachInfo queryModel)
        {
            if (companyId <= 0)
            {
                return(null);
            }

            return(_dal.GetCommissions(pageSize, pageIndex, ref recordCount, companyId, queryModel));
        }
Exemple #5
0
        /// <summary>
        /// 根据查询实体返回SqlWhere子句
        /// </summary>
        /// <param name="companyId">公司Id</param>
        /// <param name="queryModel">查询实体</param>
        /// <param name="strOrderBy">排序子句</param>
        /// <returns>SqlWhere子句</returns>
        private string GetSqlWhereByQueryModel(int companyId, MCommissionStatSeachInfo queryModel, ref string strOrderBy)
        {
            var strWhere = new StringBuilder(" BuyCompanyID > 0 and BuyerContactId > 0 and IsDelete = '0' ");

            strWhere.AppendFormat(" and SellCompanyId = {0} ", companyId);
            strWhere.AppendFormat(" and OrderState not in ({0},{1}) ", (int)Model.EnumType.TourStructure.OrderState.受理,
                                  (int)Model.EnumType.TourStructure.OrderState.留位过期);

            if (queryModel == null)
            {
                return(strWhere.ToString());
            }

            if (queryModel.ContactId != null && queryModel.ContactId.Length > 0)
            {
                strWhere.AppendFormat(" and BuyerContactId in ({0}) ", Utils.GetSqlIdStrByArray(queryModel.ContactId));
            }
            if (!string.IsNullOrEmpty(queryModel.ContactName))
            {
                strWhere.AppendFormat(" and BuyerContactName like '%{0}%' ", queryModel.ContactName);
            }
            if (queryModel.CustomerId != null && queryModel.CustomerId.Length > 0)
            {
                strWhere.AppendFormat(" and BuyCompanyID in ({0}) ", Utils.GetSqlIdStrByArray(queryModel.CustomerId));
            }
            if (!string.IsNullOrEmpty(queryModel.CustomerName))
            {
                strWhere.AppendFormat(" and BuyCompanyName like '%{0}%' ", queryModel.CustomerName);
            }
            if (queryModel.OperatorId != null && queryModel.OperatorId.Length > 0)
            {
                strWhere.AppendFormat(" and LastOperatorID in ({0}) ", Utils.GetSqlIdStrByArray(queryModel.OperatorId));
            }
            if (queryModel.LeaveDateStart.HasValue)
            {
                strWhere.AppendFormat(" and datediff(dd,'{0}',LeaveDate) >= 0 ", queryModel.LeaveDateStart.Value.ToShortDateString());
            }
            if (queryModel.LeaveDateEnd.HasValue)
            {
                strWhere.AppendFormat(" and datediff(dd,LeaveDate,'{0}') >= 0 ", queryModel.LeaveDateEnd.Value.ToShortDateString());
            }
            if (queryModel.OrderDateStart.HasValue)
            {
                strWhere.AppendFormat(" and datediff(dd,'{0}',IssueTime) >= 0 ", queryModel.OrderDateStart.Value.ToShortDateString());
            }
            if (queryModel.OrderDateEnd.HasValue)
            {
                strWhere.AppendFormat(" and datediff(dd,IssueTime,'{0}') >= 0 ", queryModel.OrderDateEnd.Value.ToShortDateString());
            }

            switch (queryModel.OrderByIndex)
            {
            case 0:
                strOrderBy = " BuyCompanyID asc, BuyerContactId asc ";
                break;

            case 1:
                strOrderBy = " BuyCompanyID desc, BuyerContactId desc ";
                break;

            default:
                strOrderBy = " BuyCompanyID desc, BuyerContactId desc ";
                break;
            }

            return(strWhere.ToString());
        }