Phase D: Add Vendor Credits (AP cycle completion)
- VendorCredit, VendorCreditLineItem, VendorCreditApplication entities - VendorCreditStatus enum (Open, PartiallyApplied, Applied, Voided) - Migration AddVendorCredits: three new tables - IUnitOfWork/UnitOfWork wired with all three repositories - VendorCreditsController: Index (status tabs), Create, Details, Post, Apply, Void - Post action: DR AP, CR each expense line (reverses original expense) - Apply action: links credit to bill, updates Bill.AmountPaid and bill status - Views: Index (summary cards + table), Create (dynamic line grid), Details (apply panel) - Nav: Vendor Credits added to Finance section in _Layout Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -146,6 +146,11 @@ public class UnitOfWork : IUnitOfWork
|
||||
private IRepository<JournalEntry>? _journalEntries;
|
||||
private IRepository<JournalEntryLine>? _journalEntryLines;
|
||||
|
||||
// Vendor Credits
|
||||
private IRepository<VendorCredit>? _vendorCredits;
|
||||
private IRepository<VendorCreditLineItem>? _vendorCreditLineItems;
|
||||
private IRepository<VendorCreditApplication>? _vendorCreditApplications;
|
||||
|
||||
/// <summary>
|
||||
/// Initialises the unit of work with the scoped <paramref name="context"/>.
|
||||
/// The context is shared across all repositories created by this instance so that
|
||||
@@ -526,6 +531,19 @@ public class UnitOfWork : IUnitOfWork
|
||||
public IRepository<JournalEntryLine> JournalEntryLines =>
|
||||
_journalEntryLines ??= new Repository<JournalEntryLine>(_context);
|
||||
|
||||
// Vendor Credits
|
||||
/// <summary>Repository for <see cref="VendorCredit"/> credit notes received from vendors; tenant-filtered with soft delete.</summary>
|
||||
public IRepository<VendorCredit> VendorCredits =>
|
||||
_vendorCredits ??= new Repository<VendorCredit>(_context);
|
||||
|
||||
/// <summary>Repository for <see cref="VendorCreditLineItem"/> expense-reversal lines on a vendor credit.</summary>
|
||||
public IRepository<VendorCreditLineItem> VendorCreditLineItems =>
|
||||
_vendorCreditLineItems ??= new Repository<VendorCreditLineItem>(_context);
|
||||
|
||||
/// <summary>Repository for <see cref="VendorCreditApplication"/> records linking a vendor credit to a specific bill.</summary>
|
||||
public IRepository<VendorCreditApplication> VendorCreditApplications =>
|
||||
_vendorCreditApplications ??= new Repository<VendorCreditApplication>(_context);
|
||||
|
||||
/// <summary>
|
||||
/// Flushes all pending changes in the EF Core change tracker to the database.
|
||||
/// Returns the number of state entries written.
|
||||
|
||||
Reference in New Issue
Block a user