我正在列出当天每种交易类型的总金额我根据给定的规则为每种交易类型做了一个案例陈述,但我需要显示未指定的其他交易的总和
var flagged = from c in db.vw_BMO_Daily
group c by c.DatePosted into dateGroup
select new AccountingSum()
{
Date = dateGroup.Key,
Year = dateGroup.Key.Year,
Month = dateGroup.Key.Month,
Store = dateGroup.Select(x=>x.Store_Id),
BridgeLoan = dateGroup.Sum(x => x.TransactionType == "Miscellaneous Debit" && x.TransactionDescription.Contains("Bridge Loan") ? x.DebitAmount : 0),
FloorPlanPayout = dateGroup.Sum(x => x.TransactionType == "Miscellaneous Debit" && !x.TransactionDescription.Contains("Bridge Loan") ? x.DebitAmount : 0),
FloorPlanEquity = dateGroup.Sum(X => X.TransactionType == "Miscellaneous Credit"? X.CreditAmount:0),
ZBA_Debit_Credit = dateGroup.Sum(x => x.TransactionType.Contains("Zero Balance") ? x.DebitAmount + x.CreditAmount : 0),
ACH = dateGroup.Sum(x => x.TransactionType.Contains("ACH") ? x.CreditAmount + x.DebitAmount : 0),
IncomingWires = dateGroup.Sum(x => x.TransactionType == "Incoming Money Transfer" ? x.CreditAmount : 0),
AccountAnalysis = dateGroup.Sum(x => x.TransactionType == "Account Analysis Fee" ? x.DebitAmount : 0),
CheckPaid = dateGroup.Sum(x => x.TransactionType == "Check Paid" ? x.DebitAmount : 0),
DebitReversal = dateGroup.Sum(x => x.TransactionType == "Debit Reversal" ? x.CreditAmount : 0)
};
最后 2 笔交易的总和“CheckPaid”和“DebitReversal”应该进入“Other”列