TavernerPOS - Source Code

Clone: 

git clone http://www.librarysmith.co.uk/tavernerPOS

 

viewgit/viewgit/inc/functions.php:49 Function create_function() is deprecated [8192]

Index » tavernerPOS : Commitdiff HEAD

Add option to turn on/off automatic receipt printing. Correct missing translation for extended day

Matt Smith [16-07-20 09:43]
Add option to turn on/off automatic receipt printing. Correct missing translation for extended day
diff --git a/i18n/messages.properties b/i18n/messages.properties
index 5060cd3..ed458a8 100755
--- a/i18n/messages.properties
+++ b/i18n/messages.properties
@@ -1140,6 +1140,8 @@ TerminalConfigurationView.7=Enable auto logoff
 TerminalConfigurationView.8=Print receipt on order settle
 TerminalConfigurationView.9=Default password length
 TerminalConfigurationView.TERMINAL_NUMBER=Terminal number\:
+TerminalConfigurationView.EXTENDDAYHOURS=Extend Day x Hours
+TerminalConfigurationView.ERROR_RANGE_CHECK_EXTENDED_DAYS=Extended Hours must be between 0 and 11 (i.e. No added time = 0 = 23:59:59 and 11=11AM the next day).
 TerminalSetupDialog.0=Setup this terminal
 TerminalSetupDialog.10=Save
 TerminalSetupDialog.12=Close
@@ -1318,6 +1320,7 @@ BARMOD_AutoCloseSummary=Enable auto close summary
 BARMOD_AutoCloseSummaryTime=Auto close summary time
 BARMOD_AutoOpenTakeOutTicket=Automatically Open New TAKE OUT (Bar Sale) Ticket on Login (if no existing tickets are present)
 BARMOD_AutoFillCardAuth=Automatically Fill Authorization Code with Time Stamp
+BARMOD_AutoPrintReceipt=Automatically Print Receipt
 DATETIMEFORMAT=M/d/yy, h:mm a
 DATEFORMAT=dd MMM, yyyy
 DATELONGFORMAT=MMM dd yyyy, h:mm a
diff --git a/i18n/messages_ar.properties b/i18n/messages_ar.properties
index 6e07a65..3512045 100755
--- a/i18n/messages_ar.properties
+++ b/i18n/messages_ar.properties
@@ -368,6 +368,7 @@ BARMOD_AutoCloseSummary=Enable auto close summary
 BARMOD_AutoCloseSummaryTime=Auto close summary time
 BARMOD_AutoOpenTakeOutTicket=Automatically Open New TAKE OUT (Bar Sale) Ticket on Login (if no existing tickets are present)
 BARMOD_AutoFillCardAuth=Automatically Fill Authorization Code with Time Stamp
+BARMOD_AutoPrintReceipt=Automatically Print Receipt
 DATETIMEFORMAT=d/M/yy, h:mm a
 DATEFORMAT=dd MMM, yyyy
 DATELONGFORMAT=MMM dd yyyy, h:mm a
diff --git a/i18n/messages_ar_EG.properties b/i18n/messages_ar_EG.properties
index db452f5..dce4c43 100755
--- a/i18n/messages_ar_EG.properties
+++ b/i18n/messages_ar_EG.properties
@@ -365,6 +365,7 @@ BARMOD_AutoCloseSummary=Enable auto close summary
 BARMOD_AutoCloseSummaryTime=Auto close summary time
 BARMOD_AutoOpenTakeOutTicket=Automatically Open New TAKE OUT (Bar Sale) Ticket on Login (if no existing tickets are present)
 BARMOD_AutoFillCardAuth=Automatically Fill Authorization Code with Time Stamp
+BARMOD_AutoPrintReceipt=Automatically Print Receipt
 DATETIMEFORMAT=d/M/yy, h:mm a
 DATEFORMAT=dd MMM, yyyy
 DATELONGFORMAT=MMM dd yyyy, h:mm a
