TavernerPOS - Source Code

Clone: 

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

 

Index » tavernerPOS : Commitdiff 85a827

Add option to automatically close Order Summary (Transaction Complete) after a user specified delay - set in Terminal Config)

Matt Smith [16-01-08 14:56]
Add option to automatically close Order Summary (Transaction Complete) after a user specified delay - set in Terminal Config)
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
index 14f521d..6472c7c 100755
--- a/.settings/org.eclipse.jdt.core.prefs
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -1,5 +1,13 @@
 eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
 org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
 org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
 org.eclipse.jdt.core.compiler.source=1.6
diff --git a/i18n/messages.properties b/i18n/messages.properties
index a4c87b8..16e00f6 100755
--- a/i18n/messages.properties
+++ b/i18n/messages.properties
@@ -1305,6 +1305,8 @@ 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?
 BARMOD_AutoTerminalID.1=Automatically set Terminal ID based on last 9 decimal digits of network MAC Address.
+BARMOD_AutoCloseSummary=Enable auto close summary
+BARMOD_AutoCloseSummaryTime=Auto close summary time
 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 237e438..63c71fe 100755
--- a/i18n/messages_ar.properties
+++ b/i18n/messages_ar.properties
@@ -357,6 +357,8 @@ 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?
 BARMOD_AutoTerminalID.1=Automatically set Terminal ID based on last 9 decimal digits of network MAC Address.
+BARMOD_AutoCloseSummary=Enable auto close summary
+BARMOD_AutoCloseSummaryTime=Auto close summary time
 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 839a0a9..9957526 100755
--- a/i18n/messages_ar_EG.properties
+++ b/i18n/messages_ar_EG.properties
@@ -354,6 +354,8 @@ 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?
 BARMOD_AutoTerminalID.1=Automatically set Terminal ID based on last 9 decimal digits of network MAC Address.
+BARMOD_AutoCloseSummary=Enable auto close summary
+BARMOD_AutoCloseSummaryTime=Auto close summary time
 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 5b6dd04..c3591c5 100755
--- a/i18n/messages_de.properties
+++ b/i18n/messages_de.properties
@@ -390,6 +390,8 @@ 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?
 BARMOD_AutoTerminalID.1=Automatically set Terminal ID based on last 9 decimal digits of network MAC Address.
+BARMOD_AutoCloseSummary=Enable auto close summary
+BARMOD_AutoCloseSummaryTime=Auto close summary time
 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 d8660f8..bc6c4af 100755
--- a/i18n/messages_en_GB.properties
+++ b/i18n/messages_en_GB.properties
@@ -1305,6 +1305,9 @@ 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?
 BARMOD_AutoTerminalID.1=Automatically set Terminal ID based on last 9 decimal digits of network MAC Address.
+BARMOD_AutoCloseSummary=Enable auto close summary
+BARMOD_AutoCloseSummaryTime=Auto close summary time
+
 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 eb26434..6810085 100755
--- a/i18n/messages_es.properties
+++ b/i18n/messages_es.properties
@@ -388,6 +388,8 @@ 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?
 BARMOD_AutoTerminalID.1=Automatically set Terminal ID based on last 9 decimal digits of network MAC Address.
+BARMOD_AutoCloseSummary=Enable auto close summary
+BARMOD_AutoCloseSummaryTime=Auto close summary time
 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 081cbcc..7512076 100755
--- a/i18n/messages_nl.properties
+++ b/i18n/messages_nl.properties
@@ -390,6 +390,8 @@ 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?
 BARMOD_AutoTerminalID.1=Automatically set Terminal ID based on last 9 decimal digits of network MAC Address.
+BARMOD_AutoCloseSummary=Enable auto close summary
+BARMOD_AutoCloseSummaryTime=Auto close summary time
 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 a4dbf49..71a1da4 100755
