migrate to new git

This commit is contained in:
2025-08-29 01:27:25 +08:00
parent 946eb9961e
commit af2c152ef6
8623 changed files with 1000453 additions and 1 deletions

View File

@@ -0,0 +1,638 @@
<%@ Page Title="後端管理" Language="C#" MasterPageFile="~/admin/Templates/TBS5ADM001/MasterPage.master" AutoEventWireup="true" CodeFile="bed_reg.aspx.cs" Inherits="admin_bed_new_reg" ValidateRequest="false" %>
<%@ Register Src="~/admin/_uc/alert.ascx" TagPrefix="uc1" TagName="alert" %>
<asp:Content ID="Content1" ContentPlaceHolderID="page_header" runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="footer_script" runat="Server">
<script>
Vue.filter('timeString', function (value, myFormat) {
return value == null || value == "" ? "" : moment(value).format(myFormat || 'YYYY-MM-DD, HH:mm:ss');
});
let VueApp = new Vue({
el: '#app',
vuetify: new Vuetify(vuetify_options),
data() {
return {
this_order_no: '<%= Request["order_no"]%>', //來源訂單編號
this_detail_id: '<%= Request["detail"]%>', //來源明細id
this_id: '<%= _this_id %>', //掛單表單單號bed_order_no
options: {},
optionsDetail: { multiSort: false },
search_dialog: {
controls: {
search1: {
id: 'search1',
title: '樓層',
text_prop: 'kind',
value_prop: 'num',
keys: [
{ id: 'kind', title: '樓層名稱', value: '' },
],
api_url: HTTP_HOST + 'api/bed_kind/GetList',
columns: [
{ id: 'kind', title: '樓層名稱', value: '' },
],
selected: {},
select(item,t) {
console.log("select search1", t);
item.bed_kind1_selected.text = t.kind
item.bed_kind1_selected.val = t.num
//清空下層
item.bed_kind2_selected.text = ''
item.bed_kind2_selected.val = 0
item.bed_kind_detail_id_selected.text = ''
item.bed_kind_detail_id_selected.val = 0
}
},
search2: {
id: 'search2',
title: '房號/房名',
text_prop: 'kind',
value_prop: 'num',
keys: [
{ id: 'kind', title: '房號/房名', value: '' },
],
api_url: HTTP_HOST + 'api/bed_kind/GetList',
columns: [
{ id: 'kind', title: '房號/房名', value: '' },
],
selected: {},
select(item,t) {
console.log("select search2", t);
item.bed_kind2_selected.text = t.kind
item.bed_kind2_selected.val = t.num
//清空下層
item.bed_kind_detail_id_selected.text = ''
item.bed_kind_detail_id_selected.val = 0
}
},
search3: {
id: 'search3',
title: '床位編號',
text_prop: 'bed_name',
value_prop: 'num',
keys: [
{ id: 'bed_name', title: '床位編號', value: '' },
{ id: 'bed_type_txt', title: '床位型態' },
],
api_url: HTTP_HOST + 'api/bed_kind/GetDetailList',
columns: [
{ id: 'bed_name', title: '床位編號' },
{ id: 'bed_type_txt', title: '床位型態' },
],
selected: {},
select(item,t) {
console.log("select search3", t);
item.bed_kind_detail_id_selected.text = t.bed_name
item.bed_kind_detail_id_selected.val = t.num
item.bed_kind_detail_id_selected.bed_type = t.bed_type_txt
}
},
},
show: false,
current: {},
list: [],
count: 0,
page:1,
loading: false,
footer: {
showFirstLastPage: true,
disableItemsPerPage: true,
itemsPerPageAllText: '',
itemsPerPageText:'',
},
},
snackbar: {
show: false,
text: "",
}
//明細
, searchDetail: '',
headersDetail: [
{ text: '姓名', value: 'u_name', sortable: false },
{ text: '掛單日期 *', value: 'check_in_date', sortable: false },
{ text: '床位型態', value: 'bed_kind_detail_id_selected.bed_type', sortable: false },
{ text: '樓層', value: 'bed_kind1_selected.text', sortable: false },
{ text: '房號/房名', value: 'bed_kind2_selected.text', sortable: false },
{ text: '床位編號 *', value: 'bed_kind_detail_id_selected.text', sortable: false },
{ text: '車牌號碼', value: 'license', sortable: false },
{ text: '數量', value: 'qty', sortable: false },
{ text: '', value: 'actions', sortable: false, width: "120px" },
],
desserts: [],
editedIndex: -1,
editedItem: {
id: 0,
num: 0,
u_name: '',
checkIn_date: new Date().format("yyyy-MM-dd"),
bed_kind1_selected: {
text: '',
val: 0
},
bed_kind2_selected: {
text: '',
val: 0
},
bed_kind_detail_id_selected: {
text: '',
val: 0,
bed_type: '',
},
license:'',
},
defaultItem: {
id: 0,
num: 0,
u_name: '',
checkIn_date: new Date().format("yyyy-MM-dd"),
bed_kind1_selected: {
text: '',
val: 0
},
bed_kind2_selected: {
text: '',
val: 0
},
bed_kind_detail_id_selected: {
text: '',
val: 0,
bed_type: '',
},
license: '',
},
}
},
mounted() {
this.search_dialog.current = this.search_dialog.controls.search1
//console.log("mounted");
},
watch: {
options: {
handler() {
//console.log("watch1", this.search_dialog, this.search_dialog.page);
this.search_get()
console.log("watch2", this.search_dialog, this.search_dialog.page);
},
deep: true,
},
optionsDetail: {
handler() {
this.initialize();
},
deep: true,
},
},
methods: {
initialize() {
const { sortBy, sortDesc, page, itemsPerPage } = this.optionsDetail
const params = {
sortBy: sortBy[0], sortDesc: sortDesc[0],
page: page, pageSize: itemsPerPage,
};
var searchBedDetail = {
order_no: this.this_order_no,
o_detail_id: this.this_detail_id,
bed_order_no: this.this_id,
}
axios
.post(HTTP_HOST + 'api/bed/GetDetailList', searchBedDetail, { params: params })
.then(response => {
this.desserts = response.data.list
})
.catch(
error => console.log(error)
)
},
editItem(item) {
this.editedIndex = this.desserts.indexOf(item);
//日期處理
let isValidDate = Date.parse(item.checkIn_date);
if (!isNaN(isValidDate))
item.checkIn_date = new Date(item.checkIn_date).format("yyyy-MM-dd")
this.editedItem = Object.assign({}, item);
},
deleteItem(item) {
if (confirm('確定要刪除此筆資料嗎?')) {
const index = this.desserts.indexOf(item);
if (item.num > 0) {
if (index != -1) {
axios
.delete(HTTP_HOST + 'api/bed/DeleteBedDetail/' + item.num)
.then(response => {
console.log("del", item);
this.desserts.splice(index, 1)
})
.catch(error => console.log(error))
}
} else {
this.desserts.splice(index, 1)
}
}
},
cancel() {
this.close();
if (this.editedItem.num == 0) {
this.desserts.splice(-1, 1)
}
this.initialize(); //or get this.editedItem ?
},
close() {
setTimeout(() => {
this.editedItem = Object.assign({}, this.defaultItem);
this.editedIndex = -1;
}, 300)
},
save() {
if (this.editedIndex > -1) {
if (this.this_id != '') {
//chcck necessary params
if (this.editedItem.checkIn_date != null && this.editedItem.checkIn_date != '' && this.editedItem.bed_kind_detail_id_selected.val > 0) {
//insert or update data
var kind_detail =
{
num: this.editedItem.num,
bed_order_no: this.this_id,
checkIn_date: this.editedItem.checkIn_date,
bed_kind1: this.editedItem.bed_kind1_selected.val,
bed_kind2: this.editedItem.bed_kind2_selected.val,
bed_kind_detail_id: this.editedItem.bed_kind_detail_id_selected.val,
license: this.editedItem.license,
}
axios
.post(HTTP_HOST + 'api/bed/SaveBedDetail', kind_detail)
.then(response => {
this.editedItem.num = response.data;
Object.assign(this.desserts[this.editedIndex], this.editedItem)
this.close()
})
.catch(
error => console.log(error)
)
} else {
this.snackbar.text = "必填項目未填寫完整";
this.snackbar.show = true
}
} else {
this.snackbar.text = "房號錯誤";
this.snackbar.show = true
}
}
},
search_show(curr) {
//console.log("btn_click:", curr, curr.api_url);
this.search_dialog.current = curr;
this.search_clear()
//this.search_get()//清除完自動會重抓, 故取消
//this.search_dialog.show = true;
},
search_clear() {
if (!this.search_dialog.current.keys) return;
this.search_dialog.current.keys.forEach((t, i) => { t.value = '' })
this.search_get()
},
search_get() {
if (!this.search_dialog.current.keys) return;
let api_url = this.search_dialog.current.api_url;
let keys = this.search_dialog.current.keys;
//const { page, itemsPerPage } = this.options
//const { sortBy, sortDesc, page, itemsPerPage } = this.options
this.search_dialog.page = this.options.page ?? 1;
let params = { page: this.search_dialog.page, pageSize: 10 };//url params
var search = {};//post body
keys.forEach((t, i) => {
search[t.id] = t.value;
});
//necessary parameter===
let goto = true;
if (this.search_dialog.current.id == 'search1') {
search['root'] = 0;
}
if (this.search_dialog.current.id == 'search2') {
if (this.editedItem.bed_kind1_selected.val != '' && this.editedItem.bed_kind1_selected.val > 0)
search['root'] = this.editedItem.bed_kind1_selected.val;
else {
goto = false;
this.snackbar.text = "請先選擇樓層"
this.snackbar.show = true
}
}
if (this.search_dialog.current.id == 'search3') {
if (this.editedItem.bed_kind2_selected.val != '' && this.editedItem.bed_kind2_selected.val > 0) {
if (this.editedItem.checkIn_date != null && this.editedItem.checkIn_date != '') {
search['inTime'] = this.editedItem.checkIn_date;
search['bed_kind_id'] = this.editedItem.bed_kind2_selected.val;
}
else {
goto = false;
this.snackbar.text = "請先選擇掛單日期"
this.snackbar.show = true
}
}
else {
goto = false;
this.snackbar.text = "請先選擇房號/房名"
this.snackbar.show = true
}
}
if (goto) {
console.log("search_get", api_url, search, params, this.options);
this.search_dialog.loading = true
this.search_dialog.show = true;
axios.post(api_url, search, { params: params })
.then(response => {
this.search_dialog.list = response.data.list
this.search_dialog.count = response.data.count
this.search_dialog.loading = false
})
.catch(error => {
console.log(error)
this.search_dialog.list = []
this.search_dialog.count = 0
this.search_dialog.loading = false
this.snackbar.text = "錯誤:" + error
this.snackbar.show = true
})
}
},
search_headers() {
if (!this.search_dialog.current.columns) return;
r = [];
this.search_dialog.current.columns.forEach((t, i) => {
r.push({
text: t.title,
align: 'start',
sortable: false,
value: t.id,
})
})
return r
},
search_select(row) {
let curr = this.search_dialog.current;
let target = $(`[data-search-control=${curr.id}]`);
curr.selected = row;
target.children("input.search-text").val(curr.selected[curr.text_prop])//text
target.children("input:hidden").val(curr.selected[curr.value_prop])//value
if (curr.select instanceof Function) {
curr.select(this.editedItem,row);
}
this.search_dialog.show = false;
},
},
computed: {
},
})
</script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="page_nav" runat="Server">
<div class="scroll-nav nav nav-tabs mb-2 mb-sm-0 d-none d-sm-flex">
</div>
<div class="">
<asp:Button ID="edit" runat="server" Text="修改" Visible="false" OnClick="edit_Click" CssClass="btn btn-primary" />
<asp:Button ID="gobackOrder" runat="server" Text="回報名表單" CausesValidation="false" OnClick="gobackOrder_Click" CssClass="btn btn-outline-secondary" />
<asp:Button ID="goback" runat="server" Text="回列表" Visible="false" CausesValidation="false" OnClick="goback_Click" CssClass="btn btn-outline-secondary" />
</div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<uc1:alert runat="server" ID="L_msg" Text="" />
<div id="content" class="container-fluid">
<div class="card shadow-sm my-3">
<div class="card-header">
掛單表單
</div>
<asp:Panel ID="cardBodyPanel" runat="server" CssClass="card-body">
<div>
<div class="form-text text-muted">以下 * 欄位為必填欄位</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-10 col-lg-3 pt-2">
<asp:Literal ID="bed_order_no" runat="server"></asp:Literal>
</div>
<label class="col-sm-2 col-lg-1 col-form-label">單據日期</label>
<div class="col-sm-10 col-lg-3 pt-2">
<%-- <asp:TextBox ID="uptime" runat="server" CssClass="form-control " TextMode="Date" autocomplete="off" data-date-format="yyyy-mm-dd"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" ControlToValidate="uptime" runat="server" ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>--%>
<asp:Literal ID="uptime" runat="server"></asp:Literal>
</div>
<label class="col-sm-2 col-lg-1 col-form-label">來源單號</label>
<div class="col-sm-10 col-lg-3 pt-2">
<asp:Literal ID="order_no" runat="server"></asp:Literal>
</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-10 col-lg-3 pt-2">
<asp:Literal ID="activity_num_Txt" runat="server"></asp:Literal>
</div>
<label class="col-sm-2 col-lg-1 col-form-label">姓名/名稱</label>
<div class="col-sm-10 col-lg-3 pt-2">
<asp:Literal ID="f_num_Txt" runat="server"></asp:Literal>
</div>
<label class="col-sm-2 col-lg-1 col-form-label">聯絡電話</label>
<div class="col-sm-10 col-lg-3">
<asp:TextBox ID="phone" MaxLength="15" runat="server" CssClass="form-control"></asp:TextBox>
</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-10 col-lg-3">
<asp:TextBox ID="start_date" runat="server" CssClass="form-control " TextMode="Date" autocomplete="off" data-date-format="yyyy-mm-dd"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="start_date" runat="server" ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
</div>
<label class="col-sm-2 col-lg-1 col-form-label">掛單結束日 *</label>
<div class="col-sm-10 col-lg-3">
<asp:TextBox ID="end_date" runat="server" CssClass="form-control " TextMode="Date" autocomplete="off" data-date-format="yyyy-mm-dd"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" ControlToValidate="end_date" runat="server" ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
</div>
<label class="col-sm-2 col-lg-1 col-form-label">單據狀態 *</label>
<div class="col-sm-10 col-lg-3">
<asp:DropDownList ID="keyin1" CssClass="form-select" runat="server" >
<asp:ListItem Value="" Text="請選擇"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" ControlToValidate="keyin1"
ErrorMessage="必填!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
</div>
</div>
<hr />
<div class="row mb-1">
<label class="col-form-label">備註</label>
<div class="">
<asp:TextBox ID="demo" runat="server" Rows="5" TextMode="MultiLine" CssClass="form-control"></asp:TextBox>
</div>
</div>
<v-card class="mx-auto mt-10" outlined v-if="this_id!=''">
<v-data-table
:headers="headersDetail"
:items="desserts"
:search="searchDetail"
:options.sync="optionsDetail" class="elevation-1" fixed-header height="350px">
<v-divider inset></v-divider>
<template v-slot:top>
<v-toolbar flat color="white">
<div class="d-flex w-100">
<v-text-field v-model="searchDetail" append-icon="mdi-magnify" label="查詢" dense outlined single-line hide-details></v-text-field>
</div>
</v-toolbar>
</template>
<template v-slot:item.u_name="{ item }">
{{item.u_name}} ({{item.sex}})
</template>
<template v-slot:item.check_in_date="{ item }">
<v-text-field v-model="editedItem.checkIn_date" :hide-details="true" dense single-line v-if="item.id === editedItem.id" type="date"></v-text-field>
<span v-else>{{item.checkIn_date|timeString('YYYY/MM/DD')}}</span>
</template>
<template v-slot:item.bed_kind1_selected.text="{ item }">
<div class="input-group mb-3" data-search-control="search1" @click="search_show(search_dialog.controls.search1)" v-if="item.id === editedItem.id">
<input class="form-control search-text" type="text" readonly
placeholder="樓層" v-model="editedItem.bed_kind1_selected.text" >
<input type="hidden" v-model="editedItem.bed_kind1_selected.val">
<button class="btn btn-outline-secondary" type="button">
<i class="mdi mdi-view-list-outline"></i>
</button>
</div>
<span v-else>{{item.bed_kind1_selected.text}}</span>
</template>
<template v-slot:item.bed_kind2_selected.text="{ item }">
<div class="input-group mb-3" data-search-control="search2" @click="search_show(search_dialog.controls.search2)" v-if="item.id === editedItem.id">
<input class="form-control search-text" type="text" readonly
placeholder="房號/房名" v-model="editedItem.bed_kind2_selected.text" >
<input type="hidden" v-model="editedItem.bed_kind2_selected.val">
<button class="btn btn-outline-secondary" type="button">
<i class="mdi mdi-view-list-outline"></i>
</button>
</div>
<span v-else>{{item.bed_kind2_selected.text}}</span>
</template>
<template v-slot:item.bed_kind_detail_id_selected.text="{ item }">
<div class="input-group mb-3" data-search-control="search3" @click="search_show(search_dialog.controls.search3)" v-if="item.id === editedItem.id">
<input class="form-control search-text" type="text" readonly
placeholder="床位編號" v-model="editedItem.bed_kind_detail_id_selected.text" >
<input type="hidden" v-model="editedItem.bed_kind_detail_id_selected.val">
<button class="btn btn-outline-secondary" type="button">
<i class="mdi mdi-view-list-outline"></i>
</button>
</div>
<span v-else>{{item.bed_kind_detail_id_selected.text}}</span>
</template>
<template v-slot:item.license="{ item }">
<v-text-field v-model="editedItem.license" :hide-details="true" dense single-line v-if="item.id === editedItem.id" :maxlength=10 ></v-text-field>
<span v-else>{{item.license}}</span>
</template>
<template v-slot:item.qty="{ item }">
1
</template>
<template v-slot:item.actions="{ item }">
<div v-if="item.id === editedItem.id">
<v-icon color="red" class="mr-3" @click="cancel">
mdi-window-close
</v-icon>
<v-icon color="green" @click="save">
mdi-content-save
</v-icon>
</div>
<div v-else>
<v-icon color="green" class="mr-3" @click="editItem(item);">
mdi-pencil
</v-icon>
<v-icon color="red" @click="deleteItem(item)">
mdi-delete
</v-icon>
</div>
</template>
</v-data-table>
</v-card>
</asp:Panel>
</div>
<v-dialog v-model="search_dialog.show" max-width="500px">
<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-card-title>
<v-card-text >
<v-row>
<v-col v-for="item in search_dialog.current.keys"
:cols="search_dialog.current.keys.length>1?6:12" >
<v-text-field v-model="item.value" :label="item.title"></v-text-field>
</v-col>
<v-col cols="12" class="text-end">
<v-btn color="primary" elevation="0" @click="search_get()">查詢</v-btn>
<v-btn elevation="0" @click="search_clear()">清除條件</v-btn>
</v-col>
</v-row>
<v-data-table
:headers="search_headers()"
:items="search_dialog.list"
:footer-props="search_dialog.footer"
:items-per-page="10"
:server-items-length="search_dialog.count"
:page.sync="search_dialog.page"
:options.sync="options"
@click:row="search_select"
></v-data-table>
</v-card-text>
<v-card-actions>
</v-card-actions>
</v-card>
</v-dialog>
<v-snackbar
v-model="snackbar.show"
timeout="2000"
>
{{ snackbar.text }}
<template v-slot:action="{ attrs }">
<v-btn
text
v-bind="attrs"
@click="snackbar.show = false"
>
關閉
</v-btn>
</template>
</v-snackbar>
</div>
</asp:Content>

