Browse Source

出入境费用明细
新增客户名单文件下载

leiy 11 months ago
parent
commit
c925857196

+ 65 - 11
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -60,6 +60,7 @@ using System.Security.Cryptography.Xml;
 using MathNet.Numerics;
 using System.Security.Policy;
 using System.Xml;
+using OASystem.Domain.Dtos.QiYeWeChat;
 
 namespace OASystem.API.Controllers
 {
@@ -3570,7 +3571,8 @@ namespace OASystem.API.Controllers
                 {
                     return Ok(JsonView(false, @"请传入有效的SubTypeId参数; 
                                                 1 明细表 --> 1005(默认明细表) 1006(因公出国(境)经费测算明细表) 1007(四川省商务厅出国经费财政先行审核表)  
-                                                2 表格 --> 1008(派员单位出(境)任务和预算审批意见表) 1009(省级单位出(境)经费报销单)"));
+                                                2 表格 --> 1008(派员单位出(境)任务和预算审批意见表) 1009(省级单位出(境)经费报销单)
+                                                3 团组成员名单 1 团组成员名单"));
                 }
 
                 var _EnterExitCosts = _sqlSugar.Queryable<Grp_EnterExitCost>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).First();
@@ -3810,7 +3812,7 @@ namespace OASystem.API.Controllers
                                     var arrCode = spDotandEmpty[2].Substring(3, 3);
                                     string depName = threeCodes.Find(it => it.Three.Equals(depCode)).City,
                                            arrName = threeCodes.Find(it => it.Three.Equals(arrCode)).City;
-                                    
+
                                     list.Add(depName);
                                     list.Add(arrName);
                                 }
@@ -3876,7 +3878,7 @@ namespace OASystem.API.Controllers
 
                             decimal rate = 0.00M;
                             rate = rateDatas.Find(it => it.CurrencyCode.Equals(currency)).Rate;
-                           
+
                             builder.Write(rate.ToString("#0.0000"));//汇率
                             builder.MoveToCell(0, accommodationStartIndex, 8, 0);
 
@@ -4064,7 +4066,7 @@ namespace OASystem.API.Controllers
                             new DataColumn(){ ColumnName = "rate",  DataType = typeof(decimal) },
                             new DataColumn(){ ColumnName = "costRMB"},
                         });
-                        dtdac1.TableName = "tb1"; 
+                        dtdac1.TableName = "tb1";
                         dtdac2.TableName = "tb2";
                         decimal dac1totalPrice = 0.00M, dac2totalPrice = 0.00M;
                         foreach (var item in dac1)
@@ -4083,7 +4085,7 @@ namespace OASystem.API.Controllers
 
                             string currency = _CurrDatas.Find(it => it.Id == item.Currency).Name;
                             decimal rate = rateDatas.Find(it => it.CurrencyCode == currency).Rate;
-                           
+
                             row["rate"] = rate;
                             //row["costRMB"] = rbmPrice;
 
@@ -4116,7 +4118,7 @@ namespace OASystem.API.Controllers
                             place.Add(item.Place);
                             //dac2totalPrice += rbmPrice;
                         }
-                       
+
                         dac1totalPrice = dac1.Sum(it => it.SubTotal);
                         dac2totalPrice = dac2.Sum(it => it.SubTotal);
 
@@ -4129,7 +4131,7 @@ namespace OASystem.API.Controllers
 
                         designer.SetDataSource("cell4Str", cell4Str);
                         designer.SetDataSource("cellStr", cellStr);
-                        designer.SetDataSource("cellSum", (_EnterExitCosts.Visa+ _EnterExitCosts.Safe).ToString("#0.00"));
+                        designer.SetDataSource("cellSum", (_EnterExitCosts.Visa + _EnterExitCosts.Safe).ToString("#0.00"));
                         designer.SetDataSource("cellSum4", (_EnterExitCosts.OutsideJJPay + _EnterExitCosts.OutsaideGWPay).ToString("#0.00"));
                         designer.SetDataSource("celllastStr", celllastStr);
 
