📄 IrbyImaging.UI.Models.Billing.cs Documentation
📖 Table of Contents
- Overview & Purpose
- Dependencies & Technologies
- Data Model Overview
3.1 Billing Class
3.2 BillingInfo Class
3.3 Month Enum - UML Class Diagram
- Key Functional Areas
- Usage Examples
- Conclusion & Next Steps
1. Overview & Purpose 🚀
The Billing.cs file defines the view models used by the IrbyImaging UI for rendering and managing billing data in ASP.NET Core MVC. This includes:
- A
Billingmodel that carries filtering criteria, drop‑down lists, search results, and metadata. - A lightweight
BillingInfomodel for aggregating invoice summaries. - A
Monthenumeration representing calendar months.
These models are passed between Controllers and Razor Views to display carrier invoices, filter by date, and present billing summaries.
2. Dependencies & Technologies 🛠️
| Dependency | Purpose |
|---|---|
IrbyImaging.DomainClasses |
Domain entities: CarrierTypeDetail, BillingInvoice |
Microsoft.AspNetCore.Mvc.Rendering |
SelectListItem for populating drop‑down lists |
System, System.Collections.Generic, |
Core types (Guid, DateTime, List<T>, etc.) |
System.Linq, System.Threading.Tasks |
LINQ operations and async support (if extended) |
3. Data Model Overview 📊
3.1 Billing Class
namespace IrbyImaging.UI.Models
{
/// <summary>
/// Carries criteria, lookup lists, and search results for Carrier Billing.
/// </summary>
public class Billing
{
public Guid Id { get; set; }
public string CarrierId { get; set; }
public List<SelectListItem> Carrier { get; set; }
public string CarrierName { get; set; }
public Month InvoiceMonth { get; set; }
public string InvoiceYear { get; set; }
public string InvoiceYearMonth { get; set; }
public string PhoneNumber { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string FullName { get; set; }
public string JDENumber { get; set; }
public decimal Charge { get; set; }
public string JobNumber { get; set; }
public string JobName { get; set; }
public string FileName { get; set; }
public Guid GeneralLedgerId { get; set; }
public string AddedBy { get; set; }
public DateTime AddedDate { get; set; }
public string ModifiedBy { get; set; }
public DateTime ModifiedDate { get; set; }
public bool IsEmployeeNumberNull { get; set; }
public bool IsJobNumberNull { get; set; }
public List<CarrierTypeDetail> CarriersTypeDetail { get; set; }
public List<BillingInvoice> SearchResults { get; set; }
public List<BillingInfo> BillingInfos { get; set; }
}
}
| Property | Type | Description |
|---|---|---|
Id |
Guid |
Unique identifier for billing entry. |
CarrierId |
string |
Selected carrier’s identifier (e.g., GUID string). |
Carrier |
List<SelectListItem> |
Drop‑down list items for carriers. |
CarrierName |
string |
Friendly name of the selected carrier. |
InvoiceMonth |
Month |
Month of the invoice. |
InvoiceYear |
string |
Year of the invoice (e.g., "2022"). |
InvoiceYearMonth |
string |
Combined "YYYY-MM" for filtering and display. |
PhoneNumber |
string |
Contact phone number. |
FirstName, LastName |
string |
Contact person’s name. |
FullName |
string |
Concatenation of first and last name. |
JDENumber |
string |
JDE (JD Edwards) customer number. |
Charge |
decimal |
Total charge amount. |
JobNumber, JobName |
string |
Project/job reference. |
FileName |
string |
Original invoice file name. |
GeneralLedgerId |
Guid |
Ledger reference ID. |
AddedBy, ModifiedBy |
string |
Username of creator/modifier. |
AddedDate, ModifiedDate |
DateTime |
Timestamps for auditing. |
IsEmployeeNumberNull |
bool |
Indicates missing employee number. |
IsJobNumberNull |
bool |
Indicates missing job number. |
CarriersTypeDetail |
List<CarrierTypeDetail> |
Extra metadata from domain. |
SearchResults |
List<BillingInvoice> |
Results of a billing invoice search. |
BillingInfos |
List<BillingInfo> |
Aggregated per‑month/per‑carrier summaries. |
3.2 BillingInfo Class
public class BillingInfo
{
public string YearMonth { get; set; }
public string Carrier { get; set; }
public decimal Charge { get; set; }
public int Devices { get; set; }
public DateTime AddedDate { get; set; }
}
| Property | Type | Description |
|---|---|---|
YearMonth |
string |
e.g., "2022-03", grouping key for summaries. |
Carrier |
string |
Friendly carrier name. |
Charge |
decimal |
Total charge for that month/carrier. |
Devices |
int |
Number of devices billed. |
AddedDate |
DateTime |
When this summary row was generated. |
3.3 Month Enum
public enum Month
{
January, February, March, April,
May, June, July, August,
September, October, November, December
}
This Month enum provides compile‑time safety when selecting invoice months in the UI.
4. UML Class Diagram 📐
classDiagram
class Billing {
+Guid Id
+string CarrierId
+List<SelectListItem> Carrier
+string CarrierName
+Month InvoiceMonth
+string InvoiceYear
+string InvoiceYearMonth
+string PhoneNumber
+string FirstName
+string LastName
+string FullName
+string JDENumber
+decimal Charge
+string JobNumber
+string JobName
+string FileName
+Guid GeneralLedgerId
+string AddedBy
+DateTime AddedDate
+string ModifiedBy
+DateTime ModifiedDate
+bool IsEmployeeNumberNull
+bool IsJobNumberNull
+List<CarrierTypeDetail> CarriersTypeDetail
+List<BillingInvoice> SearchResults
+List<BillingInfo> BillingInfos
}
class BillingInfo {
+string YearMonth
+string Carrier
+decimal Charge
+int Devices
+DateTime AddedDate
}
class Month {
<<enumeration>>
January
February
March
April
May
June
July
August
September
October
November
December
}
Billing --> "0..*" BillingInfo
Billing --> "0..*" BillingInvoice : SearchResults
Billing --> "0..*" CarrierTypeDetail
5. Key Functional Areas 🔑
-
Filtering & Selection
- Drop‑down list of carriers (
Carrier : List<SelectListItem>) - Month/Year selection (
InvoiceMonth,InvoiceYear)
- Drop‑down list of carriers (
-
Search Results
- Raw invoice list (
SearchResults : List<BillingInvoice>) - Aggregated summaries (
BillingInfos : List<BillingInfo>)
- Raw invoice list (
-
Metadata & Auditing
- Record IDs, file names, JDE numbers
- Audit fields (
AddedBy,ModifiedBy, timestamps)
-
Null‑Safety Flags
IsEmployeeNumberNull,IsJobNumberNullinform the view about missing data
6. Usage Examples 💡
6.1 Populating the Billing Model in a Controller
public async Task<IActionResult> Index(string carrierId, Month? month, string year)
{
var model = new Billing
{
// 1. Populate Carrier drop‑down
Carrier = await _carrierService.GetAll()
.Select(c => new SelectListItem { Value = c.Id.ToString(), Text = c.Name })
.ToListAsync(),
// 2. Bind search/filter criteria
CarrierId = carrierId,
InvoiceMonth = month ?? Month.January,
InvoiceYear = year ?? DateTime.UtcNow.Year.ToString(),
// 3. Fetch invoices and summaries
SearchResults = await _billingService.GetInvoicesAsync(carrierId, month, year),
BillingInfos = await _billingService.GetMonthlySummariesAsync(year)
};
return View(model);
}
6.2 Displaying in Razor View
@model IrbyImaging.UI.Models.Billing
<form asp-action="Index" method="get">
<select asp-for="CarrierId" asp-items="Model.Carrier">
<option value="">-- Select Carrier --</option>
</select>
<select asp-for="InvoiceMonth">
@foreach (var m in Enum.GetValues(typeof(Month)))
{
<option value="@m">@m</option>
}
</select>
<input type="text" asp-for="InvoiceYear" placeholder="YYYY" />
<button type="submit">🔍 Search</button>
</form>
<table>
<thead>
<tr>
<th>Invoice #</th><th>Charge</th><th>Date</th>
</tr>
</thead>
<tbody>
@foreach (var inv in Model.SearchResults)
{
<tr>
<td>@inv.InvoiceNumber</td>
<td>@inv.Charge:C</td>
<td>@inv.InvoiceDate:yyyy-MM-dd</td>
</tr>
}
</tbody>
</table>
7. Conclusion & Next Steps ✔️
- Billing.cs provides a rich view model for carrier invoice management in the IrbyImaging UI.
- Leverage its filtering, search results, and summaries in Razor views to build interactive billing dashboards.
- Extend as needed:
- Add validation attributes (e.g.,
[Required],[Range]) on select properties - Introduce helper methods for converting
InvoiceYearMonthtoDateTime - Implement paging on
SearchResultsvia a paged list utility
- Add validation attributes (e.g.,
🎉 You’re now ready to integrate, render, and manage billing data seamlessly in your ASP.NET Core MVC application!