|
@@ -59,6 +59,7 @@ using Microsoft.EntityFrameworkCore;
|
|
|
using System.Security.Cryptography.Xml;
|
|
|
using MathNet.Numerics;
|
|
|
using System.Security.Policy;
|
|
|
+using System.Xml;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
|
{
|
|
@@ -3543,6 +3544,836 @@ namespace OASystem.API.Controllers
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 团组模块 - 出入境费用 - File downlaod
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> PostEnterExitCostDownload(EnterExitCostDownloadDto dto)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (dto.DiId < 1)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "请传入有效的DiId参数;"));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (dto.ExportType <1)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "请传入有效的ExportType参数; 1 明细表 2 表格"));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (dto.SubTypeId < 1)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, @"请传入有效的SubTypeId参数;
|
|
|
+ 1 明细表 --> 1005(默认明细表) 1006(因公出国(境)经费测算明细表) 1007(四川省商务厅出国经费财政先行审核表)
|
|
|
+ 2 表格 --> 1008(派员单位出(境)任务和预算审批意见表) 1009(省级单位出(境)经费报销单)"));
|
|
|
+ }
|
|
|
+
|
|
|
+ var _EnterExitCosts = _sqlSugar.Queryable<Grp_EnterExitCost>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).First();
|
|
|
+ var _DayAndCosts = _sqlSugar.Queryable<Grp_DayAndCost>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).ToList();
|
|
|
+ if (_EnterExitCosts == null)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "该团组未填写出入境费用;"));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //数据源
|
|
|
+ List<Grp_DayAndCost> dac1 = _DayAndCosts.Where(it => it.Type == 1).ToList(); //住宿费
|
|
|
+ List<Grp_DayAndCost> dac2 = _DayAndCosts.Where(it => it.Type == 2).ToList(); //伙食费
|
|
|
+ List<Grp_DayAndCost> dac3 = _DayAndCosts.Where(it => it.Type == 3).ToList(); //公杂费
|
|
|
+ List<Grp_DayAndCost> dac4 = _DayAndCosts.Where(it => it.Type == 4).ToList(); //培训费
|
|
|
+
|
|
|
+ var _CurrDatas = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.IsDel == 0 && it.STid == 66).ToList();
|
|
|
+ var _DelegationInfo = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.IsDel == 0 && it.Id == dto.DiId).First();
|
|
|
+ var DeleClientList = _sqlSugar.Queryable<Grp_TourClientList>()
|
|
|
+ .LeftJoin<Crm_DeleClient>((tcl, dc) => tcl.ClientId == dc.Id && dc.IsDel == 0)
|
|
|
+ .LeftJoin<Crm_CustomerCompany>((tcl, dc,cc) => dc.CrmCompanyId == cc.Id && dc.IsDel == 0)
|
|
|
+ .Where((tcl, dc, cc) => tcl.IsDel == 0 && tcl.DiId == dto.DiId)
|
|
|
+ .Select((tcl, dc, cc) => new
|
|
|
+ {
|
|
|
+ Name = dc.LastName + dc.FirstName,
|
|
|
+ Sex = dc.Sex,
|
|
|
+ Birthday = dc.BirthDay,
|
|
|
+ Company = cc.CompanyFullName,
|
|
|
+ Job = dc.Job
|
|
|
+ })
|
|
|
+ .ToList();
|
|
|
+ var blackCode = _sqlSugar.Queryable<Air_TicketBlackCode>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).First();
|
|
|
+ var threeCodes = _sqlSugar.Queryable<Res_ThreeCode>().Where(it => it.IsDel == 0).ToList();
|
|
|
+ var rateDatas = await _EnterExitCosts.CurrencyRemark.SplitExchangeRate();
|
|
|
+
|
|
|
+ if (dto.ExportType == 1) //明细表
|
|
|
+ {
|
|
|
+ if (dto.SubTypeId == 1005) //1005(默认明细表)
|
|
|
+ {
|
|
|
+ //获取模板
|
|
|
+ string tempPath = (AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/Temp/出入境费用表模板.docx");
|
|
|
+
|
|
|
+ //载入模板
|
|
|
+ Document doc = new Document(tempPath);
|
|
|
+
|
|
|
+ DocumentBuilder builder = new DocumentBuilder(doc);
|
|
|
+
|
|
|
+ //利用键值对存放数据
|
|
|
+ Dictionary<string, string> dic = new Dictionary<string, string>();
|
|
|
+
|
|
|
+ decimal stayFeeTotal = _DayAndCosts.Where(it => it.Type == 1).Sum(it => it.SubTotal); // 住宿费
|
|
|
+ decimal mealsFeeTotal = _DayAndCosts.Where(it => it.Type == 2).Sum(it => it.SubTotal); // 伙食费费
|
|
|
+ decimal miscellaneousFeeTotal = _DayAndCosts.Where(it => it.Type == 1).Sum(it => it.SubTotal); // 公杂费
|
|
|
+ decimal tainFeeTotal = _DayAndCosts.Where(it => it.Type == 4).Sum(it => it.SubTotal); // 培训费
|
|
|
+ dic.Add("InsidePay", _EnterExitCosts.InsidePay.ToString("#0.00"));
|
|
|
+ dic.Add("VisaPay", _EnterExitCosts.Visa.ToString("#0.00"));
|
|
|
+ dic.Add("VisaRemark", _EnterExitCosts.VisaRemark);
|
|
|
+ dic.Add("SafePay", _EnterExitCosts.Safe.ToString("#0.00"));
|
|
|
+ dic.Add("YiMiao", _EnterExitCosts.YiMiao.ToString("#0.00"));
|
|
|
+ dic.Add("HeSuan", _EnterExitCosts.HeSuan.ToString("#0.00"));
|
|
|
+ dic.Add("ServiceFee", _EnterExitCosts.Service.ToString("#0.00"));
|
|
|
+ dic.Add("Ticket", _EnterExitCosts.Ticket.ToString("#0.00"));
|
|
|
+ dic.Add("OutsideJJ", _EnterExitCosts.OutsideJJPay.ToString("#0.00"));
|
|
|
+ dic.Add("OutsaideGW", _EnterExitCosts.OutsaideGWPay.ToString("#0.00"));
|
|
|
+ dic.Add("AirJJ", _EnterExitCosts.AirJJ.ToString("#0.00"));
|
|
|
+ dic.Add("AirGW", _EnterExitCosts.AirGW.ToString("#0.00"));
|
|
|
+ dic.Add("CityTranffic", _EnterExitCosts.CityTranffic.ToString("#0.00"));
|
|
|
+ dic.Add("SubZS", stayFeeTotal.ToString("#0.00"));
|
|
|
+ dic.Add("SubHS", mealsFeeTotal.ToString("#0.00"));
|
|
|
+ dic.Add("SubGZF", miscellaneousFeeTotal.ToString("#0.00"));
|
|
|
+ dic.Add("SubPX", tainFeeTotal.ToString("#0.00"));
|
|
|
+
|
|
|
+ decimal subJJC = _EnterExitCosts.InsidePay + stayFeeTotal + mealsFeeTotal + miscellaneousFeeTotal + tainFeeTotal + _EnterExitCosts.OutsideJJPay;
|
|
|
+ decimal subGWC = _EnterExitCosts.InsidePay + stayFeeTotal + mealsFeeTotal + miscellaneousFeeTotal + tainFeeTotal + _EnterExitCosts.OutsaideGWPay;
|
|
|
+ dic.Add("SubJJC", subJJC.ToString("#0.00"));
|
|
|
+ dic.Add("SubGWC", subGWC.ToString("#0.00"));
|
|
|
+
|
|
|
+ #region 填充word模板书签内容
|
|
|
+ foreach (var key in dic.Keys)
|
|
|
+ {
|
|
|
+ builder.MoveToBookmark(key);
|
|
|
+ builder.Write(dic[key]);
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 填充word表格内容
|
|
|
+
|
|
|
+ ////获读取指定表格方法二
|
|
|
+ NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
|
|
|
+ Aspose.Words.Tables.Table table1 = allTables[0] as Aspose.Words.Tables.Table;
|
|
|
+ for (int i = 0; i < dac1.Count; i++)
|
|
|
+ {
|
|
|
+ builder.MoveToCell(0, i + 1, 0, 0);
|
|
|
+ builder.Write("第" + dac1[i].Days.ToString() + "晚:");
|
|
|
+
|
|
|
+ builder.MoveToCell(0, i + 1, 1, 0);
|
|
|
+ builder.Write(dac1[i].Place);
|
|
|
+
|
|
|
+ builder.MoveToCell(0, i + 1, 2, 0);
|
|
|
+ builder.Write("费用标准:");
|
|
|
+
|
|
|
+ string curr = "";
|
|
|
+ var currData = _CurrDatas.Where(it => it.Id == dac1[i].Currency).FirstOrDefault();
|
|
|
+ if (currData != null)
|
|
|
+ {
|
|
|
+ curr = currData.Name;
|
|
|
+ }
|
|
|
+ builder.MoveToCell(0, i + 1, 3, 0);
|
|
|
+ builder.Write(dac1[i].Cost.ToString("#0.00") + curr);
|
|
|
+
|
|
|
+ builder.MoveToCell(0, i + 1, 4, 0);
|
|
|
+ builder.Write("费用小计:");
|
|
|
+
|
|
|
+ builder.MoveToCell(0, i + 1, 5, 0);
|
|
|
+ builder.Write(dac1[i].SubTotal.ToString("#0.00") + "CNY");
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ //删除多余行
|
|
|
+ while (table1.Rows.Count > dac1.Count + 1)
|
|
|
+ {
|
|
|
+ table1.Rows.RemoveAt(dac1.Count + 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ Aspose.Words.Tables.Table table2 = allTables[1] as Aspose.Words.Tables.Table;
|
|
|
+ for (int i = 0; i < dac2.Count; i++)
|
|
|
+ {
|
|
|
+
|
|
|
+ builder.MoveToCell(1, i + 1, 0, 0);
|
|
|
+ builder.Write("第" + dac2[i].Days.ToString() + "天:");
|
|
|
+
|
|
|
+ builder.MoveToCell(1, i + 1, 1, 0);
|
|
|
+ builder.Write(dac2[i].Place);
|
|
|
+
|
|
|
+ builder.MoveToCell(1, i + 1, 2, 0);
|
|
|
+ builder.Write("费用标准:");
|
|
|
+
|
|
|
+ string curr = "";
|
|
|
+ var currData = _CurrDatas.Where(it => it.Id == dac1[i].Currency).FirstOrDefault();
|
|
|
+ if (currData != null)
|
|
|
+ {
|
|
|
+ curr = currData.Name;
|
|
|
+ }
|
|
|
+ builder.MoveToCell(1, i + 1, 3, 0);
|
|
|
+ builder.Write(dac2[i].Cost.ToString("#0.00") + curr);
|
|
|
+
|
|
|
+ builder.MoveToCell(1, i + 1, 4, 0);
|
|
|
+ builder.Write("费用小计:");
|
|
|
+
|
|
|
+ builder.MoveToCell(1, i + 1, 5, 0);
|
|
|
+ builder.Write(dac2[i].SubTotal.ToString() + "CNY");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //删除多余行
|
|
|
+ while (table2.Rows.Count > dac2.Count + 1)
|
|
|
+ {
|
|
|
+ table2.Rows.RemoveAt(dac2.Count + 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ Aspose.Words.Tables.Table table3 = allTables[2] as Aspose.Words.Tables.Table;
|
|
|
+ for (int i = 0; i < dac3.Count; i++)
|
|
|
+ {
|
|
|
+
|
|
|
+ builder.MoveToCell(2, i + 1, 0, 0);
|
|
|
+ builder.Write("第" + dac3[i].Days.ToString() + "天:");
|
|
|
+
|
|
|
+ builder.MoveToCell(2, i + 1, 1, 0);
|
|
|
+ builder.Write(dac3[i].Place);
|
|
|
+
|
|
|
+ builder.MoveToCell(2, i + 1, 2, 0);
|
|
|
+ builder.Write("费用标准:");
|
|
|
+
|
|
|
+ string curr = "";
|
|
|
+ var currData = _CurrDatas.Where(it => it.Id == dac1[i].Currency).FirstOrDefault();
|
|
|
+ if (currData != null)
|
|
|
+ {
|
|
|
+ curr = currData.Name;
|
|
|
+ }
|
|
|
+ builder.MoveToCell(2, i + 1, 3, 0);
|
|
|
+ builder.Write(dac3[i].Cost.ToString("#0.00") + curr);
|
|
|
+
|
|
|
+ builder.MoveToCell(2, i + 1, 4, 0);
|
|
|
+ builder.Write("费用小计:");
|
|
|
+
|
|
|
+ builder.MoveToCell(2, i + 1, 5, 0);
|
|
|
+ builder.Write(dac3[i].SubTotal.ToString("#0.00") + "CNY");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //删除多余行
|
|
|
+ while (table3.Rows.Count > dac3.Count + 1)
|
|
|
+ {
|
|
|
+ table3.Rows.RemoveAt(dac3.Count + 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //文件名
|
|
|
+ string strFileName = _DelegationInfo.TeamName + "出入境费用.docx";
|
|
|
+
|
|
|
+ //文件流下载
|
|
|
+ //byte[] bytes = null;
|
|
|
+ //using (MemoryStream stream = new MemoryStream())
|
|
|
+ //{
|
|
|
+ // doc.Save(stream, Aspose.Words.SaveFormat.Doc);
|
|
|
+ // bytes = stream.ToArray();
|
|
|
+ //}
|
|
|
+
|
|
|
+ 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 }));
|
|
|
+
|
|
|
+ }
|
|
|
+ else if (dto.SubTypeId == 1006)//1006(因公出国(境)经费测算明细表)
|
|
|
+ {
|
|
|
+ //获取模板
|
|
|
+ string tempPath = (AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/Temp/因公出国(境)经费测算明细表.docx");
|
|
|
+ //载入模板
|
|
|
+ Document doc = new Document(tempPath);
|
|
|
+
|
|
|
+ DocumentBuilder builder = new DocumentBuilder(doc);
|
|
|
+
|
|
|
+ Dictionary<string, string> dic = new Dictionary<string, string>();
|
|
|
+
|
|
|
+ if (blackCode != null && !string.IsNullOrWhiteSpace(blackCode.BlackCode))
|
|
|
+ {
|
|
|
+ List<string> list = new List<string>();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var spilitArr = Regex.Split(blackCode.BlackCode, "\r\n");
|
|
|
+ foreach (var item in spilitArr)
|
|
|
+ {
|
|
|
+ var spDotandEmpty = item.Split('.')[1].Split(' ').Where(x => !string.IsNullOrEmpty(x)).ToList();
|
|
|
+ var depCode = spDotandEmpty[2].Substring(0, 3);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+
|
|
|
+ list = list.Distinct().ToList();
|
|
|
+ dic.Add("ReturnCode", string.Join("-", list).TrimEnd('-'));
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ dic.Add("ReturnCode", "行程录入不正确!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dic.Add("ReturnCode", "未录入行程!");
|
|
|
+ }
|
|
|
+
|
|
|
+ dic.Add("ReturnCodeAir", dic["ReturnCode"]);
|
|
|
+ dic.Add("VisitStartDate", _DelegationInfo.VisitStartDate.ToString("yyyy年MM月dd日"));
|
|
|
+ dic.Add("VisitEndDate", _DelegationInfo.VisitEndDate.ToString("yyyy年MM月dd日"));
|
|
|
+
|
|
|
+ if (dic.ContainsKey("VisitStartDate") && dic.ContainsKey("VisitEndDate"))
|
|
|
+ {
|
|
|
+ TimeSpan sp = _DelegationInfo.VisitEndDate.Subtract(_DelegationInfo.VisitStartDate);
|
|
|
+ dic.Add("Day", sp.Days.ToString());
|
|
|
+ }
|
|
|
+ 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);
|
|
|
+
|
|
|
+
|
|
|
+ NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
|
|
|
+ Aspose.Words.Tables.Table table1 = allTables[0] as Aspose.Words.Tables.Table;
|
|
|
+
|
|
|
+ decimal dac1totalPrice = 0.00M;
|
|
|
+ int accommodationStartIndex = 6, foodandotherStartIndex = 22;
|
|
|
+ foreach (var dac in dac1)
|
|
|
+ {
|
|
|
+ if (dac.SubTotal == 0.00M)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ //builder.MoveToCell(0, accommodationStartIndex, 0, 0);
|
|
|
+ //builder.Write(DeleClientList[i].LastName + DeleClientList[i].Name);
|
|
|
+ builder.MoveToCell(0, accommodationStartIndex, 1, 0);
|
|
|
+ builder.Write(dac.Place);//城市
|
|
|
+ builder.MoveToCell(0, accommodationStartIndex, 2, 0);
|
|
|
+
|
|
|
+ string currency = _CurrDatas.Find(it => it.Id == dac.Currency).Name;
|
|
|
+ builder.Write(currency);//币种
|
|
|
+ builder.MoveToCell(0, accommodationStartIndex, 3, 0);
|
|
|
+ builder.Write(dac.Cost.ToString("#0.00"));//标准
|
|
|
+ builder.MoveToCell(0, accommodationStartIndex, 4, 0);
|
|
|
+ builder.Write("");//人数
|
|
|
+ builder.MoveToCell(0, accommodationStartIndex, 5, 0);
|
|
|
+ builder.Write("");//天数
|
|
|
+ builder.MoveToCell(0, accommodationStartIndex, 6, 0);
|
|
|
+ builder.Write(dac.SubTotal.ToString("#0.00"));//小计
|
|
|
+ builder.MoveToCell(0, accommodationStartIndex, 7, 0);
|
|
|
+
|
|
|
+ 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);
|
|
|
+
|
|
|
+ decimal rbmPrice = rate * dac.SubTotal;
|
|
|
+ builder.Write(rbmPrice.ToString());//折合人民币
|
|
|
+ accommodationStartIndex++;
|
|
|
+ dac1totalPrice += rbmPrice;
|
|
|
+ }
|
|
|
+
|
|
|
+ dic.Add("dac1totalPrice", dac1totalPrice.ToString());
|
|
|
+
|
|
|
+ for (int i = 21; i > (dac1.Count == 0 ? 1 : dac1.Count) + 6; i--)
|
|
|
+ {
|
|
|
+ table1.Rows.RemoveAt(i - 1);
|
|
|
+ foodandotherStartIndex--;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (dac2.Count == dac3.Count)//国家 币种 金额
|
|
|
+ {
|
|
|
+ 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; //标准
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ decimal dac2totalPrice = 0.00M;
|
|
|
+
|
|
|
+ foreach (var dac in dac2)
|
|
|
+ {
|
|
|
+ if (dac.SubTotal == 0)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ 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);
|
|
|
+ builder.Write(dac.Cost.ToString("#0.00"));//标准
|
|
|
+ builder.MoveToCell(0, foodandotherStartIndex, 4, 0);
|
|
|
+ builder.Write("");//人数
|
|
|
+ builder.MoveToCell(0, foodandotherStartIndex, 5, 0);
|
|
|
+ builder.Write("");//天数
|
|
|
+ builder.MoveToCell(0, foodandotherStartIndex, 6, 0);
|
|
|
+ builder.Write(dac.SubTotal.ToString("#0.00"));//小计
|
|
|
+ builder.MoveToCell(0, foodandotherStartIndex, 7, 0);
|
|
|
+
|
|
|
+ decimal rate = 0.00M;
|
|
|
+ rate = rateDatas.Find(it => it.CurrencyCode.Equals(currency)).Rate;
|
|
|
+
|
|
|
+ builder.Write(rate.ToString("#0.0000"));//汇率
|
|
|
+
|
|
|
+ builder.MoveToCell(0, foodandotherStartIndex, 8, 0);
|
|
|
+ decimal rbmPrice = rate * dac.SubTotal;
|
|
|
+ builder.Write(rbmPrice.ToString());//折合人民币
|
|
|
+ foodandotherStartIndex++;
|
|
|
+ dac2totalPrice += rbmPrice;
|
|
|
+ }
|
|
|
+
|
|
|
+ dic.Add("dac2totalPrice", dac2totalPrice.ToString());
|
|
|
+
|
|
|
+ for (int i = foodandotherStartIndex + (15 - dac2.Count); i > (dac2.Count == 0 ? 1 : 0) + foodandotherStartIndex; i--)
|
|
|
+ {
|
|
|
+ table1.Rows.RemoveAt(i - 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ dic.Add("CityTranffic", _EnterExitCosts.CityTranffic.ToString("#0.00"));
|
|
|
+ dic.Add("VisaPay", _EnterExitCosts.Visa.ToString("#0.00"));
|
|
|
+ dic.Add("SafePay", _EnterExitCosts.Safe.ToString("#0.00"));
|
|
|
+ dic.Add("YiMiao", _EnterExitCosts.YiMiao.ToString("#0.00"));
|
|
|
+
|
|
|
+ foreach (var key in dic.Keys)
|
|
|
+ {
|
|
|
+ builder.MoveToBookmark(key);
|
|
|
+ builder.Write(dic[key]);
|
|
|
+ }
|
|
|
+
|
|
|
+ //模板文件名
|
|
|
+ string strFileName = $"{_DelegationInfo.TeamName}因公出国(境)经费测算明细表.docx";
|
|
|
+ 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 }));
|
|
|
+
|
|
|
+ }
|
|
|
+ else if (dto.SubTypeId == 1007) //1007(四川省商务厅出国经费财政先行审核表)
|
|
|
+ {
|
|
|
+ //获取模板
|
|
|
+ string tempPath = (AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/Temp/四川省商务厅出国经费财政先行审核表.xls");
|
|
|
+ //载入模板
|
|
|
+ WorkbookDesigner designer = new WorkbookDesigner();
|
|
|
+ designer.Workbook = new Workbook(tempPath);
|
|
|
+
|
|
|
+ Dictionary<string, string> dic = new Dictionary<string, string>();
|
|
|
+
|
|
|
+ if (blackCode != null && !string.IsNullOrWhiteSpace(blackCode.BlackCode))
|
|
|
+ {
|
|
|
+ List<string> list = new List<string>();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var spilitArr = Regex.Split(blackCode.BlackCode, "\r\n");
|
|
|
+ foreach (var item in spilitArr)
|
|
|
+ {
|
|
|
+ var spDotandEmpty = item.Split('.')[1].Split(' ').Where(x => !string.IsNullOrEmpty(x)).ToList();
|
|
|
+ var depCode = spDotandEmpty[2].Substring(0, 3);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+
|
|
|
+ list = list.Distinct().ToList();
|
|
|
+ dic.Add("ReturnCode", string.Join("-", list).TrimEnd('-'));
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ dic.Add("ReturnCode", "行程录入不正确!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dic.Add("ReturnCode", "未录入行程!");
|
|
|
+ }
|
|
|
+
|
|
|
+ dic.Add("ReturnCodeAir", dic["ReturnCode"]);
|
|
|
+ dic.Add("ReturnCodeAir", dic["ReturnCode"]);
|
|
|
+ dic.Add("VisitStartDate", _DelegationInfo.VisitStartDate.ToString("yyyy年MM月dd日"));
|
|
|
+ dic.Add("VisitEndDate", _DelegationInfo.VisitEndDate.ToString("yyyy年MM月dd日"));
|
|
|
+
|
|
|
+ if (dic.ContainsKey("VisitStartDate") && dic.ContainsKey("VisitEndDate"))
|
|
|
+ {
|
|
|
+ TimeSpan sp = _DelegationInfo.VisitEndDate.Subtract(_DelegationInfo.VisitStartDate);
|
|
|
+ dic.Add("Day", sp.Days.ToString());
|
|
|
+ }
|
|
|
+ dic.Add("VisitCountry", _DelegationInfo.VisitCountry);
|
|
|
+ dic.Add("ClientUnit", _DelegationInfo.ClientUnit);
|
|
|
+
|
|
|
+ var Names = string.Join("、", DeleClientList.Select(it => it.Name).ToList()).TrimEnd('、');
|
|
|
+
|
|
|
+ designer.SetDataSource("ClientUnit", _DelegationInfo.ClientUnit);
|
|
|
+ designer.SetDataSource("VisitCountry", _DelegationInfo.VisitCountry);
|
|
|
+ designer.SetDataSource("Group", _DelegationInfo.TeamName);
|
|
|
+ designer.SetDataSource("ClientUnitTitle", _DelegationInfo.TeamName);
|
|
|
+ designer.SetDataSource("Name", Names);
|
|
|
+ designer.SetDataSource("VisitStartDate", dic["VisitStartDate"] + "-" + dic["VisitEndDate"]);
|
|
|
+ designer.SetDataSource("Day", dic["Day"] + "天");
|
|
|
+ designer.SetDataSource("ReturnCode", dic["ReturnCode"]);
|
|
|
+ designer.SetDataSource("ReturnCodeAir", dic["ReturnCodeAir"]);
|
|
|
+
|
|
|
+ int startIndex = 10;
|
|
|
+ const int startIndexcopy = 10;
|
|
|
+
|
|
|
+ if (dac2.Count == dac3.Count)//国家 币种 金额
|
|
|
+ {
|
|
|
+ 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; //标准
|
|
|
+ }
|
|
|
+ }
|
|
|
+ DataTable dtdac1 = new DataTable();
|
|
|
+ List<string> place = new List<string>();
|
|
|
+ dtdac1.Columns.AddRange(new DataColumn[] {
|
|
|
+ new DataColumn(){ ColumnName = "city"},
|
|
|
+ new DataColumn(){ ColumnName = "curr"},
|
|
|
+ new DataColumn(){ ColumnName = "criterion"},
|
|
|
+ new DataColumn(){ ColumnName = "number",DataType = typeof(int)},
|
|
|
+ new DataColumn(){ ColumnName = "day",DataType = typeof(int)},
|
|
|
+ new DataColumn(){ ColumnName = "cost", DataType = typeof(float)},
|
|
|
+ new DataColumn(){ ColumnName = "rate", DataType = typeof(decimal) },
|
|
|
+ new DataColumn(){ ColumnName = "costRMB"},
|
|
|
+ });
|
|
|
+ DataTable dtdac2 = new DataTable();
|
|
|
+ dtdac2.Columns.AddRange(new DataColumn[] {
|
|
|
+ new DataColumn(){ ColumnName = "city"},
|
|
|
+ new DataColumn(){ ColumnName = "curr"},
|
|
|
+ new DataColumn(){ ColumnName = "criterion"},
|
|
|
+ new DataColumn(){ ColumnName = "number",DataType = typeof(int)},
|
|
|
+ new DataColumn(){ ColumnName = "day",DataType = typeof(int)},
|
|
|
+ new DataColumn(){ ColumnName = "cost", DataType = typeof(float)},
|
|
|
+ new DataColumn(){ ColumnName = "rate", DataType = typeof(decimal) },
|
|
|
+ new DataColumn(){ ColumnName = "costRMB"},
|
|
|
+ });
|
|
|
+ dtdac1.TableName = "tb1";
|
|
|
+ dtdac2.TableName = "tb2";
|
|
|
+ decimal dac1totalPrice = 0.00M, dac2totalPrice = 0.00M;
|
|
|
+ foreach (var item in dac1)
|
|
|
+ {
|
|
|
+ if (place.Contains(item.Place))
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ DataRow row = dtdac1.NewRow();
|
|
|
+ row["city"] = item.Place;
|
|
|
+ row["curr"] = item.Currency;
|
|
|
+ row["criterion"] = item.Cost;
|
|
|
+ row["number"] = 1;
|
|
|
+ row["day"] = dac1.FindAll(x => x.Place == item.Place).Count;
|
|
|
+
|
|
|
+ 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;
|
|
|
+
|
|
|
+ dtdac1.Rows.Add(row);
|
|
|
+ place.Add(item.Place);
|
|
|
+ }
|
|
|
+
|
|
|
+ place = new List<string>();
|
|
|
+ foreach (var item in dac2)
|
|
|
+ {
|
|
|
+ if (place.Contains(item.Place))
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ DataRow row = dtdac2.NewRow();
|
|
|
+ row["city"] = item.Place;
|
|
|
+ row["curr"] = item.Currency;
|
|
|
+ row["criterion"] = item.Cost;
|
|
|
+ row["number"] = 1;
|
|
|
+ row["day"] = dac2.FindAll(x => x.Place == item.Place).Count;
|
|
|
+ //row["cost"] = item.SubTotal;
|
|
|
+
|
|
|
+ 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;
|
|
|
+
|
|
|
+ dtdac2.Rows.Add(row);
|
|
|
+ place.Add(item.Place);
|
|
|
+ //dac2totalPrice += rbmPrice;
|
|
|
+ }
|
|
|
+
|
|
|
+ dac1totalPrice = dac1.Sum(it => it.SubTotal);
|
|
|
+ dac2totalPrice = dac2.Sum(it => it.SubTotal);
|
|
|
+
|
|
|
+ designer.SetDataSource("dac1totalPrice", dac1totalPrice.ToString("#0.00"));
|
|
|
+ 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")} 元。其中:市本级安排 。";
|
|
|
+
|
|
|
+ designer.SetDataSource("cell4Str", cell4Str);
|
|
|
+ designer.SetDataSource("cellStr", cellStr);
|
|
|
+ designer.SetDataSource("cellSum", (_EnterExitCosts.Visa+ _EnterExitCosts.Safe).ToString("#0.00"));
|
|
|
+ designer.SetDataSource("cellSum4", (_EnterExitCosts.OutsideJJPay + _EnterExitCosts.OutsaideGWPay).ToString("#0.00"));
|
|
|
+ designer.SetDataSource("celllastStr", celllastStr);
|
|
|
+
|
|
|
+ Workbook wb = designer.Workbook;
|
|
|
+ var sheet = wb.Worksheets[0];
|
|
|
+
|
|
|
+ //绑定datatable数据集
|
|
|
+ designer.SetDataSource(dtdac1);
|
|
|
+ designer.SetDataSource(dtdac2);
|
|
|
+ designer.Process();
|
|
|
+
|
|
|
+ var rowStart = dtdac1.Rows.Count;
|
|
|
+ while (rowStart > 0)
|
|
|
+ {
|
|
|
+ sheet.Cells[startIndex, 8].Formula = $"=G{startIndex + 1} * H{startIndex + 1}";
|
|
|
+ sheet.Cells[startIndex, 6].Formula = $"=E{startIndex + 1} * F{startIndex + 1} * D{startIndex + 1}";
|
|
|
+ startIndex++;
|
|
|
+ rowStart--;
|
|
|
+ }
|
|
|
+
|
|
|
+ sheet.Cells[startIndex, 8].Formula = $"=SUM(I{startIndexcopy + 1}: I{startIndex})";
|
|
|
+ startIndex += 1; //总计行
|
|
|
+
|
|
|
+ rowStart = dtdac2.Rows.Count;
|
|
|
+ while (rowStart > 0)
|
|
|
+ {
|
|
|
+ sheet.Cells[startIndex, 8].Formula = $"= G{startIndex + 1} * H{startIndex + 1}";
|
|
|
+ sheet.Cells[startIndex, 6].Formula = $"= E{startIndex + 1} * F{startIndex + 1} * D{startIndex + 1}";
|
|
|
+ startIndex++;
|
|
|
+ rowStart--;
|
|
|
+ }
|
|
|
+
|
|
|
+ sheet.Cells[startIndex, 8].Formula = $"=SUM(I{startIndexcopy + dtdac1.Rows.Count + 2}: I{startIndex})";
|
|
|
+
|
|
|
+ wb.CalculateFormula(true);
|
|
|
+
|
|
|
+ //模板文件名
|
|
|
+ string strFileName = $"四川省商务厅出国经费财政先行审核表.xls";
|
|
|
+ designer.Workbook.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
|
|
|
+ string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
|
|
|
+ return Ok(JsonView(true, "成功", new { Url = url }));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(dto.ExportType == 2) //表格
|
|
|
+ {
|
|
|
+ //利用键值对存放数据
|
|
|
+ Dictionary<string, string> dic = new Dictionary<string, string>();
|
|
|
+
|
|
|
+ dic.Add("VisitStartDate", _DelegationInfo.VisitStartDate.ToString("yyyy年MM月dd日"));
|
|
|
+ dic.Add("VisitEndDate", _DelegationInfo.VisitEndDate.ToString("yyyy年MM月dd日"));
|
|
|
+
|
|
|
+ TimeSpan sp = _DelegationInfo.VisitEndDate.Subtract(_DelegationInfo.VisitStartDate);
|
|
|
+ dic.Add("Day", sp.Days.ToString());
|
|
|
+
|
|
|
+ dic.Add("VisitCountry", _DelegationInfo.VisitCountry);
|
|
|
+
|
|
|
+ if (dto.SubTypeId == 1008) //1008(派员单位出(境)任务和预算审批意见表)
|
|
|
+ {
|
|
|
+ //获取模板
|
|
|
+ string tempPath = (AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/Temp/派员单位出(境)任务和预算审批意见表.xls");
|
|
|
+ //载入模板
|
|
|
+ Document doc = new Document(tempPath);
|
|
|
+ DocumentBuilder builder = new DocumentBuilder(doc);
|
|
|
+
|
|
|
+ dic.Add("TeamName", _DelegationInfo.TeamName);
|
|
|
+ dic.Add("ClientUnit", _DelegationInfo.ClientUnit);
|
|
|
+ dic.Add("TellPhone", _DelegationInfo.TellPhone);
|
|
|
+ dic.Add("VisitPNumber", _DelegationInfo.VisitPNumber.ToString());
|
|
|
+ dic.Add("VisitPurpose", _DelegationInfo.VisitPurpose);
|
|
|
+
|
|
|
+ NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
|
|
|
+ Aspose.Words.Tables.Table table1 = allTables[0] as Aspose.Words.Tables.Table;
|
|
|
+ int rowCount = 10;//总人数行
|
|
|
+ int startRowIndex = 7; //起始行
|
|
|
+ for (int i = 0; i < DeleClientList.Count; i++)
|
|
|
+ {
|
|
|
+ builder.MoveToCell(0, startRowIndex, 0, 0);
|
|
|
+ builder.Write(DeleClientList[i].Name); //出国人员姓名
|
|
|
+ builder.MoveToCell(0, startRowIndex, 1, 0);
|
|
|
+ string sex = DeleClientList[i].Sex == 0 ? "男" : DeleClientList[i].Sex == 1 ? "女" : "";
|
|
|
+
|
|
|
+ builder.Write(sex);//性别
|
|
|
+ builder.MoveToCell(0, startRowIndex, 2, 0);
|
|
|
+ builder.Write(Convert.ToDateTime(DeleClientList[i].Birthday).ToString("yyyy年MM月dd日"));//出生年月
|
|
|
+ builder.MoveToCell(0, startRowIndex, 3, 0);
|
|
|
+ builder.Write(DeleClientList[i].Company);//工作单位
|
|
|
+ builder.MoveToCell(0, startRowIndex, 4, 0);
|
|
|
+ builder.Write(DeleClientList[i].Job);//职务及级别
|
|
|
+ builder.MoveToCell(0, startRowIndex, 5, 0);
|
|
|
+ builder.Write("");//人员属性
|
|
|
+ builder.MoveToCell(0, startRowIndex, 6, 0);
|
|
|
+ builder.Write("");//上次出国时间
|
|
|
+ startRowIndex++;
|
|
|
+ }
|
|
|
+ int nullRow = rowCount - DeleClientList.Count;//空行
|
|
|
+ for (int i = 0; i < nullRow; i++)
|
|
|
+ {
|
|
|
+ table1.Rows.Remove(table1.Rows[startRowIndex]);
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach (var key in dic.Keys)
|
|
|
+ {
|
|
|
+ builder.MoveToBookmark(key);
|
|
|
+ builder.Write(dic[key]);
|
|
|
+ }
|
|
|
+ //模板文件名
|
|
|
+ string strFileName = $"派员单位出(境)任务和预算审批意见表.docx";
|
|
|
+ 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 }));
|
|
|
+
|
|
|
+ }
|
|
|
+ else if (dto.SubTypeId == 1009)//1009(省级单位出(境)经费报销单)
|
|
|
+ {
|
|
|
+ //获取模板
|
|
|
+ string tempPath = (AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/Temp/省级单位出(境)经费报销单.xls");
|
|
|
+ //载入模板
|
|
|
+ Document doc = new Document(tempPath);
|
|
|
+ DocumentBuilder builder = new DocumentBuilder(doc);
|
|
|
+
|
|
|
+ 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();
|
|
|
+
|
|
|
+ NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
|
|
|
+ Aspose.Words.Tables.Table table1 = allTables[0] as Aspose.Words.Tables.Table;
|
|
|
+
|
|
|
+ decimal dac1totalPrice = 0.00M;
|
|
|
+ foreach (var dac in dac1)
|
|
|
+ {
|
|
|
+ if (dac.SubTotal == 0)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ //builder.MoveToCell(0, accommodationStartIndex, 0, 0);
|
|
|
+ //builder.Write(DeleClientList[i].LastName + DeleClientList[i].Name);
|
|
|
+ builder.MoveToCell(0, accommodationStartIndex, 1, 0);
|
|
|
+ builder.Write(dac.Place);//城市
|
|
|
+ builder.MoveToCell(0, accommodationStartIndex, 2, 0);
|
|
|
+
|
|
|
+ string currency = _CurrDatas.Find(it => it.Id == dac.Currency).Name;
|
|
|
+ builder.Write(currency);//币种
|
|
|
+ builder.MoveToCell(0, accommodationStartIndex, 3, 0);
|
|
|
+ builder.Write(dac.Cost.ToString("#0.00"));//标准
|
|
|
+ builder.MoveToCell(0, accommodationStartIndex, 4, 0);
|
|
|
+ builder.Write("");//人数
|
|
|
+ builder.MoveToCell(0, accommodationStartIndex, 5, 0);
|
|
|
+ builder.Write("");//天数
|
|
|
+ builder.MoveToCell(0, accommodationStartIndex, 6, 0);
|
|
|
+ builder.Write(dac.SubTotal.ToString("#0.00"));//小计
|
|
|
+ builder.MoveToCell(0, accommodationStartIndex, 7, 0);
|
|
|
+
|
|
|
+ decimal rate = rateDatas.Find(it => it.CurrencyCode == currency).Rate;
|
|
|
+ builder.Write(rate.ToString("#0.0000"));//汇率
|
|
|
+ builder.MoveToCell(0, accommodationStartIndex, 8, 0);
|
|
|
+
|
|
|
+ decimal rbmPrice = rate * dac.SubTotal;
|
|
|
+ builder.Write(rbmPrice.ToString("#0.00"));//折合人民币
|
|
|
+ accommodationStartIndex++;
|
|
|
+ dac1totalPrice += rbmPrice;
|
|
|
+ }
|
|
|
+
|
|
|
+ dic.Add("dac1totalPrice", dac1totalPrice.ToString());
|
|
|
+
|
|
|
+ if (dac2.Count == dac3.Count)//国家 币种 金额
|
|
|
+ {
|
|
|
+ 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; //标准
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ decimal dac2totalPrice = 0.00M;
|
|
|
+ foreach (var dac in dac2)
|
|
|
+ {
|
|
|
+ if (dac.SubTotal == 0)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ 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);
|
|
|
+ builder.Write(dac.Cost.ToString("#0.00"));//标准
|
|
|
+ builder.MoveToCell(0, foodandotherStartIndex, 4, 0);
|
|
|
+ builder.Write("");//人数
|
|
|
+ builder.MoveToCell(0, foodandotherStartIndex, 5, 0);
|
|
|
+ builder.Write("");//天数
|
|
|
+ builder.MoveToCell(0, foodandotherStartIndex, 6, 0);
|
|
|
+ builder.Write(dac.SubTotal.ToString("#0.00"));//小计
|
|
|
+ builder.MoveToCell(0, foodandotherStartIndex, 7, 0);
|
|
|
+
|
|
|
+ decimal rate = rateDatas.Find(it => it.CurrencyCode == currency).Rate;
|
|
|
+ builder.Write(rate.ToString());//汇率
|
|
|
+ builder.MoveToCell(0, foodandotherStartIndex, 8, 0);
|
|
|
+
|
|
|
+ decimal rbmPrice = rate * dac.SubTotal;
|
|
|
+ builder.Write(rbmPrice.ToString("#0.00"));//折合人民币
|
|
|
+ foodandotherStartIndex++;
|
|
|
+ dac2totalPrice += rbmPrice;
|
|
|
+ }
|
|
|
+
|
|
|
+ dic.Add("dac2totalPrice", dac2totalPrice.ToString());
|
|
|
+
|
|
|
+ //删除空行
|
|
|
+ if (dac1.Count < accommodationRows)
|
|
|
+ {
|
|
|
+ int nullRow = accommodationRows - dac1.Count;
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach (var key in dic.Keys)
|
|
|
+ {
|
|
|
+ builder.MoveToBookmark(key);
|
|
|
+ builder.Write(dic[key]);
|
|
|
+ }
|
|
|
+ //模板文件名
|
|
|
+ string strFileName = $"省级单位出(境)经费报销单.docx";
|
|
|
+ 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,"操作失败!"));
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, ex.Message));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 团组模块 - 出入境费用 - 明细表导出
|
|
|
/// </summary>
|
|
@@ -3568,6 +4399,7 @@ namespace OASystem.API.Controllers
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 团组模块 - 出入境费用 - 子项删除
|
|
|
/// </summary>
|