diff --git a/i18n/messages_de.properties b/i18n/messages_de.properties
index a9380cb..0d831bd 100755
--- a/i18n/messages_de.properties
+++ b/i18n/messages_de.properties
@@ -393,6 +393,8 @@ TerminalConfigurationView.14=Klemme Nummer ist ungültig
 TerminalConfigurationView.6=Quittung ausdrucken auf Bestellung Finish
 TerminalConfigurationView.8=Quittung ausdrucken auf Bestellung absetzen
 TerminalConfigurationView.TERMINAL_NUMBER=Klemmennummer:
+TerminalConfigurationView.EXTENDDAYHOURS=Extend Day x Hours
+TerminalConfigurationView.ERROR_RANGE_CHECK_EXTENDED_DAYS=Extended Hours must be between 0 and 11 (i.e. No added time = 0 = 23:59:59 and 11=11AM the next day).
 BARMOD_TicketListView.21=Are you sure you want to clear all item?
 BARMOD_TicketListView.20=Clear All Items?
 BARMOD_AutoSaveOpen.1=Automatically Save/Open Open take out tickets on Logout/Login?
@@ -401,6 +403,7 @@ BARMOD_AutoCloseSummary=Enable auto close summary
 BARMOD_AutoCloseSummaryTime=Auto close summary time
 BARMOD_AutoOpenTakeOutTicket=Automatically Open New TAKE OUT (Bar Sale) Ticket on Login (if no existing tickets are present)
 BARMOD_AutoFillCardAuth=Automatically Fill Authorization Code with Time Stamp
+BARMOD_AutoPrintReceipt=Automatically Print Receipt
 DATETIMEFORMAT=d/M/yy, h:mm a
 DATEFORMAT=dd MMM, yyyy
 DATELONGFORMAT=MMM dd yyyy, h:mm a
diff --git a/i18n/messages_en_GB.properties b/i18n/messages_en_GB.properties
index 640c1d1..1e3c3db 100755
--- a/i18n/messages_en_GB.properties
+++ b/i18n/messages_en_GB.properties
@@ -1141,6 +1141,9 @@ TerminalConfigurationView.7=Enable auto logoff
 TerminalConfigurationView.8=Print receipt on order settle
 TerminalConfigurationView.9=Default password length
 TerminalConfigurationView.TERMINAL_NUMBER=Terminal number\:
+TerminalConfigurationView.EXTENDDAYHOURS=Extend Day x Hours
+TerminalConfigurationView.ERROR_RANGE_CHECK_EXTENDED_DAYS=Extended Hours must be between 0 and 11 (i.e. No added time = 0 = 23:59:59 and 11=11AM the next day).
+
 TerminalSetupDialog.0=Setup this terminal
 TerminalSetupDialog.10=Save
 TerminalSetupDialog.12=Close
@@ -1319,6 +1322,7 @@ BARMOD_AutoCloseSummary=Enable auto close summary
 BARMOD_AutoCloseSummaryTime=Auto close summary time
 BARMOD_AutoOpenTakeOutTicket=Automatically Open New TAKE OUT (Bar Sale) Ticket on Login (if no existing tickets are present)
 BARMOD_AutoFillCardAuth=Automatically Fill Authorisation Code with Time Stamp
+BARMOD_AutoPrintReceipt=Automatically Print Receipt
 DATETIMEFORMAT=d/M/yy, h:mm a
 DATEFORMAT=dd MMM, yyyy
 DATELONGFORMAT=MMM dd yyyy, h:mm a
diff --git a/i18n/messages_es.properties b/i18n/messages_es.properties
index bac535d..8a6084e 100755
--- a/i18n/messages_es.properties
+++ b/i18n/messages_es.properties
@@ -391,6 +391,8 @@ TerminalConfigurationView.14=Terminal number is not valid
 TerminalConfigurationView.6=Print receipt on order finish
 TerminalConfigurationView.8=Print receipt on order settle
 TerminalConfigurationView.TERMINAL_NUMBER=Terminal number:
+TerminalConfigurationView.EXTENDDAYHOURS=Extend Day x Hours
+TerminalConfigurationView.ERROR_RANGE_CHECK_EXTENDED_DAYS=Extended Hours must be between 0 and 11 (i.e. No added time = 0 = 23:59:59 and 11=11AM the next day).
 BARMOD_TicketListView.21=Are you sure you want to clear all item?
 BARMOD_TicketListView.20=Clear All Items?
 BARMOD_AutoSaveOpen.1=Automatically Save/Open Open take out tickets on Logout/Login?
