5.0 Source Code
Committing 5.0 Source Code
This commit is contained in:
@@ -0,0 +1,384 @@
|
||||
// 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.sales;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.loader.Datas;
|
||||
import com.unicenta.data.loader.PreparedSentence;
|
||||
import com.unicenta.data.loader.SerializerReadBasic;
|
||||
import com.unicenta.data.loader.SerializerReadClass;
|
||||
import com.unicenta.data.loader.SerializerWriteBasicExt;
|
||||
import com.unicenta.data.loader.SerializerWriteString;
|
||||
import com.unicenta.data.loader.Session;
|
||||
import com.unicenta.data.loader.StaticSentence;
|
||||
import com.unicenta.pos.forms.BeanFactoryDataSingle;
|
||||
import com.unicenta.pos.ticket.TicketInfo;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author adrianromero
|
||||
*/
|
||||
public class DataLogicReceipts extends BeanFactoryDataSingle {
|
||||
|
||||
private Session s;
|
||||
|
||||
/** Creates a new instance of DataLogicReceipts */
|
||||
public DataLogicReceipts() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param s
|
||||
*/
|
||||
@Override
|
||||
public void init(Session s){
|
||||
this.s = s;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param Id
|
||||
* @return
|
||||
* @throws BasicException
|
||||
*/
|
||||
public final TicketInfo getSharedTicket(String Id) throws BasicException {
|
||||
|
||||
if (Id == null) {
|
||||
return null;
|
||||
} else {
|
||||
Object[]record = (Object[]) new StaticSentence(s
|
||||
, "SELECT CONTENT, LOCKED FROM sharedtickets WHERE ID = ?"
|
||||
, SerializerWriteString.INSTANCE
|
||||
, new SerializerReadBasic(new Datas[] {
|
||||
Datas.SERIALIZABLE})).find(Id);
|
||||
return record == null ? null : (TicketInfo) record[0];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param pickupId
|
||||
* @return
|
||||
* @throws BasicException
|
||||
*/
|
||||
public final TicketInfo getSharedTicketPickupId(String pickupId) throws BasicException {
|
||||
|
||||
if (pickupId == null) {
|
||||
return null;
|
||||
} else {
|
||||
Object[]record = (Object[]) new StaticSentence(s
|
||||
, "SELECT CONTENT, LOCKED FROM sharedtickets WHERE PICKUPID = ?"
|
||||
, SerializerWriteString.INSTANCE
|
||||
, new SerializerReadBasic(new Datas[] {
|
||||
Datas.SERIALIZABLE})).find(pickupId);
|
||||
return record == null ? null : (TicketInfo) record[0];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* JG Dec 14 Administrator and Manager Roles always have access to ALL SHAREDtickets
|
||||
* @return
|
||||
* @throws BasicException
|
||||
*/
|
||||
public final List<SharedTicketInfo> getSharedTicketList() throws BasicException {
|
||||
|
||||
return (List<SharedTicketInfo>) new StaticSentence(s
|
||||
// , "SELECT ID, NAME, CONTENT, APPUSER, PICKUPID, LOCKED FROM sharedtickets ORDER BY ID"
|
||||
, "SELECT ID, NAME, CONTENT, APPUSER, PICKUPID, LOCKED "
|
||||
+ "FROM sharedtickets ORDER BY PICKUPID"
|
||||
, null
|
||||
, new SerializerReadClass(SharedTicketInfo.class)).list();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return only current APPUSER SHAREDtickets
|
||||
* @param appuser
|
||||
* @return
|
||||
* @throws BasicException
|
||||
*/
|
||||
public final List<SharedTicketInfo> getUserSharedTicketList(String appuser) throws BasicException {
|
||||
String sql = "SELECT ID, NAME, CONTENT, APPUSER, PICKUPID, LOCKED "
|
||||
+ "FROM sharedtickets "
|
||||
+ "WHERE APPUSER =\""+ appuser +"\" ORDER BY PICKUPID";
|
||||
|
||||
return (List<SharedTicketInfo>) new StaticSentence(s
|
||||
, sql
|
||||
, null
|
||||
, new SerializerReadClass(SharedTicketInfo.class)).list();
|
||||
}
|
||||
|
||||
/**
|
||||
* For Standard View
|
||||
* @param id
|
||||
* @param ticket
|
||||
* @param pickupid
|
||||
* @throws BasicException
|
||||
*/
|
||||
public final void insertSharedTicket(final String id, final TicketInfo ticket, int pickupid) throws BasicException {
|
||||
|
||||
Object[] values = new Object[] {
|
||||
id,
|
||||
ticket.getName(),
|
||||
ticket,
|
||||
ticket.getUser().getId(),
|
||||
pickupid
|
||||
|
||||
};
|
||||
Datas[] datas;
|
||||
datas = new Datas[] {
|
||||
Datas.STRING,
|
||||
Datas.STRING,
|
||||
Datas.SERIALIZABLE,
|
||||
Datas.STRING,
|
||||
Datas.INT
|
||||
|
||||
};
|
||||
new PreparedSentence(s
|
||||
, "INSERT INTO sharedtickets ("
|
||||
+ "ID, "
|
||||
+ "NAME, "
|
||||
+ "CONTENT, "
|
||||
+ "APPUSER, "
|
||||
+ "PICKUPID) "
|
||||
+ "VALUES (?, ?, ?, ?, ?)"
|
||||
, new SerializerWriteBasicExt(datas, new int[] {0, 1, 2, 3, 4})).exec(values);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* @param ticket
|
||||
* @param pickupid
|
||||
* @throws BasicException
|
||||
*/
|
||||
public final void updateSharedTicket(final String id, final TicketInfo ticket, int pickupid) throws BasicException {
|
||||
|
||||
Object[] values = new Object[] {
|
||||
id,
|
||||
ticket.getName(),
|
||||
ticket,
|
||||
ticket.getUser().getId(),
|
||||
pickupid
|
||||
};
|
||||
Datas[] datas = new Datas[] {
|
||||
Datas.STRING,
|
||||
Datas.STRING,
|
||||
Datas.SERIALIZABLE,
|
||||
Datas.STRING,
|
||||
Datas.INT
|
||||
};
|
||||
new PreparedSentence(s
|
||||
, "UPDATE sharedtickets SET "
|
||||
+ "NAME = ?, "
|
||||
+ "CONTENT = ?, "
|
||||
+ "APPUSER = ?, "
|
||||
+ "PICKUPID = ? "
|
||||
+ "WHERE ID = ?"
|
||||
, new SerializerWriteBasicExt(datas,
|
||||
new int[] {
|
||||
1, 2, 3, 4, 0})).exec(values);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* @param ticket
|
||||
* @param pickupid
|
||||
* @throws BasicException
|
||||
*/
|
||||
public final void updateRSharedTicket(
|
||||
final String id,
|
||||
final TicketInfo ticket,
|
||||
int pickupid) throws BasicException {
|
||||
|
||||
Object[] values = new Object[] {
|
||||
id,
|
||||
ticket.getName(),
|
||||
ticket,
|
||||
pickupid
|
||||
};
|
||||
Datas[] datas = new Datas[] {
|
||||
Datas.STRING,
|
||||
Datas.STRING,
|
||||
Datas.SERIALIZABLE,
|
||||
Datas.INT
|
||||
};
|
||||
new PreparedSentence(s
|
||||
, "UPDATE sharedtickets SET "
|
||||
+ "NAME = ?, "
|
||||
+ "CONTENT = ?, "
|
||||
+ "PICKUPID = ? "
|
||||
+ "WHERE ID = ?"
|
||||
, new SerializerWriteBasicExt(datas, new int[] {1, 2, 3, 0})).exec(values);
|
||||
}
|
||||
|
||||
/**
|
||||
* In place for multi-purposing like containing data from elsewhere and/or
|
||||
* using Place and User for Notifications
|
||||
* @param id
|
||||
* @param locked
|
||||
* @throws BasicException
|
||||
*/
|
||||
public final void lockSharedTicket(final String id, final String locked) throws BasicException {
|
||||
|
||||
Object[] values = new Object[] {
|
||||
id,
|
||||
locked
|
||||
};
|
||||
Datas[] datas = new Datas[] {
|
||||
Datas.STRING,
|
||||
Datas.STRING
|
||||
};
|
||||
new PreparedSentence(s
|
||||
, "UPDATE sharedtickets SET "
|
||||
+ "LOCKED = ? "
|
||||
+ "WHERE ID = ?"
|
||||
, new SerializerWriteBasicExt(datas, new int[] {1, 0})).exec(values);
|
||||
}
|
||||
|
||||
/**
|
||||
* In place for multi-purposing like flushing locks from elsewhere and/or
|
||||
* using Place and User for Notifications
|
||||
* @param id
|
||||
* @param unlocked
|
||||
* @throws BasicException
|
||||
*/
|
||||
public final void unlockSharedTicket(final String id, final String unlocked) throws BasicException {
|
||||
|
||||
Object[] values = new Object[] {
|
||||
id,
|
||||
unlocked
|
||||
};
|
||||
Datas[] datas = new Datas[] {
|
||||
Datas.STRING,
|
||||
Datas.STRING
|
||||
};
|
||||
new PreparedSentence(s
|
||||
, "UPDATE sharedtickets SET "
|
||||
+ "LOCKED = ? "
|
||||
+ "WHERE ID = ?"
|
||||
, new SerializerWriteBasicExt(datas, new int[] {1, 0})).exec(values);
|
||||
}
|
||||
|
||||
/**
|
||||
* For Restaurant View
|
||||
* @param id
|
||||
* @param ticket
|
||||
* @param pickupid
|
||||
* @throws BasicException
|
||||
*/
|
||||
public final void insertRSharedTicket(
|
||||
final String id,
|
||||
final TicketInfo ticket,
|
||||
int pickupid) throws BasicException {
|
||||
|
||||
Object[] values = new Object[] {
|
||||
id,
|
||||
ticket.getName(),
|
||||
ticket,
|
||||
ticket.getUser(),
|
||||
ticket.getPickupId(),
|
||||
ticket.getHost()
|
||||
};
|
||||
Datas[] datas;
|
||||
datas = new Datas[] {
|
||||
Datas.STRING,
|
||||
Datas.STRING,
|
||||
Datas.SERIALIZABLE,
|
||||
Datas.STRING,
|
||||
Datas.INT
|
||||
|
||||
};
|
||||
new PreparedSentence(s
|
||||
, "INSERT INTO sharedtickets ("
|
||||
+ "ID, "
|
||||
+ "NAME, "
|
||||
+ "CONTENT, "
|
||||
+ "APPUSER, "
|
||||
+ "PICKUPID) "
|
||||
+ "VALUES (?, ?, ?, ?, ?)"
|
||||
, new SerializerWriteBasicExt(datas, new int[] {0, 1, 2, 3, 4})).exec(values);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* @throws BasicException
|
||||
*/
|
||||
public final void deleteSharedTicket(final String id) throws BasicException {
|
||||
|
||||
new StaticSentence(s
|
||||
, "DELETE FROM sharedtickets WHERE ID = ?"
|
||||
, SerializerWriteString.INSTANCE).exec(id);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param Id
|
||||
* @return
|
||||
* @throws BasicException
|
||||
*/
|
||||
public final Integer getPickupId(String Id) throws BasicException {
|
||||
|
||||
if (Id == null) {
|
||||
return null;
|
||||
} else {
|
||||
Object[]record = (Object[]) new StaticSentence(s
|
||||
, "SELECT PICKUPID FROM sharedtickets WHERE ID = ?"
|
||||
, SerializerWriteString.INSTANCE
|
||||
, new SerializerReadBasic(new Datas[] {Datas.INT})).find(Id);
|
||||
return record == null ? 0 : (Integer)record[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public final String getUserId(final String id) throws BasicException {
|
||||
Object[] userID = (Object []) new StaticSentence(s
|
||||
, "SELECT APPUSER FROM sharedtickets WHERE ID = ?"
|
||||
, SerializerWriteString.INSTANCE
|
||||
, new SerializerReadBasic(new Datas[] {Datas.STRING})).find(id);
|
||||
if( userID == null ) {
|
||||
return null;
|
||||
} else {
|
||||
return (String) userID[0];
|
||||
}
|
||||
}
|
||||
|
||||
public final String getLockState(final String id, String lockState) throws BasicException {
|
||||
Object[] state = (Object[]) new StaticSentence(s
|
||||
, "SELECT LOCKED FROM sharedtickets WHERE ID = ?"
|
||||
, SerializerWriteString.INSTANCE
|
||||
, new SerializerReadBasic(new Datas[] {
|
||||
Datas.STRING
|
||||
})).find(id);
|
||||
return (String) state[0];
|
||||
}
|
||||
|
||||
public final String getServer(final String id, String user) throws BasicException {
|
||||
Object[] server = (Object[]) new StaticSentence(s
|
||||
, "SELECT appuser FROM sharedtickets WHERE ID = ?"
|
||||
, SerializerWriteString.INSTANCE
|
||||
, new SerializerReadBasic(new Datas[] {
|
||||
Datas.STRING
|
||||
})).find(id);
|
||||
return (String) server[0];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.6" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="2"/>
|
||||
</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,18,0,0,2,24"/>
|
||||
<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="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" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jScrollPane2" pref="508" max="32767" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" pref="107" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jText" min="-2" pref="222" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="jbtnCreateTicket" min="-2" pref="150" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" 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 min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane2" min="-2" pref="179" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jText" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jbtnCreateTicket" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="jbtnCreateTicket">
|
||||
<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/ok.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="label.mooringcreatebtn" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jbtnCreateTicketActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane2">
|
||||
<AuxValues>
|
||||
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTable" name="jTableSelector">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
|
||||
<Table columnCount="4" rowCount="6">
|
||||
<Column editable="false" title="Vessel Name" type="java.lang.Object"/>
|
||||
<Column editable="false" title="Size" type="java.lang.Object"/>
|
||||
<Column editable="false" title="Days" type="java.lang.Object"/>
|
||||
<Column editable="false" title="Power" type="java.lang.Object"/>
|
||||
</Table>
|
||||
</Property>
|
||||
<Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
|
||||
<TableColumnModel selectionModel="0">
|
||||
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
|
||||
<Title/>
|
||||
<Editor/>
|
||||
<Renderer/>
|
||||
</Column>
|
||||
<Column maxWidth="-1" minWidth="-1" prefWidth="50" resizable="false">
|
||||
<Title/>
|
||||
<Editor/>
|
||||
<Renderer/>
|
||||
</Column>
|
||||
<Column maxWidth="-1" minWidth="-1" prefWidth="50" resizable="false">
|
||||
<Title/>
|
||||
<Editor/>
|
||||
<Renderer/>
|
||||
</Column>
|
||||
<Column maxWidth="-1" minWidth="-1" prefWidth="70" resizable="false">
|
||||
<Title/>
|
||||
<Editor/>
|
||||
<Renderer/>
|
||||
</Column>
|
||||
</TableColumnModel>
|
||||
</Property>
|
||||
<Property name="rowHeight" type="int" value="25"/>
|
||||
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
|
||||
<TableHeader reorderingAllowed="true" resizingAllowed="true"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jTableSelectorMouseClicked"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JTextField" name="jText">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="disabledTextColor" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="0" green="0" red="0" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="enabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextActionPerformed"/>
|
||||
</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="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="label.mooringscreatefor" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,307 @@
|
||||
// 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.sales;
|
||||
|
||||
import com.unicenta.data.loader.Session;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dialog;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Window;
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import net.proteanit.sql.DbUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
public class JMooringDetails extends javax.swing.JDialog {
|
||||
|
||||
private Connection con;
|
||||
private ResultSet rs;
|
||||
private Statement stmt;
|
||||
private String ID;
|
||||
private String SQL;
|
||||
private String vesselName = "";
|
||||
private Integer vesselSize;
|
||||
private Integer vesselDays;
|
||||
private Boolean vesselPower;
|
||||
private boolean create = false;
|
||||
|
||||
|
||||
private JMooringDetails(java.awt.Frame parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
}
|
||||
|
||||
|
||||
private JMooringDetails(java.awt.Dialog parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
}
|
||||
|
||||
private void init(Session s) {
|
||||
|
||||
initComponents();
|
||||
setTitle("Select Vessel details");
|
||||
|
||||
try{
|
||||
con=s.getConnection();
|
||||
stmt = (Statement) con.createStatement();
|
||||
|
||||
SQL = "SELECT * FROM moorers";
|
||||
rs = stmt.executeQuery(SQL);
|
||||
|
||||
jTableSelector.setModel(DbUtils.resultSetToTableModel(rs));
|
||||
jTableSelector.getColumnModel().getColumn(0).setPreferredWidth(200);
|
||||
jTableSelector.getColumnModel().getColumn(1).setPreferredWidth(40);
|
||||
jTableSelector.getColumnModel().getColumn(2).setPreferredWidth(40);
|
||||
jTableSelector.getColumnModel().getColumn(3).setPreferredWidth(40);
|
||||
jTableSelector.setRowSelectionAllowed(true);
|
||||
jTableSelector.getTableHeader().setReorderingAllowed(true);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param parent
|
||||
* @param s
|
||||
* @return
|
||||
*/
|
||||
public static JMooringDetails getMooringDetails(Component parent, Session s) {
|
||||
Window window = SwingUtilities.getWindowAncestor(parent);
|
||||
// m_oticket = new ticket();
|
||||
JMooringDetails myMsg;
|
||||
if (window instanceof Frame) {
|
||||
myMsg = new JMooringDetails((Frame) window, true);
|
||||
} else {
|
||||
myMsg = new JMooringDetails((Dialog) window, true);
|
||||
}
|
||||
myMsg.init(s);
|
||||
myMsg.applyComponentOrientation(parent.getComponentOrientation());
|
||||
|
||||
|
||||
return myMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isCreate() {
|
||||
return create;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getVesselName() {
|
||||
return vesselName;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Integer getVesselSize() {
|
||||
return vesselSize;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Integer getVesselDays() {
|
||||
return vesselDays;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Boolean getVesselPower() {
|
||||
return vesselPower;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** 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() {
|
||||
|
||||
jbtnCreateTicket = new javax.swing.JButton();
|
||||
jScrollPane2 = new javax.swing.JScrollPane();
|
||||
jTableSelector = new javax.swing.JTable();
|
||||
jText = new javax.swing.JTextField();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
|
||||
jbtnCreateTicket.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
jbtnCreateTicket.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/ok.png"))); // NOI18N
|
||||
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("pos_messages"); // NOI18N
|
||||
jbtnCreateTicket.setText(bundle.getString("label.mooringcreatebtn")); // NOI18N
|
||||
jbtnCreateTicket.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jbtnCreateTicketActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jTableSelector.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
jTableSelector.setModel(new javax.swing.table.DefaultTableModel(
|
||||
new Object [][] {
|
||||
{null, null, null, null},
|
||||
{null, null, null, null},
|
||||
{null, null, null, null},
|
||||
{null, null, null, null},
|
||||
{null, null, null, null},
|
||||
{null, null, null, null}
|
||||
},
|
||||
new String [] {
|
||||
"Vessel Name", "Size", "Days", "Power"
|
||||
}
|
||||
) {
|
||||
boolean[] canEdit = new boolean [] {
|
||||
false, false, false, false
|
||||
};
|
||||
|
||||
public boolean isCellEditable(int rowIndex, int columnIndex) {
|
||||
return canEdit [columnIndex];
|
||||
}
|
||||
});
|
||||
jTableSelector.setRowHeight(25);
|
||||
jTableSelector.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||
public void mouseClicked(java.awt.event.MouseEvent evt) {
|
||||
jTableSelectorMouseClicked(evt);
|
||||
}
|
||||
});
|
||||
jScrollPane2.setViewportView(jTableSelector);
|
||||
jTableSelector.getColumnModel().getColumn(1).setResizable(false);
|
||||
jTableSelector.getColumnModel().getColumn(1).setPreferredWidth(50);
|
||||
jTableSelector.getColumnModel().getColumn(2).setResizable(false);
|
||||
jTableSelector.getColumnModel().getColumn(2).setPreferredWidth(50);
|
||||
jTableSelector.getColumnModel().getColumn(3).setResizable(false);
|
||||
jTableSelector.getColumnModel().getColumn(3).setPreferredWidth(70);
|
||||
|
||||
jText.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
jText.setDisabledTextColor(new java.awt.Color(0, 0, 0));
|
||||
jText.setEnabled(false);
|
||||
jText.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jTextActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel1.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
jLabel1.setText(bundle.getString("label.mooringscreatefor")); // NOI18N
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 508, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(10, 10, 10)
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jText, javax.swing.GroupLayout.PREFERRED_SIZE, 222, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(jbtnCreateTicket, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel1)
|
||||
.addComponent(jbtnCreateTicket))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
|
||||
setBounds((screenSize.width-536)/2, (screenSize.height-274)/2, 536, 274);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void jbtnCreateTicketActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnCreateTicketActionPerformed
|
||||
// use the passed parameters to add line to the ticket
|
||||
|
||||
if (vesselName.equals("")){
|
||||
this.create = false;
|
||||
dispose();
|
||||
}else{
|
||||
this.create = true;
|
||||
dispose();
|
||||
}
|
||||
|
||||
}//GEN-LAST:event_jbtnCreateTicketActionPerformed
|
||||
|
||||
private void jTableSelectorMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableSelectorMouseClicked
|
||||
|
||||
try{
|
||||
int row = jTableSelector.getSelectedRow();
|
||||
vesselName =(jTableSelector.getModel().getValueAt(row, 0).toString());
|
||||
SQL = "SELECT * FROM moorers WHERE VESSELNAME ='" + vesselName +"';";
|
||||
rs = stmt.executeQuery(SQL);
|
||||
if (rs.next()){
|
||||
vesselDays=rs.getInt("DAYS");
|
||||
vesselSize=rs.getInt("SIZE");
|
||||
vesselPower=rs.getBoolean("POWER");
|
||||
jText.setText(vesselName);
|
||||
}
|
||||
}catch (Exception e){
|
||||
JOptionPane.showMessageDialog(null, e);
|
||||
}
|
||||
|
||||
|
||||
}//GEN-LAST:event_jTableSelectorMouseClicked
|
||||
|
||||
private void jTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_jTextActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JScrollPane jScrollPane2;
|
||||
private javax.swing.JTable jTableSelector;
|
||||
private javax.swing.JTextField jText;
|
||||
private javax.swing.JButton jbtnCreateTicket;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</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,44,0,0,1,-112"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
|
||||
</Form>
|
||||
@@ -0,0 +1,221 @@
|
||||
// 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.sales;
|
||||
|
||||
import com.unicenta.data.loader.LocalRes;
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
import com.unicenta.pos.forms.AppUser;
|
||||
import com.unicenta.pos.util.ThumbNailBuilder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.helpers.DefaultHandler;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.parsers.SAXParser;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
@Slf4j
|
||||
public class JPanelButtons extends javax.swing.JPanel {
|
||||
|
||||
private static SAXParser m_sp = null;
|
||||
|
||||
private Properties props;
|
||||
private Map<String, String> events;
|
||||
|
||||
private ThumbNailBuilder tnbmacro;
|
||||
|
||||
private JPanelTicket panelticket;
|
||||
|
||||
/** Creates new form JPanelButtons
|
||||
* @param sConfigKey
|
||||
* @param panelticket */
|
||||
public JPanelButtons(String sConfigKey, JPanelTicket panelticket) {
|
||||
initComponents();
|
||||
|
||||
// Load categories default thumbnail
|
||||
tnbmacro = new ThumbNailBuilder(42, 36, "com/unicenta/images/run_script.png");
|
||||
|
||||
this.panelticket = panelticket;
|
||||
|
||||
props = new Properties();
|
||||
events = new HashMap<>();
|
||||
|
||||
String sConfigRes = panelticket.getResourceAsXML(sConfigKey);
|
||||
|
||||
if (sConfigRes != null) {
|
||||
try {
|
||||
if (m_sp == null) {
|
||||
SAXParserFactory spf = SAXParserFactory.newInstance();
|
||||
m_sp = spf.newSAXParser();
|
||||
}
|
||||
m_sp.parse(new InputSource(new StringReader(sConfigRes)), new ConfigurationHandler());
|
||||
|
||||
} catch (ParserConfigurationException ePC) {
|
||||
log.error(LocalRes.getIntString("exception.parserconfig"), ePC.getMessage());
|
||||
} catch (SAXException eSAX) {
|
||||
log.error(LocalRes.getIntString("exception.xmlfile"), eSAX.getMessage());
|
||||
} catch (IOException eIO) {
|
||||
log.error(LocalRes.getIntString("exception.iofile"), eIO.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param user
|
||||
*/
|
||||
public void setPermissions(AppUser user) {
|
||||
for (Component c : this.getComponents()) {
|
||||
String sKey = c.getName();
|
||||
if (sKey == null || sKey.equals("")) {
|
||||
c.setEnabled(true);
|
||||
} else {
|
||||
c.setEnabled(user.hasPermission(c.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public String getProperty(String key) {
|
||||
return props.getProperty(key);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param key
|
||||
* @param defaultvalue
|
||||
* @return
|
||||
*/
|
||||
public String getProperty(String key, String defaultvalue) {
|
||||
return props.getProperty(key, defaultvalue);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public String getEvent(String key) {
|
||||
return events.get(key);
|
||||
}
|
||||
|
||||
private class ConfigurationHandler extends DefaultHandler {
|
||||
@Override
|
||||
public void startDocument() throws SAXException {}
|
||||
@Override
|
||||
public void endDocument() throws SAXException {}
|
||||
@Override
|
||||
public void startElement(String uri, String localName, String qName,
|
||||
Attributes attributes) throws SAXException{
|
||||
switch (qName) {
|
||||
case "button":
|
||||
// The button title text
|
||||
String titlekey = attributes.getValue("titlekey");
|
||||
if (titlekey == null) {
|
||||
titlekey = attributes.getValue("name");
|
||||
}
|
||||
String title = titlekey == null
|
||||
? attributes.getValue("title")
|
||||
: AppLocal.getIntString(titlekey);
|
||||
// adding the button to the panel
|
||||
JButton btn = new JButtonFunc(attributes.getValue("key"),
|
||||
attributes.getValue("image"),
|
||||
title);
|
||||
// The template resource or the code resource
|
||||
final String template = attributes.getValue("template");
|
||||
if (template == null) {
|
||||
final String code = attributes.getValue("code");
|
||||
btn.addActionListener((ActionEvent evt) -> {
|
||||
panelticket.evalScriptAndRefresh(code);
|
||||
});
|
||||
} else {
|
||||
btn.addActionListener((ActionEvent evt) -> {
|
||||
panelticket.printTicket(template);
|
||||
});
|
||||
}
|
||||
add(btn);
|
||||
break;
|
||||
case "event":
|
||||
events.put(attributes.getValue("key"), attributes.getValue("code"));
|
||||
break;
|
||||
default:
|
||||
String value = attributes.getValue("value");
|
||||
if (value != null) {
|
||||
props.setProperty(qName, attributes.getValue("value"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void endElement(String uri, String localName, String qName) throws SAXException {}
|
||||
@Override
|
||||
public void characters(char[] ch, int start, int length) throws SAXException {}
|
||||
}
|
||||
|
||||
private class JButtonFunc extends JButton {
|
||||
|
||||
public JButtonFunc(String sKey, String sImage, String title) {
|
||||
|
||||
setName(sKey);
|
||||
setText(title);
|
||||
setIcon(new ImageIcon(tnbmacro.getThumbNail(panelticket.getResourceAsImage(sImage))));
|
||||
setFocusPainted(false);
|
||||
setFocusable(false);
|
||||
setRequestFocusEnabled(false);
|
||||
setMargin(new Insets(8, 14, 8, 14));
|
||||
setPreferredSize(new Dimension(80,45));
|
||||
}
|
||||
}
|
||||
|
||||
/** 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() {
|
||||
|
||||
setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
<?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="[200, 100]"/>
|
||||
</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">
|
||||
<Component id="jPanel1" alignment="1" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel1">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[342, 80]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
|
||||
<Component id="jbtnUpdate" min="-2" pref="155" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="56" max="-2" attributes="0"/>
|
||||
<Component id="jbtnExit" min="-2" pref="101" max="-2" attributes="0"/>
|
||||
<EmptySpace 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="22" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jbtnUpdate" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jbtnExit" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="25" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="jbtnUpdate">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="label.resetpickup" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[70, 33]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[70, 33]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[70, 33]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jbtnUpdateActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="jbtnExit">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="Button.Exit" replaceFormat="AppLocal.getIntString("Button.Exit")"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[70, 33]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[70, 33]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[70, 33]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jbtnExitActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,275 @@
|
||||
// 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.sales;
|
||||
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.gui.JMessageDialog;
|
||||
import com.unicenta.data.gui.MessageInf;
|
||||
import com.unicenta.data.loader.Session;
|
||||
import com.unicenta.pos.forms.AppConfig;
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
import com.unicenta.pos.forms.AppProperties;
|
||||
import com.unicenta.pos.forms.AppView;
|
||||
import com.unicenta.pos.forms.AppViewConnection;
|
||||
import com.unicenta.pos.forms.JPanelView;
|
||||
import com.unicenta.pos.util.AltEncrypter;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
public class JPanelResetPickupId extends JPanel implements JPanelView {
|
||||
|
||||
|
||||
private AppConfig config;
|
||||
private Connection con;
|
||||
private String sdbmanager;
|
||||
private Session session;
|
||||
private AppProperties m_props;
|
||||
private String SQL;
|
||||
private Statement stmt;
|
||||
|
||||
/** Creates new form JPaneldbUpdate
|
||||
* @param oApp */
|
||||
public JPanelResetPickupId(AppView oApp) {
|
||||
this(oApp.getProperties());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param props
|
||||
*/
|
||||
public JPanelResetPickupId(AppProperties props) {
|
||||
|
||||
initComponents();
|
||||
config = new AppConfig(props.getConfigFile());
|
||||
m_props=props;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void performReset(){
|
||||
|
||||
if ("HSQL Database Engine".equals(sdbmanager)) {
|
||||
SQL = "ALTER SEQUENCE pickup_number RESTART WITH 1";
|
||||
try {
|
||||
stmt.executeUpdate(SQL);
|
||||
// } catch (SQLException e){System.out.println(e.getMessage());}
|
||||
} catch (SQLException e){}
|
||||
} else if ("MySQL".equals(sdbmanager)) {
|
||||
SQL = "UPDATE pickup_number SET ID=0";
|
||||
try {
|
||||
stmt.executeUpdate(SQL);
|
||||
// } catch (SQLException e){System.out.println(e.getMessage());}
|
||||
} catch (SQLException e){}
|
||||
} else if ("PostgreSQL".equals(sdbmanager)) {
|
||||
SQL = "ALTER SEQUENCE pickup_number RESTART WITH 1";
|
||||
try {
|
||||
stmt.executeUpdate(SQL);
|
||||
// } catch (SQLException e){System.out.println(e.getMessage());}
|
||||
} catch (SQLException e){}
|
||||
} else if ("Oracle".equals(sdbmanager)) {
|
||||
SQL = "ALTER SEQUENCE pickup_number RESTART WITH 1";
|
||||
try {
|
||||
stmt.executeUpdate(SQL);
|
||||
// } catch (SQLException e){System.out.println(e.getMessage());}
|
||||
} catch (SQLException e){}
|
||||
} else if ("Apache Derby".equals(sdbmanager)) {
|
||||
SQL = "ALTER TABLE pickup_number ALTER COLUMN ID RESTART WITH 1";
|
||||
try {
|
||||
stmt.executeUpdate(SQL);
|
||||
// } catch (SQLException e){System.out.println(e.getMessage());}
|
||||
} catch (SQLException e){}
|
||||
} else if ("Derby".equals(sdbmanager)) {
|
||||
SQL = "UPDATE pickup_number SET ID=0";
|
||||
try {
|
||||
stmt.executeUpdate(SQL);
|
||||
// } catch (SQLException e){System.out.println(e.getMessage());}
|
||||
} catch (SQLException e){}
|
||||
} else {
|
||||
SQL = "ALTER SEQUENCE pickup_number RESTART WITH 1";
|
||||
try {
|
||||
stmt.executeUpdate(SQL);
|
||||
// } catch (SQLException e){System.out.println(e.getMessage());}
|
||||
} catch (SQLException e){}
|
||||
}
|
||||
JOptionPane.showMessageDialog(this,"Reset complete.");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public JComponent getComponent() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return AppLocal.getIntString("Menu.Resetpickup");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public void activate() throws BasicException {
|
||||
|
||||
// connect to the database
|
||||
String db_user =(m_props.getProperty("db.user"));
|
||||
String db_url = (m_props.getProperty("db.URL"));
|
||||
String db_password = (m_props.getProperty("db.password"));
|
||||
|
||||
if (db_user != null && db_password != null && db_password.startsWith("crypt:")) {
|
||||
// the password is encrypted
|
||||
AltEncrypter cypher = new AltEncrypter("cypherkey" + db_user);
|
||||
db_password = cypher.decrypt(db_password.substring(6));
|
||||
}
|
||||
|
||||
try{
|
||||
session = AppViewConnection.createSession(m_props);
|
||||
con = DriverManager.getConnection(db_url,db_user,db_password);
|
||||
sdbmanager = con.getMetaData().getDatabaseProductName();
|
||||
stmt = (Statement) con.createStatement();
|
||||
} catch (BasicException | SQLException e) {
|
||||
|
||||
JMessageDialog.showMessage(this, new MessageInf(MessageInf.SGN_DANGER, AppLocal.getIntString("database.UnableToConnect"), e));
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean deactivate() {
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
||||
/** 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();
|
||||
jbtnUpdate = new javax.swing.JButton();
|
||||
jbtnExit = new javax.swing.JButton();
|
||||
|
||||
setPreferredSize(new java.awt.Dimension(200, 100));
|
||||
|
||||
jPanel1.setPreferredSize(new java.awt.Dimension(342, 80));
|
||||
|
||||
jbtnUpdate.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
jbtnUpdate.setText(AppLocal.getIntString("label.resetpickup")); // NOI18N
|
||||
jbtnUpdate.setMaximumSize(new java.awt.Dimension(70, 33));
|
||||
jbtnUpdate.setMinimumSize(new java.awt.Dimension(70, 33));
|
||||
jbtnUpdate.setPreferredSize(new java.awt.Dimension(70, 33));
|
||||
jbtnUpdate.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jbtnUpdateActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jbtnExit.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
jbtnExit.setText(AppLocal.getIntString("button.exit")); // NOI18N
|
||||
jbtnExit.setMaximumSize(new java.awt.Dimension(70, 33));
|
||||
jbtnExit.setMinimumSize(new java.awt.Dimension(70, 33));
|
||||
jbtnExit.setPreferredSize(new java.awt.Dimension(70, 33));
|
||||
jbtnExit.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jbtnExitActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
jPanel1Layout.setHorizontalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGap(20, 20, 20)
|
||||
.addComponent(jbtnUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(56, 56, 56)
|
||||
.addComponent(jbtnExit, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
jPanel1Layout.setVerticalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGap(22, 22, 22)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jbtnUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jbtnExit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(25, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void jbtnUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnUpdateActionPerformed
|
||||
performReset();
|
||||
|
||||
}//GEN-LAST:event_jbtnUpdateActionPerformed
|
||||
|
||||
private void jbtnExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnExitActionPerformed
|
||||
deactivate();
|
||||
System.exit(0);
|
||||
}//GEN-LAST:event_jbtnExitActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JButton jbtnExit;
|
||||
private javax.swing.JButton jbtnUpdate;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,126 @@
|
||||
// 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.sales;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.pos.ticket.ProductInfoExt;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
public class JPanelTicketEdits extends JPanelTicket {
|
||||
|
||||
private JTicketCatalogLines m_catandlines;
|
||||
|
||||
/** Creates a new instance of JPanelTicketRefunds */
|
||||
public JPanelTicketEdits() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public void activate() throws BasicException {
|
||||
super.activate();
|
||||
m_catandlines.loadCatalog();
|
||||
}
|
||||
|
||||
public void reLoadCatalog(){
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void showCatalog() {
|
||||
m_jbtnconfig.setVisible(true);
|
||||
m_catandlines.showCatalog();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param aRefundLines
|
||||
*/
|
||||
public void showRefundLines(List aRefundLines) {
|
||||
// anado las lineas de refund
|
||||
// m_reflines.setLines(aRefundLines);
|
||||
m_jbtnconfig.setVisible(false);
|
||||
m_catandlines.showRefundLines(aRefundLines);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected JTicketsBag getJTicketsBag() {
|
||||
return new JTicketsBagTicket(m_App, this);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected Component getSouthComponent() {
|
||||
|
||||
m_catandlines = new JTicketCatalogLines(m_App, this,
|
||||
"true".equals(m_jbtnconfig.getProperty("pricevisible")),
|
||||
"true".equals(m_jbtnconfig.getProperty("taxesincluded")),
|
||||
Integer.parseInt(m_jbtnconfig.getProperty("img-width", "64")),
|
||||
Integer.parseInt(m_jbtnconfig.getProperty("img-height", "54")));
|
||||
m_catandlines.setPreferredSize(new Dimension(0,
|
||||
Integer.parseInt(m_jbtnconfig.getProperty("cat-height", "245"))));
|
||||
m_catandlines.addActionListener(new CatalogListener());
|
||||
return m_catandlines;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void resetSouthComponent() {
|
||||
}
|
||||
|
||||
private class CatalogListener implements ActionListener {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
buttonTransition((ProductInfoExt) e.getSource());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
// 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.sales;
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.pos.catalog.CatalogSelector;
|
||||
import com.unicenta.pos.catalog.JCatalog;
|
||||
import com.unicenta.pos.forms.AppView;
|
||||
import com.unicenta.pos.ticket.ProductInfoExt;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
public class JPanelTicketSales extends JPanelTicket {
|
||||
|
||||
private CatalogSelector m_cat;
|
||||
|
||||
/** Creates a new instance of JPanelTicketSales */
|
||||
public JPanelTicketSales() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param app
|
||||
*/
|
||||
@Override
|
||||
public void init(AppView app) {
|
||||
super.init(app);
|
||||
m_ticketlines.addListSelectionListener(new CatalogSelectionListener());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected Component getSouthComponent() {
|
||||
m_cat = new JCatalog(dlSales,
|
||||
"true".equals(m_jbtnconfig.getProperty("pricevisible")),
|
||||
"true".equals(m_jbtnconfig.getProperty("taxesincluded")),
|
||||
Integer.parseInt(m_jbtnconfig.getProperty("img-width", "64")),
|
||||
Integer.parseInt(m_jbtnconfig.getProperty("img-height", "54")));
|
||||
// Integer.parseInt(m_jbtnconfig.getProperty("img-width", "32")),
|
||||
// Integer.parseInt(m_jbtnconfig.getProperty("img-height", "32")));
|
||||
m_cat.addActionListener(new CatalogListener());
|
||||
m_cat.getComponent().setPreferredSize(new Dimension(
|
||||
0,
|
||||
Integer.parseInt(m_jbtnconfig.getProperty("cat-height", "245"))));
|
||||
return m_cat.getComponent();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void resetSouthComponent() {
|
||||
m_cat.showCatalogPanel(null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected JTicketsBag getJTicketsBag() {
|
||||
return JTicketsBag.createTicketsBag(m_App.getProperties().getProperty("machine.ticketsbag"), m_App, this);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public void activate() throws BasicException {
|
||||
super.activate();
|
||||
m_cat.loadCatalog();
|
||||
}
|
||||
|
||||
public void reLoadCatalog() {
|
||||
try {
|
||||
m_cat.loadCatalog();
|
||||
} catch (BasicException ex) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class CatalogListener implements ActionListener {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
buttonTransition((ProductInfoExt) e.getSource());
|
||||
}
|
||||
}
|
||||
|
||||
private class CatalogSelectionListener implements ListSelectionListener {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
|
||||
if (!e.getValueIsAdjusting()) {
|
||||
int i = m_ticketlines.getSelectedIndex();
|
||||
|
||||
if (i >= 0) {
|
||||
// Look for the first non auxiliar product.
|
||||
while (i >= 0 && m_oTicket.getLine(i).isProductCom()) {
|
||||
i--;
|
||||
}
|
||||
|
||||
// Show the accurate catalog panel...
|
||||
if (i >= 0) {
|
||||
m_cat.showCatalogPanel(m_oTicket.getLine(i).getProductID());
|
||||
} else {
|
||||
m_cat.showCatalogPanel(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="2"/>
|
||||
</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,-124,0,0,2,-110"/>
|
||||
<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="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 class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel5">
|
||||
<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.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.DesignBoxLayout">
|
||||
<Property name="axis" type="int" value="3"/>
|
||||
</Layout>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel3">
|
||||
<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="East"/>
|
||||
</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="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>
|
||||
</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="Last"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
|
||||
<Property name="alignment" type="int" value="2"/>
|
||||
</Layout>
|
||||
<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("{key}")"/>
|
||||
</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>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</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="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/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("{key}")"/>
|
||||
</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>
|
||||
<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>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,426 @@
|
||||
// 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.sales;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.loader.*;
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
import com.unicenta.pos.inventory.AttributeSetInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author adrianromero
|
||||
*/
|
||||
@Slf4j
|
||||
public class JProductAttEdit extends javax.swing.JDialog {
|
||||
|
||||
private SentenceFind attsetSent;
|
||||
private SentenceList attvaluesSent;
|
||||
private SentenceList attinstSent;
|
||||
private SentenceList attinstSent2;
|
||||
private SentenceFind attsetinstExistsSent;
|
||||
|
||||
private SentenceExec attsetSave;
|
||||
private SentenceExec attinstSave;
|
||||
|
||||
private List<JProductAttEditI> itemslist;
|
||||
private String attsetid;
|
||||
private String attInstanceId;
|
||||
private String attInstanceDescription;
|
||||
|
||||
private boolean ok;
|
||||
|
||||
/**
|
||||
* Creates new form JProductAttEdit
|
||||
*/
|
||||
private JProductAttEdit(java.awt.Frame parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates new form JProductAttEdit
|
||||
*/
|
||||
private JProductAttEdit(java.awt.Dialog parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
}
|
||||
|
||||
private void init(Session s) {
|
||||
|
||||
initComponents();
|
||||
|
||||
attsetSave = new PreparedSentence(s,
|
||||
"INSERT INTO attributesetinstance (ID, ATTRIBUTESET_ID, DESCRIPTION) VALUES (?, ?, ?)",
|
||||
new SerializerWriteBasic(Datas.STRING, Datas.STRING, Datas.STRING));
|
||||
attinstSave = new PreparedSentence(s,
|
||||
"INSERT INTO attributeinstance(ID, ATTRIBUTESETINSTANCE_ID, ATTRIBUTE_ID, VALUE) VALUES (?, ?, ?, ?)",
|
||||
new SerializerWriteBasic(Datas.STRING, Datas.STRING, Datas.STRING, Datas.STRING));
|
||||
|
||||
attsetSent = new PreparedSentence(s,
|
||||
"SELECT ID, NAME FROM attributeset WHERE ID = ?",
|
||||
SerializerWriteString.INSTANCE,
|
||||
new SerializerRead() {
|
||||
@Override
|
||||
public Object readValues(DataRead dr) throws BasicException {
|
||||
return new AttributeSetInfo(dr.getString(1), dr.getString(2));
|
||||
}
|
||||
});
|
||||
attsetinstExistsSent = new PreparedSentence(s,
|
||||
"SELECT ID FROM attributesetinstance WHERE ATTRIBUTESET_ID = ? AND DESCRIPTION = ?",
|
||||
new SerializerWriteBasic(Datas.STRING, Datas.STRING),
|
||||
SerializerReadString.INSTANCE);
|
||||
|
||||
attinstSent = new PreparedSentence(s, "SELECT A.ID, A.NAME, " + s.DB.CHAR_NULL() + ", " + s.DB.CHAR_NULL() + " " +
|
||||
"FROM attributeuse AU JOIN attribute A ON AU.ATTRIBUTE_ID = A.ID " +
|
||||
"WHERE AU.ATTRIBUTESET_ID = ? " +
|
||||
"ORDER BY AU.LINENO",
|
||||
SerializerWriteString.INSTANCE,
|
||||
new SerializerRead() {
|
||||
@Override
|
||||
public Object readValues(DataRead dr) throws BasicException {
|
||||
return new AttributeInstInfo(dr.getString(1), dr.getString(2), dr.getString(3), dr.getString(4));
|
||||
}
|
||||
});
|
||||
attinstSent2 = new PreparedSentence(s, "SELECT A.ID, A.NAME, AI.ID, AI.VALUE " +
|
||||
"FROM attributeuse AU JOIN attribute A ON AU.ATTRIBUTE_ID = A.ID LEFT OUTER JOIN attributeinstance AI ON AI.ATTRIBUTE_ID = A.ID " +
|
||||
"WHERE AU.ATTRIBUTESET_ID = ? AND AI.ATTRIBUTESETINSTANCE_ID = ?" +
|
||||
"ORDER BY AU.LINENO",
|
||||
new SerializerWriteBasic(Datas.STRING, Datas.STRING),
|
||||
new SerializerRead() {
|
||||
@Override
|
||||
public Object readValues(DataRead dr) throws BasicException {
|
||||
return new AttributeInstInfo(dr.getString(1), dr.getString(2), dr.getString(3), dr.getString(4));
|
||||
}
|
||||
});
|
||||
attvaluesSent = new PreparedSentence(s, "SELECT VALUE FROM attributevalue WHERE ATTRIBUTE_ID = ? ORDER BY VALUE",
|
||||
SerializerWriteString.INSTANCE,
|
||||
SerializerReadString.INSTANCE);
|
||||
|
||||
getRootPane().setDefaultButton(m_jButtonOK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parent
|
||||
* @param s
|
||||
* @return
|
||||
*/
|
||||
public static JProductAttEdit getAttributesEditor(Component parent, Session s) {
|
||||
|
||||
Window window = SwingUtilities.getWindowAncestor(parent);
|
||||
|
||||
JProductAttEdit myMsg;
|
||||
if (window instanceof Frame) {
|
||||
myMsg = new JProductAttEdit((Frame) window, true);
|
||||
} else {
|
||||
myMsg = new JProductAttEdit((Dialog) window, true);
|
||||
}
|
||||
myMsg.init(s);
|
||||
myMsg.applyComponentOrientation(parent.getComponentOrientation());
|
||||
return myMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param attsetid
|
||||
* @param attsetinstid
|
||||
* @throws BasicException
|
||||
*/
|
||||
public void editAttributes(String attsetid, String attsetinstid) throws BasicException {
|
||||
|
||||
if (attsetid == null) {
|
||||
// throw new BasicException(AppLocal.getIntString("message.attsetnotexists"));
|
||||
throw new BasicException(AppLocal.getIntString("message.cannotfindattributes"));
|
||||
} else {
|
||||
|
||||
this.attsetid = attsetid;
|
||||
this.attInstanceId = null;
|
||||
this.attInstanceDescription = null;
|
||||
|
||||
this.ok = false;
|
||||
|
||||
// get attsetinst values
|
||||
AttributeSetInfo asi = (AttributeSetInfo) attsetSent.find(attsetid);
|
||||
|
||||
if (asi == null) {
|
||||
// throw new BasicException(AppLocal.getIntString("message.attsetnotexists"));
|
||||
throw new BasicException(AppLocal.getIntString("message.cannotfindattributes"));
|
||||
}
|
||||
|
||||
setTitle(asi.getName());
|
||||
|
||||
List<AttributeInstInfo> attinstinfo = attsetinstid == null
|
||||
? attinstSent.list(attsetid)
|
||||
: attinstSent2.list(attsetid, attsetinstid);
|
||||
|
||||
itemslist = new ArrayList<>();
|
||||
|
||||
for (AttributeInstInfo aii : attinstinfo) {
|
||||
|
||||
JProductAttEditI item;
|
||||
|
||||
List<String> values = attvaluesSent.list(aii.getAttid());
|
||||
if (values.isEmpty()) {
|
||||
// Does not exist a list of values then a textfield
|
||||
item = new JProductAttEditItem(aii.getAttid(), aii.getAttname(), aii.getValue(), m_jKeys);
|
||||
} else {
|
||||
// Does exist a list with the values
|
||||
item = new JProductAttListItem(aii.getAttid(), aii.getAttname(), aii.getValue(), values);
|
||||
}
|
||||
|
||||
itemslist.add(item);
|
||||
jPanel2.add(item.getComponent());
|
||||
}
|
||||
|
||||
if (itemslist.size() > 0) {
|
||||
itemslist.get(0).assignSelection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isOK() {
|
||||
return ok;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getAttributeSetInst() {
|
||||
return attInstanceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getAttributeSetInstDescription() {
|
||||
return attInstanceDescription;
|
||||
}
|
||||
|
||||
private static class AttributeInstInfo {
|
||||
|
||||
private String attid;
|
||||
private String attname;
|
||||
private String id;
|
||||
private String value;
|
||||
|
||||
public AttributeInstInfo(String attid, String attname, String id, String value) {
|
||||
this.attid = attid;
|
||||
this.attname = attname;
|
||||
this.id = id;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the attid
|
||||
*/
|
||||
public String getAttid() {
|
||||
return attid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the attname
|
||||
*/
|
||||
public String getAttname() {
|
||||
return attname;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the value
|
||||
*/
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value the value to set
|
||||
*/
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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() {
|
||||
|
||||
jPanel5 = new javax.swing.JPanel();
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
jPanel3 = new javax.swing.JPanel();
|
||||
jPanel4 = new javax.swing.JPanel();
|
||||
m_jKeys = new com.unicenta.editor.JEditorKeys();
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
m_jButtonCancel = new javax.swing.JButton();
|
||||
m_jButtonOK = new javax.swing.JButton();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
|
||||
jPanel5.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
jPanel5.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jPanel2.setLayout(new javax.swing.BoxLayout(jPanel2, javax.swing.BoxLayout.PAGE_AXIS));
|
||||
jPanel5.add(jPanel2, java.awt.BorderLayout.NORTH);
|
||||
|
||||
getContentPane().add(jPanel5, java.awt.BorderLayout.CENTER);
|
||||
|
||||
jPanel3.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
jPanel3.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jPanel4.setLayout(new javax.swing.BoxLayout(jPanel4, javax.swing.BoxLayout.Y_AXIS));
|
||||
jPanel4.add(m_jKeys);
|
||||
|
||||
jPanel3.add(jPanel4, java.awt.BorderLayout.NORTH);
|
||||
|
||||
jPanel1.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
|
||||
|
||||
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.setRequestFocusEnabled(false);
|
||||
m_jButtonCancel.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jButtonCancelActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel1.add(m_jButtonCancel);
|
||||
|
||||
m_jButtonOK.setFont(new java.awt.Font("Arial", 0, 12)); // 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.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);
|
||||
}
|
||||
});
|
||||
jPanel1.add(m_jButtonOK);
|
||||
|
||||
jPanel3.add(jPanel1, java.awt.BorderLayout.PAGE_END);
|
||||
|
||||
getContentPane().add(jPanel3, java.awt.BorderLayout.EAST);
|
||||
|
||||
setSize(new java.awt.Dimension(658, 388));
|
||||
setLocationRelativeTo(null);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void m_jButtonOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jButtonOKActionPerformed
|
||||
|
||||
StringBuilder description = new StringBuilder();
|
||||
for (JProductAttEditI item : itemslist) {
|
||||
String value = item.getValue();
|
||||
if (value != null && value.length() > 0) {
|
||||
if (description.length() > 0) {
|
||||
description.append(", ");
|
||||
}
|
||||
description.append(value);
|
||||
}
|
||||
}
|
||||
|
||||
String id;
|
||||
|
||||
if (description.length() == 0) {
|
||||
// No values then id is null
|
||||
id = null;
|
||||
} else {
|
||||
// Some values then an instance should exists.
|
||||
try {
|
||||
// Exist an attribute set instance with these values for the attributeset selected
|
||||
id = (String) attsetinstExistsSent.find(attsetid, description.toString());
|
||||
} catch (BasicException ex) {
|
||||
log.error(ex.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (id == null) {
|
||||
// No, create a new ATTRIBUTESETINSTANCE and return the ID generated
|
||||
// or return null... That means that that product does not exists....
|
||||
// Maybe these two modes must be supported one for selection and other for creation....
|
||||
id = UUID.randomUUID().toString();
|
||||
try {
|
||||
attsetSave.exec(id, attsetid, description.toString());
|
||||
for (JProductAttEditI item : itemslist) {
|
||||
attinstSave.exec(UUID.randomUUID().toString(), id, item.getAttribute(), item.getValue());
|
||||
}
|
||||
|
||||
} catch (BasicException ex) {
|
||||
log.error(ex.getMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ok = true;
|
||||
attInstanceId = id;
|
||||
attInstanceDescription = description.toString();
|
||||
|
||||
dispose();
|
||||
}//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
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
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.JButton m_jButtonCancel;
|
||||
private javax.swing.JButton m_jButtonOK;
|
||||
private com.unicenta.editor.JEditorKeys m_jKeys;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="2"/>
|
||||
</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,-124,0,0,2,-110"/>
|
||||
<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="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 class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel5">
|
||||
<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.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.DesignBoxLayout">
|
||||
<Property name="axis" type="int" value="3"/>
|
||||
</Layout>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel3">
|
||||
<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="East"/>
|
||||
</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="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>
|
||||
</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="Last"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
|
||||
<Property name="alignment" type="int" value="2"/>
|
||||
</Layout>
|
||||
<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("{key}")"/>
|
||||
</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>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</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="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/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("{key}")"/>
|
||||
</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>
|
||||
<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>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,427 @@
|
||||
// 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.sales;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.loader.*;
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
import com.unicenta.pos.inventory.AttributeSetInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author adrianromero
|
||||
*/
|
||||
@Slf4j
|
||||
public class JProductAttEdit1 extends javax.swing.JDialog {
|
||||
|
||||
private SentenceFind attsetSent;
|
||||
private SentenceList attvaluesSent;
|
||||
private SentenceList attinstSent;
|
||||
private SentenceList attinstSent2;
|
||||
private SentenceFind attsetinstExistsSent;
|
||||
|
||||
private SentenceExec attsetSave;
|
||||
private SentenceExec attinstSave;
|
||||
|
||||
private List<JProductAttEditI> itemslist;
|
||||
private String attsetid;
|
||||
private String attInstanceId;
|
||||
private String attInstanceDescription;
|
||||
|
||||
private boolean ok;
|
||||
|
||||
/**
|
||||
* Creates new form JProductAttEdit
|
||||
*/
|
||||
private JProductAttEdit1(java.awt.Frame parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates new form JProductAttEdit
|
||||
*/
|
||||
private JProductAttEdit1(java.awt.Dialog parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
}
|
||||
|
||||
private void init(Session s) {
|
||||
|
||||
initComponents();
|
||||
|
||||
attsetSave = new PreparedSentence(s,
|
||||
"INSERT INTO attributesetinstance (ID, ATTRIBUTESET_ID, DESCRIPTION) VALUES (?, ?, ?)",
|
||||
new SerializerWriteBasic(Datas.STRING, Datas.STRING, Datas.STRING));
|
||||
attinstSave = new PreparedSentence(s,
|
||||
"INSERT INTO attributeinstance(ID, ATTRIBUTESETINSTANCE_ID, ATTRIBUTE_ID, VALUE) VALUES (?, ?, ?, ?)",
|
||||
new SerializerWriteBasic(Datas.STRING, Datas.STRING, Datas.STRING, Datas.STRING));
|
||||
|
||||
attsetSent = new PreparedSentence(s,
|
||||
"SELECT ID, NAME FROM attributeset WHERE ID = ?",
|
||||
SerializerWriteString.INSTANCE,
|
||||
new SerializerRead() {
|
||||
@Override
|
||||
public Object readValues(DataRead dr) throws BasicException {
|
||||
return new AttributeSetInfo(dr.getString(1), dr.getString(2));
|
||||
}
|
||||
});
|
||||
attsetinstExistsSent = new PreparedSentence(s,
|
||||
"SELECT ID FROM attributesetinstance WHERE ATTRIBUTESET_ID = ? AND DESCRIPTION = ?",
|
||||
new SerializerWriteBasic(Datas.STRING, Datas.STRING),
|
||||
SerializerReadString.INSTANCE);
|
||||
|
||||
attinstSent = new PreparedSentence(s, "SELECT A.ID, A.NAME, " + s.DB.CHAR_NULL() + ", " + s.DB.CHAR_NULL() + " " +
|
||||
"FROM attributeuse AU JOIN ATTRIBUTE A ON AU.ATTRIBUTE_ID = A.ID " +
|
||||
"WHERE AU.ATTRIBUTESET_ID = ? " +
|
||||
"ORDER BY AU.LINENO",
|
||||
SerializerWriteString.INSTANCE,
|
||||
new SerializerRead() {
|
||||
@Override
|
||||
public Object readValues(DataRead dr) throws BasicException {
|
||||
return new AttributeInstInfo(dr.getString(1), dr.getString(2), dr.getString(3), dr.getString(4));
|
||||
}
|
||||
});
|
||||
attinstSent2 = new PreparedSentence(s, "SELECT A.ID, A.NAME, AI.ID, AI.VALUE " +
|
||||
"FROM attributeuse AU JOIN ATTRIBUTE A ON AU.ATTRIBUTE_ID = A.ID LEFT OUTER JOIN attributeinstance AI ON AI.ATTRIBUTE_ID = A.ID " +
|
||||
"WHERE AU.ATTRIBUTESET_ID = ? AND AI.ATTRIBUTESETINSTANCE_ID = ?" +
|
||||
"ORDER BY AU.LINENO",
|
||||
new SerializerWriteBasic(Datas.STRING, Datas.STRING),
|
||||
new SerializerRead() {
|
||||
@Override
|
||||
public Object readValues(DataRead dr) throws BasicException {
|
||||
return new AttributeInstInfo(dr.getString(1), dr.getString(2), dr.getString(3), dr.getString(4));
|
||||
}
|
||||
});
|
||||
attvaluesSent = new PreparedSentence(s, "SELECT VALUE FROM attributevalue WHERE ATTRIBUTE_ID = ? ORDER BY VALUE",
|
||||
SerializerWriteString.INSTANCE,
|
||||
SerializerReadString.INSTANCE);
|
||||
|
||||
getRootPane().setDefaultButton(m_jButtonOK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parent
|
||||
* @param s
|
||||
* @return
|
||||
*/
|
||||
public static JProductAttEdit1 getAttributesEditor(Component parent, Session s) {
|
||||
|
||||
Window window = SwingUtilities.getWindowAncestor(parent);
|
||||
|
||||
JProductAttEdit1 myMsg;
|
||||
if (window instanceof Frame) {
|
||||
myMsg = new JProductAttEdit1((Frame) window, true);
|
||||
} else {
|
||||
myMsg = new JProductAttEdit1((Dialog) window, true);
|
||||
}
|
||||
myMsg.init(s);
|
||||
myMsg.applyComponentOrientation(parent.getComponentOrientation());
|
||||
return myMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param attsetid
|
||||
* @param attsetinstid
|
||||
* @throws BasicException
|
||||
*/
|
||||
public void editAttributes(String attsetid, String attsetinstid) throws BasicException {
|
||||
|
||||
if (attsetid == null) {
|
||||
// throw new BasicException(AppLocal.getIntString("message.attsetnotexists"));
|
||||
throw new BasicException(AppLocal.getIntString("message.cannotfindattributes"));
|
||||
} else {
|
||||
|
||||
this.attsetid = attsetid;
|
||||
this.attInstanceId = null;
|
||||
this.attInstanceDescription = null;
|
||||
|
||||
this.ok = false;
|
||||
|
||||
// get attsetinst values
|
||||
AttributeSetInfo asi = (AttributeSetInfo) attsetSent.find(attsetid);
|
||||
|
||||
if (asi == null) {
|
||||
// throw new BasicException(AppLocal.getIntString("message.attsetnotexists"));
|
||||
throw new BasicException(AppLocal.getIntString("message.cannotfindattributes"));
|
||||
}
|
||||
|
||||
setTitle(asi.getName());
|
||||
|
||||
List<AttributeInstInfo> attinstinfo = attsetinstid == null
|
||||
? attinstSent.list(attsetid)
|
||||
: attinstSent2.list(attsetid, attsetinstid);
|
||||
|
||||
itemslist = new ArrayList<>();
|
||||
|
||||
for (AttributeInstInfo aii : attinstinfo) {
|
||||
|
||||
JProductAttEditI item;
|
||||
|
||||
List<String> values = attvaluesSent.list(aii.getAttid());
|
||||
if (values.isEmpty()) {
|
||||
// Does not exist a list of values then a textfield
|
||||
item = new JProductAttEditItem(aii.getAttid(), aii.getAttname(), aii.getValue(), m_jKeys);
|
||||
} else {
|
||||
// Does exist a list with the values
|
||||
item = new JProductAttListItem(aii.getAttid(), aii.getAttname(), aii.getValue(), values);
|
||||
}
|
||||
|
||||
itemslist.add(item);
|
||||
jPanel2.add(item.getComponent());
|
||||
}
|
||||
|
||||
if (itemslist.size() > 0) {
|
||||
itemslist.get(0).assignSelection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isOK() {
|
||||
return ok;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getAttributeSetInst() {
|
||||
return attInstanceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getAttributeSetInstDescription() {
|
||||
return attInstanceDescription;
|
||||
}
|
||||
|
||||
private static class AttributeInstInfo {
|
||||
|
||||
private String attid;
|
||||
private String attname;
|
||||
private String id;
|
||||
private String value;
|
||||
|
||||
public AttributeInstInfo(String attid, String attname, String id, String value) {
|
||||
this.attid = attid;
|
||||
this.attname = attname;
|
||||
this.id = id;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the attid
|
||||
*/
|
||||
public String getAttid() {
|
||||
return attid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the attname
|
||||
*/
|
||||
public String getAttname() {
|
||||
return attname;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the value
|
||||
*/
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value the value to set
|
||||
*/
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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() {
|
||||
|
||||
jPanel5 = new javax.swing.JPanel();
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
jPanel3 = new javax.swing.JPanel();
|
||||
jPanel4 = new javax.swing.JPanel();
|
||||
m_jKeys = new com.unicenta.editor.JEditorKeys();
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
m_jButtonCancel = new javax.swing.JButton();
|
||||
m_jButtonOK = new javax.swing.JButton();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
|
||||
jPanel5.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
jPanel5.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jPanel2.setLayout(new javax.swing.BoxLayout(jPanel2, javax.swing.BoxLayout.PAGE_AXIS));
|
||||
jPanel5.add(jPanel2, java.awt.BorderLayout.NORTH);
|
||||
|
||||
getContentPane().add(jPanel5, java.awt.BorderLayout.CENTER);
|
||||
|
||||
jPanel3.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
jPanel3.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jPanel4.setLayout(new javax.swing.BoxLayout(jPanel4, javax.swing.BoxLayout.Y_AXIS));
|
||||
jPanel4.add(m_jKeys);
|
||||
|
||||
jPanel3.add(jPanel4, java.awt.BorderLayout.NORTH);
|
||||
|
||||
jPanel1.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
|
||||
|
||||
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.setRequestFocusEnabled(false);
|
||||
m_jButtonCancel.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jButtonCancelActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel1.add(m_jButtonCancel);
|
||||
|
||||
m_jButtonOK.setFont(new java.awt.Font("Arial", 0, 12)); // 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.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);
|
||||
}
|
||||
});
|
||||
jPanel1.add(m_jButtonOK);
|
||||
|
||||
jPanel3.add(jPanel1, java.awt.BorderLayout.PAGE_END);
|
||||
|
||||
getContentPane().add(jPanel3, java.awt.BorderLayout.EAST);
|
||||
|
||||
setSize(new java.awt.Dimension(658, 388));
|
||||
setLocationRelativeTo(null);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void m_jButtonOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jButtonOKActionPerformed
|
||||
|
||||
StringBuilder description = new StringBuilder();
|
||||
for (JProductAttEditI item : itemslist) {
|
||||
String value = item.getValue();
|
||||
if (value != null && value.length() > 0) {
|
||||
if (description.length() > 0) {
|
||||
description.append(", ");
|
||||
}
|
||||
description.append(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String id;
|
||||
|
||||
if (description.length() == 0) {
|
||||
// No values then id is null
|
||||
id = null;
|
||||
} else {
|
||||
// Some values then an instance should exists.
|
||||
try {
|
||||
// Exist an attribute set instance with these values for the attributeset selected
|
||||
id = (String) attsetinstExistsSent.find(attsetid, description.toString());
|
||||
} catch (BasicException ex) {
|
||||
log.error(ex.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (id == null) {
|
||||
// No, create a new ATTRIBUTESETINSTANCE and return the ID generated
|
||||
// or return null... That means that that product does not exists....
|
||||
// Maybe these two modes must be supported one for selection and other for creation....
|
||||
id = UUID.randomUUID().toString();
|
||||
try {
|
||||
attsetSave.exec(id, attsetid, description.toString());
|
||||
for (JProductAttEditI item : itemslist) {
|
||||
attinstSave.exec(UUID.randomUUID().toString(), id, item.getAttribute(), item.getValue());
|
||||
}
|
||||
|
||||
} catch (BasicException ex) {
|
||||
log.error(ex.getMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ok = true;
|
||||
attInstanceId = id;
|
||||
attInstanceDescription = description.toString();
|
||||
|
||||
dispose();
|
||||
}//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
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
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.JButton m_jButtonCancel;
|
||||
private javax.swing.JButton m_jButtonOK;
|
||||
private com.unicenta.editor.JEditorKeys m_jKeys;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="2"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[300, 250]"/>
|
||||
</Property>
|
||||
</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,-124,0,0,2,-112"/>
|
||||
<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="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 class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel5">
|
||||
<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.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.DesignBoxLayout">
|
||||
<Property name="axis" type="int" value="3"/>
|
||||
</Layout>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel3">
|
||||
<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="East"/>
|
||||
</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="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>
|
||||
</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="Last"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
|
||||
<Property name="alignment" type="int" value="2"/>
|
||||
</Layout>
|
||||
<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("{key}")"/>
|
||||
</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>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</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="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/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("{key}")"/>
|
||||
</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>
|
||||
<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>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,426 @@
|
||||
// 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.sales;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.loader.DataRead;
|
||||
import com.unicenta.data.loader.Datas;
|
||||
import com.unicenta.data.loader.PreparedSentence;
|
||||
import com.unicenta.data.loader.SentenceExec;
|
||||
import com.unicenta.data.loader.SentenceFind;
|
||||
import com.unicenta.data.loader.SentenceList;
|
||||
import com.unicenta.data.loader.SerializerRead;
|
||||
import com.unicenta.data.loader.SerializerReadString;
|
||||
import com.unicenta.data.loader.SerializerWriteBasic;
|
||||
import com.unicenta.data.loader.SerializerWriteString;
|
||||
import com.unicenta.data.loader.Session;
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
import com.unicenta.pos.inventory.AttributeSetInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Dialog;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Window;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
/**
|
||||
* @author adrianromero
|
||||
*/
|
||||
@Slf4j
|
||||
public class JProductAttEdit2 extends javax.swing.JDialog {
|
||||
|
||||
private SentenceFind attsetSent;
|
||||
private SentenceList attvaluesSent;
|
||||
private SentenceList attinstSent;
|
||||
private SentenceList attinstSent2;
|
||||
private SentenceFind attsetinstExistsSent;
|
||||
|
||||
private SentenceExec attsetSave;
|
||||
private SentenceExec attinstSave;
|
||||
|
||||
private List<JProductAttEditI> itemslist;
|
||||
private String attsetid;
|
||||
private String attInstanceId;
|
||||
private String attInstanceDescription;
|
||||
|
||||
private boolean ok;
|
||||
|
||||
/**
|
||||
* Creates new form JProductAttEdit
|
||||
*/
|
||||
private JProductAttEdit2(java.awt.Frame parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates new form JProductAttEdit
|
||||
*/
|
||||
private JProductAttEdit2(java.awt.Dialog parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
}
|
||||
|
||||
private void init(Session s) {
|
||||
|
||||
initComponents();
|
||||
|
||||
attsetSave = new PreparedSentence(s,
|
||||
"INSERT INTO attributesetinstance (ID, ATTRIBUTESET_ID, DESCRIPTION) VALUES (?, ?, ?)",
|
||||
new SerializerWriteBasic(Datas.STRING, Datas.STRING, Datas.STRING));
|
||||
attinstSave = new PreparedSentence(s,
|
||||
"INSERT INTO attributeinstance(ID, ATTRIBUTESETINSTANCE_ID, ATTRIBUTE_ID, VALUE) VALUES (?, ?, ?, ?)",
|
||||
new SerializerWriteBasic(Datas.STRING, Datas.STRING, Datas.STRING, Datas.STRING));
|
||||
|
||||
attsetSent = new PreparedSentence(s,
|
||||
"SELECT ID, NAME FROM attributeset WHERE ID = ?",
|
||||
SerializerWriteString.INSTANCE,
|
||||
(DataRead dr) -> new AttributeSetInfo(dr.getString(1), dr.getString(2)));
|
||||
attsetinstExistsSent = new PreparedSentence(s,
|
||||
// "SELECT ID FROM attributesetinstance WHERE ATTRIBUTESET_ID = ? AND DESCRIPTION = ?",
|
||||
"SELECT ID, DESCRIPTION FROM attributesetinstance WHERE ATTRIBUTESET_ID = ? AND DESCRIPTION = ?",
|
||||
new SerializerWriteBasic(Datas.STRING, Datas.STRING),
|
||||
SerializerReadString.INSTANCE);
|
||||
|
||||
attinstSent = new PreparedSentence(s, "SELECT A.ID, A.NAME, " + s.DB.CHAR_NULL() + ", " + s.DB.CHAR_NULL() + " " +
|
||||
"FROM attributeuse AU JOIN attribute A ON AU.ATTRIBUTE_ID = A.ID " +
|
||||
"WHERE AU.ATTRIBUTESET_ID = ? " +
|
||||
"ORDER BY AU.LINENO",
|
||||
SerializerWriteString.INSTANCE,
|
||||
(DataRead dr) -> new AttributeInstInfo(dr.getString(1), dr.getString(2), dr.getString(3), dr.getString(4)));
|
||||
attinstSent2 = new PreparedSentence(s, "SELECT A.ID, A.NAME, AI.ID, AI.VALUE " +
|
||||
"FROM attributeuse AU JOIN attribute A ON AU.ATTRIBUTE_ID = A.ID LEFT OUTER JOIN attributeinstance AI ON AI.ATTRIBUTE_ID = A.ID " +
|
||||
"WHERE AU.ATTRIBUTESET_ID = ? AND AI.ATTRIBUTESETINSTANCE_ID = ?" +
|
||||
"ORDER BY AU.LINENO",
|
||||
new SerializerWriteBasic(Datas.STRING, Datas.STRING),
|
||||
(DataRead dr) -> new AttributeInstInfo(dr.getString(1), dr.getString(2), dr.getString(3), dr.getString(4)));
|
||||
attvaluesSent = new PreparedSentence(s, "SELECT VALUE FROM attributevalue WHERE ATTRIBUTE_ID = ? ORDER BY VALUE",
|
||||
SerializerWriteString.INSTANCE,
|
||||
SerializerReadString.INSTANCE);
|
||||
|
||||
getRootPane().setDefaultButton(m_jButtonOK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parent
|
||||
* @param s
|
||||
* @return
|
||||
*/
|
||||
public static JProductAttEdit2 getAttributesEditor(Component parent, Session s) {
|
||||
|
||||
Window window = SwingUtilities.getWindowAncestor(parent);
|
||||
|
||||
JProductAttEdit2 myMsg;
|
||||
if (window instanceof Frame) {
|
||||
myMsg = new JProductAttEdit2((Frame) window, true);
|
||||
} else {
|
||||
myMsg = new JProductAttEdit2((Dialog) window, true);
|
||||
}
|
||||
myMsg.init(s);
|
||||
myMsg.applyComponentOrientation(parent.getComponentOrientation());
|
||||
return myMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param attsetid
|
||||
* @param attsetinstid
|
||||
* @throws BasicException
|
||||
*/
|
||||
public void editAttributes(String attsetid, String attsetinstid) throws BasicException {
|
||||
|
||||
if (attsetid == null) {
|
||||
// throw new BasicException(AppLocal.getIntString("message.attsetnotexists"));
|
||||
throw new BasicException(AppLocal.getIntString("message.cannotfindattributes"));
|
||||
} else {
|
||||
|
||||
this.attsetid = attsetid;
|
||||
this.attInstanceId = null;
|
||||
this.attInstanceDescription = null;
|
||||
|
||||
this.ok = false;
|
||||
|
||||
// get attsetinst values
|
||||
AttributeSetInfo asi = (AttributeSetInfo) attsetSent.find(attsetid);
|
||||
|
||||
if (asi == null) {
|
||||
// throw new BasicException(AppLocal.getIntString("message.attsetnotexists"));
|
||||
throw new BasicException(AppLocal.getIntString("message.cannotfindattributes"));
|
||||
}
|
||||
|
||||
setTitle(asi.getName());
|
||||
|
||||
List<AttributeInstInfo> attinstinfo = attsetinstid == null
|
||||
? attinstSent.list(attsetid)
|
||||
: attinstSent2.list(attsetid, attsetinstid);
|
||||
|
||||
itemslist = new ArrayList<>();
|
||||
|
||||
for (AttributeInstInfo aii : attinstinfo) {
|
||||
|
||||
JProductAttEditI item;
|
||||
|
||||
List<String> values = attvaluesSent.list(aii.getAttid());
|
||||
if (values.isEmpty()) {
|
||||
// Does not exist a list of values then a textfield
|
||||
item = new JProductAttEditItem(aii.getAttid(), aii.getAttname(), aii.getValue(), m_jKeys);
|
||||
} else {
|
||||
// Does exist a list with the values
|
||||
item = new JProductAttListItem(aii.getAttid(), aii.getAttname(), aii.getValue(), values);
|
||||
}
|
||||
|
||||
itemslist.add(item);
|
||||
jPanel2.add(item.getComponent());
|
||||
}
|
||||
|
||||
if (itemslist.size() > 0) {
|
||||
itemslist.get(0).assignSelection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isOK() {
|
||||
return ok;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getAttributeSetInst() {
|
||||
return attInstanceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public String getAttributeSetInstDescription() {
|
||||
return attInstanceDescription;
|
||||
}
|
||||
|
||||
private static class AttributeInstInfo {
|
||||
|
||||
private final String attid;
|
||||
private final String attname;
|
||||
private String id;
|
||||
private String value;
|
||||
|
||||
public AttributeInstInfo(String attid, String attname, String id, String value) {
|
||||
this.attid = attid;
|
||||
this.attname = attname;
|
||||
this.id = id;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the attid
|
||||
*/
|
||||
public String getAttid() {
|
||||
return attid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the attname
|
||||
*/
|
||||
public String getAttname() {
|
||||
return attname;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the value
|
||||
*/
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value the value to set
|
||||
*/
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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() {
|
||||
|
||||
jPanel5 = new javax.swing.JPanel();
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
jPanel3 = new javax.swing.JPanel();
|
||||
jPanel4 = new javax.swing.JPanel();
|
||||
m_jKeys = new com.unicenta.editor.JEditorKeys();
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
m_jButtonCancel = new javax.swing.JButton();
|
||||
m_jButtonOK = new javax.swing.JButton();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
setPreferredSize(new java.awt.Dimension(300, 250));
|
||||
|
||||
jPanel5.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
jPanel5.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jPanel2.setLayout(new javax.swing.BoxLayout(jPanel2, javax.swing.BoxLayout.PAGE_AXIS));
|
||||
jPanel5.add(jPanel2, java.awt.BorderLayout.NORTH);
|
||||
|
||||
getContentPane().add(jPanel5, java.awt.BorderLayout.CENTER);
|
||||
|
||||
jPanel3.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
jPanel3.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jPanel4.setLayout(new javax.swing.BoxLayout(jPanel4, javax.swing.BoxLayout.Y_AXIS));
|
||||
jPanel4.add(m_jKeys);
|
||||
|
||||
jPanel3.add(jPanel4, java.awt.BorderLayout.NORTH);
|
||||
|
||||
jPanel1.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
|
||||
|
||||
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.setRequestFocusEnabled(false);
|
||||
m_jButtonCancel.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jButtonCancelActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel1.add(m_jButtonCancel);
|
||||
|
||||
m_jButtonOK.setFont(new java.awt.Font("Arial", 0, 12)); // 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.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);
|
||||
}
|
||||
});
|
||||
jPanel1.add(m_jButtonOK);
|
||||
|
||||
jPanel3.add(jPanel1, java.awt.BorderLayout.PAGE_END);
|
||||
|
||||
getContentPane().add(jPanel3, java.awt.BorderLayout.EAST);
|
||||
|
||||
setSize(new java.awt.Dimension(656, 388));
|
||||
setLocationRelativeTo(null);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void m_jButtonOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jButtonOKActionPerformed
|
||||
|
||||
StringBuilder description = new StringBuilder();
|
||||
itemslist.stream().map((item) -> item.getValue())
|
||||
.filter((value) -> (value != null && value.length() > 0))
|
||||
.forEach((value) -> {
|
||||
if (description.length() > 0) {
|
||||
description.append(", ");
|
||||
}
|
||||
description.append(value);
|
||||
});
|
||||
|
||||
String id;
|
||||
|
||||
if (description.length() == 0) {
|
||||
id = null;
|
||||
} else {
|
||||
|
||||
try {
|
||||
|
||||
id = (String) attsetinstExistsSent.find(attsetid, description.toString());
|
||||
|
||||
} catch (BasicException ex) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (id == null) {
|
||||
// if (id == null ? (String.valueOf(description)) != null : !id.equals(String.valueOf(description))) {
|
||||
// Now creates a new ATTRIBUTESETINSTANCE and returns the ID generated
|
||||
// to allow for ad-hoc user input i.e.: Serial No
|
||||
|
||||
id = UUID.randomUUID().toString();
|
||||
|
||||
try {
|
||||
attsetSave.exec(id, attsetid, description.toString());
|
||||
|
||||
for (JProductAttEditI item : itemslist) {
|
||||
attinstSave.exec(UUID.randomUUID().toString(), id, item.getAttribute(), item.getValue());
|
||||
}
|
||||
|
||||
} catch (BasicException ex) {
|
||||
log.error(ex.getMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ok = true;
|
||||
attInstanceId = id;
|
||||
attInstanceDescription = description.toString();
|
||||
|
||||
dispose();
|
||||
}//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
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
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.JButton m_jButtonCancel;
|
||||
private javax.swing.JButton m_jButtonOK;
|
||||
private com.unicenta.editor.JEditorKeys m_jKeys;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// 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.sales;
|
||||
|
||||
import java.awt.Component;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author adrianromero
|
||||
*/
|
||||
public interface JProductAttEditI {
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getAttribute();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getValue();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Component getComponent();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void assignSelection();
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.7" 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" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jValue" min="-2" pref="224" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="56" 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="0" max="-2" attributes="0">
|
||||
<Component id="jLabel1" alignment="1" max="32767" attributes="1"/>
|
||||
<Component id="jValue" alignment="1" max="32767" attributes="1"/>
|
||||
</Group>
|
||||
</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" value="jLabel1"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="com.unicenta.editor.JEditorString" name="jValue">
|
||||
<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="[0, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,129 @@
|
||||
// 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.sales;
|
||||
|
||||
import com.unicenta.editor.JEditorKeys;
|
||||
import java.awt.Component;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author adrian
|
||||
*/
|
||||
public class JProductAttEditItem extends javax.swing.JPanel implements JProductAttEditI {
|
||||
|
||||
private String attid;
|
||||
|
||||
/** Creates new form JProductAttEditItem
|
||||
* @param attid
|
||||
* @param label
|
||||
* @param value
|
||||
* @param keys */
|
||||
public JProductAttEditItem(String attid, String label, String value, JEditorKeys keys) {
|
||||
|
||||
this.attid = attid;
|
||||
|
||||
initComponents();
|
||||
|
||||
jLabel1.setText(label);
|
||||
|
||||
jValue.addEditorKeys(keys);
|
||||
jValue.setText(value);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void assignSelection() {
|
||||
jValue.activate();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getAttribute() {
|
||||
return attid;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getValue() {
|
||||
return jValue.getText();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
jValue = new com.unicenta.editor.JEditorString();
|
||||
|
||||
jLabel1.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel1.setText("jLabel1");
|
||||
jLabel1.setPreferredSize(new java.awt.Dimension(110, 30));
|
||||
|
||||
jValue.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jValue.setPreferredSize(new java.awt.Dimension(0, 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()
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jValue, javax.swing.GroupLayout.PREFERRED_SIZE, 224, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(56, 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.LEADING, false)
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jValue, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 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 com.unicenta.editor.JEditorString jValue;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.7" 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 max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jValues" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="66" 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="jLabel1" alignment="3" min="-2" max="-2" attributes="1"/>
|
||||
<Component id="jValues" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</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" value="jLabel1"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="jValues">
|
||||
<Properties>
|
||||
<Property name="editable" type="boolean" value="true"/>
|
||||
<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>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jValuesActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,151 @@
|
||||
// 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.sales;
|
||||
|
||||
import com.unicenta.data.gui.ComboBoxValModel;
|
||||
import java.awt.Component;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author JG
|
||||
* @author adrian
|
||||
*/
|
||||
public class JProductAttListItem extends javax.swing.JPanel implements JProductAttEditI {
|
||||
|
||||
private final String attid;
|
||||
private ComboBoxValModel model;
|
||||
|
||||
/** Creates new form JProductAttListItem
|
||||
* @param attid
|
||||
* @param label
|
||||
* @param value
|
||||
* @param values */
|
||||
public JProductAttListItem(String attid, String label, String value, List<String> values) {
|
||||
|
||||
this.attid = attid;
|
||||
|
||||
initComponents();
|
||||
|
||||
jLabel1.setText(label);
|
||||
|
||||
values.stream().forEach((item) -> {
|
||||
jValues.addItem(item);
|
||||
});
|
||||
jValues.setSelectedItem(value);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void assignSelection() {
|
||||
java.awt.EventQueue.invokeLater(() -> {
|
||||
jValues.requestFocus();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getAttribute() {
|
||||
return attid;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getValue() {
|
||||
if (jValues.getSelectedItem() == null) {
|
||||
return (String) jValues.getEditor().getItem();
|
||||
} else {
|
||||
return (String) jValues.getSelectedItem();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
jValues = new javax.swing.JComboBox();
|
||||
|
||||
jLabel1.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel1.setText("jLabel1");
|
||||
jLabel1.setPreferredSize(new java.awt.Dimension(110, 30));
|
||||
|
||||
jValues.setEditable(true);
|
||||
jValues.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jValues.setPreferredSize(new java.awt.Dimension(200, 30));
|
||||
jValues.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jValuesActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
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()
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jValues, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(66, Short.MAX_VALUE))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(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(jValues, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void jValuesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jValuesActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_jValuesActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JComboBox jValues;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,492 @@
|
||||
<?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="label.editline" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[650, 350]"/>
|
||||
</Property>
|
||||
</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,-118,0,0,2,-60"/>
|
||||
<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="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 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="jPanel2">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[400, 230]"/>
|
||||
</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" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="m_jUnits" min="-2" pref="100" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="m_jPriceTax" min="-2" pref="150" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="m_jPrice" min="-2" pref="150" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jLabel5" min="-2" max="-2" 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_jSubtotal" min="-2" pref="120" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="116" max="-2" attributes="0"/>
|
||||
<Component id="m_jTaxrate" min="-2" pref="120" 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"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="m_jBtnPriceUpdate" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="m_jTotal" min="-2" pref="120" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="m_jName" min="-2" pref="354" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="60" max="-2" 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"/>
|
||||
<Component id="m_jName" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="m_jUnits" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="m_jPrice" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" 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="jLabel3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="m_jPriceTax" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="9" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="1" pref="1" max="-2" attributes="0"/>
|
||||
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="m_jTaxrate" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="m_jSubtotal" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="m_jTotal" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="19" max="32767" attributes="0"/>
|
||||
<Component id="m_jBtnPriceUpdate" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" 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.price" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 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.units" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 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.pricetax" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="com.unicenta.editor.JEditorString" name="m_jName">
|
||||
<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="[132, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="com.unicenta.editor.JEditorDouble" name="m_jUnits">
|
||||
<Properties>
|
||||
<Property name="enabled" 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="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[132, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="com.unicenta.editor.JEditorCurrency" name="m_jPrice">
|
||||
<Properties>
|
||||
<Property name="enabled" 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="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[132, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="com.unicenta.editor.JEditorCurrency" name="m_jPriceTax">
|
||||
<Properties>
|
||||
<Property name="enabled" 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="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[132, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="m_jTaxrate">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="e4" green="eb" id="TextField.disabledBackground" palette="3" red="eb" type="palette"/>
|
||||
</Property>
|
||||
<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="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="[150, 25]"/>
|
||||
</Property>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<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="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.tax" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 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.totalcash" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="m_jTotal">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="e4" green="eb" id="TextField.disabledBackground" palette="3" red="eb" type="palette"/>
|
||||
</Property>
|
||||
<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="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="[150, 25]"/>
|
||||
</Property>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</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.subtotalcash" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="m_jSubtotal">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="e4" green="eb" id="TextField.disabledBackground" palette="3" red="eb" type="palette"/>
|
||||
</Property>
|
||||
<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="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="[150, 25]"/>
|
||||
</Property>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="m_jBtnPriceUpdate">
|
||||
<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/filesave.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="button.priceupdate" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</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>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jBtnPriceUpdateActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel3">
|
||||
<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="jPanel4">
|
||||
<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>
|
||||
<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="South"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
|
||||
<Property name="alignment" type="int" value="2"/>
|
||||
</Layout>
|
||||
<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("{key}")"/>
|
||||
</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>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</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="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/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("{key}")"/>
|
||||
</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>
|
||||
<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>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,566 @@
|
||||
// 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.sales;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.loader.Session;
|
||||
import com.unicenta.pos.forms.AppConfig;
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
import com.unicenta.pos.forms.AppView;
|
||||
import com.unicenta.pos.ticket.TicketLineInfo;
|
||||
import com.unicenta.pos.util.AltEncrypter;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author adrianromero
|
||||
*/
|
||||
public class JProductLineEdit extends javax.swing.JDialog {
|
||||
|
||||
private TicketLineInfo returnLine;
|
||||
private TicketLineInfo m_oLine;
|
||||
private boolean m_bunitsok;
|
||||
private boolean m_bpriceok;
|
||||
private String productID;
|
||||
private Session s;
|
||||
private Connection con;
|
||||
private String SQL;
|
||||
private PreparedStatement pstmt;
|
||||
|
||||
/** Creates new form JProductLineEdit */
|
||||
private JProductLineEdit(java.awt.Frame parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
}
|
||||
/** Creates new form JProductLineEdit */
|
||||
private JProductLineEdit(java.awt.Dialog parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
}
|
||||
|
||||
private TicketLineInfo init(AppView app, TicketLineInfo oLine) throws BasicException {
|
||||
|
||||
initComponents();
|
||||
|
||||
productID = oLine.getProductID();
|
||||
|
||||
if (oLine.getTaxInfo() == null) {
|
||||
throw new BasicException(AppLocal.getIntString("message.cannotcalculatetaxes"));
|
||||
}
|
||||
|
||||
if (!productID.equals("xxx999_999xxx_x9x9x9")) {
|
||||
m_jBtnPriceUpdate.setVisible(AppConfig.getInstance().getBoolean("db.prodpriceupdate"));
|
||||
}else{
|
||||
m_jBtnPriceUpdate.setVisible(false);
|
||||
}
|
||||
|
||||
m_jBtnPriceUpdate.setEnabled(false);
|
||||
|
||||
m_oLine = new TicketLineInfo(oLine);
|
||||
m_bunitsok = true;
|
||||
m_bpriceok = true;
|
||||
|
||||
// m_jName.setEnabled(app.getAppUserView().getUser().hasPermission("com.unicenta.pos.sales.JPanelTicketEdits"));
|
||||
m_jUnits.setEnabled(app.getAppUserView().getUser().hasPermission("com.unicenta.pos.sales.JPanelTicketEdits"));
|
||||
m_jPrice.setEnabled(app.getAppUserView().getUser().hasPermission("com.unicenta.pos.sales.JPanelTicketEdits"));
|
||||
m_jPriceTax.setEnabled(app.getAppUserView().getUser().hasPermission("com.unicenta.pos.sales.JPanelTicketEdits"));
|
||||
|
||||
m_jName.setText(oLine.getProductName());
|
||||
m_jUnits.setDoubleValue(oLine.getMultiply());
|
||||
m_jPrice.setDoubleValue(oLine.getPrice());
|
||||
m_jPriceTax.setDoubleValue(oLine.getPriceTax());
|
||||
m_jTaxrate.setText(oLine.getTaxInfo().getName());
|
||||
|
||||
m_jName.addPropertyChangeListener("Edition", new RecalculateName());
|
||||
m_jUnits.addPropertyChangeListener("Edition", new RecalculateUnits());
|
||||
m_jPrice.addPropertyChangeListener("Edition", new RecalculatePrice());
|
||||
m_jPriceTax.addPropertyChangeListener("Edition", new RecalculatePriceTax());
|
||||
|
||||
m_jName.addEditorKeys(m_jKeys);
|
||||
m_jUnits.addEditorKeys(m_jKeys);
|
||||
m_jPrice.addEditorKeys(m_jKeys);
|
||||
m_jPriceTax.addEditorKeys(m_jKeys);
|
||||
|
||||
if (m_jName.isEnabled()) {
|
||||
m_jName.activate();
|
||||
} else {
|
||||
m_jUnits.activate();
|
||||
}
|
||||
|
||||
printTotals();
|
||||
|
||||
getRootPane().setDefaultButton(m_jButtonOK);
|
||||
returnLine = null;
|
||||
setVisible(true);
|
||||
|
||||
return returnLine;
|
||||
}
|
||||
|
||||
private void printTotals() {
|
||||
|
||||
if (m_bunitsok && m_bpriceok) {
|
||||
m_jSubtotal.setText(m_oLine.printSubValue());
|
||||
m_jTotal.setText(m_oLine.printValue());
|
||||
m_jButtonOK.setEnabled(true);
|
||||
} else {
|
||||
m_jSubtotal.setText(null);
|
||||
m_jTotal.setText(null);
|
||||
m_jButtonOK.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
private class RecalculateUnits implements PropertyChangeListener {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
Double value = m_jUnits.getDoubleValue();
|
||||
if (value == null || value == 0.0) {
|
||||
m_bunitsok = false;
|
||||
} else {
|
||||
m_oLine.setMultiply(value);
|
||||
m_bunitsok = true;
|
||||
}
|
||||
|
||||
printTotals();
|
||||
}
|
||||
}
|
||||
|
||||
private class RecalculatePrice implements PropertyChangeListener {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
|
||||
Double value = m_jPrice.getDoubleValue();
|
||||
if (value == null || value == 0.0) {
|
||||
m_bpriceok = false;
|
||||
} else {
|
||||
m_oLine.setPrice(value);
|
||||
m_jPriceTax.setDoubleValue(m_oLine.getPriceTax());
|
||||
m_bpriceok = true;
|
||||
m_jBtnPriceUpdate.setEnabled(AppConfig.getInstance().getBoolean("db.prodpriceupdate"));
|
||||
}
|
||||
|
||||
printTotals();
|
||||
}
|
||||
}
|
||||
|
||||
private class RecalculatePriceTax implements PropertyChangeListener {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
|
||||
Double value = m_jPriceTax.getDoubleValue();
|
||||
if (value == null || value == 0.0) {
|
||||
m_bpriceok = false;
|
||||
} else {
|
||||
m_oLine.setPriceTax(value);
|
||||
m_jPrice.setDoubleValue(m_oLine.getPrice());
|
||||
m_bpriceok = true;
|
||||
m_jBtnPriceUpdate.setEnabled(AppConfig.getInstance().getBoolean("db.prodpriceupdate"));
|
||||
}
|
||||
|
||||
printTotals();
|
||||
}
|
||||
}
|
||||
|
||||
private class RecalculateName implements PropertyChangeListener {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
m_oLine.setProperty("product.name", m_jName.getText());
|
||||
}
|
||||
}
|
||||
|
||||
private 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());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param parent
|
||||
* @param app
|
||||
* @param oLine
|
||||
* @return
|
||||
* @throws BasicException
|
||||
*/
|
||||
public static TicketLineInfo showMessage(Component parent
|
||||
, AppView app
|
||||
, TicketLineInfo oLine) throws BasicException {
|
||||
|
||||
Window window = getWindow(parent);
|
||||
|
||||
JProductLineEdit myMsg;
|
||||
if (window instanceof Frame) {
|
||||
myMsg = new JProductLineEdit((Frame) window, true);
|
||||
} else {
|
||||
myMsg = new JProductLineEdit((Dialog) window, true);
|
||||
}
|
||||
return myMsg.init(app, oLine);
|
||||
}
|
||||
|
||||
|
||||
/** 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();
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
jLabel3 = new javax.swing.JLabel();
|
||||
m_jName = new com.unicenta.editor.JEditorString();
|
||||
m_jUnits = new com.unicenta.editor.JEditorDouble();
|
||||
m_jPrice = new com.unicenta.editor.JEditorCurrency();
|
||||
m_jPriceTax = new com.unicenta.editor.JEditorCurrency();
|
||||
m_jTaxrate = new javax.swing.JLabel();
|
||||
jLabel5 = new javax.swing.JLabel();
|
||||
jLabel6 = new javax.swing.JLabel();
|
||||
m_jTotal = new javax.swing.JLabel();
|
||||
jLabel7 = new javax.swing.JLabel();
|
||||
m_jSubtotal = new javax.swing.JLabel();
|
||||
m_jBtnPriceUpdate = new javax.swing.JButton();
|
||||
jPanel3 = new javax.swing.JPanel();
|
||||
jPanel4 = new javax.swing.JPanel();
|
||||
m_jKeys = new com.unicenta.editor.JEditorKeys();
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
m_jButtonCancel = new javax.swing.JButton();
|
||||
m_jButtonOK = new javax.swing.JButton();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
setTitle(AppLocal.getIntString("label.editline")); // NOI18N
|
||||
setPreferredSize(new java.awt.Dimension(650, 350));
|
||||
|
||||
jPanel5.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jPanel2.setPreferredSize(new java.awt.Dimension(400, 230));
|
||||
|
||||
jLabel1.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel1.setText(AppLocal.getIntString("label.price")); // NOI18N
|
||||
jLabel1.setPreferredSize(new java.awt.Dimension(110, 30));
|
||||
|
||||
jLabel2.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel2.setText(AppLocal.getIntString("label.units")); // NOI18N
|
||||
jLabel2.setPreferredSize(new java.awt.Dimension(110, 30));
|
||||
|
||||
jLabel3.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel3.setText(AppLocal.getIntString("label.pricetax")); // NOI18N
|
||||
jLabel3.setPreferredSize(new java.awt.Dimension(110, 30));
|
||||
|
||||
m_jName.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
m_jName.setPreferredSize(new java.awt.Dimension(132, 30));
|
||||
|
||||
m_jUnits.setEnabled(false);
|
||||
m_jUnits.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
m_jUnits.setPreferredSize(new java.awt.Dimension(132, 30));
|
||||
|
||||
m_jPrice.setEnabled(false);
|
||||
m_jPrice.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
m_jPrice.setPreferredSize(new java.awt.Dimension(132, 30));
|
||||
|
||||
m_jPriceTax.setEnabled(false);
|
||||
m_jPriceTax.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
m_jPriceTax.setPreferredSize(new java.awt.Dimension(132, 30));
|
||||
|
||||
m_jTaxrate.setBackground(javax.swing.UIManager.getDefaults().getColor("TextField.disabledBackground"));
|
||||
m_jTaxrate.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
m_jTaxrate.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
|
||||
m_jTaxrate.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_jTaxrate.setOpaque(true);
|
||||
m_jTaxrate.setPreferredSize(new java.awt.Dimension(150, 25));
|
||||
m_jTaxrate.setRequestFocusEnabled(false);
|
||||
|
||||
jLabel5.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel5.setText(AppLocal.getIntString("label.tax")); // NOI18N
|
||||
jLabel5.setPreferredSize(new java.awt.Dimension(110, 30));
|
||||
|
||||
jLabel6.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel6.setText(AppLocal.getIntString("label.totalcash")); // NOI18N
|
||||
jLabel6.setPreferredSize(new java.awt.Dimension(110, 30));
|
||||
|
||||
m_jTotal.setBackground(javax.swing.UIManager.getDefaults().getColor("TextField.disabledBackground"));
|
||||
m_jTotal.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
m_jTotal.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
|
||||
m_jTotal.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_jTotal.setOpaque(true);
|
||||
m_jTotal.setPreferredSize(new java.awt.Dimension(150, 25));
|
||||
m_jTotal.setRequestFocusEnabled(false);
|
||||
|
||||
jLabel7.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel7.setText(AppLocal.getIntString("label.subtotalcash")); // NOI18N
|
||||
jLabel7.setPreferredSize(new java.awt.Dimension(110, 30));
|
||||
|
||||
m_jSubtotal.setBackground(javax.swing.UIManager.getDefaults().getColor("TextField.disabledBackground"));
|
||||
m_jSubtotal.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
m_jSubtotal.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
|
||||
m_jSubtotal.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_jSubtotal.setOpaque(true);
|
||||
m_jSubtotal.setPreferredSize(new java.awt.Dimension(150, 25));
|
||||
m_jSubtotal.setRequestFocusEnabled(false);
|
||||
|
||||
m_jBtnPriceUpdate.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
m_jBtnPriceUpdate.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/filesave.png"))); // NOI18N
|
||||
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("pos_messages"); // NOI18N
|
||||
m_jBtnPriceUpdate.setText(bundle.getString("button.priceupdate")); // NOI18N
|
||||
m_jBtnPriceUpdate.setFocusPainted(false);
|
||||
m_jBtnPriceUpdate.setFocusable(false);
|
||||
m_jBtnPriceUpdate.setMargin(new java.awt.Insets(8, 16, 8, 16));
|
||||
m_jBtnPriceUpdate.setPreferredSize(new java.awt.Dimension(110, 45));
|
||||
m_jBtnPriceUpdate.setRequestFocusEnabled(false);
|
||||
m_jBtnPriceUpdate.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jBtnPriceUpdateActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
|
||||
jPanel2.setLayout(jPanel2Layout);
|
||||
jPanel2Layout.setHorizontalGroup(
|
||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addGap(10, 10, 10)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.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(m_jUnits, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanel2Layout.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_jPriceTax, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(m_jPrice, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(jPanel2Layout.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_jSubtotal, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addGap(116, 116, 116)
|
||||
.addComponent(m_jTaxrate, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(m_jBtnPriceUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(m_jTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)))))
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(m_jName, javax.swing.GroupLayout.PREFERRED_SIZE, 354, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(60, 60, 60))
|
||||
);
|
||||
jPanel2Layout.setVerticalGroup(
|
||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(m_jName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(m_jUnits, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(m_jPrice, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(m_jPriceTax, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(9, 9, 9)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addGap(1, 1, 1)
|
||||
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
|
||||
.addComponent(m_jTaxrate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)))
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(m_jSubtotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(m_jTotal, 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.RELATED, 19, Short.MAX_VALUE)
|
||||
.addComponent(m_jBtnPriceUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
jPanel5.add(jPanel2, java.awt.BorderLayout.CENTER);
|
||||
|
||||
getContentPane().add(jPanel5, java.awt.BorderLayout.CENTER);
|
||||
|
||||
jPanel3.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jPanel4.setLayout(new javax.swing.BoxLayout(jPanel4, javax.swing.BoxLayout.Y_AXIS));
|
||||
|
||||
m_jKeys.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jKeysActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel4.add(m_jKeys);
|
||||
|
||||
jPanel3.add(jPanel4, java.awt.BorderLayout.NORTH);
|
||||
|
||||
jPanel1.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
|
||||
|
||||
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.setRequestFocusEnabled(false);
|
||||
m_jButtonCancel.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jButtonCancelActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel1.add(m_jButtonCancel);
|
||||
|
||||
m_jButtonOK.setFont(new java.awt.Font("Arial", 0, 12)); // 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.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);
|
||||
}
|
||||
});
|
||||
jPanel1.add(m_jButtonOK);
|
||||
|
||||
jPanel3.add(jPanel1, java.awt.BorderLayout.SOUTH);
|
||||
|
||||
getContentPane().add(jPanel3, java.awt.BorderLayout.EAST);
|
||||
|
||||
setSize(new java.awt.Dimension(708, 394));
|
||||
setLocationRelativeTo(null);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void m_jButtonCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jButtonCancelActionPerformed
|
||||
|
||||
dispose();
|
||||
|
||||
}//GEN-LAST:event_m_jButtonCancelActionPerformed
|
||||
|
||||
private void m_jButtonOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jButtonOKActionPerformed
|
||||
|
||||
returnLine = m_oLine;
|
||||
|
||||
dispose();
|
||||
|
||||
}//GEN-LAST:event_m_jButtonOKActionPerformed
|
||||
|
||||
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
|
||||
|
||||
private void m_jBtnPriceUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jBtnPriceUpdateActionPerformed
|
||||
|
||||
String db_password = (AppConfig.getInstance().getProperty("db.password"));
|
||||
|
||||
if (AppConfig.getInstance().getProperty("db.user") != null
|
||||
&& db_password != null
|
||||
&& db_password.startsWith("crypt:")) {
|
||||
AltEncrypter cypher = new AltEncrypter("cypherkey"
|
||||
+ AppConfig.getInstance().getProperty("db.user"));
|
||||
db_password = cypher.decrypt(db_password.substring(6));
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
// s = AppViewConnection.createSession();
|
||||
con = DriverManager.getConnection(
|
||||
AppConfig.getInstance().getProperty("db.URL") +
|
||||
AppConfig.getInstance().getProperty("db.schema")
|
||||
, AppConfig.getInstance().getProperty("db.user")
|
||||
, db_password);
|
||||
|
||||
pstmt = con.prepareStatement(
|
||||
"UPDATE PRODUCTS SET PRICESELL = ? WHERE ID = ?");
|
||||
pstmt.setDouble(1, m_jPrice.getDoubleValue());
|
||||
pstmt.setString(2, productID);
|
||||
System.out.println(pstmt);
|
||||
|
||||
pstmt.executeUpdate();
|
||||
|
||||
m_jBtnPriceUpdate.setEnabled(false);
|
||||
|
||||
con.close();
|
||||
|
||||
} catch (SQLException e) {
|
||||
System.out.println(e);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_oLine.setUpdated(true);
|
||||
}//GEN-LAST:event_m_jBtnPriceUpdateActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JLabel jLabel5;
|
||||
private javax.swing.JLabel jLabel6;
|
||||
private javax.swing.JLabel jLabel7;
|
||||
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.JButton m_jBtnPriceUpdate;
|
||||
private javax.swing.JButton m_jButtonCancel;
|
||||
private javax.swing.JButton m_jButtonOK;
|
||||
private com.unicenta.editor.JEditorKeys m_jKeys;
|
||||
private com.unicenta.editor.JEditorString m_jName;
|
||||
private com.unicenta.editor.JEditorCurrency m_jPrice;
|
||||
private com.unicenta.editor.JEditorCurrency m_jPriceTax;
|
||||
private javax.swing.JLabel m_jSubtotal;
|
||||
private javax.swing.JLabel m_jTaxrate;
|
||||
private javax.swing.JLabel m_jTotal;
|
||||
private com.unicenta.editor.JEditorDouble m_jUnits;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,525 @@
|
||||
<?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="label.editline" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
</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,-118,0,0,2,-60"/>
|
||||
<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="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 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="jPanel2">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[400, 230]"/>
|
||||
</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" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="m_jUnits" min="-2" pref="100" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="m_jPriceTax" min="-2" pref="150" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="m_jPrice" min="-2" pref="150" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="m_jName" min="-2" pref="240" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<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_jSubtotal" min="-2" pref="120" 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"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="m_jBtnPriceUpdate" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="m_jTotal" min="-2" pref="120" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jLabel5" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="116" max="-2" attributes="0"/>
|
||||
<Component id="m_jTaxrateOld" min="-2" pref="120" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="m_jTaxrate" min="-2" pref="100" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="60" max="-2" 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="m_jName" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="m_jUnits" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="m_jPrice" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" 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="jLabel3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="m_jPriceTax" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Group type="103" alignment="1" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="1" pref="1" max="-2" attributes="0"/>
|
||||
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="m_jTaxrateOld" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="m_jTaxrate" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="11" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="m_jSubtotal" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="m_jTotal" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="m_jBtnPriceUpdate" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" 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.price" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 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.units" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 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.pricetax" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 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.item" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="com.unicenta.editor.JEditorString" name="m_jName">
|
||||
<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="[132, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="com.unicenta.editor.JEditorDouble" name="m_jUnits">
|
||||
<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="[132, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="com.unicenta.editor.JEditorCurrency" name="m_jPrice">
|
||||
<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="[132, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="com.unicenta.editor.JEditorCurrency" name="m_jPriceTax">
|
||||
<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="[132, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="m_jTaxrateOld">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="e4" green="eb" id="TextField.disabledBackground" palette="3" red="eb" type="palette"/>
|
||||
</Property>
|
||||
<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="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="[150, 25]"/>
|
||||
</Property>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<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="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.tax" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 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.totalcash" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="m_jTotal">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="e4" green="eb" id="TextField.disabledBackground" palette="3" red="eb" type="palette"/>
|
||||
</Property>
|
||||
<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="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="[150, 25]"/>
|
||||
</Property>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</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.subtotalcash" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="m_jSubtotal">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="e4" green="eb" id="TextField.disabledBackground" palette="3" red="eb" type="palette"/>
|
||||
</Property>
|
||||
<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="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="[150, 25]"/>
|
||||
</Property>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="m_jBtnPriceUpdate">
|
||||
<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/filesave.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="button.priceupdate" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</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>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jBtnPriceUpdateActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="com.unicenta.editor.JEditorDouble" name="m_jTaxrate">
|
||||
<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="[132, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel3">
|
||||
<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="jPanel4">
|
||||
<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>
|
||||
<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="South"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
|
||||
<Property name="alignment" type="int" value="2"/>
|
||||
</Layout>
|
||||
<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("{key}")"/>
|
||||
</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>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</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="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/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("{key}")"/>
|
||||
</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>
|
||||
<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>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,584 @@
|
||||
// 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.sales;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.loader.Session;
|
||||
import com.unicenta.pos.forms.AppConfig;
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
import com.unicenta.pos.forms.AppView;
|
||||
import com.unicenta.pos.ticket.TicketLineInfo;
|
||||
import com.unicenta.pos.util.AltEncrypter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author adrianromero
|
||||
*/
|
||||
@Slf4j
|
||||
public class JProductLineEditTax extends javax.swing.JDialog {
|
||||
|
||||
private TicketLineInfo returnLine;
|
||||
private TicketLineInfo m_oLine;
|
||||
private boolean m_bunitsok;
|
||||
private boolean m_bpriceok;
|
||||
private String productID;
|
||||
private Session s;
|
||||
private Connection con;
|
||||
private String SQL;
|
||||
private PreparedStatement pstmt;
|
||||
|
||||
/** Creates new form JProductLineEdit */
|
||||
private JProductLineEditTax(java.awt.Frame parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
}
|
||||
/** Creates new form JProductLineEdit */
|
||||
private JProductLineEditTax(java.awt.Dialog parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
}
|
||||
|
||||
private TicketLineInfo init(AppView app, TicketLineInfo oLine) throws BasicException {
|
||||
|
||||
initComponents();
|
||||
|
||||
productID = oLine.getProductID();
|
||||
|
||||
if (oLine.getTaxInfo() == null) {
|
||||
throw new BasicException(AppLocal.getIntString("message.cannotcalculatetaxes"));
|
||||
}
|
||||
|
||||
if (!productID.equals("xxx999_999xxx_x9x9x9")) {
|
||||
m_jBtnPriceUpdate.setVisible(AppConfig.getInstance().getBoolean("db.prodpriceupdate"));
|
||||
}else{
|
||||
m_jBtnPriceUpdate.setVisible(false);
|
||||
}
|
||||
|
||||
m_jBtnPriceUpdate.setEnabled(false);
|
||||
|
||||
m_oLine = new TicketLineInfo(oLine);
|
||||
m_bunitsok = true;
|
||||
m_bpriceok = true;
|
||||
|
||||
m_jName.setEnabled(app.getAppUserView().getUser().hasPermission("com.unicenta.pos.sales.JPanelTicketEdits"));
|
||||
m_jPrice.setEnabled(app.getAppUserView().getUser().hasPermission("com.unicenta.pos.sales.JPanelTicketEdits"));
|
||||
m_jPriceTax.setEnabled(app.getAppUserView().getUser().hasPermission("com.unicenta.pos.sales.JPanelTicketEdits"));
|
||||
|
||||
m_jName.setText(oLine.getProductName());
|
||||
m_jUnits.setDoubleValue(oLine.getMultiply());
|
||||
m_jPrice.setDoubleValue(oLine.getPrice());
|
||||
m_jPriceTax.setDoubleValue(oLine.getPriceTax());
|
||||
m_jTaxrateOld.setText(oLine.getTaxInfo().getName());
|
||||
m_jTaxrate.setDoubleValue(oLine.getTaxRate());
|
||||
|
||||
m_jName.addPropertyChangeListener("Edition", new RecalculateName());
|
||||
m_jUnits.addPropertyChangeListener("Edition", new RecalculateUnits());
|
||||
m_jPrice.addPropertyChangeListener("Edition", new RecalculatePrice());
|
||||
m_jPriceTax.addPropertyChangeListener("Edition", new RecalculatePriceTax());
|
||||
|
||||
m_jName.addEditorKeys(m_jKeys);
|
||||
m_jUnits.addEditorKeys(m_jKeys);
|
||||
m_jPrice.addEditorKeys(m_jKeys);
|
||||
m_jPriceTax.addEditorKeys(m_jKeys);
|
||||
m_jTaxrate.addEditorKeys(m_jKeys);
|
||||
|
||||
if (m_jName.isEnabled()) {
|
||||
m_jName.activate();
|
||||
} else {
|
||||
m_jUnits.activate();
|
||||
}
|
||||
|
||||
printTotals();
|
||||
|
||||
getRootPane().setDefaultButton(m_jButtonOK);
|
||||
returnLine = null;
|
||||
setVisible(true);
|
||||
|
||||
return returnLine;
|
||||
}
|
||||
|
||||
private void printTotals() {
|
||||
|
||||
if (m_bunitsok && m_bpriceok) {
|
||||
m_jSubtotal.setText(m_oLine.printSubValue());
|
||||
m_jTotal.setText(m_oLine.printValue());
|
||||
m_jButtonOK.setEnabled(true);
|
||||
} else {
|
||||
m_jSubtotal.setText(null);
|
||||
m_jTotal.setText(null);
|
||||
m_jButtonOK.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
private class RecalculateUnits implements PropertyChangeListener {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
Double value = m_jUnits.getDoubleValue();
|
||||
if (value == null || value == 0.0) {
|
||||
m_bunitsok = false;
|
||||
} else {
|
||||
m_oLine.setMultiply(value);
|
||||
m_bunitsok = true;
|
||||
}
|
||||
|
||||
printTotals();
|
||||
}
|
||||
}
|
||||
|
||||
private class RecalculatePrice implements PropertyChangeListener {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
|
||||
Double value = m_jPrice.getDoubleValue();
|
||||
if (value == null || value == 0.0) {
|
||||
m_bpriceok = false;
|
||||
} else {
|
||||
m_oLine.setPrice(value);
|
||||
m_jPriceTax.setDoubleValue(m_oLine.getPriceTax());
|
||||
m_bpriceok = true;
|
||||
m_jBtnPriceUpdate.setEnabled(AppConfig.getInstance().getBoolean("db.prodpriceupdate"));
|
||||
}
|
||||
|
||||
printTotals();
|
||||
}
|
||||
}
|
||||
|
||||
private class RecalculatePriceTax implements PropertyChangeListener {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
|
||||
Double value = m_jPriceTax.getDoubleValue();
|
||||
if (value == null || value == 0.0) {
|
||||
m_bpriceok = false;
|
||||
} else {
|
||||
m_oLine.setPriceTax(value);
|
||||
m_jPrice.setDoubleValue(m_oLine.getPrice());
|
||||
m_bpriceok = true;
|
||||
m_jBtnPriceUpdate.setEnabled(AppConfig.getInstance().getBoolean("db.prodpriceupdate"));
|
||||
}
|
||||
|
||||
printTotals();
|
||||
}
|
||||
}
|
||||
|
||||
private class RecalculateName implements PropertyChangeListener {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
m_oLine.setProperty("product.name", m_jName.getText());
|
||||
}
|
||||
}
|
||||
|
||||
private 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());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param parent
|
||||
* @param app
|
||||
* @param oLine
|
||||
* @return
|
||||
* @throws BasicException
|
||||
*/
|
||||
public static TicketLineInfo showMessage(Component parent
|
||||
, AppView app
|
||||
, TicketLineInfo oLine) throws BasicException {
|
||||
|
||||
Window window = getWindow(parent);
|
||||
|
||||
JProductLineEditTax myMsg;
|
||||
if (window instanceof Frame) {
|
||||
myMsg = new JProductLineEditTax((Frame) window, true);
|
||||
} else {
|
||||
myMsg = new JProductLineEditTax((Dialog) window, true);
|
||||
}
|
||||
return myMsg.init(app, oLine);
|
||||
}
|
||||
|
||||
|
||||
/** 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();
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
jLabel3 = new javax.swing.JLabel();
|
||||
jLabel4 = new javax.swing.JLabel();
|
||||
m_jName = new com.unicenta.editor.JEditorString();
|
||||
m_jUnits = new com.unicenta.editor.JEditorDouble();
|
||||
m_jPrice = new com.unicenta.editor.JEditorCurrency();
|
||||
m_jPriceTax = new com.unicenta.editor.JEditorCurrency();
|
||||
m_jTaxrateOld = new javax.swing.JLabel();
|
||||
jLabel5 = new javax.swing.JLabel();
|
||||
jLabel6 = new javax.swing.JLabel();
|
||||
m_jTotal = new javax.swing.JLabel();
|
||||
jLabel7 = new javax.swing.JLabel();
|
||||
m_jSubtotal = new javax.swing.JLabel();
|
||||
m_jBtnPriceUpdate = new javax.swing.JButton();
|
||||
m_jTaxrate = new com.unicenta.editor.JEditorDouble();
|
||||
jPanel3 = new javax.swing.JPanel();
|
||||
jPanel4 = new javax.swing.JPanel();
|
||||
m_jKeys = new com.unicenta.editor.JEditorKeys();
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
m_jButtonCancel = new javax.swing.JButton();
|
||||
m_jButtonOK = new javax.swing.JButton();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
setTitle(AppLocal.getIntString("label.editline")); // NOI18N
|
||||
|
||||
jPanel5.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jPanel2.setPreferredSize(new java.awt.Dimension(400, 230));
|
||||
|
||||
jLabel1.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel1.setText(AppLocal.getIntString("label.price")); // NOI18N
|
||||
jLabel1.setPreferredSize(new java.awt.Dimension(110, 30));
|
||||
|
||||
jLabel2.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel2.setText(AppLocal.getIntString("label.units")); // NOI18N
|
||||
jLabel2.setPreferredSize(new java.awt.Dimension(110, 30));
|
||||
|
||||
jLabel3.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel3.setText(AppLocal.getIntString("label.pricetax")); // NOI18N
|
||||
jLabel3.setPreferredSize(new java.awt.Dimension(110, 30));
|
||||
|
||||
jLabel4.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel4.setText(AppLocal.getIntString("label.item")); // NOI18N
|
||||
jLabel4.setPreferredSize(new java.awt.Dimension(110, 30));
|
||||
|
||||
m_jName.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
m_jName.setPreferredSize(new java.awt.Dimension(132, 30));
|
||||
|
||||
m_jUnits.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
m_jUnits.setPreferredSize(new java.awt.Dimension(132, 30));
|
||||
|
||||
m_jPrice.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
m_jPrice.setPreferredSize(new java.awt.Dimension(132, 30));
|
||||
|
||||
m_jPriceTax.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
m_jPriceTax.setPreferredSize(new java.awt.Dimension(132, 30));
|
||||
|
||||
m_jTaxrateOld.setBackground(javax.swing.UIManager.getDefaults().getColor("TextField.disabledBackground"));
|
||||
m_jTaxrateOld.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
m_jTaxrateOld.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
|
||||
m_jTaxrateOld.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_jTaxrateOld.setOpaque(true);
|
||||
m_jTaxrateOld.setPreferredSize(new java.awt.Dimension(150, 25));
|
||||
m_jTaxrateOld.setRequestFocusEnabled(false);
|
||||
|
||||
jLabel5.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel5.setText(AppLocal.getIntString("label.tax")); // NOI18N
|
||||
jLabel5.setPreferredSize(new java.awt.Dimension(110, 30));
|
||||
|
||||
jLabel6.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel6.setText(AppLocal.getIntString("label.totalcash")); // NOI18N
|
||||
jLabel6.setPreferredSize(new java.awt.Dimension(110, 30));
|
||||
|
||||
m_jTotal.setBackground(javax.swing.UIManager.getDefaults().getColor("TextField.disabledBackground"));
|
||||
m_jTotal.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
m_jTotal.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
|
||||
m_jTotal.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_jTotal.setOpaque(true);
|
||||
m_jTotal.setPreferredSize(new java.awt.Dimension(150, 25));
|
||||
m_jTotal.setRequestFocusEnabled(false);
|
||||
|
||||
jLabel7.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel7.setText(AppLocal.getIntString("label.subtotalcash")); // NOI18N
|
||||
jLabel7.setPreferredSize(new java.awt.Dimension(110, 30));
|
||||
|
||||
m_jSubtotal.setBackground(javax.swing.UIManager.getDefaults().getColor("TextField.disabledBackground"));
|
||||
m_jSubtotal.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
m_jSubtotal.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
|
||||
m_jSubtotal.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_jSubtotal.setOpaque(true);
|
||||
m_jSubtotal.setPreferredSize(new java.awt.Dimension(150, 25));
|
||||
m_jSubtotal.setRequestFocusEnabled(false);
|
||||
|
||||
m_jBtnPriceUpdate.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
m_jBtnPriceUpdate.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/filesave.png"))); // NOI18N
|
||||
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("pos_messages"); // NOI18N
|
||||
m_jBtnPriceUpdate.setText(bundle.getString("button.priceupdate")); // NOI18N
|
||||
m_jBtnPriceUpdate.setFocusPainted(false);
|
||||
m_jBtnPriceUpdate.setFocusable(false);
|
||||
m_jBtnPriceUpdate.setMargin(new java.awt.Insets(8, 16, 8, 16));
|
||||
m_jBtnPriceUpdate.setPreferredSize(new java.awt.Dimension(110, 45));
|
||||
m_jBtnPriceUpdate.setRequestFocusEnabled(false);
|
||||
m_jBtnPriceUpdate.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jBtnPriceUpdateActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
m_jTaxrate.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
m_jTaxrate.setPreferredSize(new java.awt.Dimension(132, 30));
|
||||
|
||||
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
|
||||
jPanel2.setLayout(jPanel2Layout);
|
||||
jPanel2Layout.setHorizontalGroup(
|
||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addGap(10, 10, 10)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.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(m_jUnits, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanel2Layout.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_jPriceTax, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(m_jPrice, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanel2Layout.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(m_jName, javax.swing.GroupLayout.PREFERRED_SIZE, 240, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.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_jSubtotal, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(m_jBtnPriceUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(m_jTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addGap(116, 116, 116)
|
||||
.addComponent(m_jTaxrateOld, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(m_jTaxrate, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))))
|
||||
.addGap(60, 60, 60))
|
||||
);
|
||||
jPanel2Layout.setVerticalGroup(
|
||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(m_jName, 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.UNRELATED)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(m_jUnits, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(m_jPrice, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(m_jPriceTax, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addGap(1, 1, 1)
|
||||
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
|
||||
.addComponent(m_jTaxrateOld, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)))
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addComponent(m_jTaxrate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(11, 11, 11)))
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(m_jSubtotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(m_jTotal, 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.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(m_jBtnPriceUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
jPanel5.add(jPanel2, java.awt.BorderLayout.CENTER);
|
||||
|
||||
getContentPane().add(jPanel5, java.awt.BorderLayout.CENTER);
|
||||
|
||||
jPanel3.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jPanel4.setLayout(new javax.swing.BoxLayout(jPanel4, javax.swing.BoxLayout.Y_AXIS));
|
||||
|
||||
m_jKeys.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jKeysActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel4.add(m_jKeys);
|
||||
|
||||
jPanel3.add(jPanel4, java.awt.BorderLayout.NORTH);
|
||||
|
||||
jPanel1.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
|
||||
|
||||
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.setRequestFocusEnabled(false);
|
||||
m_jButtonCancel.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jButtonCancelActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel1.add(m_jButtonCancel);
|
||||
|
||||
m_jButtonOK.setFont(new java.awt.Font("Arial", 0, 12)); // 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.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);
|
||||
}
|
||||
});
|
||||
jPanel1.add(m_jButtonOK);
|
||||
|
||||
jPanel3.add(jPanel1, java.awt.BorderLayout.SOUTH);
|
||||
|
||||
getContentPane().add(jPanel3, java.awt.BorderLayout.EAST);
|
||||
|
||||
setSize(new java.awt.Dimension(708, 394));
|
||||
setLocationRelativeTo(null);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void m_jButtonCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jButtonCancelActionPerformed
|
||||
|
||||
dispose();
|
||||
|
||||
}//GEN-LAST:event_m_jButtonCancelActionPerformed
|
||||
|
||||
private void m_jButtonOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jButtonOKActionPerformed
|
||||
|
||||
returnLine = m_oLine;
|
||||
|
||||
dispose();
|
||||
|
||||
}//GEN-LAST:event_m_jButtonOKActionPerformed
|
||||
|
||||
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
|
||||
|
||||
private void m_jBtnPriceUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jBtnPriceUpdateActionPerformed
|
||||
|
||||
String db_password = (AppConfig.getInstance().getProperty("db.password"));
|
||||
|
||||
if (AppConfig.getInstance().getProperty("db.user") != null
|
||||
&& db_password != null
|
||||
&& db_password.startsWith("crypt:")) {
|
||||
AltEncrypter cypher = new AltEncrypter("cypherkey"
|
||||
+ AppConfig.getInstance().getProperty("db.user"));
|
||||
db_password = cypher.decrypt(db_password.substring(6));
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
// s = AppViewConnection.createSession();
|
||||
con = DriverManager.getConnection(
|
||||
AppConfig.getInstance().getProperty("db.URL") +
|
||||
AppConfig.getInstance().getProperty("db.schema")
|
||||
, AppConfig.getInstance().getProperty("db.user")
|
||||
, db_password);
|
||||
|
||||
pstmt = con.prepareStatement(
|
||||
"UPDATE PRODUCTS SET PRICESELL = ? WHERE ID = ?");
|
||||
pstmt.setDouble(1, m_jPrice.getDoubleValue());
|
||||
pstmt.setString(2, productID);
|
||||
pstmt.executeUpdate();
|
||||
|
||||
m_jBtnPriceUpdate.setEnabled(false);
|
||||
|
||||
con.close();
|
||||
|
||||
} catch (SQLException e) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_oLine.setUpdated(true);
|
||||
}//GEN-LAST:event_m_jBtnPriceUpdateActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JLabel jLabel4;
|
||||
private javax.swing.JLabel jLabel5;
|
||||
private javax.swing.JLabel jLabel6;
|
||||
private javax.swing.JLabel jLabel7;
|
||||
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.JButton m_jBtnPriceUpdate;
|
||||
private javax.swing.JButton m_jButtonCancel;
|
||||
private javax.swing.JButton m_jButtonOK;
|
||||
private com.unicenta.editor.JEditorKeys m_jKeys;
|
||||
private com.unicenta.editor.JEditorString m_jName;
|
||||
private com.unicenta.editor.JEditorCurrency m_jPrice;
|
||||
private com.unicenta.editor.JEditorCurrency m_jPriceTax;
|
||||
private javax.swing.JLabel m_jSubtotal;
|
||||
private com.unicenta.editor.JEditorDouble m_jTaxrate;
|
||||
private javax.swing.JLabel m_jTaxrateOld;
|
||||
private javax.swing.JLabel m_jTotal;
|
||||
private com.unicenta.editor.JEditorDouble m_jUnits;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<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="[15, 200]"/>
|
||||
</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,-31,0,0,1,103"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel3">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="West"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<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="0" left="5" right="0" top="0"/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
<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="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>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="webLabel1" min="-2" pref="110" max="-2" attributes="0"/>
|
||||
<Component id="m_jbtnAddOne" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="m_jbtnAddLine" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="m_jbtnAddAll" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="1" pref="1" max="-2" attributes="0"/>
|
||||
<Component id="webLabel1" min="-2" pref="52" max="-2" attributes="0"/>
|
||||
<EmptySpace min="5" pref="5" max="-2" attributes="0"/>
|
||||
<Component id="m_jbtnAddOne" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="5" pref="5" max="-2" attributes="0"/>
|
||||
<Component id="m_jbtnAddLine" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="5" pref="5" max="-2" attributes="0"/>
|
||||
<Component id="m_jbtnAddAll" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="com.alee.laf.label.WebLabel" name="webLabel1">
|
||||
<Properties>
|
||||
<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.refunds" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="1"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="m_jbtnAddOne">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="button.refundone" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="tooltip.refunditem" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</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, 14, 8, 14]"/>
|
||||
</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_jbtnAddOneActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="m_jbtnAddLine">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="button.refundline" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="tooltip.refundline" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</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, 14, 8, 14]"/>
|
||||
</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_jbtnAddLineActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="m_jbtnAddAll">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="button.refundall" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="tooltip.refundticket" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</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, 14, 8, 14]"/>
|
||||
</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_jbtnAddAllActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,216 @@
|
||||
// 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.sales;
|
||||
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
import com.unicenta.pos.forms.DataLogicSystem;
|
||||
import com.unicenta.pos.ticket.TicketLineInfo;
|
||||
import java.awt.BorderLayout;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
public class JRefundLines extends javax.swing.JPanel {
|
||||
|
||||
private JTicketLines ticketlines;
|
||||
private List m_aLines;
|
||||
|
||||
private JPanelTicketEdits m_jTicketEdit;
|
||||
|
||||
/** Creates new form JRefundLines
|
||||
* @param dlSystem
|
||||
* @param jTicketEdit
|
||||
*/
|
||||
public JRefundLines(DataLogicSystem dlSystem, JPanelTicketEdits jTicketEdit) {
|
||||
|
||||
m_jTicketEdit = jTicketEdit;
|
||||
|
||||
initComponents();
|
||||
|
||||
ticketlines = new JTicketLines(dlSystem.getResourceAsXML("Ticket.Line"));
|
||||
|
||||
jPanel3.add(ticketlines, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param aRefundLines
|
||||
*/
|
||||
public void setLines(List aRefundLines) {
|
||||
|
||||
m_aLines = aRefundLines;
|
||||
ticketlines.clearTicketLines();
|
||||
|
||||
if (m_aLines != null) {
|
||||
for (int i = 0; i < m_aLines.size(); i++) {
|
||||
ticketlines.addTicketLine((TicketLineInfo) m_aLines.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 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() {
|
||||
|
||||
jPanel3 = new javax.swing.JPanel();
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
webLabel1 = new com.alee.laf.label.WebLabel();
|
||||
m_jbtnAddOne = new javax.swing.JButton();
|
||||
m_jbtnAddLine = new javax.swing.JButton();
|
||||
m_jbtnAddAll = new javax.swing.JButton();
|
||||
|
||||
setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
setPreferredSize(new java.awt.Dimension(15, 200));
|
||||
setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jPanel3.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 5, 0, 0));
|
||||
jPanel1.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
webLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("pos_messages"); // NOI18N
|
||||
webLabel1.setText(bundle.getString("label.refunds")); // NOI18N
|
||||
webLabel1.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
|
||||
|
||||
m_jbtnAddOne.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
m_jbtnAddOne.setText(AppLocal.getIntString("button.refundone")); // NOI18N
|
||||
m_jbtnAddOne.setToolTipText(bundle.getString("tooltip.refunditem")); // NOI18N
|
||||
m_jbtnAddOne.setFocusPainted(false);
|
||||
m_jbtnAddOne.setFocusable(false);
|
||||
m_jbtnAddOne.setMargin(new java.awt.Insets(8, 14, 8, 14));
|
||||
m_jbtnAddOne.setPreferredSize(new java.awt.Dimension(110, 45));
|
||||
m_jbtnAddOne.setRequestFocusEnabled(false);
|
||||
m_jbtnAddOne.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jbtnAddOneActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
m_jbtnAddLine.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
m_jbtnAddLine.setText(AppLocal.getIntString("button.refundline")); // NOI18N
|
||||
m_jbtnAddLine.setToolTipText(bundle.getString("tooltip.refundline")); // NOI18N
|
||||
m_jbtnAddLine.setFocusPainted(false);
|
||||
m_jbtnAddLine.setFocusable(false);
|
||||
m_jbtnAddLine.setMargin(new java.awt.Insets(8, 14, 8, 14));
|
||||
m_jbtnAddLine.setPreferredSize(new java.awt.Dimension(110, 45));
|
||||
m_jbtnAddLine.setRequestFocusEnabled(false);
|
||||
m_jbtnAddLine.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jbtnAddLineActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
m_jbtnAddAll.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
m_jbtnAddAll.setText(AppLocal.getIntString("button.refundall")); // NOI18N
|
||||
m_jbtnAddAll.setToolTipText(bundle.getString("tooltip.refundticket")); // NOI18N
|
||||
m_jbtnAddAll.setFocusPainted(false);
|
||||
m_jbtnAddAll.setFocusable(false);
|
||||
m_jbtnAddAll.setMargin(new java.awt.Insets(8, 14, 8, 14));
|
||||
m_jbtnAddAll.setPreferredSize(new java.awt.Dimension(110, 45));
|
||||
m_jbtnAddAll.setRequestFocusEnabled(false);
|
||||
m_jbtnAddAll.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jbtnAddAllActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
|
||||
jPanel2.setLayout(jPanel2Layout);
|
||||
jPanel2Layout.setHorizontalGroup(
|
||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(webLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(m_jbtnAddOne, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(m_jbtnAddLine, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(m_jbtnAddAll, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
);
|
||||
jPanel2Layout.setVerticalGroup(
|
||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addGap(1, 1, 1)
|
||||
.addComponent(webLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(5, 5, 5)
|
||||
.addComponent(m_jbtnAddOne, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(5, 5, 5)
|
||||
.addComponent(m_jbtnAddLine, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(5, 5, 5)
|
||||
.addComponent(m_jbtnAddAll, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
);
|
||||
|
||||
jPanel1.add(jPanel2, java.awt.BorderLayout.LINE_END);
|
||||
|
||||
jPanel3.add(jPanel1, java.awt.BorderLayout.EAST);
|
||||
|
||||
add(jPanel3, java.awt.BorderLayout.WEST);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void m_jbtnAddAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jbtnAddAllActionPerformed
|
||||
|
||||
for (int i = 0; i < m_aLines.size(); i++) {
|
||||
TicketLineInfo oLine = (TicketLineInfo) m_aLines.get(i);
|
||||
TicketLineInfo oNewLine = new TicketLineInfo(oLine);
|
||||
oNewLine.setMultiply(-oLine.getMultiply());
|
||||
m_jTicketEdit.addTicketLine(oNewLine);
|
||||
}
|
||||
|
||||
}//GEN-LAST:event_m_jbtnAddAllActionPerformed
|
||||
|
||||
private void m_jbtnAddOneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jbtnAddOneActionPerformed
|
||||
|
||||
int index = ticketlines.getSelectedIndex();
|
||||
if (index >= 0) {
|
||||
TicketLineInfo oLine = (TicketLineInfo) m_aLines.get(index);
|
||||
TicketLineInfo oNewLine = new TicketLineInfo(oLine);
|
||||
oNewLine.setMultiply(-1.0);
|
||||
m_jTicketEdit.addTicketLine(oNewLine);
|
||||
}
|
||||
|
||||
}//GEN-LAST:event_m_jbtnAddOneActionPerformed
|
||||
|
||||
private void m_jbtnAddLineActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jbtnAddLineActionPerformed
|
||||
|
||||
int index = ticketlines.getSelectedIndex();
|
||||
if (index >= 0) {
|
||||
TicketLineInfo oLine = (TicketLineInfo) m_aLines.get(index);
|
||||
TicketLineInfo oNewLine = new TicketLineInfo(oLine);
|
||||
oNewLine.setMultiply(-oLine.getMultiply());
|
||||
m_jTicketEdit.addTicketLine(oNewLine);
|
||||
}
|
||||
}//GEN-LAST:event_m_jbtnAddLineActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private javax.swing.JPanel jPanel3;
|
||||
private javax.swing.JButton m_jbtnAddAll;
|
||||
private javax.swing.JButton m_jbtnAddLine;
|
||||
private javax.swing.JButton m_jbtnAddOne;
|
||||
private com.alee.laf.label.WebLabel webLabel1;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
package com.unicenta.pos.sales;
|
||||
|
||||
public class JSalesLayoutManager {
|
||||
|
||||
public JSalesLayoutManager(){ }
|
||||
|
||||
public static void createLayout(){ }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</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,18,0,0,1,-99"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignCardLayout"/>
|
||||
</Form>
|
||||
@@ -0,0 +1,129 @@
|
||||
// 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.sales;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.pos.catalog.CatalogSelector;
|
||||
import com.unicenta.pos.catalog.JCatalog;
|
||||
import com.unicenta.pos.forms.AppView;
|
||||
import com.unicenta.pos.forms.DataLogicSales;
|
||||
import com.unicenta.pos.forms.DataLogicSystem;
|
||||
import java.awt.CardLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
public class JTicketCatalogLines extends javax.swing.JPanel {
|
||||
|
||||
private JRefundLines m_reflines;
|
||||
private CatalogSelector m_catalog;
|
||||
|
||||
/** Creates new form JTicketCatalogLines
|
||||
* @param app
|
||||
* @param jTicketEdit
|
||||
* @param pricevisible
|
||||
* @param taxesincluded
|
||||
* @param width
|
||||
* @param height */
|
||||
public JTicketCatalogLines(AppView app, JPanelTicketEdits jTicketEdit, boolean pricevisible, boolean taxesincluded, int width, int height) {
|
||||
|
||||
DataLogicSystem dlSystem = null;
|
||||
DataLogicSales dlSales = null;
|
||||
dlSystem = (DataLogicSystem) app.getBean("com.unicenta.pos.forms.DataLogicSystem");
|
||||
dlSales = (DataLogicSales) app.getBean("com.unicenta.pos.forms.DataLogicSales");
|
||||
|
||||
initComponents();
|
||||
|
||||
m_reflines = new JRefundLines(dlSystem, jTicketEdit);
|
||||
add(m_reflines, "reflines");
|
||||
|
||||
m_catalog = new JCatalog(dlSales, pricevisible, taxesincluded, width, height);
|
||||
m_catalog.getComponent().setPreferredSize(new Dimension(0, 245));
|
||||
// m_catalog.addActionListener(new CatalogListener());
|
||||
add(m_catalog.getComponent(), "catalog");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void showCatalog() {
|
||||
showView("catalog");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws BasicException
|
||||
*/
|
||||
public void loadCatalog() throws BasicException {
|
||||
m_catalog.loadCatalog();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param l
|
||||
*/
|
||||
public void addActionListener(ActionListener l) {
|
||||
m_catalog.addActionListener(l);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param l
|
||||
*/
|
||||
public void removeActionListener(ActionListener l) {
|
||||
m_catalog.addActionListener(l);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param aRefundLines
|
||||
*/
|
||||
public void showRefundLines(List aRefundLines) {
|
||||
// anado las lineas de refund
|
||||
m_reflines.setLines(aRefundLines);
|
||||
showView("reflines");
|
||||
}
|
||||
|
||||
private void showView(String sView) {
|
||||
CardLayout cl = (CardLayout)(this.getLayout());
|
||||
cl.show(this, sView);
|
||||
}
|
||||
|
||||
/** 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() {
|
||||
|
||||
setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
setLayout(new java.awt.CardLayout());
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
// 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_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,-20,0,0,1,113"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="m_jScrollTableTicket">
|
||||
<Properties>
|
||||
<Property name="horizontalScrollBarPolicy" type="int" value="31"/>
|
||||
<Property name="verticalScrollBarPolicy" type="int" value="22"/>
|
||||
<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.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTable" name="m_jTicketTable">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="intercellSpacing" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[0, 1]"/>
|
||||
</Property>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
<Property name="showVerticalLines" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,482 @@
|
||||
// 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.sales;
|
||||
|
||||
import com.unicenta.data.loader.LocalRes;
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
import com.unicenta.pos.scripting.ScriptEngine;
|
||||
import com.unicenta.pos.scripting.ScriptException;
|
||||
import com.unicenta.pos.scripting.ScriptFactory;
|
||||
import com.unicenta.pos.ticket.TicketLineInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.helpers.DefaultHandler;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import javax.swing.table.JTableHeader;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.parsers.SAXParser;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
@Slf4j
|
||||
public class JTicketLines extends javax.swing.JPanel {
|
||||
|
||||
private static SAXParser m_sp = null;
|
||||
|
||||
private final TicketTableModel m_jTableModel;
|
||||
private Boolean sendStatus;
|
||||
|
||||
/** Creates new form JLinesTicket
|
||||
* @param ticketline */
|
||||
public JTicketLines(String ticketline) {
|
||||
|
||||
initComponents();
|
||||
|
||||
ColumnTicket[] acolumns = new ColumnTicket[0];
|
||||
|
||||
if (ticketline != null) {
|
||||
try {
|
||||
if (m_sp == null) {
|
||||
SAXParserFactory spf = SAXParserFactory.newInstance();
|
||||
m_sp = spf.newSAXParser();
|
||||
}
|
||||
ColumnsHandler columnshandler = new ColumnsHandler();
|
||||
m_sp.parse(new InputSource(new StringReader(ticketline)), columnshandler);
|
||||
acolumns = columnshandler.getColumns();
|
||||
|
||||
} catch (ParserConfigurationException ePC) {
|
||||
log.error(LocalRes.getIntString("exception.parserconfig"), ePC.getMessage());
|
||||
} catch (SAXException eSAX) {
|
||||
log.error(LocalRes.getIntString("exception.xmlfile"), eSAX.getMessage());
|
||||
} catch (IOException eIO) {
|
||||
log.error(LocalRes.getIntString("exception.iofile"), eIO);
|
||||
}
|
||||
}
|
||||
|
||||
m_jTableModel = new TicketTableModel(acolumns);
|
||||
m_jTicketTable.setModel(m_jTableModel);
|
||||
|
||||
TableColumnModel jColumns = m_jTicketTable.getColumnModel();
|
||||
for (int i = 0; i < acolumns.length; i++) {
|
||||
jColumns.getColumn(i).setPreferredWidth(acolumns[i].width);
|
||||
jColumns.getColumn(i).setResizable(false);
|
||||
}
|
||||
|
||||
m_jScrollTableTicket.getVerticalScrollBar().setPreferredSize(new Dimension(35, 35));
|
||||
|
||||
// set font for headers
|
||||
Font f = new Font("Arial", Font.BOLD, 14);
|
||||
JTableHeader header = m_jTicketTable.getTableHeader();
|
||||
header.setFont(f);
|
||||
|
||||
/*
|
||||
* Starting point for SORTING the current table model & view
|
||||
* m_aLines + TicketLineInfo also has to be considered BECAUSE....
|
||||
* where ticket is open on another terminal it won't reflect change from
|
||||
* other session once placed and opened from sharedticket table
|
||||
*
|
||||
* m_jTicketTable.setRowSorter(new TableRowSorter(m_jTableModel));
|
||||
* m_jTicketTable.getTableHeader().setReorderingAllowed(true);
|
||||
* m_jTicketTable.setAutoCreateRowSorter(true);
|
||||
* m_jTicketTable.getTableHeader().addMouseListener(new MouseAdapter() {
|
||||
* @Override
|
||||
* public void mouseClicked(MouseEvent e) {
|
||||
* int col = m_jTicketTable.columnAtPoint(e.getPoint());
|
||||
* String name = m_jTicketTable.getColumnName(col);
|
||||
* System.out.println("Column index selected " + col + " " + name);
|
||||
* }
|
||||
* });
|
||||
*/
|
||||
|
||||
m_jTicketTable.setDefaultRenderer(Object.class, new TicketCellRenderer(acolumns));
|
||||
|
||||
m_jTicketTable.setRowHeight(40);
|
||||
m_jTicketTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
|
||||
m_jTableModel.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param l
|
||||
*/
|
||||
public void addListSelectionListener(ListSelectionListener l) {
|
||||
m_jTicketTable.getSelectionModel().addListSelectionListener(l);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param l
|
||||
*/
|
||||
public void removeListSelectionListener(ListSelectionListener l) {
|
||||
m_jTicketTable.getSelectionModel().removeListSelectionListener(l);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void clearTicketLines() {
|
||||
m_jTableModel.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param index
|
||||
* @param oLine
|
||||
*/
|
||||
public void setTicketLine(int index, TicketLineInfo oLine){
|
||||
m_jTableModel.setRow(index, oLine);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param oLine
|
||||
*/
|
||||
public void addTicketLine(TicketLineInfo oLine) {
|
||||
m_jTableModel.addRow(oLine);
|
||||
setSelectedIndex(m_jTableModel.getRowCount() - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param index
|
||||
* @param oLine
|
||||
*/
|
||||
public void insertTicketLine(int index, TicketLineInfo oLine) {
|
||||
m_jTableModel.insertRow(index, oLine);
|
||||
setSelectedIndex(index);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param i
|
||||
*/
|
||||
public void removeTicketLine(int i){
|
||||
m_jTableModel.removeRow(i);
|
||||
|
||||
if (i >= m_jTableModel.getRowCount()) {
|
||||
i = m_jTableModel.getRowCount() - 1;
|
||||
}
|
||||
|
||||
if ((i >= 0) && (i < m_jTableModel.getRowCount())) {
|
||||
setSelectedIndex(i);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param i
|
||||
*/
|
||||
public void setSelectedIndex(int i){
|
||||
m_jTicketTable.getSelectionModel().setSelectionInterval(i, i);
|
||||
Rectangle oRect = m_jTicketTable.getCellRect(i, 0, true);
|
||||
m_jTicketTable.scrollRectToVisible(oRect);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getSelectedIndex() {
|
||||
return m_jTicketTable.getSelectionModel().getMinSelectionIndex(); // solo sera uno, luego no importa...
|
||||
}
|
||||
|
||||
public int sortIndex(int i) {
|
||||
int[] selection = m_jTicketTable.getSelectedRows();
|
||||
for (i = 0; i < selection.length; i++) {
|
||||
selection[i] = m_jTicketTable.convertRowIndexToModel(selection[i]);
|
||||
}
|
||||
return m_jTicketTable.getRowSorter().convertRowIndexToView(i);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void selectionDown() {
|
||||
int i = m_jTicketTable.getSelectionModel().getMaxSelectionIndex();
|
||||
if (i < 0){
|
||||
i = 0;
|
||||
} else {
|
||||
i ++;
|
||||
if (i >= m_jTableModel.getRowCount()) {
|
||||
i = m_jTableModel.getRowCount() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ((i >= 0) && (i < m_jTableModel.getRowCount())) {
|
||||
setSelectedIndex(i);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void selectionUp() {
|
||||
int i = m_jTicketTable.getSelectionModel().getMinSelectionIndex();
|
||||
if (i < 0){
|
||||
i = m_jTableModel.getRowCount() - 1; // No hay ninguna seleccionada
|
||||
} else {
|
||||
i --;
|
||||
if (i < 0) {
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ((i >= 0) && (i < m_jTableModel.getRowCount())) {
|
||||
setSelectedIndex(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class TicketCellRenderer extends DefaultTableCellRenderer {
|
||||
|
||||
private final ColumnTicket[] m_acolumns;
|
||||
|
||||
public TicketCellRenderer(ColumnTicket[] acolumns) {
|
||||
m_acolumns = acolumns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value,
|
||||
boolean isSelected, boolean hasFocus, int row, int column){
|
||||
|
||||
JLabel aux = (JLabel) super.getTableCellRendererComponent(table, value,
|
||||
isSelected, hasFocus, row, column);
|
||||
aux.setVerticalAlignment(javax.swing.SwingConstants.TOP);
|
||||
aux.setHorizontalAlignment(m_acolumns[column].align);
|
||||
Font fName =aux.getFont();
|
||||
aux.setFont(new Font(fName.getName(),Font.PLAIN,14));
|
||||
|
||||
return aux;
|
||||
}
|
||||
}
|
||||
|
||||
private static class TicketCellRendererSent extends DefaultTableCellRenderer {
|
||||
|
||||
private final ColumnTicket[] m_acolumns;
|
||||
|
||||
public TicketCellRendererSent(ColumnTicket[] acolumns) {
|
||||
m_acolumns = acolumns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value,
|
||||
boolean isSelected, boolean hasFocus, int row, int column){
|
||||
|
||||
JLabel aux = (JLabel) super.getTableCellRendererComponent(table,
|
||||
value, isSelected, hasFocus, row, column);
|
||||
|
||||
aux.setVerticalAlignment(javax.swing.SwingConstants.TOP);
|
||||
aux.setHorizontalAlignment(m_acolumns[column].align);
|
||||
Font fName =aux.getFont();
|
||||
aux.setFont(new Font(fName.getName(),Font.PLAIN,12));
|
||||
aux.setBackground(Color.yellow);
|
||||
return aux;
|
||||
}
|
||||
}
|
||||
|
||||
private static class TicketTableModel extends AbstractTableModel {
|
||||
|
||||
private final ColumnTicket[] m_acolumns;
|
||||
private final ArrayList m_rows = new ArrayList();
|
||||
|
||||
public TicketTableModel(ColumnTicket[] acolumns) {
|
||||
m_acolumns = acolumns;
|
||||
}
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
return m_rows.size();
|
||||
}
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return m_acolumns.length;
|
||||
}
|
||||
@Override
|
||||
public String getColumnName(int column) {
|
||||
return AppLocal.getIntString(m_acolumns[column].name);
|
||||
// return m_acolumns[column].name;
|
||||
}
|
||||
@Override
|
||||
public Object getValueAt(int row, int column) {
|
||||
return ((String[]) m_rows.get(row))[column];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCellEditable(int row, int column) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
int old = getRowCount();
|
||||
if (old > 0) {
|
||||
m_rows.clear();
|
||||
fireTableRowsDeleted(0, old - 1);
|
||||
}
|
||||
}
|
||||
|
||||
public void setRow(int index, TicketLineInfo oLine){
|
||||
|
||||
String[] row = (String []) m_rows.get(index);
|
||||
for (int i = 0; i < m_acolumns.length; i++) {
|
||||
try {
|
||||
ScriptEngine script = ScriptFactory.getScriptEngine(ScriptFactory.VELOCITY);
|
||||
script.put("ticketline", oLine);
|
||||
row[i] = script.eval(m_acolumns[i].value).toString();
|
||||
} catch (ScriptException e) {
|
||||
row[i] = null;
|
||||
}
|
||||
fireTableCellUpdated(index, i);
|
||||
}
|
||||
}
|
||||
|
||||
public void addRow(TicketLineInfo oLine) {
|
||||
|
||||
insertRow(m_rows.size(), oLine);
|
||||
}
|
||||
|
||||
public void insertRow(int index, TicketLineInfo oLine) {
|
||||
|
||||
String[] row = new String[m_acolumns.length];
|
||||
for (int i = 0; i < m_acolumns.length; i++) {
|
||||
try {
|
||||
ScriptEngine script = ScriptFactory.getScriptEngine(ScriptFactory.VELOCITY);
|
||||
script.put("ticketline", oLine);
|
||||
row[i] = script.eval(m_acolumns[i].value).toString();
|
||||
} catch (ScriptException e) {
|
||||
row[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
m_rows.add(index, row);
|
||||
fireTableRowsInserted(index, index);
|
||||
}
|
||||
|
||||
public void removeRow(int row) {
|
||||
m_rows.remove(row);
|
||||
fireTableRowsDeleted(row, row);
|
||||
}
|
||||
}
|
||||
|
||||
private static class ColumnsHandler extends DefaultHandler {
|
||||
|
||||
private ArrayList m_columns = null;
|
||||
|
||||
public ColumnTicket[] getColumns() {
|
||||
return (ColumnTicket[]) m_columns.toArray(new ColumnTicket[m_columns.size()]);
|
||||
}
|
||||
@Override
|
||||
public void startDocument() throws SAXException {
|
||||
m_columns = new ArrayList();
|
||||
}
|
||||
@Override
|
||||
public void endDocument() throws SAXException {}
|
||||
@Override
|
||||
public void startElement(String uri, String localName, String qName,
|
||||
Attributes attributes) throws SAXException{
|
||||
if ("column".equals(qName)){
|
||||
ColumnTicket c = new ColumnTicket();
|
||||
c.name = attributes.getValue("name");
|
||||
c.width = Integer.parseInt(attributes.getValue("width"));
|
||||
String sAlign = attributes.getValue("align");
|
||||
switch (sAlign) {
|
||||
case "right":
|
||||
c.align = javax.swing.SwingConstants.RIGHT;
|
||||
break;
|
||||
case "center":
|
||||
c.align = javax.swing.SwingConstants.CENTER;
|
||||
break;
|
||||
default:
|
||||
c.align = javax.swing.SwingConstants.LEFT;
|
||||
break;
|
||||
}
|
||||
c.value = attributes.getValue("value");
|
||||
m_columns.add(c);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void endElement(String uri, String localName, String qName) throws SAXException {}
|
||||
@Override
|
||||
public void characters(char[] ch, int start, int length) throws SAXException {}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param state
|
||||
*/
|
||||
public void setSendStatus(Boolean state){
|
||||
sendStatus = state;
|
||||
}
|
||||
|
||||
private static class ColumnTicket {
|
||||
public String name;
|
||||
public int width;
|
||||
public int align;
|
||||
public String value;
|
||||
}
|
||||
|
||||
/** 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() {
|
||||
|
||||
m_jScrollTableTicket = new javax.swing.JScrollPane();
|
||||
m_jTicketTable = new javax.swing.JTable();
|
||||
|
||||
setLayout(new java.awt.BorderLayout());
|
||||
|
||||
m_jScrollTableTicket.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
m_jScrollTableTicket.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
||||
m_jScrollTableTicket.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
|
||||
m_jTicketTable.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
m_jTicketTable.setFocusable(false);
|
||||
m_jTicketTable.setIntercellSpacing(new java.awt.Dimension(0, 1));
|
||||
m_jTicketTable.setRequestFocusEnabled(false);
|
||||
m_jTicketTable.setShowVerticalLines(false);
|
||||
m_jScrollTableTicket.setViewportView(m_jTicketTable);
|
||||
|
||||
add(m_jScrollTableTicket, java.awt.BorderLayout.CENTER);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JScrollPane m_jScrollTableTicket;
|
||||
private javax.swing.JTable m_jTicketTable;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -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.sales;
|
||||
|
||||
import com.unicenta.pos.forms.AppView;
|
||||
import com.unicenta.pos.forms.DataLogicSales;
|
||||
import com.unicenta.pos.sales.restaurant.JTicketsBagRestaurantMap;
|
||||
import com.unicenta.pos.sales.restaurant.JTicketsBagRestaurant;
|
||||
import com.unicenta.pos.sales.shared.JTicketsBagShared;
|
||||
import com.unicenta.pos.sales.simple.JTicketsBagSimple;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
public abstract class JTicketsBag extends JPanel {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected AppView m_App;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected DataLogicSales m_dlSales;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected TicketsEditor m_panelticket;
|
||||
|
||||
/** Creates new form JTicketsBag
|
||||
* @param oApp
|
||||
* @param panelticket */
|
||||
public JTicketsBag(AppView oApp, TicketsEditor panelticket) {
|
||||
m_App = oApp;
|
||||
m_panelticket = panelticket;
|
||||
m_dlSales = (DataLogicSales) m_App.getBean("com.unicenta.pos.forms.DataLogicSales");
|
||||
}
|
||||
|
||||
public abstract void activate();
|
||||
public abstract boolean deactivate();
|
||||
public abstract void deleteTicket();
|
||||
protected abstract JComponent getBagComponent();
|
||||
protected abstract JComponent getNullComponent();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param sName
|
||||
* @param app
|
||||
* @param panelticket
|
||||
* @return
|
||||
*/
|
||||
public static JTicketsBag createTicketsBag(String sName, AppView app, TicketsEditor panelticket) {
|
||||
switch (sName) {
|
||||
case "standard":
|
||||
// return new JTicketsBagMulti(oApp, user, panelticket);
|
||||
return new JTicketsBagShared(app, panelticket);
|
||||
case "restaurant":
|
||||
return new JTicketsBagRestaurantMap(app, panelticket);
|
||||
default:
|
||||
// "simple"
|
||||
return new JTicketsBagSimple(app, panelticket);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,397 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<NonVisualComponents>
|
||||
<Component class="javax.swing.ButtonGroup" name="buttonGroup1">
|
||||
</Component>
|
||||
</NonVisualComponents>
|
||||
<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"/>
|
||||
<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,-63,0,0,2,68"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="m_jOptions">
|
||||
<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>
|
||||
<Container class="javax.swing.JPanel" name="m_jButtons">
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="m_jTicketId" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="32767" attributes="0"/>
|
||||
<Component id="jButton2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="5" pref="5" max="-2" attributes="0"/>
|
||||
<Component id="m_jEdit" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="5" pref="5" max="-2" attributes="0"/>
|
||||
<Component id="m_jRefund" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="5" pref="5" max="-2" attributes="0"/>
|
||||
<Component id="m_jPrint" min="-2" max="-2" 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"/>
|
||||
<Component id="m_jTicketId" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="5" pref="5" max="-2" attributes="0"/>
|
||||
<Component id="jButton2" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="5" pref="5" max="-2" attributes="0"/>
|
||||
<Component id="m_jEdit" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="5" pref="5" max="-2" attributes="0"/>
|
||||
<Component id="m_jRefund" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="5" pref="5" max="-2" attributes="0"/>
|
||||
<Component id="m_jPrint" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="m_jTicketId">
|
||||
<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="horizontalAlignment" type="int" value="0"/>
|
||||
<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>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="jButton2">
|
||||
<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/search24.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="tooltip.ticketsearch" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</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="[0, 4, 0, 4]"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</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"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="m_jEdit">
|
||||
<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/sale_editline.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="tooltip.ticketedit" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</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="[0, 4, 0, 4]"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</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"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jEditActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="m_jRefund">
|
||||
<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/inbox.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="tooltip.ticketrefund" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</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="[0, 4, 0, 4]"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</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"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jRefundActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="m_jPrint">
|
||||
<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/printer24.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="tooltip.ticketreprint" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</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="[0, 4, 0, 4]"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</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"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jPrintActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel2">
|
||||
|
||||
<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="m_jPanelTicket">
|
||||
<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>
|
||||
<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"/>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel3">
|
||||
<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="jPanel4">
|
||||
<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="jPanel5">
|
||||
<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.DesignGridBagLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="jButton1">
|
||||
<Properties>
|
||||
<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="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="tooltip.edit.findticket" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</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, 14, 8, 14]"/>
|
||||
</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"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
|
||||
</Events>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="1" gridY="0" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="5" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="com.unicenta.editor.JEditorIntegerPositive" name="m_jTicketEditor">
|
||||
<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.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</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 class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JRadioButton" name="jrbSales">
|
||||
<Properties>
|
||||
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
||||
<ComponentRef name="buttonGroup1"/>
|
||||
</Property>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="label.sales" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="tooltip.edit.salesopt" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="focusPainted" type="boolean" value="false"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JRadioButton" name="jrbRefunds">
|
||||
<Properties>
|
||||
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
||||
<ComponentRef name="buttonGroup1"/>
|
||||
</Property>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="1"/>
|
||||
</Property>
|
||||
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="0" green="0" red="ff" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="label.refunds" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="tooltip.edit.refundopt" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="focusPainted" type="boolean" value="false"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,613 @@
|
||||
// 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.sales;
|
||||
|
||||
import com.unicenta.pos.customers.DataLogicCustomers;
|
||||
import com.unicenta.pos.panels.JTicketsFinder;
|
||||
import com.unicenta.pos.ticket.FindTicketsInfo;
|
||||
import com.unicenta.pos.ticket.TicketTaxInfo;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import javax.swing.*;
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.gui.JMessageDialog;
|
||||
import com.unicenta.data.gui.ListKeyed;
|
||||
import com.unicenta.data.gui.MessageInf;
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
import com.unicenta.pos.forms.AppProperties;
|
||||
import com.unicenta.pos.forms.AppView;
|
||||
import com.unicenta.pos.forms.DataLogicSales;
|
||||
import com.unicenta.pos.forms.DataLogicSystem;
|
||||
import com.unicenta.pos.printer.DeviceTicket;
|
||||
import com.unicenta.pos.printer.TicketParser;
|
||||
import com.unicenta.pos.printer.TicketPrinterException;
|
||||
import com.unicenta.pos.scripting.ScriptEngine;
|
||||
import com.unicenta.pos.scripting.ScriptException;
|
||||
import com.unicenta.pos.scripting.ScriptFactory;
|
||||
import com.unicenta.pos.ticket.TicketInfo;
|
||||
import com.unicenta.pos.ticket.TicketLineInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
public class JTicketsBagTicket extends JTicketsBag {
|
||||
|
||||
private DataLogicSystem m_dlSystem = null;
|
||||
protected DataLogicCustomers dlCustomers = null;
|
||||
private final DataLogicSales m_dlSales;
|
||||
|
||||
private TaxesLogic taxeslogic;
|
||||
private ListKeyed taxcollection;
|
||||
|
||||
private final DeviceTicket m_TP;
|
||||
private final TicketParser m_TTP;
|
||||
private final TicketParser m_TTP2;
|
||||
|
||||
private TicketInfo m_ticket;
|
||||
private TicketInfo m_ticketCopy;
|
||||
|
||||
private final JTicketsBagTicketBag m_TicketsBagTicketBag;
|
||||
private final JPanelTicketEdits m_panelticketedit;
|
||||
|
||||
private final AppView m_App;
|
||||
|
||||
/** Creates new form JTicketsBagTicket
|
||||
* @param app
|
||||
* @param panelticket */
|
||||
public JTicketsBagTicket(AppView app, JPanelTicketEdits panelticket) {
|
||||
|
||||
super(app, panelticket);
|
||||
m_App = app;
|
||||
|
||||
m_panelticketedit = panelticket;
|
||||
m_dlSystem = (DataLogicSystem) m_App.getBean("com.unicenta.pos.forms.DataLogicSystem");
|
||||
m_dlSales = (DataLogicSales) m_App.getBean("com.unicenta.pos.forms.DataLogicSales");
|
||||
dlCustomers = (DataLogicCustomers) m_App.getBean("com.unicenta.pos.customers.DataLogicCustomers");
|
||||
AppProperties props = null;
|
||||
|
||||
m_TP = new DeviceTicket();
|
||||
|
||||
m_TTP = new TicketParser(m_TP, m_dlSystem); // display ticket
|
||||
m_TTP2 = new TicketParser(m_App.getDeviceTicket(), m_dlSystem); // print ticket
|
||||
|
||||
initComponents();
|
||||
|
||||
m_TicketsBagTicketBag = new JTicketsBagTicketBag(this);
|
||||
|
||||
m_jTicketEditor.addEditorKeys(m_jKeys);
|
||||
|
||||
m_jPanelTicket.add(m_TP.getDevicePrinter("1").getPrinterComponent(), BorderLayout.CENTER);
|
||||
|
||||
try {
|
||||
taxeslogic = new TaxesLogic(m_dlSales.getTaxList().list());
|
||||
} catch (BasicException ex) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void activate() {
|
||||
|
||||
m_ticket = null;
|
||||
m_ticketCopy = null;
|
||||
|
||||
printTicket();
|
||||
|
||||
m_jTicketEditor.reset();
|
||||
m_jTicketEditor.activate();
|
||||
|
||||
m_panelticketedit.setActiveTicket(null, null);
|
||||
|
||||
jrbSales.setSelected(true);
|
||||
|
||||
m_jEdit.setVisible(m_App.getAppUserView().getUser().hasPermission("sales.EditTicket"));
|
||||
m_jRefund.setVisible(m_App.getAppUserView().getUser().hasPermission("sales.RefundTicket"));
|
||||
m_jPrint.setVisible(m_App.getAppUserView().getUser().hasPermission("sales.PrintTicket"));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean deactivate() {
|
||||
|
||||
m_ticket = null;
|
||||
m_ticketCopy = null;
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void deleteTicket() {
|
||||
|
||||
if (m_ticketCopy != null) {
|
||||
try {
|
||||
m_dlSales.deleteTicket(m_ticketCopy, m_App.getInventoryLocation());
|
||||
} catch (BasicException eData) {
|
||||
MessageInf msg = new MessageInf(MessageInf.SGN_NOTICE,
|
||||
AppLocal.getIntString("message.nosaveticket"),
|
||||
eData);
|
||||
msg.show(this);
|
||||
}
|
||||
}
|
||||
|
||||
m_ticket = null;
|
||||
m_ticketCopy = null;
|
||||
resetToTicket();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void canceleditionTicket() {
|
||||
|
||||
m_ticketCopy = null;
|
||||
resetToTicket();
|
||||
}
|
||||
|
||||
private void resetToTicket() {
|
||||
printTicket();
|
||||
m_jTicketEditor.reset();
|
||||
m_jTicketEditor.activate();
|
||||
m_panelticketedit.setActiveTicket(null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected JComponent getBagComponent() {
|
||||
return m_TicketsBagTicketBag;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected JComponent getNullComponent() {
|
||||
return this;
|
||||
}
|
||||
|
||||
private void readTicket(int iTicketid, int iTickettype) {
|
||||
Integer findTicket=0;
|
||||
try {
|
||||
findTicket = m_jTicketEditor.getValueInteger();
|
||||
}catch (Exception e){
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
TicketInfo ticket = (iTicketid==-1)
|
||||
? m_dlSales.loadTicket(iTickettype, findTicket)
|
||||
: m_dlSales.loadTicket(iTickettype, iTicketid) ;
|
||||
|
||||
if (ticket == null) {
|
||||
JFrame frame = new JFrame();
|
||||
JOptionPane.showMessageDialog(frame,
|
||||
AppLocal.getIntString("message.notexiststicket"),
|
||||
AppLocal.getIntString("message.notexiststickettitle"),
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
|
||||
} else {
|
||||
m_ticket = ticket;
|
||||
m_ticketCopy = null;
|
||||
if(m_ticket.getTicketStatus()> 0) {
|
||||
JFrame frame = new JFrame();
|
||||
JOptionPane.showMessageDialog(frame,
|
||||
AppLocal.getIntString("message.ticketrefunded"),
|
||||
AppLocal.getIntString("message.ticketrefundedtitle"),
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
m_jEdit.setEnabled(false);
|
||||
m_jRefund.setEnabled(false);
|
||||
}else{
|
||||
if (m_ticket.getTicketStatus() > 0) {
|
||||
m_jEdit.setEnabled(false);
|
||||
m_jRefund.setEnabled(false);
|
||||
} else {
|
||||
m_jEdit.setEnabled(true);
|
||||
m_jRefund.setEnabled(true);
|
||||
}
|
||||
}
|
||||
try {
|
||||
taxeslogic.calculateTaxes(m_ticket);
|
||||
TicketTaxInfo[] taxlist = m_ticket.getTaxLines();
|
||||
} catch (TaxesException ex) {}
|
||||
|
||||
printTicket();
|
||||
}
|
||||
|
||||
} catch (BasicException e) {
|
||||
MessageInf msg = new MessageInf(MessageInf.SGN_WARNING,
|
||||
AppLocal.getIntString("message.cannotloadticket"), e);
|
||||
msg.show(this);
|
||||
}
|
||||
|
||||
m_jTicketEditor.reset();
|
||||
m_jTicketEditor.activate();
|
||||
}
|
||||
|
||||
private void printTicket() {
|
||||
|
||||
try {
|
||||
m_jEdit.setEnabled(
|
||||
m_ticket != null
|
||||
&& (m_ticket.getTicketType() == TicketInfo.RECEIPT_NORMAL
|
||||
&& m_ticket.getTicketStatus() == 0)
|
||||
&& m_dlSales.isCashActive(m_ticket.getActiveCash()));
|
||||
} catch (BasicException e) {
|
||||
m_jEdit.setEnabled(false);
|
||||
m_jRefund.setEnabled(false);
|
||||
}
|
||||
|
||||
if (m_ticket != null
|
||||
&& (m_ticket.getTicketType() == TicketInfo.RECEIPT_NORMAL
|
||||
&& m_ticket.getTicketStatus() == 0)) {
|
||||
m_jRefund.setEnabled(true);
|
||||
}
|
||||
|
||||
m_jPrint.setEnabled(m_ticket != null);
|
||||
|
||||
m_TP.getDevicePrinter("1").reset();
|
||||
|
||||
if (m_ticket == null) {
|
||||
m_jTicketId.setText(null);
|
||||
} else {
|
||||
m_jTicketId.setText(m_ticket.getName());
|
||||
|
||||
try {
|
||||
ScriptEngine script = ScriptFactory.getScriptEngine(ScriptFactory.VELOCITY);
|
||||
script.put("ticket", m_ticket);
|
||||
script.put("taxes", m_ticket.getTaxLines());
|
||||
m_TTP.printTicket(script.eval(m_dlSystem.getResourceAsXML("Printer.TicketPreview")).toString());
|
||||
} catch ( ScriptException | TicketPrinterException e) {
|
||||
MessageInf msg = new MessageInf(MessageInf.SGN_WARNING,
|
||||
AppLocal.getIntString("message.cannotprintticket"), e);
|
||||
msg.show(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() {
|
||||
java.awt.GridBagConstraints gridBagConstraints;
|
||||
|
||||
buttonGroup1 = new javax.swing.ButtonGroup();
|
||||
m_jOptions = new javax.swing.JPanel();
|
||||
m_jButtons = new javax.swing.JPanel();
|
||||
m_jTicketId = new javax.swing.JLabel();
|
||||
jButton2 = new javax.swing.JButton();
|
||||
m_jEdit = new javax.swing.JButton();
|
||||
m_jRefund = new javax.swing.JButton();
|
||||
m_jPrint = new javax.swing.JButton();
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
m_jPanelTicket = new javax.swing.JPanel();
|
||||
jPanel3 = new javax.swing.JPanel();
|
||||
jPanel4 = new javax.swing.JPanel();
|
||||
m_jKeys = new com.unicenta.editor.JEditorKeys();
|
||||
jPanel5 = new javax.swing.JPanel();
|
||||
jButton1 = new javax.swing.JButton();
|
||||
m_jTicketEditor = new com.unicenta.editor.JEditorIntegerPositive();
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
jrbSales = new javax.swing.JRadioButton();
|
||||
jrbRefunds = new javax.swing.JRadioButton();
|
||||
|
||||
setLayout(new java.awt.BorderLayout());
|
||||
|
||||
m_jTicketId.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
m_jTicketId.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
m_jTicketId.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_jTicketId.setOpaque(true);
|
||||
m_jTicketId.setPreferredSize(new java.awt.Dimension(200, 30));
|
||||
m_jTicketId.setRequestFocusEnabled(false);
|
||||
|
||||
jButton2.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
|
||||
jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/search24.png"))); // NOI18N
|
||||
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("pos_messages"); // NOI18N
|
||||
jButton2.setToolTipText(bundle.getString("tooltip.ticketsearch")); // NOI18N
|
||||
jButton2.setFocusPainted(false);
|
||||
jButton2.setFocusable(false);
|
||||
jButton2.setMargin(new java.awt.Insets(0, 4, 0, 4));
|
||||
jButton2.setMaximumSize(new java.awt.Dimension(50, 40));
|
||||
jButton2.setMinimumSize(new java.awt.Dimension(50, 40));
|
||||
jButton2.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
jButton2.setRequestFocusEnabled(false);
|
||||
jButton2.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jButton2ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
m_jEdit.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
|
||||
m_jEdit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/sale_editline.png"))); // NOI18N
|
||||
m_jEdit.setToolTipText(bundle.getString("tooltip.ticketedit")); // NOI18N
|
||||
m_jEdit.setFocusPainted(false);
|
||||
m_jEdit.setFocusable(false);
|
||||
m_jEdit.setMargin(new java.awt.Insets(0, 4, 0, 4));
|
||||
m_jEdit.setMaximumSize(new java.awt.Dimension(50, 40));
|
||||
m_jEdit.setMinimumSize(new java.awt.Dimension(50, 40));
|
||||
m_jEdit.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
m_jEdit.setRequestFocusEnabled(false);
|
||||
m_jEdit.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jEditActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
m_jRefund.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
|
||||
m_jRefund.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/inbox.png"))); // NOI18N
|
||||
m_jRefund.setToolTipText(bundle.getString("tooltip.ticketrefund")); // NOI18N
|
||||
m_jRefund.setFocusPainted(false);
|
||||
m_jRefund.setFocusable(false);
|
||||
m_jRefund.setMargin(new java.awt.Insets(0, 4, 0, 4));
|
||||
m_jRefund.setMaximumSize(new java.awt.Dimension(50, 40));
|
||||
m_jRefund.setMinimumSize(new java.awt.Dimension(50, 40));
|
||||
m_jRefund.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
m_jRefund.setRequestFocusEnabled(false);
|
||||
m_jRefund.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jRefundActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
m_jPrint.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
|
||||
m_jPrint.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/printer24.png"))); // NOI18N
|
||||
m_jPrint.setToolTipText(bundle.getString("tooltip.ticketreprint")); // NOI18N
|
||||
m_jPrint.setFocusPainted(false);
|
||||
m_jPrint.setFocusable(false);
|
||||
m_jPrint.setMargin(new java.awt.Insets(0, 4, 0, 4));
|
||||
m_jPrint.setMaximumSize(new java.awt.Dimension(50, 40));
|
||||
m_jPrint.setMinimumSize(new java.awt.Dimension(50, 40));
|
||||
m_jPrint.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
m_jPrint.setRequestFocusEnabled(false);
|
||||
m_jPrint.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jPrintActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
org.jdesktop.layout.GroupLayout m_jButtonsLayout = new org.jdesktop.layout.GroupLayout(m_jButtons);
|
||||
m_jButtons.setLayout(m_jButtonsLayout);
|
||||
m_jButtonsLayout.setHorizontalGroup(
|
||||
m_jButtonsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(m_jButtonsLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.add(m_jTicketId, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.add(jButton2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.add(5, 5, 5)
|
||||
.add(m_jEdit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.add(5, 5, 5)
|
||||
.add(m_jRefund, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.add(5, 5, 5)
|
||||
.add(m_jPrint, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
);
|
||||
m_jButtonsLayout.setVerticalGroup(
|
||||
m_jButtonsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(m_jButtonsLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.add(m_jTicketId, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
.add(m_jButtonsLayout.createSequentialGroup()
|
||||
.add(5, 5, 5)
|
||||
.add(jButton2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
.add(m_jButtonsLayout.createSequentialGroup()
|
||||
.add(5, 5, 5)
|
||||
.add(m_jEdit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
.add(m_jButtonsLayout.createSequentialGroup()
|
||||
.add(5, 5, 5)
|
||||
.add(m_jRefund, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
.add(m_jButtonsLayout.createSequentialGroup()
|
||||
.add(5, 5, 5)
|
||||
.add(m_jPrint, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
);
|
||||
|
||||
m_jOptions.add(m_jButtons);
|
||||
|
||||
jPanel2.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
|
||||
m_jOptions.add(jPanel2);
|
||||
|
||||
add(m_jOptions, java.awt.BorderLayout.NORTH);
|
||||
|
||||
m_jPanelTicket.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
m_jPanelTicket.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
|
||||
m_jPanelTicket.setLayout(new java.awt.BorderLayout());
|
||||
add(m_jPanelTicket, java.awt.BorderLayout.CENTER);
|
||||
|
||||
jPanel3.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jPanel4.setLayout(new javax.swing.BoxLayout(jPanel4, javax.swing.BoxLayout.Y_AXIS));
|
||||
|
||||
m_jKeys.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jKeysActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel4.add(m_jKeys);
|
||||
|
||||
jPanel5.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
jPanel5.setLayout(new java.awt.GridBagLayout());
|
||||
|
||||
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/ok.png"))); // NOI18N
|
||||
jButton1.setToolTipText(bundle.getString("tooltip.edit.findticket")); // NOI18N
|
||||
jButton1.setFocusPainted(false);
|
||||
jButton1.setFocusable(false);
|
||||
jButton1.setMargin(new java.awt.Insets(8, 14, 8, 14));
|
||||
jButton1.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
jButton1.setRequestFocusEnabled(false);
|
||||
jButton1.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jButton1ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 1;
|
||||
gridBagConstraints.gridy = 0;
|
||||
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
|
||||
gridBagConstraints.weightx = 1.0;
|
||||
gridBagConstraints.weighty = 1.0;
|
||||
gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
|
||||
jPanel5.add(jButton1, gridBagConstraints);
|
||||
|
||||
m_jTicketEditor.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
m_jTicketEditor.setPreferredSize(new java.awt.Dimension(130, 30));
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 0;
|
||||
jPanel5.add(m_jTicketEditor, gridBagConstraints);
|
||||
|
||||
jPanel4.add(jPanel5);
|
||||
|
||||
jPanel3.add(jPanel4, java.awt.BorderLayout.NORTH);
|
||||
|
||||
buttonGroup1.add(jrbSales);
|
||||
jrbSales.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
|
||||
jrbSales.setText(AppLocal.getIntString("label.sales")); // NOI18N
|
||||
jrbSales.setToolTipText(bundle.getString("tooltip.edit.salesopt")); // NOI18N
|
||||
jrbSales.setFocusPainted(false);
|
||||
jrbSales.setFocusable(false);
|
||||
jrbSales.setRequestFocusEnabled(false);
|
||||
jPanel1.add(jrbSales);
|
||||
|
||||
buttonGroup1.add(jrbRefunds);
|
||||
jrbRefunds.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
|
||||
jrbRefunds.setForeground(new java.awt.Color(255, 0, 0));
|
||||
jrbRefunds.setText(AppLocal.getIntString("label.refunds")); // NOI18N
|
||||
jrbRefunds.setToolTipText(bundle.getString("tooltip.edit.refundopt")); // NOI18N
|
||||
jrbRefunds.setFocusPainted(false);
|
||||
jrbRefunds.setFocusable(false);
|
||||
jrbRefunds.setRequestFocusEnabled(false);
|
||||
jPanel1.add(jrbRefunds);
|
||||
|
||||
jPanel3.add(jPanel1, java.awt.BorderLayout.CENTER);
|
||||
|
||||
add(jPanel3, java.awt.BorderLayout.EAST);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void m_jEditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jEditActionPerformed
|
||||
|
||||
m_ticketCopy = m_ticket;
|
||||
m_TicketsBagTicketBag.showEdit();
|
||||
m_panelticketedit.showCatalog();
|
||||
m_ticketCopy.setOldTicket(true);
|
||||
m_panelticketedit.setActiveTicket(m_ticket.copyTicket(), null);
|
||||
|
||||
}//GEN-LAST:event_m_jEditActionPerformed
|
||||
|
||||
private void m_jPrintActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jPrintActionPerformed
|
||||
|
||||
if (m_ticket != null) {
|
||||
try {
|
||||
ScriptEngine script = ScriptFactory.getScriptEngine(ScriptFactory.VELOCITY);
|
||||
script.put("ticket", m_ticket);
|
||||
script.put("taxes", m_ticket.getTaxLines());
|
||||
m_TTP2.printTicket(script.eval(m_dlSystem.getResourceAsXML("Printer.TicketPreview")).toString());
|
||||
} catch (ScriptException | TicketPrinterException e) {
|
||||
JMessageDialog.showMessage(this,
|
||||
new MessageInf(MessageInf.SGN_NOTICE,
|
||||
AppLocal.getIntString("message.cannotprint"), e));
|
||||
}
|
||||
}
|
||||
|
||||
}//GEN-LAST:event_m_jPrintActionPerformed
|
||||
|
||||
private void m_jRefundActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jRefundActionPerformed
|
||||
|
||||
java.util.List aRefundLines = new ArrayList();
|
||||
|
||||
for(int i = 0; i < m_ticket.getLinesCount(); i++) {
|
||||
TicketLineInfo newline = new TicketLineInfo(m_ticket.getLine(i));
|
||||
aRefundLines.add(newline);
|
||||
}
|
||||
|
||||
m_ticketCopy = null;
|
||||
m_TicketsBagTicketBag.showRefund();
|
||||
m_panelticketedit.showRefundLines(aRefundLines);
|
||||
|
||||
TicketInfo refundticket = new TicketInfo();
|
||||
refundticket.setTicketType(TicketInfo.RECEIPT_REFUND);
|
||||
refundticket.setTicketStatus(m_ticket.getTicketId());
|
||||
refundticket.setCustomer(m_ticket.getCustomer());
|
||||
refundticket.setPayments(m_ticket.getPayments());
|
||||
refundticket.setOldTicket(true);
|
||||
m_panelticketedit.setActiveTicket(refundticket, null);
|
||||
}//GEN-LAST:event_m_jRefundActionPerformed
|
||||
|
||||
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
|
||||
|
||||
readTicket(-1, jrbSales.isSelected() ? 0 : 1);
|
||||
|
||||
}//GEN-LAST:event_jButton1ActionPerformed
|
||||
|
||||
private void m_jKeysActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jKeysActionPerformed
|
||||
|
||||
readTicket(-1, jrbSales.isSelected() ? 0 : 1);
|
||||
|
||||
}//GEN-LAST:event_m_jKeysActionPerformed
|
||||
|
||||
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
|
||||
JTicketsFinder finder = JTicketsFinder.getReceiptFinder(this, m_dlSales, dlCustomers);
|
||||
finder.setVisible(true);
|
||||
FindTicketsInfo selectedTicket = finder.getSelectedCustomer();
|
||||
|
||||
if (selectedTicket == null) {
|
||||
m_jTicketEditor.reset();
|
||||
m_jTicketEditor.activate();
|
||||
} else {
|
||||
readTicket(selectedTicket.getTicketId(), selectedTicket.getTicketType());
|
||||
}
|
||||
}//GEN-LAST:event_jButton2ActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.ButtonGroup buttonGroup1;
|
||||
private javax.swing.JButton jButton1;
|
||||
private javax.swing.JButton jButton2;
|
||||
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.JRadioButton jrbRefunds;
|
||||
private javax.swing.JRadioButton jrbSales;
|
||||
private javax.swing.JPanel m_jButtons;
|
||||
private javax.swing.JButton m_jEdit;
|
||||
private com.unicenta.editor.JEditorKeys m_jKeys;
|
||||
private javax.swing.JPanel m_jOptions;
|
||||
private javax.swing.JPanel m_jPanelTicket;
|
||||
private javax.swing.JButton m_jPrint;
|
||||
private javax.swing.JButton m_jRefund;
|
||||
private com.unicenta.editor.JEditorIntegerPositive m_jTicketEditor;
|
||||
private javax.swing.JLabel m_jTicketId;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
<?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,52,0,0,1,-112"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignCardLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanEdit">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignCardLayout" value="org.netbeans.modules.form.compat2.layouts.DesignCardLayout$CardConstraintsDescription">
|
||||
<CardConstraints cardName="edit"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
|
||||
<Property name="alignment" type="int" value="0"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="m_jBtnDelete">
|
||||
<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/sale_delete.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="button.deleteticket" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Delete current Ticket"/>
|
||||
<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="[0, 4, 0, 4]"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</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"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jBtnDeleteActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="m_jBtnCancel">
|
||||
<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("{key}")"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Cancel Action"/>
|
||||
<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="[0, 4, 0, 4]"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</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"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jBtnCancelActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanRefund">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignCardLayout" value="org.netbeans.modules.form.compat2.layouts.DesignCardLayout$CardConstraintsDescription">
|
||||
<CardConstraints cardName="refund"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
|
||||
<Property name="alignment" type="int" value="0"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="m_jBtnCancel1">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/com/unicenta/images/fileclose.png"/>
|
||||
</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, 14, 8, 14]"/>
|
||||
</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"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jBtnCancel1ActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,170 @@
|
||||
// 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.sales;
|
||||
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
import java.awt.CardLayout;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
public class JTicketsBagTicketBag extends javax.swing.JPanel {
|
||||
|
||||
private final JTicketsBagTicket m_ticketsbagticket;
|
||||
|
||||
/** Creates new form JTicketsBagTicketBag
|
||||
* @param ticketsbagticket */
|
||||
public JTicketsBagTicketBag(JTicketsBagTicket ticketsbagticket) {
|
||||
m_ticketsbagticket = ticketsbagticket;
|
||||
initComponents();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void showEdit() {
|
||||
showView("edit");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void showRefund() {
|
||||
showView("refund");
|
||||
}
|
||||
|
||||
private void showView(String view) {
|
||||
CardLayout cl = (CardLayout)(getLayout());
|
||||
cl.show(this, view);
|
||||
}
|
||||
|
||||
/** 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() {
|
||||
|
||||
jPanEdit = new javax.swing.JPanel();
|
||||
m_jBtnDelete = new javax.swing.JButton();
|
||||
m_jBtnCancel = new javax.swing.JButton();
|
||||
jPanRefund = new javax.swing.JPanel();
|
||||
m_jBtnCancel1 = new javax.swing.JButton();
|
||||
|
||||
setLayout(new java.awt.CardLayout());
|
||||
|
||||
jPanEdit.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
|
||||
|
||||
m_jBtnDelete.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
m_jBtnDelete.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/sale_delete.png"))); // NOI18N
|
||||
m_jBtnDelete.setText(AppLocal.getIntString("button.deleteticket")); // NOI18N
|
||||
m_jBtnDelete.setToolTipText("Delete current Ticket");
|
||||
m_jBtnDelete.setFocusPainted(false);
|
||||
m_jBtnDelete.setFocusable(false);
|
||||
m_jBtnDelete.setMargin(new java.awt.Insets(0, 4, 0, 4));
|
||||
m_jBtnDelete.setMaximumSize(new java.awt.Dimension(50, 40));
|
||||
m_jBtnDelete.setMinimumSize(new java.awt.Dimension(50, 40));
|
||||
m_jBtnDelete.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
m_jBtnDelete.setRequestFocusEnabled(false);
|
||||
m_jBtnDelete.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jBtnDeleteActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanEdit.add(m_jBtnDelete);
|
||||
|
||||
m_jBtnCancel.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
m_jBtnCancel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/cancel.png"))); // NOI18N
|
||||
m_jBtnCancel.setText(AppLocal.getIntString("button.cancel")); // NOI18N
|
||||
m_jBtnCancel.setToolTipText("Cancel Action");
|
||||
m_jBtnCancel.setFocusPainted(false);
|
||||
m_jBtnCancel.setFocusable(false);
|
||||
m_jBtnCancel.setMargin(new java.awt.Insets(0, 4, 0, 4));
|
||||
m_jBtnCancel.setMaximumSize(new java.awt.Dimension(50, 40));
|
||||
m_jBtnCancel.setMinimumSize(new java.awt.Dimension(50, 40));
|
||||
m_jBtnCancel.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
m_jBtnCancel.setRequestFocusEnabled(false);
|
||||
m_jBtnCancel.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jBtnCancelActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanEdit.add(m_jBtnCancel);
|
||||
|
||||
add(jPanEdit, "edit");
|
||||
|
||||
jPanRefund.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
|
||||
|
||||
m_jBtnCancel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/fileclose.png"))); // NOI18N
|
||||
m_jBtnCancel1.setFocusPainted(false);
|
||||
m_jBtnCancel1.setFocusable(false);
|
||||
m_jBtnCancel1.setMargin(new java.awt.Insets(8, 14, 8, 14));
|
||||
m_jBtnCancel1.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
m_jBtnCancel1.setRequestFocusEnabled(false);
|
||||
m_jBtnCancel1.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jBtnCancel1ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanRefund.add(m_jBtnCancel1);
|
||||
|
||||
add(jPanRefund, "refund");
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void m_jBtnCancel1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jBtnCancel1ActionPerformed
|
||||
|
||||
m_ticketsbagticket.canceleditionTicket();
|
||||
|
||||
}//GEN-LAST:event_m_jBtnCancel1ActionPerformed
|
||||
|
||||
private void m_jBtnDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jBtnDeleteActionPerformed
|
||||
|
||||
int res = JOptionPane.showConfirmDialog(this,
|
||||
AppLocal.getIntString("message.wannadelete"),
|
||||
AppLocal.getIntString("title.editor"),
|
||||
JOptionPane.YES_NO_OPTION,
|
||||
JOptionPane.QUESTION_MESSAGE);
|
||||
|
||||
if (res == JOptionPane.YES_OPTION) {
|
||||
m_ticketsbagticket.deleteTicket();
|
||||
|
||||
}
|
||||
|
||||
}//GEN-LAST:event_m_jBtnDeleteActionPerformed
|
||||
|
||||
private void m_jBtnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jBtnCancelActionPerformed
|
||||
|
||||
m_ticketsbagticket.canceleditionTicket();
|
||||
|
||||
}//GEN-LAST:event_m_jBtnCancelActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JPanel jPanEdit;
|
||||
private javax.swing.JPanel jPanRefund;
|
||||
private javax.swing.JButton m_jBtnCancel;
|
||||
private javax.swing.JButton m_jBtnCancel1;
|
||||
private javax.swing.JButton m_jBtnDelete;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.unicenta.pos.sales;
|
||||
|
||||
import com.unicenta.data.loader.Session;
|
||||
import com.unicenta.pos.forms.AppView;
|
||||
import com.unicenta.pos.forms.DataLogicSystem;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
public class KitchenDisplay {
|
||||
private Session s;
|
||||
private Connection con;
|
||||
private Statement stmt;
|
||||
private PreparedStatement pstmt;
|
||||
private String SQL;
|
||||
private ResultSet rs;
|
||||
private AppView m_App;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected DataLogicSystem dlSystem;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param oApp
|
||||
*/
|
||||
public KitchenDisplay(AppView oApp) {
|
||||
m_App=oApp;
|
||||
|
||||
//get database connection details
|
||||
try{
|
||||
s=m_App.getSession();
|
||||
con=s.getConnection();
|
||||
}
|
||||
// catch (Exception e){System.out.print("No session or connection");
|
||||
catch (Exception e){ }
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ID
|
||||
* @param table
|
||||
* @param pickupID
|
||||
* @param product
|
||||
* @param multiply
|
||||
* @param attributes
|
||||
*/
|
||||
public void addRecord(String ID, String table, String pickupID, String product, String multiply, String attributes){
|
||||
DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
|
||||
Date date = new Date();
|
||||
|
||||
try{
|
||||
SQL = "INSERT INTO KITCHENDISPLAY (ID, ORDERTIME, PLACE, PICKUPID, PRODUCT, MULTIPLY, ATTRIBUTES) VALUES (?, ?, ?, ?, ?, ?, ?) ";
|
||||
pstmt=con.prepareStatement(SQL);
|
||||
pstmt.setString(1,ID);
|
||||
pstmt.setString(2,dateFormat.format(date).toString());
|
||||
pstmt.setString(3,table);
|
||||
pstmt.setString(4,pickupID);
|
||||
pstmt.setString(5,product);
|
||||
pstmt.setString(6,multiply);
|
||||
pstmt.setString(7,attributes);
|
||||
pstmt.executeUpdate();
|
||||
}catch(Exception e){
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// stmt = (Statement) con.createStatement();
|
||||
// rs = stmt.executeQuery(SQL);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.unicenta.pos.sales;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jack
|
||||
*/
|
||||
public class MenuActionListener {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,235 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.5" 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="caption.split" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</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,-42,0,0,2,-38"/>
|
||||
<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="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 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="South"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
|
||||
<Property name="alignment" type="int" value="2"/>
|
||||
</Layout>
|
||||
<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("{key}")"/>
|
||||
</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>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</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="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/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("{key}")"/>
|
||||
</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>
|
||||
<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>
|
||||
<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 class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel5">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
</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>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="jBtnToRightAll">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/com/unicenta/images/2rightarrow.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Split All Line Items"/>
|
||||
<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, 14, 8, 14]"/>
|
||||
</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"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jBtnToRightAllActionPerformed"/>
|
||||
</Events>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="-1" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="jBtnToRightOne">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/com/unicenta/images/1rightarrow.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Split only one of the Line Items"/>
|
||||
<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, 14, 8, 14]"/>
|
||||
</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"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jBtnToRightOneActionPerformed"/>
|
||||
</Events>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="-1" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="jBtnToLeftOne">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/com/unicenta/images/1leftarrow.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Un-Split only one of the Line Items"/>
|
||||
<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, 14, 8, 14]"/>
|
||||
</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"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jBtnToLeftOneActionPerformed"/>
|
||||
</Events>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="-1" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="jBtnToLeftAll">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/com/unicenta/images/2leftarrow.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Un-Split All Line Items"/>
|
||||
<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, 14, 8, 14]"/>
|
||||
</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"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jBtnToLeftAllActionPerformed"/>
|
||||
</Events>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="-1" gridY="3" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel3">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,339 @@
|
||||
// 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.sales;
|
||||
|
||||
import com.unicenta.pos.customers.DataLogicCustomers;
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
import com.unicenta.pos.forms.DataLogicSales;
|
||||
import com.unicenta.pos.ticket.TicketInfo;
|
||||
import com.unicenta.pos.ticket.TicketLineInfo;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dialog;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Window;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author adrianromero
|
||||
*/
|
||||
public class ReceiptSplit extends javax.swing.JDialog {
|
||||
|
||||
private boolean accepted;
|
||||
|
||||
SimpleReceipt receiptone;
|
||||
SimpleReceipt receipttwo;
|
||||
|
||||
/** Creates new form ReceiptSplit
|
||||
* @param parent */
|
||||
protected ReceiptSplit(java.awt.Frame parent) {
|
||||
super(parent, true);
|
||||
}
|
||||
/** Creates new form ReceiptSplit
|
||||
* @param parent */
|
||||
protected ReceiptSplit(java.awt.Dialog parent) {
|
||||
super(parent, true);
|
||||
}
|
||||
|
||||
private void init(String ticketline, DataLogicSales dlSales, DataLogicCustomers dlCustomers, TaxesLogic taxeslogic) {
|
||||
|
||||
initComponents();
|
||||
getRootPane().setDefaultButton(m_jButtonOK);
|
||||
|
||||
receiptone = new SimpleReceipt(ticketline, dlSales, dlCustomers, taxeslogic);
|
||||
receiptone.setCustomerEnabled(false);
|
||||
jPanel5.add(receiptone, BorderLayout.CENTER);
|
||||
|
||||
receipttwo = new SimpleReceipt(ticketline, dlSales, dlCustomers, taxeslogic);
|
||||
jPanel3.add(receipttwo, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param parent
|
||||
* @param ticketline
|
||||
* @param dlSales
|
||||
* @param dlCustomers
|
||||
* @param taxeslogic
|
||||
* @return
|
||||
*/
|
||||
public static ReceiptSplit getDialog(Component parent, String ticketline, DataLogicSales dlSales, DataLogicCustomers dlCustomers, TaxesLogic taxeslogic) {
|
||||
|
||||
Window window = getWindow(parent);
|
||||
|
||||
ReceiptSplit myreceiptsplit;
|
||||
|
||||
if (window instanceof Frame) {
|
||||
myreceiptsplit = new ReceiptSplit((Frame) window);
|
||||
} else {
|
||||
myreceiptsplit = new ReceiptSplit((Dialog) window);
|
||||
}
|
||||
|
||||
myreceiptsplit.init(ticketline, dlSales, dlCustomers, taxeslogic);
|
||||
|
||||
return myreceiptsplit;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param parent
|
||||
* @return
|
||||
*/
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ticket
|
||||
* @param ticket2
|
||||
* @param ticketext
|
||||
* @return
|
||||
*/
|
||||
public boolean showDialog(TicketInfo ticket, TicketInfo ticket2, Object ticketext) {
|
||||
|
||||
receiptone.setTicket(ticket, ticketext);
|
||||
receipttwo.setTicket(ticket2, ticketext);
|
||||
|
||||
setVisible(true);
|
||||
return accepted;
|
||||
}
|
||||
|
||||
/** 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() {
|
||||
java.awt.GridBagConstraints gridBagConstraints;
|
||||
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
m_jButtonCancel = new javax.swing.JButton();
|
||||
m_jButtonOK = new javax.swing.JButton();
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
jPanel5 = new javax.swing.JPanel();
|
||||
jPanel4 = new javax.swing.JPanel();
|
||||
jBtnToRightAll = new javax.swing.JButton();
|
||||
jBtnToRightOne = new javax.swing.JButton();
|
||||
jBtnToLeftOne = new javax.swing.JButton();
|
||||
jBtnToLeftAll = new javax.swing.JButton();
|
||||
jPanel3 = new javax.swing.JPanel();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
setTitle(AppLocal.getIntString("caption.split")); // NOI18N
|
||||
setResizable(false);
|
||||
|
||||
jPanel2.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
|
||||
|
||||
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.setRequestFocusEnabled(false);
|
||||
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, 12)); // 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.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);
|
||||
|
||||
getContentPane().add(jPanel2, java.awt.BorderLayout.SOUTH);
|
||||
|
||||
jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.LINE_AXIS));
|
||||
|
||||
jPanel5.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
jPanel5.setLayout(new java.awt.BorderLayout());
|
||||
jPanel1.add(jPanel5);
|
||||
|
||||
jPanel4.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
jPanel4.setLayout(new java.awt.GridBagLayout());
|
||||
|
||||
jBtnToRightAll.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/2rightarrow.png"))); // NOI18N
|
||||
jBtnToRightAll.setToolTipText("Split All Line Items");
|
||||
jBtnToRightAll.setFocusPainted(false);
|
||||
jBtnToRightAll.setFocusable(false);
|
||||
jBtnToRightAll.setMargin(new java.awt.Insets(8, 14, 8, 14));
|
||||
jBtnToRightAll.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
jBtnToRightAll.setRequestFocusEnabled(false);
|
||||
jBtnToRightAll.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jBtnToRightAllActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridy = 0;
|
||||
jPanel4.add(jBtnToRightAll, gridBagConstraints);
|
||||
|
||||
jBtnToRightOne.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/1rightarrow.png"))); // NOI18N
|
||||
jBtnToRightOne.setToolTipText("Split only one of the Line Items");
|
||||
jBtnToRightOne.setFocusPainted(false);
|
||||
jBtnToRightOne.setFocusable(false);
|
||||
jBtnToRightOne.setMargin(new java.awt.Insets(8, 14, 8, 14));
|
||||
jBtnToRightOne.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
jBtnToRightOne.setRequestFocusEnabled(false);
|
||||
jBtnToRightOne.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jBtnToRightOneActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridy = 1;
|
||||
gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
|
||||
jPanel4.add(jBtnToRightOne, gridBagConstraints);
|
||||
|
||||
jBtnToLeftOne.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/1leftarrow.png"))); // NOI18N
|
||||
jBtnToLeftOne.setToolTipText("Un-Split only one of the Line Items");
|
||||
jBtnToLeftOne.setFocusPainted(false);
|
||||
jBtnToLeftOne.setFocusable(false);
|
||||
jBtnToLeftOne.setMargin(new java.awt.Insets(8, 14, 8, 14));
|
||||
jBtnToLeftOne.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
jBtnToLeftOne.setRequestFocusEnabled(false);
|
||||
jBtnToLeftOne.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jBtnToLeftOneActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridy = 2;
|
||||
gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
|
||||
jPanel4.add(jBtnToLeftOne, gridBagConstraints);
|
||||
|
||||
jBtnToLeftAll.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/2leftarrow.png"))); // NOI18N
|
||||
jBtnToLeftAll.setToolTipText("Un-Split All Line Items");
|
||||
jBtnToLeftAll.setFocusPainted(false);
|
||||
jBtnToLeftAll.setFocusable(false);
|
||||
jBtnToLeftAll.setMargin(new java.awt.Insets(8, 14, 8, 14));
|
||||
jBtnToLeftAll.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
jBtnToLeftAll.setRequestFocusEnabled(false);
|
||||
jBtnToLeftAll.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jBtnToLeftAllActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridy = 3;
|
||||
gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
|
||||
jPanel4.add(jBtnToLeftAll, gridBagConstraints);
|
||||
|
||||
jPanel1.add(jPanel4);
|
||||
|
||||
jPanel3.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
jPanel3.setLayout(new java.awt.BorderLayout());
|
||||
jPanel1.add(jPanel3);
|
||||
|
||||
getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
|
||||
|
||||
setSize(new java.awt.Dimension(730, 470));
|
||||
setLocationRelativeTo(null);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void m_jButtonOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jButtonOKActionPerformed
|
||||
|
||||
if (receipttwo.getTicket().getLinesCount() > 0) {
|
||||
accepted = true;
|
||||
dispose();
|
||||
}
|
||||
|
||||
}//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 jBtnToRightAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnToRightAllActionPerformed
|
||||
|
||||
TicketLineInfo[] lines = receiptone.getSelectedLines();
|
||||
if (lines != null) {
|
||||
receipttwo.addSelectedLines(lines);
|
||||
}
|
||||
|
||||
}//GEN-LAST:event_jBtnToRightAllActionPerformed
|
||||
|
||||
private void jBtnToRightOneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnToRightOneActionPerformed
|
||||
|
||||
TicketLineInfo[] lines = receiptone.getSelectedLinesUnit();
|
||||
if (lines != null) {
|
||||
receipttwo.addSelectedLines(lines);
|
||||
}
|
||||
|
||||
}//GEN-LAST:event_jBtnToRightOneActionPerformed
|
||||
|
||||
private void jBtnToLeftOneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnToLeftOneActionPerformed
|
||||
|
||||
TicketLineInfo[] lines = receipttwo.getSelectedLinesUnit();
|
||||
if (lines != null) {
|
||||
receiptone.addSelectedLines(lines);
|
||||
}
|
||||
|
||||
}//GEN-LAST:event_jBtnToLeftOneActionPerformed
|
||||
|
||||
private void jBtnToLeftAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnToLeftAllActionPerformed
|
||||
|
||||
TicketLineInfo[] lines = receipttwo.getSelectedLines();
|
||||
if (lines != null) {
|
||||
receiptone.addSelectedLines(lines);
|
||||
}
|
||||
|
||||
}//GEN-LAST:event_jBtnToLeftAllActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton jBtnToLeftAll;
|
||||
private javax.swing.JButton jBtnToLeftOne;
|
||||
private javax.swing.JButton jBtnToRightAll;
|
||||
private javax.swing.JButton jBtnToRightOne;
|
||||
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.JButton m_jButtonCancel;
|
||||
private javax.swing.JButton m_jButtonOK;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
// 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.sales;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.loader.DataRead;
|
||||
import com.unicenta.data.loader.DataWrite;
|
||||
import com.unicenta.data.loader.SerializableRead;
|
||||
import com.unicenta.data.loader.SerializableWrite;
|
||||
|
||||
/**
|
||||
* @author JG uniCenta
|
||||
* Sept 2018
|
||||
* Recall + Reprint of last ticket
|
||||
* Allows for reprint ticket from any terminal rather than only local
|
||||
*/
|
||||
public class ReprintTicketInfo implements SerializableRead, SerializableWrite {
|
||||
|
||||
private static final long serialVersionUID = 7640633837719L;
|
||||
private String id;
|
||||
private String total;
|
||||
private String ticketDate;
|
||||
private String UserName;
|
||||
|
||||
|
||||
/** Creates a new instance of ReprintTicketInfo */
|
||||
public ReprintTicketInfo() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dr
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public void readValues(DataRead dr) throws BasicException {
|
||||
id = dr.getString(1);
|
||||
total = dr.getString(2);
|
||||
ticketDate = dr.getString(3);
|
||||
UserName = dr.getString(4);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dp
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public void writeValues(DataWrite dp) throws BasicException {
|
||||
dp.setString(1, id);
|
||||
dp.setString(2, total);
|
||||
dp.setString(3, ticketDate);
|
||||
dp.setString(4, UserName);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public String getTicketDate() {
|
||||
return ticketDate;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return UserName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
// 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.sales;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.loader.DataRead;
|
||||
import com.unicenta.data.loader.DataWrite;
|
||||
import com.unicenta.data.loader.SerializableRead;
|
||||
import com.unicenta.data.loader.SerializableWrite;
|
||||
|
||||
public class SharedTicketInfo implements SerializableRead, SerializableWrite {
|
||||
|
||||
private static final long serialVersionUID = 7640633837719L;
|
||||
private String id;
|
||||
private String name;
|
||||
private String UserName;
|
||||
private String status;
|
||||
/*
|
||||
* For : RickyO - display Customer Name | Phone | PickupId
|
||||
* Change : JG uniCenta
|
||||
* Date : May 2017
|
||||
*/
|
||||
private String phone;
|
||||
private String pickupid;
|
||||
|
||||
/** Creates a new instance of SharedTicketInfo */
|
||||
public SharedTicketInfo() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dr
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public void readValues(DataRead dr) throws BasicException {
|
||||
id = dr.getString(1);
|
||||
name = dr.getString(2);
|
||||
UserName = dr.getString(3);
|
||||
status = dr.getString(4);
|
||||
/*
|
||||
* For : RickyO - display Customer Name | Phone | PickupId
|
||||
* Change : JG uniCenta
|
||||
* Date : May 2017
|
||||
*/
|
||||
pickupid = dr.getString(5);
|
||||
phone = dr.getString(6);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dp
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public void writeValues(DataWrite dp) throws BasicException {
|
||||
dp.setString(1, id);
|
||||
dp.setString(2, name);
|
||||
dp.setString(3, UserName);
|
||||
dp.setString(4, status);
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getAppUser() {
|
||||
return UserName;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* For : RickyO - display Customer Name | Phone | PickupId
|
||||
* Change : JG uniCenta
|
||||
* Date : May 2017
|
||||
*/
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
/*
|
||||
* For : RickyO - display Customer Name | Phone | PickupId
|
||||
* Change : JG uniCenta
|
||||
* Date : May 2017
|
||||
*/
|
||||
public String getPickupId() {
|
||||
return pickupid;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,296 @@
|
||||
<?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,84,0,0,1,98"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<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>
|
||||
<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="m_jPanTotals">
|
||||
<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.DesignGridBagLayout"/>
|
||||
<SubComponents>
|
||||
<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="14" 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="[150, 30]"/>
|
||||
</Property>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="1" gridY="2" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="5" insetsBottom="0" insetsRight="0" anchor="23" weightX="1.0" weightY="1.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<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="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.totalcash" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="m_jSubtotalEuros">
|
||||
<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="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="[150, 30]"/>
|
||||
</Property>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="1" gridY="0" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="5" insetsBottom="0" insetsRight="0" anchor="23" weightX="1.0" weightY="1.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="m_jTaxesEuros">
|
||||
<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="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="[150, 30]"/>
|
||||
</Property>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="5" insetsBottom="0" insetsRight="0" anchor="23" weightX="1.0" weightY="1.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="m_jLblTotalEuros2">
|
||||
<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.taxcash" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="m_jLblTotalEuros3">
|
||||
<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.subtotalcash" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="m_jButtons">
|
||||
<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">
|
||||
<Property name="alignment" type="int" value="0"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="m_jTicketId">
|
||||
<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="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
<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="[160, 25]"/>
|
||||
</Property>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnCustomer">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/com/unicenta/images/customer_sml.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Show Customers"/>
|
||||
<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, 14, 8, 14]"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</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"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnCustomerActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel2">
|
||||
<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>
|
||||
<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"/>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,450 @@
|
||||
// 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.sales;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.gui.MessageInf;
|
||||
import com.unicenta.pos.customers.DataLogicCustomers;
|
||||
import com.unicenta.pos.customers.JCustomerFinder;
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
import com.unicenta.pos.forms.DataLogicSales;
|
||||
import com.unicenta.pos.ticket.TicketInfo;
|
||||
import com.unicenta.pos.ticket.TicketLineInfo;
|
||||
import java.awt.BorderLayout;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author adrian
|
||||
*/
|
||||
public class SimpleReceipt extends javax.swing.JPanel {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected DataLogicCustomers dlCustomers;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected DataLogicSales dlSales;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected TaxesLogic taxeslogic;
|
||||
|
||||
private JTicketLines ticketlines;
|
||||
private TicketInfo ticket;
|
||||
private Object ticketext;
|
||||
|
||||
/** Creates new form SimpleReceipt
|
||||
* @param ticketline
|
||||
* @param dlSales
|
||||
* @param taxeslogic
|
||||
* @param dlCustomers */
|
||||
public SimpleReceipt(String ticketline, DataLogicSales dlSales, DataLogicCustomers dlCustomers, TaxesLogic taxeslogic) {
|
||||
|
||||
initComponents();
|
||||
|
||||
// dlSystem.getResourceAsXML("Ticket.Line")
|
||||
ticketlines = new JTicketLines(ticketline);
|
||||
this.dlCustomers = dlCustomers;
|
||||
this.dlSales = dlSales;
|
||||
this.taxeslogic = taxeslogic;
|
||||
|
||||
jPanel2.add(ticketlines, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
public void setCustomerEnabled(boolean value) {
|
||||
btnCustomer.setEnabled(value);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ticket
|
||||
* @param ticketext
|
||||
*/
|
||||
public void setTicket(TicketInfo ticket, Object ticketext) {
|
||||
|
||||
this.ticket = ticket;
|
||||
this.ticketext = ticketext;
|
||||
|
||||
// The ticket name
|
||||
m_jTicketId.setText(ticket.getName(ticketext));
|
||||
|
||||
ticketlines.clearTicketLines();
|
||||
for (int i = 0; i < ticket.getLinesCount(); i++) {
|
||||
ticketlines.addTicketLine(ticket.getLine(i));
|
||||
}
|
||||
|
||||
if (ticket.getLinesCount() > 0) {
|
||||
ticketlines.setSelectedIndex(0);
|
||||
}
|
||||
|
||||
printTotals();
|
||||
|
||||
}
|
||||
|
||||
private void refreshTicketTaxes() {
|
||||
|
||||
for (TicketLineInfo line : ticket.getLines()) {
|
||||
line.setTaxInfo(taxeslogic.getTaxInfo(line.getProductTaxCategoryID(), ticket.getCustomer()));
|
||||
}
|
||||
}
|
||||
|
||||
private void printTotals() {
|
||||
|
||||
if (ticket.getLinesCount() == 0) {
|
||||
m_jSubtotalEuros.setText(null);
|
||||
m_jTaxesEuros.setText(null);
|
||||
m_jTotalEuros.setText(null);
|
||||
} else {
|
||||
m_jSubtotalEuros.setText(ticket.printSubTotal());
|
||||
m_jTaxesEuros.setText(ticket.printTax());
|
||||
m_jTotalEuros.setText(ticket.printTotal());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public TicketInfo getTicket() {
|
||||
return ticket;
|
||||
}
|
||||
|
||||
private int findFirstNonAuxiliarLine() {
|
||||
|
||||
int i = ticketlines.getSelectedIndex();
|
||||
while (i >= 0 && ticket.getLine(i).isProductCom()) {
|
||||
i--;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public TicketLineInfo[] getSelectedLines() {
|
||||
|
||||
// never returns an empty array, or null, or an array with at least one element.
|
||||
|
||||
int i = findFirstNonAuxiliarLine();
|
||||
|
||||
if (i >= 0) {
|
||||
|
||||
List<TicketLineInfo> l = new ArrayList<>();
|
||||
|
||||
TicketLineInfo line = ticket.getLine(i);
|
||||
l.add(line);
|
||||
ticket.removeLine(i);
|
||||
ticketlines.removeTicketLine(i);
|
||||
|
||||
// add also auxiliars
|
||||
while (i < ticket.getLinesCount() && ticket.getLine(i).isProductCom()) {
|
||||
l.add(ticket.getLine(i));
|
||||
ticket.removeLine(i);
|
||||
ticketlines.removeTicketLine(i);
|
||||
}
|
||||
printTotals();
|
||||
return l.toArray(new TicketLineInfo[l.size()]);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public TicketLineInfo[] getSelectedLinesUnit() {
|
||||
|
||||
// never returns an empty array, or null, or an array with at least one element.
|
||||
|
||||
int i = findFirstNonAuxiliarLine();
|
||||
|
||||
if (i >= 0) {
|
||||
|
||||
TicketLineInfo line = ticket.getLine(i);
|
||||
|
||||
if (line.getMultiply() >= 1.0) {
|
||||
|
||||
List<TicketLineInfo> l = new ArrayList<>();
|
||||
|
||||
if (line.getMultiply() > 1.0) {
|
||||
line.setMultiply(line.getMultiply() -1.0);
|
||||
ticketlines.setTicketLine(i, line);
|
||||
line = line.copyTicketLine();
|
||||
line.setMultiply(1.0);
|
||||
l.add(line);
|
||||
i++;
|
||||
} else { // == 1.0
|
||||
l.add(line);
|
||||
ticket.removeLine(i);
|
||||
ticketlines.removeTicketLine(i);
|
||||
}
|
||||
|
||||
// add also auxiliars
|
||||
while (i < ticket.getLinesCount() && ticket.getLine(i).isProductCom()) {
|
||||
l.add(ticket.getLine(i));
|
||||
ticket.removeLine(i);
|
||||
ticketlines.removeTicketLine(i);
|
||||
}
|
||||
printTotals();
|
||||
return l.toArray(new TicketLineInfo[l.size()]);
|
||||
} else { // < 1.0
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param lines
|
||||
*/
|
||||
public void addSelectedLines(TicketLineInfo[] lines) {
|
||||
|
||||
int i = findFirstNonAuxiliarLine();
|
||||
|
||||
TicketLineInfo firstline = lines[0];
|
||||
|
||||
if (i >= 0
|
||||
&& ticket.getLine(i).getProductID() != null && firstline.getProductID() != null && ticket.getLine(i).getProductID().equals(firstline.getProductID())
|
||||
&& ticket.getLine(i).getTaxInfo().getId().equals(firstline.getTaxInfo().getId())
|
||||
&& ticket.getLine(i).getPrice() == firstline.getPrice()) {
|
||||
|
||||
// add the auxiliars.
|
||||
for (int j = 1; j < lines.length; j++) {
|
||||
ticket.insertLine(i + 1, lines[j]);
|
||||
ticketlines.insertTicketLine(i + 1, lines[j]);
|
||||
}
|
||||
|
||||
// inc the line
|
||||
ticket.getLine(i).setMultiply(ticket.getLine(i).getMultiply() + firstline.getMultiply());
|
||||
ticketlines.setTicketLine(i, ticket.getLine(i));
|
||||
ticketlines.setSelectedIndex(i);
|
||||
|
||||
} else {
|
||||
// add all at the end in inverse order.
|
||||
int insertpoint = ticket.getLinesCount();
|
||||
for (int j = lines.length - 1; j >= 0; j--) {
|
||||
ticket.insertLine(insertpoint, lines[j]);
|
||||
ticketlines.insertTicketLine(insertpoint, lines[j]);
|
||||
}
|
||||
}
|
||||
|
||||
printTotals();
|
||||
}
|
||||
|
||||
/** 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() {
|
||||
java.awt.GridBagConstraints gridBagConstraints;
|
||||
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
m_jPanTotals = new javax.swing.JPanel();
|
||||
m_jTotalEuros = new javax.swing.JLabel();
|
||||
m_jLblTotalEuros1 = new javax.swing.JLabel();
|
||||
m_jSubtotalEuros = new javax.swing.JLabel();
|
||||
m_jTaxesEuros = new javax.swing.JLabel();
|
||||
m_jLblTotalEuros2 = new javax.swing.JLabel();
|
||||
m_jLblTotalEuros3 = new javax.swing.JLabel();
|
||||
m_jButtons = new javax.swing.JPanel();
|
||||
m_jTicketId = new javax.swing.JLabel();
|
||||
btnCustomer = new javax.swing.JButton();
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
|
||||
setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
jPanel1.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
m_jPanTotals.setLayout(new java.awt.GridBagLayout());
|
||||
|
||||
m_jTotalEuros.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
m_jTotalEuros.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
|
||||
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);
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 1;
|
||||
gridBagConstraints.gridy = 2;
|
||||
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
|
||||
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
|
||||
gridBagConstraints.weightx = 1.0;
|
||||
gridBagConstraints.weighty = 1.0;
|
||||
gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 0);
|
||||
m_jPanTotals.add(m_jTotalEuros, gridBagConstraints);
|
||||
|
||||
m_jLblTotalEuros1.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
m_jLblTotalEuros1.setText(AppLocal.getIntString("label.totalcash")); // NOI18N
|
||||
m_jLblTotalEuros1.setPreferredSize(new java.awt.Dimension(110, 30));
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 2;
|
||||
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
|
||||
gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
|
||||
m_jPanTotals.add(m_jLblTotalEuros1, gridBagConstraints);
|
||||
|
||||
m_jSubtotalEuros.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
m_jSubtotalEuros.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
|
||||
m_jSubtotalEuros.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_jSubtotalEuros.setOpaque(true);
|
||||
m_jSubtotalEuros.setPreferredSize(new java.awt.Dimension(150, 30));
|
||||
m_jSubtotalEuros.setRequestFocusEnabled(false);
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 1;
|
||||
gridBagConstraints.gridy = 0;
|
||||
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
|
||||
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
|
||||
gridBagConstraints.weightx = 1.0;
|
||||
gridBagConstraints.weighty = 1.0;
|
||||
gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
|
||||
m_jPanTotals.add(m_jSubtotalEuros, gridBagConstraints);
|
||||
|
||||
m_jTaxesEuros.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
m_jTaxesEuros.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
|
||||
m_jTaxesEuros.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_jTaxesEuros.setOpaque(true);
|
||||
m_jTaxesEuros.setPreferredSize(new java.awt.Dimension(150, 30));
|
||||
m_jTaxesEuros.setRequestFocusEnabled(false);
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 1;
|
||||
gridBagConstraints.gridy = 1;
|
||||
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
|
||||
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
|
||||
gridBagConstraints.weightx = 1.0;
|
||||
gridBagConstraints.weighty = 1.0;
|
||||
gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 0);
|
||||
m_jPanTotals.add(m_jTaxesEuros, gridBagConstraints);
|
||||
|
||||
m_jLblTotalEuros2.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
m_jLblTotalEuros2.setText(AppLocal.getIntString("label.taxcash")); // NOI18N
|
||||
m_jLblTotalEuros2.setPreferredSize(new java.awt.Dimension(110, 30));
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 1;
|
||||
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
|
||||
gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
|
||||
m_jPanTotals.add(m_jLblTotalEuros2, gridBagConstraints);
|
||||
|
||||
m_jLblTotalEuros3.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
m_jLblTotalEuros3.setText(AppLocal.getIntString("label.subtotalcash")); // NOI18N
|
||||
m_jLblTotalEuros3.setPreferredSize(new java.awt.Dimension(110, 30));
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 0;
|
||||
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
|
||||
m_jPanTotals.add(m_jLblTotalEuros3, gridBagConstraints);
|
||||
|
||||
jPanel1.add(m_jPanTotals, java.awt.BorderLayout.EAST);
|
||||
|
||||
add(jPanel1, java.awt.BorderLayout.SOUTH);
|
||||
|
||||
m_jButtons.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
|
||||
|
||||
m_jTicketId.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
m_jTicketId.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
m_jTicketId.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_jTicketId.setOpaque(true);
|
||||
m_jTicketId.setPreferredSize(new java.awt.Dimension(160, 25));
|
||||
m_jTicketId.setRequestFocusEnabled(false);
|
||||
m_jButtons.add(m_jTicketId);
|
||||
|
||||
btnCustomer.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/customer_sml.png"))); // NOI18N
|
||||
btnCustomer.setToolTipText("Show Customers");
|
||||
btnCustomer.setFocusPainted(false);
|
||||
btnCustomer.setFocusable(false);
|
||||
btnCustomer.setMargin(new java.awt.Insets(8, 14, 8, 14));
|
||||
btnCustomer.setMaximumSize(new java.awt.Dimension(50, 40));
|
||||
btnCustomer.setMinimumSize(new java.awt.Dimension(50, 40));
|
||||
btnCustomer.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
btnCustomer.setRequestFocusEnabled(false);
|
||||
btnCustomer.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnCustomerActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
m_jButtons.add(btnCustomer);
|
||||
|
||||
add(m_jButtons, java.awt.BorderLayout.NORTH);
|
||||
|
||||
jPanel2.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
jPanel2.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
|
||||
jPanel2.setLayout(new java.awt.BorderLayout());
|
||||
add(jPanel2, java.awt.BorderLayout.CENTER);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void btnCustomerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCustomerActionPerformed
|
||||
|
||||
JCustomerFinder finder = JCustomerFinder.getCustomerFinder(this, dlCustomers);
|
||||
finder.search(ticket.getCustomer());
|
||||
finder.setVisible(true);
|
||||
|
||||
try {
|
||||
ticket.setCustomer(finder.getSelectedCustomer() == null
|
||||
? null
|
||||
: dlSales.loadCustomerExt(finder.getSelectedCustomer().getId()));
|
||||
} catch (BasicException e) {
|
||||
MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotfindcustomer"), e);
|
||||
msg.show(this);
|
||||
}
|
||||
|
||||
// The ticket name
|
||||
m_jTicketId.setText(ticket.getName(ticketext));
|
||||
|
||||
refreshTicketTaxes();
|
||||
|
||||
// refresh the receipt....
|
||||
setTicket(ticket, ticketext);
|
||||
|
||||
}//GEN-LAST:event_btnCustomerActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton btnCustomer;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private javax.swing.JPanel m_jButtons;
|
||||
private javax.swing.JLabel m_jLblTotalEuros1;
|
||||
private javax.swing.JLabel m_jLblTotalEuros2;
|
||||
private javax.swing.JLabel m_jLblTotalEuros3;
|
||||
private javax.swing.JPanel m_jPanTotals;
|
||||
private javax.swing.JLabel m_jSubtotalEuros;
|
||||
private javax.swing.JLabel m_jTaxesEuros;
|
||||
private javax.swing.JLabel m_jTicketId;
|
||||
private javax.swing.JLabel m_jTotalEuros;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
// 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.sales;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author adrianromero
|
||||
*/
|
||||
public class TaxesException extends Exception {
|
||||
|
||||
/**
|
||||
* Creates a new instance of <code>TaxesException</code> without detail message.
|
||||
* @param t
|
||||
*/
|
||||
public TaxesException(Throwable t) {
|
||||
super(t);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param msg
|
||||
* @param t
|
||||
*/
|
||||
public TaxesException(String msg, Throwable t) {
|
||||
super(msg, t);
|
||||
}
|
||||
/**
|
||||
* Constructs an instance of <code>TaxesException</code> with the specified detail message.
|
||||
* @param msg the detail message.
|
||||
*/
|
||||
public TaxesException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,314 @@
|
||||
// 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.sales;
|
||||
|
||||
import com.unicenta.pos.customers.CustomerInfoExt;
|
||||
import com.unicenta.pos.inventory.TaxCategoryInfo;
|
||||
import com.unicenta.pos.ticket.TaxInfo;
|
||||
import com.unicenta.pos.ticket.TicketInfo;
|
||||
import com.unicenta.pos.ticket.TicketLineInfo;
|
||||
import com.unicenta.pos.ticket.TicketTaxInfo;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author adrianromero
|
||||
*/
|
||||
public class TaxesLogic {
|
||||
|
||||
private List<TaxInfo> taxlist;
|
||||
|
||||
private Map<String, TaxesLogicElement> taxtrees;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param taxlist
|
||||
*/
|
||||
public TaxesLogic(List<TaxInfo> taxlist) {
|
||||
this.taxlist = taxlist;
|
||||
|
||||
// JG June 2013 use diamond inference
|
||||
taxtrees = new HashMap<>();
|
||||
|
||||
// Order the taxlist by Application Order...
|
||||
// JG June 2013 use diamond inference
|
||||
List<TaxInfo> taxlistordered = new ArrayList<>();
|
||||
taxlistordered.addAll(taxlist);
|
||||
Collections.sort(taxlistordered, new Comparator<TaxInfo>() {
|
||||
@Override
|
||||
public int compare(TaxInfo o1, TaxInfo o2) {
|
||||
if (o1.getApplicationOrder() < o2.getApplicationOrder()) {
|
||||
return -1;
|
||||
} else if (o1.getApplicationOrder() == o2.getApplicationOrder()) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Generate the taxtrees
|
||||
// JG June 2013 use diamond inference
|
||||
HashMap<String, TaxesLogicElement> taxorphans = new HashMap<>();
|
||||
|
||||
for (TaxInfo t : taxlistordered) {
|
||||
|
||||
TaxesLogicElement te = new TaxesLogicElement(t);
|
||||
|
||||
// get the parent
|
||||
TaxesLogicElement teparent = taxtrees.get(t.getParentID());
|
||||
if (teparent == null) {
|
||||
// orphan node
|
||||
teparent = taxorphans.get(t.getParentID());
|
||||
if (teparent == null) {
|
||||
teparent = new TaxesLogicElement(null);
|
||||
taxorphans.put(t.getParentID(), teparent);
|
||||
}
|
||||
}
|
||||
|
||||
teparent.getSons().add(te);
|
||||
|
||||
// Does it have orphans ?
|
||||
teparent = taxorphans.get(t.getId());
|
||||
if (teparent != null) {
|
||||
// get all the sons
|
||||
te.getSons().addAll(teparent.getSons());
|
||||
// remove the orphans
|
||||
taxorphans.remove(t.getId());
|
||||
}
|
||||
|
||||
// Add it to the tree...
|
||||
taxtrees.put(t.getId(), te);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ticket
|
||||
* @throws TaxesException
|
||||
*/
|
||||
public void calculateTaxes(TicketInfo ticket) throws TaxesException {
|
||||
|
||||
// JG June 2013 use diamond inference
|
||||
List<TicketTaxInfo> tickettaxes = new ArrayList<>();
|
||||
|
||||
for (TicketLineInfo line: ticket.getLines()) {
|
||||
tickettaxes = sumLineTaxes(tickettaxes, calculateTaxes(line));
|
||||
}
|
||||
|
||||
ticket.setTaxes(tickettaxes);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param line
|
||||
* @return
|
||||
* @throws TaxesException
|
||||
*/
|
||||
public List<TicketTaxInfo> calculateTaxes(TicketLineInfo line) throws TaxesException {
|
||||
|
||||
TaxesLogicElement taxesapplied = getTaxesApplied(line.getTaxInfo());
|
||||
return calculateLineTaxes(line.getSubValue(), taxesapplied);
|
||||
}
|
||||
|
||||
private List<TicketTaxInfo> calculateLineTaxes(double base, TaxesLogicElement taxesapplied) {
|
||||
|
||||
// JG June 2013 use diamond inference
|
||||
List<TicketTaxInfo> linetaxes = new ArrayList<>();
|
||||
|
||||
if (taxesapplied.getSons().isEmpty()) {
|
||||
TicketTaxInfo tickettax = new TicketTaxInfo(taxesapplied.getTax());
|
||||
tickettax.add(base);
|
||||
linetaxes.add(tickettax);
|
||||
} else {
|
||||
double acum = base;
|
||||
|
||||
for (TaxesLogicElement te : taxesapplied.getSons()) {
|
||||
|
||||
List<TicketTaxInfo> sublinetaxes = calculateLineTaxes(
|
||||
te.getTax().isCascade() ? acum : base,
|
||||
te);
|
||||
linetaxes.addAll(sublinetaxes);
|
||||
acum += sumTaxes(sublinetaxes);
|
||||
}
|
||||
}
|
||||
|
||||
return linetaxes;
|
||||
}
|
||||
|
||||
private TaxesLogicElement getTaxesApplied(TaxInfo t) throws TaxesException {
|
||||
|
||||
if (t == null) {
|
||||
throw new TaxesException(new java.lang.NullPointerException());
|
||||
}
|
||||
|
||||
return taxtrees.get(t.getId());
|
||||
}
|
||||
|
||||
private double sumTaxes(List<TicketTaxInfo> linetaxes) {
|
||||
|
||||
double taxtotal = 0.0;
|
||||
|
||||
taxtotal = linetaxes.stream().map((tickettax) ->
|
||||
tickettax.getTax()).reduce(taxtotal, (accumulator, _item) -> accumulator + _item);
|
||||
return taxtotal;
|
||||
}
|
||||
|
||||
private List<TicketTaxInfo> sumLineTaxes(List<TicketTaxInfo> list1, List<TicketTaxInfo> list2) {
|
||||
|
||||
list2.forEach((tickettax) -> {
|
||||
TicketTaxInfo i = searchTicketTax(list1, tickettax.getTaxInfo().getId());
|
||||
if (i == null) {
|
||||
list1.add(tickettax);
|
||||
} else {
|
||||
i.add(tickettax.getSubTotal());
|
||||
}
|
||||
});
|
||||
return list1;
|
||||
}
|
||||
|
||||
private TicketTaxInfo searchTicketTax(List<TicketTaxInfo> l, String id) {
|
||||
|
||||
for (TicketTaxInfo tickettax : l) {
|
||||
if (id.equals(tickettax.getTaxInfo().getId())) {
|
||||
return tickettax;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tcid
|
||||
* @return
|
||||
*/
|
||||
public double getTaxRate(String tcid) {
|
||||
return getTaxRate(tcid, null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tc
|
||||
* @return
|
||||
*/
|
||||
public double getTaxRate(TaxCategoryInfo tc) {
|
||||
return getTaxRate(tc, null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tc
|
||||
* @param customer
|
||||
* @return
|
||||
*/
|
||||
public double getTaxRate(TaxCategoryInfo tc, CustomerInfoExt customer) {
|
||||
|
||||
if (tc == null) {
|
||||
return 0.0;
|
||||
} else {
|
||||
return getTaxRate(tc.getID(), customer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tcid
|
||||
* @param customer
|
||||
* @return
|
||||
*/
|
||||
public double getTaxRate(String tcid, CustomerInfoExt customer) {
|
||||
|
||||
if (tcid == null) {
|
||||
return 0.0;
|
||||
} else {
|
||||
TaxInfo tax = getTaxInfo(tcid, customer);
|
||||
if (tax == null) {
|
||||
return 0.0;
|
||||
} else {
|
||||
return tax.getRate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tcid
|
||||
* @return
|
||||
*/
|
||||
public TaxInfo getTaxInfo(String tcid) {
|
||||
return getTaxInfo(tcid, null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tc
|
||||
* @return
|
||||
*/
|
||||
public TaxInfo getTaxInfo(TaxCategoryInfo tc) {
|
||||
return getTaxInfo(tc.getID(), null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tc
|
||||
* @param customer
|
||||
* @return
|
||||
*/
|
||||
public TaxInfo getTaxInfo(TaxCategoryInfo tc, CustomerInfoExt customer) {
|
||||
return getTaxInfo(tc.getID(), customer);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tcid
|
||||
* @param customer
|
||||
* @return
|
||||
*/
|
||||
public TaxInfo getTaxInfo(String tcid, CustomerInfoExt customer) {
|
||||
|
||||
TaxInfo defaulttax = null;
|
||||
|
||||
for (TaxInfo tax : taxlist) {
|
||||
if (tax.getParentID() == null && tax.getTaxCategoryID().equals(tcid)) {
|
||||
if ((customer == null
|
||||
|| customer.getTaxCustCategoryID() == null)
|
||||
&& tax.getTaxCustCategoryID() == null) {
|
||||
return tax;
|
||||
} else if (customer != null
|
||||
&& customer.getTaxCustCategoryID() != null
|
||||
&& customer.getTaxCustCategoryID().equals(tax.getTaxCustCategoryID())) {
|
||||
return tax;
|
||||
}
|
||||
|
||||
if (tax.getTaxCustCategoryID() == null) {
|
||||
defaulttax = tax;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// No tax found
|
||||
return defaulttax;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// uniCenta oPOS - Touch Friendly Point Of Sale
|
||||
// Copyright (c) 2009-20167
|
||||
// 2008-2013 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.sales;
|
||||
|
||||
import com.unicenta.pos.ticket.TaxInfo;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author adrianromero
|
||||
*/
|
||||
public class TaxesLogicElement {
|
||||
|
||||
private TaxInfo tax;
|
||||
private List<TaxesLogicElement> taxsons;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tax
|
||||
*/
|
||||
public TaxesLogicElement(TaxInfo tax) {
|
||||
this.tax = tax;
|
||||
// JG June 2013 use diamond inference
|
||||
this.taxsons = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public TaxInfo getTax() {
|
||||
return tax;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<TaxesLogicElement> getSons() {
|
||||
return taxsons;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.unicenta.pos.sales;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
class TicketsBagRestaurantMap {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// 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.sales;
|
||||
|
||||
import com.unicenta.pos.ticket.TicketInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
public interface TicketsEditor {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param oTicket
|
||||
* @param oTicketExt
|
||||
*/
|
||||
public void setActiveTicket(TicketInfo oTicket, Object oTicketExt); // el ticket mas informacion extra...
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public TicketInfo getActiveTicket();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.unicenta.pos.sales;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
class dlSales {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
// 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.sales.restaurant;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.loader.DataRead;
|
||||
import com.unicenta.data.loader.ImageUtils;
|
||||
import com.unicenta.data.loader.SerializableRead;
|
||||
import com.unicenta.pos.util.ThumbNailBuilder;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.image.BufferedImage;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
public class Floor implements SerializableRead {
|
||||
|
||||
private static final long serialVersionUID = 8694154682897L;
|
||||
private String m_sID;
|
||||
private String m_sName;
|
||||
private Container m_container;
|
||||
private Icon m_icon;
|
||||
|
||||
private static Image defimg = null;
|
||||
|
||||
/** Creates a new instance of Floor */
|
||||
public Floor() {
|
||||
try {
|
||||
defimg = ImageIO.read(getClass().getClassLoader().getResourceAsStream("com/unicenta/images/floors.png"));
|
||||
} catch (Exception fnfe) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dr
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public void readValues(DataRead dr) throws BasicException {
|
||||
m_sID = dr.getString(1);
|
||||
m_sName = dr.getString(2);
|
||||
BufferedImage img = ImageUtils.readImage(dr.getBytes(3));
|
||||
ThumbNailBuilder tnbcat = new ThumbNailBuilder(32, 32, defimg);
|
||||
m_container = new JPanelDrawing(img);
|
||||
m_icon = new ImageIcon(tnbcat.getThumbNail(img));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getID() {
|
||||
return m_sID;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getName() {
|
||||
return m_sName;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Icon getIcon() {
|
||||
return m_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Container getContainer() {
|
||||
return m_container;
|
||||
}
|
||||
|
||||
private static class JPanelDrawing extends JPanel {
|
||||
private Image img;
|
||||
|
||||
public JPanelDrawing(Image img) {
|
||||
this.img = img;
|
||||
setLayout(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent (Graphics g) {
|
||||
super.paintComponent(g);
|
||||
if (img != null) {
|
||||
g.drawImage(img, 0, 0, this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredSize() {
|
||||
return (img == null)
|
||||
// ? new Dimension(640, 480)
|
||||
? new Dimension(950, 560)
|
||||
: new Dimension(img.getWidth(this), img.getHeight(this));
|
||||
}
|
||||
@Override
|
||||
public Dimension getMinimumSize() {
|
||||
return getPreferredSize();
|
||||
}
|
||||
@Override
|
||||
public Dimension getMaximumSize() {
|
||||
return getPreferredSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
<?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="0"/>
|
||||
<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,68,0,0,1,-113"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="m_jDescription">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="<html>This is a test comment that shows how a long line is printed with this renderer."/>
|
||||
<Property name="verticalAlignment" type="int" value="1"/>
|
||||
<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="20" right="20" top="5"/>
|
||||
</Border>
|
||||
</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>
|
||||
<Container class="javax.swing.JPanel" name="jPanel1">
|
||||
<Properties>
|
||||
<Property name="opaque" type="boolean" value="false"/>
|
||||
</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.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="m_jTime">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="ff" green="0" red="0" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="10:20"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="West"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="m_jTitle">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value=" This is a test"/>
|
||||
<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="0" left="5" right="0" top="0"/>
|
||||
</Border>
|
||||
</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>
|
||||
<Component class="javax.swing.JLabel" name="m_jChairs">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="5"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="East"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,186 @@
|
||||
// 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.sales.restaurant;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.*;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Font;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Insets;
|
||||
|
||||
import java.io.Serializable;
|
||||
import com.unicenta.format.Formats;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
public class JCalendarItemRenderer extends javax.swing.JPanel implements ListCellRenderer, Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected static Border noFocusBorder;
|
||||
|
||||
private boolean m_bDone = false;
|
||||
|
||||
/** Creates new form JCalendarItemRenderer */
|
||||
public JCalendarItemRenderer() {
|
||||
|
||||
super();
|
||||
if (noFocusBorder == null) {
|
||||
noFocusBorder = new EmptyBorder(1, 1, 1, 1);
|
||||
}
|
||||
|
||||
initComponents();
|
||||
|
||||
m_jTime.setFont(new Font("SansSerif", Font.BOLD, 14)); // HORA
|
||||
m_jTitle.setFont(new Font("SansSerif", Font.BOLD, 14)); // TITULO
|
||||
m_jDescription.setFont(new Font("SansSerif", Font.ITALIC, 14)); // TEXTO EXPLICATIVO
|
||||
|
||||
setOpaque(true);
|
||||
setBorder(noFocusBorder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value,
|
||||
int index, boolean isSelected, boolean cellHasFocus) {
|
||||
|
||||
applyComponentOrientation(list.getComponentOrientation());
|
||||
|
||||
if (isSelected) {
|
||||
setBackground(list.getSelectionBackground());
|
||||
m_jTime.setForeground(list.getSelectionForeground());
|
||||
m_jTitle.setForeground(list.getSelectionForeground());
|
||||
m_jDescription.setForeground(list.getSelectionForeground());
|
||||
} else {
|
||||
setBackground(list.getBackground());
|
||||
m_jTime.setForeground(Color.BLUE);
|
||||
m_jTitle.setForeground(list.getForeground());
|
||||
m_jDescription.setForeground(list.getForeground());
|
||||
}
|
||||
|
||||
if (value == null) {
|
||||
m_jTime.setText("");
|
||||
m_jTitle.setText("");
|
||||
m_jChairs.setText("");
|
||||
m_bDone = false;
|
||||
m_jDescription.setText("");
|
||||
} else {
|
||||
Object[] avalue = (Object []) value;
|
||||
m_jTime.setText(Formats.TIME.formatValue(avalue[2]));
|
||||
m_jTitle.setText(Formats.STRING.formatValue(avalue[6]));
|
||||
m_jChairs.setText(Formats.INT.formatValue(avalue[7]));
|
||||
m_bDone = ((Boolean) avalue[8]).booleanValue();
|
||||
m_jDescription.setText(Formats.STRING.formatValue(avalue[9]));
|
||||
}
|
||||
|
||||
setEnabled(list.isEnabled());
|
||||
setFont(list.getFont());
|
||||
setBorder((cellHasFocus) ? UIManager.getBorder("List.focusCellHighlightBorder") : noFocusBorder);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
super.paintComponent(g);
|
||||
|
||||
if (m_bDone) {
|
||||
Insets in = getInsets();
|
||||
g.drawLine(in.left, 10, getWidth() - in.right, 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Overridden for performance reasons.
|
||||
*/
|
||||
@Override
|
||||
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {}
|
||||
@Override
|
||||
public void firePropertyChange(String propertyName, byte oldValue, byte newValue) {}
|
||||
@Override
|
||||
public void firePropertyChange(String propertyName, char oldValue, char newValue) {}
|
||||
@Override
|
||||
public void firePropertyChange(String propertyName, short oldValue, short newValue) {}
|
||||
@Override
|
||||
public void firePropertyChange(String propertyName, int oldValue, int newValue) {}
|
||||
@Override
|
||||
public void firePropertyChange(String propertyName, long oldValue, long newValue) {}
|
||||
@Override
|
||||
public void firePropertyChange(String propertyName, float oldValue, float newValue) {}
|
||||
@Override
|
||||
public void firePropertyChange(String propertyName, double oldValue, double newValue) {}
|
||||
@Override
|
||||
public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {}
|
||||
|
||||
/** 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() {
|
||||
|
||||
m_jDescription = new javax.swing.JLabel();
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
m_jTime = new javax.swing.JLabel();
|
||||
m_jTitle = new javax.swing.JLabel();
|
||||
m_jChairs = new javax.swing.JLabel();
|
||||
|
||||
setLayout(new java.awt.BorderLayout());
|
||||
|
||||
m_jDescription.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
m_jDescription.setText("<html>This is a test comment that shows how a long line is printed with this renderer.");
|
||||
m_jDescription.setVerticalAlignment(javax.swing.SwingConstants.TOP);
|
||||
m_jDescription.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 20, 5, 20));
|
||||
add(m_jDescription, java.awt.BorderLayout.CENTER);
|
||||
|
||||
jPanel1.setOpaque(false);
|
||||
jPanel1.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
m_jTime.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
m_jTime.setForeground(new java.awt.Color(0, 0, 255));
|
||||
m_jTime.setText("10:20");
|
||||
jPanel1.add(m_jTime, java.awt.BorderLayout.WEST);
|
||||
|
||||
m_jTitle.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
m_jTitle.setText(" This is a test");
|
||||
m_jTitle.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 5, 0, 0));
|
||||
jPanel1.add(m_jTitle, java.awt.BorderLayout.CENTER);
|
||||
|
||||
m_jChairs.setText("5");
|
||||
jPanel1.add(m_jChairs, java.awt.BorderLayout.EAST);
|
||||
|
||||
add(jPanel1, java.awt.BorderLayout.NORTH);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
javax.swing.JPanel jPanel1;
|
||||
javax.swing.JLabel m_jChairs;
|
||||
javax.swing.JLabel m_jDescription;
|
||||
javax.swing.JLabel m_jTime;
|
||||
javax.swing.JLabel m_jTitle;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<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="[250, 50]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[430, 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_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,54,0,0,1,-72"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
|
||||
<Property name="alignment" type="int" value="0"/>
|
||||
<Property name="horizontalGap" type="int" value="4"/>
|
||||
<Property name="verticalGap" type="int" value="3"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="j_btnGuests">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="1"/>
|
||||
</Property>
|
||||
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="99" green="0" red="ff" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/com/unicenta/images/customer_add_sml.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="tooltip.guests" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="horizontalAlignment" type="int" value="2"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
|
||||
<Insets value="[0, 4, 0, 4]"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</Property>
|
||||
<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="j_btnGuestsActionPerformed"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value="JTicketsBagRestaurant_j_btnGuests"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="m_TablePlan">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/com/unicenta/images/tables.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Go to Table Plan"/>
|
||||
<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="[0, 4, 0, 4]"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</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"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_TablePlanActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="m_MoveTable">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/com/unicenta/images/movetable.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Move Table"/>
|
||||
<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="[0, 4, 0, 4]"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</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"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_MoveTableActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="m_DelTicket">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/com/unicenta/images/sale_delete.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Delete Current Order"/>
|
||||
<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="[0, 4, 0, 4]"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</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"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_DelTicketActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="j_btnKitchen">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/com/unicenta/images/printer24.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Send to Kichen Printer"/>
|
||||
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
|
||||
<Insets value="[0, 4, 0, 4]"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[80, 45]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AccessibilityProperties>
|
||||
<Property name="AccessibleContext.accessibleDescription" type="java.lang.String" value="Send to Remote Printer"/>
|
||||
</AccessibilityProperties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="j_btnKitchenActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,440 @@
|
||||
// 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/>.
|
||||
// uniCenta oPOS - Touch Friendly Point Of Sale
|
||||
// Copyright (c) 2009-2018 uniCenta & previous Openbravo POS works
|
||||
// https://unicenta.com
|
||||
//
|
||||
|
||||
package com.unicenta.pos.sales.restaurant;
|
||||
|
||||
import bsh.EvalError;
|
||||
import bsh.Interpreter;
|
||||
import com.alee.extended.time.ClockType;
|
||||
import com.alee.extended.time.WebClock;
|
||||
import com.alee.managers.notification.NotificationIcon;
|
||||
import com.alee.managers.notification.NotificationManager;
|
||||
import com.alee.managers.notification.WebNotification;
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.beans.JGuestsPop;
|
||||
import com.unicenta.beans.JNumberPop;
|
||||
import com.unicenta.data.gui.JMessageDialog;
|
||||
import com.unicenta.data.gui.ListKeyed;
|
||||
import com.unicenta.data.gui.MessageInf;
|
||||
import com.unicenta.data.loader.SentenceList;
|
||||
import com.unicenta.pos.forms.*;
|
||||
import com.unicenta.pos.printer.DeviceTicket;
|
||||
import com.unicenta.pos.printer.TicketParser;
|
||||
import com.unicenta.pos.printer.TicketPrinterException;
|
||||
import com.unicenta.pos.sales.DataLogicReceipts;
|
||||
import com.unicenta.pos.sales.TaxesLogic;
|
||||
import com.unicenta.pos.scripting.ScriptEngine;
|
||||
import com.unicenta.pos.scripting.ScriptException;
|
||||
import com.unicenta.pos.scripting.ScriptFactory;
|
||||
import com.unicenta.pos.ticket.TicketInfo;
|
||||
import com.unicenta.pos.ticket.TicketLineInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
@Slf4j
|
||||
public class JTicketsBagRestaurant extends javax.swing.JPanel {
|
||||
|
||||
private final AppView m_App;
|
||||
private final JTicketsBagRestaurantMap m_restaurant;
|
||||
private List<TicketLineInfo> m_aLines;
|
||||
private TicketLineInfo line;
|
||||
private TicketInfo ticket;
|
||||
private final Object ticketExt;
|
||||
private DataLogicSystem m_dlSystem = null;
|
||||
private final DeviceTicket m_TP;
|
||||
private final TicketParser m_TTP2;
|
||||
private final RestaurantDBUtils restDB;
|
||||
|
||||
private final DataLogicSystem dlSystem = null;
|
||||
private final DataLogicReceipts dlReceipts = null;
|
||||
private DataLogicSales dlSales = null;
|
||||
|
||||
private TicketParser m_TTP;
|
||||
|
||||
private SentenceList senttax;
|
||||
private ListKeyed taxcollection;
|
||||
private TaxesLogic taxeslogic;
|
||||
|
||||
private Interpreter i;
|
||||
|
||||
|
||||
/** Creates new form JTicketsBagRestaurantMap
|
||||
* @param app
|
||||
* @param restaurant */
|
||||
public JTicketsBagRestaurant(AppView app, JTicketsBagRestaurantMap restaurant) {
|
||||
super();
|
||||
m_App = app;
|
||||
m_restaurant = restaurant;
|
||||
|
||||
initComponents();
|
||||
|
||||
ticketExt = null;
|
||||
|
||||
restDB = new RestaurantDBUtils(m_App);
|
||||
|
||||
m_dlSystem = (DataLogicSystem) m_App.getBean("com.unicenta.pos.forms.DataLogicSystem");
|
||||
dlSales = (DataLogicSales) m_App.getBean("com.unicenta.pos.forms.DataLogicSales");
|
||||
DataLogicReceipts m_dlReceipts = (DataLogicReceipts) m_App.getBean("com.unicenta.pos.sales.DataLogicReceipts");
|
||||
|
||||
m_TP = new DeviceTicket();
|
||||
m_TTP2 = new TicketParser(m_App.getDeviceTicket(), m_dlSystem);
|
||||
|
||||
j_btnKitchen.setVisible(false);
|
||||
|
||||
m_TablePlan.setVisible(m_App.getAppUserView().getUser().
|
||||
hasPermission("sales.TablePlan"));
|
||||
|
||||
// j_btnGuests.setText(null);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void activate() {
|
||||
|
||||
m_DelTicket.setEnabled(m_App.getAppUserView().getUser()
|
||||
.hasPermission("com.unicenta.pos.sales.JPanelTicketEdits"));
|
||||
|
||||
m_TablePlan.setEnabled(m_App.getAppUserView().getUser()
|
||||
.hasPermission("com.unicenta.pos.sales.JPanelTicketEdits"));
|
||||
|
||||
m_TablePlan.setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param pTicket
|
||||
* @return
|
||||
*/
|
||||
public String getPickupString(TicketInfo pTicket){
|
||||
if (pTicket == null){
|
||||
return("0");
|
||||
}
|
||||
String tmpPickupId=Integer.toString(pTicket.getPickupId());
|
||||
String pickupSize =(m_App.getProperties().getProperty("till.pickupsize"));
|
||||
|
||||
if (pickupSize!=null && (Integer.parseInt(pickupSize) >= tmpPickupId.length())){
|
||||
while (tmpPickupId.length()< (Integer.parseInt(pickupSize))){
|
||||
tmpPickupId="0"+tmpPickupId;
|
||||
}
|
||||
}
|
||||
return (tmpPickupId);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param resource
|
||||
*/
|
||||
public void printTicket(String resource) {
|
||||
printTicket(resource, ticket, m_restaurant.getTable());
|
||||
printNotify();
|
||||
// j_btnKitchen.setEnabled(false);
|
||||
}
|
||||
|
||||
private void printTicket(String sresourcename, TicketInfo ticket, String table) {
|
||||
if (ticket != null) {
|
||||
|
||||
if (ticket.getPickupId()== 0){
|
||||
try{
|
||||
ticket.setPickupId(dlSales.getNextPickupIndex());
|
||||
}catch (BasicException e){
|
||||
ticket.setPickupId(0);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
ScriptEngine script = ScriptFactory.getScriptEngine(ScriptFactory.VELOCITY);
|
||||
|
||||
script.put("ticket", ticket);
|
||||
script.put("place",m_restaurant.getTableName());
|
||||
script.put("pickupid",getPickupString(ticket));
|
||||
|
||||
m_TTP2.printTicket(script.eval(m_dlSystem.getResourceAsXML(sresourcename)).toString());
|
||||
|
||||
} catch ( ScriptException | TicketPrinterException e) {
|
||||
JMessageDialog.showMessage(this,
|
||||
new MessageInf(MessageInf.SGN_NOTICE,
|
||||
AppLocal.getIntString("message.cannotprint"), e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void printNotify(){
|
||||
final WebNotification notificationPopup = new WebNotification ();
|
||||
notificationPopup.setIcon ( NotificationIcon.information );
|
||||
notificationPopup.setDisplayTime ( 4000 );
|
||||
|
||||
final WebClock clock = new WebClock ();
|
||||
clock.setClockType ( ClockType.timer );
|
||||
clock.setTimeLeft ( 5000 );
|
||||
clock.setTimePattern ( "'Printed successfully'" );
|
||||
notificationPopup.setContent ( clock );
|
||||
|
||||
NotificationManager.showNotification ( notificationPopup );
|
||||
clock.start ();
|
||||
}
|
||||
|
||||
public void updateGuestCount() {
|
||||
Integer count = restDB.getGuestsInTable(m_restaurant.getTable());
|
||||
|
||||
if (count > 0) {
|
||||
j_btnGuests.setText(Integer.toString(count));
|
||||
|
||||
} else {
|
||||
j_btnGuests.setText("");
|
||||
}
|
||||
System.out.println("Table : " + m_restaurant.getTable() + " GuestsCount :" + count);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/** 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() {
|
||||
|
||||
j_btnGuests = new javax.swing.JButton();
|
||||
m_TablePlan = new javax.swing.JButton();
|
||||
m_MoveTable = new javax.swing.JButton();
|
||||
m_DelTicket = new javax.swing.JButton();
|
||||
j_btnKitchen = new javax.swing.JButton();
|
||||
|
||||
setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
setMinimumSize(new java.awt.Dimension(250, 50));
|
||||
setPreferredSize(new java.awt.Dimension(430, 50));
|
||||
setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 4, 3));
|
||||
|
||||
j_btnGuests.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
|
||||
j_btnGuests.setForeground(new java.awt.Color(255, 0, 153));
|
||||
j_btnGuests.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/customer_add_sml.png"))); // NOI18N
|
||||
j_btnGuests.setToolTipText(AppLocal.getIntString("tooltip.guests")); // NOI18N
|
||||
j_btnGuests.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
||||
j_btnGuests.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
j_btnGuests.setMargin(new java.awt.Insets(0, 4, 0, 4));
|
||||
j_btnGuests.setMaximumSize(new java.awt.Dimension(50, 40));
|
||||
j_btnGuests.setMinimumSize(new java.awt.Dimension(50, 40));
|
||||
j_btnGuests.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
j_btnGuests.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
j_btnGuestsActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
add(j_btnGuests);
|
||||
|
||||
m_TablePlan.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/tables.png"))); // NOI18N
|
||||
m_TablePlan.setToolTipText("Go to Table Plan");
|
||||
m_TablePlan.setFocusPainted(false);
|
||||
m_TablePlan.setFocusable(false);
|
||||
m_TablePlan.setMargin(new java.awt.Insets(0, 4, 0, 4));
|
||||
m_TablePlan.setMaximumSize(new java.awt.Dimension(50, 40));
|
||||
m_TablePlan.setMinimumSize(new java.awt.Dimension(50, 40));
|
||||
m_TablePlan.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
m_TablePlan.setRequestFocusEnabled(false);
|
||||
m_TablePlan.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_TablePlanActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
add(m_TablePlan);
|
||||
|
||||
m_MoveTable.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/movetable.png"))); // NOI18N
|
||||
m_MoveTable.setToolTipText("Move Table");
|
||||
m_MoveTable.setFocusPainted(false);
|
||||
m_MoveTable.setFocusable(false);
|
||||
m_MoveTable.setMargin(new java.awt.Insets(0, 4, 0, 4));
|
||||
m_MoveTable.setMaximumSize(new java.awt.Dimension(50, 40));
|
||||
m_MoveTable.setMinimumSize(new java.awt.Dimension(50, 40));
|
||||
m_MoveTable.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
m_MoveTable.setRequestFocusEnabled(false);
|
||||
m_MoveTable.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_MoveTableActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
add(m_MoveTable);
|
||||
|
||||
m_DelTicket.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/sale_delete.png"))); // NOI18N
|
||||
m_DelTicket.setToolTipText("Delete Current Order");
|
||||
m_DelTicket.setFocusPainted(false);
|
||||
m_DelTicket.setFocusable(false);
|
||||
m_DelTicket.setMargin(new java.awt.Insets(0, 4, 0, 4));
|
||||
m_DelTicket.setMaximumSize(new java.awt.Dimension(50, 40));
|
||||
m_DelTicket.setMinimumSize(new java.awt.Dimension(50, 40));
|
||||
m_DelTicket.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
m_DelTicket.setRequestFocusEnabled(false);
|
||||
m_DelTicket.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_DelTicketActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
add(m_DelTicket);
|
||||
|
||||
j_btnKitchen.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/printer24.png"))); // NOI18N
|
||||
j_btnKitchen.setToolTipText("Send to Kichen Printer");
|
||||
j_btnKitchen.setMargin(new java.awt.Insets(0, 4, 0, 4));
|
||||
j_btnKitchen.setMaximumSize(new java.awt.Dimension(50, 40));
|
||||
j_btnKitchen.setMinimumSize(new java.awt.Dimension(50, 40));
|
||||
j_btnKitchen.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
j_btnKitchen.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
j_btnKitchenActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
add(j_btnKitchen);
|
||||
j_btnKitchen.getAccessibleContext().setAccessibleDescription("Send to Remote Printer");
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void m_MoveTableActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_MoveTableActionPerformed
|
||||
|
||||
// JG 6 Nov 13 - clear Customer from orignal table - Thanks David Kurniawan
|
||||
restDB.clearCustomerNameInTableById(m_restaurant.getTable());
|
||||
restDB.clearWaiterNameInTableById(m_restaurant.getTable());
|
||||
restDB.clearTicketIdInTableById(m_restaurant.getTable());
|
||||
restDB.clearGuestsInTable(m_restaurant.getTable());
|
||||
restDB.clearOccupied(m_restaurant.getTable());
|
||||
restDB.setTableMovedFlag(m_restaurant.getTable());
|
||||
|
||||
m_restaurant.moveTicket();
|
||||
|
||||
}//GEN-LAST:event_m_MoveTableActionPerformed
|
||||
|
||||
@SuppressWarnings("empty-statement")
|
||||
private void m_DelTicketActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_DelTicketActionPerformed
|
||||
boolean pinOK = false;
|
||||
|
||||
if (m_App.getProperties().getProperty("override.check").equals("true")) {
|
||||
Integer secret = Integer.parseInt(m_App.getProperties().getProperty("override.pin"));
|
||||
Integer iValue = JNumberPop.showEditNumber(this, AppLocal.getIntString("title.override.enterpin"));
|
||||
|
||||
if (iValue == null ? secret == null : iValue.equals(secret)) {
|
||||
pinOK = true;
|
||||
int res = JOptionPane.showConfirmDialog(this
|
||||
, AppLocal.getIntString("message.wannadelete")
|
||||
, AppLocal.getIntString("title.editor")
|
||||
, JOptionPane.YES_NO_OPTION
|
||||
, JOptionPane.QUESTION_MESSAGE);
|
||||
if (res == JOptionPane.YES_OPTION) {
|
||||
restDB.clearCustomerNameInTableById(m_restaurant.getTable());
|
||||
restDB.clearWaiterNameInTableById(m_restaurant.getTable());
|
||||
restDB.clearTicketIdInTableById(m_restaurant.getTable());
|
||||
restDB.clearGuestsInTable(m_restaurant.getTable());
|
||||
restDB.clearOccupied(m_restaurant.getTable());
|
||||
|
||||
m_restaurant.deleteTicket();
|
||||
}
|
||||
} else {
|
||||
pinOK = false;
|
||||
JOptionPane.showMessageDialog(this,
|
||||
AppLocal.getIntString("message.override.badpin"));
|
||||
}
|
||||
} else {
|
||||
int res = JOptionPane.showConfirmDialog(this
|
||||
, AppLocal.getIntString("message.wannadelete")
|
||||
, AppLocal.getIntString("title.editor")
|
||||
, JOptionPane.YES_NO_OPTION
|
||||
, JOptionPane.QUESTION_MESSAGE);
|
||||
if (res == JOptionPane.YES_OPTION) {
|
||||
restDB.clearCustomerNameInTableById(m_restaurant.getTable());
|
||||
restDB.clearWaiterNameInTableById(m_restaurant.getTable());
|
||||
restDB.clearTicketIdInTableById(m_restaurant.getTable());
|
||||
restDB.clearGuestsInTable(m_restaurant.getTable());
|
||||
restDB.clearOccupied(m_restaurant.getTable());
|
||||
|
||||
m_restaurant.deleteTicket();
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_m_DelTicketActionPerformed
|
||||
|
||||
private void m_TablePlanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_TablePlanActionPerformed
|
||||
// outta here back to TableMap
|
||||
m_restaurant.newTicket();
|
||||
|
||||
}//GEN-LAST:event_m_TablePlanActionPerformed
|
||||
|
||||
private void j_btnGuestsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_j_btnGuestsActionPerformed
|
||||
|
||||
Integer iValue = JGuestsPop.showEditNumber(this,
|
||||
AppLocal.getIntString("title.guestspop.enterguests"));
|
||||
restDB.setGuestsInTable(iValue, m_restaurant.getTable());
|
||||
j_btnGuests.setText(iValue.toString());
|
||||
|
||||
}//GEN-LAST:event_j_btnGuestsActionPerformed
|
||||
|
||||
@SuppressWarnings("empty-statement")
|
||||
private void j_btnKitchenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_j_btnKitchenActionPerformed
|
||||
/*
|
||||
* This is legacy and deprecated and should use RemotePrinter which covers
|
||||
* all sales screens for i.e.: Kitchen Print + Click & Collect & etc
|
||||
* It may be removed from future version
|
||||
*/
|
||||
ticket = m_restaurant.getActiveTicket();
|
||||
String rScript = (m_dlSystem.getResourceAsText("script.SendOrder"));
|
||||
|
||||
Interpreter i = new Interpreter();
|
||||
try {
|
||||
i.set("ticket", ticket);
|
||||
i.set("place",m_restaurant.getTableName());
|
||||
i.set("user", m_App.getAppUserView().getUser());
|
||||
i.set("sales", this);
|
||||
i.set("pickupid", ticket.getPickupId());
|
||||
Object result = i.eval(rScript);
|
||||
} catch (EvalError ex) {
|
||||
log.error(ex.getMessage());
|
||||
}
|
||||
// Autologoff after sales
|
||||
String autoLogoff = (m_App.getProperties().getProperty("till.autoLogoff"));
|
||||
String autoLogoffRestaurant =(m_App.getProperties().getProperty("till.autoLogoffrestaurant"));
|
||||
if (autoLogoff != null){
|
||||
if (autoLogoff.equals("true")){
|
||||
if (autoLogoffRestaurant == null){
|
||||
((JRootApp)m_App).closeAppView();
|
||||
}else if (autoLogoffRestaurant.equals("true")){
|
||||
m_restaurant.newTicket();
|
||||
}else{
|
||||
((JRootApp)m_App).closeAppView();
|
||||
}
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_j_btnKitchenActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton j_btnGuests;
|
||||
private javax.swing.JButton j_btnKitchen;
|
||||
private javax.swing.JButton m_DelTicket;
|
||||
private javax.swing.JButton m_MoveTable;
|
||||
private javax.swing.JButton m_TablePlan;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
<?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,-83,0,0,3,27"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignCardLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="m_jPanelMap">
|
||||
<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.DesignCardLayout" value="org.netbeans.modules.form.compat2.layouts.DesignCardLayout$CardConstraintsDescription">
|
||||
<CardConstraints cardName="map"/>
|
||||
</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.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel2">
|
||||
<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="Before"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
|
||||
<Property name="alignment" type="int" value="0"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="m_jbtnReservations">
|
||||
<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/date.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="button.reservations" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Open Reservations screen"/>
|
||||
<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, 14, 8, 14]"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[133, 40]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[133, 40]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[133, 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_jbtnReservationsActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="m_jbtnRefresh">
|
||||
<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/reload.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="button.reloadticket" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Reload table information"/>
|
||||
<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, 14, 8, 14]"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[100, 40]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[100, 40]"/>
|
||||
</Property>
|
||||
<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="m_jbtnRefreshActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="m_jbtnLayout">
|
||||
<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/movetable.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="button.layout" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value=""/>
|
||||
<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, 14, 8, 14]"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[100, 40]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[100, 40]"/>
|
||||
</Property>
|
||||
<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="m_jbtnLayoutActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="m_jbtnSave">
|
||||
<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/filesave.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="button.save" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value=""/>
|
||||
<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, 14, 8, 14]"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[100, 40]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[100, 40]"/>
|
||||
</Property>
|
||||
<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="m_jbtnSaveActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="m_jText">
|
||||
<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="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="ff" green="99" red="0" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="opaque" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="com.alee.laf.label.WebLabel" name="webLblautoRefresh">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="33" green="33" red="ff" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="horizontalAlignment" type="int" value="4"/>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="label.autoRefreshTableMapTimerON" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</Property>
|
||||
<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="Center"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,480 @@
|
||||
<?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="[1000, 750]"/>
|
||||
</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,2,-18,0,0,3,-12"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanNorth">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1000, 350]"/>
|
||||
</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" attributes="0">
|
||||
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
|
||||
<Component id="jButton1" min="-2" pref="70" max="-2" attributes="0"/>
|
||||
<EmptySpace min="6" pref="6" max="-2" attributes="0"/>
|
||||
<Component id="txtCustomer" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="4" pref="4" max="-2" attributes="0"/>
|
||||
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="4" pref="4" max="-2" attributes="0"/>
|
||||
<Component id="m_jtxtChairs" min="-2" pref="90" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="m_jPanelTime" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jbtnShowCalendar" min="-2" pref="200" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<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 min="4" pref="4" max="-2" attributes="0"/>
|
||||
<Component id="m_jtxtDescription" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="22" max="-2" attributes="0"/>
|
||||
<Component id="m_jPanelList" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="m_jToolbar" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="m_jKeys" min="-2" pref="1" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="m_jbtnReceive" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="m_jbtnTables" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="42" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</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_jToolbar" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="24" max="-2" attributes="0"/>
|
||||
<Component id="m_jKeys" min="-2" pref="32" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="m_jbtnTables" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="m_jbtnReceive" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="5" pref="5" max="-2" attributes="0"/>
|
||||
<Component id="jLabel5" min="-2" pref="40" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="7" pref="7" max="-2" attributes="0"/>
|
||||
<Component id="txtCustomer" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="7" pref="7" max="-2" attributes="0"/>
|
||||
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="7" pref="7" max="-2" attributes="0"/>
|
||||
<Component id="m_jtxtChairs" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="7" pref="7" max="-2" attributes="0"/>
|
||||
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="7" pref="7" max="-2" attributes="0"/>
|
||||
<Component id="m_jtxtDescription" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="2" attributes="0">
|
||||
<EmptySpace min="-2" pref="31" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="42" max="-2" attributes="0"/>
|
||||
<Component id="jbtnShowCalendar" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="2" attributes="0">
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="m_jPanelTime" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="m_jPanelList" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="m_jToolbar">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[500, 55]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="m_jbtnReceive">
|
||||
<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/receive.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="button.receive" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Receive pre-Booked Customer"/>
|
||||
<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="[130, 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_jbtnReceiveActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="m_jbtnTables">
|
||||
<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/tables.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="button.tables" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Go to Table Plan"/>
|
||||
<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="[130, 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_jbtnTablesActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="m_jPanelList">
|
||||
<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>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[300, 200]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
</Container>
|
||||
<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="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="rest.label.selectcustomer" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[100, 45]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AccessibilityProperties>
|
||||
<Property name="AccessibleContext.accessibleName" type="java.lang.String" value="Select Person"/>
|
||||
</AccessibilityProperties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="jButton1">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/com/unicenta/images/customer_add_sml.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Show Customers"/>
|
||||
<Property name="focusPainted" type="boolean" value="false"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[40, 33]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[40, 33]"/>
|
||||
</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"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="com.unicenta.editor.JEditorString" name="txtCustomer">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[250, 30]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[200, 25]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[250, 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="rest.label.chairs" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[100, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="com.unicenta.editor.JEditorIntegerPositive" name="m_jtxtChairs">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 25]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 25]"/>
|
||||
</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="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="rest.label.notes" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[100, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="com.unicenta.editor.JEditorString" name="m_jtxtDescription">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[180, 25]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[250, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</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="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="rest.label.date" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="verticalAlignment" type="int" value="1"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[100, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="m_jPanelTime">
|
||||
<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, 200]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="jbtnShowCalendar">
|
||||
<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/date.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="rest.label.showcalendar" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="rest.label.showcalendar" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[129, 45]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jbtnShowCalendarActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="com.unicenta.editor.JEditorKeys" name="m_jKeys">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[5, 5]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanSouth">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1000, 350]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<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>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="1012" max="32767" attributes="0"/>
|
||||
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<Component id="jCalendar" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="350" max="32767" attributes="0"/>
|
||||
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<Component id="jCalendar" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jCalendar">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1000, 350]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
|
||||
<Property name="useNullLayout" type="boolean" value="false"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanelTime">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[250, 250]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="0" y="50" width="-1" height="-1"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanelDate">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[700, 345]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="270" y="5" width="-1" height="-1"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,710 @@
|
||||
// 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.sales.restaurant;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
import java.beans.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.unicenta.beans.*;
|
||||
import com.unicenta.data.gui.*;
|
||||
import com.unicenta.data.loader.*;
|
||||
import com.unicenta.data.user.*;
|
||||
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
import com.unicenta.pos.forms.AppView;
|
||||
import com.unicenta.format.Formats;
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.pos.customers.DataLogicCustomers;
|
||||
import com.unicenta.pos.customers.JCustomerFinder;
|
||||
import com.unicenta.pos.customers.CustomerInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
public class JTicketsBagRestaurantRes extends javax.swing.JPanel implements EditorRecord {
|
||||
|
||||
private final JTicketsBagRestaurantMap m_restaurantmap;
|
||||
|
||||
private DataLogicCustomers dlCustomers = null;
|
||||
|
||||
private final DirtyManager m_Dirty;
|
||||
private Object m_sID;
|
||||
private CustomerInfo customer;
|
||||
private Date m_dCreated;
|
||||
private final JTimePanel m_timereservation;
|
||||
private boolean m_bReceived;
|
||||
private final BrowsableEditableData m_bd;
|
||||
|
||||
private Date m_dcurrentday;
|
||||
|
||||
private final JCalendarPanel m_datepanel;
|
||||
private final JTimePanel m_timepanel;
|
||||
private boolean m_bpaintlock = false;
|
||||
|
||||
|
||||
/** Creates new form JPanelReservations
|
||||
* @param oApp
|
||||
* @param restaurantmap */
|
||||
public JTicketsBagRestaurantRes(AppView oApp, JTicketsBagRestaurantMap restaurantmap) {
|
||||
|
||||
m_restaurantmap = restaurantmap;
|
||||
|
||||
dlCustomers = (DataLogicCustomers) oApp.getBean("com.unicenta.pos.customers.DataLogicCustomers");
|
||||
|
||||
m_dcurrentday = null;
|
||||
|
||||
initComponents();
|
||||
jCalendar.setVisible(false);
|
||||
|
||||
m_datepanel = new JCalendarPanel();
|
||||
jPanelDate.add(m_datepanel, BorderLayout.CENTER);
|
||||
m_datepanel.addPropertyChangeListener("Date", new DateChangeCalendarListener());
|
||||
|
||||
m_timepanel = new JTimePanel(null, JTimePanel.BUTTONS_HOUR);
|
||||
m_timepanel.setPeriod(3600000L);
|
||||
jPanelTime.add(m_timepanel, BorderLayout.CENTER);
|
||||
m_timepanel.addPropertyChangeListener("Date", new DateChangeTimeListener());
|
||||
|
||||
m_timereservation = new JTimePanel(null, JTimePanel.BUTTONS_MINUTE);
|
||||
m_jPanelTime.add(m_timereservation, BorderLayout.CENTER);
|
||||
|
||||
txtCustomer.addEditorKeys(m_jKeys);
|
||||
m_jtxtChairs.addEditorKeys(m_jKeys);
|
||||
m_jtxtDescription.addEditorKeys(m_jKeys);
|
||||
|
||||
m_Dirty = new DirtyManager();
|
||||
m_timereservation.addPropertyChangeListener("Date", m_Dirty);
|
||||
txtCustomer.addPropertyChangeListener("Text", m_Dirty);
|
||||
txtCustomer.addPropertyChangeListener("Text", new PropertyChangeListener(){
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
customer = new CustomerInfo(null);
|
||||
customer.setTaxid(null);
|
||||
customer.setSearchkey(null);
|
||||
customer.setName(txtCustomer.getText());
|
||||
}
|
||||
});
|
||||
m_jtxtChairs.addPropertyChangeListener("Text", m_Dirty);
|
||||
m_jtxtDescription.addPropertyChangeListener("Text", m_Dirty);
|
||||
|
||||
writeValueEOF();
|
||||
|
||||
ListProvider lpr = new ListProviderCreator(dlCustomers.getReservationsList(), new MyDateFilter());
|
||||
SaveProvider spr = new SaveProvider(dlCustomers.getReservationsUpdate(),
|
||||
dlCustomers.getReservationsInsert(), dlCustomers.getReservationsDelete());
|
||||
|
||||
m_bd = new BrowsableEditableData(lpr, spr, new CompareReservations(), this, m_Dirty);
|
||||
|
||||
JListNavigator nl = new JListNavigator(m_bd, true);
|
||||
nl.setCellRenderer(new JCalendarItemRenderer());
|
||||
m_jPanelList.add(nl, BorderLayout.CENTER);
|
||||
|
||||
m_jToolbar.add(new JLabelDirty(m_Dirty));
|
||||
m_jToolbar.add(new JCounter(m_bd));
|
||||
m_jToolbar.add(new JNavigator(m_bd));
|
||||
m_jToolbar.add(new JSaver(m_bd));
|
||||
}
|
||||
|
||||
private class MyDateFilter implements EditorCreator {
|
||||
@Override
|
||||
public Object createValue() throws BasicException {
|
||||
return new Object[] {m_dcurrentday, new Date(m_dcurrentday.getTime() + 3600000L)};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void activate() {
|
||||
reload(DateUtils.getTodayHours(new Date()));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void refresh() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean deactivate() {
|
||||
try {
|
||||
return m_bd.actionClosingForm(this);
|
||||
} catch (BasicException eD) {
|
||||
MessageInf msg = new MessageInf(MessageInf.SGN_NOTICE,
|
||||
AppLocal.getIntString("message.CannotMove"), eD);
|
||||
msg.show(this);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void writeValueEOF() {
|
||||
m_sID = null;
|
||||
m_dCreated = null;
|
||||
m_timereservation.setDate(null);
|
||||
assignCustomer(new CustomerInfo(null));
|
||||
m_jtxtChairs.reset();
|
||||
m_bReceived = false;
|
||||
m_jtxtDescription.reset();
|
||||
m_timereservation.setEnabled(false);
|
||||
txtCustomer.setEnabled(false);
|
||||
m_jtxtChairs.setEnabled(false);
|
||||
m_jtxtDescription.setEnabled(false);
|
||||
m_jKeys.setEnabled(false);
|
||||
|
||||
m_jbtnReceive.setEnabled(false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void writeValueInsert() {
|
||||
m_sID = null;
|
||||
m_dCreated = null;
|
||||
m_timereservation.setCheckDates(m_dcurrentday, new Date(m_dcurrentday.getTime() + 3600000L));
|
||||
m_timereservation.setDate(m_dcurrentday);
|
||||
assignCustomer(new CustomerInfo(null));
|
||||
m_jtxtChairs.setValueInteger(2);
|
||||
m_bReceived = false;
|
||||
m_jtxtDescription.reset();
|
||||
m_timereservation.setEnabled(true);
|
||||
txtCustomer.setEnabled(true);
|
||||
m_jtxtChairs.setEnabled(true);
|
||||
m_jtxtDescription.setEnabled(true);
|
||||
m_jKeys.setEnabled(true);
|
||||
|
||||
m_jbtnReceive.setEnabled(true);
|
||||
|
||||
txtCustomer.activate();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
@Override
|
||||
public void writeValueDelete(Object value) {
|
||||
Object[] res = (Object[]) value;
|
||||
m_sID = res[0];
|
||||
m_dCreated = (Date) res[1];
|
||||
m_timereservation.setCheckDates(m_dcurrentday, new Date(m_dcurrentday.getTime() + 3600000L));
|
||||
m_timereservation.setDate((Date) res[2]);
|
||||
CustomerInfo c = new CustomerInfo((String) res[3]);
|
||||
c.setTaxid((String) res[4]);
|
||||
c.setSearchkey((String) res[5]);
|
||||
c.setName((String) res[6]);
|
||||
assignCustomer(c);
|
||||
m_jtxtChairs.setValueInteger(((Integer)res[7]).intValue());
|
||||
m_bReceived = ((Boolean)res[8]).booleanValue();
|
||||
m_jtxtDescription.setText(Formats.STRING.formatValue(res[9]));
|
||||
m_timereservation.setEnabled(false);
|
||||
txtCustomer.setEnabled(false);
|
||||
m_jtxtChairs.setEnabled(false);
|
||||
m_jtxtDescription.setEnabled(false);
|
||||
m_jKeys.setEnabled(false);
|
||||
|
||||
m_jbtnReceive.setEnabled(false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
@Override
|
||||
public void writeValueEdit(Object value) {
|
||||
Object[] res = (Object[]) value;
|
||||
m_sID = res[0];
|
||||
m_dCreated = (Date) res[1];
|
||||
m_timereservation.setCheckDates(m_dcurrentday, new Date(m_dcurrentday.getTime() + 3600000L));
|
||||
m_timereservation.setDate((Date) res[2]);
|
||||
CustomerInfo c = new CustomerInfo((String) res[3]);
|
||||
c.setTaxid((String) res[4]);
|
||||
c.setSearchkey((String) res[5]);
|
||||
c.setName((String) res[6]);
|
||||
assignCustomer(c);
|
||||
m_jtxtChairs.setValueInteger(((Integer)res[7]).intValue());
|
||||
m_bReceived = ((Boolean)res[8]).booleanValue();
|
||||
m_jtxtDescription.setText(Formats.STRING.formatValue(res[9]));
|
||||
m_timereservation.setEnabled(true);
|
||||
txtCustomer.setEnabled(true);
|
||||
m_jtxtChairs.setEnabled(true);
|
||||
m_jtxtDescription.setEnabled(true);
|
||||
m_jKeys.setEnabled(true);
|
||||
|
||||
m_jbtnReceive.setEnabled(!m_bReceived); // se habilita si no se ha recibido al cliente
|
||||
|
||||
txtCustomer.activate();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public Object createValue() throws BasicException {
|
||||
|
||||
Object[] res = new Object[10];
|
||||
|
||||
res[0] = m_sID == null ? UUID.randomUUID().toString() : m_sID;
|
||||
res[1] = m_dCreated == null ? new Date() : m_dCreated;
|
||||
res[2] = m_timereservation.getDate();
|
||||
res[3] = customer.getId();
|
||||
res[4] = customer.getTaxid();
|
||||
res[5] = customer.getSearchkey();
|
||||
res[6] = customer.getName();
|
||||
res[7] = m_jtxtChairs.getValueInteger();
|
||||
res[8] = m_bReceived;
|
||||
res[9] = m_jtxtDescription.getText();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Component getComponent() {
|
||||
return this;
|
||||
}
|
||||
|
||||
private static class CompareReservations implements Comparator {
|
||||
@Override
|
||||
public int compare(Object o1, Object o2) {
|
||||
Object[] a1 = (Object[]) o1;
|
||||
Object[] a2 = (Object[]) o2;
|
||||
Date d1 = (Date) a1[2];
|
||||
Date d2 = (Date) a2[2];
|
||||
int c = d1.compareTo(d2);
|
||||
if (c == 0) {
|
||||
d1 = (Date) a1[1];
|
||||
d2 = (Date) a2[1];
|
||||
return d1.compareTo(d2);
|
||||
} else {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void reload(Date dDate) {
|
||||
|
||||
if (!dDate.equals(m_dcurrentday)) {
|
||||
|
||||
Date doldcurrentday = m_dcurrentday;
|
||||
m_dcurrentday = dDate;
|
||||
try {
|
||||
m_bd.actionLoad();
|
||||
} catch (BasicException eD) {
|
||||
MessageInf msg = new MessageInf(MessageInf.SGN_NOTICE,
|
||||
LocalRes.getIntString("message.noreload"), eD);
|
||||
msg.show(this);
|
||||
m_dcurrentday = doldcurrentday; // nos retractamos...
|
||||
}
|
||||
}
|
||||
|
||||
paintDate();
|
||||
}
|
||||
|
||||
private void paintDate() {
|
||||
|
||||
m_bpaintlock = true;
|
||||
m_datepanel.setDate(m_dcurrentday);
|
||||
m_timepanel.setDate(m_dcurrentday);
|
||||
m_bpaintlock = false;
|
||||
}
|
||||
|
||||
private void assignCustomer(CustomerInfo c) {
|
||||
|
||||
txtCustomer.setText(c.getName());
|
||||
customer = c;
|
||||
}
|
||||
|
||||
private class DateChangeCalendarListener implements PropertyChangeListener {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
if (!m_bpaintlock) {
|
||||
reload(DateUtils.getTodayHours(DateUtils.getDate(m_datepanel.getDate(),
|
||||
m_timepanel.getDate())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class DateChangeTimeListener implements PropertyChangeListener {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
if (!m_bpaintlock) {
|
||||
reload(DateUtils.getTodayHours(DateUtils.getDate(m_datepanel.getDate(),
|
||||
m_timepanel.getDate())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 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() {
|
||||
|
||||
jPanNorth = new javax.swing.JPanel();
|
||||
m_jToolbar = new javax.swing.JPanel();
|
||||
m_jbtnReceive = new javax.swing.JButton();
|
||||
m_jbtnTables = new javax.swing.JButton();
|
||||
m_jPanelList = new javax.swing.JPanel();
|
||||
jLabel5 = new javax.swing.JLabel();
|
||||
jButton1 = new javax.swing.JButton();
|
||||
txtCustomer = new com.unicenta.editor.JEditorString();
|
||||
jLabel3 = new javax.swing.JLabel();
|
||||
m_jtxtChairs = new com.unicenta.editor.JEditorIntegerPositive();
|
||||
jLabel4 = new javax.swing.JLabel();
|
||||
m_jtxtDescription = new com.unicenta.editor.JEditorString();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
m_jPanelTime = new javax.swing.JPanel();
|
||||
jbtnShowCalendar = new javax.swing.JButton();
|
||||
m_jKeys = new com.unicenta.editor.JEditorKeys();
|
||||
jPanSouth = new javax.swing.JPanel();
|
||||
jCalendar = new javax.swing.JPanel();
|
||||
jPanelTime = new javax.swing.JPanel();
|
||||
jPanelDate = new javax.swing.JPanel();
|
||||
|
||||
setPreferredSize(new java.awt.Dimension(1000, 750));
|
||||
setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jPanNorth.setPreferredSize(new java.awt.Dimension(1000, 350));
|
||||
|
||||
m_jToolbar.setPreferredSize(new java.awt.Dimension(500, 55));
|
||||
m_jToolbar.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
m_jbtnReceive.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
m_jbtnReceive.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/receive.png"))); // NOI18N
|
||||
m_jbtnReceive.setText(AppLocal.getIntString("button.receive")); // NOI18N
|
||||
m_jbtnReceive.setToolTipText("Receive pre-Booked Customer");
|
||||
m_jbtnReceive.setFocusPainted(false);
|
||||
m_jbtnReceive.setFocusable(false);
|
||||
m_jbtnReceive.setPreferredSize(new java.awt.Dimension(130, 45));
|
||||
m_jbtnReceive.setRequestFocusEnabled(false);
|
||||
m_jbtnReceive.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jbtnReceiveActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
m_jbtnTables.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
m_jbtnTables.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/tables.png"))); // NOI18N
|
||||
m_jbtnTables.setText(AppLocal.getIntString("button.tables")); // NOI18N
|
||||
m_jbtnTables.setToolTipText("Go to Table Plan");
|
||||
m_jbtnTables.setFocusPainted(false);
|
||||
m_jbtnTables.setFocusable(false);
|
||||
m_jbtnTables.setPreferredSize(new java.awt.Dimension(130, 45));
|
||||
m_jbtnTables.setRequestFocusEnabled(false);
|
||||
m_jbtnTables.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jbtnTablesActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
m_jPanelList.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
m_jPanelList.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
m_jPanelList.setPreferredSize(new java.awt.Dimension(300, 200));
|
||||
m_jPanelList.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jLabel5.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel5.setText(AppLocal.getIntString("rest.label.selectcustomer")); // NOI18N
|
||||
jLabel5.setPreferredSize(new java.awt.Dimension(100, 45));
|
||||
|
||||
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/customer_add_sml.png"))); // NOI18N
|
||||
jButton1.setToolTipText("Show Customers");
|
||||
jButton1.setFocusPainted(false);
|
||||
jButton1.setFocusable(false);
|
||||
jButton1.setMaximumSize(new java.awt.Dimension(40, 33));
|
||||
jButton1.setMinimumSize(new java.awt.Dimension(40, 33));
|
||||
jButton1.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
jButton1.setRequestFocusEnabled(false);
|
||||
jButton1.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jButton1ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
txtCustomer.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
txtCustomer.setMaximumSize(new java.awt.Dimension(250, 30));
|
||||
txtCustomer.setMinimumSize(new java.awt.Dimension(200, 25));
|
||||
txtCustomer.setPreferredSize(new java.awt.Dimension(250, 30));
|
||||
|
||||
jLabel3.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel3.setText(AppLocal.getIntString("rest.label.chairs")); // NOI18N
|
||||
jLabel3.setPreferredSize(new java.awt.Dimension(100, 30));
|
||||
|
||||
m_jtxtChairs.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
m_jtxtChairs.setMaximumSize(new java.awt.Dimension(50, 25));
|
||||
m_jtxtChairs.setMinimumSize(new java.awt.Dimension(50, 25));
|
||||
m_jtxtChairs.setPreferredSize(new java.awt.Dimension(100, 30));
|
||||
|
||||
jLabel4.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel4.setText(AppLocal.getIntString("rest.label.notes")); // NOI18N
|
||||
jLabel4.setPreferredSize(new java.awt.Dimension(100, 30));
|
||||
|
||||
m_jtxtDescription.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
m_jtxtDescription.setMaximumSize(new java.awt.Dimension(180, 25));
|
||||
m_jtxtDescription.setPreferredSize(new java.awt.Dimension(250, 30));
|
||||
|
||||
jLabel1.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel1.setText(AppLocal.getIntString("rest.label.date")); // NOI18N
|
||||
jLabel1.setVerticalAlignment(javax.swing.SwingConstants.TOP);
|
||||
jLabel1.setPreferredSize(new java.awt.Dimension(100, 30));
|
||||
|
||||
m_jPanelTime.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
m_jPanelTime.setPreferredSize(new java.awt.Dimension(200, 200));
|
||||
m_jPanelTime.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jbtnShowCalendar.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jbtnShowCalendar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/date.png"))); // NOI18N
|
||||
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("pos_messages"); // NOI18N
|
||||
jbtnShowCalendar.setText(bundle.getString("rest.label.showcalendar")); // NOI18N
|
||||
jbtnShowCalendar.setToolTipText(bundle.getString("rest.label.showcalendar")); // NOI18N
|
||||
jbtnShowCalendar.setPreferredSize(new java.awt.Dimension(129, 45));
|
||||
jbtnShowCalendar.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jbtnShowCalendarActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
m_jKeys.setPreferredSize(new java.awt.Dimension(5, 5));
|
||||
|
||||
javax.swing.GroupLayout jPanNorthLayout = new javax.swing.GroupLayout(jPanNorth);
|
||||
jPanNorth.setLayout(jPanNorthLayout);
|
||||
jPanNorthLayout.setHorizontalGroup(
|
||||
jPanNorthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanNorthLayout.createSequentialGroup()
|
||||
.addGap(10, 10, 10)
|
||||
.addGroup(jPanNorthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addGroup(jPanNorthLayout.createSequentialGroup()
|
||||
.addGroup(jPanNorthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanNorthLayout.createSequentialGroup()
|
||||
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(10, 10, 10)
|
||||
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(6, 6, 6)
|
||||
.addComponent(txtCustomer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(4, 4, 4)
|
||||
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(4, 4, 4)
|
||||
.addComponent(m_jtxtChairs, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanNorthLayout.createSequentialGroup()
|
||||
.addComponent(m_jPanelTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanNorthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jbtnShowCalendar, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanNorthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanNorthLayout.createSequentialGroup()
|
||||
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(4, 4, 4)
|
||||
.addComponent(m_jtxtDescription, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanNorthLayout.createSequentialGroup()
|
||||
.addGap(22, 22, 22)
|
||||
.addComponent(m_jPanelList, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addContainerGap())
|
||||
.addGroup(jPanNorthLayout.createSequentialGroup()
|
||||
.addComponent(m_jToolbar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(m_jKeys, javax.swing.GroupLayout.PREFERRED_SIZE, 1, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(m_jbtnReceive, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(m_jbtnTables, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(42, 42, 42))))
|
||||
);
|
||||
jPanNorthLayout.setVerticalGroup(
|
||||
jPanNorthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanNorthLayout.createSequentialGroup()
|
||||
.addGroup(jPanNorthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(m_jToolbar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(jPanNorthLayout.createSequentialGroup()
|
||||
.addGap(24, 24, 24)
|
||||
.addComponent(m_jKeys, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanNorthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(m_jbtnTables, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(m_jbtnReceive, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanNorthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanNorthLayout.createSequentialGroup()
|
||||
.addGap(5, 5, 5)
|
||||
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(jPanNorthLayout.createSequentialGroup()
|
||||
.addGap(7, 7, 7)
|
||||
.addComponent(txtCustomer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanNorthLayout.createSequentialGroup()
|
||||
.addGap(7, 7, 7)
|
||||
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanNorthLayout.createSequentialGroup()
|
||||
.addGap(7, 7, 7)
|
||||
.addComponent(m_jtxtChairs, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanNorthLayout.createSequentialGroup()
|
||||
.addGap(7, 7, 7)
|
||||
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanNorthLayout.createSequentialGroup()
|
||||
.addGap(7, 7, 7)
|
||||
.addComponent(m_jtxtDescription, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(jPanNorthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanNorthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.CENTER, jPanNorthLayout.createSequentialGroup()
|
||||
.addGap(31, 31, 31)
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(42, 42, 42)
|
||||
.addComponent(jbtnShowCalendar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.CENTER, jPanNorthLayout.createSequentialGroup()
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(m_jPanelTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(jPanNorthLayout.createSequentialGroup()
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(m_jPanelList, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
jLabel5.getAccessibleContext().setAccessibleName("Select Person");
|
||||
|
||||
add(jPanNorth, java.awt.BorderLayout.CENTER);
|
||||
|
||||
jPanSouth.setPreferredSize(new java.awt.Dimension(1000, 350));
|
||||
|
||||
jCalendar.setPreferredSize(new java.awt.Dimension(1000, 350));
|
||||
jCalendar.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
|
||||
|
||||
jPanelTime.setPreferredSize(new java.awt.Dimension(250, 250));
|
||||
jPanelTime.setLayout(new java.awt.BorderLayout());
|
||||
jCalendar.add(jPanelTime, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 50, -1, -1));
|
||||
|
||||
jPanelDate.setPreferredSize(new java.awt.Dimension(700, 345));
|
||||
jPanelDate.setLayout(new java.awt.BorderLayout());
|
||||
jCalendar.add(jPanelDate, new org.netbeans.lib.awtextra.AbsoluteConstraints(270, 5, -1, -1));
|
||||
|
||||
javax.swing.GroupLayout jPanSouthLayout = new javax.swing.GroupLayout(jPanSouth);
|
||||
jPanSouth.setLayout(jPanSouthLayout);
|
||||
jPanSouthLayout.setHorizontalGroup(
|
||||
jPanSouthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 1012, Short.MAX_VALUE)
|
||||
.addGroup(jPanSouthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanSouthLayout.createSequentialGroup()
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addComponent(jCalendar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
);
|
||||
jPanSouthLayout.setVerticalGroup(
|
||||
jPanSouthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 350, Short.MAX_VALUE)
|
||||
.addGroup(jPanSouthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanSouthLayout.createSequentialGroup()
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addComponent(jCalendar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
);
|
||||
|
||||
add(jPanSouth, java.awt.BorderLayout.SOUTH);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void m_jbtnReceiveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jbtnReceiveActionPerformed
|
||||
|
||||
m_bReceived = true;
|
||||
m_Dirty.setDirty(true);
|
||||
|
||||
try {
|
||||
m_bd.saveData();
|
||||
m_restaurantmap.viewTables(customer);
|
||||
} catch (BasicException eD) {
|
||||
MessageInf msg = new MessageInf(MessageInf.SGN_NOTICE,
|
||||
LocalRes.getIntString("message.nosaveticket"), eD);
|
||||
msg.show(this);
|
||||
}
|
||||
|
||||
}//GEN-LAST:event_m_jbtnReceiveActionPerformed
|
||||
|
||||
private void m_jbtnTablesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jbtnTablesActionPerformed
|
||||
|
||||
m_restaurantmap.viewTables();
|
||||
|
||||
}//GEN-LAST:event_m_jbtnTablesActionPerformed
|
||||
|
||||
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
|
||||
|
||||
JCustomerFinder finder = JCustomerFinder.getCustomerFinder(this, dlCustomers);
|
||||
finder.search(customer);
|
||||
finder.setVisible(true);
|
||||
|
||||
CustomerInfo c = finder.getSelectedCustomer();
|
||||
|
||||
if (c == null) {
|
||||
assignCustomer(new CustomerInfo(null));
|
||||
} else {
|
||||
assignCustomer(c);
|
||||
}
|
||||
|
||||
}//GEN-LAST:event_jButton1ActionPerformed
|
||||
|
||||
private void jbtnShowCalendarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnShowCalendarActionPerformed
|
||||
if (jCalendar.isShowing()) {
|
||||
jCalendar.setVisible(false);
|
||||
jbtnShowCalendar.setText("Show Calendar");
|
||||
}else{
|
||||
jbtnShowCalendar.setText("Hide Calendar");
|
||||
jCalendar.setVisible(true);
|
||||
}
|
||||
}//GEN-LAST:event_jbtnShowCalendarActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton jButton1;
|
||||
private javax.swing.JPanel jCalendar;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JLabel jLabel4;
|
||||
private javax.swing.JLabel jLabel5;
|
||||
private javax.swing.JPanel jPanNorth;
|
||||
private javax.swing.JPanel jPanSouth;
|
||||
private javax.swing.JPanel jPanelDate;
|
||||
private javax.swing.JPanel jPanelTime;
|
||||
private javax.swing.JButton jbtnShowCalendar;
|
||||
private com.unicenta.editor.JEditorKeys m_jKeys;
|
||||
private javax.swing.JPanel m_jPanelList;
|
||||
private javax.swing.JPanel m_jPanelTime;
|
||||
private javax.swing.JPanel m_jToolbar;
|
||||
private javax.swing.JButton m_jbtnReceive;
|
||||
private javax.swing.JButton m_jbtnTables;
|
||||
private com.unicenta.editor.JEditorIntegerPositive m_jtxtChairs;
|
||||
private com.unicenta.editor.JEditorString m_jtxtDescription;
|
||||
private com.unicenta.editor.JEditorString txtCustomer;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
// 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.sales.restaurant;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Insets;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.SwingConstants;
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.gui.NullIcon;
|
||||
import com.unicenta.data.loader.DataRead;
|
||||
import com.unicenta.data.loader.SerializableRead;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
public class Place implements SerializableRead, java.io.Serializable {
|
||||
|
||||
private static final long serialVersionUID = 8652254694281L;
|
||||
private static final Icon ICO_OCU = new ImageIcon(Place.class.getResource("/com/unicenta/images/edit_group.png"));
|
||||
private static final Icon ICO_FRE = new NullIcon(22, 22);
|
||||
|
||||
private String m_sId;
|
||||
private String m_sName;
|
||||
private String m_sSeats;
|
||||
private int m_ix;
|
||||
private int m_iy;
|
||||
private int m_diffx;
|
||||
private int m_diffy;
|
||||
private String m_sfloor;
|
||||
private String m_customer;
|
||||
private String m_waiter;
|
||||
private String m_ticketId;
|
||||
private Boolean m_tableMoved;
|
||||
private Boolean m_changed = false;
|
||||
|
||||
private boolean m_bPeople;
|
||||
private JButton m_btn;
|
||||
|
||||
private int m_theight;
|
||||
private int m_twidth;
|
||||
private int m_guests;
|
||||
private Date m_occupied;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new instance of TablePlace
|
||||
*/
|
||||
public Place() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dr
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public void readValues(DataRead dr) throws BasicException {
|
||||
m_sId = dr.getString(1);
|
||||
m_sName = dr.getString(2);
|
||||
m_sSeats = dr.getString(3);
|
||||
m_ix = dr.getInt(4);
|
||||
m_iy = dr.getInt(5);
|
||||
m_sfloor = dr.getString(6);
|
||||
m_customer = dr.getString(7);
|
||||
m_waiter = dr.getString(8);
|
||||
m_ticketId = dr.getString(9);
|
||||
m_tableMoved = dr.getBoolean(10);
|
||||
m_twidth = dr.getInt(11);
|
||||
m_theight = dr.getInt(12);
|
||||
m_guests = dr.getInt(13);
|
||||
m_occupied = dr.getTimestamp(14);
|
||||
|
||||
m_bPeople = false;
|
||||
m_btn = new JButton();
|
||||
m_btn.setFocusPainted(false);
|
||||
m_btn.setFocusable(false);
|
||||
m_btn.setRequestFocusEnabled(false);
|
||||
m_btn.setHorizontalTextPosition(SwingConstants.CENTER);
|
||||
m_btn.setVerticalTextPosition(SwingConstants.BOTTOM);
|
||||
m_btn.setIcon(ICO_FRE);
|
||||
m_btn.setText(m_sName);
|
||||
m_btn.setMargin(new Insets(2,5,2,5));
|
||||
m_diffx=0;
|
||||
m_diffy=0;
|
||||
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return m_sId;
|
||||
}
|
||||
|
||||
public String getTicketID(){
|
||||
return m_ticketId;
|
||||
}
|
||||
public String getName() {
|
||||
return m_sName;
|
||||
}
|
||||
|
||||
public String getSeats() {
|
||||
return m_sSeats;
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return m_ix;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return m_iy;
|
||||
}
|
||||
|
||||
public void setX(int x) {
|
||||
this.m_ix = x;
|
||||
}
|
||||
|
||||
public void setY(int y) {
|
||||
this.m_iy = y;
|
||||
}
|
||||
|
||||
public int gettWidth() {
|
||||
return m_twidth;
|
||||
}
|
||||
|
||||
public int gettHeight() {
|
||||
return m_theight;
|
||||
}
|
||||
|
||||
public void settWidth(int twidth) {
|
||||
this.m_twidth = twidth;
|
||||
}
|
||||
|
||||
public void settHeight(int theight) {
|
||||
this.m_theight = theight;
|
||||
}
|
||||
|
||||
public int getDiffX() {
|
||||
return m_diffx;
|
||||
}
|
||||
|
||||
public int getDiffY() {
|
||||
return m_diffy;
|
||||
}
|
||||
|
||||
public void setDiffX(int x) {
|
||||
this.m_diffx = x;
|
||||
}
|
||||
|
||||
public void setDiffY(int y) {
|
||||
this.m_diffy = y;
|
||||
}
|
||||
|
||||
public Boolean getChanged() {
|
||||
return m_changed;
|
||||
}
|
||||
|
||||
public void setChanged(Boolean changed) {
|
||||
this.m_changed = changed;
|
||||
}
|
||||
|
||||
|
||||
public String getFloor() {
|
||||
return m_sfloor;
|
||||
}
|
||||
|
||||
public JButton getButton() {
|
||||
return m_btn;
|
||||
}
|
||||
|
||||
public String getCustomer() {
|
||||
return m_customer;
|
||||
}
|
||||
|
||||
public String getWaiter() {
|
||||
return m_waiter;
|
||||
}
|
||||
|
||||
public boolean hasPeople() {
|
||||
return m_bPeople;
|
||||
}
|
||||
|
||||
public void setPeople(boolean bValue) {
|
||||
m_bPeople = bValue;
|
||||
m_btn.setIcon(bValue ? ICO_OCU : ICO_FRE);
|
||||
}
|
||||
|
||||
public int getGuests() {
|
||||
return m_guests;
|
||||
}
|
||||
|
||||
public void setGuests(int guests) {
|
||||
this.m_guests = guests;
|
||||
}
|
||||
|
||||
public Date getOccupied() {
|
||||
return m_occupied;
|
||||
}
|
||||
|
||||
public void setOccupied(Date occupied) {
|
||||
this.m_occupied = occupied;
|
||||
}
|
||||
|
||||
public void setButtonBounds() {
|
||||
Dimension d = m_btn.getPreferredSize();
|
||||
m_btn.setPreferredSize(new Dimension(d.width + m_twidth, d.height + m_theight));
|
||||
d = m_btn.getPreferredSize();
|
||||
m_btn.setBounds(m_ix - d.width / 2, m_iy - d.height / 2, d.width, d.height);
|
||||
}
|
||||
|
||||
public void setButtonText(String btnText) {
|
||||
m_btn.setText(btnText);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,624 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.unicenta.pos.sales.restaurant;
|
||||
|
||||
import com.unicenta.data.loader.Session;
|
||||
import com.unicenta.pos.forms.AppView;
|
||||
import com.unicenta.pos.forms.DataLogicSystem;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JDL
|
||||
*/
|
||||
|
||||
public class RestaurantDBUtils {
|
||||
private Session s;
|
||||
private Connection con;
|
||||
private Statement stmt;
|
||||
private PreparedStatement pstmt;
|
||||
private String SQL;
|
||||
private ResultSet rs;
|
||||
private AppView m_App;
|
||||
|
||||
protected DataLogicSystem dlSystem;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param oApp
|
||||
*/
|
||||
public RestaurantDBUtils(AppView oApp) {
|
||||
m_App=oApp;
|
||||
|
||||
try{
|
||||
s=m_App.getSession();
|
||||
con=s.getConnection();
|
||||
} catch (SQLException e){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param newTable
|
||||
* @param ticketID
|
||||
*/
|
||||
public void moveCustomer(String newTable, String ticketID){
|
||||
String oldTable=getTableDetails(ticketID);
|
||||
|
||||
if (countTicketIdInTable(ticketID)>1){
|
||||
setCustomerNameInTable(getCustomerNameInTable(oldTable),newTable);
|
||||
setWaiterNameInTable(getWaiterNameInTable(oldTable),newTable);
|
||||
setTicketIdInTable(ticketID,newTable);
|
||||
setGuestsInTable(getGuestsInTable(oldTable),newTable);
|
||||
|
||||
|
||||
|
||||
oldTable = getTableMovedName(ticketID);
|
||||
if ((oldTable != null) && (oldTable != newTable)){
|
||||
clearCustomerNameInTable(oldTable);
|
||||
clearWaiterNameInTable(oldTable);
|
||||
clearTicketIdInTable(oldTable);
|
||||
clearTableMovedFlag(oldTable);
|
||||
} else {
|
||||
oldTable = getTableMovedName(ticketID);
|
||||
clearTableMovedFlag(oldTable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param custName
|
||||
* @param tableName
|
||||
*/
|
||||
public void setCustomerNameInTable(String custName, String tableName){
|
||||
try{
|
||||
SQL = "UPDATE places SET CUSTOMER=? WHERE NAME=?";
|
||||
pstmt=con.prepareStatement(SQL);
|
||||
pstmt.setString(1,custName);
|
||||
pstmt.setString(2,tableName);
|
||||
pstmt.executeUpdate();
|
||||
}catch(SQLException e){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param custName
|
||||
* @param tableID
|
||||
*/
|
||||
public void setCustomerNameInTableById(String custName, String tableID){
|
||||
try{
|
||||
SQL = "UPDATE places SET CUSTOMER=? WHERE ID=?";
|
||||
pstmt=con.prepareStatement(SQL);
|
||||
pstmt.setString(1,custName);
|
||||
pstmt.setString(2,tableID);
|
||||
pstmt.executeUpdate();
|
||||
}catch(SQLException e){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param custName
|
||||
* @param ticketID
|
||||
*/
|
||||
public void setCustomerNameInTableByTicketId(String custName, String ticketID){
|
||||
try{
|
||||
SQL = "UPDATE places SET CUSTOMER=? WHERE TICKETID=?";
|
||||
pstmt=con.prepareStatement(SQL);
|
||||
pstmt.setString(1,custName);
|
||||
pstmt.setString(2,ticketID);
|
||||
pstmt.executeUpdate();
|
||||
}catch(SQLException e){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tableName
|
||||
* @return
|
||||
*/
|
||||
public String getCustomerNameInTable(String tableName){
|
||||
try{
|
||||
SQL = "SELECT customer FROM places WHERE NAME='"+ tableName + "'";
|
||||
stmt = (Statement) con.createStatement();
|
||||
rs = stmt.executeQuery(SQL);
|
||||
|
||||
if (rs.next()){
|
||||
String customer =rs.getString("CUSTOMER");
|
||||
return(customer);
|
||||
}
|
||||
}catch(SQLException e){
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tableId
|
||||
* @return
|
||||
*/
|
||||
public String getCustomerNameInTableById(String tableId){
|
||||
try{
|
||||
SQL = "SELECT customer FROM places WHERE ID='"+ tableId + "'";
|
||||
stmt = (Statement) con.createStatement();
|
||||
rs = stmt.executeQuery(SQL);
|
||||
if (rs.next()){
|
||||
String customer =rs.getString("CUSTOMER");
|
||||
return(customer); }
|
||||
}catch(SQLException e){
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tableName
|
||||
*/
|
||||
public void clearCustomerNameInTable(String tableName){
|
||||
try{
|
||||
SQL = "UPDATE places SET CUSTOMER=null WHERE NAME=?";
|
||||
pstmt=con.prepareStatement(SQL);
|
||||
pstmt.setString(1,tableName);
|
||||
pstmt.executeUpdate();
|
||||
}catch(SQLException e){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tableID
|
||||
*/
|
||||
public void clearCustomerNameInTableById(String tableID){
|
||||
try{
|
||||
SQL = "UPDATE places SET CUSTOMER=null WHERE ID=?";
|
||||
pstmt=con.prepareStatement(SQL);
|
||||
pstmt.setString(1,tableID);
|
||||
pstmt.executeUpdate();
|
||||
}catch(SQLException e){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param waiterName
|
||||
* @param tableName
|
||||
*/
|
||||
public void setWaiterNameInTable(String waiterName, String tableName){
|
||||
try{
|
||||
SQL = "UPDATE places SET WAITER=? WHERE NAME=?";
|
||||
pstmt=con.prepareStatement(SQL);
|
||||
pstmt.setString(1,waiterName);
|
||||
pstmt.setString(2,tableName);
|
||||
pstmt.executeUpdate();
|
||||
}catch(SQLException e){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param waiterName
|
||||
* @param tableID
|
||||
*/
|
||||
public void setWaiterNameInTableById(String waiterName, String tableID){
|
||||
try{
|
||||
SQL = "UPDATE places SET WAITER=? WHERE ID=?";
|
||||
pstmt=con.prepareStatement(SQL);
|
||||
pstmt.setString(1,waiterName);
|
||||
pstmt.setString(2,tableID);
|
||||
pstmt.executeUpdate();
|
||||
}catch(SQLException e){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tableName
|
||||
* @return
|
||||
*/
|
||||
public String getWaiterNameInTable(String tableName){
|
||||
try{
|
||||
SQL = "SELECT waiter FROM places WHERE NAME='"+ tableName + "'";
|
||||
stmt = (Statement) con.createStatement();
|
||||
rs = stmt.executeQuery(SQL);
|
||||
|
||||
if (rs.next()){
|
||||
String waiter =rs.getString("WAITER");
|
||||
return(waiter);
|
||||
}
|
||||
}catch(SQLException e){
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tableID
|
||||
* @return
|
||||
*/
|
||||
public String getWaiterNameInTableById(String tableID){
|
||||
try{
|
||||
SQL = "SELECT waiter FROM places WHERE ID='"+ tableID + "'";
|
||||
stmt = (Statement) con.createStatement();
|
||||
rs = stmt.executeQuery(SQL);
|
||||
|
||||
if (rs.next()){
|
||||
String waiter =rs.getString("WAITER");
|
||||
return(waiter);
|
||||
}
|
||||
}catch(SQLException e){
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tableName
|
||||
*/
|
||||
public void clearWaiterNameInTable(String tableName){
|
||||
try{
|
||||
SQL = "UPDATE places SET WAITER=null WHERE NAME=?";
|
||||
pstmt=con.prepareStatement(SQL);
|
||||
pstmt.setString(1,tableName);
|
||||
pstmt.executeUpdate();
|
||||
}catch(SQLException e){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tableID
|
||||
*/
|
||||
public void clearWaiterNameInTableById(String tableID){
|
||||
try{
|
||||
SQL = "UPDATE places SET WAITER=null WHERE ID=?";
|
||||
pstmt=con.prepareStatement(SQL);
|
||||
pstmt.setString(1,tableID);
|
||||
pstmt.executeUpdate();
|
||||
|
||||
}catch(SQLException e){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ID
|
||||
* @return
|
||||
*/
|
||||
public String getTicketIdInTable(String ID){
|
||||
try{
|
||||
SQL = "SELECT TICKETID FROM places WHERE ID='"+ ID + "'";
|
||||
stmt = (Statement) con.createStatement();
|
||||
rs = stmt.executeQuery(SQL);
|
||||
|
||||
if (rs.next()){
|
||||
String customer =rs.getString("TICKETID");
|
||||
return(customer);
|
||||
}
|
||||
}catch(SQLException e){
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param TicketID
|
||||
* @param tableName
|
||||
*/
|
||||
public void setTicketIdInTable(String TicketID, String tableName){
|
||||
try{
|
||||
// SQL = "UPDATE places SET TICKETID=?, GUESTS=SEATS WHERE NAME=?";
|
||||
SQL = "UPDATE places SET TICKETID=? WHERE NAME=?";
|
||||
pstmt=con.prepareStatement(SQL);
|
||||
pstmt.setString(1,TicketID);
|
||||
pstmt.setString(2,tableName);
|
||||
pstmt.executeUpdate();
|
||||
|
||||
}catch(SQLException e){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tableName
|
||||
*/
|
||||
public void clearTicketIdInTable(String tableName){
|
||||
try{
|
||||
// SQL = "UPDATE places SET TICKETID=null WHERE NAME=?";
|
||||
SQL = "UPDATE places SET TICKETID=null, OCCUPIED=null WHERE NAME=?";
|
||||
pstmt=con.prepareStatement(SQL);
|
||||
pstmt.setString(1,tableName);
|
||||
pstmt.executeUpdate();
|
||||
}catch(SQLException e){
|
||||
}
|
||||
|
||||
clearGuestsInTable(tableName);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tableID
|
||||
*/
|
||||
public void clearTicketIdInTableById(String tableID){
|
||||
try{
|
||||
SQL = "UPDATE places SET TICKETID=null WHERE ID=?";
|
||||
pstmt=con.prepareStatement(SQL);
|
||||
pstmt.setString(1,tableID);
|
||||
pstmt.executeUpdate();
|
||||
|
||||
}catch(SQLException e){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tableID
|
||||
* @return
|
||||
*/
|
||||
public Integer getGuestsInTable(String tableID){
|
||||
try{
|
||||
SQL = "SELECT guests FROM places WHERE ID='"+ tableID + "'";
|
||||
stmt = (Statement) con.createStatement();
|
||||
rs = stmt.executeQuery(SQL);
|
||||
|
||||
if (rs.next()){
|
||||
Integer guests =rs.getInt("GUESTS");
|
||||
return(guests);
|
||||
}
|
||||
}catch(SQLException e){
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param guests
|
||||
* @param tableID
|
||||
*/
|
||||
public void setGuestsInTable(Integer guests, String tableID){
|
||||
try{
|
||||
SQL = "UPDATE places SET GUESTS=? WHERE ID=?";
|
||||
pstmt=con.prepareStatement(SQL);
|
||||
pstmt.setInt(1,guests);
|
||||
pstmt.setString(2,tableID);
|
||||
pstmt.executeUpdate();
|
||||
}catch(SQLException e){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tableID
|
||||
* @return
|
||||
*/
|
||||
public Integer updateGuestsInTable(String tableID){
|
||||
try{
|
||||
SQL = "SELECT guests FROM places WHERE ID='"+ tableID + "'";
|
||||
stmt = (Statement) con.createStatement();
|
||||
rs = stmt.executeQuery(SQL);
|
||||
|
||||
if (rs.next()){
|
||||
Integer guests =rs.getInt("GUESTS");
|
||||
return(guests);
|
||||
}
|
||||
}catch(SQLException e){
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tableID
|
||||
*/
|
||||
public void clearGuestsInTable(String tableID){
|
||||
try{
|
||||
SQL = "UPDATE places SET guests=0 WHERE ID=?";
|
||||
pstmt=con.prepareStatement(SQL);
|
||||
pstmt.setString(1,tableID);
|
||||
pstmt.executeUpdate();
|
||||
}catch(SQLException e){
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param table
|
||||
*/
|
||||
public void clearGuestsTable(String table){
|
||||
try{
|
||||
SQL = "UPDATE places SET guests=0 WHERE NAME=?";
|
||||
pstmt=con.prepareStatement(SQL);
|
||||
pstmt.setString(1,table);
|
||||
pstmt.executeUpdate();
|
||||
}catch(SQLException e){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tableID
|
||||
*/
|
||||
public void clearOccupied(String tableID){
|
||||
try{
|
||||
SQL = "UPDATE places SET occupied=null WHERE ID=?";
|
||||
pstmt=con.prepareStatement(SQL);
|
||||
pstmt.setString(1,tableID);
|
||||
pstmt.executeUpdate();
|
||||
}catch(SQLException e){
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param table
|
||||
*/
|
||||
public void clearOccupiedTable(String table){
|
||||
try{
|
||||
SQL = "UPDATE places SET occupied=null WHERE NAME=?";
|
||||
pstmt=con.prepareStatement(SQL);
|
||||
pstmt.setString(1,table);
|
||||
pstmt.executeUpdate();
|
||||
}catch(SQLException e){
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param tableID
|
||||
* @return
|
||||
*/
|
||||
public Timestamp getOccupied(String tableID){
|
||||
try{
|
||||
SQL = "SELECT occupied FROM places WHERE ID='"+ tableID + "'";
|
||||
stmt = (Statement) con.createStatement();
|
||||
rs = stmt.executeQuery(SQL);
|
||||
|
||||
if (rs.next()){
|
||||
Timestamp occupied =rs.getTimestamp("OCCUPIED");
|
||||
return(occupied);
|
||||
}
|
||||
}catch(SQLException e){
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ticketID
|
||||
*/
|
||||
public void setOccupied(String ticketID){
|
||||
try{
|
||||
SQL = "UPDATE places SET occupied=NOW() WHERE TICKETID=?";
|
||||
pstmt=con.prepareStatement(SQL);
|
||||
pstmt.setString(1,ticketID);
|
||||
pstmt.executeUpdate();
|
||||
}catch(SQLException e){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ticketID
|
||||
* @return
|
||||
*/
|
||||
public Integer countTicketIdInTable(String ticketID){
|
||||
try{
|
||||
SQL = "SELECT COUNT(*) AS RECORDCOUNT FROM places WHERE TICKETID='"+ ticketID + "'";
|
||||
stmt = (Statement) con.createStatement();
|
||||
rs = stmt.executeQuery(SQL);
|
||||
|
||||
if (rs.next()){
|
||||
Integer count =rs.getInt("RECORDCOUNT");
|
||||
return(count);
|
||||
}
|
||||
}catch(SQLException e){
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ticketID
|
||||
* @return
|
||||
*/
|
||||
public String getTableDetails (String ticketID){
|
||||
try{
|
||||
SQL = "SELECT NAME FROM places WHERE TICKETID='"+ ticketID + "'";
|
||||
stmt = (Statement) con.createStatement();
|
||||
rs = stmt.executeQuery(SQL);
|
||||
|
||||
if (rs.next()){
|
||||
String name =rs.getString("NAME");
|
||||
return(name);
|
||||
}
|
||||
}catch(SQLException e){
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tableID
|
||||
*/
|
||||
public void setTableMovedFlag (String tableID){
|
||||
try{
|
||||
SQL = "UPDATE places SET TABLEMOVED='true' WHERE ID=?";
|
||||
pstmt=con.prepareStatement(SQL);
|
||||
pstmt.setString(1,tableID);
|
||||
pstmt.executeUpdate();
|
||||
}catch(SQLException e){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ticketID
|
||||
* @return
|
||||
*/
|
||||
public String getTableMovedName (String ticketID){
|
||||
try{
|
||||
SQL = "SELECT NAME FROM places WHERE TICKETID='"+ ticketID + "' AND TABLEMOVED ='true'";
|
||||
stmt = (Statement) con.createStatement();
|
||||
rs = stmt.executeQuery(SQL);
|
||||
|
||||
if (rs.next()){
|
||||
String name =rs.getString("NAME");
|
||||
return(name);
|
||||
}
|
||||
}catch(SQLException e){
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ticketID
|
||||
* @return
|
||||
*/
|
||||
public Boolean getTableMovedFlag (String ticketID){
|
||||
try{
|
||||
SQL = "SELECT TABLEMOVED FROM places WHERE TICKETID='"+ ticketID + "'";
|
||||
stmt = (Statement) con.createStatement();
|
||||
rs = stmt.executeQuery(SQL);
|
||||
|
||||
if (rs.next()){
|
||||
return(rs.getBoolean("TABLEMOVED"));
|
||||
}
|
||||
}catch(SQLException e){
|
||||
}
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tableID
|
||||
*/
|
||||
public void clearTableMovedFlag (String tableID){
|
||||
try{
|
||||
SQL = "UPDATE places SET TABLEMOVED='false' WHERE NAME=?";
|
||||
pstmt=con.prepareStatement(SQL);
|
||||
pstmt.setString(1,tableID);
|
||||
pstmt.executeUpdate();
|
||||
}catch(SQLException e){
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</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,0,51,0,0,1,-53"/>
|
||||
</AuxValues>
|
||||
|
||||
<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="West"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="m_jNewTicket">
|
||||
<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/sale_new.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="tooltip.addnewticket" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</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="[0, 4, 0, 4]"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</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"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jNewTicketActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="m_jListTickets">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="1"/>
|
||||
</Property>
|
||||
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="99" green="0" red="ff" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/com/unicenta/images/sale_pending.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="tooltip.layaway" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="focusPainted" type="boolean" value="false"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalAlignment" type="int" value="2"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||
<Property name="iconTextGap" type="int" value="1"/>
|
||||
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
|
||||
<Insets value="[0, 2, 0, 2]"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</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="verticalTextPosition" type="int" value="1"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jListTicketsActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="m_jDelTicket">
|
||||
<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/sale_delete.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="tooltip.delete" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</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="[0, 4, 0, 4]"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</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"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jDelTicketActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="m_jReprintTickets">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="1"/>
|
||||
</Property>
|
||||
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="99" green="0" red="ff" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/com/unicenta/images/reprint24.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="tooltip.reprint" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="focusPainted" type="boolean" value="false"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="iconTextGap" type="int" value="1"/>
|
||||
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
|
||||
<Insets value="[0, 2, 0, 2]"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</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="verticalTextPosition" type="int" value="1"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jReprintTicketsActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="m_jHold">
|
||||
<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/logout.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="tooltip.quicklogoff" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</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="[0, 4, 0, 4]"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</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"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jHoldActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,504 @@
|
||||
// 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.sales.shared;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.beans.JNumberPop;
|
||||
import com.unicenta.data.gui.MessageInf;
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
import com.unicenta.pos.forms.AppView;
|
||||
import com.unicenta.pos.forms.JRootApp;
|
||||
import com.unicenta.pos.forms.DataLogicSales;
|
||||
import com.unicenta.pos.forms.DataLogicSystem;
|
||||
import com.unicenta.pos.sales.DataLogicReceipts;
|
||||
import com.unicenta.pos.sales.JTicketsBag;
|
||||
import com.unicenta.pos.sales.ReprintTicketInfo;
|
||||
import com.unicenta.pos.sales.SharedTicketInfo;
|
||||
import com.unicenta.pos.sales.TicketsEditor;
|
||||
import com.unicenta.pos.ticket.TicketInfo;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
public class JTicketsBagShared extends JTicketsBag {
|
||||
|
||||
private String m_sCurrentTicket = null;
|
||||
private DataLogicReceipts dlReceipts = null;
|
||||
private DataLogicSales dlSales = null;
|
||||
private final DataLogicSystem dlSystem;
|
||||
private Boolean showList;
|
||||
|
||||
|
||||
/** Creates new form JTicketsBagShared
|
||||
* @param app
|
||||
* @param panelticket */
|
||||
public JTicketsBagShared(AppView app, TicketsEditor panelticket) {
|
||||
|
||||
super(app, panelticket);
|
||||
|
||||
dlReceipts = (DataLogicReceipts) app.getBean("com.unicenta.pos.sales.DataLogicReceipts");
|
||||
dlSales = (DataLogicSales) app.getBean("com.unicenta.pos.forms.DataLogicSales");
|
||||
dlSystem = (DataLogicSystem) m_App.getBean("com.unicenta.pos.forms.DataLogicSystem");
|
||||
|
||||
initComponents();
|
||||
|
||||
m_jReprintTickets.setVisible(false);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void activate() {
|
||||
|
||||
m_sCurrentTicket = null;
|
||||
selectValidTicket();
|
||||
|
||||
m_jDelTicket.setEnabled(m_App.getAppUserView().getUser().hasPermission(
|
||||
"com.unicenta.pos.sales.JPanelTicketEdits"));
|
||||
m_jDelTicket.setEnabled(m_App.getAppUserView().getUser().hasPermission("sales.DeleteTicket"));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean deactivate() {
|
||||
|
||||
saveCurrentTicket();
|
||||
|
||||
m_sCurrentTicket = null;
|
||||
m_panelticket.setActiveTicket(null, null);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void deleteTicket() {
|
||||
|
||||
dlSystem.execTicketRemoved(
|
||||
new Object[] {
|
||||
m_App.getAppUserView().getUser().getName(),
|
||||
"Void",
|
||||
"Ticket Deleted",
|
||||
0.0
|
||||
});
|
||||
|
||||
m_sCurrentTicket = null;
|
||||
selectValidTicket();
|
||||
}
|
||||
|
||||
public void updateCount() {
|
||||
try {
|
||||
List<SharedTicketInfo> l = dlReceipts.getSharedTicketList();
|
||||
int count = l.size();
|
||||
|
||||
if (count > 0) {
|
||||
m_jListTickets.setText(Integer.toString(count));
|
||||
} else {
|
||||
m_jListTickets.setText("");
|
||||
}
|
||||
} catch (BasicException ex) {
|
||||
new MessageInf(ex).show(this);
|
||||
m_jListTickets.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected JComponent getBagComponent() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected JComponent getNullComponent() {
|
||||
return new JPanel();
|
||||
}
|
||||
|
||||
private void saveCurrentTicket() {
|
||||
|
||||
if (m_sCurrentTicket != null) {
|
||||
try {
|
||||
dlReceipts.insertSharedTicket(m_sCurrentTicket,
|
||||
m_panelticket.getActiveTicket(),
|
||||
m_panelticket.getActiveTicket().getPickupId());
|
||||
m_jListTickets.setText("*");
|
||||
TicketInfo l = dlReceipts.getSharedTicket(m_sCurrentTicket);
|
||||
if(l.getLinesCount() == 0) {
|
||||
dlReceipts.deleteSharedTicket(m_sCurrentTicket);
|
||||
}
|
||||
} catch (BasicException e) {
|
||||
new MessageInf(e).show(this);
|
||||
}
|
||||
}
|
||||
|
||||
updateCount();
|
||||
}
|
||||
|
||||
private void setActiveTicket(String id) throws BasicException{
|
||||
|
||||
TicketInfo ticket = dlReceipts.getSharedTicket(id);
|
||||
if (ticket == null) {
|
||||
m_jListTickets.setText("");
|
||||
throw new BasicException(AppLocal.getIntString("message.noticket"));
|
||||
} else {
|
||||
dlReceipts.getPickupId(id);
|
||||
Integer pickUp = dlReceipts.getPickupId(id);
|
||||
dlReceipts.deleteSharedTicket(id);
|
||||
m_sCurrentTicket = id;
|
||||
m_panelticket.setActiveTicket(ticket, null);
|
||||
ticket.setPickupId(pickUp);
|
||||
}
|
||||
|
||||
updateCount();
|
||||
}
|
||||
|
||||
private void setActiveReprintTicket(String id) throws BasicException{
|
||||
|
||||
|
||||
TicketInfo ticket = dlSales.getReprintTicket(id);
|
||||
m_sCurrentTicket = id;
|
||||
}
|
||||
|
||||
private void selectValidTicket() {
|
||||
|
||||
newTicket();
|
||||
updateCount();
|
||||
|
||||
try {
|
||||
List<SharedTicketInfo> l = dlReceipts.getSharedTicketList();
|
||||
if (l.isEmpty()) {
|
||||
m_jListTickets.setText("");
|
||||
newTicket();
|
||||
} else {
|
||||
showList = m_App.getAppUserView().getUser().hasPermission("sales.ShowList");
|
||||
if (showList) {
|
||||
m_jListTickets.doClick();
|
||||
}
|
||||
}
|
||||
} catch (BasicException e) {
|
||||
new MessageInf(e).show(this);
|
||||
newTicket();
|
||||
}
|
||||
}
|
||||
|
||||
private void newTicket() {
|
||||
|
||||
saveCurrentTicket();
|
||||
|
||||
TicketInfo ticket = new TicketInfo();
|
||||
m_sCurrentTicket = UUID.randomUUID().toString();
|
||||
m_panelticket.setActiveTicket(ticket, null);
|
||||
|
||||
updateCount();
|
||||
|
||||
}
|
||||
|
||||
/** 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();
|
||||
m_jNewTicket = new javax.swing.JButton();
|
||||
m_jListTickets = new javax.swing.JButton();
|
||||
m_jDelTicket = new javax.swing.JButton();
|
||||
m_jReprintTickets = new javax.swing.JButton();
|
||||
m_jHold = new javax.swing.JButton();
|
||||
|
||||
setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
setLayout(new java.awt.BorderLayout());
|
||||
|
||||
m_jNewTicket.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
|
||||
m_jNewTicket.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/sale_new.png"))); // NOI18N
|
||||
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("pos_messages"); // NOI18N
|
||||
m_jNewTicket.setToolTipText(bundle.getString("tooltip.addnewticket")); // NOI18N
|
||||
m_jNewTicket.setFocusPainted(false);
|
||||
m_jNewTicket.setFocusable(false);
|
||||
m_jNewTicket.setMargin(new java.awt.Insets(0, 4, 0, 4));
|
||||
m_jNewTicket.setMaximumSize(new java.awt.Dimension(50, 40));
|
||||
m_jNewTicket.setMinimumSize(new java.awt.Dimension(50, 40));
|
||||
m_jNewTicket.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
m_jNewTicket.setRequestFocusEnabled(false);
|
||||
m_jNewTicket.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jNewTicketActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel1.add(m_jNewTicket);
|
||||
|
||||
m_jListTickets.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
|
||||
m_jListTickets.setForeground(new java.awt.Color(255, 0, 153));
|
||||
m_jListTickets.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/sale_pending.png"))); // NOI18N
|
||||
m_jListTickets.setToolTipText(bundle.getString("tooltip.layaway")); // NOI18N
|
||||
m_jListTickets.setFocusPainted(false);
|
||||
m_jListTickets.setFocusable(false);
|
||||
m_jListTickets.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
||||
m_jListTickets.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
m_jListTickets.setIconTextGap(1);
|
||||
m_jListTickets.setMargin(new java.awt.Insets(0, 2, 0, 2));
|
||||
m_jListTickets.setMaximumSize(new java.awt.Dimension(50, 40));
|
||||
m_jListTickets.setMinimumSize(new java.awt.Dimension(50, 40));
|
||||
m_jListTickets.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
m_jListTickets.setRequestFocusEnabled(false);
|
||||
m_jListTickets.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
|
||||
m_jListTickets.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jListTicketsActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel1.add(m_jListTickets);
|
||||
|
||||
m_jDelTicket.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
|
||||
m_jDelTicket.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/sale_delete.png"))); // NOI18N
|
||||
m_jDelTicket.setToolTipText(bundle.getString("tooltip.delete")); // NOI18N
|
||||
m_jDelTicket.setFocusPainted(false);
|
||||
m_jDelTicket.setFocusable(false);
|
||||
m_jDelTicket.setMargin(new java.awt.Insets(0, 4, 0, 4));
|
||||
m_jDelTicket.setMaximumSize(new java.awt.Dimension(50, 40));
|
||||
m_jDelTicket.setMinimumSize(new java.awt.Dimension(50, 40));
|
||||
m_jDelTicket.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
m_jDelTicket.setRequestFocusEnabled(false);
|
||||
m_jDelTicket.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jDelTicketActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel1.add(m_jDelTicket);
|
||||
|
||||
m_jReprintTickets.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
|
||||
m_jReprintTickets.setForeground(new java.awt.Color(255, 0, 153));
|
||||
m_jReprintTickets.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/reprint24.png"))); // NOI18N
|
||||
m_jReprintTickets.setToolTipText(bundle.getString("tooltip.reprint")); // NOI18N
|
||||
m_jReprintTickets.setFocusPainted(false);
|
||||
m_jReprintTickets.setFocusable(false);
|
||||
m_jReprintTickets.setIconTextGap(1);
|
||||
m_jReprintTickets.setMargin(new java.awt.Insets(0, 2, 0, 2));
|
||||
m_jReprintTickets.setMaximumSize(new java.awt.Dimension(50, 40));
|
||||
m_jReprintTickets.setMinimumSize(new java.awt.Dimension(50, 40));
|
||||
m_jReprintTickets.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
m_jReprintTickets.setRequestFocusEnabled(false);
|
||||
m_jReprintTickets.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
|
||||
m_jReprintTickets.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jReprintTicketsActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel1.add(m_jReprintTickets);
|
||||
|
||||
m_jHold.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
|
||||
m_jHold.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/logout.png"))); // NOI18N
|
||||
m_jHold.setToolTipText(bundle.getString("tooltip.quicklogoff")); // NOI18N
|
||||
m_jHold.setFocusPainted(false);
|
||||
m_jHold.setFocusable(false);
|
||||
m_jHold.setMargin(new java.awt.Insets(0, 4, 0, 4));
|
||||
m_jHold.setMaximumSize(new java.awt.Dimension(50, 40));
|
||||
m_jHold.setMinimumSize(new java.awt.Dimension(50, 40));
|
||||
m_jHold.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
m_jHold.setRequestFocusEnabled(false);
|
||||
m_jHold.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jHoldActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel1.add(m_jHold);
|
||||
|
||||
add(jPanel1, java.awt.BorderLayout.WEST);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void m_jListTicketsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jListTicketsActionPerformed
|
||||
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
try {
|
||||
if (!m_App.getAppUserView().getUser().hasPermission("sales.ViewSharedTicket")){
|
||||
JOptionPane.showMessageDialog(null,
|
||||
AppLocal.getIntString("message.sharedticket"),
|
||||
AppLocal.getIntString("message.sharedtickettitle"),
|
||||
JOptionPane.INFORMATION_MESSAGE);
|
||||
}else{
|
||||
|
||||
if("0".equals(m_App.getAppUserView().getUser().getRole())
|
||||
|| "1".equals(m_App.getAppUserView().getUser().getRole())
|
||||
|| m_App.getAppUserView().getUser().hasPermission("sales.ViewSharedTicket")
|
||||
|| m_App.getAppUserView().getUser().hasPermission("sales.Override"))
|
||||
{
|
||||
List<SharedTicketInfo> l = dlReceipts.getSharedTicketList();
|
||||
JTicketsBagSharedList listDialog = JTicketsBagSharedList.newJDialog(JTicketsBagShared.this);
|
||||
String id = listDialog.showTicketsList(l, dlReceipts);
|
||||
|
||||
if (id != null) {
|
||||
saveCurrentTicket();
|
||||
setActiveTicket(id);
|
||||
}
|
||||
}else{
|
||||
|
||||
String appuser = m_App.getAppUserView().getUser().getId();
|
||||
List<SharedTicketInfo> l = dlReceipts.getUserSharedTicketList(
|
||||
appuser);
|
||||
|
||||
JTicketsBagSharedList listDialog = JTicketsBagSharedList.newJDialog(JTicketsBagShared.this);
|
||||
|
||||
String id = listDialog.showTicketsList(l, dlReceipts);
|
||||
|
||||
if (id != null) {
|
||||
saveCurrentTicket();
|
||||
setActiveTicket(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (BasicException e) {
|
||||
new MessageInf(e).show(JTicketsBagShared.this);
|
||||
newTicket();
|
||||
}
|
||||
});
|
||||
|
||||
}//GEN-LAST:event_m_jListTicketsActionPerformed
|
||||
|
||||
private void m_jNewTicketActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jNewTicketActionPerformed
|
||||
|
||||
newTicket();
|
||||
|
||||
}//GEN-LAST:event_m_jNewTicketActionPerformed
|
||||
|
||||
private void m_jHoldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jHoldActionPerformed
|
||||
deactivate();
|
||||
((JRootApp)m_App).closeAppView();
|
||||
}//GEN-LAST:event_m_jHoldActionPerformed
|
||||
|
||||
private void m_jReprintTicketsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jReprintTicketsActionPerformed
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
try {
|
||||
if (!m_App.getAppUserView().getUser().hasPermission("sales.ReprintTicket")){
|
||||
JOptionPane.showMessageDialog(null,
|
||||
AppLocal.getIntString("message.reprintticket"),
|
||||
AppLocal.getIntString("message.reprinttickettitle"),
|
||||
JOptionPane.INFORMATION_MESSAGE);
|
||||
}else{
|
||||
|
||||
if("0".equals(m_App.getAppUserView().getUser().getRole())
|
||||
|| "1".equals(m_App.getAppUserView().getUser().getRole())
|
||||
|| m_App.getAppUserView().getUser().hasPermission("sales.ViewSharedTicket")
|
||||
|| m_App.getAppUserView().getUser().hasPermission("sales.Override"))
|
||||
{
|
||||
List<ReprintTicketInfo> l = dlSales.getReprintTicketList();
|
||||
JTicketsReprintList listDialog = JTicketsReprintList.newJDialog(JTicketsBagShared.this);
|
||||
String id = listDialog.showTicketsList(l, dlSales);
|
||||
|
||||
}else{
|
||||
|
||||
String appuser = m_App.getAppUserView().getUser().getId();
|
||||
List<ReprintTicketInfo> l = dlSales.getReprintTicketList();
|
||||
|
||||
JTicketsReprintList listDialog = JTicketsReprintList.newJDialog(JTicketsBagShared.this);
|
||||
|
||||
String id = listDialog.showTicketsList(l, dlSales);
|
||||
|
||||
if (id != null) {
|
||||
saveCurrentTicket();
|
||||
setActiveReprintTicket(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (BasicException e) {
|
||||
new MessageInf(e).show(JTicketsBagShared.this);
|
||||
newTicket();
|
||||
}
|
||||
}
|
||||
});
|
||||
}//GEN-LAST:event_m_jReprintTicketsActionPerformed
|
||||
|
||||
private void m_jDelTicketActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jDelTicketActionPerformed
|
||||
// Only called in simple & standard NOT RESTAURANT
|
||||
// For Restaurant-mode see JTicketsBagRestaurant
|
||||
|
||||
boolean pinOK = false;
|
||||
|
||||
if (m_sCurrentTicket != null) {
|
||||
|
||||
if (m_App.getProperties().getProperty("override.check").equals("true")) {
|
||||
Integer secret = Integer.parseInt(m_App.getProperties().getProperty("override.pin"));
|
||||
Integer iValue = JNumberPop.showEditNumber(this, AppLocal.getIntString("title.override.enterpin"));
|
||||
|
||||
if (iValue == null ? secret == null : iValue.equals(secret)) {
|
||||
pinOK = true;
|
||||
int res = JOptionPane.showConfirmDialog(this
|
||||
, AppLocal.getIntString("message.wannadelete")
|
||||
, AppLocal.getIntString("title.editor")
|
||||
, JOptionPane.YES_NO_OPTION
|
||||
, JOptionPane.QUESTION_MESSAGE);
|
||||
|
||||
if (res == JOptionPane.YES_OPTION) {
|
||||
deleteTicket();
|
||||
}
|
||||
} else {
|
||||
pinOK = false;
|
||||
JOptionPane.showMessageDialog(this, AppLocal.getIntString("message.override.badpin"));
|
||||
}
|
||||
} else {
|
||||
int res = JOptionPane.showConfirmDialog(this
|
||||
, AppLocal.getIntString("message.wannadelete")
|
||||
, AppLocal.getIntString("title.editor")
|
||||
, JOptionPane.YES_NO_OPTION
|
||||
, JOptionPane.QUESTION_MESSAGE);
|
||||
|
||||
if (res == JOptionPane.YES_OPTION) {
|
||||
deleteTicket();
|
||||
}
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_m_jDelTicketActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JButton m_jDelTicket;
|
||||
private javax.swing.JButton m_jHold;
|
||||
private javax.swing.JButton m_jListTickets;
|
||||
private javax.swing.JButton m_jNewTicket;
|
||||
private javax.swing.JButton m_jReprintTickets;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
|
||||
<Properties>
|
||||
<Property name="title" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="caption.tickets" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</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,2,21,0,0,2,6"/>
|
||||
<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_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="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>
|
||||
<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.JScrollPane" name="jScrollPane1">
|
||||
<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.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel2">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="m_jtickets">
|
||||
<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>
|
||||
<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.DesignGridLayout">
|
||||
<Property name="columns" type="int" value="1"/>
|
||||
<Property name="horizontalGap" type="int" value="5"/>
|
||||
<Property name="rows" type="int" value="0"/>
|
||||
<Property name="verticalGap" type="int" value="5"/>
|
||||
</Layout>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel3">
|
||||
<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.DesignFlowLayout">
|
||||
<Property name="alignment" type="int" value="2"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel4">
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
|
||||
</Container>
|
||||
<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.close" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</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="[80, 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_jButtonCancelActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,236 @@
|
||||
// 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.sales.shared;
|
||||
|
||||
|
||||
import com.unicenta.pos.sales.SharedTicketInfo;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
import com.unicenta.pos.ticket.TicketInfo;
|
||||
import com.unicenta.pos.sales.DataLogicReceipts;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
public class JTicketsBagSharedList extends javax.swing.JDialog {
|
||||
|
||||
private String m_sDialogTicket;
|
||||
|
||||
/** Creates new form JTicketsBagSharedList */
|
||||
private JTicketsBagSharedList(java.awt.Frame parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
}
|
||||
/** Creates new form JTicketsBagSharedList */
|
||||
private JTicketsBagSharedList(java.awt.Dialog parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param atickets
|
||||
* @param dlReceipts
|
||||
* @return
|
||||
*/
|
||||
public String showTicketsList(java.util.List<SharedTicketInfo> atickets, DataLogicReceipts dlReceipts) {
|
||||
// JG Dec 2014
|
||||
SharedTicketInfo m_Ticket = null;
|
||||
|
||||
for (SharedTicketInfo aticket : atickets) {
|
||||
m_jtickets.add(new JButtonTicket(aticket, dlReceipts));
|
||||
}
|
||||
|
||||
m_sDialogTicket = null;
|
||||
|
||||
int lsize = atickets.size();
|
||||
if (lsize > 0) {
|
||||
setVisible(true);
|
||||
}else{
|
||||
JOptionPane.showMessageDialog(this,
|
||||
AppLocal.getIntString("message.nosharedtickets"),
|
||||
AppLocal.getIntString("message.sharedtickettitle"),
|
||||
JOptionPane.OK_OPTION);
|
||||
}
|
||||
|
||||
return m_sDialogTicket;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ticketsbagshared
|
||||
* @return
|
||||
*/
|
||||
public static JTicketsBagSharedList newJDialog(JTicketsBagShared ticketsbagshared) {
|
||||
|
||||
Window window = getWindow(ticketsbagshared);
|
||||
JTicketsBagSharedList mydialog;
|
||||
if (window instanceof Frame) {
|
||||
mydialog = new JTicketsBagSharedList((Frame) window, true);
|
||||
} else {
|
||||
mydialog = new JTicketsBagSharedList((Dialog) window, true);
|
||||
}
|
||||
|
||||
mydialog.initComponents();
|
||||
|
||||
mydialog.jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(35, 35));
|
||||
mydialog.jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(25, 25));
|
||||
|
||||
return mydialog;
|
||||
}
|
||||
|
||||
private 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());
|
||||
}
|
||||
}
|
||||
|
||||
private class JButtonTicket extends JButton {
|
||||
|
||||
private final SharedTicketInfo m_Ticket;
|
||||
|
||||
public JButtonTicket(SharedTicketInfo ticket, DataLogicReceipts dlReceipts){
|
||||
|
||||
super();
|
||||
|
||||
m_Ticket = ticket;
|
||||
setFocusPainted(false);
|
||||
setFocusable(false);
|
||||
setRequestFocusEnabled(false);
|
||||
setMargin(new Insets(8, 14, 8, 14));
|
||||
setFont(new java.awt.Font ("Dialog", 0, 14));
|
||||
setBackground(new java.awt.Color (220, 220, 220));
|
||||
addActionListener(new ActionListenerImpl());
|
||||
|
||||
// JG Nov 2014
|
||||
String total;
|
||||
try {
|
||||
TicketInfo ticket2 = dlReceipts.getSharedTicket(ticket.getId());
|
||||
total = " - " + ticket2.printTotal();
|
||||
} catch (BasicException ex) {
|
||||
total = "";
|
||||
}
|
||||
|
||||
setText(ticket.getPickupId() + " - "
|
||||
+ ticket.getName()
|
||||
+ total);
|
||||
}
|
||||
|
||||
private class ActionListenerImpl implements ActionListener {
|
||||
|
||||
public ActionListenerImpl() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
|
||||
m_sDialogTicket = m_Ticket.getId();
|
||||
JTicketsBagSharedList.this.setVisible(false);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 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();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
m_jtickets = new javax.swing.JPanel();
|
||||
jPanel3 = new javax.swing.JPanel();
|
||||
jPanel4 = new javax.swing.JPanel();
|
||||
m_jButtonCancel = new javax.swing.JButton();
|
||||
|
||||
setTitle(AppLocal.getIntString("caption.tickets")); // NOI18N
|
||||
setResizable(false);
|
||||
|
||||
jPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
jPanel1.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jPanel2.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jPanel2.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
m_jtickets.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
m_jtickets.setLayout(new java.awt.GridLayout(0, 1, 5, 5));
|
||||
jPanel2.add(m_jtickets, java.awt.BorderLayout.NORTH);
|
||||
|
||||
jScrollPane1.setViewportView(jPanel2);
|
||||
|
||||
jPanel1.add(jScrollPane1, java.awt.BorderLayout.CENTER);
|
||||
|
||||
getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
|
||||
|
||||
jPanel3.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
|
||||
jPanel3.add(jPanel4);
|
||||
|
||||
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.close")); // 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(80, 45));
|
||||
m_jButtonCancel.setRequestFocusEnabled(false);
|
||||
m_jButtonCancel.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jButtonCancelActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel3.add(m_jButtonCancel);
|
||||
|
||||
getContentPane().add(jPanel3, java.awt.BorderLayout.SOUTH);
|
||||
|
||||
setSize(new java.awt.Dimension(518, 533));
|
||||
setLocationRelativeTo(null);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void m_jButtonCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jButtonCancelActionPerformed
|
||||
|
||||
dispose();
|
||||
|
||||
}//GEN-LAST:event_m_jButtonCancelActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private javax.swing.JPanel jPanel3;
|
||||
private javax.swing.JPanel jPanel4;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JButton m_jButtonCancel;
|
||||
private javax.swing.JPanel m_jtickets;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
|
||||
<Properties>
|
||||
<Property name="title" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="caption.tickets" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</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,-113,0,0,2,7"/>
|
||||
<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="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 class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<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>
|
||||
<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.JScrollPane" name="jScrollPane1">
|
||||
<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.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel2">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="m_jtickets">
|
||||
<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>
|
||||
<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.DesignGridLayout">
|
||||
<Property name="columns" type="int" value="1"/>
|
||||
<Property name="horizontalGap" type="int" value="5"/>
|
||||
<Property name="rows" type="int" value="0"/>
|
||||
<Property name="verticalGap" type="int" value="5"/>
|
||||
</Layout>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel3">
|
||||
<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.DesignFlowLayout">
|
||||
<Property name="alignment" type="int" value="2"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel4">
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
|
||||
</Container>
|
||||
<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.close" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</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="[80, 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_jButtonCancelActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,415 @@
|
||||
// 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.sales.shared;
|
||||
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.gui.ListKeyed;
|
||||
import com.unicenta.data.gui.MessageInf;
|
||||
import com.unicenta.pos.forms.*;
|
||||
import com.unicenta.pos.printer.DeviceTicket;
|
||||
import com.unicenta.pos.printer.TicketParser;
|
||||
import com.unicenta.pos.printer.TicketPrinterException;
|
||||
import com.unicenta.pos.sales.ReprintTicketInfo;
|
||||
import com.unicenta.pos.sales.TaxesException;
|
||||
import com.unicenta.pos.sales.TaxesLogic;
|
||||
import com.unicenta.pos.scripting.ScriptEngine;
|
||||
import com.unicenta.pos.scripting.ScriptException;
|
||||
import com.unicenta.pos.scripting.ScriptFactory;
|
||||
import com.unicenta.pos.ticket.TicketInfo;
|
||||
import com.unicenta.pos.ticket.TicketTaxInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
@Slf4j
|
||||
public class JTicketsReprintList extends javax.swing.JDialog {
|
||||
|
||||
private String m_sDialogTicket;
|
||||
private final DeviceTicket m_TP;
|
||||
private final TicketParser m_TTP;
|
||||
// private final TicketParser m_TTP2;
|
||||
private TaxesLogic taxeslogic;
|
||||
private ListKeyed taxcollection;
|
||||
|
||||
private TicketInfo m_ticket;
|
||||
private TicketInfo m_ticketCopy;
|
||||
private AppView m_App;
|
||||
|
||||
private DataLogicSystem dlSystem = null;
|
||||
private DataLogicSales dlSales = null;
|
||||
|
||||
/** Creates new form JTicketsReprintList */
|
||||
private JTicketsReprintList(java.awt.Frame parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
AppView app = null;
|
||||
m_App = app;
|
||||
AppProperties props = null;
|
||||
|
||||
m_TP = new DeviceTicket();
|
||||
|
||||
m_TTP = new TicketParser(m_TP, dlSystem);
|
||||
// m_TTP2 = new TicketParser(m_App.getDeviceTicket(), dlSystem);
|
||||
}
|
||||
/** Creates new form JTicketsReprintList */
|
||||
private JTicketsReprintList(java.awt.Dialog parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
AppProperties props = null;
|
||||
|
||||
m_TP = new DeviceTicket();
|
||||
m_TTP = new TicketParser(m_TP, dlSystem);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param atickets
|
||||
* @param dlSales
|
||||
* @return
|
||||
*/
|
||||
public String showTicketsList(java.util.List<ReprintTicketInfo> atickets, DataLogicSales dlSales) {
|
||||
|
||||
m_ticket = null;
|
||||
m_ticketCopy = null;
|
||||
|
||||
ReprintTicketInfo m_Ticket = null;
|
||||
|
||||
for (ReprintTicketInfo aticket : atickets) {
|
||||
m_jtickets.add(new JButtonTicket(aticket, dlSales));
|
||||
}
|
||||
|
||||
m_sDialogTicket = null;
|
||||
|
||||
int lsize = atickets.size();
|
||||
if (lsize > 0) {
|
||||
setVisible(true);
|
||||
}else{
|
||||
JOptionPane.showMessageDialog(this,
|
||||
AppLocal.getIntString("message.nosharedtickets"),
|
||||
AppLocal.getIntString("message.sharedtickettitle"),
|
||||
JOptionPane.OK_OPTION);
|
||||
}
|
||||
|
||||
return m_sDialogTicket;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ticketsbagshared
|
||||
* @return
|
||||
*/
|
||||
public static JTicketsReprintList newJDialog(JTicketsBagShared ticketsbagshared) {
|
||||
|
||||
Window window = getWindow(ticketsbagshared);
|
||||
JTicketsReprintList mydialog;
|
||||
if (window instanceof Frame) {
|
||||
mydialog = new JTicketsReprintList((Frame) window, true);
|
||||
} else {
|
||||
mydialog = new JTicketsReprintList((Dialog) window, true);
|
||||
}
|
||||
|
||||
mydialog.initComponents();
|
||||
|
||||
mydialog.jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(35, 35));
|
||||
mydialog.jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(25, 25));
|
||||
|
||||
return mydialog;
|
||||
}
|
||||
|
||||
private 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());
|
||||
}
|
||||
}
|
||||
|
||||
private class JButtonTicket extends JButton {
|
||||
|
||||
private final ReprintTicketInfo m_Ticket;
|
||||
|
||||
public JButtonTicket(ReprintTicketInfo ticket, DataLogicSales dlSales){
|
||||
|
||||
super();
|
||||
|
||||
m_Ticket = ticket;
|
||||
setFocusPainted(false);
|
||||
setFocusable(false);
|
||||
setRequestFocusEnabled(false);
|
||||
setMargin(new Insets(8, 14, 8, 14));
|
||||
setFont(new java.awt.Font ("Dialog", 0, 14));
|
||||
setBackground(new java.awt.Color (220, 220, 220));
|
||||
addActionListener(new ActionListenerImpl());
|
||||
|
||||
setText(ticket.getId() + " - " +
|
||||
ticket.getTicketDate() + " - " +
|
||||
ticket.getUserName());
|
||||
}
|
||||
|
||||
private class ActionListenerImpl implements ActionListener {
|
||||
|
||||
public ActionListenerImpl() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
|
||||
try {
|
||||
m_sDialogTicket = m_Ticket.getId();
|
||||
|
||||
JTicketsReprintList.this.setVisible(false);
|
||||
int iTkt=Integer.valueOf(m_sDialogTicket);
|
||||
int iTt = 0;
|
||||
// readTicket(iTkt, iTt);
|
||||
// readTicket(m_sDialogTicket);
|
||||
|
||||
TicketInfo ticket = dlSales.loadTicket(iTt, iTkt);
|
||||
|
||||
if (ticket == null) {
|
||||
JFrame frame = new JFrame();
|
||||
JOptionPane.showMessageDialog(frame, AppLocal.getIntString("message.notexiststicket"), AppLocal.getIntString("message.notexiststickettitle"), JOptionPane.WARNING_MESSAGE);
|
||||
} else {
|
||||
m_ticket = ticket;
|
||||
m_ticketCopy = null;
|
||||
try {
|
||||
taxeslogic.calculateTaxes(m_ticket);
|
||||
TicketTaxInfo[] taxlist = m_ticket.getTaxLines();
|
||||
} catch (TaxesException ex) {
|
||||
}
|
||||
printTicket("Printer.ReprintLastTicket", m_ticket, null);
|
||||
}
|
||||
// } catch (BasicException e) {
|
||||
// MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotloadticket"), e);
|
||||
// msg.show(this);
|
||||
// }
|
||||
// }
|
||||
} catch (BasicException ex) {
|
||||
log.error(ex.getMessage());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// private void readTicket(int iTicketid, int iTickettype) {
|
||||
private void readTicket(String Id) {
|
||||
// Integer findTicket=Integer.valueOf(m_sDialogTicket);
|
||||
|
||||
try {
|
||||
//TicketInfo ticket = new TicketInfo();
|
||||
|
||||
// TicketInfo ticket = dlSales.loadTicket(iTickettype, iTicketid);
|
||||
|
||||
TicketInfo ticket = dlSales.getReprintTicket(Id);
|
||||
if (ticket == null) {
|
||||
JFrame frame = new JFrame();
|
||||
JOptionPane.showMessageDialog(frame,
|
||||
AppLocal.getIntString("message.notexiststicket"),
|
||||
AppLocal.getIntString("message.notexiststickettitle"),
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
|
||||
} else {
|
||||
m_ticket = ticket;
|
||||
m_ticketCopy = null;
|
||||
|
||||
if(m_ticket.getTicketType()== 1
|
||||
|| m_ticket.getTicketStatus()> 0) {
|
||||
JFrame frame = new JFrame();
|
||||
JOptionPane.showMessageDialog(frame,
|
||||
AppLocal.getIntString("message.ticketrefunded"),
|
||||
AppLocal.getIntString("message.ticketrefundedtitle"),
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
// m_jEdit.setEnabled(false);
|
||||
// m_jRefund.setEnabled(false);
|
||||
}else{
|
||||
// m_jEdit.setEnabled(true);
|
||||
// m_jRefund.setEnabled(true);
|
||||
}
|
||||
try {
|
||||
taxeslogic.calculateTaxes(m_ticket);
|
||||
TicketTaxInfo[] taxlist = m_ticket.getTaxLines();
|
||||
} catch (TaxesException ex) {}
|
||||
|
||||
// printTicket();
|
||||
}
|
||||
|
||||
} catch (BasicException e) {
|
||||
MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotloadticket"), e);
|
||||
msg.show(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* private void printTicket() {
|
||||
|
||||
if (m_ticket != null
|
||||
&& (m_ticket.getTicketType() == TicketInfo.RECEIPT_NORMAL
|
||||
&& m_ticket.getTicketStatus() == 0)) {
|
||||
}
|
||||
|
||||
m_TP.getDevicePrinter("1").reset();
|
||||
|
||||
if (m_ticket == null) {
|
||||
// m_jTicketId.setText(m_ticket.getName());
|
||||
|
||||
try {
|
||||
ScriptEngine script = ScriptFactory.getScriptEngine(ScriptFactory.VELOCITY);
|
||||
script.put("ticket", m_ticket);
|
||||
script.put("taxes", m_ticket.getTaxLines());
|
||||
m_TTP.printTicket(script.eval(dlSystem.getResourceAsXML("Printer.TicketPreview")).toString());
|
||||
} catch ( ScriptException | TicketPrinterException e) {
|
||||
MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotprintticket"), e);
|
||||
msg.show(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
private void printTicket(String sresourcename, TicketInfo ticket, Object ticketext) {
|
||||
|
||||
String sresource = dlSystem.getResourceAsXML(sresourcename);
|
||||
if (sresource == null) {
|
||||
MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotprintticket"));
|
||||
// msg.show(JPanelTicket.this);
|
||||
} else {
|
||||
|
||||
// if this is ticket does not have a pickup code assign on now
|
||||
if (ticket.getPickupId() == 0) {
|
||||
try {
|
||||
ticket.setPickupId(dlSales.getNextPickupIndex());
|
||||
} catch (BasicException e) {
|
||||
ticket.setPickupId(0);
|
||||
}
|
||||
}
|
||||
try {
|
||||
ScriptEngine script = ScriptFactory.getScriptEngine(ScriptFactory.VELOCITY);
|
||||
// JG 19 Feb 14 unnecessary boolean parse - if (Boolean.valueOf(m_App.getProperties().getProperty("receipt.newlayout")).booleanValue()){
|
||||
if (Boolean.parseBoolean(m_App.getProperties().getProperty("receipt.newlayout"))) {
|
||||
script.put("taxes", ticket.getTaxLines());
|
||||
} else {
|
||||
script.put("taxes", taxcollection);
|
||||
}
|
||||
script.put("taxeslogic", taxeslogic);
|
||||
script.put("ticket", ticket);
|
||||
script.put("place", ticketext);
|
||||
Object warrantyPrint;
|
||||
// script.put("warranty", warrantyPrint);
|
||||
// script.put("pickupid", getPickupString(ticket));
|
||||
|
||||
// JG Aug 2014
|
||||
// refreshTicket();
|
||||
|
||||
m_TTP.printTicket(script.eval(sresource).toString(), ticket);
|
||||
|
||||
// JG May 2013 replaced with Multicatch
|
||||
} catch (ScriptException | TicketPrinterException e) {
|
||||
MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotprintticket"), e);
|
||||
// msg.show(JPanelTicket.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() {
|
||||
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
m_jtickets = new javax.swing.JPanel();
|
||||
jPanel3 = new javax.swing.JPanel();
|
||||
jPanel4 = new javax.swing.JPanel();
|
||||
m_jButtonCancel = new javax.swing.JButton();
|
||||
|
||||
setTitle(AppLocal.getIntString("caption.tickets")); // NOI18N
|
||||
setResizable(false);
|
||||
|
||||
jPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
jPanel1.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jPanel2.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jPanel2.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
m_jtickets.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
m_jtickets.setLayout(new java.awt.GridLayout(0, 1, 5, 5));
|
||||
jPanel2.add(m_jtickets, java.awt.BorderLayout.NORTH);
|
||||
|
||||
jScrollPane1.setViewportView(jPanel2);
|
||||
|
||||
jPanel1.add(jScrollPane1, java.awt.BorderLayout.CENTER);
|
||||
|
||||
getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
|
||||
|
||||
jPanel3.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
|
||||
jPanel3.add(jPanel4);
|
||||
|
||||
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.close")); // 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(80, 45));
|
||||
m_jButtonCancel.setRequestFocusEnabled(false);
|
||||
m_jButtonCancel.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jButtonCancelActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel3.add(m_jButtonCancel);
|
||||
|
||||
getContentPane().add(jPanel3, java.awt.BorderLayout.SOUTH);
|
||||
|
||||
setSize(new java.awt.Dimension(519, 399));
|
||||
setLocationRelativeTo(null);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void m_jButtonCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jButtonCancelActionPerformed
|
||||
|
||||
dispose();
|
||||
|
||||
}//GEN-LAST:event_m_jButtonCancelActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private javax.swing.JPanel jPanel3;
|
||||
private javax.swing.JPanel jPanel4;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JButton m_jButtonCancel;
|
||||
private javax.swing.JPanel m_jtickets;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</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,0,49,0,0,0,-47"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
|
||||
<Property name="alignment" type="int" value="0"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="m_jDelTicket">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/com/unicenta/images/sale_delete.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="tooltip.delete" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</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="[0, 4, 0, 4]"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[50, 40]"/>
|
||||
</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"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jDelTicketActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,142 @@
|
||||
// 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.sales.simple;
|
||||
|
||||
import com.unicenta.pos.forms.*;
|
||||
import javax.swing.*;
|
||||
import com.unicenta.pos.sales.*;
|
||||
import com.unicenta.pos.ticket.TicketInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
public class JTicketsBagSimple extends JTicketsBag {
|
||||
|
||||
/** Creates new form JTicketsBagSimple
|
||||
* @param app
|
||||
* @param panelticket */
|
||||
public JTicketsBagSimple(AppView app, TicketsEditor panelticket) {
|
||||
|
||||
super(app, panelticket);
|
||||
|
||||
initComponents();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void activate() {
|
||||
|
||||
m_panelticket.setActiveTicket(new TicketInfo(), null);
|
||||
|
||||
// Authorization
|
||||
m_jDelTicket.setEnabled(m_App.getAppUserView().getUser().hasPermission("com.unicenta.pos.sales.JPanelTicketEdits"));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean deactivate() {
|
||||
m_panelticket.setActiveTicket(null, null);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void deleteTicket() {
|
||||
m_panelticket.setActiveTicket(new TicketInfo(), null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected JComponent getBagComponent() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected JComponent getNullComponent() {
|
||||
return new JPanel();
|
||||
}
|
||||
|
||||
/** 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() {
|
||||
|
||||
m_jDelTicket = new javax.swing.JButton();
|
||||
|
||||
setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
|
||||
|
||||
m_jDelTicket.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/sale_delete.png"))); // NOI18N
|
||||
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("pos_messages"); // NOI18N
|
||||
m_jDelTicket.setToolTipText(bundle.getString("tooltip.delete")); // NOI18N
|
||||
m_jDelTicket.setFocusPainted(false);
|
||||
m_jDelTicket.setFocusable(false);
|
||||
m_jDelTicket.setMargin(new java.awt.Insets(0, 4, 0, 4));
|
||||
m_jDelTicket.setMaximumSize(new java.awt.Dimension(50, 40));
|
||||
m_jDelTicket.setMinimumSize(new java.awt.Dimension(50, 40));
|
||||
m_jDelTicket.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
m_jDelTicket.setRequestFocusEnabled(false);
|
||||
m_jDelTicket.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
m_jDelTicketActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
add(m_jDelTicket);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void m_jDelTicketActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_jDelTicketActionPerformed
|
||||
|
||||
int res = JOptionPane.showConfirmDialog(this,
|
||||
AppLocal.getIntString("message.wannadelete"),
|
||||
AppLocal.getIntString("title.editor"),
|
||||
JOptionPane.YES_NO_OPTION,
|
||||
JOptionPane.QUESTION_MESSAGE);
|
||||
|
||||
if (res == JOptionPane.YES_OPTION) {
|
||||
deleteTicket();
|
||||
}
|
||||
|
||||
}//GEN-LAST:event_m_jDelTicketActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton m_jDelTicket;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user