统计修改
This commit is contained in:
73
web/App_Code/api/ActivityStatisticsController.cs
Normal file
73
web/App_Code/api/ActivityStatisticsController.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
|
||||
/// <summary>
|
||||
/// ActivityStatisticsController 的摘要描述
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@
|
||||
:server-items-length="activity_statistics.totalItems"
|
||||
:items="activity_statistics.items">
|
||||
<template #item.detail_btn="{item}">
|
||||
<a :href="'activity.aspx?num='+item.id" class="btn btn-outline-secondary btn-sm" target="_blank">詳細統計</a>
|
||||
<a :href="'statistics.aspx?num='+item.id + '&activity_name=' + encodeURIComponent(item.activity_name)" class="btn btn-outline-secondary btn-sm" target="_blank">詳細統計</a>
|
||||
</template>
|
||||
<template #item.duetime="{item}">
|
||||
{{item.startdate|timeString("YYYY/MM/DD")}}-{{item.enddate|timeString("YYYY/MM/DD")}}
|
||||
|
||||
186
web/admin/activity/statistics/statistics.aspx
Normal file
186
web/admin/activity/statistics/statistics.aspx
Normal file
@@ -0,0 +1,186 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/admin/Templates/TBS5ADM001/MasterPage.master" AutoEventWireup="true" CodeFile="statistics.aspx.cs" Inherits="admin_activity_statistics_statistics" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="page_header" Runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="page_nav" Runat="Server">
|
||||
<div class="ms-5">
|
||||
<span>
|
||||
活動名稱: {{ activity_name }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="me-5">
|
||||
<button class="btn btn-primary" type="button">匯出表格資料</button>
|
||||
</div>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
|
||||
<div id="content" class="container-fluid">
|
||||
<div class="card shadow-sm my-2" id="sec2">
|
||||
<div class="card-header py-0">
|
||||
<nav class="navbar py-0">
|
||||
<div class="nav nav-tabs">
|
||||
<button class="nav-link active" id="sec2-tab1" data-bs-toggle="tab" data-bs-target="#sec2-page1"
|
||||
type="button" role="tab" aria-controls="home" aria-selected="true">
|
||||
活動統計總表</button>
|
||||
<button class="nav-link" id="sec2-tab2" data-bs-toggle="tab" data-bs-target="#sec2-page2"
|
||||
type="button" role="tab" aria-controls="profile" aria-selected="false">
|
||||
活動統計數量明細 </button>
|
||||
<button class="nav-link" id="sec2-tab3" data-bs-toggle="tab" data-bs-target="#sec2-page3"
|
||||
type="button" role="tab" aria-controls="profile" aria-selected="false">
|
||||
活動統計報名人明細 </button>
|
||||
<button class="nav-link" id="sec2-tab4" data-bs-toggle="tab" data-bs-target="#sec2-page4"
|
||||
type="button" role="tab" aria-controls="profile" aria-selected="false">
|
||||
活動牌位明細</button>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="tab-content" id="myTabContent">
|
||||
<div class="tab-pane fade show active noedit p-4" id="sec2-page1" role="tabpanel" aria-labelledby="sec2-tab1">
|
||||
<h5 class="mb-4"> {{ activity_name }}(截至 {{summaryStats?.reportDate }})</h5>
|
||||
<!-- 基本資訊 + 功德金 統計 -->
|
||||
<table class="table table-bordered table-sm w-auto mb-4">
|
||||
<tbody>
|
||||
<!-- 基本資訊 -->
|
||||
<tr class="table-primary">
|
||||
<th colspan="4">基本資訊</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>類別</th>
|
||||
<td>報名人數</td>
|
||||
<td>男眾人數</td>
|
||||
<td>女眾人數</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>數量</th>
|
||||
<td>{{ summaryStats?.totalApplicants }}</td>
|
||||
<td>{{ summaryStats?.maleApplicants }}</td>
|
||||
<td>{{ summaryStats?.femaleApplicants }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-bordered table-sm w-auto mb-4">
|
||||
<tbody>
|
||||
<!-- 功德金 -->
|
||||
<tr class="table-primary">
|
||||
<th colspan="4">功德金統計</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>類別</th>
|
||||
<td>總功德金</td>
|
||||
<td>已收</td>
|
||||
<td>未收</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>金額</th>
|
||||
<td>{{ summaryStats?.donation.total }}</td>
|
||||
<td>{{ summaryStats?.donation.received }}</td>
|
||||
<td>{{ summaryStats?.donation.unreceived }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- 功德項目 -->
|
||||
<table class="table table-bordered table-sm w-auto mb-4">
|
||||
<tbody>
|
||||
<tr class="table-primary">
|
||||
<th colspan="100%">功德項目</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>功德項目</th>
|
||||
<td v-for="(item, index) in summaryStats?.items" :key="'name-' + index">
|
||||
{{ item.name }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>人數</th>
|
||||
<td v-for="(item, index) in summaryStats?.items" :key="'count-' + index">
|
||||
{{ item.count }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- 牌位數量 -->
|
||||
<table class="table table-bordered table-sm w-auto">
|
||||
<tbody>
|
||||
<tr class="table-primary">
|
||||
<th colspan="100%">牌位數量</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>牌位名稱</th>
|
||||
<td v-for="(plaque, index) in summaryStats?.plaques" :key="'plaque-name-' + index">
|
||||
{{ plaque.name }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>數量</th>
|
||||
<td v-for="(plaque, index) in summaryStats?.plaques" :key="'plaque-count-' + index">
|
||||
{{ plaque.count }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="sec2-page2" role="tabpanel" aria-labelledby="sec2-tab2">
|
||||
sec2-page2
|
||||
</div>
|
||||
<div class="tab-pane fade" id="sec2-page3" role="tabpanel" aria-labelledby="sec2-tab3">
|
||||
sec2-page3
|
||||
</div>
|
||||
<div class="tab-pane fade" id="sec2-page4" role="tabpanel" aria-labelledby="sec2-tab4">
|
||||
sec2-page4
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" Runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="footer_script" Runat="Server">
|
||||
<script>
|
||||
new Vue({
|
||||
el: '#app',
|
||||
vuetify: new Vuetify(vuetify_options),
|
||||
data() {
|
||||
return {
|
||||
activity_num: '<%= Request["num"] %>',
|
||||
activity_name: '<%= Request["activity_name"] %>',
|
||||
summaryStats: null, //匯總統計(總覽)
|
||||
quantityDetails: [], // 數量明細(分類數量)
|
||||
applicantList: [], // 報名人清單
|
||||
plaqueList: [], //牌位清單
|
||||
loadingSummary: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fetchSummaryStats() {
|
||||
//獲取匯總明細
|
||||
this.loadingSummary = true;
|
||||
|
||||
axios.get(HTTP_HOST + 'api/activity/statistics/summary',
|
||||
{
|
||||
params: {
|
||||
activity_num: this.activity_num
|
||||
}
|
||||
}
|
||||
|
||||
)
|
||||
.then(res => {
|
||||
this.summaryStats = res.data;
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
})
|
||||
.finally(() => {
|
||||
this.loadingSummary = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.fetchSummaryStats(); // 頁面載入時就獲取
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</asp:Content>
|
||||
|
||||
14
web/admin/activity/statistics/statistics.aspx.cs
Normal file
14
web/admin/activity/statistics/statistics.aspx.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
public partial class admin_activity_statistics_statistics : MyWeb.config
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user