|
|
|
@ -76,8 +76,8 @@ namespace DS.WMS.Core.Settlement.Method
|
|
|
|
|
var result = await TenantDb.Queryable<Invoice.Entity.Invoice>()
|
|
|
|
|
.InnerJoin<ApplicationDetail>((a, d) => d.Category == DetailCategory.InvoiceIssuance && a.Id == d.ApplicationId)
|
|
|
|
|
.InnerJoin<FeeRecord>((a, d, f) => d.RecordId == f.Id && (f.FeeStatus == FeeStatus.AuditPassed || f.FeeStatus == FeeStatus.PartialSettlement) &&
|
|
|
|
|
((f.Amount > 0 && d.OriginalAmount - d.OriginalProcessedAmount <= f.Amount - f.SettlementAmount - f.OrderAmount + f.OrderSettlementAmount) ||
|
|
|
|
|
(f.Amount < 0 && d.OriginalAmount - d.OriginalProcessedAmount >= f.Amount - f.SettlementAmount - f.OrderAmount + f.OrderSettlementAmount))
|
|
|
|
|
((f.Amount > 0 && d.OriginalAmount - d.OriginalProcessedAmount > 0 && d.OriginalAmount - d.OriginalProcessedAmount <= f.Amount - f.SettlementAmount - f.OrderAmount + f.OrderSettlementAmount) ||
|
|
|
|
|
(f.Amount < 0 && d.OriginalAmount - d.OriginalProcessedAmount < 0 && d.OriginalAmount - d.OriginalProcessedAmount >= f.Amount - f.SettlementAmount - f.OrderAmount + f.OrderSettlementAmount))
|
|
|
|
|
)
|
|
|
|
|
.GroupBy((a, d, f) => a.Id)
|
|
|
|
|
.Select((a, d, f) => new InvoiceDto
|
|
|
|
|