Add facility overhead (rent + utilities) to operating costs and pricing engine

Adds MonthlyRent, MonthlyUtilities, and MonthlyBillableHours to CompanyOperatingCosts so fixed shop occupancy costs are recovered on every quote. The pricing engine converts these into a per-hour rate and applies it as a transparent "Facility Overhead" line between oven batch cost and shop supplies. UI added in Company Settings Operating Costs tab and Setup Wizard Step 3; migration AddFacilityOverheadFields applied. Help docs and AI knowledge base updated to cover the new fields and the revised quote pricing calculation order.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-24 19:35:00 -04:00
parent 813f76138c
commit 4153acf3aa
14 changed files with 9575 additions and 21 deletions
@@ -0,0 +1,94 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PowderCoating.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddFacilityOverheadFields : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "MonthlyBillableHours",
table: "CompanyOperatingCosts",
type: "int",
nullable: false,
defaultValue: 160);
migrationBuilder.AddColumn<decimal>(
name: "MonthlyRent",
table: "CompanyOperatingCosts",
type: "decimal(18,2)",
nullable: false,
defaultValue: 0m);
migrationBuilder.AddColumn<decimal>(
name: "MonthlyUtilities",
table: "CompanyOperatingCosts",
type: "decimal(18,2)",
nullable: false,
defaultValue: 0m);
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 1,
column: "CreatedAt",
value: new DateTime(2026, 4, 24, 23, 28, 22, 104, DateTimeKind.Utc).AddTicks(7155));
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 2,
column: "CreatedAt",
value: new DateTime(2026, 4, 24, 23, 28, 22, 104, DateTimeKind.Utc).AddTicks(7162));
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 3,
column: "CreatedAt",
value: new DateTime(2026, 4, 24, 23, 28, 22, 104, DateTimeKind.Utc).AddTicks(7164));
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "MonthlyBillableHours",
table: "CompanyOperatingCosts");
migrationBuilder.DropColumn(
name: "MonthlyRent",
table: "CompanyOperatingCosts");
migrationBuilder.DropColumn(
name: "MonthlyUtilities",
table: "CompanyOperatingCosts");
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 1,
column: "CreatedAt",
value: new DateTime(2026, 4, 23, 1, 54, 43, 181, DateTimeKind.Utc).AddTicks(5272));
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 2,
column: "CreatedAt",
value: new DateTime(2026, 4, 23, 1, 54, 43, 181, DateTimeKind.Utc).AddTicks(5281));
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 3,
column: "CreatedAt",
value: new DateTime(2026, 4, 23, 1, 54, 43, 181, DateTimeKind.Utc).AddTicks(5283));
}
}
}
@@ -1770,6 +1770,15 @@ namespace PowderCoating.Infrastructure.Migrations
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<int>("MonthlyBillableHours")
.HasColumnType("int");
b.Property<decimal>("MonthlyRent")
.HasColumnType("decimal(18,2)");
b.Property<decimal>("MonthlyUtilities")
.HasColumnType("decimal(18,2)");
b.Property<decimal>("OvenOperatingCostPerHour")
.HasColumnType("decimal(18,2)");
@@ -5767,7 +5776,7 @@ namespace PowderCoating.Infrastructure.Migrations
{
Id = 1,
CompanyId = 0,
CreatedAt = new DateTime(2026, 4, 23, 1, 54, 43, 181, DateTimeKind.Utc).AddTicks(5272),
CreatedAt = new DateTime(2026, 4, 24, 23, 28, 22, 104, DateTimeKind.Utc).AddTicks(7155),
Description = "Standard pricing for regular customers",
DiscountPercent = 0m,
IsActive = true,
@@ -5778,7 +5787,7 @@ namespace PowderCoating.Infrastructure.Migrations
{
Id = 2,
CompanyId = 0,
CreatedAt = new DateTime(2026, 4, 23, 1, 54, 43, 181, DateTimeKind.Utc).AddTicks(5281),
CreatedAt = new DateTime(2026, 4, 24, 23, 28, 22, 104, DateTimeKind.Utc).AddTicks(7162),
Description = "5% discount for preferred customers",
DiscountPercent = 5m,
IsActive = true,
@@ -5789,7 +5798,7 @@ namespace PowderCoating.Infrastructure.Migrations
{
Id = 3,
CompanyId = 0,
CreatedAt = new DateTime(2026, 4, 23, 1, 54, 43, 181, DateTimeKind.Utc).AddTicks(5283),
CreatedAt = new DateTime(2026, 4, 24, 23, 28, 22, 104, DateTimeKind.Utc).AddTicks(7164),
Description = "10% discount for premium customers",
DiscountPercent = 10m,
IsActive = true,