|
@@ -33,7 +33,7 @@ namespace SMP.Data.Finance
|
|
|
Task ClearIncidentals(int LadingBillId, AmountType amountType = AmountType.应付);
|
|
|
|
|
|
Task<IEnumerable<Finance_Logistics_LadingBill>> QueryByLadingBillNumbers(IEnumerable<string> ladingBillNumbers);
|
|
|
- Task<IEnumerable<LadingBillCost>> GetLadingBillCost(int month, int publicId);
|
|
|
+ Task<IEnumerable<LadingBillCost>> GetLadingBillCost(string month, int publicId);
|
|
|
#endregion
|
|
|
#region 订单成本(作废)
|
|
|
//Task CreateCostTable(string BillTypeCode);
|
|
@@ -117,32 +117,34 @@ where rowNum=1 ");
|
|
|
}
|
|
|
|
|
|
[NonTrans]
|
|
|
- public async Task<IEnumerable<LadingBillCost>> GetLadingBillCost(int month,int publicId)
|
|
|
+ public async Task<IEnumerable<LadingBillCost>> GetLadingBillCost(string month, int publicId)
|
|
|
{
|
|
|
- DateTime start = new DateTime(DateTime.Now.Year, month, 1);
|
|
|
+ DateTime start = DateTime.Parse(month + "-01");
|
|
|
DateTime end = start.AddMonths(1);
|
|
|
- string sql = @" with t1 as(
|
|
|
- select b.LadingBillNumber,f.Name,sum(c.SettlementAmount)SettlementAmount,CONVERT(nvarchar(7),ReceiveTime,120 ) as [Month] from
|
|
|
+ string sql = @" with t1 as(
|
|
|
+ select b.LadingBillNumber,g.BillName,f.Name,sum(c.SettlementAmount)SettlementAmount,CONVERT(nvarchar(7),ReceiveTime,120 ) as [Month] from
|
|
|
(select LadingBillNumber
|
|
|
- from Logistisc_Order(nolock) where PublicChannelId = @publicId and ReceiveTime between @start and @end
|
|
|
+ from Logistisc_Order(nolock) where PublicChannelId=@publicId and ReceiveTime between @start and @end
|
|
|
group by LadingBillNumber)as a
|
|
|
- join Logistisc_Order(nolock)b on PublicChannelId =@publicId and a.LadingBillNumber=b.LadingBillNumber
|
|
|
+ join Logistisc_Order(nolock)b on PublicChannelId=@publicId and a.LadingBillNumber=b.LadingBillNumber
|
|
|
join Compute_ExpenseAmount(nolock)c on c.Number = b.SystemNo and c.CostType=1
|
|
|
join Compute_ExpenseAmountBatchOperation(nolock) d on d.BatchNo = c.BatchNo
|
|
|
join Compute_ExpenseItem(nolock)e on c.ExpenseItemId=e.Id
|
|
|
join Compute_ExpenseItemCategory(nolock)f on f.Id=e.CategoryId
|
|
|
- group by b.LadingBillNumber,f.Name,CONVERT(nvarchar(7),ReceiveTime,120 ))
|
|
|
+ left join Finance_ServiceBillSpreadApply(nolock)g on g.Id = c.ServiceBillSpreadApplyId
|
|
|
+ group by g.BillName,b.LadingBillNumber,f.Name,CONVERT(nvarchar(7),ReceiveTime,120 ))
|
|
|
|
|
|
select * from (
|
|
|
- select 提单=LadingBillNumber,类目=Name,费用=SettlementAmount,月份=[MONTH] from t1
|
|
|
+ select 提单=LadingBillNumber,类目=Name,费用=SettlementAmount,月份=[MONTH],账单=BillName from t1
|
|
|
+ where Name <>'尾程派送费' and Name<>'全程派送费用'
|
|
|
)a
|
|
|
pivot
|
|
|
(
|
|
|
- sum(a.费用) for a.类目 in(空运成本,尾程派送费,海外清关,出口报关,全程派送费用,中转成本)
|
|
|
+ sum(a.费用) for a.类目 in(空运成本,海外清关,出口报关,中转成本)
|
|
|
)p
|
|
|
- order by 提单,月份
|
|
|
+ order by 账单,提单,月份
|
|
|
";
|
|
|
- var result = await _unitOfWork.Connection.QueryAsync<LadingBillCost>(sql, new { start, end, publicId }, _unitOfWork.Transaction, null);
|
|
|
+ var result = await _unitOfWork.Connection.QueryAsync<LadingBillCost>(sql, new { start, end, publicId }, _unitOfWork.Transaction, 60);
|
|
|
return result;
|
|
|
}
|
|
|
|