1.0.9
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<Version>1.0.8</Version>
|
<Version>1.0.9</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -12,6 +12,9 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Update="invoice.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<None Update="ristorante-klinglers.ch-logo.png">
|
<None Update="ristorante-klinglers.ch-logo.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
|||||||
@@ -43,19 +43,20 @@ using System.Text.Json;
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
// INVOICE RECEIPT - HTML PRINTER
|
// INVOICE RECEIPT - HTML PRINTER
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
//var receipt = TestHelpers.BuildSampleInvoiceReceipt();
|
var receipt = TestHelpers.BuildSampleInvoiceReceipt();
|
||||||
//var serializedReceipt = JsonSerializer.Serialize(receipt, new JsonSerializerOptions { WriteIndented = true });
|
//var serializedReceipt = JsonSerializer.Serialize(receipt, new JsonSerializerOptions { WriteIndented = true });
|
||||||
|
var fileContent = File.ReadAllText("invoice.json");
|
||||||
|
var serializedReceipt = JsonSerializer.Deserialize<string>(fileContent);
|
||||||
|
var converter = new InvoiceReceiptConverter(lineWidth: 48, bigFontLineWidth: 24);
|
||||||
|
var printCommands = converter.Convert(serializedReceipt);
|
||||||
|
|
||||||
//var converter = new InvoiceReceiptConverter(lineWidth: 48, bigFontLineWidth: 24);
|
TestHelpers.PrintCommandsToConsole(printCommands);
|
||||||
//var printCommands = converter.Convert(serializedReceipt);
|
|
||||||
|
|
||||||
//TestHelpers.PrintCommandsToConsole(printCommands);
|
var printer = await TestHelpers.CreateHtmlPrinterAsync();
|
||||||
|
await TestHelpers.PrintCommandsToHtmlPrinterAsync(
|
||||||
//var printer = await TestHelpers.CreateHtmlPrinterAsync();
|
printer,
|
||||||
//await TestHelpers.PrintCommandsToHtmlPrinterAsync(
|
printCommands,
|
||||||
// printer,
|
logoPath: "ristorante-klinglers.ch-logo_white_bg.png");
|
||||||
// printCommands,
|
|
||||||
// logoPath: "ristorante-klinglers.ch-logo_white_bg.png");
|
|
||||||
|
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -112,17 +113,17 @@ using System.Text.Json;
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
// KITCHEN RECEIPT - EPSON PRINTER
|
// KITCHEN RECEIPT - EPSON PRINTER
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
var receipt = TestHelpers.BuildSampleKitchenReceipt();
|
//var receipt = TestHelpers.BuildSampleKitchenReceipt();
|
||||||
var serializedReceipt = JsonSerializer.Serialize(receipt, new JsonSerializerOptions { WriteIndented = true });
|
//var serializedReceipt = JsonSerializer.Serialize(receipt, new JsonSerializerOptions { WriteIndented = true });
|
||||||
var deserializedReceipt = JsonSerializer.Deserialize<KitchenReceipt>(serializedReceipt);
|
//var deserializedReceipt = JsonSerializer.Deserialize<KitchenReceipt>(serializedReceipt);
|
||||||
|
|
||||||
var converter = new KitchenReceiptConverter(bigLineWidth: 18, lineWidth: 33);
|
//var converter = new KitchenReceiptConverter(bigLineWidth: 18, lineWidth: 33);
|
||||||
var printCommands = converter.ConvertToPrintCommands(deserializedReceipt);
|
//var printCommands = converter.ConvertToPrintCommands(deserializedReceipt);
|
||||||
|
|
||||||
TestHelpers.PrintCommandsToConsole(printCommands);
|
//TestHelpers.PrintCommandsToConsole(printCommands);
|
||||||
|
|
||||||
var printer = await TestHelpers.CreateEpsonPrinterAsync(paperWidth: TestHelpers.KitchenPaperWidth);
|
//var printer = await TestHelpers.CreateEpsonPrinterAsync(paperWidth: TestHelpers.KitchenPaperWidth);
|
||||||
await TestHelpers.PrintCommandsToEpsonPrinterAsync(printer, printCommands, useDelay: true);
|
//await TestHelpers.PrintCommandsToEpsonPrinterAsync(printer, printCommands, useDelay: true);
|
||||||
|
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Diagnostics;
|
||||||
using Inspectron.Epson;
|
using Inspectron.Epson;
|
||||||
using Inspectron.Epson.PrintServer.Printers.Utils;
|
using Inspectron.Epson.PrintServer.Printers.Utils;
|
||||||
using Inspectron.Epson.PrintServer.Printers.Utils.FinalRecipe;
|
using Inspectron.Epson.PrintServer.Printers.Utils.FinalRecipe;
|
||||||
@@ -108,6 +109,10 @@ public static class TestHelpers
|
|||||||
TotalEftAmount = 93.00m,
|
TotalEftAmount = 93.00m,
|
||||||
Currency = "CHF"
|
Currency = "CHF"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
DiscountInfo = new DiscountInfo()
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
|
||||||
"PrinterIp": "10.0.20.12",
|
|
||||||
"LogoUrl": "https://james-dev-public-images.s3.eu-central-1.amazonaws.com/01-21-26-15:26:16.jpeg",
|
|
||||||
"ReceiptType": 4,
|
|
||||||
"Content": "{\"CompanyName\":\"Gaumenfreuden\",\"Address1\":\"Orellistrasse 21\",\"Address2\":\"8044 Zurich\",\"Phone\":\"\\u002B380504371463\",\"ReceiptNumber\":null,\"DateTime\":\"2026-01-28T12:47:47.0874074Z\",\"Guests\":null,\"Items\":[{\"Quantity\":1,\"Description\":\"Beer light\",\"UnitPrice\":40,\"TotalPrice\":40,\"TaxCategory\":\"A\",\"SubItems\":null},{\"Quantity\":1,\"Description\":\"Premium Juice\",\"UnitPrice\":1.2,\"TotalPrice\":1.2,\"TaxCategory\":\"B\",\"SubItems\":null},{\"Quantity\":1,\"Description\":\"Beer light from Catalog\",\"UnitPrice\":20,\"TotalPrice\":20,\"TaxCategory\":\"A\",\"SubItems\":null},{\"Quantity\":1,\"Description\":\"Beer light from Catalog\",\"UnitPrice\":20,\"TotalPrice\":20,\"TaxCategory\":\"A\",\"SubItems\":null}],\"Total\":81.2,\"Currency\":\"CHF\",\"ThankYouMessage\":\"Thanks\",\"TableNumber\":\"HappyHoursDrinks\"}"
|
|
||||||
}
|
|
||||||
|
"{\"CompanyName\":\"Gaumenfreuden\",\"Address1\":\"Orellistrasse 21\",\"Address2\":\"8044 Zurich\",\"Phone\":\"\\u002B380504371463\",\"ReceiptNumber\":null,\"DateTime\":\"2026-01-28T12:47:47.0874074Z\",\"Guests\":null,\"Items\":[{\"Quantity\":1,\"Description\":\"Beer light\",\"UnitPrice\":40,\"TotalPrice\":40,\"TaxCategory\":\"A\",\"SubItems\":null},{\"Quantity\":1,\"Description\":\"Premium Juice\",\"UnitPrice\":1.2,\"TotalPrice\":1.2,\"TaxCategory\":\"B\",\"SubItems\":null},{\"Quantity\":1,\"Description\":\"Beer light from Catalog\",\"UnitPrice\":20,\"TotalPrice\":20,\"TaxCategory\":\"A\",\"SubItems\":null},{\"Quantity\":1,\"Description\":\"Beer light from Catalog\",\"UnitPrice\":20,\"TotalPrice\":20,\"TaxCategory\":\"A\",\"SubItems\":null}],\"Total\":81.2,\"Currency\":\"CHF\",\"ThankYouMessage\":\"Thanks\",\"TableNumber\":\"HappyHoursDrinks\"}"
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class BarReceiptConverter
|
|||||||
|
|
||||||
//string serverIdLine = $"{kitchenReceipt.WaiterId}";
|
//string serverIdLine = $"{kitchenReceipt.WaiterId}";
|
||||||
//commands.Add(new PrintCommand(Center(serverIdLine, false)));
|
//commands.Add(new PrintCommand(Center(serverIdLine, false)));
|
||||||
|
commands.Add(new PrintCommand(""));
|
||||||
string tableLine = $"Tisch: {kitchenReceipt.TableNumber}";
|
string tableLine = $"Tisch: {kitchenReceipt.TableNumber}";
|
||||||
commands.Add(new PrintCommand(Center(tableLine, true), true, true));
|
commands.Add(new PrintCommand(Center(tableLine, true), true, true));
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,16 @@ public class FinalReceipt
|
|||||||
public string GoodbyeMessageLine1 { get; set; }
|
public string GoodbyeMessageLine1 { get; set; }
|
||||||
public string GoodbyeMessageLine2 { get; set; }
|
public string GoodbyeMessageLine2 { get; set; }
|
||||||
public List<PaymentTerminalReceipt> TerminalReceipts { get; set; } = new List<PaymentTerminalReceipt>();
|
public List<PaymentTerminalReceipt> TerminalReceipts { get; set; } = new List<PaymentTerminalReceipt>();
|
||||||
|
public DiscountInfo? DiscountInfo { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DiscountInfo
|
||||||
|
{
|
||||||
|
public string Description { get; set; }
|
||||||
|
public decimal Amount { get; set; }
|
||||||
|
public string Currency { get; set; }
|
||||||
|
public decimal? AmountInAlternateCurrency { get; set; }
|
||||||
|
public string AlternateCurrency { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FinalReceiptItem
|
public class FinalReceiptItem
|
||||||
|
|||||||
@@ -77,6 +77,14 @@ public class ReceiptConverter
|
|||||||
commands.Add(new PrintCommand(""));
|
commands.Add(new PrintCommand(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Discount
|
||||||
|
//if (finalReceipt.DiscountInfo != null && finalReceipt.DiscountInfo.Amount > 0)
|
||||||
|
//{
|
||||||
|
|
||||||
|
// commands.Add(new PrintCommand(finalReceipt.DiscountInfo.Description.PadLeft(_lineWidth/2)));
|
||||||
|
// commands.Add(new PrintCommand(""));
|
||||||
|
//}
|
||||||
|
|
||||||
// Split payments
|
// Split payments
|
||||||
if (finalReceipt.SplitPayments != null && finalReceipt.SplitPayments.Count > 0)
|
if (finalReceipt.SplitPayments != null && finalReceipt.SplitPayments.Count > 0)
|
||||||
{
|
{
|
||||||
@@ -118,7 +126,10 @@ public class ReceiptConverter
|
|||||||
|
|
||||||
// Footer info
|
// Footer info
|
||||||
commands.Add(new PrintCommand($"Bedient von:".PadLeft(_lineWidth / 2) + $" {finalReceipt.WaiterName}"));
|
commands.Add(new PrintCommand($"Bedient von:".PadLeft(_lineWidth / 2) + $" {finalReceipt.WaiterName}"));
|
||||||
commands.Add(new PrintCommand($"Terminal:".PadLeft(_lineWidth / 2) + $" {finalReceipt.Terminal}"));
|
|
||||||
|
if(!string.IsNullOrEmpty(finalReceipt.Terminal))
|
||||||
|
commands.Add(new PrintCommand($"Terminal:".PadLeft(_lineWidth / 2) + $" {finalReceipt.Terminal}"));
|
||||||
|
|
||||||
commands.Add(new PrintCommand($"Tisch:".PadLeft(_lineWidth / 2)+$" {finalReceipt.TableNumber}"));
|
commands.Add(new PrintCommand($"Tisch:".PadLeft(_lineWidth / 2)+$" {finalReceipt.TableNumber}"));
|
||||||
commands.Add(new PrintCommand(""));
|
commands.Add(new PrintCommand(""));
|
||||||
commands.Add(new PrintCommand(""));
|
commands.Add(new PrintCommand(""));
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ public class InvoiceReceipt
|
|||||||
public string Phone { get; set; }
|
public string Phone { get; set; }
|
||||||
public string ReceiptNumber { get; set; }
|
public string ReceiptNumber { get; set; }
|
||||||
public DateTime DateTime { get; set; }
|
public DateTime DateTime { get; set; }
|
||||||
public int Guests { get; set; }
|
public int? Guests { get; set; }
|
||||||
public List<ReceiptItem> Items { get; set; } = new List<ReceiptItem>();
|
public List<ReceiptItem> Items { get; set; } = new List<ReceiptItem>();
|
||||||
public decimal Total { get; set; }
|
public decimal Total { get; set; }
|
||||||
public string Currency { get; set; }
|
public string Currency { get; set; }
|
||||||
|
|||||||
@@ -34,7 +34,10 @@ public class ReceiptConverter
|
|||||||
receiptLine += $"{invoiceReceipt.DateTime:HH:mm dd.MM.yyyy}".PadLeft(_lineWidth / 2);
|
receiptLine += $"{invoiceReceipt.DateTime:HH:mm dd.MM.yyyy}".PadLeft(_lineWidth / 2);
|
||||||
|
|
||||||
commands.Add(new PrintCommand(receiptLine,isBold:true));
|
commands.Add(new PrintCommand(receiptLine,isBold:true));
|
||||||
commands.Add(new PrintCommand($"Guests: {invoiceReceipt.Guests}"));
|
|
||||||
|
if(invoiceReceipt.Guests != null)
|
||||||
|
commands.Add(new PrintCommand($"Guests: {invoiceReceipt.Guests}"));
|
||||||
|
|
||||||
commands.Add(new PrintCommand(""));
|
commands.Add(new PrintCommand(""));
|
||||||
|
|
||||||
// Items
|
// Items
|
||||||
|
|||||||
Reference in New Issue
Block a user