@@ -4173,7 +4175,7 @@ namespace OASystem.API.Controllers
                         return Ok(JsonView(true, "成功", new { Url = url }));
                     }
                 }
-                else if(dto.ExportType == 2) //表格
+                else if (dto.ExportType == 2) //表格
                 {
                     //利用键值对存放数据
                     Dictionary<string, string> dic = new Dictionary<string, string>();
@@ -4304,8 +4306,8 @@ namespace OASystem.API.Controllers
                         {
                             for (int i = 0; i < dac2.Count; i++)
                             {
-                                dac2[i].SubTotal = dac2[i].SubTotal +dac3[i].SubTotal; //小计
-                                dac2[i].Cost =dac3[i].Cost +dac2[i].Cost; //标准
+                                dac2[i].SubTotal = dac2[i].SubTotal + dac3[i].SubTotal; //小计
+                                dac2[i].Cost = dac3[i].Cost + dac2[i].Cost; //标准
                             }
                         }
 
@@ -4320,7 +4322,7 @@ namespace OASystem.API.Controllers
                             builder.MoveToCell(0, foodandotherStartIndex, 1, 0);
                             builder.Write(dac.Place);//城市
                             builder.MoveToCell(0, foodandotherStartIndex, 2, 0);
-                            
+
                             string currency = _CurrDatas.Find(it => it.Id == dac.Currency).Name;
                             builder.Write(currency);//币种
                             builder.MoveToCell(0, foodandotherStartIndex, 3, 0);
@@ -4363,6 +4365,58 @@ namespace OASystem.API.Controllers
                         return Ok(JsonView(true, "成功", new { Url = url }));
                     }
                 }
+                else if (dto.ExportType == 3)
+                {
+                    if (dto.SubTypeId == 1) //团组成员名单
+                    {
+                        //获取模板
+                        string tempPath = (AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/Temp/dwon_团组人员列表模板.doc");
+                        //载入模板
+                        Document doc = new Document(tempPath);
+                        DocumentBuilder builder = new DocumentBuilder(doc);
+
+                        //获取word里所有表格
+                        NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
+
+                        //获取所填表格的序数
+                        Aspose.Words.Tables.Table tableOne = allTables[0] as Aspose.Words.Tables.Table;
+
+                        var rowStart = tableOne.Rows[0]; //获取第1行
+
+                        //循环赋值
+                        for (int i = 0; i < DeleClientList.Count; i++)
+                        {
+                            builder.MoveToCell(0, i + 1, 0, 0);
+                            builder.Write(DeleClientList[i].Name);
+
+                            builder.MoveToCell(0, i + 1, 1, 0);
+                            string sex = DeleClientList[i].Sex == 0 ? "男" : DeleClientList[i].Sex == 1 ? "女" : "";
+                            builder.Write(sex);
+
+                            builder.MoveToCell(0, i + 1, 2, 0);
+                            builder.Write(Convert.ToDateTime(DeleClientList[i].Birthday).ToString("yyyy年MM月dd日"));
+
+                            builder.MoveToCell(0, i + 1, 3, 0);
+                            builder.Write(DeleClientList[i].Company);
+
+                            builder.MoveToCell(0, i + 1, 4, 0);
+                            builder.Write(DeleClientList[i].Job);
+                        }
+
+
+                        //删除多余行
+                        while (tableOne.Rows.Count > DeleClientList.Count + 1)
+                        {
+                            tableOne.Rows.RemoveAt(DeleClientList.Count + 1);
+                        }
+
+                        string strFileName = $"{_DelegationInfo.TeamName}组团人员名单({DateTime.Now.ToString("yyyyMMddHHmmss")}).doc";
+
+                        doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
+                        string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
+                        return Ok(JsonView(true, "成功", new { Url = url }));
+                    }
+                }
 
                 return Ok(JsonView(false,"操作失败!"));
             }

+ 1 - 0
OASystem/OASystem.Domain/Dtos/Groups/EnterExitCostDto.cs

@@ -229,6 +229,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// 模板类型
         /// 1 明细表
         /// 2 表格
+        /// 3 团组成员名单
         /// </summary>
         public int ExportType { get; set; }