diff --git a/web/App_Code/api/ActivityStatisticsController.cs b/web/App_Code/api/ActivityStatisticsController.cs new file mode 100644 index 0000000..9286277 --- /dev/null +++ b/web/App_Code/api/ActivityStatisticsController.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Http; + +/// +/// ActivityStatisticsController 的摘要描述 +/// +public class ActivityStatisticsController: ApiController +{ + private Model.ezEntities _db = new Model.ezEntities(); + + [HttpGet] + [Route("api/activity/statistics/summary")] + public IHttpActionResult GetStatisticsSummary([FromUri] int? activity_num =null) + { + if (activity_num == null) + { + return BadRequest("活动Id不能为空"); + } + var now = DateTime.Now; + var pre_order_query = _db.pro_order.Where(a => a.activity_num == activity_num); + var totalApplicants = pre_order_query.Count(); + var maleApplicants = pre_order_query.Where(a => a.follower.sex == "男眾").Count(); + + var pro_order_detail_query = _db.pro_order_detail + .Where(d => d.pro_order.activity_num == activity_num); + var result = new + { + reportDate = now.ToString("yyyy/MM/dd HH:mm:ss"), + totalApplicants = totalApplicants, //报名总人数 + maleApplicants = maleApplicants, //男 + femaleApplicants = totalApplicants - maleApplicants,//女 + donation = new + { + total = 158000,//总功德金 + received = 150000,//已收功德金 + unreceived = 8000//未收功德金 + }, + items = new[]//功德项目,这个的功德项目要根据活动预设的功德项目来做统计,就是这个活动有那些可报名的功德项目 + { + new { name = "總功德主", count = "10人" }, + new { name = "利益主", count = "15人" }, + new { name = "個人大牌", count = "50人" }, + new { name = "供僧", count = "45人" } + }, + plaques = new[]//牌位 + { + new { name = "總牌位數", count = pro_order_detail_query.Count() }, + new { name = "消災-大牌位", count = 101 }, + new { name = "超冤-大牌位", count =10 }, + new { name = "消災-個人大牌", count =10 }, + new { name = "超冤-個人大牌", count = 10 }, + new { name = "超薦-個人大牌", count = 10 }, + new { name = "消災-個人中牌", count = 10 }, + new { name = "超冤-個人中牌", count = 10 }, + new { name = "超薦-個人中牌", count = 10 }, + new { name = "消災-隨喜牌位", count = 10 }, + new { name = "超冤-隨喜牌位", count = 10 }, + new { name = "超薦-隨喜牌位", count = 10 }, + new { name = "消災-常年牌位", count = 10 }, + new { name = "超冤-常年牌位", count = 10 }, + new { name = "超薦-常年牌位", count = 10 }, + new { name = "消災-急立牌位", count = 10 }, + new { name = "超薦-急立牌位", count = 10 }, + new { name = "超冤-急立牌位", count = 101 }, + } + }; + + return Ok(result); + } +} \ No newline at end of file diff --git a/web/App_Code/api/guadanOrderController.cs b/web/App_Code/api/guadanOrderController.cs index b3966af..497ce3d 100644 --- a/web/App_Code/api/guadanOrderController.cs +++ b/web/App_Code/api/guadanOrderController.cs @@ -69,15 +69,18 @@ public class guadanOrderController : ApiController .Where(c => c.RegionRoomBedStatus.Code != GuaDanOrderGuest.STATUS_CANCELLED) .Count(), statusName = _db.GuaDanOrderGuest - .Where(g => g.GuaDanOrderNo == a.GuaDanOrderNo) - .All(g => g.StatusCode == "404") ? "預約" : + .Where(g => g.GuaDanOrderNo == a.GuaDanOrderNo && a.IsDeleted == false) + .Where(g => g.StatusCode != GuaDanOrderGuest.STATUS_CANCELLED) + .All(g => g.StatusCode == "401") ? "預約" : _db.GuaDanOrderGuest - .Where(g => g.GuaDanOrderNo == a.GuaDanOrderNo) + .Where(g => g.GuaDanOrderNo == a.GuaDanOrderNo && a.IsDeleted == false) + .Where(g => g.StatusCode != GuaDanOrderGuest.STATUS_CANCELLED) .All(g => g.StatusCode == "403") ? "全部退房" : _db.GuaDanOrderGuest - .Where(g => g.GuaDanOrderNo == a.GuaDanOrderNo) - .Any(g => g.StatusCode == "401") ? "正在入住" : - "混合狀態" + .Where(g => g.GuaDanOrderNo == a.GuaDanOrderNo && a.IsDeleted == false) + .Where(g => g.StatusCode != GuaDanOrderGuest.STATUS_CANCELLED) + .Any(g => g.StatusCode == "402" && a.IsCancel == false) ? "正在入住" : + "部分退房" }) .Skip((search.page - 1) * search.pageSize) .Take(search.pageSize) diff --git a/web/admin/activity/statistics/index.aspx b/web/admin/activity/statistics/index.aspx index f6a308a..ba2aea4 100644 --- a/web/admin/activity/statistics/index.aspx +++ b/web/admin/activity/statistics/index.aspx @@ -28,7 +28,7 @@ :server-items-length="activity_statistics.totalItems" :items="activity_statistics.items">