View File

@@ -0,0 +1,139 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Globalization;
public partial class admin_bed_new_reg : MyWeb.config
{
private Model.ezEntities _db = new Model.ezEntities();
public string _this_id = "";
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (!isStrNull(Request["order_no"]) && !isStrNull(Request["detail"]))
{
Model.bed_order order = new Model.bed_order();
ArrayList options = order.keyin1_list();
foreach (Model.bed_order.keyin optionKey in options)
{
ListItem item = new ListItem(optionKey.Text, optionKey.Value);
item.Attributes.Add("style", "color:" + optionKey.Color);
keyin1.Items.Add(item);
}
var qry = _db.bed_order.AsEnumerable();
var prod = qry.Where(q => q.order_no == Request["order_no"].ToString() && q.o_detail_id == Convert.ToInt32(Request["detail"])).FirstOrDefault();
if (prod != null)
{
bed_order_no.Text = prod.bed_order_no.ToString();
order_no.Text = prod.order_no.ToString();
//uptime.Text = Convert.ToDateTime(prod.pro_order.up_time.Value).ToString("yyyy-MM-dd");
uptime.Text = Convert.ToDateTime(prod.reg_time.Value).ToString("yyyy-MM-dd");
if (prod.pro_order_detail.f_num.HasValue)
{
f_num_Txt.Text = prod.pro_order_detail.follower.u_name.ToString();
}
if (prod.pro_order.activity_num.HasValue)
{
activity_num_Txt.Text = prod.pro_order.activity.subject.ToString();
}
MyWeb.encrypt encrypt = new MyWeb.encrypt();
phone.Text =!string.IsNullOrEmpty(prod.phone)? encrypt.DecryptAutoKey(prod.phone.ToString()) :"";
if (prod.start_date.HasValue)
{
start_date.Text = prod.start_date.Value.ToString("yyyy-MM-dd");
}
if (prod.end_date.HasValue)
{
end_date.Text = prod.end_date.Value.ToString("yyyy-MM-dd");
}
keyin1.SelectedValue = prod.keyin1.ToString();
_this_id = prod.bed_order_no.ToString();
edit.Visible = true;
goback.Visible = true;
}
else
{
Response.Redirect("reg.aspx?order_no=" + Request["order_no"]);
}
}
else
{
Response.Redirect("index.aspx");
}
}
}
protected void goback_Click(object sender, EventArgs e)
{
Response.Redirect("index.aspx?page=" + Convert.ToString(Request["page"]));
}
protected void gobackOrder_Click(object sender, EventArgs e)
{
Response.Redirect("reg.aspx?order_no=" + Request["order_no"]);
}
#region
protected void edit_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
L_msg.Text = "";
MyWeb.encrypt encrypt = new MyWeb.encrypt();
string order_no = Request["order_no"].ToString();
int detail_id = Convert.ToInt32(Request["detail"]);
Model.bed_order order = _db.bed_order.Where(q => q.order_no == order_no && q.o_detail_id == detail_id).FirstOrDefault();
if (order != null)
{
_this_id = order.bed_order_no.ToString();
if (!isStrNull(phone.Text)) { order.phone = encrypt.EncryptAutoKey(phone.Text); }
if (!isStrNull(start_date.Text)) { order.start_date = ValDate(start_date.Text); }
if (!isStrNull(end_date.Text)) { order.end_date = ValDate(end_date.Text); }
order.keyin1 = keyin1.SelectedValue;
order.demo = demo.Text;
}
try
{
_db.SaveChanges();
L_msg.Type = alert_type.success;
L_msg.Text = "操作成功";
}
catch (Exception ex)
{
L_msg.Type = alert_type.danger;
//L_msg.Text = ex.InnerException.Message;
L_msg.Text = "操作失敗";
}
}
}
#endregion
}

