|
@@ -7917,58 +7917,48 @@ WHERE
|
|
|
var groupItems = await _sqlSugar.SqlQueryable<CorporateProfitInfo>(sql).ToArrayAsync();
|
|
|
|
|
|
var dailySql = string.Format(@"SELECT
|
|
|
+ dfp.Id,
|
|
|
+ dfp.CompanyId,
|
|
|
sc.CompanyName,
|
|
|
- SUM(fdfp.SumPrice) 'CNYTotal'
|
|
|
-FROM
|
|
|
- OA2023DB.dbo.Fin_DailyFeePayment fdfp
|
|
|
- LEFT JOIN Sys_Company sc on fdfp.CompanyId = sc.Id
|
|
|
+ sd.DepName AS 'Branch',
|
|
|
+ su.CnName AS 'Applicant',
|
|
|
+ dfp.PriceTypeId,
|
|
|
+ sst.Id AS 'PriceParentTypeId',
|
|
|
+ sst.Name AS 'PriceParentTypeName',
|
|
|
+ ss.Id AS 'PriceTypeId',
|
|
|
+ ss.Name AS 'PriceypeName',
|
|
|
+ dfp.Instructions,
|
|
|
+ dfp.SumPrice AS 'CNYTotal',
|
|
|
+ dfpc.PriceName,
|
|
|
+ dfpc.Quantity,
|
|
|
+ dfpc.Price,
|
|
|
+ dfpc.ItemTotal,
|
|
|
+ dfpc.Remark,
|
|
|
+ dfp.CreateTime
|
|
|
+From
|
|
|
+ Fin_DailyFeePayment dfp
|
|
|
+ INNER JOIN Fin_DailyFeePaymentContent dfpc on dfp.Id = dfpc.DFPId
|
|
|
+ LEFT JOIN Sys_Company sc on dfp.CompanyId = sc.Id
|
|
|
+ LEFT JOIN Sys_Users su on dfp.CreateUserId = su.Id
|
|
|
+ LEFT JOIN Sys_Department sd on su.DepId = sd.Id
|
|
|
+ LEFT JOIN Sys_SetData ss on dfp.PriceTypeId = ss.Id
|
|
|
+ LEFT JOIN Sys_SetDataType sst on ss.STid = sst.Id
|
|
|
WHERE
|
|
|
- fdfp.IsDel = 0
|
|
|
- AND fdfp.IsPay = 1
|
|
|
- AND fdfp.PriceTypeId Not IN (325, 306, 686, 687, 688, 689)
|
|
|
- AND fdfp.CreateTime BETWEEN '{0}' AND '{1}'
|
|
|
-GROUP BY
|
|
|
- sc.CompanyName
|
|
|
+ dfp.IsDel = 0
|
|
|
+ AND dfpc.IsDel = 0
|
|
|
+ AND dfp.CreateTime BETWEEN '{0}' AND '{1}'
|
|
|
+ AND dfp.IsPay = 1
|
|
|
ORDER BY
|
|
|
- CNYTotal ASC", beginDt, endDt);
|
|
|
-
|
|
|
- //var dailyItems = await _sqlSugar.Queryable<Fin_DailyFeePayment, Sys_SetData, Sys_SetDataType, Sys_Company>((dfp, sd, sdt, c) =>
|
|
|
- // new JoinQueryInfos(
|
|
|
- // JoinType.Left, dfp.PriceTypeId == sd.Id,
|
|
|
- // JoinType.Left, sd.STid == sdt.Id,
|
|
|
- // JoinType.Left, dfp.CompanyId == c.Id
|
|
|
- // ))
|
|
|
-
|
|
|
- // .Select((dfp, sd, sdt, c) => new DailyInfo()
|
|
|
- // {
|
|
|
- // Id = dfp.Id,
|
|
|
- // PriceParentTypeId = sdt.Id,
|
|
|
- // PriceParentTypeName = sdt.Name,
|
|
|
- // PriceTypeId = sd.Id,
|
|
|
- // PriceTypeName = sd.Name,
|
|
|
- // CompanyName = c.CompanyName,
|
|
|
- // Instructions = dfp.Instructions,
|
|
|
- // CNYTotal = dfp.SumPrice,
|
|
|
- // PriceInfos = SqlSugar.SqlFunc.Subqueryable<Fin_DailyFeePaymentContent>()
|
|
|
- // .Where(x => x.IsDel == 0 && dfp.Id == x.DFPId)
|
|
|
- // .Select(x => new DailyPriceInfo()
|
|
|
- // {
|
|
|
- // Id = x.Id,
|
|
|
- // DFPId = x.DFPId,
|
|
|
- // PriceName = x.PriceName,
|
|
|
- // Price = x.Price,
|
|
|
- // Quantity = x.Quantity,
|
|
|
- // ItemTotal = x.ItemTotal,
|
|
|
- // Remark = x.Remark
|
|
|
- // }).ToList()
|
|
|
- // })
|
|
|
- // .ToListAsync();
|
|
|
-
|
|
|
- // var
|
|
|
+ dfp.CompanyId,
|
|
|
+ su.DepId,
|
|
|
+ dfp.CreateUserId,
|
|
|
+ dfp.PriceTypeId,
|
|
|
+ dfp.CreateTime ASC", beginDt, endDt);
|
|
|
|
|
|
+ var dailyItems = await _sqlSugar.SqlQueryable<DailyInfo>(dailySql).ToArrayAsync();
|
|
|
|
|
|
view.GroupItems = groupItems;
|
|
|
- //view.DailyItems = dailyItems;
|
|
|
+ view.DailyItems = dailyItems;
|
|
|
return view;
|
|
|
}
|
|
|
|
|
@@ -8012,6 +8002,23 @@ ORDER BY
|
|
|
var groupItems = data.GroupItems;
|
|
|
var dailyItems = data.DailyItems;
|
|
|
|
|
|
+ var priceTypeIds = new List<int>() {
|
|
|
+ 686, //686 信用卡还款
|
|
|
+ 687, //687 张总私人费用
|
|
|
+ 688, //688 代报销社保生育补贴
|
|
|
+ 688, //688 代报销社保生育补贴
|
|
|
+ 306, //306 人事行政费用-张总家用类
|
|
|
+ 325, //325 会展部备用金
|
|
|
+ 689, //689 团组签证保险
|
|
|
+ };
|
|
|
+
|
|
|
+ var companyDailyItems = dailyItems
|
|
|
+ .Where(x => !priceTypeIds.Contains(x.PriceTypeId))
|
|
|
+ .GroupBy(x => x.CompanyName)
|
|
|
+ .Select(g => new { CompanyName = g.Key, CNYTotal = g.Sum(x => x.CNYTotal) })
|
|
|
+ .OrderBy(x => x.CNYTotal)
|
|
|
+ .ToArray();
|
|
|
+
|
|
|
//业务类型
|
|
|
var groupTypeIds = new List<int>() {
|
|
|
38, // 政府团
|
|
@@ -8040,9 +8047,9 @@ ORDER BY
|
|
|
decimal totalProfit = groupProfitTotal + notGroupProfitTotal;
|
|
|
|
|
|
var dailyLabel = $"*不含日付费用类型(信用卡还款、张总私人费用、代报销社保生育补贴、人事行政费用 - 张总家用类、会展部备用金、团组签证保险)\r\n";
|
|
|
- if (dailyItems.Any())
|
|
|
+ if (companyDailyItems.Any())
|
|
|
{
|
|
|
- foreach (var dailyFee in dailyItems)
|
|
|
+ foreach (var dailyFee in companyDailyItems)
|
|
|
{
|
|
|
dailyLabel += $"[{dailyFee.CompanyName}]日常产生费用:{dailyFee.CNYTotal.ToString("#0.00")} CNY \r\n";
|
|
|
}
|