1. 新增法會活動品項:牌位陽上與超度人數限制功能

2. 信眾資料新增全年性選項以及開始參加活動日期,自動報名並代入前一次的報名資料(品項)
This commit is contained in:
2026-05-04 11:43:57 +08:00
parent 7644df57d0
commit 11a8c3e932
13 changed files with 995 additions and 104 deletions
+9
View File
@@ -406,6 +406,10 @@ namespace Model
public Nullable<float> price { get; set; }
public Nullable<int> qty { get; set; }
public Nullable<System.DateTime> reg_time { get; set; }
public Nullable<bool> has_yang_limit { get; set; }
public Nullable<bool> has_chao_limit { get; set; }
public Nullable<int> yang_limit_count { get; set; }
public Nullable<int> chao_limit_count { get; set; }
public virtual actItem actItem { get; set; }
public virtual activity activity { get; set; }
@@ -938,6 +942,11 @@ namespace Model
public Nullable<int> appellation_id { get; set; }
public string follower_hash { get; set; }
public string search_keywords { get; set; }
public Nullable<bool> is_auto_enroll { get; set; }
public Nullable<System.DateTime> auto_enroll_start_date { get; set; }
public string auto_enroll_receipt_title { get; set; }
public string auto_enroll_receipt_address { get; set; }
public Nullable<bool> auto_enroll_is_receipt { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<activity_check> activity_check { get; set; }
+27
View File
@@ -190,6 +190,10 @@
<Property Name="price" Type="real" />
<Property Name="qty" Type="int" />
<Property Name="reg_time" Type="datetime" />
<Property Name="has_yang_limit" Type="bit" />
<Property Name="has_chao_limit" Type="bit" />
<Property Name="yang_limit_count" Type="int" />
<Property Name="chao_limit_count" Type="int" />
</EntityType>
<EntityType Name="activity_spares">
<Key>
@@ -482,6 +486,11 @@
<Property Name="appellation_id" Type="int" />
<Property Name="follower_hash" Type="nvarchar" MaxLength="100" />
<Property Name="search_keywords" Type="varchar(max)" />
<Property Name="is_auto_enroll" Type="bit" />
<Property Name="auto_enroll_start_date" Type="datetime" />
<Property Name="auto_enroll_receipt_title" Type="nvarchar" MaxLength="50" />
<Property Name="auto_enroll_receipt_address" Type="nchar" MaxLength="200" />
<Property Name="auto_enroll_is_receipt" Type="bit" />
</EntityType>
<EntityType Name="followers_tablet">
<Key>
@@ -2729,6 +2738,10 @@
<Property Name="reg_time" Type="DateTime" Precision="3" />
<NavigationProperty Name="actItem" Relationship="Self.FK_activity_relating_actItem" FromRole="activity_relating" ToRole="actItem" />
<NavigationProperty Name="activity" Relationship="Self.FK_activity_relating_activity" FromRole="activity_relating" ToRole="activity" />
<Property Name="has_yang_limit" Type="Boolean" />
<Property Name="has_chao_limit" Type="Boolean" />
<Property Name="yang_limit_count" Type="Int32" />
<Property Name="chao_limit_count" Type="Int32" />
</EntityType>
<EntityType Name="activity_spares">
<Key>
@@ -2970,6 +2983,11 @@
<NavigationProperty Name="GuaDanOrder" Relationship="Model.FK_GuaDanOrder_Followers" FromRole="follower" ToRole="GuaDanOrder" />
<Property Name="search_keywords" Type="String" MaxLength="Max" FixedLength="false" Unicode="false" />
<NavigationProperty Name="GuaDanOrderGuest" Relationship="Model.FK_GuaDanOrderGuest_FOLLOWERS" FromRole="follower" ToRole="GuaDanOrderGuest" />
<Property Name="is_auto_enroll" Type="Boolean" />
<Property Name="auto_enroll_start_date" Type="DateTime" Precision="3" />
<Property Name="auto_enroll_receipt_title" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
<Property Name="auto_enroll_receipt_address" Type="String" MaxLength="200" FixedLength="true" Unicode="true" />
<Property Name="auto_enroll_is_receipt" Type="Boolean" />
</EntityType>
<EntityType Name="followers_tablet">
<Key>
@@ -5445,6 +5463,10 @@
<EntitySetMapping Name="activity_relating">
<EntityTypeMapping TypeName="Model.activity_relating">
<MappingFragment StoreEntitySet="activity_relating">
<ScalarProperty Name="chao_limit_count" ColumnName="chao_limit_count" />
<ScalarProperty Name="yang_limit_count" ColumnName="yang_limit_count" />
<ScalarProperty Name="has_chao_limit" ColumnName="has_chao_limit" />
<ScalarProperty Name="has_yang_limit" ColumnName="has_yang_limit" />
<ScalarProperty Name="num" ColumnName="num" />
<ScalarProperty Name="activity_num" ColumnName="activity_num" />
<ScalarProperty Name="actItem_num" ColumnName="actItem_num" />
@@ -5635,6 +5657,11 @@
<EntitySetMapping Name="followers">
<EntityTypeMapping TypeName="Model.follower">
<MappingFragment StoreEntitySet="followers">
<ScalarProperty Name="auto_enroll_is_receipt" ColumnName="auto_enroll_is_receipt" />
<ScalarProperty Name="auto_enroll_receipt_address" ColumnName="auto_enroll_receipt_address" />
<ScalarProperty Name="auto_enroll_receipt_title" ColumnName="auto_enroll_receipt_title" />
<ScalarProperty Name="auto_enroll_start_date" ColumnName="auto_enroll_start_date" />
<ScalarProperty Name="is_auto_enroll" ColumnName="is_auto_enroll" />
<ScalarProperty Name="search_keywords" ColumnName="search_keywords" />
<ScalarProperty Name="follower_hash" ColumnName="follower_hash" />
<ScalarProperty Name="num" ColumnName="num" />
+26
View File
@@ -10,6 +10,7 @@ using System.Collections;
using DocumentFormat.OpenXml.Office2010.Excel;
using MyWeb;
using System.Data.Entity;
using System.Diagnostics;
// api/Follower
//[ezAuthorize(Roles = "admin")]//群組:*
@@ -672,6 +673,31 @@ public class FollowerController : ApiController
return Ok(data);
}
[HttpPost]
[Route("api/follower/pending_orders")]
public IHttpActionResult GetPendingOrders(int id, string targetDate)
{
DateTime today = DateTime.Today;
if (!DateTime.TryParse(targetDate, out DateTime limitDate))
{
limitDate = new DateTime(2099, 12, 31);
}
var orderrecord = _db.pro_order
.Where(x => x.f_num == id && x.activity.startDate_solar >= today && x.activity.startDate_solar < limitDate)
.Include(x => x.activity)
.ToList();
var data = new
{
list = orderrecord.Select(x => new
{
orderno = x.order_no,
activitydate = x.activity.startDate_solar.Value.ToString("yyyy/MM/dd"),
activityname = x.activity.subject,
})
};
return Ok(data);
}
[HttpPost]
[Route("api/follower/totalorderamount")]
public IHttpActionResult GetTotalOrderCount(int id)
{
+13
View File
@@ -7,6 +7,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Data.Entity;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Net.Http;
@@ -958,6 +959,10 @@ public class activityController : ApiController
},
price = x.price ?? 0,
qty = x.qty ?? 0,
has_yang_limit = x.has_yang_limit?? false,
has_chao_limit = x.has_yang_limit?? false,
yang_limit_count = x.yang_limit_count?? 0,
chao_limit_count = x.chao_limit_count?? 0,
files = x.actItem?.actItem_files.Select(f => new
{
num = f.file.num,
@@ -1175,6 +1180,10 @@ public class activityController : ApiController
if (item.qty.HasValue) { _data.qty = item.qty.Value; }
else { _data.qty = null; }
_data.reg_time = DateTime.Now;
if (item.has_yang_limit.HasValue) { _data.has_yang_limit = item.has_yang_limit; }
if (item.yang_limit_count >= 0) { _data.yang_limit_count = item.yang_limit_count.Value; }
if (item.has_chao_limit.HasValue) { _data.has_chao_limit = item.has_chao_limit; }
if (item.chao_limit_count >= 0) { _data.chao_limit_count = item.chao_limit_count.Value; }
_db.SaveChanges();
var ret = _data.num;
@@ -1195,6 +1204,10 @@ public class activityController : ApiController
if (item.qty.HasValue) { _data.qty = item.qty.Value; }
else { _data.qty = null; }
_data.reg_time = DateTime.Now;
if (item.has_yang_limit.HasValue) { _data.has_yang_limit = item.has_yang_limit; }
if (item.yang_limit_count >= 0) { _data.yang_limit_count = item.yang_limit_count.Value; }
if (item.has_chao_limit.HasValue) { _data.has_chao_limit = item.has_chao_limit; }
if (item.chao_limit_count >= 0) { _data.chao_limit_count = item.chao_limit_count.Value; }
_db.activity_relating.Add(_data);
_db.SaveChanges();
+86 -75
View File
@@ -7,6 +7,8 @@ using System;
using System.Activities.Expressions;
using System.Collections;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Core.Objects;
using System.Diagnostics;
using System.IdentityModel.Metadata;
using System.Linq;
@@ -351,7 +353,7 @@ public class orderController : ApiController
//var qry1 = _db.pro_order_detail.AsEnumerable();
//qry1 = qry1.Where(o => o.order_no == order_no);
//var qry1 = prod.pro_order_detail.AsEnumerable();
var qry1 = prod.pro_order_detail.AsQueryable();
var qry1 = prod.pro_order_detail.AsQueryable().Include(o => o.pro_order.activity.activity_relating);
//if (!string.IsNullOrEmpty(q.subject))
// qry = qry.Where(o => o.subject.Contains(q.subject));
@@ -380,8 +382,8 @@ public class orderController : ApiController
qry1 = qry1.OrderByDescending(o => o.num);
}
var tdesc = publicFun.enum_desc<Model.pro_order.detailKeyin1>();
var tdesc = publicFun.enum_desc<Model.pro_order.detailKeyin1>();;
int i = 1;
//已有值
@@ -390,82 +392,91 @@ public class orderController : ApiController
(List<pro_order_detail>)qry1_list.ToPagedList(page, pageSize);
var count = qry1_list.Count();
var ret = new
{
list = qry1_list.Select(x => new
{
id = i++,
num = x.num,
order_no = x.order_no,
actitem_num_selected = new
list = qry1_list.Select(x => {
var tmpActivityRelating = x.pro_order?.activity?.activity_relating?.Where(a => a.actItem_num == x.actItem_num).FirstOrDefault();
return new
{
text = x.actItem_num.HasValue ? x.actItem.subject : "",
val = x.actItem_num.HasValue ? x.actItem_num.Value : 0,
},
parent_num = x.parent_num,
f_num_selected = new
{
text = x.f_num.HasValue ? x.follower.u_name : "",
val = x.f_num.HasValue ? x.f_num.Value : 0,
},
f_num_tablet = x.f_num_tablet,
print_id = x.print_id,
address = x.address,
due_date = x.due_date,
start_date = x.start_date,
extend_date = x.extend_date,
from_id_selected = new
{
text = x.from_id.HasValue ? x.follower1.u_name : "",
val = x.from_id.HasValue ? x.from_id : 0,
},
from_id_tablet = x.from_id_tablet,
price = x.price ?? 0,
qty = x.qty ?? 0,
writeBedQty = bedDt.Where(b => b.bed_order.o_detail_id.Value == x.num && b.checkIn_date.HasValue && b.bed_kind_detail_id.HasValue).Count(), //已劃數量
notBedQty = bedDt.Where(b => b.bed_order.o_detail_id.Value == x.num && (!b.checkIn_date.HasValue || !b.bed_kind_detail_id.HasValue)).Count(), //未劃數量
//total = x.total.HasValue ? x.total.Value : 0,
category = x.actItem?.category,
//pay = x.pay ?? 0,
pay = x.pro_order_record.Select(c => c.price).Sum(),
pay_date = x.pay_date,
keyin1_selected = new
{
text = tdesc[x.keyin1.HasValue && x.keyin1.Value > 0 ? x.keyin1.Value : 1],
val = x.keyin1,
},
demo = x.demo,
files = x.actItem?.actItem_files.Select(f => new
{
num = f.file.num,
subject = f.file.subject,
word = f.file.word,
cuz_column = f.file.customize_data ?? "", //??
paperset = f.file.paperset ?? "",
}),
customize_data = x.customize_data ?? "",
customize_data_comb = new
{
from_id_cuz_data = "",
activity_cuz_data = "",
actitem_cuz_data = "",
order_cuz_data = "",
},
printed_files = x.printed_files ?? "",
isPackage = (x.actItem.act_bom
.Any(ab => ab.package_num == null && ab.item_num != null)
? 1 : 0),
bom_order = (x.actItem.act_bom
.Any(ab => ab.package_num == null && ab.item_num != null)
? x.num.ToString()
: (x.parent_num.ToString() + x.num.ToString())
),
//cash_record = x.pro_order_record.Select( c => new {
// c,
// //pay_kind = tdesc2[c.payment.HasValue && x.keyin1.Value > 0 ? x.keyin1.Value : 1],
//}),
has_yang_limit = tmpActivityRelating?.has_yang_limit ?? false,
has_chao_limit = tmpActivityRelating?.has_chao_limit ?? false,
yang_limit_count = tmpActivityRelating?.yang_limit_count ?? 0,
chao_limit_count = tmpActivityRelating?.chao_limit_count ?? 0,
id = i++,
num = x.num,
order_no = x.order_no,
actitem_num_selected = new
{
text = x.actItem_num.HasValue ? x.actItem.subject : "",
val = x.actItem_num.HasValue ? x.actItem_num.Value : 0,
},
parent_num = x.parent_num,
f_num_selected = new
{
text = x.f_num.HasValue ? x.follower.u_name : "",
val = x.f_num.HasValue ? x.f_num.Value : 0,
},
f_num_tablet = x.f_num_tablet,
print_id = x.print_id,
address = x.address,
due_date = x.due_date,
start_date = x.start_date,
extend_date = x.extend_date,
from_id_selected = new
{
text = x.from_id.HasValue ? x.follower1.u_name : "",
val = x.from_id.HasValue ? x.from_id : 0,
},
from_id_tablet = x.from_id_tablet,
price = x.price ?? 0,
qty = x.qty ?? 0,
writeBedQty = bedDt.Where(b => b.bed_order.o_detail_id.Value == x.num && b.checkIn_date.HasValue && b.bed_kind_detail_id.HasValue).Count(), //已劃數量
notBedQty = bedDt.Where(b => b.bed_order.o_detail_id.Value == x.num && (!b.checkIn_date.HasValue || !b.bed_kind_detail_id.HasValue)).Count(), //未劃數量
//total = x.total.HasValue ? x.total.Value : 0,
category = x.actItem?.category,
//pay = x.pay ?? 0,
pay = x.pro_order_record.Select(c => c.price).Sum(),
pay_date = x.pay_date,
keyin1_selected = new
{
text = tdesc[x.keyin1.HasValue && x.keyin1.Value > 0 ? x.keyin1.Value : 1],
val = x.keyin1,
},
demo = x.demo,
files = x.actItem?.actItem_files.Select(f => new
{
num = f.file.num,
subject = f.file.subject,
word = f.file.word,
cuz_column = f.file.customize_data ?? "", //??
paperset = f.file.paperset ?? "",
}),
customize_data = x.customize_data ?? "",
customize_data_comb = new
{
from_id_cuz_data = "",
activity_cuz_data = "",
actitem_cuz_data = "",
order_cuz_data = "",
},
printed_files = x.printed_files ?? "",
isPackage = (x.actItem.act_bom
.Any(ab => ab.package_num == null && ab.item_num != null)
? 1 : 0),
bom_order = (x.actItem.act_bom
.Any(ab => ab.package_num == null && ab.item_num != null)
? x.num.ToString()
: (x.parent_num.ToString() + x.num.ToString())
),
//cash_record = x.pro_order_record.Select( c => new {
// c,
// //pay_kind = tdesc2[c.payment.HasValue && x.keyin1.Value > 0 ? x.keyin1.Value : 1],
//}),
})
};
})
.ToList()
.OrderByDescending(x => (x.isPackage + (x.parent_num == null ? 0 : 1)))
//.ThenBy(x => (x.parent_num == null ? 1 : 2)) // Top-level items first