874
web/admin/order/index.aspx Normal file
View File

@@ -0,0 +1,874 @@
<%@ Page Title="後端管理" Language="C#" MasterPageFile="~/admin/Templates/TBS5ADM001/MasterPage.master" AutoEventWireup="true" EnableEventValidation="false" CodeFile="index.aspx.cs" Inherits="admin_order_index" %>
<%@ Register Src="~/admin/_uc/alert.ascx" TagPrefix="uc1" TagName="alert" %>
<asp:Content ID="Content1" ContentPlaceHolderID="page_header" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="page_nav" runat="Server">
<div class="mb-2 mb-sm-0">
<a href="reg.aspx" class="btn btn-primary">
<i class="mdi mdi-plus"></i>新增
</a>
<a @click="deleteAll" class="btn btn-outline-danger" title="刪除勾選的資料" ><i class="mdi mdi-trash-can"></i> 刪除勾選</a>
</div>
<div class="">
<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>
<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">
<%--<link href="<%=ResolveUrl("~/js/vuetify_ez.css")%>" rel="stylesheet" />--%>
<script>
Vue.filter('timeString', function (value, myFormat) {
return value == null || value == "" ? "" : moment(value).format(myFormat || 'YYYY-MM-DD, HH:mm:ss');
});
let VueApp=new Vue({
el: '#app',
vuetify: new Vuetify(vuetify_options),
data() {
return {
this_act : '<%= Request["act_id"]%>',
options: { multiSort: false },
search_options: { multiSort: false },
data_table: {
loading: true,
list: [],
selected: [],
singleSelect: false,
count: 0,
page: 1,
pageSize: 10,
header: [
{ text: '單號', value: 'order_no' },
{ text: '姓名', value: 'u_name'},
{ text: '報名日期', value: 'up_time' },
{ text: '報名活動', value: 'subject', align: 'start' },
{ text: '單據狀態', value: 'keyin1_txt' },
{ text: '', value: 'slot_btn', sortable: false, align: 'end' }
],
footer:{
showFirstLastPage: true,
itemsPerPageOptions:[5,10,20,30],
},
},
//列印管理報表
print_conditions: 'yy',
print_search: {
year: '',
month: '',
season: '',
chk_hasact: false,
chk_noact: false,
select_act: '',
select_actitem: '',
},
select_act_list: [],
select_items: {
month: [{
text: "請選擇",
val: 0
},],
season: [{
text: "請選擇",
val: 0
},],
},
print_dialog: {
show: false,
},
search_dialog: {
controls: {
search1: {
id: 'search1',
title: '國籍',
text_prop: 'name_zh',
value_prop: 'id',
keys: [
{ id: 'keyword', title: '關鍵字' },
],
api_url: HTTP_HOST + 'api/country/GetList',
columns: [
{ id: 'id', title: '代碼' },
{ id: 'name_en', title: '英文短名稱' },
{ id: 'name_zh', title: '中文名稱' },
],
selected: {},
select(item, t) {
//console.log("select search1", t);
t.search.country = item.id;
t.search.country2 = '';
}
},
search2: {
id: 'search2',
title: '報名活動',
text_prop: 'subject',
value_prop: 'num',
keys: [
{ id: 'subject', title: '活動名稱', value: '' },
{ id: 'kindTxt', title: '活動分類' },
],
api_url: HTTP_HOST + 'api/activity/GetList',
columns: [
{ id: 'subject', title: '活動名稱' },
{ id: 'kindTxt', title: '活動分類' },
],
selected: {},
select(item, t) {
t.print_search.select_act = item.num;
}
},
search3: {
id: 'search3',
title: '活動品項',
text_prop: 'subject',
value_prop: 'num',
keys: [
{ id: 'subject', title: '項目名稱', value: '' },
{ id: 'kindTxt', title: '項目分類' },
{ id: 'num', visible: false },
],
api_url: HTTP_HOST + 'api/activity/GetOrderList',
columns: [
{ id: 'subject', title: '項目名稱' },
{ id: 'kindTxt', title: '項目分類' },
],
selected: {},
select(item, t) {
t.print_search.select_actitem = item.num;
}
}
}, show: false,
current: {},
list: [],
count: 0,
page: 1,
loading: false,
footer: {
showFirstLastPage: true,
disableItemsPerPage: true,
itemsPerPageAllText: '',
itemsPerPageText: '',
},
},
search: {
keyin1: '',
order_no: '',
subject: '',
u_name: '',
up_time1: '',
up_time2: '',
actItemTxt: '',
introducerTxt: '',
activity_num: '',
country: '',
country2: '',
hasPrice: '',
}
//報到
, check_dialog: {
show: false,
},
check_data: {
f_num: 0,
u_name: '',
activity_num :0,
activity_name :'',
qty: 1,
status: {
text: '',
val: 1
},
},
keyin1_items: [//狀態
//{
//text: "請選擇",
//val: 0
//},
],
}
},
mounted() {
this.detalKeyinArray();
this.search_dialog.current = this.search_dialog.controls.search1 ///default
if (this.this_act != '')
this.search.activity_num = this.this_act;
this.initPrintSearch();
this.initActivity();
const navEntries = performance.getEntriesByType("navigation");
const isReload = navEntries.length > 0 && navEntries[0].type === "reload";
if (isReload) {
sessionStorage.removeItem("orderpage");
}
else {
const savedPage = parseInt(sessionStorage.getItem('orderpage'));
if (savedPage) {
this.options.page = savedPage;
}
}
},
watch: {
options: {
handler() {
this.getDefault()
},
deep: true,
},
search_options: {
handler() {
this.search_get()
},
deep: true,
},
},
methods: {
search_show(curr) {
//console.log("btn_click:", curr, curr.api_url);
this.search_dialog.current = curr;
this.search_clear()
//this.search_get()//清除完自動會重抓, 故取消
this.search_dialog.show = true;
},
search_clear() {
if (!this.search_dialog.current.keys) return;
this.search_dialog.current.keys.forEach((t, i) => { t.value = '' })
this.search_get()
},
search_get() {
if (!this.search_dialog.current.keys) return;
let api_url = this.search_dialog.current.api_url;
let keys = this.search_dialog.current.keys;
//const { page, itemsPerPage } = this.options
//const { sortBy, sortDesc, page, itemsPerPage } = this.options
this.search_dialog.page = this.search_options.page ?? 1
let params = { page: this.search_dialog.page, pageSize: 10 };//url params
var search = {};//post body
keys.forEach((t, i) => {
search[t.id] = t.value;
});
//necessary parameter===
if (this.search_dialog.current.id == 'search2') {
params = { sortBy: 'startDate_solar', sortDesc:true, page: this.search_dialog.page, pageSize: 10 };//url params
}
console.log("search_get", api_url, search, params, this.search_options);
this.search_dialog.loading = true
axios.post(api_url, search, { params: params })
.then(response => {
this.search_dialog.list = response.data.list
this.search_dialog.count = response.data.count
this.search_dialog.loading = false
})
.catch(error => {
console.log(error)
this.search_dialog.list = []
this.search_dialog.count = 0
this.search_dialog.loading = false
this.snackbar.text = "錯誤:" + error
this.snackbar.show = true
})
},
search_headers() {
if (!this.search_dialog.current.columns) return;
r = [];
this.search_dialog.current.columns.forEach((t, i) => {
r.push({
text: t.title,
align: 'start',
sortable: false,
value: t.id,
})
})
return r
},
search_select(row) {
let curr = this.search_dialog.current;
let target = $(`[data-search-control=${curr.id}]`);
curr.selected = row;
target.children("input.search-text").val(curr.selected[curr.text_prop])//text
target.children("input:hidden").val(curr.selected[curr.value_prop])//value
if (curr.select instanceof Function) {
curr.select(row, this);
}
this.search_dialog.show = false;
//console.log(row, row["u_name"], row["f_number"], curr.id, target);
},
getDefault(clearpage = false) {
const { sortBy, sortDesc, page, itemsPerPage } = this.options
const params = {
sortBy: sortBy[0], sortDesc: sortDesc[0],
page: clearpage ? '1' : page, pageSize: itemsPerPage
};
this.data_table.loading = true
sessionStorage.setItem('orderpage', clearpage ? '1' : page);
axios
.post(HTTP_HOST + 'api/order/GetList', this.search, { params: params })
.then(response => {
this.data_table.list = response.data.list
this.data_table.count = response.data.count;
this.data_table.loading = false
})
.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]),
}
this.keyin1_items.push(_tmp);
}
},
editItem(item) {
console.log("edit", item);
},
deleteItem(item) {
if (confirm('是否確定刪除此筆資料?')) {
const index = this.data_table.list.indexOf(item)
if (index != -1) {
axios
.delete(HTTP_HOST + 'api/order/' + item.order_no)
.then(response => {
console.log("del", item);
this.data_table.list.splice(index, 1);
this.data_table.count = this.data_table.list.length
})
.catch(error => console.log(error))
}
}
},
deleteAll() {
if (confirm('是否確定刪除已勾選的資料?')) {
axios
.delete(HTTP_HOST + 'api/order/DeleteAll/' + this.data_table.selected.map(x => x.order_no))
.then(response => {
//console.log("delAll");
//for (var i = 0; i < this.data_table.selected.length; i++) {
// const index = this.data_table.list.indexOf(this.data_table.selected[i]);
// this.data_table.list.splice(index, 1);
//}
//this.data_table.selected = [];
//this.data_table.count = this.data_table.list.length
location.reload();
})
.catch(error => console.log(error))
}
},
btn_search() {
this.this_act = '';
this.search.activity_num = '';
this.getDefault(true)
},
btn_all() {
this.this_act = '';
this.search.activity_num = '';
clearObjProps(this.search);
this.btn_search()
},
checkInMsg(item) {
this.check_data.f_num = item.f_num;
this.check_data.u_name = item.u_name;
this.check_data.activity_num = item.activity_num;
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('報到資訊請填寫完整');
}
}, goPrint() {
let _qry = "";
Object.keys(this.search).forEach(key => {
//console.log(`${key}: ${this.search[key]}`);
if (this.search[key] != undefined && this.search[key] != null && this.search[key] != '') {
_qry += (_qry != '' ? '&' : '?') + (key + '=' + this.search[key]);
}
});
window.open("print.aspx" + _qry, '_blank');
},
countryChange() {
this.search.country = '';
$('#country_txt').val('')
},
//列印管理報表
print_close() {
this.print_dialog.show = false;
}
,
initPrintSearch() {
//下拉選單
for (let i = 1; i <= 12; i++) {
var _tmp = {
text: i,
val: i,
}
this.select_items.month.push(_tmp);
}
for (let i = 1; i <= 4; i++) {
var _tmp = {
text: i,
val: i,
}
this.select_items.season.push(_tmp);
}
//預設值
const Today = new Date();//現在日期時間
const first_date = new Date(Today.getFullYear(), Today.getMonth(), 1); //本月第一天
const last_month_date = new Date(first_date - 1); //上個月最後一天
this.print_search.year = last_month_date.getFullYear();
this.print_search.month = last_month_date.getMonth() + 1 //預設上個月的年份
let _season = 1;
const _month = first_date.getMonth() + 1; //本月
if (_month >= 1 && _month <= 3) {
_season = 4;
} else if (_month >= 4 && _month <= 6) {
_season = 1;
} else if (_month >= 7 && _month <= 9) {
_season = 2;
} else if (_month >= 10 && _month <= 12) {
_season = 3;
}
this.print_search.season = _season; //預設上一季
},
goPrint2() {
if (this.print_search.year != '') {
if (this.print_search.chk_noact || this.print_search.chk_hasact) {
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]);
}
}
});
this.print_dialog.show = false;
window.open("print.aspx" + _qry, '_blank');
} else {
msgbox('活動/非活動至少勾選一項');
}
} else {
msgbox('請輸入年份');
}
}, chk_hasact_change() {
if (!this.print_search.chk_hasact) {
//$('#activity_num_txt').val('')
//this.print_search.select_act = '';
this.clear_select_act();
$('#activity_num_txt').attr("placeholder", "可選擇單一活動(需先勾選活動報名)");
}else{
$('#activity_num_txt').attr("placeholder", "可選擇單一活動");
}
},
clear_select_act() {
$('#activity_num_txt').val('')
this.print_search.select_act = '';
}, clear_select_actitem() {
$('#actItem_num_txt').val('')
this.print_search.select_actitem = '';
},
initActivity() {
axios.get(HTTP_HOST + 'api/activity')
.then(response => {
this.select_act_list = response.data
})
.catch(error => {
console.log(error)
})
}
},
computed: {
pageCount() {
return Math.ceil(this.data_table.count / this.data_table.pageSize)
},
}
})
document.getElementById("<%= s_country.ClientID %>").addEventListener("click", function () {
$('#country2').val('');
VueApp.search.country2 = '';
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<uc1:alert runat="server" ID="L_msg" Text="" />
<div id="content" class="container-fluid">
<v-data-table
v-model="data_table.selected"
:items="data_table.list"
:search-props="search"
item-key="order_no"
:options.sync="options"
:headers="data_table.header"
:footer-props="data_table.footer"
:server-items-length="data_table.count"
:loading="data_table.loading"
:single-select="data_table.singleSelect"
show-select
hide-default-footer
:page.sync="data_table.page"
:items-per-page.sync="data_table.pageSize"
class="elevation-1">
<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>
{{ item.u_name }}
</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>
</template>
</v-data-table>
<v-container>
<v-row class="align-baseline" wrap>
<v-col cols="12" md="9">
<v-pagination
v-model="data_table.page"
:length="pageCount">
</v-pagination>
</v-col>
<v-col class="text-truncate text-right" cols="12" md="2">
共 {{ data_table.count }} 筆, 頁數:
</v-col>
<v-col cols="6" md="1">
<v-text-field
v-model="data_table.page"
type="number"
hide-details
dense
min="1"
:max="pageCount"
@input="data_table.page = parseInt($event, 10)"
></v-text-field>
</v-col>
</v-row>
</v-container>
<v-dialog v-model="check_dialog.show" max-width="400px">
<v-card>
<v-card-title class="justify-space-between grey lighten-2">
請填寫報到資訊
<v-btn icon @click="check_dialog.show=false;"><v-icon>mdi-close</v-icon></v-btn>
</v-card-title>
<v-card-text >
<v-row densee class="pt-3" >
<v-col :cols="3" class="pt-3" >
<span class="fs-6 text text-dark">姓名</span>
</v-col>
<v-col :cols="9" class="pt-3" >
<span class="fs-6 text text-dark">{{check_data.u_name}}</span>
</v-col>
<v-col :cols="3" class="pt-3" >
<span class="fs-6 text text-dark">活動</span>
</v-col>
<v-col :cols="9" class="pt-3" >
<span class="fs-6 text text-dark">{{check_data.activity_name}}</span>
</v-col>
<v-col :cols="3" class="pt-3" >
<span class="fs-6 text text-dark">報到人數</span>
</v-col>
<v-col :cols="9" >
<v-text-field v-model="check_data.qty" :hide-details="true" dense single-line :maxlength=5 ></v-text-field>
</v-col>
<v-col :cols="3" class="pt-3" >
<span class="fs-6 text text-dark">狀態 *</span>
</v-col>
<v-col :cols="9" >
<v-select @change=""
item-text="text"
item-value="val"
v-model="check_data.status.val"
:items="keyin1_items"
></v-select>
</v-col>
<v-col :cols="12" class="pt-3 text-center" >
<v-btn class="ma-2" color="primary" dark @click="checkIn()" ><v-icon dark left > mdi-check-bold </v-icon> 確定報到 </v-btn>
</v-col>
</v-row>
</v-card-text>
<v-card-actions>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog v-model="print_dialog.show" max-width="650px">
<v-card>
<v-card-title class="justify-space-between grey lighten-2">
活動報名日期管理報表​​
<v-btn icon @click="print_close"><v-icon>mdi-close</v-icon></v-btn>
</v-card-title>
<v-card-text >
<v-row densee class="pt-3" >
<v-col :cols="2" >
<span class="fs-6 text text-dark">查詢條件</span>
</v-col>
<v-col :cols="10" >
<select class="form-select" v-model="print_conditions" >
<option value="yy">年</option>
<option value="mm">月</option>
<option value="ss">季</option>
</select>
</v-col>
<v-col :cols="2" class="pt-5" >
<span class="fs-6 text text-dark">年 *</span>
</v-col>
<v-col :cols="10" >
<v-text-field v-model.number="print_search.year" min="1911" type="number" placeholder="年份必填" />
</v-col>
<v-col :cols="2" class="pt-5" v-if="print_conditions=='mm' " >
<span class="fs-6 text text-dark">月</span>
</v-col>
<v-col :cols="10" v-if="print_conditions=='mm' ">
<v-select
item-text="text"
item-value="val"
v-model="print_search.month"
:items="select_items.month"
></v-select>
</v-col>
<v-col :cols="2" class="pt-5" v-if="print_conditions=='ss' ">
<span class="fs-6 text text-dark">季</span>
</v-col>
<v-col :cols="10" v-if="print_conditions=='ss' ">
<v-select
item-text="text"
item-value="val"
v-model="print_search.season"
:items="select_items.season"
></v-select>
</v-col>
</v-row>
<v-row densee class="pt-3" >
<v-col :cols="2" class="pt-5" >
<span class="fs-6 text text-dark">活動 *</span>
</v-col>
<v-col :cols="10" class="pt-5" >
活動/非活動至少勾選一項
<v-checkbox
v-model="print_search.chk_noact"
:label="`非活動報名`"
></v-checkbox>
<v-checkbox
v-model="print_search.chk_hasact"
:label="`活動報名`"
@change="chk_hasact_change"
></v-checkbox>
<%-- <v-row densee class="pt-3" >
<v-col :cols="10" class="pt-5" > --%>
<div class="input-group mb-3 single-line d-none" data-search-control="search2" @click="print_search.chk_hasact && search_show(search_dialog.controls.search2)" :disabled="!print_search.chk_hasact">
<input class="form-control search-text" type="text" readonly
id="activity_num_txt" placeholder="可選擇單一活動(需先勾選活動報名)" value="" >
<input type="hidden" v-model="print_search.select_act" >
<button class="btn btn-outline-secondary" type="button">
<i class="mdi mdi-view-list-outline"></i>
</button>
</div>
<select class="form-select" v-model="print_search.select_act" :disabled="print_search.chk_hasact==false" >
<option value="">可選擇單一活動(需先勾選活動報名)</option>
<option v-for="item in select_act_list" :value="item.num">{{item.subject}}</option>
</select>
<%-- </v-col>
<v-col :cols="2" class="pt-5" >
<button type="button" class="btn btn-outline-success" @click="clear_select_act">清除</button>
</v-col>
</v-row>--%>
</v-col>
<%--<v-col :cols="2" class="pt-5" >
<span class="fs-6 text text-dark">報名項目</span>
</v-col>
<v-col :cols="10" class="pt-5" >
<v-row densee class="pt-3" >
<v-col :cols="10" class="pt-5" >
<div class="input-group mb-3 " data-search-control="search3" @click=" search_show(search_dialog.controls.search3)" >
<input class="form-control search-text" type="text" readonly
id="actItem_num_txt" value="" placeholder="請選擇報名項目" >
<input type="hidden" v-model="print_search.select_actitem" >
<button class="btn btn-outline-secondary" type="button">
<i class="mdi mdi-view-list-outline"></i>
</button>
</div>
</v-col>
<v-col :cols="2" class="pt-5" >
<button type="button" class="btn btn-outline-success" @click="clear_select_actitem">清除</button>
</v-col>
</v-row>
</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="green" dark @click="print_close" > 取消 </v-btn>
</v-col>
</v-row>
</v-card-text>
</v-card>
</v-dialog>
<v-dialog v-model="search_dialog.show" max-width="500px">
<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-card-title>
<v-card-text >
<v-row>
<v-col v-for="item in search_dialog.current.keys"
:cols="search_dialog.current.keys.length>1?6:12" >
<v-text-field v-model="item.value" :label="item.title" v-if="item.visible===undefined || item.visible==true "></v-text-field>
</v-col>
<v-col cols="12" class="text-end">
<v-btn color="primary" elevation="0" @click="search_get()">查詢</v-btn>
<v-btn elevation="0" @click="search_clear()">清除條件</v-btn>
</v-col>
</v-row>
<v-data-table
:headers="search_headers()"
:items="search_dialog.list"
:footer-props="search_dialog.footer"
:items-per-page="10"
:server-items-length="search_dialog.count"
:page.sync="search_dialog.page"
:options.sync="search_options"
@click:row="search_select"
></v-data-table>
</v-card-text>
<v-card-actions>
</v-card-actions>
</v-card>
</v-dialog>
</div>
<div id="print_data">
</div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" runat="Server">
<div id="search_panel" alt="查詢公告資料">
<div class="mb-3">
<label class="form-label">報名活動</label>
<input type="text" v-model="search.subject" class="form-control" placeholder="可輸入關鍵字查詢" id="s_subject" runat="server">
</div>
<div class="mb-3">
<label class="form-label">姓名/名稱</label>
<input type="text" v-model="search.u_name" class="form-control" placeholder="可輸入關鍵字查詢" id="s_u_name" runat="server">
</div>
<div class="mb-3">
<label class="form-label">國籍</label>
<div class="input-group mb-3 d-none" data-search-control="search1" @click="search_show(search_dialog.controls.search1)">
<input class="form-control search-text" type="text" readonly
placeholder="請選擇國籍" value="" id="country_txt">
<input type="hidden" v-model="search.country" >
<button class="btn btn-outline-secondary" type="button">
<i class="mdi mdi-view-list-outline"></i>
</button>
</div>
<asp:DropDownList ID="s_country" runat="server" CssClass="form-select" v-model="search.country" >
<asp:ListItem Value="" Text="請選擇"></asp:ListItem>
</asp:DropDownList>
<select class="form-select" v-model="search.country2" @change="countryChange">
<option value="">請選擇</option>
<option value="0">全部</option>
<option value="1">台灣</option>
<option value="2">境外(非台灣)</option>
</select>
</div>
<div class="mb-3">
<label class="form-label">介紹人</label>
<input type="text" v-model="search.introducerTxt" class="form-control" placeholder="可輸入關鍵字查詢" id="s_introducerTxt" runat="server">
</div>
<div class="mb-3">
<label class="form-label">單號</label>
<input type="text" v-model="search.order_no" class="form-control" placeholder="可輸入關鍵字查詢" id="s_order_no" runat="server">
</div>
<div class="mb-3">
<label class="form-label">品項</label>
<input type="text" v-model="search.actItemTxt" class="form-control" placeholder="可輸入關鍵字查詢" id="s_actItemTxt" runat="server">
</div>
<div class="mb-3">
<label class="form-label">單據狀態</label>
<asp:DropDownList ID="s_keyin1" runat="server" CssClass="form-select" v-model="search.keyin1" >
</asp:DropDownList>
</div>
<div class="mb-3">
<label class="form-label">報名日期</label>
<div class="input-group">
<input type="date" v-model="search.up_time1" class="form-control" autocomplete="off" id="s_up_time1" runat="server">
<span class="input-group-text">~</span>
<input type="date" v-model="search.up_time2" class="form-control" autocomplete="off" id="s_up_time2" runat="server">
</div>
</div>
<div class="mb-3 p-2 border-top">
<a @click="btn_search" class="btn btn-outline-primary"><i class="mdi mdi-filter"></i> 搜尋</a>
<a class="btn btn-outline-secondary" @click="btn_all"><i class="mdi mdi-filter-remove"></i> 所有資料</a>
</div>
</div>
</asp:Content>

View File

@@ -0,0 +1,354 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
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;
public partial class admin_order_index : MyWeb.config
{
private Model.ezEntities _db = new Model.ezEntities();
public Dictionary<int, string> _keyin1Item = null;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Model.pro_order order = new Model.pro_order();
ArrayList options = order.keyin1_list();
foreach (Model.pro_order.keyin optionKey in options)
{
ListItem item = new ListItem(optionKey.Text, optionKey.Value);
item.Attributes.Add("style", "color:" + optionKey.Color);
s_keyin1.Items.Add(item);
}
_keyin1Item = publicFun.enum_desc<Model.activity_check.keyin1>(); //狀態
BuildKind();
}
}
#region
public void BuildKind()
{
//國籍
s_country.Items.Clear();
s_country.Items.Add(new ListItem("請選擇", ""));
var qry = _db.countries.AsEnumerable().OrderBy(x => x.range).ThenBy(x => x.name_en).ToList();
if (qry.Count > 0)
{
foreach (var x in qry)
s_country.Items.Add(new ListItem(x.name_zh, x.ID));
}
}
#endregion
#region Excel
protected void excel_Click(object sender, EventArgs e)
{
var memoryStream = new MemoryStream();
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 }
);
sd.AppendChild(tr);
//查詢要匯出的資料
var aIDt = _db.actItems.AsEnumerable().Where(f => f.subject.Contains(s_actItemTxt.Value.Trim())).Select(f => f.num.ToString());//品項
var qry = _db.pro_order.AsEnumerable();
if (!isStrNull(s_order_no.Value))
qry = qry.Where(o => o.order_no.Contains(s_order_no.Value.Trim()));
if (!isStrNull(s_u_name.Value))
qry = qry.Where(o => o.f_num.HasValue && o.follower.u_name.Contains(s_u_name.Value.Trim()));
if (!isStrNull(s_introducerTxt.Value))
qry = qry.Where(o => o.f_num.HasValue && o.follower1.u_name.Contains(s_introducerTxt.Value.Trim()));
if (!isStrNull(s_subject.Value))
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);
if (!isStrNull(s_keyin1.SelectedValue))
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));
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));
qry = qry.OrderByDescending(o => o.reg_time);
MyWeb.encrypt encrypt = new MyWeb.encrypt();
var tdesc = publicFun.enum_desc<Model.pro_order.detailKeyin1>();
var bedDt = _db.bed_order_detail.AsEnumerable();//掛單明細
//left join 使用 GroupJoin
//var list = qry.Join
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?.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_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_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 ? "" : (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_demo = d == null ? "" : d.demo, //狀態備註
}).ToList();
//也可使用查詢式
//try
////{
// var listQ = from o in qry
// join p in _db.pro_order_detail
// on new
// {
// order_no = o.order_no,
// } equals
// new { p.order_no }
// into subGrp //into ==
// from d in subGrp.DefaultIfEmpty()
// select new
// {
// //訂單資料
// order_no = o.order_no,
// up_time = o.up_time,
// f_num = o.follower.u_name, //姓名/名稱
// ...
// //訂單明細
// //使用DefaultIfEmpty 因匿名型別無法輸出NULL(無法轉換成強型別)需特別注意Null的處理
// d_actItem_num = d == null? "" :(d.actItem_num.HasValue ? d.actItem.subject : ""), //項目名稱
// d_f_num = d == null ? "" :( d.f_num.HasValue ? d.follower.u_name : ""), //姓名
// ...
// };
// var list = listQ.ToList();
//}
//catch (Exception ex)
//{
// Response.Write(ex.Message);
//}
if (list.Count > 0)
{
foreach (var item in list)
{
//新增資料列
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(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(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("$" + 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_demo), 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()));
// 合并具有相同单号的行
//string orderNumber = "";
//int startRow = 1;
//int endRow = 1;
//int nowRow = 1;
//foreach (var kvp in list)
//{
// if(orderNumber == "" || orderNumber != kvp.order_no)
// {
// orderNumber = kvp.order_no;
// int _count = list.Where(x => x.order_no == orderNumber).Count();
// if (_count > 1)
// {
// endRow += _count;
// var mergeCells = new MergeCells();
// string startCellReference = GetCellReference(1, startRow);
// string endCellReference = GetCellReference(1, endRow);
// if (startCellReference != endCellReference)
// mergeCells.Append(new MergeCell() { Reference = new StringValue($"{startCellReference}:{endCellReference}") });
// }
// startRow += _count;
// endRow = startRow;
// }
// else
// {
// startRow ++;
// endRow = startRow;
// }
// nowRow++;
//}
}
}
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();
}
private string GetCellReference(int column, int row)
{
int dividend = column;
string cellReference = string.Empty;
while (dividend > 0)
{
int modulo = (dividend - 1) % 26;
char columnChar = (char)('A' + modulo);
cellReference = columnChar + cellReference;
dividend = (dividend - modulo) / 26;
}
return cellReference + row.ToString();
}
#endregion
}

