5.0 Source Code

Committing 5.0 Source Code
This commit is contained in:
2023-04-06 18:58:04 +01:00
parent 0f3ede77fa
commit 0282345603
1680 changed files with 241310 additions and 0 deletions
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[650, 75]"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="650" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="150" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Form>
@@ -0,0 +1,92 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta & previous Openbravo POS works
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.pos.forms.AppConfig;
import javax.swing.JPanel;
/**
*
* @author Mikel Irurita
*/
public class ConfigPaymentPanelEmpty extends javax.swing.JPanel implements PaymentConfiguration {
/** Creates new form ConfigPaymentPanelGeneric */
public ConfigPaymentPanelEmpty() {
initComponents();
}
/**
*
* @return
*/
@Override
public JPanel getComponent() {
return this;
}
/**
*
* @param config
*/
@Override
public void loadProperties(AppConfig config) {
}
/**
*
* @param config
*/
@Override
public void saveProperties(AppConfig config) {
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
setBackground(new java.awt.Color(255, 255, 255));
setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
setPreferredSize(new java.awt.Dimension(650, 75));
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 650, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 150, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
}
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[400, 90]"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jLabel2" max="32767" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jtxtCommerceID" min="-2" max="-2" attributes="0"/>
<Component id="jtxtCommercePwd" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="30" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jtxtCommerceID" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jtxtCommercePwd" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.commerceid" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[150, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jtxtCommerceID">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[200, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.commercepwd" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[150, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JPasswordField" name="jtxtCommercePwd">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[200, 30]"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Form>
@@ -0,0 +1,143 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta & previous Openbravo POS works
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.pos.forms.AppConfig;
import com.unicenta.pos.forms.AppLocal;
import com.unicenta.pos.util.AltEncrypter;
import javax.swing.JPanel;
/**
*
* @author Mikel Irurita
*/
public class ConfigPaymentPanelGeneric extends javax.swing.JPanel implements PaymentConfiguration {
/** Creates new form ConfigPaymentPanelGeneric */
public ConfigPaymentPanelGeneric() {
initComponents();
}
/**
*
* @return
*/
@Override
public JPanel getComponent() {
return this;
}
/**
*
* @param config
*/
@Override
public void loadProperties(AppConfig config) {
String sCommerceID = config.getProperty("payment.commerceid");
String sCommercePass = config.getProperty("payment.commercepassword");
if (sCommerceID != null && sCommercePass != null && sCommercePass.startsWith("crypt:")) {
jtxtCommerceID.setText(config.getProperty("payment.commerceid"));
AltEncrypter cypher = new AltEncrypter("cypherkey" + config.getProperty("payment.commerceid"));
jtxtCommercePwd.setText(cypher.decrypt(config.getProperty("payment.commercepassword").substring(6)));
}
}
/**
*
* @param config
*/
@Override
public void saveProperties(AppConfig config) {
config.setProperty("payment.commerceid", jtxtCommerceID.getText());
AltEncrypter cypher = new AltEncrypter("cypherkey" + jtxtCommerceID.getText());
config.setProperty("payment.commercepassword", "crypt:" + cypher.encrypt(new String(jtxtCommercePwd.getPassword())));
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jtxtCommerceID = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jtxtCommercePwd = new javax.swing.JPasswordField();
setBackground(new java.awt.Color(255, 255, 255));
setPreferredSize(new java.awt.Dimension(400, 90));
jLabel1.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabel1.setText(AppLocal.getIntString("label.commerceid")); // NOI18N
jLabel1.setPreferredSize(new java.awt.Dimension(150, 30));
jtxtCommerceID.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jtxtCommerceID.setPreferredSize(new java.awt.Dimension(200, 30));
jLabel2.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabel2.setText(AppLocal.getIntString("label.commercepwd")); // NOI18N
jLabel2.setPreferredSize(new java.awt.Dimension(150, 30));
jtxtCommercePwd.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jtxtCommercePwd.setPreferredSize(new java.awt.Dimension(200, 30));
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jtxtCommerceID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jtxtCommercePwd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(30, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jtxtCommerceID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jtxtCommercePwd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JTextField jtxtCommerceID;
private javax.swing.JPasswordField jtxtCommercePwd;
// End of variables declaration//GEN-END:variables
}
@@ -0,0 +1,140 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,49,0,0,2,99"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel2">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="East"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="North"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
<Property name="axis" type="int" value="1"/>
</Layout>
<SubComponents>
<Component class="com.unicenta.editor.JEditorKeys" name="m_jKeys">
</Component>
<Container class="javax.swing.JPanel" name="jPanel3">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="5" left="5" right="5" top="5"/>
</Border>
</Property>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Component class="com.unicenta.editor.JEditorCurrencyPositive" name="m_jTendered">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="12" style="0"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel4">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
<Property name="useNullLayout" type="boolean" value="true"/>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="18" style="1"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.InputCash" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="10" y="4" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="m_jMoneyEuros">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="33" green="ff" red="cc" type="rgb"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="18" style="1"/>
</Property>
<Property name="horizontalAlignment" type="int" value="4"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.CompoundBorderInfo">
<CompoundBorder>
<Border PropertyName="outside" info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder>
<Color PropertyName="color" blue="64" green="6f" id="Button.darkShadow" palette="3" red="71" type="palette"/>
</LineBorder>
</Border>
<Border PropertyName="inside" info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="1" left="4" right="4" top="1"/>
</Border>
</CompoundBorder>
</Border>
</Property>
<Property name="opaque" type="boolean" value="true"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[180, 30]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="120" y="4" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>
@@ -0,0 +1,185 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.format.Formats;
import com.unicenta.pos.customers.CustomerInfoExt;
import com.unicenta.pos.forms.AppLocal;
import com.unicenta.pos.util.RoundUtils;
import java.awt.Component;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
/**
*
* @author JG uniCenta
*/
public class JPaymentBank extends javax.swing.JPanel implements JPaymentInterface {
private JPaymentNotifier m_notifier;
private double m_dPaid;
private double m_dTotal;
/** Creates new form JPaymentCash
* @param notifier */
public JPaymentBank(JPaymentNotifier notifier) {
m_notifier = notifier;
initComponents();
m_jTendered.addPropertyChangeListener("Edition", new RecalculateState());
m_jTendered.addEditorKeys(m_jKeys);
}
/**
*
* @param customerext
* @param dTotal
* @param transID
*/
@Override
public void activate(CustomerInfoExt customerext, double dTotal, String transID) {
m_dTotal = dTotal;
m_jTendered.reset();
m_jTendered.activate();
printState();
}
/**
*
* @return
*/
@Override
public PaymentInfo executePayment() {
return new PaymentInfoTicket(m_dPaid, "bank");
}
/**
*
* @return
*/
@Override
public Component getComponent() {
return this;
}
private void printState() {
Double value = m_jTendered.getDoubleValue();
if (value == null) {
m_dPaid = m_dTotal;
} else {
m_dPaid = value;
}
m_jMoneyEuros.setText(Formats.CURRENCY.formatValue(new Double(m_dPaid)));
int iCompare = RoundUtils.compare(m_dPaid, m_dTotal);
// if iCompare > 0 then the payment is not valid
m_notifier.setStatus(m_dPaid > 0.0 && iCompare <= 0, iCompare == 0);
}
private class RecalculateState implements PropertyChangeListener {
@Override
public void propertyChange(PropertyChangeEvent evt) {
printState();
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel2 = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
m_jKeys = new com.unicenta.editor.JEditorKeys();
jPanel3 = new javax.swing.JPanel();
m_jTendered = new com.unicenta.editor.JEditorCurrencyPositive();
jPanel4 = new javax.swing.JPanel();
jLabel8 = new javax.swing.JLabel();
m_jMoneyEuros = new javax.swing.JLabel();
setLayout(new java.awt.BorderLayout());
jPanel2.setLayout(new java.awt.BorderLayout());
jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.Y_AXIS));
jPanel1.add(m_jKeys);
jPanel3.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel3.setLayout(new java.awt.BorderLayout());
m_jTendered.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jPanel3.add(m_jTendered, java.awt.BorderLayout.CENTER);
jPanel1.add(jPanel3);
jPanel2.add(jPanel1, java.awt.BorderLayout.NORTH);
add(jPanel2, java.awt.BorderLayout.EAST);
jPanel4.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jPanel4.setLayout(null);
jLabel8.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
jLabel8.setText(AppLocal.getIntString("label.InputCash")); // NOI18N
jLabel8.setPreferredSize(new java.awt.Dimension(100, 30));
jPanel4.add(jLabel8);
jLabel8.setBounds(10, 4, 100, 30);
m_jMoneyEuros.setBackground(new java.awt.Color(204, 255, 51));
m_jMoneyEuros.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
m_jMoneyEuros.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
m_jMoneyEuros.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")), javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4)));
m_jMoneyEuros.setOpaque(true);
m_jMoneyEuros.setPreferredSize(new java.awt.Dimension(180, 30));
jPanel4.add(m_jMoneyEuros);
m_jMoneyEuros.setBounds(120, 4, 180, 30);
add(jPanel4, java.awt.BorderLayout.CENTER);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private com.unicenta.editor.JEditorKeys m_jKeys;
private javax.swing.JLabel m_jMoneyEuros;
private com.unicenta.editor.JEditorCurrencyPositive m_jTendered;
// End of variables declaration//GEN-END:variables
}
@@ -0,0 +1,230 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[700, 400]"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-112,0,0,2,-18"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel5">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel4">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[450, 70]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="North"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
<Property name="useNullLayout" type="boolean" value="true"/>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="m_jChangeEuros">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="18" style="1"/>
</Property>
<Property name="horizontalAlignment" type="int" value="4"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.CompoundBorderInfo">
<CompoundBorder>
<Border PropertyName="outside" info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder>
<Color PropertyName="color" blue="64" green="6f" id="Button.darkShadow" palette="3" red="71" type="palette"/>
</LineBorder>
</Border>
<Border PropertyName="inside" info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="1" left="4" right="4" top="1"/>
</Border>
</CompoundBorder>
</Border>
</Property>
<Property name="opaque" type="boolean" value="true"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[180, 30]"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value="JPaymentCashPos_m_jChangeEuros"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="120" y="36" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="18" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.ChangeCash" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="10" y="36" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="18" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.InputCash" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="10" y="4" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="m_jMoneyEuros">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="18" style="0"/>
</Property>
<Property name="horizontalAlignment" type="int" value="4"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.CompoundBorderInfo">
<CompoundBorder>
<Border PropertyName="outside" info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder>
<Color PropertyName="color" blue="64" green="6f" id="Button.darkShadow" palette="3" red="71" type="palette"/>
</LineBorder>
</Border>
<Border PropertyName="inside" info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="1" left="4" right="4" top="1"/>
</Border>
</CompoundBorder>
</Border>
</Property>
<Property name="opaque" type="boolean" value="true"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[180, 30]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="120" y="4" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel6">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[450, 10]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
<Property name="alignment" type="int" value="0"/>
</Layout>
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel2">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="After"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="North"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
<Property name="axis" type="int" value="1"/>
</Layout>
<SubComponents>
<Component class="com.unicenta.editor.JEditorKeys" name="m_jKeys">
</Component>
<Container class="javax.swing.JPanel" name="jPanel3">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="5" left="5" right="5" top="5"/>
</Border>
</Property>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Component class="com.unicenta.editor.JEditorCurrencyPositive" name="m_jTendered">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="1"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>
@@ -0,0 +1,336 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.data.gui.MessageInf;
import com.unicenta.format.Formats;
import com.unicenta.pos.customers.CustomerInfoExt;
import com.unicenta.pos.forms.AppConfig;
import com.unicenta.pos.forms.AppLocal;
import com.unicenta.pos.forms.DataLogicSystem;
import com.unicenta.pos.scripting.ScriptEngine;
import com.unicenta.pos.scripting.ScriptException;
import com.unicenta.pos.scripting.ScriptFactory;
import com.unicenta.pos.util.RoundUtils;
import com.unicenta.pos.util.ThumbNailBuilder;
import java.awt.Component;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.SwingConstants;
/**
*
* @author adrianromero
*/
public class JPaymentCashPos extends javax.swing.JPanel implements JPaymentInterface {
private final JPaymentNotifier m_notifier;
private double m_dPaid;
private double m_dTotal;
private final Boolean priceWith00;
/** Creates new form JPaymentCash
* @param notifier
* @param dlSystem */
public JPaymentCashPos(JPaymentNotifier notifier, DataLogicSystem dlSystem) {
m_notifier = notifier;
initComponents();
m_jTendered.addPropertyChangeListener("Edition", new RecalculateState());
m_jTendered.addEditorKeys(m_jKeys);
// added JDL 11.05.13
AppConfig m_config = new AppConfig(new File((System.getProperty("user.home")), AppLocal.APP_ID + ".properties"));
m_config.load();
priceWith00 =("true".equals(m_config.getProperty("till.pricewith00")));
if (priceWith00) {
// use '00' instead of '.'
m_jKeys.dotIs00(true);
}
// m_config=null;
String code = dlSystem.getResourceAsXML("payment.cash");
if (code != null) {
try {
ScriptEngine script = ScriptFactory.getScriptEngine(ScriptFactory.BEANSHELL);
script.put("payment", new ScriptPaymentCash(dlSystem));
script.eval(code);
} catch (ScriptException e) {
MessageInf msg = new MessageInf(MessageInf.SGN_NOTICE, AppLocal.getIntString("message.cannotexecute"), e);
msg.show(this);
}
}
}
/**
*
* @param customerext
* @param dTotal
* @param transID
*/
@Override
public void activate(CustomerInfoExt customerext, double dTotal, String transID) {
m_dTotal = dTotal;
m_jTendered.reset();
m_jTendered.activate();
printState();
}
/**
*
* @return
*/
@Override
public PaymentInfo executePayment() {
if (m_dPaid - m_dTotal >= 0.0) {
// pago completo
return new PaymentInfoCash(m_dTotal, m_dPaid);
} else {
// pago parcial
return new PaymentInfoCash(m_dPaid, m_dPaid);
}
}
/**
*
* @return
*/
@Override
public Component getComponent() {
return this;
}
private void printState() {
Double value = m_jTendered.getDoubleValue();
if (value == null || value == 0.0) {
m_dPaid = m_dTotal;
} else {
m_dPaid = value;
}
int iCompare = RoundUtils.compare(m_dPaid, m_dTotal);
m_jMoneyEuros.setText(Formats.CURRENCY.formatValue(m_dPaid));
m_jChangeEuros.setText(iCompare > 0
? Formats.CURRENCY.formatValue(m_dPaid - m_dTotal)
: null);
m_notifier.setStatus(m_dPaid > 0.0, iCompare >= 0);
}
private class RecalculateState implements PropertyChangeListener {
@Override
public void propertyChange(PropertyChangeEvent evt) {
printState();
}
}
/**
*
*/
public class ScriptPaymentCash {
private final DataLogicSystem dlSystem;
private final ThumbNailBuilder tnbbutton;
private final AppConfig m_config;
/**
*
* @param dlSystem
*/
public ScriptPaymentCash(DataLogicSystem dlSystem) {
//added 19.04.13 JDL
AppConfig m_config = new AppConfig(new File((System.getProperty("user.home")), AppLocal.APP_ID + ".properties"));
m_config.load();
this.m_config = m_config;
this.dlSystem = dlSystem;
tnbbutton = new ThumbNailBuilder(64, 50, "com/unicenta/images/cash.png");
}
/**
*
* @param image
* @param amount
*/
public void addButton(String image, double amount) {
JButton btn = new JButton();
//added 19.04.13 JDL removal of text on payment buttons if required.
try {
if ((m_config.getProperty("payments.textoverlay")).equals("false")){
btn.setIcon(new ImageIcon(tnbbutton.getThumbNailText(dlSystem.getResourceAsImage(image),"")));
} else {
btn.setIcon(new ImageIcon(tnbbutton.getThumbNailText(dlSystem.getResourceAsImage(image), Formats.CURRENCY.formatValue(amount))));
}
} catch (Exception e){
btn.setIcon(new ImageIcon(tnbbutton.getThumbNailText(dlSystem.getResourceAsImage(image), Formats.CURRENCY.formatValue(amount))));
}
btn.setFocusPainted(false);
btn.setFocusable(false);
btn.setRequestFocusEnabled(false);
btn.setHorizontalTextPosition(SwingConstants.CENTER);
btn.setVerticalTextPosition(SwingConstants.BOTTOM);
btn.setMargin(new Insets(2, 2, 2, 2));
btn.addActionListener(new AddAmount(amount));
jPanel6.add(btn);
}
}
private class AddAmount implements ActionListener {
private final double amount;
public AddAmount(double amount) {
this.amount = amount;
}
@Override
public void actionPerformed(ActionEvent e) {
Double tendered = m_jTendered.getDoubleValue();
if (tendered == null) {
m_jTendered.setDoubleValue(amount);
} else {
m_jTendered.setDoubleValue(tendered + amount);
}
printState();
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel5 = new javax.swing.JPanel();
jPanel4 = new javax.swing.JPanel();
m_jChangeEuros = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
m_jMoneyEuros = new javax.swing.JLabel();
jPanel6 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
m_jKeys = new com.unicenta.editor.JEditorKeys();
jPanel3 = new javax.swing.JPanel();
m_jTendered = new com.unicenta.editor.JEditorCurrencyPositive();
setPreferredSize(new java.awt.Dimension(700, 400));
setLayout(new java.awt.BorderLayout());
jPanel5.setLayout(new java.awt.BorderLayout());
jPanel4.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jPanel4.setPreferredSize(new java.awt.Dimension(450, 70));
jPanel4.setLayout(null);
m_jChangeEuros.setBackground(new java.awt.Color(255, 255, 255));
m_jChangeEuros.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
m_jChangeEuros.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
m_jChangeEuros.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")), javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4)));
m_jChangeEuros.setOpaque(true);
m_jChangeEuros.setPreferredSize(new java.awt.Dimension(180, 30));
jPanel4.add(m_jChangeEuros);
m_jChangeEuros.setBounds(120, 36, 180, 30);
jLabel6.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
jLabel6.setText(AppLocal.getIntString("label.ChangeCash")); // NOI18N
jLabel6.setPreferredSize(new java.awt.Dimension(100, 30));
jPanel4.add(jLabel6);
jLabel6.setBounds(10, 36, 100, 30);
jLabel8.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
jLabel8.setText(AppLocal.getIntString("label.InputCash")); // NOI18N
jLabel8.setPreferredSize(new java.awt.Dimension(100, 30));
jPanel4.add(jLabel8);
jLabel8.setBounds(10, 4, 100, 30);
m_jMoneyEuros.setBackground(new java.awt.Color(255, 255, 255));
m_jMoneyEuros.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
m_jMoneyEuros.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
m_jMoneyEuros.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")), javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4)));
m_jMoneyEuros.setOpaque(true);
m_jMoneyEuros.setPreferredSize(new java.awt.Dimension(180, 30));
jPanel4.add(m_jMoneyEuros);
m_jMoneyEuros.setBounds(120, 4, 180, 30);
jPanel5.add(jPanel4, java.awt.BorderLayout.NORTH);
jPanel6.setPreferredSize(new java.awt.Dimension(450, 10));
jPanel6.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
jPanel5.add(jPanel6, java.awt.BorderLayout.CENTER);
add(jPanel5, java.awt.BorderLayout.CENTER);
jPanel2.setLayout(new java.awt.BorderLayout());
jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.Y_AXIS));
jPanel1.add(m_jKeys);
jPanel3.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel3.setLayout(new java.awt.BorderLayout());
m_jTendered.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jPanel3.add(m_jTendered, java.awt.BorderLayout.CENTER);
jPanel1.add(jPanel3);
jPanel2.add(jPanel1, java.awt.BorderLayout.NORTH);
add(jPanel2, java.awt.BorderLayout.LINE_END);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JLabel m_jChangeEuros;
private com.unicenta.editor.JEditorKeys m_jKeys;
private javax.swing.JLabel m_jMoneyEuros;
private com.unicenta.editor.JEditorCurrencyPositive m_jTendered;
// End of variables declaration//GEN-END:variables
}
@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,49,0,0,2,-118"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel2">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="East"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="North"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
<Property name="axis" type="int" value="1"/>
</Layout>
<SubComponents>
<Component class="com.unicenta.editor.JEditorKeys" name="m_jKeys">
</Component>
<Container class="javax.swing.JPanel" name="jPanel3">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="5" left="5" right="5" top="5"/>
</Border>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="12" style="0"/>
</Property>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Component class="com.unicenta.editor.JEditorCurrencyPositive" name="m_jTendered">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="16" style="1"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel4">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
<Property name="useNullLayout" type="boolean" value="true"/>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="18" style="1"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.InputCash" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="10" y="4" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="m_jMoneyEuros">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="33" green="ff" red="cc" type="rgb"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="18" style="1"/>
</Property>
<Property name="horizontalAlignment" type="int" value="4"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.CompoundBorderInfo">
<CompoundBorder>
<Border PropertyName="outside" info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder>
<Color PropertyName="color" blue="64" green="6f" id="Button.darkShadow" palette="3" red="71" type="palette"/>
</LineBorder>
</Border>
<Border PropertyName="inside" info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="1" left="4" right="4" top="1"/>
</Border>
</CompoundBorder>
</Border>
</Property>
<Property name="opaque" type="boolean" value="true"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[180, 30]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="120" y="4" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>
@@ -0,0 +1,198 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.format.Formats;
import com.unicenta.pos.customers.CustomerInfoExt;
import com.unicenta.pos.forms.AppConfig;
import com.unicenta.pos.forms.AppLocal;
import com.unicenta.pos.util.RoundUtils;
import java.awt.Component;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
/**
*
* @author JG uniCenta
*/
public class JPaymentCheque extends javax.swing.JPanel implements JPaymentInterface {
private JPaymentNotifier m_notifier;
private double m_dPaid;
private double m_dTotal;
private Boolean priceWith00;
/** Creates new form JPaymentCash
* @param notifier */
public JPaymentCheque(JPaymentNotifier notifier) {
m_notifier = notifier;
initComponents();
m_jTendered.addPropertyChangeListener("Edition", new RecalculateState());
m_jTendered.addEditorKeys(m_jKeys);
/* added JDL 11.05.13
AppConfig m_config = new AppConfig(new File((System.getProperty("user.home")), AppLocal.APP_ID + ".properties"));
m_config.load();
priceWith00 =("true".equals(m_config.getProperty("till.pricewith00")));
if (priceWith00) {
// use '00' instead of '.'
m_jKeys.dotIs00(true);
}
m_config=null;
*/
}
/**
*
* @param customerext
* @param dTotal
* @param transID
*/
@Override
public void activate(CustomerInfoExt customerext, double dTotal, String transID) {
m_dTotal = dTotal;
m_jTendered.reset();
m_jTendered.activate();
printState();
}
/**
*
* @return
*/
@Override
public PaymentInfo executePayment() {
return new PaymentInfoTicket(m_dPaid, "cheque");
}
/**
*
* @return
*/
@Override
public Component getComponent() {
return this;
}
private void printState() {
Double value = m_jTendered.getDoubleValue();
if (value == null) {
m_dPaid = m_dTotal;
} else {
m_dPaid = value;
}
m_jMoneyEuros.setText(Formats.CURRENCY.formatValue(new Double(m_dPaid)));
int iCompare = RoundUtils.compare(m_dPaid, m_dTotal);
// if iCompare > 0 then the payment is not valid
m_notifier.setStatus(m_dPaid > 0.0 && iCompare <= 0, iCompare == 0);
}
private class RecalculateState implements PropertyChangeListener {
@Override
public void propertyChange(PropertyChangeEvent evt) {
printState();
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel2 = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
m_jKeys = new com.unicenta.editor.JEditorKeys();
jPanel3 = new javax.swing.JPanel();
m_jTendered = new com.unicenta.editor.JEditorCurrencyPositive();
jPanel4 = new javax.swing.JPanel();
jLabel8 = new javax.swing.JLabel();
m_jMoneyEuros = new javax.swing.JLabel();
setLayout(new java.awt.BorderLayout());
jPanel2.setLayout(new java.awt.BorderLayout());
jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.Y_AXIS));
jPanel1.add(m_jKeys);
jPanel3.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel3.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jPanel3.setLayout(new java.awt.BorderLayout());
m_jTendered.setFont(new java.awt.Font("Arial", 1, 16)); // NOI18N
jPanel3.add(m_jTendered, java.awt.BorderLayout.CENTER);
jPanel1.add(jPanel3);
jPanel2.add(jPanel1, java.awt.BorderLayout.NORTH);
add(jPanel2, java.awt.BorderLayout.EAST);
jPanel4.setLayout(null);
jLabel8.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
jLabel8.setText(AppLocal.getIntString("label.InputCash")); // NOI18N
jLabel8.setPreferredSize(new java.awt.Dimension(100, 30));
jPanel4.add(jLabel8);
jLabel8.setBounds(10, 4, 100, 30);
m_jMoneyEuros.setBackground(new java.awt.Color(204, 255, 51));
m_jMoneyEuros.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
m_jMoneyEuros.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
m_jMoneyEuros.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")), javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4)));
m_jMoneyEuros.setOpaque(true);
m_jMoneyEuros.setPreferredSize(new java.awt.Dimension(180, 30));
jPanel4.add(m_jMoneyEuros);
m_jMoneyEuros.setBounds(120, 4, 180, 30);
add(jPanel4, java.awt.BorderLayout.CENTER);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private com.unicenta.editor.JEditorKeys m_jKeys;
private javax.swing.JLabel m_jMoneyEuros;
private com.unicenta.editor.JEditorCurrencyPositive m_jTendered;
// End of variables declaration//GEN-END:variables
}
@@ -0,0 +1,412 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.5" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,103,0,0,2,104"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel5">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel4">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="txtCurdebt" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="txtMaxdebt" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel12" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="m_jName" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel8" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="m_jMoneyEuros" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
<Component id="jlblMessage" alignment="0" pref="0" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="txtCurdate" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace pref="30" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel8" min="-2" max="-2" attributes="0"/>
<Component id="m_jMoneyEuros" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="m_jName" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel12" min="-2" max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="txtMaxdebt" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="txtCurdebt" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="txtCurdate" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jlblMessage" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.debt" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="m_jMoneyEuros">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="33" green="ff" red="cc" type="rgb"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="18" style="1"/>
</Property>
<Property name="horizontalAlignment" type="int" value="4"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.CompoundBorderInfo">
<CompoundBorder>
<Border PropertyName="outside" info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder>
<Color PropertyName="color" blue="64" green="6f" id="Button.darkShadow" palette="3" red="71" type="palette"/>
</LineBorder>
</Border>
<Border PropertyName="inside" info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="1" left="4" right="4" top="1"/>
</Border>
</CompoundBorder>
</Border>
</Property>
<Property name="opaque" type="boolean" value="true"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[170, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.name" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="m_jName">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[170, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel12">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.notes" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.maxdebt" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="txtMaxdebt">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
<Property name="horizontalAlignment" type="int" value="4"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[170, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.curdebt" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="txtCurdebt">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
<Property name="horizontalAlignment" type="int" value="4"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[170, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.curdate" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="txtCurdate">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[170, 30]"/>
</Property>
</Properties>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="m_jNotes">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="f0" green="f0" red="f0" type="rgb"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="null"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[170, 80]"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value="JPaymentDebt_m_jNotes"/>
</AuxValues>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JTextArea" name="jlblMessage">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="66" green="0" red="cc" type="rgb"/>
</Property>
<Property name="lineWrap" type="boolean" value="true"/>
<Property name="wrapStyleWord" type="boolean" value="true"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[275, 60]"/>
</Property>
<Property name="requestFocusEnabled" type="boolean" value="false"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel6">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Last"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
<Property name="useNullLayout" type="boolean" value="false"/>
</Layout>
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel2">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="East"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="North"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
<Property name="axis" type="int" value="1"/>
</Layout>
<SubComponents>
<Component class="com.unicenta.editor.JEditorKeys" name="m_jKeys">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jKeysActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JPanel" name="jPanel3">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="5" left="5" right="5" top="5"/>
</Border>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="40" max="-2" attributes="0"/>
<Component id="m_jTendered" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="50" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="m_jTendered" min="-2" max="-2" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="com.unicenta.editor.JEditorCurrencyPositive" name="m_jTendered">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[200, 30]"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>
@@ -0,0 +1,400 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.format.Formats;
import com.unicenta.pos.customers.CustomerInfoExt;
import com.unicenta.pos.forms.AppLocal;
import com.unicenta.pos.util.RoundUtils;
import java.awt.Component;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
/**
*
* @author adrianromero
*/
public class JPaymentDebt extends javax.swing.JPanel implements JPaymentInterface {
private JPaymentNotifier notifier;
private CustomerInfoExt customerext;
private double m_dPaid;
private double m_dTotal;
/** Creates new form JPaymentDebt
* @param notifier */
public JPaymentDebt(JPaymentNotifier notifier) {
this.notifier = notifier;
initComponents();
m_jTendered.addPropertyChangeListener("Edition", new RecalculateState());
m_jTendered.addEditorKeys(m_jKeys);
}
/**
*
* @param customerext
* @param dTotal
* @param transID
*/
@Override
public void activate(CustomerInfoExt customerext, double dTotal, String transID) {
this.customerext = customerext;
m_dTotal = dTotal;
m_jTendered.reset();
if (customerext == null) {
m_jName.setText(null);
m_jNotes.setText(null);
txtMaxdebt.setText(null);
txtCurdate.setText(null);
txtCurdebt.setText(null);
m_jKeys.setEnabled(false);
m_jTendered.setEnabled(false);
} else {
m_jName.setText(customerext.getName());
m_jNotes.setText(customerext.getNotes());
txtMaxdebt.setText(Formats.CURRENCY.formatValue(RoundUtils.getValue(customerext.getMaxdebt())));
txtCurdate.setText(Formats.DATE.formatValue(customerext.getCurdate()));
txtCurdebt.setText(Formats.CURRENCY.formatValue(RoundUtils.getValue(customerext.getAccdebt())));
if (RoundUtils.compare(RoundUtils.getValue(customerext.getAccdebt()), RoundUtils.getValue(customerext.getMaxdebt())) >= 0) {
m_jKeys.setEnabled(false);
m_jTendered.setEnabled(false);
} else {
m_jKeys.setEnabled(true);
m_jTendered.setEnabled(true);
m_jTendered.activate();
}
}
printState();
}
/**
*
* @return
*/
@Override
public PaymentInfo executePayment() {
return new PaymentInfoTicket(m_dPaid, "debt");
}
/**
*
* @return
*/
@Override
public Component getComponent() {
return this;
}
private void printState() {
if (customerext == null) {
m_jMoneyEuros.setText(null);
jlblMessage.setText(AppLocal.getIntString("message.nocustomernodebt"));
notifier.setStatus(false, false);
} else {
Double value = m_jTendered.getDoubleValue();
if (value == null || value == 0.0) {
m_dPaid = m_dTotal;
} else {
m_dPaid = value;
}
m_jMoneyEuros.setText(Formats.CURRENCY.formatValue(m_dPaid));
// if (RoundUtils.compare(RoundUtils.getValue(customerext.getAccdebt()) + m_dPaid,
// RoundUtils.getValue(customerext.getMaxdebt())) >= 0) {
if ((customerext.getAccdebt() + RoundUtils.round(m_dPaid)) - (customerext.getMaxdebt()) > 0) {
jlblMessage.setText(AppLocal.getIntString("message.customerdebtexceded"));
notifier.setStatus(false, false);
} else {
jlblMessage.setText(null);
int iCompare = RoundUtils.compare(m_dPaid, m_dTotal);
// if iCompare > 0 then the payment is not valid
notifier.setStatus(m_dPaid > 0.0 && iCompare <= 0, iCompare == 0);
}
}
}
private class RecalculateState implements PropertyChangeListener {
@Override
public void propertyChange(PropertyChangeEvent evt) {
printState();
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel5 = new javax.swing.JPanel();
jPanel4 = new javax.swing.JPanel();
jLabel8 = new javax.swing.JLabel();
m_jMoneyEuros = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
m_jName = new javax.swing.JTextField();
jLabel12 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
txtMaxdebt = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
txtCurdebt = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
txtCurdate = new javax.swing.JTextField();
jScrollPane1 = new javax.swing.JScrollPane();
m_jNotes = new javax.swing.JTextArea();
jlblMessage = new javax.swing.JTextArea();
jPanel6 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
m_jKeys = new com.unicenta.editor.JEditorKeys();
jPanel3 = new javax.swing.JPanel();
m_jTendered = new com.unicenta.editor.JEditorCurrencyPositive();
setLayout(new java.awt.BorderLayout());
jPanel5.setLayout(new java.awt.BorderLayout());
jLabel8.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabel8.setText(AppLocal.getIntString("label.debt")); // NOI18N
jLabel8.setPreferredSize(new java.awt.Dimension(100, 30));
m_jMoneyEuros.setBackground(new java.awt.Color(204, 255, 51));
m_jMoneyEuros.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
m_jMoneyEuros.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
m_jMoneyEuros.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")), javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4)));
m_jMoneyEuros.setOpaque(true);
m_jMoneyEuros.setPreferredSize(new java.awt.Dimension(170, 30));
jLabel3.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabel3.setText(AppLocal.getIntString("label.name")); // NOI18N
jLabel3.setPreferredSize(new java.awt.Dimension(100, 30));
m_jName.setEditable(false);
m_jName.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
m_jName.setPreferredSize(new java.awt.Dimension(170, 30));
jLabel12.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabel12.setText(AppLocal.getIntString("label.notes")); // NOI18N
jLabel12.setPreferredSize(new java.awt.Dimension(100, 30));
jLabel2.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabel2.setText(AppLocal.getIntString("label.maxdebt")); // NOI18N
jLabel2.setPreferredSize(new java.awt.Dimension(100, 30));
txtMaxdebt.setEditable(false);
txtMaxdebt.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
txtMaxdebt.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
txtMaxdebt.setPreferredSize(new java.awt.Dimension(170, 30));
jLabel4.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabel4.setText(AppLocal.getIntString("label.curdebt")); // NOI18N
jLabel4.setPreferredSize(new java.awt.Dimension(100, 30));
txtCurdebt.setEditable(false);
txtCurdebt.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
txtCurdebt.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
txtCurdebt.setPreferredSize(new java.awt.Dimension(170, 30));
jLabel6.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabel6.setText(AppLocal.getIntString("label.curdate")); // NOI18N
jLabel6.setPreferredSize(new java.awt.Dimension(100, 30));
txtCurdate.setEditable(false);
txtCurdate.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
txtCurdate.setHorizontalAlignment(javax.swing.JTextField.CENTER);
txtCurdate.setPreferredSize(new java.awt.Dimension(170, 30));
m_jNotes.setEditable(false);
m_jNotes.setBackground(new java.awt.Color(240, 240, 240));
m_jNotes.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
m_jNotes.setBorder(null);
m_jNotes.setEnabled(false);
m_jNotes.setPreferredSize(new java.awt.Dimension(170, 80));
jScrollPane1.setViewportView(m_jNotes);
jlblMessage.setEditable(false);
jlblMessage.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jlblMessage.setForeground(new java.awt.Color(204, 0, 102));
jlblMessage.setLineWrap(true);
jlblMessage.setWrapStyleWord(true);
jlblMessage.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jlblMessage.setFocusable(false);
jlblMessage.setPreferredSize(new java.awt.Dimension(275, 60));
jlblMessage.setRequestFocusEnabled(false);
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtCurdebt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel4Layout.createSequentialGroup()
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtMaxdebt, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel4Layout.createSequentialGroup()
.addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel4Layout.createSequentialGroup()
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(m_jName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(m_jMoneyEuros, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jlblMessage, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel4Layout.createSequentialGroup()
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtCurdate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap(30, Short.MAX_VALUE))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(m_jMoneyEuros, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(m_jName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtMaxdebt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtCurdebt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtCurdate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jlblMessage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jPanel5.add(jPanel4, java.awt.BorderLayout.CENTER);
jPanel6.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel5.add(jPanel6, java.awt.BorderLayout.PAGE_END);
add(jPanel5, java.awt.BorderLayout.CENTER);
jPanel2.setLayout(new java.awt.BorderLayout());
jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.Y_AXIS));
m_jKeys.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
m_jKeysActionPerformed(evt);
}
});
jPanel1.add(m_jKeys);
jPanel3.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel3.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
m_jTendered.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
m_jTendered.setPreferredSize(new java.awt.Dimension(200, 30));
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(40, 40, 40)
.addComponent(m_jTendered, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(50, Short.MAX_VALUE))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(m_jTendered, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
jPanel1.add(jPanel3);
jPanel2.add(jPanel1, java.awt.BorderLayout.NORTH);
add(jPanel2, java.awt.BorderLayout.EAST);
}// </editor-fold>//GEN-END:initComponents
private void m_jKeysActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jKeysActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_m_jKeysActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jlblMessage;
private com.unicenta.editor.JEditorKeys m_jKeys;
private javax.swing.JLabel m_jMoneyEuros;
private javax.swing.JTextField m_jName;
private javax.swing.JTextArea m_jNotes;
private com.unicenta.editor.JEditorCurrencyPositive m_jTendered;
private javax.swing.JTextField txtCurdate;
private javax.swing.JTextField txtCurdebt;
private javax.swing.JTextField txtMaxdebt;
// End of variables declaration//GEN-END:variables
}
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="148" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="165" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="126" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="131" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="36" style="1"/>
</Property>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="message.paymentfree" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Form>
@@ -0,0 +1,113 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.pos.customers.CustomerInfoExt;
import com.unicenta.pos.forms.AppLocal;
import java.awt.Component;
/**
*
* @author JG uniCenta
*/
public class JPaymentFree extends javax.swing.JPanel implements JPaymentInterface {
private double m_dTotal;
private JPaymentNotifier m_notifier;
/** Creates new form JPaymentFree
* @param notifier */
public JPaymentFree(JPaymentNotifier notifier) {
m_notifier = notifier;
initComponents();
}
/**
*
* @param customerext
* @param dTotal
* @param transID
*/
@Override
public void activate(CustomerInfoExt customerext, double dTotal, String transID) {
m_dTotal = dTotal;
// m_jTotal.setText(Formats.CURRENCY.formatValue(new Double(m_dTotal)));
m_notifier.setStatus(true, true);
}
/**
*
* @return
*/
@Override
public PaymentInfo executePayment() {
return new PaymentInfoFree(m_dTotal);
}
/**
*
* @return
*/
@Override
public Component getComponent() {
return this;
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel1.setFont(new java.awt.Font("Arial", 1, 36)); // NOI18N
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel1.setText(AppLocal.getIntString("message.paymentfree")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(148, 148, 148)
.addComponent(jLabel1)
.addContainerGap(165, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(126, 126, 126)
.addComponent(jLabel1)
.addContainerGap(131, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
// End of variables declaration//GEN-END:variables
}
@@ -0,0 +1,34 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.pos.customers.CustomerInfoExt;
import java.awt.Component;
/**
*
* @author Adrian
*/
public interface JPaymentInterface {
public void activate(CustomerInfoExt customerext, double dTotal, String transactionID);
public PaymentInfo executePayment();
public Component getComponent();
}
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Properties>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[300, 40]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[500, 50]"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,0,50,0,0,1,-12"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[290, 35]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[500, 45]"/>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jlblMessage" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jlblMessage" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jlblMessage">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="18" style="0"/>
</Property>
<Property name="horizontalAlignment" type="int" value="0"/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>
@@ -0,0 +1,162 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.pos.customers.CustomerInfoExt;
import com.unicenta.pos.forms.AppLocal;
import com.unicenta.pos.forms.AppView;
import java.awt.BorderLayout;
import java.awt.Component;
/**
*
* @author adrianromero
*/
public class JPaymentMagcard extends javax.swing.JPanel implements JPaymentInterface {
private PaymentPanel m_cardpanel;
private final PaymentGateway m_paymentgateway;
private final JPaymentNotifier m_notifier;
private String transaction;
/** Creates new form JPaymentMagcard
* @param app
* @param notifier */
public JPaymentMagcard(AppView app, JPaymentNotifier notifier) {
initComponents();
m_notifier = notifier;
m_paymentgateway = PaymentGatewayFac.getPaymentGateway(app.getProperties());
if (m_paymentgateway == null) {
jlblMessage.setText(AppLocal.getIntString("message.nopaymentgateway"));
} else {
// Se van a poder efectuar pagos con tarjeta
m_cardpanel = PaymentPanelFac.getPaymentPanel(app.getProperties().getProperty("payment.magcardreader"), notifier);
add(m_cardpanel.getComponent(), BorderLayout.CENTER);
jlblMessage.setText(null);
// jlblMessage.setText(AppLocal.getIntString("message.nocardreader"));
}
}
/**
*
* @param customerext
* @param dTotal
* @param transID
*/
@Override
public void activate(CustomerInfoExt customerext, double dTotal, String transID) {
this.transaction = transID;
if (m_cardpanel == null) {
jlblMessage.setText(AppLocal.getIntString("message.nopaymentgateway"));
m_notifier.setStatus(false, false);
} else {
jlblMessage.setText(null);
m_cardpanel.activate(transaction, dTotal);
}
}
/**
*
* @return
*/
@Override
public PaymentInfo executePayment() {
jlblMessage.setText(null);
PaymentInfoMagcard payinfo = m_cardpanel.getPaymentInfoMagcard();
m_paymentgateway.execute(payinfo);
if (payinfo.isPaymentOK()) {
return payinfo;
} else {
jlblMessage.setText(payinfo.getMessage());
return null;
}
}
/**
*
* @return
*/
@Override
public Component getComponent() {
return this;
}
/**
*
* @param transid
*/
public void setTransaction(String transid){
transaction = transid;
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jlblMessage = new javax.swing.JLabel();
setMinimumSize(new java.awt.Dimension(300, 40));
setPreferredSize(new java.awt.Dimension(500, 50));
jPanel1.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jPanel1.setMinimumSize(new java.awt.Dimension(290, 35));
jPanel1.setPreferredSize(new java.awt.Dimension(500, 45));
jlblMessage.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
jlblMessage.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jlblMessage, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jlblMessage, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
add(jPanel1);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel jPanel1;
private javax.swing.JLabel jlblMessage;
// End of variables declaration//GEN-END:variables
}
@@ -0,0 +1,38 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
/**
*
* @author adrian
*/
public interface JPaymentNotifier {
// public void setOKEnabled(boolean bValue);
// public void setAddEnabled(boolean bValue);
/**
*
* @param isPositive
* @param isComplete
*/
public void setStatus(boolean isPositive, boolean isComplete);
}
@@ -0,0 +1,254 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,127,0,0,2,88"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel4">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="webLblCustomer" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="webLblcustomerName" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="m_jMoneyEuros" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="m_jVoucher" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<EmptySpace min="120" pref="120" max="-2" attributes="0"/>
<Component id="voucherID" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="m_jVoucher" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<Component id="m_jMoneyEuros" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="webLblCustomer" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="webLblcustomerName" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="voucherID" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="197" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="18" style="1"/>
</Property>
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="m_jVoucher"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.voucher" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="m_jVoucher">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[180, 30]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jVoucherActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="18" style="1"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.voucherValue" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="m_jMoneyEuros">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="33" green="ff" red="cc" type="rgb"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="18" style="1"/>
</Property>
<Property name="horizontalAlignment" type="int" value="4"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.CompoundBorderInfo">
<CompoundBorder>
<Border PropertyName="outside" info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder>
<Color PropertyName="color" blue="64" green="6f" id="Button.darkShadow" palette="3" red="71" type="palette"/>
</LineBorder>
</Border>
<Border PropertyName="inside" info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="1" left="4" right="4" top="1"/>
</Border>
</CompoundBorder>
</Border>
</Property>
<Property name="opaque" type="boolean" value="true"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[180, 30]"/>
</Property>
</Properties>
</Component>
<Component class="com.alee.laf.label.WebLabel" name="webLblCustomer">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.customer" replaceFormat="AppLocal.getIntString(&quot;label.customer&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value=""/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="1"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
</Properties>
</Component>
<Component class="com.alee.laf.label.WebLabel" name="webLblcustomerName">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.customer" replaceFormat="AppLocal.getIntString(&quot;label.customer&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value=""/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
</Properties>
</Component>
<Component class="com.alee.laf.label.WebLabel" name="voucherID">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.customer" replaceFormat="AppLocal.getIntString(&quot;label.customer&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value=""/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel11">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="East"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel12">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="North"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
<Property name="axis" type="int" value="1"/>
</Layout>
<SubComponents>
<Component class="com.unicenta.editor.JEditorKeys" name="m_jKeys">
</Component>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="5" left="5" right="5" top="5"/>
</Border>
</Property>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Component class="com.unicenta.editor.JEditorCurrencyPositive" name="m_jTendered">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[130, 30]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>
@@ -0,0 +1,348 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2016 uniCenta and part works Openbravo, S.L.
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.basic.BasicException;
import com.unicenta.data.gui.ComboBoxValModel;
import com.unicenta.data.loader.SentenceList;
import com.unicenta.format.Formats;
import com.unicenta.pos.customers.CustomerInfoExt;
import com.unicenta.pos.customers.DataLogicCustomers;
import com.unicenta.pos.forms.AppLocal;
import com.unicenta.pos.forms.AppView;
import com.unicenta.pos.forms.DataLogicSales;
import com.unicenta.pos.util.RoundUtils;
import com.unicenta.pos.voucher.VoucherInfo;
//import com.unicenta.pos.voucher.VoucherInfo;
import java.awt.Component;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.List;
/**
*
* @author JG uniCenta
*/
public class JPaymentPaper extends javax.swing.JPanel implements JPaymentInterface {
private final JPaymentNotifier m_notifier;
private DataLogicSales dlSales;
private DataLogicCustomers dlCustomers;
private ComboBoxValModel m_VoucherModel;
private SentenceList m_sentvouch;
private VoucherInfo m_voucherInfo;
private double m_dTicket;
private double m_dTotal;
private final String m_sPaper; // "paperin", "paperout"
private String m_sVoucher;
/** Creates new form JPaymentTicket
* @param app
* @param notifier
* @param sPaper */
public JPaymentPaper(AppView app, JPaymentNotifier notifier, String sPaper) {
m_notifier = notifier;
m_sPaper = sPaper;
m_dTotal=0.0;
init(app);
m_jTendered.addPropertyChangeListener("Edition", new RecalculateState());
// m_jTendered.addEditorKeys(m_jKeys);
}
private void init(AppView app) {
try {
dlSales = (DataLogicSales) app.getBean("com.unicenta.pos.forms.DataLogicSales");
dlCustomers = (DataLogicCustomers) app.getBean("com.unicenta.pos.customers.DataLogicCustomers");
m_sentvouch = dlSales.getVoucherList();
initComponents();
m_VoucherModel = new ComboBoxValModel();
List a = m_sentvouch.list();
a.add(0, null);
m_VoucherModel = new ComboBoxValModel(a);
m_jVoucher.setModel(m_VoucherModel);
webLblcustomerName.setText(null);
} catch (BasicException ex) {
}
}
/**
*
* @param customerext
* @param dTotal
* @param transID
*/
@Override
public void activate(CustomerInfoExt customerext, double dTotal,String transID) {
m_dTotal = dTotal;
m_jTendered.reset();
// m_jTendered.activate();
m_jKeys.setEnabled(false);
m_jTendered.setEnabled(false);
printState();
}
/**
*
* @return
*/
@Override
public Component getComponent() {
return this;
}
/**
*
* @return
*/
@Override
public PaymentInfo executePayment() {
/* try {
String id = m_VoucherModel.getSelectedKey().toString();
VoucherInfo m_voucherInfo = dlCustomers.getVoucherInfo(id);
} catch (BasicException ex) {
}
if (m_dTicket>m_dTotal){
return new VoucherPaymentInfo(m_dTotal, m_sPaper,m_voucherInfo.getVoucherNumber());
}else{
return new VoucherPaymentInfo(m_dTicket, m_sPaper,m_voucherInfo.getVoucherNumber());
}
*/
try {
String id = m_VoucherModel.getSelectedKey().toString();
VoucherInfo m_voucherInfo1 = dlCustomers.getVoucherInfo(id);
m_sVoucher = m_voucherInfo1.getVoucherNumber();
} catch (BasicException ex) {
}
return new PaymentInfoTicket(m_dTicket, m_sPaper, m_sVoucher);
}
private void printState() {
Double value = m_jTendered.getDoubleValue();
if (value == null) {
m_dTicket = 0.0;
} else {
m_dTicket = value;
}
m_jMoneyEuros.setText(Formats.CURRENCY.formatValue(m_dTicket));
int iCompare = RoundUtils.compare(m_dTicket, m_dTotal);
// it is allowed to pay more
m_notifier.setStatus(m_dTicket > 0.0, iCompare >= 0);
}
private class RecalculateState implements PropertyChangeListener {
@Override
public void propertyChange(PropertyChangeEvent evt) {
printState();
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel4 = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
m_jVoucher = new javax.swing.JComboBox();
jLabel1 = new javax.swing.JLabel();
m_jMoneyEuros = new javax.swing.JLabel();
webLblCustomer = new com.alee.laf.label.WebLabel();
webLblcustomerName = new com.alee.laf.label.WebLabel();
voucherID = new com.alee.laf.label.WebLabel();
jPanel11 = new javax.swing.JPanel();
jPanel12 = new javax.swing.JPanel();
m_jKeys = new com.unicenta.editor.JEditorKeys();
jPanel1 = new javax.swing.JPanel();
m_jTendered = new com.unicenta.editor.JEditorCurrencyPositive();
setLayout(new java.awt.BorderLayout());
jLabel5.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
jLabel5.setLabelFor(m_jVoucher);
jLabel5.setText(AppLocal.getIntString("label.voucher")); // NOI18N
jLabel5.setPreferredSize(new java.awt.Dimension(100, 30));
m_jVoucher.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
m_jVoucher.setPreferredSize(new java.awt.Dimension(180, 30));
m_jVoucher.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
m_jVoucherActionPerformed(evt);
}
});
jLabel1.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
jLabel1.setText(AppLocal.getIntString("label.voucherValue")); // NOI18N
jLabel1.setPreferredSize(new java.awt.Dimension(100, 30));
m_jMoneyEuros.setBackground(new java.awt.Color(204, 255, 51));
m_jMoneyEuros.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
m_jMoneyEuros.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
m_jMoneyEuros.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")), javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4)));
m_jMoneyEuros.setOpaque(true);
m_jMoneyEuros.setPreferredSize(new java.awt.Dimension(180, 30));
webLblCustomer.setText(AppLocal.getIntString("label.customer")); // NOI18N
webLblCustomer.setToolTipText("");
webLblCustomer.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
webLblCustomer.setPreferredSize(new java.awt.Dimension(100, 30));
webLblcustomerName.setText(AppLocal.getIntString("label.customer")); // NOI18N
webLblcustomerName.setToolTipText("");
webLblcustomerName.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
webLblcustomerName.setPreferredSize(new java.awt.Dimension(100, 30));
voucherID.setText(AppLocal.getIntString("label.customer")); // NOI18N
voucherID.setToolTipText("");
voucherID.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
voucherID.setPreferredSize(new java.awt.Dimension(100, 30));
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addComponent(webLblCustomer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(webLblcustomerName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel4Layout.createSequentialGroup()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(m_jMoneyEuros, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(m_jVoucher, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(120, 120, 120)
.addComponent(voucherID, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(m_jVoucher, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(m_jMoneyEuros, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(webLblCustomer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(webLblcustomerName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(voucherID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(197, 197, 197))
);
add(jPanel4, java.awt.BorderLayout.CENTER);
jPanel11.setLayout(new java.awt.BorderLayout());
jPanel12.setLayout(new javax.swing.BoxLayout(jPanel12, javax.swing.BoxLayout.Y_AXIS));
jPanel12.add(m_jKeys);
jPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel1.setLayout(new java.awt.BorderLayout());
m_jTendered.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
m_jTendered.setPreferredSize(new java.awt.Dimension(130, 30));
jPanel1.add(m_jTendered, java.awt.BorderLayout.CENTER);
jPanel12.add(jPanel1);
jPanel11.add(jPanel12, java.awt.BorderLayout.NORTH);
add(jPanel11, java.awt.BorderLayout.EAST);
}// </editor-fold>//GEN-END:initComponents
private void m_jVoucherActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jVoucherActionPerformed
if (m_VoucherModel.getSelectedKey()!=null){
try {
String id = m_VoucherModel.getSelectedKey().toString();
VoucherInfo m_voucherInfo = dlCustomers.getVoucherInfo(id);
if (m_voucherInfo != null){
m_jTendered.setDoubleValue(m_voucherInfo.getAmount());
m_jMoneyEuros.setText(Formats.CURRENCY.formatValue(m_voucherInfo.getAmount()));
webLblcustomerName.setText(m_voucherInfo.getCustomerName());
printState();
}
} catch (BasicException ex) {
// ex.printStackTrace();
}
}
}//GEN-LAST:event_m_jVoucherActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel5;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel11;
private javax.swing.JPanel jPanel12;
private javax.swing.JPanel jPanel4;
private com.unicenta.editor.JEditorKeys m_jKeys;
private javax.swing.JLabel m_jMoneyEuros;
private com.unicenta.editor.JEditorCurrencyPositive m_jTendered;
private javax.swing.JComboBox m_jVoucher;
private com.alee.laf.label.WebLabel voucherID;
private com.alee.laf.label.WebLabel webLblCustomer;
private com.alee.laf.label.WebLabel webLblcustomerName;
// End of variables declaration//GEN-END:variables
}
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace pref="35" max="32767" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="35" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="131" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="155" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="30" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="message.paymentcashneg" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Form>
@@ -0,0 +1,115 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.pos.customers.CustomerInfoExt;
import com.unicenta.pos.forms.AppLocal;
import java.awt.Component;
/**
*
* @author JG uniCenta
*/
public class JPaymentRefund extends javax.swing.JPanel implements JPaymentInterface {
private JPaymentNotifier m_notifier;
private double m_dTotal;
private String m_sName;
/** Creates new form JPaymentChequeRefund
* @param notifier
* @param sName */
public JPaymentRefund(JPaymentNotifier notifier, String sName) {
m_notifier = notifier;
m_sName = sName;
initComponents();
}
/**
*
* @param customerext
* @param dTotal
* @param transID
*/
@Override
public void activate(CustomerInfoExt customerext, double dTotal, String transID) {
m_dTotal = dTotal;
m_notifier.setStatus(true, true);
}
/**
*
* @return
*/
@Override
public PaymentInfo executePayment() {
return new PaymentInfoTicket(m_dTotal, m_sName);
}
/**
*
* @return
*/
@Override
public Component getComponent() {
return this;
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel1.setFont(new java.awt.Font("Arial", 0, 30)); // NOI18N
jLabel1.setText(AppLocal.getIntString("message.paymentcashneg")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap(35, Short.MAX_VALUE)
.addComponent(jLabel1)
.addContainerGap(35, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(131, 131, 131)
.addComponent(jLabel1)
.addContainerGap(155, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
// End of variables declaration//GEN-END:variables
}
@@ -0,0 +1,379 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="payment.title" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[750, 127]"/>
</Property>
<Property name="resizable" type="boolean" value="false"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-15,0,0,2,-10"/>
<SyntheticProperty name="formSizePolicy" type="int" value="0"/>
<SyntheticProperty name="generateSize" type="boolean" value="true"/>
<SyntheticProperty name="generateCenter" type="boolean" value="true"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel4">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="North"/>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="5" max="-2" attributes="0"/>
<Component id="m_jLblTotalEuros1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="m_jTotalEuros" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel6" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Component id="m_jLblRemainingEuros" min="-2" pref="120" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="m_jRemaininglEuros" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="m_jButtonAdd" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="m_jButtonRemove" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="m_jButtonRemove" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="m_jButtonAdd" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="5" pref="5" max="-2" attributes="0"/>
<Component id="jPanel6" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="m_jLblTotalEuros1" min="-2" max="-2" attributes="0"/>
<Component id="m_jRemaininglEuros" min="-2" max="-2" attributes="0"/>
<Component id="m_jLblRemainingEuros" min="-2" max="-2" attributes="0"/>
<Component id="m_jTotalEuros" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="m_jLblTotalEuros1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="24" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.totalcash" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="m_jTotalEuros">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" id="white" palette="0" red="ff" type="palette"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="24" style="0"/>
</Property>
<Property name="horizontalAlignment" type="int" value="2"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.CompoundBorderInfo">
<CompoundBorder>
<Border PropertyName="outside" info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder>
<Color PropertyName="color" blue="99" green="8a" id="Button.darkShadow" palette="3" red="7a" type="palette"/>
</LineBorder>
</Border>
<Border PropertyName="inside" info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="1" left="4" right="4" top="1"/>
</Border>
</CompoundBorder>
</Border>
</Property>
<Property name="opaque" type="boolean" value="true"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[150, 30]"/>
</Property>
<Property name="requestFocusEnabled" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="m_jLblRemainingEuros">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="24" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.remainingcash" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[120, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="m_jRemaininglEuros">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" id="white" palette="0" red="ff" type="palette"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="24" style="1"/>
</Property>
<Property name="horizontalAlignment" type="int" value="2"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.CompoundBorderInfo">
<CompoundBorder>
<Border PropertyName="outside" info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder>
<Color PropertyName="color" blue="99" green="8a" id="Button.darkShadow" palette="3" red="7a" type="palette"/>
</LineBorder>
</Border>
<Border PropertyName="inside" info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="1" left="4" right="4" top="1"/>
</Border>
</CompoundBorder>
</Border>
</Property>
<Property name="opaque" type="boolean" value="true"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[150, 30]"/>
</Property>
<Property name="requestFocusEnabled" type="boolean" value="false"/>
</Properties>
</Component>
<Container class="javax.swing.JPanel" name="jPanel6">
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
<Property name="verticalGap" type="int" value="0"/>
</Layout>
</Container>
<Component class="javax.swing.JButton" name="m_jButtonRemove">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/unicenta/images/btnminus.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value="Delete Part Payment"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[80, 45]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jButtonRemoveActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="m_jButtonAdd">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/unicenta/images/btnplus.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value="Add Part Payment"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[80, 45]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jButtonAddActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel3">
<Properties>
<Property name="nextFocusableComponent" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="m_jTabPayment"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JTabbedPane" name="m_jTabPayment">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="5" left="5" right="5" top="5"/>
</Border>
</Property>
<Property name="tabPlacement" type="int" value="2"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="requestFocusEnabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="m_jTabPaymentStateChanged"/>
<EventHandler event="keyPressed" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="m_jTabPaymentKeyPressed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/>
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel5">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="South"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel2">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="After"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
<SubComponents>
<Component class="javax.swing.JButton" name="m_jButtonCancel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/unicenta/images/cancel.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="button.cancel" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusPainted" type="boolean" value="false"/>
<Property name="focusable" type="boolean" value="false"/>
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
<Insets value="[8, 16, 8, 16]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[110, 45]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jButtonCancelActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="m_jButtonOK">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/unicenta/images/ok.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="button.OK" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusPainted" type="boolean" value="false"/>
<Property name="focusable" type="boolean" value="false"/>
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
<Insets value="[8, 16, 8, 16]"/>
</Property>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 44]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[110, 45]"/>
</Property>
<Property name="requestFocusEnabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jButtonOKActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JToggleButton" name="m_jButtonPrint">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/unicenta/images/printer24_off.png"/>
</Property>
<Property name="selected" type="boolean" value="true"/>
<Property name="toolTipText" type="java.lang.String" value="Print Receipt"/>
<Property name="focusPainted" type="boolean" value="false"/>
<Property name="focusable" type="boolean" value="false"/>
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
<Insets value="[8, 16, 8, 16]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[80, 45]"/>
</Property>
<Property name="requestFocusEnabled" type="boolean" value="false"/>
<Property name="selectedIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/unicenta/images/printer24.png"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jButtonPrintActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Before"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jlblPrinterStatus">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="24" style="0"/>
</Property>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.printerstatusOn" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>
@@ -0,0 +1,787 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.format.Formats;
import com.unicenta.pos.customers.CustomerInfoExt;
import com.unicenta.pos.customers.DataLogicCustomers;
import com.unicenta.pos.forms.AppLocal;
import com.unicenta.pos.forms.AppView;
import com.unicenta.pos.forms.DataLogicSales;
import com.unicenta.pos.forms.DataLogicSystem;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.swing.JFrame;
import javax.swing.SwingWorker;
/**
*
* @author adrianromero
*/
public abstract class JPaymentSelect extends javax.swing.JDialog
implements JPaymentNotifier {
private PaymentInfoList m_aPaymentInfo;
private boolean printselected;
private boolean accepted;
private AppView app;
private double m_dTotal;
private CustomerInfoExt customerext;
private DataLogicSystem dlSystem;
private DataLogicCustomers dlCustomers ;
DataLogicSales dlSales;
// JG 16 May 12 use diamond inference
private Map<String, JPaymentInterface> payments = new HashMap<>();
private String m_sTransactionID;
private static PaymentInfo returnPayment = null;
public static PaymentInfo getReturnPayment() {
return returnPayment;
}
public static void setReturnPayment(PaymentInfo returnPayment) {
JPaymentSelect.returnPayment = returnPayment;
}
/**
* Creates new form JPaymentSelect
*
* @param parent
* @param modal
* @param o
*/
protected JPaymentSelect(java.awt.Frame parent, boolean modal, ComponentOrientation o) {
super(parent, modal);
initComponents();
this.applyComponentOrientation(o);
getRootPane().setDefaultButton(m_jButtonOK);
}
/** Creates new form JPaymentSelect
* @param parent
* @param modal
* @param o */
protected JPaymentSelect(java.awt.Dialog parent, boolean modal, ComponentOrientation o) {
super(parent, modal);
initComponents();
m_jButtonPrint.setVisible(true);
this.applyComponentOrientation(o);
if (printselected) {
jlblPrinterStatus.setText("Printer ON");
} else {
jlblPrinterStatus.setText("Printer OFF");
}
}
public void init(AppView app) {
this.app = app;
dlSystem = (DataLogicSystem) app.getBean("com.unicenta.pos.forms.DataLogicSystem");
dlCustomers= (DataLogicCustomers) app.getBean("com.unicenta.pos.customers.DataLogicCustomers");
dlSales = (DataLogicSales) app.getBean("com.unicenta.pos.forms.DataLogicSales");
printselected = false;
if (printselected) {
jlblPrinterStatus.setText("Printer ON");
} else {
jlblPrinterStatus.setText("Printer OFF");
}
}
public void setPrintSelected(boolean value) {
printselected = value;
}
public boolean isPrintSelected() {
return printselected;
}
public List<PaymentInfo> getSelectedPayments() {
return m_aPaymentInfo.getPayments();
}
public boolean showDialog(double total, CustomerInfoExt customerext,double deposit) {
m_aPaymentInfo = new PaymentInfoList();
accepted = false;
total -= deposit;
m_dTotal = total;
this.customerext = customerext;
m_jButtonPrint.setVisible(true);
m_jButtonPrint.setSelected(printselected);
m_jTotalEuros.setText(Formats.CURRENCY.formatValue(m_dTotal));
addTabs();
// gets the print button state
printselected = m_jButtonPrint.isSelected();
// remove all tabs
m_jTabPayment.removeAll();
return accepted;
}
public boolean showDialog(double total, CustomerInfoExt customerext) {
m_aPaymentInfo = new PaymentInfoList();
accepted = false;
m_dTotal = total;
this.customerext = customerext;
setPrintSelected(!Boolean.parseBoolean(app.getProperties().getProperty("till.receiptprintoff")));
m_jButtonPrint.setSelected(printselected);
m_jTotalEuros.setText(Formats.CURRENCY.formatValue(m_dTotal));
if (printselected) {
jlblPrinterStatus.setText("Printer ON");
} else {
jlblPrinterStatus.setText("Printer OFF");
}
// N. Deppe 08/11/2018
// Fix issue where dialog keeps moving lower and lower on the screen
// Get the size of the screen, and center the dialog in the window
Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize();
Dimension thisDim = this.getSize();
int x = (screenDim.width - thisDim.width) / 2;
int y = (screenDim.height - thisDim.height) / 2;
this.setLocation(x, y);
addTabs();
if (m_jTabPayment.getTabCount() == 0) {
// No payment panels available
m_aPaymentInfo.add(getDefaultPayment(total));
accepted = true;
} else {
getRootPane().setDefaultButton(m_jButtonOK);
printState();
setVisible(true);
}
// gets the print button state
printselected = m_jButtonPrint.isSelected();
// remove all tabs
m_jTabPayment.removeAll();
return accepted;
}
protected abstract void addTabs();
protected abstract void setStatusPanel(boolean isPositive, boolean isComplete);
protected abstract PaymentInfo getDefaultPayment(double total);
protected void setOKEnabled(boolean value) {
m_jButtonOK.setEnabled(value);
}
protected void setAddEnabled(boolean value) {
m_jButtonAdd.setEnabled(value);
}
protected void addTabPayment(JPaymentCreator jpay) {
if (app.getAppUserView().getUser().hasPermission(jpay.getKey())) {
JPaymentInterface jpayinterface = payments.get(jpay.getKey());
if (jpayinterface == null) {
jpayinterface = jpay.createJPayment();
payments.put(jpay.getKey(), jpayinterface);
}
jpayinterface.getComponent().applyComponentOrientation(getComponentOrientation());
m_jTabPayment.addTab(
AppLocal.getIntString(jpay.getLabelKey()),
new javax.swing.ImageIcon(getClass().getResource(jpay.getIconKey())),
jpayinterface.getComponent());
}
}
public interface JPaymentCreator {
public JPaymentInterface createJPayment();
public String getKey();
public String getLabelKey();
public String getIconKey();
}
public class JPaymentCashCreator implements JPaymentCreator {
@Override
public JPaymentInterface createJPayment() {
return new JPaymentCashPos(JPaymentSelect.this, dlSystem);
}
@Override
public String getKey() {
return "payment.cash"; }
@Override
public String getLabelKey() {
return "tab.cash"; }
@Override
public String getIconKey() {
return "/com/unicenta/images/cash.png"; }
}
public class JPaymentChequeCreator implements JPaymentCreator {
@Override
public JPaymentInterface createJPayment() {
return new JPaymentCheque(JPaymentSelect.this);
}
@Override
public String getKey() {
return "payment.cheque"; }
@Override
public String getLabelKey() {
return "tab.cheque"; }
@Override
public String getIconKey() {
return "/com/unicenta/images/cheque.png"; }
}
public class JPaymentVoucherCreator implements JPaymentCreator {
@Override
public JPaymentInterface createJPayment() {
return new JPaymentVoucher(app, JPaymentSelect.this, "voucherin");
}
@Override
public String getKey() {
return "payment.voucher"; }
@Override
public String getLabelKey() {
return "tab.voucher"; }
@Override
public String getIconKey() {
return "/com/unicenta/images/voucher.png"; }
}
public class JPaymentMagcardCreator implements JPaymentCreator {
@Override
public JPaymentInterface createJPayment() {
return new JPaymentMagcard(app, JPaymentSelect.this);
}
@Override
public String getKey() {
return "payment.magcard"; }
@Override
public String getLabelKey() {
return "tab.magcard"; }
@Override
public String getIconKey() {
return "/com/unicenta/images/ccard.png"; }
}
public class JPaymentFreeCreator implements JPaymentCreator {
@Override
public JPaymentInterface createJPayment() {
return new JPaymentFree(JPaymentSelect.this);
}
@Override
public String getKey() {
return "payment.free";
}
@Override
public String getLabelKey() {
return "tab.free";
}
@Override
public String getIconKey() {
return "/com/unicenta/images/wallet.png";
}
}
public class JPaymentDebtCreator implements JPaymentCreator {
@Override
public JPaymentInterface createJPayment() {
return new JPaymentDebt(JPaymentSelect.this);
}
@Override
public String getKey() {
return "payment.debt";
}
@Override
public String getLabelKey() {
return "tab.debt";
}
@Override
public String getIconKey() {
return "/com/unicenta/images/customer.png";
}
}
public class JPaymentCashRefundCreator implements JPaymentCreator {
@Override
public JPaymentInterface createJPayment() {
return new JPaymentRefund(JPaymentSelect.this, "cashrefund");
}
@Override
public String getKey() {
return "refund.cash";
}
@Override
public String getLabelKey() {
return "tab.cashrefund";
}
@Override
public String getIconKey() {
return "/com/unicenta/images/cash.png";
}
}
public class JPaymentChequeRefundCreator implements JPaymentCreator {
@Override
public JPaymentInterface createJPayment() {
return new JPaymentRefund(JPaymentSelect.this, "chequerefund");
}
@Override
public String getKey() {
return "refund.cheque";
}
@Override
public String getLabelKey() {
return "tab.chequerefund";
}
@Override
public String getIconKey() {
return "/com/unicenta/images/cheque.png";
}
}
public class JPaymentVoucherRefundCreator implements JPaymentCreator {
@Override
public JPaymentInterface createJPayment() {
return new JPaymentRefund(JPaymentSelect.this, "voucherout");
}
@Override
public String getKey() {
return "refund.voucher";
}
@Override
public String getLabelKey() {
return "tab.voucher";
}
@Override
public String getIconKey() {
return "/com/unicenta/images/voucher.png";
}
}
public class JPaymentMagcardRefundCreator implements JPaymentCreator {
@Override
public JPaymentInterface createJPayment() {
return new JPaymentMagcard(app, JPaymentSelect.this);
}
@Override
public String getKey() {
return "refund.magcard";
}
@Override
public String getLabelKey() {
return "tab.magcard";
}
@Override
public String getIconKey() {
return "/com/unicenta/images/ccard.png";
}
}
public class JPaymentBankCreator implements JPaymentCreator {
@Override
public JPaymentInterface createJPayment() {
return new JPaymentBank(JPaymentSelect.this);
}
@Override
public String getKey() {
return "payment.bank";
}
@Override
public String getLabelKey() {
return "tab.bank";
}
@Override
public String getIconKey() {
return "/com/unicenta/images/bank.png";
}
}
public class JPaymentSlipCreator implements JPaymentCreator {
@Override
public JPaymentInterface createJPayment() {
return new JPaymentSlip(JPaymentSelect.this);
}
@Override
public String getKey() {
return "payment.slip";
}
@Override
public String getLabelKey() {
return "tab.slip";
}
@Override
public String getIconKey() {
return "/com/unicenta/images/slip.png";
}
}
private void printState() {
m_jRemaininglEuros.setText(Formats.CURRENCY.formatValue(
m_dTotal - m_aPaymentInfo.getTotal()));
m_jButtonRemove.setEnabled(!m_aPaymentInfo.isEmpty());
m_jTabPayment.setSelectedIndex(0);
((JPaymentInterface) m_jTabPayment.getSelectedComponent())
.activate(customerext,
m_dTotal - m_aPaymentInfo.getTotal()
, m_sTransactionID);
}
protected static Window getWindow(Component parent) {
if (parent == null) {
return new JFrame();
} else if (parent instanceof Frame || parent instanceof Dialog) {
return (Window)parent;
} else {
return getWindow(parent.getParent());
}
}
@Override
public void setStatus(boolean isPositive, boolean isComplete) {
setStatusPanel(isPositive, isComplete);
}
public void setTransactionID(String tID){
this.m_sTransactionID = tID;
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel4 = new javax.swing.JPanel();
m_jLblTotalEuros1 = new javax.swing.JLabel();
m_jTotalEuros = new javax.swing.JLabel();
m_jLblRemainingEuros = new javax.swing.JLabel();
m_jRemaininglEuros = new javax.swing.JLabel();
jPanel6 = new javax.swing.JPanel();
m_jButtonRemove = new javax.swing.JButton();
m_jButtonAdd = new javax.swing.JButton();
jPanel3 = new javax.swing.JPanel();
m_jTabPayment = new javax.swing.JTabbedPane();
jPanel5 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
m_jButtonCancel = new javax.swing.JButton();
m_jButtonOK = new javax.swing.JButton();
m_jButtonPrint = new javax.swing.JToggleButton();
jlblPrinterStatus = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle(AppLocal.getIntString("payment.title")); // NOI18N
setPreferredSize(new java.awt.Dimension(750, 127));
setResizable(false);
jPanel4.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
m_jLblTotalEuros1.setFont(new java.awt.Font("Arial", 0, 24)); // NOI18N
m_jLblTotalEuros1.setText(AppLocal.getIntString("label.totalcash")); // NOI18N
m_jLblTotalEuros1.setPreferredSize(new java.awt.Dimension(100, 30));
m_jTotalEuros.setFont(new java.awt.Font("Arial", 0, 24)); // NOI18N
m_jTotalEuros.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
m_jTotalEuros.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")), javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4)));
m_jTotalEuros.setOpaque(true);
m_jTotalEuros.setPreferredSize(new java.awt.Dimension(150, 30));
m_jTotalEuros.setRequestFocusEnabled(false);
m_jLblRemainingEuros.setFont(new java.awt.Font("Arial", 0, 24)); // NOI18N
m_jLblRemainingEuros.setText(AppLocal.getIntString("label.remainingcash")); // NOI18N
m_jLblRemainingEuros.setPreferredSize(new java.awt.Dimension(120, 30));
m_jRemaininglEuros.setFont(new java.awt.Font("Arial", 1, 24)); // NOI18N
m_jRemaininglEuros.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
m_jRemaininglEuros.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")), javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4)));
m_jRemaininglEuros.setOpaque(true);
m_jRemaininglEuros.setPreferredSize(new java.awt.Dimension(150, 30));
m_jRemaininglEuros.setRequestFocusEnabled(false);
jPanel6.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 5, 0));
m_jButtonRemove.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/btnminus.png"))); // NOI18N
m_jButtonRemove.setToolTipText("Delete Part Payment");
m_jButtonRemove.setPreferredSize(new java.awt.Dimension(80, 45));
m_jButtonRemove.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
m_jButtonRemoveActionPerformed(evt);
}
});
m_jButtonAdd.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/btnplus.png"))); // NOI18N
m_jButtonAdd.setToolTipText("Add Part Payment");
m_jButtonAdd.setPreferredSize(new java.awt.Dimension(80, 45));
m_jButtonAdd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
m_jButtonAddActionPerformed(evt);
}
});
org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel4Layout.createSequentialGroup()
.add(5, 5, 5)
.add(m_jLblTotalEuros1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
.add(m_jTotalEuros, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(jPanel4Layout.createSequentialGroup()
.add(m_jLblRemainingEuros, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 120, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(m_jRemaininglEuros, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
.add(18, 18, 18)
.add(m_jButtonAdd, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(m_jButtonRemove, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(4, 4, 4))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel4Layout.createSequentialGroup()
.add(0, 0, Short.MAX_VALUE)
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, m_jButtonRemove, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(org.jdesktop.layout.GroupLayout.TRAILING, m_jButtonAdd, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel4Layout.createSequentialGroup()
.add(5, 5, 5)
.add(jPanel6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(m_jLblTotalEuros1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(m_jRemaininglEuros, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(m_jLblRemainingEuros, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(m_jTotalEuros, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
getContentPane().add(jPanel4, java.awt.BorderLayout.NORTH);
jPanel3.setNextFocusableComponent(m_jTabPayment);
jPanel3.setLayout(new java.awt.BorderLayout());
m_jTabPayment.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
m_jTabPayment.setTabPlacement(javax.swing.JTabbedPane.LEFT);
m_jTabPayment.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
m_jTabPayment.setRequestFocusEnabled(false);
m_jTabPayment.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
m_jTabPaymentStateChanged(evt);
}
});
m_jTabPayment.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
m_jTabPaymentKeyPressed(evt);
}
});
jPanel3.add(m_jTabPayment, java.awt.BorderLayout.CENTER);
getContentPane().add(jPanel3, java.awt.BorderLayout.CENTER);
jPanel5.setLayout(new java.awt.BorderLayout());
m_jButtonCancel.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
m_jButtonCancel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/cancel.png"))); // NOI18N
m_jButtonCancel.setText(AppLocal.getIntString("button.cancel")); // NOI18N
m_jButtonCancel.setFocusPainted(false);
m_jButtonCancel.setFocusable(false);
m_jButtonCancel.setMargin(new java.awt.Insets(8, 16, 8, 16));
m_jButtonCancel.setPreferredSize(new java.awt.Dimension(110, 45));
m_jButtonCancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
m_jButtonCancelActionPerformed(evt);
}
});
jPanel2.add(m_jButtonCancel);
m_jButtonOK.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
m_jButtonOK.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/ok.png"))); // NOI18N
m_jButtonOK.setText(AppLocal.getIntString("button.OK")); // NOI18N
m_jButtonOK.setFocusPainted(false);
m_jButtonOK.setFocusable(false);
m_jButtonOK.setMargin(new java.awt.Insets(8, 16, 8, 16));
m_jButtonOK.setMaximumSize(new java.awt.Dimension(100, 44));
m_jButtonOK.setPreferredSize(new java.awt.Dimension(110, 45));
m_jButtonOK.setRequestFocusEnabled(false);
m_jButtonOK.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
m_jButtonOKActionPerformed(evt);
}
});
jPanel2.add(m_jButtonOK);
jPanel5.add(jPanel2, java.awt.BorderLayout.LINE_END);
m_jButtonPrint.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/printer24_off.png"))); // NOI18N
m_jButtonPrint.setSelected(true);
m_jButtonPrint.setToolTipText("Print Receipt");
m_jButtonPrint.setFocusPainted(false);
m_jButtonPrint.setFocusable(false);
m_jButtonPrint.setMargin(new java.awt.Insets(8, 16, 8, 16));
m_jButtonPrint.setPreferredSize(new java.awt.Dimension(80, 45));
m_jButtonPrint.setRequestFocusEnabled(false);
m_jButtonPrint.setSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/printer24.png"))); // NOI18N
m_jButtonPrint.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
m_jButtonPrintActionPerformed(evt);
}
});
jPanel5.add(m_jButtonPrint, java.awt.BorderLayout.LINE_START);
jlblPrinterStatus.setFont(new java.awt.Font("Arial", 0, 24)); // NOI18N
jlblPrinterStatus.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("pos_messages"); // NOI18N
jlblPrinterStatus.setText(bundle.getString("label.printerstatusOn")); // NOI18N
jPanel5.add(jlblPrinterStatus, java.awt.BorderLayout.CENTER);
getContentPane().add(jPanel5, java.awt.BorderLayout.SOUTH);
setSize(new java.awt.Dimension(758, 497));
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void m_jButtonRemoveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jButtonRemoveActionPerformed
m_aPaymentInfo.removeLast();
printState();
}//GEN-LAST:event_m_jButtonRemoveActionPerformed
private void m_jButtonAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jButtonAddActionPerformed
PaymentInfo returnPayment = (
(JPaymentInterface) m_jTabPayment.getSelectedComponent())
.executePayment();
if (returnPayment != null) {
m_aPaymentInfo.add(returnPayment);
printState();
}
}//GEN-LAST:event_m_jButtonAddActionPerformed
private void m_jTabPaymentStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_m_jTabPaymentStateChanged
if (m_jTabPayment.getSelectedComponent() != null) {
((JPaymentInterface) m_jTabPayment.getSelectedComponent())
.activate(customerext
, m_dTotal - m_aPaymentInfo.getTotal()
, m_sTransactionID);
m_jRemaininglEuros.setText(
Formats.CURRENCY.formatValue(
m_dTotal - m_aPaymentInfo.getTotal()));
}
}//GEN-LAST:event_m_jTabPaymentStateChanged
private void m_jButtonOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jButtonOKActionPerformed
SwingWorker worker = new SwingWorker() {
@Override
protected Object doInBackground() throws Exception {
m_jButtonOK.setEnabled(false);
setReturnPayment(((JPaymentInterface) m_jTabPayment.getSelectedComponent()).executePayment());
return null;
}
@Override
public void done() {
m_jButtonOK.setEnabled(true);
m_jButtonCancel.setEnabled(true);
if (returnPayment != null) {
m_aPaymentInfo.add(returnPayment);
accepted = true;
dispose();
}
}
};
worker.execute();
}//GEN-LAST:event_m_jButtonOKActionPerformed
private void m_jButtonCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jButtonCancelActionPerformed
dispose();
}//GEN-LAST:event_m_jButtonCancelActionPerformed
private void m_jButtonPrintActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jButtonPrintActionPerformed
if (!m_jButtonPrint.isSelected()) {
jlblPrinterStatus.setText("Printer OFF");
} else {
jlblPrinterStatus.setText("Printer ON");
}
}//GEN-LAST:event_m_jButtonPrintActionPerformed
private void m_jTabPaymentKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_m_jTabPaymentKeyPressed
if( evt.getKeyCode() == KeyEvent.VK_F1 ) {
} else if ( evt.getKeyCode() == KeyEvent.VK_F2 ) {
}
}//GEN-LAST:event_m_jTabPaymentKeyPressed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JLabel jlblPrinterStatus;
private javax.swing.JButton m_jButtonAdd;
private javax.swing.JButton m_jButtonCancel;
private javax.swing.JButton m_jButtonOK;
private javax.swing.JToggleButton m_jButtonPrint;
private javax.swing.JButton m_jButtonRemove;
private javax.swing.JLabel m_jLblRemainingEuros;
private javax.swing.JLabel m_jLblTotalEuros1;
private javax.swing.JLabel m_jRemaininglEuros;
private javax.swing.JTabbedPane m_jTabPayment;
private javax.swing.JLabel m_jTotalEuros;
// End of variables declaration//GEN-END:variables
}
@@ -0,0 +1,97 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import java.awt.*;
/**
*
* @author adrianromero
*/
public class JPaymentSelectCustomer extends JPaymentSelect {
/** Creates new form JPaymentSelect
* @param parent
* @param modal
* @param o */
protected JPaymentSelectCustomer(java.awt.Frame parent, boolean modal, ComponentOrientation o) {
super(parent, modal, o);
}
/** Creates new form JPaymentSelect
* @param parent
* @param modal
* @param o */
protected JPaymentSelectCustomer(java.awt.Dialog parent, boolean modal, ComponentOrientation o) {
super(parent, modal, o);
}
/**
*
* @param parent
* @return
*/
public static JPaymentSelect getDialog(Component parent) {
Window window = getWindow(parent);
if (window instanceof Frame) {
return new JPaymentSelectCustomer((Frame) window, true, parent.getComponentOrientation());
} else {
return new JPaymentSelectCustomer((Dialog) window, true, parent.getComponentOrientation());
}
}
/**
*
*/
@Override
protected void addTabs() {
// Bank Payment Receipt - Thanks Steve Clough! August 2011
addTabPayment(new JPaymentSelect.JPaymentCashCreator());
addTabPayment(new JPaymentSelect.JPaymentChequeCreator());
addTabPayment(new JPaymentSelect.JPaymentVoucherCreator());
addTabPayment(new JPaymentSelect.JPaymentBankCreator());
addTabPayment(new JPaymentSelect.JPaymentMagcardCreator());
addTabPayment(new JPaymentSelect.JPaymentSlipCreator());
}
/**
*
* @param isPositive
* @param isComplete
*/
@Override
protected void setStatusPanel(boolean isPositive, boolean isComplete) {
setAddEnabled(isPositive && !isComplete);
setOKEnabled(isPositive);
}
/**
*
* @param total
* @return
*/
@Override
protected PaymentInfo getDefaultPayment(double total) {
// return new PaymentInfoCash_original(total, total);
return new PaymentInfoCash(total, total);
}
}
@@ -0,0 +1,100 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import java.awt.*;
/**
*
* @author adrianromero
*/
public class JPaymentSelectReceipt extends JPaymentSelect {
/** Creates new form JPaymentSelect
* @param parent
* @param modal
* @param o */
protected JPaymentSelectReceipt(java.awt.Frame parent, boolean modal, ComponentOrientation o) {
super(parent, modal, o);
}
/** Creates new form JPaymentSelect
* @param parent
* @param o
* @param modal */
protected JPaymentSelectReceipt(java.awt.Dialog parent, boolean modal, ComponentOrientation o) {
super(parent, modal, o);
}
/**
*
* @param parent
* @return
*/
public static JPaymentSelect getDialog(Component parent) {
Window window = getWindow(parent);
if (window instanceof Frame) {
return new JPaymentSelectReceipt((Frame) window, true, parent.getComponentOrientation());
} else {
return new JPaymentSelectReceipt((Dialog) window, true, parent.getComponentOrientation());
}
}
/**
*
*/
@Override
protected void addTabs() {
addTabPayment(new JPaymentSelect.JPaymentCashCreator());
addTabPayment(new JPaymentSelect.JPaymentChequeCreator());
addTabPayment(new JPaymentSelect.JPaymentVoucherCreator());
addTabPayment(new JPaymentSelect.JPaymentMagcardCreator());
addTabPayment(new JPaymentSelect.JPaymentFreeCreator());
addTabPayment(new JPaymentSelect.JPaymentDebtCreator());
// JG Added 1 Dec 13
addTabPayment(new JPaymentSelect.JPaymentBankCreator());
addTabPayment(new JPaymentSelect.JPaymentSlipCreator());
}
/**
*
* @param isPositive
* @param isComplete
*/
@Override
protected void setStatusPanel(boolean isPositive, boolean isComplete) {
setAddEnabled(isPositive && !isComplete);
setOKEnabled(isComplete);
}
/**
*
* @param total
* @return
*/
@Override
protected PaymentInfo getDefaultPayment(double total) {
// return new PaymentInfoCash_original(total, total);
return new PaymentInfoCash(total, total);
}
}
@@ -0,0 +1,95 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import java.awt.*;
/**
*
* @author adrianromero
*/
public class JPaymentSelectRefund extends JPaymentSelect {
/** Creates new form JPaymentSelect
* @param parent
* @param modal
* @param o */
protected JPaymentSelectRefund(java.awt.Frame parent, boolean modal, ComponentOrientation o) {
super(parent, modal, o);
}
/** Creates new form JPaymentSelect
* @param parent
* @param modal
* @param o */
protected JPaymentSelectRefund(java.awt.Dialog parent, boolean modal, ComponentOrientation o) {
super(parent, modal, o);
}
/**
*
* @param parent
* @return
*/
public static JPaymentSelect getDialog(Component parent) {
Window window = getWindow(parent);
if (window instanceof Frame) {
return new JPaymentSelectRefund((Frame) window, true, parent.getComponentOrientation());
} else {
return new JPaymentSelectRefund((Dialog) window, true, parent.getComponentOrientation());
}
}
/**
*
*/
@Override
protected void addTabs() {
addTabPayment(new JPaymentSelect.JPaymentCashRefundCreator());
addTabPayment(new JPaymentSelect.JPaymentChequeRefundCreator());
addTabPayment(new JPaymentSelect.JPaymentVoucherRefundCreator());
addTabPayment(new JPaymentSelect.JPaymentMagcardRefundCreator());
// setHeaderVisible(false);
}
/**
*
* @param isPositive
* @param isComplete
*/
@Override
protected void setStatusPanel(boolean isPositive, boolean isComplete) {
setAddEnabled(isPositive && !isComplete);
setOKEnabled(isComplete);
}
/**
*
* @param total
* @return
*/
@Override
protected PaymentInfo getDefaultPayment(double total) {
return new PaymentInfoTicket(total, "cashrefund");
}
}
@@ -0,0 +1,140 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,49,0,0,2,99"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel2">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="East"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="North"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
<Property name="axis" type="int" value="1"/>
</Layout>
<SubComponents>
<Component class="com.unicenta.editor.JEditorKeys" name="m_jKeys">
</Component>
<Container class="javax.swing.JPanel" name="jPanel3">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="5" left="5" right="5" top="5"/>
</Border>
</Property>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Component class="com.unicenta.editor.JEditorCurrencyPositive" name="m_jTendered">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="12" style="0"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel4">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
<Property name="useNullLayout" type="boolean" value="true"/>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="18" style="1"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.InputCash" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="10" y="4" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="m_jMoneyEuros">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="33" green="ff" red="cc" type="rgb"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="18" style="1"/>
</Property>
<Property name="horizontalAlignment" type="int" value="4"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.CompoundBorderInfo">
<CompoundBorder>
<Border PropertyName="outside" info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder>
<Color PropertyName="color" blue="64" green="6f" id="Button.darkShadow" palette="3" red="71" type="palette"/>
</LineBorder>
</Border>
<Border PropertyName="inside" info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="1" left="4" right="4" top="1"/>
</Border>
</CompoundBorder>
</Border>
</Property>
<Property name="opaque" type="boolean" value="true"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[180, 30]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="120" y="4" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>
@@ -0,0 +1,180 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.format.Formats;
import com.unicenta.pos.customers.CustomerInfoExt;
import com.unicenta.pos.forms.AppLocal;
import com.unicenta.pos.util.RoundUtils;
import java.awt.Component;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
/**
*
* @author JG uniCenta
*/
public class JPaymentSlip extends javax.swing.JPanel implements JPaymentInterface {
private final JPaymentNotifier m_notifier;
private double m_dPaid;
private double m_dTotal;
/** Creates new form JPaymentCash
* @param notifier */
public JPaymentSlip(JPaymentNotifier notifier) {
m_notifier = notifier;
initComponents();
m_jTendered.addPropertyChangeListener("Edition", new RecalculateState());
m_jTendered.addEditorKeys(m_jKeys);
}
/**
*
* @param customerext
* @param dTotal
* @param transID
*/
@Override
public void activate(CustomerInfoExt customerext, double dTotal, String transID) {
m_dTotal = dTotal;
m_jTendered.reset();
m_jTendered.activate();
printState();
}
/**
*
* @return
*/
@Override
public PaymentInfo executePayment() {
return new PaymentInfoTicket(m_dPaid, "slip");
}
/**
*
* @return
*/
@Override
public Component getComponent() {
return this;
}
private void printState() {
Double value = m_jTendered.getDoubleValue();
if (value == null) {
m_dPaid = m_dTotal;
} else {
m_dPaid = value;
}
m_jMoneyEuros.setText(Formats.CURRENCY.formatValue(m_dPaid));
int iCompare = RoundUtils.compare(m_dPaid, m_dTotal);
m_notifier.setStatus(m_dPaid > 0.0 && iCompare <= 0, iCompare == 0);
}
private class RecalculateState implements PropertyChangeListener {
@Override
public void propertyChange(PropertyChangeEvent evt) {
printState();
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel2 = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
m_jKeys = new com.unicenta.editor.JEditorKeys();
jPanel3 = new javax.swing.JPanel();
m_jTendered = new com.unicenta.editor.JEditorCurrencyPositive();
jPanel4 = new javax.swing.JPanel();
jLabel8 = new javax.swing.JLabel();
m_jMoneyEuros = new javax.swing.JLabel();
setLayout(new java.awt.BorderLayout());
jPanel2.setLayout(new java.awt.BorderLayout());
jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.Y_AXIS));
jPanel1.add(m_jKeys);
jPanel3.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel3.setLayout(new java.awt.BorderLayout());
m_jTendered.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jPanel3.add(m_jTendered, java.awt.BorderLayout.CENTER);
jPanel1.add(jPanel3);
jPanel2.add(jPanel1, java.awt.BorderLayout.NORTH);
add(jPanel2, java.awt.BorderLayout.EAST);
jPanel4.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jPanel4.setLayout(null);
jLabel8.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
jLabel8.setText(AppLocal.getIntString("label.InputCash")); // NOI18N
jLabel8.setPreferredSize(new java.awt.Dimension(100, 30));
jPanel4.add(jLabel8);
jLabel8.setBounds(10, 4, 100, 30);
m_jMoneyEuros.setBackground(new java.awt.Color(204, 255, 51));
m_jMoneyEuros.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
m_jMoneyEuros.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
m_jMoneyEuros.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")), javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4)));
m_jMoneyEuros.setOpaque(true);
m_jMoneyEuros.setPreferredSize(new java.awt.Dimension(180, 30));
jPanel4.add(m_jMoneyEuros);
m_jMoneyEuros.setBounds(120, 4, 180, 30);
add(jPanel4, java.awt.BorderLayout.CENTER);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private com.unicenta.editor.JEditorKeys m_jKeys;
private javax.swing.JLabel m_jMoneyEuros;
private com.unicenta.editor.JEditorCurrencyPositive m_jTendered;
// End of variables declaration//GEN-END:variables
}
@@ -0,0 +1,292 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-101,0,0,2,88"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel4">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="m_jMoneyEuros" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="m_jVoucher" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="webLblCustomer" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="webLblcustomerName" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="voucherStatus" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="m_jVoucher" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
<Component id="voucherStatus" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<Component id="m_jMoneyEuros" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="webLblCustomer" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="webLblcustomerName" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="33" max="-2" attributes="0"/>
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="18" style="1"/>
</Property>
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="m_jVoucher"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.voucher" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="m_jVoucher">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[180, 30]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jVoucherActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="18" style="1"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.voucherValue" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="m_jMoneyEuros">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="33" green="ff" red="cc" type="rgb"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="18" style="1"/>
</Property>
<Property name="horizontalAlignment" type="int" value="4"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.CompoundBorderInfo">
<CompoundBorder>
<Border PropertyName="outside" info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder>
<Color PropertyName="color" blue="64" green="6f" id="Button.darkShadow" palette="3" red="71" type="palette"/>
</LineBorder>
</Border>
<Border PropertyName="inside" info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="1" left="4" right="4" top="1"/>
</Border>
</CompoundBorder>
</Border>
</Property>
<Property name="opaque" type="boolean" value="true"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[180, 30]"/>
</Property>
</Properties>
</Component>
<Component class="com.alee.laf.label.WebLabel" name="webLblCustomer">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.customer" replaceFormat="AppLocal.getIntString(&quot;label.customer&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value=""/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="18" style="1"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
</Properties>
</Component>
<Component class="com.alee.laf.label.WebLabel" name="webLblcustomerName">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.customer" replaceFormat="AppLocal.getIntString(&quot;label.customer&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value=""/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
</Properties>
</Component>
<Component class="com.alee.laf.label.WebLabel" name="voucherStatus">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.voucherStatus" replaceFormat="AppLocal.getIntString(&quot;label.voucherStatus&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value=""/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="18" style="1"/>
</Property>
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="m_jVoucher"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.voucherStatus" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="text" type="java.lang.String" value="jButton1"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel11">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="East"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel12">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="North"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
<Property name="axis" type="int" value="1"/>
</Layout>
<SubComponents>
<Component class="com.unicenta.editor.JEditorKeys" name="m_jKeys">
</Component>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="5" left="5" right="5" top="5"/>
</Border>
</Property>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Component class="com.unicenta.editor.JEditorCurrencyPositive" name="m_jTendered">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[130, 30]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>
@@ -0,0 +1,391 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta and part works Openbravo, S.L.
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.basic.BasicException;
import com.unicenta.data.gui.ComboBoxValModel;
import com.unicenta.data.loader.SentenceList;
import com.unicenta.format.Formats;
import com.unicenta.pos.customers.CustomerInfoExt;
import com.unicenta.pos.customers.DataLogicCustomers;
import com.unicenta.pos.forms.AppLocal;
import com.unicenta.pos.forms.AppView;
import com.unicenta.pos.forms.DataLogicSales;
import com.unicenta.pos.util.RoundUtils;
import com.unicenta.pos.voucher.VoucherInfo;
import lombok.extern.slf4j.Slf4j;
import java.awt.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.List;
/**
* @author JG uniCenta
*/
@Slf4j
public class JPaymentVoucher extends javax.swing.JPanel implements JPaymentInterface {
private final JPaymentNotifier m_notifier;
private DataLogicSales dlSales;
private DataLogicCustomers dlCustomers;
private ComboBoxValModel m_VoucherModel;
private SentenceList m_sentvouch;
private VoucherInfo m_voucherInfo;
private double m_dTicket;
private double m_dTotal;
private final String m_sVoucher; // "voucherin", "voucherout"
private String m_sVoucher1;
/**
* Creates new form JPaymentTicket
*
* @param app
* @param notifier
* @param sVoucher
*/
public JPaymentVoucher(AppView app, JPaymentNotifier notifier, String sVoucher) {
m_notifier = notifier;
m_sVoucher = sVoucher;
m_dTotal = 0.0;
init(app);
m_jTendered.addPropertyChangeListener("Edition", new RecalculateState());
}
private void init(AppView app) {
dlSales = (DataLogicSales) app.getBean("com.unicenta.pos.forms.DataLogicSales");
dlCustomers = (DataLogicCustomers) app.getBean("com.unicenta.pos.customers.DataLogicCustomers");
initComponents();
webLblcustomerName.setText(null);
}
/**
* @param customerext
* @param dTotal
* @param transID
*/
@Override
public void activate(CustomerInfoExt customerext, double dTotal, String transID) {
m_dTotal = dTotal;
m_jTendered.reset();
m_jKeys.setEnabled(false);
m_jTendered.setEnabled(false);
m_VoucherModel = new ComboBoxValModel();
m_sentvouch = dlSales.getVoucherList();
List a = null;
try {
a = m_sentvouch.list();
} catch (BasicException ex) {
log.error(ex.getMessage());
}
m_VoucherModel = new ComboBoxValModel(a);
m_jVoucher.setModel(m_VoucherModel);
printState();
}
/**
* @return
*/
@Override
public Component getComponent() {
return this;
}
/**
* @return
*/
@Override
public PaymentInfo executePayment() {
try {
String id = m_VoucherModel.getSelectedKey().toString();
VoucherInfo m_voucherInfo1 = dlCustomers.getVoucherInfo(id);
m_sVoucher1 = m_voucherInfo1.getVoucherNumber();
} catch (BasicException ex) {
log.error(ex.getMessage());
}
return new PaymentInfoTicket(m_dTicket, m_sVoucher, m_sVoucher1);
}
public void confirmVoucher() {
List a = null;
try {
a = m_sentvouch.list();
// a.forEach(System.out::println);
a.remove(m_jVoucher.getSelectedIndex());
} catch (BasicException ex) {
log.error(ex.getMessage());
}
m_VoucherModel = new ComboBoxValModel(a);
m_jVoucher.setModel(m_VoucherModel);
}
private void printState() {
Double value = m_jTendered.getDoubleValue();
if (value == null) {
m_dTicket = 0.0;
} else {
m_dTicket = value;
}
m_jMoneyEuros.setText(Formats.CURRENCY.formatValue(m_dTicket));
int iCompare = RoundUtils.compare(m_dTicket, m_dTotal);
m_notifier.setStatus(m_dTicket > 0.0, iCompare >= 0);
}
private class RecalculateState implements PropertyChangeListener {
@Override
public void propertyChange(PropertyChangeEvent evt) {
printState();
}
}
/**
* This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel4 = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
m_jVoucher = new javax.swing.JComboBox();
jLabel1 = new javax.swing.JLabel();
m_jMoneyEuros = new javax.swing.JLabel();
webLblCustomer = new com.alee.laf.label.WebLabel();
webLblcustomerName = new com.alee.laf.label.WebLabel();
voucherStatus = new com.alee.laf.label.WebLabel();
jLabel6 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jPanel11 = new javax.swing.JPanel();
jPanel12 = new javax.swing.JPanel();
m_jKeys = new com.unicenta.editor.JEditorKeys();
jPanel1 = new javax.swing.JPanel();
m_jTendered = new com.unicenta.editor.JEditorCurrencyPositive();
setLayout(new java.awt.BorderLayout());
jLabel5.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
jLabel5.setLabelFor(m_jVoucher);
jLabel5.setText(AppLocal.getIntString("label.voucher")); // NOI18N
jLabel5.setPreferredSize(new java.awt.Dimension(100, 30));
m_jVoucher.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
m_jVoucher.setPreferredSize(new java.awt.Dimension(180, 30));
m_jVoucher.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
m_jVoucherActionPerformed(evt);
}
});
jLabel1.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
jLabel1.setText(AppLocal.getIntString("label.voucherValue")); // NOI18N
jLabel1.setPreferredSize(new java.awt.Dimension(100, 30));
m_jMoneyEuros.setBackground(new java.awt.Color(204, 255, 51));
m_jMoneyEuros.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
m_jMoneyEuros.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
m_jMoneyEuros.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")), javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4)));
m_jMoneyEuros.setOpaque(true);
m_jMoneyEuros.setPreferredSize(new java.awt.Dimension(180, 30));
webLblCustomer.setText(AppLocal.getIntString("label.customer")); // NOI18N
webLblCustomer.setToolTipText("");
webLblCustomer.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
webLblCustomer.setPreferredSize(new java.awt.Dimension(100, 30));
webLblcustomerName.setText(AppLocal.getIntString("label.customer")); // NOI18N
webLblcustomerName.setToolTipText("");
webLblcustomerName.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
webLblcustomerName.setPreferredSize(new java.awt.Dimension(100, 30));
voucherStatus.setText(AppLocal.getIntString("label.voucherStatus")); // NOI18N
voucherStatus.setToolTipText("");
voucherStatus.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
voucherStatus.setPreferredSize(new java.awt.Dimension(100, 30));
jLabel6.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
jLabel6.setLabelFor(m_jVoucher);
jLabel6.setText(AppLocal.getIntString("label.voucherStatus")); // NOI18N
jLabel6.setPreferredSize(new java.awt.Dimension(100, 30));
jButton1.setText("jButton1");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(m_jMoneyEuros, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(m_jVoucher, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jButton1)))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(webLblCustomer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(webLblcustomerName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(voucherStatus, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(m_jVoucher, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(voucherStatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(m_jMoneyEuros, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(webLblCustomer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(webLblcustomerName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(33, 33, 33)
.addComponent(jButton1)
.addContainerGap())
);
add(jPanel4, java.awt.BorderLayout.CENTER);
jPanel11.setLayout(new java.awt.BorderLayout());
jPanel12.setLayout(new javax.swing.BoxLayout(jPanel12, javax.swing.BoxLayout.Y_AXIS));
jPanel12.add(m_jKeys);
jPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel1.setLayout(new java.awt.BorderLayout());
m_jTendered.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
m_jTendered.setPreferredSize(new java.awt.Dimension(130, 30));
jPanel1.add(m_jTendered, java.awt.BorderLayout.CENTER);
jPanel12.add(jPanel1);
jPanel11.add(jPanel12, java.awt.BorderLayout.NORTH);
add(jPanel11, java.awt.BorderLayout.EAST);
}// </editor-fold>//GEN-END:initComponents
private void m_jVoucherActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jVoucherActionPerformed
m_jMoneyEuros.setText(null);
if (m_VoucherModel.getSelectedKey() != null) {
try {
String id = m_VoucherModel.getSelectedKey().toString();
VoucherInfo m_voucherInfo = dlCustomers.getVoucherInfo(id);
if (m_voucherInfo != null) {
m_jTendered.setDoubleValue(m_voucherInfo.getAmount());
m_jMoneyEuros.setText(Formats.CURRENCY.formatValue(m_voucherInfo.getAmount()));
webLblcustomerName.setText(m_voucherInfo.getCustomerName());
if ("A".equals(m_voucherInfo.getStatus())) {
voucherStatus.setText("Available");
} else if ("D".equals(m_voucherInfo.getStatus())) {
voucherStatus.setText("Redeemed");
}
printState();
} else {
voucherStatus.setText("Error");
webLblcustomerName.setText("");
}
} catch (BasicException ex) {
log.error(ex.getMessage());
}
}
}//GEN-LAST:event_m_jVoucherActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
}//GEN-LAST:event_jButton1ActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel11;
private javax.swing.JPanel jPanel12;
private javax.swing.JPanel jPanel4;
private com.unicenta.editor.JEditorKeys m_jKeys;
private javax.swing.JLabel m_jMoneyEuros;
private com.unicenta.editor.JEditorCurrencyPositive m_jTendered;
private javax.swing.JComboBox m_jVoucher;
private com.alee.laf.label.WebLabel voucherStatus;
private com.alee.laf.label.WebLabel webLblCustomer;
private com.alee.laf.label.WebLabel webLblcustomerName;
// End of variables declaration//GEN-END:variables
}
@@ -0,0 +1,40 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
public interface MagCardReader {
public String getReaderName();
public void reset();
public void appendChar(char c);
public boolean isComplete();
public String getHolderName();
public String getCardNumber();
public String getExpirationDate();
public String getTrack1();
public String getTrack2();
public String getTrack3();
public String getEncryptedCardData();
public String getEncryptionKey();
}
@@ -0,0 +1,43 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
/**
*
* @author adrianromero
*/
public class MagCardReaderFac {
/** Creates a new instance of MagCarReaderFac */
private MagCardReaderFac() {
}
public static MagCardReader getMagCardReader(String sReader) {
// JG 16 May 12 use switch
switch (sReader) {
case "Intelligent":
return new MagCardReaderIntelligent();
case "Generic":
return new MagCardReaderGeneric();
default:
return null;
}
}
}
@@ -0,0 +1,242 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.pos.util.LuhnAlgorithm;
import com.unicenta.pos.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
public class MagCardReaderGeneric implements MagCardReader {
private String m_sHolderName;
private String m_sCardNumber;
private String m_sExpirationDate;
private StringBuffer track1;
private StringBuffer track2;
private StringBuffer track3;
private static final int READING_STARTSENTINEL1 = 0;
private static final int READING_STARTSENTINEL2 = 1;
private static final int READING_STARTSENTINEL3 = 2;
private static final int READING_CARDTYPE = 3;
private static final int READING_TRACK1 = 4;
private static final int READING_TRACK2 = 5;
private static final int READING_TRACK3 = 6;
private static final int READING_END = 7;
private int m_iAutomState;
private List m_aTrack1;
private List m_aTrack2;
private List m_aTrack3;
private StringBuffer m_sField;
private char m_cCardType;
private String m_encryptedCardData;
private String m_encryptionKey;
/**
* Creates a new instance of GenericMagCardReader
*/
public MagCardReaderGeneric() {
reset();
}
public String getReaderName() {
return "Generic magnetic card reader";
}
public void reset() {
m_aTrack1 = null;
m_aTrack2 = null;
m_aTrack3 = null;
m_sField = null;
m_cCardType = ' ';
m_sHolderName = null;
m_sCardNumber = null;
m_sExpirationDate = null;
m_encryptedCardData = null;
m_encryptionKey = null;
m_iAutomState = READING_STARTSENTINEL1;
}
public void appendChar(char c) {
// Mastercard
// %B1111222233334444^PUBLIC/JOHN?;1111222233334444=99121010000000000000?
// *---------------- ----------- ----***
// Visa
// %B1111222233334444^PUBLIC/JOHN^9912101xxxxxxxxxxxxx?;1111222233334444=9912101xxxxxxxxxxxxx?
// *---------------- ----------- ---- ***
if (c == '%') { // && READING_STARTSENTINEL1;
track1 = new StringBuffer();
track2 = new StringBuffer();
track3 = new StringBuffer();
m_aTrack1 = new ArrayList();
m_aTrack2 = null;
m_aTrack3 = null;
m_sField = new StringBuffer();
m_cCardType = ' ';
m_sHolderName = null;
m_sCardNumber = null;
m_sExpirationDate = null;
m_iAutomState = READING_CARDTYPE;
} else if (m_iAutomState == READING_CARDTYPE) {
m_cCardType = c;
m_iAutomState = READING_TRACK1;
} else if (c == ';' && m_iAutomState == READING_STARTSENTINEL2) {
m_aTrack2 = new ArrayList();
m_sField = new StringBuffer();
m_iAutomState = READING_TRACK2;
} else if (c == ';' && m_iAutomState == READING_STARTSENTINEL3) {
m_aTrack3 = new ArrayList();
m_sField = new StringBuffer();
m_iAutomState = READING_TRACK3;
} else if (c == '^' && m_iAutomState == READING_TRACK1) {
m_aTrack1.add(m_sField.toString());
m_sField = new StringBuffer();
} else if (c == '=' && m_iAutomState == READING_TRACK2) {
m_aTrack2.add(m_sField.toString());
m_sField = new StringBuffer();
} else if (c == '=' && m_iAutomState == READING_TRACK3) {
m_aTrack3.add(m_sField.toString());
m_sField = new StringBuffer();
} else if (c == '?' && m_iAutomState == READING_TRACK1) {
m_aTrack1.add(m_sField.toString());
m_sField = null;
m_iAutomState = READING_STARTSENTINEL2;
} else if (c == '?' && m_iAutomState == READING_TRACK2) {
m_aTrack2.add(m_sField.toString());
m_sField = null;
m_iAutomState = READING_STARTSENTINEL3;
checkTracks(); // aqui ya chequeamos los paramentros que leemos...
} else if (c == '?' && m_iAutomState == READING_TRACK3) {
m_aTrack3.add(m_sField.toString());
m_sField = null;
m_iAutomState = READING_END;
} else if (m_iAutomState == READING_TRACK1 || m_iAutomState == READING_TRACK2 || m_iAutomState == READING_TRACK3) {
m_sField.append(c);
}
if (m_iAutomState == READING_CARDTYPE || m_iAutomState == READING_TRACK1 || m_iAutomState == READING_STARTSENTINEL2) {
track1.append(c);
} else if (m_iAutomState == READING_TRACK2 || m_iAutomState == READING_STARTSENTINEL3) {
track2.append(c);
} else if (m_iAutomState == READING_TRACK3 || m_iAutomState == READING_END) {
track3.append(c);
}
}
private void checkTracks() {
// Test del tipo de tarjeta
if (m_cCardType != 'B') {
return;
}
// Lectura de los valores
String sCardNumber1 = (m_aTrack1 == null || m_aTrack1.size() < 1) ? null : (String) m_aTrack1.get(0);
String sCardNumber2 = (m_aTrack2 == null || m_aTrack2.size() < 1) ? null : (String) m_aTrack2.get(0);
String sHolderName = (m_aTrack1 == null || m_aTrack1.size() < 2) ? null : (String) m_aTrack1.get(1);
String sExpDate1 = (m_aTrack1 == null || m_aTrack1.size() < 3) ? null : ((String) m_aTrack1.get(2)).substring(0, 4);
String sExpDate2 = (m_aTrack2 == null || m_aTrack2.size() < 2) ? null : ((String) m_aTrack2.get(1)).substring(0, 4);
// Test del numero de tarjeta
if (!checkCardNumber(sCardNumber1) || (sCardNumber2 != null && !sCardNumber1.equals(sCardNumber2))) {
return;
}
// Test del nombre del propietario
if (sHolderName == null) {
return;
}
// Test de la fecha de expiracion
if ((sExpDate1 != null || !checkExpDate(sExpDate2)) && (!checkExpDate(sExpDate1) || !sExpDate1.equals(sExpDate2))) {
return;
}
m_sCardNumber = sCardNumber1;
m_sHolderName = formatHolderName(sHolderName);
String yymm = sExpDate1 == null ? sExpDate2 : sExpDate1;
m_sExpirationDate = yymm.substring(2, 4) + yymm.substring(0, 2); //MMYY format
}
private boolean checkCardNumber(String sNumber) {
return LuhnAlgorithm.checkCC(sNumber);
}
private boolean checkExpDate(String sDate) {
return ( sDate.length()==4 && StringUtils.isNumber(sDate.trim()) );
}
private String formatHolderName(String sName) {
int iPos = sName.indexOf('/');
if (iPos >= 0) {
return sName.substring(iPos + 1).trim() + ' ' + sName.substring(0, iPos);
} else {
return sName.trim();
}
}
public boolean isComplete() {
return m_sCardNumber != null;
}
public String getHolderName() {
return m_sHolderName;
}
public String getCardNumber() {
return m_sCardNumber;
}
public String getExpirationDate() {
return m_sExpirationDate;
}
public String getTrack1() {
return track1 == null ? null : track1.toString();
}
public String getTrack2() {
return track2 == null ? null : track2.toString();
}
public String getTrack3() {
return track3 == null ? null : track3.toString();
}
public String getEncryptedCardData() {
return "".equals(m_encryptedCardData) ? null : m_encryptedCardData;
}
public String getEncryptionKey() {
return "".equals(m_encryptionKey) ? null : m_encryptionKey;
}
}
@@ -0,0 +1,137 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
public final class MagCardReaderIntelligent implements MagCardReader {
private String m_sHolderName;
private String m_sCardNumber;
private String m_sExpirationDate;
private StringBuffer m_sField;
private static final int READING_HOLDER = 0;
private static final int READING_NUMBER = 1;
private static final int READING_DATE = 2;
private static final int READING_FINISHED = 3;
private int m_iAutomState;
/** Creates a new instance of BasicMagCardReader */
public MagCardReaderIntelligent() {
reset();
}
public String getReaderName() {
return "Basic magnetic card reader";
}
public void reset() {
m_sHolderName = null;
m_sCardNumber = null;
m_sExpirationDate = null;
m_sField = new StringBuffer();
m_iAutomState = READING_HOLDER;
}
public void appendChar(char c) {
switch (m_iAutomState) {
case READING_HOLDER:
case READING_FINISHED:
if (c == 0x0009) {
m_sHolderName = m_sField.toString();
m_sField = new StringBuffer();
m_iAutomState = READING_NUMBER;
} else if (c == 0x000A) {
m_sHolderName = null;
m_sCardNumber = null;
m_sExpirationDate = null;
m_sField = new StringBuffer();
m_iAutomState = READING_HOLDER;
} else {
m_sField.append(c);
m_iAutomState = READING_HOLDER;
}
break;
case READING_NUMBER:
if (c == 0x0009) {
m_sCardNumber = m_sField.toString();
m_sField = new StringBuffer();
m_iAutomState = READING_DATE;
} else if (c == 0x000A) {
m_sHolderName = null;
m_sCardNumber = null;
m_sExpirationDate = null;
m_sField = new StringBuffer();
m_iAutomState = READING_HOLDER;
} else {
m_sField.append(c);
}
break;
case READING_DATE:
if (c == 0x0009) {
m_sHolderName = m_sCardNumber;
m_sCardNumber = m_sExpirationDate;
m_sExpirationDate = null;
m_sField = new StringBuffer();
} else if (c == 0x000A) {
m_sExpirationDate = m_sField.toString();
m_sField = new StringBuffer();
m_iAutomState = READING_FINISHED;
} else {
m_sField.append(c);
}
break;
}
}
public boolean isComplete() {
return m_iAutomState == READING_FINISHED;
}
public String getHolderName() {
return m_sHolderName;
}
public String getCardNumber() {
return m_sCardNumber;
}
public String getExpirationDate() {
return m_sExpirationDate;
}
public String getTrack1() {
return null;
}
public String getTrack2() {
return null;
}
public String getTrack3() {
return null;
}
@Override
public String getEncryptedCardData() {
return null;
}
@Override
public String getEncryptionKey() {
return null;
}
}
@@ -0,0 +1,49 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.pos.forms.AppConfig;
import javax.swing.JPanel;
/**
*
* @author Mikel Irurita
*/
public interface PaymentConfiguration {
/**
*
* @return
*/
public JPanel getComponent();
/**
*
* @param config
*/
public void loadProperties(AppConfig config);
/**
*
* @param config
*/
public void saveProperties(AppConfig config);
}
@@ -0,0 +1,42 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
/**
*
* @author JG uniCenta
*/
public class PaymentException extends java.lang.Exception {
/**
* Creates a new instance of <code>PaymentException</code> without detail message.
*/
public PaymentException() {
}
/**
* Constructs an instance of <code>PaymentException</code> with the specified detail message.
* @param msg the detail message.
*/
public PaymentException(String msg) {
super(msg);
}
}
@@ -0,0 +1,33 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
/**
*
* @author JG uniCenta
*/
public interface PaymentGateway {
/**
*
* @param payinfo
*/
public void execute(PaymentInfoMagcard payinfo);
}
@@ -0,0 +1,40 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta & previous Openbravo POS works
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
/**
*
* @author JG uniCenta
*/
public class PaymentGatewayExt implements PaymentGateway {
/** Creates a new instance of PaymentGatewayExt */
public PaymentGatewayExt() {
}
/**
*
* @param payinfo
*/
@Override
public void execute(PaymentInfoMagcard payinfo) {
payinfo.paymentOK("OK", payinfo.getTransactionID() , "");
}
}
@@ -0,0 +1,46 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.pos.forms.AppProperties;
/**
* Creates a new instance of PaymentGatewayFac
*/
public class PaymentGatewayFac {
/** Creates a new instance of PaymentGatewayFac */
private PaymentGatewayFac() {
}
public static PaymentGateway getPaymentGateway(AppProperties props) {
String sReader = props.getProperty("payment.gateway");
switch (sReader) {
case "external":
return new PaymentGatewayExt();
case "PaymentSense":
return new PaymentGatewayPaymentSense();
default:
return null;
}
}
}
@@ -0,0 +1,86 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta & previous Openbravo POS works
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.plugins.Application;
import com.unicenta.plugins.common.AppContext;
import com.unicenta.pos.util.RoundUtils;
import lombok.extern.slf4j.Slf4j;
import javax.swing.*;
import java.awt.*;
@Slf4j
public class PaymentGatewayPaymentSense implements PaymentGateway {
/** Creates a new instance of PaymentGatewayExt */
public PaymentGatewayPaymentSense() {
}
Window getPaymentWindow() {
for (Window window : Window.getWindows()) {
if (window.isActive()) {
return window;
}
}
return null;
}
/**
*
* @param payinfo
*/
@Override
public void execute(PaymentInfoMagcard payinfo) {
int timer = 0;
int timeout = 180;
new Application().paymentSenseTransaction(RoundUtils.round(payinfo.getTotal()), getPaymentWindow());
while (AppContext.getIsProcessing() == null || AppContext.getIsProcessing()) {
try {
log.info("uniCenta-oPos: waiting for payment to complete ....");
Thread.sleep(1000);
timer += 1;
if (timer > timeout) break;
} catch (InterruptedException e) {
log.error(e.getMessage());
}
}
if (AppContext.getPaymentResult() == null) {
payinfo.paymentError("Transaction Error! Please try again", "No Response");
}
if (AppContext.getPaymentResult().getTransactionResult().equals("SUCCESSFUL")){
payinfo.setCardName(AppContext.getPaymentResult().getCardSchemeName());
payinfo.setVerification(AppContext.getPaymentResult().getPaymentMethod());
payinfo.setChipAndPin(true);
payinfo.paymentOK(
AppContext.getPaymentResult().getAuthCode(),
AppContext.getPaymentResult().getTransactionId(),
AppContext.getPaymentResult().getTransactionResult()
);
}
else {
payinfo.paymentError("Transaction Error! Please try again", AppContext.getPaymentResult().getTransactionResult());
}
}
}
@@ -0,0 +1,39 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta & previous Openbravo POS works
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.format.Formats;
public abstract class PaymentInfo {
public abstract String getName();
public abstract double getTotal();
public abstract PaymentInfo copyPayment();
public abstract String getTransactionID();
public abstract double getPaid();
public abstract double getChange();
public abstract double getTendered();
public abstract String getCardName();
public abstract String getVoucher();
public String printTotal() {
return Formats.CURRENCY.formatValue(getTotal());
}
}
@@ -0,0 +1,133 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.format.Formats;
public class PaymentInfoCash extends PaymentInfo {
private double prePayAmount = 0.0;
private double m_dPaid;
private double m_dTotal;
private double m_dTendered;
private String m_dCardName =null;
// private double m_dTip;
/**
* Creates a new instance of PaymentInfoCash
* @param dTotal
* @param dPaid
* @param dTendered
*/
public PaymentInfoCash(double dTotal, double dPaid, double dTendered) {
m_dTotal = dTotal;
m_dPaid = dPaid;
m_dTendered = dTendered;
}
/**
* Creates a new instance of PaymentInfoCash
* @param dTotal
* @param dPaid
* @param dTendered
* @param prePayAmount
*/
public PaymentInfoCash(double dTotal, double dPaid, double dTendered, double prePayAmount) {
this(dTotal, dTendered, dPaid);
this.prePayAmount = prePayAmount;
}
/** Creates a new instance of PaymentInfoCash
* @param dTotal
* @param dPaid */
public PaymentInfoCash(double dTotal, double dPaid) {
m_dTotal = dTotal;
m_dPaid = dPaid;
}
@Override
public PaymentInfo copyPayment() {
return new PaymentInfoCash(m_dTotal, m_dPaid, m_dTendered, prePayAmount);
// return new PaymentInfoCash(m_dTotal, m_dPaid, prePayAmount);
}
@Override
public String getTransactionID() {
return "no ID";
}
@Override
public String getName() {
return "cash";
}
@Override
public double getTotal() {
return m_dTotal;
}
// public double getTip() {
// return m_dTip;
// }
@Override
public double getPaid() {
return m_dPaid;
}
@Override
public double getTendered() {
return m_dTendered;
}
@Override
public double getChange(){
return m_dPaid - m_dTotal;
}
@Override
public String getCardName() {
return m_dCardName;
}
public boolean hasPrePay() {
if (prePayAmount > 0) {
return true;
}
return false;
}
public double getPrePaid() {
return prePayAmount;
}
public String printTendered() {
return Formats.CURRENCY.formatValue(m_dTendered);
}
public String printPaid() {
return Formats.CURRENCY.formatValue(m_dPaid);
}
public String printChange() {
return Formats.CURRENCY.formatValue(m_dPaid - m_dTotal);
}
@Override
public String getVoucher() {
return null;
}
}
@@ -0,0 +1,98 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta & previous Openbravo POS works
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.format.Formats;
/**
*
* @author JG uniCenta
*/
public class PaymentInfoCash_original extends PaymentInfo {
private final double m_dPaid;
private final double m_dTotal;
private double m_dTendered;
private final String m_dCardName =null;
// private double m_dTip;
/** Creates a new instance of PaymentInfoCash
* @param dTotal
* @param dPaid */
public PaymentInfoCash_original(double dTotal, double dPaid) {
m_dTotal = dTotal;
m_dPaid = dPaid;
}
@Override
public PaymentInfo copyPayment(){
return new PaymentInfoCash_original(m_dTotal, m_dPaid);
}
@Override
public String getTransactionID(){
return "no ID";
}
@Override
public String getName() {
return "cash";
}
@Override
public double getTotal() {
return m_dTotal;
}
/** public double getTip() {
return m_dTip;
}
* @return
*/
@Override
public double getPaid() {
return m_dPaid;
}
@Override
public double getTendered() {
return m_dTendered;
}
@Override
public double getChange(){
return m_dPaid - m_dTotal;
}
@Override
public String getCardName() {
return m_dCardName;
}
public String printPaid() {
return Formats.CURRENCY.formatValue(m_dPaid);
}
public String printChange() {
return Formats.CURRENCY.formatValue(m_dPaid - m_dTotal);
}
@Override
public String getVoucher() {
return null;
}
}
@@ -0,0 +1,86 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
public class PaymentInfoFree extends PaymentInfo {
private double m_dTotal;
private double m_dTendered;
private String m_dCardName =null;
// private double m_dTip;
/** Creates a new instance of PaymentInfoFree
* @param dTotal */
public PaymentInfoFree(double dTotal) {
m_dTotal = dTotal;
}
public PaymentInfo copyPayment(){
return new PaymentInfoFree(m_dTotal);
}
public String getTransactionID(){
return "no ID";
}
public String getName() {
return "free";
}
public double getTotal() {
return m_dTotal;
}
public double getPaid() {
return (0.0);
}
/**
*
public double getTip() {
return m_dTip;
}
*/
public double getChange(){
return (0.00);
}
public double getTendered() {
return m_dTendered;
}
public String getCardName() {
return m_dCardName;
}
/**
public boolean getIsProcessed() {
throw new UnsupportedOperationException("Not supported yet.");
}
public void setIsProcessed(boolean value) {
throw new UnsupportedOperationException("Not supported yet.");
}
public String getReturnMessage() {
throw new UnsupportedOperationException("Not supported yet.");
}
*/
public String getVoucher() {
return null;
}
}
@@ -0,0 +1,62 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import java.util.Iterator;
import java.util.LinkedList;
public class PaymentInfoList {
private LinkedList<PaymentInfo> m_apayment;
/** Creates a new instance of PaymentInfoComposed */
public PaymentInfoList() {
// JG 16 May 12 use diamond inference
m_apayment = new LinkedList<>();
}
public double getTotal() {
double dTotal = 0.0;
Iterator i = m_apayment.iterator();
while (i.hasNext()) {
PaymentInfo p = (PaymentInfo) i.next();
dTotal += p.getTotal();
}
return dTotal;
}
public boolean isEmpty() {
return m_apayment.isEmpty();
}
public void add(PaymentInfo p) {
m_apayment.addLast(p);
}
public void removeLast() {
m_apayment.removeLast();
}
public LinkedList<PaymentInfo> getPayments() {
return m_apayment;
}
}
@@ -0,0 +1,310 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta & previous Openbravo POS works
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
public class PaymentInfoMagcard extends PaymentInfo {
protected double m_dTotal;
protected double m_dTip;
protected String m_sHolderName;
protected String m_sCardNumber;
protected String m_sExpirationDate;
protected String track1;
protected String track2;
protected String track3;
protected String m_sTransactionID;
protected String m_sAuthorization;
protected String m_sErrorMessage;
protected String m_sReturnMessage;
//JG Jan 2018
protected String encryptedTrack;
protected String encryptionKey;
protected String m_dCardName =null;
protected Boolean chipAndPin = Boolean.FALSE;
protected String verification;
protected String lastFourDigits;
/**
* Creates a new instance of PaymentInfoMagcard
* @param sHolderName
* @param sCardNumber
* @param sExpirationDate
* @param track1
* @param track2
* @param track3
* @param encryptedCard
* @param encryptKey
* @param sTransactionID
* @param dTotal
*/
public PaymentInfoMagcard(String sHolderName, String sCardNumber,
String sExpirationDate, String track1, String track2, String track3, String encryptedCard, String encryptKey,
String sTransactionID, double dTotal) {
m_sHolderName = sHolderName;
m_sCardNumber = sCardNumber;
m_sExpirationDate = sExpirationDate;
this.track1 = track1;
this.track2 = track2;
this.track3 = track3;
encryptedTrack = encryptedCard;
encryptionKey = encryptKey;
m_sTransactionID = sTransactionID;
m_dTotal = dTotal;
m_sAuthorization = null;
m_sErrorMessage = null;
m_sReturnMessage = null;
}
/**
* Creates a new instance of PaymentInfoMagcard
* @param sHolderName
* @param sCardNumber
* @param sExpirationDate
* @param sTransactionID
* @param dTotal
*/
public PaymentInfoMagcard(String sHolderName, String sCardNumber,
String sExpirationDate, String sTransactionID, double dTotal) {
this(sHolderName, sCardNumber, sExpirationDate,
null, null, null, null, null, sTransactionID, dTotal);
}
@Override
public PaymentInfo copyPayment() {
PaymentInfoMagcard p = new PaymentInfoMagcard(m_sHolderName,
m_sCardNumber, m_sExpirationDate, track1, track2,
track3, encryptedTrack, encryptionKey, m_sTransactionID, m_dTotal);
p.m_sAuthorization = m_sAuthorization;
p.m_sErrorMessage = m_sErrorMessage;
return p;
}
public String getName() {
// return "magcard";
return "ccard";
}
@Override
public double getTotal() {
return m_dTotal;
}
public double getTip() {
return m_dTip;
}
public boolean isPaymentOK() {
return m_sAuthorization != null;
}
public String getHolderName() {
return m_sHolderName;
}
@Override
public String getCardName() {
if (chipAndPin){
return m_dCardName;
}
return getCardType(m_sCardNumber);
}
public String getCardNumber() {
return m_sCardNumber;
}
public String getExpirationDate() {
return m_sExpirationDate;
}
@Override
public String getTransactionID() {
return m_sTransactionID;
}
/**
* Get tracks of magnetic card. Framing characters: - start sentinel (SS) -
* end sentinel (ES) - LRC
*
* @return tracks of the magnetic card
*/
public String getEncryptedCardData() {
return encryptedTrack;
}
public String getEncryptionKey() {
return encryptionKey;
}
/** @param sCardNumber
* @return
*/
public String getCardType(String sCardNumber){
String c = "UNKNOWN";
if (sCardNumber.startsWith("4")) {
c = "VISA";
} else if (sCardNumber.startsWith("6")) {
c = "DISC";
} else if (sCardNumber.startsWith("5")) {
c = "MAST";
} else if (sCardNumber.startsWith("34") || sCardNumber.startsWith("37")) {
c = "AMEX";
} else if (sCardNumber.startsWith("3528") || sCardNumber.startsWith("3589")) {
c = "JCB";
} else if (sCardNumber.startsWith("3")) {
c = "DINE";
}
m_sCardNumber = c;
return c;
}
public String getTrack1(boolean framingChar) {
return (framingChar)
? track1
: track1.substring(1, track1.length() - 2);
}
public String getTrack2(boolean framingChar) {
return (framingChar)
? track2
: track2.substring(1, track2.length() - 2);
}
public String getTrack3(boolean framingChar) {
return (framingChar)
? track3
: track3.substring(1, track3.length() - 2);
}
public String getAuthorization() {
return m_sAuthorization;
}
public String getMessage() {
return m_sErrorMessage;
}
public void paymentError(String sMessage, String moreInfo) {
m_sAuthorization = null;
m_sErrorMessage = sMessage + "\n" + moreInfo;
}
public void setReturnMessage(String returnMessage) {
m_sReturnMessage = returnMessage;
}
public String getReturnMessage() {
return m_sReturnMessage;
}
public void paymentOK(String sAuthorization, String sTransactionId, String sReturnMessage) {
m_sAuthorization = sAuthorization;
m_sTransactionID = sTransactionId;
m_sReturnMessage = sReturnMessage;
m_sErrorMessage = null;
}
public String printCardNumber() {
System.out.println(m_sCardNumber);
if (m_sCardNumber.length() > 4) {
return m_sCardNumber.substring(0, m_sCardNumber.length() - 4).replaceAll("\\.", "*")
+ m_sCardNumber.substring(m_sCardNumber.length() - 4);
} else {
return "****";
}
}
public String printExpirationDate() {
return m_sExpirationDate;
}
public String printAuthorization() {
return m_sAuthorization;
}
public String printTransactionID() {
return m_sTransactionID;
}
public boolean getIsProcessed() {
throw new UnsupportedOperationException("Not supported yet.");
}
public void setIsProcessed(boolean value) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public double getPaid() {
return (0.0);
}
@Override
public double getChange(){
return 0.00;
}
@Override
public double getTendered() {
return 0.00;
}
@Override
public String getVoucher() {
return null;
}
public void setCardName(String m_dCardName){
this.m_dCardName = m_dCardName;
}
public Boolean isChipAndPin() {
return chipAndPin;
}
public void setChipAndPin(Boolean chipAndPin) {
this.chipAndPin = chipAndPin;
}
public String printVerification() {
return verification;
}
public void setVerification(String verification) {
this.verification = verification;
}
public String getLastFourDigits() {
return lastFourDigits;
}
public String printLastFourDigits() {
return lastFourDigits;
}
public void setLastFourDigits(String lastFourDigits) {
this.lastFourDigits = lastFourDigits;
}
}
@@ -0,0 +1,53 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta & previous Openbravo POS works
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
public class PaymentInfoMagcardRefund extends PaymentInfoMagcard {
/**
* Creates a new instance of PaymentInfoMagcardRefund
*/
public PaymentInfoMagcardRefund(String sHolderName, String sCardNumber, String sExpirationDate, String track1, String track2,
String track3, String encryptCard, String encryptKey, String sTransactionID, double dTotal) {
super(sHolderName, sCardNumber, sExpirationDate, track1, track2, track3, encryptCard, encryptKey, sTransactionID, dTotal);
}
/**
* Creates a new instance of PaymentInfoMagcard
*/
public PaymentInfoMagcardRefund(String sHolderName, String sCardNumber, String sExpirationDate, String sTransactionID, String encryptedCard, String encryptionKey, double dTotal) {
super(sHolderName, sCardNumber, sExpirationDate, sTransactionID, dTotal);
}
@Override
public PaymentInfo copyPayment() {
PaymentInfoMagcard p = new PaymentInfoMagcardRefund(m_sHolderName, m_sCardNumber, m_sExpirationDate,
track1, track2, track3, encryptedTrack, encryptionKey, m_sTransactionID, m_dTotal);
p.m_sAuthorization = m_sAuthorization;
p.m_sErrorMessage = m_sErrorMessage;
return p;
}
@Override
public String getName() {
// return "magcardrefund";
return "ccardrefund";
}
}
@@ -0,0 +1,154 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.basic.BasicException;
import com.unicenta.data.loader.DataRead;
import com.unicenta.data.loader.SerializableRead;
import com.unicenta.format.Formats;
public class PaymentInfoTicket extends PaymentInfo implements SerializableRead {
private static final long serialVersionUID = 8865238639097L;
private double m_dTicket;
private String m_sName;
private String m_transactionID;
private double m_dTendered;
private double m_change;
private String m_dCardName =null;
private double m_dTip;
private boolean m_isProcessed;
private String m_returnMessage;
private String m_sVoucher;
private String sVoucher;
private String m_sVoucherNumber;
/** Creates a new instance of PaymentInfoTicket
* @param dTicket
* @param sName */
// call by Cheque, Bank , Slip
public PaymentInfoTicket(double dTicket, String sName) {
m_sName = sName;
m_dTicket = dTicket;
}
public PaymentInfoTicket(double dTicket, String sName, String transactionID, String sVoucher) {
m_sName = sName;
m_dTicket = dTicket;
m_transactionID = transactionID;
m_sVoucher = sVoucher;
}
// call by Voucher
public PaymentInfoTicket(double dTicket, String sName, String sVoucher) {
m_sName = sName;
m_dTicket = dTicket;
m_sVoucher = sVoucher;
m_sVoucherNumber = sVoucher;
}
public PaymentInfoTicket() {
m_sName = null;
m_dTicket = 0.0;
m_transactionID = null;
m_dTendered = 0.00;
}
@Override
public void readValues(DataRead dr) throws BasicException {
m_sName = dr.getString(1);
m_dTicket = dr.getDouble(2);
m_transactionID = dr.getString(3);
if (dr.getDouble(4) != null) {
m_dTendered = dr.getDouble(4);
}
m_dCardName = dr.getString(5);
}
@Override
public PaymentInfo copyPayment(){
return new PaymentInfoTicket(m_dTicket, m_sName);
}
@Override
public String getName() {
return m_sName;
}
@Override
public double getTotal() {
return m_dTicket;
}
@Override
public String getTransactionID(){
return m_transactionID;
}
@Override
public double getPaid() {
return (0.0);
}
@Override
public double getChange(){
return m_dTendered - m_dTicket;
}
@Override
public double getTendered() {
return (0.0);
}
@Override
public String getCardName() {
return m_dCardName;
}
public String printPaid() {
return Formats.CURRENCY.formatValue(m_dTicket);
}
public String printVoucherTotal() {
return Formats.CURRENCY.formatValue(-m_dTicket);
}
public String printChange() {
return Formats.CURRENCY.formatValue(m_dTendered - m_dTicket);
}
public String printTendered() {
return Formats.CURRENCY.formatValue(m_dTendered);
}
@Override
public String getVoucher() {
return m_sVoucher;
}
public String printVoucher() {
return m_sVoucher;
}
public String getVoucherNumber() {
return m_sVoucherNumber;
}
public String printVoucherNumber() {
return m_sVoucherNumber;
}
}
@@ -0,0 +1,29 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import javax.swing.JComponent;
public interface PaymentPanel {
public void activate(String sTransaction, double dTotal);
public JComponent getComponent();
public PaymentInfoMagcard getPaymentInfoMagcard();
}
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,0,124,0,0,1,-94"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
</Component>
</SubComponents>
</Form>
@@ -0,0 +1,102 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.pos.forms.AppLocal;
import javax.swing.JComponent;
public class PaymentPanelBasic extends javax.swing.JPanel implements PaymentPanel {
private double m_dTotal;
private String m_sTransactionID;
private JPaymentNotifier m_notifier;
/**
* Creates new form PaymentPanelSimple
*/
public PaymentPanelBasic(JPaymentNotifier notifier) {
m_notifier = notifier;
initComponents();
}
public JComponent getComponent() {
return this;
}
public void activate(String sTransaction, double dTotal) {
m_sTransactionID = sTransaction;
m_dTotal = dTotal;
jLabel1.setText(
m_dTotal > 0.0
? AppLocal.getIntString("message.paymentgatewayext")
: AppLocal.getIntString("message.paymentgatewayextrefund"));
m_notifier.setStatus(true, true);
}
public PaymentInfoMagcard getPaymentInfoMagcard() {
if (m_dTotal > 0.0) {
return new PaymentInfoMagcard(
"",
"",
"",
null,
null,
null,
null,
null,
m_sTransactionID,
m_dTotal);
} else {
return new PaymentInfoMagcardRefund(
"",
"",
"",
null,
null,
null,
null,
null,
m_sTransactionID,
m_dTotal);
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
add(jLabel1);
}
// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
// End of variables declaration//GEN-END:variables
}
@@ -0,0 +1,108 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.pos.forms.AppLocal;
import javax.swing.*;
public class PaymentPanelEMV extends javax.swing.JPanel implements PaymentPanel {
private double m_dTotal;
private String m_sTransactionID;
private final JPaymentNotifier m_notifier;
/**
* Creates new form PaymentPanelSimple
* @param notifier
*/
public PaymentPanelEMV(JPaymentNotifier notifier) {
m_notifier = notifier;
initComponents();
}
@Override
public JComponent getComponent() {
return this;
}
@Override
public void activate(String sTransaction, double dTotal) {
m_sTransactionID = sTransaction;
m_dTotal = dTotal;
jLabel1.setText(
m_dTotal > 0.0
//TODO: Needs to be done for all locals i.e. message.paymentgatewayemv
? AppLocal.getIntString("message.paymentgatewayemv")
: AppLocal.getIntString("message.paymentgatewayemvrefund"));
m_notifier.setStatus(true, true);
}
@Override
public PaymentInfoMagcard getPaymentInfoMagcard() {
if (m_dTotal > 0.0) {
return new PaymentInfoMagcard(
"",
"",
"",
null,
null,
null,
null,
null,
m_sTransactionID,
m_dTotal);
} else {
return new PaymentInfoMagcardRefund(
"",
"",
"",
null,
null,
null,
null,
null,
m_sTransactionID,
m_dTotal);
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
add(jLabel1);
}
// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
// End of variables declaration//GEN-END:variables
}
@@ -0,0 +1,47 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
/**
*
* @author adrianromero
*/
public class PaymentPanelFac {
/** Creates a new instance of PaymentPanelFac */
private PaymentPanelFac() {
}
public static PaymentPanel getPaymentPanel(String sReader, JPaymentNotifier notifier) {
// JG 16 May 12 use switch
switch (sReader) {
case "Intelligent":
return new PaymentPanelMagCard(new MagCardReaderIntelligent(), notifier);
case "Generic":
return new PaymentPanelMagCard(new MagCardReaderGeneric(), notifier);
case "Keyboard":
return new PaymentPanelType(notifier);
case "EMV":
return new PaymentPanelEMV(notifier);
default:
return new PaymentPanelBasic(notifier);
}
}
}
@@ -0,0 +1,267 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,0,-52,0,0,1,-7"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel2">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="North"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="18" style="0"/>
</Property>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="message.paymentgatewayswipe" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[263, 30]"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="m_jKeyFactory" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
<Component id="jLabel8" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="m_jExpirationDate" alignment="0" min="-2" pref="70" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="m_jHolderName" min="-2" max="-2" attributes="0"/>
<Component id="m_jCardNumber" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jReset" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" pref="22" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="m_jKeyFactory" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jReset" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel8" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="m_jHolderName" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
<Component id="m_jCardNumber" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="m_jExpirationDate" min="-2" max="-2" attributes="0"/>
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace min="-2" pref="17" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="jReset">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="11" style="0"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/unicenta/images/reload.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="button.reset" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusPainted" type="boolean" value="false"/>
<Property name="focusable" type="boolean" value="false"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 45]"/>
</Property>
<Property name="requestFocusEnabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jResetActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JTextArea" name="m_jKeyFactory">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[1, 1]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.cardnumber" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[150, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel7">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.cardexpdate" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[150, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="m_jExpirationDate">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" id="white" palette="0" red="ff" type="palette"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.CompoundBorderInfo">
<CompoundBorder>
<Border PropertyName="outside" info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder>
<Color PropertyName="color" blue="64" green="6f" id="Button.darkShadow" palette="3" red="71" type="palette"/>
</LineBorder>
</Border>
<Border PropertyName="inside" info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="1" left="4" right="4" top="1"/>
</Border>
</CompoundBorder>
</Border>
</Property>
<Property name="opaque" type="boolean" value="true"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[180, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="m_jCardNumber">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" id="white" palette="0" red="ff" type="palette"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.CompoundBorderInfo">
<CompoundBorder>
<Border PropertyName="outside" info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder>
<Color PropertyName="color" blue="64" green="6f" id="Button.darkShadow" palette="3" red="71" type="palette"/>
</LineBorder>
</Border>
<Border PropertyName="inside" info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="1" left="4" right="4" top="1"/>
</Border>
</CompoundBorder>
</Border>
</Property>
<Property name="opaque" type="boolean" value="true"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[200, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.cardholder" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[150, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="m_jHolderName">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" id="white" palette="1" red="ff" type="palette"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.CompoundBorderInfo">
<CompoundBorder>
<Border PropertyName="outside" info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder>
<Color PropertyName="color" blue="64" green="6f" id="Button.darkShadow" palette="3" red="71" type="palette"/>
</LineBorder>
</Border>
<Border PropertyName="inside" info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="1" left="4" right="4" top="1"/>
</Border>
</CompoundBorder>
</Border>
</Property>
<Property name="opaque" type="boolean" value="true"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[200, 30]"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>
@@ -0,0 +1,518 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.pos.forms.AppConfig;
import com.unicenta.pos.forms.AppLocal;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.HeadlessException;
import java.awt.Insets;
import java.io.File;
import javax.swing.*;
import jpos.JposException;
import jpos.MSR;
import jpos.MSRControl113;
import jpos.events.DataEvent;
import jpos.events.DataListener;
import jpos.events.ErrorEvent;
import jpos.events.ErrorListener;
public class PaymentPanelMagCard extends javax.swing.JPanel implements PaymentPanel,
DataListener, ErrorListener {
private JPaymentNotifier m_notifier;
private MagCardReader m_cardreader;
private String track1 = null;
private String track2 = null;
private String track3 = null;
private String m_sTransactionID;
private double m_dTotal;
// --------------------MagTeck variables----------------------------//
String track1DataTextField = null;
String track2DataTextField = null;
String track3DataTextField = null;
String additionalSecurityInformationTextField = null;
String track1DataEncryptedTextField = null;
String track2DataEncryptedTextField = null;
String track3DataEncryptedTextField = null;
//JButton clearButton = new JButton("Clear");
String infoLine = "";
String title = "";
String resultValue = "";
boolean enabled = false;
boolean openDevice = false;
boolean init = true;
String logicalDeviceName = "MagTekMSR_Encrypted";
String encryptedCardData = null;
String encryptionKey = null;
boolean isMercury;
MSRControl113 msr = null;
//----------------------------------------------------------------------//
/**
* Creates new form JMagCardReader
*/
// public PaymentPanelMagCard(String sReader, JPaymentNotifier notifier) {
public PaymentPanelMagCard(MagCardReader cardreader, JPaymentNotifier notifier) {
m_notifier = notifier;
m_cardreader = cardreader;
initComponents();
AppConfig config = new AppConfig(new File(new File(System.getProperty("user.home")), AppLocal.APP_ID + ".properties"));
config.load();
String payProcessor = config.getProperty("payment.gateway");
if ("MercuryPay".equals(payProcessor)) {
isMercury = true;
} else {
isMercury = false;
}
if (m_cardreader != null) {
// They will be able to pay by card
m_jKeyFactory.addKeyListener(new KeyBarsListener());
jReset.setEnabled(true);
} else {
jReset.setEnabled(false);
}
//---------------------------------------------------//
msr = new MSR();
msr.addDataListener(this);
msr.addErrorListener(this);
if (isMercury) {
processMSRSession();
}
}
private void processMSRSession() {
if ((this.logicalDeviceName != null) && (!"".equals(this.logicalDeviceName))) {
if (this.openDevice) {
try {
msr.close();
} catch (JposException localJposException1) {
JOptionPane.showMessageDialog(this, "Error Occured " + localJposException1.getMessage());
}
}
try {
msr.open(this.logicalDeviceName);
this.openDevice = true;
} catch (JposException localJposException2) {
JOptionPane.showMessageDialog(this, "Error Occured " + localJposException2.getMessage());
}
//Clear the field data.
clear();
try {
this.msr.claim(1000);
} catch (JposException localJposException3) {
JOptionPane.showMessageDialog(this, "Error Occured " + localJposException3.getMessage());
}
try {
this.msr.setDataEventEnabled(true);
} catch (JposException localJposException5) {
JOptionPane.showMessageDialog(this, "Error Occured " + localJposException5.getMessage());
}
try {
this.msr.setDeviceEnabled(true);
this.enabled = true;
} catch (JposException localJposException4) {
this.enabled = false;
JOptionPane.showMessageDialog(this, "Error Occured " + localJposException4.getMessage());
}
}
}
public void clear() {
this.track1DataTextField = "";
this.track2DataTextField = "";
this.track3DataTextField = "";
this.additionalSecurityInformationTextField = "";
this.track1DataEncryptedTextField = "";
this.track2DataEncryptedTextField = "";
this.track3DataEncryptedTextField = "";
}
@Override
public void dataOccurred(DataEvent paramDataEvent) {
String str = "";
byte[] arrayOfByte = new byte[0];
try {
arrayOfByte = this.msr.getTrack1Data();
str = new String(arrayOfByte);
if (str.length() == 0) {
str = "";
}
this.track1DataTextField = str;
arrayOfByte = this.msr.getTrack2Data();
str = new String(arrayOfByte);
if (str.length() == 0) {
str = "";
}
this.track2DataTextField = str;
arrayOfByte = this.msr.getTrack3Data();
str = new String(arrayOfByte);
if (str.length() == 0) {
str = "";
}
this.track3DataTextField = str;
arrayOfByte = this.msr.getAdditionalSecurityInformation();
str = new String(arrayOfByte);
if (str.length() == 0) {
str = "";
}
this.additionalSecurityInformationTextField = str;
arrayOfByte = this.msr.getTrack1EncryptedData();
str = new String(arrayOfByte);
if (str.length() == 0) {
str = "";
}
this.track1DataEncryptedTextField = str;
arrayOfByte = this.msr.getTrack2EncryptedData();
str = new String(arrayOfByte);
if (str.length() == 0) {
str = "";
}
this.track2DataEncryptedTextField = str;
arrayOfByte = this.msr.getTrack3EncryptedData();
str = new String(arrayOfByte);
if (str.length() == 0) {
str = "";
}
this.track3DataEncryptedTextField = str;
this.msr.setDataEventEnabled(true);
encryptedCardData = track2DataEncryptedTextField;
encryptionKey = additionalSecurityInformationTextField;
char[] cData = ("%" + track1DataTextField + "?;" + track2DataTextField + "?").toCharArray();
if (cData.length > 0) {
for (int i = 0; i < cData.length; i++) {
stateTransition(cData[i]);
}
}
} catch (JposException localJposException) {
processJposException(localJposException, "");
}
}
@Override
public void errorOccurred(ErrorEvent paramErrorEvent) {
String str1 = Integer.toString(paramErrorEvent.getErrorCode());
String str2 = Integer.toString(paramErrorEvent.getErrorCodeExtended());
String str3 = Integer.toString(paramErrorEvent.getErrorLocus());
String str4 = Integer.toString(paramErrorEvent.getErrorResponse());
JOptionPane.showMessageDialog(this, "ErrorEvent: EC=" + str1 + ", ECE=" + str2 + ", EL=" + str3 + ", ER=" + str4, this.title, 0);
}
private void processJposException(JposException paramJposException, String paramString) {
JOptionPane.showMessageDialog(this, "Exception...message = " + paramJposException.getMessage() + " with errorCode = " + paramJposException.getErrorCode() + ", errorCodeExtended = " + paramJposException.getErrorCodeExtended(), this.title, 0);
}
class XmlDialog extends JDialog {
JScrollPane jScrollPane = new JScrollPane();
JTextArea jTextArea = new JTextArea();
GridBagLayout gridBagLayout1 = new GridBagLayout();
public XmlDialog(String arg2) throws HeadlessException {
try {
jaInit();
String str = "";
this.jTextArea.append(str);
} catch (Exception localException) {
localException.printStackTrace();
}
}
private void jaInit() throws Exception {
getContentPane().setLayout(this.gridBagLayout1);
this.jTextArea.setColumns(16);
this.jTextArea.setRows(18);
getContentPane().add(this.jScrollPane, new GridBagConstraints(0, 0, 2, 1, 1.0D, 1.0D, 10, 1, new Insets(15, 17, 0, 15), 364, 213));
this.jScrollPane.getViewport().add(this.jTextArea, null);
}
}
//--------------------------------------------------------------//
@Override
public JComponent getComponent() {
return this;
}
@Override
public void activate(String sTransaction, double dTotal) {
m_sTransactionID = sTransaction;
m_dTotal = dTotal;
resetState();
m_jKeyFactory.setText(null);
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
m_jKeyFactory.requestFocus();
}
});
}
private void resetState() {
m_notifier.setStatus(false, false);
m_jHolderName.setText(null);
m_jCardNumber.setText(null);
m_jExpirationDate.setText(null);
track1 = null;
track2 = null;
track3 = null;
if (m_cardreader != null) {
// Se van a poder efectuar pagos con tarjeta
m_cardreader.reset();
}
//clear();
}
@Override
public PaymentInfoMagcard getPaymentInfoMagcard() {
if (m_dTotal > 0.0) {
return new PaymentInfoMagcard(
m_jHolderName.getText(),
m_jCardNumber.getText(),
m_jExpirationDate.getText(),
track1,
track2,
track3,
encryptedCardData,
encryptionKey,
m_sTransactionID,
m_dTotal);
} else {
return new PaymentInfoMagcardRefund(
m_jHolderName.getText(),
m_jCardNumber.getText(),
m_jExpirationDate.getText(),
track1,
track2,
track3,
encryptedCardData,
encryptionKey,
m_sTransactionID,
m_dTotal);
}
}
private void stateTransition(char cTrans) {
m_cardreader.appendChar(cTrans);
if (m_cardreader.isComplete()) {
m_jHolderName.setText(m_cardreader.getHolderName());
m_jCardNumber.setText(m_cardreader.getCardNumber());
m_jExpirationDate.setText(m_cardreader.getExpirationDate());
track1 = m_cardreader.getTrack1();
track2 = m_cardreader.getTrack2();
track3 = m_cardreader.getTrack3();
m_notifier.setStatus(true, true);
m_jKeyFactory.addKeyListener(new KeyBarsListener());
jReset.setEnabled(true);
} else {
m_jHolderName.setText(null);
m_jCardNumber.setText(null);
m_jExpirationDate.setText(null);
track1 = null;
track3 = null;
track3 = null;
m_notifier.setStatus(false, false);
}
}
private class KeyBarsListener extends java.awt.event.KeyAdapter {
@Override
public void keyTyped(java.awt.event.KeyEvent e) {
m_jKeyFactory.setText(null);
stateTransition(e.getKeyChar());
}
}
/**
*
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel2 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jReset = new javax.swing.JButton();
m_jKeyFactory = new javax.swing.JTextArea();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
m_jExpirationDate = new javax.swing.JLabel();
m_jCardNumber = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
m_jHolderName = new javax.swing.JLabel();
setLayout(new java.awt.BorderLayout());
jLabel1.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel1.setText(AppLocal.getIntString("message.paymentgatewayswipe")); // NOI18N
jLabel1.setPreferredSize(new java.awt.Dimension(263, 30));
jPanel2.add(jLabel1);
add(jPanel2, java.awt.BorderLayout.NORTH);
jReset.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
jReset.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/reload.png"))); // NOI18N
jReset.setText(AppLocal.getIntString("button.reset")); // NOI18N
jReset.setFocusPainted(false);
jReset.setFocusable(false);
jReset.setPreferredSize(new java.awt.Dimension(100, 45));
jReset.setRequestFocusEnabled(false);
jReset.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jResetActionPerformed(evt);
}
});
m_jKeyFactory.setPreferredSize(new java.awt.Dimension(1, 1));
jLabel6.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabel6.setText(AppLocal.getIntString("label.cardnumber")); // NOI18N
jLabel6.setPreferredSize(new java.awt.Dimension(150, 30));
jLabel7.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabel7.setText(AppLocal.getIntString("label.cardexpdate")); // NOI18N
jLabel7.setPreferredSize(new java.awt.Dimension(150, 30));
m_jExpirationDate.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
m_jExpirationDate.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")), javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4)));
m_jExpirationDate.setOpaque(true);
m_jExpirationDate.setPreferredSize(new java.awt.Dimension(180, 30));
m_jCardNumber.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
m_jCardNumber.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")), javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4)));
m_jCardNumber.setOpaque(true);
m_jCardNumber.setPreferredSize(new java.awt.Dimension(200, 30));
jLabel8.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabel8.setText(AppLocal.getIntString("label.cardholder")); // NOI18N
jLabel8.setPreferredSize(new java.awt.Dimension(150, 30));
m_jHolderName.setBackground(java.awt.Color.white);
m_jHolderName.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
m_jHolderName.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")), javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4)));
m_jHolderName.setOpaque(true);
m_jHolderName.setPreferredSize(new java.awt.Dimension(200, 30));
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(m_jKeyFactory, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(m_jExpirationDate, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(m_jHolderName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(m_jCardNumber, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jReset, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(22, 22, 22))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(m_jKeyFactory, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jReset, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(m_jHolderName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(m_jCardNumber, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(m_jExpirationDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(17, 17, 17))
);
add(jPanel1, java.awt.BorderLayout.CENTER);
}// </editor-fold>//GEN-END:initComponents
private void jResetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jResetActionPerformed
resetState();
}//GEN-LAST:event_jResetActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JButton jReset;
private javax.swing.JLabel m_jCardNumber;
private javax.swing.JLabel m_jExpirationDate;
private javax.swing.JLabel m_jHolderName;
private javax.swing.JTextArea m_jKeyFactory;
// End of variables declaration//GEN-END:variables
}
@@ -0,0 +1,232 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,89,0,0,2,-18"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel2">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="East"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="North"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
<Property name="axis" type="int" value="1"/>
</Layout>
<SubComponents>
<Component class="com.unicenta.editor.JEditorKeys" name="m_jKeys">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jKeysActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel4">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[400, 105]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="m_jExpirationDate" min="-2" pref="90" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" pref="61" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel8" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="m_jHolderName" min="-2" pref="200" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="m_jCardNumber" min="-2" pref="200" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel8" min="-2" max="-2" attributes="0"/>
<Component id="m_jHolderName" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
<Component id="m_jCardNumber" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="m_jExpirationDate" min="-2" max="-2" attributes="0"/>
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="177" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="com.unicenta.editor.JEditorStringNumber" name="m_jCardNumber">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[150, 30]"/>
</Property>
</Properties>
</Component>
<Component class="com.unicenta.editor.JEditorStringNumber" name="m_jExpirationDate">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[150, 30]"/>
</Property>
</Properties>
</Component>
<Component class="com.unicenta.editor.JEditorString" name="m_jHolderName">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 30]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[150, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.cardholder" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[150, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.cardnumber" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[150, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel7">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="label.cardexpdate" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[150, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="MMYY"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[150, 30]"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel5">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[350, 45]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="North"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="18" style="1"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="message.paymentgatewaytype" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>
@@ -0,0 +1,273 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.pos.forms.AppLocal;
import com.unicenta.pos.util.LuhnAlgorithm;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JComponent;
/**
*
* @author adrianromero
*/
public class PaymentPanelType extends javax.swing.JPanel implements PaymentPanel {
private double m_dTotal;
private String m_sTransactionID;
private JPaymentNotifier m_notifier;
/**
* Creates new form JPaymentCash
*/
public PaymentPanelType(JPaymentNotifier notifier) {
m_notifier = notifier;
initComponents();
m_jHolderName.addPropertyChangeListener("Edition", new RecalculateName());
m_jCardNumber.addPropertyChangeListener("Edition", new RecalculateName());
m_jExpirationDate.addPropertyChangeListener("Edition", new RecalculateName());
m_jHolderName.addEditorKeys(m_jKeys);
m_jCardNumber.addEditorKeys(m_jKeys);
m_jExpirationDate.addEditorKeys(m_jKeys);
}
public JComponent getComponent() {
return this;
}
public void activate(String sTransaction, double dTotal) {
m_sTransactionID = sTransaction;
m_dTotal = dTotal;
resetState();
m_jHolderName.activate();
}
private void resetState() {
m_notifier.setStatus(false, false);
m_jHolderName.setText(null);
m_jCardNumber.setText(null);
m_jExpirationDate.setText(null);
}
public PaymentInfoMagcard getPaymentInfoMagcard() {
if (m_dTotal > 0.0) {
return new PaymentInfoMagcard(
m_jHolderName.getText(),
m_jCardNumber.getText(),
m_jExpirationDate.getText(),
null,
null,
null,
null,
null,
m_sTransactionID,
m_dTotal);
} else {
return new PaymentInfoMagcardRefund(
m_jHolderName.getText(),
m_jCardNumber.getText(),
m_jExpirationDate.getText(),
null,
null,
null,
null,
null,
m_sTransactionID,
m_dTotal);
}
}
private class RecalculateName implements PropertyChangeListener {
public void propertyChange(PropertyChangeEvent evt) {
boolean isvalid = isValidHolder() && isValidCardNumber() && isValidExpirationDate();
m_notifier.setStatus(isvalid, isvalid);
}
}
private boolean isValidHolder() {
return !(m_jHolderName.getText() == null || m_jHolderName.getText().equals(""));
}
private boolean isValidCardNumber() {
return (LuhnAlgorithm.checkCC(m_jCardNumber.getText()) && m_jCardNumber.getText().length() > 13 && m_jCardNumber.getText().length() < 20);
}
private boolean isValidExpirationDate() {
return !(m_jExpirationDate.getText() == null || m_jExpirationDate.getText().length() != 4);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel2 = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
m_jKeys = new com.unicenta.editor.JEditorKeys();
jPanel4 = new javax.swing.JPanel();
m_jCardNumber = new com.unicenta.editor.JEditorStringNumber();
m_jExpirationDate = new com.unicenta.editor.JEditorStringNumber();
m_jHolderName = new com.unicenta.editor.JEditorString();
jLabel8 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jPanel5 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
setLayout(new java.awt.BorderLayout());
jPanel2.setLayout(new java.awt.BorderLayout());
jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.Y_AXIS));
m_jKeys.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
m_jKeysActionPerformed(evt);
}
});
jPanel1.add(m_jKeys);
jPanel2.add(jPanel1, java.awt.BorderLayout.NORTH);
add(jPanel2, java.awt.BorderLayout.EAST);
jPanel4.setPreferredSize(new java.awt.Dimension(400, 105));
m_jCardNumber.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
m_jCardNumber.setMinimumSize(new java.awt.Dimension(100, 30));
m_jCardNumber.setPreferredSize(new java.awt.Dimension(150, 30));
m_jExpirationDate.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
m_jExpirationDate.setMinimumSize(new java.awt.Dimension(100, 30));
m_jExpirationDate.setPreferredSize(new java.awt.Dimension(150, 30));
m_jHolderName.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
m_jHolderName.setMinimumSize(new java.awt.Dimension(100, 30));
m_jHolderName.setPreferredSize(new java.awt.Dimension(150, 30));
jLabel8.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabel8.setText(AppLocal.getIntString("label.cardholder")); // NOI18N
jLabel8.setPreferredSize(new java.awt.Dimension(150, 30));
jLabel6.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabel6.setText(AppLocal.getIntString("label.cardnumber")); // NOI18N
jLabel6.setPreferredSize(new java.awt.Dimension(150, 30));
jLabel7.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabel7.setText(AppLocal.getIntString("label.cardexpdate")); // NOI18N
jLabel7.setPreferredSize(new java.awt.Dimension(150, 30));
jLabel2.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabel2.setText("MMYY");
jLabel2.setPreferredSize(new java.awt.Dimension(150, 30));
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(m_jExpirationDate, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(m_jHolderName, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(m_jCardNumber, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(m_jHolderName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(m_jCardNumber, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(m_jExpirationDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(177, Short.MAX_VALUE))
);
add(jPanel4, java.awt.BorderLayout.CENTER);
jPanel5.setPreferredSize(new java.awt.Dimension(350, 45));
jLabel1.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
jLabel1.setText(AppLocal.getIntString("message.paymentgatewaytype")); // NOI18N
jPanel5.add(jLabel1);
add(jPanel5, java.awt.BorderLayout.NORTH);
}// </editor-fold>//GEN-END:initComponents
private void m_jKeysActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jKeysActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_m_jKeysActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private com.unicenta.editor.JEditorStringNumber m_jCardNumber;
private com.unicenta.editor.JEditorStringNumber m_jExpirationDate;
private com.unicenta.editor.JEditorString m_jHolderName;
private com.unicenta.editor.JEditorKeys m_jKeys;
// End of variables declaration//GEN-END:variables
}
@@ -0,0 +1,112 @@
// uniCenta oPOS - Touch Friendly Point Of Sale
// Copyright (c) 2009-2018 uniCenta
// https://unicenta.com
//
// This file is part of uniCenta oPOS
//
// uniCenta oPOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// uniCenta oPOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
package com.unicenta.pos.payment;
import com.unicenta.basic.BasicException;
import com.unicenta.data.loader.DataRead;
import com.unicenta.data.loader.SerializableRead;
import com.unicenta.format.Formats;
public class VoucherPaymentInfo extends PaymentInfo implements SerializableRead {
private static final long serialVersionUID = 8865238639097L;
private double m_dTicket;
private String m_sName;
private String m_sVoucher;
public VoucherPaymentInfo(double dTicket, String sName, String sVoucher) {
m_dTicket = dTicket;
m_sName = sName;
m_sVoucher = sVoucher;
}
public VoucherPaymentInfo() {
m_dTicket = 0.0;
m_sName = null;
m_sVoucher = null;
}
@Override
public void readValues(DataRead dr) throws BasicException {
m_sName = dr.getString(1);
m_dTicket = dr.getDouble(2);
m_sVoucher = dr.getString(3);
}
@Override
public PaymentInfo copyPayment(){
return new VoucherPaymentInfo(m_dTicket, m_sName, m_sVoucher);
}
@Override
public String getName() {
return m_sName;
}
@Override
public double getTotal() {
return m_dTicket;
}
@Override
public String getTransactionID(){
return null;
}
public String printPaid() {
return Formats.CURRENCY.formatValue(m_dTicket);
}
public String printVoucherTotal() {
return Formats.CURRENCY.formatValue(-m_dTicket);
}
@Override
public double getPaid() {
return m_dTicket;
}
@Override
public double getChange() {
return 0;
}
@Override
public String getVoucher() {
return m_sVoucher;
}
public String getCardType() {
return null;
}
@Override
public double getTendered() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getCardName() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}