|
|
@@ -1215,16 +1215,12 @@ namespace OASystem.API.Controllers
|
|
|
}
|
|
|
|
|
|
//计算费用总和
|
|
|
- decimal AllPrice = airPrice + cityTranffic + dac1.Sum(x => x.SubTotal) + dac2.Sum(x => x.SubTotal) +
|
|
|
- dac3.Sum(x => x.SubTotal) + dac4.Sum(x => x.SubTotal) + _EnterExitCosts.Visa + _EnterExitCosts.Safe +
|
|
|
+ decimal AllPrice = airPrice + cityTranffic + _EnterExitCosts.Visa + _EnterExitCosts.Safe +
|
|
|
+_EnterExitCosts.YiMiao + _EnterExitCosts.YiMiao + _EnterExitCosts.Ticket + _EnterExitCosts.Service;
|
|
|
- WordAllPrice += AllPrice;
|
|
|
-
|
|
|
- UsersTop += firstName + "出访费用为¥" + AllPrice.ToString("#0.00") + "元、";
|
|
|
-
|
|
|
+
|
|
|
TeableBookmarkArr.Add("jp", airPrice.ToString("#0.00") + " 元"); //机票金额
|
|
|
TeableBookmarkArr.Add("cs", $"{cityTranffic:#0.00} 元"); //城市交通费用
|
|
|
- TeableBookmarkArr.Add("zs", dac1.Sum(x => Convert.ToDecimal(x.SubTotal)).ToString("#0.00") + " 元"); //住宿费
|
|
|
+
|
|
|
string zsinfo = string.Empty;
|
|
|
string hsinfo = string.Empty;
|
|
|
string gzinfo = string.Empty;
|
|
|
@@ -1235,166 +1231,148 @@ namespace OASystem.API.Controllers
|
|
|
Aspose.Words.Tables.Table ChildTable1 = (Aspose.Words.Tables.Table)FirstTable.GetChild(NodeType.Table, 1, true);
|
|
|
Aspose.Words.Tables.Table ChildTable2 = (Aspose.Words.Tables.Table)FirstTable.GetChild(NodeType.Table, 2, true);
|
|
|
|
|
|
+ var totalAccom = 0.00M; // 住宿费合计
|
|
|
int rowIndex = 0;
|
|
|
if (dac1.Count <= 0 && ChildTable != null) ChildTable.Remove(); //删除表格
|
|
|
foreach (var item in dac1)
|
|
|
{
|
|
|
- if (string.IsNullOrWhiteSpace(item.Place))
|
|
|
- {
|
|
|
- continue;
|
|
|
- }
|
|
|
+ if (string.IsNullOrWhiteSpace(item.Place) || placeArr.Contains(item.Place)) continue;
|
|
|
|
|
|
- if (placeArr.Contains(item.Place))
|
|
|
- {
|
|
|
- continue;
|
|
|
- }
|
|
|
- else
|
|
|
+ placeArr.Add(item.Place);
|
|
|
+
|
|
|
+ if (rowIndex > ChildTable.Rows.Count - 1)
|
|
|
{
|
|
|
- placeArr.Add(item.Place);
|
|
|
+ var chitableRow = ChildTable.LastRow.Clone(true);
|
|
|
+ ChildTable.AppendChild(chitableRow);
|
|
|
}
|
|
|
- if (!string.IsNullOrWhiteSpace(item.Place))
|
|
|
+
|
|
|
+ decimal currencyRate = item.SubTotal / item.Cost;
|
|
|
+ string currencyCode = $"Unknown";
|
|
|
+ var sys_currencyInfo = _currencyDatas.Find(x => item.Currency == x.Id);
|
|
|
+ if (sys_currencyInfo != null)
|
|
|
{
|
|
|
- if (rowIndex > ChildTable.Rows.Count - 1)
|
|
|
+ var sys_currencyCode = sys_currencyInfo.Name;
|
|
|
+ var eec_currencyInfo = _EnterExitCostCurrencys.Find(x => x.Code.Equals(sys_currencyCode));
|
|
|
+ if (eec_currencyInfo != null)
|
|
|
{
|
|
|
- var chitableRow = ChildTable.LastRow.Clone(true);
|
|
|
- ChildTable.AppendChild(chitableRow);
|
|
|
+ currencyRate = eec_currencyInfo.Rate;
|
|
|
+ currencyCode = eec_currencyInfo.Name;
|
|
|
}
|
|
|
- int days = dac1.FindAll(x => x.Place == item.Place).Count;
|
|
|
- SetCells(ChildTable, doc, rowIndex, 0, item.Place);
|
|
|
- SetCells(ChildTable, doc, rowIndex, 1, days + "晚");
|
|
|
+ }
|
|
|
|
|
|
- string currencyCode = currData.Find(it => it.Id == item.Currency)?.Remark ?? "Unknown";
|
|
|
- SetCells(ChildTable, doc, rowIndex, 2, item.Cost.ToString("#0.00") + currencyCode + "/晚");
|
|
|
+ int days = dac1.FindAll(x => x.Place == item.Place).Count;
|
|
|
+ SetCells(ChildTable, doc, rowIndex, 0, item.Place);
|
|
|
+ SetCells(ChildTable, doc, rowIndex, 1, $"{days}晚");
|
|
|
+ SetCells(ChildTable, doc, rowIndex, 2, $"{item.Cost:0.00}{currencyCode}/晚");
|
|
|
+ SetCells(ChildTable, doc, rowIndex, 3, $"汇率{currencyRate:0.0000}");
|
|
|
|
|
|
- var currencyRate = DecimalToString((item.SubTotal / item.Cost), 4);
|
|
|
- var sys_currencyInfo = _currencyDatas.Find(x => item.Currency == x.Id);
|
|
|
- if (sys_currencyInfo != null)
|
|
|
- {
|
|
|
- var sys_currencyCode = sys_currencyInfo.Name;
|
|
|
- var eec_currencyInfo = _EnterExitCostCurrencys.Find(x => x.Code.Equals(sys_currencyCode));
|
|
|
- if (eec_currencyInfo != null)
|
|
|
- {
|
|
|
- currencyRate = DecimalToString(eec_currencyInfo.Rate, 4);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- SetCells(ChildTable, doc, rowIndex, 3, "汇率" + currencyRate);
|
|
|
- SetCells(ChildTable, doc, rowIndex, 4, "CNY " + item.SubTotal + "\r\n");
|
|
|
- rowIndex++;
|
|
|
- zsinfo += item.Place + " " + days + "晚 " + item.Cost.ToString("#0.00") + currencyCode + "/晚" + " 汇率" + (item.SubTotal / item.Cost).ToString("#0.0000") + " CNY " + item.SubTotal * days + "\r\n";
|
|
|
- }
|
|
|
+ decimal currSubTotal = Math.Round(days * item.Cost * currencyRate, 2);
|
|
|
+ SetCells(ChildTable, doc, rowIndex, 4, $"CNY {currSubTotal:0.00}\r\n");
|
|
|
|
|
|
+ zsinfo += $"{item.Place} {days}晚 {item.Cost:0.00}/晚 汇率{currencyRate:0.0000} CNY{currSubTotal:0.00}\r\n";
|
|
|
+ totalAccom += currSubTotal;
|
|
|
+ rowIndex++;
|
|
|
}
|
|
|
placeArr.Clear();
|
|
|
|
|
|
+ AllPrice += totalAccom;
|
|
|
+ TeableBookmarkArr.Add("zs", $"{totalAccom:0.00} 元"); // 住宿费
|
|
|
+ TeableBookmarkArr.Add("zsinfo", zsinfo); // 住宿费详情
|
|
|
+
|
|
|
+ decimal totalMeal = 0.00m; // 伙食费合计
|
|
|
rowIndex = 0;
|
|
|
if (dac2.Count <= 0 && ChildTable1 != null) ChildTable1.Remove(); //删除表格
|
|
|
foreach (var item in dac2)
|
|
|
{
|
|
|
- if (string.IsNullOrWhiteSpace(item.Place))
|
|
|
- {
|
|
|
- continue;
|
|
|
- }
|
|
|
+ if (string.IsNullOrWhiteSpace(item.Place) || placeArr.Contains(item.Place)) continue;
|
|
|
|
|
|
- if (placeArr.Contains(item.Place))
|
|
|
- {
|
|
|
- continue;
|
|
|
- }
|
|
|
- else
|
|
|
+ placeArr.Add(item.Place);
|
|
|
+
|
|
|
+ if (rowIndex > ChildTable1.Rows.Count - 1)
|
|
|
{
|
|
|
- placeArr.Add(item.Place);
|
|
|
+ var chitableRow = ChildTable1.LastRow.Clone(true);
|
|
|
+ ChildTable1.AppendChild(chitableRow);
|
|
|
}
|
|
|
- if (!string.IsNullOrWhiteSpace(item.Place))
|
|
|
+
|
|
|
+ decimal currencyRate = item.SubTotal / item.Cost; //默认汇率
|
|
|
+ string currencyCode = "Unknown";
|
|
|
+ var sys_currencyInfo = _currencyDatas.Find(x => item.Currency == x.Id);
|
|
|
+ if (sys_currencyInfo != null)
|
|
|
{
|
|
|
- if (rowIndex > ChildTable1.Rows.Count - 1)
|
|
|
+ var sys_currencyCode = sys_currencyInfo.Name;
|
|
|
+ var eec_currencyInfo = _EnterExitCostCurrencys.Find(x => x.Code.Equals(sys_currencyCode));
|
|
|
+ if (eec_currencyInfo != null)
|
|
|
{
|
|
|
- var chitableRow = ChildTable1.LastRow.Clone(true);
|
|
|
- ChildTable1.AppendChild(chitableRow);
|
|
|
+ currencyRate = eec_currencyInfo.Rate;
|
|
|
+ currencyCode = eec_currencyInfo.Name;
|
|
|
}
|
|
|
- int days = dac2.FindAll(x => x.Place == item.Place).Count;
|
|
|
- SetCells(ChildTable1, doc, rowIndex, 0, item.Place);
|
|
|
- SetCells(ChildTable1, doc, rowIndex, 1, days + "天");
|
|
|
-
|
|
|
- string currencyCode = currData.Find(it => it.Id == item.Currency)?.Remark ?? "Unknown";
|
|
|
- SetCells(ChildTable1, doc, rowIndex, 2, item.Cost.ToString("#0.00") + currencyCode + "/天");
|
|
|
+ }
|
|
|
|
|
|
- var currencyRate = DecimalToString((item.SubTotal / item.Cost), 4);
|
|
|
- var sys_currencyInfo = _currencyDatas.Find(x => item.Currency == x.Id);
|
|
|
- if (sys_currencyInfo != null)
|
|
|
- {
|
|
|
- var sys_currencyCode = sys_currencyInfo.Name;
|
|
|
- var eec_currencyInfo = _EnterExitCostCurrencys.Find(x => x.Code.Equals(sys_currencyCode));
|
|
|
- if (eec_currencyInfo != null)
|
|
|
- {
|
|
|
- currencyRate = DecimalToString(eec_currencyInfo.Rate, 4);
|
|
|
- }
|
|
|
- }
|
|
|
+ int days = dac2.FindAll(x => x.Place == item.Place).Count;
|
|
|
+ SetCells(ChildTable1, doc, rowIndex, 0, item.Place);
|
|
|
+ SetCells(ChildTable1, doc, rowIndex, 1, $"{days}天");
|
|
|
+ SetCells(ChildTable1, doc, rowIndex, 2, $"{item.Cost:0.00}{currencyCode}/天");
|
|
|
+ SetCells(ChildTable1, doc, rowIndex, 3, "汇率" + currencyRate);
|
|
|
|
|
|
- SetCells(ChildTable1, doc, rowIndex, 3, "汇率" + currencyRate);
|
|
|
- SetCells(ChildTable1, doc, rowIndex, 4, "CNY " + item.SubTotal);
|
|
|
- rowIndex++;
|
|
|
- hsinfo += item.Place + " " + days + "天 " + item.Cost.ToString("#0.00") + currencyCode + "/天" + " 汇率" + (item.SubTotal / item.Cost).ToString("#0.0000") + " CNY " + item.SubTotal * days + "\r\n";
|
|
|
- }
|
|
|
+ decimal currSubTotal = Math.Round(days * item.Cost * currencyRate, 2);
|
|
|
+ SetCells(ChildTable1, doc, rowIndex, 4, $"CNY {currSubTotal:0.00}");
|
|
|
|
|
|
+ totalMeal += currSubTotal;
|
|
|
+ rowIndex++;
|
|
|
+ hsinfo += $"{item.Place} {days}天 {item.Cost:0.00}{currencyCode}/天 汇率{currencyRate:0.0000} CNY{currSubTotal}\r\n";
|
|
|
}
|
|
|
placeArr.Clear();
|
|
|
|
|
|
+ AllPrice += totalMeal;
|
|
|
+ TeableBookmarkArr.Add("hs", $"{totalMeal} 元"); //伙食费
|
|
|
+ TeableBookmarkArr.Add("hsinfo", hsinfo); //伙食费详情
|
|
|
+
|
|
|
+ decimal totalMisc= 0.00M; // 公杂费合计
|
|
|
rowIndex = 0;
|
|
|
if (dac2.Count <= 0 && ChildTable2 != null) ChildTable2.Remove(); //删除表格
|
|
|
foreach (var item in dac3)
|
|
|
{
|
|
|
- if (string.IsNullOrWhiteSpace(item.Place))
|
|
|
- {
|
|
|
- continue;
|
|
|
- }
|
|
|
+ if (string.IsNullOrWhiteSpace(item.Place) || placeArr.Contains(item.Place)) continue;
|
|
|
|
|
|
- if (placeArr.Contains(item.Place))
|
|
|
- {
|
|
|
- continue;
|
|
|
- }
|
|
|
- else
|
|
|
+ placeArr.Add(item.Place);
|
|
|
+
|
|
|
+ if (rowIndex > ChildTable2.Rows.Count - 1)
|
|
|
{
|
|
|
- placeArr.Add(item.Place);
|
|
|
+ var chitableRow = ChildTable2.LastRow.Clone(true);
|
|
|
+ ChildTable2.AppendChild(chitableRow);
|
|
|
}
|
|
|
- if (!string.IsNullOrWhiteSpace(item.Place))
|
|
|
- {
|
|
|
- if (rowIndex > ChildTable2.Rows.Count - 1)
|
|
|
- {
|
|
|
- var chitableRow = ChildTable2.LastRow.Clone(true);
|
|
|
- ChildTable2.AppendChild(chitableRow);
|
|
|
- }
|
|
|
- int days = dac3.FindAll(x => x.Place == item.Place).Count;
|
|
|
- SetCells(ChildTable2, doc, rowIndex, 0, item.Place);
|
|
|
- SetCells(ChildTable2, doc, rowIndex, 1, days + "天");
|
|
|
-
|
|
|
- string currencyCode = currData.Find(it => it.Id == item.Currency)?.Remark ?? "Unknown";
|
|
|
- SetCells(ChildTable2, doc, rowIndex, 2, item.Cost.ToString("#0.00") + currencyCode + "/天");
|
|
|
|
|
|
- var currencyRate = DecimalToString((item.SubTotal / item.Cost), 4);
|
|
|
- var sys_currencyInfo = _currencyDatas.Find(x => item.Currency == x.Id);
|
|
|
- if (sys_currencyInfo != null)
|
|
|
+ decimal currencyRate = item.SubTotal / item.Cost;
|
|
|
+ string currencyCode = "Unknown";
|
|
|
+ var sys_currencyInfo = _currencyDatas.Find(x => item.Currency == x.Id);
|
|
|
+ if (sys_currencyInfo != null)
|
|
|
+ {
|
|
|
+ var sys_currencyCode = sys_currencyInfo.Name;
|
|
|
+ var eec_currencyInfo = _EnterExitCostCurrencys.Find(x => x.Code.Equals(sys_currencyCode));
|
|
|
+ if (eec_currencyInfo != null)
|
|
|
{
|
|
|
- var sys_currencyCode = sys_currencyInfo.Name;
|
|
|
- var eec_currencyInfo = _EnterExitCostCurrencys.Find(x => x.Code.Equals(sys_currencyCode));
|
|
|
- if (eec_currencyInfo != null)
|
|
|
- {
|
|
|
- currencyRate = DecimalToString(eec_currencyInfo.Rate, 4);
|
|
|
- }
|
|
|
+ currencyRate = eec_currencyInfo.Rate;
|
|
|
+ currencyCode = eec_currencyInfo.Name;
|
|
|
}
|
|
|
- SetCells(ChildTable2, doc, rowIndex, 3, "汇率" + currencyRate);
|
|
|
- SetCells(ChildTable2, doc, rowIndex, 4, "CNY " + item.SubTotal + "\r\n");
|
|
|
- rowIndex++;
|
|
|
- gzinfo += item.Place + " " + days + "天 " + item.Cost.ToString("#0.00") + currencyCode + "/天" + " 汇率" + (item.SubTotal / item.Cost).ToString("#0.00") + " CNY " + item.SubTotal * days + "\r\n";
|
|
|
}
|
|
|
|
|
|
+ int days = dac3.FindAll(x => x.Place == item.Place).Count;
|
|
|
+ SetCells(ChildTable2, doc, rowIndex, 0, item.Place);
|
|
|
+ SetCells(ChildTable2, doc, rowIndex, 1, $"{days}天");
|
|
|
+ SetCells(ChildTable2, doc, rowIndex, 2, $"{item.Cost:0.00}{currencyCode}/天");
|
|
|
+ SetCells(ChildTable2, doc, rowIndex, 3, $"汇率{currencyRate:0.0000}");
|
|
|
+
|
|
|
+ decimal currSubTotal = Math.Round(days * item.Cost * currencyRate, 2);
|
|
|
+ SetCells(ChildTable2, doc, rowIndex, 4, $"CNY {currSubTotal:0.00}\r\n");
|
|
|
+ totalMisc += currSubTotal;
|
|
|
+ gzinfo += $"{item.Place} {days}天 {item.Cost:0.00}{currencyCode}/天 汇率{currencyRate:0.0000} CNY {currSubTotal:0.00}\r\n";
|
|
|
+ rowIndex++;
|
|
|
}
|
|
|
placeArr.Clear();
|
|
|
+ AllPrice += totalMisc;
|
|
|
|
|
|
- TeableBookmarkArr.Add("zsinfo", zsinfo); //住宿费详情
|
|
|
- TeableBookmarkArr.Add("hs", dac2.Sum(x => Convert.ToDecimal(x.SubTotal)).ToString("#0.00") + " 元"); //伙食费
|
|
|
- TeableBookmarkArr.Add("hsinfo", hsinfo); //伙食费详情
|
|
|
- TeableBookmarkArr.Add("gz", dac3.Sum(x => Convert.ToDecimal(x.SubTotal)).ToString("#0.00") + " 元"); //公杂费
|
|
|
- TeableBookmarkArr.Add("gzinfo", gzinfo); //公杂费详情
|
|
|
+ TeableBookmarkArr.Add("gz",$"{totalMisc:0.00} 元"); //公杂费
|
|
|
+ TeableBookmarkArr.Add("gzinfo", gzinfo); //公杂费详情
|
|
|
|
|
|
string otherFeestr = "";
|
|
|
decimal otherFee = 0.00M;
|
|
|
@@ -1429,11 +1407,15 @@ namespace OASystem.API.Controllers
|
|
|
otherFeestr += "等费用";
|
|
|
}
|
|
|
|
|
|
- TeableBookmarkArr.Add("qt", otherFee.ToString("#0.00") + " 元");//其他费用
|
|
|
+ WordAllPrice += AllPrice;
|
|
|
+
|
|
|
+ UsersTop += $"{firstName}出访费用为¥{AllPrice:0.00}元、";
|
|
|
+
|
|
|
+ TeableBookmarkArr.Add("qt", $"{otherFee:0.00} 元");//其他费用
|
|
|
TeableBookmarkArr.Add("qtinfo", otherFeestr);//其他费用第二列
|
|
|
|
|
|
- TeableBookmarkArr.Add("fw", _EnterExitCosts.Service.ToString("#0.00") + "元/人");//服务费
|
|
|
- TeableBookmarkArr.Add("AllPrice", AllPrice.ToString("#0.00") + "元/人");//表格合计费用
|
|
|
+ TeableBookmarkArr.Add("fw", $"{_EnterExitCosts.Service:0.00}元/人");//服务费
|
|
|
+ TeableBookmarkArr.Add("AllPrice", $"{AllPrice:0.00}元/人");//表格合计费用
|
|
|
TeableBookmarkArr.Add("title", $"费用清单-{airName}({firstName})");
|
|
|
foreach (var book in TeableBookmarkArr.Keys)
|
|
|
{
|
|
|
@@ -1456,7 +1438,7 @@ namespace OASystem.API.Controllers
|
|
|
TeableBookmarkArr.Clear();
|
|
|
}
|
|
|
|
|
|
- bookmarkArr.Add("VisitPrice", WordAllPrice.ToString());//出访费用总额
|
|
|
+ bookmarkArr.Add("VisitPrice", $"{WordAllPrice:0.00}");//出访费用总额
|
|
|
bookmarkArr.Add("CnAllPrice", WordAllPrice.ConvertCNYUpper());//出访费用总额中文
|
|
|
bookmarkArr.Add("namesPrice", UsersTop.TrimEnd('、'));//各人员出访费用 付辰同志出访费用为¥73,604.8元
|
|
|
|