diff --git a/web/App_Code/api/orderController.cs b/web/App_Code/api/orderController.cs index 66a8872..6b55626 100644 --- a/web/App_Code/api/orderController.cs +++ b/web/App_Code/api/orderController.cs @@ -597,7 +597,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)); @@ -638,13 +638,19 @@ public class orderController : ApiController var ret = new { - list = qry1_list.Select(x => 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 { + 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, }, @@ -758,6 +764,10 @@ public class orderController : ApiController text = ar.actItem.subject, val = ar.actItem_num, }, + has_yang_limit = ar.has_yang_limit ?? false, + has_chao_limit = ar.has_chao_limit ?? false, + yang_limit_count = ar.yang_limit_count ?? 0, + chao_limit_count = ar.chao_limit_count ?? 0, parent_num = q.num, f_num_selected = new { @@ -838,6 +848,10 @@ public class orderController : ApiController text = x.actItem.subject, val = x.actItem.num, }, + has_yang_limit = x.has_yang_limit, + has_chao_limit = x.has_chao_limit, + yang_limit_count = x.yang_limit_count, + chao_limit_count = x.chao_limit_count, f_num_selected = new { text = "", @@ -922,8 +936,6 @@ public class orderController : ApiController { return NotFound(); } - - } [HttpPost] diff --git a/web/admin/activity/reg.aspx b/web/admin/activity/reg.aspx index 056f57c..130269f 100644 --- a/web/admin/activity/reg.aspx +++ b/web/admin/activity/reg.aspx @@ -165,6 +165,8 @@ { text: '* 品項名稱', value: 'act_item_selected.text', sortable: false }, { text: '預設金額', value: 'price', sortable: false }, { text: '數量', value: 'qty', sortable: false }, + { text: '陽上/祈福人數限制', value: 'limit_yang', sortable: false }, + { text: '超渡人數限制', value: 'limit_chao', sortable: false }, { text: '', value: 'actions', sortable: false, width: "200px" }, ], footersDetail: { @@ -191,6 +193,10 @@ price: 0, qty: 0, files: [], + has_yang_limit: false, + has_chao_limit: false, + yang_limit_count: 0, + chao_limit_count: 0, }, defaultItem: { id: 0, @@ -203,6 +209,10 @@ price: 0, qty: 0, files: [], + has_yang_limit: false, + has_chao_limit: false, + yang_limit_count: 0, + chao_limit_count: 0, }, //列印 data_table: { @@ -267,10 +277,23 @@ order_dialog: { show: false, }, + loading: false, + search: '', + headers: [ + { text: '訂單編號', value: 'order_no' }, + { text: '信眾編號', value: 'f_number' }, + { text: '信眾姓名', value: 'u_name' }, + { text: '聯絡電話', value: 'phone' }, + { text: '建立日期', value: 'order_date' }, + ], + items: [ + { order_no: "D", member_name: "S", order_date:"2025-12-07"} + ], } }, mounted() { this.search_dialog.current = this.search_dialog.controls.search1 + this.loadUnfilledList(); //console.log("mounted"); }, watch: { @@ -482,6 +505,10 @@ actItem_num: this.editedItem.act_item_selected.val, price: this.editedItem.price, qty: this.editedItem.qty, + has_yang_limit: this.editedItem.has_yang_limit, + has_chao_limit: this.editedItem.has_chao_limit, + yang_limit_count: this.editedItem.yang_limit_count, + chao_limit_count: this.editedItem.chao_limit_count, } axios .post(HTTP_HOST + 'api/activity/SaveRelatingData', pro_order_detail) @@ -886,6 +913,113 @@ const _date = $('#<%= startDate_solar.ClientID%>').val(); return _subject + " " + _date; }, +loadUnfilledList() { + if (!this.this_id) return; + + this.unfilled_list.loading = true; + + axios.get(HTTP_HOST + 'api/activity/GetUnfilledOrdersByActivity/' + this.this_id) + .then(response => { + this.unfilled_list.items = response.data.list || []; + }) + .catch(error => { + console.log(error); + this.snackbar.text = "名單載入失敗:" + error; + this.snackbar.show = true; + }) + .finally(() => { + this.unfilled_list.loading = false; + }); + }, + async printUnfilledList() { + if (!this.this_id) return; + + try { + const response = await axios.get( + HTTP_HOST + `api/activity/GetUnfilledOrdersByActivity/${this.this_id}`, + { params: { page: 1, pageSize: 99999 } } + ); + + const allItems = response.data.list || []; + + if (allItems.length === 0) { + this.snackbar.text = "目前沒有未填寫品項的資料可供列印!"; + this.snackbar.show = true; + return; + } + + const activityTitle = this.titleword(); + + const rows = allItems.map(item => ` + + ${item.order_no} + ${item.f_number || ''} + ${item.u_name} + ${item.phone} + ${item.order_date} + + `).join(''); + + const win = window.open('', '_blank'); + win.document.write(` + + + 未填寫品項名單 - ${activityTitle} + + + +
+

尚未報名品項之信眾清單

+

活動名稱:${activityTitle}

+
+ + + + + + + + + + + + ${rows} +
訂單編號信眾編號信眾姓名聯絡電話建單日期
+ +
+ 列印時間:${new Date().toLocaleString()} +
+ + + `); + + win.document.close(); + + // 確保內容載入完成後再呼叫列印 + setTimeout(() => { + win.print(); + win.close(); + }, 300); + + } catch (error) { + console.error("列印出錯:", error); + this.snackbar.text = "讀取列印資料失敗:" + error; + this.snackbar.show = true; + } + } }, computed: { }, @@ -925,6 +1059,10 @@ <%-- --%> + @@ -1098,6 +1236,53 @@ {{item.qty}} + + +