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 82e504

Add facility to automatically open new TAKE OUT (Bar Sale) ticket if no existing tickets are present

Matt Smith [16-01-08 17:13]
Add facility to automatically open new TAKE OUT (Bar Sale) ticket if no existing tickets are present
diff --git a/i18n/messages.properties b/i18n/messages.properties
index 16e00f6..c562257 100755
--- a/i18n/messages.properties
+++ b/i18n/messages.properties
@@ -1307,6 +1307,7 @@ BARMOD_AutoSaveOpen.1=Automatically Save/Open Open take out tickets on Logout/Lo
 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
+BARMOD_AutoOpenTakeOutTicket=Automatically Open New TAKE OUT (Bar Sale) Ticket on Login (if no existing tickets are present)
 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 63c71fe..eea68c4 100755
--- a/i18n/messages_ar.properties
+++ b/i18n/messages_ar.properties
@@ -359,6 +359,7 @@ BARMOD_AutoSaveOpen.1=Automatically Save/Open Open take out tickets on Logout/Lo
 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
+BARMOD_AutoOpenTakeOutTicket=Automatically Open New TAKE OUT (Bar Sale) Ticket on Login (if no existing tickets are present)
 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 9957526..6e5a0fb 100755
--- a/i18n/messages_ar_EG.properties
+++ b/i18n/messages_ar_EG.properties
@@ -356,6 +356,7 @@ BARMOD_AutoSaveOpen.1=Automatically Save/Open Open take out tickets on Logout/Lo
 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
+BARMOD_AutoOpenTakeOutTicket=Automatically Open New TAKE OUT (Bar Sale) Ticket on Login (if no existing tickets are present)
 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 c3591c5..0b1a4ba 100755
--- a/i18n/messages_de.properties
+++ b/i18n/messages_de.properties
@@ -392,6 +392,7 @@ BARMOD_AutoSaveOpen.1=Automatically Save/Open Open take out tickets on Logout/Lo
 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
+BARMOD_AutoOpenTakeOutTicket=Automatically Open New TAKE OUT (Bar Sale) Ticket on Login (if no existing tickets are present)
 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 bc6c4af..72aa9c6 100755
--- a/i18n/messages_en_GB.properties
+++ b/i18n/messages_en_GB.properties
@@ -1307,7 +1307,7 @@ BARMOD_AutoSaveOpen.1=Automatically Save/Open Open take out tickets on Logout/Lo
 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
-
+BARMOD_AutoOpenTakeOutTicket=Automatically Open New TAKE OUT (Bar Sale) Ticket on Login (if no existing tickets are present)
 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 6810085..0596229 100755
--- a/i18n/messages_es.properties
+++ b/i18n/messages_es.properties
@@ -390,6 +390,7 @@ BARMOD_AutoSaveOpen.1=Automatically Save/Open Open take out tickets on Logout/Lo
 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
+BARMOD_AutoOpenTakeOutTicket=Automatically Open New TAKE OUT (Bar Sale) Ticket on Login (if no existing tickets are present)
 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 7512076..9090da5 100755
--- a/i18n/messages_nl.properties
+++ b/i18n/messages_nl.properties
@@ -392,6 +392,7 @@ BARMOD_AutoSaveOpen.1=Automatically Save/Open Open take out tickets on Logout/Lo
 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
+BARMOD_AutoOpenTakeOutTicket=Automatically Open New TAKE OUT (Bar Sale) Ticket on Login (if no existing tickets are present)
 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 71a1da4..ee22c68 100755
