Files
ROLAC/API/ROLAC.API/Services/Disbursement/CheckPrintLayoutOptions.cs
T
Chris Chen 4b949dff9b
ci-cd-vm / ci-cd (push) Successful in 1m56s
更新支票列印
2026-06-27 21:37:40 -07:00

87 lines
4.4 KiB
C#

namespace ROLAC.API.Services.Disbursement;
/// <summary>
/// Field coordinates (in inches) for printing onto pre-printed three-stub check stock.
/// Every position is bound from the "CheckPrint:Layout" section of appsettings.json so alignment
/// can be tuned and reloaded without recompiling. Positions are expressed as an X (absolute from the
/// page's left edge) plus a Y offset within the field's stub; the per-stub origins below place the
/// three stacked regions (check + two identical receipt copies) down the 8.5"x11" page.
/// </summary>
public sealed class CheckPrintLayoutOptions
{
// Calibration nudge (inches): a TextBox renders its text inset down-and-right from the box
// origin by a fixed internal margin + line leading, so configured X/Y don't match the ink.
// These values are subtracted from every position so configured X/Y == actual printed position.
// To recalibrate: set both to 0, print, measure how far the ink sits past a known X/Y, and put
// those differences here (defaults are the measured inset for this stock).
public float TextInsetX { get; set; } = 0.13f;
public float TextInsetY { get; set; } = 0.15f;
// Stub origins — top edge of each region, inches from the top of the page.
public float CheckOriginY { get; set; } = 0f;
public float Receipt1OriginY { get; set; } = 3.67f;
public float Receipt2OriginY { get; set; } = 7.33f;
// Check stub fields (offset within the check stub).
public FieldPos Payee { get; set; } = new() { X = 1.25f, OffsetY = 1.75f, FontSize = 11, Bold = true };
public FieldPos AmountNumeric { get; set; } = new() { X = 6.50f, OffsetY = 1.75f, FontSize = 11, Bold = true };
public FieldPos AmountWords { get; set; } = new() { X = 0.60f, OffsetY = 2.20f, FontSize = 10 };
public FieldPos Memo { get; set; } = new() { X = 0.60f, OffsetY = 2.90f, FontSize = 9 };
public FieldPos CheckDate { get; set; } = new() { X = 6.50f, OffsetY = 1.25f, FontSize = 10 };
// Receipt stub fields (offset within a receipt stub — shared by both identical copies).
public FieldPos ReceiptPayee { get; set; } = new() { X = 1.00f, OffsetY = 0.30f, FontSize = 10, Bold = true };
public FieldPos ReceiptAmount { get; set; } = new() { X = 6.50f, OffsetY = 0.30f, FontSize = 10, Bold = true };
public FieldPos ReceiptMemo { get; set; } = new() { X = 1.00f, OffsetY = 0.60f, FontSize = 9 };
public FieldPos ReceiptDate { get; set; } = new() { X = 6.50f, OffsetY = 0.60f, FontSize = 9 };
// Voucher detail grid (offsets within a receipt stub).
public VoucherGridOptions Grid { get; set; } = new();
}
/// <summary>One printable field: where it sits and how it renders.</summary>
public sealed class FieldPos
{
/// <summary>Absolute X from the page's left edge, in inches.</summary>
public float X { get; set; }
/// <summary>Y offset within the field's stub, in inches (added to the stub origin).</summary>
public float OffsetY { get; set; }
public float FontSize { get; set; } = 10;
public bool Bold { get; set; }
}
/// <summary>
/// Two-column voucher detail grid on each receipt stub: 6 rows per column, 12 expense lines max,
/// filled column-major (lines 1-6 left, 7-12 right). All offsets are within the receipt stub.
/// </summary>
public sealed class VoucherGridOptions
{
/// <summary>Left edge of the left column block, in inches from the page's left edge.</summary>
public float OriginX { get; set; } = 0.60f;
/// <summary>Y offset (within the stub) of the first data row.</summary>
public float OffsetY { get; set; } = 1.10f;
public float RowHeight { get; set; } = 0.22f;
/// <summary>Horizontal gap between the left and right column blocks, in inches.</summary>
public float ColumnGap { get; set; } = 0.30f;
public float DateWidth { get; set; } = 0.85f;
public float DescWidth { get; set; } = 2.10f;
public float AmountWidth { get; set; } = 0.80f;
/// <summary>Draw our own Date/Description/Amount headers. Set false if the stock pre-prints them.</summary>
public bool ShowGridHeaders { get; set; } = true;
/// <summary>Y offset (within the stub) of the header row.</summary>
public float HeaderOffsetY { get; set; } = 0.88f;
/// <summary>Y offset (within the stub) of the "...and N more lines" overflow hint.</summary>
public float OverflowOffsetY { get; set; } = 2.55f;
public float FontSize { get; set; } = 8.5f;
}