|
|
@@ -2026,29 +2026,189 @@ namespace OASystem.API.Controllers
|
|
|
|
|
|
// 使用参数化查询避免SQL注入
|
|
|
string sql = @"
|
|
|
- SELECT
|
|
|
- di.id,
|
|
|
- di.TeamName,
|
|
|
- sd.Name AS ModouleName,
|
|
|
- ccp.CTable,
|
|
|
- CASE
|
|
|
- WHEN ccp.CTable = 76 THEN (SELECT hotelname FROM Grp_HotelReservations hr WHERE hr.Id = ccp.CId)
|
|
|
- WHEN ccp.CTable = 79 THEN (SELECT PriceName FROM Grp_CarTouristGuideGroundReservations ctgr WHERE ctgr.Id = ccp.CId)
|
|
|
- WHEN ccp.CTable = 80 THEN (SELECT Area FROM Grp_VisaInfo vi WHERE vi.Id = ccp.CId)
|
|
|
- WHEN ccp.CTable = 81 THEN (SELECT InviterArea FROM Grp_InvitationOfficialActivities ioa WHERE ioa.Id = ccp.CId)
|
|
|
- WHEN ccp.CTable = 82 THEN (SELECT (SELECT GName FROM Grp_InsuranceCost ic WHERE ic.Id = c.Iid) FROM Grp_Customers c WHERE c.Id = ccp.CId)
|
|
|
- WHEN ccp.CTable = 85 THEN (SELECT FlightsCode FROM Grp_AirTicketReservations atr WHERE atr.Id = ccp.CId)
|
|
|
- WHEN ccp.CTable = 98 THEN (SELECT PriceName FROM Grp_DecreasePayments dp WHERE dp.Id = ccp.CId)
|
|
|
- WHEN ccp.CTable = 1015 THEN (SELECT PriceName FROM Fin_GroupExtraCost gec WHERE gec.Id = ccp.CId)
|
|
|
- ELSE '-'
|
|
|
- END AS PriceName,
|
|
|
- (ccp.PayMoney * ccp.DayRate) AS CNYMoeny
|
|
|
- FROM Grp_CreditCardPayment ccp
|
|
|
- INNER JOIN Grp_DelegationInfo di ON ccp.DIId = di.Id
|
|
|
- LEFT JOIN sys_setdata sd ON ccp.CTable = sd.Id
|
|
|
- WHERE ccp.IsDel = 0
|
|
|
- AND di.IsDel = 0
|
|
|
- AND di.id = @GroupId";
|
|
|
+ Select
|
|
|
+ Id,
|
|
|
+ TeamName,
|
|
|
+ CTable,
|
|
|
+ ModuleName,
|
|
|
+ CNYMoney
|
|
|
+ from
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ di.Id,
|
|
|
+ di.TeamName,
|
|
|
+ sd.Name AS ModuleName,
|
|
|
+ ccp.CTable,
|
|
|
+ CASE
|
|
|
+ WHEN ccp.CTable = 76 THEN (
|
|
|
+ SELECT
|
|
|
+ hotelname
|
|
|
+ FROM
|
|
|
+ Grp_HotelReservations hr
|
|
|
+ WHERE
|
|
|
+ hr.Id = ccp.CId
|
|
|
+ and hr.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 79 THEN (
|
|
|
+ SELECT
|
|
|
+ PriceName
|
|
|
+ FROM
|
|
|
+ Grp_CarTouristGuideGroundReservations ctgr
|
|
|
+ WHERE
|
|
|
+ ctgr.Id = ccp.CId
|
|
|
+ and ctgr.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 80 THEN (
|
|
|
+ SELECT
|
|
|
+ Area
|
|
|
+ FROM
|
|
|
+ Grp_VisaInfo vi
|
|
|
+ WHERE
|
|
|
+ vi.Id = ccp.CId
|
|
|
+ and vi.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 81 THEN (
|
|
|
+ SELECT
|
|
|
+ InviterArea
|
|
|
+ FROM
|
|
|
+ Grp_InvitationOfficialActivities ioa
|
|
|
+ WHERE
|
|
|
+ ioa.Id = ccp.CId
|
|
|
+ and ioa.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 82 THEN (
|
|
|
+ SELECT
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ GName
|
|
|
+ FROM
|
|
|
+ Grp_InsuranceCost ic
|
|
|
+ WHERE
|
|
|
+ ic.Id = c.Iid
|
|
|
+ )
|
|
|
+ FROM
|
|
|
+ Grp_Customers c
|
|
|
+ WHERE
|
|
|
+ c.Id = ccp.CId
|
|
|
+ and c.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 85 THEN (
|
|
|
+ SELECT
|
|
|
+ FlightsCode
|
|
|
+ FROM
|
|
|
+ Grp_AirTicketReservations atr
|
|
|
+ WHERE
|
|
|
+ atr.Id = ccp.CId
|
|
|
+ and atr.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 98 THEN (
|
|
|
+ SELECT
|
|
|
+ PriceName
|
|
|
+ FROM
|
|
|
+ Grp_DecreasePayments dp
|
|
|
+ WHERE
|
|
|
+ dp.Id = ccp.CId
|
|
|
+ and dp.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 1015 THEN (
|
|
|
+ SELECT
|
|
|
+ PriceName
|
|
|
+ FROM
|
|
|
+ Fin_GroupExtraCost gec
|
|
|
+ WHERE
|
|
|
+ gec.Id = ccp.CId
|
|
|
+ and gec.IsDel = 0
|
|
|
+ )
|
|
|
+ ELSE '-'
|
|
|
+ END AS PriceName,
|
|
|
+ CASE
|
|
|
+ WHEN ccp.CTable = 76 THEN (
|
|
|
+ SELECT
|
|
|
+ IsDel
|
|
|
+ FROM
|
|
|
+ Grp_HotelReservations hr
|
|
|
+ WHERE
|
|
|
+ hr.Id = ccp.CId
|
|
|
+ and hr.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 79 THEN (
|
|
|
+ SELECT
|
|
|
+ IsDel
|
|
|
+ FROM
|
|
|
+ Grp_CarTouristGuideGroundReservations ctgr
|
|
|
+ WHERE
|
|
|
+ ctgr.Id = ccp.CId
|
|
|
+ and ctgr.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 80 THEN (
|
|
|
+ SELECT
|
|
|
+ IsDel
|
|
|
+ FROM
|
|
|
+ Grp_VisaInfo vi
|
|
|
+ WHERE
|
|
|
+ vi.Id = ccp.CId
|
|
|
+ and vi.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 81 THEN (
|
|
|
+ SELECT
|
|
|
+ IsDel
|
|
|
+ FROM
|
|
|
+ Grp_InvitationOfficialActivities ioa
|
|
|
+ WHERE
|
|
|
+ ioa.Id = ccp.CId
|
|
|
+ and ioa.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 82 THEN (
|
|
|
+ SELECT
|
|
|
+ IsDel
|
|
|
+ FROM
|
|
|
+ Grp_Customers c
|
|
|
+ WHERE
|
|
|
+ c.Id = ccp.CId
|
|
|
+ and c.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 85 THEN (
|
|
|
+ SELECT
|
|
|
+ IsDel
|
|
|
+ FROM
|
|
|
+ Grp_AirTicketReservations atr
|
|
|
+ WHERE
|
|
|
+ atr.Id = ccp.CId
|
|
|
+ and atr.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 98 THEN (
|
|
|
+ SELECT
|
|
|
+ IsDel
|
|
|
+ FROM
|
|
|
+ Grp_DecreasePayments dp
|
|
|
+ WHERE
|
|
|
+ dp.Id = ccp.CId
|
|
|
+ and dp.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 1015 THEN (
|
|
|
+ SELECT
|
|
|
+ IsDel
|
|
|
+ FROM
|
|
|
+ Fin_GroupExtraCost gec
|
|
|
+ WHERE
|
|
|
+ gec.Id = ccp.CId
|
|
|
+ and gec.IsDel = 0
|
|
|
+ )
|
|
|
+ ELSE '1'
|
|
|
+ END AS ChildIsDel,
|
|
|
+ (ccp.PayMoney * ccp.DayRate) AS CNYMoney,
|
|
|
+ ccp.IsDel AS CcpIsDel,
|
|
|
+ di.IsDel AS DiIsDel
|
|
|
+ FROM
|
|
|
+ Grp_CreditCardPayment ccp
|
|
|
+ INNER JOIN Grp_DelegationInfo di ON ccp.DIId = di.Id
|
|
|
+ LEFT JOIN sys_setdata sd ON ccp.CTable = sd.Id
|
|
|
+ ) as view1
|
|
|
+ WHERE
|
|
|
+ DiIsDel = 0
|
|
|
+ AND ChildIsDel = 0
|
|
|
+ AND DiIsDel = 0
|
|
|
+ AND Id = @GroupId";
|
|
|
|
|
|
try
|
|
|
{
|
|
|
@@ -2058,12 +2218,12 @@ namespace OASystem.API.Controllers
|
|
|
|
|
|
// 分组统计并排序
|
|
|
var feeDatas = datas
|
|
|
- .GroupBy(g => new { g.CTable, g.ModouleName })
|
|
|
+ .GroupBy(g => new { g.CTable, g.ModuleName })
|
|
|
.Select(s => new SyntheticalReceivableFeeDetailsView
|
|
|
{
|
|
|
- ModouleName = s.Key.ModouleName ?? "未知模块",
|
|
|
+ ModuleName = s.Key.ModuleName ?? "未知模块",
|
|
|
CTable = s.Key.CTable,
|
|
|
- CNYMoeny = s.Sum(ss => ss.CNYMoeny)
|
|
|
+ CNYMoney = s.Sum(ss => ss.CNYMoney)
|
|
|
})
|
|
|
.OrderBy(x => x.CTable)
|
|
|
.ToList();
|
|
|
@@ -2072,7 +2232,7 @@ namespace OASystem.API.Controllers
|
|
|
var feeLabel = new StringBuilder();
|
|
|
foreach (var item in feeDatas)
|
|
|
{
|
|
|
- feeLabel.AppendLine($"{item.ModouleName} :{item.CNYMoeny:#,##0.00} CNY");
|
|
|
+ feeLabel.AppendLine($"{item.ModuleName} :{item.CNYMoney:#,##0.00} CNY");
|
|
|
feeLabel.AppendLine(); // 空行
|
|
|
}
|
|
|
|
|
|
@@ -2198,29 +2358,189 @@ namespace OASystem.API.Controllers
|
|
|
//查询团组各模块费用信息
|
|
|
|
|
|
string sql = @"
|
|
|
- SELECT
|
|
|
- di.Id,
|
|
|
- di.TeamName,
|
|
|
- sd.Name AS ModouleName,
|
|
|
- ccp.CTable,
|
|
|
- CASE
|
|
|
- WHEN ccp.CTable = 76 THEN (SELECT hotelname FROM Grp_HotelReservations hr WHERE hr.Id = ccp.CId)
|
|
|
- WHEN ccp.CTable = 79 THEN (SELECT PriceName FROM Grp_CarTouristGuideGroundReservations ctgr WHERE ctgr.Id = ccp.CId)
|
|
|
- WHEN ccp.CTable = 80 THEN (SELECT Area FROM Grp_VisaInfo vi WHERE vi.Id = ccp.CId)
|
|
|
- WHEN ccp.CTable = 81 THEN (SELECT InviterArea FROM Grp_InvitationOfficialActivities ioa WHERE ioa.Id = ccp.CId)
|
|
|
- WHEN ccp.CTable = 82 THEN (SELECT (SELECT GName FROM Grp_InsuranceCost ic WHERE ic.Id = c.Iid) FROM Grp_Customers c WHERE c.Id = ccp.CId)
|
|
|
- WHEN ccp.CTable = 85 THEN (SELECT FlightsCode FROM Grp_AirTicketReservations atr WHERE atr.Id = ccp.CId)
|
|
|
- WHEN ccp.CTable = 98 THEN (SELECT PriceName FROM Grp_DecreasePayments dp WHERE dp.Id = ccp.CId)
|
|
|
- WHEN ccp.CTable = 1015 THEN (SELECT PriceName FROM Fin_GroupExtraCost gec WHERE gec.Id = ccp.CId)
|
|
|
+ Select
|
|
|
+ Id,
|
|
|
+ TeamName,
|
|
|
+ CTable,
|
|
|
+ ModuleName,
|
|
|
+ CNYMoney
|
|
|
+ from
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ di.Id,
|
|
|
+ di.TeamName,
|
|
|
+ sd.Name AS ModuleName,
|
|
|
+ ccp.CTable,
|
|
|
+ CASE
|
|
|
+ WHEN ccp.CTable = 76 THEN (
|
|
|
+ SELECT
|
|
|
+ hotelname
|
|
|
+ FROM
|
|
|
+ Grp_HotelReservations hr
|
|
|
+ WHERE
|
|
|
+ hr.Id = ccp.CId
|
|
|
+ and hr.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 79 THEN (
|
|
|
+ SELECT
|
|
|
+ PriceName
|
|
|
+ FROM
|
|
|
+ Grp_CarTouristGuideGroundReservations ctgr
|
|
|
+ WHERE
|
|
|
+ ctgr.Id = ccp.CId
|
|
|
+ and ctgr.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 80 THEN (
|
|
|
+ SELECT
|
|
|
+ Area
|
|
|
+ FROM
|
|
|
+ Grp_VisaInfo vi
|
|
|
+ WHERE
|
|
|
+ vi.Id = ccp.CId
|
|
|
+ and vi.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 81 THEN (
|
|
|
+ SELECT
|
|
|
+ InviterArea
|
|
|
+ FROM
|
|
|
+ Grp_InvitationOfficialActivities ioa
|
|
|
+ WHERE
|
|
|
+ ioa.Id = ccp.CId
|
|
|
+ and ioa.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 82 THEN (
|
|
|
+ SELECT
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ GName
|
|
|
+ FROM
|
|
|
+ Grp_InsuranceCost ic
|
|
|
+ WHERE
|
|
|
+ ic.Id = c.Iid
|
|
|
+ )
|
|
|
+ FROM
|
|
|
+ Grp_Customers c
|
|
|
+ WHERE
|
|
|
+ c.Id = ccp.CId
|
|
|
+ and c.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 85 THEN (
|
|
|
+ SELECT
|
|
|
+ FlightsCode
|
|
|
+ FROM
|
|
|
+ Grp_AirTicketReservations atr
|
|
|
+ WHERE
|
|
|
+ atr.Id = ccp.CId
|
|
|
+ and atr.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 98 THEN (
|
|
|
+ SELECT
|
|
|
+ PriceName
|
|
|
+ FROM
|
|
|
+ Grp_DecreasePayments dp
|
|
|
+ WHERE
|
|
|
+ dp.Id = ccp.CId
|
|
|
+ and dp.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 1015 THEN (
|
|
|
+ SELECT
|
|
|
+ PriceName
|
|
|
+ FROM
|
|
|
+ Fin_GroupExtraCost gec
|
|
|
+ WHERE
|
|
|
+ gec.Id = ccp.CId
|
|
|
+ and gec.IsDel = 0
|
|
|
+ )
|
|
|
ELSE '-'
|
|
|
- END AS PriceName,
|
|
|
- (ccp.PayMoney * ccp.DayRate) AS CNYMoeny
|
|
|
- FROM Grp_CreditCardPayment ccp
|
|
|
- INNER JOIN Grp_DelegationInfo di ON ccp.DIId = di.Id
|
|
|
- LEFT JOIN sys_setdata sd ON ccp.CTable = sd.Id
|
|
|
- WHERE ccp.IsDel = 0
|
|
|
- AND di.IsDel = 0
|
|
|
- AND di.Id IN (@GroupIds)";
|
|
|
+ END AS PriceName,
|
|
|
+ CASE
|
|
|
+ WHEN ccp.CTable = 76 THEN (
|
|
|
+ SELECT
|
|
|
+ IsDel
|
|
|
+ FROM
|
|
|
+ Grp_HotelReservations hr
|
|
|
+ WHERE
|
|
|
+ hr.Id = ccp.CId
|
|
|
+ and hr.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 79 THEN (
|
|
|
+ SELECT
|
|
|
+ IsDel
|
|
|
+ FROM
|
|
|
+ Grp_CarTouristGuideGroundReservations ctgr
|
|
|
+ WHERE
|
|
|
+ ctgr.Id = ccp.CId
|
|
|
+ and ctgr.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 80 THEN (
|
|
|
+ SELECT
|
|
|
+ IsDel
|
|
|
+ FROM
|
|
|
+ Grp_VisaInfo vi
|
|
|
+ WHERE
|
|
|
+ vi.Id = ccp.CId
|
|
|
+ and vi.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 81 THEN (
|
|
|
+ SELECT
|
|
|
+ IsDel
|
|
|
+ FROM
|
|
|
+ Grp_InvitationOfficialActivities ioa
|
|
|
+ WHERE
|
|
|
+ ioa.Id = ccp.CId
|
|
|
+ and ioa.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 82 THEN (
|
|
|
+ SELECT
|
|
|
+ IsDel
|
|
|
+ FROM
|
|
|
+ Grp_Customers c
|
|
|
+ WHERE
|
|
|
+ c.Id = ccp.CId
|
|
|
+ and c.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 85 THEN (
|
|
|
+ SELECT
|
|
|
+ IsDel
|
|
|
+ FROM
|
|
|
+ Grp_AirTicketReservations atr
|
|
|
+ WHERE
|
|
|
+ atr.Id = ccp.CId
|
|
|
+ and atr.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 98 THEN (
|
|
|
+ SELECT
|
|
|
+ IsDel
|
|
|
+ FROM
|
|
|
+ Grp_DecreasePayments dp
|
|
|
+ WHERE
|
|
|
+ dp.Id = ccp.CId
|
|
|
+ and dp.IsDel = 0
|
|
|
+ )
|
|
|
+ WHEN ccp.CTable = 1015 THEN (
|
|
|
+ SELECT
|
|
|
+ IsDel
|
|
|
+ FROM
|
|
|
+ Fin_GroupExtraCost gec
|
|
|
+ WHERE
|
|
|
+ gec.Id = ccp.CId
|
|
|
+ and gec.IsDel = 0
|
|
|
+ )
|
|
|
+ ELSE '1'
|
|
|
+ END AS ChildIsDel,
|
|
|
+ (ccp.PayMoney * ccp.DayRate) AS CNYMoney,
|
|
|
+ ccp.IsDel AS CcpIsDel,
|
|
|
+ di.IsDel AS DiIsDel
|
|
|
+ FROM
|
|
|
+ Grp_CreditCardPayment ccp
|
|
|
+ INNER JOIN Grp_DelegationInfo di ON ccp.DIId = di.Id
|
|
|
+ LEFT JOIN sys_setdata sd ON ccp.CTable = sd.Id
|
|
|
+ ) as view1
|
|
|
+ WHERE
|
|
|
+ DiIsDel = 0
|
|
|
+ AND ChildIsDel = 0
|
|
|
+ AND DiIsDel = 0
|
|
|
+ AND Id IN (@GroupIds)";
|
|
|
|
|
|
var groupIds = list_rst.Select(x => x.diid).ToList();
|
|
|
var datas = _sqlSugar.SqlQueryable<SyntheticalReceivableFeeDetailsView>(sql)
|
|
|
@@ -2303,17 +2623,17 @@ namespace OASystem.API.Controllers
|
|
|
|
|
|
var currDatas = datas.Where(w => w.Id == diId).ToList();
|
|
|
|
|
|
- decimal totalCost = currDatas.Sum(s => s.CNYMoeny);
|
|
|
+ decimal totalCost = currDatas.Sum(s => s.CNYMoney);
|
|
|
if (totalCost > 0m)
|
|
|
{
|
|
|
// 分组统计并排序
|
|
|
- var feeDatas1 = datas
|
|
|
- .GroupBy(g => new { g.CTable, g.ModouleName })
|
|
|
+ var feeDatas1 = currDatas
|
|
|
+ .GroupBy(g => new { g.CTable, g.ModuleName })
|
|
|
.Select(s => new SyntheticalReceivableFeeDetailsView
|
|
|
{
|
|
|
- ModouleName = s.Key.ModouleName ?? "未知模块",
|
|
|
+ ModuleName = s.Key.ModuleName ?? "未知模块",
|
|
|
CTable = s.Key.CTable,
|
|
|
- CNYMoeny = s.Sum(ss => ss.CNYMoeny)
|
|
|
+ CNYMoney = s.Sum(ss => ss.CNYMoney)
|
|
|
})
|
|
|
.OrderBy(x => x.CTable)
|
|
|
.ToList();
|
|
|
@@ -2323,7 +2643,7 @@ namespace OASystem.API.Controllers
|
|
|
foreach (var item in feeDatas1)
|
|
|
{
|
|
|
feeLabel.AppendLine(); // 空行
|
|
|
- feeLabel.AppendLine($"{item.ModouleName} :{item.CNYMoeny:#,##0.00} CNY");
|
|
|
+ feeLabel.AppendLine($"{item.ModuleName} :{item.CNYMoney:#,##0.00} CNY");
|
|
|
}
|
|
|
|
|
|
//item_rst.isChangeColorRed = false; //红色/橙色只显示一个
|