Browse Source

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

jiangjc 2 months ago
parent
commit
8787ce94c1

+ 415 - 7
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -1,4 +1,5 @@
 using Aspose.Cells;
+using NPOI.SS.Formula.Functions;
 using OASystem.API.OAMethodLib;
 using OASystem.Domain.Dtos.Statistics;
 using OASystem.Domain.Entities.Customer;
@@ -7,6 +8,7 @@ using OASystem.Domain.ViewModels.Financial;
 using OASystem.Domain.ViewModels.QiYeWeChat;
 using OASystem.Domain.ViewModels.Statistics;
 using OASystem.Infrastructure.Repositories.Groups;
+using System;
 using System.Data;
 using static OASystem.API.OAMethodLib.GeneralMethod;
 using TypeInfo = OASystem.Domain.ViewModels.Statistics.TypeInfo;
@@ -3667,7 +3669,7 @@ SELECT
       CAST(
         SUM(
           (
-            ((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100
+            (ccp.PayMoney * ccp.DayRate) 
           )
         ) AS DECIMAL(12, 2)
       )
@@ -3686,7 +3688,7 @@ SELECT
     SELECT
       CAST(
         SUM(
-          ((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100
+          (ccp.PayMoney * ccp.DayRate) 
         ) AS DECIMAL(12, 2)
       )
     FROM
@@ -3704,7 +3706,7 @@ SELECT
     SELECT
       CAST(
         SUM(
-          ((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100
+          (ccp.PayMoney * ccp.DayRate)
         ) AS DECIMAL(12, 2)
       )
     FROM
@@ -3714,14 +3716,15 @@ SELECT
       AND ic.Id = ccp.CId
     WHERE
       ic.IsDel = 0
-      AND ccp.IsAuditGM = 1And ccp.IsPay = 1
+      AND ccp.IsAuditGM = 1 
+      AND ccp.IsPay = 1
       AND di.Id = ic.DiId
   ) AS InsureAmount,
   (
     SELECT
       CAST(
         SUM(
-          ((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100
+          (ccp.PayMoney * ccp.DayRate)
         ) AS DECIMAL(12, 2)
       )
     FROM
@@ -3733,7 +3736,7 @@ SELECT
       AND ccp.CTable = 76
       AND ccp.IsAuditGM = 1
       AND ccp.PayMoney <> 0
-      AND ccp.IsPay = 0
+      AND ccp.IsPay = 1
       AND di.Id = hr.DiId
   ) AS HotelAmount,
   (
@@ -3755,7 +3758,7 @@ SELECT
     SELECT
       CAST(
         SUM(
-          ((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100
+          (ccp.PayMoney * ccp.DayRate) 
         ) AS DECIMAL(12, 2)
       )
     FROM
@@ -4760,6 +4763,411 @@ ORDER BY
             }
             return Ok(JsonView(false, "操作失败!"));
         }
+
+        /// <summary>
+        ///  团组数据统计
+        ///  团组预算/实际成本   
+        /// </summary>
+        /// <param name="_dto"></param>
+        /// <returns></returns>
+        [HttpPost("StatisticsGroupCost")]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> StatisticsBRCost(StatisticsBRCostDto _dto)
+        {
+            if (_dto.Year < 1) return Ok(JsonView(false, "Year参数错误!"));
+
+            string beginDt = $"{_dto.Year}-01-01 00:00:00",
+                  endDt = $"{_dto.Year}-12-31 23:59:59";
+
+            var sql = string.Format(@"
+SELECT
+  ROW_NUMBER() OVER(
+    ORDER BY
+      di.VisitDate DESC
+  ) AS 'RowNumber',
+  di.Id,
+  di.TeamName AS 'GroupName',
+  di.ClientUnit,
+  di.VisitDate,
+  di.VisitDays,
+  di.VisitPNumber,
+  (
+    SELECT
+      TOP 1 CASE
+        ISNUMERIC (gcp.Currency)
+        WHEN 1 THEN (
+          SELECT
+            Name
+          FROM
+            Sys_SetData sd
+          WHERE
+            CAST(gcp.Currency AS INT) = sd.Id
+        )
+        ELSE gcp.Currency
+      END AS 'CurrencyCode'
+    FROM
+      Grp_GroupCostParameter gcp
+    WHERE
+      gcp.IsDel = 0
+      AND gcp.DiId = di.Id
+  ) Budget_CurrencyCode,
+  --预算币种
+  (
+    SELECT
+      TOP 1 CAST(COALESCE(gcp.Rate, 0.0000) AS DECIMAL(12, 4))
+    FROM
+      Grp_GroupCostParameter gcp
+    WHERE
+      gcp.IsDel = 0
+      AND gcp.DiId = di.Id
+  ) Budget_Rate,
+  --预算汇率
+  (
+    SELECT
+      CAST(
+        SUM(COALESCE(gcp.VisaCB, 0) * COALESCE(gcp.VisaRS, 0)) AS DECIMAL(12, 2)
+      )
+    FROM
+      Grp_GroupCostParameter gcp
+    WHERE
+      gcp.IsDel = 0
+      AND gcp.DiId = di.id
+  ) Budget_VisaAmount,
+  -- 预算签证成本
+  (
+    SELECT
+      CAST(
+        SUM(
+          (
+            (ccp.PayMoney * ccp.DayRate)
+          )
+        ) AS DECIMAL(12, 2)
+      )
+    FROM
+      Grp_VisaInfo vi
+      INNER JOIN Grp_CreditCardPayment ccp ON ccp.isdel = 0
+      AND ccp.CTable = 80
+      AND vi.Id = ccp.CId
+    WHERE
+      vi.IsDel = 0
+      AND ccp.IsAuditGM = 1
+      AND ccp.IsPay = 1
+      AND di.Id = vi.DIId
+  ) AS Reality_VisaAmount,
+  -- 实际签证成本
+  (
+    SELECT
+      CAST(
+        SUM(
+          COALESCE(gcp.JJCCB, 0) * COALESCE(gcp.JJCRS, 0) + COALESCE(gcp.GWCCB, 0) * COALESCE(gcp.GWCRS, 0) + COALESCE(gcp.TDCCB, 0) * COALESCE(gcp.TDCRS, 0)
+        ) AS DECIMAL(12, 2)
+      )
+    FROM
+      Grp_GroupCostParameter gcp
+    WHERE
+      gcp.IsDel = 0
+      AND gcp.DiId = di.id
+  ) Budget_AirTicketAmount,
+  -- 预算机票成本
+  (
+    SELECT
+      CAST(
+        SUM(
+          (
+            (ccp.PayMoney * ccp.DayRate)
+          )
+        ) AS DECIMAL(12, 2)
+      )
+    FROM
+      Grp_AirTicketReservations atr
+      INNER JOIN Grp_CreditCardPayment ccp ON ccp.isdel = 0
+      AND ccp.CTable = 85
+      AND atr.Id = ccp.CId
+    WHERE
+      atr.IsDel = 0
+      AND ccp.IsAuditGM = 1
+      AND ccp.IsPay = 1
+      AND di.Id = atr.DiId
+  ) Reality_AirTicketAmount,
+  --实际机票
+  (
+    SELECT
+      CAST(
+        SUM(
+          COALESCE(gcp.SGRCB, 0) * COALESCE(gcp.SGRNumber, 0) + COALESCE(gcp.TBRCB, 0) * COALESCE(gcp.TBRNumber, 0) + COALESCE(gcp.SUITECB, 0) * COALESCE(gcp.SUITENumber, 0) + COALESCE(gcp.SUITENumber, 0) * COALESCE(gcp.JSESXS, 0)
+        ) AS DECIMAL(12, 2)
+      )
+    FROM
+      Grp_GroupCostParameter gcp
+    WHERE
+      gcp.IsDel = 0
+      AND gcp.DiId = di.id
+  ) Budget_HotelAmount,
+  -- 预算酒店成本
+  (
+    SELECT
+      CAST(
+        SUM(
+          (ccp.PayMoney * ccp.DayRate)
+        ) AS DECIMAL(12, 2)
+      )
+    FROM
+      Grp_HotelReservations hr
+      INNER JOIN Grp_CreditCardPayment ccp ON hr.Id = ccp.CId
+    WHERE
+      hr.IsDel = 0
+      AND ccp.IsDel = 0
+      AND ccp.CTable = 76
+      AND ccp.IsAuditGM = 1
+      AND ccp.PayMoney <> 0
+      AND ccp.IsPay = 1
+      AND di.Id = hr.DiId
+  ) AS Reality_HotelAmount,
+  -- 实际酒店成本
+  (
+    SELECT
+      CAST(
+        SUM(COALESCE(gcp.DJCB, 0) * COALESCE(gcp.DJRS, 0)) AS DECIMAL(12, 2)
+      )
+    FROM
+      Grp_GroupCostParameter gcp
+    WHERE
+      gcp.IsDel = 0
+      AND gcp.DiId = di.id
+  ) Budget_OPAmount,
+  -- 预算 OP
+  (
+    SELECT
+      CAST(
+        SUM(
+          (
+            ctggr.ServiceQuotedPrice * (ccp.PayPercentage / 100) * ccp.DayRate
+          )
+        ) AS DECIMAL(12, 2)
+      )
+    FROM
+      Grp_CarTouristGuideGroundReservations ctggr
+      INNER JOIN Grp_CreditCardPayment ccp ON ccp.IsDel = 0
+      AND ccp.CTable = 79
+      AND ctggr.Id = ccp.CId
+    WHERE
+      ctggr.IsDel = 0
+      AND ccp.IsAuditGM = 1
+      AND ccp.IsPay = 1
+      AND di.Id = ctggr.DiId
+  ) AS Reality_OPAmount,
+  -- 实际 OP
+  (
+    SELECT
+      CAST(
+        SUM(COALESCE(gcp.GWCB, 0) * COALESCE(gcp.GWRS, 0)) AS DECIMAL(12, 2)
+      )
+    FROM
+      Grp_GroupCostParameter gcp
+    WHERE
+      gcp.IsDel = 0
+      AND gcp.DiId = di.id
+  ) Budget_OAAmount,
+  -- 预算 商邀
+  (
+    SELECT
+      CAST(
+        SUM(
+          (ccp.PayMoney * ccp.DayRate)
+        ) AS DECIMAL(12, 2)
+      )
+    FROM
+      Grp_InvitationOfficialActivities ioa
+      INNER JOIN Grp_CreditCardPayment ccp ON ccp.isdel = 0
+      AND ccp.CTable = 81
+      AND ioa.Id = ccp.CId
+    WHERE
+      ioa.IsDel = 0
+      AND ccp.IsAuditGM = 1
+      AND ccp.IsPay = 1
+      AND di.Id = ioa.Diid
+  ) AS Reality_OAAmount,
+  -- 实际 商邀
+  (
+    SELECT
+      CAST(
+        SUM(
+          COALESCE(gcp.BXCB, 0) * COALESCE(gcp.BXRS, 0) + COALESCE(gcp.HCPCB, 0) * COALESCE(gcp.HCPRS, 0) + COALESCE(gcp.CPCB, 0) * COALESCE(gcp.CPRS, 0) + COALESCE(gcp.HSCB, 0) * COALESCE(gcp.HSRS, 0) + COALESCE(gcp.LYJCB, 0) * COALESCE(gcp.LYJRS, 0)
+        ) AS DECIMAL(12, 2)
+      )
+    FROM
+      Grp_GroupCostParameter gcp
+    WHERE
+      gcp.IsDel = 0
+      AND gcp.DiId = di.id
+  ) Budget_OtherAmount,
+  -- 预算其他成本
+  (
+    SELECT
+      CAST(
+        SUM(
+          (ccp.PayMoney * ccp.DayRate) 
+        ) AS DECIMAL(12, 2)
+      )
+    FROM
+      Grp_Customers ic
+      INNER JOIN Grp_CreditCardPayment ccp ON ccp.isdel = 0
+      AND ccp.CTable = 82
+      AND ic.Id = ccp.CId
+    WHERE
+      ic.IsDel = 0
+      AND ccp.IsAuditGM = 1And ccp.IsPay = 1
+      AND di.Id = ic.DiId
+  ) AS Reality_InsureAmount,
+  -- 实际保险成本
+  (
+    SELECT
+      CAST(SUM((ccp.PayMoney * ccp.DayRate)) AS DECIMAL(12, 2))
+    FROM
+      Grp_DecreasePayments dp
+      INNER JOIN Grp_CreditCardPayment ccp ON ccp.isdel = 0
+      AND ccp.CTable = 98
+      AND dp.Id = ccp.CId
+    WHERE
+      dp.IsDel = 0
+      AND ccp.Ctable = 98
+      AND ccp.IsAuditGM = 1
+      AND ccp.IsPay = 1
+      AND di.Id = dp.Diid
+  ) AS Reality_OtherCostAmount -- 实际其他款项
+FROM
+  Grp_DelegationInfo di
+WHERE
+  di.IsDel = 0
+  AND di.TeamDid IN (38, 39, 40, 1048)
+  AND di.VisitDate BETWEEN '{0}' AND '{1}'
+", beginDt, endDt);
+
+            if (!string.IsNullOrEmpty(_dto.Search))
+            {
+                sql += $"AND di.TeamName Like '%{_dto.Search}%'";
+            }
+
+            var view = await _sqlSugar.SqlQueryable<StatisticsBRCostView>(sql).ToListAsync();
+            view = view.OrderByDescending(x => x.Id).ToList();
+            var total = view.Count;
+            var toSkip = (_dto.PageIndex - 1) * _dto.PageSize;
+            var data = view.Skip(toSkip).Take(_dto.PageSize).ToList();
+            if (data.Count > 0)
+            {
+                var diIds = data.Select(x => x.Id).ToList();
+                var currencyData = await _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0 && x.STid == 66).ToListAsync();
+                var ccpData = await _sqlSugar.Queryable<Grp_CreditCardPayment>()
+                    .Where(x => x.IsDel == 0 && 
+                                diIds.Contains(x.DIId) &&
+                                x.IsPay == 1 &&
+                                x.IsAuditGM == 1
+                    )
+                    .ToListAsync();
+
+                for (int i = 0; i < data.Count; i++)
+                {
+                    var info = data[i];
+
+                    info.RowNumber = i + 1;
+
+                    #region 1:签证 80 
+                    var visaDatas = ccpData.Where(x => x.DIId == info.Id && x.CTable == 80).ToList();
+                    var visaDesc = "-";
+                    if (visaDatas.Count > 0)
+                    {
+                        visaDesc = $"实际币种金额:";
+                        foreach (var visa in visaDatas)
+                        {
+                            var currencyCode = currencyData.Find(x => x.Id == visa.PaymentCurrency)?.Name;
+                            visaDesc += $"{visa.PayMoney} {currencyCode} 汇率:{visa.DayRate.ToString("#0.0000")};";
+                        }
+                    }
+                    info.Reality_VisaAmountDesc = visaDesc;
+                    #endregion
+
+                    #region 2:机票 85
+                    var airDatas = ccpData.Where(x => x.DIId == info.Id && x.CTable == 85).ToList();
+                    var airDesc = "-";
+                    if (airDatas.Count > 0)
+                    {
+                        airDesc = $"实际币种金额:";
+                        foreach (var air in airDatas)
+                        {
+                            var currencyCode = currencyData.Find(x => x.Id == air.PaymentCurrency)?.Name;
+                            airDesc += $"{air.PayMoney} {currencyCode} 汇率:{air.DayRate.ToString("#0.0000")};";
+                        }
+                    }
+                    info.Reality_AirTicketAmountDesc = airDesc;
+                    #endregion
+
+                    #region 3:酒店 76
+                    var hotelDatas = ccpData.Where(x => x.DIId == info.Id && x.CTable == 76 && x.PayMoney != 0 ).ToList();
+                    var hotelDesc = "-";
+                    if (hotelDatas.Count > 0)
+                    {
+                        hotelDesc = $"实际币种金额:";
+                        foreach (var hotel in hotelDatas)
+                        {
+                            var currencyCode = currencyData.Find(x => x.Id == hotel.PaymentCurrency)?.Name;
+                            hotelDesc += $"{hotel.PayMoney} {currencyCode} 汇率:{hotel.DayRate.ToString("#0.0000")};";
+                        }
+                    }
+                    info.Reality_HotelAmountDesc = hotelDesc;
+                    #endregion
+
+                    #region 4:OP 79
+                    var opDatas = ccpData.Where(x => x.DIId == info.Id && x.CTable == 79 && x.PayMoney != 0).ToList();
+                    var opDesc = "-";
+                    if (opDatas.Count > 0)
+                    {
+                        opDesc = $"实际币种金额;";
+                        foreach (var op in opDatas)
+                        {
+                            var currencyCode = currencyData.Find(x => x.Id == op.PaymentCurrency)?.Name;
+                            opDesc += $"{op.PayMoney} {currencyCode} 汇率:{op.DayRate.ToString("#0.0000")};";
+                        }
+                    }
+                    info.Reality_OPAmountDesc = opDesc;
+                    #endregion
+
+                    #region 5:商邀 81 
+                    var oaDatas = ccpData.Where(x => x.DIId == info.Id && x.CTable == 81 && x.PayMoney != 0).ToList();
+                    var oaDesc = "-";
+                    if (oaDatas.Count > 0)
+                    {
+                        oaDesc = $"实际币种金额:";
+                        foreach (var oa in oaDatas)
+                        {
+                            var currencyCode = currencyData.Find(x => x.Id == oa.PaymentCurrency)?.Name;
+                            oaDesc += $"{oa.PayMoney} {currencyCode} 汇率:{oa.DayRate.ToString("#0.0000")};";
+                        }
+                    }
+                    info.Reality_OAAmountDesc = oaDesc;
+                    #endregion
+
+                    #region 6:其他款项(保险 82、其他款项 98)
+                    var cTables = new List<int>() { 82, 98 };
+                    var otherDatas = ccpData.Where(x => x.DIId == info.Id && cTables.Contains(x.CTable) && x.PayMoney != 0).ToList();
+                    var otherDesc = "-";
+                    if (otherDatas.Count > 0)
+                    {
+                        otherDesc = $"实际币种金额:";
+                        foreach (var other in otherDatas)
+                        {
+                            var currencyCode = currencyData.Find(x => x.Id == other.PaymentCurrency)?.Name;
+                            otherDesc += $"{other.PayMoney} {currencyCode} 汇率:{other.DayRate.ToString("#0.0000")};";
+                        }
+                    }
+                    info.Reality_OtherCostAmountDesc = otherDesc;
+                    #endregion
+                }
+            }
+
+            var briefData = _mapper.Map<List<StatisticsBRCostBriefView>>(data);
+            return Ok(JsonView(briefData, total));
+        }
+
         #endregion
     }
 }

+ 4 - 0
OASystem/OASystem.Domain/AutoMappers/_baseMappingProfile.cs

@@ -274,6 +274,10 @@ namespace OASystem.Domain.AutoMappers
             #endregion
             #endregion
 
+            #region Statistics
+            CreateMap<StatisticsBRCostView, StatisticsBRCostBriefView>();
+            #endregion
+
             #region 人事 模块
             //CreateMap<WageSheetInfoView, Pm_WageSheet>();
             CreateMap<Pm_WageSheet, WageSheetItemInfoView>();

+ 6 - 0
OASystem/OASystem.Domain/Dtos/Statistics/MarketingSalesDto.cs

@@ -214,5 +214,11 @@ namespace OASystem.Domain.Dtos.Statistics
         public int Type { get; set; }
     }
 
+    public class StatisticsBRCostDto : DtoBase
+    {
+        public int Year { get; set; }
+
+        public string Search { get; set; }
+    }
 
 }

+ 232 - 0
OASystem/OASystem.Domain/ViewModels/Financial/Fin_DailyFeePaymentView.cs

@@ -1,4 +1,5 @@
 using Dm;
+using Google.Protobuf.WellKnownTypes;
 using Npgsql.Replication.PgOutput;
 using OASystem.Domain.Entities.Financial;
 using OASystem.Domain.ViewModels.System;
@@ -1365,6 +1366,237 @@ namespace OASystem.Domain.ViewModels.Financial
         }
     }
 
+    #endregion
+
+    #region 团组预算/实际成本
+
+    public class StatisticsBRCostBasicData
+    {
+        /// <summary>
+        /// 预算币种
+        /// </summary>
+        public string Budget_CurrencyCode { get; set; }
+
+        /// <summary>
+        /// 预算币种汇率
+        /// </summary>
+        public decimal Budget_Rate { get; set; }
+
+        /// <summary>
+        /// 预算签证成本
+        /// </summary>
+        public decimal Budget_VisaAmount { get; set; }
+        /// <summary>
+        /// 实际签证成本
+        /// </summary>
+        public decimal Reality_VisaAmount { get; set; }
+
+        /// <summary>
+        /// 实际签证成本描述
+        /// </summary>
+        public string Reality_VisaAmountDesc { get; set; }
+
+        /// <summary>
+        /// 预算机票成本
+        /// </summary>
+        public decimal Budget_AirTicketAmount { get; set; }
+        /// <summary>
+        /// 实际机票
+        /// </summary>
+        public decimal Reality_AirTicketAmount { get; set; }
+        /// <summary>
+        /// 实际机票描述
+        /// </summary>
+        public string Reality_AirTicketAmountDesc { get; set; }
+        /// <summary>
+        /// 预算酒店成本
+        /// </summary>
+        public decimal Budget_HotelAmount { get; set; }
+        /// <summary>
+        /// 实际酒店成本
+        /// </summary>
+        public decimal Reality_HotelAmount { get; set; }
+        /// <summary>
+        /// 实际酒店成本描述
+        /// </summary>
+        public string Reality_HotelAmountDesc { get; set; }
+        /// <summary>
+        /// 预算 OP
+        /// </summary>
+        public decimal Budget_OPAmount { get; set; }
+        /// <summary>
+        /// 实际 OP
+        /// </summary>
+        public decimal Reality_OPAmount { get; set; }
+        /// <summary>
+        /// 实际 OP成本描述
+        /// </summary>
+        public string Reality_OPAmountDesc { get; set; }
+        /// <summary>
+        /// 预算 商邀
+        /// </summary>
+        public decimal Budget_OAAmount { get; set; }
+        /// <summary>
+        /// 实际 商邀
+        /// </summary>
+        public decimal Reality_OAAmount { get; set; }
+        /// <summary>
+        /// 实际 商邀成本描述
+        /// </summary>
+        public string Reality_OAAmountDesc { get; set; }
+        /// <summary>
+        /// 预算其他成本
+        /// </summary>
+        public decimal Budget_OtherAmount { get; set; }
+        /// <summary>
+        /// 实际其他成本 - 保险
+        /// </summary>
+        public decimal Reality_InsureAmount { get; set; }
+        /// <summary>
+        /// 实际其他成本 - 其他款项
+        /// </summary>
+        public decimal Reality_OtherCostAmount { get; set; }
+        /// <summary>
+        /// 实际其他成本 - 其他款项、保险描述
+        /// </summary>
+        public string Reality_OtherCostAmountDesc { get; set; }
+    }
+
+    public class StatisticsBRCostView : StatisticsBRCostBasicData
+    {
+        public int RowNumber { get; set; }
+        public int Id { get; set; }
+        public string GroupName { get; set; }
+        public string ClientUnit { get; set; }
+        public DateTime VisitDate { get; set; }
+        public int VisitDays { get; set; }
+        public int VisitPNumber { get; set; }
+
+        public decimal BudgetAmount
+        {
+            get
+            {
+                return Budget_VisaAmount + Budget_AirTicketAmount + Budget_HotelAmount + Budget_OPAmount + Budget_OAAmount + Budget_OtherAmount;
+            }
+        }
+
+        public decimal RealityAmount
+        {
+            get
+            {
+                return Reality_VisaAmount + Reality_AirTicketAmount + Reality_HotelAmount + Reality_OPAmount + Reality_OAAmount + Reality_InsureAmount + Reality_OtherCostAmount;
+            }
+        }
+
+        public decimal ExcessAmount
+        {
+            get
+            {
+                return RealityAmount - BudgetAmount;
+            }
+        }
+
+        public string ExcessPercentage
+        {
+            get
+            {
+                if (BudgetAmount == 0)
+                {
+                    return $"0%";
+                }
+                var percentage = (RealityAmount / BudgetAmount) * 100;
+                return $"{percentage.ToString("0.00")}%";
+            }
+        }
+
+        public GroupTypeInfo[] Details
+        {
+            get
+            {
+                var rateStr = $"汇率:{Budget_Rate.ToString("#0.0000")};" ;
+                var currencyCode = Budget_CurrencyCode;
+                decimal original_budget_airTicketAmount = 0.00M,
+                        original_budget_HotelAmount = 0.00M,
+                        original_budget_VisaAmount = 0.00M,
+                        original_budget_OPAmount = 0.00M,
+                        original_budget_OAAmount = 0.00M,
+                        original_budget_OtherAmount = 0.00M;
+                if (Budget_Rate != 0) {
+                    original_budget_airTicketAmount = Budget_AirTicketAmount / Budget_Rate;
+                    original_budget_HotelAmount = Budget_HotelAmount / Budget_Rate;
+                    original_budget_VisaAmount = Budget_VisaAmount / Budget_Rate;
+                    original_budget_OPAmount = Budget_OPAmount / Budget_Rate;
+                    original_budget_OAAmount = Budget_OAAmount / Budget_Rate;
+                    original_budget_OtherAmount = Budget_OtherAmount / Budget_Rate;
+                }
+                var budget_AirTicketAmountStr = Budget_AirTicketAmount == 0 ? "-" : 
+                    $"{Budget_AirTicketAmount.ToString("#0.00")} CNY(实际币种金额:{original_budget_airTicketAmount.ToString("#0.00")} {currencyCode} {rateStr})";
+                var budget_HotelAmountStr = Budget_HotelAmount == 0 ? "-" : 
+                    $"{Budget_HotelAmount.ToString("#0.00")} CNY(实际币种金额:{original_budget_HotelAmount.ToString("#0.00")} {currencyCode} {rateStr})";
+                var budget_VisaAmountStr = Budget_VisaAmount == 0 ? "-" : 
+                    $"{Budget_VisaAmount.ToString("#0.00")} CNY(实际币种金额:{original_budget_VisaAmount.ToString("#0.00")} {currencyCode} {rateStr})";
+                var budget_OPAmountStr = Budget_OPAmount == 0 ? "-" : 
+                    $"{Budget_OPAmount.ToString("#0.00")} CNY(实际币种金额:{original_budget_OPAmount.ToString("#0.00")} {currencyCode} {rateStr})";
+                var budget_OAAmountStr = Budget_OAAmount == 0 ? "-" :                                                   
+                    $"{Budget_OAAmount.ToString("#0.00")} CNY(实际币种金额:{original_budget_OAAmount.ToString("#0.00")} {currencyCode} {rateStr})";
+                var budget_OtherAmountStr = Budget_OtherAmount == 0 ? "-" : 
+                    $"{Budget_OtherAmount.ToString("#0.00")}CNY(实际币种金额:{original_budget_OtherAmount.ToString("#0.00")}  {currencyCode} {rateStr})";
+
+                var reality_AirTicketAmountStr = Reality_AirTicketAmount == 0 ? "-" : $"{Reality_AirTicketAmount.ToString("#0.00")} CNY({Reality_AirTicketAmountDesc})";
+                var reality_HotelAmountStr = Reality_HotelAmount == 0 ? "-" : $"{Reality_HotelAmount.ToString("#0.00")} CNY({Reality_HotelAmountDesc})";
+                var reality_VisaAmountStr = Reality_VisaAmount == 0 ? "-" : $"{Reality_VisaAmount.ToString("#0.00")} CNY({Reality_VisaAmountDesc})";
+                var reality_OPAmountStr = Reality_OPAmount == 0 ? "-" : $"{Reality_OPAmount.ToString("#0.00")} CNY({Reality_OPAmountDesc})";
+                var reality_OAAmountStr = Reality_OAAmount == 0 ? "-" : $"{Reality_OAAmount.ToString("#0.00")} CNY({Reality_OAAmountDesc})";
+                var reality_otherAmount = (Reality_InsureAmount + Reality_OtherCostAmount);
+                var reality_OtherAmountStr = reality_otherAmount == 0 ? "-" : $"{reality_otherAmount.ToString("#0.00")} CNY({Reality_OtherCostAmountDesc})";
+
+                return new GroupTypeInfo[] {
+                    new GroupTypeInfo(1,"机票",budget_AirTicketAmountStr,reality_AirTicketAmountStr),
+                    new GroupTypeInfo(2,"酒店",budget_HotelAmountStr,reality_HotelAmountStr),
+                    new GroupTypeInfo(3,"签证",budget_VisaAmountStr,reality_VisaAmountStr),
+                    new GroupTypeInfo(4,"OP",budget_OPAmountStr,reality_OPAmountStr),
+                    new GroupTypeInfo(5,"商邀",budget_OAAmountStr,reality_OAAmountStr),
+                    new GroupTypeInfo(6,"其他",budget_OtherAmountStr,reality_OtherAmountStr)
+                };
+            }
+        }
+    }
+
+    public class GroupTypeInfo
+    {
+        public int No { get; set; }
+        public string Module { get; set; }
+        public string BudgetAmountDesc { get; set; }
+        public string RealityAmountDesc { get; set; }
+        public GroupTypeInfo(int no, string module, string budgetAmount, string realityAmount)
+        {
+            No = no;
+            Module = module;
+            BudgetAmountDesc = budgetAmount;
+            RealityAmountDesc = realityAmount;
+        }
+    }
+
+    public class StatisticsBRCostBriefView
+    {
+        public int RowNumber { get; set; }
+        public int Id { get; set; }
+        public string GroupName { get; set; }
+        public string ClientUnit { get; set; }
+        public DateTime VisitDate { get; set; }
+        public int VisitDays { get; set; }
+        public int VisitPNumber { get; set; }
+
+        public decimal BudgetAmount { get; set; }
+
+        public decimal RealityAmount { get; set; }
+
+        public decimal ExcessAmount { get; set; }
+
+        public string ExcessPercentage { get; set; }
+
+        public GroupTypeInfo[] Details { get; set; }
+    }
     #endregion
     #endregion
 }