} // constructor public void Update(EarnedInterestRow v) { if (m_oClientCount.ContainsKey(v.ClientID)) { m_oClientCount[v.ClientID]++; } else { m_oClientCount[v.ClientID] = 1; } if (m_oLoanCount.ContainsKey(v.LoanID)) { m_oLoanCount[v.LoanID]++; } else { m_oLoanCount[v.LoanID] = 1; } EarnedInterest += v.EarnedInterest; LoanAmount += v.LoanAmount; TotalRepaid += v.TotalRepaid; PrincipalRepaid += v.PrincipalRepaid; SetupFees += v.SetupFees; OtherFees += v.OtherFees; Rollover += v.Rollover; } // Update
} // BuildEarnedInterestXls private KeyValuePair <ReportQuery, DataTable> CreateEarnedInterestReport(Report report, bool bAccountingMode, DateTime today, DateTime tomorrow) { var ea = new EarnedInterest.EarnedInterest(DB, EarnedInterest.EarnedInterest.WorkingMode.ForPeriod, bAccountingMode, today, tomorrow, this); SortedDictionary <int, decimal> earned = ea.Run(); var rpt = new ReportQuery(report) { DateStart = today, DateEnd = tomorrow }; var oTotal = new EarnedInterestRow(true, CustomerStatus.Enabled, CustomerStatus.Enabled); var oRows = new List <EarnedInterestRow>(); rpt.Execute(DB, (sr, bRowsetStart) => { int nLoanID = sr["LoanID"]; if (!earned.ContainsKey(nLoanID)) { return(ActionResult.Continue); } int nClientID = sr["ClientID"]; var oNewRow = new EarnedInterestRow(false, ea.CustomerStatusHistory.Data.GetLast(nClientID).NewStatus, ea.CustomerStatusHistory.GetCurrent(nClientID).NewStatus) { IssueDate = sr["IssueDate"], ClientID = nClientID, LoanID = nLoanID, ClientName = sr["ClientName"], ClientEmail = sr["ClientEmail"], EarnedInterest = earned[nLoanID], LoanAmount = sr["LoanAmount"], TotalRepaid = sr["TotalRepaid"], PrincipalRepaid = sr["PrincipalRepaid"], SetupFees = sr["SetupFees"], OtherFees = sr["OtherFees"], Rollover = sr["Rollover"], }; oTotal.Update(oNewRow); oRows.Add(oNewRow); return(ActionResult.Continue); }); // for each earned interest oRows.Sort(EarnedInterestRow.Compare); DataTable oOutput = oTotal.ToTable(); oRows.ForEach(r => r.ToRow(oOutput)); return(new KeyValuePair <ReportQuery, DataTable>(rpt, oOutput)); } // CreateEarnedInterestReport
public static int Compare(EarnedInterestRow a, EarnedInterestRow b) { int c = DateTime.Compare(a.IssueDate, b.IssueDate); return((c != 0) ? c : string.CompareOrdinal(a.ClientName, b.ClientName)); } // Compare