chore: 首次簽入 Thinkyu ASP.NET 專案

- 加入 Visual Studio / ASP.NET .gitignore
- 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
This commit is contained in:
2026-09-10 09:42:37 +08:00
commit 577060bc78
2496 changed files with 501389 additions and 0 deletions
@@ -0,0 +1,338 @@
using System;
using System.Collections.Generic;
using System.Data;
using NPOI.SS.UserModel;
using System.IO;
using Wellan.Data;
using Wellan.Common;
/// <summary>
/// 支出憑證黏存單
/// </summary>
public class : ExcelReportBase
{
public ()
{
= "支出憑證黏存單";
}
protected override void Init()
{
base.Init();
bodyStyleCenterXS.SetFont(bodyFont8PT);
}
public override MemoryStream ()
{
int = 0;
int = 0;
List<string> List = new List<string>();
string = "";
#region
foreach (DataRow r in .Tables[0].Rows)
{
+= (WDAC.GetDateTimeValue(r["RPEDT"]) - WDAC.GetDateTimeValue(r["RPRDT"])).Days + 1;
List.Add(WDAC.GetStringValue(r["RPRSN"]));
}
for (int i = 0; i < List.Count; i++)
{
+= String.Format("{0}.{1}\n", i + 1, List[i]);
}
if (.Length > 0)
= .Substring(0, .Length - 1);
foreach (DataRow r in .Tables[1].Rows)
{
+= WDAC.GetInt32Value(r["總計"]);
}
#endregion
#region
excel.MergeCell(0, 0, 0, 16);
excel.SetCellValue(0, 0, String.Format("{0}\n承辦{1}\n『{2}』\n{3}", , , , ), headerStyle);
excel.MergeCell(1, 0, 1, 16);
excel.SetCellValue(1, 0, String.Format("所屬年度:{0}年度", WGuard1.WNTSA(.Year - WGuard1.CY11, "", false)), titleStyleLeftNoBorder);
excel.MergeCell(1, 0, 1, 16);
excel.MergeCell(2, 0, 2, 4);
excel.SetCellValue(2, 0, "傳票(付款憑單)編號:", titleStyleLeftNoBorder);
excel.MergeCell(2, 15, 2, 16);
excel.SetCellValue(2, 15, "黏貼單據___張", titleStyleRightNoBorder);
excel.SetRangeOuterBorder(2, 0, 2, 16, BorderStyle.Thin);
excel.MergeCell(3, 0, 5, 1);
excel.SetCellValue(3, 0, "第 號", titleStyleCenterNoBorder);
excel.SetRangeOuterBorder(3, 0, 5, 1, BorderStyle.Thin);
excel.MergeCell(3, 2, 3, 7);
excel.SetCellValue(3, 2, "金 額", titleStyleCenterNoBorder);
excel.SetRangeOuterBorder(3, 2, 3, 7, BorderStyle.Thin);
excel.SetCellValue(4, 2, "拾", titleStyleCenter);
excel.SetCellValue(4, 3, "萬", titleStyleCenter);
excel.SetCellValue(4, 4, "仟", titleStyleCenter);
excel.SetCellValue(4, 5, "佰", titleStyleCenter);
excel.SetCellValue(4, 6, "拾", titleStyleCenter);
excel.SetCellValue(4, 7, "元", titleStyleCenter);
string s總金額 = String.Format("{0:000000}", );
excel.SetCellValue(5, 2, Convert.ToString(s總金額[0]), titleStyleCenter);
excel.SetCellValue(5, 3, Convert.ToString(s總金額[1]), titleStyleCenter);
excel.SetCellValue(5, 4, Convert.ToString(s總金額[2]), titleStyleCenter);
excel.SetCellValue(5, 5, Convert.ToString(s總金額[3]), titleStyleCenter);
excel.SetCellValue(5, 6, Convert.ToString(s總金額[4]), titleStyleCenter);
excel.SetCellValue(5, 7, Convert.ToString(s總金額[5]), titleStyleCenter);
excel.MergeCell(3, 8, 4, 10);
excel.SetCellValue(3, 8, "用途別", titleStyleCenterNoBorder);
excel.SetRangeOuterBorder(3, 8, 4, 10, BorderStyle.Thin);
excel.MergeCell(5, 8, 5, 10);
excel.SetCellValue(5, 8, "用途摘要", titleStyleCenterNoBorder);
excel.SetRangeOuterBorder(5, 8, 5, 10, BorderStyle.Thin);
excel.MergeCell(3, 11, 4, 16);
excel.SetCellValue(3, 11, "國內旅費", titleStyleLeftNoBorder);
excel.SetRangeOuterBorder(3, 11, 4, 16, BorderStyle.Thin);
excel.MergeCell(5, 11, 5, 16);
excel.SetCellValue(5, 11, String.Format("{0:MM}月出差", ), titleStyleLeftNoBorder);
excel.SetRangeOuterBorder(5, 11, 5, 16, BorderStyle.Thin);
excel.MergeCell(6, 8, 6, 12);
excel.SetCellValue(6, 8, "國內出差旅費報告單", headerStyle);
excel.MergeCell(6, 13, 6, 16);
excel.SetCellValue(6, 13, String.Format("{0:填表日期:yyyy年MM月dd日}", DateTime.UtcNow.AddHours(8).Date), titleStyleRightNoBorder);
excel.SetRangeOuterBorder(6, 0, 6, 16, BorderStyle.Thin);
excel.MergeCell(7, 0, 7, 2);
excel.MergeCell(7, 3, 7, 6);
excel.MergeCell(7, 7, 7, 8);
excel.MergeCell(7, 9, 7, 11);
excel.MergeCell(7, 12, 7, 13);
excel.MergeCell(7, 14, 7, 16);
excel.SetCellValue(7, 0, "姓 名", titleStyleCenterNoBorder);
excel.SetCellValue(7, 3, WDAC.GetStringValue(.Tables[0].Rows[0]["BPNME"]), titleStyleCenterNoBorder);
excel.SetCellValue(7, 7, "單 位", titleStyleCenterNoBorder);
excel.SetCellValue(7, 9, WDAC.GetStringValue(.Tables[0].Rows[0]["站別"]), titleStyleCenterNoBorder);
excel.SetCellValue(7, 12, "職 稱", titleStyleCenterNoBorder);
excel.SetCellValue(7, 14, WDAC.GetStringValue(.Tables[0].Rows[0]["職稱"]), titleStyleCenterNoBorder);
excel.SetRangeOuterBorder(7, 0, 7, 2, BorderStyle.Thin);
excel.SetRangeOuterBorder(7, 3, 7, 6, BorderStyle.Thin);
excel.SetRangeOuterBorder(7, 7, 7, 8, BorderStyle.Thin);
excel.SetRangeOuterBorder(7, 9, 7, 11, BorderStyle.Thin);
excel.SetRangeOuterBorder(7, 12, 7, 13, BorderStyle.Thin);
excel.SetRangeOuterBorder(7, 14, 7, 16, BorderStyle.Thin);
excel.MergeCell(8, 0, 8, 2);
excel.MergeCell(8, 3, 8, 16);
excel.SetCellValue(8, 0, "出差事由", titleStyleCenterNoBorder);
excel.SetCellValue(8, 3, , titleStyleLeftNoBorder);
excel.SetRangeOuterBorder(8, 0, 8, 2, BorderStyle.Thin);
excel.SetRangeOuterBorder(8, 3, 8, 16, BorderStyle.Thin);
excel.MergeCell(9, 0, 9, 16);
excel.SetCellValue(9, 0, String.Format("中華民國 {0:yyyy} 年 {0:MM} 月 {0:dd} 日 至 {1:yyyy} 年 {1:MM} 月 {1:dd} 日止 共計 {2} 天 附單據___張",
, .AddMonths(1).AddDays(-1), ), titleStyleCenterNoBorder);
excel.SetRangeOuterBorder(9, 0, 9, 16, BorderStyle.Thin);
excel.MergeCell(10, 0, 10, 1);
excel.MergeCell(10, 2, 11, 4);
excel.MergeCell(10, 5, 11, 7);
excel.MergeCell(10, 8, 10, 11);
excel.MergeCell(10, 12, 11, 12);
excel.MergeCell(10, 13, 11, 13);
excel.MergeCell(10, 14, 11, 14);
excel.MergeCell(10, 15, 11, 15);
excel.MergeCell(10, 16, 11, 16);
excel.SetCellValue(10, 0, String.Format("{0:yyyy}年", ), titleStyleCenterNoBorder);
excel.SetCellValue(11, 0, "月", titleStyleCenter);
excel.SetCellValue(11, 1, "日", titleStyleCenter);
excel.SetCellValue(10, 2, "起訖地點", titleStyleCenterNoBorder);
excel.SetCellValue(10, 5, "工作摘要", titleStyleCenterNoBorder);
excel.SetCellValue(10, 8, "交通費", titleStyleCenterNoBorder);
excel.SetCellValue(11, 8, "捷運\n及\n汽車", titleStyleCenter);
excel.SetCellValue(11, 9, "火\n車", titleStyleCenter);
excel.SetCellValue(11, 10, "高\n鐵", titleStyleCenter);
excel.SetCellValue(11, 11, "飛\n機", titleStyleCenter);
excel.SetCellValue(10, 12, "住宿費\n+\n過路費", titleStyleCenterNoBorder);
excel.SetCellValue(10, 13, "雜費", titleStyleCenterNoBorder);
excel.SetCellValue(10, 14, "單據\n號數", titleStyleCenterNoBorder);
excel.SetCellValue(10, 15, "總計", titleStyleCenterNoBorder);
excel.SetCellValue(10, 16, "備註", titleStyleCenterNoBorder);
excel.SetRangeOuterBorder(10, 0, 10, 1, BorderStyle.Thin);
excel.SetRangeOuterBorder(10, 2, 11, 4, BorderStyle.Thin);
excel.SetRangeOuterBorder(10, 5, 11, 7, BorderStyle.Thin);
excel.SetRangeOuterBorder(10, 8, 10, 11, BorderStyle.Thin);
excel.SetRangeOuterBorder(10, 12, 11, 12, BorderStyle.Thin);
excel.SetRangeOuterBorder(10, 13, 11, 13, BorderStyle.Thin);
excel.SetRangeOuterBorder(10, 14, 11, 14, BorderStyle.Thin);
excel.SetRangeOuterBorder(10, 15, 11, 15, BorderStyle.Thin);
excel.SetRangeOuterBorder(10, 16, 11, 16, BorderStyle.Thin);
excel.SetRowHeight(0, HeaderRowHeight * 4);
excel.SetRowHeight(1, BodyRowHeight);
excel.SetRowHeight(2, BodyRowHeight);
excel.SetRowHeight(3, BodyRowHeight);
excel.SetRowHeight(4, BodyRowHeight);
excel.SetRowHeight(5, BodyRowHeight * 2);
excel.SetRowHeight(6, BodyRowHeight * 2);
excel.SetRowHeight(7, BodyRowHeight);
excel.SetRowHeight(8, BodyRowHeight * (.Tables[0].Rows.Count > 4 ? .Tables[0].Rows.Count : 4));
excel.SetRowHeight(9, BodyRowHeight);
excel.SetRowHeight(10, BodyRowHeight);
excel.SetRowHeight(11, BodyRowHeight * 2);
#endregion
#region
int rowId = 12;
int beginRow = 12;
foreach (DataRow r in .Tables[1].Rows)
{
DataRow[] master = .Tables[0].Select("RPREN='" + WDAC.GetStringValue(r["單號"]) + "'");
excel.SetCellValue(rowId, 0, String.Format("{0:MM}", r["日期"]), bodyStyleCenter);
excel.SetCellValue(rowId, 1, String.Format("{0:dd}", r["日期"]), bodyStyleCenter);
excel.MergeCell(rowId, 2, rowId, 4);
excel.SetCellValue(rowId, 2, WDAC.GetStringValue(r["起地點"]) + "~" + WDAC.GetStringValue(r["迄地點"]), bodyStyleCenterS);
excel.SetRangeOuterBorder(rowId, 2, rowId, 4, BorderStyle.Thin);
excel.MergeCell(rowId, 5, rowId, 7);
= WDAC.GetStringValue(master[0]["RPRSN"]);
if (master.Length > 0 && List.Contains())
excel.SetCellValue(rowId, 5, String.Format("同出差事由 {0}", List.IndexOf() + 1), bodyStyleCenterS);
else
excel.SetCellValue(rowId, 5, "", bodyStyleCenter);
excel.SetRangeOuterBorder(rowId, 5, rowId, 7, BorderStyle.Thin);
excel.SetCellValue(rowId, 8, WDAC.GetDoubleValue(r["捷運"]) + WDAC.GetDoubleValue(r["汽車"]), bodyStyleCenter);
excel.SetCellValue(rowId, 9, WDAC.GetDoubleValue(r["火車"]), bodyStyleCenter);
excel.SetCellValue(rowId, 10, WDAC.GetDoubleValue(r["高鐵"]), bodyStyleCenter);
excel.SetCellValue(rowId, 11, WDAC.GetDoubleValue(r["飛機"]), bodyStyleCenter);
excel.SetCellValue(rowId, 12, WDAC.GetDoubleValue(r["住宿費"]) + WDAC.GetDoubleValue(r["過路費"]), bodyStyleCenter);
excel.SetCellValue(rowId, 13, WDAC.GetDoubleValue(r["雜費"]), bodyStyleCenter);
excel.SetCellValue(rowId, 14, WDAC.GetStringValue(r["單據號數"]), bodyStyleCenter);
excel.SetCellValue(rowId, 15, WDAC.GetDoubleValue(r["總計"]), bodyStyleCenter);
excel.SetCellValue(rowId, 16, WDAC.GetStringValue(r["備註"]), bodyStyleCenterXS);
excel.SetRowHeight(rowId, (int)(BodyRowHeight * 1.5));
rowId++;
}
// 補空行
if (.Tables[1].Rows.Count < 10)
{
for (int n = .Tables[1].Rows.Count; n < 10; n++)
{
excel.SetCellValue(rowId, 0, "", bodyStyleCenter);
excel.SetCellValue(rowId, 1, "", bodyStyleCenter);
excel.MergeCell(rowId, 2, rowId, 4);
excel.SetCellValue(rowId, 2, "", bodyStyleCenter);
excel.SetRangeOuterBorder(rowId, 2, rowId, 4, BorderStyle.Thin);
excel.MergeCell(rowId, 5, rowId, 7);
excel.SetCellValue(rowId, 5, "", bodyStyleCenter);
excel.SetRangeOuterBorder(rowId, 5, rowId, 7, BorderStyle.Thin);
excel.SetCellValue(rowId, 8, "", bodyStyleCenter);
excel.SetCellValue(rowId, 9, "", bodyStyleCenter);
excel.SetCellValue(rowId, 10, "", bodyStyleCenter);
excel.SetCellValue(rowId, 11, "", bodyStyleCenter);
excel.SetCellValue(rowId, 12, "", bodyStyleCenter);
excel.SetCellValue(rowId, 13, "", bodyStyleCenter);
excel.SetCellValue(rowId, 14, "", bodyStyleCenter);
excel.SetCellValue(rowId, 15, "", bodyStyleCenter);
excel.SetCellValue(rowId, 16, "", bodyStyleCenter);
excel.SetRowHeight(rowId, (int)(BodyRowHeight * 0.8));
rowId++;
}
}
#endregion
#region
excel.MergeCell(rowId, 0, rowId, 4);
excel.SetCellValue(rowId, 0, "合 計", titleStyleCenter);
excel.SetRangeOuterBorder(rowId, 0, rowId, 4, BorderStyle.Thin);
excel.MergeCell(rowId, 5, rowId, 7);
excel.SetRangeOuterBorder(rowId, 5, rowId, 7, BorderStyle.Thin);
excel.SetCellFormula(rowId, 8, String.Format("SUM({0}:{1})", excel.RCtoA1(beginRow, 8), excel.RCtoA1(rowId - 1, 8)), bodyStyleCenter);
excel.SetCellFormula(rowId, 9, String.Format("SUM({0}:{1})", excel.RCtoA1(beginRow, 9), excel.RCtoA1(rowId - 1, 9)), bodyStyleCenter);
excel.SetCellFormula(rowId, 10, String.Format("SUM({0}:{1})", excel.RCtoA1(beginRow, 10), excel.RCtoA1(rowId - 1, 10)), bodyStyleCenter);
excel.SetCellFormula(rowId, 11, String.Format("SUM({0}:{1})", excel.RCtoA1(beginRow, 11), excel.RCtoA1(rowId - 1, 11)), bodyStyleCenter);
excel.SetCellFormula(rowId, 12, String.Format("SUM({0}:{1})", excel.RCtoA1(beginRow, 12), excel.RCtoA1(rowId - 1, 12)), bodyStyleCenter);
excel.SetCellFormula(rowId, 13, String.Format("SUM({0}:{1})", excel.RCtoA1(beginRow, 13), excel.RCtoA1(rowId - 1, 13)), bodyStyleCenter);
excel.SetCellValue(rowId, 14, "", titleStyleCenter);
excel.SetCellFormula(rowId, 15, String.Format("SUM({0}:{1})", excel.RCtoA1(beginRow, 15), excel.RCtoA1(rowId - 1, 15)), bodyStyleCenter);
excel.SetCellValue(rowId, 16, "", titleStyleCenter);
excel.SetRowHeight(rowId, BodyRowHeight);
rowId++;
excel.MergeCell(rowId, 0, rowId, 4);
excel.MergeCell(rowId, 5, rowId, 9);
excel.MergeCell(rowId, 10, rowId, 13);
excel.MergeCell(rowId, 14, rowId, 16);
if (.Length >= 6 && .Substring(.Length - 6, 6) == "B00001")
{
excel.SetCellValue(rowId, 0, "申 請 人", titleStyleCenter);
excel.SetCellValue(rowId, 5, "單 位 主 管", titleStyleCenter);
excel.SetCellValue(rowId, 10, "財 會 經 辦", titleStyleCenter);
excel.SetCellValue(rowId, 14, "人 資 單 位", titleStyleCenter);
}
else
{
excel.SetCellValue(rowId, 0, "申 請 人", titleStyleCenter);
excel.SetCellValue(rowId, 5, "計 畫 督 導", titleStyleCenter);
excel.SetCellValue(rowId, 10, "人 事 單 位", titleStyleCenter);
excel.SetCellValue(rowId, 14, "財 務 主 管", titleStyleCenter);
}
excel.SetRangeOuterBorder(rowId, 0, rowId, 4, BorderStyle.Thin);
excel.SetRangeOuterBorder(rowId, 5, rowId, 9, BorderStyle.Thin);
excel.SetRangeOuterBorder(rowId, 10, rowId, 13, BorderStyle.Thin);
excel.SetRangeOuterBorder(rowId, 14, rowId, 16, BorderStyle.Thin);
excel.SetRowHeight(rowId, BodyRowHeight);
rowId++;
excel.MergeCell(rowId, 0, rowId, 4);
excel.SetCellValue(rowId, 0, WDAC.GetStringValue(.Tables[0].Rows[0]["BPNME"]), bodyStyleCenter);
excel.MergeCell(rowId, 5, rowId, 9);
excel.MergeCell(rowId, 10, rowId, 13);
excel.MergeCell(rowId, 14, rowId, 16);
excel.SetRangeOuterBorder(rowId, 0, rowId, 4, BorderStyle.Thin);
excel.SetRangeOuterBorder(rowId, 5, rowId, 9, BorderStyle.Thin);
excel.SetRangeOuterBorder(rowId, 10, rowId, 13, BorderStyle.Thin);
excel.SetRangeOuterBorder(rowId, 14, rowId, 16, BorderStyle.Thin);
excel.SetRowHeight(rowId, BodyRowHeight * 3);
#endregion
excel.SetColumnWidth(0, 4);
excel.SetColumnWidth(1, 4);
excel.SetColumnWidth(2, 4);
excel.SetColumnWidth(3, 4);
excel.SetColumnWidth(4, 4);
excel.SetColumnWidth(5, 4);
excel.SetColumnWidth(6, 4);
excel.SetColumnWidth(7, 4);
excel.SetColumnWidth(8, 7);
excel.SetColumnWidth(9, 7);
excel.SetColumnWidth(10, 7);
excel.SetColumnWidth(11, 7);
excel.SetColumnWidth(12, 7);
excel.SetColumnWidth(13, 7);
excel.SetColumnWidth(14, 7);
excel.SetColumnWidth(15, 9);
excel.SetColumnWidth(16, 20);
MemoryStream ms = new MemoryStream();
workbook.Write(ms);
return ms;
}
}