275
web/admin/order/index2.aspx Normal file
View File

@@ -0,0 +1,275 @@
<%@ Page Title="後端管理" Language="C#" MasterPageFile="~/admin/Templates/TBS5ADM001/MasterPage.master" AutoEventWireup="true" EnableEventValidation="false" CodeFile="index2.aspx.cs" Inherits="admin_order_check" %>
<%@ Register Src="~/admin/_uc/alert.ascx" TagPrefix="uc1" TagName="alert" %>
<asp:Content ID="Content1" ContentPlaceHolderID="page_header" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="page_nav" runat="Server">
<div class="mb-2 mb-sm-0">
<a @click="deleteAll" class="btn btn-outline-danger" title="刪除勾選的資料" ><i class="mdi mdi-trash-can"></i> 刪除勾選</a>
</div>
<div class="">
<a href="javascript:PrintTagRWD('content');" class="btn btn-outline-primary btn-print">
<i class="mdi mdi-printer"></i>列印本頁
</a>
<asp:LinkButton ID="excel" runat="server" Visible="false" CssClass="btn btn-outline-primary" 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">
<script>
let VueApp=new Vue({
el: '#app',
vuetify: new Vuetify(vuetify_options),
data() {
return {
this_act: '<%= Request["act_id"]%>',
this_actTxt: '<%= Request["act_sub"]%>',
this_dd: '<%= Request["dd"]%>',
options: { multiSort: false },
data_table: {
loading: true,
list: [],
selected: [],
singleSelect: false,
count: 0,
page: 1,
pageSize: 10,
header: [
{ text: '活動名稱​', value: 'subject', },
{ text: '報到日期​', value: 'reg_time_date', },
{ text: '報到時間​', value: 'reg_time_time' },
{ text: '姓名(人數)', value: 'qty' },
{ text: '狀態', value: 'statusTxt' },
{ text: '', value: 'slot_btn', sortable: false, align: 'end' }
],
footer:{
showFirstLastPage: true,
itemsPerPageOptions:[5,10,20,30],
},
},
search: {
status: '',
activityTxt: '',
activity_num: '',
check_time: '',
//reg_time2: '',
}
}
},
watch: {
options: {
handler() {
this.getDefault()
},
deep: true,
},
},
mounted() {
if (this.this_act != '') {
this.search.activity_num = this.this_act;
this.search.status = 1;
if (this.this_actTxt != '')
this.search.activityTxt = this.this_actTxt;
}
if (this.this_dd != '')
this.search.check_time = this.this_dd;
},
methods: {
getDefault(clearpage = false) {
const { sortBy, sortDesc, page, itemsPerPage } = this.options
const params = {
sortBy: sortBy[0], sortDesc: sortDesc[0],
page: clearpage ? '1' : page, pageSize: itemsPerPage
};
this.data_table.loading = true
axios
.post(HTTP_HOST + 'api/activity/GetCheckList', this.search, { params: params })
.then(response => {
this.data_table.list = response.data.list
this.data_table.count = response.data.count;
this.data_table.loading = false
})
.catch(error => console.log(error))
},
deleteItem(item) {
if (confirm('是否確定刪除此筆資料?')) {
const index = this.data_table.list.indexOf(item)
if (index != -1) {
axios
.delete(HTTP_HOST + 'api/activity/DeleteCheck/' + item.num)
.then(response => {
console.log("del", item);
this.data_table.list.splice(index, 1);
this.data_table.count = this.data_table.list.length
})
.catch(error => console.log(error))
}
}
},
deleteAll() {
if (confirm('是否確定刪除已勾選的資料?')) {
axios
.delete(HTTP_HOST + 'api/activity/DeleteAllCheck/' + this.data_table.selected.map(x => x.num))
.then(response => {
//console.log("delAll");
//for (var i = 0; i < this.data_table.selected.length; i++) {
// const index = this.data_table.list.indexOf(this.data_table.selected[i]);
// this.data_table.list.splice(index, 1);
//}
//this.data_table.selected = [];
//this.data_table.count = this.data_table.list.length
location.reload();
})
.catch(error => console.log(error))
}
},
btn_search() {
this.this_act = '';
//this.this_dd = '';
this.search.activity_num = '';
this.page = 1;
this.getDefault(true)
},
btn_all() {
this.this_act = '';
/*this.this_dd = '';*/
this.search.activity_num = '';
clearObjProps(this.search);
this.btn_search()
},
},
computed: {
pageCount() {
return Math.ceil(this.data_table.count / this.data_table.pageSize)
},
},
filters: {
currency: function (value) {
return value == null || value == "" ? "" :
('$' + parseFloat(value).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1,").replace(".00", ""));
}, timeString: function (value, myFormat) {
return value == null || value == "" ? "" : moment(value).format(myFormat || 'YYYY-MM-DD, HH:mm:ss');
},
}
})
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<uc1:alert runat="server" ID="L_msg" Text="" />
<div id="content" class="container-fluid">
<template v-if="this_act !=''">{{this_actTxt}}(報到人數:{{data_table.count}})</template>
<v-data-table
v-model="data_table.selected"
:items="data_table.list"
:search-props="search"
item-key="num"
:options.sync="options"
:headers="data_table.header"
:footer-props="data_table.footer"
:server-items-length="data_table.count"
:loading="data_table.loading"
:single-select="data_table.singleSelect"
show-select
hide-default-footer
:page.sync="data_table.page"
:items-per-page.sync="data_table.pageSize"
class="elevation-1">
<template #item.reg_time_date="{ item }" >
{{item.reg_time |timeString('YYYY/MM/DD') }}
</template>
<template #item.reg_time_time="{ item }" >
{{item.reg_time |timeString('HH:mm:ss') }}
</template>
<template #item.qty="{ item }" >
{{item.u_name }}({{item.qty }})
</template>
<template #item.slot_btn="{ item }">
<a @click="deleteItem(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-trash-can"></i>刪除</a>
</template>
</v-data-table>
<v-container>
<v-row class="align-baseline" wrap>
<v-col cols="12" md="9">
<v-pagination
v-model="data_table.page"
:length="pageCount">
</v-pagination>
</v-col>
<v-col class="text-truncate text-right" cols="12" md="2">
共 {{ data_table.count }} 筆, 頁數:
</v-col>
<v-col cols="6" md="1">
<v-text-field
v-model="data_table.page"
type="number"
hide-details
dense
min="1"
:max="pageCount"
@input="data_table.page = parseInt($event, 10)"
></v-text-field>
</v-col>
</v-row>
</v-container>
</div>
<div id="print_data">
</div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" runat="Server">
<div id="search_panel" alt="查詢公告資料">
<div class="mb-3">
<label class="form-label">活動名稱</label>
<input type="text" v-model="search.activityTxt" class="form-control" placeholder="可輸入關鍵字查詢">
</div>
<div class="mb-3 d-none" >
<label class="form-label">報名日期</label>
<div class="input-group">
<input type="date" v-model="search.reg_time1" class="form-control" autocomplete="off" id="s_reg_time1" runat="server">
<span class="input-group-text">~</span>
<input type="date" v-model="search.reg_time2" class="form-control" autocomplete="off" id="s_reg_time2" runat="server">
</div>
</div>
<div class="mb-3">
<label class="form-label">報名日期</label>
<input type="date" v-model="search.check_time" class="form-control" autocomplete="off" id="check_time" runat="server">
</div>
<div class="mb-3">
<label class="form-label">報到狀態</label>
<asp:DropDownList ID="s_status" runat="server" CssClass="form-select" v-model="search.status" >
<asp:ListItem Value="" Text="請選擇"></asp:ListItem>
</asp:DropDownList>
</div>
<div class="mb-3 p-2 border-top">
<a @click="btn_search" class="btn btn-outline-primary"><i class="mdi mdi-filter"></i> 搜尋</a>
<a class="btn btn-outline-secondary" @click="btn_all"><i class="mdi mdi-filter-remove"></i> 所有資料</a>
</div>
</div>
</asp:Content>

View File

@@ -0,0 +1,46 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.IO;
using System.Linq;
public partial class admin_order_check : MyWeb.config
{
private Model.ezEntities _db = new Model.ezEntities();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
InitEnumsOptions<Model.activity_check.keyin1>(s_status);
}
}
#region
#endregion
#region Excel
protected void excel_Click(object sender, EventArgs e)
{
//請參考訂單系統的匯出
}
#endregion
}

