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

@@ -18,6 +18,7 @@ public class FinalReceipt
public string PaymentMethod { get; set; }
public decimal PaymentAmount { get; set; }
public List<TaxInfo> TaxBreakdown { get; set; } = new List<TaxInfo>();
public bool IsDebtor { get; set; } = false;
public string WaiterName { get; set; }
public string Terminal { get; set; }
public string TableNumber { get; set; }
@@ -35,6 +36,7 @@ public class FinalReceiptItem
public decimal UnitPrice { get; set; }
public decimal TotalPrice { get; set; }
public string TaxCategory { get; set; }
public List<string> SubItems { get; set; }
}
public class TaxInfo

View File

@@ -22,7 +22,10 @@ public class ReceiptConverter
commands.Add(new PrintCommand(Center(finalReceipt.Phone, false)));
commands.Add(new PrintCommand(""));
commands.Add(new PrintCommand(""));
if (finalReceipt.IsDebtor)
{
commands.Add(new PrintCommand("Debitorenrechnung"));
}
// FinalReceipt info
string receiptLine = $"Rechnung Nr. {finalReceipt.ReceiptNumber}".PadRight(_lineWidth/2)+$"{finalReceipt.DateTime:HH:mm dd.MM.yyyy}".PadLeft(_lineWidth/2);
commands.Add(new PrintCommand(receiptLine,isBold:true));
@@ -41,6 +44,15 @@ public class ReceiptConverter
string itemLine = quantityDesc + new string(' ', spacesNeeded) + prices;
commands.Add(new PrintCommand(itemLine));
// SubItems
if (item.SubItems != null)
{
foreach (var subItem in item.SubItems)
{
commands.Add(new PrintCommand($" - {subItem}"));
}
}
}
commands.Add(new PrintCommand("")); // Reini
@@ -91,6 +103,12 @@ public class ReceiptConverter
string taxDetail = ($"{tax.Category}:"+ $"{tax.Rate}%".PadLeft(5)).PadRight(_lineWidth / 4) + $"{tax.Gross:F2} {tax.Currency}".PadLeft(_lineWidth/4)+$"{tax.Net:F2} {tax.Currency}".PadLeft(_lineWidth/4)+$"{tax.TaxAmount:F2} {tax.Currency}".PadLeft(_lineWidth / 4);
commands.Add(new PrintCommand(taxDetail));
}
if (finalReceipt.TaxBreakdown.Count(x => x.Category.ToLower()!="d")==0)
{
commands.Add(new PrintCommand("Nicht mehrwertsteuerpflichtig"));
}
commands.Add(new PrintCommand(""));
// Footer info
@@ -135,6 +153,16 @@ public class ReceiptConverter
commands.Add(new PrintCommand(Center(finalReceipt.ThankYouMessage, false)));
commands.Add(new PrintCommand(Center(finalReceipt.GoodbyeMessageLine1, false)));
commands.Add(new PrintCommand(Center(finalReceipt.GoodbyeMessageLine2, false)));
if (finalReceipt.IsDebtor)
{
commands.Add(new PrintCommand(""));
commands.Add(new PrintCommand(""));
commands.Add(new PrintCommand(""));
commands.Add(new PrintCommand("".PadRight(_lineWidth, '-')));
commands.Add(new PrintCommand("Unterschrift"));
}
return commands;
}