Add Project Name field to invoice create and edit forms

Stores ProjectName on the Invoice entity (previously only inherited from the
linked job at display time). Pre-fills from the job when creating from a job.
Migration: AddInvoiceProjectName.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-09 08:50:02 -04:00
parent 9f1460c9c0
commit 9367e358d9
9 changed files with 11265 additions and 4 deletions
@@ -372,6 +372,7 @@ public class InvoicesController : Controller
dto.JobId = job.Id;
dto.CustomerId = job.CustomerId;
dto.CustomerPO = job.CustomerPO;
dto.ProjectName = job.ProjectName;
// Resolve catalog item revenue accounts for pre-population
var catalogItemIds = job.JobItems
@@ -710,6 +711,7 @@ public class InvoicesController : Controller
InternalNotes = dto.InternalNotes,
Terms = dto.Terms,
CustomerPO = dto.CustomerPO,
ProjectName = dto.ProjectName,
CompanyId = currentUser.CompanyId,
CreatedAt = DateTime.UtcNow,
CreatedBy = currentUser.Email
@@ -901,6 +903,7 @@ public class InvoicesController : Controller
InternalNotes = invoice.InternalNotes,
Terms = invoice.Terms,
CustomerPO = invoice.CustomerPO,
ProjectName = invoice.ProjectName,
InvoiceItems = invoice.InvoiceItems
.Where(i => !i.IsDeleted)
.OrderBy(i => i.DisplayOrder)
@@ -1036,6 +1039,7 @@ public class InvoicesController : Controller
invoice.InternalNotes = dto.InternalNotes;
invoice.Terms = dto.Terms;
invoice.CustomerPO = dto.CustomerPO;
invoice.ProjectName = dto.ProjectName;
invoice.UpdatedAt = DateTime.UtcNow;
invoice.UpdatedBy = currentUser?.Email;