This commit is contained in:
Zeeshaun
2026-04-20 14:47:24 -05:00
parent 89057eceea
commit 8b3ea92501
485 changed files with 71042 additions and 0 deletions
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using LCU.API.Collections.RepoApi.Models.Reporting;
using LCU.Shared.Collections.RepoApiLib.Models.Reporting.Responses;
namespace LCU.Shared.Collections.RepoApiLib.Formatting
{
public static class DataTableFormatting
{
public static DataTable CreateDataTable<T>(IEnumerable<T> dataRows, Func<T, int> repoID, params Func<T, ReportHeaderCellMap>[] columns)
{
return new DataTable()
{
Headers = columns.Select(column => column(default(T)).Header).ToArray(),
Rows = dataRows.Select(entry => new RepoAccountReferenceRow()
{
RepoId = repoID(entry),
Cells = columns.Select(column => column(entry).Cell).ToArray()
})
};
}
}
}
@@ -0,0 +1,71 @@
using System;
using LCU.Shared.Collections.RepoApiLib.Models.Reporting.Responses;
namespace LCU.Shared.Collections.RepoApiLib.Formatting
{
public static class ReportCellFormatting
{
public static ReportCell CreateStringCell(string display)
{
return new ReportCell()
{
Display = string.IsNullOrEmpty(display) ? "-" : display
};
}
public static ReportCell CreateIntCell(int? number)
{
return new ReportCell()
{
Display = (number == null || number == 0) ? "-" : number?.ToString(),
Value = number
};
}
public static ReportCell CreateDecimalCell(decimal? number, bool displayZeroValue = false)
{
return new ReportCell()
{
Display = (number == null || (number == 0 && !displayZeroValue)) ? "-" : number?.ToString(),
Value = number
};
}
public static ReportCell CreatePercentageCell(decimal? number, bool isNormalized = false)
{
var display = "-";
if (number != null && number != 0)
{
if (!isNormalized)
{
number = number / 100;
}
display = string.Format(System.Globalization.CultureInfo.InvariantCulture,"{0:P2}", number);
}
return new ReportCell()
{
Display = display,
Value = number
};
}
public static ReportCell CreateDateCell(DateTime? dateTime)
{
return new ReportCell()
{
Display = dateTime?.ToString("MM/dd/yyyy") ?? "-",
Value = dateTime
};
}
public static ReportCell CreateCurrencyCell(decimal? amount)
{
return new ReportCell()
{
Display = (amount == null || amount == 0) ? "-" : string.Format("{0:C}", amount),
Value = amount
};
}
}
}
@@ -0,0 +1,334 @@
using System;
using LCU.API.Collections.RepoApi.Models.Reporting;
using LCU.Shared.Collections.RepoApiLib.Models.Reporting;
namespace LCU.Shared.Collections.RepoApiLib.Formatting
{
public static class StdReportEntryColumns
{
public static Func<StdReportEntry, ReportHeaderCellMap> Member(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Member",
Cell = ReportCellFormatting.CreateStringCell(entry?.IndividualName)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> AccountNo(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Account No",
Cell = ReportCellFormatting.CreateStringCell(entry?.AccountNo)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> AccountCode(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Account Code",
Cell = ReportCellFormatting.CreateStringCell(entry?.AccountTypeCode)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> Balance(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Balance",
Cell = ReportCellFormatting.CreateCurrencyCell(entry?.Balance)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> Status(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Status",
Cell = ReportCellFormatting.CreateStringCell(entry?.Status)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> DaysInStatus(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Days in Status",
Cell = ReportCellFormatting.CreateIntCell(entry?.DaysInStatus)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> Bankruptcy(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Bankruptcy",
Cell = ReportCellFormatting.CreateStringCell(entry?.Bankruptcy)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> Collector(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Collector",
Cell = ReportCellFormatting.CreateStringCell(entry?.Collector)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> DaysCurrentDelq(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Days Current Delq",
Cell = ReportCellFormatting.CreateIntCell(entry?.DaysCurrentDelq)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> DaysDelqWhenAdded(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Days Delq When Added",
Cell = ReportCellFormatting.CreateIntCell(entry?.DaysDelqWhenAdded)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> DelinquentAmount(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Delinquent Amount",
Cell = ReportCellFormatting.CreateCurrencyCell(entry?.DelinquentAmount)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> LastPaymentAmount(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Last Payment Amount",
Cell = ReportCellFormatting.CreateCurrencyCell(entry?.LastPaymentAmount)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> LastPaymentDate(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Last Payment Date",
Cell = ReportCellFormatting.CreateDateCell(entry?.LastPaymentDate)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> Auction(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Auction",
Cell = ReportCellFormatting.CreateStringCell(entry?.AuctionName)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> Collateral(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Collateral",
Cell = ReportCellFormatting.CreateStringCell($"{entry?.Year} {entry?.Make} {entry?.Model}")
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> RepoCompany(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Repo Company",
Cell = ReportCellFormatting.CreateStringCell(entry?.RepoCompany)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> RepoType(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Repo Type",
Cell = ReportCellFormatting.CreateStringCell(entry?.RepoType)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> DateAssigned(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Date Assigned",
Cell = ReportCellFormatting.CreateDateCell(entry?.RepoCompanyAssignmentDate)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> DateRepoed(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Date Repoed",
Cell = ReportCellFormatting.CreateDateCell(entry?.DateRepoed)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> RepoDuration(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Repo Duration",
Cell = ReportCellFormatting.CreateIntCell(entry?.RepoDuration)
};
}
// IMSAutoFile Data
public static Func<StdReportEntry, ReportHeaderCellMap> AutoImsStatus(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "AutoIMS Status",
Cell = ReportCellFormatting.CreateStringCell(entry?.AutoImsStatus)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> DateSold(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Date Sold",
Cell = ReportCellFormatting.CreateDateCell(entry?.SoldDate)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> DateEnteredAutoIMS(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Date Entered AutoIMS",
Cell = ReportCellFormatting.CreateDateCell(entry?.DateEnteredAutoIMS)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> ScheduledSaleDate(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Scheduled Sale Date",
Cell = ReportCellFormatting.CreateDateCell(entry?.ScheduledSaleDate)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> GrossPercentFloor(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Gross % Floor",
Cell = ReportCellFormatting.CreatePercentageCell(entry?.GrossPercentFloor)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> NetPercentFloor(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Net % Floor",
Cell = ReportCellFormatting.CreatePercentageCell(entry?.NetPercentFloor)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> TotalCharges(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Total Charges",
Cell = ReportCellFormatting.CreateCurrencyCell(entry?.TotalCharges)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> Grade(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Grade",
Cell = ReportCellFormatting.CreateDecimalCell(entry?.Grade, true)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> FloorPrice(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Floor Price",
Cell = ReportCellFormatting.CreateCurrencyCell(entry?.FloorPrice)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> GrossSalePrice(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Gross Sale Price",
Cell = ReportCellFormatting.CreateCurrencyCell(entry?.GrossSalePrice)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> FilteredStatus(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Filtered Status",
Cell = ReportCellFormatting.CreateStringCell(entry?.FilteredStatus)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> FilteredStatusChangeDate(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Filtered Status Changed On",
Cell = ReportCellFormatting.CreateDateCell(entry?.FilteredStatusChangeDate)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> O4RDate(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "First O4R",
Cell = ReportCellFormatting.CreateDateCell(entry?.O4RDate)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> SurplusDeficiency(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Surplus / Deficiency",
Cell = ReportCellFormatting.CreateCurrencyCell(entry?.GrossSalePrice - entry?.Balance)
};
}
public static Func<StdReportEntry, ReportHeaderCellMap> AutoIMSAssignmentToSold(string alternateHeader = null)
{
return (StdReportEntry entry) => new ReportHeaderCellMap()
{
Header = alternateHeader ?? "Days AutoIMS to Sold",
Cell = ReportCellFormatting.CreateIntCell(
entry != null ?
(
(entry.DateEnteredAutoIMS != null && entry.SoldDate != null) ?
(int?) (entry.SoldDate.Value - entry.DateEnteredAutoIMS.Value).TotalDays
: null
)
: null
)
};
}
}
}