View File

@@ -0,0 +1,26 @@
.text-block {
/* border: .25pt solid #000; */
/* margin: 5mm; */
font-family: ;
text-align: center;
vertical-align: middle;
/* --divw: 120mm; */
/* --divh: 50mm; */
--line_len: 10;
--lines: 1;
--fs_w: var(--divw)/var(--line_len);
--fs_h: var(--divh)/var(--lines);
--fs: min(var(--fs_w), var(--fs_h));
width: var(--divw);
height: var(--divh);
font-size: var(--fs);
line-height: calc(var(--fs_h) * 1.0);
}
.vertical {
writing-mode: vertical-rl;
}

View File

@@ -0,0 +1,60 @@
$(".fit-text.horizon").each(function (i, e) {
var txt = $(this).text();
var htm = $(this).html();
var txt_arr = txt.split('\n');
var txt_arr2 = Array();
//debugger;
var line = 0;
var line_len = 1;
var css = "", htm_lines = "";
txt_arr.forEach((t, n) => {
var len = t.trim().length;
if (len > 0) {
line++;
if (len > line_len) { line_len = len }
txt_arr2.push(t.trim());
}
//console.log(n,t,t.trim().length);
});
//console.log(i, $(this).html(),$(this).text());
//console.log(i, txt==htm);
//console.log(i, txt_arr, line, line_len);
line_len = Math.ceil(line_len / 5) * 5;
//if(line>1){
css = "--lines:" + line + ";--line_len:" + line_len + ";";
htm_lines = txt_arr2.join("<br>");
$(this).attr("style", css);
$(this).html(htm_lines);
//}
//console.log(i, line, line_len, css);
});
$(".fit-text.vertical").each(function (i, e) {
var txt = $(this).text();
var htm = $(this).html();
var txt_arr = txt.split('\n');
var txt_arr2 = Array();
//debugger;
var line = 0;
var line_len = 1;
var css = "", htm_lines = "";
txt_arr.forEach((t, n) => {
var len = t.trim().length;
if (len > 0) {
line++;
if (len > line_len) { line_len = len }
txt_arr2.push(t.trim());
}
//console.log(n,t,t.trim().length);
});
//console.log(i, $(this).html(),$(this).text());
//console.log(i, txt==htm);
//console.log(i, txt_arr, line, line_len);
line_len = Math.ceil(line_len / 5) * 5;
//if(line>1){
css = "--lines:" + line_len + ";--line_len:" + line + ";";
htm_lines = txt_arr2.join("<br>");
$(this).attr("style", css);
$(this).html(htm_lines);
//}
//console.log(i, line, line_len, css);
});

