Fix 4 post-review issues found in accounting module audit

- Drop orphan VendorCreditId1 column from VendorCreditApplications (was
  scaffolded by EF because WithMany() lacked inverse navigation name;
  fixed WithMany() → WithMany(vc => vc.Applications) in ApplicationDbContext)
- Wire EarlyPaymentDiscount fields through full data path: added
  EarlyPaymentDiscountPercent/Days to CreateInvoiceDto, hidden inputs to
  Invoice Create view, and JS to populate from customer AJAX response
- Add missing [HttpGet] attribute to TaxRatesController.Index
- Document GenerateNow architecture exception with XML rationale

Migration DropOrphanVendorCreditId1 applied. Build: 0 errors, 168 warnings.
Unit tests: 200/200 passing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-10 11:32:44 -04:00
parent 14026818e2
commit d94612cc9c
8 changed files with 10296 additions and 15 deletions
@@ -6293,7 +6293,7 @@ namespace PowderCoating.Infrastructure.Migrations
{
Id = 1,
CompanyId = 0,
CreatedAt = new DateTime(2026, 5, 10, 15, 1, 54, 769, DateTimeKind.Utc).AddTicks(6262),
CreatedAt = new DateTime(2026, 5, 10, 15, 25, 26, 831, DateTimeKind.Utc).AddTicks(199),
Description = "Standard pricing for regular customers",
DiscountPercent = 0m,
IsActive = true,
@@ -6304,7 +6304,7 @@ namespace PowderCoating.Infrastructure.Migrations
{
Id = 2,
CompanyId = 0,
CreatedAt = new DateTime(2026, 5, 10, 15, 1, 54, 769, DateTimeKind.Utc).AddTicks(6270),
CreatedAt = new DateTime(2026, 5, 10, 15, 25, 26, 831, DateTimeKind.Utc).AddTicks(205),
Description = "5% discount for preferred customers",
DiscountPercent = 5m,
IsActive = true,
@@ -6315,7 +6315,7 @@ namespace PowderCoating.Infrastructure.Migrations
{
Id = 3,
CompanyId = 0,
CreatedAt = new DateTime(2026, 5, 10, 15, 1, 54, 769, DateTimeKind.Utc).AddTicks(6271),
CreatedAt = new DateTime(2026, 5, 10, 15, 25, 26, 831, DateTimeKind.Utc).AddTicks(206),
Description = "10% discount for premium customers",
DiscountPercent = 10m,
IsActive = true,
@@ -8171,17 +8171,12 @@ namespace PowderCoating.Infrastructure.Migrations
b.Property<int>("VendorCreditId")
.HasColumnType("int");
b.Property<int?>("VendorCreditId1")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("BillId");
b.HasIndex("VendorCreditId");
b.HasIndex("VendorCreditId1");
b.ToTable("VendorCreditApplications");
});
@@ -9883,15 +9878,11 @@ namespace PowderCoating.Infrastructure.Migrations
.IsRequired();
b.HasOne("PowderCoating.Core.Entities.VendorCredit", "VendorCredit")
.WithMany()
.WithMany("Applications")
.HasForeignKey("VendorCreditId")
.OnDelete(DeleteBehavior.NoAction)
.IsRequired();
b.HasOne("PowderCoating.Core.Entities.VendorCredit", null)
.WithMany("Applications")
.HasForeignKey("VendorCreditId1");
b.Navigation("Bill");
b.Navigation("VendorCredit");