Merge remote-tracking branch 'origin/0.1' into dapper
# Conflicts: # web/App_Code/Model/Model.Designer.cs # web/App_Code/Model/Model.cs # web/App_Code/Model/Model.edmx # web/web.config
This commit is contained in:
+233
-61
@@ -14,17 +14,18 @@
|
||||
<a @click="print_dialog.show=true" class="btn btn-outline-primary btn-print" target="_blank">
|
||||
<i class="mdi mdi-printer"></i>列印管理報表
|
||||
</a>
|
||||
|
||||
<div class="dropdown d-inline-block">
|
||||
<a class="btn btn-outline-primary btn-print dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false"><i class="mdi mdi-printer"></i>列印報名資料</a>
|
||||
<ul class="dropdown-menu ps-0 w-100" aria-labelledby="dropdownPrintLink">
|
||||
<li><a @click="search.hasPrice='Y';goPrint()" class="dropdown-item"><i class="mdi mdi-printer me-1"></i>有金額</a></li>
|
||||
<li><a @click="search.hasPrice='N';goPrint()" class="dropdown-item"><i class="mdi mdi-printer me-1"></i>無金額</a></li>
|
||||
</ul>
|
||||
<div :style="data_table.list.length === 0 ? 'pointer-events: none; opacity: 0.5;' : ''" style="display:inline-block;">
|
||||
<div class="dropdown d-inline-block">
|
||||
<a class="btn btn-outline-primary btn-print dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false"><i class="mdi mdi-printer"></i>列印查詢資料</a>
|
||||
<ul class="dropdown-menu ps-0 w-100" aria-labelledby="dropdownPrintLink">
|
||||
<li><a @click="search.hasPrice='Y';goPrint()" class="dropdown-item"><i class="mdi mdi-printer me-1"></i>有金額</a></li>
|
||||
<li><a @click="search.hasPrice='N';goPrint()" class="dropdown-item"><i class="mdi mdi-printer me-1"></i>無金額</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div :style="data_table.list.length === 0 ? 'pointer-events: none; opacity: 0.5;' : ''" style="display:inline-block;">
|
||||
<asp:LinkButton ID="excel" runat="server" CssClass="btn btn-outline-success" OnClick="excel_Click"><span class="fa-solid fa-file-excel"></span> 匯出查詢資料(Excel)</asp:LinkButton>
|
||||
</div>
|
||||
|
||||
<asp:LinkButton ID="excel" runat="server" CssClass="btn btn-outline-success" OnClick="excel_Click"><span class="fa-solid fa-file-excel"></span> 匯出Excel</asp:LinkButton>
|
||||
|
||||
</div>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="footer_script" runat="Server">
|
||||
@@ -39,6 +40,8 @@
|
||||
vuetify: new Vuetify(vuetify_options),
|
||||
data() {
|
||||
return {
|
||||
print_error_msg: "",
|
||||
isSearched: false,
|
||||
this_act : '<%= Request["act_id"]%>',
|
||||
options: { multiSort: false },
|
||||
search_options: { multiSort: false },
|
||||
@@ -56,6 +59,7 @@
|
||||
{ text: '報名日期', value: 'up_time' },
|
||||
{ text: '報名活動', value: 'subject', align: 'start' },
|
||||
{ text: '單據狀態', value: 'keyin1_txt' },
|
||||
{ text: '報到狀態', value: 'status' },
|
||||
{ text: '', value: 'slot_btn', sortable: false, align: 'end' }
|
||||
],
|
||||
footer:{
|
||||
@@ -203,6 +207,10 @@
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const printResult = document.getElementById('<%= hid_err_msg.ClientID %>').value;
|
||||
document.getElementById('<%= hid_err_msg.ClientID %>').value = '';
|
||||
window._printResult = printResult
|
||||
|
||||
this.detalKeyinArray();
|
||||
this.search_dialog.current = this.search_dialog.controls.search1 ///default
|
||||
if (this.this_act != '')
|
||||
@@ -211,20 +219,63 @@
|
||||
this.initActivity();
|
||||
const navEntries = performance.getEntriesByType("navigation");
|
||||
const isReload = navEntries.length > 0 && navEntries[0].type === "reload";
|
||||
|
||||
if (isReload) {
|
||||
sessionStorage.removeItem("orderpage");
|
||||
sessionStorage.removeItem("order_list_cache");
|
||||
sessionStorage.removeItem("order_query_params");
|
||||
}
|
||||
else if ("<%=lastAddedNo%>" !== "") {
|
||||
const newQuery = { order_no: '<%=lastAddedNo%>' };
|
||||
sessionStorage.setItem('order_query_params', JSON.stringify(newQuery));
|
||||
this.search = newQuery;
|
||||
this.isSearched = true;
|
||||
}
|
||||
else {
|
||||
const savedPage = parseInt(sessionStorage.getItem('orderpage'));
|
||||
const savedData = sessionStorage.getItem("order_list_cache");
|
||||
const savedQuery = JSON.parse(sessionStorage.getItem("order_query_params"));
|
||||
if (savedQuery) {
|
||||
this.search = savedQuery;
|
||||
this.isSearched = true;
|
||||
}
|
||||
if (savedPage) {
|
||||
this.options.page = savedPage;
|
||||
}
|
||||
}
|
||||
if (savedData && savedData !== "undefined") {
|
||||
this.data_table = JSON.parse(savedData);
|
||||
this.isSearched = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (printResult === 'nodata' || printResult === 'success') {
|
||||
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.print_dialog.show = true;
|
||||
if (printResult === 'nodata') {
|
||||
this.print_error_msg = "查無資料,請重新選擇區間";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.$nextTick(() => {
|
||||
setTimeout(() => {
|
||||
// 清空 URL
|
||||
const cleanUrl = window.location.protocol + "//" + window.location.host + window.location.pathname;
|
||||
window.history.replaceState({}, '', cleanUrl);
|
||||
}, 100);
|
||||
});
|
||||
},
|
||||
watch: {
|
||||
options: {
|
||||
handler() {
|
||||
this.getDefault()
|
||||
if (this.isSearched) {
|
||||
this.getDefault()
|
||||
}
|
||||
else {
|
||||
this.data_table.loading = false;
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
@@ -236,6 +287,57 @@
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
triggerManagementExport(mode) {
|
||||
this.print_error_msg = "";
|
||||
if (this.print_search.year == '') {
|
||||
msgbox('請輸入年份');
|
||||
return;
|
||||
}
|
||||
if (!this.print_search.chk_noact && !this.print_search.chk_hasact) {
|
||||
msgbox('活動/非活動至少勾選一項');
|
||||
return;
|
||||
}
|
||||
|
||||
// 將 Vue 狀態同步至 ASP.NET HiddenField,供後端 PostBack 讀取參數
|
||||
document.getElementById('<%= hid_print_mode.ClientID %>').value = this.print_conditions;
|
||||
document.getElementById('<%= hid_print_year.ClientID %>').value = this.print_search.year;
|
||||
if (this.print_conditions == 'mm')
|
||||
document.getElementById('<%= hid_print_month.ClientID %>').value = this.print_search.month;
|
||||
else if (this.print_conditions == 'ss')
|
||||
document.getElementById('<%= hid_print_season.ClientID %>').value = this.print_search.season;
|
||||
document.getElementById('<%= hid_select_act.ClientID %>').value = this.print_search.select_act;
|
||||
document.getElementById('<%= hid_select_actitem.ClientID %>').value = this.print_search.select_actitem;
|
||||
document.getElementById('<%= hid_chk_hasact.ClientID %>').value = this.print_search.chk_hasact;
|
||||
document.getElementById('<%= hid_chk_noact.ClientID %>').value = this.print_search.chk_noact;
|
||||
|
||||
let qry = "";
|
||||
Object.keys(this.print_search).forEach(key => {
|
||||
if (this.print_search[key] != undefined && this.print_search[key] != null && this.print_search[key] != '') {
|
||||
if (key == 'month' ) {
|
||||
if (this.print_conditions == 'mm') {
|
||||
qry += "&month=" + this.print_search.month;
|
||||
}
|
||||
} else if ( key == 'season')
|
||||
{
|
||||
if (this.print_conditions == 'ss') {
|
||||
qry += "&season=" + this.print_search.season;
|
||||
}
|
||||
}
|
||||
else {
|
||||
qry += (qry != '' ? '&' : '?') + (key + '=' + this.print_search[key]);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
document.getElementById('<%= hid_qry.ClientID %>').value = qry;
|
||||
|
||||
if (mode === 'print') {
|
||||
document.getElementById('<%= print_management.ClientID %>').click();
|
||||
}
|
||||
else if (mode === "excel") {
|
||||
document.getElementById('<%= excel_management.ClientID %>').click();
|
||||
}
|
||||
},
|
||||
search_show(curr) {
|
||||
//console.log("btn_click:", curr, curr.api_url);
|
||||
this.search_dialog.current = curr;
|
||||
@@ -321,19 +423,24 @@
|
||||
this.data_table.list = response.data.list
|
||||
this.data_table.count = response.data.count;
|
||||
this.data_table.loading = false
|
||||
|
||||
const dataToStore = JSON.stringify(this.data_table);
|
||||
sessionStorage.setItem("order_list_cache", dataToStore);
|
||||
})
|
||||
.catch(error => console.log(error))
|
||||
},
|
||||
detalKeyinArray() {
|
||||
var getArray = <%=Newtonsoft.Json.JsonConvert.SerializeObject(_keyin1Item, Newtonsoft.Json.Formatting.Indented) %>;
|
||||
var keys = Object.keys(getArray);
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
//console.log(`${keys[i]}:${getArray[keys[i]]}`); //value : text
|
||||
var _tmp = {
|
||||
text: getArray[keys[i]],
|
||||
val: parseInt(keys[i]),
|
||||
if (getArray !== null) {
|
||||
var keys = Object.keys(getArray);
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
//console.log(`${keys[i]}:${getArray[keys[i]]}`); //value : text
|
||||
var _tmp = {
|
||||
text: getArray[keys[i]],
|
||||
val: parseInt(keys[i]),
|
||||
}
|
||||
this.keyin1_items.push(_tmp);
|
||||
}
|
||||
this.keyin1_items.push(_tmp);
|
||||
}
|
||||
|
||||
},
|
||||
@@ -368,22 +475,28 @@
|
||||
//}
|
||||
//this.data_table.selected = [];
|
||||
//this.data_table.count = this.data_table.list.length
|
||||
location.reload();
|
||||
//location.reload();
|
||||
this.getDefault();
|
||||
})
|
||||
.catch(error => console.log(error))
|
||||
}
|
||||
},
|
||||
btn_search() {
|
||||
this.isSearched = true;
|
||||
sessionStorage.setItem("order_query_params", JSON.stringify(this.search));
|
||||
this.this_act = '';
|
||||
this.search.activity_num = '';
|
||||
|
||||
this.getDefault(true)
|
||||
bootstrap.Offcanvas.getInstance(document.getElementById("offcanvasRight")).hide()
|
||||
},
|
||||
btn_all() {
|
||||
this.isSearched = false;
|
||||
this.this_act = '';
|
||||
this.search.activity_num = '';
|
||||
clearObjProps(this.search);
|
||||
this.btn_search()
|
||||
sessionStorage.setItem("order_query_params", JSON.stringify(this.search));
|
||||
//this.btn_search()
|
||||
},
|
||||
checkInMsg(item) {
|
||||
this.check_data.f_num = item.f_num;
|
||||
@@ -392,39 +505,59 @@
|
||||
this.check_data.activity_name = item.subject;
|
||||
this.check_dialog.show = true;
|
||||
},
|
||||
checkIn() {
|
||||
if (this.check_data.qty > 0 && this.check_data.status.val > 0) {
|
||||
var chechdata =
|
||||
{
|
||||
f_num: this.check_data.f_num,
|
||||
activity_num: this.check_data.activity_num,
|
||||
status: this.check_data.status.val,
|
||||
qty: this.check_data.qty,
|
||||
}
|
||||
axios
|
||||
.post(HTTP_HOST + 'api/activity/OrderCheckIn', chechdata)
|
||||
.then(response => {
|
||||
//清空
|
||||
this.check_data.f_num = 0;
|
||||
this.check_data.u_name = '';
|
||||
this.check_data.activity_num = 0;
|
||||
this.check_data.activity_name = '';
|
||||
this.check_data.qty = 1;
|
||||
this.check_data.status.text = '';
|
||||
this.check_data.status.val = 1;
|
||||
|
||||
this.check_dialog.show = false;
|
||||
msgtop('簽到成功')
|
||||
})
|
||||
.catch(
|
||||
error => {
|
||||
console.log(error)
|
||||
msgtop('簽到失敗', 'error')
|
||||
}
|
||||
)
|
||||
} else {
|
||||
msgbox('報到資訊請填寫完整');
|
||||
checkIn(item) {
|
||||
var checkdata =
|
||||
{
|
||||
f_num: item.f_num,
|
||||
activity_num: item.activity_num,
|
||||
status: 1,
|
||||
qty: 1,
|
||||
}
|
||||
console.log(checkdata)
|
||||
axios
|
||||
.post(HTTP_HOST + 'api/activity/OrderCheckIn', checkdata)
|
||||
.then(response => {
|
||||
msgtop('簽到成功');
|
||||
this.getDefault();
|
||||
})
|
||||
.catch(
|
||||
error => {
|
||||
console.log(error)
|
||||
msgtop('簽到失敗', 'error')
|
||||
}
|
||||
)
|
||||
//if (this.check_data.qty > 0 && this.check_data.status.val > 0) {
|
||||
// var chechdata =
|
||||
// {
|
||||
// f_num: this.check_data.f_num,
|
||||
// activity_num: this.check_data.activity_num,
|
||||
// status: this.check_data.status.val,
|
||||
// qty: this.check_data.qty,
|
||||
// }
|
||||
// axios
|
||||
// .post(HTTP_HOST + 'api/activity/OrderCheckIn', chechdata)
|
||||
// .then(response => {
|
||||
// //清空
|
||||
// this.check_data.f_num = 0;
|
||||
// this.check_data.u_name = '';
|
||||
// this.check_data.activity_num = 0;
|
||||
// this.check_data.activity_name = '';
|
||||
// this.check_data.qty = 1;
|
||||
// this.check_data.status.text = '';
|
||||
// this.check_data.status.val = 1;
|
||||
|
||||
// this.check_dialog.show = false;
|
||||
// msgtop('簽到成功')
|
||||
// })
|
||||
// .catch(
|
||||
// error => {
|
||||
// console.log(error)
|
||||
// msgtop('簽到失敗', 'error')
|
||||
// }
|
||||
// )
|
||||
//} else {
|
||||
// msgbox('報到資訊請填寫完整');
|
||||
//}
|
||||
}, goPrint() {
|
||||
let _qry = "";
|
||||
Object.keys(this.search).forEach(key => {
|
||||
@@ -442,6 +575,7 @@
|
||||
//列印管理報表
|
||||
print_close() {
|
||||
this.print_dialog.show = false;
|
||||
this.print_error_msg = "";
|
||||
}
|
||||
,
|
||||
initPrintSearch() {
|
||||
@@ -504,9 +638,9 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
console.log(_qry);
|
||||
this.print_dialog.show = false;
|
||||
window.open("print.aspx" + _qry, '_blank');
|
||||
//window.open("print.aspx" + _qry, '_blank');
|
||||
} else {
|
||||
msgbox('活動/非活動至少勾選一項');
|
||||
}
|
||||
@@ -537,7 +671,7 @@
|
||||
initActivity() {
|
||||
axios.get(HTTP_HOST + 'api/activity')
|
||||
.then(response => {
|
||||
this.select_act_list = response.data
|
||||
this.select_act_list = response.data
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error)
|
||||
@@ -556,10 +690,35 @@
|
||||
$('#country2').val('');
|
||||
VueApp.search.country2 = '';
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
// 判斷是否彈出 search dialog
|
||||
let hasSearchResult = sessionStorage.getItem("order_list_cache") !== null;
|
||||
|
||||
if (!hasSearchResult && window._printResult === '') {
|
||||
let $btn = $("a[data-bs-target='#offcanvasRight'][href='#search_panel']");
|
||||
$btn.click();
|
||||
let el = document.getElementById('offcanvasRight');
|
||||
let offcanvas = bootstrap.Offcanvas.getOrCreateInstance(el);
|
||||
offcanvas.show();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
|
||||
<uc1:alert runat="server" ID="L_msg" Text="" />
|
||||
<asp:HiddenField ID="hid_err_msg" runat="server" />
|
||||
<asp:HiddenField ID="hid_print_year" runat="server" />
|
||||
<asp:HiddenField ID="hid_print_month" runat="server" />
|
||||
<asp:HiddenField ID="hid_print_season" runat="server" />
|
||||
<asp:HiddenField ID="hid_print_mode" runat="server" />
|
||||
<asp:HiddenField ID="hid_chk_hasact" runat="server" />
|
||||
<asp:HiddenField ID="hid_chk_noact" runat="server" />
|
||||
<asp:HiddenField ID="hid_select_act" runat="server" />
|
||||
<asp:HiddenField ID="hid_select_actitem" runat="server" />
|
||||
<asp:HiddenField ID="hid_qry" runat="server" />
|
||||
<asp:LinkButton ID="print_management" runat="server" OnClick="export_Click" style="display:none;" />
|
||||
<asp:LinkButton ID="excel_management" runat="server" OnClick="export_Click" style="display:none;" />
|
||||
<div id="content" class="container-fluid">
|
||||
<v-data-table
|
||||
v-model="data_table.selected"
|
||||
@@ -580,10 +739,13 @@
|
||||
<template #item.up_time="{ item }" >
|
||||
{{ item.up_time|timeString('YYYY/MM/DD') }}
|
||||
</template>
|
||||
<template #item.u_name="{ item }" >
|
||||
<a v-if="item.f_num != null && item.activity_num != null" @click="checkInMsg(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-account-check"></i>報到</a>
|
||||
<template #item.u_name="{ item }" >
|
||||
{{ item.u_name }}
|
||||
</template>
|
||||
<template #item.status="{ item }" >
|
||||
<a v-if="item.f_num != null && item.activity_num != null && item.status == 0" @click="checkIn(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-account"></i>報到</a>
|
||||
<a v-if="item.f_num != null && item.activity_num != null && item.status == 1" class="btn btn-outline-secondary btn-sm opacity-50" style="pointer-events: none" ><i class="mdi mdi-account-check"></i>已報到</a>
|
||||
</template>
|
||||
<template #item.slot_btn="{ item }">
|
||||
<a :href="'reg.aspx?order_no='+item.order_no" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-pencil-box-outline"></i>修改</a>
|
||||
<a @click="deleteItem(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-trash-can"></i>刪除</a>
|
||||
@@ -692,7 +854,8 @@
|
||||
item-text="text"
|
||||
item-value="val"
|
||||
v-model="print_search.month"
|
||||
:items="select_items.month"
|
||||
:items="select_items.month"
|
||||
eager
|
||||
></v-select>
|
||||
</v-col>
|
||||
<v-col :cols="2" class="pt-5" v-if="print_conditions=='ss' ">
|
||||
@@ -703,7 +866,8 @@
|
||||
item-text="text"
|
||||
item-value="val"
|
||||
v-model="print_search.season"
|
||||
:items="select_items.season"
|
||||
:items="select_items.season"
|
||||
eager
|
||||
></v-select>
|
||||
</v-col>
|
||||
|
||||
@@ -764,9 +928,17 @@
|
||||
</v-row>
|
||||
</v-col>--%>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col>
|
||||
<div v-if="print_error_msg" class="red--text mt-2 text-center" style="font-weight: bold;">
|
||||
{{ print_error_msg }}
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row densee class="pt-3" >
|
||||
<v-col :cols="12" class="pt-3 text-center" >
|
||||
<v-btn class="ma-2" color="primary" dark @click="goPrint2" > 列印 </v-btn>
|
||||
<v-btn class="ma-2" color="primary" dark @click="triggerManagementExport('print')" > 列印 </v-btn>
|
||||
<v-btn class="ma-2" color="primary" dark @click="triggerManagementExport('excel')"> 匯出 Excel </v-btn>
|
||||
<v-btn class="ma-2" color="green" dark @click="print_close" > 取消 </v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
+565
-26
@@ -1,22 +1,28 @@
|
||||
using System;
|
||||
using DocumentFormat.OpenXml;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Data.OleDb;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using System.Linq;
|
||||
using static Model.admin_log;
|
||||
using static regionController;
|
||||
|
||||
public partial class admin_order_index : MyWeb.config
|
||||
{
|
||||
private Model.ezEntities _db = new Model.ezEntities();
|
||||
public Dictionary<int, string> _keyin1Item = null;
|
||||
protected string lastAddedNo;
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
@@ -33,6 +39,13 @@ public partial class admin_order_index : MyWeb.config
|
||||
}
|
||||
|
||||
_keyin1Item = publicFun.enum_desc<Model.activity_check.keyin1>(); //狀態
|
||||
|
||||
if (Session["LastAddedNo"] != null)
|
||||
{
|
||||
lastAddedNo = Session["LastAddedNo"].ToString();
|
||||
Session.Remove("LastAddedNo");
|
||||
}
|
||||
|
||||
BuildKind();
|
||||
|
||||
}
|
||||
@@ -58,6 +71,452 @@ public partial class admin_order_index : MyWeb.config
|
||||
#endregion
|
||||
#region 匯出Excel
|
||||
|
||||
protected void export_Click(object sender, EventArgs e)
|
||||
{
|
||||
LinkButton btn = sender as LinkButton;
|
||||
if (btn == null) return;
|
||||
bool isPrintMode = (btn.ID == "print_management");
|
||||
bool isExcelMode = (btn.ID == "excel_management" || btn.ID == "excel");
|
||||
|
||||
//查詢要匯出的資料
|
||||
string _query = ""; // 紀錄匯出條件
|
||||
//var list = searchData(ref _query, isManagementMode);
|
||||
|
||||
if (isExcelMode)
|
||||
{
|
||||
int selYear = !string.IsNullOrEmpty(hid_print_year.Value) ? int.Parse(hid_print_year.Value) : 0;
|
||||
int selMonth = !string.IsNullOrEmpty(hid_print_month.Value) ? int.Parse(hid_print_month.Value) : 0;
|
||||
int selSeason = !string.IsNullOrEmpty(hid_print_season.Value) ? int.Parse(hid_print_season.Value) : 0;
|
||||
string selMode = !string.IsNullOrEmpty(hid_print_mode.Value) ? hid_print_mode.Value : "";
|
||||
bool chkHasAct = !string.IsNullOrEmpty(hid_chk_hasact.Value) && Convert.ToBoolean(hid_chk_hasact.Value);
|
||||
bool chkNoAct = !string.IsNullOrEmpty(hid_chk_noact.Value) && Convert.ToBoolean(hid_chk_noact.Value);
|
||||
int selAct = !string.IsNullOrEmpty(hid_select_act.Value) ? int.Parse(hid_select_act.Value) : 0;
|
||||
int selActItem = !string.IsNullOrEmpty(hid_select_actitem.Value) ? int.Parse(hid_select_actitem.Value) : 0;
|
||||
|
||||
var qry = _db.pro_order.AsQueryable();
|
||||
|
||||
if (selYear > 0)
|
||||
{
|
||||
qry = qry.Where(o => o.up_time.HasValue && o.up_time.Value.Year == selYear);
|
||||
_query += "年份:" + selYear + "\n";
|
||||
}
|
||||
|
||||
if (selMode == "mm" && selMonth > 0)
|
||||
{
|
||||
qry = qry.Where(o => o.up_time.HasValue && o.up_time.Value.Month == selMonth);
|
||||
_query += "月份:" + selMonth + "\n";
|
||||
}
|
||||
|
||||
if (selMode == "ss" && selSeason > 0)
|
||||
{
|
||||
if (selSeason == 1)
|
||||
{
|
||||
qry = qry.Where(o => o.up_time.HasValue)
|
||||
.Where(o => o.up_time.Value.Month == 1 || o.up_time.Value.Month == 2 || o.up_time.Value.Month == 3);
|
||||
}
|
||||
else if (selSeason == 2)
|
||||
{
|
||||
qry = qry.Where(o => o.up_time.HasValue)
|
||||
.Where(o => o.up_time.Value.Month == 4 || o.up_time.Value.Month == 5 || o.up_time.Value.Month == 6);
|
||||
}
|
||||
else if (selSeason == 3)
|
||||
{
|
||||
qry = qry.Where(o => o.up_time.HasValue)
|
||||
.Where(o => o.up_time.Value.Month == 7 || o.up_time.Value.Month == 8 || o.up_time.Value.Month == 9);
|
||||
}
|
||||
else if (selSeason == 4)
|
||||
{
|
||||
qry = qry.Where(o => o.up_time.HasValue)
|
||||
.Where(o => o.up_time.Value.Month == 10 || o.up_time.Value.Month == 11 || o.up_time.Value.Month == 12);
|
||||
}
|
||||
|
||||
_query += "季度:" + selSeason + "\n";
|
||||
}
|
||||
|
||||
if (chkHasAct)
|
||||
{
|
||||
if(selAct > 0)
|
||||
{
|
||||
var actSubject = _db.activities.Where(a => a.num == selAct).Select(a => a.subject).FirstOrDefault();
|
||||
_query += $"活動報名: {actSubject}\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
_query += $"活動報名\n";
|
||||
}
|
||||
|
||||
if (chkNoAct)
|
||||
{
|
||||
_query += "非活動報名\n";
|
||||
if (selAct > 0)
|
||||
qry = qry.Where(o => o.activity_num.HasValue && o.activity_num.Value == selAct);
|
||||
}
|
||||
else
|
||||
{
|
||||
qry = qry.Where(o => o.activity_num.HasValue);
|
||||
if (selAct > 0)
|
||||
qry = qry.Where(o => o.activity_num.Value == selAct);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (chkNoAct)
|
||||
{
|
||||
qry = qry.Where(o => o.activity_num == null);
|
||||
_query += "非活動報名\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (selActItem > 0)
|
||||
qry = qry.Where(o => o.pro_order_detail.Where(f2 => f2.actItem_num.HasValue && f2.actItem_num.Value == selActItem).Count() > 0);
|
||||
|
||||
if (selYear > 0)
|
||||
qry = qry.OrderByDescending(o => o.activity != null ? o.activity.startDate_solar : null).ThenByDescending(o => o.up_time).ThenByDescending(o => o.order_no);
|
||||
else
|
||||
qry = qry.OrderByDescending(o => o.order_no);
|
||||
|
||||
MyWeb.encrypt encrypt = new MyWeb.encrypt();
|
||||
var tdesc = publicFun.enum_desc<Model.pro_order.detailKeyin1>();
|
||||
var bedDt = _db.bed_order_detail.AsQueryable();//掛單明細
|
||||
|
||||
//紀錄匯出條件
|
||||
//var list = qry.ToList();
|
||||
var list = qry.GroupJoin(
|
||||
_db.pro_order_detail, o => o.order_no, p => p.order_no, (o, c) =>
|
||||
new
|
||||
{
|
||||
//訂單資料
|
||||
order_no = o.order_no,
|
||||
up_time = o.up_time,
|
||||
keyin1 = o.keyin1,
|
||||
f_num = o.follower != null ? o.follower.u_name : "", //姓名/名稱
|
||||
phone = o.phone,
|
||||
activity_num = o.activity_num.HasValue ? o.activity.subject : "",
|
||||
address = o.address,
|
||||
demo = o.demo,
|
||||
c
|
||||
}).SelectMany(o => o.c.DefaultIfEmpty(), (o, d) => //SelectMany 展開
|
||||
new
|
||||
{
|
||||
//訂單資料
|
||||
order_no = o.order_no,
|
||||
up_time = o.up_time,
|
||||
keyin1 = o.keyin1,
|
||||
f_num = o.f_num, //姓名/名稱
|
||||
phone = o.phone,
|
||||
activity_num = o.activity_num,
|
||||
address = o.address,
|
||||
demo = o.demo,
|
||||
|
||||
//訂單明細
|
||||
//使用DefaultIfEmpty 因匿名型別無法輸出NULL(無法轉換成強型別),需特別注意Null的處理
|
||||
d_actItem_num = d == null ? "" : (d.actItem_num.HasValue ? d.actItem.subject : ""), //項目名稱
|
||||
d_category = d == null ? "" : (d.actItem_num.HasValue ? d.actItem.category.ToString() : ""),
|
||||
d_f_num = d == null ? "" : (d.f_num.HasValue ? d.follower.u_name : ""), //姓名
|
||||
d_address = d == null ? "" : d.address,
|
||||
d_from_id = d == null ? "" : (d.from_id.HasValue ? d.follower1.u_name : ""), //陽上/報恩者
|
||||
d_f_num_tablet = d == null ? "" : d.f_num_tablet,
|
||||
d_start_date = d == null ? (DateTime?)null : d.start_date, //開始日期
|
||||
d_due_date = d == null ? (DateTime?)null : d.due_date, //期滿日期
|
||||
d_extend_date = d == null ? (DateTime?)null : d.extend_date, //應續約日
|
||||
d_price = d == null ? (float?)null : d.price, //預設金額
|
||||
d_qty = d == null ? "" : (d.qty.HasValue ? d.qty.Value.ToString() : "0"), //數量
|
||||
d_writeBedQty = d == null ? 0 : bedDt.Where(b => (b.bed_order.o_detail_id.Value == d.num) && b.checkIn_date.HasValue && b.bed_kind_detail_id.HasValue).Count(), //已劃數量
|
||||
d_notBedQty = d == null ? 0 : bedDt.Where(b => b.bed_order.o_detail_id.Value == d.num && (!b.checkIn_date.HasValue || !b.bed_kind_detail_id.HasValue)).Count(), //未劃數量
|
||||
d_pay = d == null ? "" : (d.pay.HasValue ? d.pay.Value.ToString() : "0"), //已收金額
|
||||
d_pay_date = d == null ? (DateTime?)null : d.start_date, //付款期限
|
||||
d_keyin1 = d == null ? (int?)null : d.keyin1,
|
||||
d_demo = d == null ? "" : d.demo, //狀態備註
|
||||
}).ToList();
|
||||
|
||||
var memoryStream = new MemoryStream();
|
||||
|
||||
if (list.Count > 0)
|
||||
{
|
||||
using (var doc = SpreadsheetDocument.Create(memoryStream, SpreadsheetDocumentType.Workbook))
|
||||
{
|
||||
var wb = doc.AddWorkbookPart();
|
||||
wb.Workbook = new Workbook();
|
||||
var sheets = wb.Workbook.AppendChild(new Sheets());
|
||||
|
||||
//建立第一個頁籤
|
||||
var ws = wb.AddNewPart<WorksheetPart>();
|
||||
ws.Worksheet = new Worksheet();
|
||||
sheets.Append(new Sheet()
|
||||
{
|
||||
Id = wb.GetIdOfPart(ws),
|
||||
SheetId = 1,
|
||||
Name = "報名"
|
||||
});
|
||||
|
||||
//設定欄寬
|
||||
var cu = new Columns();
|
||||
cu.Append(
|
||||
new Column { Min = 1, Max = 1, Width = 15, CustomWidth = true },
|
||||
new Column { Min = 2, Max = 4, Width = 10, CustomWidth = true },
|
||||
new Column { Min = 5, Max = 5, Width = 15, CustomWidth = true },
|
||||
new Column { Min = 6, Max = 8, Width = 25, CustomWidth = true },
|
||||
new Column { Min = 9, Max = 9, Width = 15, CustomWidth = true },
|
||||
new Column { Min = 10, Max = 10, Width = 10, CustomWidth = true },
|
||||
new Column { Min = 11, Max = 11, Width = 25, CustomWidth = true },
|
||||
new Column { Min = 12, Max = 16, Width = 10, CustomWidth = true },
|
||||
new Column { Min = 17, Max = 20, Width = 10, CustomWidth = true }
|
||||
);
|
||||
ws.Worksheet.Append(cu);
|
||||
|
||||
//建立資料頁
|
||||
var sd = new SheetData();
|
||||
ws.Worksheet.AppendChild(sd);
|
||||
|
||||
//第一列資料
|
||||
var tr = new Row();
|
||||
tr.Append(
|
||||
new Cell() { CellValue = new CellValue("單號"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("報名日期"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("單據狀態"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("姓名/名稱"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("聯絡電話"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("報名活動"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("收件地址"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("備註"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("項目名稱"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("姓名"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("代表地址"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("標題"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("陽上/報恩者"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("開始日期"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("期滿日期"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("應續約日"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("劃位狀態"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("預設金額"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("數量"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("小計"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("已收金額"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("未收金額"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("付款期限"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("報名狀態"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("狀態備註"), DataType = CellValues.String }
|
||||
);
|
||||
sd.AppendChild(tr);
|
||||
|
||||
|
||||
|
||||
foreach (var item in list)
|
||||
{
|
||||
string midNamesResult = "";
|
||||
string leftNamesResult = "";
|
||||
string jsonString = item.d_f_num_tablet?.ToString() ?? "";
|
||||
try
|
||||
{
|
||||
var jo = JObject.Parse(jsonString);
|
||||
|
||||
// 標題
|
||||
var midList = jo["mid_items"]?
|
||||
.Select(i => (string)i["fam_name"])
|
||||
.Where(name => !string.IsNullOrEmpty(name))
|
||||
.ToList();
|
||||
if (midList != null && midList.Any())
|
||||
{
|
||||
midNamesResult = string.Join(", ", midList);
|
||||
}
|
||||
|
||||
// 陽上
|
||||
var leftList = jo["left_items"]?
|
||||
.Select(i => (string)i["fam_name"])
|
||||
.Where(name => !string.IsNullOrEmpty(name))
|
||||
.ToList();
|
||||
if (leftList != null && leftList.Any())
|
||||
{
|
||||
leftNamesResult = string.Join(", ", leftList);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"JSON 解析失敗 (訂單:{item.order_no}): {ex.Message}");
|
||||
}
|
||||
|
||||
//新增資料列
|
||||
tr = new Row();
|
||||
tr.Append(
|
||||
new Cell() { CellValue = new CellValue(item.order_no), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.up_time?.ToString("yyyy/MM/dd") ?? ""), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(Model.pro_order.keyin1_value_to_text(item.keyin1)), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.f_num), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(encrypt.DecryptAutoKey(item.phone)), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.activity_num), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.address), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.demo), DataType = CellValues.String },
|
||||
|
||||
new Cell() { CellValue = new CellValue(item.d_actItem_num), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.d_f_num), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.d_address), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(midNamesResult), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(leftNamesResult), DataType = CellValues.String },
|
||||
//new Cell() { CellValue = new CellValue(item.d_from_id), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.d_start_date?.ToString("yyyy/MM/dd") ?? ""), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.d_due_date?.ToString("yyyy/MM/dd") ?? ""), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.d_extend_date?.ToString("yyyy/MM/dd") ?? ""), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue((Val(item.d_category) == (int)Model.activity.category.Order) ? (item.d_notBedQty + "/" + item.d_writeBedQty) : ""), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("$" + ValMoney(item.d_price)), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.d_qty), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("$" + ValMoney(ValFloat(item.d_price) * Val(item.d_qty))), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("$" + ValMoney(item.d_pay)), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("$" + ValMoney(ValFloat(item.d_price) * Val(item.d_qty) - ValFloat(item.d_pay))), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.d_pay_date?.ToString("yyyy/MM/dd") ?? ""), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.d_keyin1.HasValue ? tdesc[item.d_keyin1.Value] : ""), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.d_demo), DataType = CellValues.String }
|
||||
);
|
||||
sd.AppendChild(tr);
|
||||
}
|
||||
|
||||
//空一列
|
||||
tr = new Row();
|
||||
sd.AppendChild(tr);
|
||||
|
||||
//匯出資訊
|
||||
string _data = "匯出時間 : " + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
|
||||
_data += " " + admin.info.u_id;
|
||||
tr = new Row();
|
||||
tr.Append(
|
||||
new Cell() { CellValue = new CellValue(_data), DataType = CellValues.String }
|
||||
);
|
||||
sd.AppendChild(tr);
|
||||
|
||||
_data = "匯出條件 : " + (!isStrNull(_query) ? _query : "-");
|
||||
tr = new Row();
|
||||
tr.Append(
|
||||
new Cell() { CellValue = new CellValue(_data), DataType = CellValues.String }
|
||||
);
|
||||
sd.AppendChild(tr);
|
||||
|
||||
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.Excel, admin_log.LogViewBtn(list.Select(x => x.order_no).ToList()));
|
||||
}
|
||||
|
||||
HttpContext.Current.Response.Clear();
|
||||
HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=報名.xlsx");
|
||||
HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
||||
HttpContext.Current.Response.BinaryWrite(memoryStream.ToArray());
|
||||
HttpContext.Current.Response.End();
|
||||
|
||||
hid_err_msg.Value = "success";
|
||||
}
|
||||
else
|
||||
{
|
||||
hid_err_msg.Value = "nodata";
|
||||
}
|
||||
}
|
||||
else if (isPrintMode)
|
||||
{
|
||||
int selYear = !string.IsNullOrEmpty(hid_print_year.Value) ? int.Parse(hid_print_year.Value) : 0;
|
||||
int selMonth = !string.IsNullOrEmpty(hid_print_month.Value) ? int.Parse(hid_print_month.Value) : 0;
|
||||
int selSeason = !string.IsNullOrEmpty(hid_print_season.Value) ? int.Parse(hid_print_season.Value) : 0;
|
||||
string selMode = !string.IsNullOrEmpty(hid_print_mode.Value) ? hid_print_mode.Value : "";
|
||||
bool chkHasAct = !string.IsNullOrEmpty(hid_chk_hasact.Value) && Convert.ToBoolean(hid_chk_hasact.Value);
|
||||
bool chkNoAct = !string.IsNullOrEmpty(hid_chk_noact.Value) && Convert.ToBoolean(hid_chk_noact.Value);
|
||||
int selAct = !string.IsNullOrEmpty(hid_select_act.Value) ? int.Parse(hid_select_act.Value) : -1;
|
||||
int selActItem = !string.IsNullOrEmpty(hid_select_actitem.Value) ? int.Parse(hid_select_actitem.Value) : -1;
|
||||
string urlParams = !string.IsNullOrEmpty(hid_qry.Value) ? hid_qry.Value : "";
|
||||
|
||||
var qry = _db.pro_order.AsQueryable();
|
||||
|
||||
if (selYear > 0)
|
||||
qry = qry.Where(o => o.up_time.HasValue && o.up_time.Value.Year == selYear);
|
||||
if (selMode == "mm" && selMonth > 0)
|
||||
qry = qry.Where(o => o.up_time.HasValue && o.up_time.Value.Month == selMonth);
|
||||
else if (selMode == "ss" && selSeason > 0)
|
||||
{
|
||||
if (selSeason == 1)
|
||||
qry = qry.Where(o => o.up_time.HasValue)
|
||||
.Where(o => o.up_time.Value.Month == 1 || o.up_time.Value.Month == 2 || o.up_time.Value.Month == 3);
|
||||
else if (selSeason == 2)
|
||||
qry = qry.Where(o => o.up_time.HasValue)
|
||||
.Where(o => o.up_time.Value.Month == 4 || o.up_time.Value.Month == 5 || o.up_time.Value.Month == 6);
|
||||
else if (selSeason == 3)
|
||||
qry = qry.Where(o => o.up_time.HasValue)
|
||||
.Where(o => o.up_time.Value.Month == 7 || o.up_time.Value.Month == 8 || o.up_time.Value.Month == 9);
|
||||
else if (selSeason == 4)
|
||||
qry = qry.Where(o => o.up_time.HasValue)
|
||||
.Where(o => o.up_time.Value.Month == 10 || o.up_time.Value.Month == 11 || o.up_time.Value.Month == 12);
|
||||
}
|
||||
|
||||
if (chkHasAct)
|
||||
{
|
||||
if (chkNoAct)
|
||||
{
|
||||
if (selAct >= 0)
|
||||
qry = qry.Where(o => o.activity_num.HasValue && o.activity_num.Value == selAct);
|
||||
}
|
||||
else
|
||||
{
|
||||
qry = qry.Where(o => o.activity_num.HasValue);
|
||||
if (selAct >= 0)
|
||||
qry = qry.Where(o => o.activity_num.Value == selAct);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (chkNoAct)
|
||||
qry = qry.Where(o => o.activity_num == null);
|
||||
}
|
||||
|
||||
if (selActItem >= 0)
|
||||
{
|
||||
qry = qry.Where(o => o.pro_order_detail.Where(f2 => f2.actItem_num.HasValue && f2.actItem_num.Value == selActItem).Count() > 0);
|
||||
}
|
||||
|
||||
|
||||
var count = qry.Count();
|
||||
if (count > 0)
|
||||
{
|
||||
hid_err_msg.Value = "success";
|
||||
|
||||
string script = $@"var otherWin = window.open('print.aspx{urlParams}', '列印報名資料', 'noopener,noreferrer');";
|
||||
ScriptManager.RegisterStartupScript(this, GetType(), "ExecutePrint", script, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
hid_err_msg.Value = "nodata";
|
||||
}
|
||||
//var qry = _db.followers.AsQueryable();
|
||||
//if (selYear > 0)
|
||||
//{
|
||||
// urlParams += "&year=" + selYear;
|
||||
//}
|
||||
//if (selMode == "mm" && selMonth > 0)
|
||||
//{
|
||||
// urlParams += "&month=" + selMonth;
|
||||
//}
|
||||
//else if (selMode == "ss" && selSeason > 0)
|
||||
//{
|
||||
// urlParams += "&season=" + selSeason;
|
||||
//}
|
||||
|
||||
//if (list.Count > 0)
|
||||
//{
|
||||
// hid_err_msg.Value = "success";
|
||||
// hid_print_year.Value = selYear.ToString();
|
||||
// hid_print_month.Value = selMonth.ToString();
|
||||
// hid_print_season.Value = selSeason.ToString();
|
||||
// hid_print_mode.Value = selMode;
|
||||
|
||||
// string script = $@"window.open('print.aspx?{urlParams}&mode={selMode}', '列印信眾資料');";
|
||||
// ScriptManager.RegisterStartupScript(this, GetType(), "ExecutePrint", script, true);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// hid_err_msg.Value = "nodata";
|
||||
// string script = $@"
|
||||
// var win = window.open('', '列印信眾資料');
|
||||
// if (win) win.close()";
|
||||
|
||||
// ScriptManager.RegisterStartupScript(this, GetType(), "CancelPrint", script, true);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void excel_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
@@ -111,6 +570,7 @@ public partial class admin_order_index : MyWeb.config
|
||||
new Cell() { CellValue = new CellValue("項目名稱"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("姓名"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("代表地址"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("標題"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("陽上/報恩者"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("開始日期"), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("期滿日期"), DataType = CellValues.String },
|
||||
@@ -132,32 +592,57 @@ public partial class admin_order_index : MyWeb.config
|
||||
// 改為整數陣列,避免後續查詢中使用 .ToString()
|
||||
var aIDt = _db.actItems.Where(f => f.subject.Contains(s_actItemTxt.Value.Trim())).Select(f => f.num).ToArray();//品項
|
||||
var qry = _db.pro_order.AsQueryable();
|
||||
string _query = ""; // 紀錄匯出條件
|
||||
|
||||
if (!isStrNull(s_order_no.Value))
|
||||
{
|
||||
_query += "單號:" + s_order_no.Value + "\n";
|
||||
qry = qry.Where(o => o.order_no.Contains(s_order_no.Value.Trim()));
|
||||
}
|
||||
if (!isStrNull(s_u_name.Value))
|
||||
{
|
||||
_query += "姓名/名稱:" + s_u_name.Value + "\n";
|
||||
qry = qry.Where(o => o.f_num.HasValue && o.follower.u_name.Contains(s_u_name.Value.Trim()));
|
||||
}
|
||||
if (!isStrNull(s_introducerTxt.Value))
|
||||
{
|
||||
_query += "介紹人:" + s_introducerTxt.Value + "\n";
|
||||
qry = qry.Where(o => o.f_num.HasValue && o.follower1.u_name.Contains(s_introducerTxt.Value.Trim()));
|
||||
}
|
||||
if (!isStrNull(s_subject.Value))
|
||||
{
|
||||
_query += "報名活動:" + s_subject.Value + "\n";
|
||||
qry = qry.Where(o => o.activity_num.HasValue && o.activity.subject.Contains(s_subject.Value.Trim()));
|
||||
}
|
||||
if (!isStrNull(s_actItemTxt.Value))
|
||||
{
|
||||
// ❌ 錯誤寫法: qry = qry.Where(o => o.pro_order_detail.Where(f2 => f2.order_no == o.order_no && aIDt.ToArray().Contains(f2.actItem_num.ToString())).Count() > 0);
|
||||
// ✅ 實際比較:僅在 actItem_num 有值時才與整數陣列比對
|
||||
_query += "品項:" + s_actItemTxt.Value + "\n";
|
||||
qry = qry.Where(o => o.pro_order_detail.Any(f2 =>
|
||||
f2.order_no == o.order_no &&
|
||||
f2.actItem_num.HasValue &&
|
||||
aIDt.Contains(f2.actItem_num.Value)));
|
||||
}
|
||||
if (!isStrNull(s_keyin1.SelectedValue))
|
||||
{
|
||||
_query += $"單據狀態:{Model.pro_order.keyin1_value_to_text(s_keyin1.SelectedValue)}\n";
|
||||
qry = qry.Where(o => o.keyin1 == s_keyin1.SelectedValue);
|
||||
}
|
||||
|
||||
if (!isStrNull(s_up_time1.Value) && isDate(s_up_time1.Value))
|
||||
qry = qry.Where(o => o.up_time >= ValDate(s_up_time1.Value));
|
||||
{
|
||||
_query += "報名日期(起):" + s_up_time1.Value.Trim() + "\n";
|
||||
var tmp_s_up_time1 = ValDate(s_up_time1.Value);
|
||||
qry = qry.Where(o => o.up_time >= tmp_s_up_time1);
|
||||
}
|
||||
if (!isStrNull(s_up_time2.Value) && isDate(s_up_time2.Value))
|
||||
qry = qry.Where(o => o.up_time < Convert.ToDateTime(s_up_time2.Value).AddDays(1));
|
||||
|
||||
{
|
||||
_query += "報名日期(訖):" + s_up_time2.Value.Trim() + "\n";
|
||||
var tmp_s_up_time2 = Convert.ToDateTime(s_up_time2.Value).AddDays(1);
|
||||
qry = qry.Where(o => o.up_time < tmp_s_up_time2);
|
||||
}
|
||||
|
||||
qry = qry.OrderByDescending(o => o.reg_time);
|
||||
|
||||
MyWeb.encrypt encrypt = new MyWeb.encrypt();
|
||||
@@ -198,20 +683,21 @@ public partial class admin_order_index : MyWeb.config
|
||||
//訂單明細
|
||||
//使用DefaultIfEmpty 因匿名型別無法輸出NULL(無法轉換成強型別),需特別注意Null的處理
|
||||
d_actItem_num = d == null ? "" : (d.actItem_num.HasValue ? d.actItem.subject : ""), //項目名稱
|
||||
d_category = d == null ? "" : (d.actItem_num.HasValue ? d.actItem.category.ToString() : ""),
|
||||
d_category = d == null ? "" : (d.actItem_num.HasValue ? d.actItem.category.ToString() : ""),
|
||||
d_f_num = d == null ? "" : (d.f_num.HasValue ? d.follower.u_name : ""), //姓名
|
||||
d_address = d == null ? "" : d.address,
|
||||
d_from_id = d == null ? "" : (d.from_id.HasValue ? d.follower1.u_name : ""), //陽上/報恩者
|
||||
d_start_date = d == null ? "" : (d.start_date.HasValue ? d.start_date.Value.ToString("yyyy/MM/dd") : ""), //開始日期
|
||||
d_due_date = d == null ? "" : (d.due_date.HasValue ? d.due_date.Value.ToString("yyyy/MM/dd") : ""), //期滿日期
|
||||
d_extend_date = d == null ? "" : (d.extend_date.HasValue ? d.extend_date.Value.ToString("yyyy/MM/dd") : ""), //應續約日
|
||||
d_price = d == null ? "" : (d.price.HasValue ? d.price.Value.ToString() : "0"), //預設金額
|
||||
d_f_num_tablet = d == null ? "" : d.f_num_tablet,
|
||||
d_start_date = d == null ? (DateTime?)null : d.start_date, //開始日期
|
||||
d_due_date = d == null ? (DateTime?)null : d.due_date, //期滿日期
|
||||
d_extend_date = d == null ? (DateTime?)null : d.extend_date, //應續約日
|
||||
d_price = d == null ? (float?)null : d.price, //預設金額
|
||||
d_qty = d == null ? "" : (d.qty.HasValue ? d.qty.Value.ToString() : "0"), //數量
|
||||
d_writeBedQty = d == null ? 0 : bedDt.Where(b =>( b.bed_order.o_detail_id.Value == d.num) && b.checkIn_date.HasValue && b.bed_kind_detail_id.HasValue).Count(), //已劃數量
|
||||
d_writeBedQty = d == null ? 0 : bedDt.Where(b => (b.bed_order.o_detail_id.Value == d.num) && b.checkIn_date.HasValue && b.bed_kind_detail_id.HasValue).Count(), //已劃數量
|
||||
d_notBedQty = d == null ? 0 : bedDt.Where(b => b.bed_order.o_detail_id.Value == d.num && (!b.checkIn_date.HasValue || !b.bed_kind_detail_id.HasValue)).Count(), //未劃數量
|
||||
d_pay = d == null ? "" : (d.pay.HasValue ? d.pay.Value.ToString() : "0"), //已收金額
|
||||
d_pay_date = d == null ? "" : (d.pay_date.HasValue ? d.pay_date.Value.ToString("yyyy/MM/dd") : ""), //付款期限
|
||||
d_keyin1 = d == null ? "" : (d.keyin1.HasValue&& d.keyin1.Value>0 ? tdesc[d.keyin1 ?? 1] : ""), //報名狀態
|
||||
d_pay_date = d == null ? (DateTime?)null : d.start_date, //付款期限
|
||||
d_keyin1 = d == null ? (int?)null : d.keyin1,
|
||||
d_demo = d == null ? "" : d.demo, //狀態備註
|
||||
}).ToList();
|
||||
|
||||
@@ -259,11 +745,43 @@ public partial class admin_order_index : MyWeb.config
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
string midNamesResult = "";
|
||||
string leftNamesResult = "";
|
||||
string jsonString = item.d_f_num_tablet?.ToString() ?? "";
|
||||
try
|
||||
{
|
||||
var jo = JObject.Parse(jsonString);
|
||||
|
||||
// 標題
|
||||
var midList = jo["mid_items"]?
|
||||
.Select(i => (string)i["fam_name"])
|
||||
.Where(name => !string.IsNullOrEmpty(name))
|
||||
.ToList();
|
||||
if (midList != null && midList.Any())
|
||||
{
|
||||
midNamesResult = string.Join(", ", midList);
|
||||
}
|
||||
|
||||
// 陽上
|
||||
var leftList = jo["left_items"]?
|
||||
.Select(i => (string)i["fam_name"])
|
||||
.Where(name => !string.IsNullOrEmpty(name))
|
||||
.ToList();
|
||||
if (leftList != null && leftList.Any())
|
||||
{
|
||||
leftNamesResult = string.Join(", ", leftList);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"JSON 解析失敗 (訂單:{item.order_no}): {ex.Message}");
|
||||
}
|
||||
|
||||
//新增資料列
|
||||
tr = new Row();
|
||||
tr.Append(
|
||||
new Cell() { CellValue = new CellValue(item.order_no), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.up_time.Value.ToString("yyyy/MM/dd")), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.up_time?.ToString("yyyy/MM/dd") ?? ""), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(Model.pro_order.keyin1_value_to_text(item.keyin1)), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.f_num), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(encrypt.DecryptAutoKey(item.phone)), DataType = CellValues.String },
|
||||
@@ -274,23 +792,44 @@ public partial class admin_order_index : MyWeb.config
|
||||
new Cell() { CellValue = new CellValue(item.d_actItem_num), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.d_f_num), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.d_address), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.d_from_id), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.d_start_date), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.d_due_date), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.d_extend_date), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue((Val(item.d_category) ==(int)Model.activity.category.Order) ?( item.d_notBedQty +"/" + item.d_writeBedQty):""), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(midNamesResult), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(leftNamesResult), DataType = CellValues.String },
|
||||
//new Cell() { CellValue = new CellValue(item.d_from_id), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.d_start_date?.ToString("yyyy/MM/dd") ?? ""), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.d_due_date?.ToString("yyyy/MM/dd") ?? ""), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.d_extend_date?.ToString("yyyy/MM/dd") ?? ""), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue((Val(item.d_category) == (int)Model.activity.category.Order) ? (item.d_notBedQty + "/" + item.d_writeBedQty) : ""), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("$" + ValMoney(item.d_price)), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.d_qty), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("$" + ValMoney(ValFloat(item.d_price) * Val(item.d_qty))), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("$" + ValMoney(item.d_pay)), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue("$" + ValMoney(ValFloat(item.d_price) * Val(item.d_qty) - ValFloat(item.d_pay))), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.d_pay_date), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.d_keyin1), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.d_pay_date?.ToString("yyyy/MM/dd") ?? ""), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.d_keyin1.HasValue ? tdesc[item.d_keyin1.Value] : ""), DataType = CellValues.String },
|
||||
new Cell() { CellValue = new CellValue(item.d_demo), DataType = CellValues.String }
|
||||
);
|
||||
sd.AppendChild(tr);
|
||||
}
|
||||
|
||||
//空一列
|
||||
tr = new Row();
|
||||
sd.AppendChild(tr);
|
||||
|
||||
//匯出資訊
|
||||
string _data = "匯出時間 : " + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
|
||||
_data += " " + admin.info.u_id;
|
||||
tr = new Row();
|
||||
tr.Append(
|
||||
new Cell() { CellValue = new CellValue(_data), DataType = CellValues.String }
|
||||
);
|
||||
sd.AppendChild(tr);
|
||||
|
||||
_data = "匯出條件 : " + (!isStrNull(_query) ? _query : "-");
|
||||
tr = new Row();
|
||||
tr.Append(
|
||||
new Cell() { CellValue = new CellValue(_data), DataType = CellValues.String }
|
||||
);
|
||||
sd.AppendChild(tr);
|
||||
|
||||
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.Excel, admin_log.LogViewBtn(list.Select(x => x.order_no).ToList()));
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
{ text: '活動名稱', value: 'subject', },
|
||||
{ text: '報到日期', value: 'reg_time_date', },
|
||||
{ text: '報到時間', value: 'reg_time_time' },
|
||||
{ text: '姓名(人數)', value: 'qty' },
|
||||
{ text: '姓名', value: 'qty' },
|
||||
{ text: '狀態', value: 'statusTxt' },
|
||||
{ text: '', value: 'slot_btn', sortable: false, align: 'end' }
|
||||
|
||||
@@ -199,7 +199,7 @@
|
||||
{{item.reg_time |timeString('HH:mm:ss') }}
|
||||
</template>
|
||||
<template #item.qty="{ item }" >
|
||||
{{item.u_name }}({{item.qty }})
|
||||
{{item.u_name }}
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
@@ -144,13 +144,10 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>項目名稱</th>
|
||||
<th class="nowarp">姓名</th>
|
||||
<th>代表地址</th>
|
||||
<th class="nowarp">陽上/報恩</th>
|
||||
<th class="nowarp">陽上</th>
|
||||
<th class="nowarp">標題</th>
|
||||
<th class="fit">開始日</th>
|
||||
<th class="fit">期滿日</th>
|
||||
<th class="fit">延續日</th>
|
||||
<th class="fit">劃位</th>
|
||||
<asp:PlaceHolder ID="PlaceHolder2" runat="server">
|
||||
<th class="fit">功德金</th>
|
||||
<th class="fit">數量</th>
|
||||
@@ -167,18 +164,14 @@
|
||||
<td>
|
||||
<asp:Literal ID="actitem_numTxt" runat="server"></asp:Literal></td>
|
||||
<td class="nowarp">
|
||||
<asp:Literal ID="f_numTxt" runat="server"></asp:Literal></td>
|
||||
<td><%# Eval("address") %></td>
|
||||
<asp:Literal ID="left_nameTxt" runat="server"></asp:Literal></td>
|
||||
<td class="nowarp">
|
||||
<asp:Literal ID="from_idTxt" runat="server"></asp:Literal></td>
|
||||
<asp:Literal ID="mid_nameTxt" runat="server"></asp:Literal></td>
|
||||
|
||||
|
||||
<td class="fit"><%# Eval("start_date") != null? Convert.ToDateTime( Eval("start_date")).ToString("yyyy/MM/dd") : "" %></td>
|
||||
<td class="fit">
|
||||
<asp:Literal ID="due_date" runat="server"></asp:Literal></td>
|
||||
<td class="fit">
|
||||
<asp:Literal ID="extend_date" runat="server"></asp:Literal></td>
|
||||
|
||||
<td class="fit">
|
||||
<asp:Literal ID="BedQty" runat="server"></asp:Literal></td>
|
||||
<asp:PlaceHolder ID="PlaceHolder2" runat="server">
|
||||
<td class="fit text-end">
|
||||
<asp:Literal ID="item_price" runat="server" Text='<%# Eval("price") %>'></asp:Literal></td>
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
using DocumentFormat.OpenXml.Drawing.Charts;
|
||||
using DocumentFormat.OpenXml.Vml.Office;
|
||||
using Microsoft.Ajax.Utilities;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Helpers;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
@@ -182,8 +188,20 @@ public partial class admin_follower_print_ : System.Web.UI.Page
|
||||
|
||||
if (!string.IsNullOrEmpty(_chkHasAct) && Convert.ToBoolean(_chkHasAct))
|
||||
{
|
||||
_query += "活動報名\n";
|
||||
|
||||
if (!string.IsNullOrEmpty(_selectAct))
|
||||
{
|
||||
int selectAct = Convert.ToInt32(_selectAct);
|
||||
if (selectAct > 0)
|
||||
{
|
||||
var actSubject = _db.activities.Where(a => a.num == selectAct).Select(a => a.subject).FirstOrDefault();
|
||||
_query += $"活動報名: {actSubject}\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_query += $"活動報名\n";
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(_chkNoAct) && Convert.ToBoolean(_chkNoAct))
|
||||
{
|
||||
_query += "非活動報名\n";
|
||||
@@ -200,7 +218,7 @@ public partial class admin_follower_print_ : System.Web.UI.Page
|
||||
else
|
||||
{
|
||||
qry = qry.Where(o => o.activity_num.HasValue);
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(_selectAct))
|
||||
{
|
||||
int selectAct = Convert.ToInt32(_selectAct);
|
||||
@@ -404,16 +422,56 @@ public partial class admin_follower_print_ : System.Web.UI.Page
|
||||
actitem_numTxt.Text = row.actItem_num.HasValue && row.actItem != null ? row.actItem.subject : "";
|
||||
}
|
||||
|
||||
Literal fNumTxtLit = (Literal)e.Item.FindControl("f_numTxt");
|
||||
if (fNumTxtLit != null)
|
||||
{
|
||||
fNumTxtLit.Text = row.f_num.HasValue && row.follower != null ? row.follower.u_name : "";
|
||||
}
|
||||
//Literal fNumTxtLit = (Literal)e.Item.FindControl("f_numTxt");
|
||||
//if (fNumTxtLit != null)
|
||||
//{
|
||||
// fNumTxtLit.Text = row.f_num.HasValue && row.follower != null ? row.follower.u_name : "";
|
||||
//}
|
||||
|
||||
Literal fromIdTxtLit = (Literal)e.Item.FindControl("from_idTxt");
|
||||
if (fromIdTxtLit != null)
|
||||
string jsonString = row.f_num_tablet?.ToString() ?? "";
|
||||
if (!string.IsNullOrWhiteSpace(jsonString))
|
||||
{
|
||||
fromIdTxtLit.Text = row.from_id.HasValue && row.follower1 != null ? row.follower1.u_name : "";
|
||||
var jo = JObject.Parse(jsonString);
|
||||
List<string> allMidNames = new List<string>();
|
||||
List<string> allLeftNames = new List<string>();
|
||||
|
||||
// 標題
|
||||
var midNames = jo["mid_items"]?
|
||||
.Select(item => (string)item["fam_name"])
|
||||
.ToList();
|
||||
|
||||
if (midNames != null && midNames.Any())
|
||||
{
|
||||
allMidNames.AddRange(midNames);
|
||||
}
|
||||
|
||||
if (allMidNames.Any())
|
||||
{
|
||||
Literal midNameTextLit = (Literal)e.Item.FindControl("mid_nameTxt");
|
||||
if (midNameTextLit != null)
|
||||
{
|
||||
midNameTextLit.Text = string.Join(", ", allMidNames);
|
||||
}
|
||||
}
|
||||
|
||||
// 陽上
|
||||
var leftNames = jo["left_items"]?
|
||||
.Select(item => (string)item["fam_name"])
|
||||
.ToList();
|
||||
|
||||
if (leftNames != null && leftNames.Any())
|
||||
{
|
||||
allLeftNames.AddRange(leftNames);
|
||||
}
|
||||
|
||||
if (allLeftNames.Any())
|
||||
{
|
||||
Literal leftNameTextLit = (Literal)e.Item.FindControl("left_nameTxt");
|
||||
if (leftNameTextLit != null)
|
||||
{
|
||||
leftNameTextLit.Text = string.Join(", ", allLeftNames);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Literal dueDateLit = (Literal)e.Item.FindControl("due_date");
|
||||
@@ -422,21 +480,21 @@ public partial class admin_follower_print_ : System.Web.UI.Page
|
||||
dueDateLit.Text = row.due_date.HasValue ? row.due_date.Value.ToString("yyyy-MM-dd") : "";
|
||||
}
|
||||
|
||||
Literal extendDateLit = (Literal)e.Item.FindControl("extend_date");
|
||||
if (extendDateLit != null)
|
||||
{
|
||||
extendDateLit.Text = row.extend_date.HasValue ? row.extend_date.Value.ToString("yyyy-MM-dd") : "";
|
||||
}
|
||||
//Literal extendDateLit = (Literal)e.Item.FindControl("extend_date");
|
||||
//if (extendDateLit != null)
|
||||
//{
|
||||
// extendDateLit.Text = row.extend_date.HasValue ? row.extend_date.Value.ToString("yyyy-MM-dd") : "";
|
||||
//}
|
||||
|
||||
//劃位狀態
|
||||
int writeBedQty = _bedDt.Where(b => b.bed_order != null && b.bed_order.o_detail_id == row.num && b.checkIn_date.HasValue && b.bed_kind_detail_id.HasValue).Count();
|
||||
int notBedQty = _bedDt.Where(b => b.bed_order != null && b.bed_order.o_detail_id == row.num && (!b.checkIn_date.HasValue || !b.bed_kind_detail_id.HasValue)).Count();
|
||||
|
||||
Literal bedQtyLit = (Literal)e.Item.FindControl("BedQty");
|
||||
if (bedQtyLit != null)
|
||||
{
|
||||
bedQtyLit.Text = (row.actItem != null && row.actItem.category.HasValue && Convert.ToInt32(row.actItem.category.Value) == (int)Model.activity.category.Order) ? (notBedQty + "/" + writeBedQty) : "";
|
||||
}
|
||||
////劃位狀態
|
||||
//int writeBedQty = _bedDt.Where(b => b.bed_order != null && b.bed_order.o_detail_id == row.num && b.checkIn_date.HasValue && b.bed_kind_detail_id.HasValue).Count();
|
||||
//int notBedQty = _bedDt.Where(b => b.bed_order != null && b.bed_order.o_detail_id == row.num && (!b.checkIn_date.HasValue || !b.bed_kind_detail_id.HasValue)).Count();
|
||||
|
||||
//Literal bedQtyLit = (Literal)e.Item.FindControl("BedQty");
|
||||
//if (bedQtyLit != null)
|
||||
//{
|
||||
// bedQtyLit.Text = (row.actItem != null && row.actItem.category.HasValue && Convert.ToInt32(row.actItem.category.Value) == (int)Model.activity.category.Order) ? (notBedQty + "/" + writeBedQty) : "";
|
||||
//}
|
||||
|
||||
Literal keyin1Lit = (Literal)e.Item.FindControl("keyin1");
|
||||
if (keyin1Lit != null)
|
||||
|
||||
@@ -755,6 +755,7 @@
|
||||
curr.select(this.editedItem, row);
|
||||
}
|
||||
this.search_dialog.show = false;
|
||||
this.search_dialog.page = 1;
|
||||
//console.log(row, row["u_name"], row["f_number"], curr.id, target);
|
||||
},
|
||||
//報名詳細資料
|
||||
@@ -859,7 +860,7 @@
|
||||
isValidDate = Date.parse(item.pay_date);
|
||||
if (!isNaN(isValidDate))
|
||||
item.pay_date = new Date(item.pay_date).format("yyyy-MM-dd")
|
||||
|
||||
console.log(item);
|
||||
this.editedItem = $.extend(true, {}, item);
|
||||
this.data_dialog.show = true;
|
||||
this.data_dialog.isAddNew = false;
|
||||
@@ -1100,9 +1101,11 @@
|
||||
/* (this.editedItem.category=="1"? this.editedItem.from_id_selected.val != 0 : true) &&*/
|
||||
this.requireData(this.editedItem.qty, (this.editedItem.num == 0 ? false : true)) ) /* qty為0視為不需要此項目,不儲存此筆資料*/
|
||||
{
|
||||
console.log(this.editedItem);
|
||||
//check price
|
||||
if (this.editedItem.pay <= this.editedItem.price * this.editedItem.qty) {
|
||||
|
||||
console.log(this.editedItem.f_num_selected.val);
|
||||
console.log(this.editedItem.from_id_selected.val);
|
||||
//check qty
|
||||
//數量不可小於掛單明細的數量
|
||||
if (this.editedItem.qty >= this.editedItem.writeBedQty + this.editedItem.notBedQty) {
|
||||
@@ -1857,7 +1860,7 @@
|
||||
<div class="">
|
||||
<asp:Button ID="add" runat="server" Text="送出" OnClick="add_Click" CssClass="btn btn-primary" />
|
||||
<asp:Button ID="edit" runat="server" Text="修改" Visible="false" OnClick="edit_Click" CssClass="btn btn-primary" />
|
||||
<asp:Button ID="goback" runat="server" Text="回列表" Visible="false" CausesValidation="false" OnClick="goback_Click" CssClass="btn btn-outline-secondary" />
|
||||
<asp:Button ID="goback" runat="server" Text="取消" CausesValidation="false" OnClick="goback_Click" CssClass="btn btn-outline-secondary" />
|
||||
</div>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
|
||||
@@ -2486,7 +2489,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; search_dialog.page = 1;"><v-icon>mdi-close</v-icon></v-btn>
|
||||
</v-card-title>
|
||||
<v-card-text >
|
||||
<v-row>
|
||||
|
||||
+26
-12
@@ -1,15 +1,16 @@
|
||||
using System;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Data.Entity.Infrastructure;
|
||||
using System.Data.OleDb;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Data.Entity.Infrastructure;
|
||||
|
||||
public partial class admin_order_reg : MyWeb.config
|
||||
{
|
||||
@@ -187,16 +188,29 @@ public partial class admin_order_reg : MyWeb.config
|
||||
{
|
||||
if (!isStrNull(pro_order.order_no))
|
||||
{
|
||||
_db.pro_order.Add(pro_order);
|
||||
_db.SaveChanges();
|
||||
bool isRegistered = _db.pro_order.Any(x => x.f_num == pro_order.f_num && x.activity_num == pro_order.activity_num);
|
||||
|
||||
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);
|
||||
if (isRegistered) // 重複報名
|
||||
{
|
||||
L_msg.Type = alert_type.warning;
|
||||
L_msg.Text = "此信眾已報名過本活動";
|
||||
}
|
||||
else
|
||||
{
|
||||
_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);
|
||||
|
||||
|
||||
string url = "index.aspx";
|
||||
url = "reg.aspx?order_no=" + pro_order.order_no;
|
||||
Response.Redirect(url);
|
||||
string url = "index.aspx";
|
||||
url = "reg.aspx?order_no=" + pro_order.order_no;
|
||||
|
||||
Session["LastAddedNo"] = pro_order.order_no;
|
||||
|
||||
Response.Redirect(url);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user