222
web/admin/order/print.aspx Normal file
View File

@@ -0,0 +1,222 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="print.aspx.cs" Inherits="admin_follower_print_" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>列印信眾資料</title>
<script src="https://code.jquery.com/jquery-3.6.2.min.js"></script>
<link href="~/js/bootstrap5/bootstrap.min.css" rel="stylesheet" />
<style>
body {
font-size: 10pt;
}
.fit {
width: 1%;
white-space: nowrap;
}
.nowarp {
white-space: nowrap;
}
table {
width: 100%;
}
table td {
padding: 4px 3px;
}
table thead tr th {
font-size: 11pt;
font-weight: 300;
color: #666;
}
table thead tr td {
font-size: 11pt;
font-weight: 700;
border-bottom: 2px solid #333;
}
table tbody tr th {
padding: 4px 3px;
font-weight: 700;
border-bottom: 1px solid #333;
}
table tbody tr td {
border-bottom: 1px solid #ccc;
}
table tbody tr td.no-border {
border: 0;
}
@media print {
@page {
size: A4 landscape
}
body {
margin: 5mm 3mm;
}
}
@media screen {
body {
padding: 3.5mm 2.5mm;
}
.docs {
max-width: 297mm;
margin: 0 auto;
border: 1px solid #ccc;
padding: 5px;
}
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div class="docs">
<h1><asp:Literal ID="title" runat="server" Text="報名查詢列表"></asp:Literal></h1>
<table style="repeat-header: yes; repeat-footer: yes;" id="content">
<thead>
<tr>
<asp:Literal ID="footer" runat="server"></asp:Literal>
</tr>
</thead>
<tbody>
<tr style="background-color:antiquewhite;"><td><asp:Literal ID="count_data" runat="server"></asp:Literal></td></tr>
<tr>
<td colspan="3" class="no-border">
<asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound">
<ItemTemplate>
<table>
<tbody>
<tr>
<td class="no-border py-0">
<label>單號:</label>
<%# Eval("order_no") %>
</td>
<td class="no-border py-0">
<label>報名日期:</label>
<%# Eval("up_time") != null? Convert.ToDateTime( Eval("up_time")).ToString("yyyy/MM/dd") : "" %>
</td>
<td class="no-border py-0">
<label>單據狀態:</label>
<asp:Literal ID="keyin1" runat="server"></asp:Literal>
</td>
<td class="no-border py-0">
<label>報名活動:</label>
<asp:Literal ID="activityTxt" runat="server"></asp:Literal>
</td>
<td class="no-border py-0">
<label>姓名/名稱:</label>
<asp:Literal ID="f_numTxt" runat="server"></asp:Literal>
</td>
</tr>
<tr>
<td class="no-border py-0">
<label>聯絡電話:</label>
<%# encrypt.DecryptAutoKey( Eval("phone")?.ToString()) %>
</td>
<td class="no-border py-0" colspan="2">
<label>收件地址:</label>
<%# Eval("address") %>
</td>
<td class="no-border py-0" colspan="2">
<label>備註:</label>
<%# Eval("demo") %>
</td>
</tr>
</tbody>
</table>
<asp:PlaceHolder ID="detailTable" runat="server" Visible="false">
<table class="mb-2">
<tbody>
<tr>
<th>項目名稱</th>
<th class="nowarp">姓名</th>
<th>代表地址</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>
<th class="fit">合計​</th>
<th class="fit">已收</th>
<th class="fit">未收</th>
<th class="fit">付款期限</th>
<th class="fit">報名狀態</th>
</asp:PlaceHolder>
</tr>
<asp:Repeater ID="Repeater2" runat="server" OnItemDataBound="Repeater2_ItemDataBound">
<ItemTemplate>
<tr>
<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>
<td class="nowarp">
<asp:Literal ID="from_idTxt" 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>
<td class="fit text-end">
<asp:Literal ID="item_qty" runat="server" Text='<%# Eval("qty") %>'></asp:Literal></td>
<td class="fit text-end"><%# Convert.ToDouble(Eval("price")) * Convert.ToInt32(Eval("qty")) %></td>
<td class="fit text-end"><%# Eval("pay") %></td>
<td class="fit text-end"><%# Convert.ToDouble(Eval("price")) * Convert.ToInt32(Eval("qty")) -Convert.ToDouble(Eval("pay")) %></td>
<td class="fit"><%# Eval("pay_date") != null? Convert.ToDateTime( Eval("pay_date")).ToString("yyyy/MM/dd") : "" %></td>
<td class="fit">
<asp:Literal ID="keyin1" runat="server"></asp:Literal></td>
</asp:PlaceHolder>
</tr>
</ItemTemplate>
</asp:Repeater>
</tbody>
</table>
</asp:PlaceHolder>
<asp:Panel ID="hr" runat="server" style="page-break-after: always;"></asp:Panel>
</ItemTemplate>
</asp:Repeater>
<asp:PlaceHolder ID="PlaceHolder1" runat="server" Visible="false">
<div >查無資料</div>
</asp:PlaceHolder>
</td>
</tr>
<tr style="background-color:antiquewhite;"><td><asp:Literal ID="count_data2" runat="server"></asp:Literal></td></tr>
</tbody>
</table>
</div>
</form>
<script src="print.js"></script>
<script type="text/javascript">
window.onload = function () {
window.print();
}
</script>
</body>
</html>

View File

@@ -0,0 +1,299 @@
using DocumentFormat.OpenXml.Drawing.Charts;
using DocumentFormat.OpenXml.Vml.Office;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class admin_follower_print_ : System.Web.UI.Page
{
private Model.ezEntities _db = new Model.ezEntities();
public MyWeb.encrypt encrypt = new MyWeb.encrypt();
List<Model.pro_order_detail> _detail = new List<Model.pro_order_detail>();
List<Model.bed_order_detail> _bedDt = new List<Model.bed_order_detail>();
Dictionary<int, string> tdesc = new Dictionary<int, string>();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
MyWeb.admin admin = new MyWeb.admin();
if ( admin.isLoign())
{
//紀錄匯出條件
string _query = "";
var qry = _db.pro_order.AsEnumerable();
if (!string.IsNullOrEmpty(Request["order_no"]))
{
qry = qry.Where(o => o.order_no.Contains(Request["order_no"].Trim()));
_query += "單號:" + Request["order_no"].Trim() + "\n";
}
if (!string.IsNullOrEmpty(Request["subject"]))
{
qry = qry.Where(o => o.activity_num.HasValue && o.activity.subject.Contains(Request["subject"].Trim()));
_query += "報名活動:" + Request["subject"].Trim() + "\n";
}
if (!string.IsNullOrEmpty(Request["u_name"]))
{
qry = qry.Where(o => o.f_num.HasValue && o.follower.u_name.Contains(Request["u_name"].Trim()));
_query += "姓名/名稱:" + Request["u_name"].Trim() + "\n";
}
if (!string.IsNullOrEmpty(Request["introducerTxt"]))
{
qry = qry.Where(o => o.introducer.HasValue && o.follower1.u_name.Contains(Request["introducerTxt"].Trim()));
_query += "介紹人:" + Request["introducerTxt"].Trim() + "\n";
}
if (!string.IsNullOrEmpty(Request["actItemTxt"]))
{
qry = qry.Where(o => o.pro_order_detail.Where(f2 => f2.actItem_num.HasValue && f2.actItem.subject.Contains(Request["actItemTxt"].Trim()) ).Count() > 0);
_query += "品項:" + Request["actItemTxt"].Trim() + "\n";
}
if (!string.IsNullOrEmpty(Request["keyin1"]))
{
qry = qry.Where(o => o.keyin1==Request["keyin1"].ToString());
_query += "單據狀態:" + Model.pro_order.keyin1_value_to_text( Request["keyin1"].Trim()) + "\n";
}
if (!string.IsNullOrEmpty(Request["address"]))
{
qry = qry.Where(o => o.address.Contains(Request["address"].Trim()));
_query += "地址:" + Request["address"].Trim() + "\n";
}
if (!string.IsNullOrEmpty(Request["up_time1"]))
{
qry = qry.Where(o => o.up_time >= Convert.ToDateTime(Request["up_time1"].Trim()));
_query += "報名日期(起):" + Convert.ToDateTime(Request["up_time1"].Trim()).ToString("yyyy/MM/dd") + "\n";
}
if (!string.IsNullOrEmpty(Request["up_time2"]) )
{
qry = qry.Where(o => o.up_time < Convert.ToDateTime(Request["up_time2"]).AddDays(1));
_query += "報名日期(訖):" + Convert.ToDateTime(Request["up_time2"].Trim()).ToString("yyyy/MM/dd") + "\n";
}
if (!string.IsNullOrEmpty(Request["country"]))
{
qry = qry.Where(o => o.f_num != null && o.follower?.country == Request["country"]);
_query += "國家:" + (_db.countries.AsEnumerable().Where(x => x.ID == Request["country"]).Select(x => x.name_zh).FirstOrDefault()??"") + "\n";
}
if (!string.IsNullOrEmpty(Request["country2"]))
{
if (Request["country2"] == "1")
{
qry = qry.Where(o => o.f_num != null && o.follower?.country == "158");
}
else if (Request["country2"] == "2")
{
qry = qry.Where(o => o.f_num != null && o.follower?.country != "158");
}
_query += "國家:" + (_db.countries.AsEnumerable().Where(x => x.ID == Request["country2"]).Select(x => x.name_zh).FirstOrDefault()??"") + "\n";
}
if (!string.IsNullOrEmpty(Request["hasPrice"]))
{
if (Request["hasPrice"].ToString() == "Y")
{
_query += "有金額\n";
}
else if (Request["hasPrice"].ToString() == "N")
{
_query += "無金額\n";
}
}
//管理報表
if (!string.IsNullOrEmpty(Request["year"]))
{
title.Text = "報名管理報表";
qry = qry.Where(o => o.up_time.HasValue && o.up_time.Value.Year == Convert.ToInt32(Request["year"]));
_query += "年份:" + Request["year"] + "\n";
}
if (!string.IsNullOrEmpty(Request["month"]))
{
qry = qry.Where(o => o.up_time.HasValue && o.up_time.Value.Month == Convert.ToInt32(Request["month"]));
_query += "月份:" + Request["month"] + "\n";
}
if (!string.IsNullOrEmpty(Request["season"]))
{
if (Request["season"] == "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 (Request["season"] == "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 (Request["season"] == "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 (Request["season"] == "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 += "季度:" + Request["season"] + "\n";
}
if (!string.IsNullOrEmpty(Request["chk_hasact"]) && Convert.ToBoolean(Request["chk_hasact"]) )
{
_query += "活動報名\n";
if (!string.IsNullOrEmpty(Request["chk_noact"]) && Convert.ToBoolean(Request["chk_noact"]))
{
_query += "非活動報名\n";
if (!string.IsNullOrEmpty(Request["select_act"]) && Convert.ToInt32(Request["select_act"]) > 0)
{
qry = qry.Where(o => o.activity_num.HasValue && o.activity_num.Value == Convert.ToInt32(Request["select_act"]));
}
}
else
{
qry = qry.Where(o => o.activity_num.HasValue);
if (!string.IsNullOrEmpty(Request["select_act"]) && Convert.ToInt32(Request["select_act"]) > 0)
{
qry = qry.Where(o => o.activity_num.Value == Convert.ToInt32(Request["select_act"]));
}
}
}
else
{
if (!string.IsNullOrEmpty(Request["chk_noact"]) && Convert.ToBoolean(Request["chk_noact"]))
{
qry = qry.Where(o => o.activity_num==null);
_query += "非活動報名\n";
}
}
if (!string.IsNullOrEmpty(Request["select_actitem"]) && Convert.ToInt32(Request["select_actitem"]) > 0)
{
qry = qry.Where(o => o.pro_order_detail.Where(f2 => f2.actItem_num.HasValue && f2.actItem_num.Value == Convert.ToInt32(Request["select_actitem"])).Count() > 0);
}
if (!string.IsNullOrEmpty(Request["year"]))
qry = qry.OrderByDescending(o => o.activity?.startDate_solar).ThenByDescending(o=>o.up_time).ThenByDescending(o=>o.order_no);
else
qry = qry.OrderByDescending(o => o.order_no);
//紀錄匯出條件
var prod= qry.ToList();
if (prod.Count > 0)
{
tdesc = publicFun.enum_desc<Model.pro_order.detailKeyin1>();
//明細
_detail = _db.pro_order_detail.AsEnumerable().Where(x => prod.Select(o => o.order_no).Contains( x.order_no)).ToList();
_bedDt = _db.bed_order_detail.AsEnumerable().Where(x => prod.Select(o => o.order_no).Contains( x.bed_order.order_no)).ToList();
Repeater1.DataSource = prod;
Repeater1.DataBind();
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.Print, admin_log.LogViewBtn(prod.Select(x => x.order_no).ToList()));
}
else
{
PlaceHolder1.Visible = true;
//Response.Clear();
//Response.StatusCode = 404;
//Response.End();
}
string _data = "列印時間 : " + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
_data += "<br>列印帳號 : " + admin.info.u_id;
_data += "<br>列印條件 : " + (!string.IsNullOrEmpty(_query) ? _query : "-");
footer.Text = _data;
if (Request["hasPrice"].ToString() == "Y")
{
((Panel)Repeater1.Items[Repeater1.Items.Count - 1].FindControl("hr")).Visible = false;
int _total = 0;
int _item_qty = 0;
foreach (RepeaterItem gItem in Repeater1.Items)
{
Repeater rpt = (Repeater)gItem.FindControl("Repeater2");
foreach (RepeaterItem rItem in rpt.Items)
{
Literal item_price = (Literal)rItem.FindControl("item_price");
Literal item_qty = (Literal)rItem.FindControl("item_qty");
_total += Convert.ToInt32(item_price.Text) * Convert.ToInt32(item_qty.Text);
_item_qty += Convert.ToInt32(item_qty.Text);
}
}
_data = "報名單筆數 : " + Repeater1.Items.Count;
_data += "</td><td>項目數量合計 : " + _item_qty;
_data += "</td><td>金額合計 : $" + _total;
count_data.Text = _data;
count_data2.Text = _data;
}
}
else
{
Response.Clear();
Response.StatusCode = 404;
Response.End();
}
}
}
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
Model.pro_order row = (Model.pro_order)e.Item.DataItem;
((Literal)e.Item.FindControl("keyin1")).Text = Model.pro_order.keyin1_value_to_text(row.keyin1);
((Literal)e.Item.FindControl("f_numTxt")).Text = row.f_num.HasValue ? row.follower.u_name : "";
((Literal)e.Item.FindControl("activityTxt")).Text = row.activity_num.HasValue ? row.activity.subject : "";
Repeater Repeater2 = (Repeater)e.Item.FindControl("Repeater2");
var _ds = _detail.Where(x => x.order_no == row.order_no).ToList();
if (_ds .Count>0) {
((PlaceHolder)e.Item.FindControl("detailTable")).Visible = true;
Repeater2.DataSource = _ds;
Repeater2.DataBind();
((PlaceHolder)e.Item.FindControl("PlaceHolder2")).Visible = Request["hasPrice"].ToString() == "Y";
}
}
protected void Repeater2_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
Model.pro_order_detail row = (Model.pro_order_detail)e.Item.DataItem;
Literal actitem_numTxt = (Literal)e.Item.FindControl("actitem_numTxt");
actitem_numTxt.Text = row.actItem_num.HasValue ? row.actItem.subject : "";
((Literal)e.Item.FindControl("f_numTxt")).Text = row.f_num.HasValue ? row.follower.u_name : "";
((Literal)e.Item.FindControl("from_idTxt")).Text = row.from_id.HasValue ? row.follower1.u_name : "";
((Literal)e.Item.FindControl("due_date")).Text = row.due_date.HasValue? row.due_date.Value.ToString("yyyy-MM-dd"):"";
// ((Literal)e.Item.FindControl("start_date")).Text = row.start_date.HasValue? row.start_date.Value.ToString("yyyy-MM-dd"):"";
((Literal)e.Item.FindControl("extend_date")).Text = row.extend_date.HasValue? row.extend_date.Value.ToString("yyyy-MM-dd"):"";
//劃位狀態
int writeBedQty = _bedDt.Where(b => 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.o_detail_id == row.num && (!b.checkIn_date.HasValue || !b.bed_kind_detail_id.HasValue)).Count(); //未劃數量
((Literal)e.Item.FindControl("BedQty")).Text = (Convert.ToInt32(row.actItem?.category) == (int)Model.activity.category.Order) ? (notBedQty + "/" + writeBedQty) : "";
((Literal)e.Item.FindControl("keyin1")).Text = row.keyin1.HasValue && row.keyin1.Value > 0 ? tdesc[row.keyin1 ?? 1] : "";
((PlaceHolder)e.Item.FindControl("PlaceHolder2")).Visible = Request["hasPrice"].ToString() == "Y";
}
}