@@ -399,6 +401,7 @@ BARMOD_AutoCloseSummary=Enable auto close summary
 BARMOD_AutoCloseSummaryTime=Auto close summary time
 BARMOD_AutoOpenTakeOutTicket=Automatically Open New TAKE OUT (Bar Sale) Ticket on Login (if no existing tickets are present)
 BARMOD_AutoFillCardAuth=Automatically Fill Authorization Code with Time Stamp
+BARMOD_AutoPrintReceipt=Automatically Print Receipt
 DATETIMEFORMAT=d/M/yy, h:mm a
 DATEFORMAT=dd MMM, yyyy
 DATELONGFORMAT=MMM dd yyyy, h:mm a
diff --git a/i18n/messages_nl.properties b/i18n/messages_nl.properties
index b7adddd..8a89a89 100755
--- a/i18n/messages_nl.properties
+++ b/i18n/messages_nl.properties
@@ -393,6 +393,8 @@ TerminalConfigurationView.14=Klemnummer is niet geldig
 TerminalConfigurationView.6=Print ontvangst op bestelling afwerking
 TerminalConfigurationView.8=Print ontvangst op bestelling af te wikkelen
 TerminalConfigurationView.TERMINAL_NUMBER=Klemnummer:
+TerminalConfigurationView.EXTENDDAYHOURS=Extend Day x Hours
+TerminalConfigurationView.ERROR_RANGE_CHECK_EXTENDED_DAYS=Extended Hours must be between 0 and 11 (i.e. No added time = 0 = 23:59:59 and 11=11AM the next day).
 BARMOD_TicketListView.21=Are you sure you want to clear all item?
 BARMOD_TicketListView.20=Clear All Items?
 BARMOD_AutoSaveOpen.1=Automatically Save/Open Open take out tickets on Logout/Login?
@@ -401,6 +403,7 @@ BARMOD_AutoCloseSummary=Enable auto close summary
 BARMOD_AutoCloseSummaryTime=Auto close summary time
 BARMOD_AutoOpenTakeOutTicket=Automatically Open New TAKE OUT (Bar Sale) Ticket on Login (if no existing tickets are present)
 BARMOD_AutoFillCardAuth=Automatically Fill Authorization Code with Time Stamp
+BARMOD_AutoPrintReceipt=Automatically Print Receipt
 DATETIMEFORMAT=d/M/yy, h:mm a
 DATEFORMAT=dd MMM, yyyy
 DATELONGFORMAT=MMM dd yyyy, h:mm a
