0.1 #4

Open
minom wants to merge 9 commits from 0.1 into dapper
24 changed files with 1505 additions and 542 deletions
Showing only changes of commit 7644df57d0 - Show all commits
+38 -38
View File
@@ -1,9 +1,9 @@
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// <auto-generated>
// 這個程式碼是由範本產生。
// 這個程式碼是由範本產生。
//
// 對這個檔案進行手動變更可能導致您的應用程式產生未預期的行為。
// 如果重新產生程式碼,將會覆寫對這個檔案的手動變更。
// 對這個檔案進行手動變更可能導致您的應用程式產生未預期的行為。
// 如果重新產生程式碼,將會覆寫對這個檔案的手動變更。
// </auto-generated>
//------------------------------------------------------------------------------
@@ -14,19 +14,19 @@ namespace Model
using System.Data.Entity.Infrastructure;
using System.Data.Entity.Core.Objects;
using System.Linq;
public partial class ezEntities : DbContext
{
public ezEntities()
: base("name=ezEntities")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
public virtual DbSet<accounting> accountings { get; set; }
public virtual DbSet<accounting_files> accounting_files { get; set; }
public virtual DbSet<accounting_kind> accounting_kind { get; set; }
@@ -94,134 +94,134 @@ namespace Model
public virtual DbSet<AncestralTabletRegistrant> AncestralTabletRegistrant { get; set; }
public virtual DbSet<AncestralTabletStatus> AncestralTabletStatus { get; set; }
public virtual DbSet<GuaDanOrderGuest> GuaDanOrderGuest { get; set; }
public virtual int pager_eztrust(Nullable<int> startRowIndex, Nullable<int> pageSize, string tableName, string columnName, string sqlWhere, string orderBy, ObjectParameter rowCount)
{
var startRowIndexParameter = startRowIndex.HasValue ?
new ObjectParameter("StartRowIndex", startRowIndex) :
new ObjectParameter("StartRowIndex", typeof(int));
var pageSizeParameter = pageSize.HasValue ?
new ObjectParameter("PageSize", pageSize) :
new ObjectParameter("PageSize", typeof(int));
var tableNameParameter = tableName != null ?
new ObjectParameter("tableName", tableName) :
new ObjectParameter("tableName", typeof(string));
var columnNameParameter = columnName != null ?
new ObjectParameter("columnName", columnName) :
new ObjectParameter("columnName", typeof(string));
var sqlWhereParameter = sqlWhere != null ?
new ObjectParameter("sqlWhere", sqlWhere) :
new ObjectParameter("sqlWhere", typeof(string));
var orderByParameter = orderBy != null ?
new ObjectParameter("orderBy", orderBy) :
new ObjectParameter("orderBy", typeof(string));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("pager_eztrust", startRowIndexParameter, pageSizeParameter, tableNameParameter, columnNameParameter, sqlWhereParameter, orderByParameter, rowCount);
}
public virtual int sp_alterdiagram(string diagramname, Nullable<int> owner_id, Nullable<int> version, byte[] definition)
{
var diagramnameParameter = diagramname != null ?
new ObjectParameter("diagramname", diagramname) :
new ObjectParameter("diagramname", typeof(string));
var owner_idParameter = owner_id.HasValue ?
new ObjectParameter("owner_id", owner_id) :
new ObjectParameter("owner_id", typeof(int));
var versionParameter = version.HasValue ?
new ObjectParameter("version", version) :
new ObjectParameter("version", typeof(int));
var definitionParameter = definition != null ?
new ObjectParameter("definition", definition) :
new ObjectParameter("definition", typeof(byte[]));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_alterdiagram", diagramnameParameter, owner_idParameter, versionParameter, definitionParameter);
}
public virtual int sp_creatediagram(string diagramname, Nullable<int> owner_id, Nullable<int> version, byte[] definition)
{
var diagramnameParameter = diagramname != null ?
new ObjectParameter("diagramname", diagramname) :
new ObjectParameter("diagramname", typeof(string));
var owner_idParameter = owner_id.HasValue ?
new ObjectParameter("owner_id", owner_id) :
new ObjectParameter("owner_id", typeof(int));
var versionParameter = version.HasValue ?
new ObjectParameter("version", version) :
new ObjectParameter("version", typeof(int));
var definitionParameter = definition != null ?
new ObjectParameter("definition", definition) :
new ObjectParameter("definition", typeof(byte[]));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_creatediagram", diagramnameParameter, owner_idParameter, versionParameter, definitionParameter);
}
public virtual int sp_dropdiagram(string diagramname, Nullable<int> owner_id)
{
var diagramnameParameter = diagramname != null ?
new ObjectParameter("diagramname", diagramname) :
new ObjectParameter("diagramname", typeof(string));
var owner_idParameter = owner_id.HasValue ?
new ObjectParameter("owner_id", owner_id) :
new ObjectParameter("owner_id", typeof(int));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_dropdiagram", diagramnameParameter, owner_idParameter);
}
public virtual ObjectResult<sp_helpdiagramdefinition_Result> sp_helpdiagramdefinition(string diagramname, Nullable<int> owner_id)
{
var diagramnameParameter = diagramname != null ?
new ObjectParameter("diagramname", diagramname) :
new ObjectParameter("diagramname", typeof(string));
var owner_idParameter = owner_id.HasValue ?
new ObjectParameter("owner_id", owner_id) :
new ObjectParameter("owner_id", typeof(int));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<sp_helpdiagramdefinition_Result>("sp_helpdiagramdefinition", diagramnameParameter, owner_idParameter);
}
public virtual ObjectResult<sp_helpdiagrams_Result> sp_helpdiagrams(string diagramname, Nullable<int> owner_id)
{
var diagramnameParameter = diagramname != null ?
new ObjectParameter("diagramname", diagramname) :
new ObjectParameter("diagramname", typeof(string));
var owner_idParameter = owner_id.HasValue ?
new ObjectParameter("owner_id", owner_id) :
new ObjectParameter("owner_id", typeof(int));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<sp_helpdiagrams_Result>("sp_helpdiagrams", diagramnameParameter, owner_idParameter);
}
public virtual int sp_renamediagram(string diagramname, Nullable<int> owner_id, string new_diagramname)
{
var diagramnameParameter = diagramname != null ?
new ObjectParameter("diagramname", diagramname) :
new ObjectParameter("diagramname", typeof(string));
var owner_idParameter = owner_id.HasValue ?
new ObjectParameter("owner_id", owner_id) :
new ObjectParameter("owner_id", typeof(int));
var new_diagramnameParameter = new_diagramname != null ?
new ObjectParameter("new_diagramname", new_diagramname) :
new ObjectParameter("new_diagramname", typeof(string));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_renamediagram", diagramnameParameter, owner_idParameter, new_diagramnameParameter);
}
public virtual int sp_upgraddiagrams()
{
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_upgraddiagrams");
File diff suppressed because it is too large Load Diff
+26 -29
View File
@@ -91,6 +91,7 @@
<Property Name="customize_data" Type="nvarchar(max)" />
<Property Name="reg_time" Type="datetime" />
<Property Name="is_reconcile" Type="nvarchar" MaxLength="1" />
<Property Name="sort_order" Type="int" />
</EntityType>
<EntityType Name="actItem_files">
<Key>
@@ -480,7 +481,7 @@
<Property Name="country" Type="nvarchar" MaxLength="5" />
<Property Name="appellation_id" Type="int" />
<Property Name="follower_hash" Type="nvarchar" MaxLength="100" />
<Property Name="search_keywords" Type="nvarchar(max)" />
<Property Name="search_keywords" Type="varchar(max)" />
</EntityType>
<EntityType Name="followers_tablet">
<Key>
@@ -604,8 +605,8 @@
</Key>
<Property Name="num" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="kind" Type="nvarchar" MaxLength="100" />
<Property Name="starttime" Type="time" Precision="0" />
<Property Name="offtime" Type="time" Precision="0" />
<Property Name="starttime" Type="time" Precision="7" />
<Property Name="offtime" Type="time" Precision="7" />
<Property Name="resttime" Type="int" />
<Property Name="root" Type="int" />
<Property Name="range" Type="int" />
@@ -980,7 +981,7 @@
<Property Name="balance_act_item" Type="int" />
<Property Name="balance_pro_order_detail" Type="int" />
</EntityType>
<Association Name="FK__Ancestral__Regis__4DF47A4E">
<Association Name="FK__Ancestral__Regis__1A9EF37A">
<End Role="AncestralTabletRegistrant" Type="Self.AncestralTabletRegistrant" Multiplicity="1" />
<End Role="AncestralTabletPositionRecord" Type="Self.AncestralTabletPositionRecord" Multiplicity="*" />
<ReferentialConstraint>
@@ -1079,7 +1080,9 @@
</ReferentialConstraint>
</Association>
<Association Name="FK_act_bom_actItem1">
<End Role="actItem" Type="Self.actItem" Multiplicity="0..1" />
<End Role="actItem" Type="Self.actItem" Multiplicity="0..1">
<OnDelete Action="Cascade" />
</End>
<End Role="act_bom" Type="Self.act_bom" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="actItem">
@@ -1128,18 +1131,6 @@
</Dependent>
</ReferentialConstraint>
</Association>
<Association Name="FK_activity_activity_kind">
<End Role="activity_kind" Type="Self.activity_kind" Multiplicity="0..1" />
<End Role="activity" Type="Self.activity" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="activity_kind">
<PropertyRef Name="num" />
</Principal>
<Dependent Role="activity">
<PropertyRef Name="kind" />
</Dependent>
</ReferentialConstraint>
</Association>
<Association Name="FK_activity_check_activity">
<End Role="activity" Type="Self.activity" Multiplicity="0..1">
<OnDelete Action="Cascade" />
@@ -1211,7 +1202,9 @@
</ReferentialConstraint>
</Association>
<Association Name="FK_activity_relating_activity">
<End Role="activity" Type="Self.activity" Multiplicity="1" />
<End Role="activity" Type="Self.activity" Multiplicity="1">
<OnDelete Action="Cascade" />
</End>
<End Role="activity_relating" Type="Self.activity_relating" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="activity">
@@ -1637,7 +1630,9 @@
</ReferentialConstraint>
</Association>
<Association Name="FK_pro_order_activity">
<End Role="activity" Type="Self.activity" Multiplicity="0..1" />
<End Role="activity" Type="Self.activity" Multiplicity="0..1">
<OnDelete Action="Cascade" />
</End>
<End Role="pro_order" Type="Self.pro_order" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="activity">
@@ -1687,7 +1682,9 @@
</ReferentialConstraint>
</Association>
<Association Name="FK_pro_order_detail_pro_order">
<End Role="pro_order" Type="Self.pro_order" Multiplicity="1" />
<End Role="pro_order" Type="Self.pro_order" Multiplicity="1">
<OnDelete Action="Cascade" />
</End>
<End Role="pro_order_detail" Type="Self.pro_order_detail" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="pro_order">
@@ -1699,7 +1696,9 @@
</ReferentialConstraint>
</Association>
<Association Name="FK_pro_order_followers">
<End Role="followers" Type="Self.followers" Multiplicity="0..1" />
<End Role="followers" Type="Self.followers" Multiplicity="0..1">
<OnDelete Action="Cascade" />
</End>
<End Role="pro_order" Type="Self.pro_order" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="followers">
@@ -2157,7 +2156,7 @@
<EntitySet Name="supplier" EntityType="Self.supplier" Schema="dbo" store:Type="Tables" />
<EntitySet Name="supplier_kind" EntityType="Self.supplier_kind" Schema="dbo" store:Type="Tables" />
<EntitySet Name="transfer_register" EntityType="Self.transfer_register" Schema="dbo" store:Type="Tables" />
<AssociationSet Name="FK__Ancestral__Regis__4DF47A4E" Association="Self.FK__Ancestral__Regis__4DF47A4E">
<AssociationSet Name="FK__Ancestral__Regis__1A9EF37A" Association="Self.FK__Ancestral__Regis__1A9EF37A">
<End Role="AncestralTabletRegistrant" EntitySet="AncestralTabletRegistrant" />
<End Role="AncestralTabletPositionRecord" EntitySet="AncestralTabletPositionRecord" />
</AssociationSet>
@@ -2205,10 +2204,6 @@
<End Role="activity_category_kind" EntitySet="activity_category_kind" />
<End Role="activity" EntitySet="activity" />
</AssociationSet>
<AssociationSet Name="FK_activity_activity_kind" Association="Self.FK_activity_activity_kind">
<End Role="activity_kind" EntitySet="activity_kind" />
<End Role="activity" EntitySet="activity" />
</AssociationSet>
<AssociationSet Name="FK_activity_check_activity" Association="Self.FK_activity_check_activity">
<End Role="activity" EntitySet="activity" />
<End Role="activity_check" EntitySet="activity_check" />
@@ -2613,6 +2608,7 @@
<Property Name="print_init" Type="String" MaxLength="100" FixedLength="false" Unicode="true" />
<NavigationProperty Name="transfer_register" Relationship="Model.FK_transfer_register_actItem" FromRole="actItem" ToRole="transfer_register" />
<Property Name="is_reconcile" Type="String" MaxLength="1" FixedLength="false" Unicode="true" />
<Property Name="sort_order" Type="Int32" />
</EntityType>
<EntityType Name="actItem_files">
<Key>
@@ -2972,7 +2968,7 @@
<NavigationProperty Name="transfer_register" Relationship="Model.FK_transfer_register_followers" FromRole="follower" ToRole="transfer_register" />
<NavigationProperty Name="transfer_register1" Relationship="Model.FK_transfer_register_followers_match" FromRole="follower" ToRole="transfer_register" />
<NavigationProperty Name="GuaDanOrder" Relationship="Model.FK_GuaDanOrder_Followers" FromRole="follower" ToRole="GuaDanOrder" />
<Property Name="search_keywords" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
<Property Name="search_keywords" Type="String" MaxLength="Max" FixedLength="false" Unicode="false" />
<NavigationProperty Name="GuaDanOrderGuest" Relationship="Model.FK_GuaDanOrderGuest_FOLLOWERS" FromRole="follower" ToRole="GuaDanOrderGuest" />
</EntityType>
<EntityType Name="followers_tablet">
@@ -3062,8 +3058,8 @@
</Key>
<Property Name="num" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="kind" Type="String" MaxLength="100" FixedLength="false" Unicode="true" />
<Property Name="starttime" Type="Time" Precision="0" />
<Property Name="offtime" Type="Time" Precision="0" />
<Property Name="starttime" Type="Time" Precision="7" />
<Property Name="offtime" Type="Time" Precision="7" />
<Property Name="resttime" Type="Int32" />
<Property Name="root" Type="Int32" />
<Property Name="range" Type="Int32" />
@@ -5334,6 +5330,7 @@
<EntitySetMapping Name="actItems">
<EntityTypeMapping TypeName="Model.actItem">
<MappingFragment StoreEntitySet="actItem">
<ScalarProperty Name="sort_order" ColumnName="sort_order" />
<ScalarProperty Name="is_reconcile" ColumnName="is_reconcile" />
<ScalarProperty Name="print_init" ColumnName="print_init" />
<ScalarProperty Name="partno" ColumnName="partno" />
+4 -2
View File
@@ -151,8 +151,10 @@ public class FollowerController : ApiController
qry = qry.Where(o => o.u_name.Contains(q.u_name.Trim()));
if (q.birthday.HasValue)
qry = qry.Where(o => o.birthday >= q.birthday.Value);
if (q.birthday2.HasValue)
qry = qry.Where(o => o.birthday < Convert.ToDateTime(q.birthday2.Value).AddDays(1));
if (q.birthday2.HasValue) {
var tmpBirthday2 = Convert.ToDateTime(q.birthday2.Value).AddDays(1);
qry = qry.Where(o => o.birthday < tmpBirthday2);
}
if (!string.IsNullOrEmpty(q.address))
qry = qry.Where(o => o.address !=null && o.address.Contains(q.address.Trim()));
//if (q.num.HasValue && q.num.Value>0)
+40 -2
View File
@@ -1,4 +1,5 @@
using DocumentFormat.OpenXml.Drawing.Spreadsheet;
using Model;
using Newtonsoft.Json;
using Org.BouncyCastle.Crypto;
using PagedList;
@@ -10,6 +11,7 @@ using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Services;
using static TreeView;
// api/activity
@@ -326,6 +328,36 @@ public class activityController : ApiController
return Ok(ret);
}
public class SortOrderRequest
{
public List<int> ids { get; set; }
}
[HttpPost]
[Route("api/activity/SaveItemList")]
public IHttpActionResult UpdateSortOrder([FromBody] SortOrderRequest request)
{
if (request == null || request.ids == null) return BadRequest();
using (Model.ezEntities _db = new Model.ezEntities())
{
int totalCount = request.ids.Count;
for (int i = 0; i < totalCount; i++)
{
int id = request.ids[i];
var item = _db.actItems.FirstOrDefault(x => x.num == id);
if (item != null)
{
// 改成總數減去索引,這樣第一筆 (i=0) 會拿到最大的數字
item.sort_order = totalCount - i;
}
}
_db.SaveChanges();
}
return Ok();
}
[HttpPost]
[Route("api/activity/GetItemList")]
public IHttpActionResult GetItemList([FromBody] Model.ViewModel.actItem q, int page, int pageSize = 10,
@@ -430,8 +462,14 @@ public class activityController : ApiController
else
qry = qry.OrderBy(o => o.status);
}
else
else if (sortBy.Equals("num"))
{
qry = qry.OrderByDescending(o => o.num);
}
else
{
qry = qry.OrderByDescending(o => o.sort_order);
}
var tdesc = publicFun.enum_desc<Model.activity.category>();
var count = qry.Count(); //pageSize = count;//一次取回??
@@ -1315,7 +1353,7 @@ public class activityController : ApiController
[Route("api/activity/OrderCheckIn")]
public IHttpActionResult OrderCheckIn([FromBody] Model.activity_check item)
{
if (item.f_num.HasValue && item.activity_num.HasValue && item.qty.HasValue && item.status.HasValue)
if (item.f_num.HasValue && item.activity_num.HasValue && item.status.HasValue)
{
//同一天不能簽到兩次以上
Model.activity_check check = _db.activity_check
+14 -2
View File
@@ -4,6 +4,7 @@ using MyWeb;
using Newtonsoft.Json;
using PagedList;
using System;
using System.Activities.Expressions;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
@@ -207,7 +208,7 @@ public class orderController : ApiController
string sortBy = "", bool sortDesc = false)
{
var qry = _db.pro_order.AsQueryable();
var qry = _db.pro_order.Include("activity").Include("activity.activity_check").AsQueryable();
//var aIDt = _db.actItems.AsEnumerable().Where(f => f.subject.Contains(q.actItemTxt.Trim())).Select(f => f.num);//品項
@@ -222,7 +223,10 @@ public class orderController : ApiController
if (q.up_time1.HasValue)
qry = qry.Where(o => o.up_time >= q.up_time1.Value);
if (q.up_time2.HasValue)
qry = qry.Where(o => o.up_time < Convert.ToDateTime(q.up_time2.Value).AddDays(1));
{
var tmp_up_time2 = Convert.ToDateTime(q.up_time2.Value).AddDays(1);
qry = qry.Where(o => o.up_time < tmp_up_time2);
}
if (!string.IsNullOrEmpty(q.address))
qry = qry.Where(o => o.address.Contains(q.address.Trim()));
if (!string.IsNullOrEmpty(q.subject))
@@ -292,6 +296,13 @@ public class orderController : ApiController
else
qry = qry.OrderBy(o => o.activity != null ? o.activity.subject : "");
}
else if(sortBy.Equals("status"))
{
if (sortDesc)
qry = qry.OrderByDescending(o => o.activity.activity_check.FirstOrDefault(a => o.activity_num == a.activity_num && o.f_num == a.f_num).status ?? 0);
else
qry = qry.OrderBy(o => o.activity.activity_check.FirstOrDefault(a => o.activity_num == a.activity_num && o.f_num == a.f_num).status ?? 0);
}
else
qry = qry.OrderByDescending(o => o.reg_time);
@@ -308,6 +319,7 @@ public class orderController : ApiController
keyin1 = x.keyin1,
up_time = x.up_time,
keyin1_txt = Model.pro_order.keyin1_value_to_text(x.keyin1),
status = x.activity.activity_check.FirstOrDefault(a => x.activity_num == a.activity_num && x.f_num == a.f_num)?.status ?? 0,
}),
count = count
};
+2 -1
View File
@@ -16,7 +16,8 @@
<asp:Repeater ID="Repeater2" runat="server" OnItemDataBound="Repeater2_ItemDataBound">
<ItemTemplate>
<a class="nav-link" href="<%#ResolveUrl(ValString(Eval("url"))) %>"
onclick="sessionStorage.removeItem('member_list_cache');sessionStorage.removeItem('member_query_params');"
onclick="sessionStorage.removeItem('member_list_cache'); sessionStorage.removeItem('member_query_params');
sessionStorage.removeItem('order_list_cache'); sessionStorage.removeItem('order_query_params');"
target="<%#(ValString(Eval("target"))=="B"?"_blank":"_self") %>">
<%#Eval("title") %></a>
</ItemTemplate>
+216 -115
View File
@@ -7,19 +7,20 @@
<div class="mb-2 mb-sm-0">
<ul class="nav ps-0">
<li class="nav-item pe-3">
<select class="form-select" v-model="search.kind" @change="btn_search">
<select class="form-select" v-model="search.kind" @change="btn_search" :disabled="isEditing">
<option value="">選擇分類</option>
<option v-for="item in itemKindList" :value="item.num">{{item.kind}}</option>
</select>
</li>
<li class="nav-item pe-1">
<a href="item_reg.aspx" class="btn btn-primary">
<a href="item_reg.aspx" class="btn btn-primary" :class="{ 'disabled': isEditing }" >
<i class="mdi mdi-plus"></i>新增
</a>
</li>
<li class="nav-item pe-1">
<a @click="deleteAll" class="btn btn-outline-danger" title="刪除勾選的資料" ><i class="mdi mdi-trash-can"></i> 刪除勾選</a>
</li>
<li class="nav-item pe-1">
<a @click="deleteAll" class="btn btn-outline-danger" title="刪除勾選的資料" :class="{ 'disabled': isEditing }" ><i class="mdi mdi-trash-can"></i> 刪除勾選</a>
</li>
</ul>
<%-- <div class="input-group mb-3" data-search-control="search1" @click="search_show(search_dialog.controls.search1)">
<input class="form-control search-text" type="text" readonly
@@ -29,26 +30,31 @@
<i class="mdi mdi-view-list-outline"></i>
</button>
</div>--%>
</div>
</div>
<div>
<div class="">
<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>
<a v-if="!isEditing" @click="editClick" class="btn btn-outline-secondary" title="編輯排列順序"><i class="mdi mdi-swap-vertical"></i> 編輯排列順序</a>
<a v-else @click="editClick" class="btn btn-outline-secondary" title="完成編輯排列順序"><i class="mdi mdi-swap-vertical"></i> 完成編輯</a>
<div :style="isEditing ? '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>
</div> </div>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="footer_script" runat="Server">
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.14.0/Sortable.min.js"></script>
<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({
let VueApp = new Vue({
el: '#app',
vuetify: new Vuetify(vuetify_options),
data() {
return {
isEditing: false,
options: { multiSort: false },
data_table: {
loading: true,
@@ -63,20 +69,20 @@
{ text: '項目分類', value: 'kindsTxt' },
{ text: '類別', value: 'categoryTxt' },
{ text: '預設金額', value: 'price' },
{ text: '庫存狀態', value: 'stock' },
{ text: '庫存狀態', value: 'stock' },
{ text: '停用', value: 'status' },
{ text: '', value: 'slot_btn', sortable: false, align: 'end' },
],
footer:{
footer: {
showFirstLastPage: true,
itemsPerPageOptions:[5,10,20,30],
itemsPerPageOptions: [5, 10, 20, 30],
},
},
search: {
kind: '',
subject: '',
selltime1:'',
selltime1: '',
selltime2: '',
uptime1: '',
uptime2: '',
@@ -98,7 +104,7 @@
{ id: 'kind', title: '品項分類', value: '' },
],
selected: {},
select(t,data) {
select(t, data) {
data.search.kind = t.num;
data.btn_search()
console.log("select search1", t);
@@ -120,9 +126,9 @@
}, snackbar: {
show: false,
text: "",
}, itemKindList:{
}, itemKindList: {
num: 0,
kind:''
kind: ''
}
}
},
@@ -149,9 +155,9 @@
if (!isNaN(actItemPage) && actItemPage !== 1) {
this.options.page = actItemPage;
}
}
}
},
methods: {
methods: {
initKindList() {
axios
//.get(HTTP_HOST + 'api/activity_kind')
@@ -174,26 +180,45 @@
},
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/GetItemList', 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))
},
editItem(item) {
console.log("edit", item);
if (this.isEditing) {
const { sortBy, sortDesc, page, itemsPerPage } = this.options
const params = {
sortBy: "sort_order", sortDesc: sortDesc[0],
page: clearpage ? '1' : page, pageSize: 0
};
this.data_table.loading = true
axios
.post(HTTP_HOST + 'api/activity/GetItemList', 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))
}
else {
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/GetItemList', 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) {
editItem(item) {
console.log("edit", item);
},
deleteItem(item) {
if (confirm('是否確定刪除此筆資料?')) {
const index = this.data_table.list.indexOf(item)
if (index != -1) {
@@ -203,7 +228,7 @@
this.getDefault();
})
.catch(error => console.log(error))
}
}
}
},
deleteAll() {
@@ -225,100 +250,155 @@
.catch(error => console.log(error))
}
},
btn_search() {
editClick() {
if (this.isEditing) {
this.isEditing = false;
const sortedIds = this.data_table.list.map(item => item.num);
axios.post(HTTP_HOST + 'api/activity/SaveItemList', { ids: sortedIds })
.then(response => {
this.isEditing = false;
this.getDefault();
})
.catch(error => {
alert("儲存排序失敗:" + error);
})
.finally(() => {
this.data_table.loading = false;
});
}
else {
this.isEditing = true;
this.getDefault()
}
},
btn_search() {
this.getDefault(true)
},
btn_all() {
clearObjProps(this.search);
this.btn_search()
},
//===
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;
});
},
//===
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;
});
console.log("search_get", api_url, search, params, this.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
console.log("search_get", api_url, search, params, this.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,
})
})
.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;
},
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;
},
saveOrder(event) {
const movedItem = this.data_table.list.splice(event.oldIndex, 1)[0];
this.data_table.list.splice(event.newIndex, 0, movedItem);
},
},
computed: {
pageCount() {
return Math.ceil(this.data_table.count / this.data_table.pageSize)
},
computedHeaders() {
return this.data_table.header.map(h => {
if (h.value === 'slot_btn') {
return { ...h, sortable: false };
}
return {
...h,
sortable: this.isEditing ? false : (h.sortable !== false)
};
});
},
},
filters: {
currency: function (value) {
return value == null || value == "" ? "" :
('$' + parseFloat(value).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1,").replace(".00", ""));
},
}
},
directives: {
sortableDataTable: {
bind(el, binding, vnode) {
const options = {
animation: 150,
onUpdate: function (event) {
vnode.child.$emit('sorted', event)
}
}
Sortable.create(el.getElementsByTagName('tbody')[0], options)
}
}
},
})
</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-data-table
v-sortable-data-table
@sorted="saveOrder"
:headers="computedHeaders"
v-model="data_table.selected"
:items="data_table.list"
:search-props="search"
@@ -332,8 +412,29 @@
show-select
hide-default-footer
:page.sync="data_table.page"
:items-per-page.sync="data_table.pageSize"
:items-per-page.sync= "isEditing ? -1 :data_table.pageSize"
class="elevation-1">
<template v-slot:header.data-table-select="{ on, props }">
<v-simple-checkbox
v-if="!isEditing"
v-bind="props"
v-on="on"
></v-simple-checkbox>
<v-icon v-else small>mdi-swap-vertical</v-icon>
</template>
<template v-slot:item.data-table-select="{ item, isSelected, select }">
<v-simple-checkbox
v-if="!isEditing"
:value="isSelected"
@input="select($event)"
></v-simple-checkbox>
<div v-else class="handle" style="cursor: grab;">
<v-icon color="grey darken-1">mdi-drag-vertical</v-icon>
</div>
</template>
<template #item.price="{ item }" >
{{item.price | currency }}
</template>
@@ -352,12 +453,12 @@
</template>
<template #item.slot_btn="{ item }">
<a :href="'item_reg.aspx?num='+item.num" 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 #item.slot_btn="{ item }" >
<a v-if="!isEditing" :href="'item_reg.aspx?num='+item.num" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-pencil-box-outline"></i>修改</a>
<a v-if="!isEditing" @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-container v-if="!isEditing">
<v-row class="align-baseline" wrap>
<v-col cols="12" md="9">
<v-pagination
+1 -1
View File
@@ -148,7 +148,7 @@ public partial class admin_activity_index2 : MyWeb.config
}
var tdesc = publicFun.enum_desc<Model.activity.category>();
qry = qry.OrderByDescending(o => o.num);
qry = qry.OrderByDescending(o => o.sort_order);
var list = qry.ToList();
if (list.Count > 0)
{
+2
View File
@@ -118,6 +118,7 @@ public partial class admin_activity_item_reg : MyWeb.config
L_msg.Text = "";
Model.actItem actItem = new Model.actItem();//新增
int maxSort = _db.actItems.Max(x => (int?)x.sort_order) ?? 0;
actItem.subject = subject.Text;
actItem.print_init = print_init.Text;
actItem.partno = PARTNO.Text;
@@ -131,6 +132,7 @@ public partial class admin_activity_item_reg : MyWeb.config
actItem.is_reconcile = is_reconcile_item.Checked ? "Y" : "N";
actItem.demo = demo.Text;
actItem.customize_data = customize_data.Text;
actItem.sort_order = maxSort + 1;
_db.actItems.Add(actItem);
_db.SaveChanges();
+1 -1
View File
@@ -827,7 +827,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="取消" Visible="true" CausesValidation="false" OnClick="goback_Click" CssClass="btn btn-outline-secondary" />
</div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
+7 -23
View File
@@ -135,7 +135,7 @@
},
watch: {
options: {
handler() {
handler() {
if (this.isSearched) {
this.getList()
}
@@ -200,23 +200,6 @@
}
}
//if (params.has('year')) {
// this.print_search.year = parseInt(params.get('year'));
// this.print_dialog.show = true;
//}
//if (params.has('month')) {
// this.print_search.month = parseInt(params.get('month'));
// this.print_dialog.show = true;
//}
//if (params.has('season')) {
// this.print_search.season = parseInt(params.get('season'));
// this.print_dialog.show = true;
//}
//if (params.has('mode')) {
// this.print_conditions = params.get('mode');
// this.print_dialog.show = true;
//}
if (printResult === 'nodata' || printResult === 'success') {
this.$nextTick(() => {
this.print_search.year = parseInt(document.getElementById('<%= hid_print_year.ClientID %>').value) || this.print_search.year;
@@ -231,8 +214,9 @@
}
this.$nextTick(() => {
setTimeout(() => {
['year', 'month', 'season', 'mode', 'msg'].forEach(p => params.delete(p));
window.history.replaceState({}, '', url.pathname + url.search);
// 清空 URL
const cleanUrl = window.location.protocol + "//" + window.location.host + window.location.pathname;
window.history.replaceState({}, '', cleanUrl);
}, 100);
});
},
@@ -255,7 +239,6 @@
}
if (mode === 'print') {
const printWindow = window.open('about:blank', '列印信眾資料');
document.getElementById('<%= print_management.ClientID %>').click();
}
else if (mode === "excel") {
@@ -397,13 +380,13 @@
}
},
btn_search() {
isSearched = true;
this.isSearched = true;
sessionStorage.setItem("member_query_params", JSON.stringify(this.search));
this.getList(true)
bootstrap.Offcanvas.getInstance(document.getElementById("offcanvasRight")).hide()
},
btn_all() {
isSearched = false;
this.isSearched = false;
clearObjProps(this.search);
sessionStorage.setItem("member_query_params", JSON.stringify(this.search));
//this.btn_search()
@@ -527,6 +510,7 @@
<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_qry" runat="server" />
<asp:LinkButton ID="excel_management" runat="server" OnClick="export_Click" style="display:none;" />
<asp:LinkButton ID="print_management" runat="server" OnClick="export_Click" style="display:none;" />
<div id="content" class="container-fluid">
+9 -11
View File
@@ -13,6 +13,7 @@ using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Windows.Controls;
using System.Windows.Interop;
using static TreeView;
@@ -243,7 +244,7 @@ public partial class admin_follower_index : MyWeb.config
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 : "";
var qry = _db.followers.AsQueryable();
if (selYear > 0)
{
@@ -255,7 +256,7 @@ public partial class admin_follower_index : MyWeb.config
}
else if (selMode == "ss" && selSeason > 0)
{
urlParams += "&season=" + selSeason;
urlParams += "&season=" + selSeason;
}
if (list.Count > 0)
@@ -266,17 +267,12 @@ public partial class admin_follower_index : MyWeb.config
hid_print_season.Value = selSeason.ToString();
hid_print_mode.Value = selMode;
string script = $@"window.open('print.aspx?{urlParams}&mode={selMode}', '列印信眾資料');";
string script = $@"window.open('print.aspx?{urlParams}&mode={selMode}', '列印信眾資料', 'noopener,noreferrer');";
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);
}
}
}
@@ -357,7 +353,7 @@ public partial class admin_follower_index : MyWeb.config
qry = qry.Where(o => o.address.Contains(s_address.Value.Trim()));
_query += "地址:" + s_address.Value.Trim() + "\n";
}
// 電話/證號搜尋 (使用 search_keywords HEX 編碼)
if (!isStrNull(s_phone_idcode.Value) && GlobalVariables.UseSearchKeywords)
{
@@ -372,12 +368,14 @@ public partial class admin_follower_index : MyWeb.config
if (!isStrNull(s_birthday.Value) && isDate(s_birthday.Value))
{
qry = qry.Where(o => o.birthday >= ValDate(s_birthday.Value));
var tmp_s_birthday = ValDate(s_birthday.Value);
qry = qry.Where(o => o.birthday >= tmp_s_birthday);
_query += "生日(起):" + s_birthday.Value.Trim() + "\n";
}
if (!isStrNull(s_birthday2.Value) && isDate(s_birthday2.Value))
{
qry = qry.Where(o => o.birthday < Convert.ToDateTime(s_birthday2.Value).AddDays(1));
var tmp_s_birthday2 = Convert.ToDateTime(s_birthday2.Value).AddDays(1);
qry = qry.Where(o => o.birthday < tmp_s_birthday2);
_query += "生日(訖):" + s_birthday2.Value.Trim() + "\n";
}
qry = qry.OrderByDescending(o => o.num);
+14 -1
View File
@@ -61,7 +61,8 @@ public partial class admin_follower_print_ : System.Web.UI.Page
if (!string.IsNullOrEmpty(Request["birthday2"]))
{
DateTime birthday2Param = Convert.ToDateTime(Request["birthday2"].Trim());
qry = qry.Where(o => o.birthday < birthday2Param.AddDays(1));
var tmpBirthday2Param = birthday2Param.AddDays(1);
qry = qry.Where(o => o.birthday < tmpBirthday2Param);
_query += "生日(訖):" + birthday2Param.ToString("yyyy/MM/dd") + "\n";
}
// ❌ 錯誤寫法: _db.countries.Where(x => x.ID == Request["country"].ToString())
@@ -87,6 +88,18 @@ public partial class admin_follower_print_ : System.Web.UI.Page
_query += "國家:" + (_db.countries.Where(x => x.ID == country2Id).Select(x => x.name_zh).FirstOrDefault() ?? "") + "\n";
}
string phone_ipcode = Request["phone_idcode"]?.ToString();
if (!string.IsNullOrEmpty(phone_ipcode) && GlobalVariables.UseSearchKeywords)
{
MyWeb.encrypt encrypt = new MyWeb.encrypt();
string hexSearch = encrypt.ConvertToHex(phone_ipcode.Trim());
if (!string.IsNullOrEmpty(hexSearch))
{
qry = qry.Where(o => o.search_keywords != null && o.search_keywords.Contains(hexSearch));
_query += "電話/證號:" + phone_ipcode.Trim() + "\n";
}
}
//管理報表
if (!string.IsNullOrEmpty(Request["year"]))
{
+23 -3
View File
@@ -1318,13 +1318,32 @@
$('.tab-pane,.edit_Click').removeClass('pe-none'); // 移除 pe-none 類,允許編輯
}
});
let isComposing = false;
const cellphoneInput = document.querySelector('[id$="cellphone"]');
if (cellphoneInput) {
cellphoneInput.addEventListener('compositionstart', () => {
isComposing = true;
});
cellphoneInput.addEventListener('compositionend', (e) => {
isComposing = false;
formatCellphone(e.target);
});
cellphoneInput.addEventListener('input', (e) => {
if (!isComposing) {
formatCellphone(e.target);
}
});
}
</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">
<template v-if="follower_id !='' "> {{titleword()}} </template>
</div>
<div class="d-flex align-items-center">
<div class="">
<div class="form-check me-3 d-none" id="editCheckboxContainer">
<input class="form-check-input" type="checkbox" id="editCheckbox">
<label class="form-check-label" for="editCheckbox">
@@ -1333,7 +1352,7 @@
</div>
<asp:Button ID="add" runat="server" Text="送出" OnClick="add_Click" CssClass="btn btn-primary edit_Click noedit" />
<asp:Button ID="edit" runat="server" Text="儲存" Visible="false" OnClick="edit_Click" CssClass="btn btn-primary edit_Click noedit" />
<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="取消" Visible="true" CausesValidation="false" OnClick="goback_Click" CssClass="btn btn-outline-secondary" />
</div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
@@ -1412,7 +1431,7 @@
</div>
<label class="col-sm-2 col-lg-1 col-form-label">手機號碼<asp:Literal ID="cellphoneReqStar" runat="server" Text=" *"></asp:Literal></label>
<div class="col-sm-10 col-lg-3">
<asp:TextBox ID="cellphone" MaxLength="12" runat="server" CssClass="form-control" data-encrypt="Y" placeholder="聯絡電話與手機號碼請至少填寫一項" oninput="formatCellphone(this)"></asp:TextBox>
<asp:TextBox ID="cellphone" MaxLength="12" runat="server" CssClass="form-control" data-encrypt="Y" placeholder="聯絡電話與手機號碼請至少填寫一項"></asp:TextBox>
<asp:RegularExpressionValidator ControlToValidate="cellphone" Display="Dynamic" ErrorMessage="格式有誤" ID="RegularExpressionValidator2" runat="server" SetFocusOnError="true" ValidationExpression="^09\d{2}-?\d{3}-?\d{3}$" />
</div>
</div>
@@ -2155,4 +2174,5 @@
</template>
</v-snackbar>
</div>
</asp:Content>
+32 -1
View File
@@ -85,7 +85,7 @@
<label for="u_gauth"><i class="mdi mdi-key-variant"></i> Google Authenticator 驗證碼</label>
</div>
<div class="mt-4 mb-0 d-grid gap-2">
<asp:LinkButton ID="Button1" runat="server" OnClick="Button1_Click"
<asp:LinkButton ID="Button1" runat="server" OnClick="Button1_Click"
CssClass="btn btn-primary rounded-pill">
<i class="mdi mdi-login"></i> 登入</asp:LinkButton>
<asp:LinkButton ID="DesignModeButton" runat="server" OnClick="DesignModeButton_Click"
@@ -105,5 +105,36 @@
</div>
</div>
<!-- /.content_box -->
<script>
document.addEventListener('DOMContentLoaded', function () {
var accountInput = document.getElementById('<%= u_id.ClientID %>');
var passwordInput = document.getElementById('<%= u_password.ClientID %>');
var chkInput = document.getElementById('<%= chknum.ClientID %>');
var btn = document.getElementById('<%= Button1.ClientID %>');
accountInput.addEventListener('keypress', function (e){
if (e.keyCode === 13) {
$("#<%= u_password.ClientID %>").focus();
return false;
}
})
passwordInput.addEventListener('keypress', function (e) {
if (e.keyCode === 13) {
$("#<%= chknum.ClientID %>").focus();
return false;
}
})
var triggerLogin = function (e) {
if (e.keyCode === 13) {
btn.click();
e.preventDefault();
return false;
}
};
if (chkInput) chkInput.addEventListener('keypress', triggerLogin);
});
</script>
</asp:Content>
+228 -67
View File
@@ -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,7 +40,8 @@
vuetify: new Vuetify(vuetify_options),
data() {
return {
isFirstLoad: true,
print_error_msg: "",
isSearched: false,
this_act : '<%= Request["act_id"]%>',
options: { multiSort: false },
search_options: { multiSort: false },
@@ -57,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:{
@@ -204,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 != '')
@@ -212,29 +219,63 @@
this.initActivity();
const navEntries = performance.getEntriesByType("navigation");
const isReload = navEntries.length > 0 && navEntries[0].type === "reload";
const isBackForward = navEntries.length > 0 && navEntries[0].type === "back_forward";
if (isReload) {
sessionStorage.removeItem("orderpage");
sessionStorage.removeItem("order_list_cache");
sessionStorage.removeItem("order_query_params");
}
else if (isBackForward) {
this.isFirstLoad = false;
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() {
if (this.isFirstLoad) {
this.isFirstLoad = false;
this.data_table.loading = false;
return;
if (this.isSearched) {
this.getDefault()
}
else {
this.data_table.loading = false;
}
this.getDefault()
},
deep: true,
},
@@ -246,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;
@@ -331,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);
}
},
@@ -385,16 +482,21 @@
}
},
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;
@@ -403,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 => {
@@ -453,6 +575,7 @@
//列印管理報表
print_close() {
this.print_dialog.show = false;
this.print_error_msg = "";
}
,
initPrintSearch() {
@@ -515,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('活動/非活動至少勾選一項');
}
@@ -567,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"
@@ -591,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>
@@ -703,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' ">
@@ -714,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>
@@ -775,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
View File
@@ -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()));
+2 -2
View File
@@ -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>
+6 -13
View File
@@ -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>
+83 -25
View File
@@ -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)
+3 -2
View File
@@ -703,6 +703,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);
},
//報名詳細資料
@@ -1729,7 +1730,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">
@@ -2355,7 +2356,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>
+3
View File
@@ -206,6 +206,9 @@ public partial class admin_order_reg : MyWeb.config
string url = "index.aspx";
url = "reg.aspx?order_no=" + pro_order.order_no;
Session["LastAddedNo"] = pro_order.order_no;
Response.Redirect(url);
}
}
+8
View File
@@ -0,0 +1,8 @@
FK_act_bom_actItem1 刪除規則設為 cascade
FK_pro_order_followers 刪除規則設為 cascade
FK_pro_order_activity 刪除規則設為 cascade
FK_pro_order_detail_pro_order 刪除規則設為 cascade
FK_pro_order_detail_followers 刪除規則設為 沒有動作
FK_activity_relating_activity 刪除規則設為 cascade
actitem 加上 sort_order(int) 欄位