final receipt update

This commit is contained in:
EugeneTes
2026-01-22 11:09:38 +01:00
parent 9fbc61dede
commit fcb192b797
31 changed files with 2679 additions and 655 deletions

View File

@@ -14,6 +14,7 @@ public class FinalReceipt
public string Currency { get; set; }
public decimal? TotalInAlternateCurrency { get; set; }
public string AlternateCurrency { get; set; }
public List<SplitPaymentInfo> SplitPayments { get; set; } = new List<SplitPaymentInfo>();
public string PaymentMethod { get; set; }
public decimal PaymentAmount { get; set; }
public List<TaxInfo> TaxBreakdown { get; set; } = new List<TaxInfo>();
@@ -24,7 +25,7 @@ public class FinalReceipt
public string ThankYouMessage { get; set; }
public string GoodbyeMessageLine1 { get; set; }
public string GoodbyeMessageLine2 { get; set; }
public PaymentTerminalReceipt TerminalReceipt { get; set; }
public List<PaymentTerminalReceipt> TerminalReceipts { get; set; } = new List<PaymentTerminalReceipt>();
}
public class ReceiptItem
@@ -46,6 +47,13 @@ public class TaxInfo
public string Currency { get; set; }
}
public class SplitPaymentInfo
{
public string PaymentMethod { get; set; }
public decimal Amount { get; set; }
public string Currency { get; set; }
}
public class PaymentTerminalReceipt
{
public string ReceiptType { get; set; } // e.g., "*** Kundenbeleg ***"

View File

@@ -60,6 +60,17 @@ public class ReceiptConverter
commands.Add(new PrintCommand(""));
}
// Split payments
if (finalReceipt.SplitPayments != null && finalReceipt.SplitPayments.Count > 0)
{
foreach (var splitPayment in finalReceipt.SplitPayments)
{
string splitLine = $"{splitPayment.PaymentMethod}: {splitPayment.Amount:F2} {splitPayment.Currency}";
commands.Add(new PrintCommand(splitLine.PadLeft(_lineWidth)));
}
commands.Add(new PrintCommand(""));
}
// Payment method
string paymentLine = $"{finalReceipt.PaymentMethod}";
string paymentAmount = $"{finalReceipt.PaymentAmount:F2} {finalReceipt.Currency}";
@@ -93,30 +104,31 @@ public class ReceiptConverter
commands.Add(new PrintCommand(Center(finalReceipt.VatNumber, false)));
commands.Add(new PrintCommand(""));
// Payment Terminal Receipt
if (finalReceipt.TerminalReceipt != null)
// Payment Terminal Receipts
if (finalReceipt.TerminalReceipts != null && finalReceipt.TerminalReceipts.Count > 0)
{
var terminal = finalReceipt.TerminalReceipt;
foreach (var terminal in finalReceipt.TerminalReceipts)
{
commands.Add(new PrintCommand(Center(terminal.ReceiptType, false)));
commands.Add(new PrintCommand(Center(terminal.BookingType, false)));
commands.Add(new PrintCommand(Center(terminal.PaymentSystem, false)));
commands.Add(new PrintCommand(terminal.TransactionNumber));
commands.Add(new PrintCommand($"{terminal.TransactionDateTime:dd.MM.yyyy}".PadRight(_lineWidth/2) + $"{terminal.TransactionDateTime:HH:mm:ss}".PadLeft(_lineWidth/2)));
commands.Add(new PrintCommand(Center(terminal.ReceiptType, false)));
commands.Add(new PrintCommand(Center(terminal.BookingType, false)));
commands.Add(new PrintCommand(Center(terminal.PaymentSystem, false)));
commands.Add(new PrintCommand(terminal.TransactionNumber));
commands.Add(new PrintCommand($"{terminal.TransactionDateTime:dd.MM.yyyy}".PadRight(_lineWidth/2) + $"{terminal.TransactionDateTime:HH:mm:ss}".PadLeft(_lineWidth/2)));
commands.Add(new PrintCommand($"Trm-Id:".PadRight(_lineWidth/2) + $"{terminal.TerminalId}".PadLeft(_lineWidth/2)));
commands.Add(new PrintCommand($"AID:".PadRight(_lineWidth/2) + $"{terminal.AID}".PadLeft(_lineWidth/2)));
commands.Add(new PrintCommand($"Trx. Seq-Cnt:".PadRight(_lineWidth/2) + $"{terminal.TransactionSeqCount}".PadLeft(_lineWidth/2)));
commands.Add(new PrintCommand($"Trx. Ref-No:".PadRight(_lineWidth/2) + $"{terminal.TransactionRefNo}".PadLeft(_lineWidth/2)));
commands.Add(new PrintCommand($"Auth. Code:".PadRight(_lineWidth/2) + $"{terminal.AuthCode}".PadLeft(_lineWidth/2)));
commands.Add(new PrintCommand($"Acq-Id:".PadRight(_lineWidth/2) + $"{terminal.AcquirerId}".PadLeft(_lineWidth/2)));
commands.Add(new PrintCommand($"Trm-Id:".PadRight(_lineWidth/2) + $"{terminal.TerminalId}".PadLeft(_lineWidth/2)));
commands.Add(new PrintCommand($"AID:".PadRight(_lineWidth/2) + $"{terminal.AID}".PadLeft(_lineWidth/2)));
commands.Add(new PrintCommand($"Trx. Seq-Cnt:".PadRight(_lineWidth/2) + $"{terminal.TransactionSeqCount}".PadLeft(_lineWidth/2)));
commands.Add(new PrintCommand($"Trx. Ref-No:".PadRight(_lineWidth/2) + $"{terminal.TransactionRefNo}".PadLeft(_lineWidth/2)));
commands.Add(new PrintCommand($"Auth. Code:".PadRight(_lineWidth/2) + $"{terminal.AuthCode}".PadLeft(_lineWidth/2)));
commands.Add(new PrintCommand($"Acq-Id:".PadRight(_lineWidth/2) + $"{terminal.AcquirerId}".PadLeft(_lineWidth/2)));
commands.Add(new PrintCommand($"EFT {terminal.Currency}:".PadRight(_lineWidth/2) + $"{terminal.EftAmount:F2}".PadLeft(_lineWidth/2)));
commands.Add(new PrintCommand($"Trinkgeld {terminal.Currency}:".PadRight(_lineWidth/2) + $"{terminal.TipAmount:F2}".PadLeft(_lineWidth/2)));
commands.Add(new PrintCommand($"Total-EFT {terminal.Currency}:".PadRight(_lineWidth/2) + $"{terminal.TotalEftAmount:F2}".PadLeft(_lineWidth/2)));
commands.Add(new PrintCommand($"EFT {terminal.Currency}:".PadRight(_lineWidth/2) + $"{terminal.EftAmount:F2}".PadLeft(_lineWidth/2)));
commands.Add(new PrintCommand($"Trinkgeld {terminal.Currency}:".PadRight(_lineWidth/2) + $"{terminal.TipAmount:F2}".PadLeft(_lineWidth/2)));
commands.Add(new PrintCommand($"Total-EFT {terminal.Currency}:".PadRight(_lineWidth/2) + $"{terminal.TotalEftAmount:F2}".PadLeft(_lineWidth/2)));
commands.Add(new PrintCommand(new string('-', _lineWidth)));
commands.Add(new PrintCommand(""));
commands.Add(new PrintCommand(new string('-', _lineWidth)));
commands.Add(new PrintCommand(""));
}
}
// Thank you message