TavernerPOS - Source Code
Clone:
git clone http://www.librarysmith.co.uk/tavernerPOS
viewgit/viewgit/inc/functions.php:49 Function create_function() is deprecated [8192]Prevent printing of ticket-receipt by default on payment screen.
diff --git a/config/printerlayouts/ticket-receipt.jasper b/config/printerlayouts/ticket-receipt.jasper
new file mode 100755
index 0000000..24b5d90
Binary files /dev/null and b/config/printerlayouts/ticket-receipt.jasper differ
diff --git a/config/printerlayouts/ticket-receipt.jrxml b/config/printerlayouts/ticket-receipt.jrxml
old mode 100644
new mode 100755
index a0f3714..d618893
--- a/config/printerlayouts/ticket-receipt.jrxml
+++ b/config/printerlayouts/ticket-receipt.jrxml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="TicketReceiptReport" pageWidth="164" pageHeight="324" whenNoDataType="BlankPage" columnWidth="148" leftMargin="8" rightMargin="8" topMargin="0" bottomMargin="14" isFloatColumnFooter="true" isIgnorePagination="true">
+<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="TicketReceiptReport" pageWidth="136" pageHeight="324" whenNoDataType="BlankPage" columnWidth="136" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="14" isFloatColumnFooter="true" isIgnorePagination="true">
<property name="ireport.scriptlethandling" value="0"/>
<property name="ireport.encoding" value="UTF-8"/>
- <property name="ireport.zoom" value="1.5"/>
+ <property name="ireport.zoom" value="2.1961500000000007"/>
<property name="ireport.x" value="0"/>
- <property name="ireport.y" value="336"/>
+ <property name="ireport.y" value="0"/>
<import value="net.sf.jasperreports.engine.*"/>
<import value="java.util.*"/>
<import value="net.sf.jasperreports.engine.data.*"/>
@@ -194,7 +194,7 @@
<textFieldExpression class="java.lang.String"><![CDATA[$P{headerLine5}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement key="textField-12" x="0" y="0" width="148" height="18" isRemoveLineWhenBlank="true"/>
+ <reportElement key="textField-12" x="0" y="0" width="136" height="18" isRemoveLineWhenBlank="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -202,12 +202,12 @@
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
- <font fontName="Monospaced" size="12" isBold="true" pdfFontName="Helvetica-Bold"/>
+ <font fontName="Monospaced" size="11" isBold="true" pdfFontName="Helvetica-Bold"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$P{headerLine1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement key="textField-13" x="0" y="18" width="148" height="14" isRemoveLineWhenBlank="true"/>
+ <reportElement key="textField-13" x="0" y="26" width="136" height="14" isRemoveLineWhenBlank="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -220,7 +220,7 @@
<textFieldExpression class="java.lang.String"><![CDATA[$P{headerLine2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement key="textField-14" x="0" y="32" width="148" height="14" isRemoveLineWhenBlank="true"/>
+ <reportElement key="textField-14" x="0" y="40" width="136" height="14" isRemoveLineWhenBlank="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -233,7 +233,7 @@
<textFieldExpression class="java.lang.String"><![CDATA[$P{headerLine3}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement key="textField-15" x="0" y="46" width="148" height="14" isRemoveLineWhenBlank="true"/>
+ <reportElement key="textField-15" x="0" y="54" width="136" height="14" isRemoveLineWhenBlank="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -246,7 +246,7 @@
<textFieldExpression class="java.lang.String"><![CDATA[$P{headerLine4}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement key="textField-16" x="0" y="60" width="148" height="14" isRemoveLineWhenBlank="true"/>
+ <reportElement key="textField-16" x="0" y="68" width="136" height="14" isRemoveLineWhenBlank="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -259,7 +259,7 @@
<textFieldExpression class="java.lang.String"><![CDATA[$P{headerLine5}]]></textFieldExpression>
</textField>
<line>
- <reportElement key="line-1" x="0" y="99" width="148" height="1" isRemoveLineWhenBlank="true">
+ <reportElement key="line-1" x="0" y="99" width="132" height="1" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[$P{showHeaderSeparator}!=null && $P{showHeaderSeparator}==true]]></printWhenExpression>
</reportElement>
<graphicElement>
@@ -267,7 +267,7 @@
</graphicElement>
</line>
<line>
- <reportElement key="line-1" positionType="Float" x="0" y="142" width="148" height="1"/>
+ <reportElement key="line-1" positionType="Float" x="0" y="142" width="136" height="1"/>
<graphicElement>
<pen lineWidth="1.0" lineStyle="Dashed"/>
</graphicElement>
@@ -287,7 +287,7 @@
<textFieldExpression class="java.lang.String"><![CDATA[$P{quantityText}]]></textFieldExpression>
</textField>
<textField>
- <reportElement key="staticText-4" positionType="Float" x="98" y="145" width="50" height="15">
+ <reportElement key="staticText-4" positionType="Float" x="98" y="145" width="34" height="15">
<printWhenExpression><![CDATA[$P{showSubtotal}==true]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right" verticalAlignment="Middle" markup="none">
@@ -296,7 +296,7 @@
<textFieldExpression class="java.lang.String"><![CDATA[$P{subTotalText}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement key="textField-16" x="0" y="82" width="148" height="14" isRemoveLineWhenBlank="true"/>
+ <reportElement key="textField-16" x="-4" y="82" width="140" height="14" isRemoveLineWhenBlank="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -321,20 +321,20 @@
</graphicElement>
</line>
<line>
- <reportElement positionType="Float" x="112" y="162" width="36" height="1"/>
+ <reportElement positionType="Float" x="100" y="162" width="36" height="1"/>
<graphicElement>
<pen lineStyle="Dashed"/>
</graphicElement>
</line>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement stretchType="RelativeToBandHeight" x="0" y="103" width="148" height="12" isRemoveLineWhenBlank="true"/>
+ <reportElement stretchType="RelativeToBandHeight" x="0" y="103" width="136" height="12" isRemoveLineWhenBlank="true"/>
<textElement markup="html">
<font fontName="Monospaced" size="9"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$P{ticketHeader}]]></textFieldExpression>
</textField>
<componentElement>
- <reportElement positionType="Float" x="1" y="115" width="146" height="20" isRemoveLineWhenBlank="true"/>
+ <reportElement positionType="Float" x="1" y="115" width="135" height="20" isRemoveLineWhenBlank="true"/>
<jr:barbecue xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" type="Code128" drawText="false" checksumRequired="false">
<jr:codeExpression><![CDATA[$P{barcode}]]></jr:codeExpression>
</jr:barbecue>
@@ -365,7 +365,7 @@
<textFieldExpression class="java.lang.String"><![CDATA[$F{itemName}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement key="textField" x="98" y="0" width="50" height="12" isRemoveLineWhenBlank="true">
+ <reportElement key="textField" x="98" y="0" width="34" height="12" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[$P{showSubtotal}==true]]></printWhenExpression>
</reportElement>
<box>
@@ -429,7 +429,7 @@
<textFieldExpression class="java.lang.String"><![CDATA[$P{netAmountText}]]></textFieldExpression>
</textField>
<line>
- <reportElement key="line-2" x="0" y="0" width="148" height="1">
+ <reportElement key="line-2" x="0" y="0" width="136" height="1">
<printWhenExpression><![CDATA[$P{showFooter}==true]]></printWhenExpression>
</reportElement>
<graphicElement>
@@ -437,7 +437,7 @@
</graphicElement>
</line>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement key="textField-1" x="98" y="117" width="50" height="13" isRemoveLineWhenBlank="true"/>
+ <reportElement key="textField-1" x="98" y="117" width="38" height="13" isRemoveLineWhenBlank="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -458,7 +458,7 @@
<textFieldExpression class="java.lang.String"><![CDATA[$P{taxText}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement key="textField" x="98" y="6" width="50" height="13"/>
+ <reportElement key="textField" x="92" y="6" width="44" height="13"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -471,7 +471,7 @@
<textFieldExpression class="java.lang.String"><![CDATA[$P{grandSubtotal}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement key="textField" x="98" y="91" width="50" height="13" isRemoveLineWhenBlank="true"/>
+ <reportElement key="textField" x="98" y="91" width="38" height="13" isRemoveLineWhenBlank="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -484,7 +484,7 @@
<textFieldExpression class="java.lang.String"><![CDATA[$P{netAmount}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement key="textField" x="98" y="32" width="50" height="13" isRemoveLineWhenBlank="true"/>
+ <reportElement key="textField" x="98" y="32" width="38" height="13" isRemoveLineWhenBlank="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -504,7 +504,7 @@
<textFieldExpression class="java.lang.String"><![CDATA[$P{dueAmountText}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement key="textField" isPrintRepeatedValues="false" x="98" y="58" width="50" height="13" isRemoveLineWhenBlank="true"/>
+ <reportElement key="textField" isPrintRepeatedValues="false" x="98" y="58" width="38" height="13" isRemoveLineWhenBlank="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -517,7 +517,7 @@
<textFieldExpression class="java.lang.String"><![CDATA[$P{tipAmount}]]></textFieldExpression>
</textField>
<line>
- <reportElement key="line-2" x="0" y="86" width="148" height="1" isRemoveLineWhenBlank="true">
+ <reportElement key="line-2" x="0" y="86" width="136" height="1" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[$P{showFooter}==true]]></printWhenExpression>
</reportElement>
<graphicElement>
@@ -525,7 +525,7 @@
</graphicElement>
</line>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement key="textField" x="98" y="104" width="50" height="13" isRemoveLineWhenBlank="true"/>
+ <reportElement key="textField" x="98" y="104" width="38" height="13" isRemoveLineWhenBlank="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -554,7 +554,7 @@
<textFieldExpression class="java.lang.String"><![CDATA[$P{serviceChargeText}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement key="textField" x="98" y="45" width="50" height="13" isRemoveLineWhenBlank="true"/>
+ <reportElement key="textField" x="98" y="45" width="38" height="13" isRemoveLineWhenBlank="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -576,7 +576,7 @@
<textFieldExpression class="java.lang.String"><![CDATA[$P{discountText}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement key="textField" x="98" y="19" width="50" height="13" isRemoveLineWhenBlank="true"/>
+ <reportElement key="textField" x="98" y="19" width="38" height="13" isRemoveLineWhenBlank="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -589,7 +589,7 @@
<textFieldExpression class="java.lang.String"><![CDATA[$P{discountAmount}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement key="textField-1" positionType="Float" x="0" y="298" width="148" height="12" isRemoveLineWhenBlank="true">
+ <reportElement key="textField-1" positionType="Float" x="0" y="298" width="136" height="12" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[$P{showFooter}==true]]></printWhenExpression>
</reportElement>
<box>
@@ -612,7 +612,7 @@
<textFieldExpression class="java.lang.String"><![CDATA[$P{deliveryChargeText}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement key="textField" isPrintRepeatedValues="false" x="98" y="71" width="50" height="13" isRemoveLineWhenBlank="true"/>
+ <reportElement key="textField" isPrintRepeatedValues="false" x="98" y="71" width="38" height="13" isRemoveLineWhenBlank="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -634,7 +634,7 @@
<textFieldExpression class="java.lang.String"><![CDATA[$P{changeAmountText}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement key="textField-1" x="98" y="130" width="50" height="13" isRemoveLineWhenBlank="true"/>
+ <reportElement key="textField-1" x="98" y="130" width="38" height="13" isRemoveLineWhenBlank="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -646,7 +646,7 @@
<textFieldExpression class="java.lang.String"><![CDATA[$P{changedAmount}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement key="textField-1" x="0" y="144" width="148" height="13" isRemoveLineWhenBlank="true"/>
+ <reportElement key="textField-1" x="0" y="144" width="136" height="13" isRemoveLineWhenBlank="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -658,7 +658,7 @@
<textFieldExpression class="java.lang.String"><![CDATA[$P{additionalProperties}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement key="staticText-9" x="0" y="252" width="148" height="13" isRemoveLineWhenBlank="true">
+ <reportElement key="staticText-9" x="0" y="252" width="136" height="13" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[$P{cardPayment}==true]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Left" verticalAlignment="Middle" markup="html">
@@ -667,7 +667,7 @@
<textFieldExpression class="java.lang.String"><![CDATA[$P{approvalCode}]]></textFieldExpression>
</textField>
<staticText>
- <reportElement x="0" y="214" width="148" height="36" isRemoveLineWhenBlank="true">
+ <reportElement x="0" y="214" width="136" height="36" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[$P{cardPayment}==true]]></printWhenExpression>
</reportElement>
<box>
@@ -679,7 +679,7 @@
<text><![CDATA[Sign:]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
- <reportElement key="staticText-9" positionType="Float" x="0" y="278" width="148" height="13" isRemoveLineWhenBlank="true">
+ <reportElement key="staticText-9" positionType="Float" x="0" y="278" width="136" height="13" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[$P{cardPayment}==true]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle" markup="none">
@@ -688,7 +688,7 @@
<textFieldExpression class="java.lang.String"><![CDATA[$P{copyType}]]></textFieldExpression>
</textField>
<staticText>
- <reportElement x="0" y="157" width="148" height="26" isRemoveLineWhenBlank="true">
+ <reportElement x="0" y="157" width="136" height="26" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[$P{cardPayment}==true]]></printWhenExpression>
</reportElement>
<textElement verticalAlignment="Bottom">
@@ -697,12 +697,12 @@
<text><![CDATA[Tips:]]></text>
</staticText>
<line>
- <reportElement x="31" y="182" width="115" height="1" isRemoveLineWhenBlank="true">
+ <reportElement x="31" y="182" width="105" height="1" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[$P{cardPayment}==true]]></printWhenExpression>
</reportElement>
</line>
<staticText>
- <reportElement x="0" y="183" width="148" height="31" isRemoveLineWhenBlank="true">
+ <reportElement x="0" y="183" width="136" height="31" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[$P{cardPayment}==true]]></printWhenExpression>
</reportElement>
<textElement verticalAlignment="Bottom">
@@ -711,7 +711,7 @@
<text><![CDATA[Total:]]></text>
</staticText>
<line>
- <reportElement x="32" y="213" width="115" height="1" isRemoveLineWhenBlank="true">
+ <reportElement x="32" y="213" width="104" height="1" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[$P{cardPayment}==true]]></printWhenExpression>
</reportElement>
</line>
diff --git a/images/floreant-pos.orig.png b/images/floreant-pos.orig.png
new file mode 100755
index 0000000..34ade36
Binary files /dev/null and b/images/floreant-pos.orig.png differ
diff --git a/images/ui_icons/floreant-pos-orig.png b/images/ui_icons/floreant-pos-orig.png
new file mode 100755
index 0000000..34ade36
Binary files /dev/null and b/images/ui_icons/floreant-pos-orig.png differ
diff --git a/resources/images/floreant-pos-orig.png b/resources/images/floreant-pos-orig.png
new file mode 100755
index 0000000..34ade36
Binary files /dev/null and b/resources/images/floreant-pos-orig.png differ
diff --git a/src/com/floreantpos/config/TerminalConfig.java b/src/com/floreantpos/config/TerminalConfig.java
index 52080ef..a083501 100755
--- a/src/com/floreantpos/config/TerminalConfig.java
+++ b/src/com/floreantpos/config/TerminalConfig.java
@@ -227,11 +227,11 @@ public class TerminalConfig {
}
public static String getDrawerPortName() {
- return config.getString("drawerPortName", "COM1"); //$NON-NLS-1$ //$NON-NLS-2$
+ return config.getString("drawerPortName", "/dev/usb/lp0"); //$NON-NLS-1$ //$NON-NLS-2$
}
public static void setDrawerControlCodes(String controlCode) {
- config.setProperty("controlCode", controlCode); //$NON-NLS-1$
+ config.setProperty("controlCode", controlCode.replace(",", "\,")); //$NON-NLS-1$
}
public static String getDrawerControlCodes() {
@@ -266,7 +266,7 @@ public class TerminalConfig {
drawerControlCodes = getDefaultDrawerControlCodes();
}
- String[] split = drawerControlCodes.split(","); //$NON-NLS-1$
+ String[] split = drawerControlCodes.split("\,"); //$NON-NLS-1$
char[] codes = new char[split.length];
for (int i = 0; i < split.length; i++) {
try {
diff --git a/src/com/floreantpos/config/ui/TerminalConfigurationView.java b/src/com/floreantpos/config/ui/TerminalConfigurationView.java
index b765b0e..8e4e041 100755
--- a/src/com/floreantpos/config/ui/TerminalConfigurationView.java
+++ b/src/com/floreantpos/config/ui/TerminalConfigurationView.java
@@ -169,7 +169,7 @@ public class TerminalConfigurationView extends ConfigurationView {
btnRestoreDrawerDefault.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- tfDrawerName.setText("COM1"); //$NON-NLS-1$
+ tfDrawerName.setText("/dev/usb/lp0"); //$NON-NLS-1$
tfDrawerCodes.setText(TerminalConfig.getDefaultDrawerControlCodes());
}
});
diff --git a/src/com/floreantpos/report/template/kitchen-receipt.jasper b/src/com/floreantpos/report/template/kitchen-receipt.jasper
old mode 100644
new mode 100755
index 3f8464d..6207b20
Binary files a/src/com/floreantpos/report/template/kitchen-receipt.jasper and b/src/com/floreantpos/report/template/kitchen-receipt.jasper differ
diff --git a/src/com/floreantpos/report/template/ticket-receipt.jasper b/src/com/floreantpos/report/template/ticket-receipt.jasper
old mode 100644
new mode 100755
diff --git a/src/com/floreantpos/report/template/ticket-receipt.jrxml b/src/com/floreantpos/report/template/ticket-receipt.jrxml
old mode 100644
new mode 100755
diff --git a/src/com/floreantpos/ui/dialog/ManagerDialog.java b/src/com/floreantpos/ui/dialog/ManagerDialog.java
old mode 100644
new mode 100755
index d540847..daeb84c
--- a/src/com/floreantpos/ui/dialog/ManagerDialog.java
+++ b/src/com/floreantpos/ui/dialog/ManagerDialog.java
@@ -165,8 +165,13 @@ public class ManagerDialog extends JDialog {
protected void doDrawerKick() {
try {
+ String executableFilename ="drawer-kick.bat";
+ String osName = System.getProperty("os.name").toLowerCase();
+ if(osName.contains("linux")) {
+ executableFilename = "drawer-kick.sh";
+ }
- File file = new File(Application.getInstance().getLocation(), "drawer-kick.bat"); //$NON-NLS-1$
+ File file = new File(Application.getInstance().getLocation(), executableFilename); //$NON-NLS-1$
if (file.exists()) {
Runtime.getRuntime().exec(file.getAbsolutePath());
}
diff --git a/src/com/floreantpos/ui/views/payment/SettleTicketDialog.java b/src/com/floreantpos/ui/views/payment/SettleTicketDialog.java
old mode 100644
new mode 100755
index 430c773..d7f1fbc
--- a/src/com/floreantpos/ui/views/payment/SettleTicketDialog.java
+++ b/src/com/floreantpos/ui/views/payment/SettleTicketDialog.java
@@ -391,7 +391,7 @@ public class SettleTicketDialog extends POSDialog implements CardInputListener {
transactionService.settleTicket(ticket, transaction);
//FIXME
- printTicket(ticket, transaction);
+ //printTicket(ticket, transaction);
showTransactionCompleteMsg(dueAmount, transaction.getTenderAmount(), ticket, transaction);
diff --git a/src/com/floreantpos/util/DrawerUtil.java b/src/com/floreantpos/util/DrawerUtil.java
index 8a3363d..73f9aa9 100755
--- a/src/com/floreantpos/util/DrawerUtil.java
+++ b/src/com/floreantpos/util/DrawerUtil.java
@@ -1,5 +1,10 @@
package com.floreantpos.util;
+import java.io.BufferedWriter;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+
import jssc.SerialPort;
import jssc.SerialPortException;
@@ -10,7 +15,8 @@ import com.floreantpos.config.TerminalConfig;
public class DrawerUtil {
/* fields */
private boolean escp24pin; //boolean to indicate whether the printer is a 24 pin esc/p2 epson
-
+ private static boolean fileMode = false;
+ private static FileOutputStream out = null;
private static int MAX_ADVANCE_9PIN = 216; //for 24/48 pin esc/p2 printers this should be 180
private static int MAX_ADVANCE_24PIN = 180;
private static int MAX_UNITS = 127; //for vertical positioning range is between 0 - 255 (0 <= n <= 255) according to epson ref. but 255 gives weird errors at 1.5f, 127 as max (0 - 128) seems to be working
@@ -65,17 +71,57 @@ public class DrawerUtil {
public void close() {
//post: closes the stream, used when printjob ended
+
+ if (!fileMode) {
+
try {
serialPort.closePort();
- } catch (SerialPortException ex) {
+ } catch (SerialPortException ex) {}
+ } else {
+
+ try {
+ out.close();
+ } catch (IOException ex) {}
}
+
}
+
+
+ public static boolean initializeFile(String portName) {
- public static boolean initialize() {
+ try {
+ out = new FileOutputStream(portName, true);
+
+ //reset default settings
+ //print(ESC);
+ //print(AT);
+
+ //select 10-cpi character pitch
+ //select10CPI();
+
+ //select draft quality printing
+ //selectDraftPrinting();
+
+ //set character set
+ //setCharacterSet(USA);
+
+ } catch (IOException ex) {
+ return false;
+ }
+
+
+ return true;
+ }
+
+
+ public static boolean initializeSerial() {
try {
+
+
serialPort.openPort();//Open serial port
serialPort.setParams(SerialPort.BAUDRATE_9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
+
//Set params. Also you can set params by this string: serialPort.setParams(9600, 8, 1, 0);
//serialPort.writeBytes( reconstitutedString.getBytes());//
@@ -95,6 +141,7 @@ public class DrawerUtil {
} catch (SerialPortException ex) {
return false;
}
+
return true;
}
@@ -164,7 +211,7 @@ public class DrawerUtil {
}
public static void kick() {
- print("Start kicking drawer\n"); //$NON-NLS-1$
+ //print("Start kicking drawer\n"); //$NON-NLS-1$
//print(ESC);
//print(AT);
@@ -181,6 +228,14 @@ public class DrawerUtil {
print(controlCodes[3]);
print(controlCodes[4]);
+ //System.out.print(controlCodes[0]);
+ //System.out.print(controlCodes[1]);
+ //System.out.print(controlCodes[2]);
+ //System.out.print(controlCodes[3]);
+ //System.out.print(controlCodes[4]);
+
+
+
/*
print(ESC);
print(p);
@@ -200,7 +255,7 @@ public class DrawerUtil {
print(_55);
print(_121);
*/
- print("End kicking drawer\n"); //$NON-NLS-1$
+ //print("End kicking drawer\n"); //$NON-NLS-1$
}
public static void proportionalMode(boolean proportional) {
@@ -265,21 +320,40 @@ public class DrawerUtil {
}
public static void print(String text) {
+
+ if (!fileMode) {
try {
serialPort.writeBytes(text.getBytes());
} catch (SerialPortException ex) {
System.out.println(ex);
}
+
+ } else {
+ try {
+ out.write(text.getBytes());
+ } catch (IOException ex) {
+ System.out.println(ex);
+ }
+ }
}
public static void print(char text) {
+
+ if (!fileMode) {
try {
serialPort.writeByte((byte) text);
} catch (SerialPortException ex) {
System.out.println(ex);
}
+ } else {
+ try {
+ out.write((byte) text);
+ } catch (IOException ex) {
+ System.out.println(ex);
+ }
+ }
}
@@ -302,17 +376,38 @@ public class DrawerUtil {
public static void kickDrawer(String portName, char[] codes) {
DrawerUtil.controlCodes = codes;
- serialPort = new SerialPort(portName);
-
- initialize();
+ String osName = System.getProperty("os.name").toLowerCase();
+ if (osName.contains("linux")) fileMode=true;
+
+ if (!fileMode) {
+ serialPort = new SerialPort(portName);
+ initializeSerial();
+ } else {
+ initializeFile(portName);
+ }
+ if (!fileMode) {
try {
kick();
//tear();
- serialPort.closePort();//Close serial port
+ serialPort.closePort();//Close serial port
} catch (SerialPortException ex) {
System.out.println(ex);
}
+ } else {
+
+ try {
+ kick();
+ //tear();
+
+ out.close();
+ } catch (IOException ex) {
+ System.out.println(ex);
+ }
+
+
+ }
+
}
}
\ No newline at end of file
- Details
- Last Updated: Monday, 04 April 2016 02:04
- Hits: 40681184