36 Commits

Author SHA1 Message Date
minom 07e29c32aa 調整匯款沖帳 2026-05-11 15:59:23 +08:00
minom 3c5617b403 merge dapper and 0.1 into dapper 2026-04-28 17:09:04 +08:00
minomdu 50c2203ebf Merge remote-tracking branch 'origin/0.1' into dapper
# Conflicts:
#	web/App_Code/Model/Model.Designer.cs
#	web/App_Code/Model/Model.cs
#	web/App_Code/Model/Model.edmx
#	web/web.config
2026-04-28 16:26:19 +08:00
EnChia 7644df57d0 1. 優化報名頁面:彈出查詢頁面、顯示剛新增資料
2. 新增報名頁面加上取消鍵
3. 優化登入頁面:按下 enter 自動換格/送出
4. 修復新增報名頁面中,不同 search_dialog 中的 page 參數相互連動之異常
5. 修改報名頁面列印格式
6. 修復報名頁面匯出功能
7. 優化報到功能
8. 報名頁面中,無查詢資料時不可點選匯出/列印按鈕
9. 匯出/列印報名管理報表時,若無資料則顯示提示
10. 修復列印管理報表後父視窗 UI 不能點擊的問題
11. 新增報名管理表單匯出 excel 功能
12. 於新增信眾、新增活動頁面加上取消鍵
13. 優化報名管理匯出功能:若篩選條件包含特定活動,自動於「匯出條件」欄位標註活動名稱
14. 優化報名查詢匯出功能:匯出之文件中加上「匯出條件」欄位
15. 修復信眾資料頁面中,使用「生日」作為篩選基準時,後續執行「列印查詢資料」與「匯出查詢資料」會報錯
16. 修復「列印信眾查詢」功能中,電話搜尋欄位未正確帶入查詢條件之異常
17. 解決中文輸入法輸入電話號碼的跳字問題
18. 新增品項管理介面排序功能
2026-04-21 09:03:57 +08:00
minom 3273072fb3 排版設定 2026-04-16 17:51:02 +08:00
minom d9e651fe72 左右正名可選可輸入 2026-04-15 17:46:35 +08:00
minom 08b339e0cd 牌位報名與列印 2026-04-14 15:45:42 +08:00
minom a81967ddbd 新增親友功能 2026-04-13 17:44:13 +08:00
minom 1afb90f3ba 新增親友 2026-04-12 20:55:09 +08:00
minom 21a3ec6198 still 牌位版面調整 2026-04-10 17:24:46 +08:00
minom c5fc2469d7 1.報名牌位 2.牌位列印 2026-04-09 17:42:29 +08:00
EnChia aa5941a324 1. 加上返回鍵
2. 修改報名記錄中的活動開始結束時間
3. 修正列印問題
4. 信眾資料及報名管理起始不會出現資料
5. 信眾不得重複報名相同活動
6. 信眾資料的 cache(含結果與搜尋條件)
7. 修復信眾、活動、品項刪除功能
8. 增加自訂是否自動編號
9. 優化信眾資料頁面(彈出查詢頁面、顯示剛新增資料)
10. 新增管理表單匯出 excel 功能
11. 無查詢資料時不可點選匯出/列印按鈕
12. 匯出/列印管理報表時,若無資料則顯示提示
13. 新增信眾資料時,加入日期預設為今日
2026-04-09 17:37:00 +08:00
minom 8fe243356e 牌位設定 2026-04-08 17:54:28 +08:00
minom 83a7c67439 增加一個新的報名牌位編輯功能 2026-04-07 18:04:08 +08:00
minom 36174834a8 牌位排版 2026-04-06 19:06:22 +08:00
minom f087e4aa61 底圖 2026-04-02 18:22:46 +08:00
minom 7998312785 排版 2026-04-02 18:22:18 +08:00
minom 37d0b928ec 牌位設定列印 2026-04-01 18:03:42 +08:00
minom 5f8da12363 陽上 2026-03-31 18:03:45 +08:00
minom f16b3e3678 排版 2026-03-30 18:07:41 +08:00
minom ad1c99c3e9 牌位列印 2026-03-27 19:24:04 +08:00
minom 7722cc16ff print 2026-03-26 18:08:20 +08:00
minom 35ca33315d go 2026-03-25 18:04:13 +08:00
minom 8154473d1a 要改列印的功能 2026-03-24 18:02:44 +08:00
minom c235a138ee .... 2026-03-20 18:14:27 +08:00
minom 1b79aa9d14 報名 2026-03-19 17:44:27 +08:00
minom 095b310109 排版功能調整 2026-03-13 17:59:14 +08:00
minom f92fa65133 go 2026-03-12 17:44:08 +08:00
minom d81b99fd7d 1 2026-03-12 11:22:28 +08:00
minom f900649724 .. 2026-03-11 17:38:27 +08:00
minom 0bb9da198b .. 2026-03-11 17:37:27 +08:00
minom 5baac4fdb7 預覽 2026-03-11 15:37:05 +08:00
minom b66976b7c4 增加紙張尺寸設定 2026-03-10 17:59:57 +08:00
minom bfd07ebe90 .. 2026-03-09 18:09:32 +08:00
minom 50b24a7282 script 2026-03-06 19:10:33 +08:00
minom 27f936d4a9 排版 2026-03-06 19:08:25 +08:00
57 changed files with 18001 additions and 825 deletions
+8045
View File
File diff suppressed because it is too large Load Diff
+351
View File
@@ -0,0 +1,351 @@
using DocumentFormat.OpenXml.Office2010.Excel;
using DocumentFormat.OpenXml.Wordprocessing;
using MINOM.COM.Utility;
using Model;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Http.ModelBinding;
/// <summary>
/// StyleDataAccess 的摘要描述
/// </summary>
public class StyleDataAccess
{
LogUtility log=new LogUtility();
object[] obj = new object[] { "Y", "" ,null};
public StyleDataAccess()
{
//
// TODO: 在這裡新增建構函式邏輯
//
}
public object[] AddTabletPaper(TabletPaperSize tps)
{
try
{
using (var context = new ezEntities())
{
StringBuilder sb = new StringBuilder();
var sp = new List<SqlParameter>();
sb.Append("insert into TabletPaperSize (PaperID,PaperName,Width,Height,CUser,CDate,CTime,UUser,UDate,UTime ) ");
sb.Append("values (@PaperID,@PaperName,@Width,@Height,@CUser,@CDate,@CTime,@UUser,@UDate,@UTime )");
sp.Add(new SqlParameter("@PaperID",tps.PaperID));
sp.Add(new SqlParameter("@PaperName", tps.PaperName));
sp.Add(new SqlParameter("@Width", tps.Width));
sp.Add(new SqlParameter("@Height", tps.Height));
sp.Add(new SqlParameter("@CUser", tps.CUser));
sp.Add(new SqlParameter("@CDate", tps.CDate));
sp.Add(new SqlParameter("@CTime", tps.CTime));
sp.Add(new SqlParameter("@UUser", tps.UUser));
sp.Add(new SqlParameter("@UDate", tps.UDate));
sp.Add(new SqlParameter("@UTime", tps.UTime));
context.Database.ExecuteSqlCommand(sb.ToString(),sp.ToArray());
}
}
catch (Exception ex)
{
log.writeErrorPath("AddTabletPaper:" + ex.Message + ex.StackTrace);
obj[0] = "N";
obj[1] = ex.Message;
}
return obj;
}
public object[] GetTabletPaper(string paperID, string name)
{
try
{
using (var context = new ezEntities())
{
StringBuilder sb = new StringBuilder();
var sp = new List<SqlParameter>();
sb.Append("select * from TabletPaperSize where 1=1 ");
if (!string.IsNullOrEmpty(paperID))
{
sb.Append("and PaperID=@PaperID ");
sp.Add(new SqlParameter("@PaperID", paperID));
}
if (!string.IsNullOrEmpty(name))
{
sb.Append("and Name=@Name ");
sp.Add(new SqlParameter("@Name", name));
}
var data = context.Database.SqlQuery<TabletPaperSize>(sb.ToString(), sp.ToArray()).ToList();
obj[2] = data;
}
}
catch (Exception ex)
{
log.writeErrorPath("GetTabletElement:" + ex.Message + ex.StackTrace);
obj[0] = "N";
obj[1] = ex.Message;
}
return obj;
}
public object[] GetTabletElement(string elementID ,string name)
{
try
{
using (var context = new ezEntities())
{
StringBuilder sb = new StringBuilder();
var sp = new List<SqlParameter>();
sb.Append("select * from TabletElement where 1=1 ");
if (!string.IsNullOrEmpty(elementID))
{
sb.Append("and ElementID=@ElementID ");
sp.Add(new SqlParameter("@ElementID", elementID));
}
if (!string.IsNullOrEmpty(name))
{
sb.Append("and Name=@Name ");
sp.Add(new SqlParameter("@Name", name));
}
var data = context.Database.SqlQuery<TabletElement>(sb.ToString(), sp.ToArray()).ToList();
obj[2] = data;
}
}
catch (Exception ex)
{
log.writeErrorPath("GetTabletElement:" + ex.Message + ex.StackTrace);
obj[0] = "N";
obj[1] = ex.Message;
}
return obj;
}
public object[] GetStyleDetail(string styleID,string elementID)
{
try
{
using (var context = new ezEntities())
{
StringBuilder sb = new StringBuilder();
var sp = new List<SqlParameter>();
sb.Append("select * from TabletStyleDetail where 1=1 ");
if (!string.IsNullOrEmpty(styleID))
{
sb.Append("and StyleID=@StyleID ");
sp.Add(new SqlParameter("@StyleID", styleID));
}
if (!string.IsNullOrEmpty(elementID))
{
sb.Append("and ElementID=@ElementID ");
sp.Add(new SqlParameter("@ElementID", elementID));
}
var data = context.Database.SqlQuery<TabletStyleDetail>(sb.ToString(), sp.ToArray()).ToList();
obj[2] = data;
}
}
catch (Exception ex)
{
log.writeErrorPath("GetStyleDetail:" + ex.Message + ex.StackTrace);
obj[0] = "N";
obj[1] = ex.Message;
}
return obj;
}
public object[] GetStyle(string id,string name)
{
try
{
using (var context = new ezEntities())
{
StringBuilder sb = new StringBuilder();
var sp = new List<SqlParameter>();
sb.Append("select * from TabletStyle where 1=1 ");
if (!string.IsNullOrEmpty(id))
{
sb.Append("and StyleID=@StyleID ");
sp.Add(new SqlParameter( "@StyleID",id));
}
if (!string.IsNullOrEmpty(name))
{
sb.Append("and Name=@Name ");
sp.Add(new SqlParameter("@Name", name));
}
var data= context.Database.SqlQuery<TabletStyle>(sb.ToString(), sp.ToArray()).ToList();
obj[2]= data;
}
}
catch (Exception ex)
{
log.writeErrorPath("GetStyle:" + ex.Message + ex.StackTrace);
obj[0] = "N";
obj[1] = ex.Message;
}
return obj;
}
public object[] AddStyle(TabletStyle ts, List<TabletStyleDetail> list)
{
try
{
using (var context = new ezEntities())
{
StringBuilder sb = new StringBuilder();
SqlParameter[] sp = new SqlParameter[] {
new SqlParameter("@StyleID",ts.StyleID),
new SqlParameter("@Name",ts.Name),
new SqlParameter("@Descr",ts.Descr),
new SqlParameter("@PaperSize",ts.PaperSize),
new SqlParameter("@BackendImg",ts.BackendImg),
new SqlParameter("@PrintSize",ts.PrintSize),
new SqlParameter("@PrintMode",ts.PrintMode),
new SqlParameter("@Orientation",ts.Orientation),
new SqlParameter("@PrintPageCount",ts.PrintPageCount),
new SqlParameter("@RosterLimit",ts.RosterLimit),
new SqlParameter("@CUser",""),
new SqlParameter("@CDate",""),
new SqlParameter("@CTime",""),
new SqlParameter("@UUser",""),
new SqlParameter("@UDate",""),
new SqlParameter("@UTime",""),
};
sb.Append("insert into TabletStyle (StyleID,Name,Descr,PaperSize,BackendImg,PrintSize,PrintMode,Orientation,PrintPageCount,RosterLimit");
sb.Append(",CUser,CDate,CTime,UUser,UDate,UTime ) ");
sb.Append("values(@StyleID,@Name,@Descr,@PaperSize,@BackendImg,@PrintSize,@PrintMode,@Orientation,@PrintPageCount,@RosterLimit");
sb.Append(",@CUser,@CDate,@CTime,@UUser,@UDate,@UTime ) ");
context.Database.ExecuteSqlCommand(sb.ToString(), sp);
sb.Clear();
sb.Append("insert into TabletStyleDetail(StyleID,Name,Descr,ElementID,StartX,StartY,FontSize,BreakLen,FontFamily,TwoOffset,");
sb.Append("ThreeOffset,FourOffSet,IsActive,Width,Height,TextWidth,TextHeight,CUser,CDate,CTime,UUser,UDate,UTime) ");
sb.Append("values (@StyleID,@Name,@Descr,@ElementID,@StartX,@StartY,@FontSize,@BreakLen,@FontFamily,@TwoOffset,");
sb.Append("@ThreeOffset,@FourOffSet,@IsActive,@Width,@Height,@TextWidth,@TextHeight,@CUser,@CDate,@CTime,@UUser,@UDate,@UTime) ");
foreach (var item in list)
{
SqlParameter[] sp1 = new SqlParameter[] {
new SqlParameter("@StyleID",item.StyleID),
new SqlParameter("@Name",item.Name),
new SqlParameter("@Descr",item.Descr),
new SqlParameter("@ElementID",item.ElementID),
new SqlParameter("@StartX",item.StartX),
new SqlParameter("@StartY",item.StartY),
new SqlParameter("@FontSize",item.FontSize),
new SqlParameter("@BreakLen",item.BreakLen),
new SqlParameter("@FontFamily",item.FontFamily),
new SqlParameter("@TwoOffset",item.TwoOffset),
new SqlParameter("@ThreeOffset",item.ThreeOffset),
new SqlParameter("@FourOffset",item.FourOffset),
new SqlParameter("@IsActive",item.IsActive),
new SqlParameter("@Width",item.Width),
new SqlParameter("@Height",item.Height),
new SqlParameter("@TextWidth",item.TextWidth),
new SqlParameter("@TextHeight",item.TextHeight),
new SqlParameter("@CUser",""),
new SqlParameter("@CDate",""),
new SqlParameter("@CTime",""),
new SqlParameter("@UUser",""),
new SqlParameter("@UDate",""),
new SqlParameter("@UTime",""),
};
context.Database.ExecuteSqlCommand(sb.ToString(), sp1.ToArray());
}
}
}
catch (Exception ex)
{
log.writeErrorPath("AddStyle:" + ex.Message+ex.StackTrace);
obj[0] = "N";
obj[1] = ex.Message;
}
return obj;
}
public object[] UpdateStyle(TabletStyle ts, List<TabletStyleDetail> list)
{
try
{
using (var context = new ezEntities())
{
StringBuilder sb = new StringBuilder();
SqlParameter[] sp = new SqlParameter[] {
new SqlParameter("@StyleID",ts.StyleID),
new SqlParameter("@Name",ts.Name),
new SqlParameter("@Descr",ts.Descr),
new SqlParameter("@PaperSize",ts.PaperSize),
new SqlParameter("@BackendImg",ts.BackendImg),
new SqlParameter("@PrintSize",ts.PrintSize),
new SqlParameter("@PrintMode",ts.PrintMode),
new SqlParameter("@Orientation",ts.Orientation),
new SqlParameter("@PrintPageCount",ts.PrintPageCount),
new SqlParameter("@RosterLimit",ts.RosterLimit),
new SqlParameter("@CUser",""),
new SqlParameter("@CDate",""),
new SqlParameter("@CTime",""),
new SqlParameter("@UUser",""),
new SqlParameter("@UDate",""),
new SqlParameter("@UTime",""),
};
sb.Append("update TabletStyle set Descr=@Descr,PaperSize=@PaperSize,BackendImg=@BackendImg,PrintSize=@PrintSize,");
sb.Append("PrintMode=@PrintMode,Orientation=@Orientation,PrintPageCount=@PrintPageCount,RosterLimit=@RosterLimit,");
sb.Append("CUser=@CUser,CDate=@CDate,CTime=@CTime,UUser=@UUSer,UDate=@UDate,UTime=@UTime ");
sb.Append("where StyleID=@StyleID ");
context.Database.ExecuteSqlCommand(sb.ToString(), sp.ToArray());
sb.Clear();
sb.Append("update TabletStyleDetail set Descr=@Descr,StartX=@StartX,StartY=@StartY,FontSize=@FontSize,BreakLen=@BreakLen,");
sb.Append("FontFamily=@FontFamily,TwoOffset=@TwoOffset,ThreeOffset=@ThreeOffset,FourOffset=@FourOffset,IsActive=@IsActive,");
sb.Append("Width=@Width,Height=@Height,TextWidth=@TextWidth,TextHeight=@TextHeight,UUser=@UUser,UDate=@UDate,UTime=@UTime ");
sb.Append("where StyleID=@StyleID and ElementID=@ElementID ");
//sb.Append("insert into TabletStyleDetail(StyleID,Name,Descr,ElementID,StartX,StartY,FontSize,BreakLen,FontFamily,TwoOffset,");
//sb.Append("ThreeOffset,FourOffSet,IsActive,Width,Height,TextWidth,TextHeight,CUser,CDate,CTime,UUser,UDate,UTime) ");
//sb.Append("values (@StyleID,@Name,@Descr,@ElementID,@StartX,@StartY,@FontSize,@BreakLen,@FontFamily,@TwoOffset,");
//sb.Append("@ThreeOffset,@FourOffSet,@IsActive,@Width,@Height,@TextWidth,@TextHeight,@CUser,@CDate,@CTime,@UUser,@UDate,@UTime) ");
foreach (var item in list)
{
SqlParameter[] sp1 = new SqlParameter[] {
new SqlParameter("@StyleID",item.StyleID),
new SqlParameter("@Name",item.Name),
new SqlParameter("@Descr",item.Descr),
new SqlParameter("@ElementID",item.ElementID),
new SqlParameter("@StartX",item.StartX),
new SqlParameter("@StartY",item.StartY),
new SqlParameter("@FontSize",item.FontSize),
new SqlParameter("@BreakLen",item.BreakLen),
new SqlParameter("@FontFamily",item.FontFamily),
new SqlParameter("@TwoOffset",item.TwoOffset),
new SqlParameter("@ThreeOffset",item.ThreeOffset),
new SqlParameter("@FourOffset",item.FourOffset),
new SqlParameter("@IsActive",item.IsActive),
new SqlParameter("@Width",item.Width),
new SqlParameter("@Height",item.Height),
new SqlParameter("@TextWidth",item.TextWidth),
new SqlParameter("@TextHeight",item.TextHeight),
new SqlParameter("@CUser",""),
new SqlParameter("@CDate",""),
new SqlParameter("@CTime",""),
new SqlParameter("@UUser",""),
new SqlParameter("@UDate",""),
new SqlParameter("@UTime",""),
};
context.Database.ExecuteSqlCommand(sb.ToString(), sp1.ToArray());
}
}
}
catch (Exception ex)
{
log.writeErrorPath("UpdateStyle:" + ex.Message + ex.StackTrace);
obj[0] = "N";
obj[1] = ex.Message;
}
return obj;
}
}
+92
View File
@@ -0,0 +1,92 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// Style 的摘要描述
/// </summary>
public class TabletStyle
{
public TabletStyle()
{
//
// TODO: 在這裡新增建構函式邏輯
//
}
public string StyleID { get; set; }
public string Name { get; set; }
public string Descr { get; set; }
public string PaperSize { get; set; }
public string BackendImg { get; set; }
public string PrintSize { get; set; }
public string PrintMode { get; set; }
public string Orientation { get; set; }
public string PrintPageCount { get; set; }
public string RosterLimit { get; set; }
public string CUser { get; set; }
public string CDate { get; set; }
public string CTime { get; set; }
public string UUser { get; set; }
public string UDate { get; set; }
public string UTime { get; set; }
}
public class TabletStyleDetail
{
public TabletStyleDetail() { }
public string StyleID { get; set; }
public string Name { get; set; }
public string Descr { get; set; }
public string ElementID { get; set; }
public string StartX { get; set; }
public string StartY { get; set; }
public string FontSize { get; set; }
public string FontFamily { get; set; }
public string TwoOffset { get; set; }
public string ThreeOffset { get; set; }
public string FourOffset { get; set; }
public string IsActive { get; set; }
public string Width { get; set; }
public string Height { get; set; }
public string TextWidth { get; set; }
public string TextHeight { get; set; }
public string BreakLen { get; set; }
public string CUser { get; set; }
public string CDate { get; set; }
public string CTime { get; set; }
public string UUser { get; set; }
public string UDate { get; set; }
public string UTime { get; set; }
}
public class TabletElement
{
public TabletElement() { }
public string ElementID { get; set; }
public string Name { get; set; }
public string ElementType { get; set; }
public string SampleContent { get; set; }
public string CUser { get; set; }
public string CDate { get; set; }
public string CTime { get; set; }
public string UUser { get; set; }
public string UDate { get; set; }
public string UTime { get; set; }
}
public class TabletPaperSize
{
public TabletPaperSize() { }
public string PaperID { get; set; }
public string PaperName { get; set; }
public string Width { get; set; }
public string Height { get; set; }
public string CUser { get; set; }
public string CDate { get; set; }
public string CTime { get; set; }
public string UUser { get; set; }
public string UDate { get; set; }
public string UTime { get; set; }
}
+1 -1
View File
@@ -1,4 +1,4 @@
// 已啟用模型 'C:\project\17168ERP\web\App_Code\Model\Model.edmx' 的 T4 程式碼產生。
// 已啟用模型 'D:\project\17168ERP\web\App_Code\Model\Model.edmx' 的 T4 程式碼產生。
// 若要啟用舊版程式碼產生,請將 [程式碼產生策略] 設計工具屬性的值
//變更為 [舊版 ObjectContext]。當模型在設計工具中開啟時,這個屬性便可
//以在 [屬性] 視窗中使用。
+5
View File
@@ -184,6 +184,10 @@ namespace Model
public string partno { get; set; }
public string print_init { get; set; }
public string is_reconcile { get; set; }
public string pageSize { get; set; }
public string printSize { get; set; }
public string defaultStyle { get; set; }
public Nullable<int> sort_order { get; set; }
public virtual actItem_kind actItem_kind { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
@@ -1389,6 +1393,7 @@ namespace Model
public Nullable<int> parent_num { get; set; }
public string print_id { get; set; }
public Nullable<System.DateTime> UpdateTime { get; set; }
public string style { get; set; }
public virtual actItem actItem { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+38 -29
View File
@@ -91,6 +91,10 @@
<Property Name="customize_data" Type="nvarchar(max)" />
<Property Name="reg_time" Type="datetime" />
<Property Name="is_reconcile" Type="nvarchar" MaxLength="1" />
<Property Name="pageSize" Type="varchar" MaxLength="50" />
<Property Name="printSize" Type="varchar" MaxLength="50" />
<Property Name="defaultStyle" Type="varchar" MaxLength="50" />
<Property Name="sort_order" Type="int" />
</EntityType>
<EntityType Name="actItem_files">
<Key>
@@ -480,7 +484,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 +608,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" />
@@ -724,6 +728,7 @@
<Property Name="customize_data" Type="nvarchar(max)" />
<Property Name="printed_files" Type="nvarchar(max)" />
<Property Name="UpdateTime" Type="datetime2" Precision="7" />
<Property Name="style" Type="varchar" MaxLength="50" />
</EntityType>
<EntityType Name="pro_order_record">
<Key>
@@ -980,7 +985,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 +1084,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 +1135,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 +1206,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 +1634,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 +1686,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 +1700,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 +2160,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 +2208,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 +2612,10 @@
<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="pageSize" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="printSize" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="defaultStyle" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="sort_order" Type="Int32" ConcurrencyMode="None" />
</EntityType>
<EntityType Name="actItem_files">
<Key>
@@ -2972,7 +2975,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 +3065,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" />
@@ -3188,6 +3191,7 @@
<Property Name="UpdateTime" Type="DateTime" Precision="7" />
<NavigationProperty Name="accountings" Relationship="Model.FK_accounting_pro_order_detail" FromRole="pro_order_detail" ToRole="accounting" />
<NavigationProperty Name="transfer_register" Relationship="Model.FK_transfer_register_pro_order_detail" FromRole="pro_order_detail" ToRole="transfer_register" />
<Property Name="style" Type="String" Unicode="false" FixedLength="false" MaxLength="50" Nullable="true" />
</EntityType>
<EntityType Name="pro_order_record">
<Key>
@@ -5334,6 +5338,10 @@
<EntitySetMapping Name="actItems">
<EntityTypeMapping TypeName="Model.actItem">
<MappingFragment StoreEntitySet="actItem">
<ScalarProperty Name="sort_order" ColumnName="sort_order" />
<ScalarProperty Name="defaultStyle" ColumnName="defaultStyle" />
<ScalarProperty Name="printSize" ColumnName="printSize" />
<ScalarProperty Name="pageSize" ColumnName="pageSize" />
<ScalarProperty Name="is_reconcile" ColumnName="is_reconcile" />
<ScalarProperty Name="print_init" ColumnName="print_init" />
<ScalarProperty Name="partno" ColumnName="partno" />
@@ -5863,6 +5871,7 @@
<ScalarProperty Name="demo" ColumnName="demo" />
<ScalarProperty Name="customize_data" ColumnName="customize_data" />
<ScalarProperty Name="printed_files" ColumnName="printed_files" />
<ScalarProperty Name="style" ColumnName="style" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
+3 -3
View File
@@ -4,12 +4,12 @@
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- Diagram content (shape and connector positions) -->
<edmx:Diagrams>
<Diagram DiagramId="b267a343dc0c4bf0ae194b775754b108" Name="Diagram1" ZoomLevel="78">
<Diagram DiagramId="b267a343dc0c4bf0ae194b775754b108" Name="Diagram1" ZoomLevel="116">
<EntityTypeShape EntityType="Model.accounting" Width="1.5" PointX="22.5" PointY="22.125" IsExpanded="true" />
<EntityTypeShape EntityType="Model.accounting_files" Width="1.5" PointX="15.75" PointY="27.75" IsExpanded="true" />
<EntityTypeShape EntityType="Model.accounting_kind" Width="1.5" PointX="11.25" PointY="27.625" IsExpanded="true" />
<EntityTypeShape EntityType="Model.accounting_kind2" Width="1.5" PointX="13.5" PointY="11.25" IsExpanded="true" />
<EntityTypeShape EntityType="Model.actItem" Width="1.5" PointX="9.25" PointY="7.875" IsExpanded="true" />
<EntityTypeShape EntityType="Model.actItem" Width="1.5" PointX="8.375" PointY="27.25" IsExpanded="true" />
<EntityTypeShape EntityType="Model.actItem_files" Width="1.5" PointX="16.5" PointY="5.875" IsExpanded="true" />
<EntityTypeShape EntityType="Model.actItem_kind" Width="1.5" PointX="6.125" PointY="7.875" IsExpanded="true" />
<EntityTypeShape EntityType="Model.activity" Width="1.5" PointX="3" PointY="8.875" IsExpanded="true" />
@@ -17,7 +17,7 @@
<EntityTypeShape EntityType="Model.activity_check" Width="1.5" PointX="5.25" PointY="18.5" IsExpanded="true" />
<EntityTypeShape EntityType="Model.activity_kind" Width="1.5" PointX="0.75" PointY="11.625" IsExpanded="true" />
<EntityTypeShape EntityType="Model.activity_kind_detail" Width="1.5" PointX="13.5" PointY="3.875" IsExpanded="true" />
<EntityTypeShape EntityType="Model.activity_relating" Width="1.5" PointX="10.5" PointY="9.875" IsExpanded="true" />
<EntityTypeShape EntityType="Model.activity_relating" Width="1.5" PointX="11.25" PointY="9.875" IsExpanded="true" />
<EntityTypeShape EntityType="Model.activity_spares" Width="1.5" PointX="13.5" PointY="7.75" IsExpanded="true" />
<EntityTypeShape EntityType="Model.admin" Width="1.5" PointX="6" PointY="1.375" IsExpanded="true" />
<EntityTypeShape EntityType="Model.admin_group" Width="1.5" PointX="3.75" PointY="3.625" IsExpanded="true" />
+1 -1
View File
@@ -28,7 +28,7 @@ namespace MyWeb
public AdmItem info { get; set; }
//定義欄位cookie==================start
public class AdmItem
public class AdmItem
{
public int num { get; set; }
public string u_id { get; set; }
+16 -11
View File
@@ -103,17 +103,18 @@ public class FollowerController : ApiController
{
foreach (var item in prod)
{
foreach (var item2 in item.pro_order_detail1)
item2.from_id = null; //清空訂單明細的陽上報恩者from_id //f_num設定串聯刪除
//foreach (var item2 in item.pro_order_detail1)
// item2.from_id = null; //清空訂單明細的陽上報恩者from_id //f_num設定串聯刪除
foreach (var item2 in item.pro_order)
item2.introducer = null;
//foreach (var item2 in item.pro_order)
// item2.introducer = null;
item.leader = null;//清空leader
//item.leader = null;//清空leader
_db.followers.RemoveRange(prod);
}
_db.followers.RemoveRange(prod);
//_db.followers.RemoveRange(prod);
_db.SaveChanges();
Model.admin_log admin_log = new Model.admin_log();
@@ -150,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)
@@ -173,7 +176,7 @@ public class FollowerController : ApiController
}
}
// 電話/證號搜尋 (使用 search_keywords HEX 編碼)
if (!string.IsNullOrEmpty(q.phone_idcode) && GlobalVariables.UseSearchKeywords)
{
@@ -655,8 +658,10 @@ public class FollowerController : ApiController
list = orderrecord.Select(x => new
{
orderno = x.order_no,
startdate = x.reg_time,
endtime = x.up_time,
//startdate = x.reg_time,
//endtime = x.up_time,
startdate = x.activity.startDate_solar,
enddate = x.activity.endDate_solar,
pwcount = x.pro_order_detail.Where(a => a.actItem.act_bom.Where(b => b.item_num == a.actItem_num && b.package_num == null).Count() == 0).Count(),
amount = x.pro_order_detail.Select(o => (float?)o.price).Sum(),
activityname = x.activity.subject,
+71 -17
View File
@@ -1,14 +1,18 @@
using System;
using DocumentFormat.OpenXml.Drawing.Spreadsheet;
using Model;
using Newtonsoft.Json;
using Org.BouncyCastle.Crypto;
using PagedList;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using PagedList;
using Newtonsoft.Json;
using System.Collections;
using System.Web.Services;
using static TreeView;
using System.Data.Entity;
// api/activity
//[ezAuthorize(Roles = "admin")]//群組:*
@@ -126,6 +130,12 @@ public class activityController : ApiController
if (prod != null)
{
////prod.IsDel = true; ////不確定是否新增欄位? 先註解
// 先刪除子項目
var prod2 = _db.act_bom.Where(q => q.package_num == prod.num).ToList();
_db.act_bom.RemoveRange(prod2);
_db.actItems.Remove(prod);
_db.SaveChanges();
Model.admin_log admin_log = new Model.admin_log();
MyWeb.admin admin = new MyWeb.admin();//api裡不可以用MyWeb
@@ -190,12 +200,18 @@ public class activityController : ApiController
if (prod.Count() > 0)
{
//var prod2 = _db.actItem_files.AsEnumerable().Where(q => ids.Contains(Convert.ToInt32(q.actItem_num))).ToList();
var prod2 = _db.actItem_files.Where(q => ids.Contains(q.actItem_num)).ToList();
if (prod2.Count > 0)
{
_db.actItem_files.RemoveRange(prod2);
//_db.SaveChanges();
}
//var prod2 = _db.actItem_files.Where(q => ids.Contains(q.actItem_num)).ToList();
//if (prod2.Count > 0)
//{
// _db.actItem_files.RemoveRange(prod2);
// //_db.SaveChanges();
//}
// 先刪除子項目
var parentBoms = _db.act_bom.Where(q => q.item_num.HasValue && ids.Contains(q.item_num.Value)).ToList();
var parentIds = parentBoms.Select(x => x.num).ToList(); // 取得母件 id
var childBoms = _db.act_bom.Where(q => q.package_num.HasValue && parentIds.Contains(q.package_num.Value)).ToList();
_db.act_bom.RemoveRange(childBoms);
_db.actItems.RemoveRange(prod);
_db.SaveChanges();
@@ -282,6 +298,7 @@ public class activityController : ApiController
var count = qry.Count(); //pageSize = count;//一次取回??
var qryList = (pageSize > 0) ? qry.ToPagedList(page, pageSize).ToList() : qry.ToList();
var ret = new
{
list = qryList.Select(x => new
@@ -301,17 +318,48 @@ public class activityController : ApiController
startDate_lunar = x.startDate_lunar,
endDate_lunar = x.endDate_lunar,
dueDate = x.dueDate,
orderCounts= _db.pro_order.Where(y => y.activity_num == x.num).Count(),
}),
count = count,
}),
count = count
};
};
if (ret.list == null) throw new HttpResponseException(HttpStatusCode.NotFound);
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,
@@ -416,8 +464,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;//一次取回??
@@ -1301,7 +1355,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
+302
View File
@@ -0,0 +1,302 @@
using Microsoft.Ajax.Utilities;
using MINOM.COM.Utility;
using Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Http;
/// <summary>
/// designerController 的摘要描述
/// </summary>
public class designerController : ApiController
{
private Model.ezEntities _db = new Model.ezEntities();
public designerController()
{
//
// TODO: 在這裡新增建構函式邏輯
//
}
[HttpPost]
[Route("api/tablet/GetActItem")]
public IHttpActionResult GetActItem([FromBody] dynamic data)
{
LogUtility log = new LogUtility();
var json = data;
string itemNum = (json == null || json.itemNum == null) ? "" : (string)json.itemNum;
int num = int.Parse(itemNum);
var item=_db.actItems.AsQueryable().Where(x => x.num == num).FirstOrDefault();
return Ok(new { result = "Y", data =item});
}
[HttpPost]
[Route("api/tablet/GetTabletElement")]
public IHttpActionResult GetTabletElement([FromBody] dynamic data)
{
LogUtility log = new LogUtility();
var json = data;
string elementID = (json == null || json.elementID == null) ? "" : (string)json.elementID;
object[] obj = new StyleDataAccess().GetTabletElement(elementID, "");
if (obj[0].ToString() == "Y")
{
return Ok(new { result = "Y", data = obj[2] });
}
else
{
return Ok(new { result = "N", message = obj[1] });
//throw new HttpResponseException(HttpStatusCode.NotFound);
}
//return Ok(data);
}
[HttpPost]
[Route("api/tablet/GetStyleDetailData")]
public IHttpActionResult GetStyleDetailData([FromBody] dynamic data)
{
LogUtility log = new LogUtility();
var json = data;
string styleID = (json == null || json.styleID == null) ? "" : (string)json.styleID;
object[] obj = new StyleDataAccess().GetStyleDetail(styleID, "");
if (obj[0].ToString() == "Y")
{
return Ok(new { result = "Y", data = obj[2] });
}
else
{
return Ok(new { result = "N", message = obj[1] });
//throw new HttpResponseException(HttpStatusCode.NotFound);
}
//return Ok(data);
}
[HttpPost]
[Route("api/tablet/saveFamily")]
public IHttpActionResult saveFamily([FromBody] family_members familyMember)
{
LogUtility log = new LogUtility();
_db.family_members.Add(familyMember);
_db.SaveChanges();
return Ok(new { result = "Y", data= familyMember });
//object[] obj = new StyleDataAccess().GetStyle("", "");
//if (obj[0].ToString() == "Y")
//{
// return Ok(new { result = "Y", data = obj[2] });
//}
//else
//{
// return Ok(new { result = "N", message = obj[1] });
// //throw new HttpResponseException(HttpStatusCode.NotFound);
//}
//return Ok(data);
}
[HttpPost]
[Route("api/tablet/GetStyleData")]
public IHttpActionResult GetStyleData([FromBody] dynamic data)
{
LogUtility log = new LogUtility();
object[] obj = new StyleDataAccess().GetStyle("", "");
if (obj[0].ToString() == "Y")
{
return Ok(new { result = "Y", data = obj[2] });
}
else
{
return Ok(new { result = "N", message = obj[1] });
//throw new HttpResponseException(HttpStatusCode.NotFound);
}
//return Ok(data);
}
[HttpPost]
[Route("api/tablet/SavDegignerData")]
public IHttpActionResult SavDegignerData([FromBody] dynamic data)
{
LogUtility log = new LogUtility();
var json = data;
//json.detail.Children<JObject>()
log.writeLogPath((string)json.styleName);
TabletStyle ts = new TabletStyle();
List<TabletStyleDetail> list = new List<TabletStyleDetail>();
ts.StyleID = (json == null || json.styleID == null) ? "" : (string)json.styleID;
string mode = "edit";
if (string.IsNullOrEmpty(ts.StyleID))
{
ts.StyleID = DateTime.Now.ToString("yyyyMMddHHmmss");
mode = "add";
}
ts.Name = (json == null || json.styleName == null) ? "" : (string)json.styleName;
ts.Descr = (json == null || json.descr == null) ? "" : (string)json.descr;
ts.PaperSize = (json == null || json.paperSize == null) ? "" : (string)json.paperSize;
ts.BackendImg = (json == null || json.backendImg == null) ? "" : (string)json.backendImg;
ts.PrintSize = (json == null || json.printSize == null) ? "" : (string)json.printSize;
ts.Orientation = (json == null || json.orientation == null) ? "" : (string)json.orientation;
ts.PrintPageCount = (json == null || json.printPageCount == null) ? "" : (string)json.printPageCount;
ts.PrintMode = (json == null || json.printMode == null) ? "" : (string)json.printMode;
ts.RosterLimit=(json == null || json.rosterLimit == null) ? "" : (string)json.rosterLimit;
foreach (var item in json.detail.Children<JObject>())
{
TabletStyleDetail tsd = new TabletStyleDetail();
tsd.StyleID = ts.StyleID;
tsd.Name = item.name == null ? "" : (string)item.name;
tsd.Descr = item.descr == null ? "" : (string)item.descr;
tsd.ElementID = item.elementID == null ? "" : (string)item.elementID;
tsd.StartX = item.startX == null ? "" : (string)item.startX;
tsd.StartY = item.startY == null ? "" : (string)item.startY;
tsd.FontSize = item.fontSize == null ? "" : (string)item.fontSize;
tsd.FontFamily = item.fontFamily == null ? "" : (string)item.fontFamily;
tsd.BreakLen = item.breakLen == null ? "" : (string)item.breakLen;
tsd.Width = item.width == null ? "" : (string)item.width;
tsd.Height = item.height == null ? "" : (string)item.height;
tsd.TextWidth = item.textWidth == null ? "" : (string)item.textWidth;
tsd.TextHeight = item.textHeight == null ? "" : (string)item.textHeight;
tsd.TwoOffset = item.twoOffset == null ? "" : (string)item.twoOffset;
tsd.ThreeOffset = item.threeOffset == null ? "" : (string)item.threeOffset;
tsd.FourOffset = item.fourOffset == null ? "" : (string)item.fourOffset;
tsd.IsActive = item.isActive == null ? "" : (string)item.isActive;
list.Add(tsd);
}
if (mode == "add")
{
object[] obj = new StyleDataAccess().AddStyle(ts, list);
if (obj[0].ToString() == "Y")
{
return Ok(new { result = "Y" });
}
else
{
return Ok(new { result = "N" });
}
}
return Ok();
}
[HttpPost]
[Route("api/tablet/UpdateDegignerData")]
public IHttpActionResult UpdateDegignerData([FromBody] dynamic data)
{
LogUtility log = new LogUtility();
var json = data;
//json.detail.Children<JObject>()
log.writeLogPath((string)json.styleName);
TabletStyle ts = new TabletStyle();
List<TabletStyleDetail> list = new List<TabletStyleDetail>();
ts.StyleID = (json == null || json.styleID == null) ? "" : (string)json.styleID;
string mode = "edit";
if (string.IsNullOrEmpty(ts.StyleID))
{
ts.StyleID = DateTime.Now.ToString("yyyyMMddHHmmss");
mode = "add";
}
ts.Name = (json == null || json.styleName == null) ? "" : (string)json.styleName;
ts.Descr = (json == null || json.descr == null) ? "" : (string)json.descr;
ts.PaperSize = (json == null || json.paperSize == null) ? "" : (string)json.paperSize;
ts.BackendImg = (json == null || json.backendImg == null) ? "" : (string)json.backendImg;
ts.PrintSize = (json == null || json.printSize == null) ? "" : (string)json.printSize;
ts.Orientation = (json == null || json.orientation == null) ? "" : (string)json.orientation;
ts.PrintPageCount = (json == null || json.printPageCount == null) ? "" : (string)json.printPageCount;
ts.PrintMode = (json == null || json.printMode == null) ? "" : (string)json.printMode;
ts.RosterLimit = (json == null || json.rosterLimit == null) ? "" : (string)json.rosterLimit;
foreach (var item in json.detail.Children<JObject>())
{
TabletStyleDetail tsd = new TabletStyleDetail();
tsd.StyleID = ts.StyleID;
tsd.Name = item.name == null ? "" : (string)item.name;
tsd.Descr = item.descr == null ? "" : (string)item.descr;
tsd.ElementID = item.elementID == null ? "" : (string)item.elementID;
tsd.StartX = item.startX == null ? "" : (string)item.startX;
tsd.StartY = item.startY == null ? "" : (string)item.startY;
tsd.FontSize = item.fontSize == null ? "" : (string)item.fontSize;
tsd.FontFamily = item.fontFamily == null ? "" : (string)item.fontFamily;
tsd.BreakLen = item.breakLen == null ? "" : (string)item.breakLen;
tsd.Width = item.width == null ? "" : (string)item.width;
tsd.TwoOffset = item.twoOffset == null ? "" : (string)item.twoOffset;
tsd.ThreeOffset = item.threeOffset == null ? "" : (string)item.threeOffset;
tsd.FourOffset = item.fourOffset == null ? "" : (string)item.fourOffset;
tsd.IsActive = item.isActive == null ? "" : (string)item.isActive;
tsd.Width = item.width == null ? "" : (string)item.width;
tsd.Height = item.height == null ? "" : (string)item.height;
tsd.TextWidth = item.textWidth == null ? "" : (string)item.textWidth;
tsd.TextHeight = item.textHeight == null ? "" : (string)item.textHeight;
list.Add(tsd);
}
object[] obj = new StyleDataAccess().UpdateStyle(ts, list);
if (obj[0].ToString() == "Y")
{
return Ok(new { result = "Y" });
}
else
{
return Ok(new { result = "N" });
}
}
[HttpPost]
[Route("api/tablet/GetPaperSize")]
public IHttpActionResult GetPaperSize([FromBody] dynamic data)
{
LogUtility log = new LogUtility();
object[] obj = new StyleDataAccess().GetTabletPaper("", "");
if (obj[0].ToString() == "Y")
{
return Ok(new { result = "Y", data = obj[2] });
}
else
{
return Ok(new { result = "N", message = obj[1] });
//throw new HttpResponseException(HttpStatusCode.NotFound);
}
//return Ok(data);
}
[HttpPost]
[Route("api/tablet/SavePaperSize")]
public IHttpActionResult SavePaperSize([FromBody] dynamic data)
{
LogUtility log = new LogUtility();
var json = data;
//json.detail.Children<JObject>()
log.writeLogPath((string)json.styleName);
TabletPaperSize tps = new TabletPaperSize();
tps.PaperID = (json == null || json.paperID == null) ? "" : (string)json.paperID;
if (string.IsNullOrEmpty(tps.PaperID))
{
tps.PaperID = DateTime.Now.ToString("yyyyMMddHHmmss");
}
tps.PaperName = (json == null || json.paperName == null) ? "" : (string)json.paperName;
tps.Width = (json == null || json.width == null) ? "" : (string)json.width;
tps.Height = (json == null || json.height == null) ? "" : (string)json.height;
tps.CUser = "";
tps.CDate = DateTime.Now.ToString("yyyyMMdd");
tps.CTime = DateTime.Now.ToString("HHmmss");
tps.UUser = "";
tps.UDate = DateTime.Now.ToString("yyyyMMdd");
tps.UTime = DateTime.Now.ToString("HHmmss");
object[] obj = new StyleDataAccess().AddTabletPaper(tps);
if (obj[0].ToString()=="Y")
{
return Ok(new { result = "Y" });
}
else
{
return Ok(new { result = "N"});
}
}
}
+27 -11
View File
@@ -1,17 +1,19 @@
using System;
using DocumentFormat.OpenXml.Drawing.Charts;
using Model;
using MyWeb;
using Newtonsoft.Json;
using PagedList;
using System;
using System.Activities.Expressions;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IdentityModel.Metadata;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using PagedList;
using Newtonsoft.Json;
using System.Collections;
using static TreeView;
using Model;
using System.IdentityModel.Metadata;
using MyWeb;
using DocumentFormat.OpenXml.Drawing.Charts;
// api/order
@@ -206,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);//品項
@@ -221,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))
@@ -291,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);
@@ -307,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
};
@@ -447,6 +460,7 @@ public class orderController : ApiController
? x.num.ToString()
: (x.parent_num.ToString() + x.num.ToString())
),
style=x.style??""
//cash_record = x.pro_order_record.Select( c => new {
// c,
// //pay_kind = tdesc2[c.payment.HasValue && x.keyin1.Value > 0 ? x.keyin1.Value : 1],
@@ -683,7 +697,7 @@ public class orderController : ApiController
.Where(q => q.num == item.num)
.FirstOrDefault();//修改
if (order != null)
{
{
order.actItem_num = (item.actItem_num.HasValue && item.actItem_num.Value > 0)
? item.actItem_num : null;
order.f_num = (item.f_num.HasValue && item.f_num.Value > 0)
@@ -712,6 +726,7 @@ public class orderController : ApiController
order.demo = item.demo;
order.customize_data = item.customize_data;
order.UpdateTime = DateTime.Now;
order.style = item.style;
_db.SaveChanges();
var ret = new
{
@@ -765,6 +780,7 @@ public class orderController : ApiController
demo = item.demo,
customize_data = item.customize_data,
UpdateTime = DateTime.Now,
style=item.style
};
_db.pro_order_detail.Add(orderDetail);
_db.SaveChanges();
+44 -5
View File
@@ -1,14 +1,18 @@
using System;
using com.itextpdf.text.pdf;
using Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PagedList;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.SqlClient;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using PagedList;
using Newtonsoft.Json;
using System.Collections;
using static TreeView;
using System.Data.Entity;
/// <summary>
/// orderdetail 的摘要说明
@@ -59,4 +63,39 @@ public class orderdetailController:ApiController
if (ret.list == null) throw new HttpResponseException(HttpStatusCode.NotFound);
return Ok(ret);
}
[HttpPost]
[Route("api/orderdetail/GetDetailToPrint")]
public IHttpActionResult GetDetailToPrint([FromBody] dynamic data)
{
if (data.param is Newtonsoft.Json.Linq.JArray items)
{
string[] details = new string[items.Count];
int i = 0;
foreach (var item in items)
{
details[i] = item["order_no"] + item["num"].ToString();
i++;
}
var parameters = details.Select((s,j)=>"@p"+j).ToArray();
string sql = $"select * from pro_order_detail where order_no+convert(varchar,num) in ({string.Join(",",parameters)}) ";
int l =0;
List<SqlParameter> sqlList = new List<SqlParameter>();
foreach (var item in details)
{
sqlList.Add( new SqlParameter("@p" + l, item));
l++;
}
SqlParameter[] p = sqlList.ToArray();
var ret = _db.Database.SqlQuery<pro_order_detail>(sql, p).ToList();
if (ret == null) throw new HttpResponseException(HttpStatusCode.NotFound);
return Ok(ret);
}
else
{
throw new HttpResponseException(HttpStatusCode.NotFound);
}
}
}
@@ -10,6 +10,7 @@ using System.Collections;
using MyWeb;
using System.Web.WebPages;
using System.Data.Entity;
using Model;
[ezAuthorize]
public class transfer_registerController : ApiController
@@ -269,6 +270,7 @@ public class transfer_registerController : ApiController
public string check_memo { get; set; }
public string draft { get; set; }
public int? acc_kind { get; set; } // 新增關聯欄位
public int? kind { get; set; }
}
[HttpPost]
@@ -315,7 +317,7 @@ public class transfer_registerController : ApiController
{
uptime = dto.check_date,
category = 1, // 收入
kind = 27, // 固定值:法會收入/功德項目
kind = dto.kind,//27, // 固定值:法會收入/功德項目
kind2 = dto.acc_num,
price = (float)(dto.check_amount ?? 0),
tax = 0,
@@ -346,6 +348,7 @@ public class transfer_registerController : ApiController
item.check_memo = dto.check_memo;
item.draft = dto.draft;
item.acc_kind = dto.acc_kind;
}
}
_db.SaveChanges();
@@ -958,7 +961,10 @@ public class transfer_registerController : ApiController
activity_name = x.activity != null ? x.activity.subject : "",
activity_num = x.activity_num,
acc_name = x.acc_num != null ? _db.accounting_kind2.Where(a => a.num == x.acc_num).Select(a => a.kind).FirstOrDefault() : "",
price_totals=_db.pro_order_detail.
Where(a => _db.pro_order.Where (po=>po.f_num==x.f_num&&po.activity_num==x.activity_num).
Select(po => po.order_no).Any(p=>p.Equals(a.order_no))).Sum(a => a.price*a.qty),
pay_totals=_db.transfer_register.Where(a=>a.activity_num==x.activity_num&&a.f_num==x.f_num).Sum(a=>a.check_amount),
// pro_order_record 資訊 (透過 transfer_id 關聯)
pro_order_records = x.pro_order_record.Select(pr => new {
pr.num,
@@ -8,7 +8,7 @@
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>D:\17168web</PublishUrl>
<PublishUrl>C:\17168web</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<_TargetId>Folder</_TargetId>
<SiteUrlToLaunchAfterPublish />
@@ -16,6 +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');
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)
{
+128 -52
View File
@@ -23,6 +23,8 @@
data() {
return {
this_id: '<%= Request["num"] %>',
paperlist: [],
stylelist: [],
options: {},
optionsDetail: {
multiSort: false,
@@ -43,7 +45,7 @@
{ id: 'kind', title: '分類名稱' },
],
selected: {},
select(item,t) {
select(item, t) {
console.log("select search1", t);
}
},
@@ -60,7 +62,7 @@
{ id: 'subject', title: '文件名稱' },
],
selected: {},
select(item,t) {
select(item, t) {
console.log("select search2", t);
item.files_num_selected.text = t.subject //=====?
@@ -71,26 +73,26 @@
id: 'search3',
title: '子項目',
text_prop: 'subject',
value_prop: 'num',
keys: [
{ id: 'subject', title: '項目名稱', value: '' },
{ id: 'kindTxt', title: '項目分類' },
],
api_url: HTTP_HOST + 'api/activity/GetItemList',
columns: [
{ id: 'subject', title: '項目名稱', value: '' },
{ id: 'kindTxt', title: '項目分類' },
],
selected: {},
select(item,t) {
console.log("select search3", item, t);
//debugger;
item.actItem.subject = t.subject
item.actItem.num = t.num
item.item_num_selected={
text: t.subject,
val : t.num
}
value_prop: 'num',
keys: [
{ id: 'subject', title: '項目名稱', value: '' },
{ id: 'kindTxt', title: '項目分類' },
],
api_url: HTTP_HOST + 'api/activity/GetItemList',
columns: [
{ id: 'subject', title: '項目名稱', value: '' },
{ id: 'kindTxt', title: '項目分類' },
],
selected: {},
select(item, t) {
console.log("select search3", item, t);
//debugger;
item.actItem.subject = t.subject
item.actItem.num = t.num
item.item_num_selected = {
text: t.subject,
val: t.num
}
// item.bom_editedItem.actItem.subject = t.subject
// item.bom_editedItem.actItem.num = t.num
@@ -98,11 +100,11 @@
// text : t.subject,
// val = t.num
// }
}
////新增/修改+關閉時, 會清空/還原
}
////新增/修改+關閉時, 會清空/還原
},
},
},
show: false,
current: {},
list: [],
@@ -142,7 +144,7 @@
editedItem: {
id: 0,
num: 0,
actItem_num: 0,
actItem_num: 0,
files_num_selected: {
text: '',
val: 0
@@ -175,12 +177,12 @@
'items-per-page-options': []
},
bom_list: [],
bom_count: 0,
bom_count: 0,
bom_editedIndex: -1,
bom_editedItem: {
id: 0,
num: 0,
package_num: 0,
package_num: 0,
//item_num: 0,
item_num_selected: {
text: '',
@@ -190,13 +192,13 @@
bom_defaultItem: {
id: 0,
num: 0,
package_num: 0,
package_num: 0,
//item_num: 0,
item_num_selected: {
text: '',
val: 0
},
},
},
}
},
mounted() {
@@ -243,8 +245,8 @@
});
//necessary parameter===
if (this.search_dialog.current.id == 'search1') {
if (this.this_id=="")
search['status'] = "Y";//啟用
if (this.this_id == "")
search['status'] = "Y";//啟用
}
console.log("search_get", api_url, search, params, this.options);
this.search_dialog.loading = true
@@ -292,7 +294,7 @@
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(editem,row);
curr.select(editem, row);
}
this.search_dialog.show = false;
//console.log(row, row["u_name"], row["f_number"], curr.id, target);
@@ -309,7 +311,7 @@
actItem_num: this.this_id,
}
axios
.post(HTTP_HOST + 'api/activity/GetItemFiles',
.post(HTTP_HOST + 'api/activity/GetItemFiles',
searchItemDetail, { params: params })
.then(response => {
this.desserts = response.data.list
@@ -323,7 +325,7 @@
item_num: this.this_id,
}
axios
.post(HTTP_HOST + 'api/activity/GetItemBomList',
.post(HTTP_HOST + 'api/activity/GetItemBomList',
searchItemBom, { params: params })
.then(response => {
this.bom_list = response.data.list
@@ -334,6 +336,50 @@
)
}
axios
.post(HTTP_HOST + 'api/tablet/GetPaperSize', {})
.then(response => {
console.log(response);
if (response.status == "200") {
let data = response.data;
if (data.result == "Y") {
data.data.forEach(x => {
this.paperlist.push({ name: x.paperName, id: x.paperID, width: x.width, height: x.height })
$('#<%= ddlPageSize.ClientID %>').append(`<option value="${x.paperID}">${x.paperName}</option>`);
$('#<%= ddlPrintSize.ClientID %>').append(`<option value="${x.paperID}">${x.paperName}</option>`);
});
$('#<%= ddlPageSize.ClientID %>').val($("#<%= hidPageSize.ClientID %>").val())
$('#<%= ddlPrintSize.ClientID %>').val($("#<%= hidPrintSize.ClientID %>").val())
}
}
})
.catch(
error => console.log(error)
)
axios
.post(HTTP_HOST + 'api/tablet/GetStyleData', {})
.then(response => {
console.log(response);
if (response.status == "200") {
let data = response.data;
if (data.result == "Y") {
data.data.forEach(x => {
if (x.styleID != "000001") {
this.stylelist.push({ styleID: x.styleID, name: x.name })
$('#<%= ddlDefaultStyle.ClientID %>').append(`<option value="${x.styleID}">${x.name}</option>`);
//$("#defaultStyle").append(`<option value="${x.styleID}">${x.name}</option>`);
}
});
$('#<%= ddlDefaultStyle.ClientID %>').val($("#<%= hidDefaultStyle.ClientID %>").val())
}
}
})
.catch(
error => console.log(error)
)
},
editItem(item) {
this.editedIndex = this.desserts.indexOf(item);
@@ -360,7 +406,7 @@
}
},
cancel() {
this.spliceNullData();
this.close();
},
@@ -383,7 +429,7 @@
}, 300)
},
addNew() {
this.spliceNullData();
//addObj.id = this.desserts.length + 1;
@@ -399,12 +445,12 @@
addObj.id = (isFinite(_c) ? _c : 0) + 1;
this.desserts.unshift(addObj);
this.editItem(addObj);
},
},
save() {
if (this.editedIndex > -1) {
if (this.this_id != '') {
//chcck necessary params
if (this.editedItem.files_num_selected.val != 0 ) {
if (this.editedItem.files_num_selected.val != 0) {
//insert or update data
var pro_order_detail =
{
@@ -434,27 +480,27 @@
}
}
},
titleword() {
var e = document.getElementById("<%= category.ClientID%>");
},
titleword() {
var e = document.getElementById("<%= category.ClientID%>");
const strUser = e.options[e.selectedIndex].text;
const _kind_txt = $('#<%= kind_txt.ClientID%>').val();
const _subject = $('#<%= subject.ClientID%>').val();
return "" + strUser + "" + " " + _kind_txt + " " + _subject;
},
bom_editItem(item){
bom_editItem(item) {
this.bom_editedIndex = this.bom_list.indexOf(item);
this.bom_editedItem = $.extend(true, {}, item);
console.log("bom_editItem:", this.bom_editedIndex, this.bom_editedItem);
//debugger;
},
bom_deleteItem(item){
bom_deleteItem(item) {
confirm('確定要刪除此筆資料嗎?') && this.bom_list.splice(index, 1);
},
bom_cancel(){
bom_cancel() {
this.bom_spliceNullData();
this.bom_close();
this.bom_close();
},
bom_spliceNullData() {
//if new data ,then splice it
@@ -472,7 +518,7 @@
this.bom_editedItem = -1;
}, 300)
},
bom_addNew(){
bom_addNew() {
this.spliceNullData();
//addObj.id = this.desserts.length + 1;
@@ -491,13 +537,13 @@
if (!!this.bom_list) this.bom_list?.unshift(addObj);
this.bom_editItem(addObj);
},
bom_save(){
bom_save() {
if (this.bom_editedIndex > -1) {
if (this.this_id != '') {
//chcck necessary params
if (this.bom_editedItem.item_num_selected.val != 0 ) {
if (this.bom_editedItem.item_num_selected.val != 0) {
//insert or update data
var package_num = $(".packageNum input[type=hidden]").val();
var package_num = $(".packageNum input[type=hidden]").val();
var bom_detail =
{
num: this.bom_editedItem.num,
@@ -525,6 +571,15 @@
}
}
},
changeSel(selType) {
if (selType=="ddlPageSize") {
$("#<%= hidPageSize.ClientID %>").val($("#<%= ddlPageSize.ClientID %>").val())
} else if (selType == "ddlPrintSize") {
$("#<%= hidPrintSize.ClientID %>").val($("#<%=ddlPrintSize.ClientID %>").val())
} else if (selType == "ddlDefaultStyle") {
$("#<%= hidDefaultStyle.ClientID %>").val($("#<%= ddlDefaultStyle.ClientID %>").val())
}
}
},
computed: {
},
@@ -541,8 +596,8 @@
function setCss() {
$(".cyclePanel input").addClass("form-check-input");
}
</script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="page_nav" runat="Server">
@@ -625,6 +680,27 @@
<asp:RegularExpressionValidator ControlToValidate="price" Display="Dynamic" SetFocusOnError="true" ErrorMessage="只能輸入數字" ID="RegularExpressionValidator3" runat="server" ValidationExpression="^(-?\d+)(\.\d+)?$" />
</div>
</div>
<div class="row mb-1 label-sm-right">
<label class="col-sm-2 col-form-label">預設頁面尺寸</label>
<div class="col-sm-4">
<select ID="ddlPageSize" runat="server" onchange="VueApp.changeSel('ddlPageSize')"></select>
<asp:HiddenField ID="hidPageSize" runat="server" />
</div>
<label class="col-sm-2 col-form-label">預設列印尺寸</label>
<div class="col-sm-4">
<select ID="ddlPrintSize" runat="server" onchange="VueApp.changeSel('ddlPrintSize')"></select>
<asp:HiddenField ID="hidPrintSize" runat="server" />
</div>
</div>
<div class="row mb-1 label-sm-right">
<label class="col-sm-2 col-form-label">預設版型</label>
<div class="col-sm-4">
<select ID="ddlDefaultStyle" runat="server" onchange="VueApp.changeSel('ddlDefaultStyle')"></select>
<asp:HiddenField ID="hidDefaultStyle" runat="server" />
</div>
</div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" class="row mb-1 label-sm-right">
<ContentTemplate>
<label class="col-sm-2 col-form-label"></label>
+54 -1
View File
@@ -44,6 +44,21 @@ public partial class admin_activity_item_reg : MyWeb.config
print_init.Text = prod.print_init;
PARTNO.Text = prod.partno;
//kind.SelectedValue = prod.kind.ToString();
if (!isStrNull(prod.pageSize))
{
ddlPageSize.Value = prod.pageSize.ToString();
hidPageSize.Value = prod.pageSize.ToString();
}
if (!isStrNull(prod.printSize))
{
ddlPrintSize.Value = prod.printSize.ToString();
hidPrintSize.Value = prod.printSize.ToString();
}
if (!isStrNull(prod.defaultStyle))
{
ddlDefaultStyle.Value = prod.defaultStyle.ToString();
hidDefaultStyle.Value = prod.defaultStyle.ToString();
}
if (prod.kind.HasValue)
{
kind_txt.Value = prod.actItem_kind.kind;
@@ -118,9 +133,22 @@ 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;
actItem.partno = PARTNO.Text;
if (!isStrNull(ddlPageSize.Value))
{
actItem.pageSize = ddlPageSize.Value;
}
if (!isStrNull(ddlPrintSize.Value))
{
actItem.printSize = ddlPrintSize.Value;
}
if (!isStrNull(ddlDefaultStyle.Value))
{
actItem.defaultStyle = (ddlDefaultStyle.Value);
}
//if (!isStrNull(kind.SelectedValue)) { actItem.kind = Val(kind.SelectedValue); } else { actItem.kind = null; }
if (!isStrNull(category.SelectedValue)) { actItem.category = Val(category.SelectedValue); } else { actItem.category = null; }
if (!isStrNull(kind.Value)) { actItem.kind = Val(kind.Value); } else { actItem.kind = null; }
@@ -131,6 +159,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();
@@ -168,6 +197,18 @@ public partial class admin_activity_item_reg : MyWeb.config
actItem.subject = subject.Text;
actItem.print_init = print_init.Text;
actItem.partno = PARTNO.Text;
if (!isStrNull(hidPageSize.Value))
{
actItem.pageSize = hidPageSize.Value;
}
if (!isStrNull(hidPrintSize.Value))
{
actItem.printSize = hidPrintSize.Value;
}
if (!isStrNull(hidDefaultStyle.Value))
{
actItem.defaultStyle = (hidDefaultStyle.Value);
}
//if (!isStrNull(kind.SelectedValue)) { actItem.kind = Val(kind.SelectedValue); } else { actItem.kind = null; }
if (!isStrNull(category.SelectedValue)) { actItem.category = Val(category.SelectedValue); } else { actItem.category = null; }
if (!isStrNull(kind.Value)) { actItem.kind = Val(kind.Value); } else { actItem.kind = null; }
@@ -246,4 +287,16 @@ public partial class admin_activity_item_reg : MyWeb.config
}
}
}
//protected override void Render(HtmlTextWriter writer)
//{
// ClientScript.RegisterForEventValidation(
// ddlDefaultStyle.UniqueID, "ddlDefaultStyle");
// ClientScript.RegisterForEventValidation(
// ddlPageSize.UniqueID, "ddlPageSize");
// ClientScript.RegisterForEventValidation(
// ddlPrintSize.UniqueID, "ddlPrintSize");
// base.Render(writer);
//}
}
+91 -7
View File
@@ -590,7 +590,8 @@
this.data_table.selected.push(this.data_table.editFilesItem[i])
}
}
}, multiPrint() {
},
multiPrintNew() {
var params = {
item: this.thisItemSelected.val,
file: this.thisFilesSelected.val,
@@ -601,8 +602,81 @@
//list = this.data_table.selected.map(x => x.num);
list = this.data_table.selected
.sort((a, b) => a.print_id.localeCompare(b.print_id))
.map(x => x.num);
.sort((a, b) => (a.print_id == null ? "" : a.print_id).localeCompare(b.print_id == null ? "" : b.print_id))
.map(x => x.num);
//console.log("what:",list);
if (list.length > 0) {
// 記錄已列印
let _url = HTTP_HOST + 'api/order/printMultiFileLog';
axios.post(_url, list, { params: params })
.then(response => {
for (let i = 0; i < this.data_table.selected.length; i++) {
for (let j = 0; i < this.data_table.editFilesItem.length; j++) {
if (this.data_table.selected[i].num == this.data_table.editFilesItem[j].num) {
this.data_table.editFilesItem[j].isPrinted = true;
break;
}
}
}
})
.catch(error => {
console.log(error)
})
// 送出列印
_url = HTTP_HOST + 'admin/print/print_multi_new.aspx';
var form = document.createElement("form");
form.method = "POST";
form.action = _url;
form.target = "_blank"; // Open the result in a new tab
// Helper function to add hidden fields
const addHiddenField = (name, value) => {
const hiddenField = document.createElement("input");
hiddenField.type = "hidden";
hiddenField.name = name;
hiddenField.value = value;
form.appendChild(hiddenField);
};
// Add form fields
console.log(this.thisItemSelected.val, this.thisFilesSelected.val, JSON.stringify(list));
addHiddenField("item", this.thisItemSelected.val);
addHiddenField("file", this.thisFilesSelected.val);
addHiddenField("list", JSON.stringify(list));
addHiddenField("title", `${this.thisItemSelected.text} / ${this.thisFilesSelected.text}`);
//console.log("底家:",this.data_table.selected);
localStorage.setItem("item", this.thisItemSelected.val);
localStorage.setItem("list", JSON.stringify(this.data_table.selected));
document.body.appendChild(form); // Not entirely sure if this is necessary
form.submit();
document.body.removeChild(form);
}
else {
this.snackbar.text = "未選擇列印項目";
this.snackbar.show = true
}
},
multiPrint() {
var params = {
item: this.thisItemSelected.val,
file: this.thisFilesSelected.val,
//list: this.data_table.selected.map(x => x.num)
};
var list = [];
//list = this.data_table.selected.map(x => x.num);
list = this.data_table.selected
.sort((a, b) => (a.print_id==null?"":a.print_id).localeCompare(b.print_id==null?"":b.print_id))
.map(x => x.num);
//console.log("what:",list);
if (list.length > 0) {
// 記錄已列印
@@ -638,12 +712,16 @@
form.appendChild(hiddenField);
};
// Add form fields
// Add form fields
console.log(this.thisItemSelected.val, this.thisFilesSelected.val,JSON.stringify(list));
addHiddenField("item", this.thisItemSelected.val);
addHiddenField("file", this.thisFilesSelected.val);
addHiddenField("list", JSON.stringify(list));
addHiddenField("title", `${this.thisItemSelected.text} / ${this.thisFilesSelected.text}`);
addHiddenField("title", `${this.thisItemSelected.text} / ${this.thisFilesSelected.text}`);
//console.log("底家:",this.data_table.selected);
localStorage.setItem("item", this.thisItemSelected.val);
localStorage.setItem("list", JSON.stringify(this.data_table.selected));
/*
var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
@@ -827,7 +905,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">
@@ -1199,6 +1277,12 @@
@click="multiPrint">
列印<v-icon dark>mdi-turn-right</v-icon>
</v-btn>
<v-btn
color="primary"
class="ml-2 white--text"
@click="multiPrintNew">
列印(New)<v-icon dark>mdi-turn-right</v-icon>
</v-btn>
</div>
</v-toolbar>
</template>
+822
View File
@@ -0,0 +1,822 @@
<%@ Page Title="匯款/沖帳管" Language="C#" MasterPageFile="~/admin/Templates/TBS5ADM001/MasterPage.master" AutoEventWireup="true" CodeFile="index.aspx.cs" Inherits="admin_bill_index" %>
<asp:Content ID="Content1" ContentPlaceHolderID="page_header" Runat="Server">
<link rel="stylesheet" href="../../js/_bootstrap-icons-1.8.1/bootstrap-icons.css">
<style>
.function-icon {
font-size: 2em;
line-height: 1;
align-content: center;
}
.external-link-icon {
font-size: 0.8em;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="page_nav" Runat="Server">
<h2 class="mb-3">匯款/沖帳管理</h2>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div id="content" class="container py-4">
<div class="row">
<!-- 第一欄:匯款登錄與核對 -->
<div class="col-lg-4 mb-4">
<h5 class="text-primary mb-3">
<i class="bi bi-upload"></i> 匯款登錄與核對
</h5>
<div class="list-group">
<a href="register.aspx" class="list-group-item list-group-item-action" target="_blank">
<div class="d-flex justify-content-between align-items-start">
<div class="d-flex">
<i class="bi bi-plus-circle text-success me-3 function-icon"></i>
<div>
<div>
登錄匯款資料
<i class="bi bi-box-arrow-up-right text-muted ms-1 external-link-icon"></i>
</div>
<small class="text-muted">報名者自行填寫匯款相關資訊</small>
</div>
</div>
<span class="badge bg-primary">報名者</span>
</div>
</a>
<a href="verify.aspx" class="list-group-item list-group-item-action d-none">
<div class="d-flex justify-content-between align-items-start">
<div class="d-flex">
<i class="bi bi-person-check text-info me-3 function-icon"></i>
<div>
<div>出納核對匯款人</div>
<small class="text-muted">核對匯款人身份與報名資料</small>
</div>
</div>
<span class="badge bg-info">出納</span>
</div>
</a>
<a href="verify1.aspx" class="list-group-item list-group-item-action">
<div class="d-flex justify-content-between align-items-start">
<div class="d-flex">
<i class="bi bi-person-check text-info me-3 function-icon"></i>
<div>
<div>出納核對匯款人(階段1</div>
<small class="text-muted">初步核對匯款人身份資料</small>
</div>
</div>
<span class="badge bg-info">出納</span>
</div>
</a>
<a href="verify2.aspx" class="list-group-item list-group-item-action">
<div class="d-flex justify-content-between align-items-start">
<div class="d-flex">
<i class="bi bi-currency-dollar text-warning me-3 function-icon"></i>
<div>
<div>出納核對金額(階段2</div>
<small class="text-muted">核對匯款金額與入帳資料</small>
</div>
</div>
<span class="badge bg-warning text-dark">出納</span>
</div>
</a>
</div>
</div>
<!-- 第二欄:沖帳流程 -->
<div class="col-lg-4 mb-4">
<h5 class="text-primary mb-3">
<i class="bi bi-receipt"></i> 沖帳流程
</h5>
<div class="list-group">
<a href="personal_reconcile.aspx" class="list-group-item list-group-item-action">
<div class="d-flex justify-content-between align-items-start">
<div class="d-flex">
<i class="bi bi-person text-primary me-3 function-icon"></i>
<div>
<div>個人-沖帳流程</div>
<small class="text-muted">處理個人匯款的沖帳作業</small>
</div>
</div>
<span class="badge bg-success">會計</span>
</div>
</a>
<a href="group_reconcile.aspx" class="list-group-item list-group-item-action">
<div class="d-flex justify-content-between align-items-start">
<div class="d-flex">
<i class="bi bi-people text-success me-3 function-icon"></i>
<div>
<div>共同-沖帳流程</div>
<small class="text-muted">處理多人共同支付的沖帳作業</small>
</div>
</div>
<span class="badge bg-success">會計</span>
</div>
</a>
<a href="balance_reconcile.aspx" class="list-group-item list-group-item-action">
<div class="d-flex justify-content-between align-items-start">
<div class="d-flex">
<i class="bi bi-calculator text-danger me-3 function-icon"></i>
<div>
<div>餘額核銷</div>
<small class="text-muted">處理沖帳後剩餘金額的核銷</small>
</div>
</div>
<span class="badge bg-danger">會計</span>
</div>
</a>
</div>
</div>
<!-- 第三欄:查詢功能 -->
<div class="col-lg-4 mb-4">
<h5 class="text-primary mb-3">
<i class="bi bi-search"></i> 查詢功能
</h5>
<div class="list-group">
<a href="verify_order_record_query.aspx" class="list-group-item list-group-item-action">
<div class="d-flex justify-content-between align-items-start">
<div class="d-flex">
<i class="bi bi-journal-check text-info me-3 function-icon"></i>
<div>
<div>沖帳查詢</div>
<small class="text-muted">查詢所有沖帳記錄與明細</small>
</div>
</div>
<span class="badge bg-info">會計</span>
</div>
</a>
<a href="balance_reconcile_query.aspx" class="list-group-item list-group-item-action">
<div class="d-flex justify-content-between align-items-start">
<div class="d-flex">
<i class="bi bi-file-text text-secondary me-3 function-icon"></i>
<div>
<div>餘額核銷查詢</div>
<small class="text-muted">查詢已完成的餘額核銷記錄</small>
</div>
</div>
<span class="badge bg-secondary">會計</span>
</div>
</a>
</div>
</div>
</div>
<!-- 統計資訊 -->
<div class="row mt-4">
<div class="col-12">
<div class="alert alert-info">
<h6 class="alert-heading">
<i class="bi bi-info-circle"></i> 系統說明
</h6>
<ul class="mb-0">
<li><strong>匯款登錄與核對</strong>:處理報名者匯款資料的登錄與出納核對作業</li>
<li><strong>沖帳流程</strong>:處理個人與共同支付的沖帳作業,以及剩餘金額的核銷</li>
<li><strong>查詢功能</strong>:提供各類沖帳記錄的查詢與統計功能</li>
</ul>
</div>
</div>
</div>
</div>
<keep-alive>
<component
:is="currentView" :form-data="$data">
</component>
</keep-alive>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" Runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="footer_script" Runat="Server">
<script>
Vue.component('step-one', {
template: document.getElementById("content"),
props: ['formData'],
data() {
return {
this_act: '<%= Request["act_id"]%>',
options: { multiSort: false },
search_options: { multiSort: false },
data_table: {
loading: true,
list: [],
selected: [],
singleSelect: false,
count: 0,
page: 1,
pageSize: 10,
header: [
{ text: '活動分類', value: 'kindsTxt' },
{ text: '活動名稱', value: 'subject' },
{ text: '開始日期', value: 'startDate_solar' },
{ text: '結束日期', value: 'endDate_solar', align: 'start' },
{ text: '報名人數', value: 'orderCounts' },
{ text: '', value: 'slot_btn', sortable: false, align: 'end' }
],
footer: {
showFirstLastPage: true,
itemsPerPageOptions: [5, 10, 20, 30],
},
},
//列印管理報表
print_conditions: 'yy',
print_search: {
year: '',
month: '',
season: '',
chk_hasact: false,
chk_noact: false,
select_act: '',
select_actitem: '',
},
select_act_list: [],
select_items: {
month: [{
text: "請選擇",
val: 0
},],
season: [{
text: "請選擇",
val: 0
},],
},
print_dialog: {
show: false,
},
search_dialog: {
controls: {
search1: {
id: 'search1',
title: '國籍',
text_prop: 'name_zh',
value_prop: 'id',
keys: [
{ id: 'keyword', title: '關鍵字' },
],
api_url: HTTP_HOST + 'api/country/GetList',
columns: [
{ id: 'id', title: '代碼' },
{ id: 'name_en', title: '英文短名稱' },
{ id: 'name_zh', title: '中文名稱' },
],
selected: {},
select(item, t) {
//console.log("select search1", t);
t.search.country = item.id;
t.search.country2 = '';
}
},
search2: {
id: 'search2',
title: '報名活動',
text_prop: 'subject',
value_prop: 'num',
keys: [
{ id: 'subject', title: '活動名稱', value: '' },
{ id: 'kindTxt', title: '活動分類' },
],
api_url: HTTP_HOST + 'api/activity/GetList',
columns: [
{ id: 'subject', title: '活動名稱' },
{ id: 'kindTxt', title: '活動分類' },
],
selected: {},
select(item, t) {
t.print_search.select_act = item.num;
}
},
search3: {
id: 'search3',
title: '活動品項',
text_prop: 'subject',
value_prop: 'num',
keys: [
{ id: 'subject', title: '項目名稱', value: '' },
{ id: 'kindTxt', title: '項目分類' },
{ id: 'num', visible: false },
],
api_url: HTTP_HOST + 'api/activity/GetOrderList',
columns: [
{ id: 'subject', title: '項目名稱' },
{ id: 'kindTxt', title: '項目分類' },
],
selected: {},
select(item, t) {
t.print_search.select_actitem = item.num;
}
}
}, show: false,
current: {},
list: [],
count: 0,
page: 1,
loading: false,
footer: {
showFirstLastPage: true,
disableItemsPerPage: true,
itemsPerPageAllText: '',
itemsPerPageText: '',
},
},
search: {
keyin1: '',
order_no: '',
subject: '',
u_name: '',
up_time1: '',
up_time2: '',
actItemTxt: '',
introducerTxt: '',
activity_num: '',
country: '',
country2: '',
hasPrice: '',
}
//報到
, check_dialog: {
show: false,
},
check_data: {
f_num: 0,
u_name: '',
activity_num: 0,
activity_name: '',
qty: 1,
status: {
text: '',
val: 1
},
},
keyin1_items: [//狀態
//{
//text: "請選擇",
//val: 0
//},
],
};
},
mounted() {
this.detalKeyinArray();
this.search_dialog.current = this.search_dialog.controls.search1 ///default
if (this.this_act != '')
this.search.activity_num = this.this_act;
//this.initPrintSearch();
//this.initActivity();
const navEntries = performance.getEntriesByType("navigation");
const isReload = navEntries.length > 0 && navEntries[0].type === "reload";
if (isReload) {
sessionStorage.removeItem("orderpage");
}
else {
const savedPage = parseInt(sessionStorage.getItem('orderpage'));
if (savedPage) {
this.options.page = savedPage;
}
}
},
watch: {
options: {
handler() {
this.getDefault()
},
deep: true,
},
search_options: {
handler() {
this.search_get()
},
deep: true,
},
},
methods: {
search_show(curr) {
//console.log("btn_click:", curr, curr.api_url);
this.search_dialog.current = curr;
this.search_clear()
//this.search_get()//清除完自動會重抓, 故取消
this.search_dialog.show = true;
},
search_clear() {
if (!this.search_dialog.current.keys) return;
this.search_dialog.current.keys.forEach((t, i) => { t.value = '' })
this.search_get()
},
search_get() {
if (!this.search_dialog.current.keys) return;
let api_url = this.search_dialog.current.api_url;
let keys = this.search_dialog.current.keys;
//const { page, itemsPerPage } = this.options
//const { sortBy, sortDesc, page, itemsPerPage } = this.options
this.search_dialog.page = this.search_options.page ?? 1
let params = { page: this.search_dialog.page, pageSize: 10 };//url params
var search = {};//post body
keys.forEach((t, i) => {
search[t.id] = t.value;
});
//necessary parameter===
if (this.search_dialog.current.id == 'search2') {
params = { sortBy: 'startDate_solar', sortDesc: true, page: this.search_dialog.page, pageSize: 10 };//url params
}
console.log("search_get", api_url, search, params, this.search_options);
this.search_dialog.loading = true
axios.post(api_url, search, { params: params })
.then(response => {
this.search_dialog.list = response.data.list
this.search_dialog.count = response.data.count
this.search_dialog.loading = false
})
.catch(error => {
console.log(error)
this.search_dialog.list = []
this.search_dialog.count = 0
this.search_dialog.loading = false
this.snackbar.text = "錯誤:" + error
this.snackbar.show = true
})
},
search_headers() {
if (!this.search_dialog.current.columns) return;
r = [];
this.search_dialog.current.columns.forEach((t, i) => {
r.push({
text: t.title,
align: 'start',
sortable: false,
value: t.id,
})
})
return r
},
search_select(row) {
let curr = this.search_dialog.current;
let target = $(`[data-search-control=${curr.id}]`);
curr.selected = row;
target.children("input.search-text").val(curr.selected[curr.text_prop])//text
target.children("input:hidden").val(curr.selected[curr.value_prop])//value
if (curr.select instanceof Function) {
curr.select(row, this);
}
this.search_dialog.show = false;
//console.log(row, row["u_name"], row["f_number"], curr.id, target);
},
getDetail(clearpage = false) {
console.log("test");
const { sortBy, sortDesc, page, itemsPerPage } = this.options
const params = {
sortBy: sortBy[0], sortDesc: sortDesc[0],
page: clearpage ? '1' : page, pageSize: itemsPerPage
};
this.detail_table.loading = true
sessionStorage.setItem('orderpage', clearpage ? '1' : page);
axios
//.post(HTTP_HOST + 'api/order/GetList', this.search, { params: params })
.post(HTTP_HOST + 'api/order/GetList', this.search, { params: params })
.then(response => {
this.detail_table.list = response.data.list
this.detail_table.count = response.data.count;
this.detail_table.loading = false
})
.catch(error => console.log(error))
},
getDefault(clearpage = false) {
const { sortBy, sortDesc, page, itemsPerPage } = this.options
const params = {
sortBy: sortBy[0], sortDesc: sortDesc[0],
page: clearpage ? '1' : page, pageSize: itemsPerPage
};
this.data_table.loading = true
sessionStorage.setItem('orderpage', clearpage ? '1' : page);
axios
//.post(HTTP_HOST + 'api/order/GetList', this.search, { params: params })
.post(HTTP_HOST + 'api/activity/GetList', this.search, { params: params })
.then(response => {
this.data_table.list = response.data.list
this.data_table.count = response.data.count;
this.data_table.loading = false
})
.catch(error => console.log(error))
},
detalKeyinArray() {
var getArray = <%=Newtonsoft.Json.JsonConvert.SerializeObject(_keyin1Item, Newtonsoft.Json.Formatting.Indented) %>;
var keys = Object.keys(getArray);
for (let i = 0; i < keys.length; i++) {
//console.log(`${keys[i]}:${getArray[keys[i]]}`); //value : text
var _tmp = {
text: getArray[keys[i]],
val: parseInt(keys[i]),
}
this.keyin1_items.push(_tmp);
}
},
editItem(item) {
console.log("edit", item);
},
deleteItem(item) {
if (confirm('是否確定刪除此筆資料?')) {
const index = this.data_table.list.indexOf(item)
if (index != -1) {
axios
.delete(HTTP_HOST + 'api/order/' + item.order_no)
.then(response => {
console.log("del", item);
this.data_table.list.splice(index, 1);
this.data_table.count = this.data_table.list.length
})
.catch(error => console.log(error))
}
}
},
deleteAll() {
if (confirm('是否確定刪除已勾選的資料?')) {
axios
.delete(HTTP_HOST + 'api/order/DeleteAll/' + this.data_table.selected.map(x => x.order_no))
.then(response => {
//console.log("delAll");
//for (var i = 0; i < this.data_table.selected.length; i++) {
// const index = this.data_table.list.indexOf(this.data_table.selected[i]);
// this.data_table.list.splice(index, 1);
//}
//this.data_table.selected = [];
//this.data_table.count = this.data_table.list.length
location.reload();
})
.catch(error => console.log(error))
}
},
btn_search() {
this.this_act = '';
this.search.activity_num = '';
this.getDefault(true)
},
btn_all() {
this.this_act = '';
this.search.activity_num = '';
clearObjProps(this.search);
this.btn_search()
},
checkInMsg(item) {
this.check_data.f_num = item.f_num;
this.check_data.u_name = item.u_name;
this.check_data.activity_num = item.activity_num;
this.check_data.activity_name = item.subject;
this.check_dialog.show = true;
},
checkIn() {
if (this.check_data.qty > 0 && this.check_data.status.val > 0) {
var chechdata =
{
f_num: this.check_data.f_num,
activity_num: this.check_data.activity_num,
status: this.check_data.status.val,
qty: this.check_data.qty,
}
axios
.post(HTTP_HOST + 'api/activity/OrderCheckIn', chechdata)
.then(response => {
//清空
this.check_data.f_num = 0;
this.check_data.u_name = '';
this.check_data.activity_num = 0;
this.check_data.activity_name = '';
this.check_data.qty = 1;
this.check_data.status.text = '';
this.check_data.status.val = 1;
this.check_dialog.show = false;
msgtop('簽到成功')
})
.catch(
error => {
console.log(error)
msgtop('簽到失敗', 'error')
}
)
} else {
msgbox('報到資訊請填寫完整');
}
}, goPrint() {
let _qry = "";
Object.keys(this.search).forEach(key => {
//console.log(`${key}: ${this.search[key]}`);
if (this.search[key] != undefined && this.search[key] != null && this.search[key] != '') {
_qry += (_qry != '' ? '&' : '?') + (key + '=' + this.search[key]);
}
});
window.open("print.aspx" + _qry, '_blank');
},
countryChange() {
this.search.country = '';
$('#country_txt').val('')
},
//列印管理報表
print_close() {
this.print_dialog.show = false;
}
,
initPrintSearch() {
//下拉選單
for (let i = 1; i <= 12; i++) {
var _tmp = {
text: i,
val: i,
}
this.select_items.month.push(_tmp);
}
for (let i = 1; i <= 4; i++) {
var _tmp = {
text: i,
val: i,
}
this.select_items.season.push(_tmp);
}
//預設值
const Today = new Date();//現在日期時間
const first_date = new Date(Today.getFullYear(), Today.getMonth(), 1); //本月第一天
const last_month_date = new Date(first_date - 1); //上個月最後一天
this.print_search.year = last_month_date.getFullYear();
this.print_search.month = last_month_date.getMonth() + 1 //預設上個月的年份
let _season = 1;
const _month = first_date.getMonth() + 1; //本月
if (_month >= 1 && _month <= 3) {
_season = 4;
} else if (_month >= 4 && _month <= 6) {
_season = 1;
} else if (_month >= 7 && _month <= 9) {
_season = 2;
} else if (_month >= 10 && _month <= 12) {
_season = 3;
}
this.print_search.season = _season; //預設上一季
},
goPrint2() {
if (this.print_search.year != '') {
if (this.print_search.chk_noact || this.print_search.chk_hasact) {
let _qry = "";
Object.keys(this.print_search).forEach(key => {
if (this.print_search[key] != undefined && this.print_search[key] != null && this.print_search[key] != '') {
if (key == 'month') {
if (this.print_conditions == 'mm') {
_qry += "&month=" + this.print_search.month;
}
} else if (key == 'season') {
if (this.print_conditions == 'ss') {
_qry += "&season=" + this.print_search.season;
}
}
else {
_qry += (_qry != '' ? '&' : '?') + (key + '=' + this.print_search[key]);
}
}
});
this.print_dialog.show = false;
window.open("print.aspx" + _qry, '_blank');
} else {
msgbox('活動/非活動至少勾選一項');
}
} else {
msgbox('請輸入年份');
}
}, chk_hasact_change() {
if (!this.print_search.chk_hasact) {
//$('#activity_num_txt').val('')
//this.print_search.select_act = '';
this.clear_select_act();
$('#activity_num_txt').attr("placeholder", "可選擇單一活動(需先勾選活動報名)");
} else {
$('#activity_num_txt').attr("placeholder", "可選擇單一活動");
}
},
clear_select_act() {
$('#activity_num_txt').val('')
this.print_search.select_act = '';
}, clear_select_actitem() {
$('#actItem_num_txt').val('')
this.print_search.select_actitem = '';
},
initActivity() {
axios.get(HTTP_HOST + 'api/activity')
.then(response => {
this.select_act_list = response.data
})
.catch(error => {
console.log(error)
})
}
},
computed: {
pageCount() {
return Math.ceil(this.data_table.count / this.data_table.pageSize)
},
}
});
let VueApp = new Vue({
el: '#app',
vuetify: new Vuetify(),
data() {
return {
currentView: 'step-one',
selected_act: '',
selected_order: '',
};
}, activated() {
console.log("yes ,go go");
this.getDetail();
},
data() {
return {
options: { multiSort: false },
search_options: { multiSort: false },
sign_table: {
loading: true,
list: [],
selected: [],
singleSelect: false,
count: 0,
page: 1,
pageSize: 10,
header: [
{ text: '單號', value: 'order_no' },
{ text: '姓名', value: 'u_name' },
{ text: '報名日期', value: 'up_time' },
{ text: '單據狀態', value: 'keyin1_txt', align: 'start' },
{ text: '', value: 'slot_btn', sortable: false, align: 'end' }
],
footer: {
showFirstLastPage: true,
itemsPerPageOptions: [5, 10, 20, 30],
},
},
search: {
keyin1: '',
order_no: '',
subject: '',
u_name: '',
up_time1: '',
up_time2: '',
actItemTxt: '',
introducerTxt: '',
activity_num: '',
country: '',
country2: '',
hasPrice: '',
}
};
},
watch: {
options: {
handler() {
this.getDetail()
},
deep: true,
},
},
methods: {
getDetail() {
const { sortBy, sortDesc, page, itemsPerPage } = this.options
const params = {
//sortBy: sortBy == undefined ? "order_no" : sortBy[0],
//sortDesc: sortDesc == undefined ? "" : sortDesc[0],
//page: clearpage ? '1' : page, pageSize: itemsPerPage,
page: '1', pageSize: 10,
};
this.search = { activity_num: this.$root.selected_act }
this.detail_table.loading = true
sessionStorage.setItem('orderpage', '1');// clearpage ? '1' : page
axios
.post(HTTP_HOST + 'api/order/GetList', this.search, { params: params })
.then(response => {
this.detail_table.list = response.data.list
this.detail_table.count = response.data.count;
this.detail_table.loading = false
})
.catch(error => console.log(error))
},
},
computed: {
pageCount() {
return Math.ceil(this.detail_table.count / this.detail_table.pageSize)
},
}
});
</script>
</asp:Content>
+14
View File
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class admin_bill_index : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
+1 -1
View File
@@ -260,7 +260,7 @@ public partial class admin_follower_import : MyWeb.config
follower.introducer = ValString(sheet.Cells[currentRow, 17].Text.Trim());
//檢查國籍代碼是否存在
var country = _country.Where(x => x.name_zh == ValString(sheet.Cells[currentRow, 18].Text.Trim())).FirstOrDefault();
var country = _country.Where(x => x.name_zh == ValString(sheet.Cells[currentRow, 18].Text.Trim())).FirstOrDefault();
if(country != null)
{
//follower.country = ValString(sheet.Cells[currentRow, 18].Text.Trim());
+146 -20
View File
@@ -13,10 +13,12 @@
<a @click="print_dialog.show=true" class="btn btn-outline-primary btn-print" target="_blank">
<i class="mdi mdi-printer"></i>列印管理報表
</a>
<a @click="goPrint" class="btn btn-outline-primary btn-print" target="_blank">
<a @click="goPrint" class="btn btn-outline-primary btn-print" :class="{ 'disabled': data_table.list.length === 0 }" target="_blank">
<i class="mdi mdi-printer"></i>列印查詢資料
</a>
<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 :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="export_Click"><span class="fa-solid fa-file-excel"></span> 匯出查詢資料(Excel</asp:LinkButton>
</div>
</div>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="footer_script" runat="Server">
@@ -24,11 +26,13 @@
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 {
isSearched: false,
print_error_msg: '',
options: { multiSort: false },
search_options: { multiSort: false },
data_table: {
@@ -38,10 +42,10 @@
singleSelect: false,
count: 0,
page: 1,
pageSize: 10,
pageSize: 10,
header: [
{ text: '信眾編號', value: 'f_number', align: 'start' },
{ text: '信眾姓名', value: 'u_name'},
{ text: '信眾姓名', value: 'u_name' },
{ text: '身分別', value: 'identity_type_desc' },
{ text: '性別', value: 'sex' },
{ text: '生日', value: 'birthday' },
@@ -49,9 +53,9 @@
{ text: '', value: 'slot', sortable: false },
{ text: '', value: 'slot_btn', sortable: false, align: 'end' },
],
footer:{
footer: {
showFirstLastPage: true,
pageSizeOptions:[5,10,20,30],
pageSizeOptions: [5, 10, 20, 30],
},
},
search: {
@@ -60,7 +64,7 @@
sex: '',
//birthday: new Date().toISOString().split('T')[0],
//birthday2: new Date().toISOString().split('T')[0]
birthday:'',
birthday: '',
birthday2: '',
address: '',
country: '',
@@ -69,14 +73,14 @@
/*注意這邊的參數不能跟下方print_search重複*/
},
//列印管理報表
print_conditions:'yy',
print_conditions: 'yy',
print_search: {
year: '',
month: '',
season: '',
season: '',
},
select_items: {
month: [{
month: [{
text: "請選擇",
val: 0
},],
@@ -126,13 +130,18 @@
itemsPerPageText: '',
},
},
}
},
watch: {
options: {
handler() {
this.getList()
handler() {
if (this.isSearched) {
this.getList()
}
else {
this.data_table.loading = false;
}
},
deep: true,
},
@@ -141,23 +150,101 @@
this.search_get()
},
deep: true,
},
}, mounted() {
}
}, mounted() {
const printResult = document.getElementById('<%= hid_err_msg.ClientID %>').value;
document.getElementById('<%= hid_err_msg.ClientID %>').value = '';
window._printResult = printResult
this.search_dialog.current = this.search_dialog.controls.search1 ///default
this.initPrintSearch();
const navEntries = performance.getEntriesByType("navigation");
const isReload = navEntries.length > 0 && navEntries[0].type === "reload";
const url = new URL(window.location.href);
let params = url.searchParams;
if (params.get('dirty') === '1') { // 資料有更新時執行 getlist
this.search = JSON.parse(sessionStorage.getItem("member_query_params"));
this.getList();
params.delete('dirty');
window.history.replaceState({}, '', url.pathname + url.search);
}
if (isReload) {
sessionStorage.removeItem("followerpage");
sessionStorage.removeItem("member_list_cache");
sessionStorage.removeItem("member_query_params");
}
else if ("<%=lastAddedID%>" !== "") {
const newQuery = { f_number: '<%=lastAddedID%>' };
sessionStorage.setItem('member_query_params', JSON.stringify(newQuery));
this.search = newQuery;
this.isSearched = true;
}
else {
const savedPage = parseInt(sessionStorage.getItem('followerpage'));
const savedData = sessionStorage.getItem("member_list_cache");
const savedQuery = JSON.parse(sessionStorage.getItem("member_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_search.year = parseInt(document.getElementById('<%= hid_print_year.ClientID %>').value) || this.print_search.year;
this.print_search.month = parseInt(document.getElementById('<%= hid_print_month.ClientID %>').value) || this.print_search.month;
this.print_search.season = parseInt(document.getElementById('<%= hid_print_season.ClientID %>').value) || this.print_search.season;
this.print_conditions = document.getElementById('<%= hid_print_mode.ClientID %>').value || 'yy';
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);
});
},
methods: {
triggerManagementExport(mode) {
this.print_dialog.show = false;
this.print_error_msg = "";
if (this.print_search.year == '') {
msgbox('請輸入年份');
return;
}
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;
}
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;
@@ -228,6 +315,7 @@
//console.log(row, row["u_name"], row["f_number"], curr.id, target);
},
getList(clearpage = false) {
console.log("do getlist")
const { sortBy, sortDesc, page, itemsPerPage } = this.options
const params = {
sortBy: sortBy[0], sortDesc: sortDesc[0],
@@ -241,6 +329,9 @@
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("member_list_cache", dataToStore);
})
.catch(
error => console.log(error)
@@ -262,7 +353,7 @@
const index = this.data_table.list.indexOf(item)
if (index != -1) {
axios
.delete(HTTP_HOST + 'api/follower/' + item.num)
.delete(HTTP_HOST + 'api/follower/Delete/' + item.num)
.then(response => {
this.getList();
})
@@ -282,18 +373,23 @@
//}
//this.data_table.selected = [];
//this.data_table.count = this.data_table.list.length
location.reload();
//location.reload();
this.getList();
})
.catch(error => console.log(error))
}
},
btn_search() {
this.isSearched = true;
sessionStorage.setItem("member_query_params", JSON.stringify(this.search));
this.getList(true)
bootstrap.Offcanvas.getInstance(document.getElementById("offcanvasRight")).hide()
},
btn_all() {
this.isSearched = false;
clearObjProps(this.search);
this.btn_search()
sessionStorage.setItem("member_query_params", JSON.stringify(this.search));
//this.btn_search()
},
goPrint() {
//debugger;
@@ -309,6 +405,7 @@
//列印管理報表
print_close() {
this.print_dialog.show = false;
this.print_error_msg = "";
}
,
initPrintSearch() {
@@ -391,10 +488,31 @@
$('#country2').val('');
VueApp.search.country2 = '';
});
$(document).ready(function () {
// 判斷是否彈出 search dialog
let hasSearchResult = sessionStorage.getItem("member_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_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">
<v-data-table
v-model="data_table.selected"
@@ -508,9 +626,17 @@
</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>
+294 -183
View File
@@ -1,17 +1,20 @@
using System;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;
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.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 System.Windows.Controls;
using System.Windows.Interop;
using static TreeView;
@@ -19,16 +22,22 @@ public partial class admin_follower_index : MyWeb.config
{
public int page = 1;
private Model.ezEntities _db = new Model.ezEntities();
protected string lastAddedID;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Session["LastAddedID"] != null)
{
lastAddedID = Session["LastAddedID"].ToString();
Session.Remove("LastAddedID");
}
BuildKind();
}
else
{
}
}
@@ -42,10 +51,10 @@ public partial class admin_follower_index : MyWeb.config
//國籍
s_country.Items.Clear();
s_country.Items.Add(new ListItem("請選擇", ""));
var qry =_db.countries.OrderBy(x => x.range).ThenBy(x => x.name_en).ToList();
var qry = _db.countries.OrderBy(x => x.range).ThenBy(x => x.name_en).ToList();
if (qry.Count > 0)
{
foreach(var x in qry)
{
foreach (var x in qry)
s_country.Items.Add(new ListItem(x.name_zh, x.ID));
}
@@ -68,208 +77,310 @@ public partial class admin_follower_index : MyWeb.config
#endregion
#region Excel
#region
protected void excel_Click(object sender, EventArgs e)
protected void export_Click(object sender, EventArgs e)
{
var memoryStream = new MemoryStream();
using (var doc = SpreadsheetDocument.Create(memoryStream, SpreadsheetDocumentType.Workbook))
LinkButton btn = sender as LinkButton;
if (btn == null) return;
bool isPrintMode = (btn.ID == "print_management");
bool isExcelMode = (btn.ID == "excel_management" || btn.ID == "excel");
bool isManagementMode = (btn.ID == "excel_management" || btn.ID == "print_management");
//查詢要匯出的資料
string _query = ""; // 紀錄匯出條件
var list = searchData(ref _query, isManagementMode);
if (isExcelMode)
{
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 = 2, Width = 15, CustomWidth = true },
new Column { Min = 3, Max = 3, Width = 10, CustomWidth = true },
new Column { Min = 4, Max = 11, Width = 15, CustomWidth = true },
new Column { Min = 12, Max = 12, Width = 25, CustomWidth = true },
new Column { Min = 13, Max = 13, Width = 8, CustomWidth = true },
new Column { Min = 14, Max = 14, Width = 35, CustomWidth = true },
new Column { Min = 15, Max = 16, Width = 15, 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("LINE帳號"), 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("SHA"), DataType = CellValues.String }
);
sd.AppendChild(tr);
//查詢要匯出的資料
//紀錄匯出條件
string _query = "";
var list = searchData(ref _query);
if (list.Count > 0)
{
MyWeb.encrypt encrypt = new MyWeb.encrypt();
Model.country country = new Model.country();
var tdesc = publicFun.enum_desc<Model.follower.type>();
foreach (var item in list)
using (var doc = SpreadsheetDocument.Create(memoryStream, SpreadsheetDocumentType.Workbook))
{
//新增資料列
tr = new Row();
string s1, s2, sha;
s1= encrypt.DecryptAutoKey(item.phone);
s2= encrypt.DecryptAutoKey(item.id_code);
sha = encrypt.followerHash(s1, s2);
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 = 2, Width = 15, CustomWidth = true },
new Column { Min = 3, Max = 3, Width = 10, CustomWidth = true },
new Column { Min = 4, Max = 11, Width = 15, CustomWidth = true },
new Column { Min = 12, Max = 12, Width = 25, CustomWidth = true },
new Column { Min = 13, Max = 13, Width = 8, CustomWidth = true },
new Column { Min = 14, Max = 14, Width = 35, CustomWidth = true },
new Column { Min = 15, Max = 16, Width = 15, 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(item.f_number), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.u_name), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.sex), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(!isStrNull(item.identity_type)? tdesc[item.identity_type ?? 1] :""), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.birthday.HasValue ? ValDate(item.birthday.Value).ToString("yyyy/MM/dd") : ""), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(encrypt.DecryptAutoKey(item.phone)), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(encrypt.DecryptAutoKey(item.cellphone)), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.refuge_area), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.refuge_name), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.refugedate.HasValue ? ValDate(item.refugedate.Value).ToString("yyyy/MM/dd") : ""), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.join_date.HasValue ? ValDate(item.join_date.Value).ToString("yyyy/MM/dd") : ""), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.contactor), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(encrypt.DecryptAutoKey(item.contactor_phone)), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.blood), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(!isStrNull(item.country) ? item.country1.name_zh : ""), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.address), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.introducer), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.socialid1), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.socialid2), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.reg_time.HasValue ? ValDate(item.reg_time.Value).ToString("yyyy/MM/dd HH:mm:ss") : ""), DataType = CellValues.String }
,new Cell() { CellValue = new CellValue(encrypt.DecryptAutoKey(item.id_code)), DataType = CellValues.String }
//, new Cell() { CellValue = new CellValue(sha), 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("LINE帳號"), 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("SHA"), DataType = CellValues.String }
);
sd.AppendChild(tr);
MyWeb.encrypt encrypt = new MyWeb.encrypt();
Model.country country = new Model.country();
var tdesc = publicFun.enum_desc<Model.follower.type>();
foreach (var item in list)
{
//新增資料列
tr = new Row();
string s1, s2, sha;
s1 = encrypt.DecryptAutoKey(item.phone);
s2 = encrypt.DecryptAutoKey(item.id_code);
sha = encrypt.followerHash(s1, s2);
tr.Append(
new Cell() { CellValue = new CellValue(item.f_number), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.u_name), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.sex), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(!isStrNull(item.identity_type) ? tdesc[item.identity_type ?? 1] : ""), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.birthday.HasValue ? ValDate(item.birthday.Value).ToString("yyyy/MM/dd") : ""), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(encrypt.DecryptAutoKey(item.phone)), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(encrypt.DecryptAutoKey(item.cellphone)), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.refuge_area), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.refuge_name), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.refugedate.HasValue ? ValDate(item.refugedate.Value).ToString("yyyy/MM/dd") : ""), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.join_date.HasValue ? ValDate(item.join_date.Value).ToString("yyyy/MM/dd") : ""), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.contactor), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(encrypt.DecryptAutoKey(item.contactor_phone)), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.blood), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(!isStrNull(item.country) ? item.country1.name_zh : ""), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.address), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.introducer), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.socialid1), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.socialid2), DataType = CellValues.String },
new Cell() { CellValue = new CellValue(item.reg_time.HasValue ? ValDate(item.reg_time.Value).ToString("yyyy/MM/dd HH:mm:ss") : ""), DataType = CellValues.String }
, new Cell() { CellValue = new CellValue(encrypt.DecryptAutoKey(item.id_code)), DataType = CellValues.String }
//, new Cell() { CellValue = new CellValue(sha), 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.Follower, (int)Model.admin_log.Status.Excel, admin_log.LogViewBtn(list.Select(x => x.f_number + x.u_name).ToList()));
}
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=信眾_data.xlsx");
HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
HttpContext.Current.Response.BinaryWrite(memoryStream.ToArray());
HttpContext.Current.Response.End();
//空一列
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.Follower, (int)Model.admin_log.Status.Excel, admin_log.LogViewBtn(list.Select(x => x.f_number + x.u_name).ToList()));
hid_err_msg.Value = "success";
}
else
{
ScriptMsg2("查無資料");
//ScriptMsg2("查無資料");
hid_err_msg.Value = "nodata";
}
}
else if (isPrintMode)
{
string urlParams = "";
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 : "";
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;
}
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=信眾_data.xlsx");
HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
HttpContext.Current.Response.BinaryWrite(memoryStream.ToArray());
HttpContext.Current.Response.End();
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}', '列印信眾資料', 'noopener,noreferrer');";
ScriptManager.RegisterStartupScript(this, GetType(), "ExecutePrint", script, true);
}
else
{
hid_err_msg.Value = "nodata";
}
}
}
protected List<Model.follower> searchData(ref string _query)
protected List<Model.follower> searchData(ref string _query, bool isManagementMode = false)
{
//查詢要匯出的資料
var qry = _db.followers.AsQueryable();
//紀錄匯出條件
if (!isStrNull(s_f_number.Value))
// 管理報表
if (isManagementMode)
{
qry = qry.Where(o => o.f_number.Contains(s_f_number.Value.Trim()));
_query += "信眾編號:" + s_f_number.Value.Trim() + "\n";
}
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 : "";
if (!isStrNull(s_u_name.Value))
{
qry = qry.Where(o => o.u_name.Contains(s_u_name.Value.Trim()));
_query += "信眾姓名:" + s_u_name.Value.Trim() + "\n";
}
if (!isStrNull(s_address.Value))
{
qry = qry.Where(o => o.address.Contains(s_address.Value.Trim()));
_query += "地址:" + s_u_name.Value.Trim() + "\n";
}
// 電話/證號搜尋 (使用 search_keywords HEX 編碼)
if (!isStrNull(s_phone_idcode.Value) && GlobalVariables.UseSearchKeywords)
{
MyWeb.encrypt encrypt = new MyWeb.encrypt();
string hexSearch = encrypt.ConvertToHex(s_phone_idcode.Value.Trim());
if (!string.IsNullOrEmpty(hexSearch))
if (selYear > 0)
{
qry = qry.Where(o => o.search_keywords != null && o.search_keywords.Contains(hexSearch));
_query += "電話/證號:" + s_phone_idcode.Value.Trim() + "\n";
qry = qry.Where(o => o.join_date.HasValue && o.join_date.Value.Year == selYear);
_query += "年份:" + selYear + "\n";
}
if (selMode == "mm" && selMonth > 0)
{
qry = qry.Where(o => o.join_date.HasValue && o.join_date.Value.Month == selMonth);
_query += "月份:" + selMonth + "\n";
}
else if (selMode == "ss" && selSeason > 0)
{
if (selSeason == 1)
{
qry = qry.Where(o => o.join_date.HasValue)
.Where(o => o.join_date.Value.Month == 1 || o.join_date.Value.Month == 2 || o.join_date.Value.Month == 3);
}
else if (selSeason == 2)
{
qry = qry.Where(o => o.join_date.HasValue)
.Where(o => o.join_date.Value.Month == 4 || o.join_date.Value.Month == 5 || o.join_date.Value.Month == 6);
}
else if (selSeason == 3)
{
qry = qry.Where(o => o.join_date.HasValue)
.Where(o => o.join_date.Value.Month == 7 || o.join_date.Value.Month == 8 || o.join_date.Value.Month == 9);
}
else if (selSeason == 4)
{
qry = qry.Where(o => o.join_date.HasValue)
.Where(o => o.join_date.Value.Month == 10 || o.join_date.Value.Month == 11 || o.join_date.Value.Month == 12);
}
_query += "季度:" + selSeason + "\n";
}
qry = qry.OrderByDescending(o => o.num);
return qry.ToList();
}
if (!isStrNull(s_birthday.Value) && isDate(s_birthday.Value))
else
// 匯出查詢資料
{
qry = qry.Where(o => o.birthday >= ValDate(s_birthday.Value));
_query += "生日(起):" + s_birthday.Value.Trim() + "\n";
//紀錄匯出條件
if (!isStrNull(s_f_number.Value))
{
qry = qry.Where(o => o.f_number.Contains(s_f_number.Value.Trim()));
_query += "信眾編號:" + s_f_number.Value.Trim() + "\n";
}
if (!isStrNull(s_u_name.Value))
{
qry = qry.Where(o => o.u_name.Contains(s_u_name.Value.Trim()));
_query += "信眾姓名:" + s_u_name.Value.Trim() + "\n";
}
if (!isStrNull(s_address.Value))
{
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)
{
MyWeb.encrypt encrypt = new MyWeb.encrypt();
string hexSearch = encrypt.ConvertToHex(s_phone_idcode.Value.Trim());
if (!string.IsNullOrEmpty(hexSearch))
{
qry = qry.Where(o => o.search_keywords != null && o.search_keywords.Contains(hexSearch));
_query += "電話/證號:" + s_phone_idcode.Value.Trim() + "\n";
}
}
if (!isStrNull(s_birthday.Value) && isDate(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))
{
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);
return qry.ToList();
}
if (!isStrNull(s_birthday2.Value) && isDate(s_birthday2.Value))
{
qry = qry.Where(o => o.birthday < Convert.ToDateTime(s_birthday2.Value).AddDays(1));
_query += "生日(訖):" + s_birthday2.Value.Trim() + "\n";
}
qry = qry.OrderByDescending(o => o.num);
return qry.ToList();
}
+1
View File
@@ -8,6 +8,7 @@
<span>信眾姓名:</span><asp:Literal runat="server" ID="username"></asp:Literal>
</div>
</div>
<a href="index.aspx" class="btn btn-outline-secondary">返回</a>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="container-fluid">
+5 -4
View File
@@ -4,10 +4,11 @@
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="page_nav" Runat="Server">
<div class="scroll-nav nav nav-tabs mb-2 mb-sm-0 d-none d-sm-flex">
<div class="ms-3">
<span>信眾姓名:</span><asp:Literal runat="server" ID="username"></asp:Literal>
</div>
</div>
<div class="ms-3">
<span>信眾姓名:</span><asp:Literal runat="server" ID="username"></asp:Literal>
</div>
</div>
<a href="order_record.aspx?userid=<%=Request["userid"] %>" class="btn btn-outline-secondary">返回</a>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="container-fluid">
+17 -3
View File
@@ -3,6 +3,7 @@ using DocumentFormat.OpenXml.Vml.Office;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Information;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Web;
using System.Web.UI;
@@ -26,7 +27,7 @@ public partial class admin_follower_print_ : System.Web.UI.Page
//紀錄匯出條件
string _query = "";
var qry = _db.followers.AsQueryable();
// ❌ 錯誤寫法: qry = qry.Where(o => o.f_number.Contains(Request["f_number"].Trim()));
// LINQ to Entities 無法轉換 Request[] 方法,必須先轉換為變數再使用
string fNumberParam = Request["f_number"]?.Trim();
@@ -60,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())
@@ -85,7 +87,19 @@ 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"]))
{
+53 -33
View File
@@ -190,7 +190,7 @@
text_prop: 'name_zh',
value_prop: 'id',
keys: [
{ id: 'keyword', title: '關鍵字' },
{ id: 'keyword', title: '關鍵字' },
],
api_url: HTTP_HOST + 'api/country/GetList',
columns: [
@@ -208,11 +208,11 @@
title: '稱謂',
text_prop: 'title',
value_prop: 'num',
keys: [
keys: [
],
api_url: HTTP_HOST + 'api/appellation/GetList',
columns: [
{ id: 'title', title: '稱謂' },
{ id: 'title', title: '稱謂' },
],
selected: {},
select(item, index, t) {
@@ -230,7 +230,7 @@
{ id: 'f_number', title: '編號' },
{ id: 'u_name', title: '姓名' },
{ id: 'address', title: '地址' },
{ id: 'onlyfamily', title: '只查親屬'},
{ id: 'onlyfamily', title: '只查親屬' },
],
api_url: HTTP_HOST + 'api/follower/GetList',
columns: [
@@ -241,7 +241,7 @@
selected: {},
select(item, index, t) {
console.log("select search5", t);
}
},
},
@@ -314,10 +314,10 @@
birthday: '',
phoneDes: '',
demo: '',
appellation_id_selected :
appellation_id_selected:
{
text : '',
val : 0,
text: '',
val: 0,
},
},
@@ -372,33 +372,33 @@
],
tabletsDetail: { multiSort: false },
tabletTable: {
Loading:true,
Loading: true,
disableButton: true,
searchDetail: '',
headersDetail: [
{ text: '超渡/陽上', value: 'type', sortable: false, width: "100px" },
{ text: '* 牌位標題', value: 'title', sortable: true },
{ text: '超渡/陽上', value: 'type', sortable: false, width: "100px" },
{ text: '* 牌位標題', value: 'title', sortable: true },
{ text: '', value: 'actions', sortable: false, width: "100px" },
],
],
desserts: [],
desserts_count: 0,
editedIndex: -1,
editedItem: {
id: 0,
num: 0,
f_num: 0,
title: '',
num: 0,
f_num: 0,
title: '',
},
defaultItem: {
id: 0,
num: 0,
f_num: 0,
num: 0,
f_num: 0,
type: this.selectedTabletType,
title:'',
title: '',
},
},
//新:家人
family:{
family: {
dialog: false,
isEditing: false,
is_tw: true,
@@ -420,8 +420,8 @@
chinese_year: "",
zodiac: "",
birth_time: "",
city:"",
area:"",
city: "",
area: "",
address: "",
phone: "",
mobile: "",
@@ -440,8 +440,8 @@
chinese_year: "",
zodiac: "",
birth_time: "",
city:"",
area:"",
city: "",
area: "",
address: "",
phone: "",
mobile: "",
@@ -458,11 +458,11 @@
areaOptions: {}, // 區域選項
//天干地支:甲子, 乙丑...
chineseYears: [
'甲子', '乙丑', '丙寅', '丁卯', '戊辰', '己巳', '庚午', '辛未', '壬申', '癸酉',
'甲戌', '乙亥', '丙子', '丁丑', '戊寅', '己卯', '庚辰', '辛巳', '壬午', '癸未',
'甲申', '乙酉', '丙戌', '丁亥', '戊子', '己丑', '庚寅', '辛卯', '壬辰', '癸巳',
'甲午', '乙未', '丙申', '丁酉', '戊戌', '己亥', '庚子', '辛丑', '壬寅', '癸卯',
'甲辰', '乙巳', '丙午', '丁未', '戊申', '己酉', '庚戌', '辛亥', '壬子', '癸丑',
'甲子', '乙丑', '丙寅', '丁卯', '戊辰', '己巳', '庚午', '辛未', '壬申', '癸酉',
'甲戌', '乙亥', '丙子', '丁丑', '戊寅', '己卯', '庚辰', '辛巳', '壬午', '癸未',
'甲申', '乙酉', '丙戌', '丁亥', '戊子', '己丑', '庚寅', '辛卯', '壬辰', '癸巳',
'甲午', '乙未', '丙申', '丁酉', '戊戌', '己亥', '庚子', '辛丑', '壬寅', '癸卯',
'甲辰', '乙巳', '丙午', '丁未', '戊申', '己酉', '庚戌', '辛亥', '壬子', '癸丑',
'甲寅', '乙卯', '丙辰', '丁巳', '戊午', '己未', '庚申', '辛酉', '壬戌', '癸亥'
],
//生肖
@@ -585,7 +585,7 @@
this.search_dialog.list = response.data.list
this.search_dialog.count = response.data.count
this.search_dialog.loading = false
console.log(this.search_dialog.list)
})
.catch(error => {
console.log(error)
@@ -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">
@@ -1332,8 +1351,8 @@
</label>
</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="edit" runat="server" Text="儲存" Visible="false" OnClick="edit_Click" CssClass="btn btn-primary edit_Click noedit" />
<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>
+81 -23
View File
@@ -1,34 +1,44 @@
using System;
using Model;
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.Entity;
using System.Data.OleDb;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Globalization;
using Model;
public partial class admin_follower_reg : MyWeb.config
{
private Model.ezEntities _db = new Model.ezEntities();
public ArrayList _tmp = new ArrayList();
public bool isDataChanged = false;
public bool isAutoNumbering = ConfigurationManager.AppSettings["IsAutoNumbering"].ToString() == "true" ? true : false;
protected void Page_Load(object sender, EventArgs e)
{
CallAjax();
if (!IsPostBack)
{
{
InitEnumsOptions<Model.follower.type>(identity_type); //身分別
//var qry = _db.followers.AsEnumerable();
var qry = _db.followers.AsQueryable();
var qry = _db.followers.AsQueryable();
if (isStrNull(Request["num"]))
{
if (!isAutoNumbering)
{
f_number.ReadOnly = false;
}
if (!isStrNull(Request["leader"]))
{
int _num = Val(Request["leader"]);
@@ -50,9 +60,14 @@ public partial class admin_follower_reg : MyWeb.config
//預設國籍
country.Value = "158";
country_txt.Value = "中華民國(台灣)";
// 預設加入日期
join_date.Text = DateTime.Now.ToString("yyyy-MM-dd");
}
else
{
f_number.ReadOnly = true;
int _num = Val(Request["num"]);
var prod = qry.Where(q => q.num == _num).FirstOrDefault();
if (prod != null)
@@ -206,8 +221,11 @@ public partial class admin_follower_reg : MyWeb.config
}
}
}
// 使用新的 generate_f_number 方法,已內建重號檢查和重試機制
followers.f_number = follower.generate_f_number(sex.SelectedValue);
if (isAutoNumbering)
{
// 使用新的 generate_f_number 方法,已內建重號檢查和重試機制
followers.f_number = follower.generate_f_number(sex.SelectedValue);
}
followers.identity_type = Val(identity_type.SelectedValue);
if(!isStrNull(leader.Value)) followers.leader = Val(leader.Value);
if (!isStrNull(country.Value)) followers.country = country.Value;
@@ -239,7 +257,9 @@ public partial class admin_follower_reg : MyWeb.config
Model.admin_log admin_log = new Model.admin_log();
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Follower, (int)Model.admin_log.Status.Insert, f_number.Text + u_name.Text);
Session["LastAddedID"] = followers.f_number;
Response.Redirect("index.aspx");
}
else
@@ -282,7 +302,7 @@ public partial class admin_follower_reg : MyWeb.config
try
{
foreach (Control obj in cardBodyPanel.Controls)
{
{
if (obj is TextBox)
{
var ObjValue = followers.GetType().GetProperty(obj.ID);
@@ -300,7 +320,7 @@ public partial class admin_follower_reg : MyWeb.config
ObjValue.SetValue(followers, null);
}
}
@@ -310,22 +330,60 @@ public partial class admin_follower_reg : MyWeb.config
followers.sex = sex.SelectedValue;
followers.blood = blood.SelectedValue;
followers.tab = tab.Value.Trim(',');
followers.admin_log = admin.info.u_id + " " + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
//followers.admin_log = admin.info.u_id + " " + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
followers.follower_hash = encrypt.followerHash(followers.phone, followers.id_code);
// 如果啟用 search_keywords 功能,生成並更新 search_keywords
if (GlobalVariables.UseSearchKeywords)
{
followers.search_keywords = encrypt.GenerateSearchKeywords(followers);
}
_db.SaveChanges();
Model.admin_log admin_log = new Model.admin_log();
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Follower, (int)Model.admin_log.Status.Update, f_number.Text + u_name.Text);
// 檢查是否有修改資料
var entry = _db.Entry(followers);
this.isDataChanged = entry.CurrentValues.PropertyNames.Any(name =>
{
if (name == "admin_log" || name == "follower_hash")
return false;
Response.Redirect("index.aspx?page=" + Convert.ToString(Request["page"]));
var originalVal = entry.OriginalValues[name]?.ToString();
var currentVal = entry.CurrentValues[name]?.ToString();
// 針對加密欄位進行特殊處理
bool isEncryptedField = (name == "phone" || name == "id_code");
if (isEncryptedField)
{
string originalPlain = !string.IsNullOrEmpty(originalVal) ? encrypt.DecryptAutoKey(originalVal) : "";
string currentPlain = !string.IsNullOrEmpty(currentVal) ? encrypt.DecryptAutoKey(currentVal) : "";
return originalPlain.Trim() != currentPlain.Trim();
}
return !object.Equals(originalVal, currentVal);
});
if (this.isDataChanged)
{
followers.admin_log = admin.info.u_id + " " + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
}
else
{
entry.State = EntityState.Unchanged;
}
int isDataSaved = _db.SaveChanges();
if (isDataSaved > 0)
{
//L_msg.Type = alert_type.success;
//L_msg.Text = "修改成功";
Model.admin_log admin_log = new Model.admin_log();
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Follower, (int)Model.admin_log.Status.Update, f_number.Text + u_name.Text);
Response.Redirect("index.aspx?dirty=1&page=" + Convert.ToString(Request["page"]));
}
else
{
Response.Redirect("index.aspx?page=" + Convert.ToString(Request["page"]));
}
}
catch (Exception ex)
{
@@ -339,7 +397,7 @@ public partial class admin_follower_reg : MyWeb.config
L_msg.Type = alert_type.danger;
L_msg.Text = "查無資料";
}
/*
/*
if (chk_pro_num(f_number.Text, Val(Request["num"])))
{
}
@@ -349,7 +407,7 @@ public partial class admin_follower_reg : MyWeb.config
L_msg.Text = "信眾編號重複";
}
*/
}
}
}
#endregion
+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>
File diff suppressed because it is too large Load Diff
+13 -3
View File
@@ -23,6 +23,10 @@ public class TabletElement
public double? threeOffset { get; set; }
public double? fourOffset { get; set; }
public int? breakLen { get; set; }
public string backendInp { get; set; }
public double? textWidth { get; set; }
public double? textHeight { get; set; }
}
public class ElementStyle
@@ -43,7 +47,12 @@ public partial class admin_item_TabletDesigner :MyWeb.config
{
}
[WebMethod]
public static string SaveDesigner()
{
return "";
}
[WebMethod]
public static string GetConfig()
{
@@ -52,12 +61,13 @@ public partial class admin_item_TabletDesigner :MyWeb.config
{
elements = new List<TabletElement> {
new TabletElement {
id = "address", type = "address", text = "台中市潭子區中山路", x = 160, y = 80,
id = "address", type = "address", text = "台中市潭子區中山路", x = 60, y = 80,
style = new ElementStyle { fontSize = 24, fontFamily = "Kaiti", isVertical = true, letterSpacing = 5, lineHeight = 1.5,visibility="" }
},
new TabletElement {
id = "title1", type = "ancestor", text = "牌位正名", x = 130, y = 80,
style = new ElementStyle { fontSize = 24, fontFamily = "Kaiti", isVertical = true, letterSpacing = 5, lineHeight = 1.5 ,visibility="" }
id = "title1", type = "ancestor", text = "張一\n李二\n陳三\n吳四\n劉五\n趙六\n林七\n徐八", x = 50, y = 80,
width=136,height=600,textWidth=20,textHeight=90,
style = new ElementStyle { fontSize = 16, fontFamily = "Kaiti", isVertical = true, letterSpacing = 1, lineHeight = 1 ,visibility="" }
},
new TabletElement {
id = "lefttitle", type = "ancestor", text = "左正名", x = 10, y = 80,
+20 -8
View File
@@ -1,7 +1,7 @@
:host {
display: block;
width: 100%;
height: 100%;
width: auto;
height: auto;
--canvas-bg: #f8f9fa;
--canvas-grid: #dee2e6;
--paper-bg: #fffbf0;
@@ -16,6 +16,17 @@
/* 紙張保持米黃,因為它是實物模擬 */
}
/*.yangshang-wrapper {
display: flex !important;
flex-direction: row !important;*/ /* 垂直堆疊 */
/*justify-content: space-between !important;*/ /* 陽上與拜薦各據頂底 */
/*align-items: center !important;*/ /* 水平方向置中 */
/*height: 100% !important;
width: 100% !important;
writing-mode: vertical-rl !important;*/ /* 確保內部文字均為垂直書寫 */
/*text-orientation: upright !important;*/ /* 確保文字方向轉正 */
/*gap: 1px;
}*/
.designer-root {
/* 防止瀏覽器預設捲動影響畫布 */
@@ -27,7 +38,7 @@
background-image: linear-gradient(45deg, var(--canvas-grid) 25%, transparent 25%), linear-gradient(-45deg, var(--canvas-grid) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--canvas-grid) 75%), linear-gradient(-45deg, transparent 75%, var(--canvas-grid) 75%);
background-size: 20px 20px;
transition: background-color 0.3s;
min-height: 100vw;
/* min-height: 100vw;*/
}
@@ -67,10 +78,10 @@
/* 名單金字塔佈局容器 */
.roster-container {
width: 100%; height: 100%;
width: 100%; height: 600px;
writing-mode: vertical-rl; /* 直書 */
display: flex;
//flex-direction: column; /* 雖然是直書,但物理上我們是將「上層區」和「下層區」垂直堆疊 */
/*flex-direction: column;*/ /* 雖然是直書,但物理上我們是將「上層區」和「下層區」垂直堆疊 */
flex-direction: row; /* 上下分層 (Top / Bottom) */
align-items: center; /* 左右置中對齊 */
justify-content: center;
@@ -95,12 +106,13 @@
.roster-name {
text-orientation: upright;
font-weight: bold;
/*font-weight: bold;*/
white-space: nowrap;
line-height: 1.2;
font-family: 'Kaiti', serif;
/* 確保名字本身不會佔據過多寬度導致間距看起來很大 */
/* width: fit-content;*/
width: fit-content;
height:200px;
}
@@ -220,7 +232,7 @@
display: flex;
flex-direction: column;
align-items: center; /* 水平置中 */
justify-content: center;
justify-content: flex-start;
width: fit-content;
}
+1 -1
View File
@@ -8,7 +8,7 @@
<ul class="collapsible_item">
<asp:Repeater ID="Repeater2" runat="server" OnItemDataBound="Repeater2_ItemDataBound">
<ItemTemplate>
<li><a class="menu" href="<%#ResolveUrl(ValString(Eval("url"))) %>"
<li><a class="menu" href="<%#ResolveUrl(ValString(Eval("url"))) %>"
target="<%#(ValString(Eval("target"))=="B"?"_blank":"_self") %>"><%#Eval("title") %></a></li>
</ItemTemplate>
</asp:Repeater>
+13
View File
@@ -0,0 +1,13 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/admin/Templates/TBS5ADM001/MasterPage.master" AutoEventWireup="true" CodeFile="detail.aspx.cs" Inherits="admin_order_detail" %>
<asp:Content ID="Content1" ContentPlaceHolderID="page_header" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="page_nav" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" Runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="footer_script" Runat="Server">
</asp:Content>
+14
View File
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class admin_order_detail : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
+233 -61
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,6 +40,8 @@
vuetify: new Vuetify(vuetify_options),
data() {
return {
print_error_msg: "",
isSearched: false,
this_act : '<%= Request["act_id"]%>',
options: { multiSort: false },
search_options: { multiSort: false },
@@ -56,6 +59,7 @@
{ text: '報名日期', value: 'up_time' },
{ text: '報名活動', value: 'subject', align: 'start' },
{ text: '單據狀態', value: 'keyin1_txt' },
{ text: '報到狀態', value: 'status' },
{ text: '', value: 'slot_btn', sortable: false, align: 'end' }
],
footer:{
@@ -203,6 +207,10 @@
}
},
mounted() {
const printResult = document.getElementById('<%= hid_err_msg.ClientID %>').value;
document.getElementById('<%= hid_err_msg.ClientID %>').value = '';
window._printResult = printResult
this.detalKeyinArray();
this.search_dialog.current = this.search_dialog.controls.search1 ///default
if (this.this_act != '')
@@ -211,20 +219,63 @@
this.initActivity();
const navEntries = performance.getEntriesByType("navigation");
const isReload = navEntries.length > 0 && navEntries[0].type === "reload";
if (isReload) {
sessionStorage.removeItem("orderpage");
sessionStorage.removeItem("order_list_cache");
sessionStorage.removeItem("order_query_params");
}
else if ("<%=lastAddedNo%>" !== "") {
const newQuery = { order_no: '<%=lastAddedNo%>' };
sessionStorage.setItem('order_query_params', JSON.stringify(newQuery));
this.search = newQuery;
this.isSearched = true;
}
else {
const savedPage = parseInt(sessionStorage.getItem('orderpage'));
const savedData = sessionStorage.getItem("order_list_cache");
const savedQuery = JSON.parse(sessionStorage.getItem("order_query_params"));
if (savedQuery) {
this.search = savedQuery;
this.isSearched = true;
}
if (savedPage) {
this.options.page = savedPage;
}
}
if (savedData && savedData !== "undefined") {
this.data_table = JSON.parse(savedData);
this.isSearched = true;
}
}
if (printResult === 'nodata' || printResult === 'success') {
this.$nextTick(() => {
this.print_dialog.show = true;
if (printResult === 'nodata') {
this.print_error_msg = "查無資料,請重新選擇區間";
}
});
}
this.$nextTick(() => {
setTimeout(() => {
// 清空 URL
const cleanUrl = window.location.protocol + "//" + window.location.host + window.location.pathname;
window.history.replaceState({}, '', cleanUrl);
}, 100);
});
},
watch: {
options: {
handler() {
this.getDefault()
if (this.isSearched) {
this.getDefault()
}
else {
this.data_table.loading = false;
}
},
deep: true,
},
@@ -236,6 +287,57 @@
},
},
methods: {
triggerManagementExport(mode) {
this.print_error_msg = "";
if (this.print_search.year == '') {
msgbox('請輸入年份');
return;
}
if (!this.print_search.chk_noact && !this.print_search.chk_hasact) {
msgbox('活動/非活動至少勾選一項');
return;
}
// 將 Vue 狀態同步至 ASP.NET HiddenField,供後端 PostBack 讀取參數
document.getElementById('<%= hid_print_mode.ClientID %>').value = this.print_conditions;
document.getElementById('<%= hid_print_year.ClientID %>').value = this.print_search.year;
if (this.print_conditions == 'mm')
document.getElementById('<%= hid_print_month.ClientID %>').value = this.print_search.month;
else if (this.print_conditions == 'ss')
document.getElementById('<%= hid_print_season.ClientID %>').value = this.print_search.season;
document.getElementById('<%= hid_select_act.ClientID %>').value = this.print_search.select_act;
document.getElementById('<%= hid_select_actitem.ClientID %>').value = this.print_search.select_actitem;
document.getElementById('<%= hid_chk_hasact.ClientID %>').value = this.print_search.chk_hasact;
document.getElementById('<%= hid_chk_noact.ClientID %>').value = this.print_search.chk_noact;
let qry = "";
Object.keys(this.print_search).forEach(key => {
if (this.print_search[key] != undefined && this.print_search[key] != null && this.print_search[key] != '') {
if (key == 'month' ) {
if (this.print_conditions == 'mm') {
qry += "&month=" + this.print_search.month;
}
} else if ( key == 'season')
{
if (this.print_conditions == 'ss') {
qry += "&season=" + this.print_search.season;
}
}
else {
qry += (qry != '' ? '&' : '?') + (key + '=' + this.print_search[key]);
}
}
});
document.getElementById('<%= hid_qry.ClientID %>').value = qry;
if (mode === 'print') {
document.getElementById('<%= print_management.ClientID %>').click();
}
else if (mode === "excel") {
document.getElementById('<%= excel_management.ClientID %>').click();
}
},
search_show(curr) {
//console.log("btn_click:", curr, curr.api_url);
this.search_dialog.current = curr;
@@ -321,19 +423,24 @@
this.data_table.list = response.data.list
this.data_table.count = response.data.count;
this.data_table.loading = false
const dataToStore = JSON.stringify(this.data_table);
sessionStorage.setItem("order_list_cache", dataToStore);
})
.catch(error => console.log(error))
},
detalKeyinArray() {
var getArray = <%=Newtonsoft.Json.JsonConvert.SerializeObject(_keyin1Item, Newtonsoft.Json.Formatting.Indented) %>;
var keys = Object.keys(getArray);
for (let i = 0; i < keys.length; i++) {
//console.log(`${keys[i]}:${getArray[keys[i]]}`); //value : text
var _tmp = {
text: getArray[keys[i]],
val: parseInt(keys[i]),
if (getArray !== null) {
var keys = Object.keys(getArray);
for (let i = 0; i < keys.length; i++) {
//console.log(`${keys[i]}:${getArray[keys[i]]}`); //value : text
var _tmp = {
text: getArray[keys[i]],
val: parseInt(keys[i]),
}
this.keyin1_items.push(_tmp);
}
this.keyin1_items.push(_tmp);
}
},
@@ -368,22 +475,28 @@
//}
//this.data_table.selected = [];
//this.data_table.count = this.data_table.list.length
location.reload();
//location.reload();
this.getDefault();
})
.catch(error => console.log(error))
}
},
btn_search() {
this.isSearched = true;
sessionStorage.setItem("order_query_params", JSON.stringify(this.search));
this.this_act = '';
this.search.activity_num = '';
this.getDefault(true)
bootstrap.Offcanvas.getInstance(document.getElementById("offcanvasRight")).hide()
},
btn_all() {
this.isSearched = false;
this.this_act = '';
this.search.activity_num = '';
clearObjProps(this.search);
this.btn_search()
sessionStorage.setItem("order_query_params", JSON.stringify(this.search));
//this.btn_search()
},
checkInMsg(item) {
this.check_data.f_num = item.f_num;
@@ -392,39 +505,59 @@
this.check_data.activity_name = item.subject;
this.check_dialog.show = true;
},
checkIn() {
if (this.check_data.qty > 0 && this.check_data.status.val > 0) {
var chechdata =
{
f_num: this.check_data.f_num,
activity_num: this.check_data.activity_num,
status: this.check_data.status.val,
qty: this.check_data.qty,
}
axios
.post(HTTP_HOST + 'api/activity/OrderCheckIn', chechdata)
.then(response => {
//清空
this.check_data.f_num = 0;
this.check_data.u_name = '';
this.check_data.activity_num = 0;
this.check_data.activity_name = '';
this.check_data.qty = 1;
this.check_data.status.text = '';
this.check_data.status.val = 1;
this.check_dialog.show = false;
msgtop('簽到成功')
})
.catch(
error => {
console.log(error)
msgtop('簽到失敗', 'error')
}
)
} else {
msgbox('報到資訊請填寫完整');
checkIn(item) {
var checkdata =
{
f_num: item.f_num,
activity_num: item.activity_num,
status: 1,
qty: 1,
}
console.log(checkdata)
axios
.post(HTTP_HOST + 'api/activity/OrderCheckIn', checkdata)
.then(response => {
msgtop('簽到成功');
this.getDefault();
})
.catch(
error => {
console.log(error)
msgtop('簽到失敗', 'error')
}
)
//if (this.check_data.qty > 0 && this.check_data.status.val > 0) {
// var chechdata =
// {
// f_num: this.check_data.f_num,
// activity_num: this.check_data.activity_num,
// status: this.check_data.status.val,
// qty: this.check_data.qty,
// }
// axios
// .post(HTTP_HOST + 'api/activity/OrderCheckIn', chechdata)
// .then(response => {
// //清空
// this.check_data.f_num = 0;
// this.check_data.u_name = '';
// this.check_data.activity_num = 0;
// this.check_data.activity_name = '';
// this.check_data.qty = 1;
// this.check_data.status.text = '';
// this.check_data.status.val = 1;
// this.check_dialog.show = false;
// msgtop('簽到成功')
// })
// .catch(
// error => {
// console.log(error)
// msgtop('簽到失敗', 'error')
// }
// )
//} else {
// msgbox('報到資訊請填寫完整');
//}
}, goPrint() {
let _qry = "";
Object.keys(this.search).forEach(key => {
@@ -442,6 +575,7 @@
//列印管理報表
print_close() {
this.print_dialog.show = false;
this.print_error_msg = "";
}
,
initPrintSearch() {
@@ -504,9 +638,9 @@
}
}
});
console.log(_qry);
this.print_dialog.show = false;
window.open("print.aspx" + _qry, '_blank');
//window.open("print.aspx" + _qry, '_blank');
} else {
msgbox('活動/非活動至少勾選一項');
}
@@ -537,7 +671,7 @@
initActivity() {
axios.get(HTTP_HOST + 'api/activity')
.then(response => {
this.select_act_list = response.data
this.select_act_list = response.data
})
.catch(error => {
console.log(error)
@@ -556,10 +690,35 @@
$('#country2').val('');
VueApp.search.country2 = '';
});
$(document).ready(function () {
// 判斷是否彈出 search dialog
let hasSearchResult = sessionStorage.getItem("order_list_cache") !== null;
if (!hasSearchResult && window._printResult === '') {
let $btn = $("a[data-bs-target='#offcanvasRight'][href='#search_panel']");
$btn.click();
let el = document.getElementById('offcanvasRight');
let offcanvas = bootstrap.Offcanvas.getOrCreateInstance(el);
offcanvas.show();
}
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<uc1:alert runat="server" ID="L_msg" Text="" />
<asp:HiddenField ID="hid_err_msg" runat="server" />
<asp:HiddenField ID="hid_print_year" runat="server" />
<asp:HiddenField ID="hid_print_month" runat="server" />
<asp:HiddenField ID="hid_print_season" runat="server" />
<asp:HiddenField ID="hid_print_mode" runat="server" />
<asp:HiddenField ID="hid_chk_hasact" runat="server" />
<asp:HiddenField ID="hid_chk_noact" runat="server" />
<asp:HiddenField ID="hid_select_act" runat="server" />
<asp:HiddenField ID="hid_select_actitem" runat="server" />
<asp:HiddenField ID="hid_qry" runat="server" />
<asp:LinkButton ID="print_management" runat="server" OnClick="export_Click" style="display:none;" />
<asp:LinkButton ID="excel_management" runat="server" OnClick="export_Click" style="display:none;" />
<div id="content" class="container-fluid">
<v-data-table
v-model="data_table.selected"
@@ -580,10 +739,13 @@
<template #item.up_time="{ item }" >
{{ item.up_time|timeString('YYYY/MM/DD') }}
</template>
<template #item.u_name="{ item }" >
<a v-if="item.f_num != null && item.activity_num != null" @click="checkInMsg(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-account-check"></i>報到</a>
<template #item.u_name="{ item }" >
{{ item.u_name }}
</template>
<template #item.status="{ item }" >
<a v-if="item.f_num != null && item.activity_num != null && item.status == 0" @click="checkIn(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-account"></i>報到</a>
<a v-if="item.f_num != null && item.activity_num != null && item.status == 1" class="btn btn-outline-secondary btn-sm opacity-50" style="pointer-events: none" ><i class="mdi mdi-account-check"></i>已報到</a>
</template>
<template #item.slot_btn="{ item }">
<a :href="'reg.aspx?order_no='+item.order_no" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-pencil-box-outline"></i>修改</a>
<a @click="deleteItem(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-trash-can"></i>刪除</a>
@@ -692,7 +854,8 @@
item-text="text"
item-value="val"
v-model="print_search.month"
:items="select_items.month"
:items="select_items.month"
eager
></v-select>
</v-col>
<v-col :cols="2" class="pt-5" v-if="print_conditions=='ss' ">
@@ -703,7 +866,8 @@
item-text="text"
item-value="val"
v-model="print_search.season"
:items="select_items.season"
:items="select_items.season"
eager
></v-select>
</v-col>
@@ -764,9 +928,17 @@
</v-row>
</v-col>--%>
</v-row>
<v-row>
<v-col>
<div v-if="print_error_msg" class="red--text mt-2 text-center" style="font-weight: bold;">
{{ print_error_msg }}
</div>
</v-col>
</v-row>
<v-row densee class="pt-3" >
<v-col :cols="12" class="pt-3 text-center" >
<v-btn class="ma-2" color="primary" dark @click="goPrint2" > 列印 </v-btn>
<v-btn class="ma-2" color="primary" dark @click="triggerManagementExport('print')" > 列印 </v-btn>
<v-btn class="ma-2" color="primary" dark @click="triggerManagementExport('excel')"> 匯出 Excel </v-btn>
<v-btn class="ma-2" color="green" dark @click="print_close" > 取消 </v-btn>
</v-col>
</v-row>
+565 -26
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>
+861
View File
@@ -0,0 +1,861 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/admin/Templates/TBS5ADM001/MasterPage.master" AutoEventWireup="true" CodeFile="index3.aspx.cs" Inherits="admin_order_index3" %>
<%@ Register Src="~/admin/_uc/alert.ascx" TagPrefix="uc1" TagName="alert" %>
<asp:Content ID="Content1" ContentPlaceHolderID="page_header" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="page_nav" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<uc1:alert runat="server" ID="L_msg" Text="" />
<keep-alive>
<component
:is="currentView" :form-data="$data">
</component>
</keep-alive>
<div id="print_data">
</div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="footer_script" runat="Server">
<script>
Vue.filter('timeString', function (value, myFormat) {
return value == null || value == "" ? "" : moment(value).format(myFormat || 'YYYY-MM-DD, HH:mm:ss');
});
Vue.component('step-one', {
template: `
<div class="container-fluid">
<v-data-table
v-model="data_table.selected"
:items="data_table.list"
:search-props="search"
item-key="order_no"
:options.sync="options"
:headers="data_table.header"
:footer-props="data_table.footer"
:server-items-length="data_table.count"
:loading="data_table.loading"
:single-select="data_table.singleSelect"
show-select
hide-default-footer
:page.sync="data_table.page"
:items-per-page.sync="data_table.pageSize"
class="elevation-1">
<template #item.up_time="{ item }" >
{{ item.up_time|timeString('YYYY/MM/DD') }}
</template>
<template #item.u_name="{ item }" >
<a v-if="item.f_num != null && item.activity_num != null" @click="checkInMsg(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-account-check"></i>報到</a>
{{ item.u_name }}
</template>
<template #item.slot_btn="{ item }">
<a @click="$root.currentView='step-two';$root.selected_act=item.num" class="btn btn-outline-secondary btn-sm">明細</a>
<a @click="deleteItem(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-trash-can"></i>刪除</a>
</template>
</v-data-table>
<v-container>
<v-row class="align-baseline" wrap>
<v-col cols="12" md="9">
<v-pagination
v-model="data_table.page"
:length="pageCount">
</v-pagination>
</v-col>
<v-col class="text-truncate text-right" cols="12" md="2">
共 {{ data_table.count }} 筆, 頁數:
</v-col>
<v-col cols="6" md="1">
<v-text-field
v-model="data_table.page"
type="number"
hide-details
dense
min="1"
:max="pageCount"
@input="data_table.page = parseInt($event, 10)"
></v-text-field>
</v-col>
</v-row>
</v-container>
</div>`,
props: ['formData'],
data() {
return {
this_act: '<%= Request["act_id"]%>',
options: { multiSort: false },
search_options: { multiSort: false },
data_table: {
loading: true,
list: [],
selected: [],
singleSelect: false,
count: 0,
page: 1,
pageSize: 10,
header: [
{ text: '活動分類', value: 'kindsTxt' },
{ text: '活動名稱', value: 'subject' },
{ text: '開始日期', value: 'startDate_solar' },
{ text: '結束日期', value: 'endDate_solar', align: 'start' },
{ text: '報名人數', value: 'orderCounts' },
{ text: '', value: 'slot_btn', sortable: false, align: 'end' }
],
footer: {
showFirstLastPage: true,
itemsPerPageOptions: [5, 10, 20, 30],
},
},
//列印管理報表
print_conditions: 'yy',
print_search: {
year: '',
month: '',
season: '',
chk_hasact: false,
chk_noact: false,
select_act: '',
select_actitem: '',
},
select_act_list: [],
select_items: {
month: [{
text: "請選擇",
val: 0
},],
season: [{
text: "請選擇",
val: 0
},],
},
print_dialog: {
show: false,
},
search_dialog: {
controls: {
search1: {
id: 'search1',
title: '國籍',
text_prop: 'name_zh',
value_prop: 'id',
keys: [
{ id: 'keyword', title: '關鍵字' },
],
api_url: HTTP_HOST + 'api/country/GetList',
columns: [
{ id: 'id', title: '代碼' },
{ id: 'name_en', title: '英文短名稱' },
{ id: 'name_zh', title: '中文名稱' },
],
selected: {},
select(item, t) {
//console.log("select search1", t);
t.search.country = item.id;
t.search.country2 = '';
}
},
search2: {
id: 'search2',
title: '報名活動',
text_prop: 'subject',
value_prop: 'num',
keys: [
{ id: 'subject', title: '活動名稱', value: '' },
{ id: 'kindTxt', title: '活動分類' },
],
api_url: HTTP_HOST + 'api/activity/GetList',
columns: [
{ id: 'subject', title: '活動名稱' },
{ id: 'kindTxt', title: '活動分類' },
],
selected: {},
select(item, t) {
t.print_search.select_act = item.num;
}
},
search3: {
id: 'search3',
title: '活動品項',
text_prop: 'subject',
value_prop: 'num',
keys: [
{ id: 'subject', title: '項目名稱', value: '' },
{ id: 'kindTxt', title: '項目分類' },
{ id: 'num', visible: false },
],
api_url: HTTP_HOST + 'api/activity/GetOrderList',
columns: [
{ id: 'subject', title: '項目名稱' },
{ id: 'kindTxt', title: '項目分類' },
],
selected: {},
select(item, t) {
t.print_search.select_actitem = item.num;
}
}
}, show: false,
current: {},
list: [],
count: 0,
page: 1,
loading: false,
footer: {
showFirstLastPage: true,
disableItemsPerPage: true,
itemsPerPageAllText: '',
itemsPerPageText: '',
},
},
search: {
keyin1: '',
order_no: '',
subject: '',
u_name: '',
up_time1: '',
up_time2: '',
actItemTxt: '',
introducerTxt: '',
activity_num: '',
country: '',
country2: '',
hasPrice: '',
}
//報到
, check_dialog: {
show: false,
},
check_data: {
f_num: 0,
u_name: '',
activity_num: 0,
activity_name: '',
qty: 1,
status: {
text: '',
val: 1
},
},
keyin1_items: [//狀態
//{
//text: "請選擇",
//val: 0
//},
],
};
},
mounted() {
this.detalKeyinArray();
this.search_dialog.current = this.search_dialog.controls.search1 ///default
if (this.this_act != '')
this.search.activity_num = this.this_act;
//this.initPrintSearch();
//this.initActivity();
const navEntries = performance.getEntriesByType("navigation");
const isReload = navEntries.length > 0 && navEntries[0].type === "reload";
if (isReload) {
sessionStorage.removeItem("orderpage");
}
else {
const savedPage = parseInt(sessionStorage.getItem('orderpage'));
if (savedPage) {
this.options.page = savedPage;
}
}
},
watch: {
options: {
handler() {
this.getDefault()
},
deep: true,
},
search_options: {
handler() {
this.search_get()
},
deep: true,
},
},
methods: {
search_show(curr) {
//console.log("btn_click:", curr, curr.api_url);
this.search_dialog.current = curr;
this.search_clear()
//this.search_get()//清除完自動會重抓, 故取消
this.search_dialog.show = true;
},
search_clear() {
if (!this.search_dialog.current.keys) return;
this.search_dialog.current.keys.forEach((t, i) => { t.value = '' })
this.search_get()
},
search_get() {
if (!this.search_dialog.current.keys) return;
let api_url = this.search_dialog.current.api_url;
let keys = this.search_dialog.current.keys;
//const { page, itemsPerPage } = this.options
//const { sortBy, sortDesc, page, itemsPerPage } = this.options
this.search_dialog.page = this.search_options.page ?? 1
let params = { page: this.search_dialog.page, pageSize: 10 };//url params
var search = {};//post body
keys.forEach((t, i) => {
search[t.id] = t.value;
});
//necessary parameter===
if (this.search_dialog.current.id == 'search2') {
params = { sortBy: 'startDate_solar', sortDesc: true, page: this.search_dialog.page, pageSize: 10 };//url params
}
console.log("search_get", api_url, search, params, this.search_options);
this.search_dialog.loading = true
axios.post(api_url, search, { params: params })
.then(response => {
this.search_dialog.list = response.data.list
this.search_dialog.count = response.data.count
this.search_dialog.loading = false
})
.catch(error => {
console.log(error)
this.search_dialog.list = []
this.search_dialog.count = 0
this.search_dialog.loading = false
this.snackbar.text = "錯誤:" + error
this.snackbar.show = true
})
},
search_headers() {
if (!this.search_dialog.current.columns) return;
r = [];
this.search_dialog.current.columns.forEach((t, i) => {
r.push({
text: t.title,
align: 'start',
sortable: false,
value: t.id,
})
})
return r
},
search_select(row) {
let curr = this.search_dialog.current;
let target = $(`[data-search-control=${curr.id}]`);
curr.selected = row;
target.children("input.search-text").val(curr.selected[curr.text_prop])//text
target.children("input:hidden").val(curr.selected[curr.value_prop])//value
if (curr.select instanceof Function) {
curr.select(row, this);
}
this.search_dialog.show = false;
//console.log(row, row["u_name"], row["f_number"], curr.id, target);
},
getDetail(clearpage = false) {
console.log("test");
const { sortBy, sortDesc, page, itemsPerPage } = this.options
const params = {
sortBy: sortBy[0], sortDesc: sortDesc[0],
page: clearpage ? '1' : page, pageSize: itemsPerPage
};
this.detail_table.loading = true
sessionStorage.setItem('orderpage', clearpage ? '1' : page);
axios
//.post(HTTP_HOST + 'api/order/GetList', this.search, { params: params })
.post(HTTP_HOST + 'api/order/GetList', this.search, { params: params })
.then(response => {
this.detail_table.list = response.data.list
this.detail_table.count = response.data.count;
this.detail_table.loading = false
})
.catch(error => console.log(error))
},
getDefault(clearpage = false) {
const { sortBy, sortDesc, page, itemsPerPage } = this.options
const params = {
sortBy: sortBy[0], sortDesc: sortDesc[0],
page: clearpage ? '1' : page, pageSize: itemsPerPage
};
this.data_table.loading = true
sessionStorage.setItem('orderpage', clearpage ? '1' : page);
axios
//.post(HTTP_HOST + 'api/order/GetList', this.search, { params: params })
.post(HTTP_HOST + 'api/activity/GetList', this.search, { params: params })
.then(response => {
this.data_table.list = response.data.list
this.data_table.count = response.data.count;
this.data_table.loading = false
})
.catch(error => console.log(error))
},
detalKeyinArray() {
var getArray = <%=Newtonsoft.Json.JsonConvert.SerializeObject(_keyin1Item, Newtonsoft.Json.Formatting.Indented) %>;
var keys = Object.keys(getArray);
for (let i = 0; i < keys.length; i++) {
//console.log(`${keys[i]}:${getArray[keys[i]]}`); //value : text
var _tmp = {
text: getArray[keys[i]],
val: parseInt(keys[i]),
}
this.keyin1_items.push(_tmp);
}
},
editItem(item) {
console.log("edit", item);
},
deleteItem(item) {
if (confirm('是否確定刪除此筆資料?')) {
const index = this.data_table.list.indexOf(item)
if (index != -1) {
axios
.delete(HTTP_HOST + 'api/order/' + item.order_no)
.then(response => {
console.log("del", item);
this.data_table.list.splice(index, 1);
this.data_table.count = this.data_table.list.length
})
.catch(error => console.log(error))
}
}
},
deleteAll() {
if (confirm('是否確定刪除已勾選的資料?')) {
axios
.delete(HTTP_HOST + 'api/order/DeleteAll/' + this.data_table.selected.map(x => x.order_no))
.then(response => {
//console.log("delAll");
//for (var i = 0; i < this.data_table.selected.length; i++) {
// const index = this.data_table.list.indexOf(this.data_table.selected[i]);
// this.data_table.list.splice(index, 1);
//}
//this.data_table.selected = [];
//this.data_table.count = this.data_table.list.length
location.reload();
})
.catch(error => console.log(error))
}
},
btn_search() {
this.this_act = '';
this.search.activity_num = '';
this.getDefault(true)
},
btn_all() {
this.this_act = '';
this.search.activity_num = '';
clearObjProps(this.search);
this.btn_search()
},
checkInMsg(item) {
this.check_data.f_num = item.f_num;
this.check_data.u_name = item.u_name;
this.check_data.activity_num = item.activity_num;
this.check_data.activity_name = item.subject;
this.check_dialog.show = true;
},
checkIn() {
if (this.check_data.qty > 0 && this.check_data.status.val > 0) {
var chechdata =
{
f_num: this.check_data.f_num,
activity_num: this.check_data.activity_num,
status: this.check_data.status.val,
qty: this.check_data.qty,
}
axios
.post(HTTP_HOST + 'api/activity/OrderCheckIn', chechdata)
.then(response => {
//清空
this.check_data.f_num = 0;
this.check_data.u_name = '';
this.check_data.activity_num = 0;
this.check_data.activity_name = '';
this.check_data.qty = 1;
this.check_data.status.text = '';
this.check_data.status.val = 1;
this.check_dialog.show = false;
msgtop('簽到成功')
})
.catch(
error => {
console.log(error)
msgtop('簽到失敗', 'error')
}
)
} else {
msgbox('報到資訊請填寫完整');
}
}, goPrint() {
let _qry = "";
Object.keys(this.search).forEach(key => {
//console.log(`${key}: ${this.search[key]}`);
if (this.search[key] != undefined && this.search[key] != null && this.search[key] != '') {
_qry += (_qry != '' ? '&' : '?') + (key + '=' + this.search[key]);
}
});
window.open("print.aspx" + _qry, '_blank');
},
countryChange() {
this.search.country = '';
$('#country_txt').val('')
},
//列印管理報表
print_close() {
this.print_dialog.show = false;
}
,
initPrintSearch() {
//下拉選單
for (let i = 1; i <= 12; i++) {
var _tmp = {
text: i,
val: i,
}
this.select_items.month.push(_tmp);
}
for (let i = 1; i <= 4; i++) {
var _tmp = {
text: i,
val: i,
}
this.select_items.season.push(_tmp);
}
//預設值
const Today = new Date();//現在日期時間
const first_date = new Date(Today.getFullYear(), Today.getMonth(), 1); //本月第一天
const last_month_date = new Date(first_date - 1); //上個月最後一天
this.print_search.year = last_month_date.getFullYear();
this.print_search.month = last_month_date.getMonth() + 1 //預設上個月的年份
let _season = 1;
const _month = first_date.getMonth() + 1; //本月
if (_month >= 1 && _month <= 3) {
_season = 4;
} else if (_month >= 4 && _month <= 6) {
_season = 1;
} else if (_month >= 7 && _month <= 9) {
_season = 2;
} else if (_month >= 10 && _month <= 12) {
_season = 3;
}
this.print_search.season = _season; //預設上一季
},
goPrint2() {
if (this.print_search.year != '') {
if (this.print_search.chk_noact || this.print_search.chk_hasact) {
let _qry = "";
Object.keys(this.print_search).forEach(key => {
if (this.print_search[key] != undefined && this.print_search[key] != null && this.print_search[key] != '') {
if (key == 'month') {
if (this.print_conditions == 'mm') {
_qry += "&month=" + this.print_search.month;
}
} else if (key == 'season') {
if (this.print_conditions == 'ss') {
_qry += "&season=" + this.print_search.season;
}
}
else {
_qry += (_qry != '' ? '&' : '?') + (key + '=' + this.print_search[key]);
}
}
});
this.print_dialog.show = false;
window.open("print.aspx" + _qry, '_blank');
} else {
msgbox('活動/非活動至少勾選一項');
}
} else {
msgbox('請輸入年份');
}
}, chk_hasact_change() {
if (!this.print_search.chk_hasact) {
//$('#activity_num_txt').val('')
//this.print_search.select_act = '';
this.clear_select_act();
$('#activity_num_txt').attr("placeholder", "可選擇單一活動(需先勾選活動報名)");
} else {
$('#activity_num_txt').attr("placeholder", "可選擇單一活動");
}
},
clear_select_act() {
$('#activity_num_txt').val('')
this.print_search.select_act = '';
}, clear_select_actitem() {
$('#actItem_num_txt').val('')
this.print_search.select_actitem = '';
},
initActivity() {
axios.get(HTTP_HOST + 'api/activity')
.then(response => {
this.select_act_list = response.data
})
.catch(error => {
console.log(error)
})
}
},
computed: {
pageCount() {
return Math.ceil(this.data_table.count / this.data_table.pageSize)
},
}
});
Vue.component('step-two', {
template: `
<div class="container-fluid">
<v-data-table
v-model="detail_table.selected"
:items="detail_table.list"
:search-props="search"
item-key="order_no"
:options.sync="options"
:headers="detail_table.header"
:footer-props="detail_table.footer"
:server-items-length="detail_table.count"
:loading="detail_table.loading"
:single-select="detail_table.singleSelect"
show-select
hide-default-footer
:page.sync="detail_table.page"
:items-per-page.sync="detail_table.pageSize"
class="elevation-1">
<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="$root.currentView='step-three';$root.selected_order=item.order_no" class="btn btn-outline-secondary btn-sm">明細</a>
<a @click="deleteItem(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-trash-can"></i>刪除</a>
</template>
</v-data-table>
<v-container>
<v-row class="align-baseline" wrap>
<v-col cols="12" md="9">
<v-pagination
v-model="detail_table.page"
:length="pageCount">
</v-pagination>
</v-col>
<v-col class="text-truncate text-right" cols="12" md="2">
共 {{ detail_table.count }} 筆, 頁數:
</v-col>
<v-col cols="6" md="1">
<v-text-field
v-model="detail_table.page"
type="number"
hide-details
dense
min="1"
:max="pageCount"
@input="detail_table.page = parseInt($event, 10)"
></v-text-field>
</v-col>
</v-row>
</v-container>
</div>`,
props: ['twoData'],
activated() {
console.log("yes ,go go");
this.getDetail();
},
data() {
return {
options: { multiSort: false },
search_options: { multiSort: false },
detail_table: {
loading: true,
list: [],
selected: [],
singleSelect: false,
count: 0,
page: 1,
pageSize: 10,
header: [
{ text: '單號', value: 'order_no' },
{ text: '姓名', value: 'u_name' },
{ text: '報名日期', value: 'up_time' },
{ text: '單據狀態', value: 'keyin1_txt', align: 'start' },
{ text: '', value: 'slot_btn', sortable: false, align: 'end' }
],
footer: {
showFirstLastPage: true,
itemsPerPageOptions: [5, 10, 20, 30],
},
},
search: {
keyin1: '',
order_no: '',
subject: '',
u_name: '',
up_time1: '',
up_time2: '',
actItemTxt: '',
introducerTxt: '',
activity_num: '',
country: '',
country2: '',
hasPrice: '',
}
};
},
watch: {
options: {
handler() {
this.getDetail()
},
deep: true,
},
},
methods: {
getDetail() {
const { sortBy, sortDesc, page, itemsPerPage } = this.options
const params = {
//sortBy: sortBy == undefined ? "order_no" : sortBy[0],
//sortDesc: sortDesc == undefined ? "" : sortDesc[0],
//page: clearpage ? '1' : page, pageSize: itemsPerPage,
page:'1',pageSize:10,
};
this.search = { activity_num: this.$root.selected_act }
this.detail_table.loading = true
sessionStorage.setItem('orderpage','1');// clearpage ? '1' : page
axios
.post(HTTP_HOST + 'api/order/GetList', this.search, { params: params })
.then(response => {
this.detail_table.list = response.data.list
this.detail_table.count = response.data.count;
this.detail_table.loading = false
})
.catch(error => console.log(error))
},
},
computed: {
pageCount() {
return Math.ceil(this.detail_table.count / this.detail_table.pageSize)
},
}
});
Vue.component('step-three', {
template: `<div>放報名資料</div>`,
props:['signData']
});
let VueApp = new Vue({
el: '#app',
vuetify: new Vuetify(),
data() {
return {
currentView: 'step-one',
selected_act: '',
selected_order:'',
};
},activated() {
console.log("yes ,go go");
this.getDetail();
},
data() {
return {
options: { multiSort: false },
search_options: { multiSort: false },
sign_table: {
loading: true,
list: [],
selected: [],
singleSelect: false,
count: 0,
page: 1,
pageSize: 10,
header: [
{ text: '單號', value: 'order_no' },
{ text: '姓名', value: 'u_name' },
{ text: '報名日期', value: 'up_time' },
{ text: '單據狀態', value: 'keyin1_txt', align: 'start' },
{ text: '', value: 'slot_btn', sortable: false, align: 'end' }
],
footer: {
showFirstLastPage: true,
itemsPerPageOptions: [5, 10, 20, 30],
},
},
search: {
keyin1: '',
order_no: '',
subject: '',
u_name: '',
up_time1: '',
up_time2: '',
actItemTxt: '',
introducerTxt: '',
activity_num: '',
country: '',
country2: '',
hasPrice: '',
}
};
},
watch: {
options: {
handler() {
this.getDetail()
},
deep: true,
},
},
methods: {
getDetail() {
const { sortBy, sortDesc, page, itemsPerPage } = this.options
const params = {
//sortBy: sortBy == undefined ? "order_no" : sortBy[0],
//sortDesc: sortDesc == undefined ? "" : sortDesc[0],
//page: clearpage ? '1' : page, pageSize: itemsPerPage,
page: '1', pageSize: 10,
};
this.search = { activity_num: this.$root.selected_act }
this.detail_table.loading = true
sessionStorage.setItem('orderpage', '1');// clearpage ? '1' : page
axios
.post(HTTP_HOST + 'api/order/GetList', this.search, { params: params })
.then(response => {
this.detail_table.list = response.data.list
this.detail_table.count = response.data.count;
this.detail_table.loading = false
})
.catch(error => console.log(error))
},
},
computed: {
pageCount() {
return Math.ceil(this.detail_table.count / this.detail_table.pageSize)
},
}
});
</script>
</asp:Content>
+284
View File
@@ -0,0 +1,284 @@
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using static Model.activity_check;
public partial class admin_order_index3 : MyWeb.config
{
private Model.ezEntities _db = new Model.ezEntities();
public Dictionary<int, string> _keyin1Item = null;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Model.pro_order order = new Model.pro_order();
ArrayList options = order.keyin1_list();
foreach (Model.pro_order.keyin optionKey in options)
{
ListItem item = new ListItem(optionKey.Text, optionKey.Value);
item.Attributes.Add("style", "color:" + optionKey.Color);
//s_keyin1.Items.Add(item);
}
_keyin1Item = publicFun.enum_desc<Model.activity_check.keyin1>(); //狀態
BuildKind();
}
}
public void detailButton_click(object sender, EventArgs e)
{
}
public void BuildKind()
{
//國籍
//s_country.Items.Clear();
//s_country.Items.Add(new ListItem("請選擇", ""));
var qry = _db.countries.OrderBy(x => x.range).ThenBy(x => x.name_en).ToList();
if (qry.Count > 0)
{
//foreach (var x in qry)
//s_country.Items.Add(new ListItem(x.name_zh, x.ID));
}
}
protected void excel_Click(object sender, EventArgs e)
{
//var memoryStream = new MemoryStream();
//using (var doc = SpreadsheetDocument.Create(memoryStream, SpreadsheetDocumentType.Workbook))
//{
// var wb = doc.AddWorkbookPart();
// wb.Workbook = new Workbook();
// var sheets = wb.Workbook.AppendChild(new Sheets());
// //建立第一個頁籤
// var ws = wb.AddNewPart<WorksheetPart>();
// ws.Worksheet = new Worksheet();
// sheets.Append(new Sheet()
// {
// Id = wb.GetIdOfPart(ws),
// SheetId = 1,
// Name = "報名"
// });
// //設定欄寬
// var cu = new Columns();
// cu.Append(
// new Column { Min = 1, Max = 1, Width = 15, CustomWidth = true },
// new Column { Min = 2, Max = 4, Width = 10, CustomWidth = true },
// new Column { Min = 5, Max = 5, Width = 15, CustomWidth = true },
// new Column { Min = 6, Max = 8, Width = 25, CustomWidth = true },
// new Column { Min = 9, Max = 9, Width = 15, CustomWidth = true },
// new Column { Min = 10, Max = 10, Width = 10, CustomWidth = true },
// new Column { Min = 11, Max = 11, Width = 25, CustomWidth = true },
// new Column { Min = 12, Max = 16, Width = 10, CustomWidth = true },
// new Column { Min = 17, Max = 20, Width = 10, CustomWidth = true }
// );
// ws.Worksheet.Append(cu);
// //建立資料頁
// var sd = new SheetData();
// ws.Worksheet.AppendChild(sd);
// //第一列資料
// var tr = new Row();
// tr.Append(
// new Cell() { CellValue = new CellValue("單號"), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("報名日期"), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("單據狀態"), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("姓名/名稱"), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("聯絡電話"), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("報名活動"), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("收件地址"), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("備註"), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("項目名稱"), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("姓名"), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("代表地址"), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("陽上/報恩者"), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("開始日期"), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("期滿日期"), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("應續約日"), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("劃位狀態"), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("預設金額"), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("數量"), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("小計"), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("已收金額"), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("未收金額"), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("付款期限"), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("報名狀態"), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("狀態備註"), DataType = CellValues.String }
// );
// sd.AppendChild(tr);
// //查詢要匯出的資料
// // ❌ 錯誤寫法: var aIDt = _db.actItems.Where(f => f.subject.Contains(s_actItemTxt.Value.Trim())).Select(f => f.num.ToString());
// // 改為整數陣列,避免後續查詢中使用 .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();
// if (!isStrNull(s_order_no.Value))
// qry = qry.Where(o => o.order_no.Contains(s_order_no.Value.Trim()));
// if (!isStrNull(s_u_name.Value))
// qry = qry.Where(o => o.f_num.HasValue && o.follower.u_name.Contains(s_u_name.Value.Trim()));
// if (!isStrNull(s_introducerTxt.Value))
// qry = qry.Where(o => o.f_num.HasValue && o.follower1.u_name.Contains(s_introducerTxt.Value.Trim()));
// if (!isStrNull(s_subject.Value))
// qry = qry.Where(o => o.activity_num.HasValue && o.activity.subject.Contains(s_subject.Value.Trim()));
// if (!isStrNull(s_actItemTxt.Value))
// {
// // ❌ 錯誤寫法: qry = qry.Where(o => o.pro_order_detail.Where(f2 => f2.order_no == o.order_no && aIDt.ToArray().Contains(f2.actItem_num.ToString())).Count() > 0);
// // ✅ 實際比較:僅在 actItem_num 有值時才與整數陣列比對
// 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))
// qry = qry.Where(o => o.keyin1 == s_keyin1.SelectedValue);
// if (!isStrNull(s_up_time1.Value) && isDate(s_up_time1.Value))
// qry = qry.Where(o => o.up_time >= ValDate(s_up_time1.Value));
// if (!isStrNull(s_up_time2.Value) && isDate(s_up_time2.Value))
// qry = qry.Where(o => o.up_time < Convert.ToDateTime(s_up_time2.Value).AddDays(1));
// qry = qry.OrderByDescending(o => o.reg_time);
// MyWeb.encrypt encrypt = new MyWeb.encrypt();
// var tdesc = publicFun.enum_desc<Model.pro_order.detailKeyin1>();
// var bedDt = _db.bed_order_detail.AsQueryable();//掛單明細
// //left join 使用 GroupJoin
// //var list = qry.Join
// var list = qry.GroupJoin(
// _db.pro_order_detail, o => o.order_no, p => p.order_no, (o, c) =>
// new
// {
// //訂單資料
// order_no = o.order_no,
// up_time = o.up_time,
// keyin1 = o.keyin1,
// f_num = o.follower != 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_start_date = d == null ? "" : (d.start_date.HasValue ? d.start_date.Value.ToString("yyyy/MM/dd") : ""), //開始日期
// d_due_date = d == null ? "" : (d.due_date.HasValue ? d.due_date.Value.ToString("yyyy/MM/dd") : ""), //期滿日期
// d_extend_date = d == null ? "" : (d.extend_date.HasValue ? d.extend_date.Value.ToString("yyyy/MM/dd") : ""), //應續約日
// d_price = d == null ? "" : (d.price.HasValue ? d.price.Value.ToString() : "0"), //預設金額
// d_qty = d == null ? "" : (d.qty.HasValue ? d.qty.Value.ToString() : "0"), //數量
// d_writeBedQty = d == null ? 0 : bedDt.Where(b => (b.bed_order.o_detail_id.Value == d.num) && b.checkIn_date.HasValue && b.bed_kind_detail_id.HasValue).Count(), //已劃數量
// d_notBedQty = d == null ? 0 : bedDt.Where(b => b.bed_order.o_detail_id.Value == d.num && (!b.checkIn_date.HasValue || !b.bed_kind_detail_id.HasValue)).Count(), //未劃數量
// d_pay = d == null ? "" : (d.pay.HasValue ? d.pay.Value.ToString() : "0"), //已收金額
// d_pay_date = d == null ? "" : (d.pay_date.HasValue ? d.pay_date.Value.ToString("yyyy/MM/dd") : ""), //付款期限
// d_keyin1 = d == null ? "" : (d.keyin1.HasValue && d.keyin1.Value > 0 ? tdesc[d.keyin1 ?? 1] : ""), //報名狀態
// d_demo = d == null ? "" : d.demo, //狀態備註
// }).ToList();
// if (list.Count > 0)
// {
// foreach (var item in list)
// {
// //新增資料列
// tr = new Row();
// tr.Append(
// new Cell() { CellValue = new CellValue(item.order_no), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue(item.up_time.Value.ToString("yyyy/MM/dd")), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue(Model.pro_order.keyin1_value_to_text(item.keyin1)), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue(item.f_num), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue(encrypt.DecryptAutoKey(item.phone)), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue(item.activity_num), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue(item.address), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue(item.demo), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue(item.d_actItem_num), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue(item.d_f_num), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue(item.d_address), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue(item.d_from_id), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue(item.d_start_date), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue(item.d_due_date), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue(item.d_extend_date), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue((Val(item.d_category) == (int)Model.activity.category.Order) ? (item.d_notBedQty + "/" + item.d_writeBedQty) : ""), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("$" + ValMoney(item.d_price)), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue(item.d_qty), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("$" + ValMoney(ValFloat(item.d_price) * Val(item.d_qty))), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("$" + ValMoney(item.d_pay)), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue("$" + ValMoney(ValFloat(item.d_price) * Val(item.d_qty) - ValFloat(item.d_pay))), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue(item.d_pay_date), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue(item.d_keyin1), DataType = CellValues.String },
// new Cell() { CellValue = new CellValue(item.d_demo), DataType = CellValues.String }
// );
// sd.AppendChild(tr);
// }
// Model.admin_log admin_log = new Model.admin_log();
// admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Order, (int)Model.admin_log.Status.Excel, admin_log.LogViewBtn(list.Select(x => x.order_no).ToList()));
// }
//}
//HttpContext.Current.Response.Clear();
//HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=報名.xlsx");
//HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
//HttpContext.Current.Response.BinaryWrite(memoryStream.ToArray());
//HttpContext.Current.Response.End();
}
private string GetCellReference(int column, int row)
{
int dividend = column;
string cellReference = string.Empty;
while (dividend > 0)
{
int modulo = (dividend - 1) % 26;
char columnChar = (char)('A' + modulo);
cellReference = columnChar + cellReference;
dividend = (dividend - modulo) / 26;
}
return cellReference + row.ToString();
}
}
+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)
+159 -12
View File
@@ -11,9 +11,9 @@
border-bottom: 1px solid #eee;
}
</style>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="footer_script" runat="Server">
<script>
Vue.filter('timeString', function (value, myFormat) {
return value == null || value == "" ? "" : moment(value).format(myFormat || 'YYYY-MM-DD, HH:mm:ss');
@@ -464,6 +464,11 @@
initialized: false,
currentItem: {}
},
tablet_edit_new: {
show: false,
initialized: false,
currentItem: {}
},
//收款註記
cash_dialog: {
show: false,
@@ -526,30 +531,59 @@
window.addEventListener('message', async (event) => {
if (event.data.source === 'editor.btn.click') {
const receivedData = event.data.data;
// 更新編輯中的項目
//if (receivedData.tabletItem && this.editedIndex > -1) {
if (receivedData.tabletItem) {
// 將 tablet_data 轉換為 JSON 字串
//this.editedItem.f_num_tablet = JSON.stringify(receivedData.tablet_data);
// 確保其他必要欄位保持不變
const currentItem = this.desserts[this.editedIndex];
//currentItem.f_num_tablet = JSON.stringify(receivedData.tablet_data);
this.editedItem = {
...currentItem,
f_num_tablet: JSON.stringify(receivedData.tablet_data)
f_num_tablet: JSON.stringify(receivedData.tablet_data),
style: receivedData.style
};
// 呼叫 save 方法
await this.save();
}
// 關閉編輯對話框
this.tablet_edit.show = false;
this.tablet_edit_new.show = false;
// 顯示成功訊息
this.snackbar.text = '牌位資料已更新';
this.snackbar.show = true;
} else if (event.data.source === 'editorNew.btn.click') {
const receivedData = event.data.data;
// 更新編輯中的項目
//if (receivedData.tabletItem && this.editedIndex > -1) {
if (receivedData.tabletItem) {
// 將 tablet_data 轉換為 JSON 字串
//this.editedItem.f_num_tablet = JSON.stringify(receivedData.tablet_data);
// 確保其他必要欄位保持不變
const currentItem = this.desserts[this.editedIndex];
//currentItem.f_num_tablet = JSON.stringify(receivedData.tablet_data);
this.editedItem = {
...currentItem,
f_num_tablet: JSON.stringify(receivedData.tablet_data),
style: receivedData.style
};
// 呼叫 save 方法
await this.save();
}
this.tablet_edit_new.show = false;
// 顯示成功訊息
this.snackbar.text = '牌位資料已更新';
this.snackbar.show = true;
}
});
@@ -560,6 +594,13 @@
this.tablet_edit.initialized = true;
};
}
const iframe1 = document.querySelector('iframe#tablet_edit_new_iframe');
if (iframe1) {
iframe1.onload = () => {
this.tablet_edit_new.initialized = true;
};
}
},
watch: {
options: {
@@ -571,6 +612,17 @@
'tablet_edit.show': {
handler(newVal) {
if (!newVal && this._savedEditedItem) {
// console.log("三小");
this.editedItem = $.extend(true, {}, this._savedEditedItem);
this._savedEditedItem = null;
}
}
},
'tablet_edit_new.show': {
handler(newVal) {
if (!newVal && this._savedEditedItem) {
//console.log("不合理");
//$("#tablet_edit_new_iframe").src = $("#tablet_edit_new_iframe").src;
this.editedItem = $.extend(true, {}, this._savedEditedItem);
this._savedEditedItem = null;
}
@@ -703,6 +755,7 @@
curr.select(this.editedItem, row);
}
this.search_dialog.show = false;
this.search_dialog.page = 1;
//console.log(row, row["u_name"], row["f_number"], curr.id, target);
},
//報名詳細資料
@@ -807,7 +860,7 @@
isValidDate = Date.parse(item.pay_date);
if (!isNaN(isValidDate))
item.pay_date = new Date(item.pay_date).format("yyyy-MM-dd")
console.log(item);
this.editedItem = $.extend(true, {}, item);
this.data_dialog.show = true;
this.data_dialog.isAddNew = false;
@@ -818,6 +871,34 @@
this.editedItem = $.extend(true, {}, item);
this.file_dialog.show = true;
},
async editTabletNew(item) {
this.editedIndex = this.desserts.indexOf(item);
this.editedItem = $.extend(true, {}, item);
try {
//document.getElementById("tablet_edit_new_iframe").contentWindow.location.reload();
// 如果是新項目,先保存
if (this.editedItem.num <= 0 || this.editedItem.num === null || this.editedItem.num === undefined) {
this.editedItem.qty = 1;
const savedItem = await this.save(false);
if (savedItem) {
this.$set(this.desserts, this.editedIndex, savedItem);
this.editedItem = $.extend(true, {}, savedItem);
}
}
// 先發送消息
await this.sendMessageToIframeNew();
// 保存當前的 editedItem 數據
const currentData = $.extend(true, {}, this.editedItem);
// 顯示對話框
this.tablet_edit_new.show = true;
// 立即恢復數據
this.editedItem = $.extend(true, {}, currentData);
} catch (error) {
console.error('Error in editTablet:', error);
}
},
async editTablet(item) {
this.editedIndex = this.desserts.indexOf(item);
this.editedItem = $.extend(true, {}, item);
@@ -844,6 +925,54 @@
console.error('Error in editTablet:', error);
}
},
async sendMessageToIframeNew() {
const iframe = document.querySelector('iframe#tablet_edit_new_iframe');
// 在這裡深度複製 editedItem,確保數據不會被修改
const itemToSend = $.extend(true, {}, this.editedItem);
if (iframe) {
try {
// 準備要發送的數據
let familyMembers = [];
try {
// 嘗試獲取家族成員數據
const response = await axios.get(HTTP_HOST + 'api/familymembers/follower/' + this.follower_id);
familyMembers = response.data;
} catch (error) {
console.warn('error:', error);
}
// 準備發送的數據
const itemInfo = {
source: 'order.btn.click',
tabletItem: {
...itemToSend,
title: this.titleword() // 確保標題被包含
},
familyMembers: familyMembers,
host: HTTP_HOST,
follower_id:this.follower_id
};
iframe.contentWindow.postMessage(itemInfo, '*');
// 發送後確認數據完整性
// 如果數據被清除,立即恢復
if (!this.editedItem.num && itemToSend.num) {
this.$nextTick(() => {
this.editedItem = $.extend(true, {}, itemToSend);
});
}
} catch (error) {
console.error('Error in sendMessageToIframe:', error);
}
} else {
console.error('iframe not found');
}
},
async sendMessageToIframe() {
const iframe = document.querySelector('iframe#tablet_edit_iframe');
@@ -964,6 +1093,7 @@
async save(shouldClose = true) {
if (this.editedIndex > -1) {
if (this.order_no != '') {
console.log("ok:",this.editedItem);
//chcck necessary params
if (this.editedItem.actitem_num_selected.val != 0 &&
this.editedItem.keyin1_selected.val !=0 &&
@@ -971,9 +1101,11 @@
/* (this.editedItem.category=="1"? this.editedItem.from_id_selected.val != 0 : true) &&*/
this.requireData(this.editedItem.qty, (this.editedItem.num == 0 ? false : true)) ) /* qty為0視為不需要此項目,不儲存此筆資料*/
{
console.log(this.editedItem);
//check price
if (this.editedItem.pay <= this.editedItem.price * this.editedItem.qty) {
console.log(this.editedItem.f_num_selected.val);
console.log(this.editedItem.from_id_selected.val);
//check qty
//數量不可小於掛單明細的數量
if (this.editedItem.qty >= this.editedItem.writeBedQty + this.editedItem.notBedQty) {
@@ -1001,6 +1133,7 @@
pay: this.editedItem.pay,
pay_date: this.editedItem.pay_date,
customize_data: this.editedItem.customize_data,
style: this.editedItem.style
}
await axios
.post(HTTP_HOST + 'api/order/SaveDetailData', pro_order_detail)
@@ -1727,7 +1860,7 @@
<div class="">
<asp:Button ID="add" runat="server" Text="送出" OnClick="add_Click" CssClass="btn btn-primary" />
<asp:Button ID="edit" runat="server" Text="修改" Visible="false" OnClick="edit_Click" CssClass="btn btn-primary" />
<asp:Button ID="goback" runat="server" Text="回列表" Visible="false" CausesValidation="false" OnClick="goback_Click" CssClass="btn btn-outline-secondary" />
<asp:Button ID="goback" runat="server" Text="取消" CausesValidation="false" OnClick="goback_Click" CssClass="btn btn-outline-secondary" />
</div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
@@ -1998,7 +2131,10 @@
</v-icon>
<v-icon title="編輯牌位" color="blue" class="mr-2" @click="editTablet(item);">
mdi-file-document-edit-outline
</v-icon>
</v-icon>
<v-icon title="編輯牌位New" color="blue" class="mr-2" @click="editTabletNew(item);">
mdi-file-document-edit-outline
</v-icon>
<v-icon title="列印" color="blue" class="mr-2" @click="printItem(item);" v-if="canPrint || lists.length==0" >
mdi-printer
</v-icon>
@@ -2353,7 +2489,7 @@
<v-card>
<v-card-title class="justify-space-between grey lighten-2">
查詢:{{search_dialog.current.title}}
<v-btn icon @click="search_dialog.show=false"><v-icon>mdi-close</v-icon></v-btn>
<v-btn icon @click="search_dialog.show=false; search_dialog.page = 1;"><v-icon>mdi-close</v-icon></v-btn>
</v-card-title>
<v-card-text >
<v-row>
@@ -2566,6 +2702,17 @@
</v-card>
</v-dialog>
<v-dialog v-model="tablet_edit_new.show" min-width="100vw" min-height="100vh" persistent eager :class="{'d-none': !tablet_edit_new.initialized}">
<v-card>
<v-card-title class="justify-space-between grey lighten-2">
<span class="fs-6 text text-dark">編輯牌位 : {{editedItem.actitem_num_selected.text}} - {{editedItem.print_id}}</span>
<v-btn icon @click="tablet_edit_new.show=false"><v-icon>mdi-close</v-icon></v-btn>
</v-card-title>
<v-card-text>
<iframe id="tablet_edit_new_iframe" src="../print/tablet_edit/editorNewOne.html" style="width: 100%; height: 100%;min-height:100vh;min-width:100vw" frameborder="0"></iframe>
</v-card-text>
</v-card>
</v-dialog>
<v-dialog v-model="tablet_edit.show" max-width="1000px" persistent eager :class="{'d-none': !tablet_edit.initialized}">
<v-card>
<v-card-title class="justify-space-between grey lighten-2">
@@ -2573,7 +2720,7 @@
<v-btn icon @click="tablet_edit.show=false"><v-icon>mdi-close</v-icon></v-btn>
</v-card-title>
<v-card-text>
<iframe id="tablet_edit_iframe" src="../print/tablet_edit/editor.html" style="width: 100%; height: 550px;" frameborder="0"></iframe>
<iframe id="tablet_edit_iframe" src="../print/tablet_edit/editornew.html" style="width: 100%; height: 580px;" frameborder="0"></iframe>
</v-card-text>
</v-card>
</v-dialog>
+26 -12
View File
@@ -1,15 +1,16 @@
using System;
using DocumentFormat.OpenXml.Spreadsheet;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.Entity.Infrastructure;
using System.Data.OleDb;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Data.Entity.Infrastructure;
public partial class admin_order_reg : MyWeb.config
{
@@ -187,16 +188,29 @@ public partial class admin_order_reg : MyWeb.config
{
if (!isStrNull(pro_order.order_no))
{
_db.pro_order.Add(pro_order);
_db.SaveChanges();
bool isRegistered = _db.pro_order.Any(x => x.f_num == pro_order.f_num && x.activity_num == pro_order.activity_num);
Model.admin_log admin_log = new Model.admin_log();
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Order, (int)Model.admin_log.Status.Insert, pro_order.order_no);
if (isRegistered) // 重複報名
{
L_msg.Type = alert_type.warning;
L_msg.Text = "此信眾已報名過本活動";
}
else
{
_db.pro_order.Add(pro_order);
_db.SaveChanges();
Model.admin_log admin_log = new Model.admin_log();
admin_log.writeLog(admin.info.u_id, (int)Model.admin_log.Systems.Order, (int)Model.admin_log.Status.Insert, pro_order.order_no);
string url = "index.aspx";
url = "reg.aspx?order_no=" + pro_order.order_no;
Response.Redirect(url);
string url = "index.aspx";
url = "reg.aspx?order_no=" + pro_order.order_no;
Session["LastAddedNo"] = pro_order.order_no;
Response.Redirect(url);
}
}
else
{
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 81 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 99 KiB

File diff suppressed because it is too large Load Diff
+15
View File
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class admin_print_print_multi_new :MyWeb.function
{
private Model.ezEntities _db = new Model.ezEntities();
protected void Page_Load(object sender, EventArgs e)
{
}
}
File diff suppressed because it is too large Load Diff
+835
View File
@@ -0,0 +1,835 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link href="../../../js/vuetify.css" rel="stylesheet" />
<link href="../../../js/mdi-font/css/materialdesignicons.min.css" rel="stylesheet" />
<script src="../../../js/vue.min.js"></script>
<script src="../../../js/vuetify.min.js"></script>
<script src="../../../js/axios.min.js"></script>
<style>
html {
overflow: hidden;
}
.scrollable-list {
max-height: 250px;
height: 220px;
overflow-y: auto;
overflow-x: hidden;
}
.scrollable-list .v-list-item__content {
padding: 4px 0px;
}
.scrollable-list .v-list-item {
min-height: 30px;
padding: 0 8px;
}
.scrollable-list .v-list-item__action {
min-width: 0 !important;
width: auto !important;
margin-right: 0 !important;
}
.scrollable-list .v-btn--icon.v-size--default {
height: 24px;
width: 24px;
}
#app .v-card__subtitle,
#app .v-card__text,
#app .v-card__title {
padding: 12px 16px 0 16px;
}
#app .v-list-item.hover-item .v-list-item__subtitle {
/*display: none !important;*/
display: flex !important;
}
#app .v-list-item.hover-item:hover .v-list-item__subtitle {
display: flex !important;
}
.badge-deceased {
background-color: #ffc904;
color: #300a0a;
padding: 2px 4px;
border-radius: 20px;
font-weight: bold;
font-size: 10px;
display: inline-block;
position: relative;
top: -2px;
}
.badge-zero {
background-color: #CCC;
color: #FFF;
padding: 2px 4px;
border-radius: 20px;
font-weight: bold;
font-size: 10px;
display: inline-block;
position: relative;
top: -2px;
}
.equal-card {
min-height: 280px;
}
.checkbox-narrow {
min-width: 32px;
width: 32px;
padding: 0;
margin-right: 4px;
}
/* num=0 刪除按鈕警示樣式 */
.btn-delete-warning:hover {
background-color: #fff3cd !important;
border-radius: 50%;
}
.btn-delete-warning:hover .v-icon {
color: #856404 !important;
}
</style>
<link rel="stylesheet" href="print.css">
</head>
<body>
<div id="app">
<v-app>
<v-container>
<v-row>
<v-col cols="12" md="12">
選擇版型
<select id="model-select" v-model="selected.style">
<option v-for="c in code.style" :value="c.styleID">{{c.name}}</option>
</select>
</v-col>
</v-row>
<v-row>
<v-col cols="4" md="4">
<v-card class="pa-2" outlined tile>
<div class="docs editor">
<div class="page border" data-body-class="tblt-l a3">
<div class="content">
<div class="bg"><img alt="Alternate Text" :src="'../' + item_type_image"></div>
<div class="text">
<div class="top_text_1"></div>
<div class="top_text_2">{{tabletItem.print_id}}</div>
<div class="top_text_3"></div>
<div class="right_text text-block fit-text vertical text-start border"
style="--lines:0;--line_len:5;"></div>
<div class="mid_text text-block fit-text vertical border"
:style="mid_text_style" v-html="join_mid_text"></div>
<div class="mid_text_2 text-block fit-text vertical border"
style="--lines:0;--line_len:5;"></div>
<div class="left_text text-block fit-text vertical text-start border"
:style="left_text_style" v-html="join_left_text"></div>
<div class="txt_up vertical" v-if="item_type == 'B'">陽上</div>
<div class="txt_down vertical" v-if="item_type == 'B'">拜薦</div>
</div>
</div>
</div>
</div>
</v-card>
<div class="mt-2">
<v-btn color="primary" @click="saveData">儲存牌位</v-btn>
</div>
</v-col>
<v-col cols="4" md="4" id="type_edit_B" v-if="item_type==='B'" class="d-flex flex-column">
<v-card elevation="2" class="mb-2 equal-card">
<v-card-text class="py-2 px-2">
<v-row no-gutters align="center">
<v-col cols="auto">
<v-checkbox v-model="isAllSelected"
@change="toggleSelectAll"
color="primary"
hide-details
label="疏文代表"
class="ma-0"></v-checkbox>
</v-col>
<v-col cols="auto" class="ml-4">
<span class="subtitle-2 grey--text text--darken-1">超渡-已選</span>
</v-col>
<v-spacer></v-spacer>
<v-col cols="auto">
<v-btn color="primary" icon small @click="openAddDialog('Y')">
<v-icon>mdi-plus</v-icon>
</v-btn>
</v-col>
</v-row>
</v-card-text>
<v-list class="scrollable-list">
<v-list-item-group>
<v-list-item v-for="(member, index) in family_deceased_Y_selected" :key="index" class="hover-item">
<v-list-item-action>
<v-checkbox v-model="member.IsShuWen"
color="primary"
class="checkbox-narrow d-inline-flex align-center" />
</v-list-item-action>
<v-list-item-content>
<v-list-item-title>
<span class="badge-zero" v-if="member.num==0">0</span>
<span class="badge-deceased" v-if="member.deceased">{{ member.deceased ? '卍' : '' }}</span>
{{ member.fam_name }}
<v-chip v-if="member.fam_title" small>
{{ member.fam_title }}
</v-chip>
</v-list-item-title>
<v-list-item-subtitle class="d-flex justify-end">
<v-btn v-if="member.num === 0" icon @click="toggleNoSpace(member)" :title="'不加空格'">
<v-icon :color="member.nospace ? 'green' : 'grey lighten-1'">mdi-backspace</v-icon>
</v-btn>
<v-btn icon @click="moveUp(member, 'Y', index)" :disabled="index === 0">
<v-icon color="grey lighten-1">mdi-arrow-up</v-icon>
</v-btn>
<v-btn icon @click="moveDown(member, 'Y', index)" :disabled="index === family_deceased_Y_selected.length - 1">
<v-icon color="grey lighten-1">mdi-arrow-down</v-icon>
</v-btn>
<v-btn icon @click="confirmRemove(member, index, 'Y')" :class="{'btn-delete-warning': member.num === 0}">
<v-icon color="grey lighten-1">mdi-minus</v-icon>
</v-btn>
</v-list-item-subtitle>
</v-list-item-content>
<v-list-item-action class="align-self-start">
<v-btn icon @click="breakAfter(member, 'Y')">
<v-icon :color="member.option_break ? 'blue' : 'grey lighten-1'">
mdi-subdirectory-arrow-left
</v-icon>
</v-btn>
</v-list-item-action>
</v-list-item>
</v-list-item-group>
</v-list>
</v-card>
<v-card elevation="2" class="equal-card">
<v-card-subtitle>超渡-可選</v-card-subtitle>
<v-list class="scrollable-list">
<v-list-item-group>
<v-list-item v-for="member in family_deceased_Y_unselected" :key="member.fam_name">
<v-list-item-content>
<v-list-item-title>
<span class="badge-deceased" v-if="member.deceased">{{ member.deceased ? '卍' : '' }}</span>
{{ member.fam_name }}
<v-chip v-if="member.fam_title" small>
{{ member.fam_title }}
</v-chip>
</v-list-item-title>
</v-list-item-content>
<v-list-item-action>
<v-btn icon @click="addToSelected(member, 'Y')">
<v-icon color="grey lighten-1">mdi-plus</v-icon>
</v-btn>
</v-list-item-action>
</v-list-item>
</v-list-item-group>
</v-list>
</v-card>
</v-col>
<v-col cols="4" md="4" id="type_edit_AB" class="d-flex flex-column">
<v-card elevation="2" class="mb-2 equal-card">
<v-card-text class="py-2 px-2">
<v-row no-gutters align="center">
<v-col cols="auto" v-if="item_type==='A'">
<v-checkbox v-model="isAllSelected"
@change="toggleSelectAll"
color="primary"
hide-details
label="疏文代表"
class="ma-0"></v-checkbox>
</v-col>
<v-col cols="auto" :class="{'ml-4': item_type==='A'}">
<span class="subtitle-2 grey--text text--darken-1">陽上/祈福-已選</span>
</v-col>
<v-spacer></v-spacer>
<v-col cols="auto">
<v-btn color="primary" icon small @click="openAddDialog('N')">
<v-icon>mdi-plus</v-icon>
</v-btn>
</v-col>
</v-row>
</v-card-text>
<v-list class="scrollable-list">
<v-list-item-group>
<v-list-item v-for="(member, index) in family_deceased_N_selected" :key="index" class="hover-item">
<v-list-item-action v-if="item_type==='A'">
<v-checkbox v-model="member.IsShuWen"
color="primary"
class="checkbox-narrow d-inline-flex align-center" />
</v-list-item-action>
<v-list-item-content>
<v-list-item-title>
<span class="badge-zero" v-if="member.num==0">0</span>
<span class="badge-deceased" v-if="member.deceased">{{ member.deceased ? '卍' : '' }}</span>
{{ member.fam_name }}
<v-chip v-if="member.fam_title" small>
{{ member.fam_title }}
</v-chip>
</v-list-item-title>
<v-list-item-subtitle class="d-flex justify-end">
<v-btn v-if="member.num === 0" icon @click="toggleNoSpace(member)" :title="'不加空格'">
<v-icon :color="member.nospace ? 'green' : 'grey lighten-1'">mdi-backspace</v-icon>
</v-btn>
<v-btn icon @click="moveUp(member, 'N', index)" :disabled="index === 0">
<v-icon color="grey lighten-1">mdi-arrow-up</v-icon>
</v-btn>
<v-btn icon @click="moveDown(member, 'N', index)" :disabled="index === family_deceased_N_selected.length - 1">
<v-icon color="grey lighten-1">mdi-arrow-down</v-icon>
</v-btn>
<v-btn icon @click="confirmRemove(member, index, 'N')" :class="{'btn-delete-warning': member.num === 0}">
<v-icon color="grey lighten-1">mdi-minus</v-icon>
</v-btn>
</v-list-item-subtitle>
</v-list-item-content>
<v-list-item-action class="align-self-start">
<v-btn icon @click="breakAfter(member, 'N')">
<v-icon :color="member.option_break ? 'blue' : 'grey lighten-1'">
mdi-subdirectory-arrow-left
</v-icon>
</v-btn>
</v-list-item-action>
</v-list-item>
</v-list-item-group>
</v-list>
</v-card>
<v-card elevation="2" class="equal-card">
<v-card-subtitle>陽上/祈福-可選</v-card-subtitle>
<v-list class="scrollable-list">
<v-list-item-group>
<v-list-item v-for="member in family_deceased_N_unselected" :key="member.fam_name">
<v-list-item-content>
<v-list-item-title>
<span class="badge-deceased" v-if="member.deceased">{{ member.deceased ? '卍' : '' }}</span>
{{ member.fam_name }}
<v-chip v-if="member.fam_title" small>
{{ member.fam_title }}
</v-chip>
</v-list-item-title>
</v-list-item-content>
<v-list-item-action>
<v-btn icon @click="addToSelected(member, 'N')">
<v-icon color="grey lighten-1">mdi-plus</v-icon>
</v-btn>
</v-list-item-action>
</v-list-item>
</v-list-item-group>
</v-list>
</v-card>
</v-col>
</v-row>
</v-container>
<div style="display:block;">
<textarea id="desc_iframe" style="width: 900px; height: 100px;">{{tabletItem}}</textarea>
</div>
<!-- 新增項目對話框 -->
<v-dialog v-model="addDialog" max-width="400">
<v-card>
<v-card-title style="font-size: 1rem;">新增項目</v-card-title>
<v-card-text>
<div class="mb-2">
<v-chip
v-for="(phrase, idx) in phrases"
:key="idx"
small
class="mr-1 mb-1"
:title="phrase.length > 5 ? phrase : ''"
@click="newItemText = (newItemText || '') + phrase"
style="cursor: pointer;"
>{{ phrase.length > 5 ? phrase.slice(0, 5) + '...' : phrase }}</v-chip>
</div>
<v-text-field
v-model="newItemText"
label="請輸入名稱"
outlined
dense
clearable
autofocus
@keyup.enter="confirmAddItem"
></v-text-field>
</v-card-text>
<v-card-actions>
<div class="d-flex align-center">
<v-checkbox
class="pt-0"
v-model="noSpace"
label="不加空格"
dense
hide-details
></v-checkbox>
<v-icon class="ml-2 mt-1">mdi-backspace</v-icon>
</div>
<v-spacer></v-spacer>
<v-btn text @click="addDialog = false">取消</v-btn>
<v-btn color="primary" @click="confirmAddItem">確定</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<!-- 確認刪除對話框 -->
<v-dialog v-model="deleteDialog" max-width="350">
<v-card>
<v-card-title style="font-size: 1rem;">確認刪除</v-card-title>
<v-card-text>
確定要刪除「<strong>{{ deleteMemberName }}</strong>」嗎?<br>
<span class="red--text">此為手動新增項目,刪除後無法復原。</span>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn text @click="deleteDialog = false">取消</v-btn>
<v-btn color="error" @click="doRemove">確定刪除</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-app>
</div>
<script>
var VueApp = new Vue({
el: '#app',
vuetify: new Vuetify(),
data() {
return {
code: {
style:[]
},
selected: {
style:""
},
actitem: "",
pageSize: "",
defaultStyle:"",
isAllSelected: false,
dialog: false,
addDialog: false, // 新增項目對話框
addDialogType: '', // 'Y' 或 'N'
newItemText: '', // 新增項目的文字
noSpace: true, // 不加空格 checkbox(預設勾選)
deleteDialog: false, // 確認刪除對話框
deleteIndex: -1, // 要刪除的 index
deleteType: '', // 'Y' 或 'N'
deleteMemberName: '', // 要刪除的名稱(顯示用)
phrases: [], // 常用片語
familyMembers: [], // 親友名單
tabletItem: {}, // 傳入的資料(信眾/牌位資訊)
item: {},
family_deceased_Y_selected: [], // 超渡/超薦/超冤名單
family_deceased_N_selected: [] // 消災/陽上名單
};
},
watch: {
family_deceased_N_selected: {
handler(newValue) {
if (this.item_type === 'A') {
if (Array.isArray(newValue) && newValue.length > 0) {
this.isAllSelected = newValue.every(member => member.IsShuWen === true);
}
}
},
deep: true
},
family_deceased_Y_selected: {
handler(newValue) {
if (this.item_type === 'B') {
if (Array.isArray(newValue) && newValue.length > 0) {
this.isAllSelected = newValue.every(member => member.IsShuWen === true);
}
}
},
deep: true
},
actitem: {
handler() {
this.getActItem();
},
deep: true
}
},
computed: {
family_deceased_Y_unselected() {
return this.familyMembers.filter(member =>
member.deceased === true &&
!this.family_deceased_Y_selected.some(selected => selected.num === member.num));
},
family_deceased_N_unselected() {
return this.familyMembers.filter(member =>
member.deceased === false &&
!this.family_deceased_N_selected.some(selected => selected.num === member.num));
},
item_type() {
return this.tabletItem?.actitem_num_selected?.text?.includes('超') ? 'B' : 'A';
// A:消災, 陽上.....
// B:超渡, 超薦.....
},
item_type_image() {
if (this.item_type === 'B') {
return 'tablet-1.svg';
} else {
return 'tablet-2.svg';
}
},
join_mid_text() {
const target = this.item_type === 'B'
? this.family_deceased_Y_selected
: this.family_deceased_N_selected;
return this.join_text(target);
},
join_left_text() {
let target = '';
if (this.item_type === 'B') {
target = this.join_text(this.family_deceased_N_selected);
}
return target;
},
mid_text_style() {
const text = this.join_mid_text; // Remove function call since join_mid_text is a computed property
return this.calculateTextStyle(text);
},
left_text_style() {
if (this.item_type !== 'B') return '--lines:1;--line_len:5';
return this.calculateTextStyle(this.join_left_text);
}
},
mounted() {
// 載入常用片語
fetch('phrases.json')
.then(res => res.json())
.then(data => { this.phrases = data; })
.catch(err => console.error('載入 phrases.json 失敗:', err));
// 監聽來自父頁面的消息
window.addEventListener('message', (event) => {
this.isAllSelected = false;
console.log('editor.html - received message event');
//console.log('editor.html - event origin:', event.origin);
//console.log('editor.html - parent origin:', window.parent.location.origin);
if (event.origin === window.parent.location.origin) {
//console.log('editor.html - origin check passed');
//console.log('editor.html - received data:', event.data);
const receivedData = event.data;
this.family_deceased_Y_selected = [];
this.family_deceased_N_selected = [];
if (receivedData.tabletItem) {
console.log('editor.html - updating tabletItem:', receivedData.tabletItem);
this.tabletItem = receivedData.tabletItem;
if (receivedData.familyMembers) {
this.familyMembers = receivedData.familyMembers; // 更新 familyMembers
console.log("app mounted, window message: ", this.familyMembers, receivedData);
}
if (receivedData.tabletItem) {
this.tabletItem = receivedData.tabletItem;
}
//console.log("actitem:", receivedData.tabletItem.actitem_num_selected.val);
console.log("receivedData::",receivedData);
if (receivedData.tabletItem.style) {
this.selected.style = receivedData.tabletItem.style;
} else {
this.selected.style = "";
}
//console.log("actitem:", receivedData.tabletItem.actitem_num_selected.val);
this.actitem = receivedData.tabletItem.actitem_num_selected.val;
//console.log("actitem:",receivedData.tabletItem.actitem_num_selected.val);
// 處理 f_num_tablet 資料
if (this.tabletItem.f_num_tablet) {
try {
const data = JSON.parse(this.tabletItem.f_num_tablet);
if (this.item_type === 'B') {
// B類型:超渡、超薦等
this.family_deceased_Y_selected = data.mid_items || [];
this.family_deceased_N_selected = data.left_items || [];
this.family_deceased_Y_selected.forEach(item => {
if (item.IsShuWen === undefined) {
Vue.set(item, 'IsShuWen', false);
}
});
if (this.family_deceased_Y_selected.length > 0) {
this.isAllSelected = this.family_deceased_Y_selected.every(member => member.IsShuWen === true);
} else {
this.isAllSelected = false;
}
} else {
// A類型:消災、陽上等
this.family_deceased_Y_selected = [];
this.family_deceased_N_selected = data.mid_items || [];
this.family_deceased_N_selected.forEach(item => {
if (item.IsShuWen === undefined) {
Vue.set(item, 'IsShuWen', false);
}
});
if (this.family_deceased_Y_selected.length > 0) {
this.isAllSelected = this.family_deceased_N_selected.every(member => member.IsShuWen === true);
} else {
this.isAllSelected = false;
}
console.log(this.family_deceased_N_selected)
}
} catch (e) {
console.error('解析牌位資料時發生錯誤:', e);
}
}
}
}
//this.getActItem();
});
},
methods: {
getActItem() {
axios
.post('/api/tablet/GetActItem', { itemNum: this.actitem })
.then(response => {
console.log(response);
if (response.data.result == "Y" && response.data.data) {
this.pageSize = response.data.data.pageSize;
this.defaultStyle = response.data.data.defaultStyle;
this.selected.style = response.data.data.defaultStyle;
console.log("shit:",this.selected.style);
this.getStyle();
}
}
);
},
getStyle() {
axios
.post('/api/tablet/GetStyleData', {}, {})
.then(response => {
console.log(response);
if (response.data.data) {
response.data.data.forEach(x => {
if (x.styleID != "000001") {
console.log(this.pageSize, x.paperSize);
if (this.pageSize&&this.pageSize==x.paperSize) {
this.code.style.push(x)
}
}
})
}
})
.catch(error => console.log(error))
},
toggleSelectAll(checked) {
this.isAllSelected = checked
if (this.item_type === 'B') {
this.family_deceased_Y_selected.forEach(member => {
member.IsShuWen = checked;
});
}
else if (this.item_type === 'A') {
this.family_deceased_N_selected.forEach(member => {
member.IsShuWen = checked;
});
}
console.log(checked)
console.log(this.family_deceased_N_selected)
console.log(this.family_deceased_Y_selected)
},
openAddDialog(type) {
this.addDialogType = type;
this.newItemText = '';
this.noSpace = true; // 重置為預設勾選
this.addDialog = true;
},
confirmAddItem() {
if (!this.newItemText.trim()) {
return; // 不允許空白
}
const newItem = {
num: 0,
fam_name: this.newItemText.trim(),
fam_gender: '',
deceased: false,
fam_title: '',
option_break: false,
IsShuWen: this.isAllSelected,
nospace: this.noSpace
};
if (this.addDialogType === 'Y') {
this.family_deceased_Y_selected.push(newItem);
} else if (this.addDialogType === 'N') {
this.family_deceased_N_selected.push(newItem);
}
this.addDialog = false;
this.newItemText = '';
},
addToSelected(member, type) {
const selectedMember = {
num: member.num,
fam_name: member.fam_name,
fam_gender: member.fam_gender,
deceased: member.deceased,
fam_title: member.fam_title, // 新增,讓上方顯示稱謂 tag
option_break: false, // 默認為 false,根據需要可以更改
IsShuWen: this.isAllSelected //是否加入疏文名單,默認false
};
console.log(this.isAllSelected)
if (type === 'Y') {
this.family_deceased_Y_selected.push(selectedMember);
console.log(this.family_deceased_Y_selected)
} else if (type === 'N') {
this.family_deceased_N_selected.push(selectedMember);
console.log(this.family_deceased_N_selected)
}
},
confirmRemove(member, index, type) {
if (member.num === 0) {
// num=0 需確認
this.deleteIndex = index;
this.deleteType = type;
this.deleteMemberName = member.fam_name;
this.deleteDialog = true;
} else {
// num!=0 直接刪除
this.removeFromSelected(index, type);
}
},
doRemove() {
this.removeFromSelected(this.deleteIndex, this.deleteType);
this.deleteDialog = false;
},
removeFromSelected(index, type) {
if (type === 'Y') {
this.family_deceased_Y_selected.splice(index, 1);
} else if (type === 'N') {
this.family_deceased_N_selected.splice(index, 1);
}
},
moveUp(member, type, index) {
if (index > 0) {
const array = type === 'Y' ? this.family_deceased_Y_selected : this.family_deceased_N_selected;
const temp = array[index - 1];
this.$set(array, index - 1, member);
this.$set(array, index, temp);
}
},
moveDown(member, type, index) {
if (index < (type === 'Y' ? this.family_deceased_Y_selected : this.family_deceased_N_selected).length - 1) {
const array = type === 'Y' ? this.family_deceased_Y_selected : this.family_deceased_N_selected;
const temp = array[index + 1];
this.$set(array, index + 1, member);
this.$set(array, index, temp);
}
},
breakAfter(member, type) {
console.log("breakAfter", member, type);
member.option_break = !member.option_break;
},
toggleNoSpace(member) {
this.$set(member, 'nospace', !member.nospace);
},
join_text(target) {
let result = '';
target.forEach((member, index) => {
// 每項前面加空格,但例外:
// 1. 第一項前面不加空格 (index === 0)
// 2. nospace === true 的項目前面不加空格
if (index > 0 && !member.nospace) {
result += ' ';
}
result += member.fam_name;
// 處理換行:如果 option_break 為 true 且不是最後一項,加 <br>
if (member.option_break && index < target.length - 1) {
result += '<br>';
}
});
result = result.replace('|', '<br>');
return result;
},
calculateTextStyle(text) {
if (!text) return '--lines:1;--line_len:5';
const lines = text.split('<br>');
const line_len = Math.max(...lines.map(line => {
return Array.from(line).reduce((acc, char) => {
// Full width (Chinese) characters
if (char.match(/[\u4e00-\u9fa5]/)) {
return acc + 1;
}
// Half width (English, numbers, etc.)
return acc + 0.5;
}, 0);
}));
return `--lines:${lines.length};--line_len:${Math.ceil(line_len)}`;
},
saveData() {
// 其它資料欄位, 不應在這裡修改
// 應該在進來的時候, 就已經修改(insert)好了
let tablet_data = {};
if (this.item_type === 'B') {// B:超渡, 超薦.....
tablet_data = {
mid_items: this.family_deceased_Y_selected,
left_items: this.family_deceased_N_selected,
style: this.selected.style
}
}
else {// A:消災, 陽上.....
tablet_data = {
mid_items: this.family_deceased_N_selected,
left_items: null,
style: this.selected.style
}
}
console.log(tablet_data)
const ret = {
source: 'editor.btn.click',
data: {
tabletItem: this.tabletItem,
tablet_data: tablet_data,
style:this.selected.style
}
};
console.log("儲存牌位資料", ret);
window.parent.postMessage(ret, '/');
}
}
});
</script>
<script>
const desc_iframe = document.getElementById('desc_iframe');
const btn = document.getElementById('btn');
//window.addEventListener('message', (event) => {
// if (event.source === window.parent) {
// let data = event.data;
// if (data.source === 'order.btn.click') {
// console.log('editor message', event.source, window.parent);
// app.item = data;
// console.log(app);
// desc_iframe.value = JSON.stringify(data);
// }
// }
//});
/*
btn.addEventListener('click', () => {
const ret = {
source: 'editor.btn.click',
desc: desc_iframe.value,
}
debugger;
console.log("btn click", ret);
window.parent.postMessage(ret, '/');
});
*/
</script>
</body>
</html>
+29 -2
View File
@@ -105,6 +105,23 @@
></v-text-field>
</div>
</template>
<template v-slot:item.kind="{ item }">
<div>
<div class="mb-2">
<span class="badge bg-primary me-1" title="支付方式">收支項目</span>
</div>
</div>
<div>
<v-select
:items="accountingKinds"
v-model="item.kind"
dense
outlined
hide-details
style="max-width: 200px"
></v-select>
</div>
</template>
<template v-slot:item.check_memo="{ item }">
<div class="d-flex align-center my-2" style="min-width: 300px">
<v-text-field
@@ -159,6 +176,7 @@ new Vue({
{ text: '*入帳銀行/帳戶 | 支付資訊/帳號後5碼', value: 'acc_num' },
{ text: '*入帳日期', value: 'check_date' },
{ text: '*入帳金額', value: 'check_amount' },
{ text: '*收支項目', value: 'kind' },
{ text: '備註/狀態 | 核對記錄', value: 'check_memo' }
],
items: [],
@@ -172,7 +190,8 @@ new Vue({
{ text: '其他問題', value: '4' },
{ text: '作廢', value: '5' }
],
bankOptions: [],
bankOptions: [],
accountingKinds:[],
payTypeText: {
1: '現金',
2: '匯款',
@@ -212,6 +231,13 @@ new Vue({
text: x.kind + (x.bank_name ? ' - ' + x.bank_name : '') + (x.bank_id ? ' (' + x.bank_id + ')' : ''),
value: x.num
}));
const kindRes = await axios.post('../../api/accounting/GetTitleKindList', {}, { params: { page: 1, pageSize: 1000 } });
this.accountingKinds = kindRes.data.list.map(x => ({
text: x.kind ,
value: x.num
}));
this.loading = false;
},
async submitData() {
@@ -246,7 +272,8 @@ new Vue({
acc_num: item.acc_num,
check_date: item.check_date,
check_amount: item.check_amount,
check_memo: item.check_memo
check_memo: item.check_memo,
kind: item.kind
}));
try {
const res = await axios.post('../../api/transfer_register/batch_update', updateList);
@@ -65,6 +65,7 @@
</template>
<template v-slot:item.transfer_info="{ item }">
<div>
<div class="font-weight-bold text-primary">應收總額:{{ item.price_totals | currency }}</div>
<div class="font-weight-bold text-primary">入帳金額:{{ item.transfer_check_amount | currency }}</div>
<div class="text-success">沖帳日期:{{ item.transfer_check_date | date }}</div>
<div v-if="item.transfer_remain_amount > 0" class="text-warning">
@@ -202,6 +203,7 @@
<div class="mb-2"><span class="font-weight-bold">入帳帳戶:</span>{{ dialog.selected.acc_name }}</div>
<div class="mb-2"><span class="font-weight-bold">入帳日期:</span>{{ dialog.selected.transfer_check_date | date }}</div>
<div class="mb-2"><span class="font-weight-bold">入帳金額:</span>{{ dialog.selected.transfer_check_amount | currency }}</div>
<div class="mb-2"><span class="font-weight-bold">應收總額:</span>{{ dialog.selected.price_totals | currency }}</div>
</v-col>
</v-row>
<v-divider class="my-4"></v-divider>
+6 -3
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
@@ -42,11 +42,14 @@
<add key="UseSearchKeywords" value="true" />
<!--網站的簡稱,用來區別session和cookie-->
<add key="SC" value="erp17168" />
<add key="LogPath" value="C:\\log\\" />
<!--是否啟用信眾自動編號 (true=啟用, false=停用)-->
<add key="IsAutoNumbering" value="true" />
</appSettings>
<connectionStrings>
<!--SQL用-->
<add name="shopConn" providerName="System.Data.SqlClient" connectionString="Data Source=192.168.5.21;Initial Catalog=17168erp_t;User ID=sa;Password=linux@mssql1234;Encrypt=False;TrustServerCertificate=True;Provider=SQLOLEDB;Connection Timeout=10;" />
<add name="ezEntities" providerName="System.Data.EntityClient" connectionString="metadata=res://*/App_Code.Model.Model.csdl|res://*/App_Code.Model.Model.ssdl|res://*/App_Code.Model.Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=192.168.5.21;Initial Catalog=17168erp_t;User ID=sa;Password=linux@mssql1234;Encrypt=False;TrustServerCertificate=True;Connection Timeout=10;&quot;" />
<add name="shopConn" providerName="System.Data.SqlClient" connectionString="Data Source=192.168.5.225;Initial Catalog=17168erp_c;User ID=sa;Password=linux@mssql1234;Encrypt=False;TrustServerCertificate=True;Provider=SQLOLEDB;Connection Timeout=10;" />
<add name="ezEntities" providerName="System.Data.EntityClient" connectionString="metadata=res://*/App_Code.Model.Model.csdl|res://*/App_Code.Model.Model.ssdl|res://*/App_Code.Model.Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=192.168.5.225;Initial Catalog=17168erp_c;User ID=sa;Password=linux@mssql1234;Encrypt=False;TrustServerCertificate=True;Connection Timeout=10;&quot;" />
<!--
-->
<!--SQL用-->
+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) 欄位