Forráskód Böngészése

Merge branch 'develop' of http://132.232.92.186:3000/XinXiBu/OA2023 into develop

leiy 1 éve%!(EXTRA string=óta)
szülő
commit
2602ecbdee

+ 139 - 0
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -45,6 +45,8 @@ using StackExchange.Redis;
 using Org.BouncyCastle.Utilities;
 using Aspose.Words.Drawing;
 using Aspose.Cells.Charts;
+using static NPOI.HSSF.Util.HSSFColor;
+using Quartz.Util;
 
 namespace OASystem.API.Controllers
 {
@@ -4067,6 +4069,11 @@ namespace OASystem.API.Controllers
             }
         }
 
+        /// <summary>
+        /// 导出团组成本
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
         [HttpPost]
         public async Task<IActionResult> ExportGroupCostExcelFile(GroupCostExportExcelFile dto)
         {
@@ -5037,6 +5044,138 @@ namespace OASystem.API.Controllers
             }));
         }
 
+        /// <summary>
+        /// 导出客户报表
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public async Task<IActionResult> ExportClientWordFile(ExportClientWordFileDto dto)
+        {
+            var jw = JsonView(false);
+
+            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)
+            {
+                return Ok(JsonView(false, "团组信息查询失败!"));
+            }
+
+            //文件名
+            //string strFileName = di.TeamName + "-团组-客户报价.doc";
+            //获取模板
+            string tmppath = (AppSettingsHelper.Get("WordBasePath") + "Template/团组-客户报价.doc");
+            //载入模板
+            Document doc = new Document(tmppath);
+            Aspose.Words.DocumentBuilder builder = new Aspose.Words.DocumentBuilder(doc);
+
+            Dictionary<string, string> DickeyValue = new Dictionary<string, string>();
+
+            DickeyValue.Add("DickeyValue", di.TeamName);  //团组名
+
+            var ParameterList = _GroupCostParameterRepository.GetGroupCostParameterListByDiid(dto.Diid);
+
+            var AParameter = ParameterList.Find(x => x.CostType == "A");
+            var BParameter = ParameterList.Find(x => x.CostType == "B");
+
+            if (AParameter == null)
+            {
+                return Ok(JsonView(false, "系数不存在!"));
+            }
+
+            string CarGuides, TzNumber, CarGuides1, Meal, SubsidizedMeals, NightRepair, AttractionsTickets, MiscellaneousFees, ATip, TzHotelDesc, Offcial, PettyCash, Visa, TrainTicket, TicketPrice
+                , TzAirDesc, TzZCost;
+            CarGuides = TzNumber = CarGuides1 = Meal = SubsidizedMeals = NightRepair = AttractionsTickets = MiscellaneousFees = ATip = TzHotelDesc = Offcial = PettyCash = Visa = TrainTicket = TicketPrice
+                = TzAirDesc = TzZCost = string.Empty;
+
+            TzNumber = AParameter.CostTypenumber.ToString();
+            CarGuides = "RMB " + (AParameter.DJCB * AParameter.DJXS).ToString("#0.00");
+            CarGuides1 = dto.CarGuides1;
+            Meal = dto.Meal;
+            SubsidizedMeals = dto.SubsidizedMeals;
+            NightRepair = dto.NightRepair;
+            AttractionsTickets = dto.AttractionsTickets;
+            MiscellaneousFees = dto.MiscellaneousFees;
+            ATip = dto.ATip;
+            TzHotelDesc = "";
+            Offcial = "RMB " + (AParameter.GWCB * AParameter.GWXS).ToString("#0.00");
+            PettyCash = "RMB " + (AParameter.LYJCB * AParameter.LYJXS ).ToString("#0.00");
+            Visa = "RMB " + (AParameter.VisaCB * AParameter.VisaXS + AParameter.HSCB * AParameter.HSXS + AParameter.BXCB * AParameter.BXXS).ToString("#0.00");
+            TrainTicket = "RMB " + (AParameter.HCPCB * AParameter.HCPXS).ToString("#0.00");
+            TicketPrice = "RMB " + (AParameter.CPCB * AParameter.CPXS).ToString("#0.00");
+            TzAirDesc = "";
+            TzZCost = dto.TzZCost;
+
+
+            if (dto.costType == "B")
+            {
+                if (BParameter == null)
+                {
+                    return Ok(JsonView(false, "B段系数不存在!"));
+                }
+
+                CarGuides = CarGuides.Insert(0,"A段 ") + " B段 RMB" + (BParameter.DJCB * BParameter.DJXS ).ToString("#0.00");
+                Offcial = Offcial.Insert(0, "A段 ") + " B段 RMB " + (BParameter.GWCB * BParameter.GWXS ).ToString("#0.00");
+                PettyCash = PettyCash.Insert(0, "A段 ") + " B段 RMB " + (BParameter.LYJCB * BParameter.LYJXS ).ToString("#0.00");
+                Visa = Visa.Insert(0, "A段 ") + " B段 RMB " + (BParameter.VisaCB * BParameter.VisaXS + BParameter.HSCB * BParameter.HSXS + BParameter.BXCB * BParameter.BXXS).ToString("#0.00");
+                TrainTicket = TrainTicket.Insert(0, "A段 ") + " B段 RMB " + (BParameter.HCPCB * BParameter.HCPXS ).ToString("#0.00");
+                TicketPrice = TicketPrice.Insert(0, "A段 ") + " B段 RMB " + (BParameter.CPCB * BParameter.CPXS ).ToString("#0.00");
+            }
+
+            Visa = Visa.Insert(0, "签证及保险(含核酸检测): ");
+
+            DickeyValue.Add("TzNumber", TzNumber); //团组人数
+            DickeyValue.Add("CarGuides", CarGuides); //地接单人报价
+            DickeyValue.Add("CarGuides1", CarGuides1); // 地接 - 车导费
+            DickeyValue.Add("Meal", Meal); // 地接 - 餐费
+            DickeyValue.Add("SubsidizedMeals", SubsidizedMeals);// 地接 - 餐补
+            DickeyValue.Add("NightRepair", NightRepair); // 地接 - 宿补
+            DickeyValue.Add("AttractionsTickets", AttractionsTickets); // 地接 - 景点
+            DickeyValue.Add("MiscellaneousFees", MiscellaneousFees); // 地接 - 杂费
+            DickeyValue.Add("ATip", ATip);   // 地接 - 小费
+
+            DickeyValue.Add("TzHotelDesc", TzHotelDesc); //酒店
+            DickeyValue.Add("Offcial", Offcial); // 公务单人报价
+            DickeyValue.Add("PettyCash", PettyCash); // 零用金单人报价
+            DickeyValue.Add("Visa", Visa); // 签证单人报价
+            DickeyValue.Add("TrainTicket", TrainTicket); //火车票
+            DickeyValue.Add("TicketPrice", TicketPrice); //船票
+            DickeyValue.Add("TzAirDesc", TzAirDesc); //机票
+            DickeyValue.Add("TzZCost", TzZCost);
+
+            foreach (var key in DickeyValue.Keys)
+            {
+                if (doc.Range.Bookmarks[key] != null)
+                {
+                    Bookmark mark = doc.Range.Bookmarks[key];
+                    mark.Text = DickeyValue[key];
+                }
+            }
+
+            byte[] bytes = null;
+            string strFileName = di.TeamName + "-客户报价.doc";
+            using (MemoryStream stream = new MemoryStream())
+            {
+                doc.Save(stream, Aspose.Words.SaveFormat.Doc);
+                bytes = stream.ToArray();
+            }
+
+            return Ok(JsonView(true, "", new
+            {
+                Data = bytes,
+                strFileName,
+            }));
+        }
+
         #endregion
 
         #region 酒店预定 保留

+ 17 - 0
OASystem/OASystem.Domain/Dtos/Groups/GroupCostSavaDto.cs

@@ -808,6 +808,23 @@ namespace OASystem.Domain.Dtos.Groups
         public List<TitleModel> titleModel { get; set; }
     }
 
+    public class ExportClientWordFileDto
+    {
+        public int Diid { get; set; }
+        public string costType { get; set; }
+
+        public decimal Rate { get; set; }
+
+        public string CarGuides1 { get; set; }
+        public string Meal { get; set; }
+        public string SubsidizedMeals { get; set; }
+        public string NightRepair { get; set; }
+        public string AttractionsTickets { get; set; }
+        public string MiscellaneousFees { get; set; }
+        public string ATip { get; set; }
+        public string TzZCost { get; set; }
+    }
+
     public class LeftModel
     {
         public string Type { get; set; }