f54b945053
The data export was silently dropping account linkages, so an export->import (used to copy prod data) lost which bank account each payment hit, all invoice line items, and any bill/deposit/journal-entry detail. Diagnosed while cleaning up a company's books from a copied dataset. Now every accounting linkage travels by account/vendor/customer/invoice number — matching how expenses already worked — so a round-trip preserves GL attribution instead of dropping it. Payments: add DepositAccountNumber to the export + DTO; import resolves it back to DepositAccountId so payments post to the right bank account on recalc. Invoices: were header-only (re-imported invoices had 0 line items). Add a new invoice_items CSV (one row per line, carrying RevenueAccountNumber) with export, idempotent import, UI cards, and a template. Bills / Deposits / Journal Entries: were not exported at all. Add full-fidelity export + import including line-item children — bills + bill line items (vendor by name, AP account + per-line expense account by number), deposits (customer + bank account + applied invoice), and journal entries + JE lines (account by number, debit/credit). 5 DTOs, 5 importers, 5 exporters + actions, all added to the all_data export zip, plus 10 import/export UI cards. Shared RunCsvImport helper added for the new import endpoints. All linkages resolve by stable business keys (numbers/names), never internal IDs, so the files round-trip across databases. Build clean; 278 unit tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
45 lines
1.4 KiB
C#
45 lines
1.4 KiB
C#
using CsvHelper.Configuration.Attributes;
|
|
|
|
namespace PowderCoating.Application.DTOs.Import;
|
|
|
|
/// <summary>
|
|
/// DTO for importing invoice line items from CSV. Column names match the native
|
|
/// invoice-items export (ExportInvoiceItemsCsv) for round-trip compatibility.
|
|
/// Line items are matched to their parent invoice by <c>InvoiceNumber</c>; the revenue
|
|
/// account is resolved from <c>RevenueAccountNumber</c> against Account.AccountNumber so the
|
|
/// invoice's revenue attribution survives an export/import round-trip.
|
|
/// </summary>
|
|
public class InvoiceItemImportDto
|
|
{
|
|
[Name("InvoiceNumber")]
|
|
public string? InvoiceNumber { get; set; }
|
|
|
|
[Name("Description")]
|
|
public string? Description { get; set; }
|
|
|
|
[Name("Quantity")]
|
|
public decimal Quantity { get; set; }
|
|
|
|
[Name("UnitPrice")]
|
|
public decimal UnitPrice { get; set; }
|
|
|
|
[Name("TotalPrice")]
|
|
public decimal TotalPrice { get; set; }
|
|
|
|
[Name("ColorName")]
|
|
public string? ColorName { get; set; }
|
|
|
|
/// <summary>
|
|
/// Account number (Chart of Accounts) of the revenue account this line posts to. Optional —
|
|
/// a blank value means the line falls back to the company's default revenue account.
|
|
/// </summary>
|
|
[Name("RevenueAccountNumber")]
|
|
public string? RevenueAccountNumber { get; set; }
|
|
|
|
[Name("DisplayOrder")]
|
|
public int DisplayOrder { get; set; }
|
|
|
|
[Name("Notes")]
|
|
public string? Notes { get; set; }
|
|
}
|