5.0 Source Code

Committing 5.0 Source Code
This commit is contained in:
2023-04-06 18:58:04 +01:00
parent 0f3ede77fa
commit 0282345603
1680 changed files with 241310 additions and 0 deletions
@@ -0,0 +1,110 @@
// 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.epm;
/**
*
* @author Ali Safdar and Aneeqa Baber
*/
public class Break {
private String m_sId;
private String m_sName;
private String m_sNotes;
private boolean m_sVisible;
/**
*
* @param id
* @param name
* @param notes
* @param visible
*/
public Break(String id, String name, String notes, boolean visible) {
m_sId = id;
m_sName = name;
m_sNotes = notes;
m_sVisible = visible;
}
/**
*
* @return
*/
public String getId() {
return m_sId;
}
/**
*
* @param Id
*/
public void setId(String Id) {
this.m_sId = Id;
}
/**
*
* @return
*/
public String getName() {
return m_sName;
}
/**
*
* @param Name
*/
public void setName(String Name) {
this.m_sName = Name;
}
/**
*
* @return
*/
public String getNotes() {
return m_sNotes;
}
/**
*
* @param Notes
*/
public void setNotes(String Notes) {
this.m_sNotes = Notes;
}
/**
*
* @return
*/
public boolean isVisible() {
return m_sVisible;
}
/**
*
* @param Visible
*/
public void setVisible(boolean Visible) {
this.m_sVisible = Visible;
}
}
@@ -0,0 +1,89 @@
// 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.epm;
import com.unicenta.data.loader.IKeyed;
/**
*
* @author Ali Safdar and Aneeqa Baber
*/
public class BreaksInfo implements IKeyed {
private static final long serialVersionUID = 8936482715929L;
private String m_sID;
private String m_sName;
/**
*
* @param id
* @param name
*/
public BreaksInfo(String id, String name) {
m_sID = id;
m_sName = name;
}
/**
*
* @return
*/
@Override
public Object getKey() {
return m_sID;
}
/**
*
* @param sID
*/
public void setID(String sID) {
m_sID = sID;
}
/**
*
* @return
*/
public String getID() {
return m_sID;
}
/**
*
* @return
*/
public String getName() {
return m_sName;
}
/**
*
* @param sName
*/
public void setName(String sName) {
m_sName = sName;
}
@Override
public String toString(){
return m_sName;
}
}
@@ -0,0 +1,133 @@
// 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.epm;
import com.unicenta.basic.BasicException;
import com.unicenta.data.gui.ListCellRendererBasic;
import com.unicenta.data.loader.ComparatorCreator;
import com.unicenta.data.loader.TableDefinition;
import com.unicenta.data.loader.Vectorer;
import com.unicenta.data.user.EditorRecord;
import com.unicenta.data.user.ListProvider;
import com.unicenta.data.user.ListProviderCreator;
import com.unicenta.data.user.SaveProvider;
import com.unicenta.pos.forms.AppLocal;
import com.unicenta.pos.panels.JPanelTable;
import javax.swing.ListCellRenderer;
/**
*
* @author Ali Safdar and Aneeqa Baber
*/
public class BreaksPanel extends JPanelTable {
private TableDefinition tbreaks;
private BreaksView jeditor;
/**
*
*/
public BreaksPanel() {
}
/**
*
*/
@Override
protected void init() {
DataLogicPresenceManagement dlPresenceManagement = (DataLogicPresenceManagement) app.getBean("com.unicenta.pos.epm.DataLogicPresenceManagement");
tbreaks = dlPresenceManagement.getTableBreaks();
jeditor = new BreaksView(app, dirty);
}
/**
*
* @throws BasicException
*/
@Override
public void activate() throws BasicException {
jeditor.activate();
super.activate();
}
/**
*
* @return
*/
@Override
public ListProvider getListProvider() {
return new ListProviderCreator(tbreaks);
}
/**
*
* @return
*/
@Override
public SaveProvider getSaveProvider() {
return new SaveProvider(tbreaks, new int[] {0, 1, 2, 3});
}
/**
*
* @return
*/
@Override
public Vectorer getVectorer() {
return tbreaks.getVectorerBasic(new int[]{1, 2});
}
/**
*
* @return
*/
@Override
public ComparatorCreator getComparatorCreator() {
return tbreaks.getComparatorCreator(new int[] {1, 2});
}
/**
*
* @return
*/
@Override
public ListCellRenderer getListCellRenderer() {
return new ListCellRendererBasic(tbreaks.getRenderStringBasic(new int[]{1}));
}
/**
*
* @return
*/
@Override
public EditorRecord getEditor() {
return jeditor;
}
/**
*
* @return
*/
@Override
public String getTitle() {
return AppLocal.getIntString("Menu.Breaks");
}
}
@@ -0,0 +1,127 @@
<?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"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jLabel1" alignment="0" pref="126" max="32767" attributes="1"/>
<Component id="m_Name3" alignment="0" pref="126" max="32767" attributes="1"/>
<Component id="m_Ncx" alignment="0" pref="126" max="32767" attributes="1"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="m_jVisible" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="m_jBreakName" alignment="0" max="32767" attributes="1"/>
<Component id="jScrollPane1" alignment="0" min="-2" pref="223" max="-2" attributes="1"/>
</Group>
<EmptySpace min="-2" pref="214" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="m_jBreakName" alignment="3" min="-2" pref="25" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="3" min="-2" pref="25" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="m_Ncx" min="-2" pref="25" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="m_Name3" min="-2" pref="25" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="m_jVisible" min="-2" pref="25" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" pref="138" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="35" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JTextField" name="m_jBreakName">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
</Properties>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<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.JTextArea" name="m_jBreakDescription">
<Properties>
<Property name="columns" type="int" value="20"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
<Property name="lineWrap" type="boolean" value="true"/>
<Property name="rows" type="int" value="5"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JCheckBox" name="m_jVisible">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="12" style="0"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="m_Ncx">
<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.epm.visible" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="m_Name3">
<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.epm.notes" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</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="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.epm.employee" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Form>
@@ -0,0 +1,239 @@
// 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.epm;
import com.unicenta.basic.BasicException;
import com.unicenta.data.loader.SentenceList;
import com.unicenta.data.user.DirtyManager;
import com.unicenta.data.user.EditorRecord;
import com.unicenta.pos.forms.AppLocal;
import com.unicenta.pos.forms.AppView;
import java.awt.Component;
import java.util.List;
import java.util.UUID;
/**
*
* @author Ali Safdar and Aneeqa Baber
*/
public final class BreaksView extends javax.swing.JPanel implements EditorRecord {
private Object m_oId;
private SentenceList m_sentcat;
private DirtyManager m_Dirty;
/** Creates new form BreaksView
* @param app
* @param dirty */
public BreaksView(AppView app, DirtyManager dirty) {
DataLogicPresenceManagement dlPresenceManagement = (DataLogicPresenceManagement) app.getBean("com.unicenta.pos.epm.DataLogicPresenceManagement");
initComponents();
m_sentcat = dlPresenceManagement.getBreaksList();
m_Dirty = dirty;
m_jBreakName.getDocument().addDocumentListener(dirty);
m_jVisible.addActionListener(dirty);
m_jBreakDescription.getDocument().addDocumentListener(dirty);
writeValueEOF();
}
void activate() throws BasicException {
List a = m_sentcat.list();
a.add(0, null);
}
/**
*
*/
@Override
public void writeValueEOF() {
m_oId = null;
m_jBreakName.setText(null);
m_jBreakDescription.setText(null);
m_jVisible.setSelected(false);
m_jBreakName.setEditable(false);
m_jBreakDescription.setEnabled(false);
m_jVisible.setEnabled(false);
}
/**
*
*/
@Override
public void writeValueInsert() {
m_oId = null;
m_jBreakName.setText(null);
m_jBreakDescription.setText(null);
m_jVisible.setSelected(true);
m_jBreakName.setEditable(true);
m_jBreakDescription.setEnabled(true);
m_jVisible.setEnabled(true);
}
/**
*
* @param value
*/
@Override
public void writeValueEdit(Object value) {
Object[] breaks = (Object[]) value;
m_oId = breaks[0];
m_jBreakName.setText((String) breaks[1]);
m_jBreakDescription.setText((String) breaks[2]);
m_jVisible.setSelected(((Boolean) breaks[3]).booleanValue());
m_jBreakName.setEditable(true);
m_jBreakDescription.setEnabled(true);
m_jVisible.setEnabled(true);
}
/**
*
* @param value
*/
@Override
public void writeValueDelete(Object value) {
Object[] breaks = (Object[]) value;
m_oId = breaks[0];
m_jBreakName.setText((String) breaks[1]);
m_jBreakDescription.setText((String) breaks[2]);
m_jVisible.setSelected(((Boolean) breaks[3]).booleanValue());
m_jBreakName.setEditable(false);
m_jBreakDescription.setEnabled(false);
m_jVisible.setEnabled(false);
}
/**
*
*/
@Override
public void refresh() {
}
/**
*
* @return
*/
@Override
public Component getComponent() {
return this;
}
/**
*
* @return
* @throws BasicException
*/
@Override
public Object createValue() throws BasicException {
Object[] breaks = new Object[4];
breaks[0] = m_oId == null ? UUID.randomUUID().toString() : m_oId;
breaks[1] = m_jBreakName.getText();
breaks[2] = m_jBreakDescription.getText();
breaks[3] = Boolean.valueOf(m_jVisible.isSelected());
return breaks;
}
/** 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() {
m_jBreakName = new javax.swing.JTextField();
jScrollPane1 = new javax.swing.JScrollPane();
m_jBreakDescription = new javax.swing.JTextArea();
m_jVisible = new javax.swing.JCheckBox();
m_Ncx = new javax.swing.JLabel();
m_Name3 = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
m_jBreakName.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
m_jBreakDescription.setColumns(20);
m_jBreakDescription.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
m_jBreakDescription.setLineWrap(true);
m_jBreakDescription.setRows(5);
jScrollPane1.setViewportView(m_jBreakDescription);
m_jVisible.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
m_Ncx.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
m_Ncx.setText(AppLocal.getIntString("label.epm.visible")); // NOI18N
m_Name3.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
m_Name3.setText(AppLocal.getIntString("label.epm.notes")); // NOI18N
jLabel1.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("pos_messages"); // NOI18N
jLabel1.setText(bundle.getString("label.epm.employee")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE)
.addComponent(m_Name3, javax.swing.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE)
.addComponent(m_Ncx, javax.swing.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(m_jVisible)
.addComponent(m_jBreakName)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 223, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(214, 214, 214))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(m_jBreakName, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(m_Ncx, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(m_Name3, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(m_jVisible, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(35, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JLabel m_Name3;
private javax.swing.JLabel m_Ncx;
private javax.swing.JTextArea m_jBreakDescription;
private javax.swing.JTextField m_jBreakName;
private javax.swing.JCheckBox m_jVisible;
// End of variables declaration//GEN-END:variables
}
@@ -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.epm;
import com.unicenta.basic.BasicException;
import com.unicenta.data.loader.*;
import com.unicenta.format.Formats;
import com.unicenta.pos.forms.AppLocal;
import com.unicenta.pos.forms.BeanFactoryDataSingle;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
*
* @author Ali Safdar and Aneeqa Baber
*/
public class DataLogicPresenceManagement extends BeanFactoryDataSingle {
/**
*
*/
protected Session s;
private SentenceExec m_checkin;
private SentenceExec m_checkout;
private SentenceFind m_checkdate;
private SentenceList m_breaksvisible;
private SentenceExec m_startbreak;
private SentenceExec m_endbreak;
private SentenceFind m_isonbreak;
private SentenceFind m_isonleave;
private SentenceFind m_shiftid;
private SentenceFind m_lastcheckin;
private SentenceFind m_lastcheckout;
private SentenceFind m_startbreaktime;
private SentenceFind m_lastbreakid;
private SentenceFind m_breakname;
private SerializerRead breakread;
private TableDefinition tbreaks;
private TableDefinition tleaves;
/**
*
*/
public DataLogicPresenceManagement() {
}
/**
*
* @param s
*/
@Override
public void init(Session s){
this.s = s;
breakread = new SerializerRead() {
@Override
public Object readValues(DataRead dr) throws BasicException {
return new Break(
dr.getString(1),
dr.getString(2),
dr.getString(3),
dr.getBoolean(4));
}
};
tbreaks = new TableDefinition(s
, "breaks"
, new String[] { "ID", "NAME", "NOTES", "VISIBLE"}
, new String[] { "ID", AppLocal.getIntString("label.epm.employee"), AppLocal.getIntString("label.epm.notes"), "VISIBLE"}
, new Datas[] { Datas.STRING, Datas.STRING, Datas.STRING, Datas.BOOLEAN}
, new Formats[] { Formats.STRING, Formats.STRING, Formats.STRING, Formats.BOOLEAN}
, new int[] {0}
);
tleaves = new TableDefinition(s
, "leaves"
, new String[] { "ID", "PPLID", "NAME", "STARTDATE", "ENDDATE", "NOTES"}
, new String[] { "ID", AppLocal.getIntString("label.epm.employee.id"), AppLocal.getIntString("label.epm.employee"), AppLocal.getIntString("label.StartDate"), AppLocal.getIntString("label.EndDate"), AppLocal.getIntString("label.notes")}
, new Datas[] { Datas.STRING, Datas.STRING, Datas.STRING, Datas.TIMESTAMP, Datas.TIMESTAMP, Datas.STRING}
, new Formats[] { Formats.STRING, Formats.STRING, Formats.STRING, Formats.TIMESTAMP, Formats.TIMESTAMP, Formats.STRING}
, new int[] {0}
);
m_breaksvisible = new StaticSentence(s
, "SELECT ID, NAME, NOTES, VISIBLE FROM breaks WHERE VISIBLE = " + s.DB.TRUE()
, null
, breakread);
m_checkin = new PreparedSentence(s
, "INSERT INTO shifts(ID, STARTSHIFT, PPLID) VALUES (?, ?, ?)"
, new SerializerWriteBasic(new Datas[] {Datas.STRING, Datas.TIMESTAMP, Datas.STRING}));
m_checkout = new StaticSentence(s
, "UPDATE shifts SET ENDSHIFT = ? WHERE ENDSHIFT IS NULL AND PPLID = ?"
,new SerializerWriteBasic(new Datas[] {Datas.TIMESTAMP, Datas.STRING}));
m_checkdate = new StaticSentence(s
, "SELECT COUNT(*) FROM shifts WHERE ENDSHIFT IS NULL AND PPLID = ?"
, SerializerWriteString.INSTANCE
, SerializerReadString.INSTANCE);
m_startbreak = new PreparedSentence(s
, "INSERT INTO shift_breaks(ID, SHIFTID, BREAKID, STARTTIME) VALUES (?, ?, ?, ?)"
, new SerializerWriteBasic(new Datas[] {Datas.STRING, Datas.STRING, Datas.STRING, Datas.TIMESTAMP}));
m_endbreak = new StaticSentence(s
, "UPDATE shift_breaks SET ENDTIME = ? WHERE ENDTIME IS NULL AND SHIFTID = ?"
,new SerializerWriteBasic(new Datas[] {Datas.TIMESTAMP, Datas.STRING}));
m_isonbreak = new StaticSentence(s
// , "SELECT COUNT(*) FROM shift_breaks WHERE ENDTIME IS NULL AND SHIFTID = ?"
, "SELECT COUNT(*) FROM shift_breaks WHERE ENDTIME IS NULL"
, SerializerWriteString.INSTANCE
, SerializerReadString.INSTANCE);
m_shiftid = new StaticSentence(s
, "SELECT ID FROM shifts WHERE ENDSHIFT IS NULL AND PPLID = ?"
, SerializerWriteString.INSTANCE
, SerializerReadString.INSTANCE);
m_isonleave = new StaticSentence(s
, "SELECT COUNT(*) FROM leaves WHERE STARTDATE < ? AND ENDDATE > ? AND PPLID = ?"
, new SerializerWriteBasic(new Datas[] {Datas.TIMESTAMP, Datas.TIMESTAMP, Datas.STRING})
, SerializerReadString.INSTANCE);
m_lastcheckin = new StaticSentence(s
, "SELECT STARTSHIFT FROM shifts WHERE ENDSHIFT IS NULL AND PPLID = ?"
, SerializerWriteString.INSTANCE
, SerializerReadDate.INSTANCE);
m_lastcheckout = new StaticSentence(s
, "SELECT MAX(ENDSHIFT) FROM shifts WHERE PPLID = ?"
, SerializerWriteString.INSTANCE
, SerializerReadDate.INSTANCE);
m_startbreaktime = new StaticSentence(s
, "SELECT STARTTIME FROM shift_breaks WHERE ENDTIME IS NULL AND SHIFTID = ?"
, SerializerWriteString.INSTANCE
, SerializerReadDate.INSTANCE);
m_lastbreakid = new StaticSentence(s
, "SELECT BREAKID FROM shift_breaks WHERE ENDTIME IS NULL AND SHIFTID = ?"
, SerializerWriteString.INSTANCE
, SerializerReadString.INSTANCE);
m_breakname = new StaticSentence(s
, "SELECT NAME FROM breaks WHERE ID = ?"
, SerializerWriteString.INSTANCE
, SerializerReadString.INSTANCE);
}
/**
*
* @return
*/
public final SentenceList getBreaksList() {
return new StaticSentence(s
, "SELECT ID, NAME FROM breaks ORDER BY NAME"
, null
, new SerializerRead() {@Override
public Object readValues(DataRead dr) throws BasicException {
return new BreaksInfo(dr.getString(1), dr.getString(2));
}});
}
/**
*
* @return
*/
public final SentenceList getLeavesList() {
return new StaticSentence(s
, "SELECT ID, PPLID, NAME, STARTDATE, ENDDATE, NOTES FROM leaves ORDER BY NAME"
, null
, new SerializerRead() {@Override
public Object readValues(DataRead dr) throws BasicException {
return new LeavesInfo(dr.getString(1), dr.getString(2), dr.getString(3), dr.getString(4), dr.getString(5), dr.getString(6));
}});
}
/**
*
* @return
* @throws BasicException
*/
public final List listBreaksVisible()throws BasicException {
return m_breaksvisible.list();
}
/**
*
* @param user
* @throws BasicException
*/
public final void CheckIn(String user) throws BasicException {
Object[] value = new Object[] {UUID.randomUUID().toString(), new Date(), user};
m_checkin.exec(value);
}
/**
*
* @param user
* @throws BasicException
*/
public final void CheckOut(String user) throws BasicException {
Object[] value = new Object[] {new Date(), user};
m_checkout.exec(value);
}
/**
*
* @param user
* @return
* @throws BasicException
*/
public final boolean IsCheckedIn(String user) throws BasicException {
String Data = (String) m_checkdate.find(user);
// "0" rows shows user is not checked in
if (Data.equals("0")) {
return false;
}
return true;
}
/**
*
* @param UserID
* @param BreakID
* @throws BasicException
*/
public final void StartBreak(String UserID, String BreakID) throws BasicException {
String ShiftID = GetShiftID(UserID);
Object[] value = new Object[] {UUID.randomUUID().toString(), ShiftID, BreakID, new Date()};
m_startbreak.exec(value);
}
/**
*
* @param UserID
* @throws BasicException
*/
public final void EndBreak(String UserID) throws BasicException {
String ShiftID = GetShiftID(UserID);
Object[] value = new Object[] {new Date(), ShiftID};
m_endbreak.exec(value);
}
/**
*
* @param user
* @return
* @throws BasicException
*/
public final boolean IsOnBreak(String user) throws BasicException {
String ShiftID = GetShiftID(user);
String Data = (String) m_isonbreak.find(ShiftID);
// "0" rows shows user is not on break
if (Data.equals("0")) {
return false;
}
return true;
}
/**
*
* @param user
* @return
* @throws BasicException
*/
public final String GetShiftID(String user) throws BasicException {
return (String) m_shiftid.find(user);
}
/**
*
* @param user
* @return
* @throws BasicException
*/
public final Date GetLastCheckIn(String user) throws BasicException {
return (Date) m_lastcheckin.find(user);
}
/**
*
* @param user
* @return
* @throws BasicException
*/
public final Date GetLastCheckOut(String user) throws BasicException {
return (Date) m_lastcheckout.find(user);
}
/**
*
* @param ShiftID
* @return
* @throws BasicException
*/
public final Date GetStartBreakTime(String ShiftID) throws BasicException {
return (Date) m_startbreaktime.find(ShiftID);
}
/**
*
* @param ShiftID
* @return
* @throws BasicException
*/
public final String GetLastBreakID(String ShiftID) throws BasicException {
return (String) m_lastbreakid.find(ShiftID);
}
/**
*
* @param ShiftID
* @return
* @throws BasicException
*/
public final String GetLastBreakName(String ShiftID) throws BasicException {
String BreakID = GetLastBreakID(ShiftID);
return (String) m_breakname.find(BreakID);
}
/**
*
* @param user
* @return
* @throws BasicException
*/
public final Object [] GetLastBreak(String user) throws BasicException {
String ShiftID = GetShiftID(user);
Date StartBreakTime = GetStartBreakTime(ShiftID);
String BreakName = GetLastBreakName(ShiftID);
return new Object[] {BreakName, StartBreakTime};
}
/**
*
* @param user
* @return
* @throws BasicException
*/
public final boolean IsOnLeave(String user) throws BasicException {
Object[] value = new Object[] {new Date(), new Date(), user};
String Data = (String) m_isonleave.find(value);
// "0" rows shows user is not on leave
if (Data.equals("0")) {
return false;
}
return true;
}
// EmployeeList list
// Changed ='4' to !='0' --it lists all the users except admin who doesn´t clock in
/**
*
* @return
*/
public SentenceList getEmployeeList() {
return new StaticSentence(s
, new QBFBuilder("SELECT ID, NAME FROM people WHERE ROLE != '0' AND VISIBLE = " + s.DB.TRUE() + " AND ?(QBF_FILTER) ORDER BY NAME", new String[] {"NAME"})
, new SerializerWriteBasic(new Datas[] {Datas.OBJECT, Datas.STRING})
, new SerializerRead() {
@Override
public Object readValues(DataRead dr) throws BasicException {
EmployeeInfo c = new EmployeeInfo(dr.getString(1));
c.setName(dr.getString(2));
return c;
}
});
}
/**
*
* @param user
* @throws BasicException
*/
public void BlockEmployee(String user) throws BasicException {
boolean isOnBreak = IsOnBreak(user);
if (isOnBreak) {
EndBreak(user);
}
CheckOut(user);
}
TableDefinition getTableBreaks() {
return tbreaks;
}
TableDefinition getTableLeaves() {
return tleaves;
}
/**
*
* @param id
* @return
* @throws BasicException
*/
public EmployeeInfoExt loadEmployeeExt(String id) throws BasicException {
return (EmployeeInfoExt) new PreparedSentence(s
, "SELECT ID, NAME FROM people WHERE ID = ?"
, SerializerWriteString.INSTANCE
, new EmployeeExtRead()).find(id);
}
/**
*
*/
protected static class EmployeeExtRead implements SerializerRead {
/**
*
* @param dr
* @return
* @throws BasicException
*/
@Override
public Object readValues(DataRead dr) throws BasicException {
EmployeeInfoExt c = new EmployeeInfoExt(dr.getString(1));
c.setName(dr.getString(2));
return c;
}
}
}
@@ -0,0 +1,87 @@
// 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.epm;
import com.unicenta.pos.util.StringUtils;
import java.io.Serializable;
/**
*
* @author Ali Safdar and Aneeqa Baber
*/
public class EmployeeInfo implements Serializable {
private static final long serialVersionUID = 9083257536541L;
/**
*
*/
protected String id;
/**
*
*/
protected String name;
/** Creates a new instance of EmployeeInfo
* @param id */
public EmployeeInfo(String id) {
this.id = id;
this.name = null;
}
/**
*
* @return
*/
public String getId() {
return id;
}
/**
*
* @return
*/
public String getName() {
return name;
}
/**
*
* @param name
*/
public void setName(String name) {
this.name = name;
}
/**
*
* @return
*/
public String printName() {
return StringUtils.encodeXML(name);
}
@Override
public String toString() {
return getName();
}
}
@@ -0,0 +1,54 @@
// 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.epm;
/**
*
* @author Ali Safadr and Aneeqa Baber
*/
public class EmployeeInfoExt extends EmployeeInfo {
/**
*
*/
protected boolean visible;
/** Creates a new instance of EmployeeInfoExt
* @param id */
public EmployeeInfoExt(String id) {
super(id);
}
/**
*
* @return
*/
public boolean isVisible() {
return visible;
}
/**
*
* @param visible
*/
public void setVisible(boolean visible) {
this.visible = visible;
}
}
@@ -0,0 +1,48 @@
// 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.epm;
import java.awt.Component;
import javax.swing.DefaultListCellRenderer;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JList;
/**
*
* @author Ali Safdar and Aneeqa Baber
*/
public class EmployeeRenderer extends DefaultListCellRenderer {
private Icon icoemployee;
/** Creates a new instance of EmployeeRenderer */
public EmployeeRenderer() {
icoemployee = new ImageIcon(getClass().getClassLoader().getResource("com/unicenta/images/user.png"));
}
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, null, index, isSelected, cellHasFocus);
setText(value.toString());
setIcon(icoemployee);
return this;
}
}
@@ -0,0 +1,288 @@
<?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="form.customertitle" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</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,-17,0,0,2,-85"/>
<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="After"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Component class="com.unicenta.editor.JEditorKeys" name="m_jKeys">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="North"/>
</Constraint>
</Constraints>
</Component>
<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"/>
<SubComponents>
<Component class="javax.swing.JButton" name="jcmdCancel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/unicenta/images/cancel.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="Button.Cancel" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusPainted" type="boolean" value="false"/>
<Property name="focusable" type="boolean" value="false"/>
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
<Insets value="[8, 16, 8, 16]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[110, 45]"/>
</Property>
<Property name="requestFocusEnabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jcmdCancelActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jcmdOK">
<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(&quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
<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="jcmdOKActionPerformed"/>
</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="Center"/>
</Constraint>
</Constraints>
<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="First"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel7">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel5" min="-2" pref="126" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="m_jtxtName" min="-2" pref="220" 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 max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel5" alignment="0" min="-2" pref="25" max="-2" attributes="0"/>
<Component id="m_jtxtName" alignment="0" min="-2" pref="25" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="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.epm.employee" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="com.unicenta.editor.JEditorString" name="m_jtxtName">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel6">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="South"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
<SubComponents>
<Component class="javax.swing.JButton" name="jButton1">
<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.clean" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[110, 45]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton3">
<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.executefilter" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusPainted" type="boolean" value="false"/>
<Property name="focusable" type="boolean" value="false"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[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="jButton3ActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel4">
<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>
<Component class="javax.swing.JList" name="jListEmployees">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="requestFocusEnabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jListEmployeesMouseClicked"/>
<EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="jListEmployeesValueChanged"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel8">
<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"/>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>
@@ -0,0 +1,383 @@
// 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.epm;
import com.unicenta.basic.BasicException;
import com.unicenta.data.loader.QBFCompareEnum;
import com.unicenta.data.user.EditorCreator;
import com.unicenta.data.user.ListProvider;
import com.unicenta.data.user.ListProviderCreator;
import com.unicenta.pos.forms.AppLocal;
import java.awt.*;
import java.util.ArrayList;
import javax.swing.JFrame;
/**
*
* @author Ali Safdar and Aneeqa Baber
*/
public class JEmployeeFinder extends javax.swing.JDialog implements EditorCreator {
private EmployeeInfo selectedEmployee;
private ListProvider lpr;
/** Creates new form JEmployeeFinder */
private JEmployeeFinder(java.awt.Frame parent, boolean modal) {
super(parent, modal);
}
/** Creates new form JEmployeeFinder */
private JEmployeeFinder(java.awt.Dialog parent, boolean modal) {
super(parent, modal);
}
/**
*
* @param parent
* @param dlPresenceManagement
* @return
*/
public static JEmployeeFinder getEmployeeFinder(Component parent, DataLogicPresenceManagement dlPresenceManagement) {
Window window = getWindow(parent);
JEmployeeFinder myMsg;
if (window instanceof Frame) {
myMsg = new JEmployeeFinder((Frame) window, true);
} else {
myMsg = new JEmployeeFinder((Dialog) window, true);
}
myMsg.init(dlPresenceManagement);
myMsg.applyComponentOrientation(parent.getComponentOrientation());
return myMsg;
}
/**
*
* @return
*/
public EmployeeInfo getSelectedEmployee() {
return selectedEmployee;
}
private void init(DataLogicPresenceManagement dlPresenceManagement) {
initComponents();
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(35, 35));
m_jtxtName.addEditorKeys(m_jKeys);
m_jtxtName.reset();
lpr = new ListProviderCreator(dlPresenceManagement.getEmployeeList(), this);
jListEmployees.setCellRenderer(new EmployeeRenderer());
getRootPane().setDefaultButton(jcmdOK);
selectedEmployee = null;
}
/**
*
* @param employee
*/
public void search(EmployeeInfo employee) {
if (employee == null || employee.getName() == null || employee.getName().equals("")) {
m_jtxtName.reset();
cleanSearch();
} else {
m_jtxtName.setText(employee.getName());
executeSearch();
}
}
private void cleanSearch() {
jListEmployees.setModel(new MyListData(new ArrayList()));
}
/**
*
*/
public void executeSearch() {
try {
jListEmployees.setModel(new MyListData(lpr.loadData()));
if (jListEmployees.getModel().getSize() > 0) {
jListEmployees.setSelectedIndex(0);
}
} catch (BasicException e) {
}
}
/**
*
* @return
* @throws BasicException
*/
@Override
public Object createValue() throws BasicException {
Object[] afilter = new Object[2];
// Name
if (m_jtxtName.getText() == null || m_jtxtName.getText().equals("")) {
afilter[0] = QBFCompareEnum.COMP_NONE;
afilter[1] = null;
} else {
afilter[0] = QBFCompareEnum.COMP_RE;
afilter[1] = "%" + m_jtxtName.getText() + "%";
}
return afilter;
}
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 static class MyListData extends javax.swing.AbstractListModel {
private java.util.List m_data;
public MyListData(java.util.List data) {
m_data = data;
}
@Override
public Object getElementAt(int index) {
return m_data.get(index);
}
@Override
public int getSize() {
return m_data.size();
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel2 = new javax.swing.JPanel();
m_jKeys = new com.unicenta.editor.JEditorKeys();
jPanel1 = new javax.swing.JPanel();
jcmdCancel = new javax.swing.JButton();
jcmdOK = new javax.swing.JButton();
jPanel3 = new javax.swing.JPanel();
jPanel5 = new javax.swing.JPanel();
jPanel7 = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
m_jtxtName = new com.unicenta.editor.JEditorString();
jPanel6 = new javax.swing.JPanel();
jButton1 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jPanel4 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jListEmployees = new javax.swing.JList();
jPanel8 = new javax.swing.JPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle(AppLocal.getIntString("form.customertitle")); // NOI18N
jPanel2.setLayout(new java.awt.BorderLayout());
jPanel2.add(m_jKeys, java.awt.BorderLayout.NORTH);
jcmdCancel.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jcmdCancel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/cancel.png"))); // NOI18N
jcmdCancel.setText(AppLocal.getIntString("button.cancel")); // NOI18N
jcmdCancel.setFocusPainted(false);
jcmdCancel.setFocusable(false);
jcmdCancel.setMargin(new java.awt.Insets(8, 16, 8, 16));
jcmdCancel.setPreferredSize(new java.awt.Dimension(110, 45));
jcmdCancel.setRequestFocusEnabled(false);
jcmdCancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jcmdCancelActionPerformed(evt);
}
});
jPanel1.add(jcmdCancel);
jcmdOK.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jcmdOK.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/ok.png"))); // NOI18N
jcmdOK.setText(AppLocal.getIntString("button.OK")); // NOI18N
jcmdOK.setEnabled(false);
jcmdOK.setFocusPainted(false);
jcmdOK.setFocusable(false);
jcmdOK.setMargin(new java.awt.Insets(8, 16, 8, 16));
jcmdOK.setPreferredSize(new java.awt.Dimension(110, 45));
jcmdOK.setRequestFocusEnabled(false);
jcmdOK.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jcmdOKActionPerformed(evt);
}
});
jPanel1.add(jcmdOK);
jPanel2.add(jPanel1, java.awt.BorderLayout.PAGE_END);
getContentPane().add(jPanel2, java.awt.BorderLayout.LINE_END);
jPanel3.setLayout(new java.awt.BorderLayout());
jPanel5.setLayout(new java.awt.BorderLayout());
jLabel5.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jLabel5.setText(AppLocal.getIntString("label.epm.employee")); // NOI18N
m_jtxtName.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
jPanel7.setLayout(jPanel7Layout);
jPanel7Layout.setHorizontalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(m_jtxtName, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel7Layout.setVerticalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(m_jtxtName, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel5.add(jPanel7, java.awt.BorderLayout.CENTER);
jButton1.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/reload.png"))); // NOI18N
jButton1.setText(AppLocal.getIntString("button.clean")); // NOI18N
jButton1.setPreferredSize(new java.awt.Dimension(110, 45));
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jPanel6.add(jButton1);
jButton3.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/ok.png"))); // NOI18N
jButton3.setText(AppLocal.getIntString("button.executefilter")); // NOI18N
jButton3.setFocusPainted(false);
jButton3.setFocusable(false);
jButton3.setPreferredSize(new java.awt.Dimension(110, 45));
jButton3.setRequestFocusEnabled(false);
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jPanel6.add(jButton3);
jPanel5.add(jPanel6, java.awt.BorderLayout.SOUTH);
jPanel3.add(jPanel5, java.awt.BorderLayout.PAGE_START);
jPanel4.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel4.setLayout(new java.awt.BorderLayout());
jListEmployees.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jListEmployees.setFocusable(false);
jListEmployees.setRequestFocusEnabled(false);
jListEmployees.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jListEmployeesMouseClicked(evt);
}
});
jListEmployees.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
jListEmployeesValueChanged(evt);
}
});
jScrollPane1.setViewportView(jListEmployees);
jPanel4.add(jScrollPane1, java.awt.BorderLayout.CENTER);
jPanel3.add(jPanel4, java.awt.BorderLayout.CENTER);
jPanel8.setLayout(new java.awt.BorderLayout());
jPanel3.add(jPanel8, java.awt.BorderLayout.SOUTH);
getContentPane().add(jPanel3, java.awt.BorderLayout.CENTER);
setSize(new java.awt.Dimension(683, 495));
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void jcmdOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcmdOKActionPerformed
selectedEmployee = (EmployeeInfo) jListEmployees.getSelectedValue();
dispose();
}//GEN-LAST:event_jcmdOKActionPerformed
private void jcmdCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcmdCancelActionPerformed
dispose();
}//GEN-LAST:event_jcmdCancelActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
executeSearch();
}//GEN-LAST:event_jButton3ActionPerformed
private void jListEmployeesValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jListEmployeesValueChanged
jcmdOK.setEnabled(jListEmployees.getSelectedValue() != null);
}//GEN-LAST:event_jListEmployeesValueChanged
private void jListEmployeesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jListEmployeesMouseClicked
if (evt.getClickCount() == 2) {
selectedEmployee = (EmployeeInfo) jListEmployees.getSelectedValue();
dispose();
}
}//GEN-LAST:event_jListEmployeesMouseClicked
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
m_jtxtName.reset();
cleanSearch();
}//GEN-LAST:event_jButton1ActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton3;
private javax.swing.JLabel jLabel5;
private javax.swing.JList jListEmployees;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JPanel jPanel7;
private javax.swing.JPanel jPanel8;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JButton jcmdCancel;
private javax.swing.JButton jcmdOK;
private com.unicenta.editor.JEditorKeys m_jKeys;
private com.unicenta.editor.JEditorString m_jtxtName;
// End of variables declaration//GEN-END:variables
}
@@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 45]"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="btnCheckIn" min="-2" pref="256" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="btnCheckOut" min="-2" pref="248" max="-2" attributes="0"/>
</Group>
<Component id="jScrollPane1" alignment="0" max="32767" attributes="0"/>
<Component id="message" alignment="1" max="32767" attributes="0"/>
</Group>
<EmptySpace 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="message" min="-2" pref="50" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="btnCheckIn" alignment="3" min="-2" pref="49" max="-2" attributes="0"/>
<Component id="btnCheckOut" alignment="3" min="-2" pref="49" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="80" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="btnCheckIn">
<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="Check In"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[85, 23]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 45]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnCheckInActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="btnCheckOut">
<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="Check Out"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 45]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnCheckOutActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<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>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[570, 120]"/>
</Property>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
</Container>
<Component class="javax.swing.JLabel" name="message">
<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="[160, 25]"/>
</Property>
<Property name="requestFocusEnabled" type="boolean" value="false"/>
</Properties>
</Component>
</SubComponents>
</Form>
@@ -0,0 +1,327 @@
// 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.epm;
import com.unicenta.basic.BasicException;
import com.unicenta.beans.JFlowPanel;
import com.unicenta.data.gui.MessageInf;
import com.unicenta.format.Formats;
import com.unicenta.pos.forms.*;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.util.Date;
import javax.swing.*;
/**
*
* @author Ali Safdar and Aneeqa Baber
*/
public class JPanelEmployeePresence extends javax.swing.JPanel implements JPanelView, BeanFactoryApp {
private AppView app;
private DataLogicPresenceManagement dlpresencemanagement;
private JFlowPanel jBreaks;
/** Creates new form JPanelEmployeePresence */
public JPanelEmployeePresence() {
initComponents();
this.setVisible(true);
}
/**
*
* @param app
* @throws BeanFactoryException
*/
@Override
public void init(AppView app) throws BeanFactoryException {
this.app = app;
dlpresencemanagement = (DataLogicPresenceManagement) app.getBean("com.unicenta.pos.epm.DataLogicPresenceManagement");
}
private void listBreaks()
{
try {
jScrollPane1.getViewport().setView(null);
jBreaks = new JFlowPanel();
jBreaks.applyComponentOrientation(getComponentOrientation());
java.util.List breaks = dlpresencemanagement.listBreaksVisible();
for (int i = 0; i < breaks.size(); i++) {
Break m_break = (Break) breaks.get(i);
JButton btn = new JButton(new BreakAction(m_break));
btn.applyComponentOrientation(getComponentOrientation());
btn.setFocusPainted(false);
btn.setFocusable(false);
btn.setRequestFocusEnabled(false);
btn.setHorizontalAlignment(SwingConstants.LEADING);
btn.setMaximumSize(new Dimension(190, 50));
btn.setPreferredSize(new Dimension(190, 50));
btn.setMinimumSize(new Dimension(190, 50));
jBreaks.add(btn);
}
jScrollPane1.getViewport().setView(jBreaks);
} catch (BasicException ee) {
}
}
private class BreakAction extends AbstractAction {
private Break m_break;
public BreakAction(Break aBreak) {
m_break = aBreak;
putValue(Action.NAME, m_break.getName());
}
public Break getBreak() {
return m_break;
}
@Override
public void actionPerformed(ActionEvent evt) {
try {
dlpresencemanagement.StartBreak(app.getAppUserView().getUser().getId(), m_break.getId());
message.setText(app.getAppUserView().getUser().getName()+" "+AppLocal.getIntString("message.leavefor")+" "+ m_break.getName()+" "+AppLocal.getIntString("message.at")+" "+Formats.TIMESTAMP.formatValue(new Date()));
BreakAction();
} catch (BasicException ex) {
message.setText(AppLocal.getIntString("message.probleminbreak"));
}
}
}
/**
*
* @return
*/
@Override
public String getTitle() {
return AppLocal.getIntString("Menu.CheckInCheckOut");
}
/**
*
* @throws BasicException
*/
@Override
public void activate() throws BasicException {
boolean isOnLeave = dlpresencemanagement.IsOnLeave(app.getAppUserView().getUser().getId());
listBreaks();
if (isOnLeave) {
message.setText(app.getAppUserView().getUser().getName()+" "+AppLocal.getIntString("message.leavecontrol"));
LeaveAction();
} else {
boolean isCheckedIn = dlpresencemanagement.IsCheckedIn(app.getAppUserView().getUser().getId());
if (isCheckedIn) {
Date lastCheckIn = dlpresencemanagement.GetLastCheckIn(app.getAppUserView().getUser().getId());
message.setText(app.getAppUserView().getUser().getName()+" "+AppLocal.getIntString("message.checkedin")+" "+Formats.TIMESTAMP.formatValue(lastCheckIn));
CheckInAction();
} else {
Date lastCheckOut = dlpresencemanagement.GetLastCheckOut(app.getAppUserView().getUser().getId());
if (lastCheckOut != null) {
message.setText(app.getAppUserView().getUser().getName()+" "+AppLocal.getIntString("message.checkedout")+" "+Formats.TIMESTAMP.formatValue(lastCheckOut));
} else {
message.setText(app.getAppUserView().getUser().getName()+" "+AppLocal.getIntString("message.noshift"));
}
CheckOutAction();
}
boolean isOnBreak = dlpresencemanagement.IsOnBreak(app.getAppUserView().getUser().getId());
if (isOnBreak) {
Object[] LastBreak = (Object[]) dlpresencemanagement.GetLastBreak(app.getAppUserView().getUser().getId());
message.setText(app.getAppUserView().getUser().getName()+" "+AppLocal.getIntString("message.leavefor")+" "+(String) LastBreak[0] +" "+AppLocal.getIntString("message.at")+" "+ Formats.TIMESTAMP.formatValue((Date) LastBreak[1]));
BreakAction();
}
}
}
/**
*
* @return
*/
@Override
public boolean deactivate() {
return true;
}
/**
*
* @return
*/
@Override
public JComponent getComponent() {
return this;
}
/**
*
* @return
*/
@Override
public Object getBean() {
return this;
}
private void CheckInAction() {
btnCheckIn.setEnabled(false);
btnCheckOut.setEnabled(true);
jBreaks.setEnabled(true);
}
private void CheckOutAction() {
btnCheckIn.setEnabled(true);
btnCheckOut.setEnabled(false);
jBreaks.setEnabled(false);
}
private void BreakAction() {
btnCheckIn.setEnabled(true);
btnCheckOut.setEnabled(true);
jBreaks.setEnabled(false);
}
private void LeaveAction() {
btnCheckIn.setEnabled(false);
btnCheckOut.setEnabled(false);
jBreaks.setEnabled(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.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
btnCheckIn = new javax.swing.JButton();
btnCheckOut = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
message = new javax.swing.JLabel();
setPreferredSize(new java.awt.Dimension(0, 45));
btnCheckIn.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
btnCheckIn.setText("Check In");
btnCheckIn.setMaximumSize(new java.awt.Dimension(85, 23));
btnCheckIn.setPreferredSize(new java.awt.Dimension(0, 45));
btnCheckIn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCheckInActionPerformed(evt);
}
});
btnCheckOut.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
btnCheckOut.setText("Check Out");
btnCheckOut.setPreferredSize(new java.awt.Dimension(0, 45));
btnCheckOut.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCheckOutActionPerformed(evt);
}
});
jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
jScrollPane1.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jScrollPane1.setPreferredSize(new java.awt.Dimension(570, 120));
message.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
message.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
message.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")), javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4)));
message.setOpaque(true);
message.setPreferredSize(new java.awt.Dimension(160, 25));
message.setRequestFocusEnabled(false);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(btnCheckIn, javax.swing.GroupLayout.PREFERRED_SIZE, 256, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnCheckOut, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(message, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(message, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnCheckIn, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnCheckOut, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(80, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void btnCheckInActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCheckInActionPerformed
try {
boolean isOnBreak = dlpresencemanagement.IsOnBreak(app.getAppUserView().getUser().getId());
if (isOnBreak) {
dlpresencemanagement.EndBreak(app.getAppUserView().getUser().getId());
message.setText(app.getAppUserView().getUser().getName()+AppLocal.getIntString("message.breakoverandcheckedin")+" "+Formats.TIMESTAMP.formatValue(new Date()));
} else {
dlpresencemanagement.CheckIn(app.getAppUserView().getUser().getId());
message.setText(app.getAppUserView().getUser().getName()+" "+AppLocal.getIntString("message.checkedin")+" "+Formats.TIMESTAMP.formatValue(new Date()));
}
} catch (BasicException ex) {
MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotcheckin"));
msg.show(this);
}
CheckInAction();
}//GEN-LAST:event_btnCheckInActionPerformed
private void btnCheckOutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCheckOutActionPerformed
try {
boolean isOnBreak = dlpresencemanagement.IsOnBreak(app.getAppUserView().getUser().getId());
if (isOnBreak) {
dlpresencemanagement.EndBreak(app.getAppUserView().getUser().getId());
message.setText(app.getAppUserView().getUser().getName()+" "+AppLocal.getIntString("message.breakoverandcheckedout")+" "+Formats.TIMESTAMP.formatValue(new Date()));
} else {
message.setText(app.getAppUserView().getUser().getName()+" "+AppLocal.getIntString("message.checkedout")+" "+Formats.TIMESTAMP.formatValue(new Date()));
}
dlpresencemanagement.CheckOut(app.getAppUserView().getUser().getId());
} catch (BasicException ex) {
MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotcheckout"));
msg.show(this);
}
CheckOutAction();
}//GEN-LAST:event_btnCheckOutActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnCheckIn;
private javax.swing.JButton btnCheckOut;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JLabel message;
// End of variables declaration//GEN-END:variables
}
@@ -0,0 +1,164 @@
// 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.epm;
import com.unicenta.data.loader.IKeyed;
/**
*
* @author Ali Safdar and Aneeqa Baber
*/
public class LeavesInfo implements IKeyed {
private static final long serialVersionUID = 8936482715929L;
private String m_sID;
private String m_sName;
private String m_sEmployeeID;
private String m_sStartDate;
private String m_sEndDate;
private String m_sNotes;
/** Creates new LeavesInfo
* @param id
* @param name
* @param notes
* @param startdate
* @param employeeid
* @param enddate */
public LeavesInfo(String id, String name, String employeeid, String startdate, String enddate, String notes) {
m_sID = id;
m_sName = name;
m_sEmployeeID = employeeid;
m_sStartDate = startdate;
m_sEndDate = enddate;
m_sNotes = notes;
}
/**
*
* @return
*/
@Override
public Object getKey() {
return m_sID;
}
/**
*
* @param sID
*/
public void setID(String sID) {
m_sID = sID;
}
/**
*
* @return
*/
public String getID() {
return m_sID;
}
/**
*
* @return
*/
public String getName() {
return m_sName;
}
/**
*
* @param sName
*/
public void setName(String sName) {
m_sName = sName;
}
@Override
public String toString(){
return m_sName;
}
/**
*
* @return
*/
public String getEmployeeID() {
return m_sEmployeeID;
}
/**
*
* @param EmployeeID
*/
public void setEmployeeID(String EmployeeID) {
this.m_sEmployeeID = EmployeeID;
}
/**
*
* @return
*/
public String getStartDate() {
return m_sStartDate;
}
/**
*
* @param StartDate
*/
public void setStartDate(String StartDate) {
this.m_sStartDate = StartDate;
}
/**
*
* @return
*/
public String getEndDate() {
return m_sEndDate;
}
/**
*
* @param EndDate
*/
public void setEndDate(String EndDate) {
this.m_sEndDate = EndDate;
}
/**
*
* @return
*/
public String getNotes() {
return m_sNotes;
}
/**
*
* @param Notes
*/
public void setNotes(String Notes) {
this.m_sNotes = Notes;
}
}
@@ -0,0 +1,130 @@
// 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.epm;
import com.unicenta.basic.BasicException;
import com.unicenta.data.gui.ListCellRendererBasic;
import com.unicenta.data.loader.ComparatorCreator;
import com.unicenta.data.loader.TableDefinition;
import com.unicenta.data.loader.Vectorer;
import com.unicenta.data.user.EditorRecord;
import com.unicenta.data.user.ListProvider;
import com.unicenta.data.user.ListProviderCreator;
import com.unicenta.data.user.SaveProvider;
import com.unicenta.pos.forms.AppLocal;
import com.unicenta.pos.panels.JPanelTable;
import javax.swing.ListCellRenderer;
/**
*
* @author Ali Safdar and Aneeqa Baber
*/
public class LeavesPanel extends JPanelTable {
private TableDefinition tleaves;
private LeavesView jeditor;
/** Creates a new instance of LeavesPanel */
public LeavesPanel() {
}
/**
*
*/
@Override
protected void init() {
DataLogicPresenceManagement dlPresenceManagement = (DataLogicPresenceManagement) app.getBean("com.unicenta.pos.epm.DataLogicPresenceManagement");
tleaves = dlPresenceManagement.getTableLeaves();
jeditor = new LeavesView(app, dirty);
}
/**
*
* @throws BasicException
*/
@Override
public void activate() throws BasicException {
jeditor.activate();
super.activate();
}
/**
*
* @return
*/
@Override
public ListProvider getListProvider() {
return new ListProviderCreator(tleaves);
}
/**
*
* @return
*/
@Override
public SaveProvider getSaveProvider() {
return new SaveProvider(tleaves, new int[] {0, 1, 2, 3, 4, 5});
}
/**
*
* @return
*/
@Override
public Vectorer getVectorer() {
return tleaves.getVectorerBasic(new int[]{2, 5});
}
/**
*
* @return
*/
@Override
public ComparatorCreator getComparatorCreator() {
return tleaves.getComparatorCreator(new int[] {2, 3, 4, 5});
}
/**
*
* @return
*/
@Override
public ListCellRenderer getListCellRenderer() {
return new ListCellRendererBasic(tleaves.getRenderStringBasic(new int[]{2}));
}
/**
*
* @return
*/
@Override
public EditorRecord getEditor() {
return jeditor;
}
/**
*
* @return
*/
@Override
public String getTitle() {
return AppLocal.getIntString("Menu.Leaves");
}
}
@@ -0,0 +1,237 @@
<?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"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="m_Notes" alignment="1" pref="126" max="32767" attributes="1"/>
<Component id="m_EndDate" pref="126" max="32767" attributes="1"/>
<Component id="m_StartDate" alignment="0" pref="126" max="32767" attributes="1"/>
<Component id="m_Name" alignment="0" pref="126" max="32767" attributes="1"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="m_jEndDate" alignment="0" max="32767" attributes="1"/>
<Component id="m_jStartDate" max="32767" attributes="1"/>
<Component id="m_jEmployeeName" alignment="0" pref="172" max="32767" attributes="1"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="btnStartDate" alignment="0" max="32767" attributes="1"/>
<Component id="btnEmployee" alignment="0" max="32767" attributes="1"/>
<Component id="btnEndDate" alignment="0" max="32767" attributes="1"/>
</Group>
</Group>
<Component id="jScrollPane1" pref="258" max="32767" attributes="1"/>
</Group>
<EmptySpace min="-2" pref="77" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
<Component id="m_Name" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="m_jEmployeeName" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="btnEmployee" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
<Component id="m_StartDate" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="m_jStartDate" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="btnStartDate" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="btnEndDate" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="m_EndDate" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="m_jEndDate" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace type="separate" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="m_Notes" min="-2" pref="25" max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" pref="141" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JTextField" name="m_jEmployeeName">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="12" style="0"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 30]"/>
</Property>
</Properties>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<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.JTextArea" name="m_jLeaveNote">
<Properties>
<Property name="columns" type="int" value="20"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Monospaced" size="14" style="0"/>
</Property>
<Property name="lineWrap" type="boolean" value="true"/>
<Property name="rows" type="int" value="5"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="m_Name">
<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.epm.employee" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="m_StartDate">
<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.epm.startdate" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="m_EndDate">
<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.epm.enddate" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="m_jStartDate">
<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="[0, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="m_Notes">
<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.epm.notes" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 30]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="btnEmployee">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/unicenta/images/user_sml.png"/>
</Property>
<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="[57, 33]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[57, 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="btnEmployeeActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="btnEndDate">
<Properties>
<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="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="btnEndDateActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="btnStartDate">
<Properties>
<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="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="btnStartDateActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JTextField" name="m_jEndDate">
<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="[0, 30]"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Form>
@@ -0,0 +1,432 @@
// 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.epm;
import com.unicenta.basic.BasicException;
import com.unicenta.beans.JCalendarDialog;
import com.unicenta.data.gui.MessageInf;
import com.unicenta.data.loader.SentenceList;
import com.unicenta.data.user.DirtyManager;
import com.unicenta.data.user.EditorRecord;
import com.unicenta.format.Formats;
import com.unicenta.pos.forms.AppLocal;
import com.unicenta.pos.forms.AppView;
import java.awt.Component;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.Calendar;
/**
*
* @author Ali Safdar and Aneeqa Baber
*/
public final class LeavesView extends javax.swing.JPanel implements EditorRecord {
private Object m_oId;
private Object m_employeeid;
private SentenceList m_sentcat;
private DirtyManager m_Dirty;
private DataLogicPresenceManagement dlPresenceManagement;
/** Creates new form LeavesView
* @param app
* @param dirty */
public LeavesView(AppView app, DirtyManager dirty) {
dlPresenceManagement = (DataLogicPresenceManagement) app.getBean("com.unicenta.pos.epm.DataLogicPresenceManagement");
initComponents();
m_sentcat = dlPresenceManagement.getLeavesList();
m_Dirty = dirty;
m_jEmployeeName.getDocument().addDocumentListener(dirty);
m_jStartDate.getDocument().addDocumentListener(dirty);
m_jEndDate.getDocument().addDocumentListener(dirty);
m_jLeaveNote.getDocument().addDocumentListener(dirty);
writeValueEOF();
}
void activate() throws BasicException {
List a = m_sentcat.list();
a.add(0, null);
}
/**
*
*/
@Override
public void writeValueEOF() {
m_oId = null;
m_jEmployeeName.setText(null);
m_jStartDate.setText(null);
m_jEndDate.setText(null);
m_jLeaveNote.setText(null);
m_jEmployeeName.setEditable(false);
m_jStartDate.setEnabled(false);
m_jEndDate.setEnabled(false);
m_jLeaveNote.setEnabled(false);
}
/**
*
*/
@Override
public void writeValueInsert() {
m_oId = null;
m_jEmployeeName.setText(null);
m_jStartDate.setText(null);
m_jEndDate.setText(null);
m_jLeaveNote.setText(null);
m_jEmployeeName.setEditable(true);
m_jStartDate.setEnabled(true);
m_jEndDate.setEnabled(true);
m_jLeaveNote.setEnabled(true);
}
/**
*
* @param value
*/
@Override
public void writeValueEdit(Object value) {
Object[] leaves = (Object[]) value;
m_oId = leaves[0];
m_employeeid = leaves[1];
m_jEmployeeName.setText((String) leaves[2]);
m_jStartDate.setText(Formats.TIMESTAMP.formatValue((Date) leaves[3]));
m_jEndDate.setText(Formats.TIMESTAMP.formatValue((Date) leaves[4]));
m_jLeaveNote.setText((String) leaves[5]);
m_jEmployeeName.setEditable(true);
m_jStartDate.setEnabled(true);
m_jEndDate.setEnabled(true);
m_jLeaveNote.setEnabled(true);
}
/**
*
* @param value
*/
@Override
public void writeValueDelete(Object value) {
Object[] leaves = (Object[]) value;
m_oId = leaves[0];
m_employeeid = leaves[1];
m_jEmployeeName.setText((String) leaves[2]);
m_jStartDate.setText(Formats.TIMESTAMP.formatValue((Date) leaves[3]));
m_jEndDate.setText(Formats.TIMESTAMP.formatValue((Date) leaves[4]));
m_jLeaveNote.setText((String) leaves[5]);
m_jEmployeeName.setEditable(false);
m_jStartDate.setEnabled(false);
m_jEndDate.setEnabled(false);
m_jLeaveNote.setEnabled(false);
}
/**
*
*/
@Override
public void refresh() {
}
/**
*
* @return
*/
@Override
public Component getComponent() {
return this;
}
/**
*
* @return
* @throws BasicException
*/
@Override
public Object createValue() throws BasicException {
Object[] leaves = new Object[6];
leaves[0] = m_oId == null ? UUID.randomUUID().toString() : m_oId;
leaves[1] = m_employeeid;
leaves[2] = m_jEmployeeName.getText();
leaves[3] = (Date) Formats.TIMESTAMP.parseValue(m_jStartDate.getText());
leaves[4] = (Date) Formats.TIMESTAMP.parseValue(m_jEndDate.getText());
leaves[5] = m_jLeaveNote.getText();
boolean isCheckedIn = dlPresenceManagement.IsCheckedIn((String) m_employeeid);
Date startDate = (Date) Formats.TIMESTAMP.parseValue(m_jStartDate.getText());
Date endDate = (Date) Formats.TIMESTAMP.parseValue(m_jEndDate.getText());
Date systemDate = new Date();
if (isCheckedIn && startDate.before(systemDate) && endDate.after(systemDate)) {
dlPresenceManagement.BlockEmployee((String) m_employeeid);
}
return leaves;
}
// TODO - rewrite IsValidEndDate using Apache commons or Calendar
private boolean IsValidEndDate(Date date) {
Date systemDate = new Date();
if (! m_jStartDate.getText().equals("")) {
Date startdate;
try {
startdate = (Date) Formats.TIMESTAMP.parseValue(m_jStartDate.getText());
return (startdate.before(date)
|| (startdate.getDate() == date.getDate()
&& startdate.getMonth() == date.getMonth()
&& startdate.getYear() == date.getYear()));
} catch (BasicException ex) {
}
}
return (systemDate.before(date)
|| (systemDate.getDate() == date.getDate()
&& systemDate.getMonth() == date.getMonth()
&& systemDate.getYear() == date.getYear()));
}
// TODO - rewrite IsValidStartDate using Apache commons or Calendar
private boolean IsValidStartDate(Date date) {
Date systemDate = new Date();
boolean validEndDate = true;
if (! m_jEndDate.getText().equals("")) {
try {
Date enddate = (Date) Formats.TIMESTAMP.parseValue(m_jEndDate.getText());
validEndDate = (enddate.after(date)
|| (enddate.getDate() == date.getDate()
&& enddate.getMonth() == date.getMonth()
&& enddate.getYear() == date.getYear()));
} catch (BasicException ex) {
}
}
return validEndDate && (systemDate.before(date)
|| (systemDate.getDate() == date.getDate()
&& systemDate.getMonth() == date.getMonth()
&& systemDate.getYear() == date.getYear()));
}
/** 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() {
m_jEmployeeName = new javax.swing.JTextField();
jScrollPane1 = new javax.swing.JScrollPane();
m_jLeaveNote = new javax.swing.JTextArea();
m_Name = new javax.swing.JLabel();
m_StartDate = new javax.swing.JLabel();
m_EndDate = new javax.swing.JLabel();
m_jStartDate = new javax.swing.JTextField();
m_Notes = new javax.swing.JLabel();
btnEmployee = new javax.swing.JButton();
btnEndDate = new javax.swing.JButton();
btnStartDate = new javax.swing.JButton();
m_jEndDate = new javax.swing.JTextField();
m_jEmployeeName.setEditable(false);
m_jEmployeeName.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
m_jEmployeeName.setPreferredSize(new java.awt.Dimension(0, 30));
m_jLeaveNote.setColumns(20);
m_jLeaveNote.setFont(new java.awt.Font("Monospaced", 0, 14)); // NOI18N
m_jLeaveNote.setLineWrap(true);
m_jLeaveNote.setRows(5);
jScrollPane1.setViewportView(m_jLeaveNote);
m_Name.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("pos_messages"); // NOI18N
m_Name.setText(bundle.getString("label.epm.employee")); // NOI18N
m_Name.setPreferredSize(new java.awt.Dimension(0, 30));
m_StartDate.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
m_StartDate.setText(AppLocal.getIntString("label.epm.startdate")); // NOI18N
m_StartDate.setPreferredSize(new java.awt.Dimension(0, 30));
m_EndDate.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
m_EndDate.setText(AppLocal.getIntString("label.epm.enddate")); // NOI18N
m_EndDate.setPreferredSize(new java.awt.Dimension(0, 30));
m_jStartDate.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
m_jStartDate.setPreferredSize(new java.awt.Dimension(0, 30));
m_Notes.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
m_Notes.setText(AppLocal.getIntString("label.epm.notes")); // NOI18N
m_Notes.setPreferredSize(new java.awt.Dimension(0, 30));
btnEmployee.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/user_sml.png"))); // NOI18N
btnEmployee.setFocusPainted(false);
btnEmployee.setFocusable(false);
btnEmployee.setMaximumSize(new java.awt.Dimension(57, 33));
btnEmployee.setMinimumSize(new java.awt.Dimension(57, 33));
btnEmployee.setPreferredSize(new java.awt.Dimension(80, 45));
btnEmployee.setRequestFocusEnabled(false);
btnEmployee.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnEmployeeActionPerformed(evt);
}
});
btnEndDate.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/date.png"))); // NOI18N
btnEndDate.setPreferredSize(new java.awt.Dimension(80, 45));
btnEndDate.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnEndDateActionPerformed(evt);
}
});
btnStartDate.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/date.png"))); // NOI18N
btnStartDate.setPreferredSize(new java.awt.Dimension(80, 45));
btnStartDate.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnStartDateActionPerformed(evt);
}
});
m_jEndDate.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
m_jEndDate.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()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(m_Notes, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE)
.addComponent(m_EndDate, javax.swing.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE)
.addComponent(m_StartDate, javax.swing.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE)
.addComponent(m_Name, javax.swing.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(m_jEndDate, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(m_jStartDate, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(m_jEmployeeName, javax.swing.GroupLayout.DEFAULT_SIZE, 172, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btnStartDate, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnEmployee, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnEndDate, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 258, Short.MAX_VALUE))
.addGap(77, 77, 77))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(m_Name, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(m_jEmployeeName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(btnEmployee, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(m_StartDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(m_jStartDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(btnStartDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btnEndDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(m_EndDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(m_jEndDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(m_Notes, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void btnEmployeeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEmployeeActionPerformed
JEmployeeFinder finder = JEmployeeFinder.getEmployeeFinder(this, dlPresenceManagement);
finder.search(null);
finder.setVisible(true);
try {
m_jEmployeeName.setText(finder.getSelectedEmployee() == null
? null
: dlPresenceManagement.loadEmployeeExt(finder.getSelectedEmployee().getId()).toString());
m_employeeid = finder.getSelectedEmployee() == null
? null
:finder.getSelectedEmployee().getId();
} catch (BasicException e) {
MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotfindemployee"), e);
msg.show(this);
}
}//GEN-LAST:event_btnEmployeeActionPerformed
private void btnEndDateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEndDateActionPerformed
Date date;
try {
date = (Date) Formats.TIMESTAMP.parseValue(m_jEndDate.getText());
} catch (BasicException e) {
date = null;
}
date = JCalendarDialog.showCalendarTimeHours(this, date);
if (date != null) {
if (IsValidEndDate(date)) {
m_jEndDate.setText(Formats.TIMESTAMP.formatValue(date));
} else {
MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.invalidenddate"));
msg.show(this);
}
}
}//GEN-LAST:event_btnEndDateActionPerformed
private void btnStartDateActionPerformed(java.awt.event.ActionEvent evt) {
Date date;
try {
date = (Date) Formats.TIMESTAMP.parseValue(m_jStartDate.getText());
} catch (BasicException e) {
date = null;
}
date = JCalendarDialog.showCalendarTimeHours(this, date);
if (date != null) {
if (IsValidStartDate(date)) {
m_jStartDate.setText(Formats.TIMESTAMP.formatValue(date));
} else {
MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.invalidstartdate"));
msg.show(this);
}
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnEmployee;
private javax.swing.JButton btnEndDate;
private javax.swing.JButton btnStartDate;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JLabel m_EndDate;
private javax.swing.JLabel m_Name;
private javax.swing.JLabel m_Notes;
private javax.swing.JLabel m_StartDate;
private javax.swing.JTextField m_jEmployeeName;
private javax.swing.JTextField m_jEndDate;
private javax.swing.JTextArea m_jLeaveNote;
private javax.swing.JTextField m_jStartDate;
// End of variables declaration//GEN-END:variables
}