Browse Source

出入境费用 模板二次调整

leiy 1 year ago
parent
commit
04758004b3

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

@@ -3719,6 +3719,8 @@ namespace OASystem.API.Controllers
                 var rateDatas = await _EnterExitCosts.CurrencyRemark.SplitExchangeRate();
 
 
+                _DelegationInfo.VisitCountry = _DelegationInfo.VisitCountry.Replace("|", "、");
+
                 if (dto.ExportType == 1) //明细表
                 {
                     if (dto.SubTypeId == 1005) //1005(默认明细表)
@@ -4011,8 +4013,8 @@ namespace OASystem.API.Controllers
                         dic.Add("VisitCountry", _DelegationInfo.VisitCountry);
                         dic.Add("ClientUnit", _DelegationInfo.ClientUnit);
 
-                        var Names = string.Join("、", DeleClientList.Select(it => it.Name).ToList()).TrimEnd('、');
-                        dic.Add("Names", Names);
+                        //var Names = string.Join("、", DeleClientList.Select(it => it.Name).ToList()).TrimEnd('、');
+                        //dic.Add("Names", Names);
 
 
                         NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
@@ -4313,8 +4315,19 @@ namespace OASystem.API.Controllers
                         designer.SetDataSource("dac2totalPrice", dac2totalPrice);
                         string cell4Str = $"  4.国际旅费:经济舱:{_EnterExitCosts.OutsideJJPay.ToString("#0.00")}元,公务舱:{_EnterExitCosts.OutsaideGWPay.ToString("#0.00")}元";
                         string cellStr = $"  5.其他费用(签证费:{_EnterExitCosts.Visa.ToString("#0.00")}元,保险费 :{_EnterExitCosts.Safe.ToString("#0.00")}元)";
-                        decimal s = dac1totalPrice + dac2totalPrice + _EnterExitCosts.OutsideJJPay + _EnterExitCosts.OutsaideGWPay + _EnterExitCosts.Visa + _EnterExitCosts.Safe;
-                        string celllastStr = $"    经审核,住宿费 {dac1totalPrice.ToString("#0.00")} 元,伙食费和公杂费 {dac2totalPrice.ToString(".00")} 元,培训费   元,国际旅费 {(_EnterExitCosts.OutsideJJPay + _EnterExitCosts.OutsaideGWPay).ToString("#0.00")} 元,其他费用 {(_EnterExitCosts.Visa + _EnterExitCosts.Safe).ToString("#0.00")} 元,本次出国经费预算合计为 {s.ToString("#0.00")} 元。其中:市本级安排      。";
+                        decimal s = dac1totalPrice + dac2totalPrice + _EnterExitCosts.OutsideJJPay + _EnterExitCosts.OutsaideGWPay + _EnterExitCosts.Visa + _EnterExitCosts.Safe + _EnterExitCosts.Ticket;
+
+                        decimal pxFee = dac4.Sum(it => it.Cost);
+                        decimal glvFee = _EnterExitCosts.OutsideJJPay + _EnterExitCosts.OutsaideGWPay;
+                        decimal otherFee = _EnterExitCosts.Visa + _EnterExitCosts.Safe + _EnterExitCosts.Ticket;
+                        string celllastStr1 = "";
+                        if (dac1totalPrice > 0) celllastStr1 += $"住宿费 {dac1totalPrice.ToString("#0.00")} 元";
+                        if (dac2totalPrice > 0) celllastStr1 += $",伙食费和公杂费 {dac2totalPrice.ToString("#0.00")} 元";
+                        if (pxFee > 0) celllastStr1 += $",培训费 {pxFee.ToString("#0.00")} 元";
+                        if (glvFee > 0) celllastStr1 += $",国际旅费 {glvFee.ToString("#0.00")} 元";
+                        if (otherFee > 0) celllastStr1 += $",其他费用 {otherFee.ToString("#0.00")} 元";
+
+                        string celllastStr = $"    经审核,{celllastStr1},本次出国经费预算合计为 {s.ToString("#0.00")} 元。其中:市本级安排      。";
 
                         designer.SetDataSource("cell4Str", cell4Str);
                         designer.SetDataSource("cellStr", cellStr);
@@ -4385,7 +4398,13 @@ namespace OASystem.API.Controllers
 
                         dic.Add("TeamName", _DelegationInfo.TeamName);
                         dic.Add("ClientUnit", _DelegationInfo.ClientUnit);
-                        dic.Add("TellPhone", _DelegationInfo.TellPhone);
+                        //dic.Add("TellPhone", _DelegationInfo.TellPhone);
+
+                        string missionLeaderName = DeleClientList[0].Name,
+                               missionLeaderJob = DeleClientList[0].Job;
+                        dic.Add("MissionLeaderName", missionLeaderName);
+                        dic.Add("MissionLeaderJob", missionLeaderJob);
+
                         dic.Add("VisitPNumber", _DelegationInfo.VisitPNumber.ToString());
                         dic.Add("VisitPurpose", _DelegationInfo.VisitPurpose);
 
@@ -4439,11 +4458,11 @@ namespace OASystem.API.Controllers
                         Document doc = new Document(tempPath);
                         DocumentBuilder builder = new DocumentBuilder(doc);
 
+                        dic.Add("GroupClient", _DelegationInfo.ClientUnit);
+
                         var Names = string.Join("、", DeleClientList.Select(x => x.Name)).TrimEnd('、');
                         dic.Add("Names", Names);
 
-                        int accommodationStartIndex = 6;
-                        int foodandotherStartIndex = 19;//
                         int accommodationRows = 12, foodandotherRows = 12;
                         var Dac1currCn = dac1.GroupBy(x => x.Currency).Select(x => x.Key).ToList();
                         var Dac2currCn = dac2.GroupBy(x => x.Currency).Select(x => x.Key).ToList();
@@ -4451,6 +4470,8 @@ namespace OASystem.API.Controllers
                         NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
                         Aspose.Words.Tables.Table table1 = allTables[0] as Aspose.Words.Tables.Table;
 
+
+                        int accommodationStartIndex = 6;
                         decimal dac1totalPrice = 0.00M;
                         foreach (var dac in dac1)
                         {
@@ -4487,8 +4508,33 @@ namespace OASystem.API.Controllers
                             dac1totalPrice += rbmPrice;
                         }
 
+                        
+
+
                         dic.Add("dac1totalPrice", dac1totalPrice.ToString("#0.00"));
 
+
+                        builder.MoveToCell(0, accommodationStartIndex, 1, 0);
+                        builder.Write("小计");
+                        builder.MoveToCell(0, accommodationStartIndex, 8, 0);
+                        builder.Write(dac1totalPrice.ToString("#0.00"));
+
+                        accommodationStartIndex++;
+
+
+                        int nullRow = accommodationRows - dac1.Count;
+                        //删除空行
+                        //if (nullRow > 0)
+                        //{
+                        //    int rowIndex = accommodationStartIndex;
+                        //    for (int i = 0; i < nullRow; i++)
+                        //    {
+                        //        Row row = table1.Rows[rowIndex];
+                        //        row.Remove();        
+                        //        rowIndex++;
+                        //    }
+                        //}
+
                         if (dac2.Count == dac3.Count)//国家 币种 金额
                         {
                             for (int i = 0; i < dac2.Count; i++)
@@ -4498,6 +4544,7 @@ namespace OASystem.API.Controllers
                             }
                         }
 
