5.0 Source Code
Committing 5.0 Source Code
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
|
||||
<EmptyBorder bottom="5" left="5" right="5" top="5"/>
|
||||
</Border>
|
||||
</Property>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanelHeader">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="North"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanelFilter">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="Center"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel1">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="South"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
|
||||
<Property name="alignment" type="int" value="2"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JToggleButton" name="jToggleFilter">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/com/unicenta/images/1downarrow.png"/>
|
||||
</Property>
|
||||
<Property name="selected" type="boolean" value="true"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Hide/Show Filter"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[80, 45]"/>
|
||||
</Property>
|
||||
<Property name="selectedIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/com/unicenta/images/1uparrow.png"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jToggleFilterActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<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/ok.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="button.executereport" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Execute Report"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[150, 45]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,330 @@
|
||||
// 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.reports;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.gui.MessageInf;
|
||||
import com.unicenta.data.loader.BaseSentence;
|
||||
import com.unicenta.data.loader.SentenceList;
|
||||
import com.unicenta.data.loader.Session;
|
||||
import com.unicenta.data.user.EditorCreator;
|
||||
import com.unicenta.pos.forms.*;
|
||||
import com.unicenta.pos.sales.TaxesLogic;
|
||||
import com.unicenta.pos.util.JRViewer400;
|
||||
import java.awt.BorderLayout;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.sql.Connection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
import net.sf.jasperreports.engine.*;
|
||||
import net.sf.jasperreports.engine.design.JasperDesign;
|
||||
import net.sf.jasperreports.engine.xml.JRXmlLoader;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
public abstract class JPanelReport extends JPanel implements JPanelView, BeanFactoryApp {
|
||||
|
||||
private JRViewer400 reportviewer = null;
|
||||
private JasperReport jr = null;
|
||||
private EditorCreator editor = null;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected AppView m_App;
|
||||
private Session s;
|
||||
private Connection con;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected SentenceList taxsent;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected TaxesLogic taxeslogic;
|
||||
|
||||
/** Creates new form JPanelReport */
|
||||
public JPanelReport() {
|
||||
|
||||
initComponents();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param app
|
||||
* @throws BeanFactoryException
|
||||
*/
|
||||
@Override
|
||||
public void init(AppView app) throws BeanFactoryException {
|
||||
|
||||
m_App = app;
|
||||
|
||||
DataLogicSales dlSales = (DataLogicSales) app.getBean("com.unicenta.pos.forms.DataLogicSales");
|
||||
taxsent = dlSales.getTaxList();
|
||||
|
||||
editor = getEditorCreator();
|
||||
if (editor instanceof ReportEditorCreator) {
|
||||
jPanelFilter.add(((ReportEditorCreator) editor).getComponent(), BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
reportviewer = new JRViewer400(null);
|
||||
|
||||
add(reportviewer, BorderLayout.CENTER);
|
||||
|
||||
try {
|
||||
|
||||
InputStream in = getClass().getResourceAsStream(getReport() + ".ser");
|
||||
if (in == null) {
|
||||
// read and compile the report
|
||||
JasperDesign jd = JRXmlLoader.load(getClass().getResourceAsStream(getReport() + ".jrxml"));
|
||||
jr = JasperCompileManager.compileReport(jd);
|
||||
} else {
|
||||
// JG 16 May 12 use try-with-resources
|
||||
try (ObjectInputStream oin = new ObjectInputStream(in)) {
|
||||
jr = (JasperReport) oin.readObject();
|
||||
}
|
||||
}
|
||||
// JG 16 May 12 use multicatch
|
||||
} catch (JRException | IOException | ClassNotFoundException e) {
|
||||
MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotloadreport"), e);
|
||||
msg.show(this);
|
||||
jr = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object getBean() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected abstract String getReport();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected abstract String getResourceBundle();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected abstract BaseSentence getSentence();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected abstract ReportFields getReportFields();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected EditorCreator getEditorCreator() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public JComponent getComponent() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public void activate() throws BasicException {
|
||||
|
||||
setVisibleFilter(true);
|
||||
taxeslogic = new TaxesLogic(taxsent.list());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean deactivate() {
|
||||
|
||||
reportviewer.loadJasperPrint(null);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
protected void setVisibleButtonFilter(boolean value) {
|
||||
jToggleFilter.setVisible(value);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
protected void setVisibleFilter(boolean value) {
|
||||
jToggleFilter.setSelected(value);
|
||||
jToggleFilterActionPerformed(null);
|
||||
}
|
||||
|
||||
private void launchreport() {
|
||||
|
||||
m_App.waitCursorBegin();
|
||||
|
||||
if (jr != null) {
|
||||
try {
|
||||
|
||||
// Archivo de recursos
|
||||
String res = getResourceBundle();
|
||||
|
||||
// Parametros y los datos
|
||||
Object params = (editor == null) ? null : editor.createValue();
|
||||
JRDataSource data = new JRDataSourceBasic(getSentence(), getReportFields(), params);
|
||||
|
||||
// Construyo el mapa de los parametros.
|
||||
Map reportparams = new HashMap();
|
||||
reportparams.put("ARG", params);
|
||||
if (res != null) {
|
||||
reportparams.put("REPORT_RESOURCE_BUNDLE", ResourceBundle.getBundle(res));
|
||||
}
|
||||
reportparams.put("TAXESLOGIC", taxeslogic);
|
||||
|
||||
JasperPrint jp = JasperFillManager.fillReport(jr, reportparams, data);
|
||||
|
||||
reportviewer.loadJasperPrint(jp);
|
||||
|
||||
setVisibleFilter(false);
|
||||
|
||||
} catch (MissingResourceException e) {
|
||||
MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotloadresourcedata"), e);
|
||||
msg.show(this);
|
||||
} catch (JRException e) {
|
||||
MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotfillreport"), e);
|
||||
msg.show(this);
|
||||
} catch (BasicException e) {
|
||||
MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotloadreportdata"), e);
|
||||
msg.show(this);
|
||||
}
|
||||
}
|
||||
|
||||
m_App.waitCursorEnd();
|
||||
}
|
||||
|
||||
/** 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() {
|
||||
|
||||
jPanelHeader = new javax.swing.JPanel();
|
||||
jPanelFilter = new javax.swing.JPanel();
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
jToggleFilter = new javax.swing.JToggleButton();
|
||||
jButton1 = new javax.swing.JButton();
|
||||
|
||||
setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jPanelHeader.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
jPanelFilter.setLayout(new java.awt.BorderLayout());
|
||||
jPanelHeader.add(jPanelFilter, java.awt.BorderLayout.CENTER);
|
||||
|
||||
jPanel1.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
|
||||
|
||||
jToggleFilter.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/1downarrow.png"))); // NOI18N
|
||||
jToggleFilter.setSelected(true);
|
||||
jToggleFilter.setToolTipText("Hide/Show Filter");
|
||||
jToggleFilter.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
jToggleFilter.setSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/1uparrow.png"))); // NOI18N
|
||||
jToggleFilter.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jToggleFilterActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel1.add(jToggleFilter);
|
||||
|
||||
jButton1.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/ok.png"))); // NOI18N
|
||||
jButton1.setText(AppLocal.getIntString("button.executereport")); // NOI18N
|
||||
jButton1.setToolTipText("Execute Report");
|
||||
jButton1.setPreferredSize(new java.awt.Dimension(150, 45));
|
||||
jButton1.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jButton1ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel1.add(jButton1);
|
||||
|
||||
jPanelHeader.add(jPanel1, java.awt.BorderLayout.SOUTH);
|
||||
|
||||
add(jPanelHeader, java.awt.BorderLayout.NORTH);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
|
||||
|
||||
launchreport();
|
||||
|
||||
}//GEN-LAST:event_jButton1ActionPerformed
|
||||
|
||||
private void jToggleFilterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleFilterActionPerformed
|
||||
|
||||
jPanelFilter.setVisible(jToggleFilter.isSelected());
|
||||
|
||||
}//GEN-LAST:event_jToggleFilterActionPerformed
|
||||
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton jButton1;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JPanel jPanelFilter;
|
||||
private javax.swing.JPanel jPanelHeader;
|
||||
private javax.swing.JToggleButton jToggleFilter;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,0,111,0,0,1,-124"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout">
|
||||
<Property name="axis" type="int" value="1"/>
|
||||
</Layout>
|
||||
</Form>
|
||||
@@ -0,0 +1,142 @@
|
||||
// uniCenta oPOS - Touch Friendly Point Of Sale
|
||||
// Copyright (c) 2009-2018 uniCenta & previous Openbravo POS works
|
||||
// https://unicenta.com
|
||||
//
|
||||
// This file is part of uniCenta oPOS
|
||||
//
|
||||
// uniCenta oPOS is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// uniCenta oPOS is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package com.unicenta.pos.reports;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.loader.SerializerWrite;
|
||||
import com.unicenta.data.loader.SerializerWriteComposed;
|
||||
import com.unicenta.pos.forms.AppView;
|
||||
import java.awt.Component;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
public class JParamsComposed extends javax.swing.JPanel implements ReportEditorCreator {
|
||||
|
||||
// JG 16 May 12 use diamond inference
|
||||
private List<ReportEditorCreator> editors = new ArrayList<>();
|
||||
|
||||
/** Creates new form JParamsComposed */
|
||||
public JParamsComposed() {
|
||||
initComponents();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param app
|
||||
*/
|
||||
@Override
|
||||
public void init(AppView app) {
|
||||
for (ReportEditorCreator qbff : editors) {
|
||||
qbff.init(app);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public void activate() throws BasicException {
|
||||
for (ReportEditorCreator qbff : editors) {
|
||||
qbff.activate();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SerializerWrite getSerializerWrite() {
|
||||
|
||||
SerializerWriteComposed sw = new SerializerWriteComposed();
|
||||
|
||||
for (ReportEditorCreator qbff : editors) {
|
||||
sw.add(qbff.getSerializerWrite());
|
||||
}
|
||||
|
||||
return sw;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Component getComponent() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public Object createValue() throws BasicException {
|
||||
|
||||
Object[] value = new Object[editors.size()];
|
||||
|
||||
for(int i = 0; i < editors.size(); i++) {
|
||||
value[i] = editors.get(i).createValue();
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param c
|
||||
*/
|
||||
public void addEditor(ReportEditorCreator c) {
|
||||
editors.add(c);
|
||||
add(c.getComponent());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
|
||||
return editors.isEmpty();
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
*/
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.Y_AXIS));
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.5" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[550, 50]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AccessibilityProperties>
|
||||
<Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="label.bycustomer" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</Property>
|
||||
</AccessibilityProperties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jTextField1" min="-2" pref="300" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnCustomer" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jTextField1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="btnCustomer" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTextField" name="jTextField1">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[250, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnCustomer">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/com/unicenta/images/customer_sml.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Get Customers"/>
|
||||
<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="btnCustomerActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="label.customer" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,204 @@
|
||||
// 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.reports;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.loader.Datas;
|
||||
import com.unicenta.data.loader.QBFCompareEnum;
|
||||
import com.unicenta.data.loader.SerializerWrite;
|
||||
import com.unicenta.data.loader.SerializerWriteBasic;
|
||||
import com.unicenta.pos.customers.CustomerInfo;
|
||||
import com.unicenta.pos.customers.DataLogicCustomers;
|
||||
import com.unicenta.pos.customers.JCustomerFinder;
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
import com.unicenta.pos.forms.AppView;
|
||||
import java.awt.Component;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author adrianromero
|
||||
*/
|
||||
public class JParamsCustomer extends javax.swing.JPanel implements ReportEditorCreator {
|
||||
|
||||
private DataLogicCustomers dlCustomers;
|
||||
private CustomerInfo currentcustomer;
|
||||
|
||||
/** Creates new form JParamsCustomer */
|
||||
public JParamsCustomer() {
|
||||
|
||||
initComponents();
|
||||
|
||||
jTextField1.getDocument().addDocumentListener(new DocumentListener() {
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
currentcustomer = null;
|
||||
}
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e) {
|
||||
currentcustomer = null;
|
||||
}
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e) {
|
||||
currentcustomer = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param app
|
||||
*/
|
||||
@Override
|
||||
public void init(AppView app) {
|
||||
dlCustomers = (DataLogicCustomers) app.getBean("com.unicenta.pos.customers.DataLogicCustomers");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public void activate() throws BasicException {
|
||||
|
||||
currentcustomer = null;
|
||||
jTextField1.setText(null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SerializerWrite getSerializerWrite() {
|
||||
return new SerializerWriteBasic(new Datas[] {Datas.OBJECT, Datas.STRING, Datas.OBJECT, Datas.STRING});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Component getComponent() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public Object createValue() throws BasicException {
|
||||
|
||||
if (currentcustomer == null) {
|
||||
if (jTextField1.getText() == null || jTextField1.getText().equals("")) {
|
||||
return new Object[] {QBFCompareEnum.COMP_NONE, null, QBFCompareEnum.COMP_NONE, null};
|
||||
} else {
|
||||
return new Object[] {QBFCompareEnum.COMP_NONE, null, QBFCompareEnum.COMP_RE, jTextField1.getText()};
|
||||
}
|
||||
} else {
|
||||
return new Object[] {QBFCompareEnum.COMP_EQUALS, currentcustomer.getId(), QBFCompareEnum.COMP_NONE, null};
|
||||
}
|
||||
}
|
||||
|
||||
/** 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() {
|
||||
|
||||
jTextField1 = new javax.swing.JTextField();
|
||||
btnCustomer = new javax.swing.JButton();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
|
||||
setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
setPreferredSize(new java.awt.Dimension(550, 50));
|
||||
|
||||
jTextField1.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jTextField1.setPreferredSize(new java.awt.Dimension(250, 30));
|
||||
|
||||
btnCustomer.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/customer_sml.png"))); // NOI18N
|
||||
btnCustomer.setToolTipText("Get Customers");
|
||||
btnCustomer.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
btnCustomer.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnCustomerActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel2.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel2.setText(AppLocal.getIntString("label.customer")); // NOI18N
|
||||
jLabel2.setPreferredSize(new java.awt.Dimension(110, 30));
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnCustomer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(btnCustomer, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("pos_messages"); // NOI18N
|
||||
getAccessibleContext().setAccessibleName(bundle.getString("label.bycustomer")); // NOI18N
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void btnCustomerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCustomerActionPerformed
|
||||
|
||||
JCustomerFinder finder = JCustomerFinder.getCustomerFinder(this, dlCustomers);
|
||||
finder.search(currentcustomer);
|
||||
finder.setVisible(true);
|
||||
currentcustomer = finder.getSelectedCustomer();
|
||||
if (currentcustomer == null) {
|
||||
jTextField1.setText(null);
|
||||
} else {
|
||||
jTextField1.setText(currentcustomer.getName());
|
||||
}
|
||||
|
||||
}//GEN-LAST:event_btnCustomerActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton btnCustomer;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JTextField jTextField1;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[750, 50]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jTxtStartDate" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnDateStart" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jTxtEndDate" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnDateEnd" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jTxtEndDate" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="btnDateStart" alignment="0" pref="0" max="32767" attributes="0"/>
|
||||
<Group type="103" alignment="1" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jTxtStartDate" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="btnDateEnd" alignment="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="label.StartDate" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="jTxtStartDate">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[160, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value="JParamsDatesInterval_jTxtStartDate"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="label.EndDate" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="jTxtEndDate">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[160, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnDateStart">
|
||||
<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="toolTipText" type="java.lang.String" value="Open Calendar"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[40, 33]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[40, 33]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[80, 45]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnDateStartActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnDateEnd">
|
||||
<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="toolTipText" type="java.lang.String" value="Open Calendar"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[40, 33]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[40, 33]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[80, 45]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnDateEndActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,242 @@
|
||||
// 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.reports;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.beans.JCalendarDialog;
|
||||
import com.unicenta.data.loader.Datas;
|
||||
import com.unicenta.data.loader.QBFCompareEnum;
|
||||
import com.unicenta.data.loader.SerializerWrite;
|
||||
import com.unicenta.data.loader.SerializerWriteBasic;
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
public class JParamsDatesInterval extends javax.swing.JPanel implements ReportEditorCreator {
|
||||
|
||||
/** Creates new form JParamsClosedPos */
|
||||
public JParamsDatesInterval() {
|
||||
initComponents();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param d
|
||||
*/
|
||||
public void setStartDate(Date d) {
|
||||
jTxtStartDate.setText(Formats.TIMESTAMP.formatValue(d));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param d
|
||||
*/
|
||||
public void setEndDate(Date d) {
|
||||
jTxtEndDate.setText(Formats.TIMESTAMP.formatValue(d));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param app
|
||||
*/
|
||||
@Override
|
||||
public void init(AppView app) {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public void activate() throws BasicException {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SerializerWrite getSerializerWrite() {
|
||||
return new SerializerWriteBasic(new Datas[] {Datas.OBJECT, Datas.TIMESTAMP, Datas.OBJECT, Datas.TIMESTAMP});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Component getComponent() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public Object createValue() throws BasicException {
|
||||
Object startdate = Formats.TIMESTAMP.parseValue(jTxtStartDate.getText());
|
||||
Object enddate = Formats.TIMESTAMP.parseValue(jTxtEndDate.getText());
|
||||
|
||||
return new Object[] {
|
||||
startdate == null ? QBFCompareEnum.COMP_NONE : QBFCompareEnum.COMP_GREATEROREQUALS,
|
||||
startdate,
|
||||
enddate == null ? QBFCompareEnum.COMP_NONE : QBFCompareEnum.COMP_LESS,
|
||||
enddate
|
||||
};
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
*/
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
jTxtStartDate = new javax.swing.JTextField();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
jTxtEndDate = new javax.swing.JTextField();
|
||||
btnDateStart = new javax.swing.JButton();
|
||||
btnDateEnd = new javax.swing.JButton();
|
||||
|
||||
setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
setPreferredSize(new java.awt.Dimension(750, 50));
|
||||
|
||||
jLabel1.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel1.setText(AppLocal.getIntString("label.StartDate")); // NOI18N
|
||||
jLabel1.setPreferredSize(new java.awt.Dimension(110, 30));
|
||||
|
||||
jTxtStartDate.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jTxtStartDate.setPreferredSize(new java.awt.Dimension(160, 30));
|
||||
|
||||
jLabel2.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel2.setText(AppLocal.getIntString("label.EndDate")); // NOI18N
|
||||
jLabel2.setPreferredSize(new java.awt.Dimension(110, 30));
|
||||
|
||||
jTxtEndDate.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jTxtEndDate.setPreferredSize(new java.awt.Dimension(160, 30));
|
||||
|
||||
btnDateStart.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/date.png"))); // NOI18N
|
||||
btnDateStart.setToolTipText("Open Calendar");
|
||||
btnDateStart.setMaximumSize(new java.awt.Dimension(40, 33));
|
||||
btnDateStart.setMinimumSize(new java.awt.Dimension(40, 33));
|
||||
btnDateStart.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
btnDateStart.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnDateStartActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
btnDateEnd.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/date.png"))); // NOI18N
|
||||
btnDateEnd.setToolTipText("Open Calendar");
|
||||
btnDateEnd.setMaximumSize(new java.awt.Dimension(40, 33));
|
||||
btnDateEnd.setMinimumSize(new java.awt.Dimension(40, 33));
|
||||
btnDateEnd.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
btnDateEnd.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnDateEndActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jTxtStartDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnDateStart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jTxtEndDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnDateEnd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jTxtEndDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(btnDateStart, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jTxtStartDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(btnDateEnd, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void btnDateStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDateStartActionPerformed
|
||||
|
||||
Date date;
|
||||
try {
|
||||
date = (Date) Formats.TIMESTAMP.parseValue(jTxtStartDate.getText());
|
||||
} catch (BasicException e) {
|
||||
date = null;
|
||||
}
|
||||
date = JCalendarDialog.showCalendarTimeHours(this, date);
|
||||
if (date != null) {
|
||||
jTxtStartDate.setText(Formats.TIMESTAMP.formatValue(date));
|
||||
}
|
||||
}//GEN-LAST:event_btnDateStartActionPerformed
|
||||
|
||||
private void btnDateEndActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDateEndActionPerformed
|
||||
|
||||
Date date;
|
||||
try {
|
||||
date = (Date) Formats.TIMESTAMP.parseValue(jTxtEndDate.getText());
|
||||
} catch (BasicException e) {
|
||||
date = null;
|
||||
}
|
||||
date = JCalendarDialog.showCalendarTimeHours(this, date);
|
||||
if (date != null) {
|
||||
jTxtEndDate.setText(Formats.TIMESTAMP.formatValue(date));
|
||||
}
|
||||
}//GEN-LAST:event_btnDateEndActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton btnDateEnd;
|
||||
private javax.swing.JButton btnDateStart;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JTextField jTxtEndDate;
|
||||
private javax.swing.JTextField jTxtStartDate;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[384, 50]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel8" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="m_jLocation" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="-2" pref="11" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="m_jLocation" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JComboBox" name="m_jLocation">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[250, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel8">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="label.warehouse" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,179 @@
|
||||
// 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.reports;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.gui.ComboBoxValModel;
|
||||
import com.unicenta.data.loader.*;
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
import com.unicenta.pos.forms.AppView;
|
||||
import com.unicenta.pos.forms.DataLogicSales;
|
||||
import java.awt.Component;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author adrianromero
|
||||
*/
|
||||
public class JParamsLocation extends javax.swing.JPanel implements ReportEditorCreator {
|
||||
|
||||
private SentenceList m_sentlocations;
|
||||
private ComboBoxValModel m_LocationsModel;
|
||||
|
||||
/** Creates new form JParamsLocation */
|
||||
public JParamsLocation() {
|
||||
initComponents();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param app
|
||||
*/
|
||||
@Override
|
||||
public void init(AppView app) {
|
||||
|
||||
DataLogicSales dlSales = (DataLogicSales) app.getBean("com.unicenta.pos.forms.DataLogicSales");
|
||||
|
||||
// El modelo de locales
|
||||
m_sentlocations = dlSales.getLocationsList();
|
||||
m_LocationsModel = new ComboBoxValModel();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public void activate() throws BasicException {
|
||||
List a = m_sentlocations.list();
|
||||
addFirst(a);
|
||||
m_LocationsModel = new ComboBoxValModel(a);
|
||||
m_LocationsModel.setSelectedFirst();
|
||||
m_jLocation.setModel(m_LocationsModel); // refresh model
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SerializerWrite getSerializerWrite() {
|
||||
return new SerializerWriteBasic(new Datas[] {Datas.OBJECT, Datas.STRING});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Component getComponent() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param a
|
||||
*/
|
||||
protected void addFirst(List a) {
|
||||
a.add(0, null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param l
|
||||
*/
|
||||
public void addActionListener(ActionListener l) {
|
||||
m_jLocation.addActionListener(l);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param l
|
||||
*/
|
||||
public void removeActionListener(ActionListener l) {
|
||||
m_jLocation.removeActionListener(l);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public Object createValue() throws BasicException {
|
||||
|
||||
return new Object[] {
|
||||
m_LocationsModel.getSelectedKey() == null
|
||||
? QBFCompareEnum.COMP_NONE
|
||||
: QBFCompareEnum.COMP_EQUALS,
|
||||
m_LocationsModel.getSelectedKey()
|
||||
};
|
||||
}
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
*/
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
m_jLocation = new javax.swing.JComboBox();
|
||||
jLabel8 = new javax.swing.JLabel();
|
||||
|
||||
setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
setPreferredSize(new java.awt.Dimension(384, 50));
|
||||
|
||||
m_jLocation.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
m_jLocation.setPreferredSize(new java.awt.Dimension(250, 30));
|
||||
|
||||
jLabel8.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel8.setText(AppLocal.getIntString("label.warehouse")); // NOI18N
|
||||
jLabel8.setPreferredSize(new java.awt.Dimension(110, 30));
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(m_jLocation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGap(11, 11, 11)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(m_jLocation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap())
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JLabel jLabel8;
|
||||
private javax.swing.JComboBox m_jLocation;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
// 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.reports;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author adrian
|
||||
*/
|
||||
public class JParamsLocationWithFirst extends JParamsLocation {
|
||||
|
||||
/** Creates a new instance of JParamsLocationWithFirst */
|
||||
public JParamsLocationWithFirst() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param a
|
||||
*/
|
||||
@Override
|
||||
protected void addFirst(List a) {
|
||||
a.add(0, null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[400, 50]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="m_jreason" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="m_jreason" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="label.stockreason" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="m_jreason">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="maximumRowCount" type="int" value="12"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[250, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,161 @@
|
||||
// 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.reports;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.gui.ComboBoxValModel;
|
||||
import com.unicenta.data.loader.Datas;
|
||||
import com.unicenta.data.loader.QBFCompareEnum;
|
||||
import com.unicenta.data.loader.SerializerWrite;
|
||||
import com.unicenta.data.loader.SerializerWriteBasic;
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
import com.unicenta.pos.forms.AppView;
|
||||
import com.unicenta.pos.inventory.MovementReason;
|
||||
import java.awt.Component;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
public class JParamsReason extends javax.swing.JPanel implements ReportEditorCreator {
|
||||
|
||||
private ComboBoxValModel m_ReasonModel;
|
||||
|
||||
/** Creates new form JParamsReason */
|
||||
public JParamsReason() {
|
||||
initComponents();
|
||||
|
||||
m_ReasonModel = new ComboBoxValModel();
|
||||
m_ReasonModel.add(null);
|
||||
m_ReasonModel.add(MovementReason.IN_PURCHASE); //Supplier Purchase
|
||||
m_ReasonModel.add(MovementReason.OUT_SALE); //Sale
|
||||
m_ReasonModel.add(MovementReason.IN_REFUND); //Customer Refund
|
||||
m_ReasonModel.add(MovementReason.OUT_REFUND); //Supplier Return
|
||||
m_ReasonModel.add(MovementReason.IN_MOVEMENT); //Adjust Add
|
||||
m_ReasonModel.add(MovementReason.OUT_MOVEMENT); //Adjust Subtract
|
||||
m_ReasonModel.add(MovementReason.OUT_SUBTRACT); //Rectify error per JM requirement
|
||||
m_ReasonModel.add(MovementReason.OUT_BREAK); //Breakage
|
||||
m_ReasonModel.add(MovementReason.OUT_FREE); //Given Free
|
||||
m_ReasonModel.add(MovementReason.OUT_SAMPLE); //Given Sample
|
||||
m_ReasonModel.add(MovementReason.OUT_USED); //Used item
|
||||
m_ReasonModel.add(MovementReason.OUT_CROSSING); //Inter-Location move
|
||||
|
||||
m_jreason.setModel(m_ReasonModel);
|
||||
// m_jreason.setSelectedItem(null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param app
|
||||
*/
|
||||
@Override
|
||||
public void init(AppView app) {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public void activate() throws BasicException {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SerializerWrite getSerializerWrite() {
|
||||
return new SerializerWriteBasic(new Datas[] {Datas.OBJECT, Datas.INT});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Component getComponent() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public Object createValue() throws BasicException {
|
||||
|
||||
return new Object[] {
|
||||
m_ReasonModel.getSelectedItem() == null ? QBFCompareEnum.COMP_NONE : QBFCompareEnum.COMP_EQUALS, m_ReasonModel.getSelectedKey()
|
||||
};
|
||||
}
|
||||
|
||||
/** 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() {
|
||||
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
m_jreason = new javax.swing.JComboBox();
|
||||
|
||||
setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
setPreferredSize(new java.awt.Dimension(400, 50));
|
||||
|
||||
jLabel2.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel2.setText(AppLocal.getIntString("label.stockreason")); // NOI18N
|
||||
jLabel2.setPreferredSize(new java.awt.Dimension(110, 30));
|
||||
|
||||
m_jreason.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
m_jreason.setMaximumRowCount(12);
|
||||
m_jreason.setPreferredSize(new java.awt.Dimension(250, 30));
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(m_jreason, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(m_jreason, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap())
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JComboBox m_jreason;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.5" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[550, 50]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AccessibilityProperties>
|
||||
<Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="label.bycustomer" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/>
|
||||
</Property>
|
||||
</AccessibilityProperties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jTextField1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnSupplier" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jTextField1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="btnSupplier" min="-2" pref="34" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTextField" name="jTextField1">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[300, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnSupplier">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/com/unicenta/images/customer_sml.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Get Suppliers"/>
|
||||
<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="btnSupplierActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="label.supplier" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,207 @@
|
||||
// uniCenta oPOS - Touch Friendly Point Of Sale
|
||||
// Copyright (c) 2009-2016 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.reports;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.loader.Datas;
|
||||
import com.unicenta.data.loader.QBFCompareEnum;
|
||||
import com.unicenta.data.loader.SerializerWrite;
|
||||
import com.unicenta.data.loader.SerializerWriteBasic;
|
||||
import com.unicenta.pos.suppliers.SupplierInfo;
|
||||
import com.unicenta.pos.suppliers.DataLogicSuppliers;
|
||||
import com.unicenta.pos.suppliers.JSupplierFinder;
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
import com.unicenta.pos.forms.AppView;
|
||||
import java.awt.Component;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jack Gerrard
|
||||
*/
|
||||
public class JParamsSuppliers extends javax.swing.JPanel implements ReportEditorCreator {
|
||||
|
||||
private DataLogicSuppliers dlSuppliers;
|
||||
private SupplierInfo currentsupplier;
|
||||
|
||||
/** Creates new form JParamsSupplier */
|
||||
public JParamsSuppliers() {
|
||||
|
||||
initComponents();
|
||||
|
||||
jTextField1.getDocument().addDocumentListener(new DocumentListener() {
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
currentsupplier = null;
|
||||
}
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e) {
|
||||
currentsupplier = null;
|
||||
}
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e) {
|
||||
currentsupplier = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param app
|
||||
*/
|
||||
@Override
|
||||
public void init(AppView app) {
|
||||
dlSuppliers = (DataLogicSuppliers) app.getBean("com.unicenta.pos.suppliers.DataLogicSuppliers");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public void activate() throws BasicException {
|
||||
|
||||
currentsupplier = null;
|
||||
jTextField1.setText(null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SerializerWrite getSerializerWrite() {
|
||||
return new SerializerWriteBasic(new Datas[] {Datas.OBJECT, Datas.STRING, Datas.OBJECT, Datas.STRING});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Component getComponent() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public Object createValue() throws BasicException {
|
||||
|
||||
if (currentsupplier == null) {
|
||||
if (jTextField1.getText() == null || jTextField1.getText().equals("")) {
|
||||
return new Object[] {QBFCompareEnum.COMP_NONE, null, QBFCompareEnum.COMP_NONE, null};
|
||||
} else {
|
||||
return new Object[] {QBFCompareEnum.COMP_NONE, null, QBFCompareEnum.COMP_RE, jTextField1.getText()};
|
||||
}
|
||||
} else {
|
||||
return new Object[] {QBFCompareEnum.COMP_EQUALS, currentsupplier.getID(), QBFCompareEnum.COMP_NONE, null};
|
||||
}
|
||||
}
|
||||
|
||||
/** 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() {
|
||||
|
||||
jTextField1 = new javax.swing.JTextField();
|
||||
btnSupplier = new javax.swing.JButton();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
|
||||
setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
setPreferredSize(new java.awt.Dimension(550, 50));
|
||||
|
||||
jTextField1.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jTextField1.setPreferredSize(new java.awt.Dimension(300, 30));
|
||||
|
||||
btnSupplier.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/customer_sml.png"))); // NOI18N
|
||||
btnSupplier.setToolTipText("Get Suppliers");
|
||||
btnSupplier.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
btnSupplier.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnSupplierActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel2.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel2.setText(AppLocal.getIntString("label.supplier")); // NOI18N
|
||||
jLabel2.setPreferredSize(new java.awt.Dimension(110, 30));
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnSupplier, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(14, 14, 14))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addComponent(btnSupplier, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())))
|
||||
);
|
||||
|
||||
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("pos_messages"); // NOI18N
|
||||
getAccessibleContext().setAccessibleName(bundle.getString("label.bycustomer")); // NOI18N
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void btnSupplierActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSupplierActionPerformed
|
||||
|
||||
JSupplierFinder finder = JSupplierFinder.getSupplierFinder(this, dlSuppliers);
|
||||
finder.search(currentsupplier);
|
||||
finder.setVisible(true);
|
||||
currentsupplier = finder.getSelectedSupplier();
|
||||
if (currentsupplier == null) {
|
||||
jTextField1.setText(null);
|
||||
} else {
|
||||
jTextField1.setText(currentsupplier.getName());
|
||||
}
|
||||
|
||||
}//GEN-LAST:event_btnSupplierActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton btnSupplier;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JTextField jTextField1;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.5" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[0, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,0,43,0,0,1,-64"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
|
||||
<Property name="useNullLayout" type="boolean" value="true"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="lblField">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="***"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[0, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="20" y="10" width="120" height="-1"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="txtField">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[0, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
|
||||
<AbsoluteConstraints x="140" y="10" width="200" height="-1"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,234 @@
|
||||
// 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.reports;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.loader.Datas;
|
||||
import com.unicenta.data.loader.QBFCompareEnum;
|
||||
import com.unicenta.data.loader.SerializerWrite;
|
||||
import com.unicenta.data.loader.SerializerWriteBasic;
|
||||
import com.unicenta.format.Formats;
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
import com.unicenta.pos.forms.AppView;
|
||||
import java.awt.Component;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author adrianromero
|
||||
*/
|
||||
public final class JParamsText extends javax.swing.JPanel implements ReportEditorCreator {
|
||||
|
||||
private Datas datasvalue;
|
||||
private Formats formatsvalue;
|
||||
private QBFCompareEnum comparevalue;
|
||||
|
||||
/** Creates new form JParamsText */
|
||||
public JParamsText() {
|
||||
initComponents();
|
||||
|
||||
setLabel(AppLocal.getIntString("label.value"));
|
||||
setType(Formats.STRING);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param label
|
||||
*/
|
||||
public JParamsText(String label) {
|
||||
|
||||
initComponents();
|
||||
|
||||
setLabel(label);
|
||||
setType(Formats.STRING);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param label
|
||||
* @param format
|
||||
*/
|
||||
public JParamsText(String label, Formats format) {
|
||||
|
||||
initComponents();
|
||||
|
||||
setLabel(label);
|
||||
setType(format);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param label
|
||||
* @param format
|
||||
* @param data
|
||||
*/
|
||||
public JParamsText(String label, Formats format, Datas data) {
|
||||
|
||||
initComponents();
|
||||
|
||||
setLabel(label);
|
||||
setType(format, data);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param label
|
||||
*/
|
||||
public void setLabel(String label) {
|
||||
lblField.setText(label);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param format
|
||||
* @param data
|
||||
*/
|
||||
public void setType(Formats format, Datas data) {
|
||||
formatsvalue = format;
|
||||
datasvalue = data;
|
||||
setDefaultCompare();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param format
|
||||
*/
|
||||
public void setType(Formats format) {
|
||||
|
||||
if (Formats.INT == format) {
|
||||
setType(format, Datas.INT);
|
||||
} else if (Formats.DOUBLE == format || Formats.CURRENCY == format || Formats.PERCENT == format) {
|
||||
setType(format, Datas.DOUBLE);
|
||||
} else if (Formats.DATE == format || Formats.TIME == format || Formats.TIMESTAMP == format) {
|
||||
setType(format, Datas.TIMESTAMP);
|
||||
} else if (Formats.BOOLEAN == format) {
|
||||
setType(format, Datas.BOOLEAN);
|
||||
} else { // if (Formats.STRING == format) {
|
||||
setType(format, Datas.STRING);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param compare
|
||||
*/
|
||||
public void setCompare(QBFCompareEnum compare) {
|
||||
comparevalue = compare;
|
||||
}
|
||||
|
||||
private void setDefaultCompare() {
|
||||
if (Formats.INT == formatsvalue) {
|
||||
comparevalue = QBFCompareEnum.COMP_LESSOREQUALS;
|
||||
} else if (Formats.DOUBLE == formatsvalue || Formats.CURRENCY == formatsvalue || Formats.PERCENT == formatsvalue) {
|
||||
comparevalue = QBFCompareEnum.COMP_LESSOREQUALS;
|
||||
} else if (Formats.DATE == formatsvalue || Formats.TIME == formatsvalue || Formats.TIMESTAMP == formatsvalue) {
|
||||
comparevalue = QBFCompareEnum.COMP_GREATEROREQUALS;
|
||||
} else if (Formats.BOOLEAN == formatsvalue) {
|
||||
comparevalue = QBFCompareEnum.COMP_EQUALS;
|
||||
} else { // if (Formats.STRING == formatsvalue) {
|
||||
comparevalue = QBFCompareEnum.COMP_RE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param app
|
||||
*/
|
||||
@Override
|
||||
public void init(AppView app) {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public void activate() throws BasicException {
|
||||
txtField.setText(null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SerializerWrite getSerializerWrite() {
|
||||
return new SerializerWriteBasic(new Datas[] {Datas.OBJECT, datasvalue});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Component getComponent() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public Object createValue() throws BasicException {
|
||||
|
||||
Object value = formatsvalue.parseValue(txtField.getText());
|
||||
txtField.setText(formatsvalue.formatValue(value));
|
||||
|
||||
if (value == null) {
|
||||
return new Object[] {QBFCompareEnum.COMP_NONE, null};
|
||||
} else {
|
||||
return new Object[] {comparevalue, value};
|
||||
}
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
*/
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
lblField = new javax.swing.JLabel();
|
||||
txtField = new javax.swing.JTextField();
|
||||
|
||||
setPreferredSize(new java.awt.Dimension(0, 30));
|
||||
setLayout(null);
|
||||
|
||||
lblField.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
lblField.setText("***");
|
||||
lblField.setPreferredSize(new java.awt.Dimension(0, 30));
|
||||
add(lblField);
|
||||
lblField.setBounds(20, 10, 120, 30);
|
||||
|
||||
txtField.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
txtField.setPreferredSize(new java.awt.Dimension(0, 30));
|
||||
add(txtField);
|
||||
txtField.setBounds(140, 10, 200, 30);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JLabel lblField;
|
||||
private javax.swing.JTextField txtField;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.5" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="12" style="0"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[425, 50]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
|
||||
<Component id="jTextField1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnUser" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jTextField1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="btnUser" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="pos_messages.properties" key="label.user" replaceFormat="AppLocal.getIntString("{key}")"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[110, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="jTextField1">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[200, 30]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnUser">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/com/unicenta/images/customer_sml.png"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Get Customers"/>
|
||||
<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="btnUserActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -0,0 +1,201 @@
|
||||
// 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.reports;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.loader.Datas;
|
||||
import com.unicenta.data.loader.QBFCompareEnum;
|
||||
import com.unicenta.data.loader.SerializerWrite;
|
||||
import com.unicenta.data.loader.SerializerWriteBasic;
|
||||
import com.unicenta.pos.admin.PeopleInfo;
|
||||
import com.unicenta.pos.admin.DataLogicAdmin;
|
||||
import com.unicenta.pos.admin.JPeopleFinder;
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
import com.unicenta.pos.forms.AppView;
|
||||
import java.awt.Component;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author adrianromero
|
||||
*/
|
||||
public class JParamsUser extends javax.swing.JPanel implements ReportEditorCreator {
|
||||
|
||||
private DataLogicAdmin dlPeople;
|
||||
private PeopleInfo currentpeople;
|
||||
|
||||
/** Creates new form JParamsUser */
|
||||
public JParamsUser() {
|
||||
|
||||
initComponents();
|
||||
|
||||
jTextField1.getDocument().addDocumentListener(new DocumentListener() {
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
currentpeople = null;
|
||||
}
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e) {
|
||||
currentpeople = null;
|
||||
}
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e) {
|
||||
currentpeople = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param app
|
||||
*/
|
||||
@Override
|
||||
public void init(AppView app) {
|
||||
dlPeople = (DataLogicAdmin) app.getBean("com.unicenta.pos.admin.DataLogicAdmin");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public void activate() throws BasicException {
|
||||
|
||||
currentpeople = null;
|
||||
jTextField1.setText(null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SerializerWrite getSerializerWrite() {
|
||||
return new SerializerWriteBasic(new Datas[] {Datas.OBJECT, Datas.STRING, Datas.OBJECT, Datas.STRING});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Component getComponent() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public Object createValue() throws BasicException {
|
||||
|
||||
if (currentpeople == null) {
|
||||
if (jTextField1.getText() == null || jTextField1.getText().equals("")) {
|
||||
return new Object[] {QBFCompareEnum.COMP_NONE, null, QBFCompareEnum.COMP_NONE, null};
|
||||
} else {
|
||||
return new Object[] {QBFCompareEnum.COMP_NONE, null, QBFCompareEnum.COMP_RE, jTextField1.getText()};
|
||||
}
|
||||
} else {
|
||||
return new Object[] {QBFCompareEnum.COMP_EQUALS, currentpeople.getID(), QBFCompareEnum.COMP_NONE, null};
|
||||
}
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
*/
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
jTextField1 = new javax.swing.JTextField();
|
||||
btnUser = new javax.swing.JButton();
|
||||
|
||||
setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
|
||||
setPreferredSize(new java.awt.Dimension(425, 50));
|
||||
|
||||
jLabel1.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jLabel1.setText(AppLocal.getIntString("label.user")); // NOI18N
|
||||
jLabel1.setPreferredSize(new java.awt.Dimension(110, 30));
|
||||
|
||||
jTextField1.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
jTextField1.setPreferredSize(new java.awt.Dimension(200, 30));
|
||||
|
||||
btnUser.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/unicenta/images/customer_sml.png"))); // NOI18N
|
||||
btnUser.setToolTipText("Get Customers");
|
||||
btnUser.setPreferredSize(new java.awt.Dimension(80, 45));
|
||||
btnUser.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnUserActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(6, 6, 6)
|
||||
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(btnUser, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void btnUserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUserActionPerformed
|
||||
|
||||
JPeopleFinder finder = JPeopleFinder.getPeopleFinder(this, dlPeople);
|
||||
finder.search(currentpeople);
|
||||
finder.setVisible(true);
|
||||
currentpeople = finder.getSelectedPeople();
|
||||
if (currentpeople == null) {
|
||||
jTextField1.setText(null);
|
||||
} else {
|
||||
jTextField1.setText(currentpeople.getName());
|
||||
}
|
||||
|
||||
}//GEN-LAST:event_btnUserActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton btnUser;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JTextField jTextField1;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
// 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.reports;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.loader.BaseSentence;
|
||||
import com.unicenta.data.loader.DataResultSet;
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
import net.sf.jasperreports.engine.JRDataSource;
|
||||
import net.sf.jasperreports.engine.JRException;
|
||||
import net.sf.jasperreports.engine.JRField;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
public class JRDataSourceBasic implements JRDataSource {
|
||||
|
||||
private BaseSentence sent;
|
||||
private DataResultSet SRS = null;
|
||||
private Object current = null;
|
||||
|
||||
private ReportFields m_fields = null;
|
||||
|
||||
/** Creates a new instance of JRDataSourceBasic
|
||||
* @param sent
|
||||
* @param fields
|
||||
* @param params
|
||||
* @throws com.unicenta.basic.BasicException */
|
||||
public JRDataSourceBasic(BaseSentence sent, ReportFields fields, Object params) throws BasicException {
|
||||
|
||||
this.sent = sent;
|
||||
SRS = sent.openExec(params);
|
||||
m_fields = fields;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param jrField
|
||||
* @return
|
||||
* @throws JRException
|
||||
*/
|
||||
@Override
|
||||
public Object getFieldValue(JRField jrField) throws JRException {
|
||||
|
||||
try {
|
||||
return m_fields.getField(current, jrField.getName());
|
||||
} catch (ReportException er) {
|
||||
throw new JRException(er);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* @throws JRException
|
||||
*/
|
||||
@Override
|
||||
public boolean next() throws JRException {
|
||||
|
||||
if (SRS == null) {
|
||||
throw new JRException(AppLocal.getIntString("exception.unavailabledataset"));
|
||||
}
|
||||
|
||||
try {
|
||||
if (SRS.next()) {
|
||||
current = SRS.getCurrent();
|
||||
return true;
|
||||
} else {
|
||||
current = null;
|
||||
SRS = null;
|
||||
sent.closeExec();
|
||||
sent = null;
|
||||
return false;
|
||||
}
|
||||
} catch (BasicException e) {
|
||||
throw new JRException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
// 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.reports;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.loader.*;
|
||||
import com.unicenta.data.user.EditorCreator;
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
import com.unicenta.pos.forms.AppView;
|
||||
import com.unicenta.pos.forms.BeanFactoryException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author adrianromero
|
||||
*/
|
||||
public class PanelReportBean extends JPanelReport {
|
||||
|
||||
private String title;
|
||||
private String report;
|
||||
|
||||
private String resourcebundle = null;
|
||||
|
||||
private String sentence;
|
||||
|
||||
|
||||
// JG 16 May 12 use diamond inference
|
||||
private List<Datas> fielddatas = new ArrayList<>();
|
||||
private List<String> fieldnames = new ArrayList<>();
|
||||
|
||||
private List<String> paramnames = new ArrayList<>();
|
||||
|
||||
private JParamsComposed qbffilter = new JParamsComposed();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param app
|
||||
* @throws BeanFactoryException
|
||||
*/
|
||||
@Override
|
||||
public void init(AppView app) throws BeanFactoryException {
|
||||
|
||||
qbffilter.init(app);
|
||||
super.init(app);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws BasicException
|
||||
*/
|
||||
@Override
|
||||
public void activate() throws BasicException {
|
||||
|
||||
qbffilter.activate();
|
||||
super.activate();
|
||||
|
||||
if (qbffilter.isEmpty()) {
|
||||
setVisibleFilter(false);
|
||||
setVisibleButtonFilter(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected EditorCreator getEditorCreator() {
|
||||
|
||||
return qbffilter;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param title
|
||||
*/
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param titlekey
|
||||
*/
|
||||
public void setTitleKey(String titlekey) {
|
||||
title = AppLocal.getIntString(titlekey);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param report
|
||||
*/
|
||||
public void setReport(String report) {
|
||||
this.report = report;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected String getReport() {
|
||||
return report;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param resourcebundle
|
||||
*/
|
||||
public void setResourceBundle(String resourcebundle) {
|
||||
this.resourcebundle = resourcebundle;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected String getResourceBundle() {
|
||||
return resourcebundle == null
|
||||
? report
|
||||
: resourcebundle;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param sentence
|
||||
*/
|
||||
public void setSentence(String sentence) {
|
||||
this.sentence = sentence;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param name
|
||||
* @param data
|
||||
*/
|
||||
public void addField(String name, Datas data) {
|
||||
fieldnames.add(name);
|
||||
fielddatas.add(data);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public void addParameter(String name) {
|
||||
paramnames.add(name);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected BaseSentence getSentence() {
|
||||
return new StaticSentence(m_App.getSession()
|
||||
, new QBFBuilder(sentence, paramnames.toArray(new String[paramnames.size()]))
|
||||
, qbffilter.getSerializerWrite()
|
||||
, new SerializerReadBasic(fielddatas.toArray(new Datas[fielddatas.size()])));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected ReportFields getReportFields() {
|
||||
return new ReportFieldsArray(fieldnames.toArray(new String[fieldnames.size()]));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param qbff
|
||||
*/
|
||||
public void addQBFFilter(ReportEditorCreator qbff) {
|
||||
qbffilter.addEditor(qbff);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
// 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.reports;
|
||||
|
||||
import com.unicenta.basic.BasicException;
|
||||
import com.unicenta.data.user.FilterEditorCreator;
|
||||
import com.unicenta.pos.forms.AppView;
|
||||
import java.awt.Component;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author adrianromero
|
||||
*/
|
||||
public interface ReportEditorCreator extends FilterEditorCreator {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param app
|
||||
*/
|
||||
public void init(AppView app);
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws BasicException
|
||||
*/
|
||||
public void activate() throws BasicException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Component getComponent();
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
// 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.reports;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
public class ReportException extends Exception {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public ReportException() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param msg
|
||||
*/
|
||||
public ReportException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param e
|
||||
*/
|
||||
public ReportException(Exception e) {
|
||||
super(e);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// 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.reports;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
public interface ReportFields {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param record
|
||||
* @param field
|
||||
* @return
|
||||
* @throws ReportException
|
||||
*/
|
||||
public Object getField(Object record, String field) throws ReportException;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
// 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.reports;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import com.unicenta.pos.forms.AppLocal;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JG uniCenta
|
||||
*/
|
||||
public class ReportFieldsArray implements ReportFields {
|
||||
|
||||
private Map m_keys = null;
|
||||
|
||||
/** Creates a new instance of ReportFieldsArray
|
||||
* @param afields */
|
||||
public ReportFieldsArray(String[] afields) {
|
||||
|
||||
// Creo el mapa de claves
|
||||
m_keys = new HashMap();
|
||||
for (int i = 0; i < afields.length; i++) {
|
||||
m_keys.put(afields[i], new Integer(i));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param record
|
||||
* @param field
|
||||
* @return
|
||||
* @throws ReportException
|
||||
*/
|
||||
@Override
|
||||
public Object getField(Object record, String field) throws ReportException {
|
||||
|
||||
Integer i = (Integer) m_keys.get(field);
|
||||
if (i == null) {
|
||||
throw new ReportException(AppLocal.getIntString("exception.unavailablefield", new Object[] {field}));
|
||||
} else {
|
||||
Object[] arecord = (Object[]) record;
|
||||
if (arecord == null || i.intValue() < 0
|
||||
|| i.intValue() >= arecord.length) {
|
||||
throw new ReportException(AppLocal.getIntString("exception.unavailablefields"));
|
||||
} else {
|
||||
return arecord[i.intValue()];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user