diff --git a/src/com/floreantpos/config/TerminalConfig.java b/src/com/floreantpos/config/TerminalConfig.java
index cafca54..46019f0 100755
--- a/src/com/floreantpos/config/TerminalConfig.java
+++ b/src/com/floreantpos/config/TerminalConfig.java
@@ -54,7 +54,8 @@ public class TerminalConfig {

 	private static final String AUTOSAVEANDOPEN_TAKEOUT_TICKET = "auto_save_and_open";//$NON-NLS-1$

-	private static final String AUTOTERMINAL_ID= "auto_terminal_id";//$NON-NLS-1$
+	private static final String AUTOTERMINAL_ID = "auto_terminal_id";//$NON-NLS-1$
+	private static final String AUTOPRINTRECEIPT = "auto_print_receipt";//$NON-NLS-1$

 	private static PropertiesConfiguration config = AppConfig.getConfig();

@@ -301,6 +302,14 @@ public class TerminalConfig {
 		config.setProperty(AUTOTERMINAL_ID, autoterminalid);
 	}

+	public static boolean isAutoPrintReceipt() {
+		return config.getBoolean(AUTOPRINTRECEIPT, false);
+	}
+
+	public static void setAutoPrintReceipt(boolean autoprintreceipt) {
+		config.setProperty(AUTOPRINTRECEIPT,autoprintreceipt);
+	}
+

 	public static char[] getDrawerControlCodesArray() {
 		String drawerControlCodes = getDefaultDrawerControlCodes();
diff --git a/src/com/floreantpos/config/ui/TerminalConfigurationView.java b/src/com/floreantpos/config/ui/TerminalConfigurationView.java
index a3e1fba..2ef0a25 100755
--- a/src/com/floreantpos/config/ui/TerminalConfigurationView.java
+++ b/src/com/floreantpos/config/ui/TerminalConfigurationView.java
@@ -40,10 +40,13 @@ public class TerminalConfigurationView extends ConfigurationView {
 	private JCheckBox cbFullscreenMode = new JCheckBox(Messages.getString("TerminalConfigurationView.3")); //$NON-NLS-1$
 	private JCheckBox cbAutoOpenTakeOutTicket = new JCheckBox(Messages.getString("BARMOD_AutoOpenTakeOutTicket")); //$NON-NLS-1$

+
 	private JCheckBox cbUseSettlementPrompt = new JCheckBox(Messages.getString("TerminalConfigurationView.4")); //$NON-NLS-1$
 	private JCheckBox cbShowDbConfiguration = new JCheckBox(Messages.getString("TerminalConfigurationView.5")); //$NON-NLS-1$
 	private JCheckBox cbAutoSaveOpen = new JCheckBox(Messages.getString("BARMOD_AutoSaveOpen.1")); //$NON-NLS-1$
 	private JCheckBox cbAutoTerminalID = new JCheckBox(Messages.getString("BARMOD_AutoTerminalID.1")); //$NON-NLS-1$
+	private JCheckBox cbAutoPrintReceipt = new JCheckBox(Messages.getString("BARMOD_AutoPrintReceipt")); //$NON-NLS-1$
+

 	private JComboBox<String> cbFonts = new JComboBox<String>();

@@ -80,6 +83,8 @@ public class TerminalConfigurationView extends ConfigurationView {
 		tfTerminalNumber.setColumns(10);
 		add(tfTerminalNumber, "aligny top, wrap"); //$NON-NLS-1$

+		add(cbAutoPrintReceipt,"newline, span"); //$NON-NLS-1$
+
 		add(new JLabel(Messages.getString("TerminalConfigurationView.9"))); //$NON-NLS-1$
 		tfSecretKeyLength = new IntegerTextField(3);
 		add(tfSecretKeyLength, "wrap"); //$NON-NLS-1$
@@ -313,7 +318,7 @@ public class TerminalConfigurationView extends ConfigurationView {

 		TerminalConfig.setAutoSaveOpen(cbAutoSaveOpen.isSelected());
 		TerminalConfig.setAutoTerminalID(cbAutoTerminalID.isSelected());
-
+		TerminalConfig.setAutoPrintReceipt(cbAutoPrintReceipt.isSelected());

 		TerminalConfig.setUseSettlementPrompt(cbUseSettlementPrompt.isSelected());

@@ -372,7 +377,7 @@ public class TerminalConfigurationView extends ConfigurationView {
 		cbAutoSaveOpen.setSelected(TerminalConfig.isAutoSaveOpen());
 		cbAutoOpenTakeOutTicket.setEnabled(TerminalConfig.isAutoSaveOpen());
 		cbAutoTerminalID.setSelected(TerminalConfig.isAutoTerminalID());
-
+		cbAutoPrintReceipt.setSelected(TerminalConfig.isAutoPrintReceipt());

 		initializeFontConfig();

diff --git a/src/com/floreantpos/ui/views/payment/SettleTicketDialog.java b/src/com/floreantpos/ui/views/payment/SettleTicketDialog.java
index b61a8eb..4678b0f 100755
--- a/src/com/floreantpos/ui/views/payment/SettleTicketDialog.java
+++ b/src/com/floreantpos/ui/views/payment/SettleTicketDialog.java
@@ -392,7 +392,7 @@ public class SettleTicketDialog extends POSDialog implements CardInputListener {
 			transactionService.settleTicket(ticket, transaction);

 			//FIXME
-			//printTicket(ticket, transaction);
+			if (TerminalConfig.isAutoPrintReceipt()) printTicket(ticket, transaction);
 			DrawerUtil.kickDrawer();

Add comment
These comments are moderated so so won't be published until reviewed.