+                        int foodandotherStartIndex = 19;//
                         decimal dac2totalPrice = 0.00M;
                         foreach (var dac in dac2)
                         {
@@ -4505,7 +4552,7 @@ namespace OASystem.API.Controllers
                             {
                                 continue;
                             }
-
+                            //foodandotherStartIndex = 12;
                             builder.MoveToCell(0, foodandotherStartIndex, 1, 0);
                             builder.Write(GetEnterExitCostExportCity(placeData, dac.NationalTravelFeeId));//城市
                             builder.MoveToCell(0, foodandotherStartIndex, 2, 0);
@@ -4523,7 +4570,7 @@ namespace OASystem.API.Controllers
                             builder.MoveToCell(0, foodandotherStartIndex, 7, 0);
 
                             decimal rate = rateDatas.Find(it => it.CurrencyName == currency)?.Rate ?? 0.00M;
-                            builder.Write(rate.ToString());//汇率
+                            builder.Write(rate.ToString("#0.0000"));//汇率
                             builder.MoveToCell(0, foodandotherStartIndex, 8, 0);
 
                             decimal rbmPrice = rate * dac.SubTotal;
@@ -4533,7 +4580,15 @@ namespace OASystem.API.Controllers
                         }
 
                         dic.Add("dac2totalPrice", dac2totalPrice.ToString("#0.00"));
-
+                        //删除空行
+                        if (dac2.Count < foodandotherRows)
+                        {
+                            //int nullRow = accommodationRows - dac2.Count;
+                            //while (table2.Rows.Count > dac2.Count)
+                            //{
+                            //    table2.Rows.RemoveAt(dac2.Count);
+                            //}
+                        }
 
                         dic.Add("CityTranffic", _EnterExitCosts.CityTranffic.ToString("#0.00"));
 
@@ -4550,14 +4605,6 @@ namespace OASystem.API.Controllers
                             dic.Add("OtherFeeStr", otherFeeStr);
                         }
 
