| | |
| | | foreach (var item in this.RepClientList.DataSource as IEnumerable<OA_CorporateClients>) |
| | | { |
| | | item.LessOrderMoneyProperty = item.Contractmoney-item.OrderMoney; |
| | | var ssss = bll_eC_OrderBasicDAL.GetOrderById(item.Keyid, -1, CurrentUser.MemberId); |
| | | item.NoOverOderCount = ssss.Count; |
| | | if (ssss.Count > 0) |
| | | { |
| | | string ids = ""; |
| | | |
| | | item.NoOverOderCount = bll_eC_OrderBasicDAL.GetOrderById(item.Keyid, -1, CurrentUser.MemberId).Count; |
| | | foreach(var c_OrderBasic in ssss) |
| | | { |
| | | ids += c_OrderBasic.Keyid + ","; |
| | | } |
| | | ids = ids.Trim(','); |
| | | var eC_OrderBasics = bll_eC_OrderBasicDAL.GetOrderByIds(ids); |
| | | |
| | | |
| | | item.Weishoukuanjine = eC_OrderBasics.Sum(x => x.UnPayedMoney); |
| | | |
| | | |
| | | var sssssss = item.Paytime; |
| | | var Paydays = item.Paydays.HasValue? item.Paydays.Value:0; |
| | | var Shifouwanjie = item.Shifouwanjie.HasValue ? item.Shifouwanjie.Value : 2; |
| | | item.Yuqijine = 0; |
| | | foreach (var eC_OrderBasic in eC_OrderBasics) |
| | | { |
| | | //判断订单是否逾期 |
| | | var yuqi = false; |
| | | var ssdfsdf = eC_OrderBasic.CreateTime.Value.Date; |
| | | |
| | | if(sssssss == 1) |
| | | { |
| | | // 步骤1:获取当前时间的“本月第一天” |
| | | DateTime currentMonthFirstDay = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); |
| | | |
| | | if(ssdfsdf < currentMonthFirstDay) |
| | | { |
| | | yuqi = true; |
| | | } |
| | | } |
| | | else if (sssssss == 2) |
| | | { |
| | | // 步骤1:提取日期的年份和月份(忽略时分秒) |
| | | int year = DateTime.Now.Year; |
| | | int month = DateTime.Now.Month; |
| | | |
| | | // 步骤2:计算当前月份所属季度的起始月份(核心公式) |
| | | // 逻辑:(月份-1)/3 得到季度索引(0=Q1,1=Q2,2=Q3,3=Q4),再×3+1得到起始月 |
| | | int quarterStartMonth = ((month - 1) / 3) * 3 + 1; |
| | | |
| | | // 步骤3:组合成本季度第一天(仅日期,时分秒为00:00:00) |
| | | DateTime quarterFirstDay = new DateTime(year, quarterStartMonth, 1); |
| | | if (ssdfsdf < quarterFirstDay) |
| | | { |
| | | yuqi = true; |
| | | } |
| | | } |
| | | else if (sssssss == 3) |
| | | { |
| | | // 步骤1:提取日期的年份和月份(忽略时分秒) |
| | | int year = DateTime.Now.Year; |
| | | int month = DateTime.Now.Month; |
| | | |
| | | // 判断所属半年,确定起始月份 |
| | | int halfYearStartMonth = month <= 6 ? 1 : 7; |
| | | |
| | | // 组合成本半年第一天(时分秒默认00:00:00) |
| | | DateTime halfYearFirstDay = new DateTime(year, halfYearStartMonth, 1); |
| | | if (ssdfsdf < halfYearFirstDay) |
| | | { |
| | | yuqi = true; |
| | | } |
| | | } |
| | | else if (sssssss == 4) |
| | | { |
| | | // 步骤1:提取日期的年份和月份(忽略时分秒) |
| | | int year = DateTime.Now.Year; |
| | | int month = DateTime.Now.Month; |
| | | |
| | | // 核心逻辑:提取年份,直接构造1月1日 |
| | | DateTime yearFirstDay = new DateTime(year, 1, 1); |
| | | |
| | | if (ssdfsdf < yearFirstDay) |
| | | { |
| | | yuqi = true; |
| | | } |
| | | } |
| | | else if (sssssss == 5) |
| | | { |
| | | // 步骤1:提取日期的年份和月份(忽略时分秒) |
| | | int year = DateTime.Now.Year; |
| | | int month = DateTime.Now.Month; |
| | | |
| | | DateTime semesterFirstDay; |
| | | if (month >= 3 && month <= 8) |
| | | { |
| | | // 3-8月:当年第一学期,首日=当年3月1日 |
| | | semesterFirstDay = new DateTime(year, 3, 1); |
| | | } |
| | | else if (month >= 9 && month <= 12) |
| | | { |
| | | // 9-12月:当年第二学期,首日=当年9月1日 |
| | | semesterFirstDay = new DateTime(year, 9, 1); |
| | | } |
| | | else // 1-2月 |
| | | { |
| | | // 1-2月:上一年第二学期,首日=上一年9月1日 |
| | | semesterFirstDay = new DateTime(year - 1, 9, 1); |
| | | } |
| | | |
| | | if (ssdfsdf < semesterFirstDay) |
| | | { |
| | | yuqi = true; |
| | | } |
| | | } |
| | | else if (sssssss == 6) |
| | | { |
| | | if (Shifouwanjie == 1) |
| | | { |
| | | yuqi = true; |
| | | } |
| | | } |
| | | else if (sssssss == 7) |
| | | { |
| | | // 第二步:计算时间差,取Days属性(已取整),绝对值保证结果为正 |
| | | TimeSpan timeSpan = DateTime.Now.Date.Subtract(ssdfsdf); |
| | | |
| | | var sss = Math.Abs(timeSpan.Days); |
| | | |
| | | if (sss > Paydays) |
| | | { |
| | | yuqi = true; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | if (yuqi) |
| | | { |
| | | if (eC_OrderBasic.UnPayedMoney >= 0) |
| | | { |
| | | item.Yuqijine += eC_OrderBasic.UnPayedMoney; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | Database DC = new Database(); |
| | | try |
| | | { |
| | |
| | | if (DC.Connection.State != System.Data.ConnectionState.Closed) |
| | | DC.Connection.Close(); |
| | | } |
| | | item.Yanse = ""; |
| | | |
| | | |
| | | //if (item.Keyid == item.MemberId) |
| | | //{ |
| | | // item.Yanse = "green"; |
| | | //} |
| | | //有到期时间的,到期前3个月变成红色(像人事管理那样); |
| | | if (item.Expiretype.HasValue && item.Expiretype == 1) |
| | | { |
| | | if (item.ExpireTime.HasValue) |
| | | { |
| | | if (item.ExpireTime.Value < DateTime.Now.AddMonths(3)) |
| | | { |
| | | item.Yanse = "red"; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | if (item.CreateTime.HasValue) |
| | | { |
| | | //没有到期时间的,从建档时间起算,9个月后变成红色。 |
| | | if (item.CreateTime.Value < DateTime.Now.AddMonths(-9)) |
| | | { |
| | | item.Yanse = "red"; |
| | | } |
| | | //建档后1个月没有下单,变成血红色。 |
| | | if (item.CreateTime.Value < DateTime.Now.AddMonths(-1)) |
| | | { |
| | | if (!item.OrderCount.HasValue || item.OrderCount.Value <= 0) |
| | | { |
| | | item.Yanse = "maroon"; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | this.RepClientList.DataBind(); |
| | | UCPager1.AspNetPager.RecordCount = pa.RecordCount; |