2597
web/admin/order/reg.aspx Normal file

File diff suppressed because it is too large Load Diff

270
web/admin/order/reg.aspx.cs Normal file
View File

@@ -0,0 +1,270 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
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
{
private Model.ezEntities _db = new Model.ezEntities();
public string _activity_id = "";
public string _follower_id = "";
public string _org_from_id_cuz_data = "";
public string _org_activity_cuz_data = "";
public Dictionary<int, string> _keyin1Item = null;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Model.pro_order order = new Model.pro_order();
ArrayList options = order.keyin1_list();
foreach (Model.pro_order.keyin optionKey in options)
{
ListItem item = new ListItem(optionKey.Text, optionKey.Value);
item.Attributes.Add("style", "color:" + optionKey.Color);
keyin1.Items.Add(item);
}
_keyin1Item = publicFun.enum_desc<Model.pro_order.detailKeyin1>(); //報名狀態
if (isStrNull(Request["order_no"]))
{
up_time.Text =DateTime.Now.ToString("yyyy-MM-dd");
}
else
{
var qry = _db.pro_order.AsEnumerable();
var prod = qry.Where(q => q.order_no == Convert.ToString(Request["order_no"])).FirstOrDefault();
if (prod != null)
{
MyWeb.encrypt encrypt = new MyWeb.encrypt();
order_no.Text = prod.order_no.ToString();
if (prod.up_time.HasValue)
{
up_time.Text = prod.up_time.Value.ToString("yyyy-MM-dd");
up_time2.Text = "<div class='pt-2' id='titleDate'>" + prod.up_time.Value.ToString("yyyy-MM-dd") + "</div>";
}
keyin1.SelectedValue = prod.keyin1.ToString();
if (prod.f_num.HasValue)
{
f_num_txt.Value = prod.follower.u_name.ToString();
f_num_txt_link.Text = prod.follower.u_name.ToString();
f_num_txt_link.NavigateUrl = "../follower/reg.aspx?num="+ prod.f_num.ToString();
f_num.Value = prod.f_num.ToString();
_follower_id= prod.f_num.ToString();
}
if (prod.introducer.HasValue)
{
introducer_txt.Value = prod.follower1.u_name.ToString();
introducer.Value = prod.introducer.ToString();
}
if (!isStrNull(prod.phone)) { phone.Text = encrypt.DecryptAutoKey(prod.phone); }
if (prod.activity_num.HasValue)
{
activity_num_txt.Value = prod.activity.subject.ToString();
activity_num_txt2.Text = "<div class='pt-2'>" + prod.activity.subject.ToString() + "</div>";
activity_num.Value = prod.activity_num.ToString();
_activity_id = prod.activity_num.ToString();
}
address.Text = prod.address.ToString();
if (prod.receipt_title != null)
{
receipt_title.Text = prod.receipt_title?.ToString();
}
send_receipt.Checked = prod.send_receipt.HasValue ? prod.send_receipt.Value : false;
demo.Text = prod.demo.ToString();
customize_data.Text = prod.customize_data;
_org_from_id_cuz_data = prod.f_num.HasValue ? prod.follower.customize_data?.Replace(Convert.ToString((char)10), "").Replace(Convert.ToString((char)13), "") ?? "" : "";
_org_activity_cuz_data = prod.activity_num.HasValue ? prod.activity.customize_data?.Replace(Convert.ToString((char)10), "").Replace(Convert.ToString((char)13), "") ?? "" : "";
if (prod.reg_time.HasValue)
{
timePanel1.Visible = true;
reg_time.Text = prod.reg_time.Value.ToString("yyyy/MM/dd HH:mm:ss");
}
activity_numPH.Visible = false;
f_numPH.Visible = false;
up_timePH.Visible = false;
edit.Visible = true;
goback.Visible = true;
add.Visible = false;
}
else
{
Response.Redirect("index.aspx");
}
}
}
}
protected void goback_Click(object sender, EventArgs e)
{
Response.Redirect("index.aspx?page=" + Convert.ToString(Request["page"]));
}
#region
protected string createOrderNumber()
{
Application.Lock();
string order_no = "AA" + DateTime.Now.ToString("yyMMdd");
var qry = _db.companies.AsEnumerable();
//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)
{
L_msg.Text = "";
MyWeb.encrypt encrypt = new MyWeb.encrypt();
Model.pro_order pro_order = new Model.pro_order();//新增
pro_order.order_no = createOrderNumber();
if (isDate(up_time.Text)) { pro_order.up_time = ValDate(up_time.Text); }
pro_order.reg_time = DateTime.Now;
pro_order.keyin1 = keyin1.SelectedValue;
if (IsNumeric(f_num.Value)) { pro_order.f_num = Val(f_num.Value); }
if (!isStrNull(phone.Text)) { pro_order.phone = encrypt.EncryptAutoKey(phone.Text); }
if (IsNumeric(activity_num.Value)) { pro_order.activity_num = Val(activity_num.Value); }
pro_order.address = address.Text;
pro_order.receipt_title = receipt_title.Text;
pro_order.send_receipt = send_receipt.Checked;
pro_order.demo = demo.Text;
pro_order.customize_data = customize_data.Text;
if (IsNumeric(introducer.Value)) { pro_order.introducer = Val(introducer.Value); }
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);
string url = "index.aspx";
url = "reg.aspx?order_no=" + pro_order.order_no;
Response.Redirect(url);
}
else
{
L_msg.Type = alert_type.danger;
L_msg.Text = "報名單號錯誤";
}
}
catch (Exception ex)
{
L_msg.Type = alert_type.danger;
//L_msg.Text = ex.InnerException.Message;
L_msg.Text = "操作失敗";
}
}
}
#endregion
#region
protected void edit_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
L_msg.Text = "";
string _orderNo = Request["order_no"].ToString();
MyWeb.encrypt encrypt = new MyWeb.encrypt();
Model.pro_order pro_order = _db.pro_order.Where(q => q.order_no == _orderNo).FirstOrDefault();//修改
if (pro_order != null)
{
//if (isDate(up_time.Text)) { pro_order.up_time = ValDate(up_time.Text); }
pro_order.keyin1 = keyin1.SelectedValue;
if (!isStrNull(phone.Text)) { pro_order.phone = encrypt.EncryptAutoKey(phone.Text); }
pro_order.address = address.Text;
pro_order.receipt_title = receipt_title.Text;
pro_order.send_receipt = send_receipt.Checked;
pro_order.demo = demo.Text;
pro_order.customize_data = customize_data.Text;
if (IsNumeric(introducer.Value)) { pro_order.introducer = Val(introducer.Value); }
try
{
_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.Update, pro_order.order_no);
//Response.Redirect("index.aspx?page=" + Convert.ToString(Request["page"]));
}
catch (Exception ex)
{
L_msg.Type = alert_type.danger;
//L_msg.Text = ex.Message;
L_msg.Text = "操作失敗";
}
}
else
{
L_msg.Type = alert_type.danger;
L_msg.Text = "查無資料";
}
}
}
#endregion
}