--- a/src/com/floreantpos/config/TerminalConfig.java
+++ b/src/com/floreantpos/config/TerminalConfig.java
@@ -32,6 +32,10 @@ public class TerminalConfig {
 	private static final String AUTO_LOGOFF_TIME = "AUTO_LOGOFF_TIME"; //$NON-NLS-1$

 	private static final String AUTO_LOGOFF_ENABLE = "AUTO_LOGOFF_ENABLE"; //$NON-NLS-1$
+
+	private static final String AUTO_CLOSESUMMARY_TIME = "AUTO_CLOSESUMMARY_TIME"; //$NON-NLS-1$
+
+	private static final String AUTO_CLOSESUMMARY_ENABLE = "AUTO_CLOSESUMMARY_ENABLE"; //$NON-NLS-1$

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

@@ -126,6 +130,23 @@ public class TerminalConfig {
 		return config.getInt(AUTO_LOGOFF_TIME, 60);
 	}

+
+	public static boolean isAutoCloseSummaryEnable() {
+		return config.getBoolean(AUTO_CLOSESUMMARY_ENABLE, true);
+	}
+
+	public static void setAutoCloseSummaryEnable(boolean enable) {
+		config.setProperty(AUTO_CLOSESUMMARY_ENABLE, enable);
+	}
+
+	public static void setAutoCloseSummaryTime(int time) {
+		config.setProperty(AUTO_CLOSESUMMARY_TIME, time);
+	}
+
+	public static int getAutoCloseSummaryTime() {
+		return config.getInt(AUTO_CLOSESUMMARY_TIME, 30);
+	}
+
 	public static String getUiDefaultFont() {
 		return config.getString(UI_DEFAULT_FONT);
 	}
diff --git a/src/com/floreantpos/config/ui/TerminalConfigurationView.java b/src/com/floreantpos/config/ui/TerminalConfigurationView.java
index 8e4e041..6a2a4ac 100755
--- a/src/com/floreantpos/config/ui/TerminalConfigurationView.java
+++ b/src/com/floreantpos/config/ui/TerminalConfigurationView.java
@@ -49,6 +49,9 @@ public class TerminalConfigurationView extends ConfigurationView {
 	private JCheckBox cbAutoLogoff = new JCheckBox(Messages.getString("TerminalConfigurationView.7")); //$NON-NLS-1$
 	private IntegerTextField tfLogoffTime = new IntegerTextField(4);

+	private JCheckBox cbAutoCloseSummary = new JCheckBox(Messages.getString("BARMOD_AutoCloseSummaryTime")); //$NON-NLS-1$
+	private IntegerTextField tfCloseSummaryTime = new IntegerTextField(4);
+
 	JCheckBox chkHasCashDrawer;
 	private JTextField tfDrawerName = new JTextField(10);
 	private JTextField tfDrawerCodes = new JTextField(15);
@@ -90,10 +93,28 @@ public class TerminalConfigurationView extends ConfigurationView {
 				}
 			}
 		});
+
 		add(cbAutoLogoff, "newline"); //$NON-NLS-1$
 		add(new JLabel(Messages.getString("TerminalConfigurationView.16"))); //$NON-NLS-1$
 		add(tfLogoffTime, "wrap"); //$NON-NLS-1$

+
+		cbAutoCloseSummary.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				if(cbAutoCloseSummary.isSelected()) {
+					tfCloseSummaryTime.setEnabled(true);
+				}
+				else {
+					tfCloseSummaryTime.setEnabled(false);
+				}
+			}
+		});
+
+		add(cbAutoCloseSummary, "newline"); //$NON-NLS-1$
+		add(new JLabel(Messages.getString("BARMOD_AutoCloseSummaryTime"))); //$NON-NLS-1$
+		add(tfCloseSummaryTime, "wrap"); //$NON-NLS-1$
+
 		add(cbAutoSaveOpen,"newline, span"); //$NON-NLS-1$

 		add(cbTranslatedName, "span 2"); //$NON-NLS-1$
