0.1 #4
@@ -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; }
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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));
|
||||
@@ -381,7 +383,7 @@ public class orderController : ApiController
|
||||
|
||||
}
|
||||
|
||||
var tdesc = publicFun.enum_desc<Model.pro_order.detailKeyin1>();
|
||||
var tdesc = publicFun.enum_desc<Model.pro_order.detailKeyin1>();;
|
||||
|
||||
int i = 1;
|
||||
//已有值
|
||||
@@ -390,10 +392,18 @@ 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
|
||||
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,
|
||||
@@ -465,6 +475,7 @@ public class orderController : ApiController
|
||||
// //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)))
|
||||
|
||||
@@ -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: {
|
||||
@@ -434,7 +444,6 @@
|
||||
this.close();
|
||||
},
|
||||
spliceNullData() {
|
||||
|
||||
//if new data ,then splice it
|
||||
if (this.editedItem.num == 0) {
|
||||
for (var i = 0; i < this.desserts.map(x => x.id).length; i++) {
|
||||
@@ -482,6 +491,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)
|
||||
@@ -1019,6 +1032,54 @@
|
||||
<v-text-field v-model="editedItem.qty" :hide-details="true" dense single-line v-if="item.id === editedItem.id" ></v-text-field>
|
||||
<span v-else>{{item.qty}}</span>
|
||||
</template>
|
||||
|
||||
<template v-slot:item.limit_yang="{ item }">
|
||||
<div class="d-flex align-center">
|
||||
<v-text-field v-model="editedItem.yang_limit_count" v-if="item.id === editedItem.id"
|
||||
type="number"
|
||||
dense
|
||||
:hide-details="true"
|
||||
single-line
|
||||
:disabled="!editedItem.has_yang_limit"
|
||||
suffix="人" >
|
||||
</v-text-field>
|
||||
<v-checkbox v-if="item.id === editedItem.id"
|
||||
v-model="editedItem.has_yang_limit"
|
||||
label="不限"
|
||||
hide-details
|
||||
class="ml-2 mt-0"
|
||||
:true-value="false"
|
||||
:false-value="true"
|
||||
:disabled="item.id !== editedItem.id">
|
||||
</v-checkbox>
|
||||
<span v-if="item.id !== editedItem.id && !item.has_yang_limit">不限</span>
|
||||
<span v-if="item.id !== editedItem.id && item.has_yang_limit">{{item.yang_limit_count}} 人</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-slot:item.limit_chao="{ item }">
|
||||
<div class="d-flex align-center">
|
||||
<v-text-field v-model="editedItem.chao_limit_count" v-if="item.id === editedItem.id"
|
||||
type="number"
|
||||
dense
|
||||
:hide-details="true"
|
||||
single-line
|
||||
:disabled="!editedItem.has_chao_limit"
|
||||
suffix="人" >
|
||||
</v-text-field>
|
||||
<v-checkbox v-if="item.id === editedItem.id"
|
||||
v-model="editedItem.has_chao_limit"
|
||||
label="不限"
|
||||
hide-details
|
||||
class="ml-2 mt-0"
|
||||
:true-value="false"
|
||||
:false-value="true"
|
||||
:disabled="item.id !== editedItem.id">
|
||||
</v-checkbox>
|
||||
<span v-if="item.id !== editedItem.id && !item.has_chao_limit">不限</span>
|
||||
<span v-if="item.id !== editedItem.id && item.has_chao_limit">{{item.chao_limit_count}} 人</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-slot:item.actions="{ item }">
|
||||
<template v-if="item.id === editedItem.id">
|
||||
<v-icon color="red" class="mr-2" @click="cancel">
|
||||
|
||||
@@ -235,6 +235,36 @@ public partial class admin_activity_reg : MyWeb.config
|
||||
#endregion
|
||||
|
||||
#region 資料新增
|
||||
protected string createOrderNumber()
|
||||
{
|
||||
Application.Lock();
|
||||
string order_no = "AA" + DateTime.Now.ToString("yyMMdd");
|
||||
|
||||
var qry = _db.companies.AsQueryable();
|
||||
//var prod = qry.Where(q => q.last_order_no.Contains(order_no)).FirstOrDefault();
|
||||
var prod = qry.Where(q => q.num == 1).FirstOrDefault();
|
||||
if (prod != null)
|
||||
{
|
||||
if (!isStrNull(prod.last_order_no) && prod.last_order_no.Contains(order_no))
|
||||
{
|
||||
int tmp = Convert.ToInt32(prod.last_order_no.Replace(order_no, "")) + 1;
|
||||
order_no = order_no + tmp.ToString("0000");
|
||||
}
|
||||
else
|
||||
{
|
||||
order_no = order_no + "0001";
|
||||
}
|
||||
|
||||
prod.last_order_no = order_no;
|
||||
_db.SaveChanges();
|
||||
}
|
||||
else
|
||||
order_no = "";
|
||||
|
||||
Application.UnLock();
|
||||
|
||||
return order_no;
|
||||
}
|
||||
|
||||
protected void add_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -293,6 +323,60 @@ public partial class admin_activity_reg : MyWeb.config
|
||||
Model.admin_log admin_log = new Model.admin_log();
|
||||
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Activity, (int)Model.admin_log.Status.Insert, subject.Text);
|
||||
|
||||
// 自動報名的信眾報名
|
||||
var qry = _db.followers.Where(f => f.is_auto_enroll == true).AsQueryable();
|
||||
var followers = qry.ToList();
|
||||
if (followers != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var follower in followers)
|
||||
{
|
||||
Model.pro_order pro_order = new Model.pro_order(); //新增
|
||||
|
||||
pro_order.order_no = createOrderNumber();
|
||||
pro_order.up_time = DateTime.Now;
|
||||
pro_order.reg_time = DateTime.Now;
|
||||
pro_order.keyin1 = "A01";
|
||||
pro_order.f_num = follower.num;
|
||||
if (!isStrNull(follower.phone)) { pro_order.phone = follower.phone; }
|
||||
if (!isStrNull(follower.cellphone)) { pro_order.phone = follower.cellphone; }
|
||||
if (IsNumeric(activity.num)) { pro_order.activity_num = activity.num; }
|
||||
pro_order.address = isStrNull(follower.auto_enroll_receipt_address) ? "" : follower.auto_enroll_receipt_address;
|
||||
pro_order.receipt_title = isStrNull(follower.auto_enroll_receipt_title) ? "" : follower.auto_enroll_receipt_title;
|
||||
pro_order.send_receipt = isStrNull(follower.auto_enroll_is_receipt) ? false : follower.auto_enroll_is_receipt;
|
||||
pro_order.demo = "";
|
||||
pro_order.customize_data = "";
|
||||
|
||||
try
|
||||
{
|
||||
if (!isStrNull(pro_order.order_no))
|
||||
{
|
||||
bool isRegistered = _db.pro_order.Any(x => x.f_num == pro_order.f_num && x.activity_num == pro_order.activity_num);
|
||||
|
||||
if (isRegistered) // 重複報名
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
_db.pro_order.Add(pro_order);
|
||||
_db.SaveChanges();
|
||||
|
||||
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Order, (int)Model.admin_log.Status.Insert, pro_order.order_no);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Response.Redirect("index.aspx");
|
||||
}
|
||||
else
|
||||
|
||||
+213
-5
@@ -116,6 +116,15 @@
|
||||
vuetify: new Vuetify(vuetify_options),
|
||||
data() {
|
||||
return {
|
||||
init_is_auto_enroll: false,
|
||||
is_auto_enroll: false,
|
||||
auto_enroll_date: '',
|
||||
auto_enroll_config: {
|
||||
is_receipt: true, // 是否寄送收據
|
||||
receipt_title: '', // 收據抬頭
|
||||
receipt_address: '', // 收據地址
|
||||
},
|
||||
last_confirmed_date: '',
|
||||
tabArray: tabtmp,
|
||||
tabArray2: "",
|
||||
follower_id: '<%= Request["num"] %>',
|
||||
@@ -124,6 +133,18 @@
|
||||
multiSort: false,
|
||||
//itemsPerPage: -1,
|
||||
},
|
||||
confirm_dialog: {
|
||||
show: false,
|
||||
headers: [
|
||||
{ text: '活動日期', value: 'activitydate' },
|
||||
{ text: '活動名稱', value: 'activityname'},
|
||||
],
|
||||
title: '',
|
||||
desc: '',
|
||||
orders: [],
|
||||
btn_cancel_text: '', // 「取消報名」按鈕文字
|
||||
btn_keep_text: '' // 「保留活動」按鈕文字
|
||||
},
|
||||
search_dialog: {
|
||||
controls: {
|
||||
search1: {
|
||||
@@ -485,7 +506,16 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
mounted() {//一開始就載入
|
||||
mounted() {
|
||||
//一開始就載入
|
||||
this.$nextTick(() => {
|
||||
this.auto_enroll_date = document.getElementById('<%= hid_auto_enroll_start_date.ClientID %>').value;
|
||||
this.is_auto_enroll = (document.getElementById('<%= hid_is_auto_enroll.ClientID %>').value.toLowerCase() === "true");
|
||||
this.init_is_auto_enroll = this.is_auto_enroll;
|
||||
this.auto_enroll_config.is_receipt = (document.getElementById('<%= hid_auto_enroll_is_receipt.ClientID %>').value.toLowerCase() === "true");
|
||||
this.auto_enroll_config.receipt_title = document.getElementById('<%= hid_auto_enroll_receipt_title.ClientID %>').value;
|
||||
this.auto_enroll_config.receipt_address = document.getElementById('<%= hid_auto_enroll_receipt_address.ClientID %>').value;
|
||||
})
|
||||
this.search_dialog.current = this.search_dialog.controls.search1 ///default
|
||||
//console.log("mounted");
|
||||
//this.initialize();
|
||||
@@ -496,6 +526,30 @@
|
||||
this.onCityChange();
|
||||
},
|
||||
watch: {
|
||||
auto_enroll_config: {
|
||||
handler(newVal) {
|
||||
document.getElementById('<%= hid_auto_enroll_is_receipt.ClientID %>').value = newVal.is_receipt;
|
||||
document.getElementById('<%= hid_auto_enroll_receipt_title.ClientID %>').value = newVal.receipt_title;
|
||||
document.getElementById('<%= hid_auto_enroll_receipt_address.ClientID %>').value = newVal.receipt_address;
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
is_auto_enroll(newVal, oldVal) {
|
||||
if (newVal === true) {
|
||||
if (!this.auto_enroll_date) {
|
||||
this.auto_enroll_date = new Date().toISOString().substr(0, 10);
|
||||
this.last_confirmed_date = this.auto_enroll_date;
|
||||
}
|
||||
} else {
|
||||
if (this.init_is_auto_enroll === true) {
|
||||
this.open_confirm_dialog('CANCEL_AUTO_ENROLL');
|
||||
}
|
||||
}
|
||||
document.getElementById('<%=hid_is_auto_enroll.ClientID%>').value = newVal;
|
||||
},
|
||||
auto_enroll_date(newVal) {
|
||||
document.getElementById('<%=hid_auto_enroll_start_date.ClientID%>').value = newVal;
|
||||
},
|
||||
options: {
|
||||
handler() {
|
||||
//console.log("watch1", this.search_dialog, this.search_dialog.page);
|
||||
@@ -537,6 +591,58 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
syncAddress() {
|
||||
const sourceAddr = document.getElementById('<%=address.ClientID%>').value;
|
||||
this.auto_enroll_config.receipt_address = sourceAddr;
|
||||
},
|
||||
open_confirm_dialog(type) {
|
||||
const targetDate = (type === 'CANCEL_AUTO_ENROLL') ? '2099-12-31' : this.auto_enroll_date;
|
||||
api_url = 'api/follower/pending_orders?id=' + '<%= Request["num"] %>' + '&targetDate=' + targetDate;
|
||||
if (type === "CANCEL_AUTO_ENROLL") {
|
||||
axios
|
||||
.post(HTTP_HOST + api_url)
|
||||
.then(response => {
|
||||
this.confirm_dialog.orders = response.data.list;
|
||||
this.confirm_dialog.title = "取消自動報名";
|
||||
this.confirm_dialog.desc = "以下活動已報名,是否一併取消?";
|
||||
this.confirm_dialog.btn_cancel_text = "取消全部活動";
|
||||
this.confirm_dialog.btn_keep_text = "保留現有活動";
|
||||
const orderNos = this.confirm_dialog.orders.map(o => o.orderno).join(',');
|
||||
document.getElementById('<%= hid_delete_order_list.ClientID %>').value = orderNos;
|
||||
if (this.confirm_dialog.orders.length > 0) this.confirm_dialog.show = true;
|
||||
})
|
||||
}
|
||||
else if (type === "UPDATE_START_DATE") {
|
||||
axios
|
||||
.post(HTTP_HOST + api_url)
|
||||
.then(response => {
|
||||
this.confirm_dialog.orders = response.data.list;
|
||||
this.confirm_dialog.title = "生效日期延後確認";
|
||||
this.confirm_dialog.desc = "以下活動已報名,是否一併取消?";
|
||||
this.confirm_dialog.btn_cancel_text = "取消活動";
|
||||
this.confirm_dialog.btn_keep_text = "保留現有活動";
|
||||
const orderNos = this.confirm_dialog.orders.map(o => o.orderno).join(',');
|
||||
document.getElementById('<%= hid_delete_order_list.ClientID %>').value = orderNos;
|
||||
if (this.confirm_dialog.orders.length > 0) this.confirm_dialog.show = true;
|
||||
})
|
||||
}
|
||||
},
|
||||
close_confirm_dialog() {
|
||||
this.auto_enroll_date = this.last_confirmed_date;
|
||||
if (!this.is_auto_enroll)this.is_auto_enroll = true;
|
||||
this.confirm_dialog.show = false;
|
||||
},
|
||||
keep_auto_enroll_order() {
|
||||
document.getElementById('<%= hid_is_delete_all_order.ClientID %>').value = "false";
|
||||
this.last_confirmed_date = this.auto_enroll_date;
|
||||
this.confirm_dialog.show = false;
|
||||
},
|
||||
delete_auto_enroll_order() {
|
||||
document.getElementById('<%= hid_is_delete_all_order.ClientID %>').value = "true";
|
||||
console.log("TRUE");
|
||||
this.last_confirmed_date = this.auto_enroll_date;
|
||||
this.confirm_dialog.show = false;
|
||||
},
|
||||
search_show(curr) {
|
||||
console.log("btn_click:", curr, curr.api_url);
|
||||
this.search_dialog.current = curr;
|
||||
@@ -1340,6 +1446,7 @@
|
||||
</script>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="page_nav" runat="Server">
|
||||
<asp:HiddenField ID="hid_delete_order_list" runat="server" />
|
||||
<div class="scroll-nav nav nav-tabs mb-2 mb-sm-0 d-none d-sm-flex">
|
||||
<template v-if="follower_id !='' "> {{titleword()}} </template>
|
||||
</div>
|
||||
@@ -1564,16 +1671,42 @@
|
||||
<asp:RegularExpressionValidator ControlToValidate="contactor_phone" ErrorMessage="格式有誤" ID="RegularExpressionValidator3" runat="server" ValidationExpression="^[+-]?\d+([+-]?\d*)*$" Display="Dynamic" SetFocusOnError="true" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-1 label-sm-right">
|
||||
<label class="col-sm-2 col-lg-1 col-form-label">自訂標籤</label>
|
||||
<div class="col-sm-2 col-lg-1 d-flex align-center justify-content-end pr-2">
|
||||
|
||||
<input type="checkbox"
|
||||
v-model="is_auto_enroll"
|
||||
style="width: 18px; height: 18px; cursor: pointer;"
|
||||
class="mr-2">
|
||||
<label class="col-form-label">全年報名</label>
|
||||
<asp:HiddenField ID="hid_is_auto_enroll" runat="server" Value="false" />
|
||||
<asp:HiddenField ID="hid_is_delete_all_order" runat="server" Value="false" />
|
||||
</div>
|
||||
|
||||
<div class="col-sm-10 col-lg-3">
|
||||
<input ID="auto_enroll_start_date" type="date"
|
||||
class="form-control"
|
||||
v-model="auto_enroll_date"
|
||||
:disabled="!is_auto_enroll"
|
||||
@change="open_confirm_dialog('UPDATE_START_DATE')">
|
||||
<asp:HiddenField ID="hid_auto_enroll_start_date" runat="server" Value="" />
|
||||
<small class="text-muted" v-if="is_auto_enroll">請設定生效日期</small>
|
||||
</div>
|
||||
|
||||
<label class="col-sm-2 col-lg-1 col-form-label text-right">自訂標籤</label>
|
||||
|
||||
<div class="col-sm-4 col-lg-3">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" v-model="tabArray2" v-on:keyup.enter="addTab" title="可自由輸入標籤名稱,輸入完成請按「+」,或「Enter」" placeholder="自訂標籤名稱">
|
||||
<asp:HiddenField ID="tab" runat="server" />
|
||||
<a class="btn btn-default" @click="addTab" ><i class="mdi mdi-plus"></i></a>
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-default" @click="addTab"><i class="mdi mdi-plus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-lg-7">
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 col-lg-4">
|
||||
<template>
|
||||
<div class="">
|
||||
<v-chip v-for="item,index in tabArray"
|
||||
@@ -1590,6 +1723,40 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<v-expand-transition>
|
||||
<div v-show="is_auto_enroll" class="row rounded grey lighten-4 border py-4">
|
||||
<div class="row mb-1 label-sm-right">
|
||||
<div class="col-sm-2 col-lg-1 d-flex align-center justify-content-end pr-2">
|
||||
<input type="checkbox" v-model="auto_enroll_config.is_receipt" style="width:18px; height:18px; cursor: pointer;" class="mr-2">
|
||||
<label class="col-form-label">寄送收據</label>
|
||||
<asp:HiddenField ID="hid_auto_enroll_is_receipt" runat="server" />
|
||||
</div>
|
||||
<div class="col-sm-12 col-lg-3">
|
||||
<input type="text" class="form-control"
|
||||
placeholder="收據抬頭" v-model="auto_enroll_config.receipt_title" :disabled="!auto_enroll_config.is_receipt">
|
||||
<asp:HiddenField ID="hid_auto_enroll_receipt_title" runat="server" />
|
||||
</div>
|
||||
<div class="col-sm-12 col-lg-6">
|
||||
<div class="input-group mb-3">
|
||||
<input type="text" class="form-control"
|
||||
placeholder="收據地址" v-model="auto_enroll_config.receipt_address" :disabled="!auto_enroll_config.is_receipt">
|
||||
<asp:HiddenField ID="hid_auto_enroll_receipt_address" runat="server" />
|
||||
<button class="btn btn-outline-secondary" type="button" @click="syncAddress" :disabled="!auto_enroll_config.is_receipt">同收件地址</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="py-1 px-8 mb-2 text-muted" style="font-size: 0.85rem; line-height: 1.5;">
|
||||
<div class="font-weight-bold mb-1">
|
||||
<v-icon small color="info" class="mr-1">mdi-information</v-icon> 自動報名須知:
|
||||
</div>
|
||||
<ul class="pl-4 mb-0">
|
||||
<li><strong>生效範疇:</strong>此處修改僅影響<strong>往後</strong>產生的訂單;既有訂單請至「報名管理」手動調整。</li>
|
||||
<li><strong>品項帶入:</strong>系統將自動沿用該信眾<strong>距今最近一次</strong>的報名品項(若無歷史紀錄則不自動帶入)。</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</v-expand-transition>
|
||||
|
||||
<div class="row mb-1">
|
||||
<label class="col-form-label">備註</label>
|
||||
@@ -2123,7 +2290,7 @@
|
||||
<v-card>
|
||||
<v-card-title class="justify-space-between grey lighten-2">
|
||||
查詢:{{search_dialog.current.title}}
|
||||
<v-btn icon @click="search_dialog.show=false"><v-icon>mdi-close</v-icon></v-btn>
|
||||
<v-btn icon @click="search_dialog.show=false;"><v-icon>mdi-close</v-icon></v-btn>
|
||||
</v-card-title>
|
||||
<v-card-text >
|
||||
<v-row>
|
||||
@@ -2173,6 +2340,47 @@
|
||||
</v-btn>
|
||||
</template>
|
||||
</v-snackbar>
|
||||
|
||||
<v-dialog v-model="confirm_dialog.show" max-width="500px" persistent>
|
||||
<v-card>
|
||||
<v-card-title class="justify-space-between grey lighten-2">
|
||||
<span>{{ confirm_dialog.title }}</span>
|
||||
<v-btn icon @click="close_confirm_dialog"><v-icon>mdi-close</v-icon></v-btn>
|
||||
</v-card-title>
|
||||
|
||||
<v-card-text class="pt-4">
|
||||
<p class="body-1">{{ confirm_dialog.desc }}</p>
|
||||
|
||||
<v-data-table
|
||||
:headers="confirm_dialog.headers"
|
||||
:items="confirm_dialog.orders"
|
||||
:items-per-page="5"
|
||||
class="elevation-1 grey lighten-5"
|
||||
:footer-props="{
|
||||
'items-per-page-text': '每頁顯示',
|
||||
'items-per-page-options': [5, 10]
|
||||
}"
|
||||
>
|
||||
<template v-slot:item.activitydate="{ item }">
|
||||
<span>{{ item.activitydate }}</span>
|
||||
</template>
|
||||
|
||||
|
||||
</v-data-table>
|
||||
</v-card-text>
|
||||
<v-divider class="pa-0 ma-0"></v-divider>
|
||||
<v-card-actions class="pa-4 justify-end">
|
||||
<v-btn color="primary" @click="keep_auto_enroll_order">
|
||||
{{ confirm_dialog.btn_keep_text }}
|
||||
</v-btn>
|
||||
|
||||
<v-btn color="red" dark @click="delete_auto_enroll_order">
|
||||
{{ confirm_dialog.btn_cancel_text }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
</div>
|
||||
|
||||
</asp:Content>
|
||||
@@ -11,9 +11,11 @@ using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using static Model.activity_check;
|
||||
|
||||
public partial class admin_follower_reg : MyWeb.config
|
||||
{
|
||||
@@ -153,6 +155,30 @@ public partial class admin_follower_reg : MyWeb.config
|
||||
modify_time.Text = prod.admin_log;
|
||||
}
|
||||
|
||||
if (!isStrNull(prod.is_auto_enroll))
|
||||
{
|
||||
hid_is_auto_enroll.Value = prod.is_auto_enroll.ToString();
|
||||
}
|
||||
|
||||
if (prod.auto_enroll_start_date.HasValue)
|
||||
{
|
||||
hid_auto_enroll_start_date.Value = prod.auto_enroll_start_date.Value.ToString("yyyy-MM-dd");
|
||||
}
|
||||
|
||||
if (prod.auto_enroll_is_receipt.HasValue)
|
||||
{
|
||||
hid_auto_enroll_is_receipt.Value = prod.auto_enroll_is_receipt.ToString();
|
||||
}
|
||||
|
||||
if (!isStrNull(prod.auto_enroll_receipt_title))
|
||||
{
|
||||
hid_auto_enroll_receipt_title.Value = prod.auto_enroll_receipt_title.ToString();
|
||||
}
|
||||
|
||||
if (!isStrNull(prod.auto_enroll_receipt_address))
|
||||
{
|
||||
hid_auto_enroll_receipt_address.Value = prod.auto_enroll_receipt_address.ToString();
|
||||
}
|
||||
|
||||
edit.Visible = true;
|
||||
goback.Visible = true;
|
||||
@@ -181,7 +207,36 @@ public partial class admin_follower_reg : MyWeb.config
|
||||
|
||||
|
||||
#region 資料新增
|
||||
protected string createOrderNumber()
|
||||
{
|
||||
Application.Lock();
|
||||
string order_no = "AA" + DateTime.Now.ToString("yyMMdd");
|
||||
|
||||
var qry = _db.companies.AsQueryable();
|
||||
//var prod = qry.Where(q => q.last_order_no.Contains(order_no)).FirstOrDefault();
|
||||
var prod = qry.Where(q => q.num == 1).FirstOrDefault();
|
||||
if (prod != null)
|
||||
{
|
||||
if (!isStrNull(prod.last_order_no) && prod.last_order_no.Contains(order_no))
|
||||
{
|
||||
int tmp = Convert.ToInt32(prod.last_order_no.Replace(order_no, "")) + 1;
|
||||
order_no = order_no + tmp.ToString("0000");
|
||||
}
|
||||
else
|
||||
{
|
||||
order_no = order_no + "0001";
|
||||
}
|
||||
|
||||
prod.last_order_no = order_no;
|
||||
_db.SaveChanges();
|
||||
}
|
||||
else
|
||||
order_no = "";
|
||||
|
||||
Application.UnLock();
|
||||
|
||||
return order_no;
|
||||
}
|
||||
protected void add_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Page.IsValid) {
|
||||
@@ -237,12 +292,77 @@ public partial class admin_follower_reg : MyWeb.config
|
||||
//tab
|
||||
followers.tab = tab.Value.Trim(',');
|
||||
|
||||
if (!isStrNull(hid_is_auto_enroll.Value)) followers.is_auto_enroll = hid_is_auto_enroll.Value == "true";
|
||||
if (!isStrNull(hid_auto_enroll_start_date.Value)) followers.auto_enroll_start_date = Convert.ToDateTime(hid_auto_enroll_start_date.Value);
|
||||
if (!isStrNull(hid_auto_enroll_is_receipt.Value)) followers.auto_enroll_is_receipt = hid_auto_enroll_is_receipt.Value == "true";
|
||||
if (!isStrNull(hid_auto_enroll_receipt_title.Value)) followers.auto_enroll_receipt_title = hid_auto_enroll_receipt_title.Value;
|
||||
if (!isStrNull(hid_auto_enroll_receipt_address.Value)) followers.auto_enroll_receipt_address = hid_auto_enroll_receipt_address.Value;
|
||||
|
||||
string ChkNewMsg = Model.follower.ChkNewFollower(followers);
|
||||
|
||||
if(string.IsNullOrEmpty(ChkNewMsg))
|
||||
{
|
||||
_db.followers.Add(followers);
|
||||
_db.SaveChanges();
|
||||
|
||||
if (hid_is_auto_enroll.Value == "true")
|
||||
{
|
||||
// 信眾自動報名
|
||||
var qry = _db.activities.Where(a => a.startDate_solar >= followers.auto_enroll_start_date).AsQueryable();
|
||||
var activities = qry.ToList();
|
||||
if (activities != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var activity in activities)
|
||||
{
|
||||
Model.pro_order pro_order = new Model.pro_order(); //新增
|
||||
bool isRegistered = _db.pro_order.Any(x => x.f_num == followers.num && x.activity_num == activity.num);
|
||||
if (isRegistered) continue; // 重複報名
|
||||
|
||||
pro_order.order_no = createOrderNumber();
|
||||
pro_order.up_time = DateTime.Now;
|
||||
pro_order.reg_time = DateTime.Now;
|
||||
pro_order.keyin1 = "A01";
|
||||
pro_order.f_num = followers.num;
|
||||
if (!isStrNull(followers.phone)) { pro_order.phone = followers.phone; }
|
||||
if (!isStrNull(followers.cellphone)) { pro_order.phone = followers.cellphone; }
|
||||
if (IsNumeric(activity.num)) { pro_order.activity_num = activity.num; }
|
||||
pro_order.address = isStrNull(followers.auto_enroll_receipt_address) ? "" : followers.auto_enroll_receipt_address;
|
||||
pro_order.receipt_title = isStrNull(followers.auto_enroll_receipt_title) ? "" : followers.auto_enroll_receipt_title;
|
||||
pro_order.send_receipt = isStrNull(followers.auto_enroll_is_receipt) ? false : followers.auto_enroll_is_receipt;
|
||||
pro_order.demo = "";
|
||||
pro_order.customize_data = "";
|
||||
|
||||
try
|
||||
{
|
||||
if (!isStrNull(pro_order.order_no))
|
||||
{
|
||||
_db.pro_order.Add(pro_order);
|
||||
_db.SaveChanges();
|
||||
|
||||
Model.admin_log admin_log = new Model.admin_log();
|
||||
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Order, (int)Model.admin_log.Status.Insert, pro_order.order_no);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
//if (prod.Count > 0)
|
||||
//{
|
||||
// var orderNumbers = prod.Select(x => x.order_no).ToList();
|
||||
// var qry = _db.pro_order_detail
|
||||
// .Where(o => orderNumbers.Contains(o.order_no))
|
||||
// }
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int _id = followers.num;
|
||||
|
||||
@@ -301,6 +421,10 @@ public partial class admin_follower_reg : MyWeb.config
|
||||
{
|
||||
try
|
||||
{
|
||||
// 記錄修改前的舊值,供後續流程判斷
|
||||
bool old_is_auto_enroll = followers.is_auto_enroll ?? false;
|
||||
DateTime? old_auto_enroll_start_date = followers.auto_enroll_start_date;
|
||||
|
||||
foreach (Control obj in cardBodyPanel.Controls)
|
||||
{
|
||||
if (obj is TextBox)
|
||||
@@ -318,10 +442,7 @@ public partial class admin_follower_reg : MyWeb.config
|
||||
}
|
||||
else
|
||||
ObjValue.SetValue(followers, null);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
followers.identity_type = Val(identity_type.SelectedValue);
|
||||
@@ -333,6 +454,302 @@ public partial class admin_follower_reg : MyWeb.config
|
||||
//followers.admin_log = admin.info.u_id + " " + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
|
||||
followers.follower_hash = encrypt.followerHash(followers.phone, followers.id_code);
|
||||
|
||||
if (!isStrNull(hid_is_auto_enroll.Value)) followers.is_auto_enroll = hid_is_auto_enroll.Value == "true";
|
||||
if (!isStrNull(hid_auto_enroll_start_date.Value)) followers.auto_enroll_start_date = Convert.ToDateTime(hid_auto_enroll_start_date.Value);
|
||||
if (!isStrNull(hid_auto_enroll_is_receipt.Value)) followers.auto_enroll_is_receipt = hid_auto_enroll_is_receipt.Value == "true";
|
||||
if (!isStrNull(hid_auto_enroll_receipt_title.Value)) followers.auto_enroll_receipt_title = hid_auto_enroll_receipt_title.Value;
|
||||
if (!isStrNull(hid_auto_enroll_receipt_address.Value)) followers.auto_enroll_receipt_address = hid_auto_enroll_receipt_address.Value;
|
||||
|
||||
// is_auto_enroll 從關 → 開,執行自動報名
|
||||
bool new_is_auto_enroll = followers.is_auto_enroll ?? false;
|
||||
bool isAutoEnrollTurnedOn = !old_is_auto_enroll && new_is_auto_enroll;
|
||||
bool isAutoEnrollTurnedOff = old_is_auto_enroll && !new_is_auto_enroll;
|
||||
|
||||
// auto_enroll_start_date 有變更,確認是否刪除已有訂單
|
||||
bool isStartDateChanged = followers.auto_enroll_start_date != old_auto_enroll_start_date;
|
||||
|
||||
// 關 → 開,執行自動報名
|
||||
if (isAutoEnrollTurnedOn)
|
||||
{
|
||||
var qry = _db.activities.Where(a => a.startDate_solar >= followers.auto_enroll_start_date).AsQueryable();
|
||||
var latestOrder = _db.pro_order.Where(o => o.f_num == followers.num).OrderByDescending(o => o.order_no).FirstOrDefault(); // 最近一次訂單
|
||||
var activities = qry.ToList();
|
||||
if (activities != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var activity in activities)
|
||||
{
|
||||
Model.pro_order pro_order = new Model.pro_order(); //新增
|
||||
bool isRegistered = _db.pro_order.Any(x => x.f_num == followers.num && x.activity_num == activity.num);
|
||||
if (isRegistered) continue; // 重複報名
|
||||
|
||||
pro_order.order_no = createOrderNumber();
|
||||
pro_order.up_time = DateTime.Now;
|
||||
pro_order.reg_time = DateTime.Now;
|
||||
pro_order.keyin1 = "A01";
|
||||
pro_order.f_num = followers.num;
|
||||
if (!isStrNull(followers.phone)) { pro_order.phone = followers.phone; }
|
||||
if (!isStrNull(followers.cellphone)) { pro_order.phone = followers.cellphone; }
|
||||
if (IsNumeric(activity.num)) { pro_order.activity_num = activity.num; }
|
||||
pro_order.address = isStrNull(followers.auto_enroll_receipt_address) ? "" : followers.auto_enroll_receipt_address;
|
||||
pro_order.receipt_title = isStrNull(followers.auto_enroll_receipt_title) ? "" : followers.auto_enroll_receipt_title;
|
||||
pro_order.send_receipt = isStrNull(followers.auto_enroll_is_receipt) ? false : followers.auto_enroll_is_receipt;
|
||||
pro_order.demo = "";
|
||||
pro_order.customize_data = "";
|
||||
|
||||
try
|
||||
{
|
||||
if (!isStrNull(pro_order.order_no))
|
||||
{
|
||||
Debug.WriteLine(pro_order.order_no);
|
||||
|
||||
_db.pro_order.Add(pro_order);
|
||||
_db.SaveChanges();
|
||||
|
||||
// 報名品項(最近一次訂單內容)
|
||||
if (latestOrder != null)
|
||||
{
|
||||
Debug.WriteLine("上次的單號 ", latestOrder.order_no);
|
||||
var last_order_details = _db.pro_order_detail.Where(o => o.order_no == latestOrder.order_no).ToList();
|
||||
foreach (var last_order_detail in last_order_details)
|
||||
{
|
||||
|
||||
Model.pro_order_detail order_detail = new Model.pro_order_detail();
|
||||
order_detail.order_no = pro_order.order_no;
|
||||
order_detail.actItem = last_order_detail.actItem;
|
||||
order_detail.parent_num = last_order_detail.parent_num;
|
||||
order_detail.print_id = last_order_detail.print_id;
|
||||
order_detail.f_num = last_order_detail.f_num;
|
||||
order_detail.f_num_tablet = last_order_detail.f_num_tablet;
|
||||
order_detail.address = last_order_detail.address;
|
||||
order_detail.from_id = last_order_detail.from_id;
|
||||
order_detail.from_id_tablet = last_order_detail.from_id_tablet;
|
||||
order_detail.bed_type = last_order_detail.bed_type;
|
||||
order_detail.qty = last_order_detail.qty;
|
||||
order_detail.price = last_order_detail.price;
|
||||
order_detail.start_date = DateTime.Today;
|
||||
order_detail.pay = last_order_detail.pay;
|
||||
order_detail.bed_type = last_order_detail.bed_type;
|
||||
order_detail.keyin1 = last_order_detail.keyin1;
|
||||
order_detail.demo = last_order_detail.demo;
|
||||
order_detail.customize_data = last_order_detail.customize_data;
|
||||
order_detail.printed_files = last_order_detail.printed_files;
|
||||
order_detail.UpdateTime = DateTime.Now;
|
||||
_db.pro_order_detail.Add(order_detail);
|
||||
}
|
||||
}
|
||||
_db.SaveChanges();
|
||||
Model.admin_log admin_log = new Model.admin_log();
|
||||
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Order, (int)Model.admin_log.Status.Insert, pro_order.order_no);
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 開 → 關,刪除自動報名訂單
|
||||
if (isAutoEnrollTurnedOff && hid_is_delete_all_order.Value == "true")
|
||||
{
|
||||
if (!string.IsNullOrEmpty(hid_delete_order_list.Value))
|
||||
{
|
||||
var ids = hid_delete_order_list.Value.TrimEnd(',').Split(',');
|
||||
Debug.WriteLine(ids);
|
||||
var prod = _db.pro_order.Where(q => ids.Contains(q.order_no)).ToList();
|
||||
if (prod.Count() > 0)
|
||||
{
|
||||
var prod2 = _db.pro_order_detail.Where(q => ids.Contains(q.order_no)).ToList();
|
||||
if (prod2.Count > 0)
|
||||
{
|
||||
foreach (var item2 in prod2)
|
||||
{
|
||||
var prod3 = _db.bed_order.Where(q => q.order_no == item2.order_no && q.o_detail_id == item2.num).ToList();
|
||||
if (prod3.Count > 0)
|
||||
{
|
||||
foreach (var item3 in prod3)
|
||||
{
|
||||
var prod4 = _db.bed_order_detail.Where(q => q.bed_order_no == item3.bed_order_no).ToList();
|
||||
if (prod4.Count > 0)
|
||||
{
|
||||
_db.bed_order_detail.RemoveRange(prod4);
|
||||
}
|
||||
}
|
||||
|
||||
_db.bed_order.RemoveRange(prod3);
|
||||
}
|
||||
}
|
||||
|
||||
_db.pro_order_detail.RemoveRange(prod2);
|
||||
_db.SaveChanges();
|
||||
}
|
||||
|
||||
_db.pro_order.RemoveRange(prod);
|
||||
_db.SaveChanges();
|
||||
|
||||
Model.admin_log admin_log = new Model.admin_log();
|
||||
if (admin.isLoign())
|
||||
{
|
||||
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Order, (int)Model.admin_log.Status.Delete, admin_log.LogViewBtn(prod.Select(x => x.order_no).ToList()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isStartDateChanged && old_auto_enroll_start_date.HasValue && !isAutoEnrollTurnedOff)
|
||||
{
|
||||
bool isDateMovedLater = followers.auto_enroll_start_date > old_auto_enroll_start_date; // 變晚
|
||||
bool isDateMovedEarlier = followers.auto_enroll_start_date < old_auto_enroll_start_date; // 變早
|
||||
|
||||
// 日期變晚,刪除指定訂單
|
||||
if (isDateMovedLater && hid_is_delete_all_order.Value == "true")
|
||||
{
|
||||
if (!string.IsNullOrEmpty(hid_delete_order_list.Value))
|
||||
{
|
||||
var ids = hid_delete_order_list.Value.TrimEnd(',').Split(',');
|
||||
Debug.WriteLine(ids);
|
||||
var prod = _db.pro_order.Where(q => ids.Contains(q.order_no)).ToList();
|
||||
if (prod.Count() > 0)
|
||||
{
|
||||
//var prod2 = _db.pro_order_detail.ToList().Where(q => ids.Contains(Convert.ToString(q.order_no))).ToList();
|
||||
var prod2 = _db.pro_order_detail.Where(q => ids.Contains(q.order_no)).ToList();
|
||||
if (prod2.Count > 0)
|
||||
{
|
||||
foreach (var item2 in prod2)
|
||||
{
|
||||
var prod3 = _db.bed_order.Where(q => q.order_no == item2.order_no && q.o_detail_id == item2.num).ToList();
|
||||
if (prod3.Count > 0)
|
||||
{
|
||||
foreach (var item3 in prod3)
|
||||
{
|
||||
var prod4 = _db.bed_order_detail.Where(q => q.bed_order_no == item3.bed_order_no).ToList();
|
||||
if (prod4.Count > 0)
|
||||
{
|
||||
_db.bed_order_detail.RemoveRange(prod4);
|
||||
}
|
||||
}
|
||||
|
||||
_db.bed_order.RemoveRange(prod3);
|
||||
}
|
||||
}
|
||||
|
||||
_db.pro_order_detail.RemoveRange(prod2);
|
||||
_db.SaveChanges();
|
||||
}
|
||||
|
||||
_db.pro_order.RemoveRange(prod);
|
||||
_db.SaveChanges();
|
||||
|
||||
Model.admin_log admin_log = new Model.admin_log();
|
||||
if (admin.isLoign())
|
||||
{
|
||||
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Order, (int)Model.admin_log.Status.Delete, admin_log.LogViewBtn(prod.Select(x => x.order_no).ToList()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 日期變早,補報名
|
||||
else if (isDateMovedEarlier && !isAutoEnrollTurnedOn)
|
||||
{
|
||||
var qry = _db.activities.Where(a =>
|
||||
a.startDate_solar >= followers.auto_enroll_start_date &&
|
||||
a.startDate_solar < old_auto_enroll_start_date);
|
||||
var latestOrder = _db.pro_order.Where(o => o.f_num == followers.num).OrderByDescending(o => o.order_no).FirstOrDefault(); // 最近一次訂單
|
||||
var activities = qry.ToList();
|
||||
if (activities != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var activity in activities)
|
||||
{
|
||||
Model.pro_order pro_order = new Model.pro_order(); //新增
|
||||
bool isRegistered = _db.pro_order.Any(x => x.f_num == followers.num && x.activity_num == activity.num);
|
||||
if (isRegistered) continue; // 重複報名
|
||||
|
||||
pro_order.order_no = createOrderNumber();
|
||||
pro_order.up_time = DateTime.Now;
|
||||
pro_order.reg_time = DateTime.Now;
|
||||
pro_order.keyin1 = "A01";
|
||||
pro_order.f_num = followers.num;
|
||||
if (!isStrNull(followers.phone)) { pro_order.phone = followers.phone; }
|
||||
if (!isStrNull(followers.cellphone)) { pro_order.phone = followers.cellphone; }
|
||||
if (IsNumeric(activity.num)) { pro_order.activity_num = activity.num; }
|
||||
pro_order.address = isStrNull(followers.auto_enroll_receipt_address) ? "" : followers.auto_enroll_receipt_address;
|
||||
pro_order.receipt_title = isStrNull(followers.auto_enroll_receipt_title) ? "" : followers.auto_enroll_receipt_title;
|
||||
pro_order.send_receipt = isStrNull(followers.auto_enroll_is_receipt) ? false : followers.auto_enroll_is_receipt;
|
||||
pro_order.demo = "";
|
||||
pro_order.customize_data = "";
|
||||
|
||||
try
|
||||
{
|
||||
if (!isStrNull(pro_order.order_no))
|
||||
{
|
||||
Debug.WriteLine(pro_order.order_no);
|
||||
|
||||
_db.pro_order.Add(pro_order);
|
||||
_db.SaveChanges();
|
||||
|
||||
// 報名品項(最近一次訂單內容)
|
||||
if (latestOrder != null)
|
||||
{
|
||||
Debug.WriteLine("上次的單號 ", latestOrder.order_no);
|
||||
var last_order_details = _db.pro_order_detail.Where(o => o.order_no == latestOrder.order_no).ToList();
|
||||
foreach (var last_order_detail in last_order_details)
|
||||
{
|
||||
|
||||
Model.pro_order_detail order_detail = new Model.pro_order_detail();
|
||||
order_detail.order_no = pro_order.order_no;
|
||||
order_detail.actItem = last_order_detail.actItem;
|
||||
order_detail.parent_num = last_order_detail.parent_num;
|
||||
order_detail.print_id = last_order_detail.print_id;
|
||||
order_detail.f_num = last_order_detail.f_num;
|
||||
order_detail.f_num_tablet = last_order_detail.f_num_tablet;
|
||||
order_detail.address = last_order_detail.address;
|
||||
order_detail.from_id = last_order_detail.from_id;
|
||||
order_detail.from_id_tablet = last_order_detail.from_id_tablet;
|
||||
order_detail.bed_type = last_order_detail.bed_type;
|
||||
order_detail.qty = last_order_detail.qty;
|
||||
order_detail.price = last_order_detail.price;
|
||||
order_detail.start_date = DateTime.Today;
|
||||
order_detail.pay = last_order_detail.pay;
|
||||
order_detail.bed_type = last_order_detail.bed_type;
|
||||
order_detail.keyin1 = last_order_detail.keyin1;
|
||||
order_detail.demo = last_order_detail.demo;
|
||||
order_detail.customize_data = last_order_detail.customize_data;
|
||||
order_detail.printed_files = last_order_detail.printed_files;
|
||||
order_detail.UpdateTime = DateTime.Now;
|
||||
_db.pro_order_detail.Add(order_detail);
|
||||
}
|
||||
}
|
||||
_db.SaveChanges();
|
||||
Model.admin_log admin_log = new Model.admin_log();
|
||||
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Order, (int)Model.admin_log.Status.Insert, pro_order.order_no);
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 如果啟用 search_keywords 功能,生成並更新 search_keywords
|
||||
if (GlobalVariables.UseSearchKeywords)
|
||||
{
|
||||
|
||||
@@ -783,6 +783,7 @@
|
||||
this.desserts_count = response.data.list !== undefined ? response.data.count : 0
|
||||
this.calutotalPrice();
|
||||
this.disableButton = false;
|
||||
console.log(response.data.list);
|
||||
|
||||
})
|
||||
.catch(
|
||||
|
||||
@@ -147,6 +147,14 @@
|
||||
</v-col>
|
||||
<v-col cols="auto" class="ml-4">
|
||||
<span class="subtitle-2 grey--text text--darken-1">超渡-已選</span>
|
||||
<v-chip v-if="tabletItem.has_chao_limit"
|
||||
x-small
|
||||
class="ml-2 px-2"
|
||||
:color="family_deceased_Y_selected.length > tabletItem.chao_limit_count ? 'error' : 'grey lighten-1'"
|
||||
:dark="family_deceased_Y_selected.length > tabletItem.chao_limit_count"
|
||||
label>
|
||||
{{ family_deceased_Y_selected.length }} / {{ tabletItem.chao_limit_count }}
|
||||
</v-chip>
|
||||
</v-col>
|
||||
<v-spacer></v-spacer>
|
||||
<v-col cols="auto">
|
||||
@@ -237,6 +245,14 @@
|
||||
</v-col>
|
||||
<v-col cols="auto" :class="{'ml-4': item_type==='A'}">
|
||||
<span class="subtitle-2 grey--text text--darken-1">陽上/祈福-已選</span>
|
||||
<v-chip v-if="tabletItem.has_yang_limit"
|
||||
x-small
|
||||
class="ml-2 px-2"
|
||||
:color="family_deceased_N_selected.length > tabletItem.yang_limit_count ? 'error' : 'grey lighten-1'"
|
||||
:dark="family_deceased_N_selected.length > tabletItem.yang_limit_count"
|
||||
label>
|
||||
{{ family_deceased_N_selected.length }} / {{ tabletItem.yang_limit_count }}
|
||||
</v-chip>
|
||||
</v-col>
|
||||
<v-spacer></v-spacer>
|
||||
<v-col cols="auto">
|
||||
@@ -700,6 +716,15 @@
|
||||
saveData() {
|
||||
// 其它資料欄位, 不應在這裡修改
|
||||
// 應該在進來的時候, 就已經修改(insert)好了
|
||||
if (this.tabletItem.has_chao_limit && this.family_deceased_Y_selected.length > this.tabletItem.chao_limit_count) {
|
||||
alert(`超渡人數超過限制!(上限 ${this.tabletItem.chao_limit_count} 人)`);
|
||||
return; // 阻斷存檔
|
||||
}
|
||||
if (this.tabletItem.has_yang_limit && this.family_deceased_N_selected.length > this.tabletItem.yang_limit_count) {
|
||||
alert(`陽上人數超過限制!(上限 ${this.tabletItem.yang_limit_count} 人)`);
|
||||
return; // 阻斷存檔
|
||||
}
|
||||
|
||||
let tablet_data = {};
|
||||
if (this.item_type === 'B') {// B:超渡, 超薦.....
|
||||
tablet_data = {
|
||||
|
||||
@@ -6,3 +6,12 @@ FK_pro_order_detail_followers 刪除規則設為 沒有動作
|
||||
FK_activity_relating_activity 刪除規則設為 cascade
|
||||
|
||||
actitem 加上 sort_order(int) 欄位
|
||||
activity_relating 加上 has_yang_limit(bit) 欄位
|
||||
activity_relating 加上 has_chao_limit(bit) 欄位
|
||||
activity_relating 加上 yang_limit_count(int) 欄位
|
||||
activity_relating 加上 chao_limit_count(int) 欄位
|
||||
follower 加上 is_auto_enroll(bit) 欄位
|
||||
follower 加上 auto_enroll_start_date(datetime) 欄位
|
||||
follower 加上 auto_enroll_receipt_title(nvarchar(50)) 欄位
|
||||
follower 加上 auto_enroll_receipt_address(nvarchar(200)) 欄位
|
||||
follower 加上 auto_enroll_is_receipt(bit) 欄位
|
||||
Reference in New Issue
Block a user