From f820d227c54e7686d7b582fcd3c1ffcf885b5d31 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期五, 24 一月 2025 12:22:49 +0800
Subject: [PATCH] 审批拒绝的可以修改后再次提交   完成 报销单需要一个编号   EvaluationContent  报销单编号 完成 增加一个状态,保存状态   完成

---
 CY_ECommercePlatform/CY.WebForm/Pages/work/BaoxiaoFukuanList.aspx.cs |  135 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 135 insertions(+), 0 deletions(-)

diff --git a/CY_ECommercePlatform/CY.WebForm/Pages/work/BaoxiaoFukuanList.aspx.cs b/CY_ECommercePlatform/CY.WebForm/Pages/work/BaoxiaoFukuanList.aspx.cs
index 7620d6a..c293ef3 100644
--- a/CY_ECommercePlatform/CY.WebForm/Pages/work/BaoxiaoFukuanList.aspx.cs
+++ b/CY_ECommercePlatform/CY.WebForm/Pages/work/BaoxiaoFukuanList.aspx.cs
@@ -9,6 +9,9 @@
 using CY.Model;
 using CY.Infrastructure.Query;
 using CY.Infrastructure.Common;
+using NPOI.SS.UserModel;
+using NPOI.XSSF.UserModel;
+using System.IO;
 
 namespace CY.WebForm.Pages.work
 {
@@ -224,5 +227,137 @@
         {
             BindList();
         }
+
+
+
+
+        //鏌ヨ浜嬩欢
+        protected void btn_Daochu_Click(object src, EventArgs e)
+        {
+           
+            byte[] fileBytes = ExportToExcel();
+            if (fileBytes != null)
+            {
+                Response.Clear();
+                Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+                Response.AppendHeader("Content-Disposition", "attachment; filename=鎶ラ攢浠樻瀵煎嚭.xlsx");
+                Response.BinaryWrite(fileBytes);
+                Response.End();
+            }
+            else
+            {
+                // 澶勭悊瀵煎嚭澶辫触鐨勬儏鍐�
+                Response.Write("瀵煎嚭澶辫触锛岃绋嶅悗閲嶈瘯锛�");
+            }
+
+        }
+
+
+        public byte[] ExportToExcel()
+        {
+            byte[] bt = null;
+            try
+            {
+                Pagination pa = new Pagination();
+                DateTime? beginTime = null;
+                DateTime? endTime = null;
+                pa.PageSize = 10000;
+                pa.PageIndex = 1;
+                var oA_WorkPlans = bll_OA_WorkPlanBll.SelectModelPage(pa, CurrentUser.MemberId, Guid.Empty, Guid.Empty, 3, 17, "", null, null, string.IsNullOrEmpty(this.txtRegTimeStart.Value) ? beginTime : Convert.ToDateTime(this.txtRegTimeStart.Value), string.IsNullOrEmpty(this.txtRegTimeEnd.Value) ? endTime : Convert.ToDateTime(this.txtRegTimeEnd.Value), this.txtPlanPeople.Value.Trim(), -1, 1, this.selEvaluationStatus.Value.ToInt32(), null, this.TxtRewardContent.Value.Trim(), this.txtPlanContent.Value.Trim());
+
+
+                // 鍒涘缓宸ヤ綔绨�
+                IWorkbook workbook = new XSSFWorkbook();
+                ISheet sheet = workbook.CreateSheet("瀵煎嚭鏁版嵁");
+
+                // 鍒涘缓琛ㄥご
+                IRow headerRow = sheet.CreateRow(0);
+                headerRow.CreateCell(0).SetCellValue("缂栧彿");
+                headerRow.CreateCell(1).SetCellValue("鐢宠鏃ユ湡");
+                headerRow.CreateCell(2).SetCellValue("鎶ラ攢鍗曞彿");
+                headerRow.CreateCell(3).SetCellValue("閮ㄩ棬");
+                headerRow.CreateCell(4).SetCellValue("濮撳悕");
+                headerRow.CreateCell(5).SetCellValue("绉戠洰");
+                headerRow.CreateCell(6).SetCellValue("鎽樿");
+                headerRow.CreateCell(7).SetCellValue("閲戦");
+                headerRow.CreateCell(8).SetCellValue("浠樻鐘舵��");
+                headerRow.CreateCell(9).SetCellValue("瀹℃壒浜�1");
+                headerRow.CreateCell(10).SetCellValue("瀹℃壒鏃堕棿1");
+                headerRow.CreateCell(11).SetCellValue("瀹℃壒缁撴灉1");
+                headerRow.CreateCell(12).SetCellValue("瀹℃壒浜�2");
+                headerRow.CreateCell(13).SetCellValue("瀹℃壒鏃堕棿2");
+                headerRow.CreateCell(14).SetCellValue("瀹℃壒缁撴灉2");
+                headerRow.CreateCell(15).SetCellValue("瀹℃壒浜�3");
+                headerRow.CreateCell(16).SetCellValue("瀹℃壒鏃堕棿3");
+                headerRow.CreateCell(17).SetCellValue("瀹℃壒缁撴灉3");
+
+                // 娣诲姞鏁版嵁
+                int rowIndex = 1;
+                foreach (var order in oA_WorkPlans)
+                {
+                    IRow row = sheet.CreateRow(rowIndex++);
+                    row.CreateCell(0).SetCellValue((rowIndex-1).ToString());
+                    row.CreateCell(1).SetCellValue(order.PlanStartTime.Value.ToString("yyyy-MM-dd HH:mm:ss"));
+                    row.CreateCell(2).SetCellValue(order.EvaluationContent);
+                    row.CreateCell(3).SetCellValue(order.DepartName);
+                    row.CreateCell(4).SetCellValue(order.PlanPeople);
+                    row.CreateCell(5).SetCellValue(order.RewardContent);
+                    row.CreateCell(6).SetCellValue(order.PlanContent);
+                    row.CreateCell(7).SetCellValue(order.PlanMoney.ToString());
+                    row.CreateCell(8).SetCellValue(order.EvaluationStatusName);
+                    var oA_WorkPlan_Shenpis = oA_WorkPlan_ShenpiBLL.GetModelByKaipiaoId(order.Keyid.Value).OrderBy(x => x.Keyid).ToList();
+                    foreach (var a_WorkPlan_Shenpi in oA_WorkPlan_Shenpis)
+                    {
+                        var oA_Staff = oA_StaffBLL.GetModelByMemberId(a_WorkPlan_Shenpi.ApprovalStaffId);
+                        if (oA_Staff != null)
+                        {
+                            a_WorkPlan_Shenpi.ApprovalStaffName = oA_Staff.Name;
+                        }
+                    }
+                    if (oA_WorkPlan_Shenpis.Count > 0)
+                    {
+                        row.CreateCell(9).SetCellValue(oA_WorkPlan_Shenpis[0].ApprovalStaffName);
+                        row.CreateCell(10).SetCellValue(oA_WorkPlan_Shenpis[0].ApprovalTime.Value.ToString("yyyy-MM-dd HH:mm:ss"));
+                        row.CreateCell(11).SetCellValue(oA_WorkPlan_Shenpis[0].ApprovalStatusName);
+                       
+                    }
+                    if (oA_WorkPlan_Shenpis.Count > 1)
+                    {
+                        row.CreateCell(12).SetCellValue(oA_WorkPlan_Shenpis[1].ApprovalStaffName);
+                        row.CreateCell(13).SetCellValue(oA_WorkPlan_Shenpis[1].ApprovalTime.Value.ToString("yyyy-MM-dd HH:mm:ss"));
+                        row.CreateCell(14).SetCellValue(oA_WorkPlan_Shenpis[1].ApprovalStatusName);
+
+                    }
+                    if (oA_WorkPlan_Shenpis.Count > 2)
+                    {
+                        row.CreateCell(15).SetCellValue(oA_WorkPlan_Shenpis[2].ApprovalStaffName);
+                        row.CreateCell(16).SetCellValue(oA_WorkPlan_Shenpis[2].ApprovalTime.Value.ToString("yyyy-MM-dd HH:mm:ss"));
+                        row.CreateCell(17).SetCellValue(oA_WorkPlan_Shenpis[2].ApprovalStatusName);
+
+                    }
+                    
+                }
+
+                // 灏嗗伐浣滅翱鍐欏叆鍐呭瓨娴�
+                using (var ms = new MemoryStream())
+                {
+                    workbook.Write(ms);
+                    bt = ms.ToArray();
+                }
+            }
+            catch (Exception e)
+            {
+                bt = null;
+                // 璁板綍鏃ュ織
+               
+            }
+            return bt;
+        }
+
+
+
+
+
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1