--- a/src/com/floreantpos/config/TerminalConfig.java
+++ b/src/com/floreantpos/config/TerminalConfig.java
@@ -47,6 +47,8 @@ public class TerminalConfig {

 	static final String TERMINAL_ID = "terminal_id"; //$NON-NLS-1$
 	static final String FULLSCREEN_MODE = "fullscreen_mode"; //$NON-NLS-1$
+	static final String AUTO_OPEN_TAKE_OUT_TICKET = "auto_open_takeout_ticket"; //$NON-NLS-1$
+

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

@@ -73,11 +75,19 @@ public class TerminalConfig {
 	public static boolean isFullscreenMode() {
 		return config.getBoolean(FULLSCREEN_MODE, false);
 	}
-
+
+	public static boolean isAutoOpenTakeOutTicket() {
+		return config.getBoolean(AUTO_OPEN_TAKE_OUT_TICKET, false);
+	}
+
 	public static void setFullscreenMode(boolean fullscreen) {
 		config.setProperty(FULLSCREEN_MODE, fullscreen);
 	}
-
+
+	public static void setAutoOpenTakeOutTicket(boolean autoopen) {
+		config.setProperty(AUTO_OPEN_TAKE_OUT_TICKET, autoopen);
+	}
+
 	public static String getAdminPassword() {
 		return config.getString(ADMIN_PASSWORD, PasswordHasher.hashPassword("1111")); //$NON-NLS-1$
 	}
diff --git a/src/com/floreantpos/config/ui/TerminalConfigurationView.java b/src/com/floreantpos/config/ui/TerminalConfigurationView.java
index 6a2a4ac..1be110d 100755
--- a/src/com/floreantpos/config/ui/TerminalConfigurationView.java
+++ b/src/com/floreantpos/config/ui/TerminalConfigurationView.java
@@ -36,6 +36,8 @@ public class TerminalConfigurationView extends ConfigurationView {

 	private JCheckBox cbTranslatedName = new JCheckBox(Messages.getString("TerminalConfigurationView.2")); //$NON-NLS-1$
 	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$
@@ -117,8 +119,24 @@ public class TerminalConfigurationView extends ConfigurationView {

 		add(cbAutoSaveOpen,"newline, span"); //$NON-NLS-1$

+		cbAutoSaveOpen.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				if(cbAutoSaveOpen.isSelected()) {
+					cbAutoOpenTakeOutTicket.setEnabled(true);
+				}
+				else {
+					cbAutoOpenTakeOutTicket.setEnabled(false);
+				}
+			}
+		});
+
+		add(cbAutoOpenTakeOutTicket, "newline, span"); //$NON-NLS-1$
+
 		add(cbTranslatedName, "span 2"); //$NON-NLS-1$
 		add(cbFullscreenMode, "newline, span"); //$NON-NLS-1$
+
+
 		add(cbUseSettlementPrompt, "newline, span"); //$NON-NLS-1$

 		add(new JLabel(Messages.getString("TerminalConfigurationView.17")), "newline");  //$NON-NLS-1$//$NON-NLS-2$
@@ -257,6 +275,8 @@ public class TerminalConfigurationView extends ConfigurationView {
 		TerminalConfig.setTerminalId(terminalNumber);
 		TerminalConfig.setDefaultPassLen(defaultPassLen);
 		TerminalConfig.setFullscreenMode(cbFullscreenMode.isSelected());
+		TerminalConfig.setAutoOpenTakeOutTicket(cbAutoOpenTakeOutTicket.isSelected());
+
 		TerminalConfig.setShowDbConfigureButton(cbShowDbConfiguration.isSelected());
 		TerminalConfig.setUseTranslatedName(cbTranslatedName.isSelected());

@@ -310,6 +330,8 @@ public class TerminalConfigurationView extends ConfigurationView {
 		tfTerminalNumber.setText(String.valueOf(TerminalConfig.getTerminalId()));
 		tfSecretKeyLength.setText(String.valueOf(TerminalConfig.getDefaultPassLen()));
 		cbFullscreenMode.setSelected(TerminalConfig.isFullscreenMode());
+		cbAutoOpenTakeOutTicket.setSelected(TerminalConfig.isAutoOpenTakeOutTicket());
+
 		cbShowDbConfiguration.setSelected(TerminalConfig.isShowDbConfigureButton());
 		cbUseSettlementPrompt.setSelected(TerminalConfig.isUseSettlementPrompt());

@@ -327,6 +349,7 @@ public class TerminalConfigurationView extends ConfigurationView {


 		cbAutoSaveOpen.setSelected(TerminalConfig.isAutoSaveOpen());
+		cbAutoOpenTakeOutTicket.setEnabled(TerminalConfig.isAutoSaveOpen());
 		cbAutoTerminalID.setSelected(TerminalConfig.isAutoTerminalID());


diff --git a/src/com/floreantpos/ui/views/SwitchboardView.java b/src/com/floreantpos/ui/views/SwitchboardView.java
index cceb07f..7ef3a03 100755
--- a/src/com/floreantpos/ui/views/SwitchboardView.java
+++ b/src/com/floreantpos/ui/views/SwitchboardView.java
@@ -504,6 +504,12 @@ public class SwitchboardView extends ViewPanel implements ActionListener, ITicke
 		User user = Application.getCurrentUser();
 		Ticket ticket=ticketList.getAllOpenTicketsWithUser(user,OrderType.TAKE_OUT);
 		if (ticket!=null) editTicket(ticket);
+		if ((ticket==null)&&(com.floreantpos.config.TerminalConfig.isAutoOpenTakeOutTicket())) {
+			btnTakeout.doClick();
+			//doCreateNewTicket(OrderType.TAKE_OUT);
+			//OrderUtil.createNewTakeOutOrder(OrderType.TAKE_OUT);
+		}
+
 	}

 	private void doCreateNewTicket(final OrderType ticketType) {

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