-
-
-                        //删除空行
-                        if (dac1.Count < accommodationRows)
-                        {
-                            int nullRow = accommodationRows - dac1.Count;
-                        }
-
                         foreach (var key in dic.Keys)
                         {
                             builder.MoveToBookmark(key);

+ 11 - 11
OASystem/OASystem.Infrastructure/Repositories/Groups/EnterExitCostRepository.cs

@@ -112,7 +112,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 //            new DayAndCostInfoView {Days=7},
                 //            new DayAndCostInfoView {Days=8},
                 //    };
-
                 //    enterExitCostInfoView.QuarterageData = views;
                 //    enterExitCostInfoView.BoardWagesData = views;
                 //    enterExitCostInfoView.MiscellaneousFeeData = views;
@@ -165,24 +164,25 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 try
                 {
                     var enterExit = _sqlSugar.Storageable<Grp_EnterExitCost>(enterExitCost).ToStorage();
-                    enterExit.AsInsertable.ExecuteCommand();   //不存在插入
-                    enterExit.AsUpdateable.IgnoreColumns(it => new { it.DiId, it.CreateUserId, it.CreateTime, it.IsDel }).ExecuteCommand();   //存在更新
+                    
+                    var enterExitadd = enterExit.AsInsertable.ExecuteCommand();   //不存在插入
+                    var enterExitedit = enterExit.AsUpdateable.IgnoreColumns(it => new { it.DiId, it.CreateUserId, it.CreateTime, it.IsDel }).ExecuteCommand();   //存在更新
 
                     var quarterage = _sqlSugar.Storageable<Grp_DayAndCost>(quarterageData).ToStorage();  //住宿费 1
-                    quarterage.AsInsertable.ExecuteCommand();   //不存在插入                             
-                    quarterage.AsUpdateable.IgnoreColumns(it => new { it.DiId, it.Type, it.CreateUserId, it.CreateTime, it.IsDel }).ExecuteCommand();   //存在更新
+                    var quarterageadd  =quarterage.AsInsertable.ExecuteCommand();   //不存在插入                             
+                    var quarterageedit = quarterage.AsUpdateable.IgnoreColumns(it => new { it.DiId, it.Type, it.CreateUserId, it.CreateTime, it.IsDel }).ExecuteCommand();   //存在更新
 
                     var boardWages = _sqlSugar.Storageable<Grp_DayAndCost>(boardWagesData).ToStorage();  //伙食费 2
-                    boardWages.AsInsertable.ExecuteCommand();   //不存在插入
-                    boardWages.AsUpdateable.IgnoreColumns(it => new { it.DiId, it.Type, it.CreateUserId, it.CreateTime, it.IsDel }).ExecuteCommand();   //存在更新
+                    var boardWagesadd  =boardWages.AsInsertable.ExecuteCommand();   //不存在插入
+                    var boardWagesedit = boardWages.AsUpdateable.IgnoreColumns(it => new { it.DiId, it.Type, it.CreateUserId, it.CreateTime, it.IsDel }).ExecuteCommand();   //存在更新
 
                     var miscellaneousFee = _sqlSugar.Storageable<Grp_DayAndCost>(miscellaneousFeeData).ToStorage(); //公杂费 3
-                    miscellaneousFee.AsInsertable.ExecuteCommand();   //不存在插入
-                    miscellaneousFee.AsUpdateable.IgnoreColumns(it => new { it.DiId, it.Type, it.CreateUserId, it.CreateTime, it.IsDel }).ExecuteCommand();   //存在更新
+                    var miscellaneousFeeedd  =miscellaneousFee.AsInsertable.ExecuteCommand();   //不存在插入
+                    var miscellaneousFeeedit = miscellaneousFee.AsUpdateable.IgnoreColumns(it => new { it.DiId, it.Type, it.CreateUserId, it.CreateTime, it.IsDel }).ExecuteCommand();   //存在更新
 
                     var trainingExpense = _sqlSugar.Storageable<Grp_DayAndCost>(trainingExpenseData).ToStorage();    //培训费 4
-                    trainingExpense.AsInsertable.ExecuteCommand();   //不存在插入
-                    trainingExpense.AsUpdateable.IgnoreColumns(it => new { it.DiId, it.Type, it.CreateUserId, it.CreateTime, it.IsDel }).ExecuteCommand();   //存在更新
+                    var trainingExpenseadd  =trainingExpense.AsInsertable.ExecuteCommand();   //不存在插入
+                    var trainingExpenseedit = trainingExpense.AsUpdateable.IgnoreColumns(it => new { it.DiId, it.Type, it.CreateUserId, it.CreateTime, it.IsDel }).ExecuteCommand();   //存在更新
 
                     _sqlSugar.CommitTran();
                     result.Code = 0;