LEIYI 8 ヶ月 前
コミット
4b38e71754
共有1 個のファイルを変更した56 個の追加41 個の削除を含む
  1. 56 41
      OASystem/OASystem.Api/Controllers/StatisticsController.cs

+ 56 - 41
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -416,24 +416,61 @@ namespace OASystem.API.Controllers
 
                 //ccp.RMBPrice As CNYPrice
                 //(((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100) As CNYPrice
-                string hotelFeeSql = string.Format(@"Select hr.Id As HrId,hr.DiId As HrDiId,hr.City,hr.HotelName,hr.CheckInDate,hr.CheckOutDate,hr.CardPrice As RoomPrice,
-                                                     sd1.Name As PaymentCurrency,hr.SingleRoomPrice,hr.SingleRoomCount,hr.DoubleRoomPrice,
-                                                     hr.DoubleRoomCount,hr.SuiteRoomPrice,hr.SuiteRoomCount,hr.OtherRoomPrice,hr.OtherRoomCount,
-                                                     hr.BreakfastPrice,sd4.Name As BreakfastCurrency,hr.Isoppay,hr.GovernmentRent,
-                                                     sd5.Name As GovernmentRentCurrency,hr.CityTax,sd6.Name As CityTaxCurrency,
-                                                     ccp.PayMoney,(((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100) As CNYPrice,ccp.DayRate,ccp.Payee,ccp.OrbitalPrivateTransfer,
-                                                     sd2.Name As PayWay,sd3.Name As CardType,ccp.IsPay,u.CnName As Applicant
-                                                     From Grp_HotelReservations  hr
-                                                     Left Join Grp_CreditCardPayment ccp On hr.Id = ccp.CId
-                                                     Left Join Sys_SetData sd1 On ccp.PaymentCurrency = sd1.Id
-                                                     Left Join Sys_SetData sd2 On ccp.PayDId = sd2.Id
-                                                     Left Join Sys_SetData sd3 On ccp.CTDId = sd3.Id
-                                                     Left Join Sys_Users u On ccp.CreateUserId = u.Id
-                                                     Left Join Sys_SetData sd4 On hr.BreakfastCurrency = sd4.Id
-                                                     Left Join Sys_SetData sd5 On hr.GovernmentRentCurrency = sd5.Id
-                                                     Left Join Sys_SetData sd6 On hr.CityTaxCurrency = sd6.Id
-                                                     Where hr.IsDel = 0 And ccp.IsDel = 0 And ccp.CTable = 76 {1} And ccp.PayMoney<> 0 And hr.DiId = {0} 
-                                                     Order By CheckInDate Asc", _dto.DiId, _dto.isAudit ? "And ccp.IsAuditGM = 1" : " ");
+                string hotelFeeSql = string.Format(@"
+SELECT
+  hr.Id AS HrId,
+  hr.DiId AS HrDiId,
+  hr.City,
+  hr.HotelName,
+  hr.CheckInDate,
+  hr.CheckOutDate,
+  hr.CardPrice AS RoomPrice,
+  sd1.Name AS PaymentCurrency,
+  hr.SingleRoomPrice,
+  hr.SingleRoomCount,
+  hr.DoubleRoomPrice,
+  hr.DoubleRoomCount,
+  hr.SuiteRoomPrice,
+  hr.SuiteRoomCount,
+  hr.OtherRoomPrice,
+  hr.OtherRoomCount,
+  hr.BreakfastPrice,
+  sd4.Name AS BreakfastCurrency,
+  hr.Isoppay,
+  hr.GovernmentRent,
+  sd5.Name AS GovernmentRentCurrency,
+  hr.CityTax,
+  sd6.Name AS CityTaxCurrency,
+  ccp.PayMoney,
+  (
+    ((ccp.PayMoney * ccp.DayRate) / ccp.PayPercentage) * 100
+  ) AS CNYPrice,
+  ccp.PayPercentage,
+  ccp.DayRate,
+  ccp.Payee,
+  ccp.OrbitalPrivateTransfer,
+  sd2.Name AS PayWay,
+  sd3.Name AS CardType,
+  ccp.IsPay,
+  u.CnName AS Applicant
+FROM
+  Grp_HotelReservations hr
+  INNER JOIN Grp_CreditCardPayment ccp ON hr.Id = ccp.CId
+  LEFT JOIN Sys_SetData sd1 ON ccp.PaymentCurrency = sd1.Id
+  LEFT JOIN Sys_SetData sd2 ON ccp.PayDId = sd2.Id
+  LEFT JOIN Sys_SetData sd3 ON ccp.CTDId = sd3.Id
+  LEFT JOIN Sys_Users u ON ccp.CreateUserId = u.Id
+  LEFT JOIN Sys_SetData sd4 ON hr.BreakfastCurrency = sd4.Id
+  LEFT JOIN Sys_SetData sd5 ON hr.GovernmentRentCurrency = sd5.Id
+  LEFT JOIN Sys_SetData sd6 ON hr.CityTaxCurrency = sd6.Id
+WHERE
+  hr.IsDel = 0
+  AND ccp.IsDel = 0
+  AND ccp.CTable = 76 {1}
+  AND ccp.PayMoney <> 0
+  AND hr.DiId = {0}
+ORDER BY
+  CheckInDate Asc", _dto.DiId, _dto.isAudit ? "AND (ccp.IsAuditGM = 1 Or ccp.IsAuditGM = 3)" : " ");
 
                 groupHotelFeeViews = await _sqlSugar.SqlQueryable<GroupHotelFeeView>(hotelFeeSql).ToListAsync();
 
@@ -559,28 +596,6 @@ namespace OASystem.API.Controllers
 
                 List<GroupCTGGRFeeView> groupCTGGRFeeViews = new List<GroupCTGGRFeeView>();
 
-                //string CTGGRFeeSql = string.Format(@"Select ctggr.Id As CTGGRId,ctggr.DiId As CTGGRDiId,ctggr.PriceName As Area,ctggrc.*,ctggrc.Price As PayMoney,
-                //                                     sd2.name As PaymentCurrency,ccp.PayPercentage,
-                //                                     (ctggrc.Price / (ccp.PayPercentage / 100)) As AmountPaid,
-                //                                     (ctggrc.Price / (ccp.PayPercentage / 100) - ctggrc.Price) As BalancePayment,
-                //                                     ccp.DayRate,(ctggrc.Price * ccp.DayRate)  As CNYPrice,ccp.Payee,ccp.AuditGMDate,
-                //                                     ccp.OrbitalPrivateTransfer,sd1.Name As PayWay,ccp.IsPay,u.CnName As Applicant,ctggr.CreateTime
-                //                                     From Grp_CarTouristGuideGroundReservations ctggr
-                //                                     Left Join ( Select cggrc.CTGGRId,sd1.Name As PriceName,cggrc.Price,sd2.Name As PriceCurrency,
-                //                                                        cggrc.DatePrice,cggrc.PriceContent
-                //                                             From Grp_CarTouristGuideGroundReservationsContent cggrc
-                //                                             Left Join Sys_SetData sd1 On cggrc.SId = sd1.Id
-                //                                             Left Join Sys_SetData sd2 On cggrc.Currency = sd2.Id
-                //                                             Where cggrc.ISdel = 0 And cggrc.Price != 0.00 
-                //                                             ) ctggrc On ctggr.Id = ctggrc.CTGGRId 
-                //                                     Left Join Grp_CreditCardPayment ccp On ccp.IsDel = 0  And ccp.CTable = 79 And ctggr.Id = ccp.CId
-                //                                     Left Join Sys_SetData sd1 On ccp.PayDId = sd1.Id
-                //                                     Left Join Sys_SetData sd2 On ccp.PaymentCurrency = sd2.Id
-                //                                     Left Join Sys_Users u On ccp.CreateUserId = u.Id
-                //                                     Where ctggr.IsDel = 0 And ccp.IsAuditGM = 1 And ctggr.DiId = {0}
-                //                                     Order By CreateTime", _dto.DiId);
-
-
                 string CTGGRFeeSql = string.Format(@"Select ctggr.Id As CTGGRId,ctggr.DiId As CTGGRDiId,ctggr.PriceName As Area,ctggrc.*,ctggrc.Price As PayMoney,
                                                      sd2.name As PaymentCurrency,ccp.PayPercentage,
                                                      (ctggrc.Price * (ccp.PayPercentage / 100)) As AmountPaid,
@@ -600,7 +615,7 @@ namespace OASystem.API.Controllers
                                                      Left Join Sys_SetData sd2 On ccp.PaymentCurrency = sd2.Id
                                                      Left Join Sys_Users u On ccp.CreateUserId = u.Id
                                                      Where ctggr.IsDel = 0 {1} And ctggr.DiId = {0}
-                                                     Order By CreateTime", _dto.DiId, _dto.isAudit ? "And ccp.IsAuditGM = 1" : " ");
+                                                     Order By CreateTime", _dto.DiId, _dto.isAudit ? "And (ccp.IsAuditGM = 1 OR ccp.IsAuditGM = 3)" : " ");
 
                 groupCTGGRFeeViews = await _sqlSugar.SqlQueryable<GroupCTGGRFeeView>(CTGGRFeeSql).ToListAsync();