|
@@ -40,6 +40,9 @@ using OASystem.Domain.ViewModels.QiYeWeChat;
|
|
using OASystem.Domain.Entities.Financial;
|
|
using OASystem.Domain.Entities.Financial;
|
|
using NPOI.POIFS.Crypt.Dsig;
|
|
using NPOI.POIFS.Crypt.Dsig;
|
|
using System.Diagnostics.Eventing.Reader;
|
|
using System.Diagnostics.Eventing.Reader;
|
|
|
|
+using System.IO;
|
|
|
|
+using StackExchange.Redis;
|
|
|
|
+using Org.BouncyCastle.Utilities;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
namespace OASystem.API.Controllers
|
|
{
|
|
{
|
|
@@ -3917,6 +3920,388 @@ namespace OASystem.API.Controllers
|
|
return Ok(jw);
|
|
return Ok(jw);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ [HttpPost]
|
|
|
|
+ public async Task<IActionResult> ExportPriceCheckWordFile(GroupCostExportWordFile dto)
|
|
|
|
+ {
|
|
|
|
+ if (dto.Diid == 0)
|
|
|
|
+ {
|
|
|
|
+ return Ok(JsonView(false, "请传递团组id"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var deleInfo = await _groupRepository.PostGroupInfo(new GroupInfoDto { Id = dto.Diid, PortType = 1 });
|
|
|
|
+ if (deleInfo.Code != 0)
|
|
|
|
+ {
|
|
|
|
+ return Ok(JsonView(false, "团组信息查询失败!"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var di = deleInfo.Data as DelegationInfoWebView;
|
|
|
|
+ if (di != null)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ string strFileName = di.TeamName + "-收款账单.doc";
|
|
|
|
+
|
|
|
|
+ string tmppath = (AppSettingsHelper.Get("WordBasePath") + "Template/收款账单(四川)模板.doc");
|
|
|
|
+
|
|
|
|
+ Document doc = new Document(tmppath);
|
|
|
|
+
|
|
|
|
+ decimal TotalPrice = 0.00M;
|
|
|
|
+ string itemStr = string.Empty;
|
|
|
|
+
|
|
|
|
+ Dictionary<string, string> airSouer = new Dictionary<string, string>();
|
|
|
|
+
|
|
|
|
+ airSouer.Add("JJCTBR", "经济舱及酒店双人间");
|
|
|
|
+ airSouer.Add("JJCSGR", "经济舱及酒店单人间");
|
|
|
|
+ airSouer.Add("GWCSGR", "公务舱及酒店单人间");
|
|
|
|
+ airSouer.Add("GWCJSES", "公务舱及酒店小套房");
|
|
|
|
+ airSouer.Add("GWCSUITE", "公务舱及酒店套房");
|
|
|
|
+ airSouer.Add("JJCSUITE", "经济舱及酒店套房");
|
|
|
|
+
|
|
|
|
+ var groupCostType = dto.airs.GroupBy(x => x.costType).OrderBy(x=>x.Key);
|
|
|
|
+
|
|
|
|
+ foreach(var cost in groupCostType)
|
|
|
|
+ {
|
|
|
|
+ var List = cost.ToList();
|
|
|
|
+
|
|
|
|
+ if (cost.Key == "A")
|
|
|
|
+ {
|
|
|
|
+ foreach (var ListItem in List)
|
|
|
|
+ {
|
|
|
|
+ if (ListItem.number > 0)
|
|
|
|
+ {
|
|
|
|
+ if (ListItem.code.Contains("TBR"))
|
|
|
|
+ {
|
|
|
|
+ itemStr += "团费(" + airSouer[ListItem.code] + ") RMB " + ListItem.price.ToString("F2") + "/人*" + ListItem.number + "(" + (ListItem.number / 2) + "间( ............合计 RMB " + (ListItem.number * ListItem.price).ToString("#0.00") + "\n";
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ itemStr += "团费(" + airSouer[ListItem.code] + ") RMB " + ListItem.price.ToString("F2") + "/人*" + ListItem.number + "(" + ListItem.number + "间( ............合计 RMB " + (ListItem.number * ListItem.price).ToString("#0.00") + "\n";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ TotalPrice += (ListItem.number * ListItem.price);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ itemStr = itemStr.Insert(0, "A段\r\n");
|
|
|
|
+ itemStr += "B段\r\n";
|
|
|
|
+
|
|
|
|
+ foreach (var ListItem in List)
|
|
|
|
+ {
|
|
|
|
+ if (ListItem.number > 0)
|
|
|
|
+ {
|
|
|
|
+ if (ListItem.code.Contains("TBR"))
|
|
|
|
+ {
|
|
|
|
+ itemStr += "团费(" + airSouer[ListItem.code] + ") RMB " + ListItem.price.ToString("F2") + "/人*" + ListItem.number + "(" + (ListItem.number / 2) + "间( ............合计 RMB " + (ListItem.number * ListItem.price).ToString("#0.00") + "\n";
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ itemStr += "团费(" + airSouer[ListItem.code] + ") RMB " + ListItem.price.ToString("F2") + "/人*" + ListItem.number + "(" + ListItem.number + "间( ............合计 RMB " + (ListItem.number * ListItem.price).ToString("#0.00") + "\n";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ TotalPrice += (ListItem.number * ListItem.price);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ #region 替换Word模板书签内容
|
|
|
|
+
|
|
|
|
+ Dictionary<string, string> marks = new Dictionary<string, string>();
|
|
|
|
+ marks.Add("To", di.ClientUnit);
|
|
|
|
+ marks.Add("ToTel", di.TellPhone);
|
|
|
|
+ marks.Add("Date", DateTime.Now.ToString("yyyy-MM-dd"));
|
|
|
|
+ marks.Add("Team", di.VisitCountry.Replace(" ", "、"));
|
|
|
|
+ marks.Add("TontractTime", (di.VisitDate).ToString("yyyy年MM月dd日"));
|
|
|
|
+ marks.Add("PayDay", (di.PayDay).ToString());
|
|
|
|
+ marks.Add("PaymentMoney", (di.PaymentMoney).ToString("#0.00"));
|
|
|
|
+ marks.Add("WeChat", "WeChat");
|
|
|
|
+ marks.Add("PayItemContent", itemStr);
|
|
|
|
+ marks.Add("Total", TotalPrice.ToString("F2"));
|
|
|
|
+
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ foreach (var item in marks.Keys)
|
|
|
|
+ {
|
|
|
|
+ if (doc.Range.Bookmarks[item] != null)
|
|
|
|
+ {
|
|
|
|
+ Bookmark mark = doc.Range.Bookmarks[item];
|
|
|
|
+ mark.Text = marks[item];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ byte[] bytes = null;
|
|
|
|
+
|
|
|
|
+ using (MemoryStream stream = new MemoryStream())
|
|
|
|
+ {
|
|
|
|
+ doc.Save(stream, Aspose.Words.SaveFormat.Doc);
|
|
|
|
+ bytes = stream.ToArray();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return Ok(JsonView(true,"",new
|
|
|
|
+ {
|
|
|
|
+ Data = bytes,
|
|
|
|
+ strFileName,
|
|
|
|
+ }));
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ return Ok(JsonView(false,"团组信息不存在!"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ [HttpPost]
|
|
|
|
+ public async Task<IActionResult> ExportGroupCostExcelFile(GroupCostExportExcelFile dto)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if (dto.Diid == 0)
|
|
|
|
+ {
|
|
|
|
+ return Ok(JsonView(false, "请传递团组id"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<GroupCost_Excel> List_GC1 = new List<GroupCost_Excel>();
|
|
|
|
+ WorkbookDesigner designer = new WorkbookDesigner();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ designer.Workbook = new Workbook(AppSettingsHelper.Get("ExcelBasePath") + ("Template/团组-成本.xls"));
|
|
|
|
+
|
|
|
|
+ var List_GC = _GroupCostRepository.GetAllByDiid(dto.Diid);
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < List_GC.Count; i++)
|
|
|
|
+ {
|
|
|
|
+ GroupCost_Excel gc = new GroupCost_Excel();
|
|
|
|
+ gc.Id = List_GC[i].Id;
|
|
|
|
+ gc.Diid = List_GC[i].Diid.ToString();
|
|
|
|
+ gc.DAY = List_GC[i].DAY;
|
|
|
|
+ string week = "";
|
|
|
|
+ if (!string.IsNullOrEmpty(List_GC[i].Date.Trim()))
|
|
|
|
+ week = CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(Convert.ToDateTime(List_GC[i].Date).DayOfWeek);
|
|
|
|
+ gc.Date = (List_GC[i].Date + "\n" + week).ToString();
|
|
|
|
+ gc.ITIN = List_GC[i].ITIN;
|
|
|
|
+ gc.CarType = List_GC[i].CarType;
|
|
|
|
+ gc.CarTiming = List_GC[i].CarTiming.ToString() == "0" ? "/" : List_GC[i].CarTiming.ToString();
|
|
|
|
+ gc.CarCost = List_GC[i].CarCost.ToString() == "0" ? "/" : List_GC[i].CarCost.ToString();
|
|
|
|
+ gc.CarNumber = List_GC[i].CarNumber.ToString() == "0" ? "/" : List_GC[i].CarNumber.ToString();
|
|
|
|
+ gc.TGS = List_GC[i].TGS.ToString() == "0" ? "/" : List_GC[i].TGS.ToString();
|
|
|
|
+ gc.TGWH = List_GC[i].TGWH.ToString() == "0" ? "/" : List_GC[i].TGWH.ToString();
|
|
|
|
+ gc.TGN = List_GC[i].TGS.ToString() == "0" ? "/" : List_GC[i].TGN.ToString();
|
|
|
|
+ gc.TGOF = List_GC[i].TGOF.ToString() == "0" ? "/" : List_GC[i].TGOF.ToString();
|
|
|
|
+
|
|
|
|
+ gc.TGM = List_GC[i].TGM.ToString() == "0" ? "/" : List_GC[i].TGM.ToString();
|
|
|
|
+ gc.TGA = List_GC[i].TGA.ToString() == "0" ? "/" : List_GC[i].TGA.ToString();
|
|
|
|
+ gc.TGTF = List_GC[i].TGTF.ToString() == "0" ? "/" : List_GC[i].TGTF.ToString();
|
|
|
|
+ gc.TGEF = List_GC[i].TGEF.ToString() == "0" ? "/" : List_GC[i].TGEF.ToString();
|
|
|
|
+ gc.CFS = List_GC[i].CFS.ToString() == "0" ? "/" : List_GC[i].CFS.ToString();
|
|
|
|
+ gc.CFM = List_GC[i].CFM.ToString() == "0" ? "/" : List_GC[i].CFOF.ToString();
|
|
|
|
+ gc.CFOF = List_GC[i].CFOF.ToString() == "0" ? "/" : List_GC[i].CFOF.ToString();
|
|
|
|
+ gc.B = List_GC[i].B.ToString() == "0" ? "/" : List_GC[i].B.ToString();
|
|
|
|
+ gc.L = List_GC[i].L.ToString() == "0" ? "/" : List_GC[i].L.ToString();
|
|
|
|
+ gc.D = List_GC[i].D.ToString() == "0" ? "/" : List_GC[i].D.ToString();
|
|
|
|
+ gc.TBR = List_GC[i].TBR.ToString() == "0" ? "/" : List_GC[i].TBR.ToString();
|
|
|
|
+ gc.SGR = List_GC[i].SGR.ToString() == "0" ? "/" : List_GC[i].SGR.ToString();
|
|
|
|
+ gc.JS_ES = List_GC[i].JS_ES.ToString() == "0" ? "/" : List_GC[i].JS_ES.ToString();
|
|
|
|
+ gc.Suite = List_GC[i].Suite.ToString() == "0" ? "/" : List_GC[i].Suite.ToString();
|
|
|
|
+ gc.ACCON = List_GC[i].ACCON.ToString() == "0" ? "/" : List_GC[i].ACCON.ToString();
|
|
|
|
+ gc.TV = List_GC[i].TV.ToString() == "0" ? "/" : List_GC[i].TV.ToString();
|
|
|
|
+ gc.iL = List_GC[i].iL.ToString() == "0" ? "/" : List_GC[i].iL.ToString();
|
|
|
|
+ gc.IF = List_GC[i].IF.ToString() == "0" ? "/" : List_GC[i].IF.ToString();
|
|
|
|
+ gc.EF = List_GC[i].EF.ToString() == "0" ? "/" : List_GC[i].EF.ToString();
|
|
|
|
+ gc.B_R_F = List_GC[i].B_R_F.ToString() == "0" ? "/" : List_GC[i].B_R_F.ToString();
|
|
|
|
+ gc.TE = List_GC[i].TE.ToString() == "0" ? "/" : List_GC[i].TE.ToString();
|
|
|
|
+ gc.TGTips = List_GC[i].TGTips.ToString() == "0" ? "/" : List_GC[i].TGTips.ToString();
|
|
|
|
+ gc.DRVTips = List_GC[i].DRVTips.ToString() == "0" ? "/" : List_GC[i].DRVTips.ToString();
|
|
|
|
+ gc.PC = List_GC[i].PC.ToString() == "0" ? "/" : List_GC[i].PC.ToString();
|
|
|
|
+ gc.TLF = List_GC[i].TLF.ToString() == "0" ? "/" : List_GC[i].TLF.ToString();
|
|
|
|
+ gc.ECT = List_GC[i].ECT.ToString() == "0" ? "/" : List_GC[i].ECT.ToString();
|
|
|
|
+ List_GC1.Add(gc);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var dt = CommonFun.GetDataTableFromIList(List_GC1);
|
|
|
|
+ dt.TableName = "TB";
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ designer.SetDataSource("TeamName", dto.title.TeamName);
|
|
|
|
+ designer.SetDataSource("Pnumber", dto.title.GroupNumber);
|
|
|
|
+ designer.SetDataSource("Tax", dto.title.Tax);
|
|
|
|
+
|
|
|
|
+ designer.SetDataSource("Currency", dto.title.Currency);
|
|
|
|
+
|
|
|
|
+ designer.SetDataSource("Rate", dto.title.Rate);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|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