new receipt formats
This commit is contained in:
@@ -6,7 +6,7 @@ public class FinalReceipt
|
||||
public string Address1 { get; set; }
|
||||
public string Address2 { get; set; }
|
||||
public string Phone { get; set; }
|
||||
public string ReceiptNumber { get; set; }
|
||||
public string? ReceiptNumber { get; set; }
|
||||
public DateTime DateTime { get; set; }
|
||||
public int Guests { get; set; }
|
||||
public List<FinalReceiptItem> Items { get; set; } = new List<FinalReceiptItem>();
|
||||
|
||||
@@ -27,7 +27,12 @@ public class ReceiptConverter
|
||||
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);
|
||||
string receiptLine = "";
|
||||
if (finalReceipt.ReceiptNumber != null)
|
||||
receiptLine += $"Rechnung Nr. {finalReceipt.ReceiptNumber}".PadRight(_lineWidth / 2);
|
||||
else
|
||||
receiptLine += $"".PadRight(_lineWidth / 2);
|
||||
receiptLine += $"{finalReceipt.DateTime:HH:mm dd.MM.yyyy}".PadLeft(_lineWidth / 2);
|
||||
commands.Add(new PrintCommand(receiptLine,isBold:true));
|
||||
commands.Add(new PrintCommand($"Guests: {finalReceipt.Guests}"));
|
||||
commands.Add(new PrintCommand(""));
|
||||
|
||||
@@ -12,6 +12,8 @@ public class InvoiceReceipt
|
||||
public List<ReceiptItem> Items { get; set; } = new List<ReceiptItem>();
|
||||
public decimal Total { get; set; }
|
||||
public string Currency { get; set; }
|
||||
public string TableNumber { get; set; }
|
||||
public string ThankYouMessage { get; set; }
|
||||
}
|
||||
|
||||
public class ReceiptItem
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using Inspectron.Epson.PrintServer.Printers.Utils.FinalRecipe;
|
||||
|
||||
namespace Inspectron.Epson.PrintServer.Printers.Utils.InvoiceReceipt;
|
||||
|
||||
public class ReceiptConverter
|
||||
@@ -24,7 +26,13 @@ public class ReceiptConverter
|
||||
commands.Add(new PrintCommand(""));
|
||||
|
||||
// InvoiceReceipt info
|
||||
string receiptLine = $"Rechnung Nr. {invoiceReceipt.ReceiptNumber}".PadRight(_lineWidth/2)+$"{invoiceReceipt.DateTime:HH:mm dd.MM.yyyy}".PadLeft(_lineWidth/2);
|
||||
string receiptLine = "";
|
||||
if (invoiceReceipt.ReceiptNumber != null)
|
||||
receiptLine += $"Rechnung Nr. {invoiceReceipt.ReceiptNumber}".PadRight(_lineWidth / 2);
|
||||
else
|
||||
receiptLine += $"".PadRight(_lineWidth / 2);
|
||||
receiptLine += $"{invoiceReceipt.DateTime:HH:mm dd.MM.yyyy}".PadLeft(_lineWidth / 2);
|
||||
|
||||
commands.Add(new PrintCommand(receiptLine,isBold:true));
|
||||
commands.Add(new PrintCommand($"Guests: {invoiceReceipt.Guests}"));
|
||||
commands.Add(new PrintCommand(""));
|
||||
@@ -59,6 +67,8 @@ public class ReceiptConverter
|
||||
// Total
|
||||
string totalLine = $"Summe: {invoiceReceipt.Total:F2} {invoiceReceipt.Currency}";
|
||||
commands.Add(new PrintCommand(Center(totalLine, true), true, true));
|
||||
commands.Add(new PrintCommand(Center($"Tisch: {invoiceReceipt.TableNumber}",false), false));
|
||||
commands.Add(new PrintCommand(Center(invoiceReceipt.ThankYouMessage, false)));
|
||||
|
||||
return commands;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class KitchenReceiptConverter
|
||||
|
||||
|
||||
// Gangs
|
||||
|
||||
|
||||
foreach (Gang gang in kitchenReceipt.Gangs)
|
||||
{
|
||||
|
||||
@@ -55,6 +55,13 @@ public class KitchenReceiptConverter
|
||||
{
|
||||
PrintDish(dish, commands);
|
||||
}
|
||||
|
||||
if (gang != kitchenReceipt.Gangs.Last())
|
||||
{
|
||||
commands.Add(new PrintCommand(""){IsCut = true});
|
||||
commands.Add(new PrintCommand(""));
|
||||
commands.Add(new PrintCommand(""));
|
||||
}
|
||||
}
|
||||
|
||||
if (kitchenReceipt.Gangs.Count > 0)
|
||||
@@ -96,7 +103,11 @@ public class KitchenReceiptConverter
|
||||
private static void PrintDish(Dish dish, List<PrintCommand> commands)
|
||||
{
|
||||
string dishLine = $"{dish.Number}x {dish.Name}";
|
||||
commands.Add(new PrintCommand(dishLine){IsTall = true});
|
||||
string guestInfo = dish.GuestId.HasValue ? $"{dish.GuestId.Value} " : "";
|
||||
|
||||
//todo: add word wrap if guest id is present and guestInfo + dish line too long. add spaces in front of continued lines to align with dish name start position
|
||||
|
||||
commands.Add(new PrintCommand(guestInfo+dishLine) {IsTall = true});
|
||||
// Modifications
|
||||
if (dish.Modifications != null && (dish.Modifications.Removed.Any() || dish.Modifications.Added.Any()))
|
||||
{
|
||||
|
||||
@@ -80,6 +80,8 @@
|
||||
|
||||
public Dish(){}
|
||||
|
||||
public int? GuestId { get; set; }
|
||||
|
||||
public Dish(int number, string name)
|
||||
{
|
||||
Number = number;
|
||||
|
||||
@@ -8,6 +8,7 @@ public class PrintCommand
|
||||
public bool IsBold { get; set; }
|
||||
public bool IsRed { get; set; }
|
||||
public int? SetLineSpacing { get; set; }=null;
|
||||
public bool IsCut { get; set; }
|
||||
public PrintCommand(string text, bool isBig = false, bool isBold = false)
|
||||
{
|
||||
Text = text;
|
||||
|
||||
Reference in New Issue
Block a user