12 Commits

Author SHA1 Message Date
c235a138ee .... 2026-03-20 18:14:27 +08:00
1b79aa9d14 報名 2026-03-19 17:44:27 +08:00
095b310109 排版功能調整 2026-03-13 17:59:14 +08:00
f92fa65133 go 2026-03-12 17:44:08 +08:00
d81b99fd7d 1 2026-03-12 11:22:28 +08:00
f900649724 .. 2026-03-11 17:38:27 +08:00
0bb9da198b .. 2026-03-11 17:37:27 +08:00
5baac4fdb7 預覽 2026-03-11 15:37:05 +08:00
b66976b7c4 增加紙張尺寸設定 2026-03-10 17:59:57 +08:00
bfd07ebe90 .. 2026-03-09 18:09:32 +08:00
50b24a7282 script 2026-03-06 19:10:33 +08:00
27f936d4a9 排版 2026-03-06 19:08:25 +08:00
13 changed files with 10427 additions and 136 deletions

8045
data/17168erp_t.sql Normal file

File diff suppressed because it is too large Load Diff

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;
}
}

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; }
}

View File

@@ -282,6 +282,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,11 +302,12 @@ 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);

View File

@@ -0,0 +1,245 @@
using Microsoft.Ajax.Utilities;
using MINOM.COM.Utility;
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
{
public designerController()
{
//
// TODO: 在這裡新增建構函式邏輯
//
}
[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/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);
}
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);
return Ok();
}
[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);
return Ok();
}
}

File diff suppressed because it is too large Load Diff

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,

View File

@@ -67,10 +67,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 +95,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;
}

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>

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)
{
}
}

708
web/admin/order/index3.aspx Normal file
View File

@@ -0,0 +1,708 @@
<%@ 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 :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-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">QOO</div>
`,
props: ['oneData'],
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],
},
}
};
},
watch: {
options: {
handler() {
this.getDetail()
},
deep: true,
},
},
methods: {
getDetail() {
const { sortBy, sortDesc, page, itemsPerPage } = this.options
const params = {
sortBy: sortBy[0], sortDesc: sortDesc[0],
page: clearpage ? '1' : page, pageSize: itemsPerPage,
activity_num: $root.selected_act
};
this.detail_table.loading = true
sessionStorage.setItem('orderpage', 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))
},
}
});
let VueApp = new Vue({
el: '#app',
vuetify: new Vuetify(),
data() {
return {
currentView: 'step-one',
selected_act:'',
};
}
});
</script>
</asp:Content>

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();
}
}

View File

@@ -42,11 +42,12 @@
<add key="UseSearchKeywords" value="true" />
<!--網站的簡稱用來區別session和cookie-->
<add key="SC" value="erp17168" />
<add key="LogPath" value="D:\\log\\" />
</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.16;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.16;Initial Catalog=17168erp_t;User ID=sa;Password=linux@mssql1234;Encrypt=False;TrustServerCertificate=True;Connection Timeout=10;&quot;" />
<!--
-->
<!--SQL用-->