1. 新增法會活動品項:牌位陽上與超度人數限制功能
2. 信眾資料新增全年性選項以及開始參加活動日期,自動報名並代入前一次的報名資料(品項)
This commit is contained in:
@@ -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));
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user