From eb087403639aad23f48f90813dd53b4a53c67bee Mon Sep 17 00:00:00 2001 From: Vitaly Kravtsov Date: Wed, 6 Sep 2023 14:52:48 +0300 Subject: [PATCH] [-] Fixed error with printing before receipt ending --- History.txt | 7 +++++++ .../shtrih/jpos/fiscalprinter/receipt/CustomReceipt.java | 5 ++++- .../shtrih/jpos/fiscalprinter/receipt/FSSalesReceipt.java | 4 ++++ .../src/com/shtrih/util/ServiceVersion.java | 2 +- Source/FiscalPrinterTest/src/PrinterTest.java | 1 + 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/History.txt b/History.txt index c2912266..c79aedaf 100644 --- a/History.txt +++ b/History.txt @@ -5,6 +5,13 @@ Company : SHTRIH-M www.shtrih-m.ru (495) 787-6090 Url : https://github.com/shtrih-m/javapos_shtrih +******************************************************************************** + + 06.09.2023 + deviceServiceVersion = 1013702 + + [-] Fixed error with printing before receipt ending + ******************************************************************************** 29.08.2023 diff --git a/Source/Core/src/com/shtrih/jpos/fiscalprinter/receipt/CustomReceipt.java b/Source/Core/src/com/shtrih/jpos/fiscalprinter/receipt/CustomReceipt.java index f555d795..1aa65db0 100644 --- a/Source/Core/src/com/shtrih/jpos/fiscalprinter/receipt/CustomReceipt.java +++ b/Source/Core/src/com/shtrih/jpos/fiscalprinter/receipt/CustomReceipt.java @@ -36,6 +36,7 @@ public abstract class CustomReceipt implements FiscalReceipt { + protected boolean ending = false; protected boolean cancelled = false; private final SMFiscalPrinter printer; private static CompositeLogger logger = CompositeLogger.getLogger(CustomReceipt.class); @@ -120,7 +121,7 @@ public boolean isCancelled() { } public boolean isEnding() throws Exception{ - return isPayed() || isCancelled(); + return ending; } public void notSupported() throws Exception { @@ -129,6 +130,7 @@ public void notSupported() throws Exception { } public void beginFiscalReceipt(boolean printHeader) throws Exception { + ending = false; cancelled = false; } @@ -171,6 +173,7 @@ public void printRecTotal(long total, long payment, long payType, public void printRecVoid(String description) throws Exception { cancelled = true; + ending = true; } public void printRecVoidItem(String description, long amount, double quantity, diff --git a/Source/Core/src/com/shtrih/jpos/fiscalprinter/receipt/FSSalesReceipt.java b/Source/Core/src/com/shtrih/jpos/fiscalprinter/receipt/FSSalesReceipt.java index 32e89bb1..740f7fa3 100644 --- a/Source/Core/src/com/shtrih/jpos/fiscalprinter/receipt/FSSalesReceipt.java +++ b/Source/Core/src/com/shtrih/jpos/fiscalprinter/receipt/FSSalesReceipt.java @@ -836,6 +836,10 @@ public void printRecTotal(long total, long payment, long payType, checkTotal(getSubtotal(), total); addPayment(payment, payType); clearPrePostLine(); + + if (isPayed()){ + ending = true; + } } public void printRecItemVoid(String description, long price, double quantity, diff --git a/Source/FiscalPrinterService/src/com/shtrih/util/ServiceVersion.java b/Source/FiscalPrinterService/src/com/shtrih/util/ServiceVersion.java index 8b42750b..2b152742 100644 --- a/Source/FiscalPrinterService/src/com/shtrih/util/ServiceVersion.java +++ b/Source/FiscalPrinterService/src/com/shtrih/util/ServiceVersion.java @@ -1,5 +1,5 @@ package com.shtrih.util; public class ServiceVersion { - public static final String VERSION = "700"; + public static final String VERSION = "701"; } \ No newline at end of file diff --git a/Source/FiscalPrinterTest/src/PrinterTest.java b/Source/FiscalPrinterTest/src/PrinterTest.java index 34c364b1..63cc006f 100644 --- a/Source/FiscalPrinterTest/src/PrinterTest.java +++ b/Source/FiscalPrinterTest/src/PrinterTest.java @@ -3981,6 +3981,7 @@ public void printFiscalReceipt145_7() printer.resetPrinter(); printer.setFiscalReceiptType(SmFptrConst.SMFPTR_RT_SALE); printer.beginFiscalReceipt(false); + printer.printRecMessage("printRecMessage 1"); printer.fsWriteTag(1008, "foo@example.com"); TLVWriter tlvWriter = new TLVWriter();