@@ -244,6 +265,11 @@ public class TerminalConfigurationView extends ConfigurationView {

 		TerminalConfig.setAutoLogoffEnable(cbAutoLogoff.isSelected());
 		TerminalConfig.setAutoLogoffTime(tfLogoffTime.getInteger() <= 0 ? 10 : tfLogoffTime.getInteger());
+
+		TerminalConfig.setAutoCloseSummaryEnable(cbAutoCloseSummary.isSelected());
+		TerminalConfig.setAutoCloseSummaryTime(tfCloseSummaryTime.getInteger() <= 0 ? 10 : tfCloseSummaryTime.getInteger());
+
+

 		TerminalConfig.setAutoSaveOpen(cbAutoSaveOpen.isSelected());
 		TerminalConfig.setAutoTerminalID(cbAutoTerminalID.isSelected());
@@ -295,6 +321,11 @@ public class TerminalConfigurationView extends ConfigurationView {
 		tfLogoffTime.setText("" + TerminalConfig.getAutoLogoffTime()); //$NON-NLS-1$
 		tfLogoffTime.setEnabled(cbAutoLogoff.isSelected());

+		cbAutoCloseSummary.setSelected(TerminalConfig.isAutoCloseSummaryEnable());
+		tfCloseSummaryTime.setText("" + TerminalConfig.getAutoCloseSummaryTime()); //$NON-NLS-1$
+		tfCloseSummaryTime.setEnabled(cbAutoCloseSummary.isSelected());
+
+
 		cbAutoSaveOpen.setSelected(TerminalConfig.isAutoSaveOpen());
 		cbAutoTerminalID.setSelected(TerminalConfig.isAutoTerminalID());

diff --git a/src/com/floreantpos/ui/dialog/TransactionCompletionDialog.java b/src/com/floreantpos/ui/dialog/TransactionCompletionDialog.java
old mode 100644
new mode 100755
index 3d40a44..8b1902f
--- a/src/com/floreantpos/ui/dialog/TransactionCompletionDialog.java
+++ b/src/com/floreantpos/ui/dialog/TransactionCompletionDialog.java
@@ -2,7 +2,7 @@ package com.floreantpos.ui.dialog;

 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
-
+import javax.swing.Timer;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.JSeparator;
@@ -31,14 +31,21 @@ public class TransactionCompletionDialog extends POSDialog {
 	private JLabel lblDueAmount;
 	private JLabel lblChangeDue;
 	private JLabel lblGratuityAmount;
+
+	private int timerProgress;
+

 	private PosTransaction completedTransaction;

 	public TransactionCompletionDialog(PosTransaction transaction) {
+
+
+
+
 		this.completedTransaction = transaction;

-		setTitle(com.floreantpos.POSConstants.TRANSACTION_COMPLETED);
-
+		setTitle(com.floreantpos.POSConstants.TRANSACTION_COMPLETED+" (Closing in "+com.floreantpos.config.TerminalConfig.getAutoCloseSummaryTime()+")");
+
 		setLayout(new MigLayout("align 50% 0%, ins 20", "[]20[]", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

 		add(createLabel(Messages.getString("TransactionCompletionDialog.3") + ":", JLabel.LEFT), "grow"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -73,8 +80,23 @@ public class TransactionCompletionDialog extends POSDialog {

 		add(new JSeparator(), "sg mygroup,newline,span,grow"); //$NON-NLS-1$
 		PosButton btnClose = new PosButton(Messages.getString("TransactionCompletionDialog.37")); //$NON-NLS-1$
+
+		timerProgress=1;
+		 Timer timer = new Timer(1000, new ActionListener() {
+	            public void actionPerformed(ActionEvent e) {
+	            	setTitle(com.floreantpos.POSConstants.TRANSACTION_COMPLETED+" (Closing in "+(com.floreantpos.config.TerminalConfig.getAutoCloseSummaryTime()-timerProgress)+")");
+	            	timerProgress++;
+	            	if (timerProgress>com.floreantpos.config.TerminalConfig.getAutoCloseSummaryTime())  dispose();
+	            }
+	        });
+	        timer.setRepeats(true);
+	        timer.start();
+
+
 		btnClose.addActionListener(new ActionListener() {

+
+
 			public void actionPerformed(ActionEvent e) {
 				dispose();
 			}

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