This commit is contained in:
EugeneTes
2026-01-26 10:53:09 +01:00
parent 70466d1007
commit 53cf40c5e3
7 changed files with 70 additions and 24 deletions

View File

@@ -10,7 +10,7 @@ using System.Text.Json;
// ============================================================================
// FINAL RECEIPT - HTML PRINTER
// ============================================================================
//var receipt = TestHelpers.BuildSampleFinalReceipt();
//var receipt = TestHelpers.BuildSampleFinalReceipt(true);
//var serializedReceipt = JsonSerializer.Serialize(receipt, new JsonSerializerOptions { WriteIndented = true });
//var converter = new FinalReceiptConverter(lineWidth: 48, bigFontLineWidth: 24);

View File

@@ -40,7 +40,7 @@ public static class TestHelpers
#region Receipt Builders
public static FinalReceipt BuildSampleFinalReceipt()
public static FinalReceipt BuildSampleFinalReceipt(bool includeTax = true)
{
var receipt = new FinalReceipt
{
@@ -64,6 +64,7 @@ public static class TestHelpers
ThankYouMessage = "Das Team bedankt sich herzlich für Ihren",
GoodbyeMessageLine1 = "Besuch.",
GoodbyeMessageLine2 = "Auf Wiedersehen.",
IsDebtor = true,
SplitPayments = new List<SplitPaymentInfo>
{
new() { PaymentMethod = "Cash", Amount = 50.00m, Currency = "CHF" },
@@ -144,7 +145,8 @@ public static class TestHelpers
Description = "Business Lunch Menu Seco",
UnitPrice = 44.00m,
TotalPrice = 88.00m,
TaxCategory = "A"
TaxCategory = "A",
SubItems = new List<string> { "Tomato Soup", "Grilled Salmon", "Tiramisu" }
});
receipt.Items.Add(new FinalReceiptItem
@@ -174,26 +176,29 @@ public static class TestHelpers
TaxCategory = "B"
});
// Add tax breakdown
receipt.TaxBreakdown.Add(new TaxInfo
if (includeTax)
{
Category = "A",
Rate = 8.1m,
Gross = 149.50m,
Net = 138.30m,
TaxAmount = 11.20m,
Currency = "CHF"
});
// Add tax breakdown
receipt.TaxBreakdown.Add(new TaxInfo
{
Category = "A",
Rate = 8.1m,
Gross = 149.50m,
Net = 138.30m,
TaxAmount = 11.20m,
Currency = "CHF"
});
receipt.TaxBreakdown.Add(new TaxInfo
{
Category = "B",
Rate = 0m,
Gross = 10.50m,
Net = 10.50m,
TaxAmount = 0.00m,
Currency = "CHF"
});
receipt.TaxBreakdown.Add(new TaxInfo
{
Category = "B",
Rate = 0m,
Gross = 10.50m,
Net = 10.50m,
TaxAmount = 0.00m,
Currency = "CHF"
});
}
return receipt;
}
@@ -247,7 +252,8 @@ public static class TestHelpers
Description = "Business Lunch Menu Seco",
UnitPrice = 44.00m,
TotalPrice = 88.00m,
TaxCategory = "A"
TaxCategory = "A",
SubItems = new List<string> { "Tomato Soup", "Grilled Salmon", "Tiramisu" }
});
receipt.Items.Add(new Inspectron.Epson.PrintServer.Printers.Utils.InvoiceReceipt.ReceiptItem