public List <PaymentHistoryLineItem> GetAmountsOwed() { List <PaymentHistoryLineItem> items = new List <PaymentHistoryLineItem>(); // Expense claims ExpenseClaims expenses = ExpenseClaims.FromClaimingPersonAndOrganization(_person, _authenticationData.CurrentOrganization); foreach (ExpenseClaim claim in expenses) { if (claim.Open || claim.PaidOut) // if both these are false, the claim was denied and shouldn't be listed { PaymentHistoryLineItem newItem = new PaymentHistoryLineItem(); newItem.Id = "E" + claim.Identity.ToString(CultureInfo.InvariantCulture); newItem.Name = String.Format(Resources.Global.Financial_ExpenseClaimLongSpecification, claim.Identity); newItem.Description = claim.Description; newItem.OpenedDate = claim.CreatedDateTime; newItem.OwedToPerson = claim.AmountCents; Payout payout = claim.Payout; if (payout != null && payout.Open == false) { _payoutLookup[payout.Identity] = payout; newItem.ClosedDate = payout.FinancialTransaction.DateTime; } items.Add(newItem); } } // Salaries Salaries salaries = Salaries.ForPersonAndOrganization(_person, _authenticationData.CurrentOrganization, true); foreach (Salary salary in salaries) { if (salary.Open || salary.NetPaid) // either of these must be open for the salary to be valid { PaymentHistoryLineItem newItem = new PaymentHistoryLineItem(); newItem.Id = "S" + salary.Identity.ToString(CultureInfo.InvariantCulture); newItem.Name = Resources.Global.Financial_Salary; newItem.Description = String.Format(Resources.Global.Financial_SalaryDualSpecification, salary.Identity, salary.PayoutDate); newItem.OwedToPerson = salary.NetSalaryCents; FinancialTransaction openTx = FinancialTransaction.FromDependency(salary); if (openTx != null) { newItem.OpenedDate = openTx.DateTime; } Payout payout = Payout.FromDependency(salary, FinancialDependencyType.Salary); if (payout != null && payout.Open == false) { _payoutLookup[payout.Identity] = payout; newItem.ClosedDate = payout.FinancialTransaction.DateTime; } items.Add(newItem); } } // Cash advances CashAdvances advances = CashAdvances.ForPersonAndOrganization(_person, _authenticationData.CurrentOrganization, true); foreach (CashAdvance advance in advances) { if (advance.Open || advance.PaidOut) { Payout payout = advance.PayoutOut; if (payout != null) { _payoutLookup[payout.Identity] = payout; _payoutDescriptionOverride[payout.Identity] = String.Format(Resources.Global.Financial_CashAdvanceSpecification, advance.Identity.ToString("N0")); } } } return(items); }