82fb48f7a5
- DataExportController + AccountDataExportController: add ProjectName to Jobs, Quotes, Invoices (XLSX + CSV); add LeadSource + ShipTo fields to Customers (XLSX + CSV); add CustomerContacts sheet/CSV (new) - Both export views: add Customer Contacts checkbox (checked by default) - CustomerImportDto: add LeadSource + ShipTo* fields - JobImportDto: add ProjectName - QuoteImportDto: add ProjectName - InvoiceImportDto: add Project Name (dual-name alias for round-trip) - CsvImportService: wire all new import fields to entity creation; also patch invoice update path for ProjectName - Add scripts/purge_imported_data.sql (dry-run T-SQL for data cleanup) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
70 lines
1.9 KiB
C#
70 lines
1.9 KiB
C#
using CsvHelper.Configuration.Attributes;
|
|
|
|
namespace PowderCoating.Application.DTOs.Import;
|
|
|
|
/// <summary>
|
|
/// DTO for importing invoice headers from CSV files.
|
|
/// Column names match the native CSV export (ExportInvoicesCsv) for round-trip compatibility.
|
|
/// CustomerEmail is an additional optional column for more reliable customer matching when
|
|
/// the file did not originate from the native export.
|
|
/// </summary>
|
|
public class InvoiceImportDto
|
|
{
|
|
[Name("InvoiceNumber")]
|
|
public string? InvoiceNumber { get; set; }
|
|
|
|
// Customer resolution: email takes priority, name is the fallback
|
|
[Name("CustomerEmail")]
|
|
public string? CustomerEmail { get; set; }
|
|
|
|
// "Customer" matches the column written by ExportInvoicesCsv
|
|
[Name("Customer")]
|
|
public string? CustomerName { get; set; }
|
|
|
|
[Name("JobNumber")]
|
|
public string? JobNumber { get; set; }
|
|
|
|
[Name("Status")]
|
|
public string Status { get; set; } = "Draft";
|
|
|
|
[Name("InvoiceDate")]
|
|
public DateTime InvoiceDate { get; set; }
|
|
|
|
[Name("DueDate")]
|
|
public DateTime? DueDate { get; set; }
|
|
|
|
[Name("Project Name", "ProjectName")]
|
|
public string? ProjectName { get; set; }
|
|
|
|
[Name("SubTotal")]
|
|
public decimal SubTotal { get; set; }
|
|
|
|
[Name("TaxPercent")]
|
|
public decimal TaxPercent { get; set; }
|
|
|
|
[Name("TaxAmount")]
|
|
public decimal TaxAmount { get; set; }
|
|
|
|
[Name("DiscountAmount")]
|
|
public decimal DiscountAmount { get; set; }
|
|
|
|
[Name("Total")]
|
|
public decimal Total { get; set; }
|
|
|
|
[Name("AmountPaid")]
|
|
public decimal AmountPaid { get; set; }
|
|
|
|
// BalanceDue is computed (Total - AmountPaid); ignored on import
|
|
[Ignore]
|
|
public decimal BalanceDue { get; set; }
|
|
|
|
[Name("CustomerPO")]
|
|
public string? CustomerPO { get; set; }
|
|
|
|
[Name("Terms")]
|
|
public string? Terms { get; set; }
|
|
|
|
[Name("Notes")]
|
|
public string? Notes { get; set; }
|
|
}
|