OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Comparer les révisions

Ignorer les espaces blanc Révision 141 → Révision 142

/trunk/OpenConcerto/lib/jOpenDocument-1.4rc2.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/OpenConcerto/lib/mime_util.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/OpenConcerto/lib/mime_util.jar
Nouveau fichier
Changements de propriété:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/OpenConcerto/lib/json-smart-2.2.1.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/OpenConcerto/lib/json-smart-2.2.1.jar
===================================================================
--- trunk/OpenConcerto/lib/json-smart-2.2.1.jar (revision 0)
+++ trunk/OpenConcerto/lib/json-smart-2.2.1.jar (revision 142)
/trunk/OpenConcerto/lib/json-smart-2.2.1.jar
Changements de propriété:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/OpenConcerto/lib/mysql-connector-java-5.1.40-bin.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/OpenConcerto/lib/mysql-connector-java-5.1.40-bin.jar
===================================================================
--- trunk/OpenConcerto/lib/mysql-connector-java-5.1.40-bin.jar (revision 0)
+++ trunk/OpenConcerto/lib/mysql-connector-java-5.1.40-bin.jar (revision 142)
/trunk/OpenConcerto/lib/mysql-connector-java-5.1.40-bin.jar
Changements de propriété:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/OpenConcerto/lib/jOpenCalendar.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/OpenConcerto/lib/accessors-smart-1.1.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/OpenConcerto/lib/accessors-smart-1.1.jar
===================================================================
--- trunk/OpenConcerto/lib/accessors-smart-1.1.jar (revision 0)
+++ trunk/OpenConcerto/lib/accessors-smart-1.1.jar (revision 142)
/trunk/OpenConcerto/lib/accessors-smart-1.1.jar
Changements de propriété:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/OpenConcerto/lib/icudata_56.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/OpenConcerto/lib/icudata_56.jar
===================================================================
--- trunk/OpenConcerto/lib/icudata_56.jar (revision 0)
+++ trunk/OpenConcerto/lib/icudata_56.jar (revision 142)
/trunk/OpenConcerto/lib/icudata_56.jar
Changements de propriété:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/OpenConcerto/lib/DS_Desktop_Notify.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/OpenConcerto/lib/DS_Desktop_Notify.jar
===================================================================
--- trunk/OpenConcerto/lib/DS_Desktop_Notify.jar (revision 0)
+++ trunk/OpenConcerto/lib/DS_Desktop_Notify.jar (revision 142)
/trunk/OpenConcerto/lib/DS_Desktop_Notify.jar
Changements de propriété:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/OpenConcerto/src/org/jopendocument/link/OOConnexion.java
===================================================================
--- trunk/OpenConcerto/src/org/jopendocument/link/OOConnexion.java (revision 141)
+++ trunk/OpenConcerto/src/org/jopendocument/link/OOConnexion.java (revision 142)
@@ -117,15 +117,33 @@
}
public static void main(String[] args) throws IOException {
- if (args.length == 0) {
- System.out.println("Usage : " + OOConnexion.class.getName() + " officeFile");
+ if (args.length == 0 || args.length > 2) {
+ System.out.println("Usage : " + OOConnexion.class.getName() + " officeFile | --type param");
System.out.println("Open officeFile in the default installation of LibreOffice");
+ System.out.println("--type is either file or url");
System.exit(1);
}
final OOConnexion conn = OOConnexion.create();
if (conn == null)
throw new IllegalStateException("No Office found");
- conn.loadDocument(new File(args[0]), false);
+ final boolean file;
+ final String arg;
+ if (args.length == 1) {
+ file = true;
+ arg = args[0];
+ } else if (args[0].equals("--file")) {
+ file = true;
+ arg = args[1];
+ } else if (args[0].equals("--url")) {
+ file = false;
+ arg = args[1];
+ } else {
+ throw new IllegalArgumentException("Type not valid : " + args[0]);
+ }
+ if (file)
+ conn.loadDocument(new File(arg), false);
+ else
+ conn.loadDocumentFromURLAsync(arg, false);
conn.closeConnexion();
}
/trunk/OpenConcerto/src/org/jopenchart/sample/devguide/PieChartSample.java
63,14 → 63,13
 
private static void chart3() {
PieChartWithSeparatedLabels c = new PieChartWithSeparatedLabels();
c.setInnerDimension(50, 50);
c.addLabel(new Label("AAAAAA"), Color.red);
c.addLabel(new Label("BBBB"));
c.addLabel(new Label("CCCCCCCCCCCCCCCCCCCCCCCCCCCC"));
c.addLabel(new Label("D"));
c.addLabel(new Label("EEE"));
c.addLabel(new Label("FFF"));
c.addLabel(new Label("GG"));
c.addLabel(new Label("HHH"));
 
c.setDimension(new Dimension(400, 200));
 
ArrayList<Number> l = new ArrayList<Number>();
/trunk/OpenConcerto/src/org/openconcerto/erp/core/reports/history/ui/ListeHistoriquePanel.java
27,6 → 27,7
import org.openconcerto.sql.element.SQLElementDirectory;
import org.openconcerto.sql.model.SQLDataSource;
import org.openconcerto.sql.model.SQLField;
import org.openconcerto.sql.model.SQLFieldsSet;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLRowValues;
130,15 → 131,9
 
Where w = null;
final SQLTable table = liste.getElement().getTable();
for (String key : ListeHistoriquePanel.this.whereList.keySet()) {
Where wTmp = ListeHistoriquePanel.this.whereList.get(key);
 
if (liste.getListe().getRequest().getAllFields().containsAll(wTmp.getFields())) {
if (w == null) {
w = wTmp;
} else {
w = w.and(wTmp);
}
for (final Where wTmp : ListeHistoriquePanel.this.whereList.values()) {
if (new SQLFieldsSet(wTmp.getFields()).getTables().contains(liste.getListe().getRequest().getPrimaryTable())) {
w = wTmp.and(w);
}
}
 
245,7 → 240,7
request.setSelectTransf(null);
}
if (where != null) {
if (request.getAllFields().containsAll(where.getFields())) {
if (new SQLFieldsSet(where.getFields()).getTables().contains(request.getPrimaryTable())) {
request.setWhere(where);
}
} else {
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/element/CommandeElementSQLElement.java
40,9 → 40,14
l.add("ID_STYLE");
l.add("CODE");
l.add("NOM");
l.add("ID_COMMANDE");
l.add("ID_ARTICLE");
l.add("PA_HT");
l.add("PV_HT");
l.add("ID_TAXE");
l.add("QTE");
l.add("QTE_UNITAIRE");
l.add("QTE_RECUE");
l.add("POIDS");
return l;
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/element/FactureFournisseurSQLElement.java
23,6 → 23,7
import org.openconcerto.erp.generationDoc.gestcomm.FactureFournisseurXmlSheet;
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.utils.ListMap;
 
public class FactureFournisseurSQLElement extends ComptaSQLConfElement {
 
46,6 → 47,13
return l;
}
 
@Override
public ListMap<String, String> getShowAs() {
ListMap<String, String> map = new ListMap<String, String>();
map.putCollection(null, "NUMERO", "DATE");
return map;
}
 
protected List<String> getComboFields() {
final List<String> l = new ArrayList<String>();
l.add("NUMERO");
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/element/CommandeSQLElement.java
24,8 → 24,6
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.element.SQLElementLink.LinkType;
import org.openconcerto.sql.element.SQLElementLinksSetup;
import org.openconcerto.sql.element.TreesOfSQLRows;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowValues;
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/element/FactureFournisseurElementSQLElement.java
38,11 → 38,15
protected List<String> getListFields() {
final List<String> l = new ArrayList<String>();
l.add("ID_STYLE");
l.add("ID_FACTURE_FOURNISSEUR");
l.add("CODE");
l.add("NOM");
l.add("QTE");
l.add("QTE_UNITAIRE");
l.add("PA_HT");
l.add("PV_HT");
l.add("T_PA_HT");
l.add("ID_TAXE");
l.add("T_PA_TTC");
l.add("POIDS");
return l;
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/action/ListeDesElementsACommanderAction.java
Nouveau fichier
0,0 → 1,145
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.supplychain.order.action;
 
import org.openconcerto.erp.action.CreateFrameAbstractAction;
import org.openconcerto.erp.core.common.ui.IListFilterDatePanel;
import org.openconcerto.erp.core.common.ui.ListeViewPanel;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.model.FieldPath;
import org.openconcerto.sql.model.FieldRef;
import org.openconcerto.sql.model.SQLName;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.SQLSelectJoin;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.model.graph.Path;
import org.openconcerto.sql.view.IListFrame;
import org.openconcerto.sql.view.ListeAddPanel;
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
import org.openconcerto.sql.view.list.IListe;
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.FrameUtil;
import org.openconcerto.ui.state.WindowStateManager;
import org.openconcerto.utils.CollectionUtils;
import org.openconcerto.utils.DecimalUtils;
import org.openconcerto.utils.cc.ITransformer;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.io.File;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Arrays;
import java.util.Collection;
import java.util.Set;
 
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JFrame;
import javax.swing.JPanel;
 
public class ListeDesElementsACommanderAction extends CreateFrameAbstractAction {
 
public ListeDesElementsACommanderAction() {
super();
this.putValue(Action.NAME, "Liste des éléments en attente de réception");
}
 
private BaseSQLTableModelColumn colAvancement;
 
public JFrame createFrame() {
final JFrame frame = new JFrame("Eléments à réceptionner");
// Actions
final SQLElement eltCmd = Configuration.getInstance().getDirectory().getElement("COMMANDE_ELEMENT");
final JPanel orderPanel = createPanel();
 
frame.getContentPane().add(orderPanel);
FrameUtil.setBounds(frame);
final File file = IListFrame.getConfigFile(eltCmd, frame.getClass());
if (file != null)
new WindowStateManager(frame, file).loadState();
return frame;
}
 
JPanel createPanel() {
final SQLElement eltCmd = Configuration.getInstance().getDirectory().getElement("COMMANDE_ELEMENT");
final SQLTableModelSourceOnline tableSource = eltCmd.getTableSource(true);
tableSource.getReq().setSelectTransf(new ITransformer<SQLSelect, SQLSelect>() {
 
@Override
public SQLSelect transformChecked(SQLSelect input) {
// new SQLName(eltCmd.getTable().getDBRoot().getName(),
// tableBLElement.getName()).quote()
final String quoteQteL = new SQLName(input.getAlias(eltCmd.getTable()).getAlias(), "QTE_RECUE").quote();
final String quoteQte = new SQLName(input.getAlias(eltCmd.getTable()).getAlias(), "QTE").quote();
final String quoteQteU = new SQLName(input.getAlias(eltCmd.getTable()).getAlias(), "QTE_UNITAIRE").quote();
Where w = Where.createRaw(quoteQteL + " < (" + quoteQte + "*" + quoteQteU + ")", eltCmd.getTable().getField("QTE_RECUE"), eltCmd.getTable().getField("QTE"),
eltCmd.getTable().getField("QTE_UNITAIRE"));
input.setWhere(w);
return input;
}
});
 
final ListeAddPanel panel = getPanel(eltCmd, tableSource);
 
return panel;
}
 
private ListeAddPanel getPanel(final SQLElement eltCmd, final SQLTableModelSourceOnline tableSource) {
final ListeAddPanel panel = new ListeAddPanel(eltCmd, new IListe(tableSource));
 
// final List<Tuple2<? extends SQLTableModelColumn, IListTotalPanel.Type>> fields = new
// ArrayList<Tuple2<? extends SQLTableModelColumn, IListTotalPanel.Type>>(2);
// fields.add(Tuple2.create(panel.getListe().getSource().getColumn(eltCmd.getTable().getField("T_HT")),
// IListTotalPanel.Type.SOMME));
// fields.add(Tuple2.create(this.colAvancement, IListTotalPanel.Type.AVANCEMENT_TTC));
// final IListTotalPanel totalPanel = new IListTotalPanel(panel.getListe(), fields, null,
// "Total des commandes de la liste");
 
final GridBagConstraints c = new DefaultGridBagConstraints();
c.gridwidth = GridBagConstraints.REMAINDER;
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.EAST;
c.weightx = 1;
c.gridy = 4;
 
// Date panel
final IListFilterDatePanel datePanel = new IListFilterDatePanel(panel.getListe(), eltCmd.getTable().getForeignTable("ID_COMMANDE").getField("DATE"), IListFilterDatePanel.getDefaultMap());
 
datePanel.setFilterOnDefault();
 
final JPanel bottomPanel = new JPanel();
bottomPanel.setLayout(new GridBagLayout());
bottomPanel.setOpaque(false);
final GridBagConstraints c2 = new DefaultGridBagConstraints();
c2.fill = GridBagConstraints.NONE;
c2.weightx = 1;
bottomPanel.add(datePanel, c2);
 
// c2.gridx++;
// c2.weightx = 0;
// c2.anchor = GridBagConstraints.EAST;
// bottomPanel.add(totalPanel, c2);
 
panel.add(bottomPanel, c);
return panel;
}
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/component/FactureFournisseurSQLComponent.java
78,7 → 78,36
private JDate dateCommande = new JDate();
private final JTextField fieldTaux = new JTextField(15);
private final JLabel labelTaux = new JLabel();
private ElementSQLObject eltModeRegl;
private PropertyChangeListener listenerModeReglDefaut = new PropertyChangeListener() {
 
public void propertyChange(PropertyChangeEvent evt) {
 
SQLRow rowFourn = fourn.getRequest().getPrimaryTable().getRow(fourn.getWantedID());
 
if (!isFilling() && rowFourn != null && !rowFourn.isUndefined()) {
 
// SQLRow rowCharge = rowFourn.getForeign("ID_COMPTE_PCE_CHARGE");
// if (rowCharge != null && !rowCharge.isUndefined()) {
// compteSel.setValue(rowCharge);
// }
 
int idModeRegl = rowFourn.getInt("ID_MODE_REGLEMENT");
if (idModeRegl > 1 && FactureFournisseurSQLComponent.this.eltModeRegl != null && getMode() == Mode.INSERTION) {
SQLElement sqlEltModeRegl = Configuration.getInstance().getDirectory().getElement("MODE_REGLEMENT");
SQLRow rowModeRegl = sqlEltModeRegl.getTable().getRow(idModeRegl);
SQLRowValues rowVals = rowModeRegl.createUpdateRow();
rowVals.clearPrimaryKeys();
FactureFournisseurSQLComponent.this.eltModeRegl.setValue(rowVals);
System.err.println("Select Mode regl " + idModeRegl);
}
// }
}
 
}
 
};
 
public FactureFournisseurSQLComponent() {
super(Configuration.getInstance().getDirectory().getElement("FACTURE_FOURNISSEUR"));
}
183,6 → 212,7
}
}
});
this.fourn.addModelListener("wantedID", this.listenerModeReglDefaut);
 
if (getTable().contains("TAUX_APPLIQUE")) {
// Devise
300,6 → 330,7
table.setFournisseur(fourn.getSelectedRow());
if (!isFilling()) {
SQLRow row = fourn.getSelectedRow();
row.fetchValues();
if (row != null && !row.isUndefined() && !row.isForeignEmpty("ID_COMPTE_PCE_CHARGE")) {
comptePCE.setValue(row.getForeign("ID_COMPTE_PCE_CHARGE"));
}
367,7 → 398,7
panel.add(scrollPane, c);
 
this.addView("ID_MODE_REGLEMENT", REQ + ";" + DEC + ";" + SEP);
ElementSQLObject eltModeRegl = (ElementSQLObject) this.getView("ID_MODE_REGLEMENT");
this.eltModeRegl = (ElementSQLObject) this.getView("ID_MODE_REGLEMENT");
 
c.gridx++;
c.fill = GridBagConstraints.NONE;
445,6 → 476,7
 
DeviseField textRemiseHT = new DeviseField();
DeviseField fieldHT = new DeviseField();
DeviseField fieldEco = new DeviseField();
DeviseField fieldTVA = new DeviseField();
DeviseField fieldTTC = new DeviseField();
DeviseField fieldDevise = new DeviseField();
454,6 → 486,7
fieldTTC.setOpaque(false);
fieldService.setOpaque(false);
addRequiredSQLObject(fieldDevise, "T_DEVISE");
addRequiredSQLObject(fieldEco, "T_ECO_CONTRIBUTION");
addRequiredSQLObject(fieldHT, "T_HT");
addRequiredSQLObject(fieldTVA, "T_TVA");
 
461,6 → 494,7
addRequiredSQLObject(fieldService, "T_SERVICE");
 
// Disable
this.allowEditable("T_ECO_CONTRIBUTION", false);
this.allowEditable("T_HT", false);
this.allowEditable("T_TVA", false);
this.allowEditable("T_TTC", false);
467,8 → 501,8
this.allowEditable("T_SERVICE", false);
this.allowEditable("T_POIDS", false);
 
final TotalPanel totalTTC = new TotalPanel(this.table, fieldHT, fieldTVA, fieldTTC, textPortHT, textRemiseHT, fieldService, null, fieldDevise, null, null,
(getTable().contains("ID_TAXE_PORT") ? comboTaxePort : null));
final TotalPanel totalTTC = new TotalPanel(this.table, fieldEco, fieldHT, fieldTVA, fieldTTC, textPortHT, textRemiseHT, fieldService, null, fieldDevise, null, null,
(getTable().contains("ID_TAXE_PORT") ? comboTaxePort : null), null);
 
c.gridx++;
c.gridy--;
494,6 → 528,20
}
});
 
this.fourn.addModelListener("wantedID", new PropertyChangeListener() {
 
@Override
public void propertyChange(PropertyChangeEvent evt) {
final SQLRow selectedRow2 = fourn.getSelectedRow();
if (selectedRow2 != null && !selectedRow2.isUndefined()) {
totalTTC.setIntraComm(selectedRow2.getBoolean("UE"));
} else {
totalTTC.setIntraComm(false);
}
 
}
});
 
textPortHT.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
totalTTC.updateTotal();
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/component/SaisieAchatSQLComponent.java
528,7 → 528,7
eltEcr.archiveMouvementProfondeur(idMvt, false);
 
// regenere les ecritures
new Thread(new GenerationMvtSaisieAchat(row, idMvt)).start();
new Thread(new GenerationMvtSaisieAchat(row)).start();
}
}
 
568,7 → 568,15
if (id > 1) {
final SQLElement eltCommande = Configuration.getInstance().getDirectory().getElement(tableName);
final SQLInjector injector = SQLInjector.getInjector(eltCommande.getTable(), this.getTable());
this.select(injector.createRowValuesFrom(id));
final SQLRowValues createRowValuesFrom = injector.createRowValuesFrom(id);
final SQLRowAccessor foreignFourn = createRowValuesFrom.getForeign("ID_FOURNISSEUR");
if (foreignFourn != null && !foreignFourn.isUndefined()) {
SQLRowAccessor rowCharge = foreignFourn.getForeign("ID_COMPTE_PCE_CHARGE");
if (rowCharge != null && !rowCharge.isUndefined()) {
createRowValuesFrom.put("ID_COMPTE_PCE", rowCharge.getID());
}
}
this.select(createRowValuesFrom);
}
}
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/component/CommandeSQLComponent.java
40,7 → 40,6
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.sqlobject.ElementComboBox;
69,10 → 68,10
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.sql.SQLException;
import java.util.List;
 
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
83,8 → 82,6
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
 
import org.apache.commons.dbutils.handlers.ArrayListHandler;
 
public class CommandeSQLComponent extends TransfertBaseSQLComponent {
 
private CommandeItemTable table = new CommandeItemTable();
118,7 → 115,16
c.weightx = 0;
this.add(new JLabel(getLabelFor("NUMERO"), SwingConstants.RIGHT), c);
 
this.numeroUniqueCommande = new JUniqueTextField(16);
this.numeroUniqueCommande = new JUniqueTextField(16) {
@Override
public String getAutoRefreshNumber() {
if (getMode() == Mode.INSERTION) {
return NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), dateCommande.getDate());
} else {
return null;
}
}
};
c.gridx++;
c.weightx = 1;
c.fill = GridBagConstraints.NONE;
708,6 → 714,7
 
DeviseField textRemiseHT = new DeviseField();
DeviseField fieldHT = new DeviseField();
DeviseField fieldEco = new DeviseField();
DeviseField fieldTVA = new DeviseField();
DeviseField fieldTTC = new DeviseField();
DeviseField fieldDevise = new DeviseField();
716,6 → 723,7
fieldTVA.setOpaque(false);
fieldTTC.setOpaque(false);
fieldService.setOpaque(false);
addRequiredSQLObject(fieldEco, "T_ECO_CONTRIBUTION");
addRequiredSQLObject(fieldDevise, "T_DEVISE");
addRequiredSQLObject(fieldHT, "T_HT");
addRequiredSQLObject(fieldTVA, "T_TVA");
724,14 → 732,14
addRequiredSQLObject(fieldService, "T_SERVICE");
 
// Disable
 
this.allowEditable("T_ECO_CONTRIBUTION", false);
this.allowEditable("T_HT", false);
this.allowEditable("T_TVA", false);
this.allowEditable("T_TTC", false);
this.allowEditable("T_SERVICE", false);
 
final TotalPanel totalTTC = new TotalPanel(this.table, fieldHT, fieldTVA, fieldTTC, textPortHT, textRemiseHT, fieldService, null, fieldDevise, null, null,
(getTable().contains("ID_TAXE_PORT") ? comboTaxePort : null));
final TotalPanel totalTTC = new TotalPanel(this.table, fieldEco, fieldHT, fieldTVA, fieldTTC, textPortHT, textRemiseHT, fieldService, null, fieldDevise, null, null,
(getTable().contains("ID_TAXE_PORT") ? comboTaxePort : null), null);
 
c.gridx++;
c.gridy--;
805,8 → 813,33
 
int idCommande = getSelectedID();
// on verifie qu'un devis du meme numero n'a pas été inséré entre temps
if (this.numeroUniqueCommande.checkValidation()) {
 
int attempt = 0;
if (!this.numeroUniqueCommande.checkValidation(false)) {
while (attempt < JUniqueTextField.RETRY_COUNT) {
String num = NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), dateCommande.getDate());
this.numeroUniqueCommande.setText(num);
attempt++;
if (this.numeroUniqueCommande.checkValidation(false)) {
System.err.println("ATEMPT " + attempt + " SUCCESS WITH NUMERO " + num);
break;
}
try {
Thread.sleep(JUniqueTextField.SLEEP_WAIT_MS);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
final String num = this.numeroUniqueCommande.getText();
if (attempt == JUniqueTextField.RETRY_COUNT) {
idCommande = getSelectedID();
ExceptionHandler.handle("Impossible d'ajouter, numéro de commande existant.");
final Object root = SwingUtilities.getRoot(this);
if (root instanceof EditFrame) {
final EditFrame frame = (EditFrame) root;
frame.getPanel().setAlwaysVisible(true);
}
} else {
idCommande = super.insert(order);
this.table.updateField("ID_COMMANDE", idCommande);
 
837,12 → 870,12
e.printStackTrace();
}
}
} else {
ExceptionHandler.handle("Impossible d'ajouter, numéro de commande client existant.");
Object root = SwingUtilities.getRoot(this);
if (root instanceof EditFrame) {
EditFrame frame = (EditFrame) root;
frame.getPanel().setAlwaysVisible(true);
if (attempt > 0) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JOptionPane.showMessageDialog(null, "Le numéro a été actualisé en " + num);
}
});
}
}
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/receipt/element/BonReceptionSQLElement.java
24,9 → 24,13
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.element.TreesOfSQLRows;
import org.openconcerto.sql.model.AliasedTable;
import org.openconcerto.sql.model.SQLName;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.request.UpdateBuilder;
import org.openconcerto.sql.view.EditFrame;
import org.openconcerto.sql.view.list.IListe;
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
123,10 → 127,34
editFactureFrame.setVisible(true);
}
 
public List<Object> getCmdFrom(int brOrigin) {
SQLTable tableBRElement = getTable().getTable("BON_RECEPTION_ELEMENT");
SQLTable tableCmdElement = getTable().getTable("COMMANDE_ELEMENT");
String up = "SELECT DISTINCT c2.\"ID_COMMANDE\" FROM " + new SQLName(tableBRElement.getDBRoot().getName(), tableBRElement.getName()).quote() + " b2, "
+ new SQLName(tableCmdElement.getDBRoot().getName(), tableCmdElement.getName()).quote() + " c2 WHERE b2.\"ID_BON_RECEPTION\"=" + brOrigin
+ " AND c2.\"ARCHIVE\"=0 AND b2.\"ARCHIVE\"=0 AND c2.\"ID\">1 AND b2.\"ID\">1 AND b2.\"ID_COMMANDE_ELEMENT\"=c2.\"ID\"";
List<Object> cmds = getTable().getDBSystemRoot().getDataSource().executeCol(up);
return cmds;
}
 
public void updateCmdElement(List<Object> cmds, int idbrOrigin) {
SQLTable tableBRElement = getTable().getTable("BON_RECEPTION_ELEMENT");
SQLTable tableCmdElement = getTable().getTable("COMMANDE_ELEMENT");
UpdateBuilder build = new UpdateBuilder(tableCmdElement);
build.set("QTE_RECUE", "(SELECT SUM(b.\"QTE\" * b.\"QTE_UNITAIRE\") from " + new SQLName(tableBRElement.getDBRoot().getName(), tableBRElement.getName()).quote()
+ " b where c.\"ID\"=b.\"ID_COMMANDE_ELEMENT\" AND c.\"ID\">1 AND c.\"ARCHIVE\"=0 AND b.\"ID\">1 AND b.\"ARCHIVE\"=0 )");
AliasedTable alias = new AliasedTable(tableCmdElement, "c");
build.setWhere(new Where(alias.getField("ID_COMMANDE"), cmds));
getTable().getDBSystemRoot().getDataSource().execute(build.asString().replaceAll(" SET", " c SET "));
}
 
@Override
protected void archive(TreesOfSQLRows trees, boolean cutLinks) throws SQLException {
 
List<Object> cmds = null;
List<Integer> ids = new ArrayList<Integer>();
for (SQLRow row : trees.getRows()) {
cmds = getCmdFrom(row.getID());
ids.add(row.getID());
 
// Mise à jour des stocks
SQLElement eltMvtStock = Configuration.getInstance().getDirectory().getElement("MOUVEMENT_STOCK");
145,5 → 173,9
}
}
super.archive(trees, cutLinks);
for (Integer id : ids) {
 
updateCmdElement(cmds, id);
}
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/receipt/component/BonReceptionSQLComponent.java
21,6 → 21,7
import org.openconcerto.erp.core.common.ui.TotalPanel;
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
import org.openconcerto.erp.core.sales.product.ui.ReliquatRowValuesTable;
import org.openconcerto.erp.core.supplychain.receipt.element.BonReceptionSQLElement;
import org.openconcerto.erp.core.supplychain.receipt.ui.BonReceptionItemTable;
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater;
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater.TypeStockUpdate;
32,9 → 33,7
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.sqlobject.ElementComboBox;
import org.openconcerto.sql.sqlobject.JUniqueTextField;
import org.openconcerto.sql.view.EditFrame;
48,7 → 47,6
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.NumberUtils;
 
import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
68,8 → 66,6
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
 
import org.apache.commons.dbutils.handlers.ArrayListHandler;
 
public class BonReceptionSQLComponent extends TransfertBaseSQLComponent {
private BonReceptionItemTable tableBonItem;
private ReliquatRowValuesTable tableBonReliquatItem;
122,7 → 118,16
labelNum.setHorizontalAlignment(SwingConstants.RIGHT);
this.add(labelNum, c);
 
this.textNumeroUnique = new JUniqueTextField(16);
this.textNumeroUnique = new JUniqueTextField(16) {
@Override
public String getAutoRefreshNumber() {
if (getMode() == Mode.INSERTION) {
return NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), date.getDate());
} else {
return null;
}
}
};
c.gridx++;
c.weightx = 1;
c.weighty = 0;
199,8 → 204,8
 
@Override
public void propertyChange(PropertyChangeEvent arg0) {
if (fournisseur.getSelectedRow() != null) {
boxDevise.setValue(fournisseur.getSelectedRow().getForeignID("ID_DEVISE"));
if (fournisseur.getSelectedRow() != null && fournisseur.getSelectedRow().getFields().contains("ID_DEVISE")) {
boxDevise.setValue(fournisseur.getSelectedRow().asRow().getForeignID("ID_DEVISE"));
} else {
boxDevise.setValue((SQLRowAccessor) null);
}
251,6 → 256,7
c.fill = GridBagConstraints.HORIZONTAL;
 
DeviseField fieldHT = new DeviseField();
DeviseField fieldEco = new DeviseField();
DeviseField fieldTVA = new DeviseField();
DeviseField fieldTTC = new DeviseField();
DeviseField fieldDevise = new DeviseField();
258,6 → 264,7
fieldHT.setOpaque(false);
fieldTVA.setOpaque(false);
fieldTTC.setOpaque(false);
addRequiredSQLObject(fieldEco, "T_ECO_CONTRIBUTION");
addRequiredSQLObject(fieldDevise, "T_DEVISE");
addRequiredSQLObject(fieldHT, "TOTAL_HT");
addRequiredSQLObject(fieldTVA, "TOTAL_TVA");
269,6 → 276,7
this.allowEditable("TOTAL_HT", false);
this.allowEditable("TOTAL_TVA", false);
this.allowEditable("TOTAL_TTC", false);
this.allowEditable("T_ECO_CONTRIBUTION", false);
this.allowEditable("TOTAL_POIDS", false);
 
DeviseField textRemiseHT = new DeviseField();
275,7 → 283,7
DeviseField fieldService = new DeviseField();
DeviseField textPortHT = new DeviseField();
 
final TotalPanel totalTTC = new TotalPanel(this.tableBonItem, fieldHT, fieldTVA, fieldTTC, textPortHT, textRemiseHT, fieldService, null, fieldDevise, fieldPoids, null, null);
final TotalPanel totalTTC = new TotalPanel(this.tableBonItem, fieldEco, fieldHT, fieldTVA, fieldTTC, textPortHT, textRemiseHT, fieldService, null, fieldDevise, fieldPoids, null, null, null);
 
c.gridx++;
c.gridy++;
364,18 → 372,37
 
}
 
private void reconfigure(JTextField field) {
field.setEnabled(false);
field.setHorizontalAlignment(JTextField.RIGHT);
field.setDisabledTextColor(Color.BLACK);
field.setBorder(null);
}
 
public int insert(SQLRow order) {
 
int idBon = SQLRow.NONEXISTANT_ID;
// on verifie qu'un bon du meme numero n'a pas été inséré entre temps
if (this.textNumeroUnique.checkValidation()) {
// on verifie qu'un devis du meme numero n'a pas été inséré entre temps
int attempt = 0;
if (!this.textNumeroUnique.checkValidation(false)) {
while (attempt < JUniqueTextField.RETRY_COUNT) {
String num = NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), date.getDate());
this.textNumeroUnique.setText(num);
attempt++;
if (this.textNumeroUnique.checkValidation(false)) {
System.err.println("ATEMPT " + attempt + " SUCCESS WITH NUMERO " + num);
break;
}
try {
Thread.sleep(JUniqueTextField.SLEEP_WAIT_MS);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
final String num = this.textNumeroUnique.getText();
if (attempt == JUniqueTextField.RETRY_COUNT) {
idBon = getSelectedID();
ExceptionHandler.handle("Impossible d'ajouter, numéro de bon existant.");
final Object root = SwingUtilities.getRoot(this);
if (root instanceof EditFrame) {
final EditFrame frame = (EditFrame) root;
frame.getPanel().setAlwaysVisible(true);
}
} else {
idBon = super.insert(order);
try {
this.tableBonItem.updateField("ID_BON_RECEPTION", idBon);
402,11 → 429,13
public void run() {
try {
updateStock(idBonFinal);
((BonReceptionSQLElement) getElement()).updateCmdElement(((BonReceptionSQLElement) getElement()).getCmdFrom(idBonFinal), idBonFinal);
} catch (Exception e) {
ExceptionHandler.handle("Update error", e);
}
}
});
 
// generation du document
final BonReceptionXmlSheet sheet = new BonReceptionXmlSheet(getTable().getRow(idBonFinal));
sheet.createDocumentAsynchronous();
415,13 → 444,6
} catch (Exception e) {
throw new IllegalStateException(e);
}
} else {
ExceptionHandler.handle("Impossible d'ajouter, numéro de bon de livraison existant.");
Object root = SwingUtilities.getRoot(this);
if (root instanceof EditFrame) {
EditFrame frame = (EditFrame) root;
frame.getPanel().setAlwaysVisible(true);
}
}
 
return idBon;
487,6 → 509,7
 
// Mise à jour de l'élément
super.update();
final List<Object> cmdFrom = ((BonReceptionSQLElement) getElement()).getCmdFrom(getSelectedID());
this.tableBonItem.updateField("ID_BON_RECEPTION", getSelectedID());
if (tableBonReliquatItem != null) {
this.tableBonReliquatItem.updateField("ID_BON_RECEPTION_ORIGINE", getSelectedID());
501,6 → 524,8
 
// Mise à jour du stock
updateStock(id);
((BonReceptionSQLElement) getElement()).updateCmdElement(cmdFrom, getSelectedID());
 
} catch (Exception e) {
ExceptionHandler.handle("Update error", e);
}
521,6 → 546,7
* @throws SQLException
*/
private void calculPHaPondere(int id) throws SQLException {
// FIXME : unused !
SQLTable sqlTableArticle = ((ComptaPropsConfiguration) Configuration.getInstance()).getRootSociete().getTable("ARTICLE");
SQLElement eltArticle = Configuration.getInstance().getDirectory().getElement(sqlTableArticle);
SQLElement eltStock = Configuration.getInstance().getDirectory().getElement("STOCK");
588,7 → 614,7
getTable().contains("CREATE_VIRTUAL_STOCK") && row.getBoolean("CREATE_VIRTUAL_STOCK") ? TypeStockUpdate.REAL_VIRTUAL_RECEPT : TypeStockUpdate.REAL_RECEPT);
 
if (getTable().getDBRoot().contains("RELIQUAT_BR")) {
List<SQLRow> l = row.getReferentRows(getTable().getTable("RELIQUAT_BR"));
List<SQLRow> l = row.getReferentRows(getTable().getTable("RELIQUAT_BR").getField("ID_BON_RECEPTION_ORIGINE"));
for (SQLRow sqlRow : l) {
stockUpdater.addReliquat(sqlRow.getForeign("ID_ARTICLE"), sqlRow.getInt("QTE"), sqlRow.getBigDecimal("QTE_UNITAIRE"));
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/product/component/ArticleFournisseurSQLComponent.java
471,7 → 471,7
GridBagConstraints c = new DefaultGridBagConstraints();
 
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot());
boolean gestionStockMin = prefs.getBoolean("ArticleStockMin", true);
boolean gestionStockMin = prefs.getBoolean(GestionArticleGlobalPreferencePanel.WARNING_STOCK_MIN, true);
c.gridx = 0;
c.gridy++;
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/stock/element/StockItemsUpdater.java
13,21 → 13,6
package org.openconcerto.erp.core.supplychain.stock.element;
 
import java.awt.GraphicsEnvironment;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
 
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
 
import org.apache.commons.dbutils.ResultSetHandler;
 
import org.openconcerto.erp.core.sales.product.model.ProductComponent;
import org.openconcerto.erp.core.sales.product.model.ProductHelper;
import org.openconcerto.erp.core.supplychain.stock.element.StockItem.TypeStockMouvement;
49,6 → 34,23
import org.openconcerto.utils.Tuple3;
import org.openconcerto.utils.cc.ITransformer;
 
import java.awt.GraphicsEnvironment;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
 
import org.apache.commons.dbutils.ResultSetHandler;
 
public class StockItemsUpdater {
 
private final StockLabel label;
137,7 → 139,9
rowValsArt.put("ID_STOCK", rowVals);
rowValsArt.commit();
}
stockItem.fillCommandeFournisseur(cmd);
if (!this.type.isEntry()) {
stockItem.fillCommandeFournisseur(cmd);
}
}
 
final List<? extends ResultSetHandler> handlers = new ArrayList<ResultSetHandler>(requests.size());
221,9 → 225,20
}
});
 
// On stocke les items pour le calcul total des stocks (sinon le calcul est faux si
// l'article apparait plusieurs fois
// ou si
// on archive un mvt reel et theorique)
Map<Number, StockItem> items = new HashMap<Number, StockItem>();
List<SQLRowValues> result = fetcher.fetch();
for (SQLRowValues sqlRowValues : result) {
StockItem item = new StockItem(sqlRowValues.getForeign("ID_ARTICLE"));
final StockItem item;
if (!items.containsKey(sqlRowValues.getForeignIDNumber("ID_ARTICLE"))) {
item = new StockItem(sqlRowValues.getForeign("ID_ARTICLE"));
items.put(sqlRowValues.getForeignIDNumber("ID_ARTICLE"), item);
} else {
item = items.get(sqlRowValues.getForeignIDNumber("ID_ARTICLE"));
}
final TypeStockMouvement t;
if (sqlRowValues.getBoolean("REEL")) {
t = TypeStockMouvement.REEL;
248,7 → 263,7
for (int i = index; i < items.size(); i++) {
SQLRowAccessor r = items.get(i);
 
if (!r.getTable().contains("NIVEAU") || r.getInt("NIVEAU") >= 1) {
if (!r.getTable().contains("NIVEAU") || r.getInt("NIVEAU") >= level) {
// On ne calcul pas les stocks pour les éléments ayant des fils (le mouvement de
// stock
// des fils impactera les stocks automatiquement)
264,6 → 279,9
if ((!r.getTable().contains("NIVEAU") || r.getInt("NIVEAU") == level) && !r.isForeignEmpty("ID_ARTICLE") && r.getForeign("ID_ARTICLE") != null) {
productComponents.add(ProductComponent.createFrom(r, qte));
}
} else if (r.getInt("NIVEAU") < level) {
// BREAK si on sort de l'article composé
break;
}
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/stock/element/MouvementStockSQLElement.java
18,6 → 18,7
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
import org.openconcerto.erp.core.supplychain.order.component.CommandeSQLComponent;
import org.openconcerto.erp.core.supplychain.supplier.component.MouvementStockSQLComponent;
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.element.SQLElement;
178,7 → 179,7
}
 
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot());
boolean gestionStockMin = prefs.getBoolean("ArticleStockMin", true);
boolean gestionStockMin = prefs.getBoolean(GestionArticleGlobalPreferencePanel.WARNING_STOCK_MIN, true);
 
if (!archive && rowArticle.getTable().getFieldsName().contains("QTE_MIN") && gestionStockMin && rowArticle.getObject("QTE_MIN") != null && qteNvlle < rowArticle.getInt("QTE_MIN")) {
// final float qteShow = qteNvlle;
265,10 → 266,10
}
 
public static void createCommandeF(final ListMap<SQLRow, SQLRowValues> col, final SQLRow rowDevise) {
createCommandeF(col, rowDevise, "");
createCommandeF(col, rowDevise, "", true);
}
 
public static void createCommandeF(final ListMap<SQLRow, SQLRowValues> col, final SQLRow rowDevise, final String ref) {
public static void createCommandeF(final ListMap<SQLRow, SQLRowValues> col, final SQLRow rowDevise, final String ref, final boolean useCommandeEnCours) {
if (SwingUtilities.isEventDispatchThread()) {
throw new IllegalStateException("This method must be called outside of EDT");
}
284,7 → 285,8
w = w.and(new Where(commande.getTable().getField("ID_FOURNISSEUR"), "=", fournisseur.getID()));
sel.setWhere(w);
 
final List<SQLRow> rowsCmd = (List<SQLRow>) Configuration.getInstance().getBase().getDataSource().execute(sel.asString(), SQLRowListRSH.createFromSelect(sel));
final List<SQLRow> rowsCmd = !useCommandeEnCours ? null
: (List<SQLRow>) Configuration.getInstance().getBase().getDataSource().execute(sel.asString(), SQLRowListRSH.createFromSelect(sel));
 
SwingUtilities.invokeLater(new Runnable() {
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/stock/element/ComposedItemStockUpdater.java
57,7 → 57,7
* @throws SQLException
*/
public void update() throws SQLException {
// Liste des articles composés
// Liste des nomenclatures dépendantes des itemsUpdated
List<StockItem> items = getAllComposedItemToUpdate();
 
// Fecth des articles liés
160,6 → 160,7
for (StockItem stockItem : itemsUpdated) {
ids.add(stockItem.getArticle().getID());
}
// Liste des nomenclatures dépendantes des itemsUpdated
List<SQLRowValues> list = getComposedItemToUpdate(ids);
int size = list.size();
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/stock/element/StockItem.java
13,6 → 13,7
package org.openconcerto.erp.core.supplychain.stock.element;
 
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel;
import org.openconcerto.sql.model.SQLInjector;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
94,7 → 95,7
public void fillCommandeFournisseur(ListMap<SQLRow, SQLRowValues> cmd) {
 
SQLPreferences prefs = new SQLPreferences(article.getTable().getDBRoot());
boolean gestionStockMin = prefs.getBoolean("ArticleStockMin", true);
boolean gestionStockMin = prefs.getBoolean(GestionArticleGlobalPreferencePanel.WARNING_STOCK_MIN, true);
if (article.getTable().getFieldsName().contains("QTE_MIN") && gestionStockMin && article.getObject("QTE_MIN") != null && getRealQty() < article.getInt("QTE_MIN")) {
// final float qteShow = qteNvlle;
SQLInjector inj = SQLInjector.getInjector(article.getTable(), article.getTable().getTable("COMMANDE_ELEMENT"));
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/supplier/element/FournisseurSQLElement.java
14,8 → 14,13
package org.openconcerto.erp.core.supplychain.supplier.element;
 
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.erp.core.edm.AttachmentAction;
import org.openconcerto.erp.core.supplychain.supplier.component.FournisseurSQLComponent;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.request.ComboSQLRequest;
import org.openconcerto.sql.request.ComboSQLRequest.KeepMode;
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
import org.openconcerto.sql.request.ListSQLRequest;
 
import java.util.ArrayList;
26,6 → 31,10
 
public FournisseurSQLElement() {
super("FOURNISSEUR", "un fournisseur", "fournisseurs");
 
PredicateRowAction actionAttachment = new PredicateRowAction(new AttachmentAction().getAction(), true);
actionAttachment.setPredicate(IListeEvent.getSingleSelectionPredicate());
getRowActions().add(actionAttachment);
}
 
protected List<String> getListFields() {
49,9 → 58,18
}
 
@Override
protected void _initComboRequest(ComboSQLRequest req) {
super._initComboRequest(req);
req.addToGraphToFetch("UE");
req.addForeignToGraphToFetch("ID_COMPTE_PCE_CHARGE", Arrays.asList("ID", "NUMERO"));
req.keepRows(KeepMode.GRAPH);
}
 
@Override
protected void _initListRequest(ListSQLRequest req) {
super._initListRequest(req);
req.addForeignToGraphToFetch("ID_MODE_REGLEMENT", Arrays.asList("AJOURS", "LENJOUR", "DATE_FACTURE", "COMPTANT"));
 
}
 
/*
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/CompteClientTransactionGroup.java
Nouveau fichier
0,0 → 1,29
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.customerrelationship.customer.element;
 
import org.openconcerto.ui.group.Group;
 
public class CompteClientTransactionGroup extends Group {
public final static String ID = "customerrelationship.customer.account.default";
 
public CompteClientTransactionGroup() {
super(ID);
this.addItem("ID_CLIENT");
this.addItem("DATE");
this.addItem("MONTANT");
this.addItem("ID_REGLEMENT");
}
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/CustomerGroup.java
82,6 → 82,7
 
this.add(gState);
final Group gInfo = new Group("customerrelationship.customer.info", LayoutHints.DEFAULT_SEPARATED_GROUP_HINTS);
gInfo.addItem("REMIND_DATE");
gInfo.addItem("INFOS", new LayoutHints(true, true, true, true, true, true, true, true));
gInfo.addItem("COMMENTAIRES", new LayoutHints(true, true, true, true, true, true, true, true));
gInfo.addItem("OBSOLETE");
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/ContactSQLElementBase.java
47,6 → 47,9
 
protected List<String> getListFields() {
final List<String> l = new ArrayList<String>();
if (getTable().contains("ID_TITRE_PERSONNEL")) {
l.add("ID_TITRE_PERSONNEL");
}
l.add("NOM");
l.add("PRENOM");
l.add("FONCTION");
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/ClientNormalSQLElement.java
16,6 → 16,7
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.erp.core.customerrelationship.customer.report.FicheClientXmlSheet;
import org.openconcerto.erp.preferences.GestionClientPreferencePanel;
import org.openconcerto.erp.preferences.PrinterNXProps;
import org.openconcerto.ql.LabelCreator;
import org.openconcerto.ql.QLPrinter;
23,6 → 24,7
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.preferences.SQLPreferences;
import org.openconcerto.sql.request.ListSQLRequest;
import org.openconcerto.sql.view.list.IListe;
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
49,24 → 51,7
@Override
public void actionPerformed(ActionEvent e) {
final SQLRowAccessor row = IListe.get(e).fetchSelectedRow();
final LabelCreator c = new LabelCreator(720);
c.setLeftMargin(10);
c.setTopMargin(10);
c.setDefaultFont(new Font("Verdana", Font.PLAIN, 50));
c.addLineBold(row.getString("NOM"));
final SQLRowAccessor foreignRow = row.getForeign("ID_ADRESSE");
final String string = foreignRow.getString("RUE");
String[] s = string.split("\n");
for (String string2 : s) {
c.addLineNormal(string2);
}
c.addLineNormal(foreignRow.getString("CODE_POSTAL") + " " + foreignRow.getString("VILLE"));
final QLPrinter prt = new QLPrinter(property);
try {
prt.print(c.getImage());
} catch (Exception ex) {
ex.printStackTrace();
}
printLabel(row, property);
}
}, false, "customerrelationship.customer.label.print");
actionPrintLabel.setPredicate(IListeEvent.getSingleSelectionPredicate());
98,6 → 83,33
getRowActions().add(action);
}
 
public void printLabel(SQLRowAccessor row, String qlPrinterProperty) {
final LabelCreator c = new LabelCreator(720);
c.setLeftMargin(10);
c.setTopMargin(10);
c.setDefaultFont(new Font("Verdana", Font.PLAIN, 50));
c.addLineBold(row.getString("NOM"));
final SQLRowAccessor foreignRow = row.asRow().getForeign("ID_ADRESSE");
final String string = foreignRow.getString("RUE");
String[] s = string.split("\n");
for (String string2 : s) {
c.addLineNormal(string2);
}
c.addLineNormal(foreignRow.getString("CODE_POSTAL") + " " + foreignRow.getString("VILLE"));
 
final String pays = foreignRow.getString("PAYS");
if (pays != null && pays.trim().length() > 0 && !pays.equalsIgnoreCase(ComptaPropsConfiguration.getInstanceCompta().getRowSociete().getForeignRow("ID_ADRESSE_COMMON").getString("PAYS"))) {
c.addLineNormal(pays);
}
 
final QLPrinter prt = new QLPrinter(qlPrinterProperty);
try {
prt.print(c.getImage());
} catch (Exception ex) {
ex.printStackTrace();
}
}
 
protected void sendMail(List<SQLRowValues> l) {
 
String mail = "";
155,6 → 167,10
} else {
l.add("CODE");
}
SQLPreferences prefs = SQLPreferences.getMemCached(getTable().getDBRoot());
if (prefs.getBoolean(GestionClientPreferencePanel.DISPLAY_CLIENT_PCE, false)) {
l.add("ID_COMPTE_PCE");
}
return l;
}
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/CompteClientTransactionSQLELement.java
Nouveau fichier
0,0 → 1,48
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.customerrelationship.customer.element;
 
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.sql.element.GroupSQLComponent;
import org.openconcerto.sql.element.SQLComponent;
 
import java.util.ArrayList;
import java.util.List;
 
public class CompteClientTransactionSQLELement extends ComptaSQLConfElement {
 
public CompteClientTransactionSQLELement() {
super("COMPTE_CLIENT_TRANSACTION");
}
 
@Override
protected List<String> getListFields() {
final List<String> fields = new ArrayList<String>();
fields.add("ID_CLIENT");
fields.add("DATE");
fields.add("MONTANT");
fields.add("ID_MODE_REGLEMENT");
return fields;
}
 
@Override
protected SQLComponent createComponent() {
return new GroupSQLComponent(this, new CompteClientTransactionGroup());
}
 
@Override
protected String createCode() {
return super.createCodeFromPackage() + ".account.transaction";
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/CustomerSQLElement.java
13,9 → 13,12
package org.openconcerto.erp.core.customerrelationship.customer.element;
 
import org.openconcerto.erp.core.edm.AttachmentAction;
import org.openconcerto.sql.element.GlobalMapper;
import org.openconcerto.sql.element.GroupSQLComponent;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
 
import java.util.List;
 
26,6 → 29,11
final CustomerGroup group = new CustomerGroup();
GlobalMapper.getInstance().map(CustomerGroup.ID, group);
setDefaultGroup(group);
PredicateRowAction actionAttachment = new PredicateRowAction(new AttachmentAction().getAction(), true);
actionAttachment.setPredicate(IListeEvent.getSingleSelectionPredicate());
getRowActions().add(actionAttachment);
 
}
 
@Override
38,6 → 46,11
@Override
protected List<String> getListFields() {
final List<String> fields = super.getListFields();
if (getTable().contains("GROUPE")) {
fields.add("GROUPE");
}
fields.add("SOLDE_COMPTE");
fields.add("REMIND_DATE");
fields.add("OBSOLETE");
return fields;
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/CustomerSQLComponent.java
16,7 → 16,6
import org.openconcerto.erp.core.common.component.AdresseSQLComponent;
import org.openconcerto.erp.core.common.element.NumerotationAutoSQLElement;
import org.openconcerto.erp.core.customerrelationship.customer.ui.AdresseClientItemTable;
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel;
import org.openconcerto.erp.preferences.ModeReglementDefautPrefPanel;
import org.openconcerto.erp.utils.TM;
import org.openconcerto.sql.Configuration;
28,7 → 27,6
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.UndefinedRowValuesCache;
import org.openconcerto.sql.preferences.SQLPreferences;
import org.openconcerto.sql.sqlobject.JUniqueTextField;
import org.openconcerto.sql.sqlobject.SQLSearchableTextCombo;
import org.openconcerto.sql.ui.textmenu.TextFieldWithMenu;
45,6 → 43,7
import org.openconcerto.ui.component.ComboLockedMode;
import org.openconcerto.ui.component.ITextArea;
import org.openconcerto.ui.component.InteractionMode;
import org.openconcerto.utils.ExceptionHandler;
 
import java.awt.Component;
import java.awt.Dimension;
53,7 → 52,6
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.SQLException;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
 
62,9 → 60,11
import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
 
75,7 → 75,16
private AdresseClientItemTable adresseTable = new AdresseClientItemTable();
private SQLTable contactTable = Configuration.getInstance().getDirectory().getElement("CONTACT").getTable();
private final SQLTable tableNum = getTable().getBase().getTable("NUMEROTATION_AUTO");
private final JUniqueTextField code = new JUniqueTextField(20);
private final JUniqueTextField code = new JUniqueTextField(20) {
@Override
public String getAutoRefreshNumber() {
if (getMode() == Mode.INSERTION) {
return NumerotationAutoSQLElement.getNextNumero(getElement().getClass());
} else {
return null;
}
}
};
 
private SQLRowValues defaultContactRowVals = new SQLRowValues(UndefinedRowValuesCache.getInstance().getDefaultRowValues(this.contactTable));
private JCheckBox checkAdrLivraison, checkAdrFacturation;
243,25 → 252,62
 
@Override
public int insert(SQLRow order) {
int id = super.insert(order);
this.table.updateField("ID_CLIENT", id);
this.adresseTable.updateField("ID_CLIENT", id);
if (NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), new Date()).equalsIgnoreCase(this.code.getText().trim())) {
SQLRowValues rowVals = new SQLRowValues(this.tableNum);
final SQLRow rowNumAuto = this.tableNum.getRow(2);
if (rowNumAuto.getObject("CLIENT_START") != null) {
int val = rowNumAuto.getInt("CLIENT_START");
val++;
rowVals.put("CLIENT_START", new Integer(val));
int id;
 
int attempt = 0;
// on verifie qu'un client du meme numero n'a pas été inséré entre temps
if (!this.code.checkValidation(false)) {
while (attempt < JUniqueTextField.RETRY_COUNT) {
String num = NumerotationAutoSQLElement.getNextNumero(getElement().getClass());
this.code.setText(num);
attempt++;
if (this.code.checkValidation(false)) {
System.err.println("ATEMPT " + attempt + " SUCCESS WITH NUMERO " + num);
break;
}
try {
rowVals.update(2);
} catch (SQLException e) {
Thread.sleep(JUniqueTextField.SLEEP_WAIT_MS);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
final String num = this.code.getText();
if (attempt == JUniqueTextField.RETRY_COUNT) {
id = getSelectedID();
ExceptionHandler.handle("Impossible d'ajouter, numéro de client existant.");
final Object root = SwingUtilities.getRoot(this);
if (root instanceof EditFrame) {
final EditFrame frame = (EditFrame) root;
frame.getPanel().setAlwaysVisible(true);
}
} else {
id = super.insert(order);
this.table.updateField("ID_CLIENT", id);
this.adresseTable.updateField("ID_CLIENT", id);
if (NumerotationAutoSQLElement.getNextNumero(getElement().getClass()).equalsIgnoreCase(this.code.getText().trim())) {
SQLRowValues rowVals = new SQLRowValues(this.tableNum);
final SQLRow rowNumAuto = this.tableNum.getRow(2);
if (rowNumAuto.getObject("CLIENT_START") != null) {
int val = rowNumAuto.getInt("CLIENT_START");
val++;
rowVals.put("CLIENT_START", new Integer(val));
 
try {
rowVals.update(2);
} catch (SQLException e) {
e.printStackTrace();
}
}
}
if (attempt > 0) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JOptionPane.showMessageDialog(null, "Le numéro a été actualisé en " + num);
}
});
}
}
return id;
}
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/element/AssociationAnalytiqueSQLElement.java
14,15 → 14,13
package org.openconcerto.erp.core.finance.accounting.element;
 
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.map.model.Ville;
import org.openconcerto.sql.element.BaseSQLComponent;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.model.FieldPath;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.graph.Path;
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
import org.openconcerto.sql.view.list.SQLTableModelSource;
import org.openconcerto.utils.CollectionUtils;
 
import java.math.BigDecimal;
76,8 → 74,8
}
 
@Override
protected SQLTableModelSourceOnline createTableSource() {
SQLTableModelSourceOnline table = super.createTableSource();
protected synchronized void _initTableSource(final SQLTableModelSource table) {
super._initTableSource(table);
BaseSQLTableModelColumn debit = new BaseSQLTableModelColumn("Débit", BigDecimal.class) {
 
@Override
121,7 → 119,5
};
 
table.getColumns().add(credit);
 
return table;
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/element/ComptePCESQLElement.java
24,13 → 24,18
import org.openconcerto.sql.model.SQLBackgroundTableCacheItem;
import org.openconcerto.sql.model.SQLBase;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLRowListRSH;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.request.ComboSQLRequest;
import org.openconcerto.sql.request.UpdateBuilder;
import org.openconcerto.sql.sqlobject.JUniqueTextField;
import org.openconcerto.sql.view.list.IListe;
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.component.ITextArea;
import org.openconcerto.utils.ExceptionHandler;
39,11 → 44,13
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
 
import javax.swing.AbstractAction;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JTextField;
55,13 → 62,33
 
public ComptePCESQLElement() {
super("COMPTE_PCE", "un compte", "comptes");
 
PredicateRowAction action = new PredicateRowAction(new AbstractAction("Consulter le compte") {
 
public void actionPerformed(ActionEvent e) {
final SQLRowAccessor row = IListe.get(e).getSelectedRow();
((EcritureSQLElement) getDirectory().getElement("ECRITURE")).consultationCompte(row);
// ConsultationCompteFrame f = new ConsultationCompteFrame(table.getValueAt(row,
// 0).toString());
 
}
}, true);
action.setPredicate(IListeEvent.getSingleSelectionPredicate());
getRowActions().add(action);
}
 
@Override
protected void _initComboRequest(ComboSQLRequest req) {
super._initComboRequest(req);
req.setWhere(new Where(getTable().getField("OBSOLETE"), "=", Boolean.FALSE));
}
 
protected List<String> getListFields() {
final List<String> list = new ArrayList<String>(3);
list.add("NUMERO");
list.add("NOM");
list.add("INFOS");
list.add("OBSOLETE");
return list;
}
 
141,6 → 168,12
JCheckBox checkRacine = new JCheckBox("Racine");
this.add(checkRacine, c);
 
c.gridy++;
c.gridx++;
c.weightx = 0;
JCheckBox checkObs = new JCheckBox("Obsolète");
this.add(checkObs, c);
 
// Infos
JLabel labelInfos = new JLabel(getLabelFor("INFOS"));
c.gridy++;
161,6 → 194,7
this.addRequiredSQLObject(textNom, "NOM");
this.addSQLObject(textInfos, "INFOS");
this.addSQLObject(checkRacine, "RACINE");
this.addSQLObject(checkObs, "OBSOLETE");
}
 
@Override
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/element/EcritureSQLElement.java
17,8 → 17,11
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.erp.core.common.ui.DeviseField;
import org.openconcerto.erp.core.common.ui.PanelFrame;
import org.openconcerto.erp.core.edm.AttachmentAction;
import org.openconcerto.erp.core.finance.accounting.ui.ConsultationCompteFrame;
import org.openconcerto.erp.core.finance.accounting.ui.LettrageRenderer;
import org.openconcerto.erp.core.finance.accounting.ui.ListEcritureRenderer;
import org.openconcerto.erp.core.finance.accounting.ui.ListeDesEcrituresPanel;
import org.openconcerto.erp.core.finance.accounting.ui.PointageRenderer;
import org.openconcerto.erp.core.finance.accounting.ui.SuppressionEcrituresPanel;
import org.openconcerto.sql.Configuration;
43,7 → 46,10
import org.openconcerto.sql.utils.SQLUtils.SQLFactory;
import org.openconcerto.sql.view.EditFrame;
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
import org.openconcerto.sql.view.list.SQLTableModelColumn;
import org.openconcerto.sql.view.list.SQLTableModelSource;
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.JDate;
50,11 → 56,17
import org.openconcerto.ui.component.InteractionMode;
import org.openconcerto.utils.CollectionUtils;
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.convertor.ValueConvertor;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
62,9 → 74,11
import java.util.List;
import java.util.Set;
 
import javax.swing.AbstractAction;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
 
74,6 → 88,9
 
public EcritureSQLElement() {
super("ECRITURE", "une écriture", "écritures");
PredicateRowAction actionAttachment = new PredicateRowAction(new AttachmentAction("ID_MOUVEMENT").getAction(), true);
actionAttachment.setPredicate(IListeEvent.getSingleSelectionPredicate());
getRowActions().add(actionAttachment);
}
 
@Override
87,8 → 104,6
 
public List<String> getListFields() {
final List<String> l = new ArrayList<String>();
 
l.add("ID");
l.add("VALIDE");
l.add("ID_MOUVEMENT");
if (getTable().contains("NOM_PIECE")) {
125,9 → 140,100
req.addToGraphToFetch("VALIDE");
}
 
public void consultationCompte(SQLRowAccessor rowCpt) {
final ConsultationCompteFrame f = new ConsultationCompteFrame(new ListeDesEcrituresPanel(), "Consultation compte n°" + rowCpt.getString("NUMERO") + " " + rowCpt.getString("NOM"));
 
f.getPanel().getListe().getJTable().addMouseListener(new MouseAdapter() {
 
public void mousePressed(final MouseEvent mE) {
 
if (mE.getButton() == MouseEvent.BUTTON3) {
JPopupMenu menuDroit = new JPopupMenu();
 
menuDroit.add(new AbstractAction("Voir les ecritures du journal") {
 
public void actionPerformed(ActionEvent e) {
int id = f.getPanel().getListe().idFromIndex(f.getPanel().getListe().getJTable().rowAtPoint(mE.getPoint()));
// int id = f.getPanel().getListe().getSelectedId();
 
SQLTable ecrTable = getTable().getTable("ECRITURE");
 
System.err.println("Ecritures ID ::: " + id);
SQLRow rowEcr = ecrTable.getRow(id);
 
System.err.println("Ecritures ID ::: " + id + " --> ID_JOURNAL = " + rowEcr.getInt("ID_JOURNAL"));
 
ConsultationCompteFrame f2 = new ConsultationCompteFrame(new ListeDesEcrituresPanel(),
"Consultation du journal " + getTable().getTable("JOURNAL").getRow(rowEcr.getInt("ID_JOURNAL")).getString("NOM"));
 
Where w = new Where(ecrTable.getField("ID_JOURNAL"), "=", rowEcr.getInt("ID_JOURNAL"));
 
f2.getPanel().getListe().getRequest().setWhere(w);
f2.getPanel().getListe().setSQLEditable(false);
f2.pack();
f2.setVisible(true);
}
});
 
menuDroit.add(new AbstractAction("Voir la source") {
 
public void actionPerformed(ActionEvent e) {
 
// int id = f.getPanel().getListe().getSelectedId();
int id = f.getPanel().getListe().idFromIndex(f.getPanel().getListe().getJTable().rowAtPoint(mE.getPoint()));
System.err.println("ID COMPTE SELECTED " + id);
SQLRow rowEcr = getTable().getTable("ECRITURE").getRow(id);
 
System.out.println("MOUVEMENT VALIDE ------------->>>>>>>>>>>>>> " + MouvementSQLElement.isEditable(rowEcr.getInt("ID_MOUVEMENT")));
 
MouvementSQLElement.showSource(rowEcr.getInt("ID_MOUVEMENT"));
 
System.out.println("Mouvement Numero : " + rowEcr.getInt("ID_MOUVEMENT"));
}
});
 
menuDroit.show(mE.getComponent(), mE.getX(), mE.getY());
}
}
});
 
SQLTable ecrTable = getTable().getTable("ECRITURE");
 
Where w = new Where(ecrTable.getField("ID_COMPTE_PCE"), "=", rowCpt.getID());
f.getPanel().getListe().getRequest().setWhere(w);
 
f.getPanel().getListe().setSQLEditable(false);
f.pack();
f.setVisible(true);
}
 
@Override
protected void _initTableSource(SQLTableModelSourceOnline res) {
protected void _initTableSource(SQLTableModelSource res) {
super._initTableSource(res);
BaseSQLTableModelColumn analytique = new BaseSQLTableModelColumn("Poste analytique", String.class) {
 
@Override
protected Object show_(SQLRowAccessor r) {
Collection<? extends SQLRowAccessor> assocs = r.getReferentRows(getTable().getTable("ASSOCIATION_ANALYTIQUE"));
StringBuffer res = new StringBuffer();
 
for (SQLRowAccessor sqlRowAccessor : assocs) {
res.append(sqlRowAccessor.getForeign("ID_POSTE_ANALYTIQUE").getString("NOM"));
res.append(", ");
}
 
return res.toString();
}
 
@Override
public Set<FieldPath> getPaths() {
Path p = new Path(getTable());
p = p.add(getTable().getTable("ASSOCIATION_ANALYTIQUE"));
p = p.add(p.getLast().getForeignTable("ID_POSTE_ANALYTIQUE"));
return CollectionUtils.createSet(new FieldPath(p, "NOM"));
}
};
res.getColumns().add(analytique);
for (SQLTableModelColumn col : res.getColumns()) {
col.setRenderer(ListEcritureRenderer.UTILS.getRenderer(col.getRenderer()));
}
142,11 → 248,33
listEcriture.add("DATE");
listEcriture.add("DEBIT");
listEcriture.add("CREDIT");
final SQLTableModelSourceOnline res = this.initTableSource(new SQLTableModelSourceOnline(this.createListRequest(listEcriture)));
for (SQLTableModelColumn column : res.getColumns()) {
column.setRenderer(PointageRenderer.UTILS.getRenderer(column.getRenderer()));
final SQLTableModelSourceOnline res = this.instantiateTableSourceOnline(this.createListRequest(listEcriture));
for (SQLTableModelColumn col : res.getColumns()) {
if (col.getValueClass() == Long.class || col.getValueClass() == BigInteger.class) {
col.setConverter(new ValueConvertor<Number, BigDecimal>() {
@Override
public BigDecimal convert(Number o) {
if (o == null) {
return BigDecimal.ZERO;
}
return new BigDecimal(o.longValue()).movePointLeft(2);
}
 
@Override
public Number unconvert(BigDecimal o) {
 
if (o == null) {
return 0;
}
return o.movePointRight(2);
}
}, BigDecimal.class);
col.setRenderer(CURRENCY_RENDERER);
}
 
col.setRenderer(PointageRenderer.UTILS.getRenderer(col.getRenderer()));
}
return res;
return this.initTableSource(res, true);
}
 
public final SQLTableModelSourceOnline createLettrageTableSource() {
162,43 → 290,32
listEcriture.add("DATE");
listEcriture.add("DEBIT");
listEcriture.add("CREDIT");
final SQLTableModelSourceOnline res = this.initTableSource(new SQLTableModelSourceOnline(this.createListRequest(listEcriture)));
for (SQLTableModelColumn column : res.getColumns()) {
column.setRenderer(LettrageRenderer.UTILS.getRenderer(column.getRenderer()));
}
return res;
}
final SQLTableModelSourceOnline res = this.instantiateTableSourceOnline(this.createListRequest(listEcriture));
for (SQLTableModelColumn col : res.getColumns()) {
if (col.getValueClass() == Long.class || col.getValueClass() == BigInteger.class) {
col.setConverter(new ValueConvertor<Number, BigDecimal>() {
@Override
public BigDecimal convert(Number o) {
if (o == null) {
return BigDecimal.ZERO;
}
return new BigDecimal(o.longValue()).movePointLeft(2);
}
 
@Override
protected SQLTableModelSourceOnline createTableSource() {
SQLTableModelSourceOnline source = super.createTableSource();
@Override
public Number unconvert(BigDecimal o) {
 
BaseSQLTableModelColumn analytique = new BaseSQLTableModelColumn("Poste analytique", String.class) {
 
@Override
protected Object show_(SQLRowAccessor r) {
Collection<? extends SQLRowAccessor> assocs = r.getReferentRows(getTable().getTable("ASSOCIATION_ANALYTIQUE"));
StringBuffer res = new StringBuffer();
 
for (SQLRowAccessor sqlRowAccessor : assocs) {
res.append(sqlRowAccessor.getForeign("ID_POSTE_ANALYTIQUE").getString("NOM"));
res.append(", ");
}
 
return res.toString();
if (o == null) {
return 0;
}
return o.movePointRight(2);
}
}, BigDecimal.class);
col.setRenderer(CURRENCY_RENDERER);
}
 
@Override
public Set<FieldPath> getPaths() {
Path p = new Path(getTable());
p = p.add(getTable().getTable("ASSOCIATION_ANALYTIQUE"));
p = p.add(p.getLast().getForeignTable("ID_POSTE_ANALYTIQUE"));
return CollectionUtils.createSet(new FieldPath(p, "NOM"));
}
};
source.getColumns().add(analytique);
 
return source;
col.setRenderer(LettrageRenderer.UTILS.getRenderer(col.getRenderer()));
}
return this.initTableSource(res, true);
}
 
/*
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/PdfGenerator.java
51,7 → 51,7
 
public static void main(String[] args) {
new PdfGenerator_2033B().generateFrom(null);
HashMap h = new HashMap();
// HashMap h = new HashMap();
// h.put("NOM","Front Software");
// new PdfGenerator_2033A().generateFrom(h);
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/BalanceAgeeListeSheetXML.java
94,10 → 94,11
sel.addSelect(ecr.getTable().getField("LETTRAGE"));
Where w = new Where(ecr.getTable().getField("LETTRAGE"), "IS NOT", (Object) null);
w = w.and(new Where(ecr.getTable().getField("LETTRAGE"), "!=", ""));
if (this.fin == null) {
this.fin = new Date();
}
 
if (fin != null) {
w = w.and(new Where(ecr.getTable().getField("DATE"), "<=", fin));
}
w = w.and(new Where(ecr.getTable().getField("DATE"), "<=", fin));
sel.setWhere(w);
 
final List<String> lettrageList = (List<String>) Configuration.getInstance().getBase().getDataSource().executeCol(sel.asString());
110,9 → 111,9
if (deb != null) {
w2 = w2.and(new Where(ecr.getTable().getField("DATE"), ">=", deb));
}
if (fin != null) {
w2 = w2.and(new Where(ecr.getTable().getField("DATE"), "<=", fin));
}
 
w2 = w2.and(new Where(ecr.getTable().getField("DATE"), "<=", fin));
 
sel2.addGroupBy(ecr.getTable().getField("LETTRAGE"));
sel2.setHaving(Where.createRaw("SUM(\"DEBIT\") != SUM(\"CREDIT\")", Arrays.asList(ecr.getTable().getField("DEBIT"), ecr.getTable().getField("CREDIT"))));
sel2.setWhere(w2);
135,9 → 136,8
if (deb != null) {
w = w.and(new Where(tableEcriture.getField("DATE"), ">=", deb));
}
if (fin != null) {
w = w.and(new Where(tableEcriture.getField("DATE"), "<=", fin));
}
w = w.and(new Where(tableEcriture.getField("DATE"), "<=", fin));
 
// w = w.and(new Where(cpt.getTable().getField("NOM"), "LIKE", "%RIBEIRO%"));
// w = w.and(new Where(ecr.getTable().getField("ID_COMPTE_PCE"), "=",
// cpt.getTable().getKey()));
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/JournauxAnalytiqueSheetXML.java
47,8 → 47,8
public final static int MODELETTREE = 2;
public final static int MODENONLETTREE = 3;
 
private final static DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM);
private final static DateFormat dateFormatEcr = DateFormat.getDateInstance(DateFormat.SHORT);
private final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM);
private final DateFormat dateFormatEcr = DateFormat.getDateInstance(DateFormat.SHORT);
protected Date dateDu, dateAu;
private SQLRow rowPoste;
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/Map3310.java
39,7 → 39,7
public class Map3310 extends Thread {
 
private Map<String, Object> m;
private static final DateFormat format = new SimpleDateFormat("ddMMyyyy");
private final DateFormat format = new SimpleDateFormat("ddMMyyyy");
private JProgressBar bar;
private Date dateDebut, dateFin;
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/Map2033A.java
37,11 → 37,17
public class Map2033A extends Thread {
 
private Map<String, Object> m;
private static final DateFormat format = new SimpleDateFormat("ddMMyyyy");
private final DateFormat format = new SimpleDateFormat("ddMMyyyy");
private JProgressBar bar;
private Date dateDebut, dateFin;
SommeCompte sommeCompte;
 
// Debugger un bilan non réparti
// Faire le bilan mois par mois pour retrouver à partir de quel date le bilan est déséquilibré,
// puis comparer les balances J J-1 pour trouver les différences ( ou le grand livre)
// --> Utiliser Check Bilan ACtion pour retrouver les mouvements qui ne sont pas bien réparti
// entre actif et passif
 
// TODO if value = 0.0 ne pas mettre -0.0
 
public void run() {
114,7 → 120,7
// Racine = "109, 201, 203, 205, 208, 237"
// S014=201...205+208+237+232
// Fix Abaque 208 - 2087
long v014 = this.sommeCompte.sommeCompteFils("109", this.dateDebut, this.dateFin) + this.sommeCompte.sommeCompteFils("201", this.dateDebut, this.dateFin)
long v014 = this.sommeCompte.soldeCompteDebiteur(109, 109, true, this.dateDebut, this.dateFin) + this.sommeCompte.sommeCompteFils("201", this.dateDebut, this.dateFin)
+ this.sommeCompte.sommeCompteFils("203", this.dateDebut, this.dateFin) + this.sommeCompte.sommeCompteFils("232", this.dateDebut, this.dateFin)
+ this.sommeCompte.sommeCompteFils("205", this.dateDebut, this.dateFin) + this.sommeCompte.soldeCompte(208, 208, true, this.dateDebut, this.dateFin)
- this.sommeCompte.soldeCompte(2087, 2087, true, this.dateDebut, this.dateFin) + this.sommeCompte.sommeCompteFils("237", this.dateDebut, this.dateFin);
501,8 → 507,9
// 120 -SommeSolde( 100, 103* )-SommeSolde( 108, 109* )
// Racine = "101, 104, 108"
// S120=-10...101-108-104
long v120 = -this.sommeCompte.sommeCompteFils("101", this.dateDebut, this.dateFin) - this.sommeCompte.sommeCompteFils("108", this.dateDebut, this.dateFin)
- this.sommeCompte.sommeCompteFils("104", this.dateDebut, this.dateFin);
long v120 = -this.sommeCompte.sommeCompteFils("101", this.dateDebut, this.dateFin) - this.sommeCompte.sommeCompteFils("103", this.dateDebut, this.dateFin)
- this.sommeCompte.sommeCompteFils("108", this.dateDebut, this.dateFin) - this.sommeCompte.sommeCompteFils("104", this.dateDebut, this.dateFin)
+ this.sommeCompte.soldeCompteCrediteur(109, 109, true, this.dateDebut, this.dateFin);
this.m.put("PASSIF3.15", GestionDevise.currencyToString(v120, false));
 
// 121
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/Map2033B.java
34,7 → 34,7
 
public class Map2033B extends Thread {
private Map<String, String> m;
private static final DateFormat format = new SimpleDateFormat("ddMMyyyy");
private final DateFormat format = new SimpleDateFormat("ddMMyyyy");
private JProgressBar bar;
private Date dateDeb, dateFin;
SommeCompte sommeCompte;
431,6 → 431,7
******************************************************************************************/
// 312
// 374 SommeSoldeDebit( 4457, 4457* )
// TODO répartir les comptes crediteurs
long v374 = this.sommeCompte.soldeCompteDebiteur(4457, 4457, true, this.dateDeb, this.dateFin);
this.m.put("T1.41", GestionDevise.currencyToString(v374, false));
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/Map2033E.java
28,7 → 28,7
// TODO finir de remplir la Map
public class Map2033E {
private Map m;
private static final DateFormat format = new SimpleDateFormat("ddMMyyyy");
private final DateFormat format = new SimpleDateFormat("ddMMyyyy");
SommeCompte sommeCompte;
 
public Map2033E() {
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/VentilationAnalytiqueSheetXML.java
50,8 → 50,8
private final static SQLTable tableMvt = base.getTable("MOUVEMENT");
private final static SQLTable tableCompte = base.getTable("COMPTE_PCE");
 
private final static DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM);
private final static DateFormat dateFormatEcr = DateFormat.getDateInstance(DateFormat.SHORT);
private final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM);
private final DateFormat dateFormatEcr = DateFormat.getDateInstance(DateFormat.SHORT);
private SQLRow rowSociete = ((ComptaPropsConfiguration) Configuration.getInstance()).getRowSociete();
 
private Date dateDu, dateAu;
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/RepartitionAnalytiqueSheetXML.java
41,8 → 41,8
protected final static SQLTable tablePoste = base.getTable("POSTE_ANALYTIQUE");
private final static SQLTable tableEcriture = base.getTable("ECRITURE");
 
private final static DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM);
private final static DateFormat dateFormatEcr = DateFormat.getDateInstance(DateFormat.SHORT);
private final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM);
private final DateFormat dateFormatEcr = DateFormat.getDateInstance(DateFormat.SHORT);
private SQLRow rowSociete = ((ComptaPropsConfiguration) Configuration.getInstance()).getRowSociete();
 
private Date dateDu, dateAu;
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/BalanceSheet.java
40,8 → 40,8
private final static SQLTable tableEcriture = base.getTable("ECRITURE");
private final static SQLTable tableCompte = base.getTable("COMPTE_PCE");
private boolean centralClient, centralFourn, centralFournImmo;
private final static DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM);
private final static DateFormat dateFormatEcr = DateFormat.getDateInstance(DateFormat.SHORT);
private final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM);
private final DateFormat dateFormatEcr = DateFormat.getDateInstance(DateFormat.SHORT);
public static String TEMPLATE_ID = "Balance";
public static String TEMPLATE_PROPERTY_NAME = "LocationBalance";
private Date dateAu, dateDu;
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/action/ListeDesEcrituresAction.java
18,6 → 18,7
import org.openconcerto.erp.core.common.ui.IListFilterDatePanel;
import org.openconcerto.erp.core.common.ui.IListTotalPanel;
import org.openconcerto.erp.core.common.ui.PanelFrame;
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
import org.openconcerto.erp.core.finance.accounting.element.EcritureSQLElement;
import org.openconcerto.erp.core.finance.accounting.element.MouvementSQLElement;
import org.openconcerto.erp.core.finance.accounting.ui.AssociationAnalytiquePanel;
27,6 → 28,7
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.model.SQLField;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLRowListRSH;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLSelect;
53,7 → 55,6
import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
import javax.swing.JTable;
 
144,7 → 145,12
public void mouseReleased(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON3) {
JPopupMenu menuDroit = new JPopupMenu();
 
menuDroit.add(new AbstractAction("Consultation du compte") {
public void actionPerformed(ActionEvent event) {
SQLRowAccessor row = frame.getPanel().getListe().getSelectedRow();
((EcritureSQLElement) element).consultationCompte(ComptePCESQLElement.getRow(row.getString("COMPTE_NUMERO"), row.getString("COMPTE_NOM")));
}
});
menuDroit.add(new AbstractAction("Contrepassation") {
public void actionPerformed(ActionEvent event) {
EcritureSQLElement.contrePassationPiece(frame.getPanel().getListe().getSelectedId());
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/action/ListeDesComptesAction.java
21,11 → 21,10
import javax.swing.Action;
import javax.swing.JFrame;
 
 
public class ListeDesComptesAction extends CreateFrameAbstractAction {
public ListeDesComptesAction() {
super();
this.putValue(Action.NAME, "Liste des comptes");
this.putValue(Action.NAME, "Liste des comptes du plan comptable");
}
 
public JFrame createFrame() {
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/ui/ListeGestCommEltPanel.java
15,6 → 15,8
 
import org.openconcerto.erp.core.common.ui.PanelFrame;
import org.openconcerto.erp.core.finance.accounting.element.MouvementSQLElement;
import org.openconcerto.erp.core.sales.account.VenteFactureSituationSQLComponent;
import org.openconcerto.erp.core.sales.account.VenteFactureSoldeSQLComponent;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
32,7 → 34,7
 
public class ListeGestCommEltPanel extends ListeAddPanel {
 
private EditFrame editModifyFrame, editReadOnlyFrame;
private EditFrame editReadOnlyFrame;
 
private ListeGestCommEltPanel(SQLElement elem, boolean showAdd, Where w, String variant) {
// TODO verifier que l'element contient la clef etrangere ID_MOUVEMENT
61,19 → 63,19
return null;
}
});
this.btnMngr.setAdditional(this.buttonModifier, new ITransformer<JButton, String>() {
 
@Override
public String transformChecked(JButton input) {
 
SQLRowAccessor row = getListe().fetchSelectedRow();
 
if (row.getBoolean("PARTIAL") || row.getBoolean("SOLDE")) {
return "Vous ne pouvez pas modifier une facture intermédiaire.";
}
return null;
}
});
// this.btnMngr.setAdditional(this.buttonModifier, new ITransformer<JButton, String>() {
//
// @Override
// public String transformChecked(JButton input) {
//
// SQLRowAccessor row = getListe().fetchSelectedRow();
//
// if (row.getBoolean("PARTIAL") || row.getBoolean("SOLDE")) {
// return "Vous ne pouvez pas modifier une facture intermédiaire.";
// }
// return null;
// }
// });
}
}
 
139,12 → 141,17
} else {
if (source == this.buttonModifier) {
 
if (mvt == null || mvt.isUndefined() | MouvementSQLElement.isEditable(mvt.getID())) {
if (this.editModifyFrame == null) {
this.editModifyFrame = new EditFrame(this.element, EditPanel.MODIFICATION);
if (mvt == null || mvt.isUndefined() || MouvementSQLElement.isEditable(mvt.getID())) {
EditFrame editModifyFrame;
if (this.element.getTable().getName().equals("SAISIE_VENTE_FACTURE") && row.getBoolean("PARTIAL")) {
editModifyFrame = new EditFrame(this.element.createComponent(VenteFactureSituationSQLComponent.ID), EditPanel.MODIFICATION);
} else if (this.element.getTable().getName().equals("SAISIE_VENTE_FACTURE") && row.getBoolean("SOLDE")) {
editModifyFrame = new EditFrame(this.element.createComponent(VenteFactureSoldeSQLComponent.ID), EditPanel.MODIFICATION);
} else {
editModifyFrame = new EditFrame(this.element, EditPanel.MODIFICATION);
}
this.editModifyFrame.selectionId(this.getListe().getSelectedId());
this.editModifyFrame.setVisible(true);
editModifyFrame.selectionId(this.getListe().getSelectedId());
editModifyFrame.setVisible(true);
} else {
if (this.editReadOnlyFrame == null) {
this.editReadOnlyFrame = new EditFrame(this.element, EditPanel.READONLY);
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/ui/ClotureManuellePanel.java
53,7 → 53,7
private final SQLRow rowExercice = this.exercice.getRow(this.rowSociete.getInt("ID_EXERCICE_COMMON"));
private JButton valider = new JButton("Valider");
private JButton annul = new JButton("Annuler");
private static final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
private final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
 
public ClotureManuellePanel() {
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/ui/SaisieKmItemTable.java
93,12 → 93,6
final SQLTableElement tableElementNomEcriture = new SQLTableElement(tableElement.getField("NOM_ECRITURE"));
list.add(tableElementNomEcriture);
 
if (!DefaultNXProps.getInstance().getBooleanValue("HideAnalytique")) {
final AnalytiqueItemTable analytiqueAssocTable = new AnalytiqueItemTable(true);
SQLTableElement eltPourcentAnalytique = new SQLTableElement(tableElement.getField("ANALYTIQUE"), String.class, new MultiLineTableCellEditor(
(RowValuesMultiLineEditTable) analytiqueAssocTable.getTable(), analytiqueAssocTable));
list.add(eltPourcentAnalytique);
}
//
 
this.debit = new SQLTableElement(tableElement.getField("DEBIT"), Long.class, this.deviseCellEditor);
105,6 → 99,12
list.add(this.debit);
this.credit = new SQLTableElement(tableElement.getField("CREDIT"), Long.class, this.deviseCellEditor);
list.add(this.credit);
if (!DefaultNXProps.getInstance().getBooleanValue("HideAnalytique")) {
final AnalytiqueItemTable analytiqueAssocTable = new AnalytiqueItemTable(true);
SQLTableElement eltPourcentAnalytique = new SQLTableElement(tableElement.getField("ANALYTIQUE"), String.class,
new MultiLineTableCellEditor((RowValuesMultiLineEditTable) analytiqueAssocTable.getTable(), analytiqueAssocTable));
list.add(eltPourcentAnalytique);
}
 
final RowValuesTableModel model = new RowValuesTableModel(elt, list, tableElement.getField("NUMERO"), false, defaultRowVals) {
@Override
131,21 → 131,24
ToolTipManager.sharedInstance().unregisterComponent(this.table.getTableHeader());
 
// Autocompletion
final AutoCompletionManager m = new AutoCompletionManager(this.tableElementNumeroCompte, ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete().getField(
"COMPTE_PCE.NUMERO"), this.table, this.table.getRowValuesTableModel(), ITextWithCompletion.MODE_STARTWITH, true, false, new ValidStateChecker() {
final AutoCompletionManager m = new AutoCompletionManager(this.tableElementNumeroCompte,
((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete().getField("COMPTE_PCE.NUMERO"), this.table, this.table.getRowValuesTableModel(),
ITextWithCompletion.MODE_STARTWITH, true, false, new ValidStateChecker() {
 
ComptePCESQLElement elt = Configuration.getInstance().getDirectory().getElement(ComptePCESQLElement.class);
ComptePCESQLElement elt = Configuration.getInstance().getDirectory().getElement(ComptePCESQLElement.class);
 
@Override
public ValidState getValidState(Object o) {
if (o != null) {
return elt.getCompteNumeroValidState(o.toString());
}
return super.getValidState(o);
}
});
@Override
public ValidState getValidState(Object o) {
if (o != null) {
return elt.getCompteNumeroValidState(o.toString());
}
return super.getValidState(o);
}
});
m.fill("NOM", "NOM");
m.setFillWithField("NUMERO");
final Where w = new Where(elt.getTable().getTable("COMPTE_PCE").getField("OBSOLETE"), "=", Boolean.FALSE);
m.setWhere(w);
 
// FIXME erreur fill numero
final AutoCompletionManager m2 = new AutoCompletionManager(tableElementNomCompte, ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete().getField("COMPTE_PCE.NOM"),
152,6 → 155,7
this.table, this.table.getRowValuesTableModel(), ITextWithCompletion.MODE_CONTAINS, true);
m2.fill("NUMERO", "NUMERO");
m2.setFillWithField("NOM");
m2.setWhere(w);
 
TextTableCellEditorWithCompletion t = (TextTableCellEditorWithCompletion) this.tableElementNumeroCompte.getTableCellEditor(this.table);
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/ui/ClotureMensuellePayePanel.java
131,6 → 131,7
selFiche.andWhere(new Where(tableFiche.getField("ANNEE"), "=", new Integer(textAnnee.getText())));
selFiche.andWhere(new Where(tableSalarie.getField("ID"), "=", tableFiche.getField("ID_SALARIE")));
selFiche.andWhere(new Where(tableInfosSal.getField("ID"), "=", tableSalarie.getField("ID_INFOS_SALARIE_PAYE")));
selFiche.andWhere(new Where(tableSalarie.getField("ID_FICHE_PAYE"), "!=", tableFiche.getKey()));
 
// FIXME ne pas valider les fiches d'un employé renvoyé
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/ui/EcritureGrandLivreRenderer.java
31,7 → 31,7
public class EcritureGrandLivreRenderer extends DefaultTableCellRenderer {
 
private TableSorter model;
private static final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.FRENCH);
private final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.FRENCH);
private final static Color couleurEcritureValide = new Color(253, 243, 204);
private final static Color couleurEcritureToDay = new Color(225, 254, 207);
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/ui/PlanComptableEPanel.java
14,7 → 14,7
package org.openconcerto.erp.core.finance.accounting.ui;
 
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.erp.core.finance.accounting.element.MouvementSQLElement;
import org.openconcerto.erp.core.finance.accounting.element.EcritureSQLElement;
import org.openconcerto.erp.core.finance.accounting.model.PlanComptableEModel;
import org.openconcerto.erp.element.objet.ClasseCompte;
import org.openconcerto.erp.element.objet.Compte;
22,8 → 22,6
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.model.SQLBase;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.view.EditFrame;
import org.openconcerto.sql.view.EditPanel;
import org.openconcerto.ui.DefaultGridBagConstraints;
255,75 → 253,9
 
public void actionPerformed(ActionEvent e) {
int row = table.rowAtPoint(mE.getPoint());
 
// ConsultationCompteFrame f = new ConsultationCompteFrame(table.getValueAt(row,
// 0).toString());
final ConsultationCompteFrame f = new ConsultationCompteFrame(new ListeDesEcrituresPanel(), "Consultation compte n°" + table.getValueAt(row, 0).toString() + " "
+ table.getValueAt(row, 1).toString());
 
f.getPanel().getListe().getJTable().addMouseListener(new MouseAdapter() {
 
public void mousePressed(final MouseEvent mE) {
 
if (mE.getButton() == MouseEvent.BUTTON3) {
JPopupMenu menuDroit = new JPopupMenu();
 
menuDroit.add(new AbstractAction("Voir les ecritures du journal") {
 
public void actionPerformed(ActionEvent e) {
int id = f.getPanel().getListe().idFromIndex(f.getPanel().getListe().getJTable().rowAtPoint(mE.getPoint()));
// int id = f.getPanel().getListe().getSelectedId();
 
SQLTable ecrTable = base.getTable("ECRITURE");
 
System.err.println("Ecritures ID ::: " + id);
SQLRow rowEcr = ecrTable.getRow(id);
 
System.err.println("Ecritures ID ::: " + id + " --> ID_JOURNAL = " + rowEcr.getInt("ID_JOURNAL"));
 
ConsultationCompteFrame f2 = new ConsultationCompteFrame(new ListeDesEcrituresPanel(), "Consultation du journal "
+ base.getTable("JOURNAL").getRow(rowEcr.getInt("ID_JOURNAL")).getString("NOM"));
 
Where w = new Where(ecrTable.getField("ID_JOURNAL"), "=", rowEcr.getInt("ID_JOURNAL"));
 
f2.getPanel().getListe().getRequest().setWhere(w);
f2.getPanel().getListe().setSQLEditable(false);
f2.pack();
f2.setVisible(true);
}
});
 
menuDroit.add(new AbstractAction("Voir la source") {
 
public void actionPerformed(ActionEvent e) {
 
// int id = f.getPanel().getListe().getSelectedId();
int id = f.getPanel().getListe().idFromIndex(f.getPanel().getListe().getJTable().rowAtPoint(mE.getPoint()));
System.err.println("ID COMPTE SELECTED " + id);
SQLRow rowEcr = base.getTable("ECRITURE").getRow(id);
 
System.out.println("MOUVEMENT VALIDE ------------->>>>>>>>>>>>>> " + MouvementSQLElement.isEditable(rowEcr.getInt("ID_MOUVEMENT")));
 
MouvementSQLElement.showSource(rowEcr.getInt("ID_MOUVEMENT"));
 
System.out.println("Mouvement Numero : " + rowEcr.getInt("ID_MOUVEMENT"));
}
});
 
menuDroit.show(mE.getComponent(), mE.getX(), mE.getY());
}
}
});
 
SQLTable ecrTable = base.getTable("ECRITURE");
SQLRow rowCompte = base.getTable("COMPTE_PCE").getRow(((PlanComptableEModel) (table.getModel())).getId(row));
 
Where w = new Where(ecrTable.getField("ID_COMPTE_PCE"), "=", rowCompte.getID());
f.getPanel().getListe().getRequest().setWhere(w);
 
f.getPanel().getListe().setSQLEditable(false);
f.pack();
f.setVisible(true);
((EcritureSQLElement) ComptaPropsConfiguration.getInstanceCompta().getDirectory().getElement("ECRITURE")).consultationCompte(rowCompte);
}
});
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/ui/CloturePanel.java
28,6 → 28,7
import org.openconcerto.sql.model.SQLSystem;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.utils.SQLUtils;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.JDate;
import org.openconcerto.ui.JLabelBold;
72,7 → 73,7
private final Map<Object, Long> mRAN = new HashMap<Object, Long>();
private JButton valider = new JButton("Valider");
private JButton annul = new JButton("Annuler");
private static final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
private final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
private JLabel opEnCours = new JLabel("Etat: en attente de validation");
private JCheckBox boxValid = new JCheckBox("Je confirme avoir effectué toutes les opérations nécessaires.");
 
182,15 → 183,30
this.valider.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
 
try {
clotureExercice();
// show OK works fine
Component comp = SwingUtilities.getRoot(CloturePanel.this);
JOptionPane.showMessageDialog(CloturePanel.this, "Exercice clôturé", "Fin de la clôture", JOptionPane.INFORMATION_MESSAGE);
((JFrame) comp).dispose();
} catch (Exception ex) {
ExceptionHandler.handle("Erreur lors de la clôture", ex);
}
valider.setEnabled(false);
dateFerm.setEnabled(false);
dateOuv.setEnabled(false);
 
new Thread(new Runnable() {
public void run() {
try {
clotureExercice();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
// show OK works fine
Component comp = SwingUtilities.getRoot(CloturePanel.this);
JOptionPane.showMessageDialog(CloturePanel.this, "Exercice clôturé", "Fin de la clôture", JOptionPane.INFORMATION_MESSAGE);
if (comp != null) {
((JFrame) comp).dispose();
}
}
});
} catch (Exception ex) {
ExceptionHandler.handle("Erreur lors de la clôture", ex);
}
}
}).start();
 
}
});
 
222,15 → 238,19
 
private void clotureExercice() throws SQLException {
 
SQLRow rowPrefCompte = this.tablePrefCompte.getRow(2);
int id_Compte_Bilan_Ouverture = rowPrefCompte.getInt("ID_COMPTE_PCE_BILAN_O");
if (id_Compte_Bilan_Ouverture <= 1) {
final SQLRow rowPrefCompte = this.tablePrefCompte.getRow(2);
final int id_Compte_Bilan_Ouverture;
if (rowPrefCompte.getInt("ID_COMPTE_PCE_BILAN_O") <= 1) {
id_Compte_Bilan_Ouverture = ComptePCESQLElement.getId("890");
} else {
id_Compte_Bilan_Ouverture = rowPrefCompte.getInt("ID_COMPTE_PCE_BILAN_O");
}
 
int id_Compte_Bilan_Cloture = rowPrefCompte.getInt("ID_COMPTE_PCE_BILAN_F");
if (id_Compte_Bilan_Cloture <= 1) {
final int id_Compte_Bilan_Cloture;
if (rowPrefCompte.getInt("ID_COMPTE_PCE_BILAN_F") <= 1) {
id_Compte_Bilan_Cloture = ComptePCESQLElement.getId("891");
} else {
id_Compte_Bilan_Cloture = rowPrefCompte.getInt("ID_COMPTE_PCE_BILAN_F");
}
 
/*******************************************************************************************
237,132 → 257,152
* Validation des écritures
******************************************************************************************/
EcritureSQLElement.validationEcrituresBefore((Date) this.rowExercice.getObject("DATE_FIN"), true);
/*******************************************************************************************
* Solde des comptes de gestion 6* et 7* (génération du résultat)
******************************************************************************************/
this.opEnCours.setText("En cours: solde des comptes 6 et 7");
long time = new Date().getTime();
System.err.println("Start :: " + time);
soldeCompte(false);
 
/*******************************************************************************************
* Solde des autres comptes (comptes de bilan)
******************************************************************************************/
this.opEnCours.setText("En cours: solde des comptes autres que 6 et 7");
this.bar.setValue(1);
soldeCompte(true);
SQLUtils.executeAtomic(this.tablePrefCompte.getDBSystemRoot().getDataSource(), new SQLUtils.SQLFactory<Object>() {
@Override
public Object create() throws SQLException {
 
long time2 = new Date().getTime();
System.err.println("Stop :: " + time2);
System.err.println("Time :: " + (time2 - time));
/*******************************************************************************************
* Solde des comptes de gestion 6* et 7* (génération du résultat)
******************************************************************************************/
SwingUtilities.invokeLater(new Runnable() {
public void run() {
CloturePanel.this.opEnCours.setText("En cours: solde des comptes 6 et 7");
}
});
long time = new Date().getTime();
System.err.println("Start :: " + time);
soldeCompte(false);
 
/*******************************************************************************************
* Reouverture des comptes de bilan
******************************************************************************************/
this.opEnCours.setText("En cours: report des à nouveaux");
this.bar.setValue(2);
// transfert du compte bilan fermeture vers le compte bilan ouverture
SQLTable ecritureTable = this.base.getTable("ECRITURE");
SQLTable compteTable = this.base.getTable("COMPTE_PCE");
SQLSelect sel = new SQLSelect(this.base);
/*******************************************************************************************
* Solde des autres comptes (comptes de bilan)
******************************************************************************************/
SwingUtilities.invokeLater(new Runnable() {
public void run() {
CloturePanel.this.opEnCours.setText("En cours: solde des comptes autres que 6 et 7");
CloturePanel.this.bar.setValue(1);
}
});
soldeCompte(true);
 
sel.addSelect(compteTable.getKey());
sel.addSelect(compteTable.getField("NUMERO"));
sel.addSelect(compteTable.getField("NOM"));
sel.addSelect(ecritureTable.getField("DEBIT"), "SUM");
sel.addSelect(ecritureTable.getField("CREDIT"), "SUM");
long time2 = new Date().getTime();
System.err.println("Stop :: " + time2);
System.err.println("Time :: " + (time2 - time));
 
Where w = new Where(ecritureTable.getField("ID_COMPTE_PCE"), "=", id_Compte_Bilan_Cloture);
w = w.and(new Where(ecritureTable.getField("ID_COMPTE_PCE"), "=", compteTable.getKey()));
sel.setWhere(w);
/*******************************************************************************************
* Reouverture des comptes de bilan
******************************************************************************************/
SwingUtilities.invokeLater(new Runnable() {
public void run() {
CloturePanel.this.opEnCours.setText("En cours: report des à nouveaux");
CloturePanel.this.bar.setValue(2);
}
});
// transfert du compte bilan fermeture vers le compte bilan ouverture
SQLTable ecritureTable = CloturePanel.this.base.getTable("ECRITURE");
SQLTable compteTable = CloturePanel.this.base.getTable("COMPTE_PCE");
SQLSelect sel = new SQLSelect(CloturePanel.this.base);
 
String req = sel.asString() + " GROUP BY \"COMPTE_PCE\".\"ID\", \"COMPTE_PCE\".\"NUMERO\", \"COMPTE_PCE\".\"NOM\" ORDER BY \"COMPTE_PCE\".\"NUMERO\"";
System.out.println(req);
sel.addSelect(compteTable.getKey());
sel.addSelect(compteTable.getField("NUMERO"));
sel.addSelect(compteTable.getField("NOM"));
sel.addSelect(ecritureTable.getField("DEBIT"), "SUM");
sel.addSelect(ecritureTable.getField("CREDIT"), "SUM");
 
Object ob = this.base.getDataSource().execute(req, new ArrayListHandler());
Where w = new Where(ecritureTable.getField("ID_COMPTE_PCE"), "=", id_Compte_Bilan_Cloture);
w = w.and(new Where(ecritureTable.getField("ID_COMPTE_PCE"), "=", compteTable.getKey()));
sel.setWhere(w);
 
List myList = (List) ob;
String req = sel.asString() + " GROUP BY \"COMPTE_PCE\".\"ID\", \"COMPTE_PCE\".\"NUMERO\", \"COMPTE_PCE\".\"NOM\" ORDER BY \"COMPTE_PCE\".\"NUMERO\"";
System.out.println(req);
 
if (myList.size() != 0) {
GenerationMvtVirement gen = new GenerationMvtVirement(1, id_Compte_Bilan_Cloture, 0, 0, "Fermeture du compte ", this.rowExercice.getDate("DATE_FIN").getTime(), JournalSQLElement.OD,
"Fermeture des comptes");
for (int i = 0; i < myList.size(); i++) {
Object ob = CloturePanel.this.base.getDataSource().execute(req, new ArrayListHandler());
 
Object[] objTmp = (Object[]) myList.get(i);
Compte cptTmp = new Compte(((Number) objTmp[0]).intValue(), objTmp[1].toString(), objTmp[2].toString(), "", ((Number) objTmp[3]).longValue(), ((Number) objTmp[4]).longValue());
// vecteurCompte.add(cptTmp);
List myList = (List) ob;
 
long solde = cptTmp.getTotalDebit() - cptTmp.getTotalCredit();
if (myList.size() != 0) {
GenerationMvtVirement gen = new GenerationMvtVirement(1, id_Compte_Bilan_Cloture, 0, 0, "Fermeture du compte ", CloturePanel.this.rowExercice.getDate("DATE_FIN").getTime(),
JournalSQLElement.OD, "Fermeture des comptes");
for (int i = 0; i < myList.size(); i++) {
 
if (solde != 0) {
Object[] objTmp = (Object[]) myList.get(i);
Compte cptTmp = new Compte(((Number) objTmp[0]).intValue(), objTmp[1].toString(), objTmp[2].toString(), "", ((Number) objTmp[3]).longValue(), ((Number) objTmp[4]).longValue());
// vecteurCompte.add(cptTmp);
 
long solde = cptTmp.getTotalDebit() - cptTmp.getTotalCredit();
 
if (solde != 0) {
if (solde > 0) {
gen.setValues(cptTmp.getId(), id_Compte_Bilan_Cloture, 0, Math.abs(solde), "Fermeture du compte " + cptTmp.getNumero(),
CloturePanel.this.rowExercice.getDate("DATE_FIN").getTime(), JournalSQLElement.OD, false);
 
} else {
gen.setValues(cptTmp.getId(), id_Compte_Bilan_Cloture, Math.abs(solde), 0, "Fermeture du compte " + cptTmp.getNumero(),
CloturePanel.this.rowExercice.getDate("DATE_FIN").getTime(), JournalSQLElement.OD, false);
}
gen.genereMouvement();
}
}
}
/*******************************************************************************************
* Validation des écritures de clotures
******************************************************************************************/
SwingUtilities.invokeLater(new Runnable() {
public void run() {
CloturePanel.this.opEnCours.setText("En cours: validation des écritures de l'exercice");
CloturePanel.this.bar.setValue(3);
}
});
EcritureSQLElement.validationEcrituresBefore((Date) CloturePanel.this.rowExercice.getObject("DATE_FIN"), true);
 
// A nouveaux
Object[] compteAnouveau = CloturePanel.this.mRAN.keySet().toArray();
GenerationMvtVirement genAnouveaux = new GenerationMvtVirement(id_Compte_Bilan_Ouverture, 1, 0, 0, "A nouveaux", CloturePanel.this.dateOuv.getValue(), JournalSQLElement.OD,
"A nouveaux");
for (int i = 0; i < CloturePanel.this.mRAN.keySet().size(); i++) {
 
long solde = CloturePanel.this.mRAN.get(compteAnouveau[i]).longValue();
 
// if (solde != 0) {
if (solde > 0) {
gen.setValues(cptTmp.getId(), id_Compte_Bilan_Cloture, 0, Math.abs(solde), "Fermeture du compte " + cptTmp.getNumero(), this.rowExercice.getDate("DATE_FIN").getTime(),
genAnouveaux.setValues(id_Compte_Bilan_Ouverture, Integer.parseInt(compteAnouveau[i].toString()), 0, Math.abs(solde), "A nouveaux", CloturePanel.this.dateOuv.getValue(),
JournalSQLElement.OD, false);
 
} else {
gen.setValues(cptTmp.getId(), id_Compte_Bilan_Cloture, Math.abs(solde), 0, "Fermeture du compte " + cptTmp.getNumero(), this.rowExercice.getDate("DATE_FIN").getTime(),
genAnouveaux.setValues(id_Compte_Bilan_Ouverture, Integer.parseInt(compteAnouveau[i].toString()), Math.abs(solde), 0, "A nouveaux", CloturePanel.this.dateOuv.getValue(),
JournalSQLElement.OD, false);
}
gen.genereMouvement();
genAnouveaux.genereMouvement();
// }
}
}
}
/*******************************************************************************************
* Validation des écritures de clotures
******************************************************************************************/
this.opEnCours.setText("En cours: validation des écritures de l'exercice");
this.bar.setValue(3);
EcritureSQLElement.validationEcrituresBefore((Date) this.rowExercice.getObject("DATE_FIN"), true);
 
// A nouveaux
Object[] compteAnouveau = this.mRAN.keySet().toArray();
GenerationMvtVirement genAnouveaux = new GenerationMvtVirement(id_Compte_Bilan_Ouverture, 1, 0, 0, "A nouveaux", this.dateOuv.getValue(), JournalSQLElement.OD, "A nouveaux");
for (int i = 0; i < this.mRAN.keySet().size(); i++) {
// Fixé la nouvel date de l'exercice
SQLRowValues valsExercice = new SQLRowValues(CloturePanel.this.exercice);
valsExercice.put("CLOTURE", Boolean.TRUE);
valsExercice.update(CloturePanel.this.rowExercice.getID());
 
long solde = this.mRAN.get(compteAnouveau[i]).longValue();
// Creation d'un nouvel exercice
valsExercice.put("CLOTURE", Boolean.FALSE);
valsExercice.put("DATE_DEB", new java.sql.Date(CloturePanel.this.dateOuv.getValue().getTime()));
valsExercice.put("DATE_FIN", new java.sql.Date(CloturePanel.this.dateFerm.getValue().getTime()));
valsExercice.put("ID_SOCIETE_COMMON", CloturePanel.this.rowSociete.getID());
SQLRow rowNewEx = valsExercice.insert();
 
// if (solde != 0) {
if (solde > 0) {
genAnouveaux.setValues(id_Compte_Bilan_Ouverture, Integer.parseInt(compteAnouveau[i].toString()), 0, Math.abs(solde), "A nouveaux", this.dateOuv.getValue(), JournalSQLElement.OD,
false);
} else {
genAnouveaux.setValues(id_Compte_Bilan_Ouverture, Integer.parseInt(compteAnouveau[i].toString()), Math.abs(solde), 0, "A nouveaux", this.dateOuv.getValue(), JournalSQLElement.OD,
false);
// mise a jour de l'exercice de la societe
SQLRowValues rowValsSociete = new SQLRowValues(CloturePanel.this.societe);
rowValsSociete.put("ID_EXERCICE_COMMON", rowNewEx.getID());
rowValsSociete.update(CloturePanel.this.rowSociete.getID());
// Recharge les informations de la societe pour pointer sur le nouvel exercice
ComptaPropsConfiguration.getInstanceCompta().getRowSociete().fetchValues();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
CloturePanel.this.bar.setValue(4);
CloturePanel.this.opEnCours.setText("Etat: clôture terminée");
}
});
 
return null;
}
genAnouveaux.genereMouvement();
// }
}
 
// Fixé la nouvel date de l'exercice
SQLRowValues valsExercice = new SQLRowValues(this.exercice);
valsExercice.put("CLOTURE", Boolean.TRUE);
try {
valsExercice.update(this.rowExercice.getID());
} catch (SQLException e) {
 
e.printStackTrace();
}
 
// Creation d'un nouvel exercice
valsExercice.put("CLOTURE", Boolean.FALSE);
valsExercice.put("DATE_DEB", new java.sql.Date(this.dateOuv.getValue().getTime()));
valsExercice.put("DATE_FIN", new java.sql.Date(this.dateFerm.getValue().getTime()));
valsExercice.put("ID_SOCIETE_COMMON", this.rowSociete.getID());
try {
SQLRow rowNewEx = valsExercice.insert();
 
// mise a jour de l'exercice de la societe
SQLRowValues rowValsSociete = new SQLRowValues(this.societe);
rowValsSociete.put("ID_EXERCICE_COMMON", rowNewEx.getID());
rowValsSociete.update(this.rowSociete.getID());
// Recharge les informations de la societe pour pointer sur le nouvel exercice
ComptaPropsConfiguration.getInstanceCompta().getRowSociete().fetchValues();
} catch (SQLException e) {
 
e.printStackTrace();
}
this.bar.setValue(4);
this.opEnCours.setText("Etat: clôture terminée");
});
}
 
private void soldeCompte(boolean compteBilan) throws SQLException {
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/ui/CompteGestCommPreferencePanel.java
40,8 → 40,8
 
public class CompteGestCommPreferencePanel extends DefaultPreferencePanel {
 
private ISQLCompteSelector selCompteTVAIntraComm, selCompteFourn, selCompteAchat, selCompteClient, selCompteVenteProduits, selCompteVenteService, selCompteTVACol, selCompteTVADed,
selCompteTVAImmo, selCompteAchatIntra, selCompteFactor, selComptePortSoumis, selComptePortNonSoumis;
private ISQLCompteSelector selCompteTVAIntraComm, selCompteFourn, selCompteAchat, selCompteValeurEncaissement, selCompteAvanceClient, selCompteClient, selCompteVenteProduits,
selCompteVenteService, selCompteTVACol, selCompteTVADed, selCompteTVAImmo, selCompteAchatIntra, selCompteFactor, selComptePortSoumis, selComptePortNonSoumis;
private ElementComboBox selJrnlFactor;
private final static SQLBase base = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
private static final SQLTable tablePrefCompte = base.getTable("PREFS_COMPTE");
145,6 → 145,28
this.selCompteClient.init();
this.add(this.selCompteClient, c);
 
// Avance Compte client
c.gridy++;
c.weightx = 0;
this.add(new JLabel("Compte Avance Client"), c);
c.weightx = 1;
c.gridx++;
 
this.selCompteAvanceClient = new ISQLCompteSelector();
this.selCompteAvanceClient.init();
this.add(this.selCompteAvanceClient, c);
 
// Valeur à l'encaissement
c.gridy++;
c.weightx = 0;
this.add(new JLabel("Compte dépôt chèque"), c);
c.weightx = 1;
c.gridx++;
 
this.selCompteValeurEncaissement = new ISQLCompteSelector();
this.selCompteValeurEncaissement.init();
this.add(this.selCompteValeurEncaissement, c);
 
// Compte vente produits
c.gridy++;
c.weightx = 0;
298,6 → 320,8
this.rowPrefCompteVals.put("ID_JOURNAL_FACTOR", (selectedId > 1) ? selectedId : 1);
this.rowPrefCompteVals.put("ID_COMPTE_PCE_FOURNISSEUR", this.selCompteFourn.getValue());
this.rowPrefCompteVals.put("ID_COMPTE_PCE_CLIENT", this.selCompteClient.getValue());
this.rowPrefCompteVals.put("ID_COMPTE_PCE_AVANCE_CLIENT", this.selCompteAvanceClient.getValue());
this.rowPrefCompteVals.put("ID_COMPTE_PCE_VALEUR_ENCAISSEMENT", this.selCompteValeurEncaissement.getValue());
this.rowPrefCompteVals.put("ID_COMPTE_PCE_TVA_ACHAT", this.selCompteTVADed.getValue());
this.rowPrefCompteVals.put("ID_COMPTE_PCE_TVA_VENTE", this.selCompteTVACol.getValue());
this.rowPrefCompteVals.put("ID_COMPTE_PCE_TVA_INTRA", this.selCompteTVAIntraComm.getValue());
358,6 → 382,14
value = ComptePCESQLElement.getId(compte);
this.selCompteClient.setValue(value);
 
// AvanceClient
compte = ComptePCESQLElement.getComptePceDefault("AvanceClients");
value = ComptePCESQLElement.getId(compte);
this.selCompteAvanceClient.setValue(value);
 
compte = ComptePCESQLElement.getComptePceDefault("ValeurEncaissement");
value = ComptePCESQLElement.getId(compte);
this.selCompteValeurEncaissement.setValue(value);
// Port
compte = ComptePCESQLElement.getComptePceDefault("PortVenteSoumisTVA");
value = ComptePCESQLElement.getId(compte);
416,6 → 448,8
 
setComboValues(selCompteFourn, "ID_COMPTE_PCE_FOURNISSEUR", "Fournisseurs");
setComboValues(selCompteClient, "ID_COMPTE_PCE_CLIENT", "Clients");
setComboValues(selCompteAvanceClient, "ID_COMPTE_PCE_AVANCE_CLIENT", "AvanceClients");
setComboValues(selCompteValeurEncaissement, "ID_COMPTE_PCE_VALEUR_ENCAISSEMENT", "ValeurEncaissement");
setComboValues(selComptePortSoumis, "ID_COMPTE_PCE_PORT_SOUMIS", "PortVenteSoumisTVA");
setComboValues(selComptePortNonSoumis, "ID_COMPTE_PCE_PORT_NON_SOUMIS", "PortVenteNonSoumisTVA");
setComboValues(selCompteTVACol, "ID_COMPTE_PCE_TVA_VENTE", "TVACollectee");
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/ui/ComptaPrefTreeNode.java
20,6 → 20,7
import org.openconcerto.erp.modules.AbstractModule;
import org.openconcerto.erp.modules.ModuleManager;
import org.openconcerto.erp.modules.ModulePreferencePanelDesc;
import org.openconcerto.erp.preferences.AttachmentPreferencePanel;
import org.openconcerto.erp.preferences.GenerationDeclarationDocPreferencePanel;
import org.openconcerto.erp.preferences.GenerationDocGlobalPreferencePanel;
import org.openconcerto.erp.preferences.GenerationDocumentComptaPreferencePanel;
142,8 → 143,10
final PrefTreeNode nDestGestComm = new PrefTreeNode(GenerationDocumentGestCommPreferencePanel.class, "Gestion commerciale", new String[] { "destination" });
final PrefTreeNode nDestPaye = new PrefTreeNode(GenerationDocumentPayePreferencePanel.class, "Paye", new String[] { "destination" });
final PrefTreeNode nDestEtat = new PrefTreeNode(GenerationDeclarationDocPreferencePanel.class, "Déclaration", new String[] { "Déclaration", "destination" });
final PrefTreeNode nGED = new PrefTreeNode(AttachmentPreferencePanel.class, "GED", new String[] { "GED", "EDM" });
 
nDest.add(nDestCompta);
nDest.add(nGED);
nDest.add(nDestGestComm);
nDest.add(nDestPaye);
nDest.add(nDestEtat);
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/model/CurrencyConverter.java
48,7 → 48,7
}
 
public CurrencyConverter() {
this(ComptaPropsConfiguration.getInstanceCompta().getRootSociete(), ComptaPropsConfiguration.getInstanceCompta().getRowSociete().getForeign("ID_DEVISE").getString("CODE"), "EUR");
this(ComptaPropsConfiguration.getInstanceCompta().getRootSociete(), ComptaPropsConfiguration.getInstanceCompta().getCurrency().getCode(), "EUR");
}
 
public String getCompanyCurrencyCode() {
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/model/PlanComptableGModel.java
92,6 → 92,9
if (w2 != null) {
w1 = w1.and(w2);
}
if (compteTable.getName().equals("COMPTE_PCE")) {
w1 = w1.and(new Where(compteTable.getField("OBSOLETE"), "=", Boolean.FALSE));
}
selCompte.setWhere(w1);
 
selCompte.addRawOrder("\"" + table + "\".\"NUMERO\"");
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/model/Currency.java
17,13 → 17,24
import java.util.Map;
 
public class Currency {
 
private String code;
 
public Currency(String code) {
this.code = code;
}
 
public String getCode() {
return code;
}
 
public static String[] ISO_CODES = { "AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD", "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BRL", "BSD", "BTN",
"BWP", "BYR", "BZD", "CAD", "CDF", "CHF", "CLP", "CNY", "COP", "CRC", "CUC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR", "FJD", "FKP", "GBP", "GEL",
"GGP", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "IMP", "INR", "IQD", "IRR", "ISK", "JEP", "JMD", "JOD", "JPY", "KES", "KGS", "KHR",
"KMF", "KPW", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LYD", "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRO", "MUR", "MVR", "MWK", "MXN", "MYR", "MZN",
"NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP",
"SLL", "SOS", "SPL", "SRD", "STD", "SVC", "SYP", "SZL", "THB", "TJS", "TMT", "TND", "TOP", "TRY", "TTD", "TVD", "TWD", "TZS", "UAH", "UGX", "USD", "UYU", "UZS", "VEF", "VND", "VUV",
"WST", "XAF", "XCD", "XDR", "XOF", "XPF", "YER", "ZAR", "ZMW", "ZWD" };
"BWP", "BYR", "BZD", "CAD", "CDF", "CHF", "CLP", "CNY", "COP", "CRC", "CUC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR", "FJD", "FKP", "GBP", "GEL", "GGP",
"GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "IMP", "INR", "IQD", "IRR", "ISK", "JEP", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW",
"KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LYD", "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRO", "MUR", "MVR", "MWK", "MXN", "MYR", "MZN", "NAD", "NGN", "NIO",
"NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP", "SLL", "SOS", "SPL", "SRD",
"STD", "SVC", "SYP", "SZL", "THB", "TJS", "TMT", "TND", "TOP", "TRY", "TTD", "TVD", "TWD", "TZS", "UAH", "UGX", "USD", "UYU", "UZS", "VEF", "VND", "VUV", "WST", "XAF", "XCD", "XDR", "XOF",
"XPF", "YER", "ZAR", "ZMW", "ZWD" };
 
private static final Map<String, String> mapSymbol;
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/tax/element/TaxeSQLElement.java
142,8 → 142,6
ISQLCompteSelector compteCol = new ISQLCompteSelector();
this.add(compteCol, c);
 
 
 
JLabel labelCompteDed = new JLabel(getLabelFor("ID_COMPTE_PCE_DED"), SwingConstants.RIGHT);
c.gridx = 0;
c.gridy++;
158,7 → 156,6
ISQLCompteSelector compteDed = new ISQLCompteSelector();
this.add(compteDed, c);
 
JLabel labelCompteVente = new JLabel(getLabelFor("ID_COMPTE_PCE_VENTE"), SwingConstants.RIGHT);
c.fill = GridBagConstraints.HORIZONTAL;
c.gridwidth = 1;
184,7 → 181,32
c.gridwidth = GridBagConstraints.REMAINDER;
ISQLCompteSelector compteVenteS = new ISQLCompteSelector();
this.add(compteVenteS, c);
 
JLabel labelCompteColIntra = new JLabel(getLabelFor("ID_COMPTE_PCE_COLLECTE_INTRA"), SwingConstants.RIGHT);
c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 0;
c.gridy++;
this.add(labelCompteColIntra, c);
c.gridx++;
c.weightx = 1;
c.gridwidth = GridBagConstraints.REMAINDER;
ISQLCompteSelector compteColIntra = new ISQLCompteSelector();
this.add(compteColIntra, c);
 
JLabel labelCompteDedIntra = new JLabel(getLabelFor("ID_COMPTE_PCE_DED_INTRA"), SwingConstants.RIGHT);
c.gridx = 0;
c.gridy++;
c.weightx = 0;
c.gridwidth = 1;
c.fill = GridBagConstraints.HORIZONTAL;
this.add(labelCompteDedIntra, c);
c.gridx++;
c.weightx = 1;
 
c.gridwidth = GridBagConstraints.REMAINDER;
ISQLCompteSelector compteDedIntra = new ISQLCompteSelector();
this.add(compteDedIntra, c);
 
// Spacer
c.gridy++;
c.weighty = 1;
195,8 → 217,9
this.addSQLObject(compteDed, "ID_COMPTE_PCE_DED");
this.addSQLObject(compteVente, "ID_COMPTE_PCE_VENTE");
this.addSQLObject(compteVenteS, "ID_COMPTE_PCE_VENTE_SERVICE");
this.addSQLObject(compteColIntra, "ID_COMPTE_PCE_COLLECTE_INTRA");
this.addSQLObject(compteDedIntra, "ID_COMPTE_PCE_DED_INTRA");
 
 
this.addRequiredSQLObject(fieldNom, "NOM");
this.addRequiredSQLObject(fieldTaux, "TAUX");
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/tax/element/TaxeComplementaireSQLElement.java
Nouveau fichier
0,0 → 1,126
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.finance.tax.element;
 
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.erp.model.ISQLCompteSelector;
import org.openconcerto.sql.element.BaseSQLComponent;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.ui.DefaultGridBagConstraints;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.ArrayList;
import java.util.List;
 
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
 
public class TaxeComplementaireSQLElement extends ComptaSQLConfElement {
 
public TaxeComplementaireSQLElement() {
super("TAXE_COMPLEMENTAIRE", "une taxe complémentaire", "taxes complémentaires");
 
}
 
protected List<String> getListFields() {
final List<String> l = new ArrayList<String>();
l.add("NOM");
l.add("POURCENT");
l.add("ID_COMPTE_PCE");
l.add("ID_COMPTE_PCE_PRODUITS");
return l;
}
 
protected List<String> getComboFields() {
final List<String> l = new ArrayList<String>();
l.add("NOM");
return l;
}
 
public SQLComponent createComponent() {
return new BaseSQLComponent(this) {
 
@Override
protected void addViews() {
 
this.setLayout(new GridBagLayout());
GridBagConstraints c = new DefaultGridBagConstraints();
JLabel labelNom = new JLabel(getLabelFor("NOM"), SwingConstants.RIGHT);
 
this.add(labelNom, c);
c.gridx++;
c.weightx = 1;
c.fill = GridBagConstraints.NONE;
JTextField fieldNom = new JTextField(40);
DefaultGridBagConstraints.lockMinimumSize(fieldNom);
this.add(fieldNom, c);
c.gridx = 0;
c.gridy++;
c.weightx = 0;
c.fill = GridBagConstraints.HORIZONTAL;
JLabel labelTaux = new JLabel(getLabelFor("POURCENT"), SwingConstants.RIGHT);
this.add(labelTaux, c);
c.gridx++;
c.fill = GridBagConstraints.NONE;
JTextField fieldTaux = new JTextField(6);
DefaultGridBagConstraints.lockMinimumSize(fieldTaux);
this.add(fieldTaux, c);
 
JLabel labelCompteCol = new JLabel(getLabelFor("ID_COMPTE_PCE"), SwingConstants.RIGHT);
c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 0;
c.gridy++;
this.add(labelCompteCol, c);
c.gridx++;
c.weightx = 1;
c.gridwidth = GridBagConstraints.REMAINDER;
ISQLCompteSelector compte = new ISQLCompteSelector();
this.add(compte, c);
 
JLabel labelCompteDed = new JLabel(getLabelFor("ID_COMPTE_PCE_PRODUITS"), SwingConstants.RIGHT);
c.gridx = 0;
c.gridy++;
c.weightx = 0;
c.gridwidth = 1;
c.fill = GridBagConstraints.HORIZONTAL;
this.add(labelCompteDed, c);
c.gridx++;
c.weightx = 1;
 
c.gridwidth = GridBagConstraints.REMAINDER;
ISQLCompteSelector compteProduits = new ISQLCompteSelector();
this.add(compteProduits, c);
 
// Spacer
c.gridy++;
c.weighty = 1;
c.anchor = GridBagConstraints.NORTHWEST;
this.add(new JPanel(), c);
 
this.addRequiredSQLObject(compte, "ID_COMPTE_PCE");
this.addRequiredSQLObject(compteProduits, "ID_COMPTE_PCE_PRODUITS");
this.addRequiredSQLObject(fieldNom, "NOM");
this.addRequiredSQLObject(fieldTaux, "POURCENT");
}
};
}
 
@Override
protected String createCode() {
return "finance.tax.complement";
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/tax/action/ReportingEcoContributionPanel.java
Nouveau fichier
0,0 → 1,106
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
/*
* Créé le 23 avr. 2012
*/
package org.openconcerto.erp.core.finance.tax.action;
 
import org.openconcerto.erp.generationDoc.gestcomm.ReportingEcoContributionSheetXML;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.JDate;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Calendar;
import java.util.concurrent.ExecutionException;
 
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
 
public class ReportingEcoContributionPanel extends JPanel {
 
public ReportingEcoContributionPanel() {
super(new GridBagLayout());
 
JLabel labelCom = new JLabel("Période du ");
 
GridBagConstraints c = new DefaultGridBagConstraints();
this.add(labelCom, c);
c.gridx++;
final JDate dateDeb = new JDate();
this.add(dateDeb, c);
c.gridx++;
JLabel labelYear = new JLabel("au");
final JDate dateFin = new JDate();
 
Calendar cal = Calendar.getInstance();
cal.set(Calendar.MONTH, Calendar.JANUARY);
cal.set(Calendar.DAY_OF_MONTH, 1);
dateDeb.setValue(cal.getTime());
 
this.add(labelYear, c);
c.gridx++;
this.add(dateFin, c);
cal.set(Calendar.MONTH, Calendar.DECEMBER);
cal.set(Calendar.DAY_OF_MONTH, 31);
dateFin.setValue(cal.getTime());
 
final JButton buttonValid = new JButton(new AbstractAction("Valider") {
 
@Override
public void actionPerformed(ActionEvent e) {
 
new Thread() {
public void run() {
ReportingEcoContributionSheetXML sheet = new ReportingEcoContributionSheetXML(dateDeb.getValue(), dateFin.getValue());
try {
sheet.createDocument();
} catch (InterruptedException exn) {
exn.printStackTrace();
} catch (ExecutionException exn) {
exn.printStackTrace();
}
sheet.showPrintAndExport(true, false, false);
 
};
}.start();
 
}
 
});
c.gridx++;
// buttonValid.setEnabled(false);
this.add(buttonValid, c);
dateDeb.addValueListener(new PropertyChangeListener() {
 
@Override
public void propertyChange(PropertyChangeEvent evt) {
buttonValid.setEnabled(dateDeb.getValue() != null && dateFin.getValue() != null);
}
});
dateFin.addValueListener(new PropertyChangeListener() {
 
@Override
public void propertyChange(PropertyChangeEvent evt) {
buttonValid.setEnabled(dateDeb.getValue() != null && dateFin.getValue() != null);
}
});
}
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/tax/model/TaxeCache.java
73,6 → 73,17
return this.mapTaux.get(Integer.valueOf(idTaux));
}
 
public SQLRowAccessor getRowFromId(final int idTaux) {
Set<SQLRowAccessor> s = mapRowTaux.keySet();
for (SQLRowAccessor r : s) {
if (r.getID() == idTaux) {
return r;
}
}
return null;
 
}
 
public SQLRow getFirstTaxe() {
if (this.firstIdTaxe == null) {
final SQLSelect sel = getSel();
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/payment/element/ChequeSQLElement.java
15,9 → 15,7
 
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.erp.core.finance.payment.ui.GestionChequesRenderer;
import org.openconcerto.sql.FieldExpander;
import org.openconcerto.sql.ShowAs;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.request.ListSQLRequest;
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
31,21 → 29,9
}
 
protected final SQLTableModelSourceOnline createDepositTableSource(final List<String> fields, final ShowAs showAs, final Where w) {
final ListSQLRequest req = new ListSQLRequest(getTable(), fields) {
@Override
protected void customizeToFetch(SQLRowValues graphToFetch) {
super.customizeToFetch(graphToFetch);
graphToFetch.putNulls(getDoneFieldName());
}
 
@Override
protected FieldExpander getShowAs() {
return showAs;
}
};
req.setWhere(new Where(this.getTable().getField(this.getDoneFieldName()), "=", Boolean.FALSE).and(w));
 
final SQLTableModelSourceOnline res = new SQLTableModelSourceOnline(req);
final ListSQLRequest req = this.createListRequest(fields, new Where(this.getTable().getField(this.getDoneFieldName()), "=", Boolean.FALSE).and(w), showAs);
req.addToGraphToFetch(getDoneFieldName());
final SQLTableModelSourceOnline res = this.instantiateTableSourceOnline(req);
res.init();
res.getColumn(getTable().getField(getMinDateFieldName())).setRenderer(new GestionChequesRenderer());
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/payment/element/EncaisserMontantSQLElement.java
31,7 → 31,7
import org.openconcerto.sql.model.graph.Path;
import org.openconcerto.sql.model.graph.PathBuilder;
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
import org.openconcerto.sql.view.list.SQLTableModelSource;
import org.openconcerto.utils.CollectionUtils;
 
import java.sql.SQLException;
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/payment/element/TypeReglementSQLElement.java
34,7 → 34,9
public static final int CB = 3;
public static final int ESPECE = 4;
public static final int TRAITE = 5;
public static final int INDEFINI = 7;
public static final int INDEFINI = 6;
public static final int VIREMENT = 7;
public static final int CESU = 8;
 
public TypeReglementSQLElement() {
super("TYPE_REGLEMENT", "Type de règlement", "Type de règlement");
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/payment/action/ListeDesReferencesAction.java
91,7 → 91,7
}
};
 
final IListe list = new IListe(elementArticle.initTableSource(new SQLTableModelSourceOnline(req)));
final IListe list = new IListe(elementArticle.createTableSourceOnline(req));
 
IListFrame frame = new IListFrame(new ListeAddPanel(elementArticle, list) {
@Override
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/payment/ui/GestionChequesRenderer.java
24,7 → 24,7
public class GestionChequesRenderer extends DefaultTableCellRenderer {
 
private final static Color couleurChequeValide = new Color(255, 128, 64);
private static final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM);
private final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM);
 
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/employe/report/N4DS.java
14,6 → 14,8
package org.openconcerto.erp.core.humanresources.employe.report;
 
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.erp.core.humanresources.payroll.report.FichePayeSheetXML;
import org.openconcerto.erp.generationDoc.DocumentLocalStorageManager;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.model.SQLRow;
41,7 → 43,7
 
public class N4DS {
 
private static DateFormat format = new SimpleDateFormat("ddMMyyyy");
private DateFormat format = new SimpleDateFormat("ddMMyyyy");
private ComptaPropsConfiguration conf = ((ComptaPropsConfiguration) Configuration.getInstance());
private double masseSalarialeBrute;
private static final byte[] retour = "'\n".getBytes();
65,8 → 67,12
 
public File createDocument() {
this.masseSalarialeBrute = 0;
File f = new File("N4DS_" + format.format(new Date()) + ".txt");
File dir = DocumentLocalStorageManager.getInstance().getDocumentOutputDirectory(FichePayeSheetXML.TEMPLATE_ID);
dir.mkdirs();
File f = new File(dir, "N4DS_" + format.format(new Date()) + ".txt");
 
// File f = new File("N4DS_" + format.format(new Date()) + ".txt");
 
try {
 
this.stream = new PrintStream(f, "ISO-8859-1");
83,6 → 89,16
SQLSelect sel = new SQLSelect();
sel.addSelect(eltSalarie.getTable().getKey());
 
final SQLElement infosElt = eltSalarie.getForeignElement("ID_INFOS_SALARIE_PAYE");
// Date d1 = new Date(116, 0, 1);
Date d2 = new Date(116, 11, 31);
 
Where w = new Where(infosElt.getTable().getKey(), "=", eltSalarie.getTable().getField("ID_INFOS_SALARIE_PAYE"));
w = w.and(new Where(infosElt.getTable().getField("DATE_ARRIVE"), "<=", d2));
w = w.and(new Where(infosElt.getTable().getField("DATE_SORTIE"), "=", (Date) null).or(new Where(infosElt.getTable().getField("DATE_SORTIE"), "<=", d2)));
 
sel.setWhere(w);
 
@SuppressWarnings("unchecked")
List<SQLRow> l = (List<SQLRow>) this.conf.getBase().getDataSource().execute(sel.asString(), new SQLRowListRSH(eltSalarie.getTable()));
 
134,12 → 150,12
complement = complement.substring(0, complement.length() - 1);
}
 
write("S80.G01.00.003.001", complement);
write("S80.G01.00.003.001", normalizeString2(complement));
}
}
 
// Voie
write("S80.G01.00.003.006", voie);
write("S80.G01.00.003.006", normalizeString2(voie));
 
// TODO Code INSEE, facultatif
// stream.write("S80.G01.00.003.007",voie);
226,9 → 242,11
SQLElement eltInfos = this.conf.getDirectory().getElement("INFOS_SALARIE_PAYE");
SQLSelect sel = new SQLSelect();
sel.addSelect(eltSalarie.getTable().getKey());
Date d2 = new Date(112, 11, 31);
// Date d1 = new Date(116, 0, 1);
Date d2 = new Date(116, 11, 31);
Where w = new Where(eltSalarie.getTable().getField("ID_INFOS_SALARIE_PAYE"), "=", eltInfos.getTable().getKey());
w = w.and(new Where(eltInfos.getTable().getField("DATE_SORTIE"), "=", (Date) null).or(new Where(eltInfos.getTable().getField("DATE_SORTIE"), ">", d2)));
w = w.and(new Where(eltInfos.getTable().getField("DATE_SORTIE"), "=", (Date) null).or(new Where(eltInfos.getTable().getField("DATE_SORTIE"), "<=", d2)));
w = w.and(new Where(eltInfos.getTable().getField("DATE_ARRIVE"), "=", (Date) null).or(new Where(eltInfos.getTable().getField("DATE_ARRIVE"), "<=", d2)));
 
sel.setWhere(w);
System.err.println(sel.asString());
241,6 → 259,10
s = s.toUpperCase();
String temp = Normalizer.normalize(s, Form.NFC);
temp = temp.replaceAll("-", " ");
temp = temp.replaceAll("é", "e");
temp = temp.replaceAll("è", "e");
temp = temp.replaceAll("ê", "e");
temp = temp.replaceAll(",", "");
return temp.replaceAll("[^\\p{ASCII}]", "");
}
 
254,13 → 276,13
write("S20.G01.00.001", siren);
 
// Raison sociale
write("S20.G01.00.002", rowSociete.getString("NOM"));
write("S20.G01.00.002", normalizeString2(rowSociete.getString("NOM")));
 
// FIXME Debut periode
write("S20.G01.00.003.001", "01012015");
write("S20.G01.00.003.001", "01012016");
 
// FIXME Fin periode
write("S20.G01.00.003.002", "31122015");
write("S20.G01.00.003.002", "31122016");
 
// Code nature
write("S20.G01.00.004.001", "01");
299,12 → 321,12
complement = complement.substring(0, complement.length() - 1);
}
 
write("S20.G01.00.009.001", complement);
write("S20.G01.00.009.001", normalizeString2(complement));
}
}
 
// Voie
write("S20.G01.00.009.006", voie);
write("S20.G01.00.009.006", normalizeString2(voie));
 
// Code postal
write("S20.G01.00.009.010", rowAdr.getString("CODE_POSTAL"));
339,7 → 361,7
write("S10.G01.00.001.002", nic);
 
// Raison sociale
write("S10.G01.00.002", rowSociete.getString("NOM"));
write("S10.G01.00.002", normalizeString2(rowSociete.getString("NOM")));
 
SQLRow rowAdr = rowSociete.getForeignRow("ID_ADRESSE_COMMON");
String voie = rowAdr.getString("RUE");
357,12 → 379,12
complement = complement.substring(0, complement.length() - 1);
}
 
write("S10.G01.00.003.001", complement);
write("S10.G01.00.003.001", normalizeString2(complement));
}
}
 
// Voie
write("S10.G01.00.003.006", voie);
write("S10.G01.00.003.006", normalizeString2(voie));
 
// TODO Code INSEE, facultatif
// stream.write("S10.G01.00.003.007",voie);
400,7 → 422,7
write("S10.G01.00.010", "02");
 
// Norme utilisée
write("S10.G01.00.011", "V01X10");
write("S10.G01.00.011", "V01X11");
 
// Code table char
write("S10.G01.00.012", "01");
437,8 → 459,13
write("S10.G01.01.005", rowContact.getString("EMAIL"));
 
// Tel
write("S10.G01.01.006", rowContact.getString("TEL_DIRECT"));
String string = rowContact.getString("TEL_DIRECT");
if (string.trim().length() == 0) {
string = rowContact.getString("TEL_STANDARD");
}
 
write("S10.G01.01.006", string);
 
// Fax
write("S10.G01.01.007", rowContact.getString("FAX"));
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/employe/report/N4DSSalarie.java
39,12 → 39,12
 
public class N4DSSalarie {
 
private static DateFormat format = new SimpleDateFormat("ddMMyyyy");
private DateFormat format = new SimpleDateFormat("ddMMyyyy");
private ComptaPropsConfiguration conf = ((ComptaPropsConfiguration) Configuration.getInstance());
private N4DS n4ds;
 
Date d = new Date(114, 0, 1);
Date d2 = new Date(114, 11, 31);
Date d = new Date(116, 0, 1);
Date d2 = new Date(116, 11, 31);
 
DecimalFormat decimalFormat = new DecimalFormat("0.00");
 
82,7 → 82,7
n4ds.write("S45.G01.00.001.001", dateFormat.format(dateArrivee.getTime()));
 
// Code situation familiale
n4ds.write("S45.G01.00.002", siutationFam.getString("CODE"));
n4ds.write("S45.G01.00.002", "0" + (siutationFam.getID() - 1));
 
// Nombre d'enfant à charge
n4ds.write("S45.G01.00.006", rowEtatCivil.getString("NB_ENFANTS"));
181,6 → 181,7
 
private void writeS48(SQLRow rowSalarie) throws IOException {
// Assurance chômage
 
n4ds.write("S48.G10.00.015", "01");
n4ds.write("S48.G10.00.016", "90");
n4ds.write("S48.G10.00.017", "01");
199,11 → 200,15
n4ds.write("S65.G40.05.010", "05");
 
// FIXME durée annuelle = 1200heures
n4ds.write("S65.G40.10.023.001", "01");
n4ds.write("S65.G40.10.023.002", "98");
n4ds.write("S65.G40.10.023.003", "98");
n4ds.write("S65.G40.10.023.004", "03");
n4ds.write("S65.G40.10.023.005", "98");
// n4ds.write("S65.G40.10.023.001", "01");
// n4ds.write("S65.G40.10.023.002", "98");
// n4ds.write("S65.G40.10.023.003", "98");
// if (rowSalarie.getString("PRENOM").equalsIgnoreCase("Vincent")) {
// n4ds.write("S65.G40.10.023.004", "12");
// } else {
// n4ds.write("S65.G40.10.023.004", "03");
// }
// n4ds.write("S65.G40.10.023.005", "98");
 
}
 
252,7 → 257,7
SQLRow rowContrat = rowInfos.getForeignRow("ID_CONTRAT_SALARIE");
 
// Nature de l'emploi
n4ds.write("S40.G10.00.010", rowContrat.getString("NATURE"));
n4ds.write("S40.G10.00.010", normalizeString2(rowContrat.getString("NATURE")));
 
// Catégorie socio
SQLRow rowCodeEmploi = rowContrat.getForeignRow("ID_CODE_EMPLOI");
283,7 → 288,13
 
// Convention collective IDCC
SQLRow rowIDCC = rowInfos.getForeignRow("ID_IDCC");
n4ds.write("S40.G10.05.016", rowIDCC.getString("CODE"));
String idcc = rowIDCC.getString("CODE").trim();
if (idcc.length() <= 3) {
for (int c = 0; c < 4 - idcc.length(); c++) {
idcc = "0" + idcc;
}
}
n4ds.write("S40.G10.05.016", idcc);
// FIXME Classement conventionnel
n4ds.write("S40.G10.05.017", "sans classement conventionnel");
 
306,7 → 317,7
 
/**
* Emploi supérieur antérieur de l'agent sous statut personnel de droit public. S40.G10.15
* */
*/
// TODO secteur public
 
/**
336,6 → 347,7
 
// FIXME Temps de travail
double tempsTravail = 1820.00;
 
n4ds.write("S40.G15.00.003", decimalFormat.format(tempsTravail));
n4ds.write("S40.G15.00.022.001", decimalFormat.format(tempsTravail));
n4ds.write("S40.G15.00.022.002", decimalFormat.format(tempsTravail));
386,23 → 398,27
n4ds.write("S40.G30.04.002", decimalFormat.format(getCSG(rowSalarie)));
 
// final double baseBrute = getBaseBrute(rowSalarie);
final double smicMensuel = 9.53;
final double smicMensuel = 9.61;
if ((baseBrute) < (2.5 * smicMensuel * 12 * 151.6667)) {
 
n4ds.write("S40.G30.40.001", String.valueOf("17344.60"));
n4ds.write("S40.G30.40.001", String.valueOf("17490.00"));
n4ds.write("S40.G30.40.002", decimalFormat.format(baseBrute));
}
 
if ((baseBrute / 12.0 / 151.6667) < (1.6 * smicMensuel)) {
double COEFF_FILLON = (0.281 / 0.6) * ((1.6 * smicMensuel * 12 * 151.6667 / (rowSalarie.getForeign("ID_INFOS_SALARIE_PAYE").getFloat("SALAIRE_MOIS") * 12.0)) - 1.0);
double COEFF_FILLON = (0.2795 / 0.6) * ((1.6 * 17490.0 / (rowSalarie.getForeign("ID_INFOS_SALARIE_PAYE").getFloat("SALAIRE_MOIS") * 12.0)) - 1.0);
n4ds.write("S40.G30.40.003", decimalFormat.format(baseBrute * COEFF_FILLON));
} else {
n4ds.write("S40.G30.40.003", String.valueOf("0.00"));
}
 
n4ds.write("S40.G30.40.004", String.valueOf("0.00"));
if ((baseBrute) < (2.5 * smicMensuel * 12 * 151.6667)) {
n4ds.write("S40.G30.40.005", String.valueOf("17344.60"));
// n4ds.write("S40.G30.40.004", String.valueOf("0.00"));
if ((baseBrute) < (2.5 * 17490.0)) {
n4ds.write("S40.G30.40.005", String.valueOf("17490.00"));
n4ds.write("S40.G30.40.006", decimalFormat.format(baseBrute));
} else {
n4ds.write("S40.G30.40.005", String.valueOf("0.00"));
n4ds.write("S40.G30.40.006", String.valueOf("0.00"));
}
 
// FIXME base brute fiscale
543,11 → 559,11
n4ds.write("S30.G01.00.001", nir);
 
// Nom
n4ds.write("S30.G01.00.002", rowSalarie.getString("NOM"));
n4ds.write("S30.G01.00.002", normalizeString2(rowSalarie.getString("NOM")));
 
// Prenoms
// FIXME: regarder pour les prénoms pas seulement le 1er
n4ds.write("S30.G01.00.003", rowSalarie.getString("PRENOM"));
n4ds.write("S30.G01.00.003", normalizeString2(rowSalarie.getString("PRENOM")));
 
// Code civilite
final SQLRow rowTitre = rowSalarie.getForeignRow("ID_TITRE_PERSONNEL");
577,12 → 593,12
complement = complement.substring(0, complement.length() - 1);
}
 
n4ds.write("S30.G01.00.008.001", complement);
n4ds.write("S30.G01.00.008.001", normalizeString2(complement));
}
}
 
// Numéro, extension, nature et libellé de la voie
n4ds.write("S30.G01.00.008.006", voie);
n4ds.write("S30.G01.00.008.006", normalizeString2(voie));
 
// Code postal
n4ds.write("S30.G01.00.008.010", rowAdr.getString("CODE_POSTAL"));
621,6 → 637,10
s = s.toUpperCase();
String temp = Normalizer.normalize(s, Form.NFC);
temp = temp.replaceAll("-", " ");
temp = temp.replaceAll("é", "e");
temp = temp.replaceAll("è", "e");
temp = temp.replaceAll("ê", "e");
temp = temp.replaceAll(",", "");
return temp.replaceAll("[^\\p{ASCII}]", "");
}
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/employe/action/ListeDesAyantsDroitsAction.java
Nouveau fichier
0,0 → 1,36
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.humanresources.employe.action;
 
import org.openconcerto.erp.action.CreateFrameAbstractAction;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.view.IListFrame;
import org.openconcerto.sql.view.ListeAddPanel;
 
import javax.swing.Action;
import javax.swing.JFrame;
 
public class ListeDesAyantsDroitsAction extends CreateFrameAbstractAction {
 
public ListeDesAyantsDroitsAction() {
super();
this.putValue(Action.NAME, "Liste des ayants droit");
}
 
public JFrame createFrame() {
ListeAddPanel listeSal = new ListeAddPanel(Configuration.getInstance().getDirectory().getElement("AYANT_DROIT"));
listeSal.getListe().setSQLEditable(false);
return new IListFrame(listeSal);
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/employe/action/ListeDesContratsPrevoyanceAction.java
Nouveau fichier
0,0 → 1,36
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.humanresources.employe.action;
 
import org.openconcerto.erp.action.CreateFrameAbstractAction;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.view.IListFrame;
import org.openconcerto.sql.view.ListeAddPanel;
 
import javax.swing.Action;
import javax.swing.JFrame;
 
public class ListeDesContratsPrevoyanceAction extends CreateFrameAbstractAction {
 
public ListeDesContratsPrevoyanceAction() {
super();
this.putValue(Action.NAME, "Liste des contrats prévoyance, mutuelles, formations, ...");
}
 
public JFrame createFrame() {
ListeAddPanel listeSal = new ListeAddPanel(Configuration.getInstance().getDirectory().getElement("CONTRAT_PREVOYANCE"));
listeSal.getListe().setSQLEditable(false);
return new IListFrame(listeSal);
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/employe/action/ListeDesCaissesCotisationsAction.java
Nouveau fichier
0,0 → 1,36
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.humanresources.employe.action;
 
import org.openconcerto.erp.action.CreateFrameAbstractAction;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.view.IListFrame;
import org.openconcerto.sql.view.ListeAddPanel;
 
import javax.swing.Action;
import javax.swing.JFrame;
 
public class ListeDesCaissesCotisationsAction extends CreateFrameAbstractAction {
 
public ListeDesCaissesCotisationsAction() {
super();
this.putValue(Action.NAME, "Liste des caisses de cotisations");
}
 
public JFrame createFrame() {
ListeAddPanel listeSal = new ListeAddPanel(Configuration.getInstance().getDirectory().getElement("CAISSE_COTISATION"));
listeSal.getListe().setSQLEditable(false);
return new IListFrame(listeSal);
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/ContratSalarieSQLElement.java
24,7 → 24,9
import java.awt.GridBagLayout;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
 
import javax.swing.JLabel;
import javax.swing.JTextField;
42,9 → 44,17
return l;
}
 
@Override
public Set<String> getInsertOnlyFields() {
Set<String> s = new HashSet<String>();
s.add("DATE_MODIFICATION");
return s;
}
 
protected List<String> getComboFields() {
final List<String> l = new ArrayList<String>();
l.add("NATURE");
l.add("NUMERO");
l.add("DATE_DEBUT");
return l;
}
 
64,8 → 74,22
public void addViews() {
 
this.setLayout(new GridBagLayout());
 
GridBagConstraints c = new DefaultGridBagConstraints();
 
// Numero
JLabel labelNumero = new JLabel(getLabelFor("NUMERO"));
labelNumero.setHorizontalAlignment(SwingConstants.RIGHT);
JTextField textNumero = new JTextField();
 
this.add(labelNumero, c);
c.gridx++;
c.weightx = 1;
this.add(textNumero, c);
this.addRequiredSQLObject(textNumero, "NUMERO");
 
c.gridy++;
c.gridx = 0;
// Nature
JLabel labelNature = new JLabel(getLabelFor("NATURE"));
labelNature.setHorizontalAlignment(SwingConstants.RIGHT);
296,6 → 320,49
// this.add(textCodeRegimeRetraite, c);
// addRequiredSQLObject(textCodeRegimeRetraite, "CODE_REGIME_RETRAITE_DSN");
 
JLabel labelDateModif = new JLabel(getLabelFor("DATE_MODIFICATION"));
labelDateModif.setHorizontalAlignment(SwingConstants.RIGHT);
JDate textDateModif = new JDate();
c.gridy++;
c.gridx = 0;
c.weightx = 0;
this.add(textDateModif, c);
c.gridx++;
c.weighty = 1;
c.weightx = 1;
this.add(textDateModif, c);
addSQLObject(textDateModif, "DATE_MODIFICATION");
 
// JLabel labelCM = new JLabel(getLabelFor("ID_INFOS_SALARIE_PAYE_MODIFIE"));
// labelCM.setHorizontalAlignment(SwingConstants.RIGHT);
// ElementComboBox selCM = new ElementComboBox();
// final SQLElement elementInfosPaye =
// getDirectory().getElement("INFOS_SALARIE_PAYE");
// selCM.init(elementInfosPaye, elementInfosPaye.createComboRequest());
// selCM.setInfoIconVisible(false);
// c.gridy++;
// c.gridx = 0;
// c.weightx = 0;
// this.add(labelCM, c);
// c.gridx++;
// c.weighty = 1;
// c.weightx = 1;
// this.add(selCM, c);
// this.addSQLObject(selCM, "ID_INFOS_SALARIE_PAYE_MODIFIE");
 
JLabel labelDateDebut = new JLabel(getLabelFor("DATE_DEBUT"));
labelDateDebut.setHorizontalAlignment(SwingConstants.RIGHT);
JDate textDateDebut = new JDate();
c.gridy++;
c.gridx = 0;
c.weightx = 0;
this.add(labelDateDebut, c);
c.gridx++;
c.weighty = 1;
c.weightx = 1;
this.add(textDateDebut, c);
addSQLObject(textDateDebut, "DATE_DEBUT", REQ);
 
JLabel labelDateFin = new JLabel(getLabelFor("DATE_PREV_FIN"));
labelDateFin.setHorizontalAlignment(SwingConstants.RIGHT);
JDate textDateFin = new JDate();
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/AyantDroitTypeSQLElement.java
Nouveau fichier
0,0 → 1,26
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.humanresources.payroll.element;
 
public class AyantDroitTypeSQLElement extends AbstractCodeSQLElement {
 
public AyantDroitTypeSQLElement() {
super("AYANT_DROIT_TYPE", "un type d'ayant droit", "types d'ayant droit");
}
 
@Override
protected String createCode() {
return createCodeFromPackage() + ".type.ayantdroit";
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/SalarieSQLElement.java
18,6 → 18,7
import org.openconcerto.sql.element.BaseSQLComponent;
import org.openconcerto.sql.element.ElementSQLObject;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLRowValues;
25,7 → 26,14
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.sqlobject.ElementComboBox;
import org.openconcerto.sql.view.EditFrame;
import org.openconcerto.sql.view.EditPanelListener;
import org.openconcerto.sql.view.EditPanel.EditMode;
import org.openconcerto.sql.view.list.IListe;
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.FrameUtil;
import org.openconcerto.ui.warning.JLabelWarning;
import org.openconcerto.utils.checks.ValidState;
import org.openconcerto.utils.text.SimpleDocumentListener;
32,13 → 40,16
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
 
import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
49,6 → 60,54
 
public SalarieSQLElement() {
super("SALARIE", "un salarié", "salariés");
 
PredicateRowAction actionNewContrat = new PredicateRowAction(new AbstractAction("Créer un nouveau contrat") {
 
@Override
public void actionPerformed(ActionEvent e) {
 
final SQLRowAccessor rowSelected = IListe.get(e).getSelectedRow();
 
JOptionPane.showMessageDialog(null,
"Attention la création d'un nouveau contrat n'est pas réversible.\nCréer tous les bulletins de salaire de l'ancien contrat avant la création du nouveau.");
final SQLElement infosPayeElement = getDirectory().getElement("INFOS_SALARIE_PAYE");
EditFrame f = new EditFrame(infosPayeElement, EditMode.CREATION);
final SQLRow rowInfosAncien = rowSelected.asRow().getForeign("ID_INFOS_SALARIE_PAYE");
 
SQLRowValues cloneInfos = infosPayeElement.createCopy(rowInfosAncien.getID());
((SQLRowValues) cloneInfos.getForeign("ID_CONTRAT_SALARIE")).put("DATE_DEBUT", null);
f.getSQLComponent().select(cloneInfos);
 
f.addEditPanelListener(new EditPanelListener() {
 
@Override
public void modified() {
}
 
@Override
public void inserted(int id) {
try {
rowInfosAncien.createEmptyUpdateRow().put("ID_SALARIE", rowSelected.getID()).commit();
rowSelected.createEmptyUpdateRow().put("ID_INFOS_SALARIE_PAYE", id).commit();
} catch (SQLException e) {
e.printStackTrace();
}
}
 
@Override
public void deleted() {
}
 
@Override
public void cancelled() {
}
});
FrameUtil.show(f);
}
}, true);
actionNewContrat.setPredicate(IListeEvent.getSingleSelectionPredicate());
this.getRowActions().add(actionNewContrat);
 
}
 
protected List<String> getListFields() {
287,6 → 346,11
SQLTable tableInfosPaye = getTable().getBase().getTable("INFOS_SALARIE_PAYE");
SQLRow row = getTable().getRow(id);
SQLRow rowInfosPaye = tableInfosPaye.getRow(row.getInt("ID_INFOS_SALARIE_PAYE"));
try {
rowInfosPaye.createEmptyUpdateRow().put("ID_SALARIE", id).commit();
} catch (SQLException e1) {
e1.printStackTrace();
}
 
SQLRowValues rowVals = new SQLRowValues(tableFichePaye);
rowVals.put("ID_SALARIE", id);
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/CumulsPayeSQLElement.java
116,7 → 116,7
// net imposable
cPanel.gridx = 0;
cPanel.gridy++;
JLabel labelH = new JLabel(getLabelFor("HEURE_TRAV"));
JLabel labelH = new JLabel(getLabelFor("HEURE_TRAV_C"));
this.add(labelH, cPanel);
JTextField textH = new JTextField(10);
cPanel.gridx++;
127,7 → 127,7
this.addSQLObject(textCotSal, "COT_SAL_C");
this.addSQLObject(textNetAPayer, "NET_A_PAYER_C");
this.addSQLObject(textNetImp, "NET_IMP_C");
this.addSQLObject(textH, "HEURE_TRAV");
this.addSQLObject(textH, "HEURE_TRAV_C");
this.addSQLObject(textSalBrut, "SAL_BRUT_C");
}
};
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/CodeCotisationEtablissementSQLElement.java
Nouveau fichier
0,0 → 1,33
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.humanresources.payroll.element;
 
import org.openconcerto.utils.ListMap;
 
public class CodeCotisationEtablissementSQLElement extends AbstractCodeSQLElement {
 
public CodeCotisationEtablissementSQLElement() {
super("CODE_COTISATION_ETABLISSEMENT", "un code de cotisation établissement", "codes de cotisation établissement");
}
 
@Override
protected String createCode() {
return createCodeFromPackage() + ".cotisation.etablissement.code";
}
 
@Override
public ListMap<String, String> getShowAs() {
return ListMap.singleton(null, "CODE");
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/ContratPrevoyanceRubriqueNetSQLElement.java
Nouveau fichier
0,0 → 1,76
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.humanresources.payroll.element;
 
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.sql.element.BaseSQLComponent;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.utils.ListMap;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.ArrayList;
import java.util.List;
 
public class ContratPrevoyanceRubriqueNetSQLElement extends ComptaSQLConfElement {
 
public ContratPrevoyanceRubriqueNetSQLElement() {
super("CONTRAT_PREVOYANCE_RUBRIQUE_NET", "un rattachement rubrique net-contrat prévoyance", "rattachements rubrique net-contrat prévoyance");
}
 
protected List<String> getListFields() {
final List<String> l = new ArrayList<String>();
l.add("ID_RUBRIQUE_NET");
l.add("ID_CONTRAT_PREVOYANCE");
return l;
}
 
protected List<String> getComboFields() {
final List<String> l = new ArrayList<String>();
l.add("ID_RUBRIQUE_NET");
return l;
}
 
@Override
public ListMap<String, String> getShowAs() {
return ListMap.singleton(null, "ID_RUBRIQUE_NET");
}
 
@Override
protected String getParentFFName() {
return "ID_CONTRAT_PREVOYANCE";
}
 
@Override
protected String createCode() {
return "humanresources.payroll.prevoyance.rubriquenet";
}
 
/*
* (non-Javadoc)
*
* @see org.openconcerto.devis.SQLElement#getComponent()
*/
public SQLComponent createComponent() {
return new BaseSQLComponent(this) {
 
public void addViews() {
 
this.setLayout(new GridBagLayout());
 
}
};
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/ContratPrevoyanceSalarieSQLElement.java
Nouveau fichier
0,0 → 1,86
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.humanresources.payroll.element;
 
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.sql.element.BaseSQLComponent;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.element.SQLElementLinksSetup;
import org.openconcerto.sql.element.SQLElementLink.LinkType;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.utils.ListMap;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.ArrayList;
import java.util.List;
 
public class ContratPrevoyanceSalarieSQLElement extends ComptaSQLConfElement {
 
public ContratPrevoyanceSalarieSQLElement() {
super("CONTRAT_PREVOYANCE_CONTRAT_SALARIE", "un rattachement salarié-contrat prévoyance", "rattachements salarié-contrat prévoyance");
}
 
protected List<String> getListFields() {
final List<String> l = new ArrayList<String>();
l.add("ID_INFOS_SALARIE_PAYE");
l.add("ID_CONTRAT_PREVOYANCE");
return l;
}
 
protected List<String> getComboFields() {
final List<String> l = new ArrayList<String>();
l.add("ID_INFOS_SALARIE_PAYE");
return l;
}
 
@Override
public ListMap<String, String> getShowAs() {
return ListMap.singleton(null, "ID_INFOS_SALARIE_PAYE");
}
 
@Override
protected void setupLinks(SQLElementLinksSetup links) {
super.setupLinks(links);
if (getTable().contains("ID_INFOS_SALARIE_PAYE")) {
links.get("ID_INFOS_SALARIE_PAYE").setType(LinkType.ASSOCIATION);
}
}
 
@Override
protected String getParentFFName() {
return "ID_CONTRAT_PREVOYANCE";
}
 
@Override
protected String createCode() {
return "humanresources.payroll.prevoyance.employee";
}
 
/*
* (non-Javadoc)
*
* @see org.openconcerto.devis.SQLElement#getComponent()
*/
public SQLComponent createComponent() {
return new BaseSQLComponent(this) {
 
public void addViews() {
 
this.setLayout(new GridBagLayout());
 
}
};
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/CodePenibiliteContratSQLElement.java
Nouveau fichier
0,0 → 1,76
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.humanresources.payroll.element;
 
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.sql.element.BaseSQLComponent;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.utils.ListMap;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.ArrayList;
import java.util.List;
 
public class CodePenibiliteContratSQLElement extends ComptaSQLConfElement {
 
public CodePenibiliteContratSQLElement() {
super("CODE_PENIBILITE_CONTRAT_SALARIE", "un rattachement code pénibilité contrat salarié", "rattachements code pénibilité contrat salarié");
}
 
protected List<String> getListFields() {
final List<String> l = new ArrayList<String>();
l.add("ID_CODE_PENIBILITE");
l.add("ID_INFOS_SALARIE_PAYE");
return l;
}
 
protected List<String> getComboFields() {
final List<String> l = new ArrayList<String>();
l.add("ID_INFOS_SALARIE_PAYE");
return l;
}
 
@Override
public ListMap<String, String> getShowAs() {
return ListMap.singleton(null, "ID_INFOS_SALARIE_PAYE");
}
 
@Override
protected String getParentFFName() {
return "ID_INFOS_SALARIE_PAYE";
}
 
@Override
protected String createCode() {
return "humanresources.payroll.penibilite.contrat";
}
 
/*
* (non-Javadoc)
*
* @see org.openconcerto.devis.SQLElement#getComponent()
*/
public SQLComponent createComponent() {
return new BaseSQLComponent(this) {
 
public void addViews() {
 
this.setLayout(new GridBagLayout());
 
}
};
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/RubriqueBrutSQLElement.java
328,7 → 328,7
panelProp.add(checkCP, cPanel);
 
// Type
JLabel labelSelCodeRubrique = new JLabel("Code DSN");
JLabel labelSelCodeRubrique = new JLabel("Code DSN (S21.G00.51.011)");
labelSelCodeRubrique.setHorizontalAlignment(SwingConstants.RIGHT);
cPanel.gridy++;
cPanel.gridx = 1;
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/TypeComposantBaseAssujettieSQLElement.java
Nouveau fichier
0,0 → 1,33
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.humanresources.payroll.element;
 
import org.openconcerto.utils.ListMap;
 
public class TypeComposantBaseAssujettieSQLElement extends AbstractCodeSQLElement {
 
public TypeComposantBaseAssujettieSQLElement() {
super("TYPE_COMPOSANT_BASE_ASSUJETTIE", "un type de composant de base assujettie", "types de composant de base assujettie");
}
 
@Override
protected String createCode() {
return createCodeFromPackage() + ".composant.base.type";
}
 
@Override
public ListMap<String, String> getShowAs() {
return ListMap.singleton(null, "CODE");
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/CaisseCotisationSQLElement.java
13,16 → 13,7
package org.openconcerto.erp.core.humanresources.payroll.element;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.ArrayList;
import java.util.List;
 
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
 
import org.openconcerto.erp.core.humanresources.payroll.ui.CaisseCotisationRenseignementTable;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.BaseSQLComponent;
import org.openconcerto.sql.element.ConfSQLElement;
29,6 → 20,7
import org.openconcerto.sql.element.ElementSQLObject;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLRowListRSH;
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.SQLTable;
36,6 → 28,17
import org.openconcerto.ui.TitledSeparator;
import org.openconcerto.utils.ListMap;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.ArrayList;
import java.util.List;
 
import javax.swing.BorderFactory;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
 
public class CaisseCotisationSQLElement extends ConfSQLElement {
 
public CaisseCotisationSQLElement() {
86,6 → 89,7
*/
public SQLComponent createComponent() {
return new BaseSQLComponent(this) {
CaisseCotisationRenseignementTable table;
 
public void addViews() {
 
108,6 → 112,26
panelInfos.add(textNom, c);
c.weightx = 0;
 
// Nom
JCheckBox boxOrgProt = new JCheckBox(getLabelFor("ORG_PROTECTION_SOCIALE"));
c.gridwidth = GridBagConstraints.REMAINDER;
c.weightx = 1;
c.gridy++;
c.gridx = 0;
panelInfos.add(boxOrgProt, c);
this.addSQLObject(boxOrgProt, "ORG_PROTECTION_SOCIALE");
c.gridwidth = 1;
 
// Nom
JCheckBox boxUrssaf = new JCheckBox(getLabelFor("URSSAF"));
c.gridwidth = GridBagConstraints.REMAINDER;
c.weightx = 1;
c.gridy++;
c.gridx = 0;
panelInfos.add(boxUrssaf, c);
this.addSQLObject(boxUrssaf, "URSSAF");
c.gridwidth = 1;
 
// Adresse
TitledSeparator sep = new TitledSeparator("Adresse");
c.gridwidth = GridBagConstraints.REMAINDER;
164,12 → 188,18
c.gridx++;
c.weightx = 1;
panelInfos.add(textMail, c);
 
this.addSQLObject(textMail, "MAIL");
c.weightx = 0;
 
c.gridx = 0;
c.gridy = 0;
c.fill = GridBagConstraints.BOTH;
c.weightx = 1;
c.weighty = 1;
this.add(panelInfos, c);
c.weightx = 0;
c.weighty = 0;
c.fill = GridBagConstraints.HORIZONTAL;
 
/***********************************************************************************
215,7 → 245,11
c.gridx = 0;
c.gridy = 1;
c.fill = GridBagConstraints.BOTH;
c.weightx = 1;
c.weighty = 1;
this.add(panelCompta, c);
c.weightx = 0;
c.weighty = 0;
 
this.addSQLObject(textNom, "NOM");
this.addSQLObject(textTel, "TEL");
224,7 → 258,43
// this.addSQLObject(selCompteCharge, "ID_COMPTE_PCE_CHARGE");
// selCompteTiers.init();
// selCompteCharge.init();
TitledSeparator sepRenseignement = new TitledSeparator("Renseignement Organisme de protection social (S21.G00.20)");
c.gridwidth = GridBagConstraints.REMAINDER;
c.gridy++;
c.gridx = 0;
c.weightx = 1;
this.add(sepRenseignement, c);
this.table = new CaisseCotisationRenseignementTable();
this.table.setEnabled(true);
c.gridy++;
c.weighty = 1;
this.add(this.table, c);
 
}
 
@Override
public void select(SQLRowAccessor r) {
super.select(r);
if (r != null) {
this.table.getModel().insertFrom(r);
} else {
this.table.getModel().clearRows();
}
}
 
@Override
public void update() {
 
super.update();
this.table.getModel().updateField("ID_CAISSE_COTISATION", getSelectedID());
}
 
@Override
public int insert(SQLRow order) {
final int insertID = super.insert(order);
this.table.getModel().updateField("ID_CAISSE_COTISATION", insertID);
return insertID;
}
};
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/TypePreavisSQLElement.java
Nouveau fichier
0,0 → 1,25
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.humanresources.payroll.element;
 
public class TypePreavisSQLElement extends AbstractCodeCommonSQLElement {
public TypePreavisSQLElement() {
super("TYPE_PREAVIS", "un type de préavis", "types de préavis");
}
 
@Override
protected String createCode() {
return "humanresources.type.preavis.code";
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/CodePenibiliteSQLElement.java
Nouveau fichier
0,0 → 1,33
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.humanresources.payroll.element;
 
import org.openconcerto.utils.ListMap;
 
public class CodePenibiliteSQLElement extends AbstractCodeSQLElement {
 
public CodePenibiliteSQLElement() {
super("CODE_PENIBILITE", "un code de pénibilité", "codes de pénibilité");
}
 
@Override
protected String createCode() {
return createCodeFromPackage() + ".cotisation.penibilite.code";
}
 
@Override
public ListMap<String, String> getShowAs() {
return ListMap.singleton(null, "CODE");
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/ContratPrevoyanceRubriqueSQLElement.java
Nouveau fichier
0,0 → 1,76
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.humanresources.payroll.element;
 
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.sql.element.BaseSQLComponent;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.utils.ListMap;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.ArrayList;
import java.util.List;
 
public class ContratPrevoyanceRubriqueSQLElement extends ComptaSQLConfElement {
 
public ContratPrevoyanceRubriqueSQLElement() {
super("CONTRAT_PREVOYANCE_RUBRIQUE", "un rattachement rubrique-contrat prévoyance", "rattachements rubrique-contrat prévoyance");
}
 
protected List<String> getListFields() {
final List<String> l = new ArrayList<String>();
l.add("ID_RUBRIQUE_COTISATION");
l.add("ID_CONTRAT_PREVOYANCE");
return l;
}
 
protected List<String> getComboFields() {
final List<String> l = new ArrayList<String>();
l.add("ID_RUBRIQUE_COTISATION");
return l;
}
 
@Override
public ListMap<String, String> getShowAs() {
return ListMap.singleton(null, "ID_RUBRIQUE_COTISATION");
}
 
@Override
protected String getParentFFName() {
return "ID_CONTRAT_PREVOYANCE";
}
 
@Override
protected String createCode() {
return "humanresources.payroll.prevoyance.rubrique";
}
 
/*
* (non-Javadoc)
*
* @see org.openconcerto.devis.SQLElement#getComponent()
*/
public SQLComponent createComponent() {
return new BaseSQLComponent(this) {
 
public void addViews() {
 
this.setLayout(new GridBagLayout());
 
}
};
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/CodeTypeRubriqueBrutSQLElement.java
13,11 → 13,88
package org.openconcerto.erp.core.humanresources.payroll.element;
 
public class CodeTypeRubriqueBrutSQLElement extends AbstractCodeCommonSQLElement {
import org.openconcerto.erp.config.DsnBrutCode;
import org.openconcerto.sql.element.BaseSQLComponent;
import org.openconcerto.sql.element.ConfSQLElement;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.component.ComboLockedMode;
import org.openconcerto.ui.component.ITextCombo;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
 
import javax.swing.JLabel;
import javax.swing.JTextField;
 
public class CodeTypeRubriqueBrutSQLElement extends ConfSQLElement {
 
public CodeTypeRubriqueBrutSQLElement() {
super("CODE_TYPE_RUBRIQUE_BRUT", "un code rubrique de brut", "codes rubrique de brut");
}
 
protected List<String> getListFields() {
final List<String> list = new ArrayList<String>(3);
list.add("CODE");
list.add("TYPE");
list.add("NOM");
return list;
}
 
protected List<String> getComboFields() {
final List<String> list = new ArrayList<String>(3);
list.add("CODE");
list.add("TYPE");
list.add("NOM");
return list;
}
 
public SQLComponent createComponent() {
return new BaseSQLComponent(this) {
 
public void addViews() {
this.setLayout(new GridBagLayout());
final GridBagConstraints c = new DefaultGridBagConstraints();
 
// Code
final JLabel labelCode = new JLabel("Code");
this.add(labelCode, c);
c.gridx++;
c.weightx = 1;
final JTextField textCode = new JTextField();
this.add(textCode, c);
 
// Nom
c.gridx++;
c.weightx = 0;
final JLabel labelNom = new JLabel("Libellé");
this.add(labelNom, c);
c.gridx++;
c.weightx = 1;
final JTextField textNom = new JTextField();
this.add(textNom, c);
 
// Type
ITextCombo comboType = new ITextCombo(ComboLockedMode.LOCKED);
comboType.initCache(Arrays.asList(DsnBrutCode.DsnTypeCodeBrut.PRIME.getName(), DsnBrutCode.DsnTypeCodeBrut.AUTRE.getName(), DsnBrutCode.DsnTypeCodeBrut.REMUNERATION.getName()));
c.gridx++;
c.weightx = 0;
final JLabel labelType = new JLabel("Type");
this.add(labelType, c);
c.gridx++;
c.weightx = 1;
this.add(comboType, c);
 
this.addRequiredSQLObject(comboType, "TYPE");
this.addRequiredSQLObject(textNom, "NOM");
this.addRequiredSQLObject(textCode, "CODE");
}
};
}
 
@Override
protected String createCode() {
return "humanresources.rubriquebrut.code";
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/InfosSalariePayeSQLElement.java
15,6 → 15,7
 
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.erp.core.humanresources.payroll.ui.ContratPenibiliteTable;
import org.openconcerto.erp.model.PrixHT;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.BaseSQLComponent;
21,6 → 22,7
import org.openconcerto.sql.element.ElementSQLObject;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.model.SQLBase;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.sqlobject.ElementComboBox;
import org.openconcerto.ui.DefaultGridBagConstraints;
53,12 → 55,14
protected List<String> getListFields() {
final List<String> l = new ArrayList<String>();
l.add("ID_IDCC");
l.add("ID_SALARIE");
return l;
}
 
protected List<String> getComboFields() {
final List<String> l = new ArrayList<String>();
l.add("ID_IDCC");
l.add("ID_SALARIE");
l.add("ID_CONTRAT_SALARIE");
return l;
}
 
103,6 → 107,24
}
};
 
ContratPenibiliteTable tablePeni = new ContratPenibiliteTable();
 
@Override
public int insert(SQLRow order) {
// TODO Auto-generated method stub
int id = super.insert(order);
tablePeni.updateField("ID_INFOS_SALARIE_PAYE", id);
return id;
}
 
@Override
public void update() {
// TODO Auto-generated method stub
int id = getSelectedID();
super.update();
tablePeni.updateField("ID_INFOS_SALARIE_PAYE", id);
}
 
public void addViews() {
this.setLayout(new GridBagLayout());
GridBagConstraints c = new DefaultGridBagConstraints();
176,7 → 198,7
 
c.gridx = 2;
c.gridy = 1;
c.gridheight = 3;
c.gridheight = 4;
c.gridwidth = GridBagConstraints.REMAINDER;
c.weightx = 1;
this.add(panelContrat, c);
232,6 → 254,22
this.add(panelEntreeSortie, c);
c.gridwidth = 1;
 
JPanel panelPeni = new JPanel();
panelPeni.setOpaque(false);
panelPeni.setBorder(BorderFactory.createTitledBorder("Pénibilité (S21.G00.34)"));
panelPeni.setLayout(new GridBagLayout());
GridBagConstraints cPeni = new DefaultGridBagConstraints();
cPeni.weightx = 1;
cPeni.weighty = 1;
cPeni.fill = GridBagConstraints.BOTH;
 
panelPeni.add(tablePeni, cPeni);
c.gridy++;
c.weighty = 1;
c.fill = GridBagConstraints.BOTH;
this.add(panelPeni, c);
c.fill = GridBagConstraints.HORIZONTAL;
 
/***********************************************************************************
* Valeurs de bases
**********************************************************************************/
404,7 → 442,7
panelBase.add(sectionAT, c);
addView(sectionAT, "CODE_SECTION_AT");
 
c.gridy = 4;
c.gridy = 5;
c.gridx = 0;
c.gridwidth = GridBagConstraints.REMAINDER;
c.weighty = 1;
462,6 → 500,10
 
super.select(r);
 
if (r != null) {
tablePeni.insertFrom("ID_INFOS_SALARIE_PAYE", r.getID());
}
 
this.dureeMois.getDocument().addDocumentListener(this.listenerMois);
this.dureeHebdo.getDocument().addDocumentListener(this.listenerHebdo);
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/CodeCotisationIndividuelleSQLElement.java
Nouveau fichier
0,0 → 1,33
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.humanresources.payroll.element;
 
import org.openconcerto.utils.ListMap;
 
public class CodeCotisationIndividuelleSQLElement extends AbstractCodeSQLElement {
 
public CodeCotisationIndividuelleSQLElement() {
super("CODE_COTISATION_INDIVIDUELLE", "un code de cotisation individuelle", "codes de cotisation individuelle");
}
 
@Override
protected String createCode() {
return createCodeFromPackage() + ".cotisation.individuelle.code";
}
@Override
public ListMap<String, String> getShowAs() {
return ListMap.singleton(null, "CODE");
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/CaisseCotisationRenseignentSQLElement.java
Nouveau fichier
0,0 → 1,88
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.humanresources.payroll.element;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.ArrayList;
import java.util.List;
 
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
 
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.BaseSQLComponent;
import org.openconcerto.sql.element.ConfSQLElement;
import org.openconcerto.sql.element.ElementSQLObject;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowListRSH;
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.TitledSeparator;
import org.openconcerto.utils.ListMap;
 
public class CaisseCotisationRenseignentSQLElement extends ConfSQLElement {
 
public CaisseCotisationRenseignentSQLElement() {
super("CAISSE_COTISATION_RENSEIGNEMENT", "une caisse renseignement", "caisses renseignements");
}
 
protected List<String> getListFields() {
final List<String> l = new ArrayList<String>();
l.add("IDENTIFIANT");
return l;
}
 
protected List<String> getComboFields() {
final List<String> l = new ArrayList<String>();
l.add("IDENTIFIANT");
return l;
}
 
@Override
public ListMap<String, String> getShowAs() {
return ListMap.singleton(null, "IDENTIFIANT");
}
 
/*
* (non-Javadoc)
*
* @see org.openconcerto.devis.SQLElement#getComponent()
*/
public SQLComponent createComponent() {
return new BaseSQLComponent(this) {
 
public void addViews() {
 
this.setLayout(new GridBagLayout());
final GridBagConstraints c = new DefaultGridBagConstraints();
 
// Nom
JLabel labelNom = new JLabel(getLabelFor("NOM"));
JTextField textNom = new JTextField();
this.add(labelNom, c);
c.gridx++;
c.weightx = 1;
this.add(textNom, c);
c.weightx = 0;
 
this.addSQLObject(textNom, "NOM");
}
};
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/ContratPrevoyanceSQLElement.java
Nouveau fichier
0,0 → 1,263
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.humanresources.payroll.element;
 
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.erp.core.humanresources.payroll.ui.ContratPrevRubriqueTable;
import org.openconcerto.erp.core.humanresources.payroll.ui.ContratPrevSalarieTable;
import org.openconcerto.sql.element.BaseSQLComponent;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.JDate;
import org.openconcerto.ui.TitledSeparator;
import org.openconcerto.utils.ListMap;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.ArrayList;
import java.util.List;
 
import javax.swing.BorderFactory;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
 
public class ContratPrevoyanceSQLElement extends ComptaSQLConfElement {
 
public ContratPrevoyanceSQLElement() {
super("CONTRAT_PREVOYANCE", "un contrat de prévoyance, mutuelle, formation", "contrats de prévoyance, mutuelle, formation");
}
 
protected List<String> getListFields() {
final List<String> l = new ArrayList<String>();
// l.add("CODE_UNIQUE");
l.add("NOM");
l.add("REFERENCE");
l.add("CODE_ORGANISME");
l.add("CODE_DELEGATAIRE");
l.add("COTISATION_ETABLISSEMENT");
return l;
}
 
protected List<String> getComboFields() {
final List<String> l = new ArrayList<String>();
l.add("NOM");
l.add("REFERENCE");
return l;
}
 
@Override
public ListMap<String, String> getShowAs() {
return ListMap.singleton(null, "NOM");
}
 
/*
* (non-Javadoc)
*
* @see org.openconcerto.devis.SQLElement#getComponent()
*/
public SQLComponent createComponent() {
return new BaseSQLComponent(this) {
 
ContratPrevSalarieTable tableSalarie = new ContratPrevSalarieTable();
 
ContratPrevRubriqueTable tableRub = new ContratPrevRubriqueTable(false);
ContratPrevRubriqueTable tableRubNet = new ContratPrevRubriqueTable(true);
 
public void addViews() {
 
this.setLayout(new GridBagLayout());
final GridBagConstraints c = new DefaultGridBagConstraints();
 
/***********************************************************************************
* Renseignements
**********************************************************************************/
JPanel panelInfos = new JPanel();
panelInfos.setBorder(BorderFactory.createTitledBorder("Renseignements (S21.G00.15)"));
panelInfos.setLayout(new GridBagLayout());
 
// // Code
// JLabel labelCode = new JLabel(getLabelFor("CODE_UNIQUE"));
// JTextField textCode = new JTextField();
// panelInfos.add(labelCode, c);
// c.gridx++;
// c.weightx = 1;
// panelInfos.add(textCode, c);
// this.addSQLObject(textCode, "CODE_UNIQUE");
// c.weightx = 0;
 
// Nom
JLabel labelNom = new JLabel(getLabelFor("NOM"));
JTextField textNom = new JTextField();
// c.gridx++;
c.weightx = 0;
panelInfos.add(labelNom, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(textNom, c);
c.weightx = 0;
// Ref
JLabel labelRef = new JLabel(getLabelFor("REFERENCE"));
JTextField textRef = new JTextField();
c.gridx++;
panelInfos.add(labelRef, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(textRef, c);
 
c.weightx = 0;
 
// Nom
JLabel labelCO = new JLabel(getLabelFor("CODE_ORGANISME"));
JTextField textCO = new JTextField();
c.gridy++;
c.gridx = 0;
c.weightx = 0;
panelInfos.add(labelCO, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(textCO, c);
c.weightx = 0;
 
// Ref
JLabel labelCD = new JLabel(getLabelFor("CODE_DELEGATAIRE"));
JTextField textCD = new JTextField();
c.gridx++;
panelInfos.add(labelCD, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(textCD, c);
 
// Formation
JCheckBox checkFO = new JCheckBox(getLabelFor("COTISATION_ETABLISSEMENT"));
c.gridy++;
c.gridx = 0;
c.weightx = 0;
c.gridwidth = 2;
panelInfos.add(checkFO, c);
 
// Deb
JLabel labelDateDeb = new JLabel(getLabelFor("DATE_DEBUT"));
JDate dateDeb = new JDate();
c.gridx = 0;
c.gridy++;
c.weightx = 0;
panelInfos.add(labelDateDeb, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(dateDeb, c);
this.addSQLObject(dateDeb, "DATE_DEBUT");
c.weightx = 0;
// Fin
JLabel labelDateFin = new JLabel(getLabelFor("DATE_FIN"));
JDate dateFin = new JDate();
c.gridx++;
panelInfos.add(labelDateFin, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(dateFin, c);
this.addSQLObject(dateFin, "DATE_FIN");
 
c.weightx = 0;
 
TitledSeparator sepRenseignement = new TitledSeparator("Renseignement par contrat salarié (S21.G00.70)");
c.gridwidth = GridBagConstraints.REMAINDER;
c.gridy++;
c.gridx = 0;
panelInfos.add(sepRenseignement, c);
c.gridx = 0;
c.gridy++;
c.fill = GridBagConstraints.BOTH;
c.gridwidth = GridBagConstraints.REMAINDER;
c.weighty = 0.5;
 
panelInfos.add(tableSalarie, c);
 
TitledSeparator sepRub = new TitledSeparator("Rubriques de cotisation rattachées");
c.gridwidth = GridBagConstraints.REMAINDER;
c.gridy++;
c.gridx = 0;
panelInfos.add(sepRub, c);
 
c.gridx = 0;
c.gridy++;
c.fill = GridBagConstraints.BOTH;
c.weighty = 0.5;
panelInfos.add(tableRub, c);
 
TitledSeparator sepRubN = new TitledSeparator("Rubriques de net rattachées");
c.gridwidth = GridBagConstraints.REMAINDER;
c.gridy++;
c.gridx = 0;
panelInfos.add(sepRubN, c);
 
c.gridx = 0;
c.gridy++;
c.fill = GridBagConstraints.BOTH;
c.weighty = 0.5;
panelInfos.add(tableRubNet, c);
 
c.gridx = 0;
c.gridy++;
c.fill = GridBagConstraints.BOTH;
c.weightx = 1;
c.weighty = 1;
this.add(panelInfos, c);
 
this.addSQLObject(textNom, "NOM");
 
this.addSQLObject(textCD, "CODE_DELEGATAIRE");
this.addSQLObject(textCO, "CODE_ORGANISME");
this.addSQLObject(textRef, "REFERENCE");
this.addSQLObject(checkFO, "COTISATION_ETABLISSEMENT");
}
 
@Override
public int insert(SQLRow order) {
 
int id = super.insert(order);
 
tableRub.updateField("ID_CONTRAT_PREVOYANCE", id);
tableRubNet.updateField("ID_CONTRAT_PREVOYANCE", id);
tableSalarie.updateField("ID_CONTRAT_PREVOYANCE", id);
return id;
}
 
@Override
public void update() {
 
int id = getSelectedID();
super.update();
tableRub.updateField("ID_CONTRAT_PREVOYANCE", id);
tableRubNet.updateField("ID_CONTRAT_PREVOYANCE", id);
tableSalarie.updateField("ID_CONTRAT_PREVOYANCE", id);
 
}
 
@Override
public void select(SQLRowAccessor r) {
 
super.select(r);
if (r != null) {
tableRub.insertFrom("ID_CONTRAT_PREVOYANCE", r.getID());
tableRubNet.insertFrom("ID_CONTRAT_PREVOYANCE", r.getID());
tableSalarie.insertFrom("ID_CONTRAT_PREVOYANCE", r.getID());
}
}
};
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/AyantDroitSQLElement.java
Nouveau fichier
0,0 → 1,267
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.humanresources.payroll.element;
 
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.erp.core.humanresources.payroll.ui.AyantDroitTable;
import org.openconcerto.sql.element.BaseSQLComponent;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.sqlobject.SQLRequestComboBox;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.JDate;
import org.openconcerto.utils.ListMap;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.ArrayList;
import java.util.List;
 
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
 
public class AyantDroitSQLElement extends ComptaSQLConfElement {
 
public AyantDroitSQLElement() {
super("AYANT_DROIT", "un ayant droit", "ayants droit");
}
 
protected List<String> getListFields() {
final List<String> l = new ArrayList<String>();
l.add("ID_SALARIE");
l.add("NOM");
l.add("PRENOMS");
return l;
}
 
protected List<String> getComboFields() {
final List<String> l = new ArrayList<String>();
l.add("NOM");
l.add("PRENOMS");
return l;
}
 
@Override
protected String createCode() {
return createCodeFromPackage() + ".ayantdroit";
}
 
@Override
public ListMap<String, String> getShowAs() {
return ListMap.singleton(null, "NOM");
}
 
/*
* (non-Javadoc)
*
* @see org.openconcerto.devis.SQLElement#getComponent()
*/
public SQLComponent createComponent() {
return new BaseSQLComponent(this) {
 
AyantDroitTable table = new AyantDroitTable();
 
public void addViews() {
 
this.setLayout(new GridBagLayout());
final GridBagConstraints c = new DefaultGridBagConstraints();
 
/***********************************************************************************
* Renseignements
**********************************************************************************/
JPanel panelInfos = new JPanel();
panelInfos.setBorder(BorderFactory.createTitledBorder("Renseignements (S21.G00.73)"));
panelInfos.setLayout(new GridBagLayout());
 
// Code
JLabel labelSal = new JLabel(getLabelFor("ID_SALARIE"));
SQLRequestComboBox boxSal = new SQLRequestComboBox();
panelInfos.add(labelSal, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(boxSal, c);
this.addRequiredSQLObject(boxSal, "ID_SALARIE");
c.weightx = 0;
 
// Nom
JLabel labelNom = new JLabel(getLabelFor("NOM"));
JTextField textNom = new JTextField();
c.gridy++;
c.gridx = 0;
c.weightx = 0;
panelInfos.add(labelNom, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(textNom, c);
this.addRequiredSQLObject(textNom, "NOM");
c.weightx = 0;
// Ref
JLabel labelPrenoms = new JLabel(getLabelFor("PRENOMS"));
JTextField textPrenoms = new JTextField();
c.gridx++;
panelInfos.add(labelPrenoms, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(textPrenoms, c);
this.addRequiredSQLObject(textPrenoms, "PRENOMS");
 
c.weightx = 0;
 
// Nom
JLabel labelCO = new JLabel(getLabelFor("CODE_OPTION"));
JTextField textCO = new JTextField();
c.gridy++;
c.gridx = 0;
c.weightx = 0;
panelInfos.add(labelCO, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(textCO, c);
this.addSQLObject(textCO, "CODE_OPTION");
 
c.weightx = 0;
 
// Ref
JLabel labelADT = new JLabel(getLabelFor("ID_AYANT_DROIT_TYPE"));
SQLRequestComboBox boxType = new SQLRequestComboBox();
c.gridx++;
panelInfos.add(labelADT, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(boxType, c);
this.addRequiredSQLObject(boxType, "ID_AYANT_DROIT_TYPE");
 
// Nom
JLabel labelD = new JLabel(getLabelFor("DATE_DEBUT_RATTACHEMENT"));
JDate d = new JDate();
c.gridy++;
c.gridx = 0;
c.weightx = 0;
panelInfos.add(labelD, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(d, c);
this.addRequiredSQLObject(d, "DATE_DEBUT_RATTACHEMENT");
 
c.weightx = 0;
 
// Ref
JLabel labelDN = new JLabel(getLabelFor("DATE_NAISSANCE"));
JDate dn = new JDate();
c.gridx++;
panelInfos.add(labelDN, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(dn, c);
this.addRequiredSQLObject(dn, "DATE_NAISSANCE");
 
// Nom
JLabel labelNIR = new JLabel(getLabelFor("NIR"));
JTextField nir = new JTextField();
c.gridy++;
c.gridx = 0;
c.weightx = 0;
panelInfos.add(labelNIR, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(nir, c);
this.addSQLObject(nir, "NIR");
 
c.weightx = 0;
 
// // Ref
// JLabel labelNIRO = new JLabel(getLabelFor("NIR_OUVRANT_DROIT"));
// JTextField niro = new JTextField();
// c.gridx++;
// panelInfos.add(labelNIRO, c);
// c.gridx++;
// c.weightx = 1;
// panelInfos.add(niro, c);
// this.addRequiredSQLObject(niro, "NIR_OUVRANT_DROIT");
 
// Nom
JLabel labelCodeAffil = new JLabel(getLabelFor("CODE_ORGANISME_AFFILIATION"));
JTextField codeAffil = new JTextField();
c.gridy++;
c.gridx = 0;
c.weightx = 0;
panelInfos.add(labelCodeAffil, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(codeAffil, c);
this.addSQLObject(codeAffil, "CODE_ORGANISME_AFFILIATION");
 
c.weightx = 0;
 
// Ref
JLabel labelDATEFIN = new JLabel(getLabelFor("DATE_FIN_RATTACHEMENT"));
JDate dFin = new JDate();
c.gridx++;
panelInfos.add(labelDATEFIN, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(dFin, c);
this.addRequiredSQLObject(dFin, "DATE_FIN_RATTACHEMENT");
 
c.weightx = 0;
 
c.gridx = 0;
c.gridy++;
c.fill = GridBagConstraints.BOTH;
c.gridwidth = GridBagConstraints.REMAINDER;
c.weighty = 1;
panelInfos.add(table, c);
 
c.gridx = 0;
c.gridy++;
c.fill = GridBagConstraints.BOTH;
c.weightx = 1;
c.weighty = 1;
this.add(panelInfos, c);
 
 
}
 
@Override
public int insert(SQLRow order) {
 
int id = super.insert(order);
 
table.updateField("ID_AYANT_DROIT", id);
return id;
}
 
@Override
public void update() {
 
int id = getSelectedID();
super.update();
table.updateField("ID_AYANT_DROIT", id);
}
 
@Override
public void select(SQLRowAccessor r) {
 
super.select(r);
if (r != null) {
table.insertFrom("ID_AYANT_DROIT", r.getID());
}
}
};
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/RubriqueCotisationSQLElement.java
68,6 → 68,8
l.add("BRUT");
l.add("ID_CODE_CAISSE_TYPE_RUBRIQUE");
l.add("ID_CODE_BASE_ASSUJETTIE");
l.add("ID_TYPE_COMPOSANT_BASE_ASSUJETTIE");
l.add("ID_CODE_COTISATION_INDIVIDUELLE");
l.add("PART_CSG");
l.add("PART_CSG_SANS_ABATTEMENT");
l.add("IMPOSABLE");
235,7 → 237,7
JCheckBox checkImpo = new JCheckBox(getLabelFor("IMPOSABLE"));
panelProp.add(checkImpo, cPanel);
 
JLabel labelSelTypePersonnel = new JLabel("Code Type Personnel");
JLabel labelSelTypePersonnel = new JLabel("Code Type Personnel URSSAF (S21.G00.23)");
cPanel.gridy++;
cPanel.gridx = 1;
cPanel.weightx = 0;
247,7 → 249,7
panelProp.add(comboSelTypePersonnel, cPanel);
this.addView(comboSelTypePersonnel, "ID_CODE_CAISSE_TYPE_RUBRIQUE");
 
JLabel labelSelTypeBase = new JLabel("Code Base assujettie");
JLabel labelSelTypeBase = new JLabel("Code Base assujettie (S21.G00.78)");
cPanel.gridy++;
cPanel.gridx = 1;
cPanel.weightx = 0;
259,6 → 261,44
panelProp.add(comboSelTypeBase, cPanel);
this.addView(comboSelTypeBase, "ID_CODE_BASE_ASSUJETTIE");
 
JLabel labelSelTypeComposant = new JLabel("Type Composant base assujettie (S21.G00.79)");
cPanel.gridy++;
cPanel.gridx = 1;
cPanel.weightx = 0;
panelProp.add(labelSelTypeComposant, cPanel);
 
ElementComboBox comboSelTypeComposant = new ElementComboBox(false);
cPanel.gridx++;
cPanel.weightx = 1;
panelProp.add(comboSelTypeComposant, cPanel);
this.addView(comboSelTypeComposant, "ID_TYPE_COMPOSANT_BASE_ASSUJETTIE");
 
JLabel labelSelCodeInd = new JLabel("Code cotisation individuelle (S21.G00.81)");
cPanel.gridy++;
cPanel.gridx = 1;
cPanel.weightx = 0;
panelProp.add(labelSelCodeInd, cPanel);
 
ElementComboBox comboSelCodeInd = new ElementComboBox(false);
cPanel.gridx++;
cPanel.weightx = 1;
panelProp.add(comboSelCodeInd, cPanel);
this.addView(comboSelCodeInd, "ID_CODE_COTISATION_INDIVIDUELLE");
JLabel labelSelCodeEta = new JLabel("Code cotisation établissement (S21.G00.82.002)");
cPanel.gridy++;
cPanel.gridx = 1;
cPanel.weightx = 0;
panelProp.add(labelSelCodeEta, cPanel);
 
ElementComboBox comboSelCodeEta = new ElementComboBox(false);
cPanel.gridx++;
cPanel.weightx = 1;
panelProp.add(comboSelCodeEta, cPanel);
this.addView(comboSelCodeEta, "ID_CODE_COTISATION_ETABLISSEMENT");
 
// Patronale imposable
cPanel.gridy++;
c.gridx--;
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/FichePayeSQLElement.java
54,7 → 54,9
import org.openconcerto.sql.element.BaseSQLComponent;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.element.SQLElementDirectory;
import org.openconcerto.sql.element.SQLElementLinksSetup;
import org.openconcerto.sql.element.TreesOfSQLRows;
import org.openconcerto.sql.element.SQLElementLink.LinkType;
import org.openconcerto.sql.model.SQLBase;
import org.openconcerto.sql.model.SQLField;
import org.openconcerto.sql.model.SQLRow;
101,6 → 103,14
return true;
}
 
@Override
protected void setupLinks(SQLElementLinksSetup links) {
super.setupLinks(links);
if (getTable().contains("ID_INFOS_SALARIE_PAYE")) {
links.get("ID_INFOS_SALARIE_PAYE").setType(LinkType.ASSOCIATION);
}
}
 
/*
* (non-Javadoc)
*
665,6 → 675,9
float cotSal = rowCumuls.getFloat("COT_SAL_C") - row.getFloat("COT_SAL");
float cotPat = rowCumuls.getFloat("COT_PAT_C") - row.getFloat("COT_PAT");
float netImp = rowCumuls.getFloat("NET_IMP_C") - row.getFloat("NET_IMP");
// TODO stocker les heures travaillées du mois pour faire déduction
// float heure = rowCumuls.getFloat("HEURE_TRAV_C") -
// row.getFloat("HEURE_TRAV");
float netAPayer = rowCumuls.getFloat("NET_A_PAYER_C") - row.getFloat("NET_A_PAYER") - row.getFloat("ACOMPTE");
 
SQLRowValues rowValsCumul = rowCumuls.createEmptyUpdateRow();
674,6 → 687,7
rowValsCumul.put("NET_IMP_C", new Float(netImp));
rowValsCumul.put("NET_A_PAYER_C", new Float(netAPayer));
rowValsCumul.put("CSG_C", new Float(cgs));
// rowValsCumul.put("HEURE_TRAV_C", new Float(heure));
 
try {
rowValsCumul.update();
825,12 → 839,12
float cotSal = rowCumuls.getFloat("COT_SAL_C") + rowFiche.getFloat("COT_SAL");
float cotPat = rowCumuls.getFloat("COT_PAT_C") + rowFiche.getFloat("COT_PAT");
float netImp = rowCumuls.getFloat("NET_IMP_C") + rowFiche.getFloat("NET_IMP");
float hTrav = rowCumuls.getFloat("HEURE_TRAV") + rowVarSal.getFloat("HEURE_TRAV");
float hTrav = rowCumuls.getFloat("HEURE_TRAV_C") + rowVarSal.getFloat("HEURE_TRAV");
float netAPayer = rowCumuls.getFloat("NET_A_PAYER_C") + rowFiche.getFloat("NET_A_PAYER") + rowFiche.getFloat("ACOMPTE");
 
SQLRowValues rowValsCumul = new SQLRowValues(tableCumuls);
rowValsCumul.put("SAL_BRUT_C", new Float(salBrut));
rowValsCumul.put("HEURE_TRAV", new Float(hTrav));
rowValsCumul.put("HEURE_TRAV_C", new Float(hTrav));
rowValsCumul.put("COT_SAL_C", new Float(cotSal));
rowValsCumul.put("COT_PAT_C", new Float(cotPat));
rowValsCumul.put("NET_IMP_C", new Float(netImp));
904,7 → 918,11
// Remise à 0 des variables sal
final SQLRowValues rowVals = new SQLRowValues(tableVariableSal);
for (final SQLField field : tableVariableSal.getContentFields()) {
rowVals.put(field.getName(), Float.valueOf(0));
if (field.getType().getJavaType() == Integer.class) {
rowVals.put(field.getName(), 0);
} else {
rowVals.put(field.getName(), Float.valueOf(0));
}
}
rowVals.put("HEURE_TRAV", rowSalInfosPaye.getObject("DUREE_MOIS"));
 
973,6 → 991,8
final SQLRow rContrat = rInfosSalPaye.getForeignRow("ID_CONTRAT_SALARIE");
rowValsFiche.put("NATURE_EMPLOI", rContrat.getString("NATURE"));
rowValsFiche.put("ID_IDCC", rInfosSalPaye.getInt("ID_IDCC"));
rowValsFiche.put("ID_INFOS_SALARIE_PAYE", rInfosSalPaye.getID());
 
rowValsFiche.update(id);
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/CaisseModePaiementSQLElement.java
Nouveau fichier
0,0 → 1,26
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.humanresources.payroll.element;
 
public class CaisseModePaiementSQLElement extends AbstractCodeSQLElement {
 
public CaisseModePaiementSQLElement() {
super("CAISSE_MODE_PAIEMENT", "un mode de paiement", "modes de paiement");
}
 
@Override
protected String createCode() {
return createCodeFromPackage() + ".mode.paiement";
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/RubriqueNetSQLElement.java
13,6 → 13,7
package org.openconcerto.erp.core.humanresources.payroll.element;
 
import org.openconcerto.erp.config.DsnBrutCode;
import org.openconcerto.erp.core.common.ui.SQLJavaEditor;
import org.openconcerto.erp.core.humanresources.payroll.component.FormuleTreeNode;
import org.openconcerto.erp.core.humanresources.payroll.component.RubriqueSQLComponent;
21,8 → 22,11
import org.openconcerto.sql.element.ElementSQLObject;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.request.ComboSQLRequest;
import org.openconcerto.sql.sqlobject.ElementComboBox;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.TitledSeparator;
import org.openconcerto.utils.ListMap;
 
import java.awt.GridBagConstraints;
326,6 → 330,104
panelProp.add(textCpt, cPanel);
addView(textCpt, "NUMERO_COMPTE_PCE_CHARGES");
 
TitledSeparator sepRenseignement = new TitledSeparator("Prime, gratification et indemnité (S21.G00.52)");
cPanel.gridwidth = GridBagConstraints.REMAINDER;
cPanel.gridy++;
cPanel.gridx = 1;
panelProp.add(sepRenseignement, cPanel);
 
// Type
JLabel labelSelCodeRubrique = new JLabel("Code DSN (S21.G00.52.001)");
labelSelCodeRubrique.setHorizontalAlignment(SwingConstants.RIGHT);
cPanel.gridy++;
cPanel.gridwidth = 1;
cPanel.gridx = 1;
cPanel.gridheight = 1;
cPanel.gridwidth = 1;
cPanel.weightx = 0;
cPanel.anchor = GridBagConstraints.WEST;
panelProp.add(labelSelCodeRubrique, cPanel);
 
ElementComboBox comboSelCodeRubrique = new ElementComboBox(false);
final SQLElement foreignElement = getElement().getForeignElement("ID_CODE_TYPE_RUBRIQUE_BRUT");
ComboSQLRequest req = foreignElement.getComboRequest(true);
Where where = new Where(foreignElement.getTable().getField("TYPE"), "=", DsnBrutCode.DsnTypeCodeBrut.PRIME.getName());
where = where.or(new Where(foreignElement.getTable().getField("TYPE"), "=", DsnBrutCode.DsnTypeCodeBrut.AUTRE.getName()));
req.setWhere(where);
comboSelCodeRubrique.init(foreignElement, req);
cPanel.gridx++;
cPanel.weightx = 1;
panelProp.add(comboSelCodeRubrique, cPanel);
this.addView(comboSelCodeRubrique, "ID_CODE_TYPE_RUBRIQUE_BRUT");
 
TitledSeparator sepRenseignementPrev = new TitledSeparator("Renseignement contrat prévoyance, mutuelle");
cPanel.gridwidth = GridBagConstraints.REMAINDER;
cPanel.gridy++;
cPanel.gridx = 1;
panelProp.add(sepRenseignementPrev, cPanel);
 
JLabel labelSelCaisse = new JLabel("Caisse de cotisation");
cPanel.gridy++;
cPanel.gridwidth = 1;
cPanel.gridx = 1;
cPanel.weightx = 0;
panelProp.add(labelSelCaisse, cPanel);
 
ElementComboBox comboSelTypeCaisse = new ElementComboBox(true);
cPanel.gridx++;
cPanel.weightx = 1;
panelProp.add(comboSelTypeCaisse, cPanel);
this.addView(comboSelTypeCaisse, "ID_CAISSE_COTISATION");
 
JLabel labelSelTypeBase = new JLabel("Code Base assujettie (S21.G00.78)");
cPanel.gridy++;
cPanel.gridx = 1;
cPanel.weightx = 0;
panelProp.add(labelSelTypeBase, cPanel);
 
ElementComboBox comboSelTypeBase = new ElementComboBox(false);
cPanel.gridx++;
cPanel.weightx = 1;
panelProp.add(comboSelTypeBase, cPanel);
this.addView(comboSelTypeBase, "ID_CODE_BASE_ASSUJETTIE");
 
JLabel labelSelTypeComposant = new JLabel("Type Composant base assujettie (S21.G00.79)");
cPanel.gridy++;
cPanel.gridx = 1;
cPanel.weightx = 0;
panelProp.add(labelSelTypeComposant, cPanel);
 
ElementComboBox comboSelTypeComposant = new ElementComboBox(false);
cPanel.gridx++;
cPanel.weightx = 1;
panelProp.add(comboSelTypeComposant, cPanel);
this.addView(comboSelTypeComposant, "ID_TYPE_COMPOSANT_BASE_ASSUJETTIE");
 
JLabel labelSelCodeInd = new JLabel("Code cotisation individuelle (S21.G00.81)");
cPanel.gridy++;
cPanel.gridx = 1;
cPanel.weightx = 0;
panelProp.add(labelSelCodeInd, cPanel);
 
ElementComboBox comboSelCodeInd = new ElementComboBox(false);
cPanel.gridx++;
cPanel.weightx = 1;
panelProp.add(comboSelCodeInd, cPanel);
this.addView(comboSelCodeInd, "ID_CODE_COTISATION_INDIVIDUELLE");
 
// JLabel labelSelCodeEta = new JLabel("Code cotisation établissement
// (S21.G00.82.002)");
// cPanel.gridy++;
// cPanel.gridx = 1;
// cPanel.weightx = 0;
// panelProp.add(labelSelCodeEta, cPanel);
//
// ElementComboBox comboSelCodeEta = new ElementComboBox(false);
// cPanel.gridx++;
// cPanel.weightx = 1;
// panelProp.add(comboSelCodeEta, cPanel);
// this.addView(comboSelCodeEta, "ID_CODE_COTISATION_ETABLISSEMENT");
 
// Tabbed Pane
JTabbedPane tab = new JTabbedPane();
tab.add("Calcul", new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, paneTree, panelCalcul));
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/AyantDroitContratPrevSQLElement.java
Nouveau fichier
0,0 → 1,262
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.humanresources.payroll.element;
 
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.erp.core.humanresources.payroll.ui.AyantDroitTable;
import org.openconcerto.sql.element.BaseSQLComponent;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.sqlobject.SQLRequestComboBox;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.JDate;
import org.openconcerto.utils.ListMap;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.ArrayList;
import java.util.List;
 
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
 
public class AyantDroitContratPrevSQLElement extends ComptaSQLConfElement {
 
public AyantDroitContratPrevSQLElement() {
super("CONTRAT_PREVOYANCE_AYANT_DROIT", "un ayant droit", "ayants droit");
}
 
protected List<String> getListFields() {
final List<String> l = new ArrayList<String>();
l.add("ID_CONTRAT_PREVOYANCE");
return l;
}
 
protected List<String> getComboFields() {
final List<String> l = new ArrayList<String>();
l.add("ID_CONTRAT_PREVOYANCE");
return l;
}
 
@Override
protected String createCode() {
return createCodeFromPackage() + ".contrat.ayantdroit";
}
 
@Override
public ListMap<String, String> getShowAs() {
return ListMap.singleton(null, "ID_CONTRAT_PREVOYANCE");
}
 
/*
* (non-Javadoc)
*
* @see org.openconcerto.devis.SQLElement#getComponent()
*/
public SQLComponent createComponent() {
return new BaseSQLComponent(this) {
 
AyantDroitTable table = new AyantDroitTable();
 
public void addViews() {
 
this.setLayout(new GridBagLayout());
final GridBagConstraints c = new DefaultGridBagConstraints();
 
/***********************************************************************************
* Renseignements
**********************************************************************************/
JPanel panelInfos = new JPanel();
panelInfos.setBorder(BorderFactory.createTitledBorder("Renseignements"));
panelInfos.setLayout(new GridBagLayout());
 
// Code
JLabel labelSal = new JLabel(getLabelFor("ID_SALARIE"));
SQLRequestComboBox boxSal = new SQLRequestComboBox();
panelInfos.add(labelSal, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(boxSal, c);
this.addRequiredSQLObject(boxSal, "ID_SALARIE");
c.weightx = 0;
 
// Nom
JLabel labelNom = new JLabel(getLabelFor("NOM"));
JTextField textNom = new JTextField();
// c.gridx++;
c.weightx = 0;
panelInfos.add(labelNom, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(textNom, c);
c.weightx = 0;
// Ref
JLabel labelPrenoms = new JLabel(getLabelFor("PRENOMS"));
JTextField textPrenoms = new JTextField();
c.gridx++;
panelInfos.add(labelPrenoms, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(textPrenoms, c);
this.addSQLObject(textPrenoms, "PRENOMS");
 
c.weightx = 0;
 
// Nom
JLabel labelCO = new JLabel(getLabelFor("CODE_OPTION"));
JTextField textCO = new JTextField();
c.gridy++;
c.gridx = 0;
c.weightx = 0;
panelInfos.add(labelCO, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(textCO, c);
this.addSQLObject(textCO, "CODE_OPTION");
 
c.weightx = 0;
 
// Ref
JLabel labelADT = new JLabel(getLabelFor("ID_AYANT_DROIT_TYPE"));
SQLRequestComboBox boxType = new SQLRequestComboBox();
c.gridx++;
panelInfos.add(labelADT, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(boxType, c);
this.addRequiredSQLObject(boxType, "ID_AYANT_DROIT_TYPE");
 
// Nom
JLabel labelD = new JLabel(getLabelFor("DATE_DEBUT"));
JDate d = new JDate();
c.gridy++;
c.gridx = 0;
c.weightx = 0;
panelInfos.add(labelD, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(d, c);
this.addRequiredSQLObject(d, "DATE_DEBUT");
 
c.weightx = 0;
 
// Ref
JLabel labelDN = new JLabel(getLabelFor("DATE_NAISSANCE"));
JDate dn = new JDate();
c.gridx++;
panelInfos.add(labelDN, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(dn, c);
this.addRequiredSQLObject(dn, "DATE_NAISSANCE");
 
// Nom
JLabel labelNIR = new JLabel(getLabelFor("NIR"));
JTextField nir = new JTextField();
c.gridy++;
c.gridx = 0;
c.weightx = 0;
panelInfos.add(labelNIR, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(nir, c);
this.addSQLObject(nir, "NIR");
 
c.weightx = 0;
 
// Ref
JLabel labelNIRO = new JLabel(getLabelFor("NIR_OUVRANT_DROIT"));
JTextField niro = new JTextField();
c.gridx++;
panelInfos.add(labelNIRO, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(niro, c);
this.addRequiredSQLObject(niro, "NIR_OUVRANT_DROIT");
 
// Nom
JLabel labelCodeAffil = new JLabel(getLabelFor("CODE_ORGANISME_AFFILIATION"));
JTextField codeAffil = new JTextField();
c.gridy++;
c.gridx = 0;
c.weightx = 0;
panelInfos.add(labelCodeAffil, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(codeAffil, c);
this.addSQLObject(codeAffil, "CODE_ORGANISME_AFFILIATION");
 
c.weightx = 0;
 
// Ref
JLabel labelDATEFIN = new JLabel(getLabelFor("DATE_FIN"));
JDate dFin = new JDate();
c.gridx++;
panelInfos.add(labelDATEFIN, c);
c.gridx++;
c.weightx = 1;
panelInfos.add(dFin, c);
this.addRequiredSQLObject(dFin, "DATE_FIN");
 
c.weightx = 0;
 
c.gridx = 0;
c.gridy++;
c.fill = GridBagConstraints.BOTH;
c.gridwidth = GridBagConstraints.REMAINDER;
c.weighty = 1;
panelInfos.add(table, c);
 
c.gridx = 0;
c.gridy++;
c.fill = GridBagConstraints.BOTH;
c.weightx = 1;
c.weighty = 1;
this.add(panelInfos, c);
 
this.addSQLObject(textNom, "NOM");
 
}
 
@Override
public int insert(SQLRow order) {
 
int id = super.insert(order);
 
table.updateField("ID_AYANT_DROIT", id);
return id;
}
 
@Override
public void update() {
 
int id = getSelectedID();
super.update();
table.updateField("ID_AYANT_DROIT", id);
}
 
@Override
public void select(SQLRowAccessor r) {
 
super.select(r);
if (r != null) {
table.insertFrom("ID_AYANT_DROIT", r.getID());
}
}
};
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/report/EtatChargesPayeSheet.java
41,7 → 41,7
private final static SQLTable tableCaisse = Configuration.getInstance().getBase().getTable("CAISSE_COTISATION");
private final static SQLTable tableRubCot = Configuration.getInstance().getBase().getTable("RUBRIQUE_COTISATION");
 
private final static DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM);
private final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM);
private int moisDu, moisAu;
private String annee;
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/report/FichePayeSheet.java
59,7 → 59,6
private final static SQLTable tableCumulsPaye = base.getTable("CUMULS_PAYE");
private final static SQLTable tableVarPeriode = base.getTable("VARIABLE_SALARIE");
private final static SQLTable tableConventionC = base.getTable("IDCC");
private final static DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.SHORT);
 
private Map styleMapRow;
 
200,6 → 199,8
 
protected void createMap() {
 
final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.SHORT);
 
this.styleMapRow = new HashMap();
this.mapReplace = new HashMap();
 
425,7 → 426,6
cotSalCumul = cotSalCumul.add(rowCumulsPaye.getBigDecimal("COT_SAL_C"));
cotPatCumul = cotPatCumul.add(rowCumulsPaye.getBigDecimal("COT_PAT_C"));
netImpCumul = netImpCumul.add(rowCumulsPaye.getBigDecimal("NET_IMP_C"));
 
this.mCell.put("D62", salBrutCumul);
this.mCell.put("E62", cotSalCumul);
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/report/FichePayeSheetXML.java
18,6 → 18,8
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.model.SQLRow;
 
import java.util.Calendar;
 
public class FichePayeSheetXML extends AbstractSheetXMLWithDate {
 
public static final String TEMPLATE_ID = "FichePaye";
39,8 → 41,12
public String getName() {
SQLRow rowSal = row.getForeign("ID_SALARIE");
SQLRow rowMois = row.getForeign("ID_MOIS");
return ("FichePaye_" + rowSal.getString("CODE") + "_" + rowMois.getString("NOM") + "_" + row.getString("ANNEE"));
 
Calendar du = row.getDate("DU");
String suffix = "";
if (du != null && du.get(Calendar.DAY_OF_MONTH) != 1) {
suffix = "_" + du.get(Calendar.DAY_OF_MONTH);
}
return ("FichePaye_" + rowSal.getString("CODE") + suffix + "_" + rowMois.getString("NOM") + "_" + row.getString("ANNEE"));
}
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/report/LivrePayeSheet.java
43,7 → 43,7
private final static SQLTable tableRubNet = Configuration.getInstance().getBase().getTable("RUBRIQUE_NET");
private final static SQLTable tableRubBrut = Configuration.getInstance().getBase().getTable("RUBRIQUE_BRUT");
 
private final static DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM);
private final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM);
private int moisDu, moisAu;
private String annee;
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/action/ListeFichePayeAddPanel.java
Nouveau fichier
0,0 → 1,34
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.humanresources.payroll.action;
 
import org.openconcerto.erp.core.common.ui.ListeViewPanel;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.view.list.IListe;
 
public class ListeFichePayeAddPanel extends ListeViewPanel {
{
this.buttonModifier.setText("Voir");
}
 
public ListeFichePayeAddPanel(SQLElement component) {
super(component);
}
 
public ListeFichePayeAddPanel(SQLElement component, IListe list) {
super(component, list);
this.buttonEffacer.setVisible(true);
}
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/action/ListeDesFichesDePayeAction.java
16,7 → 16,6
import org.openconcerto.erp.action.CreateFrameAbstractAction;
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.erp.core.common.ui.PanelFrame;
import org.openconcerto.erp.core.humanresources.payroll.report.FichePayeSheet;
import org.openconcerto.erp.core.humanresources.payroll.report.FichePayeSheetXML;
import org.openconcerto.erp.core.humanresources.payroll.ui.PanelCumulsPaye;
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
36,7 → 35,6
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
 
import javax.swing.AbstractAction;
import javax.swing.Action;
60,7 → 58,7
final SQLTableModelSourceOnline src = elt.getTableSource(true);
// On affcihe seulement les fiches de payes validées
src.getReq().setWhere(new Where(elt.getTable().getField("VALIDE"), "=", Boolean.TRUE));
final ListeAddPanel liste = new ListFichePayeAddPanel(elt, new IListe(src));
final ListeAddPanel liste = new ListeFichePayeAddPanel(elt, new IListe(src));
 
final IListFrame frame = new IListFrame(liste);
 
113,29 → 111,4
return frame;
}
 
class ListFichePayeAddPanel extends ListeAddPanel {
{
this.buttonModifier.setText("Voir");
}
 
public ListFichePayeAddPanel(SQLElement component) {
super(component);
}
 
public ListFichePayeAddPanel(SQLElement component, IListe list) {
super(component, list);
}
 
protected void handleAction(JButton source, ActionEvent evt) {
if (source == this.buttonModifier) {
if (ListeDesFichesDePayeAction.this.editFrame == null) {
ListeDesFichesDePayeAction.this.editFrame = new EditFrame(this.element, EditPanel.READONLY);
}
ListeDesFichesDePayeAction.this.editFrame.selectionId(this.getListe().getSelectedId());
ListeDesFichesDePayeAction.this.editFrame.setVisible(true);
} else {
super.handleAction(source, evt);
}
}
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/action/ListeDesInfosSalariePayeAction.java
Nouveau fichier
0,0 → 1,34
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.humanresources.payroll.action;
 
import org.openconcerto.erp.action.CreateFrameAbstractAction;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.view.IListFrame;
import org.openconcerto.sql.view.ListeAddPanel;
 
import javax.swing.Action;
import javax.swing.JFrame;
 
public class ListeDesInfosSalariePayeAction extends CreateFrameAbstractAction {
 
public ListeDesInfosSalariePayeAction() {
super();
this.putValue(Action.NAME, "Historique des Informations de contrat");
}
 
public JFrame createFrame() {
return new IListFrame(new ListeAddPanel(Configuration.getInstance().getDirectory().getElement("INFOS_SALARIE_PAYE")));
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/ui/HistoriqueFichePayePanel.java
15,7 → 15,7
 
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.erp.core.common.ui.PanelFrame;
import org.openconcerto.erp.core.humanresources.payroll.report.FichePayeSheet;
import org.openconcerto.erp.core.humanresources.payroll.action.ListeFichePayeAddPanel;
import org.openconcerto.erp.core.humanresources.payroll.report.FichePayeSheetXML;
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
import org.openconcerto.sql.Configuration;
27,7 → 27,6
import org.openconcerto.sql.users.rights.JListSQLTablePanel;
import org.openconcerto.sql.view.IListPanel;
import org.openconcerto.sql.view.IListener;
import org.openconcerto.sql.view.ListeAddPanel;
import org.openconcerto.sql.view.list.IListe;
import org.openconcerto.sql.view.list.RowAction;
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
41,9 → 40,6
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
 
import javax.swing.AbstractAction;
import javax.swing.JButton;
108,7 → 104,7
// IListe
final SQLTableModelSourceOnline src = eltFiche.getTableSource(true);
src.getReq().setWhere(Where.FALSE);
this.listePanel = new ListeAddPanel(eltFiche, new IListe(src));
this.listePanel = new ListeFichePayeAddPanel(eltFiche, new IListe(src));
this.listePanel.setAddVisible(false);
 
this.listePanel.getListe().setSQLEditable(false);
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/ui/ContratPrevRubriqueTable.java
Nouveau fichier
0,0 → 1,90
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.humanresources.payroll.ui;
 
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.view.list.RowValuesTable;
import org.openconcerto.sql.view.list.RowValuesTableControlPanel;
import org.openconcerto.sql.view.list.RowValuesTableModel;
import org.openconcerto.sql.view.list.RowValuesTablePanel;
import org.openconcerto.sql.view.list.RowValuesTableRenderer;
import org.openconcerto.sql.view.list.SQLTableElement;
import org.openconcerto.ui.DefaultGridBagConstraints;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.List;
import java.util.Vector;
 
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
 
public class ContratPrevRubriqueTable extends RowValuesTablePanel {
 
public final boolean net;
 
public ContratPrevRubriqueTable(final boolean net) {
 
this.net = net;
init();
uiInit();
 
}
 
/**
*
*/
protected void init() {
 
final SQLElement e = getSQLElement();
 
final List<SQLTableElement> tableElements = new Vector<SQLTableElement>();
 
String fieldName = net ? "ID_RUBRIQUE_NET" : "ID_RUBRIQUE_COTISATION";
tableElements.add(new SQLTableElement(e.getTable().getField(fieldName)));
 
this.defaultRowVals = new SQLRowValues(getSQLElement().getTable());
this.model = new RowValuesTableModel(e, tableElements, e.getTable().getField(fieldName), false, this.defaultRowVals);
 
this.table = new RowValuesTable(this.model, null);
}
 
public SQLElement getSQLElement() {
return Configuration.getInstance().getDirectory().getElement(net ? "CONTRAT_PREVOYANCE_RUBRIQUE_NET" : "CONTRAT_PREVOYANCE_RUBRIQUE");
}
 
protected void uiInit() {
// Ui init
setLayout(new GridBagLayout());
this.setOpaque(false);
final GridBagConstraints c = new DefaultGridBagConstraints();
 
c.weightx = 1;
 
RowValuesTableControlPanel control = new RowValuesTableControlPanel(this.table);
control.setOpaque(false);
this.add(control, c);
 
c.gridy++;
c.fill = GridBagConstraints.BOTH;
c.weightx = 1;
c.weighty = 1;
final JScrollPane comp = new JScrollPane(this.table);
comp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
this.add(comp, c);
this.table.setDefaultRenderer(Long.class, new RowValuesTableRenderer());
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/ui/CaisseCotisationRenseignementTable.java
Nouveau fichier
0,0 → 1,95
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.humanresources.payroll.ui;
 
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.view.list.RowValuesTable;
import org.openconcerto.sql.view.list.RowValuesTableControlPanel;
import org.openconcerto.sql.view.list.RowValuesTableModel;
import org.openconcerto.sql.view.list.RowValuesTablePanel;
import org.openconcerto.sql.view.list.RowValuesTableRenderer;
import org.openconcerto.sql.view.list.SQLTableElement;
import org.openconcerto.ui.DefaultGridBagConstraints;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.List;
import java.util.Vector;
 
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
 
public class CaisseCotisationRenseignementTable extends RowValuesTablePanel {
 
public CaisseCotisationRenseignementTable() {
 
init();
uiInit();
 
}
 
/**
*
*/
protected void init() {
 
final SQLElement e = getSQLElement();
 
final List<SQLTableElement> tableElements = new Vector<SQLTableElement>();
 
tableElements.add(new SQLTableElement(e.getTable().getField("IDENTIFIANT")));
tableElements.add(new SQLTableElement(e.getTable().getField("IBAN")));
tableElements.add(new SQLTableElement(e.getTable().getField("BIC")));
tableElements.add(new SQLTableElement(e.getTable().getField("ENTITE_AFFECTATION")));
// tableElements.add(new
// SQLTableElement(e.getTable().getField("ORGANISME_COMPLEMENTAIRE")));
tableElements.add(new SQLTableElement(e.getTable().getField("CODE_DELEGATAIRE")));
tableElements.add(new SQLTableElement(e.getTable().getField("ID_CAISSE_MODE_PAIEMENT")));
tableElements.add(new SQLTableElement(e.getTable().getField("PAIEMENT_TRIMESTRIEL")));
tableElements.add(new SQLTableElement(e.getTable().getField("ID_SOCIETE_COMMON")));
 
this.defaultRowVals = new SQLRowValues(getSQLElement().getTable());
this.model = new RowValuesTableModel(e, tableElements, e.getTable().getField("ID_SOCIETE_COMMON"), false, this.defaultRowVals);
 
this.table = new RowValuesTable(this.model, null);
}
 
public SQLElement getSQLElement() {
return Configuration.getInstance().getDirectory().getElement("CAISSE_COTISATION_RENSEIGNEMENT");
}
 
protected void uiInit() {
// Ui init
setLayout(new GridBagLayout());
this.setOpaque(false);
final GridBagConstraints c = new DefaultGridBagConstraints();
 
c.weightx = 1;
 
RowValuesTableControlPanel control = new RowValuesTableControlPanel(this.table);
control.setOpaque(false);
this.add(control, c);
 
c.gridy++;
c.fill = GridBagConstraints.BOTH;
c.weightx = 1;
c.weighty = 1;
final JScrollPane comp = new JScrollPane(this.table);
comp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
this.add(comp, c);
this.table.setDefaultRenderer(Long.class, new RowValuesTableRenderer());
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/ui/ContratPrevSalarieTable.java
Nouveau fichier
0,0 → 1,92
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.humanresources.payroll.ui;
 
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.view.list.RowValuesTable;
import org.openconcerto.sql.view.list.RowValuesTableControlPanel;
import org.openconcerto.sql.view.list.RowValuesTableModel;
import org.openconcerto.sql.view.list.RowValuesTablePanel;
import org.openconcerto.sql.view.list.RowValuesTableRenderer;
import org.openconcerto.sql.view.list.SQLTableElement;
import org.openconcerto.ui.DefaultGridBagConstraints;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.List;
import java.util.Vector;
 
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
 
public class ContratPrevSalarieTable extends RowValuesTablePanel {
 
public ContratPrevSalarieTable() {
 
init();
uiInit();
 
}
 
/**
*
*/
protected void init() {
 
final SQLElement e = getSQLElement();
 
final List<SQLTableElement> tableElements = new Vector<SQLTableElement>();
tableElements.add(new SQLTableElement(e.getTable().getField("ID_INFOS_SALARIE_PAYE")));
tableElements.add(new SQLTableElement(e.getTable().getField("CODE_OPTION")));
tableElements.add(new SQLTableElement(e.getTable().getField("CODE_POPULATION")));
tableElements.add(new SQLTableElement(e.getTable().getField("NB_ENFANT_CHARGE")));
tableElements.add(new SQLTableElement(e.getTable().getField("NB_ADULTE_AYANT_DROIT")));
tableElements.add(new SQLTableElement(e.getTable().getField("NB_AYANT_DROIT")));
tableElements.add(new SQLTableElement(e.getTable().getField("NB_AYANT_DROIT_AUTRE")));
tableElements.add(new SQLTableElement(e.getTable().getField("NB_ENFANT_AYANT_DROIT")));
 
this.defaultRowVals = new SQLRowValues(getSQLElement().getTable());
this.model = new RowValuesTableModel(e, tableElements, e.getTable().getField("ID_INFOS_SALARIE_PAYE"), false, this.defaultRowVals);
 
this.table = new RowValuesTable(this.model, null);
}
 
public SQLElement getSQLElement() {
return Configuration.getInstance().getDirectory().getElement("CONTRAT_PREVOYANCE_CONTRAT_SALARIE");
}
 
protected void uiInit() {
// Ui init
setLayout(new GridBagLayout());
this.setOpaque(false);
final GridBagConstraints c = new DefaultGridBagConstraints();
 
c.weightx = 1;
 
RowValuesTableControlPanel control = new RowValuesTableControlPanel(this.table);
control.setOpaque(false);
this.add(control, c);
 
c.gridy++;
c.fill = GridBagConstraints.BOTH;
c.weightx = 1;
c.weighty = 1;
final JScrollPane comp = new JScrollPane(this.table);
comp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
this.add(comp, c);
this.table.setDefaultRenderer(Long.class, new RowValuesTableRenderer());
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/ui/AyantDroitTable.java
Nouveau fichier
0,0 → 1,86
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.humanresources.payroll.ui;
 
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.view.list.RowValuesTable;
import org.openconcerto.sql.view.list.RowValuesTableControlPanel;
import org.openconcerto.sql.view.list.RowValuesTableModel;
import org.openconcerto.sql.view.list.RowValuesTablePanel;
import org.openconcerto.sql.view.list.RowValuesTableRenderer;
import org.openconcerto.sql.view.list.SQLTableElement;
import org.openconcerto.ui.DefaultGridBagConstraints;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.List;
import java.util.Vector;
 
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
 
public class AyantDroitTable extends RowValuesTablePanel {
 
public AyantDroitTable() {
 
init();
uiInit();
 
}
 
/**
*
*/
protected void init() {
 
final SQLElement e = getSQLElement();
 
final List<SQLTableElement> tableElements = new Vector<SQLTableElement>();
 
tableElements.add(new SQLTableElement(e.getTable().getField("ID_CONTRAT_PREVOYANCE")));
 
this.defaultRowVals = new SQLRowValues(getSQLElement().getTable());
this.model = new RowValuesTableModel(e, tableElements, e.getTable().getField("ID_CONTRAT_PREVOYANCE"), false, this.defaultRowVals);
 
this.table = new RowValuesTable(this.model, null);
}
 
public SQLElement getSQLElement() {
return Configuration.getInstance().getDirectory().getElement("CONTRAT_PREVOYANCE_AYANT_DROIT");
}
 
protected void uiInit() {
// Ui init
setLayout(new GridBagLayout());
this.setOpaque(false);
final GridBagConstraints c = new DefaultGridBagConstraints();
 
c.weightx = 1;
 
RowValuesTableControlPanel control = new RowValuesTableControlPanel(this.table);
control.setOpaque(false);
this.add(control, c);
 
c.gridy++;
c.fill = GridBagConstraints.BOTH;
c.weightx = 1;
c.weighty = 1;
final JScrollPane comp = new JScrollPane(this.table);
comp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
this.add(comp, c);
this.table.setDefaultRenderer(Long.class, new RowValuesTableRenderer());
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/ui/ContratPenibiliteTable.java
Nouveau fichier
0,0 → 1,86
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.humanresources.payroll.ui;
 
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.view.list.RowValuesTable;
import org.openconcerto.sql.view.list.RowValuesTableControlPanel;
import org.openconcerto.sql.view.list.RowValuesTableModel;
import org.openconcerto.sql.view.list.RowValuesTablePanel;
import org.openconcerto.sql.view.list.RowValuesTableRenderer;
import org.openconcerto.sql.view.list.SQLTableElement;
import org.openconcerto.ui.DefaultGridBagConstraints;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.List;
import java.util.Vector;
 
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
 
public class ContratPenibiliteTable extends RowValuesTablePanel {
 
public ContratPenibiliteTable() {
 
init();
uiInit();
 
}
 
/**
*
*/
protected void init() {
 
final SQLElement e = getSQLElement();
 
final List<SQLTableElement> tableElements = new Vector<SQLTableElement>();
 
tableElements.add(new SQLTableElement(e.getTable().getField("ID_CODE_PENIBILITE")));
 
this.defaultRowVals = new SQLRowValues(getSQLElement().getTable());
this.model = new RowValuesTableModel(e, tableElements, e.getTable().getField("ID_CODE_PENIBILITE"), false, this.defaultRowVals);
 
this.table = new RowValuesTable(this.model, null);
}
 
public SQLElement getSQLElement() {
return Configuration.getInstance().getDirectory().getElement("CODE_PENIBILITE_CONTRAT_SALARIE");
}
 
protected void uiInit() {
// Ui init
setLayout(new GridBagLayout());
this.setOpaque(false);
final GridBagConstraints c = new DefaultGridBagConstraints();
 
c.weightx = 1;
 
RowValuesTableControlPanel control = new RowValuesTableControlPanel(this.table);
control.setOpaque(false);
this.add(control, c);
 
c.gridy++;
c.fill = GridBagConstraints.BOTH;
c.weightx = 1;
c.weighty = 1;
final JScrollPane comp = new JScrollPane(this.table);
comp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
this.add(comp, c);
this.table.setDefaultRenderer(Long.class, new RowValuesTableRenderer());
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/AttachmentSQLElement.java
Nouveau fichier
0,0 → 1,83
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.edm;
 
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.sql.element.BaseSQLComponent;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.ui.DefaultGridBagConstraints;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.ArrayList;
import java.util.List;
 
public class AttachmentSQLElement extends ComptaSQLConfElement {
 
public final static String DIRECTORY_PREFS = "EDMdirectory";
 
public AttachmentSQLElement() {
super("ATTACHMENT", "un attachement", "attachements");
 
}
 
protected List<String> getListFields() {
final List<String> l = new ArrayList<String>();
l.add("SOURCE_TABLE");
l.add("SOURCE_ID");
l.add("NAME");
l.add("MIMETYPE");
l.add("FILENAME");
l.add("STORAGE_PATH");
l.add("THUMBNAIL");
l.add("THUMBNAIL_WIDTH");
l.add("THUMBNAIL_HEIGHT");
l.add("TAG");
return l;
}
 
protected List<String> getComboFields() {
final List<String> l = new ArrayList<String>();
l.add("NAME");
return l;
}
 
public SQLComponent createComponent() {
return new BaseSQLComponent(this) {
public void addViews() {
this.setLayout(new GridBagLayout());
 
final GridBagConstraints c = new DefaultGridBagConstraints();
c.anchor = GridBagConstraints.NORTHEAST;
c.gridwidth = 1;
 
// // Numero
// JLabel labelNumero = new JLabel("Numéro ");
// this.add(labelNumero, c);
//
// JTextField textNumero = new JTextField();
// c.gridx++;
// c.weightx = 1;
// this.add(textNumero, c);
 
// this.addRequiredSQLObject(textNumero, "NUMERO");
}
};
}
 
@Override
protected String createCode() {
return createCodeFromPackage() + ".attachment";
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/data-icon.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/data-icon.png
Nouveau fichier
Changements de propriété:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/pdf-icon.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/pdf-icon.png
===================================================================
--- trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/pdf-icon.png (revision 0)
+++ trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/pdf-icon.png (revision 142)
/trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/pdf-icon.png
Changements de propriété:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/AttachmentAction.java
===================================================================
--- trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/AttachmentAction.java (revision 0)
+++ trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/AttachmentAction.java (revision 142)
@@ -0,0 +1,50 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of the GNU General Public License Version 3
+ * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
+ * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each file.
+ */
+
+ package org.openconcerto.erp.core.edm;
+
+import org.openconcerto.erp.core.common.ui.PanelFrame;
+import org.openconcerto.sql.model.SQLRowAccessor;
+import org.openconcerto.sql.view.list.IListe;
+import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
+import org.openconcerto.ui.FrameUtil;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+
+public class AttachmentAction extends PredicateRowAction {
+
+ public AttachmentAction(final String foreignField) {
+ super(new AbstractAction("Fichiers liés") {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ SQLRowAccessor row = IListe.get(e).getSelectedRow();
+ if (foreignField != null) {
+ row = row.getForeign(foreignField);
+ }
+ AttachmentPanel panel = new AttachmentPanel(row);
+ // TODO mettre le nom du sqlelement et la ref??? ex : du devis DEV20170101-003
+ PanelFrame frame = new PanelFrame(panel, "Liste des fichiers liés");
+ FrameUtil.show(frame);
+ }
+ }, true);
+
+ }
+
+ public AttachmentAction() {
+ this(null);
+ }
+
+}
Index: trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/docx-icon.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/docx-icon.png
===================================================================
--- trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/docx-icon.png (revision 0)
+++ trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/docx-icon.png (revision 142)
/trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/docx-icon.png
Changements de propriété:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/xlsx-icon.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/xlsx-icon.png
===================================================================
--- trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/xlsx-icon.png (revision 0)
+++ trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/xlsx-icon.png (revision 142)
/trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/xlsx-icon.png
Changements de propriété:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/AttachmentPanel.java
===================================================================
--- trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/AttachmentPanel.java (revision 0)
+++ trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/AttachmentPanel.java (revision 142)
@@ -0,0 +1,244 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of the GNU General Public License Version 3
+ * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
+ * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each file.
+ */
+
+ package org.openconcerto.erp.core.edm;
+
+import org.openconcerto.erp.core.common.ui.ScrollablePanel;
+import org.openconcerto.sql.model.SQLRowAccessor;
+import org.openconcerto.sql.model.SQLRowValues;
+import org.openconcerto.sql.model.SQLRowValuesListFetcher;
+import org.openconcerto.sql.model.SQLTable;
+import org.openconcerto.sql.model.Where;
+import org.openconcerto.ui.DefaultGridBagConstraints;
+import org.openconcerto.ui.SwingThreadUtils;
+import org.openconcerto.utils.ExceptionHandler;
+import org.openconcerto.utils.FileUtils;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.FileDialog;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DropTarget;
+import java.awt.dnd.DropTargetDropEvent;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.JButton;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JProgressBar;
+import javax.swing.JScrollPane;
+import javax.swing.SwingUtilities;
+import javax.swing.event.ListDataEvent;
+import javax.swing.event.ListDataListener;
+
+public class AttachmentPanel extends JPanel {
+
+ private final SQLRowAccessor rowSource;
+ private List<ListDataListener> listeners = new ArrayList<ListDataListener>();
+
+ public AttachmentPanel(SQLRowAccessor rowSource) {
+ super();
+ this.rowSource = rowSource;
+ this.setLayout(new GridBagLayout());
+ initUI();
+ setFocusable(true);
+ }
+
+ public void addListener(ListDataListener l) {
+ this.listeners.add(l);
+ }
+
+ public void removeListener(ListDataListener l) {
+ this.listeners.remove(l);
+ }
+
+ public void fireDataChanged() {
+ for (ListDataListener listDataListener : listeners) {
+ listDataListener.contentsChanged(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, 0, 0));
+ }
+ }
+
+ public void initUI() {
+ this.invalidate();
+ this.removeAll();
+ GridBagConstraints c = new DefaultGridBagConstraints();
+
+ // Recupération de la liste des fichiers
+
+ // TODO requete dans un SwingWorker
+ final SQLTable tableAttachment = rowSource.getTable().getTable("ATTACHMENT");
+ SQLRowValues rowVals = new SQLRowValues(tableAttachment);
+ rowVals.putNulls(tableAttachment.getFieldsName());
+
+ SQLRowValuesListFetcher fetcher = SQLRowValuesListFetcher.create(rowVals);
+ Where where = new Where(tableAttachment.getField("SOURCE_TABLE"), "=", this.rowSource.getTable().getName());
+ where = where.and(new Where(tableAttachment.getField("SOURCE_ID"), "=", this.rowSource.getID()));
+ // TODO en premier les dossier, puis trier par nom
+ List<SQLRowValues> attachments = fetcher.fetch(where);
+
+ // AJout d'un fichier
+ final JButton addButton = new JButton("Ajouter un fichier");
+ this.add(addButton, c);
+
+ c.gridx++;
+ c.weightx = 1;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ final JProgressBar progressBar = new JProgressBar(0, 100);
+ progressBar.setValue(100);
+ progressBar.setStringPainted(true);
+ progressBar.setVisible(false);
+ this.add(progressBar, c);
+ c.fill = GridBagConstraints.BOTH;
+ c.gridx = 0;
+ c.gridy++;
+
+ addButton.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ final Frame frame = SwingThreadUtils.getAncestorOrSelf(Frame.class, (Component) e.getSource());
+
+ final FileDialog fd = new FileDialog(frame, "Ajouter un fichier", FileDialog.LOAD);
+ fd.setVisible(true);
+ final String fileName = fd.getFile();
+ if (fileName != null) {
+ File inFile = new File(fd.getDirectory(), fileName);
+ AttachmentUtils utils = new AttachmentUtils();
+ utils.uploadFile(inFile, rowSource);
+ initUI();
+ }
+ }
+ });
+
+ ScrollablePanel files = new ScrollablePanel() {
+ @Override
+ public Dimension getPreferredSize() {
+ int w = getSize().width;
+ int nbPerRow = (w - 5) / (FilePanel.WIDTH + 5);
+ if (nbPerRow < 1) {
+ nbPerRow = 1;
+ }
+ int nbRow = 1 + (getComponentCount() / nbPerRow);
+ if (nbRow < 1) {
+ nbRow = 1;
+ }
+ return new Dimension(w, 5 + nbRow * (FilePanel.HEIGHT + 5));
+ }
+
+ };
+ files.setOpaque(true);
+ files.setBackground(Color.WHITE);
+ files.setScrollableWidth(ScrollablePanel.ScrollableSizeHint.FIT);
+ files.setScrollableHeight(ScrollablePanel.ScrollableSizeHint.NONE);
+ files.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
+ // Liste des fichiers
+ for (final SQLRowValues sqlRowValues : attachments) {
+
+ final FilePanel filePanel = new FilePanel(sqlRowValues, this);
+ filePanel.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mousePressed(MouseEvent e) {
+ if (e.getClickCount() == 2) {
+ Thread t = new Thread() {
+ @Override
+ public void run() {
+ AttachmentUtils utils = new AttachmentUtils();
+ File f = utils.getFile(sqlRowValues);
+ if (f == null) {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ JOptionPane.showMessageDialog(null, "Impossible de récupérer le fichier.", "Erreur", JOptionPane.ERROR_MESSAGE);
+ }
+ });
+ System.err.println("Impossible de récupérer le fichier.");
+ } else {
+ try {
+ FileUtils.openFile(f);
+ } catch (IOException e1) {
+ ExceptionHandler.handle("Erreur lors de l'ouverture du fichier.", e1);
+ }
+ }
+ }
+ };
+ t.start();
+ }
+ }
+ });
+ files.add(filePanel);
+
+ }
+ c.gridwidth = 2;
+ c.gridx = 0;
+ c.gridy++;
+ c.weightx = 1;
+ c.weighty = 1;
+ JScrollPane scroll = new JScrollPane(files);
+ scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ scroll.setMinimumSize(new Dimension((int) (400 * 1.618), 400));
+ scroll.setPreferredSize(new Dimension((int) (400 * 1.618), 400));
+ scroll.setBackground(Color.WHITE);
+ scroll.getViewport().setBackground(Color.WHITE);
+ this.add(scroll, c);
+
+ this.validate();
+ this.repaint();
+
+ DropTarget dt = new DropTarget() {
+ @Override
+ public synchronized void drop(DropTargetDropEvent dtde) {
+ dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
+ Transferable t = dtde.getTransferable();
+ try {
+
+ if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
+ @SuppressWarnings("unchecked")
+ List<File> fileList = (List<File>) t.getTransferData(DataFlavor.javaFileListFlavor);
+ // TODO faire en arriere plan, mettre une jauge à droite du bouton ajouter
+ // et mettre un bouton d'annulation
+ AttachmentUtils utils = new AttachmentUtils();
+ boolean cancelledByUser = false;
+ for (File f : fileList) {
+ if (cancelledByUser) {
+ break;
+ }
+ utils.uploadFile(f, rowSource);
+ }
+ initUI();
+ }
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ };
+ files.setDropTarget(dt);
+ scroll.getViewport().setDropTarget(dt);
+ fireDataChanged();
+ }
+
+}
Index: trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/AttachmentUtils.java
===================================================================
--- trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/AttachmentUtils.java (revision 0)
+++ trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/AttachmentUtils.java (revision 142)
@@ -0,0 +1,264 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of the GNU General Public License Version 3
+ * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
+ * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each file.
+ */
+
+ package org.openconcerto.erp.core.edm;
+
+import org.openconcerto.erp.config.ComptaPropsConfiguration;
+import org.openconcerto.erp.generationDoc.DocumentLocalStorageManager;
+import org.openconcerto.erp.storage.StorageEngine;
+import org.openconcerto.erp.storage.StorageEngines;
+import org.openconcerto.sql.model.SQLRow;
+import org.openconcerto.sql.model.SQLRowAccessor;
+import org.openconcerto.sql.model.SQLRowValues;
+import org.openconcerto.sql.model.SQLTable;
+import org.openconcerto.utils.ExceptionHandler;
+import org.openconcerto.utils.FileUtils;
+import org.openconcerto.utils.sync.SyncClient;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.List;
+
+import javax.swing.JOptionPane;
+
+import eu.medsea.mimeutil.MimeType;
+import eu.medsea.mimeutil.MimeUtil;
+
+public class AttachmentUtils {
+
+ public void uploadFile(File inFile, SQLRowAccessor rowSource) {
+ try {
+
+ // Création de la row attachment
+ SQLRowValues rowValsAttachment = new SQLRowValues(rowSource.getTable().getTable("ATTACHMENT"));
+ rowValsAttachment.put("SOURCE_TABLE", rowSource.getTable().getName());
+ rowValsAttachment.put("SOURCE_ID", rowSource.getID());
+
+ SQLRow rowAttachment = rowValsAttachment.insert();
+ int id = rowAttachment.getID();
+
+ String subDir = "EDM" + File.separator + String.valueOf((id / 1000) * 1000);
+ String fileNameID = String.valueOf(id);
+ String ext = "";
+
+ int i = inFile.getName().lastIndexOf('.');
+ if (i > 0) {
+ ext = inFile.getName().substring(i + 1);
+ }
+
+ final String fileWithIDNAme = fileNameID + "." + ext;
+
+ final ComptaPropsConfiguration config = ComptaPropsConfiguration.getInstanceCompta();
+ boolean isOnCloud = config.isOnCloud();
+
+ if (isOnCloud) {
+
+ String remotePath = subDir;
+ remotePath = remotePath.replace('\\', '/');
+ List<StorageEngine> engines = StorageEngines.getInstance().getActiveEngines();
+ for (StorageEngine storageEngine : engines) {
+ if (storageEngine.isConfigured() && storageEngine.allowAutoStorage()) {
+ final String path = remotePath;
+ try {
+ storageEngine.connect();
+ final BufferedInputStream inStream = new BufferedInputStream(new FileInputStream(inFile));
+ storageEngine.store(inStream, path, fileWithIDNAme, true);
+ inStream.close();
+ storageEngine.disconnect();
+ } catch (IOException e) {
+ ExceptionHandler.handle("Impossible de sauvegarder le fichier " + inFile.getAbsolutePath() + " vers " + path + "(" + storageEngine + ")", e);
+ }
+ // if (storageEngine instanceof CloudStorageEngine) {
+ // try {
+ // storageEngine.connect();
+ // final BufferedInputStream inStream = new BufferedInputStream(new
+ // FileInputStream(generatedFile));
+ // storageEngine.store(inStream, path, generatedFile.getName(), true);
+ // inStream.close();
+ // storageEngine.disconnect();
+ // } catch (IOException e) {
+ // ExceptionHandler.handle("Impossible de sauvegarder le fichier généré " +
+ // generatedFile.getAbsolutePath() + " vers " + path + "(" + storageEngine +
+ // ")", e);
+ // }
+ // }
+ }
+ }
+ } else {
+ // Upload File
+
+ // Get file out
+ File dirRoot = DocumentLocalStorageManager.getInstance().getDocumentOutputDirectory(AttachmentSQLElement.DIRECTORY_PREFS);
+ File storagePathFile = new File(dirRoot, subDir);
+ storagePathFile.mkdirs();
+ // TODO CHECK IF FILE EXISTS
+ FileUtils.copyFile(inFile, new File(storagePathFile, fileWithIDNAme));
+
+ }
+
+ // Update rowAttachment
+ rowValsAttachment = rowAttachment.createEmptyUpdateRow();
+
+ // Default is without extension
+ String fileName = inFile.getName();
+ String name = fileName;
+ int index = name.lastIndexOf('.');
+ if (index > 0) {
+ name = name.substring(0, index);
+ }
+ rowValsAttachment.put("NAME", name);
+ rowValsAttachment.put("SOURCE_TABLE", rowSource.getTable().getName());
+ rowValsAttachment.put("SOURCE_ID", rowSource.getID());
+ Collection<MimeType> mimeTypes = MimeUtil.getMimeTypes(inFile);
+ if (mimeTypes != null && !mimeTypes.isEmpty()) {
+ final MimeType mimeType = (MimeType) mimeTypes.toArray()[0];
+ rowValsAttachment.put("MIMETYPE", mimeType.getMediaType() + "/" + mimeType.getSubType());
+ } else {
+ rowValsAttachment.put("MIMETYPE", "application/octet-stream");
+ }
+ rowValsAttachment.put("FILENAME", fileName);
+ rowValsAttachment.put("FILESIZE", inFile.length());
+ rowValsAttachment.put("STORAGE_PATH", subDir);
+ rowValsAttachment.put("STORAGE_FILENAME", fileWithIDNAme);
+ // TODO THUMBNAIL
+ // rowVals.put("THUMBNAIL", );
+ // rowVals.put("THUMBNAIL_WIDTH", );
+ // rowVals.put("THUMBNAIL_HEIGHT", );
+
+ // needed for update count
+
+ rowValsAttachment.commit();
+
+ updateAttachmentsCountFromAttachment(rowValsAttachment);
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ } catch (SQLException e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ public File getFile(SQLRowAccessor rowAttachment) {
+
+ final ComptaPropsConfiguration config = ComptaPropsConfiguration.getInstanceCompta();
+ boolean isOnCloud = config.isOnCloud();
+
+ String subDir = rowAttachment.getString("STORAGE_PATH");
+ String fileName = rowAttachment.getString("STORAGE_FILENAME");
+
+ String remotePath = config.getSocieteID() + File.separator + subDir;
+
+ File fTemp;
+ try {
+ fTemp = File.createTempFile("edm_", "oc");
+ } catch (IOException e) {
+ ExceptionHandler.handle("Impossible de créer le fichier temporaire de réception", e);
+ return null;
+ }
+ File f = new File(fTemp.getParent(), fTemp.getName() + "-dir");
+ f.mkdirs();
+ fTemp.delete();
+
+ if (isOnCloud) {
+ remotePath = remotePath.replace('\\', '/');
+ final SyncClient client = new SyncClient("https://" + config.getStorageServer());
+
+ client.setVerifyHost(false);
+
+ try {
+ client.retrieveFile(f, remotePath, fileName, config.getToken());
+ } catch (Exception e) {
+ ExceptionHandler.handle("Impossible de récupérer le fichier depuis le cloud", e);
+ return null;
+ }
+
+ } else {
+
+ // Get file out
+ File dirRoot = DocumentLocalStorageManager.getInstance().getDocumentOutputDirectory(AttachmentSQLElement.DIRECTORY_PREFS);
+ File storagePathFile = new File(dirRoot, subDir);
+ File fileIn = new File(storagePathFile, fileName);
+ if (fileIn.exists()) {
+ final File outFile = new File(f, fileName);
+ try {
+ FileUtils.copyFile(fileIn, outFile);
+ } catch (IOException e) {
+ ExceptionHandler.handle("Impossible de copier le fichier vers le fichier temporaire de réception", e);
+ return null;
+ }
+ } else {
+ JOptionPane.showMessageDialog(null, "Le fichier n'existe pas sur le serveur!", "Erreur fichier", JOptionPane.ERROR_MESSAGE);
+ }
+ }
+ final File outFile = new File(f, fileName);
+ outFile.setReadOnly();
+ return outFile;
+
+ }
+
+ public void deleteFile(SQLRowAccessor rowAttachment) throws SQLException, IllegalStateException {
+
+ final ComptaPropsConfiguration config = ComptaPropsConfiguration.getInstanceCompta();
+ boolean isOnCloud = config.isOnCloud();
+
+ // Delete File
+ String subDir = rowAttachment.getString("STORAGE_PATH");
+ String fileName = rowAttachment.getString("STORAGE_FILENAME");
+
+ String remotePath = config.getSocieteID() + File.separator + subDir;
+ if (isOnCloud) {
+ remotePath = remotePath.replace('\\', '/');
+ // final SyncClient client = new SyncClient("https://" + config.getStorageServer());
+ //
+ // client.setVerifyHost(false);
+
+ // TODO DELETE FILE ON CLOUD OR RENAME?
+ // client.retrieveFile(f, remotePath, fileName, config.getToken());
+ } else {
+
+ File dirRoot = DocumentLocalStorageManager.getInstance().getDocumentOutputDirectory(AttachmentSQLElement.DIRECTORY_PREFS);
+ File storagePathFile = new File(dirRoot, subDir);
+ File f = new File(storagePathFile, fileName);
+ if (f.exists()) {
+ if (!f.delete()) {
+ throw new IllegalStateException("Une erreur est survenue lors de la suppression du fichier");
+ }
+ }
+ }
+
+ // Delete Row
+ config.getDirectory().getElement(rowAttachment.getTable()).archive(rowAttachment.getID());
+ updateAttachmentsCountFromAttachment(rowAttachment);
+ }
+
+ public void updateAttachmentsCountFromAttachment(SQLRowAccessor rowAttachment) {
+ SQLTable table = rowAttachment.getTable().getTable(rowAttachment.getString("SOURCE_TABLE"));
+ SQLRow source = table.getRow(rowAttachment.getInt("SOURCE_ID"));
+ updateAttachmentsCountFromSource(source);
+ }
+
+ public void updateAttachmentsCountFromSource(SQLRow rowSource) {
+ SQLTable tableSource = rowSource.getTable();
+ SQLTable tableAtt = rowSource.getTable().getTable("ATTACHMENT");
+
+ String req = "UPDATE " + tableSource.getSQLName().quote() + " SET " + tableSource.getField("ATTACHMENTS").getQuotedName() + "=(SELECT COUNT(*) FROM " + tableAtt.getSQLName().quote();
+ req += " WHERE " + tableAtt.getArchiveField().getQuotedName() + "=0 AND " + tableAtt.getField("SOURCE_TABLE").getQuotedName() + "='" + tableSource.getName() + "'";
+ req += " AND " + tableAtt.getField("SOURCE_ID").getQuotedName() + "=" + rowSource.getID() + ") WHERE " + tableSource.getKey().getQuotedName() + "=" + rowSource.getID();
+
+ tableSource.getDBSystemRoot().getDataSource().execute(req);
+ }
+
+}
Index: trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/jpg-icon.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/jpg-icon.png
===================================================================
--- trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/jpg-icon.png (revision 0)
+++ trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/jpg-icon.png (revision 142)
/trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/jpg-icon.png
Changements de propriété:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/png-icon.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/png-icon.png
===================================================================
--- trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/png-icon.png (revision 0)
+++ trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/png-icon.png (revision 142)
/trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/png-icon.png
Changements de propriété:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/doc-icon.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/doc-icon.png
===================================================================
--- trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/doc-icon.png (revision 0)
+++ trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/doc-icon.png (revision 142)
/trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/doc-icon.png
Changements de propriété:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/ods-icon.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/ods-icon.png
===================================================================
--- trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/ods-icon.png (revision 0)
+++ trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/ods-icon.png (revision 142)
/trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/ods-icon.png
Changements de propriété:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/FilePanel.java
===================================================================
--- trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/FilePanel.java (revision 0)
+++ trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/FilePanel.java (revision 142)
@@ -0,0 +1,279 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of the GNU General Public License Version 3
+ * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
+ * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each file.
+ */
+
+ package org.openconcerto.erp.core.edm;
+
+import org.openconcerto.sql.model.SQLRowValues;
+import org.openconcerto.ui.DefaultGridBagConstraints;
+import org.openconcerto.utils.ExceptionHandler;
+import org.openconcerto.utils.JImage;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.sql.SQLException;
+
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
+import javax.swing.JTextField;
+import javax.swing.SwingConstants;
+
+public class FilePanel extends JPanel {
+ JImage image = null;
+
+ public static final int WIDTH = 128;
+ public static final int HEIGHT = 80;
+ JLabel label;
+
+ public FilePanel(final SQLRowValues rowAttachment, final AttachmentPanel panelSource) {
+ final String name = rowAttachment.getString("NAME");
+ this.setOpaque(true);
+ this.setLayout(new BorderLayout());
+ try {
+ String type = rowAttachment.getString("MIMETYPE");
+ if (type == null || type.trim().isEmpty() || type.equals("application/octet-stream")) {
+ image = new JImage(this.getClass().getResource("data-icon.png"));
+ } else if (type.equals("application/msword")) {
+ image = new JImage(this.getClass().getResource("doc-icon.png"));
+ } else if (type.equals("application/vnd.openxmlformats-officedocument.wordprocessingml.document")) {
+ image = new JImage(this.getClass().getResource("docx-icon.png"));
+ } else if (type.equals("application/vnd.oasis.opendocument.text")) {
+ image = new JImage(this.getClass().getResource("odt-icon.png"));
+ } else if (type.equals("application/pdf")) {
+ image = new JImage(this.getClass().getResource("pdf-icon.png"));
+ } else if (type.equals("image/jpeg")) {
+ image = new JImage(this.getClass().getResource("jpg-icon.png"));
+ } else if (type.equals("image/png")) {
+ image = new JImage(this.getClass().getResource("png-icon.png"));
+ } else if (type.equals("application/vnd.oasis.opendocument.spreadsheet")) {
+ image = new JImage(this.getClass().getResource("ods-icon.png"));
+ } else if (type.equals("application/msexcel") || type.equals("application/vnd.ms-excel") || type.equals("application/xls")) {
+ image = new JImage(this.getClass().getResource("xls-icon.png"));
+ } else if (type.equals("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")) {
+ image = new JImage(this.getClass().getResource("xlsx-icon.png"));
+ } else {
+ image = new JImage(this.getClass().getResource("data-icon.png"));
+ }
+ image.setOpaque(true);
+
+ image.setCenterImage(true);
+ this.add(image, BorderLayout.CENTER);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ setBackground(Color.WHITE);
+ label = new JLabel(name, SwingConstants.CENTER);
+ label.setOpaque(false);
+ this.add(label, BorderLayout.SOUTH);
+
+ this.setPreferredSize(new Dimension(WIDTH, HEIGHT));
+ this.setMinimumSize(new Dimension(WIDTH, HEIGHT));
+ this.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseExited(MouseEvent e) {
+ setBackground(Color.WHITE);
+ }
+
+ @Override
+ public void mouseEntered(MouseEvent e) {
+ setBackground(new Color(230, 240, 255));
+ }
+
+ });
+ final JPopupMenu menu = new JPopupMenu();
+ final JMenuItem menuItemDelete = new JMenuItem("Supprimer");
+ menuItemDelete.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+
+ int value = JOptionPane.showConfirmDialog(FilePanel.this, "Voulez-vous vraiment supprimer ce fichier ?\n" + rowAttachment.getString("NAME") + "\nFichier orignal : "
+ + rowAttachment.getString("FILENAME") + "\nType : " + rowAttachment.getString("MIMETYPE"), "Supprimer le ficher", JOptionPane.YES_NO_OPTION);
+
+ if (value == JOptionPane.YES_OPTION) {
+ AttachmentUtils utils = new AttachmentUtils();
+ try {
+ utils.deleteFile(rowAttachment);
+ panelSource.initUI();
+ } catch (Exception e1) {
+ ExceptionHandler.handle("Erreur lors de la suppression du fichier!", e1);
+ }
+ }
+
+ }
+ });
+ menu.add(menuItemDelete);
+ final JMenuItem menuItemRename = new JMenuItem("Renommer");
+ menuItemRename.addActionListener(new ActionListener() {
+
+ final JTextField text = new JTextField(name);
+
+ private void stopNameEditing() {
+ FilePanel.this.invalidate();
+ FilePanel.this.remove(text);
+ FilePanel.this.add(label, BorderLayout.SOUTH);
+ FilePanel.this.validate();
+ FilePanel.this.repaint();
+ }
+
+ public void validText(final SQLRowValues rowAttachment, final String name, final JTextField text) {
+ try {
+ String newName = text.getText();
+ if (newName.trim().isEmpty()) {
+ newName = name;
+ }
+ rowAttachment.put("NAME", newName).commit();
+ label.setText(newName);
+ } catch (SQLException e1) {
+ ExceptionHandler.handle("Erreur lors du renommage du fichier!", e1);
+ }
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ final String name = rowAttachment.getString("NAME");
+
+ text.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_ENTER) {
+ validText(rowAttachment, name, text);
+ stopNameEditing();
+ } else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
+ stopNameEditing();
+ }
+ }
+
+ });
+ text.addFocusListener(new FocusListener() {
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ validText(rowAttachment, name, text);
+ stopNameEditing();
+ }
+
+ @Override
+ public void focusGained(FocusEvent e) {
+ }
+
+ });
+ text.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseExited(MouseEvent e) {
+ validText(rowAttachment, name, text);
+ stopNameEditing();
+ }
+
+ });
+
+ FilePanel.this.invalidate();
+ FilePanel.this.remove(label);
+ FilePanel.this.add(text, BorderLayout.SOUTH);
+ FilePanel.this.validate();
+ FilePanel.this.repaint();
+
+ text.grabFocus();
+ text.setSelectionStart(0);
+ text.setSelectionEnd(name.length());
+ }
+
+ });
+ menu.add(menuItemRename);
+ menu.addSeparator();
+ JMenuItem menuItemProperties = new JMenuItem("Propriétés");
+ menuItemProperties.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ JFrame f = new JFrame();
+ f.setTitle("Propriétés de " + rowAttachment.getString("NAME"));
+ JPanel p = new JPanel();
+ p.setLayout(new GridBagLayout());
+ GridBagConstraints c = new DefaultGridBagConstraints();
+ // Name
+ c.weightx = 0;
+ p.add(new JLabel("Nom : ", SwingConstants.RIGHT), c);
+ c.gridx++;
+ c.weightx = 1;
+ p.add(new JLabel(rowAttachment.getString("NAME")), c);
+ c.gridy++;
+ // Type
+ c.gridx = 0;
+ c.weightx = 0;
+ p.add(new JLabel("Type : ", SwingConstants.RIGHT), c);
+ c.gridx++;
+ c.weightx = 1;
+ p.add(new JLabel(rowAttachment.getString("MIMETYPE")), c);
+ c.gridy++;
+ // FileName
+ c.gridx = 0;
+ c.weightx = 0;
+ p.add(new JLabel("Fichier original : ", SwingConstants.RIGHT), c);
+ c.gridx++;
+ c.weightx = 1;
+ p.add(new JLabel(rowAttachment.getString("FILENAME")), c);
+ c.gridy++;
+ // Size
+ c.gridx = 0;
+ c.weightx = 0;
+ p.add(new JLabel("Taille : ", SwingConstants.RIGHT), c);
+ c.gridx++;
+ c.weightx = 1;
+ p.add(new JLabel(rowAttachment.getInt("FILESIZE") + " octets"), c);
+
+ // Spacer
+ c.gridx = 1;
+ c.gridy++;
+ c.weightx = 1;
+ JPanel spacer = new JPanel();
+ spacer.setPreferredSize(new Dimension(300, 1));
+ p.add(spacer, c);
+ f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+
+ f.setContentPane(p);
+ f.pack();
+ f.setResizable(false);
+ f.setLocationRelativeTo(FilePanel.this);
+ f.setVisible(true);
+
+ }
+ });
+ menu.add(menuItemProperties);
+ setComponentPopupMenu(menu);
+ }
+
+ @Override
+ public void setBackground(Color bg) {
+ super.setBackground(bg);
+ if (image != null) {
+ image.setBackground(bg);
+ }
+ }
+}
Index: trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/odt-icon.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/odt-icon.png
===================================================================
--- trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/odt-icon.png (revision 0)
+++ trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/odt-icon.png (revision 142)
/trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/odt-icon.png
Changements de propriété:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/xls-icon.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/xls-icon.png
===================================================================
--- trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/xls-icon.png (revision 0)
+++ trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/xls-icon.png (revision 142)
/trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/xls-icon.png
Changements de propriété:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/shipment/element/BonDeLivraisonSQLElement.java
===================================================================
--- trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/shipment/element/BonDeLivraisonSQLElement.java (revision 141)
+++ trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/shipment/element/BonDeLivraisonSQLElement.java (revision 142)
@@ -20,20 +20,23 @@
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.element.SQLElement;
+import org.openconcerto.sql.element.SQLElementLink.LinkType;
import org.openconcerto.sql.element.SQLElementLinksSetup;
import org.openconcerto.sql.element.TreesOfSQLRows;
-import org.openconcerto.sql.element.SQLElementLink.LinkType;
+import org.openconcerto.sql.model.AliasedTable;
+import org.openconcerto.sql.model.SQLName;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLSelect;
+import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.preferences.SQLPreferences;
+import org.openconcerto.sql.request.UpdateBuilder;
import org.openconcerto.ui.preferences.DefaultProps;
+import org.openconcerto.utils.ListMap;
import java.sql.SQLException;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import org.apache.commons.dbutils.handlers.ArrayListHandler;
@@ -84,6 +87,11 @@
return l;
}
+ @Override
+ public ListMap<String, String> getShowAs() {
+ return ListMap.singleton(null, "NUMERO", "DATE");
+ }
+
/*
* (non-Javadoc)
*
@@ -93,12 +101,39 @@
return new BonDeLivraisonSQLComponent();
}
+ public List<Object> getCmdClientFrom(int blOrigin) {
+ SQLTable tableBLElement = getTable().getTable("BON_DE_LIVRAISON_ELEMENT");
+ SQLTable tableCmdElement = getTable().getTable("COMMANDE_CLIENT_ELEMENT");
+ String up = "SELECT DISTINCT c2.\"ID_COMMANDE_CLIENT\" FROm " + new SQLName(tableBLElement.getDBRoot().getName(), tableBLElement.getName()).quote() + " b2, "
+ + new SQLName(tableCmdElement.getDBRoot().getName(), tableCmdElement.getName()).quote() + " c2 WHERE b2.\"ID_BON_DE_LIVRAISON\"=" + blOrigin
+ + " AND c2.\"ARCHIVE\"=0 AND b2.\"ARCHIVE\"=0 AND c2.\"ID\">1 AND b2.\"ID\">1 AND b2.\"ID_COMMANDE_CLIENT_ELEMENT\"=c2.\"ID\"";
+ List<Object> cmds = getTable().getDBSystemRoot().getDataSource().executeCol(up);
+ return cmds;
+ }
+
+ public void updateCmdClientElement(List<Object> cmds, int idblOrigin) {
+ SQLTable tableBLElement = getTable().getTable("BON_DE_LIVRAISON_ELEMENT");
+ SQLTable tableCmdElement = getTable().getTable("COMMANDE_CLIENT_ELEMENT");
+ UpdateBuilder build = new UpdateBuilder(tableCmdElement);
+ build.set("QTE_LIVREE", "(SELECT SUM(b.\"QTE_LIVREE\" * b.\"QTE_UNITAIRE\") from " + new SQLName(tableBLElement.getDBRoot().getName(), tableBLElement.getName()).quote()
+ + " b where c.\"ID\"=b.\"ID_COMMANDE_CLIENT_ELEMENT\" AND c.\"ID\">1 AND c.\"ARCHIVE\"=0 AND b.\"ID\">1 AND b.\"ARCHIVE\"=0 )");
+ AliasedTable alias = new AliasedTable(tableCmdElement, "c");
+ build.setWhere(new Where(alias.getField("ID_COMMANDE_CLIENT"), cmds));
+
+ getTable().getDBSystemRoot().getDataSource().execute(build.asString().replaceAll(" SET", " c SET "));
+ }
+
@Override
protected void archive(TreesOfSQLRows trees, boolean cutLinks) throws SQLException {
+ List<Object> cmds = null;
+ List<Integer> ids = new ArrayList<Integer>();
for (SQLRow row : trees.getRows()) {
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot());
+
+ cmds = getCmdClientFrom(row.getID());
+ ids.add(row.getID());
if (!prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_FACT, true)) {
// Mise à jour des stocks
@@ -120,5 +155,9 @@
}
}
super.archive(trees, cutLinks);
+ for (Integer id : ids) {
+
+ updateCmdClientElement(cmds, id);
+ }
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/shipment/action/ListeDesBonsDeLivraisonAction.java
17,7 → 17,6
import org.openconcerto.erp.core.common.component.TransfertBaseSQLComponent;
import org.openconcerto.erp.core.common.ui.IListFilterDatePanel;
import org.openconcerto.erp.core.common.ui.IListTotalPanel;
import org.openconcerto.erp.core.sales.order.report.CommandeClientXmlSheet;
import org.openconcerto.erp.core.sales.shipment.report.BonLivraisonXmlSheet;
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
import org.openconcerto.sql.Configuration;
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/shipment/action/ListeDesReliquatsBonsLivraisonsAction.java
Nouveau fichier
0,0 → 1,43
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.sales.shipment.action;
 
import javax.swing.Action;
import javax.swing.JFrame;
 
import org.openconcerto.erp.action.CreateFrameAbstractAction;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.view.IListFrame;
import org.openconcerto.sql.view.ListeAddPanel;
import org.openconcerto.sql.view.list.IListe;
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
 
public class ListeDesReliquatsBonsLivraisonsAction extends CreateFrameAbstractAction {
 
public ListeDesReliquatsBonsLivraisonsAction() {
super();
this.putValue(Action.NAME, "Liste des reliquats de bons de livraisons");
}
 
public JFrame createFrame() {
final SQLElement element = Configuration.getInstance().getDirectory().getElement("RELIQUAT_BL");
final SQLTableModelSourceOnline tableSource = element.getTableSource(true);
 
final IListFrame frame = new IListFrame(new ListeAddPanel(element, new IListe(tableSource)));
 
return frame;
}
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/shipment/ui/BonDeLivraisonItemTable.java
17,6 → 17,7
import org.openconcerto.erp.core.common.ui.AbstractVenteArticleItemTable;
import org.openconcerto.erp.core.common.ui.Acompte;
import org.openconcerto.erp.core.common.ui.AcompteCellEditor;
import org.openconcerto.erp.core.common.ui.DeviseNumericCellEditor;
import org.openconcerto.erp.core.common.ui.DeviseNumericHTConvertorCellEditor;
import org.openconcerto.erp.core.common.ui.DeviseTableCellRenderer;
import org.openconcerto.erp.core.common.ui.QteCellEditor;
23,9 → 24,15
import org.openconcerto.erp.core.common.ui.Remise;
import org.openconcerto.erp.core.finance.accounting.model.CurrencyConverter;
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
import org.openconcerto.erp.core.sales.pos.io.BarcodeReader;
import org.openconcerto.erp.core.sales.pos.ui.BarcodeListener;
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
import org.openconcerto.erp.core.sales.product.ui.ArticleRowValuesRenderer;
import org.openconcerto.erp.core.sales.product.ui.CurrencyWithSymbolRenderer;
import org.openconcerto.erp.core.sales.product.ui.DeliveredQtyRowValuesRenderer;
import org.openconcerto.erp.core.sales.product.ui.QteUnitRowValuesRenderer;
import org.openconcerto.erp.core.sales.product.ui.QtyToDeliverRowValuesRenderer;
import org.openconcerto.erp.core.sales.product.ui.ReliquatRowValuesTable;
import org.openconcerto.erp.preferences.DefaultNXProps;
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel;
import org.openconcerto.sql.Configuration;
33,7 → 40,9
import org.openconcerto.sql.model.SQLField;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLRowListRSH;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.UndefinedRowValuesCache;
import org.openconcerto.sql.model.Where;
40,6 → 49,8
import org.openconcerto.sql.preferences.SQLPreferences;
import org.openconcerto.sql.sqlobject.ITextArticleWithCompletionCellEditor;
import org.openconcerto.sql.sqlobject.ITextWithCompletion;
import org.openconcerto.sql.users.rights.UserRights;
import org.openconcerto.sql.users.rights.UserRightsManager;
import org.openconcerto.sql.view.list.AutoCompletionManager;
import org.openconcerto.sql.view.list.CellDynamicModifier;
import org.openconcerto.sql.view.list.RowValuesTable;
49,8 → 60,16
import org.openconcerto.sql.view.list.ValidStateChecker;
import org.openconcerto.ui.table.XTableColumnModel;
import org.openconcerto.utils.DecimalUtils;
import org.openconcerto.utils.Tuple3;
import org.openconcerto.utils.i18n.TranslationManager;
 
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.HierarchyEvent;
import java.awt.event.HierarchyListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
58,9 → 77,13
import java.util.List;
import java.util.Vector;
 
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPopupMenu;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.ToolTipManager;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellRenderer;
71,11 → 94,16
 
private SQLTableElement tableElementPoidsTotalLivree;
private SQLTable tableArticle = Configuration.getInstance().getBase().getTable("ARTICLE");
private ReliquatRowValuesTable reliquatTable;
 
public BonDeLivraisonItemTable(List<JButton> l) {
super(l);
}
 
public void setReliquatTable(ReliquatRowValuesTable reliquatTable) {
this.reliquatTable = reliquatTable;
}
 
@Override
protected void init() {
final SQLElement e = getSQLElement();
84,23 → 112,70
final boolean selectArticle = prefs.getBoolean(GestionArticleGlobalPreferencePanel.USE_CREATED_ARTICLE, false);
final boolean createAuto = prefs.getBoolean(GestionArticleGlobalPreferencePanel.CREATE_ARTICLE_AUTO, true);
final boolean filterFamilleArticle = prefs.getBoolean(GestionArticleGlobalPreferencePanel.FILTER_BY_FAMILY, false);
final boolean showEco = prefs.getBoolean(AbstractVenteArticleItemTable.SHOW_ECO_CONTRIBUTION_COLUMNS, false);
 
final UserRights rights = UserRightsManager.getCurrentUserRights();
final boolean editVTPrice = rights.haveRight(EDIT_PRIX_VENTE_CODE);
final boolean showHAPrice = rights.haveRight(SHOW_PRIX_ACHAT_CODE);
final boolean lockVTMinPrice = rights.haveRight(LOCK_PRIX_MIN_VENTE_CODE);
 
final List<SQLTableElement> list = new Vector<SQLTableElement>();
list.add(new SQLTableElement(e.getTable().getField("ID_STYLE")));
 
final SQLTableElement tableFamille = new SQLTableElement(e.getTable().getField("ID_FAMILLE_ARTICLE"));
list.add(tableFamille);
// Article
final SQLTableElement tableElementArticle = new SQLTableElement(e.getTable().getField("ID_ARTICLE"), true, true, true) {
@Override
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) {
boolean b = super.isCellEditable(vals, rowIndex, columnIndex);
if (e.getTable().contains("ID_COMMANDE_CLIENT_ELEMENT")) {
boolean noCmdElt = vals.getObject("ID_COMMANDE_CLIENT_ELEMENT") == null || vals.isForeignEmpty("ID_COMMANDE_CLIENT_ELEMENT");
return b && noCmdElt;
} else {
return b;
}
 
// Article
final SQLTableElement tableElementArticle = new SQLTableElement(e.getTable().getField("ID_ARTICLE"), true, true, true);
}
};
list.add(tableElementArticle);
 
if (e.getTable().getFieldsName().contains("ID_ECO_CONTRIBUTION")) {
this.tableElementEcoID = new SQLTableElement(e.getTable().getField("ID_ECO_CONTRIBUTION"));
list.add(this.tableElementEcoID);
}
 
// Code article
final SQLTableElement tableElementCode = new SQLTableElement(e.getTable().getField("CODE"), String.class,
new ITextArticleWithCompletionCellEditor(e.getTable().getTable("ARTICLE"), e.getTable().getTable("ARTICLE_FOURNISSEUR")));
new ITextArticleWithCompletionCellEditor(e.getTable().getTable("ARTICLE"), e.getTable().getTable("ARTICLE_FOURNISSEUR"))) {
@Override
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) {
boolean b = super.isCellEditable(vals, rowIndex, columnIndex);
if (e.getTable().contains("ID_COMMANDE_CLIENT_ELEMENT")) {
boolean noCmdElt = vals.getObject("ID_COMMANDE_CLIENT_ELEMENT") == null || vals.isForeignEmpty("ID_COMMANDE_CLIENT_ELEMENT");
return b && noCmdElt;
} else {
return b;
}
 
}
};
list.add(tableElementCode);
// Désignation de l'article
final SQLTableElement tableElementNom = new SQLTableElement(e.getTable().getField("NOM"));
final SQLTableElement tableElementNom = new SQLTableElement(e.getTable().getField("NOM")) {
@Override
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) {
 
boolean b = super.isCellEditable(vals, rowIndex, columnIndex);
if (e.getTable().contains("ID_COMMANDE_CLIENT_ELEMENT")) {
boolean noCmdElt = vals.getObject("ID_COMMANDE_CLIENT_ELEMENT") == null || vals.isForeignEmpty("ID_COMMANDE_CLIENT_ELEMENT");
return b && noCmdElt;
} else {
return b;
}
 
}
};
list.add(tableElementNom);
 
// Désignation de l'article
170,6 → 245,22
};
 
list.add(tableElement_ValeurMetrique1);
 
// Prix d'achat HT de la métrique 1
final SQLTableElement tableElement_PrixMetrique1_AchatHT = new SQLTableElement(e.getTable().getField("PRIX_METRIQUE_HA_1"), BigDecimal.class) {
protected Object getDefaultNullValue() {
return BigDecimal.ZERO;
}
 
@Override
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) {
return isCellNiveauEditable(vals, rowIndex, columnIndex);
}
 
};
tableElement_PrixMetrique1_AchatHT.setRenderer(new CurrencyWithSymbolRenderer());
list.add(tableElement_PrixMetrique1_AchatHT);
 
// Prix de vente HT de la métrique 1
SQLField field = e.getTable().getField("PRIX_METRIQUE_VT_1");
final DeviseNumericHTConvertorCellEditor editorPVHT = new DeviseNumericHTConvertorCellEditor(field);
188,11 → 279,6
// }
// };
list.add(tableElement_PrixMetrique1_VenteHT);
// Prix d'achat HT de la métrique 1
// final SQLTableElement tableElement_PrixMetrique1_AchatHT = new
// SQLTableElement(e.getTable().getField("PRIX_METRIQUE_HA_1"), Long.class, new
// DeviseCellEditor());
// list.add(tableElement_PrixMetrique1_AchatHT);
 
// Prix de vente HT de la métrique 3
// final SQLTableElement tableElement_PrixMetrique3_VenteHT = new
205,6 → 291,11
// DeviseCellEditor());
// list.add(tableElement_PrixMetrique3_AchatHT);
 
if (e.getTable().getFieldsName().contains("ECO_CONTRIBUTION")) {
this.tableElementEco = new SQLTableElement(e.getTable().getField("ECO_CONTRIBUTION"));
list.add(this.tableElementEco);
}
 
SQLTableElement eltDevise = null;
SQLTableElement eltUnitDevise = null;
if (DefaultNXProps.getInstance().getBooleanValue(ARTICLE_SHOW_DEVISE, false)) {
254,6 → 345,13
protected Object getDefaultNullValue() {
return Integer.valueOf(0);
}
 
@Override
public TableCellRenderer getTableCellRenderer() {
 
return new QtyToDeliverRowValuesRenderer();
}
 
};
list.add(this.qte);
 
260,7 → 358,23
// Mode de vente
final SQLTableElement tableElement_ModeVente = new SQLTableElement(e.getTable().getField("ID_MODE_VENTE_ARTICLE"));
list.add(tableElement_ModeVente);
final SQLField prixAchatHTField = e.getTable().getField("PA_HT");
final DeviseNumericCellEditor editorPAchatHT = new DeviseNumericCellEditor(prixAchatHTField);
 
this.ha = new SQLTableElement(prixAchatHTField, BigDecimal.class, editorPAchatHT) {
protected Object getDefaultNullValue() {
return BigDecimal.ZERO;
}
 
@Override
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) {
return isCellNiveauEditable(vals, rowIndex, columnIndex);
}
};
this.ha.setRenderer(new CurrencyWithSymbolRenderer());
 
list.add(this.ha);
 
// Prix d'achat unitaire HT
// final SQLTableElement tableElement_PrixAchat_HT = new
// SQLTableElement(e.getTable().getField("PA_HT"), Long.class, new DeviseCellEditor());
283,7 → 397,13
list.add(this.tableElementTVA);
 
// Quantité Livrée
final SQLTableElement tableElement_QuantiteLivree = new SQLTableElement(e.getTable().getField("QTE_LIVREE"), Integer.class);
final SQLTableElement tableElement_QuantiteLivree = new SQLTableElement(e.getTable().getField("QTE_LIVREE"), Integer.class) {
@Override
public TableCellRenderer getTableCellRenderer() {
 
return new DeliveredQtyRowValuesRenderer();
}
};
list.add(tableElement_QuantiteLivree);
 
// Poids piece
384,8 → 504,60
list.add(tableElementRemise);
 
// Total HT
this.totalHA = new SQLTableElement(e.getTable().getField("T_PA_HT"), BigDecimal.class);
this.totalHA.setRenderer(new CurrencyWithSymbolRenderer());
this.totalHA.setEditable(false);
list.add(this.totalHA);
 
this.totalHT = new SQLTableElement(e.getTable().getField("T_PV_HT"), BigDecimal.class);
this.totalHT.setRenderer(new DeviseTableCellRenderer());
 
// Marge HT
if (e.getTable().getFieldsName().contains("MARGE_HT")) {
 
final SQLTableElement marge = new SQLTableElement(e.getTable().getField("MARGE_HT"), BigDecimal.class) {
protected Object getDefaultNullValue() {
return BigDecimal.ZERO;
}
 
@Override
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) {
return isCellNiveauEditable(vals, rowIndex, columnIndex);
}
 
};
marge.setRenderer(new CurrencyWithSymbolRenderer());
marge.setEditable(false);
list.add(marge);
this.totalHT.addModificationListener(marge);
this.totalHA.addModificationListener(marge);
marge.setModifier(new CellDynamicModifier() {
@Override
public Object computeValueFrom(SQLRowValues row, SQLTableElement source) {
 
BigDecimal vt = (BigDecimal) row.getObject("T_PV_HT");
 
BigDecimal ha = (BigDecimal) row.getObject("T_PA_HT");
 
final BigDecimal acomptePercent = row.getBigDecimal("POURCENT_FACTURABLE");
final BigDecimal acompteMontant = row.getBigDecimal("MONTANT_FACTURABLE");
Acompte acompte = new Acompte(acomptePercent, acompteMontant);
ha = acompte.getResultFrom(ha);
vt = acompte.getResultFrom(vt);
 
return vt.subtract(ha).setScale(marge.getDecimalDigits(), RoundingMode.HALF_UP);
}
 
});
 
}
 
if (e.getTable().getFieldsName().contains("T_ECO_CONTRIBUTION")) {
this.tableElementEcoTotal = new SQLTableElement(e.getTable().getField("T_ECO_CONTRIBUTION"));
list.add(this.tableElementEcoTotal);
}
 
// Total HT
list.add(this.totalHT);
// Total TTC
this.tableElementTotalTTC = new SQLTableElement(e.getTable().getField("T_PV_TTC"), BigDecimal.class);
392,6 → 564,11
this.tableElementTotalTTC.setRenderer(new DeviseTableCellRenderer());
list.add(this.tableElementTotalTTC);
 
if (e.getTable().contains("ID_COMMANDE_CLIENT_ELEMENT")) {
final SQLTableElement tableCmdElt = new SQLTableElement(e.getTable().getField("ID_COMMANDE_CLIENT_ELEMENT"));
list.add(tableCmdElt);
}
 
SQLRowValues defautRow = new SQLRowValues(UndefinedRowValuesCache.getInstance().getDefaultRowValues(e.getTable()));
defautRow.put("ID_TAXE", TaxeCache.getCache().getFirstTaxe().getID());
defautRow.put("CODE", "");
415,6 → 592,9
if (DefaultNXProps.getInstance().getBooleanValue(ARTICLE_SHOW_DEVISE, false)) {
completionField.add("ID_PAYS");
}
if (e.getTable().getFieldsName().contains("ID_ECO_CONTRIBUTION")) {
completionField.add("ID_ECO_CONTRIBUTION");
}
completionField.add("ID_UNITE_VENTE");
completionField.add("PA_HT");
completionField.add("PV_HT");
466,6 → 646,53
final Where w = new Where(sqlTableArticle.getField("OBSOLETE"), "=", Boolean.FALSE);
m.setWhere(w);
 
if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.CAN_EXPAND_NOMENCLATURE_VT, true)) {
 
table.addMouseListener(new MouseAdapter() {
 
@Override
public void mousePressed(MouseEvent e) {
 
handlePopup(e);
}
 
@Override
public void mouseReleased(MouseEvent e) {
 
handlePopup(e);
}
 
public void handlePopup(MouseEvent e) {
final int rowindex = table.getSelectedRow();
if (rowindex < 0)
return;
if (e.isPopupTrigger() && e.getComponent() instanceof JTable) {
JPopupMenu popup = new JPopupMenu();
popup.add(new AbstractAction(TranslationManager.getInstance().getTranslationForItem("product.bom.expand")) {
 
@Override
public void actionPerformed(ActionEvent arg0) {
expandNomenclature(rowindex, m, EXPAND_TYPE.EXPAND);
}
});
popup.add(new AbstractAction(TranslationManager.getInstance().getTranslationForItem("product.bom.expose")) {
 
@Override
public void actionPerformed(ActionEvent arg0) {
expandNomenclature(rowindex, m, EXPAND_TYPE.VIEW_ONLY);
}
});
 
for (AbstractAction action : getAdditionnalMouseAction(rowindex)) {
popup.add(action);
}
 
popup.show(e.getComponent(), e.getX(), e.getY());
}
}
});
}
 
final AutoCompletionManager m2 = new AutoCompletionManager(tableElementNom, ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete().getField("ARTICLE.NOM"), this.table,
this.table.getRowValuesTableModel()) {
@Override
506,16 → 733,44
 
m3.setWhere(w);
 
// ECO Contribution
if (this.tableElementEco != null && this.tableElementEcoTotal != null && this.tableElementEcoID != null) {
this.qte.addModificationListener(this.tableElementEcoTotal);
this.tableElementEco.addModificationListener(this.tableElementEcoTotal);
this.tableElementEcoTotal.setModifier(new CellDynamicModifier() {
public Object computeValueFrom(final SQLRowValues row, SQLTableElement source) {
 
int qte = Integer.parseInt(row.getObject("QTE").toString());
BigDecimal f = (row.getObject("ECO_CONTRIBUTION") == null) ? BigDecimal.ZERO : (BigDecimal) row.getObject("ECO_CONTRIBUTION");
return f.multiply(new BigDecimal(qte));
}
 
});
this.tableElementEcoID.addModificationListener(this.tableElementEco);
this.tableElementEco.setModifier(new CellDynamicModifier() {
public Object computeValueFrom(final SQLRowValues row, SQLTableElement source) {
 
if (source != null && source.equals(tableElementEcoID)) {
return row.getForeign("ID_ECO_CONTRIBUTION").getBigDecimal("TAUX");
} else {
return row.getObject("ECO_CONTRIBUTION");
}
}
});
}
 
// Calcul automatique du total HT
this.qte.addModificationListener(tableElement_PrixMetrique1_VenteHT);
this.qte.addModificationListener(totalHT);
tableElement_QuantiteLivree.addModificationListener(tableElement_PrixMetrique1_VenteHT);
tableElement_QuantiteLivree.addModificationListener(totalHT);
tableElement_QuantiteLivree.addModificationListener(totalHA);
qteU.addModificationListener(totalHT);
qteU.addModificationListener(totalHA);
this.ha.addModificationListener(this.totalHA);
tableElementRemise.addModificationListener(this.totalHT);
tableElement_PrixVente_HT.addModificationListener(totalHT);
this.totalHT.setModifier(new CellDynamicModifier() {
public Object computeValueFrom(final SQLRowValues row, SQLTableElement source) {
System.out.println("Compute totalHT");
int qte = Integer.parseInt(row.getObject("QTE").toString());
int qte = Integer.parseInt(row.getObject("QTE_LIVREE").toString());
BigDecimal f = (BigDecimal) row.getObject("PV_HT");
System.out.println("Qte:" + qte + " et PV_HT:" + f);
BigDecimal b = (row.getObject("QTE_UNITAIRE") == null) ? BigDecimal.ONE : (BigDecimal) row.getObject("QTE_UNITAIRE");
531,8 → 786,18
}
 
});
this.totalHA.setModifier(new CellDynamicModifier() {
public Object computeValueFrom(final SQLRowValues row, SQLTableElement source) {
int qte = Integer.parseInt(row.getObject("QTE_LIVREE").toString());
BigDecimal f = (BigDecimal) row.getObject("PA_HT");
BigDecimal b = (row.getObject("QTE_UNITAIRE") == null) ? BigDecimal.ONE : (BigDecimal) row.getObject("QTE_UNITAIRE");
BigDecimal r = b.multiply(f.multiply(BigDecimal.valueOf(qte)), DecimalUtils.HIGH_PRECISION).setScale(totalHA.getDecimalDigits(), BigDecimal.ROUND_HALF_UP);
return r;
}
 
});
// Calcul automatique du total TTC
this.qte.addModificationListener(tableElementTotalTTC);
tableElement_QuantiteLivree.addModificationListener(tableElementTotalTTC);
qteU.addModificationListener(tableElementTotalTTC);
tableElement_PrixVente_HT.addModificationListener(tableElementTotalTTC);
this.tableElementTVA.addModificationListener(tableElementTotalTTC);
653,7 → 918,7
tableElementTotalDevise.setModifier(new CellDynamicModifier() {
@Override
public Object computeValueFrom(SQLRowValues row, SQLTableElement source) {
int qte = row.getInt("QTE");
int qte = row.getInt("QTE_LIVREE");
BigDecimal prixDeVenteUnitaireDevise = (row.getObject("PV_U_DEVISE") == null) ? BigDecimal.ZERO : (BigDecimal) row.getObject("PV_U_DEVISE");
BigDecimal qUnitaire = (row.getObject("QTE_UNITAIRE") == null) ? BigDecimal.ONE : (BigDecimal) row.getObject("QTE_UNITAIRE");
// r = prixUnitaire x qUnitaire x qte
696,6 → 961,23
}
});
 
// Calcul automatique du prix de achat unitaire HT
tableElement_ValeurMetrique1.addModificationListener(ha);
tableElement_ValeurMetrique2.addModificationListener(ha);
tableElement_ValeurMetrique3.addModificationListener(ha);
tableElement_PrixMetrique1_AchatHT.addModificationListener(ha);
this.ha.setModifier(new CellDynamicModifier() {
public Object computeValueFrom(SQLRowValues row, SQLTableElement source) {
if (row.isForeignEmpty("ID_MODE_VENTE_ARTICLE") || row.getInt("ID_MODE_VENTE_ARTICLE") == ReferenceArticleSQLElement.A_LA_PIECE) {
return row.getObject("PRIX_METRIQUE_HA_1");
} else {
 
final BigDecimal prixHAFromDetails = ReferenceArticleSQLElement.getPrixHAFromDetails(row);
return prixHAFromDetails.setScale(ha.getDecimalDigits(), RoundingMode.HALF_UP);
}
}
});
 
this.table.readState();
 
tableFamille.addModificationListener(tableElementArticle);
733,6 → 1015,7
hideColumn(model.getColumnForField("VALEUR_METRIQUE_2"));
hideColumn(model.getColumnForField("VALEUR_METRIQUE_3"));
hideColumn(model.getColumnForField("PV_HT"));
hideColumn(model.getColumnForField("PA_HT"));
hideColumn(model.getColumnForField("ID_MODE_VENTE_ARTICLE"));
}
 
747,40 → 1030,73
 
setColumnVisible(getModel().getColumnForField("ID_FAMILLE_ARTICLE"), filterFamilleArticle);
 
if (this.tableElementEco != null && this.tableElementEcoTotal != null && this.tableElementEcoID != null) {
setColumnVisible(model.getColumnForField("ID_ECO_CONTRIBUTION"), showEco);
setColumnVisible(model.getColumnForField("ECO_CONTRIBUTION"), showEco);
setColumnVisible(model.getColumnForField("T_ECO_CONTRIBUTION"), showEco);
}
 
// Gestion des unités de vente
final boolean gestionUV = prefs.getBoolean(GestionArticleGlobalPreferencePanel.UNITE_VENTE, true);
setColumnVisible(model.getColumnForField("QTE_UNITAIRE"), gestionUV);
setColumnVisible(model.getColumnForField("ID_UNITE_VENTE"), gestionUV);
 
setColumnVisible(model.getColumnForField("PRIX_METRIQUE_HA_1"), showHAPrice);
setColumnVisible(model.getColumnForField("T_PA_HT"), showHAPrice);
 
if (e.getTable().contains("ID_COMMANDE_CLIENT_ELEMENT")) {
setColumnVisible(model.getColumnForField("ID_COMMANDE_CLIENT_ELEMENT"), false);
}
// Barcode reader
final BarcodeReader barcodeReader = ComptaPropsConfiguration.getInstanceCompta().getBarcodeReader();
if (barcodeReader != null) {
 
final BarcodeListener l = new BarcodeListener() {
 
@Override
public void keyReceived(KeyEvent ee) {
// TODO Auto-generated method stub
}
 
@Override
public void barcodeRead(String code) {
if (((JFrame) SwingUtilities.getRoot(getRowValuesTable())).isActive()) {
final SQLSelect selArticle = new SQLSelect();
final SQLTable tableArticle = getSQLElement().getForeignElement("ID_ARTICLE").getTable();
selArticle.addSelectStar(tableArticle);
Where w = new Where(tableArticle.getField("OBSOLETE"), "=", Boolean.FALSE);
w = w.and(new Where(tableArticle.getField("CODE_BARRE"), "=", code));
selArticle.setWhere(w);
List<SQLRow> l2 = SQLRowListRSH.execute(selArticle);
if (l2.size() > 0) {
System.err.println("ARTICLE " + l2.get(0).getString("NOM"));
Tuple3<Double, String, String> art = Tuple3.create(1.0D, l2.get(0).getString("CODE"), l2.get(0).getString("NOM"));
List<Tuple3<Double, String, String>> l = new ArrayList<Tuple3<Double, String, String>>();
l.add(art);
insertFromDrop(l, m);
} else {
System.err.println("ARTICLE NOT FOUND !");
}
}
 
}
};
getRowValuesTable().addHierarchyListener(new HierarchyListener() {
public void hierarchyChanged(HierarchyEvent e) {
if ((e.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0)
if (getRowValuesTable().isDisplayable()) {
barcodeReader.addBarcodeListener(l);
} else {
barcodeReader.removeBarcodeListener(l);
}
}
});
 
}
 
// On réécrit la configuration au cas ou les preferences aurait changé
this.table.writeState();
 
// Calcul automatique du prix d'achat unitaire HT
// tableElement_ValeurMetrique1.addModificationListener(tableElement_PrixAchat_HT);
// tableElement_ValeurMetrique2.addModificationListener(tableElement_PrixAchat_HT);
// tableElement_ValeurMetrique3.addModificationListener(tableElement_PrixAchat_HT);
// //tableElement_PrixMetrique1_AchatHT.addModificationListener(tableElement_PrixAchat_HT);
// tableElement_PrixAchat_HT.setModifier(new CellDynamicModifier() {
// public Object computeValueFrom(SQLRowValues row) {
// if (row.getInt("ID_MODE_VENTE_ARTICLE") == ReferenceArticleSQLElement.A_LA_PIECE) {
// return new Long(((Number) row.getObject("PA_HT")).longValue());
// } else {
// return new Long(ReferenceArticleSQLElement.getPrixHAFromDetails(row));
// }
// }
// });
 
// Mode de vente non éditable
// int modeVenteColumn = model.getColumnForField("ID_MODE_VENTE_ARTICLE");
// if (modeVenteColumn >= 0) {
// model.setEditable(false, modeVenteColumn);
// }
 
// for (int i = 0; i < model.getColumnCount(); i++) {
//
// this.table.getColumnModel().getColumn(i).setCellRenderer(new
// ArticleRowValuesRenderer(model));
// }
}
 
@Override
809,6 → 1125,30
return Configuration.getInstance().getDirectory().getElement("BON_DE_LIVRAISON_ELEMENT");
}
 
@Override
protected List<AbstractAction> getAdditionnalMouseAction(final int rowIndex) {
List<AbstractAction> actions = new ArrayList<AbstractAction>();
actions.addAll(super.getAdditionnalMouseAction(rowIndex));
actions.add(new AbstractAction("Ajouter un reliquat") {
 
@Override
public void actionPerformed(ActionEvent e) {
if (reliquatTable != null) {
SQLRowAccessor sqlRowArticleChildElement = getRowValuesTable().getRowValuesTableModel().getRowValuesAt(rowIndex);
final SQLRowValues row2Insert = new SQLRowValues(reliquatTable.getDefaultRowValues());
 
row2Insert.put("ID_BON_DE_LIVRAISON_ELEMENT", sqlRowArticleChildElement);
 
row2Insert.put("QTE", 1);
row2Insert.put("QTE_UNITAIRE", BigDecimal.ONE);
 
reliquatTable.getRowValuesTable().getRowValuesTableModel().addRow(row2Insert);
}
}
});
return actions;
}
 
private void hideColumn(int col) {
if (col >= 0) {
// this.table.getColumnModel().getColumn(col).setResizable(false);
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/shipment/component/BonDeLivraisonSQLComponent.java
14,6 → 14,7
package org.openconcerto.erp.core.sales.shipment.component;
 
import static org.openconcerto.utils.CollectionUtils.createSet;
 
import org.openconcerto.erp.core.common.component.TransfertBaseSQLComponent;
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.erp.core.common.element.NumerotationAutoSQLElement;
23,7 → 24,9
import org.openconcerto.erp.core.customerrelationship.customer.ui.AdresseType;
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
import org.openconcerto.erp.core.sales.invoice.element.SaisieVenteFactureItemSQLElement;
import org.openconcerto.erp.core.sales.product.ui.ReliquatRowValuesTable;
import org.openconcerto.erp.core.sales.shipment.element.BonDeLivraisonItemSQLElement;
import org.openconcerto.erp.core.sales.shipment.element.BonDeLivraisonSQLElement;
import org.openconcerto.erp.core.sales.shipment.report.BonLivraisonXmlSheet;
import org.openconcerto.erp.core.sales.shipment.ui.BonDeLivraisonItemTable;
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater;
87,6 → 90,7
 
public class BonDeLivraisonSQLComponent extends TransfertBaseSQLComponent {
private BonDeLivraisonItemTable tableBonItem;
private ReliquatRowValuesTable tableBonReliquatItem;
private ElementComboBox selectCommande, comboClient;
private PanelOOSQLComponent panelOO;
private JUniqueTextField textNumeroUnique;
158,7 → 162,16
labelNum.setHorizontalAlignment(SwingConstants.RIGHT);
this.add(labelNum, c);
 
this.textNumeroUnique = new JUniqueTextField(16);
this.textNumeroUnique = new JUniqueTextField(16) {
@Override
public String getAutoRefreshNumber() {
if (getMode() == Mode.INSERTION) {
return NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), date.getDate());
} else {
return null;
}
}
};
c.gridx++;
c.weightx = 1;
c.weighty = 0;
454,7 → 467,7
reconfigure(this.textTotalHT);
reconfigure(this.textTotalTVA);
reconfigure(this.textTotalTTC);
 
DeviseField fieldEco = new DeviseField(5);
DeviseField textPortHT = new DeviseField(5);
DeviseField textRemiseHT = new DeviseField();
 
487,15 → 500,17
c.gridwidth = 1;
c.fill = GridBagConstraints.NONE;
this.addSQLObject(this.textPoidsTotal, "TOTAL_POIDS");
this.addSQLObject(fieldEco, "T_ECO_CONTRIBUTION");
this.addRequiredSQLObject(this.textTotalHT, "TOTAL_HT");
this.addRequiredSQLObject(this.textTotalTVA, "TOTAL_TVA");
this.addRequiredSQLObject(this.textTotalTTC, "TOTAL_TTC");
this.allowEditable("T_ECO_CONTRIBUTION", false);
this.allowEditable("TOTAL_HT", false);
this.allowEditable("TOTAL_TVA", false);
this.allowEditable("TOTAL_TTC", false);
this.allowEditable("TOTAL_POIDS", false);
final TotalPanel panelTotal = new TotalPanel(tableBonItem, textTotalHT, textTotalTVA, textTotalTTC, textPortHT, textRemiseHT, fieldService, fieldHA, fieldDevise, this.textPoidsTotal, null,
(getTable().contains("ID_TAXE_PORT") ? boxTaxePort : null));
final TotalPanel panelTotal = new TotalPanel(tableBonItem, fieldEco, textTotalHT, textTotalTVA, textTotalTTC, textPortHT, textRemiseHT, fieldService, fieldHA, fieldDevise, this.textPoidsTotal,
null, (getTable().contains("ID_TAXE_PORT") ? boxTaxePort : null), null);
 
// if (b) {
JPanel panel = new JPanel(new GridBagLayout());
573,6 → 588,30
 
c.anchor = GridBagConstraints.WEST;
 
if (getTable().getDBRoot().contains("RELIQUAT_BL")) {
 
c.gridwidth = GridBagConstraints.REMAINDER;
c.weightx = 1;
c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 0;
c.gridy++;
TitledSeparator sep = new TitledSeparator("Reliquat de kits");
c.insets = new Insets(10, 2, 1, 2);
this.add(sep, c);
c.insets = new Insets(2, 2, 1, 2);
 
// Reliquat du bon
this.tableBonReliquatItem = new ReliquatRowValuesTable("RELIQUAT_BL");
c.gridx = 0;
c.gridy++;
c.weightx = 1;
c.weighty = 1;
c.gridwidth = GridBagConstraints.REMAINDER;
c.fill = GridBagConstraints.BOTH;
this.add(this.tableBonReliquatItem, c);
this.tableBonItem.setReliquatTable(tableBonReliquatItem);
}
 
/*******************************************************************************************
* * INFORMATIONS COMPLEMENTAIRES
******************************************************************************************/
666,12 → 705,41
public int insert(SQLRow order) {
 
int idBon = getSelectedID();
// on verifie qu'un bon du meme numero n'a pas été inséré entre temps
if (this.textNumeroUnique.checkValidation()) {
int attempt = 0;
// on verifie qu'un devis du meme numero n'a pas été inséré entre temps
if (!this.textNumeroUnique.checkValidation(false)) {
while (attempt < JUniqueTextField.RETRY_COUNT) {
String num = NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), date.getDate());
this.textNumeroUnique.setText(num);
attempt++;
if (this.textNumeroUnique.checkValidation(false)) {
System.err.println("ATEMPT " + attempt + " SUCCESS WITH NUMERO " + num);
break;
}
try {
Thread.sleep(JUniqueTextField.SLEEP_WAIT_MS);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
final String num = this.textNumeroUnique.getText();
if (attempt == JUniqueTextField.RETRY_COUNT) {
idBon = getSelectedID();
ExceptionHandler.handle("Impossible d'ajouter, numéro de bon existant.");
final Object root = SwingUtilities.getRoot(this);
if (root instanceof EditFrame) {
final EditFrame frame = (EditFrame) root;
frame.getPanel().setAlwaysVisible(true);
}
} else {
idBon = super.insert(order);
if (this.tableBonReliquatItem != null) {
this.tableBonReliquatItem.updateField("ID_BON_DE_LIVRAISON_ORIGINE", idBon);
}
this.tableBonItem.updateField("ID_BON_DE_LIVRAISON", idBon);
this.tableBonItem.createArticle(idBon, this.getElement());
 
((BonDeLivraisonSQLElement) getElement()).updateCmdClientElement(((BonDeLivraisonSQLElement) getElement()).getCmdClientFrom(idBon), idBon);
// generation du document
BonLivraisonXmlSheet bSheet = new BonLivraisonXmlSheet(getTable().getRow(idBon));
bSheet.createDocumentAsynchronous();
702,12 → 770,12
}
}
// updateQte(idBon);
} else {
ExceptionHandler.handle("Impossible d'ajouter, numéro de bon de livraison existant.");
Object root = SwingUtilities.getRoot(this);
if (root instanceof EditFrame) {
EditFrame frame = (EditFrame) root;
frame.getPanel().setAlwaysVisible(true);
if (attempt > 0) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JOptionPane.showMessageDialog(null, "Le numéro a été actualisé en " + num);
}
});
}
}
 
729,6 → 797,12
rVals.remove("ID_CLIENT");
super.select(rVals);
}
if (this.tableBonReliquatItem != null) {
this.tableBonReliquatItem.getRowValuesTable().clear();
if (r != null) {
this.tableBonReliquatItem.getRowValuesTable().insertFrom("ID_BON_LIVRAISON_ORIGINE", r.asRowValues());
}
}
}
 
@Override
743,8 → 817,13
return;
}
super.update();
if (tableBonReliquatItem != null) {
this.tableBonReliquatItem.updateField("ID_BON_DE_LIVRAISON_ORIGINE", getSelectedID());
}
final List<Object> cmdClientFrom = ((BonDeLivraisonSQLElement) getElement()).getCmdClientFrom(getSelectedID());
this.tableBonItem.updateField("ID_BON_DE_LIVRAISON", getSelectedID());
this.tableBonItem.createArticle(getSelectedID(), this.getElement());
((BonDeLivraisonSQLElement) getElement()).updateCmdClientElement(cmdClientFrom, getSelectedID());
 
// generation du document
BonLivraisonXmlSheet bSheet = new BonLivraisonXmlSheet(getTable().getRow(getSelectedID()));
896,10 → 975,22
}, row, row.getReferentRows(getTable().getTable("BON_DE_LIVRAISON_ELEMENT")),
getTable().contains("CREATE_VIRTUAL_STOCK") && row.getBoolean("CREATE_VIRTUAL_STOCK") ? TypeStockUpdate.REAL_VIRTUAL_DELIVER : TypeStockUpdate.REAL_DELIVER);
 
if (getTable().getDBRoot().contains("RELIQUAT_BL")) {
List<SQLRow> l = row.getReferentRows(getTable().getTable("RELIQUAT_BL").getField("ID_BON_DE_LIVRAISON_ORIGINE"));
for (SQLRow sqlRow : l) {
stockUpdater.addReliquat(sqlRow.getForeign("ID_ARTICLE"), sqlRow.getInt("QTE"), sqlRow.getBigDecimal("QTE_UNITAIRE"));
}
}
 
stockUpdater.update();
}
}
 
public void loadFromReliquat(List<SQLRowValues> l) {
this.tableBonItem.insertFromReliquat(l);
this.tableBonItem.setEnabled(false);
}
 
@Override
protected void refreshAfterSelect(SQLRowAccessor rSource) {
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/credit/component/AvoirClientSQLComponent.java
44,6 → 44,7
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.ElementSQLObject;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.model.SQLField;
import org.openconcerto.sql.model.SQLRow;
58,6 → 59,7
import org.openconcerto.sql.sqlobject.JUniqueTextField;
import org.openconcerto.sql.sqlobject.SQLRequestComboBox;
import org.openconcerto.sql.view.EditFrame;
import org.openconcerto.sql.view.EditPanel.EditMode;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.FormLayouter;
import org.openconcerto.ui.FrameUtil;
65,6 → 67,7
import org.openconcerto.ui.component.ITextArea;
import org.openconcerto.ui.component.InteractionMode;
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.cc.IFactory;
import org.openconcerto.utils.checks.ValidState;
 
import java.awt.Dimension;
109,7 → 112,7
private ElementComboBox comboCommercial = new ElementComboBox();
private ElementComboBox comboVerificateur = new ElementComboBox();
private final ElementComboBox comboBanque = new ElementComboBox();
private final ElementComboBox selectContact = new ElementComboBox();
private ElementComboBox selectContact;
private JLabel labelCompteServ;
private ISQLCompteSelector compteSelService;
private static final SQLTable TABLE_PREFS_COMPTE = Configuration.getInstance().getBase().getTable("PREFS_COMPTE");
117,8 → 120,6
private final boolean displayDpt;
private final ElementComboBox comboDpt = new ElementComboBox();
 
private SQLRowValues defaultContactRowValues;
 
private JCheckBox checkCompteServiceAuto;
 
private PropertyChangeListener listenerModeReglDefaut = new PropertyChangeListener() {
147,8 → 148,6
 
// if (AvoirClientSQLComponent.this.comboClient.getValue() != null) {
Integer id = AvoirClientSQLComponent.this.comboClient.getWantedID();
AvoirClientSQLComponent.this.defaultContactRowValues.put("ID_CLIENT", id);
 
if (id > 1) {
 
SQLRow row = AvoirClientSQLComponent.this.clientElt.getTable().getRow(id);
420,7 → 419,25
// c.weightx = 0;
final JLabel labelContact = new JLabel(getLabelFor("ID_CONTACT"), SwingConstants.RIGHT);
this.add(labelContact, c);
this.selectContact = new ElementComboBox() {
@Override
protected SQLComponent createSQLComponent(EditMode mode) {
final SQLComponent c = super.createSQLComponent(mode);
if (mode.equals(EditMode.CREATION)) {
c.setDefaultsFactory(new IFactory<SQLRowValues>() {
 
@Override
public SQLRowValues createChecked() {
final SQLRowValues defaultContactRowValues = new SQLRowValues(selectContact.getRequest().getPrimaryTable());
Integer id = AvoirClientSQLComponent.this.comboClient.getWantedID();
defaultContactRowValues.put("ID_CLIENT", id);
return defaultContactRowValues;
}
});
}
return c;
}
};
c.gridx++;
c.gridwidth = 3;
c.weightx = 1;
429,8 → 446,6
selectContact.init(contactElement, contactElement.getComboRequest(true));
selectContact.getRequest().setWhere(Where.FALSE);
this.addView(selectContact, "ID_CONTACT");
this.defaultContactRowValues = new SQLRowValues(selectContact.getRequest().getPrimaryTable());
selectContact.getAddComp().setDefaults(this.defaultContactRowValues);
 
 
 
627,6 → 642,7
 
// Colonne 3 : totaux
final DeviseField fieldHT = new DeviseField();
final DeviseField fieldEco = new DeviseField();
final DeviseField fieldTVA = new DeviseField();
final DeviseField fieldService = new DeviseField();
final DeviseField fieldTTC = new DeviseField();
636,6 → 652,7
if (getTable().getFieldsName().contains("T_DEVISE"))
addSQLObject(fieldDevise, "T_DEVISE");
addSQLObject(textRemiseHT, "REMISE_HT");
addSQLObject(fieldEco, "T_ECO_CONTRIBUTION");
addRequiredSQLObject(fieldHT, "MONTANT_HT");
addRequiredSQLObject(fieldTVA, "MONTANT_TVA");
addRequiredSQLObject(fieldTTC, "MONTANT_TTC");
644,7 → 661,7
JTextField poids = new JTextField();
if (getTable().getFieldsName().contains("T_POIDS"))
addSQLObject(poids, "T_POIDS");
final TotalPanel totalTTC = new TotalPanel(this.table, fieldHT, fieldTVA, fieldTTC, textPortHT, textRemiseHT, fieldService, null, fieldDevise, poids, null);
final TotalPanel totalTTC = new TotalPanel(this.table, fieldEco, fieldHT, fieldTVA, fieldTTC, textPortHT, textRemiseHT, fieldService, null, fieldDevise, poids, null);
totalTTC.setOpaque(false);
c.gridx++;
c.gridy = 0;
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/credit/element/AvoirClientElementSQLElement.java
35,11 → 35,16
 
protected List<String> getListFields() {
final List<String> list = new ArrayList<String>(7);
list.add("ID_AVOIR_CLIENT");
list.add("ID_STYLE");
list.add("NIVEAU");
list.add("CODE");
list.add("NOM");
list.add("PA_HT");
list.add("PV_HT");
list.add("T_PA_HT");
list.add("T_PV_HT");
list.add("T_PV_TTC");
list.add("ID_TAXE");
list.add("POIDS");
return list;
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/credit/element/AvoirClientSQLElement.java
32,8 → 32,9
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.request.ListSQLRequest;
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
import org.openconcerto.sql.view.list.SQLTableModelSource;
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.ListMap;
 
import java.sql.SQLException;
import java.util.ArrayList;
89,10 → 90,8
}
 
@Override
protected SQLTableModelSourceOnline createTableSource() {
 
SQLTableModelSourceOnline table = super.createTableSource();
return table;
protected synchronized void _initTableSource(final SQLTableModelSource table) {
super._initTableSource(table);
}
 
/*
110,6 → 109,13
req.addToGraphToFetch("A_DEDUIRE", "MOTIF");
}
 
@Override
public ListMap<String, String> getShowAs() {
ListMap<String, String> map = new ListMap<String, String>();
map.putCollection(null, "NUMERO", "DATE", "ID_COMMERCIAL");
return map;
}
 
public void annulationAvoir(SQLRowAccessor row) {
Collection<? extends SQLRowAccessor> rows = row.getReferentRows(getTable().getTable("SAISIE_VENTE_FACTURE"));
for (SQLRowAccessor sqlRowAccessor : rows) {
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/order/element/CommandeClientSQLElement.java
13,29 → 13,6
package org.openconcerto.erp.core.sales.order.element;
 
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
 
import javax.swing.AbstractAction;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.table.DefaultTableCellRenderer;
 
import org.apache.commons.dbutils.ResultSetHandler;
import org.apache.commons.dbutils.handlers.ArrayListHandler;
 
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.erp.core.common.component.TransfertBaseSQLComponent;
import org.openconcerto.erp.core.common.component.TransfertGroupSQLComponent;
46,6 → 23,7
import org.openconcerto.erp.core.sales.order.report.CommandeClientXmlSheet;
import org.openconcerto.erp.core.sales.order.ui.EtatCommandeClient;
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
import org.openconcerto.erp.core.sales.shipment.component.BonDeLivraisonSQLComponent;
import org.openconcerto.erp.core.supplychain.stock.element.MouvementStockSQLElement;
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel;
52,9 → 30,9
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.element.SQLElementLink.LinkType;
import org.openconcerto.sql.element.SQLElementLinksSetup;
import org.openconcerto.sql.element.TreesOfSQLRows;
import org.openconcerto.sql.element.SQLElementLink.LinkType;
import org.openconcerto.sql.model.ConnectionHandlerNoSetup;
import org.openconcerto.sql.model.SQLDataSource;
import org.openconcerto.sql.model.SQLField;
65,6 → 43,7
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLRowValuesListFetcher;
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.SQLSelectJoin;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.preferences.SQLPreferences;
75,7 → 54,7
import org.openconcerto.sql.view.list.RowAction;
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
import org.openconcerto.sql.view.list.SQLTableModelColumn;
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
import org.openconcerto.sql.view.list.SQLTableModelSource;
import org.openconcerto.utils.CompareUtils;
import org.openconcerto.utils.DecimalUtils;
import org.openconcerto.utils.ExceptionHandler;
83,6 → 62,29
import org.openconcerto.utils.NumberUtils;
import org.openconcerto.utils.cc.ITransformer;
 
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
 
import javax.swing.AbstractAction;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.table.DefaultTableCellRenderer;
 
import org.apache.commons.dbutils.ResultSetHandler;
import org.apache.commons.dbutils.handlers.ArrayListHandler;
 
public class CommandeClientSQLElement extends ComptaSQLConfElement {
 
public CommandeClientSQLElement() {
223,7 → 225,7
@Override
public void run() {
final CommandeClientSQLElement elt = (CommandeClientSQLElement) Configuration.getInstance().getDirectory().getElement("COMMANDE_CLIENT");
elt.transfertCommande(selectedId);
elt.transfertCommande(selectedId, true);
 
}
});
255,6 → 257,9
if (getTable().contains("ID_ADRESSE")) {
links.get("ID_ADRESSE").setType(LinkType.ASSOCIATION);
}
if (getTable().contains("ID_ADRESSE_FACT")) {
links.get("ID_ADRESSE_FACT").setType(LinkType.ASSOCIATION);
}
if (getTable().contains("ID_ADRESSE_LIVRAISON")) {
links.get("ID_ADRESSE_LIVRAISON").setType(LinkType.ASSOCIATION);
}
454,6 → 459,9
final List<String> l = new ArrayList<String>();
l.add("NUMERO");
l.add("DATE");
if (getTable().contains("DATE_LIVRAISON_PREV")) {
l.add("DATE_LIVRAISON_PREV");
}
l.add("ID_CLIENT");
l.add("ID_COMMERCIAL");
l.add("T_HT");
501,8 → 509,8
}
 
@Override
protected SQLTableModelSourceOnline createTableSource() {
final SQLTableModelSourceOnline source = super.createTableSource();
protected synchronized void _initTableSource(final SQLTableModelSource source) {
super._initTableSource(source);
// TODO: refaire un renderer pour les commandes transférées en BL
// final CommandeClientRenderer rend = CommandeClientRenderer.getInstance();
// final SQLTableModelColumn col = source.getColumn(getTable().getField("T_HT"));
538,7 → 546,6
 
}
}
return source;
}
 
/*
555,7 → 562,7
*
* @param commandeID
*/
public void transfertCommande(int commandeID) {
public void transfertCommande(int commandeID, boolean useCommandeEnCours) {
 
SQLElement elt = Configuration.getInstance().getDirectory().getElement("COMMANDE_CLIENT_ELEMENT");
SQLTable tableCmdElt = Configuration.getInstance().getDirectory().getElement("COMMANDE_ELEMENT").getTable();
574,7 → 581,7
 
int idArticle = ReferenceArticleSQLElement.getIdForCNM(rowArticle, true);
SQLRow rowArticleFind = eltArticle.getTable().getRow(idArticle);
if (rowArticle != null) {
if (rowArticleFind != null && !rowArticleFind.isUndefined()) {
SQLInjector inj = SQLInjector.getInjector(rowArticle.getTable(), tableCmdElt);
SQLRowValues rowValsElt = new SQLRowValues(inj.createRowValuesFrom(rowArticleFind));
rowValsElt.put("ID_STYLE", sqlRow.getObject("ID_STYLE"));
586,8 → 593,9
rowValsElt.put("ID_DEVISE", rowCmd.getForeignRow("ID_TARIF").getForeignID("ID_DEVISE"));
map.add(rowArticleFind.getForeignRow("ID_FOURNISSEUR"), rowValsElt);
}
 
}
MouvementStockSQLElement.createCommandeF(map, rowCmd.getForeignRow("ID_TARIF").getForeignRow("ID_DEVISE"), rowCmd.getString("NUMERO") + " - " + rowCmd.getString("NOM"));
MouvementStockSQLElement.createCommandeF(map, rowCmd.getForeignRow("ID_TARIF").getForeignRow("ID_DEVISE"), rowCmd.getString("NUMERO") + " - " + rowCmd.getString("NOM"), useCommandeEnCours);
}
 
/**
595,8 → 603,33
*
* @param row
*/
public void transfertBonLivraisonClient(List<SQLRowValues> rows) {
TransfertBaseSQLComponent.openTransfertFrame(rows, "BON_DE_LIVRAISON");
public void transfertBonLivraisonClient(final List<SQLRowValues> rows) {
BonDeLivraisonSQLComponent comp = (BonDeLivraisonSQLComponent) TransfertBaseSQLComponent.openTransfertFrame(rows, "BON_DE_LIVRAISON").getSQLComponent();
final SQLTable tableElt = comp.getElement().getTable().getTable("BON_DE_LIVRAISON_ELEMENT");
SQLRowValues rowVals = new SQLRowValues(tableElt);
rowVals.put("QTE_UNITAIRE", null);
rowVals.put("QTE", null);
rowVals.put("QTE_LIVREE", null);
rowVals.put("ID_ARTICLE", null);
 
SQLRowValuesListFetcher fetcher = SQLRowValuesListFetcher.create(rowVals);
fetcher.setSelTransf(new ITransformer<SQLSelect, SQLSelect>() {
 
@Override
public SQLSelect transformChecked(SQLSelect input) {
List<Integer> ids = new ArrayList<Integer>(rows.size());
for (SQLRowValues sqlRowValues : rows) {
ids.add(sqlRowValues.getID());
}
SQLSelectJoin joinBR = input.addJoin("RIGHT", tableElt.getTable("BON_DE_LIVRAISON_ELEMENT").getField("ID_BON_DE_LIVRAISON"));
SQLSelectJoin joinTR = input.addBackwardJoin("RIGHT", tableElt.getTable("TR_COMMANDE_CLIENT").getField("ID_BON_DE_LIVRAISON"), joinBR.getJoinedTable().getAlias());
joinTR.setWhere(new Where(joinTR.getJoinedTable().getField("ID_COMMANDE_CLIENT"), ids));
System.err.println(input.asString());
return input;
}
});
comp.loadQuantity(fetcher.fetch());
 
}
 
/**
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/order/element/CommandeClientElementSQLElement.java
13,16 → 13,35
package org.openconcerto.erp.core.sales.order.element;
 
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.erp.core.common.ui.DeviseField;
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
import org.openconcerto.erp.core.supplychain.stock.element.MouvementStockSQLElement;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.element.UISQLComponent;
import org.openconcerto.sql.model.SQLInjector;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.sqlobject.ElementComboBox;
import org.openconcerto.sql.view.list.IListe;
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
import org.openconcerto.utils.DecimalUtils;
import org.openconcerto.utils.ListMap;
 
import java.awt.event.ActionEvent;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
 
import javax.swing.AbstractAction;
import javax.swing.JTextField;
 
public class CommandeClientElementSQLElement extends ComptaSQLConfElement {
29,6 → 48,36
 
public CommandeClientElementSQLElement() {
super("COMMANDE_CLIENT_ELEMENT", "un element de commande", "éléments de commande");
 
PredicateRowAction rowAction = new PredicateRowAction(new AbstractAction("Transfert vers commande fournisseur") {
 
@Override
public void actionPerformed(ActionEvent e) {
final List<SQLRowValues> selectedRows = IListe.get(e).getSelectedRows();
final List<SQLRowAccessor> arts = new ArrayList<SQLRowAccessor>();
final Set<Integer> s = new HashSet<Integer>();
for (SQLRowValues sqlRowValues : selectedRows) {
if (sqlRowValues.getObject("ID_ARTICLE") != null && !sqlRowValues.isForeignEmpty("ID_ARTICLE")) {
SQLRowAccessor rowArt = sqlRowValues.getForeign("ID_ARTICLE");
if (!s.contains(rowArt.getID())) {
s.add(rowArt.getID());
arts.add(rowArt);
}
}
}
ComptaPropsConfiguration.getInstanceCompta().getNonInteractiveSQLExecutor().execute(new Runnable() {
 
@Override
public void run() {
 
createCommandeF(arts);
}
});
}
 
}, true);
rowAction.setPredicate(IListeEvent.getNonEmptySelectionPredicate());
getRowActions().add(rowAction);
}
 
@Override
38,16 → 87,98
 
protected List<String> getListFields() {
final List<String> l = new ArrayList<String>();
l.add("ID_STYLE");
l.add("CODE");
l.add("NOM");
l.add("ID_COMMANDE_CLIENT");
l.add("ID_ARTICLE");
l.add("PA_HT");
l.add("PV_HT");
l.add("ID_TAXE");
l.add("POIDS");
l.add("QTE");
l.add("QTE_UNITAIRE");
l.add("QTE_LIVREE");
return l;
}
 
/**
* Transfert d'une commande en commande fournisseur
*
* @param commandeID
*/
public void transfertCommande(List<SQLRowValues> commandeClientEltsRows) {
 
SQLTable tableCmdElt = getDirectory().getElement("COMMANDE_ELEMENT").getTable();
SQLElement eltArticle = getDirectory().getElement("ARTICLE");
 
final ListMap<SQLRow, SQLRowValues> map = new ListMap<SQLRow, SQLRowValues>();
List<String> fields2copy = Arrays.asList("CODE", "NOM", "VALEUR_METRIQUE_1", "VALEUR_METRIQUE_2", "VALEUR_METRIQUE_3");
 
Set<Integer> art = new HashSet<Integer>();
for (SQLRowValues sqlRow : commandeClientEltsRows) {
// on récupére l'article qui lui correspond
SQLRowValues rowArticle = new SQLRowValues(eltArticle.getTable());
for (String field : fields2copy) {
// if (sqlRow.getTable().getFieldsName().contains(field.getName())) {
rowArticle.put(field, sqlRow.asRow().getObject(field));
// }
}
 
int idArticle = ReferenceArticleSQLElement.getIdForCNM(rowArticle, true);
SQLRow rowArticleFind = eltArticle.getTable().getRow(idArticle);
if (rowArticleFind != null && !rowArticleFind.isUndefined()) {
SQLInjector inj = SQLInjector.getInjector(rowArticle.getTable(), tableCmdElt);
SQLRowValues rowValsElt = new SQLRowValues(inj.createRowValuesFrom(rowArticleFind));
rowValsElt.put("ID_STYLE", sqlRow.getObject("ID_STYLE"));
 
// if()
 
rowValsElt.put("QTE", sqlRow.getObject("QTE"));
rowValsElt.put("T_POIDS", rowValsElt.getLong("POIDS") * rowValsElt.getInt("QTE"));
rowValsElt.put("T_PA_HT", ((BigDecimal) rowValsElt.getObject("PA_HT")).multiply(new BigDecimal(rowValsElt.getInt("QTE")), DecimalUtils.HIGH_PRECISION));
rowValsElt.put("T_PA_TTC",
((BigDecimal) rowValsElt.getObject("T_PA_HT")).multiply(new BigDecimal((rowValsElt.getForeign("ID_TAXE").getFloat("TAUX") / 100.0 + 1.0)), DecimalUtils.HIGH_PRECISION));
// rowValsElt.put("ID_DEVISE",
// rowCmd.getForeignRow("ID_TARIF").getForeignID("ID_DEVISE"));
map.add(rowArticleFind.getForeignRow("ID_FOURNISSEUR"), rowValsElt);
}
 
}
// TODO
MouvementStockSQLElement.createCommandeF(map, null, "", false);
}
 
public void createCommandeF(final List<? extends SQLRowAccessor> rowsArt) {
 
ComptaPropsConfiguration.getInstanceCompta().getNonInteractiveSQLExecutor().execute(new Runnable() {
 
@Override
public void run() {
final ListMap<SQLRow, SQLRowValues> map = new ListMap<SQLRow, SQLRowValues>();
 
for (SQLRowAccessor rowArticleFind : rowsArt) {
 
SQLRow row = rowArticleFind.asRow();
final int value = -Math.round(row.getForeign("ID_STOCK").getFloat("QTE_TH") - row.getFloat("QTE_MIN"));
if (value > 0) {
 
SQLInjector inj = SQLInjector.getInjector(row.getTable(), row.getTable().getTable("COMMANDE_ELEMENT"));
SQLRowValues rowValsElt = new SQLRowValues(inj.createRowValuesFrom(row));
 
rowValsElt.put("QTE", value);
rowValsElt.put("T_POIDS", rowValsElt.getLong("POIDS") * rowValsElt.getInt("QTE"));
rowValsElt.put("T_PA_HT", ((BigDecimal) rowValsElt.getObject("PA_HT")).multiply(new BigDecimal(rowValsElt.getInt("QTE")), DecimalUtils.HIGH_PRECISION));
rowValsElt.put("T_PA_TTC", ((BigDecimal) rowValsElt.getObject("T_PA_HT")).multiply(new BigDecimal((rowValsElt.getForeign("ID_TAXE").getFloat("TAUX") / 100.0 + 1.0)),
DecimalUtils.HIGH_PRECISION));
// rowValsElt.put("ID_DEVISE",
// rowCmd.getForeignRow("ID_TARIF").getForeignID("ID_DEVISE"));
map.add(rowArticleFind.getForeign("ID_FOURNISSEUR").asRow(), rowValsElt);
}
}
MouvementStockSQLElement.createCommandeF(map, null, "", false);
}
});
 
}
 
protected List<String> getComboFields() {
final List<String> l = new ArrayList<String>();
if (getTable().contains("ID_ARTICLE")) {
61,8 → 192,9
@Override
public ListMap<String, String> getShowAs() {
final ListMap<String, String> res = new ListMap<String, String>();
res.putCollection("ID_COMMANDE_CLIENT", "NUMERO", "DATE", "DATE_LIVRAISON_PREV");
if (getTable().contains("ID_ARTICLE")) {
res.putCollection("ID_ARTICLE", "ID_FAMILLE_ARTICLE");
res.putCollection("ID_ARTICLE", "ID_FAMILLE_ARTICLE", "ID_FOURNISSEUR");
}
res.putCollection(null, "NOM");
return res;
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/order/action/ListeDesElementsACommanderClientAction.java
Nouveau fichier
0,0 → 1,335
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*/
package org.openconcerto.erp.core.sales.order.action;
 
import org.openconcerto.erp.action.CreateFrameAbstractAction;
import org.openconcerto.erp.core.common.ui.IListFilterDatePanel;
import org.openconcerto.erp.core.common.ui.ListeViewPanel;
import org.openconcerto.erp.core.sales.order.element.CommandeClientElementSQLElement;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.model.FieldPath;
import org.openconcerto.sql.model.FieldRef;
import org.openconcerto.sql.model.SQLName;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.SQLSelectJoin;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.model.graph.Path;
import org.openconcerto.sql.view.IListFrame;
import org.openconcerto.sql.view.ListeAddPanel;
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
import org.openconcerto.sql.view.list.IListe;
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.FrameUtil;
import org.openconcerto.ui.state.WindowStateManager;
import org.openconcerto.utils.CollectionUtils;
import org.openconcerto.utils.DecimalUtils;
import org.openconcerto.utils.cc.ITransformer;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.io.File;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Collection;
import java.util.List;
import java.util.Set;
 
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JFrame;
import javax.swing.JPanel;
 
public class ListeDesElementsACommanderClientAction extends CreateFrameAbstractAction {
final CommandeClientElementSQLElement eltCmd = (CommandeClientElementSQLElement) Configuration.getInstance().getDirectory().getElement("COMMANDE_CLIENT_ELEMENT");
 
public ListeDesElementsACommanderClientAction() {
super();
this.putValue(Action.NAME, "Liste des éléments en attente de livraison");
}
 
private BaseSQLTableModelColumn colAvancement;
 
public JFrame createFrame() {
final JFrame frame = new JFrame("Eléments en attente de livraison");
// Actions
 
final JPanel orderPanel = createPanel();
 
frame.getContentPane().add(orderPanel);
FrameUtil.setBounds(frame);
final File file = IListFrame.getConfigFile(eltCmd, frame.getClass());
if (file != null)
new WindowStateManager(frame, file).loadState();
return frame;
}
 
JPanel createPanel() {
final SQLTableModelSourceOnline tableSource = eltCmd.getTableSource(true);
tableSource.getReq().setSelectTransf(new ITransformer<SQLSelect, SQLSelect>() {
 
@Override
public SQLSelect transformChecked(SQLSelect input) {
// new SQLName(eltCmd.getTable().getDBRoot().getName(),
// tableBLElement.getName()).quote()
final String quoteQteL = new SQLName(input.getAlias(eltCmd.getTable()).getAlias(), "QTE_LIVREE").quote();
final String quoteQte = new SQLName(input.getAlias(eltCmd.getTable()).getAlias(), "QTE").quote();
final String quoteQteU = new SQLName(input.getAlias(eltCmd.getTable()).getAlias(), "QTE_UNITAIRE").quote();
Where w = Where.createRaw(quoteQteL + " < (" + quoteQte + "*" + quoteQteU + ")", eltCmd.getTable().getField("QTE_LIVREE"), eltCmd.getTable().getField("QTE"),
eltCmd.getTable().getField("QTE_UNITAIRE"));
input.setWhere(w);
return input;
}
});
 
BaseSQLTableModelColumn colStockR = new BaseSQLTableModelColumn("Stock Reel", Float.class) {
 
@Override
protected Object show_(SQLRowAccessor r) {
 
final SQLRowAccessor foreign = r.getForeign("ID_ARTICLE");
if (foreign != null && !foreign.isUndefined()) {
final SQLRowAccessor foreign2 = foreign.getForeign("ID_STOCK");
if (foreign2 != null && !foreign2.isUndefined()) {
return foreign2.getFloat("QTE_REEL");
}
}
return 0F;
}
 
@Override
public Set<FieldPath> getPaths() {
Path p = new Path(eltCmd.getTable());
p = p.add(p.getLast().getField("ID_ARTICLE"));
p = p.add(p.getLast().getField("ID_STOCK"));
return CollectionUtils.createSet(new FieldPath(p, "QTE_REEL"));
}
};
tableSource.getColumns().add(colStockR);
 
BaseSQLTableModelColumn colLiv2 = new BaseSQLTableModelColumn("Stock TH", Float.class) {
 
@Override
protected Object show_(SQLRowAccessor r) {
 
final SQLRowAccessor foreign = r.getForeign("ID_ARTICLE");
if (foreign != null && !foreign.isUndefined()) {
final SQLRowAccessor foreign2 = foreign.getForeign("ID_STOCK");
if (foreign2 != null && !foreign2.isUndefined()) {
return foreign2.getFloat("QTE_TH");
}
}
return 0F;
}
 
@Override
public Set<FieldPath> getPaths() {
Path p = new Path(eltCmd.getTable());
p = p.add(p.getLast().getField("ID_ARTICLE"));
p = p.add(p.getLast().getField("ID_STOCK"));
return CollectionUtils.createSet(new FieldPath(p, "QTE_TH"));
}
};
tableSource.getColumns().add(colLiv2);
 
BaseSQLTableModelColumn colStockMin = new BaseSQLTableModelColumn("Stock Min", Integer.class) {
 
@Override
protected Object show_(SQLRowAccessor r) {
 
final SQLRowAccessor foreign = r.getForeign("ID_ARTICLE");
return foreign.getInt("QTE_MIN");
}
 
@Override
public Set<FieldPath> getPaths() {
Path p = new Path(eltCmd.getTable());
p = p.add(p.getLast().getField("ID_ARTICLE"));
 
return CollectionUtils.createSet(new FieldPath(p, "QTE_MIN"));
}
};
tableSource.getColumns().add(colStockMin);
 
BaseSQLTableModelColumn colSug = new BaseSQLTableModelColumn("Qtè à commander", Float.class) {
 
@Override
protected Object show_(SQLRowAccessor r) {
 
// final float qteCommande = r.getBigDecimal("QTE_UNITAIRE").multiply(new
// BigDecimal(r.getInt("QTE"))).subtract(r.getBigDecimal("QTE_LIVREE")).floatValue();
final SQLRowAccessor foreign = r.getForeign("ID_ARTICLE");
if (foreign != null && !foreign.isUndefined()) {
float qteMin = foreign.getFloat("QTE_MIN");
final SQLRowAccessor foreign2 = foreign.getForeign("ID_STOCK");
if (foreign2 != null && !foreign2.isUndefined()) {
float manque = foreign2.getFloat("QTE_TH") - qteMin;
if (manque < 0) {
return -manque;
}
}
}
return 0F;
}
 
@Override
public Set<FieldPath> getPaths() {
Path pA = new Path(eltCmd.getTable());
 
pA = pA.add(pA.getLast().getField("ID_ARTICLE"));
Path p = pA.add(pA.getLast().getField("ID_STOCK"));
return CollectionUtils.createSet(new FieldPath(pA, "QTE_MIN"), new FieldPath(p, "QTE_TH"));
}
};
tableSource.getColumns().add(colSug);
// colLiv2.setRenderer(new PercentTableCellRenderer());
 
final ListeAddPanel panel = getPanel(eltCmd, tableSource);
PredicateRowAction action = new PredicateRowAction(new AbstractAction("Calcul des besoins") {
 
@Override
public void actionPerformed(ActionEvent e) {
final SQLElement artElt = eltCmd.getForeignElement("ID_ARTICLE");
final SQLTableModelSourceOnline createTableSource = artElt.createTableSource();
createTableSource.getReq().setSelectTransf(new ITransformer<SQLSelect, SQLSelect>() {
@Override
public SQLSelect transformChecked(SQLSelect input) {
FieldRef refStock = input.getAlias(artElt.getTable().getForeignTable("ID_STOCK").getField("QTE_TH"));
 
SQLSelectJoin j = input.getJoinFromField(artElt.getTable().getTable("ARTICLE_ELEMENT").getField("ID_ARTICLE_PARENT"));
Where w = new Where(refStock, "<", artElt.getTable().getField("QTE_MIN"));
w = w.and(new Where(j.getJoinedTable().getKey(), "=", (Object) null));
input.setWhere(w);
// input.setHaving(Where.createRaw("COUNT(\"" + j.getJoinedTable().getKey()
// + "\")" + " = 0", Arrays.asList(j.getJoinedTable().getKey())));
return input;
}
});
 
BaseSQLTableModelColumn colSug = new BaseSQLTableModelColumn("Qtè à commander", Float.class) {
 
@Override
protected Object show_(SQLRowAccessor r) {
 
float qteMin = r.getFloat("QTE_MIN");
final SQLRowAccessor foreign2 = r.getForeign("ID_STOCK");
if (foreign2 != null && !foreign2.isUndefined()) {
float manque = foreign2.getFloat("QTE_TH") - qteMin;
if (manque < 0) {
return -manque;
}
}
 
return 0F;
}
 
@Override
public Set<FieldPath> getPaths() {
Path pA = new Path(artElt.getTable());
 
Path p = pA.add(pA.getLast().getField("ID_STOCK"));
return CollectionUtils.createSet(new FieldPath(pA, "QTE_MIN"), new FieldPath(p, "QTE_TH"));
}
};
createTableSource.getColumns().add(colSug);
 
IListe listeArt = new IListe(createTableSource);
final PredicateRowAction predicateACtion = new PredicateRowAction(new AbstractAction("Passer une commande fournisseur") {
 
@Override
public void actionPerformed(ActionEvent e) {
List<SQLRowValues> selectedRows = IListe.get(e).getSelectedRows();
eltCmd.createCommandeF(selectedRows);
}
}, true);
predicateACtion.setPredicate(IListeEvent.getNonEmptySelectionPredicate());
listeArt.addIListeAction(predicateACtion);
ListeViewPanel p = new ListeViewPanel(artElt, listeArt);
IListFrame f = new IListFrame(p);
FrameUtil.show(f);
}
}, true);
action.setPredicate(IListeEvent.createTotalRowCountPredicate(0, Integer.MAX_VALUE));
panel.getListe().addIListeAction(action);
return panel;
}
 
private BigDecimal getAvancementLFromBL(SQLRowAccessor r) {
Collection<? extends SQLRowAccessor> rows = r.getReferentRows(r.getTable().getTable("COMMANDE_CLIENT_ELEMENT"));
BigDecimal totalQte = BigDecimal.ZERO;
BigDecimal totalQteL = BigDecimal.ZERO;
for (SQLRowAccessor row : rows) {
BigDecimal qte = row.getBigDecimal("QTE_UNITAIRE").multiply(new BigDecimal(row.getInt("QTE")));
totalQte = totalQte.add(qte);
if (row.getBoolean("LIVRE_FORCED") || row.getBoolean("LIVRE")) {
totalQteL = totalQteL.add(qte);
} else {
totalQteL = totalQteL.add(row.getBigDecimal("QTE_LIVREE"));
}
}
if (totalQte.signum() != 0) {
return totalQteL.divide(totalQte, DecimalUtils.HIGH_PRECISION).movePointRight(2).setScale(2, RoundingMode.HALF_UP);
} else {
return BigDecimal.ONE.movePointRight(2);
}
}
 
private ListeAddPanel getPanel(final SQLElement eltCmd, final SQLTableModelSourceOnline tableSource) {
final ListeAddPanel panel = new ListeAddPanel(eltCmd, new IListe(tableSource));
 
// final List<Tuple2<? extends SQLTableModelColumn, IListTotalPanel.Type>> fields = new
// ArrayList<Tuple2<? extends SQLTableModelColumn, IListTotalPanel.Type>>(2);
// fields.add(Tuple2.create(panel.getListe().getSource().getColumn(eltCmd.getTable().getField("T_HT")),
// IListTotalPanel.Type.SOMME));
// fields.add(Tuple2.create(this.colAvancement, IListTotalPanel.Type.AVANCEMENT_TTC));
// final IListTotalPanel totalPanel = new IListTotalPanel(panel.getListe(), fields, null,
// "Total des commandes de la liste");
 
final GridBagConstraints c = new DefaultGridBagConstraints();
c.gridwidth = GridBagConstraints.REMAINDER;
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.EAST;
c.weightx = 1;
c.gridy = 4;
 
// Date panel
final IListFilterDatePanel datePanel = new IListFilterDatePanel(panel.getListe(), eltCmd.getTable().getForeignTable("ID_COMMANDE_CLIENT").getField("DATE"),
IListFilterDatePanel.getDefaultMap());
 
datePanel.setFilterOnDefault();
 
final JPanel bottomPanel = new JPanel();
bottomPanel.setLayout(new GridBagLayout());
bottomPanel.setOpaque(false);
final GridBagConstraints c2 = new DefaultGridBagConstraints();
c2.fill = GridBagConstraints.NONE;
c2.weightx = 1;
bottomPanel.add(datePanel, c2);
 
// c2.gridx++;
// c2.weightx = 0;
// c2.anchor = GridBagConstraints.EAST;
// bottomPanel.add(totalPanel, c2);
 
panel.add(bottomPanel, c);
return panel;
}
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/order/action/ListeDesCommandesClientAction.java
14,23 → 14,14
package org.openconcerto.erp.core.sales.order.action;
 
import org.openconcerto.erp.action.CreateFrameAbstractAction;
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.erp.core.common.component.TransfertBaseSQLComponent;
import org.openconcerto.erp.core.common.component.TransfertGroupSQLComponent;
import org.openconcerto.erp.core.common.ui.IListFilterDatePanel;
import org.openconcerto.erp.core.common.ui.IListTotalPanel;
import org.openconcerto.erp.core.sales.account.VenteFactureSituationSQLComponent;
import org.openconcerto.erp.core.sales.account.VenteFactureSoldeSQLComponent;
import org.openconcerto.erp.core.sales.order.element.CommandeClientSQLElement;
import org.openconcerto.erp.core.sales.order.report.CommandeClientXmlSheet;
import org.openconcerto.erp.core.sales.order.ui.EtatCommandeClient;
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.model.FieldPath;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.model.graph.Path;
40,9 → 31,6
import org.openconcerto.sql.view.ListeAddPanel;
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
import org.openconcerto.sql.view.list.IListe;
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
import org.openconcerto.sql.view.list.RowAction;
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
import org.openconcerto.sql.view.list.SQLTableModelColumn;
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
import org.openconcerto.ui.DefaultGridBagConstraints;
51,13 → 39,11
import org.openconcerto.ui.table.PercentTableCellRenderer;
import org.openconcerto.utils.CollectionUtils;
import org.openconcerto.utils.DecimalUtils;
import org.openconcerto.utils.NumberUtils;
import org.openconcerto.utils.Tuple2;
import org.openconcerto.utils.cc.ITransformer;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.io.File;
import java.math.BigDecimal;
import java.math.RoundingMode;
66,7 → 52,6
import java.util.List;
import java.util.Set;
 
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JFrame;
120,22 → 105,28
});
}
 
if (eltCmd.getTable().getDBRoot().contains("TARIF_AGENCE")) {
this.colAvancement = new BaseSQLTableModelColumn("Avancement livraison", BigDecimal.class) {
BaseSQLTableModelColumn colLiv2 = new BaseSQLTableModelColumn("Avancement livraison v2", BigDecimal.class) {
 
@Override
protected Object show_(SQLRowAccessor r) {
@Override
protected Object show_(SQLRowAccessor r) {
 
return getAvancementL(r);
}
return getAvancementLFromBL(r);
}
 
@Override
public Set<FieldPath> getPaths() {
final Path p = new PathBuilder(eltCmd.getTable()).addTable("TR_COMMANDE_CLIENT").addTable("BON_DE_LIVRAISON").build();
return CollectionUtils.createSet(new FieldPath(p, "TOTAL_HT"));
}
};
@Override
public Set<FieldPath> getPaths() {
final Path p = new PathBuilder(eltCmd.getTable()).addTable("COMMANDE_CLIENT_ELEMENT").build();
return CollectionUtils.createSet(new FieldPath(p, "QTE_LIVREE"), new FieldPath(p, "QTE"), new FieldPath(p, "QTE_UNITAIRE"), new FieldPath(p, "LIVRE_FORCED"),
new FieldPath(p, "LIVRE"));
}
};
tableSource.getColumns().add(colLiv2);
colLiv2.setRenderer(new PercentTableCellRenderer());
 
if (eltCmd.getTable().getDBRoot().contains("TARIF_AGENCE")) {
this.colAvancement = colLiv2;
} else {
 
this.colAvancement = new BaseSQLTableModelColumn("Avancement facturation", BigDecimal.class) {
 
@Override
158,6 → 149,26
return panel;
}
 
private BigDecimal getAvancementLFromBL(SQLRowAccessor r) {
Collection<? extends SQLRowAccessor> rows = r.getReferentRows(r.getTable().getTable("COMMANDE_CLIENT_ELEMENT"));
BigDecimal totalQte = BigDecimal.ZERO;
BigDecimal totalQteL = BigDecimal.ZERO;
for (SQLRowAccessor row : rows) {
BigDecimal qte = row.getBigDecimal("QTE_UNITAIRE").multiply(new BigDecimal(row.getInt("QTE")));
totalQte = totalQte.add(qte);
if (row.getBoolean("LIVRE_FORCED") || row.getBoolean("LIVRE")) {
totalQteL = totalQteL.add(qte);
} else {
totalQteL = totalQteL.add(row.getBigDecimal("QTE_LIVREE"));
}
}
if (totalQte.signum() != 0) {
return totalQteL.divide(totalQte, DecimalUtils.HIGH_PRECISION).movePointRight(2).setScale(2, RoundingMode.HALF_UP);
} else {
return BigDecimal.ONE.movePointRight(2);
}
}
 
private BigDecimal getAvancementL(SQLRowAccessor r) {
Collection<? extends SQLRowAccessor> rows = r.getReferentRows(r.getTable().getTable("TR_COMMANDE_CLIENT"));
long totalFact = 0;
233,6 → 244,10
};
 
final List<Tuple2<? extends SQLTableModelColumn, IListTotalPanel.Type>> fields = new ArrayList<Tuple2<? extends SQLTableModelColumn, IListTotalPanel.Type>>(2);
// if (panel.getListe().getSource().getColumn(eltCmd.getTable().getField("T_HA")) != null) {
// fields.add(Tuple2.create(panel.getListe().getSource().getColumn(eltCmd.getTable().getField("T_HA")),
// IListTotalPanel.Type.SOMME));
// }
fields.add(Tuple2.create(panel.getListe().getSource().getColumn(eltCmd.getTable().getField("T_HT")), IListTotalPanel.Type.SOMME));
fields.add(Tuple2.create(this.colAvancement, IListTotalPanel.Type.AVANCEMENT_TTC));
final IListTotalPanel totalPanel = new IListTotalPanel(panel.getListe(), fields, null, "Total des commandes de la liste");
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/order/component/CommandeClientSQLComponent.java
14,6 → 14,7
package org.openconcerto.erp.core.sales.order.component;
 
import static org.openconcerto.utils.CollectionUtils.createSet;
 
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.erp.core.common.component.TransfertBaseSQLComponent;
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
66,6 → 67,8
import java.beans.PropertyChangeListener;
import java.sql.SQLException;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
 
import javax.swing.JLabel;
import javax.swing.JOptionPane;
111,7 → 114,16
c.gridx = 0;
this.add(new JLabel(getLabelFor("NUMERO"), SwingConstants.RIGHT), c);
 
this.numeroUniqueCommande = new JUniqueTextField(16);
this.numeroUniqueCommande = new JUniqueTextField(16) {
@Override
public String getAutoRefreshNumber() {
if (getMode() == Mode.INSERTION) {
return NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), dateCommande.getDate());
} else {
return null;
}
}
};
c.fill = GridBagConstraints.NONE;
c.gridx++;
c.weightx = 1;
324,6 → 336,22
}
});
 
if (getTable().contains("DATE_LIVRAISON_PREV")) {
// Date
JLabel labelDatePrev = new JLabel(getLabelFor("DATE_LIVRAISON_PREV"));
labelDatePrev.setHorizontalAlignment(SwingConstants.RIGHT);
c.gridx = 2;
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 0;
this.add(labelDatePrev, c);
 
c.gridx++;
c.fill = GridBagConstraints.NONE;
JDate datePrev = new JDate();
this.add(datePrev, c);
this.addView(datePrev, "DATE_LIVRAISON_PREV");
}
 
}
SQLPreferences prefs = SQLPreferences.getMemCached(getTable().getDBRoot());
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.ADDRESS_SPEC, true)) {
435,6 → 463,24
}
});
}
if (this.getTable().getFieldsName().contains("ACOMPTE_COMMANDE")) {
// ACOMPTE
c.gridy += (this.getTable().getFieldsName().contains("ID_TARIF") ? 0 : 1);
c.gridx += (this.getTable().getFieldsName().contains("ID_TARIF") ? 1 : 2);
c.weightx = 0;
c.weighty = 0;
c.gridwidth = 1;
c.fill = GridBagConstraints.HORIZONTAL;
this.add(new JLabel(getLabelFor("ACOMPTE_COMMANDE"), SwingConstants.RIGHT), c);
c.gridx++;
c.gridwidth = GridBagConstraints.REMAINDER;
c.fill = GridBagConstraints.NONE;
c.weightx = 1;
JTextField acompteCmd = new JTextField(15);
DefaultGridBagConstraints.lockMinimumSize(acompteCmd);
this.add(acompteCmd, c);
this.addView(acompteCmd, "ACOMPTE_COMMANDE");
}
 
// Table d'élément
this.table = new CommandeClientItemTable();
456,6 → 502,7
DeviseField fieldDevise = new DeviseField();
DeviseField fieldService = new DeviseField();
DeviseField fieldHA = new DeviseField();
DeviseField fieldEco = new DeviseField();
fieldHT.setOpaque(false);
fieldHA.setOpaque(false);
fieldTVA.setOpaque(false);
462,6 → 509,7
fieldTTC.setOpaque(false);
fieldService.setOpaque(false);
addSQLObject(fieldDevise, "T_DEVISE");
addSQLObject(fieldEco, "T_ECO_CONTRIBUTION");
addRequiredSQLObject(fieldHT, "T_HT");
addRequiredSQLObject(fieldTVA, "T_TVA");
addRequiredSQLObject(fieldTTC, "T_TTC");
473,6 → 521,7
addSQLObject(fieldHA, "T_HA");
}
// Disable
this.allowEditable("T_ECO_CONTRIBUTION", false);
this.allowEditable("T_HT", false);
this.allowEditable("T_TVA", false);
this.allowEditable("T_TTC", false);
481,8 → 530,8
JTextField poids = new JTextField();
SQLRequestComboBox boxTaxePort = new SQLRequestComboBox(false, 8);
// addSQLObject(poids, "T_POIDS");
final TotalPanel totalTTC = new TotalPanel(this.table, fieldHT, fieldTVA, fieldTTC, textPortHT, textRemiseHT, fieldService, fieldHA, fieldDevise, poids, null,
(getTable().contains("ID_TAXE_PORT") ? boxTaxePort : null));
final TotalPanel totalTTC = new TotalPanel(this.table, fieldEco, fieldHT, fieldTVA, fieldTTC, textPortHT, textRemiseHT, fieldService, fieldHA, fieldDevise, poids, null,
(getTable().contains("ID_TAXE_PORT") ? boxTaxePort : null), null);
 
// INfos
c.gridx = 0;
644,9 → 693,35
 
public int insert(SQLRow order) {
final int idCommande;
 
int attempt = 0;
// on verifie qu'un devis du meme numero n'a pas été inséré entre temps
if (this.numeroUniqueCommande.checkValidation()) {
 
if (!this.numeroUniqueCommande.checkValidation(false)) {
while (attempt < JUniqueTextField.RETRY_COUNT) {
String num = NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), dateCommande.getDate());
this.numeroUniqueCommande.setText(num);
attempt++;
if (this.numeroUniqueCommande.checkValidation(false)) {
System.err.println("ATEMPT " + attempt + " SUCCESS WITH NUMERO " + num);
break;
}
try {
Thread.sleep(JUniqueTextField.SLEEP_WAIT_MS);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
final String num = this.numeroUniqueCommande.getText();
if (attempt == JUniqueTextField.RETRY_COUNT) {
idCommande = getSelectedID();
ExceptionHandler.handle("Impossible d'ajouter, numéro de commande existant.");
final Object root = SwingUtilities.getRoot(this);
if (root instanceof EditFrame) {
final EditFrame frame = (EditFrame) root;
frame.getPanel().setAlwaysVisible(true);
}
} else {
idCommande = super.insert(order);
this.table.updateField("ID_COMMANDE_CLIENT", idCommande);
try {
679,13 → 754,12
e.printStackTrace();
}
}
} else {
idCommande = getSelectedID();
ExceptionHandler.handle("Impossible d'ajouter, numéro de commande client existant.");
Object root = SwingUtilities.getRoot(this);
if (root instanceof EditFrame) {
EditFrame frame = (EditFrame) root;
frame.getPanel().setAlwaysVisible(true);
if (attempt > 0) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JOptionPane.showMessageDialog(null, "Le numéro a été actualisé en " + num);
}
});
}
}
 
693,6 → 767,19
}
 
@Override
public Set<String> getPartialResetNames() {
Set<String> s = new HashSet<String>();
s.add("NOM");
s.add("NUMERO");
s.add("INFOS");
s.add("ID_CLIENT");
if (getTable().contains("ACOMPTE_COMMANDE")) {
s.add("ACOMPTE_COMMANDE");
}
return s;
}
 
@Override
public void select(SQLRowAccessor r) {
if (r == null || r.getIDNumber() == null)
super.select(r);
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/account/PartialInvoiceEditGroup.java
33,6 → 33,7
 
final Group gCustomer = new Group("sales.invoice.customer");
gCustomer.addItem("sales.invoice.customer", LayoutHints.DEFAULT_LARGE_FIELD_HINTS);
gCustomer.addItem("REMISE_HT");
add(gCustomer);
 
final Group gElements = new Group("sales.invoice.partial.items");
47,9 → 48,18
gTotal.addItem("sales.invoice.partial.total.amount");
add(gTotal);
 
final Group bottom = new Group("sales.quote.footer");
final Group gInfos = new Group("sales.account.infos");
gInfos.addItem("INFOS", LayoutHints.DEFAULT_VERY_LARGE_TEXT_HINTS);
add(gInfos);
final LayoutHints hint = new LayoutHints(false, true, true, false, true, true, true, true);
gInfos.addItem("sales.quote.info.general", hint);
bottom.add(gInfos);
 
final Group gOO = new Group("sales.quote.oo");
LayoutHints hintInfos = new LayoutHints(false, false, true, true, true, false);
gOO.addItem("panel.oo", hintInfos);
bottom.add(gOO);
 
add(bottom);
}
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/account/VenteFactureSituationSQLComponent.java
22,15 → 22,18
import org.openconcerto.erp.core.common.ui.AcompteRowItemView;
import org.openconcerto.erp.core.common.ui.DeviseField;
import org.openconcerto.erp.core.common.ui.TotalPanel;
import org.openconcerto.erp.core.finance.accounting.element.EcritureSQLElement;
import org.openconcerto.erp.core.sales.invoice.element.SaisieVenteFactureSQLElement;
import org.openconcerto.erp.core.sales.invoice.report.VenteFactureXmlSheet;
import org.openconcerto.erp.core.sales.invoice.ui.FactureSituationItemTable;
import org.openconcerto.erp.generationEcritures.GenerationMvtSaisieVenteFacture;
import org.openconcerto.erp.panel.PanelOOSQLComponent;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.ElementSQLObject;
import org.openconcerto.sql.element.GlobalMapper;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.sqlobject.JUniqueTextField;
56,6 → 59,7
import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
64,6 → 68,8
public class VenteFactureSituationSQLComponent extends TransfertGroupSQLComponent {
public static final String ID = "sales.invoice.partial";
 
private PanelOOSQLComponent panelOO;
 
public VenteFactureSituationSQLComponent(SQLElement element) {
super(element, (Group) GlobalMapper.getInstance().get(ID));
}
76,6 → 82,7
protected Set<String> createRequiredNames() {
final Set<String> s = new HashSet<String>(1);
s.add("ID_CLIENT");
s.add("ID_COMMERCIAL");
s.add("NUMERO");
s.add("DATE");
s.add("MONTANT_FACTURABLE");
92,6 → 99,14
JCheckBox box = new JCheckBox("partial");
 
@Override
public void select(SQLRowAccessor r) {
super.select(r);
final DeviseField totalRemise = (DeviseField) getEditor("REMISE_HT");
totalRemise.setEditable(false);
totalRemise.setEnabled(false);
}
 
@Override
protected void addViews() {
 
super.addViews();
106,12 → 121,15
final JTextField totalWeight = (JTextField) getEditor("T_POIDS");
final DeviseField totalTTC = (DeviseField) getEditor("T_TTC");
final DeviseField totalTVA = (DeviseField) getEditor("T_TVA");
final DeviseField totalEco = (DeviseField) getEditor("T_ECO_CONTRIBUTION");
final DeviseField totalRemise = (DeviseField) getEditor("REMISE_HT");
totalRemise.setEditable(false);
totalRemise.setEnabled(false);
final DeviseField totalPORT = (DeviseField) getEditor("PORT_HT");
this.addView(totalPORT, "PORT_HT");
this.addView(totalRemise, "REMISE_HT");
this.addView(totalTVA, "T_TVA");
this.addView(totalTTC, "T_TTC");
this.addView(totalEco, "T_ECO_CONTRIBUTION");
this.addView(totalWeight, "T_POIDS");
this.addView(totalDevise, "T_DEVISE");
this.addView(totalSupply, "T_HA");
191,6 → 209,8
final JLabel jLabel = new JLabel("Montant HT (ou %) à facturer");
jLabel.setHorizontalAlignment(SwingConstants.RIGHT);
return jLabel;
} else if (id.equals("panel.oo")) {
return new JLabel();
} else if (id.equals("sales.invoice.partial.total.amount")) {
return new JLabel();
} else {
204,8 → 224,20
public JComponent createEditor(String id) {
 
if (id.equals("sales.invoice.number")) {
this.numberField = new JUniqueTextField(20);
this.numberField = new JUniqueTextField(20) {
@Override
public String getAutoRefreshNumber() {
if (getMode() == Mode.INSERTION) {
return NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), ((JDate) getEditor("DATE")).getDate());
} else {
return null;
}
}
};
return this.numberField;
} else if (id.equals("panel.oo")) {
this.panelOO = new PanelOOSQLComponent(this);
return this.panelOO;
} else if (id.equals("INFOS")) {
final ITextArea jTextArea = new ITextArea();
jTextArea.setFont(new JLabel().getFont());
229,6 → 261,7
}
 
final DeviseField totalHT = (DeviseField) getEditor("T_HT");
final DeviseField totalEco = (DeviseField) getEditor("T_ECO_CONTRIBUTION");
final DeviseField totalService = (DeviseField) getEditor("T_SERVICE");
final DeviseField totalSupply = (DeviseField) getEditor("T_HA");
final DeviseField totalDevise = (DeviseField) getEditor("T_DEVISE");
236,13 → 269,19
final DeviseField totalTTC = (DeviseField) getEditor("T_TTC");
final DeviseField totalTVA = (DeviseField) getEditor("T_TVA");
final DeviseField totalRemise = (DeviseField) getEditor("REMISE_HT");
totalRemise.setEditable(false);
totalRemise.setEnabled(false);
final AcompteField acompte = (AcompteField) getEditor("sales.invoice.partial.amount");
final DeviseField totalPORT = (DeviseField) getEditor("PORT_HT");
 
return new TotalPanel(items, totalHT, totalTVA, totalTTC, totalRemise, totalPORT, totalService, totalSupply, totalDevise, totalWeight, null);
final SQLRequestComboBox taxePort = (SQLRequestComboBox) getEditor("ID_TAXE_PORT");
return new TotalPanel(items, totalEco, totalHT, totalTVA, totalTTC, totalPORT, totalRemise, totalService, totalSupply, totalDevise, totalWeight, null, taxePort, acompte);
} else if (id.startsWith("T_")) {
return new DeviseField();
} else if (id.equals("REMISE_HT") || id.equals("PORT_HT")) {
return new DeviseField();
DeviseField fieldD = new DeviseField();
fieldD.setEditable(false);
fieldD.setEnabled(false);
return fieldD;
} else if (id.equals("sales.invoice.partial.amount")) {
return new AcompteField();
}
256,8 → 295,34
 
int idSaisieVF = SQLRow.NONEXISTANT_ID;
 
if (this.numberField.checkValidation()) {
 
int attempt = 0;
// on verifie qu'un devis du meme numero n'a pas été inséré entre temps
if (!this.numberField.checkValidation(false)) {
while (attempt < JUniqueTextField.RETRY_COUNT) {
String num = NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), ((JDate) getEditor("DATE")).getDate());
this.numberField.setText(num);
attempt++;
if (this.numberField.checkValidation(false)) {
System.err.println("ATEMPT " + attempt + " SUCCESS WITH NUMERO " + num);
break;
}
try {
Thread.sleep(JUniqueTextField.SLEEP_WAIT_MS);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
final String num = this.numberField.getText();
if (attempt == JUniqueTextField.RETRY_COUNT) {
idSaisieVF = getSelectedID();
ExceptionHandler.handle("Impossible d'ajouter, numéro de facture existant.");
final Object root = SwingUtilities.getRoot(this);
if (root instanceof EditFrame) {
final EditFrame frame = (EditFrame) root;
frame.getPanel().setAlwaysVisible(true);
}
} else {
idSaisieVF = super.insert(order);
SQLRow rowFacture = getTable().getRow(idSaisieVF);
// incrémentation du numéro auto
281,17 → 346,16
try {
VenteFactureXmlSheet sheet = new VenteFactureXmlSheet(rowFacture);
sheet.createDocument();
sheet.showPrintAndExport(true, false, false);
sheet.showPrintAndExport(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true);
} catch (Exception e) {
ExceptionHandler.handle("Une erreur est survenue lors de la création du document.", e);
}
 
} else {
ExceptionHandler.handle("Impossible d'ajouter, numéro de facture existant.");
Object root = SwingUtilities.getRoot(this);
if (root instanceof EditFrame) {
EditFrame frame = (EditFrame) root;
frame.getPanel().setAlwaysVisible(true);
if (attempt > 0) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JOptionPane.showMessageDialog(null, "Le numéro a été actualisé en " + num);
}
});
}
}
return idSaisieVF;
300,10 → 364,24
@Override
public void update() {
 
int id = getSelectedID();
super.update();
int id = getSelectedID();
final SQLRow rowFacture = getTable().getRow(id);
((AbstractArticleItemTable) getEditor("sales.invoice.partial.items.list")).updateField("ID_SAISIE_VENTE_FACTURE", id);
 
int idMvt = rowFacture.getInt("ID_MOUVEMENT");
// on supprime tout ce qui est lié à la facture
System.err.println("Archivage des fils");
EcritureSQLElement eltEcr = (EcritureSQLElement) getDirectory().getElement("ECRITURE");
eltEcr.archiveMouvementProfondeur(idMvt, false);
new GenerationMvtSaisieVenteFacture(id);
try {
VenteFactureXmlSheet sheet = new VenteFactureXmlSheet(rowFacture);
sheet.createDocument();
sheet.showPrintAndExport(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true);
} catch (Exception e) {
ExceptionHandler.handle("Une erreur est survenue lors de la création du document.", e);
}
}
 
@Override
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/account/VenteFactureSoldeEditGroup.java
34,6 → 34,7
 
final Group gCustomer = new Group("sales.invoice.partial.balance.customer");
gCustomer.addItem("sales.invoice.customer", LayoutHints.DEFAULT_LARGE_FIELD_HINTS);
gCustomer.addItem("REMISE_HT");
add(gCustomer);
 
final Group gElements = new Group("sales.invoice.partial.balance.items");
48,10 → 49,18
gTotal.addItem("sales.invoice.partial.total.amount");
add(gTotal);
 
final Group gInfos = new Group("sales.invoice.partial.balance.infos");
gInfos.addItem("INFOS", LayoutHints.DEFAULT_VERY_LARGE_TEXT_HINTS);
add(gInfos);
final Group bottom = new Group("sales.quote.footer");
final Group gInfos = new Group("sales.account.infos");
final LayoutHints hint = new LayoutHints(false, true, true, false, true, true, true, true);
gInfos.addItem("sales.quote.info.general", hint);
bottom.add(gInfos);
 
final Group gOO = new Group("sales.quote.oo");
LayoutHints hintInfos = new LayoutHints(false, false, true, true, true, false);
gOO.addItem("panel.oo", hintInfos);
bottom.add(gOO);
 
add(bottom);
}
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/account/VenteFactureSoldeSQLComponent.java
25,9 → 25,11
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.ui.group.Group;
import org.openconcerto.utils.DecimalUtils;
import org.openconcerto.utils.Tuple2;
 
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
74,7 → 76,11
AcompteField field = (AcompteField) getEditor("sales.invoice.partial.amount");
 
Tuple2<Long, Long> t = getTotalFacture(rows);
final Acompte a = new Acompte(null, new BigDecimal(t.get0() - t.get1()).movePointLeft(2));
// final Acompte a = new Acompte(null, new BigDecimal(t.get0() -
// t.get1()).movePointLeft(2));
// field.setValue(a);
final BigDecimal percent = BigDecimal.ONE.subtract(new BigDecimal(t.get1()).divide(new BigDecimal(t.get0()), DecimalUtils.HIGH_PRECISION).setScale(6, RoundingMode.HALF_UP));
final Acompte a = new Acompte(percent.movePointRight(2), null);
field.setValue(a);
final FactureSituationItemTable table = ((FactureSituationItemTable) getEditor("sales.invoice.partial.items.list"));
table.calculPourcentage(a, TypeCalcul.CALCUL_FACTURABLE);
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/element/SaisieVenteFactureItemSQLElement.java
23,7 → 23,7
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.sqlobject.ElementComboBox;
import org.openconcerto.sql.users.rights.UserRightsManager;
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
import org.openconcerto.sql.view.list.SQLTableModelSource;
import org.openconcerto.ui.DefaultGridBagConstraints;
 
import java.awt.GridBagConstraints;
57,6 → 57,7
*/
protected List<String> getComboFields() {
List<String> l = new ArrayList<String>();
l.add("NIVEAU");
l.add("CODE");
l.add("NOM");
l.add("PV_HT");
66,10 → 67,8
}
 
@Override
protected SQLTableModelSourceOnline createTableSource() {
 
SQLTableModelSourceOnline table = super.createTableSource();
return table;
protected synchronized void _initTableSource(final SQLTableModelSource table) {
super._initTableSource(table);
}
 
/*
94,6 → 93,11
}
l.add("PV_HT");
l.add("QTE");
if (getTable().contains("ID_ECO_CONTRIBUTION")) {
l.add("ID_ECO_CONTRIBUTION");
l.add("ECO_CONTRIBUTION");
l.add("T_ECO_CONTRIBUTION");
}
l.add("T_PV_HT");
l.add("T_PV_TTC");
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/element/SaisieVenteFactureSQLElement.java
31,9 → 31,11
import org.openconcerto.erp.core.sales.shipment.component.BonDeLivraisonSQLComponent;
import org.openconcerto.erp.core.supplychain.stock.element.MouvementStockSQLElement;
import org.openconcerto.erp.generationEcritures.GenerationMvtRetourNatexis;
import org.openconcerto.erp.generationEcritures.GenerationMvtSaisieVenteFacture;
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
import org.openconcerto.erp.preferences.DefaultNXProps;
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel;
import org.openconcerto.erp.preferences.PrinterNXProps;
import org.openconcerto.erp.rights.NXRights;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.GlobalMapper;
56,7 → 58,6
import org.openconcerto.sql.preferences.SQLPreferences;
import org.openconcerto.sql.request.ListSQLRequest;
import org.openconcerto.sql.sqlobject.ElementComboBox;
import org.openconcerto.sql.users.UserManager;
import org.openconcerto.sql.users.rights.UserRightsManager;
import org.openconcerto.sql.view.EditFrame;
import org.openconcerto.sql.view.EditPanel;
67,8 → 68,9
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
import org.openconcerto.sql.view.list.RowAction;
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
import org.openconcerto.sql.view.list.SQLTableModelSource;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.FrameUtil;
import org.openconcerto.ui.table.PercentTableCellRenderer;
import org.openconcerto.utils.CollectionUtils;
import org.openconcerto.utils.DecimalUtils;
102,6 → 104,7
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
 
import org.apache.commons.dbutils.handlers.ArrayListHandler;
 
147,7 → 150,7
}
});
 
final boolean affact = UserManager.getInstance().getCurrentUser().getRights().haveRight(NXRights.ACCES_RETOUR_AFFACTURAGE.getCode());
final boolean affact = UserRightsManager.getCurrentUserRights().haveRight(NXRights.ACCES_RETOUR_AFFACTURAGE.getCode());
List<RowAction> l = new ArrayList<RowAction>(5);
PredicateRowAction actionBL = new PredicateRowAction(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
163,6 → 166,19
}, false, "sales.invoice.create.credit");
actionAvoir.setPredicate(IListeEvent.getSingleSelectionPredicate());
l.add(actionAvoir);
 
final String property = PrinterNXProps.getInstance().getProperty("QLPrinter");
if (property != null && property.trim().length() > 0) {
PredicateRowAction actionPrintLabel = new PredicateRowAction(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
// ((ClientNormalSQLElement)
// getForeignElement("ID_CLIENT")).printLabel(IListe.get(e).getSelectedRow().getForeign("ID_CLIENT"),
// property);
}
}, false, "customerrelationship.customer.label.print");
actionPrintLabel.setPredicate(IListeEvent.getSingleSelectionPredicate());
// l.add(actionPrintLabel);
}
RowAction actionClone = new RowAction(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
 
211,6 → 227,20
actionCommande.setPredicate(IListeEvent.getSingleSelectionPredicate());
getRowActions().add(actionCommande);
 
RowAction actionCancelAvoir = new PredicateRowAction(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
cancelAvoir(IListe.get(e).getSelectedRow());
}
}, false, "sales.invoice.cancel.credit") {
@Override
public boolean enabledFor(IListeEvent evt) {
final SQLRowAccessor selectedRow = evt.getSelectedRow().asRow();
final List<SQLRowValues> rows = evt.getSelectedRows();
return rows != null && rows.size() == 1 && selectedRow != null && !selectedRow.isForeignEmpty("ID_AVOIR_CLIENT");
}
};
getRowActions().add(actionCancelAvoir);
 
MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(VenteFactureXmlSheet.class);
getRowActions().addAll(mouseSheetXmlListeListener.getRowActions());
// this.frame.getPanel().getListe().addRowActions(mouseListener.getRowActions());
232,7 → 262,7
@Override
public ListMap<String, String> getShowAs() {
ListMap<String, String> map = new ListMap<String, String>();
map.putCollection(null, "NUMERO");
map.putCollection(null, "NUMERO", "DATE", "ID_COMMERCIAL");
return map;
}
 
303,8 → 333,8
}
 
@Override
protected SQLTableModelSourceOnline createTableSource() {
SQLTableModelSourceOnline table = super.createTableSource();
protected synchronized void _initTableSource(final SQLTableModelSource table) {
super._initTableSource(table);
 
final BaseSQLTableModelColumn colAvancement = new BaseSQLTableModelColumn("Avancement réglement", BigDecimal.class) {
 
328,7 → 358,6
table.getColumns().add(colAvancement);
colAvancement.setRenderer(new PercentTableCellRenderer());
 
return table;
}
 
protected List<String> getComboFields() {
517,4 → 546,77
specialAction.put(key, action);
}
 
public void cancelAvoir(final SQLRowAccessor rowFactureOrigin) {
JPanel p = new JPanel(new GridBagLayout());
GridBagConstraints c = new DefaultGridBagConstraints();
c.gridwidth = GridBagConstraints.REMAINDER;
p.add(new JLabel("Voulez annuler l'avoir affecté sur cette facture?"), c);
c.gridwidth = 1;
c.gridy++;
c.gridx = 0;
final JButton buttonApply = new JButton("Appliquer");
JButton buttonAnnuler = new JButton("Fermer");
p.add(buttonApply, c);
 
c.gridx++;
p.add(buttonAnnuler, c);
final PanelFrame f = new PanelFrame(p, "Suppression d'un avoir client sur facture");
 
buttonAnnuler.addActionListener(new ActionListener() {
 
@Override
public void actionPerformed(ActionEvent e) {
f.dispose();
}
});
 
buttonApply.addActionListener(new ActionListener() {
 
@Override
public void actionPerformed(ActionEvent e) {
long ttc = rowFactureOrigin.getLong("T_TTC");
// long netAPayer = rowFactureOrigin.getLong("NET_A_PAYER");
long avoirTTC = rowFactureOrigin.getLong("T_AVOIR_TTC");
SQLRowAccessor rowAvoir = rowFactureOrigin.getForeign("ID_AVOIR_CLIENT");
 
final SQLRowValues createEmptyUpdateRow = rowFactureOrigin.createEmptyUpdateRow();
createEmptyUpdateRow.put("ID_AVOIR_CLIENT", rowFactureOrigin.getTable().getTable("AVOIR_CLIENT").getUndefinedID());
createEmptyUpdateRow.put("NET_A_PAYER", ttc);
createEmptyUpdateRow.put("T_AVOIR_TTC", 0L);
try {
SQLRow rowFacture = createEmptyUpdateRow.commit();
 
// long restant = totalAvoirTTC - totalAvoirApplique;
 
SQLRowValues rowVals = rowAvoir.createEmptyUpdateRow();
rowVals.put("SOLDE", Boolean.FALSE);
rowVals.put("MONTANT_SOLDE", 0L);
rowVals.put("MONTANT_RESTANT", avoirTTC);
rowVals.update();
 
EcritureSQLElement eltEcr = (EcritureSQLElement) Configuration.getInstance().getDirectory().getElement("ECRITURE");
final int foreignIDmvt = rowFacture.getForeignID("ID_MOUVEMENT");
eltEcr.archiveMouvementProfondeur(foreignIDmvt, false);
 
System.err.println("Regeneration des ecritures");
new GenerationMvtSaisieVenteFacture(rowFacture.getID(), foreignIDmvt);
System.err.println("Fin regeneration");
} catch (SQLException e1) {
ExceptionHandler.handle("Erreur lors de l'affection de l'avoir sur la facture!", e1);
} finally {
f.dispose();
}
 
}
});
SwingUtilities.invokeLater(new Runnable() {
 
@Override
public void run() {
 
FrameUtil.showPacked(f);
}
 
});
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/element/EcheanceClientSQLElement.java
42,7 → 42,7
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
import org.openconcerto.sql.view.list.RowAction;
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
import org.openconcerto.sql.view.list.SQLTableModelSource;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.EmailComposer;
import org.openconcerto.ui.JDate;
196,6 → 196,7
int idFact = rowMvtSource.getInt("IDSOURCE");
SQLRow rowFacture = base.getTable("SAISIE_VENTE_FACTURE").getRow(idFact);
 
final VenteFactureXmlSheet sheet = new VenteFactureXmlSheet(rowFacture);
 
Set<SQLField> setContact = null;
SQLTable tableContact = Configuration.getInstance().getRoot().findTable("CONTACT");
229,9 → 230,12
@Override
public void run() {
 
final File f;
try {
EmailComposer.getInstance().compose(adresseMail, references, text);
f = sheet.getOrCreatePDFDocumentFile(true);
 
EmailComposer.getInstance().compose(adresseMail, references, text, f.getAbsoluteFile());
 
// Création d'une relance
String numero = NumerotationAutoSQLElement.getNextNumero(RelanceSQLElement.class);
SQLRowValues rowValsR = new SQLRowValues(row.getTable().getTable("RELANCE"));
271,6 → 275,9
exn.printStackTrace();
} catch (InterruptedException exn) {
exn.printStackTrace();
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/report/ListeDebiteursXmlSheet.java
34,7 → 34,7
 
public class ListeDebiteursXmlSheet extends AbstractListeSheetXml {
 
private static final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yy");
private final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yy");
 
public ListeDebiteursXmlSheet() {
super();
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/report/ListeVenteXmlSheet.java
38,7 → 38,7
 
public class ListeVenteXmlSheet extends AbstractListeSheetXml {
 
private static final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yy");
private final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yy");
 
public static final String TEMPLATE_ID = "ListeVentes";
public static final String TEMPLATE_PROPERTY_NAME = DEFAULT_PROPERTY_NAME;
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/ui/ListeDesEcheancesClientsPanel.java
29,7 → 29,6
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.users.UserManager;
import org.openconcerto.sql.users.rights.UserRightsManager;
import org.openconcerto.sql.view.EditFrame;
import org.openconcerto.sql.view.EditPanelListener;
124,7 → 123,7
// Bouton Relancer
this.relancer = new JButton("Relancer");
this.relancer.setHorizontalAlignment(SwingConstants.RIGHT);
if (UserManager.getInstance().getCurrentUser().getRights().haveRight(NXRights.GESTION_ENCAISSEMENT.getCode())) {
if (UserRightsManager.getCurrentUserRights().haveRight(NXRights.GESTION_ENCAISSEMENT.getCode())) {
c.gridx++;
this.add(this.relancer, c);
this.relancer.addActionListener(new ActionListener() {
139,7 → 138,7
this.encaisser.setHorizontalAlignment(SwingConstants.RIGHT);
c.gridx++;
c.weightx = 0;
if (UserManager.getInstance().getCurrentUser().getRights().haveRight(NXRights.GESTION_ENCAISSEMENT.getCode())) {
if (UserRightsManager.getCurrentUserRights().haveRight(NXRights.GESTION_ENCAISSEMENT.getCode())) {
 
this.add(this.encaisser, c);
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/ui/ListeDesVentesPanel.java
166,6 → 166,9
panelFacture.add(this.listeFact, cFacture);
 
List<SQLField> l = new ArrayList<SQLField>();
if (this.listeFact.getListe().getSource().getColumn(eltFacture.getTable().getField("T_HA")) != null) {
l.add(eltFacture.getTable().getField("T_HA"));
}
l.add(eltFacture.getTable().getField("T_HT"));
l.add(eltFacture.getTable().getField("T_TTC"));
final IListTotalPanel total = new IListTotalPanel(this.listeFact.getListe(), l);
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/ui/ListeFactureRenderer.java
94,7 → 94,7
JLabel label = (JLabel) comp;
 
final int realColIndex = table.getColumnModel().getColumn(column).getModelIndex();
final Set<SQLField> fields = line.getSrc().getParent().getColumn(realColIndex).getFields();
final Set<SQLField> fields = line.getColumns().getAllColumns().get(realColIndex).getFields();
// System.err.println("Column " + column + " Fields : " + fields);
if (fields.contains(tableModeReglement.getField("AJOURS"))) {
final SQLRowAccessor foreignRow = rowAt.getForeign("ID_MODE_REGLEMENT");
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/ui/DateReglementRenderer.java
31,7 → 31,7
private static final Color orangeDark = orange.darker();
private static final Color blue = new Color(153, 215, 251);
private static final Color blueDark = blue.darker();
private static final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.FRENCH);
private final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.FRENCH);
 
public DateReglementRenderer() {
super();
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/component/SaisieVenteFactureSQLComponent.java
14,6 → 14,7
package org.openconcerto.erp.core.sales.invoice.component;
 
import static org.openconcerto.utils.CollectionUtils.createSet;
 
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.erp.core.common.component.TransfertBaseSQLComponent;
import org.openconcerto.erp.core.common.element.BanqueSQLElement;
64,6 → 65,7
import org.openconcerto.sql.sqlobject.SQLTextCombo;
import org.openconcerto.sql.users.UserManager;
import org.openconcerto.sql.view.EditFrame;
import org.openconcerto.sql.view.EditPanel.EditMode;
import org.openconcerto.sql.view.list.RowValuesTable;
import org.openconcerto.sql.view.list.RowValuesTableModel;
import org.openconcerto.ui.DefaultGridBagConstraints;
74,6 → 76,7
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.GestionDevise;
import org.openconcerto.utils.ProductInfo;
import org.openconcerto.utils.cc.IFactory;
import org.openconcerto.utils.text.SimpleDocumentListener;
 
import java.awt.GridBagConstraints;
102,8 → 105,6
import javax.swing.SwingUtilities;
import javax.swing.event.DocumentEvent;
 
import org.apache.commons.dbutils.handlers.ArrayListHandler;
 
public class SaisieVenteFactureSQLComponent extends TransfertBaseSQLComponent {
private AbstractArticleItemTable tableFacture;
private JLabel labelAffaire = new JLabel("Affaire");
133,7 → 134,7
private SQLRowAccessor rowSelected;
private SQLElement eltContact = Configuration.getInstance().getDirectory().getElement("CONTACT");
private JTextField refClient = new JTextField();
private SQLRowValues defaultContactRowValues = new SQLRowValues(this.eltContact.getTable());
 
protected TotalPanel totalTTC;
private final boolean displayDpt;
private final ElementComboBox comboDpt = new ElementComboBox();
263,7 → 264,16
c.weightx = 0;
this.add(labelNum, c);
 
this.textNumeroUnique = new JUniqueTextField(16);
this.textNumeroUnique = new JUniqueTextField(16) {
@Override
public String getAutoRefreshNumber() {
if (getMode() == Mode.INSERTION) {
return NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), dateSaisie.getDate());
} else {
return null;
}
}
};
c.gridx++;
c.weightx = 0;
c.fill = GridBagConstraints.NONE;
312,6 → 322,7
c.gridy++;
c.weightx = 0;
c.fill = GridBagConstraints.HORIZONTAL;
 
JLabel labelLibelle = new JLabel(getLabelFor("NOM"));
labelLibelle.setHorizontalAlignment(SwingConstants.RIGHT);
this.add(labelLibelle, c);
390,7 → 401,9
 
}
 
if (getTable().contains("ID_ECHEANCIER_CCI")) {
if (
 
getTable().contains("ID_ECHEANCIER_CCI")) {
// Echeancier
c.gridy++;
c.gridx = 0;
458,8 → 471,27
});
// }
// Contact
this.contact = new ElementComboBox();
this.contact = new ElementComboBox() {
@Override
protected SQLComponent createSQLComponent(EditMode mode) {
final SQLComponent c = super.createSQLComponent(mode);
if (mode.equals(EditMode.CREATION)) {
c.setDefaultsFactory(new IFactory<SQLRowValues>() {
 
@Override
public SQLRowValues createChecked() {
final SQLRowValues defaultContactRowValues = new SQLRowValues(eltContact.getTable());
final SQLRow row = SaisieVenteFactureSQLComponent.this.comboClient.getSelectedRow();
defaultContactRowValues.putForeignID("ID_CLIENT", row);
 
return defaultContactRowValues;
}
});
}
return c;
}
};
 
JLabel labelContact = new JLabel(getLabelFor("ID_CONTACT"));
c.gridy++;
c.gridx = 0;
476,11 → 508,12
SQLElement contactElement = getElement().getForeignElement("ID_CONTACT");
this.contact.init(contactElement, contactElement.getComboRequest(true));
this.contact.getRequest().setWhere(Where.FALSE);
this.contact.getAddComp().setDefaults(this.defaultContactRowValues);
this.addSQLObject(this.contact, "ID_CONTACT");
// }
 
if (getTable().contains("DATE_LIVRAISON")) {
if (
 
getTable().contains("DATE_LIVRAISON")) {
JLabel labelDateLiv = new JLabel("Livraison le");
c.gridx++;
c.gridwidth = 1;
590,6 → 623,25
}
});
}
if (this.getTable().getFieldsName().contains("ACOMPTE_COMMANDE")) {
// ACOMPTE
c.gridy += (this.getTable().getFieldsName().contains("ID_TARIF") ? 0 : 1);
c.gridx += (this.getTable().getFieldsName().contains("ID_TARIF") ? 1 : 2);
c.weightx = 0;
c.weighty = 0;
c.gridwidth = 1;
c.fill = GridBagConstraints.HORIZONTAL;
this.add(new JLabel(getLabelFor("ACOMPTE_COMMANDE"), SwingConstants.RIGHT), c);
c.gridx++;
c.gridwidth = GridBagConstraints.REMAINDER;
c.fill = GridBagConstraints.NONE;
c.weightx = 1;
JTextField acompteCmd = new JTextField(15);
DefaultGridBagConstraints.lockMinimumSize(acompteCmd);
this.add(acompteCmd, c);
this.addView(acompteCmd, "ACOMPTE_COMMANDE");
}
 
c.gridy++;
c.gridx = 0;
c.weightx = 1;
685,6 → 737,7
final DeviseField fieldTVA = new DeviseField();
DeviseField fieldService = new DeviseField();
DeviseField fieldTHA = new DeviseField();
DeviseField fieldTEco = new DeviseField();
 
DeviseField fieldDevise = null;
if (getTable().getFieldsName().contains("T_DEVISE")) {
693,6 → 746,7
}
// FIXME was required but not displayed for KD
addSQLObject(fieldTHA, "T_HA");
addSQLObject(fieldTEco, "T_ECO_CONTRIBUTION");
addRequiredSQLObject(fieldHT, "T_HT");
addRequiredSQLObject(fieldTVA, "T_TVA");
addRequiredSQLObject(this.fieldTTC, "T_TTC");
702,6 → 756,7
 
// Disable
this.allowEditable("T_HA", false);
this.allowEditable("T_ECO_CONTRIBUTION", false);
this.allowEditable("T_HT", false);
this.allowEditable("T_TVA", false);
this.allowEditable("T_TTC", false);
708,8 → 763,8
this.allowEditable("T_SERVICE", false);
this.allowEditable("T_POIDS", false);
 
totalTTC = new TotalPanel(this.tableFacture, fieldHT, fieldTVA, this.fieldTTC, this.textPortHT, this.textRemiseHT, fieldService, fieldTHA, fieldDevise, poids, null,
(getTable().contains("ID_TAXE_PORT") ? boxTaxePort : null));
totalTTC = new TotalPanel(this.tableFacture, fieldTEco, fieldHT, fieldTVA, this.fieldTTC, this.textPortHT, this.textRemiseHT, fieldService, fieldTHA, fieldDevise, poids, null,
(getTable().contains("ID_TAXE_PORT") ? boxTaxePort : null), null);
DefaultGridBagConstraints.lockMinimumSize(totalTTC);
cBottom.gridx++;
cBottom.weightx = 1;
862,15 → 917,15
 
if (SaisieVenteFactureSQLComponent.this.comboClient.getSelectedRow() != null) {
final SQLRow row = SaisieVenteFactureSQLComponent.this.comboClient.getSelectedRow();
final int id = row == null ? SQLRow.NONEXISTANT_ID : row.getID();
SaisieVenteFactureSQLComponent.this.defaultContactRowValues.putForeignID("ID_CLIENT", row);
if (compteSelService != null && !row.isForeignEmpty("ID_COMPTE_PCE_SERVICE")) {
compteSelService.setValue(row.getForeignID("ID_COMPTE_PCE_SERVICE"));
final int id = (row == null) ? SQLRow.NONEXISTANT_ID : row.getID();
if (row != null) {
if (row.getFields().contains("ID_COMPTE_PCE_SERVICE") && compteSelService != null && !row.isForeignEmpty("ID_COMPTE_PCE_SERVICE")) {
compteSelService.setValue(row.getForeignID("ID_COMPTE_PCE_SERVICE"));
}
if (row.getFields().contains("ID_COMPTE_PCE_PRODUIT") && !row.isForeignEmpty("ID_COMPTE_PCE_PRODUIT")) {
totalTTC.setDefaultCompteProduit(row.getForeign("ID_COMPTE_PCE_PRODUIT"));
}
}
 
if (row.getTable().contains("ID_COMPTE_PCE_PRODUIT") && !row.isForeignEmpty("ID_COMPTE_PCE_PRODUIT")) {
totalTTC.setDefaultCompteProduit(row.getForeign("ID_COMPTE_PCE_PRODUIT"));
}
if (row != null) {
if (SaisieVenteFactureSQLComponent.this.contact != null) {
Where w = new Where(SaisieVenteFactureSQLComponent.this.eltContact.getTable().getField("ID_CLIENT"), "=", SQLRow.NONEXISTANT_ID);
929,7 → 984,6
return;
final SQLRow row = ((SQLRequestComboBox) evt.getSource()).getSelectedRow();
if (row != null) {
SaisieVenteFactureSQLComponent.this.defaultContactRowValues.putForeignID("ID_CLIENT", row);
if (SaisieVenteFactureSQLComponent.this.client.getTable().contains("ID_TARIF")) {
SQLRowAccessor foreignRow = row.getForeignRow("ID_TARIF");
if (foreignRow != null && !foreignRow.isUndefined() && (boxTarif.getSelectedRow() == null || boxTarif.getSelectedId() != foreignRow.getID())) {
1182,7 → 1236,9
}
super.select(r);
 
if (r != null) {
if (r != null)
 
{
// this.tableFacture.getModel().clearRows();
// this.tableFacture.insertFrom("ID_SAISIE_VENTE_FACTURE", r.getID());
Boolean b = (Boolean) r.getObject("ACOMPTE");
1225,8 → 1281,34
long lFactureOld = 0;
SQLRow rowFactureOld = null;
SQLRow rowFacture = null;
SQLElement eltMvtStock = Configuration.getInstance().getDirectory().getElement("MOUVEMENT_STOCK");
if (this.textNumeroUnique.checkValidation()) {
int attempt = 0;
// on verifie qu'un devis du meme numero n'a pas été inséré entre temps
if (!this.textNumeroUnique.checkValidation(false)) {
while (attempt < JUniqueTextField.RETRY_COUNT) {
String num = NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), dateSaisie.getDate());
this.textNumeroUnique.setText(num);
attempt++;
if (this.textNumeroUnique.checkValidation(false)) {
System.err.println("ATEMPT " + attempt + " SUCCESS WITH NUMERO " + num);
break;
}
try {
Thread.sleep(JUniqueTextField.SLEEP_WAIT_MS);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
final String num = this.textNumeroUnique.getText();
if (attempt == JUniqueTextField.RETRY_COUNT) {
idSaisieVF = getSelectedID();
ExceptionHandler.handle("Impossible d'ajouter, numéro de facture existant.");
final Object root = SwingUtilities.getRoot(this);
if (root instanceof EditFrame) {
final EditFrame frame = (EditFrame) root;
frame.getPanel().setAlwaysVisible(true);
}
} else {
try {
if (getMode() == Mode.INSERTION) {
idSaisieVF = super.insert(order);
1355,16 → 1437,16
createDocument(rowFacture);
 
}
if (attempt > 0) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JOptionPane.showMessageDialog(null, "Le numéro a été actualisé en " + num);
}
});
}
} catch (Exception e) {
ExceptionHandler.handle("", e);
}
} else {
ExceptionHandler.handle("Impossible d'ajouter, numéro de facture existant.");
Object root = SwingUtilities.getRoot(this);
if (root instanceof EditFrame) {
EditFrame frame = (EditFrame) root;
frame.getPanel().setAlwaysVisible(true);
}
}
return idSaisieVF;
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/quote/element/DevisItemSQLElement.java
28,7 → 28,6
import org.openconcerto.sql.view.list.IListe;
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.FileUtils;
 
79,14 → 78,6
return l;
}
 
@Override
protected SQLTableModelSourceOnline createTableSource() {
 
SQLTableModelSourceOnline table = super.createTableSource();
 
return table;
}
 
protected List<String> getComboFields() {
final List<String> l = new ArrayList<String>();
l.add("CODE");
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/quote/element/DevisSQLElement.java
46,7 → 46,6
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.model.graph.Path;
import org.openconcerto.sql.request.ListSQLRequest;
import org.openconcerto.sql.sqlobject.ElementComboBoxUtils;
import org.openconcerto.sql.users.UserManager;
import org.openconcerto.sql.users.rights.UserRightsManager;
import org.openconcerto.sql.view.EditFrame;
58,7 → 57,7
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
import org.openconcerto.sql.view.list.RowAction;
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
import org.openconcerto.sql.view.list.SQLTableModelSource;
import org.openconcerto.ui.light.ActivationOnSelectionControler;
import org.openconcerto.ui.light.ColumnSpec;
import org.openconcerto.ui.light.ColumnsSpec;
546,9 → 545,8
}
 
@Override
protected SQLTableModelSourceOnline createTableSource() {
SQLTableModelSourceOnline table = super.createTableSource();
 
protected synchronized void _initTableSource(final SQLTableModelSource table) {
super._initTableSource(table);
final BaseSQLTableModelColumn colAdrLiv = new BaseSQLTableModelColumn("Adresse de livraison", String.class) {
 
@Override
588,8 → 586,6
};
table.getColumns().add(3, colAdrLiv);
 
 
return table;
}
 
@Override
646,8 → 642,9
}
 
@Override
protected Map<String, CustomEditorProvider> getDefaultCustomEditorProvider(final Configuration configuration, final SQLRowValues sqlRow, long userId) throws IllegalArgumentException {
final Map<String, CustomEditorProvider> map = super.getDefaultCustomEditorProvider(configuration, sqlRow, userId);
protected Map<String, CustomEditorProvider> _getDefaultCustomEditorProvider(final Configuration configuration, final SQLRowAccessor sqlRow, final String sessionSecurityToken)
throws IllegalArgumentException {
final Map<String, CustomEditorProvider> map = super._getDefaultCustomEditorProvider(configuration, sqlRow, sessionSecurityToken);
map.put("sales.quote.items.list", new CustomEditorProvider() {
 
@Override
687,6 → 684,9
if (w3cDoc != null) {
columnsPrefs = in.build(w3cDoc);
}
if (columnsPrefs == null) {
throw new IllegalStateException("Columns Prefs is null");
}
} catch (Exception ex) {
throw new IllegalArgumentException(
"DevisSQLElement getItemsCustomEditorProvider - Failed to get ColumnPrefs for descriptor " + lId + " and for user " + userId + "\n" + ex.getMessage());
747,21 → 747,22
 
if (sqlRow != null) {
// send: id,value
final SQLTable table = configuration.getDirectory().getElement("DEVIS_ELEMENT").getTable();
final List<SQLField> fieldsToFetch = new ArrayList<SQLField>();
final SQLElement elem = configuration.getDirectory().getElement("DEVIS_ELEMENT");
final SQLTable table = elem.getTable();
final List<String> fieldsToFetch = new ArrayList<String>();
for (ColumnSpec cs : columnsSpec) {
String colId = cs.getId();
SQLField f = configuration.getFieldMapper().getSQLFieldForItem(colId);
if (f != null) {
fieldsToFetch.add(f);
fieldsToFetch.add(f.getName());
} else {
throw new IllegalStateException("No field in " + table + " for column id " + colId);
}
}
 
final Where where = new Where(table.getKey(), "=", sqlRow.getID());
final SQLRowValues graph = ElementComboBoxUtils.getGraphToFetch(configuration, table, fieldsToFetch);
List<SQLRowValues> fetchedRows = ElementComboBoxUtils.fetchRows(graph, where);
final Where where = new Where(table.getField("ID_DEVIS"), "=", sqlRow.getID());
final ListSQLRequest req = elem.createListRequest(fieldsToFetch, where, configuration.getShowAs());
List<SQLRowValues> fetchedRows = req.getValues();
 
List<Row> rows = new ArrayList<Row>();
for (final SQLRowValues vals : fetchedRows) {
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/quote/ui/EtatDevisRenderer.java
37,7 → 37,7
 
public final static Color couleurRed = new Color(255, 232, 245);
 
private final static DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM);
private final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM);
 
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/quote/ui/QuoteSQLComponent.java
63,6 → 63,8
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
 
import com.ibm.icu.math.BigDecimal;
 
public class QuoteSQLComponent extends GroupSQLComponent {
 
public static final String ID = "sales.quote";
147,8 → 149,9
final DeviseField totalTVA = (DeviseField) getEditor("T_TVA");
final DeviseField totalRemise = (DeviseField) getEditor("REMISE_HT");
final DeviseField totalPORT = (DeviseField) getEditor("PORT_HT");
final DeviseField totalEco = (DeviseField) getEditor("T_ECO_CONTRIBUTION");
 
return new TotalPanel(items, totalHT, totalTVA, totalTTC, totalRemise, totalPORT, totalService, totalSupply, totalDevise, totalWeight, null);
return new TotalPanel(items, totalEco, totalHT, totalTVA, totalTTC, totalRemise, totalPORT, totalService, totalSupply, totalDevise, totalWeight, null);
} else if (id.startsWith("T_")) {
return new DeviseField();
} else if (id.equals("REMISE_HT") || id.equals("PORT_HT") || id.equals("PREBILAN")) {
420,6 → 423,7
 
}
rowVals.put("DATE", new Date());
rowVals.put("T_ECO_CONTRIBUTION", BigDecimal.ZERO);
rowVals.put("T_HT", Long.valueOf(0));
rowVals.put("T_TVA", Long.valueOf(0));
rowVals.put("T_SERVICE", Long.valueOf(0));
461,6 → 465,7
super.addViews();
 
final DeviseField totalHT = (DeviseField) getEditor("T_HT");
final DeviseField totalEco = (DeviseField) getEditor("T_ECO_CONTRIBUTION");
final DeviseField totalService = (DeviseField) getEditor("T_SERVICE");
final DeviseField totalSupply = (DeviseField) getEditor("T_HA");
final DeviseField totalDevise = (DeviseField) getEditor("T_DEVISE");
475,6 → 480,7
}
 
this.addView(totalPORT, "PORT_HT");
this.addView(totalEco, "T_ECO_CONTRIBUTION");
this.addView(totalRemise, "REMISE_HT");
this.addView(totalTVA, "T_TVA");
this.addView(totalTTC, "T_TTC");
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/quote/ui/ListeDesDevisPanel.java
23,27 → 23,34
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.model.AliasedTable;
import org.openconcerto.sql.model.FieldPath;
import org.openconcerto.sql.model.SQLBackgroundTableCache;
import org.openconcerto.sql.model.SQLField;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.TableRef;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.model.graph.Path;
import org.openconcerto.sql.model.graph.PathBuilder;
import org.openconcerto.sql.users.UserManager;
import org.openconcerto.sql.users.rights.UserRights;
import org.openconcerto.sql.users.rights.UserRightsManager;
import org.openconcerto.sql.view.ListeAddPanel;
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
import org.openconcerto.sql.view.list.IListe;
import org.openconcerto.sql.view.list.ITableModel;
import org.openconcerto.sql.view.list.SQLTableModelColumn;
import org.openconcerto.sql.view.list.SQLTableModelColumnPath;
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.table.PercentTableCellRenderer;
import org.openconcerto.ui.table.TableCellRendererDecorator;
import org.openconcerto.ui.table.TableCellRendererUtils;
import org.openconcerto.ui.table.TimestampTableCellRenderer;
import org.openconcerto.utils.CollectionUtils;
import org.openconcerto.utils.DecimalUtils;
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.SwingWorker2;
import org.openconcerto.utils.Tuple2;
import org.openconcerto.utils.cc.ITransformer;
 
53,11 → 60,12
import java.awt.GridBagLayout;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.Date;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
86,29 → 94,19
this.map.put(this.tabbedPane.getTabCount(), panelAll);
this.tabbedPane.add("Tous", panelAll);
 
// En cours
ListeAddPanel panelCours = createPanel(EtatDevisSQLElement.EN_COURS);
this.map.put(this.tabbedPane.getTabCount(), panelCours);
List<SQLRow> rowsEtat = SQLBackgroundTableCache.getInstance().getCacheForTable(eltEtatDevis.getTable()).getRows();
 
this.tabbedPane.add(" ", panelCours);
// Date panel
Map<IListe, SQLField> mapDate = new HashMap<IListe, SQLField>();
 
// Attente
ListeAddPanel panelAttente = createPanel(EtatDevisSQLElement.EN_ATTENTE);
this.map.put(this.tabbedPane.getTabCount(), panelAttente);
this.tabbedPane.add(" ", panelAttente);
for (SQLRow sqlRow : rowsEtat) {
ListeAddPanel p = createPanel(sqlRow.getID());
this.map.put(this.tabbedPane.getTabCount(), p);
this.tabbedPane.add(sqlRow.getString("NOM"), p);
mapDate.put(p.getListe(), eltDevis.getTable().getField("DATE"));
}
 
// Accepte
ListeAddPanel panelAccepte = createPanel(EtatDevisSQLElement.ACCEPTE);
this.map.put(this.tabbedPane.getTabCount(), panelAccepte);
this.tabbedPane.add(" ", panelAccepte);
 
// Refuse
ListeAddPanel panelRefuse = createPanel(EtatDevisSQLElement.REFUSE);
this.map.put(this.tabbedPane.getTabCount(), panelRefuse);
this.tabbedPane.add(" ", panelRefuse);
Map<IListe, SQLField> mapDate = new HashMap<IListe, SQLField>();
 
 
this.tabbedPane.setSelectedIndex(1);
 
c.weightx = 1;
120,11 → 118,6
this.add(this.tabbedPane, c);
 
// Date panel
 
mapDate.put(panelAttente.getListe(), eltDevis.getTable().getField("DATE"));
mapDate.put(panelAccepte.getListe(), eltDevis.getTable().getField("DATE"));
mapDate.put(panelRefuse.getListe(), eltDevis.getTable().getField("DATE"));
mapDate.put(panelCours.getListe(), eltDevis.getTable().getField("DATE"));
mapDate.put(panelAll.getListe(), eltDevis.getTable().getField("DATE"));
 
final IListFilterDatePanel datePanel = new IListFilterDatePanel(mapDate, IListFilterDatePanel.getDefaultMap());
133,56 → 126,11
c.weighty = 0;
datePanel.setFilterOnDefault();
this.add(datePanel, c);
initTabTitles();
}
 
 
private void initTabTitles() {
SwingWorker2<List<String>, Object> worker = new SwingWorker2<List<String>, Object>() {
protected void setRenderer(SQLTableModelSourceOnline source) {
 
@Override
protected List<String> doInBackground() throws Exception {
final SQLSelect quoteStates = new SQLSelect();
final SQLTable quoteStatesTable = eltEtatDevis.getTable();
quoteStates.addSelect(quoteStatesTable.getKey());
quoteStates.addSelect(quoteStatesTable.getField("NOM"));
final List<Integer> labelIds = Arrays.asList(EtatDevisSQLElement.EN_COURS, EtatDevisSQLElement.EN_ATTENTE, EtatDevisSQLElement.ACCEPTE, EtatDevisSQLElement.REFUSE);
quoteStates.setWhere(new Where(quoteStatesTable.getKey(), true, labelIds));
@SuppressWarnings("unchecked")
final List<Map<String, Object>> values = quoteStatesTable.getDBSystemRoot().getDataSource().execute(quoteStates.asString());
final List<String> tabNames = new ArrayList<String>();
 
final String keyFieldName = quoteStatesTable.getKey().getName();
for (Integer id : labelIds) {
for (Map<String, Object> m : values) {
if (m.get(keyFieldName).equals(id)) {
tabNames.add(m.get("NOM").toString());
break;
}
}
}
 
return tabNames;
}
 
@Override
protected void done() {
final List<String> tabNames;
try {
tabNames = get();
for (int index = 0; index < tabNames.size(); index++) {
tabbedPane.setTitleAt(index + 1, tabNames.get(index));
}
} catch (Exception e) {
ExceptionHandler.handle("Unable to set tab names", e);
}
}
};
worker.execute();
 
}
 
protected void setRenderer(SQLTableModelSourceOnline source) {
final SQLTableModelColumn column = source.getColumn(this.eltDevis.getTable().getField("DUNNING_DATE"));
if (column != null) {
column.setRenderer(new TimestampTableCellRenderer(false, false) {
284,48 → 232,59
// Filter
final SQLTableModelSourceOnline lAttente = this.eltDevis.getTableSource(true);
final SQLTableModelColumnPath dateEnvoiCol;
if (this.eltDevis.getTable().contains("DATE_REMISE_DOSSIER") && !(idFilter == EtatDevisSQLElement.EN_ATTENTE || idFilter == EtatDevisSQLElement.EN_COURS)) {
// SPADE
SQLTableModelColumn col = lAttente.getColumn(this.eltDevis.getTable().getField("REMIND_DATE"));
if (col != null) {
lAttente.getColumns().remove(col);
}
}
if (idFilter == EtatDevisSQLElement.ACCEPTE) {
dateEnvoiCol = new SQLTableModelColumnPath(this.eltDevis.getTable().getField("DATE_ENVOI"));
lAttente.getColumns().add(dateEnvoiCol);
dateEnvoiCol.setRenderer(new DateEnvoiRenderer());
dateEnvoiCol.setEditable(true);
if (!this.eltDevis.getTable().contains("DATE_REMISE_DOSSIER")) {
dateEnvoiCol = new SQLTableModelColumnPath(this.eltDevis.getTable().getField("DATE_ENVOI"));
lAttente.getColumns().add(dateEnvoiCol);
dateEnvoiCol.setRenderer(new DateEnvoiRenderer());
dateEnvoiCol.setEditable(true);
final BaseSQLTableModelColumn colAvancementCmd = new BaseSQLTableModelColumn("Commande", BigDecimal.class) {
 
final BaseSQLTableModelColumn colAvancementCmd = new BaseSQLTableModelColumn("Commande", BigDecimal.class) {
@Override
protected Object show_(SQLRowAccessor r) {
 
@Override
protected Object show_(SQLRowAccessor r) {
return getAvancementCommande(r);
}
 
return getAvancementCommande(r);
}
@Override
public Set<FieldPath> getPaths() {
final Path p = new PathBuilder(eltDevis.getTable()).addTable("TR_DEVIS").addTable("COMMANDE_CLIENT").build();
return CollectionUtils.createSet(new FieldPath(p, "T_HT"));
}
};
lAttente.getColumns().add(colAvancementCmd);
colAvancementCmd.setRenderer(new PercentTableCellRenderer());
 
@Override
public Set<FieldPath> getPaths() {
final Path p = new PathBuilder(eltDevis.getTable()).addTable("TR_DEVIS").addTable("COMMANDE_CLIENT").build();
return CollectionUtils.createSet(new FieldPath(p, "T_HT"));
}
};
lAttente.getColumns().add(colAvancementCmd);
colAvancementCmd.setRenderer(new PercentTableCellRenderer());
final BaseSQLTableModelColumn colAvancement = new BaseSQLTableModelColumn("Facturation", BigDecimal.class) {
 
final BaseSQLTableModelColumn colAvancement = new BaseSQLTableModelColumn("Facturation", BigDecimal.class) {
@Override
protected Object show_(SQLRowAccessor r) {
 
@Override
protected Object show_(SQLRowAccessor r) {
return getAvancementFacture(r);
}
 
return getAvancementFacture(r);
}
@Override
public Set<FieldPath> getPaths() {
final Path p = new PathBuilder(eltDevis.getTable()).addTable("TR_DEVIS").addTable("SAISIE_VENTE_FACTURE").build();
final Path p2 = new PathBuilder(eltDevis.getTable()).addTable("TR_DEVIS").addTable("COMMANDE_CLIENT").addTable("TR_COMMANDE_CLIENT").addTable("SAISIE_VENTE_FACTURE").build();
final Path p3 = new PathBuilder(eltDevis.getTable()).addTable("TR_DEVIS").addTable("COMMANDE_CLIENT").addTable("TR_COMMANDE_CLIENT").addTable("BON_DE_LIVRAISON")
.addTable("TR_BON_DE_LIVRAISON").addTable("SAISIE_VENTE_FACTURE").build();
return CollectionUtils.createSet(new FieldPath(p, "T_HT"), new FieldPath(p2, "T_HT"), new FieldPath(p3, "T_HT"));
}
};
lAttente.getColumns().add(colAvancement);
colAvancement.setRenderer(new PercentTableCellRenderer());
} else {
dateEnvoiCol = null;
 
@Override
public Set<FieldPath> getPaths() {
final Path p = new PathBuilder(eltDevis.getTable()).addTable("TR_DEVIS").addTable("SAISIE_VENTE_FACTURE").build();
final Path p2 = new PathBuilder(eltDevis.getTable()).addTable("TR_DEVIS").addTable("COMMANDE_CLIENT").addTable("TR_COMMANDE_CLIENT").addTable("SAISIE_VENTE_FACTURE").build();
final Path p3 = new PathBuilder(eltDevis.getTable()).addTable("TR_DEVIS").addTable("COMMANDE_CLIENT").addTable("TR_COMMANDE_CLIENT").addTable("BON_DE_LIVRAISON")
.addTable("TR_BON_DE_LIVRAISON").addTable("SAISIE_VENTE_FACTURE").build();
return CollectionUtils.createSet(new FieldPath(p, "T_HT"), new FieldPath(p2, "T_HT"), new FieldPath(p3, "T_HT"));
}
};
lAttente.getColumns().add(colAvancement);
colAvancement.setRenderer(new PercentTableCellRenderer());
}
} else {
dateEnvoiCol = null;
}
356,6 → 315,7
}
 
setRenderer(lAttente);
 
// one config file per idFilter since they haven't the same number of
// columns
final ListeAddPanel pane = new ListeAddPanel(this.eltDevis, new IListe(lAttente), "idFilter" + idFilter);
381,7 → 341,10
return null;
}
}, IListTotalPanel.Type.MOYENNE_MARGE));
total = new IListTotalPanel(pane.getListe(), fields, null, "Total Global");
 
List<Tuple2<SQLField, ?>> filter = new ArrayList<Tuple2<SQLField, ?>>();
filter.add(Tuple2.create(this.eltDevis.getTable().getField("PREBILAN"), Long.valueOf(0)));
total = new IListTotalPanel(pane.getListe(), fields, null, filter, "Total Global (si budget prév. >0)");
} else if (this.eltDevis.getTable().getFieldsName().contains("T_HA") && pane.getListe().getSource().getColumns(this.eltDevis.getTable().getField("T_HA")) != null
&& UserRightsManager.getCurrentUserRights().haveRight(AbstractVenteArticleItemTable.SHOW_PRIX_ACHAT_CODE)) {
total = new IListTotalPanel(pane.getListe(), Arrays.asList(this.eltDevis.getTable().getField("T_HA"), this.eltDevis.getTable().getField("T_HT")));
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/quote/component/DevisSQLComponent.java
14,6 → 14,7
package org.openconcerto.erp.core.sales.quote.component;
 
import static org.openconcerto.utils.CollectionUtils.createSet;
 
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.erp.core.common.element.NumerotationAutoSQLElement;
47,9 → 48,11
import org.openconcerto.sql.preferences.SQLPreferences;
import org.openconcerto.sql.sqlobject.ElementComboBox;
import org.openconcerto.sql.sqlobject.JUniqueTextField;
import org.openconcerto.sql.sqlobject.SQLRequestComboBox;
import org.openconcerto.sql.sqlobject.SQLTextCombo;
import org.openconcerto.sql.ui.RadioButtons;
import org.openconcerto.sql.users.UserManager;
import org.openconcerto.sql.users.rights.UserRightsManager;
import org.openconcerto.sql.view.EditFrame;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.FormLayouter;
59,7 → 62,6
import org.openconcerto.ui.component.ITextArea;
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.GestionDevise;
import org.openconcerto.utils.SwingWorker2;
import org.openconcerto.utils.cc.ITransformer;
import org.openconcerto.utils.checks.ValidState;
import org.openconcerto.utils.text.SimpleDocumentListener;
93,6 → 95,8
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.SwingWorker;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.even