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/.classpath
38,5 → 38,7
<classpathentry kind="lib" path="lib/json-smart-1.3.1.jar"/>
<classpathentry kind="lib" path="lib/icu4j-56_1-module_format+calendar.jar"/>
<classpathentry kind="lib" path="lib/icu4j-56-data-western_europe.jar"/>
<classpathentry kind="lib" path="lib/DS_Desktop_Notify.jar"/>
<classpathentry kind="lib" path="lib/mime_util.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
/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: OpenConcerto/lib/json-smart-2.2.1.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: OpenConcerto/lib/json-smart-2.2.1.jar
===================================================================
--- OpenConcerto/lib/json-smart-2.2.1.jar (revision 0)
+++ OpenConcerto/lib/json-smart-2.2.1.jar (revision 142)
/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: OpenConcerto/lib/jOpenCalendar.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: 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: OpenConcerto/lib/mysql-connector-java-5.1.40-bin.jar
===================================================================
--- OpenConcerto/lib/mysql-connector-java-5.1.40-bin.jar (revision 0)
+++ OpenConcerto/lib/mysql-connector-java-5.1.40-bin.jar (revision 142)
/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: OpenConcerto/lib/accessors-smart-1.1.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: OpenConcerto/lib/accessors-smart-1.1.jar
===================================================================
--- OpenConcerto/lib/accessors-smart-1.1.jar (revision 0)
+++ OpenConcerto/lib/accessors-smart-1.1.jar (revision 142)
/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: OpenConcerto/lib/icudata_56.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: OpenConcerto/lib/icudata_56.jar
===================================================================
--- OpenConcerto/lib/icudata_56.jar (revision 0)
+++ OpenConcerto/lib/icudata_56.jar (revision 142)
/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: OpenConcerto/lib/DS_Desktop_Notify.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: OpenConcerto/lib/DS_Desktop_Notify.jar
===================================================================
--- OpenConcerto/lib/DS_Desktop_Notify.jar (revision 0)
+++ OpenConcerto/lib/DS_Desktop_Notify.jar (revision 142)
/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: OpenConcerto/src/product.properties
===================================================================
--- OpenConcerto/src/product.properties (revision 141)
+++ OpenConcerto/src/product.properties (revision 142)
@@ -1,2 +1,5 @@
NAME=OpenConcerto
-VERSION=1.4.2
\ No newline at end of file
+VERSION=1.5
+ORGANIZATION_NAME=OpenConcerto
+ORGANIZATION_ID=org.openconcerto
+
Index: OpenConcerto/src/org/jopenchart/sample/devguide/PieChartSample.java
===================================================================
--- OpenConcerto/src/org/jopenchart/sample/devguide/PieChartSample.java (revision 141)
+++ OpenConcerto/src/org/jopenchart/sample/devguide/PieChartSample.java (revision 142)
@@ -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/task/TodoListPanel.java
14,8 → 14,11
package org.openconcerto.task;
 
import static org.openconcerto.task.TM.getTM;
 
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.model.DBSystemRoot;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowListRSH;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.SQLTable;
38,7 → 41,6
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.SwingWorker2;
import org.openconcerto.utils.TableSorter;
import org.openconcerto.utils.Tuple3;
import org.openconcerto.utils.cc.ITransformer;
 
import java.awt.Color;
55,8 → 57,6
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.net.URL;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
95,8 → 95,6
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
 
import org.apache.commons.dbutils.ResultSetHandler;
 
public class TodoListPanel extends JPanel implements ModelStateListener {
 
// Actions
263,10 → 261,10
}
 
private void initViewableUsers(final User currentUser) {
final SwingWorker2<List<Tuple3<String, Integer, String>>, Object> worker = new SwingWorker2<List<Tuple3<String, Integer, String>>, Object>() {
final SwingWorker2<List<User>, Object> worker = new SwingWorker2<List<User>, Object>() {
 
@Override
protected List<Tuple3<String, Integer, String>> doInBackground() throws Exception {
protected List<User> doInBackground() throws Exception {
final List<Integer> canViewUsers = new ArrayList<Integer>();
for (final UserTaskRight right : UserTaskRight.getUserTaskRight(currentUser)) {
if (right.canRead())
276,30 → 274,15
final SQLTable userT = UserManager.getInstance().getTable();
final DBSystemRoot systemRoot = Configuration.getInstance().getSystemRoot();
final SQLSelect select1 = new SQLSelect(systemRoot, false);
select1.addSelect(userT.getKey());
select1.addSelect(userT.getField("NOM"));
select1.addSelect(userT.getField("PRENOM"));
select1.addSelect(userT.getField("SURNOM"));
select1.addSelectStar(userT);
final Where meWhere = new Where(userT.getKey(), "=", currentUser.getId());
final Where canViewWhere = new Where(userT.getKey(), canViewUsers);
select1.setWhere(meWhere.or(canViewWhere));
 
final List<Tuple3<String, Integer, String>> result = new ArrayList<Tuple3<String, Integer, String>>();
userT.getDBSystemRoot().getDataSource().execute(select1.asString(), new ResultSetHandler() {
public Object handle(ResultSet rs) throws SQLException {
while (rs.next()) {
String displayName = rs.getString(4).trim();
if (displayName.length() == 0) {
displayName = rs.getString(3).trim() + " " + rs.getString(2).trim().toUpperCase();
}
final int uId = rs.getInt(1);
final String name = rs.getString(2);
result.add(new Tuple3<String, Integer, String>(displayName, uId, name));
 
}
return null;
}
});
final List<User> result = new ArrayList<User>();
for (final SQLRow r : SQLRowListRSH.execute(select1)) {
result.add(new User(r));
}
return result;
}
 
306,15 → 289,18
@Override
protected void done() {
try {
final List<Tuple3<String, Integer, String>> tuples = get();
for (Tuple3<String, Integer, String> tuple3 : tuples) {
final JCheckBoxMenuItem checkBoxMenuItem = new JCheckBoxMenuItem(tuple3.get0());
final List<User> tuples = get();
for (final User user : tuples) {
String displayName = user.getNickName();
if (displayName.length() == 0) {
displayName = user.getFirstName() + " " + user.getName().toUpperCase();
}
final JCheckBoxMenuItem checkBoxMenuItem = new JCheckBoxMenuItem(displayName);
TodoListPanel.this.comboUser.add(checkBoxMenuItem);
 
final int uId = tuple3.get1();
final String name = tuple3.get2();
final int uId = user.getId();
 
TodoListPanel.this.users.add(new User(uId, name));
TodoListPanel.this.users.add(user);
checkBoxMenuItem.addActionListener(new ActionListener() {
 
public void actionPerformed(ActionEvent e) {
/trunk/OpenConcerto/src/org/openconcerto/task/config/TaskPropsConfiguration.java
36,7 → 36,7
try {
// try to read the file from within the jar, but allow it to be overridden by an
// external file
final File confFile = getConfFile(PRODUCT_INFO.getName());
final File confFile = getConfFile(PRODUCT_INFO);
final Properties props;
if (confFile.exists()) {
props = create(new FileInputStream(confFile), defaults);
/trunk/OpenConcerto/src/org/openconcerto/task/config/ComptaBasePropsConfiguration.java
13,18 → 13,6
package org.openconcerto.task.config;
 
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.Collections;
import java.util.Properties;
 
import javax.swing.JOptionPane;
 
import com.jcraft.jsch.Session;
 
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.PropsConfiguration;
import org.openconcerto.sql.element.ConfSQLElement;
39,26 → 27,36
import org.openconcerto.sql.users.UserCommonSQLElement;
import org.openconcerto.sql.users.rights.RightSQLElement;
import org.openconcerto.sql.users.rights.UserRightSQLElement;
import org.openconcerto.task.element.FWKListPrefs;
import org.openconcerto.task.element.FWKSessionState;
import org.openconcerto.task.element.TaskRightSQLElement;
import org.openconcerto.task.element.TaskSQLElement;
import org.openconcerto.utils.BaseDirs;
import org.openconcerto.utils.DesktopEnvironment;
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.LogUtils;
import org.openconcerto.utils.ProductInfo;
 
import java.awt.GraphicsEnvironment;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.Collections;
import java.util.Properties;
 
import javax.swing.JFrame;
import javax.swing.JOptionPane;
 
import com.jcraft.jsch.Session;
 
public abstract class ComptaBasePropsConfiguration extends PropsConfiguration {
 
public abstract void setUpSocieteDataBaseConnexion(int base);
 
public static File getConfFile(final String appName) {
return getConfFile(appName, new File("."));
}
 
public static File getConfFile(final String appName, final File wd) {
public static File getConfFile(final ProductInfo info) {
final String confFilePath = System.getProperty("gestion.confFile");
final File wdFile = new File(wd + "/Configuration", "main.properties");
final File wdFile = new File("Configuration", "main.properties");
final File confFile;
if (confFilePath != null) {
confFile = new File(confFilePath);
65,7 → 63,17
} else if (wdFile.isFile()) {
confFile = wdFile;
} else {
confFile = new File(DesktopEnvironment.getDE().getPreferencesFolder(appName), "main.properties");
// we added organisation name, so migrate preferences
final File prefsFolder = BaseDirs.create(info).getPreferencesFolder();
if (!prefsFolder.exists()) {
try {
final File oldDir = DesktopEnvironment.getDE().getPreferencesFolder(info.getName());
Configuration.migrateToNewDir(oldDir, prefsFolder);
} catch (IOException ex) {
throw new IllegalStateException("Couldn't migrate preferences dir", ex);
}
}
confFile = new File(prefsFolder, "main.properties");
}
return confFile;
}
128,9 → 136,11
try {
Thread.sleep(1000);
if (!conn.isConnected()) {
JOptionPane.showMessageDialog(null, "Coupure réseau", "Liaison sécurisée déconnectée!\nVérifiez votre connexion internet et relancez le logiciel.",
JOptionPane.ERROR_MESSAGE);
System.exit(1);
if (!GraphicsEnvironment.isHeadless()) {
JOptionPane.showMessageDialog(null, "Liaison sécurisée déconnectée!\nVérifiez votre connexion internet et relancez le logiciel.");
} else {
ExceptionHandler.die("Liaison sécurisée déconnectée!\nVérifiez votre connexion internet et relancez le logiciel.");
}
break;
}
} catch (InterruptedException e) {
/trunk/OpenConcerto/src/org/openconcerto/erp/action/AboutAction.java
13,15 → 13,26
package org.openconcerto.erp.action;
 
import org.openconcerto.erp.config.Benchmark;
import org.openconcerto.sql.ui.InfoPanel;
import org.openconcerto.ui.JLabelBold;
import org.openconcerto.ui.ReloadPanel;
 
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
 
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
 
public final class AboutAction extends AbstractAction {
 
39,8 → 50,13
@Override
public void actionPerformed(final ActionEvent event) {
final JFrame frame = new JFrame((String) this.getValue(Action.NAME));
JPanel p = new JPanel();
p.setLayout(new BorderLayout());
 
final JScrollPane contentPane = new JScrollPane(new InfoPanel());
frame.setContentPane(contentPane);
p.add(contentPane, BorderLayout.CENTER);
p.add(createBenchMarkPanel(), BorderLayout.SOUTH);
frame.setContentPane(p);
frame.pack();
 
final Dimension size = frame.getSize();
62,4 → 78,71
 
frame.setVisible(true);
}
 
private JPanel createBenchMarkPanel() {
final JPanel p = new JPanel();
p.setLayout(new FlowLayout(FlowLayout.LEFT));
final JLabel lt = new JLabelBold("Test de performance : ");
p.add(lt);
final JLabel l = new JLabel("CLiquez sur démarrer pour lancer le test");
p.add(l);
final JButton b = new JButton("Démarrer");
p.add(b);
final ReloadPanel r = new ReloadPanel();
p.add(r);
b.addActionListener(new ActionListener() {
 
@Override
public void actionPerformed(ActionEvent e) {
l.setText("Test en cours");
b.setEnabled(false);
r.setMode(ReloadPanel.MODE_ROTATE);
SwingWorker<String, String> s = new SwingWorker<String, String>() {
 
@Override
protected String doInBackground() throws Exception {
Benchmark bench = new Benchmark();
String s = "";
s += "Base de données : " + bench.testDB();
final String s1 = s;
SwingUtilities.invokeLater(new Runnable() {
 
@Override
public void run() {
l.setText(s1);
 
}
});
s += " - Processeur : " + bench.testCPU();
final String s2 = s;
SwingUtilities.invokeLater(new Runnable() {
 
@Override
public void run() {
l.setText(s2);
 
}
});
s += " - Disque dur : " + bench.testWriteHD();
return s;
}
 
protected void done() {
b.setEnabled(true);
try {
String result = get();
l.setText(result);
r.setMode(ReloadPanel.MODE_EMPTY);
} catch (Exception e) {
r.setMode(ReloadPanel.MODE_BLINK);
e.printStackTrace();
}
};
};
s.execute();
 
}
});
return p;
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/action/NouvelleConnexionAction.java
248,8 → 248,10
// don't close ConnexionPanel until the main frame is shown
showMainFrame.get();
} catch (Throwable e) {
if (e.getMessage() != null && e.getMessage().contains("TR_BON_DE_LIVRAISON not found")) {
JOptionPane.showMessageDialog(new JFrame(), "Votre base de données n'est pas à jour.\nUtilisez l'outil de configuration et pensez à l'achat du manuel!!!");
if (e.getMessage() != null && ((e.getMessage().contains("table") && e.getMessage().contains("not found")) || e.getMessage().contains("unknown field")
|| e.getMessage().contains("Couldn't add showAs"))) {
JOptionPane.showMessageDialog(new JFrame(),
"Votre base de données n'est pas à jour.\nUtilisez l'outil de configuration et pensez à l'achat du manuel !\n(" + e.getMessage() + ")");
return;
}
ExceptionHandler.handle("Erreur de connexion", e);
306,6 → 308,7
Ville.init(new NXDatabaseAccessor(comptaConf), prefs.getBoolean(GestionClientPreferencePanel.LOAD_CITIES, true));
 
SQLBackgroundTableCache.getInstance().add(baseSociete.getTable("TAXE"), 600);
SQLBackgroundTableCache.getInstance().add(baseSociete.getTable("ETAT_DEVIS"), 600);
SQLBackgroundTableCache.getInstance().add(baseSociete.getTable("PREFS_COMPTE"), 600);
SQLBackgroundTableCache.getInstance().add(baseSociete.getTable("COMPTE_PCE"), 600);
SQLBackgroundTableCache.getInstance().add(baseSociete.getTable("JOURNAL"), 600);
/trunk/OpenConcerto/src/org/openconcerto/erp/action/CreateListFrameAbstractAction.java
58,7 → 58,7
 
// Create frame
final LightUIFrame frame = new LightUIFrame(elementCode);
frame.setTitle(frameTitle);
frame.createTitlePanel(frameTitle);
 
// Create table
final String tableId = element.getCode() + ".table";
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/CommandeFactureClientSQLInjector.java
28,6 → 28,7
final SQLTable tableCommande = getSource();
final SQLTable tableFacture = getDestination();
map(tableCommande.getField("ID_CLIENT"), tableFacture.getField("ID_CLIENT"));
map(tableCommande.getField("ID_COMMERCIAL"), tableFacture.getField("ID_COMMERCIAL"));
if (tableCommande.contains("ID_TAXE_PORT")) {
map(tableCommande.getField("ID_TAXE_PORT"), tableFacture.getField("ID_TAXE_PORT"));
}
34,6 → 35,9
if (tableCommande.contains("PORT_HT")) {
map(tableCommande.getField("PORT_HT"), tableFacture.getField("PORT_HT"));
}
if (tableCommande.contains("ACOMPTE_COMMANDE")) {
map(tableCommande.getField("ACOMPTE_COMMANDE"), tableFacture.getField("ACOMPTE_COMMANDE"));
}
if (tableCommande.contains("REMISE_HT")) {
map(tableCommande.getField("REMISE_HT"), tableFacture.getField("REMISE_HT"));
}
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/BonFactureEltSQLInjector.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.injector;
 
import org.openconcerto.sql.model.DBRoot;
import org.openconcerto.sql.model.SQLInjector;
 
public class BonFactureEltSQLInjector extends SQLInjector {
public BonFactureEltSQLInjector(final DBRoot root) {
super(root, "BON_DE_LIVRAISON_ELEMENT", "SAISIE_VENTE_FACTURE_ELEMENT", false);
createDefaultMap();
remove(getSource().getField("QTE"), getDestination().getField("QTE"));
map(getSource().getField("QTE_LIVREE"), getDestination().getField("QTE"));
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/CommandeBlSQLInjector.java
41,6 → 41,9
if (getSource().getTable().contains("ID_TARIF") && getDestination().getTable().contains("ID_TARIF")) {
map(getSource().getField("ID_TARIF"), getDestination().getField("ID_TARIF"));
}
if (tableBl.contains("ACOMPTE_COMMANDE")) {
map(getSource().getField("ACOMPTE_COMMANDE"), getDestination().getField("ACOMPTE_COMMANDE"));
}
if (tableBl.contains("CREATE_VIRTUAL_STOCK")) {
mapDefaultValues(tableBl.getField("CREATE_VIRTUAL_STOCK"), Boolean.FALSE);
}
54,6 → 57,12
if (tableBl.contains("REMISE_HT")) {
map(tableCmd.getField("REMISE_HT"), tableBl.getField("REMISE_HT"));
}
if (getSource().getTable().contains("ID_ADRESSE") && getDestination().contains("ID_ADRESSE")) {
map(getSource().getField("ID_ADRESSE"), getDestination().getField("ID_ADRESSE"));
}
if (getSource().getTable().contains("ID_ADRESSE_LIVRAISON")) {
map(getSource().getField("ID_ADRESSE_LIVRAISON"), getDestination().getField("ID_ADRESSE_LIVRAISON"));
}
}
 
@Override
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/CommandeFactureEltSQLInjector.java
Nouveau fichier
0,0 → 1,27
/*
* 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.injector;
 
import org.openconcerto.sql.model.DBRoot;
import org.openconcerto.sql.model.SQLInjector;
 
public class CommandeFactureEltSQLInjector extends SQLInjector {
public CommandeFactureEltSQLInjector(final DBRoot root) {
super(root, "COMMANDE_CLIENT_ELEMENT", "SAISIE_VENTE_FACTURE_ELEMENT", false);
createDefaultMap();
if (getDestination().contains("ID_COMMANDE_CLIENT_ELEMENT")) {
map(getSource().getKey(), getDestination().getField("ID_COMMANDE_CLIENT_ELEMENT"));
}
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/CommandeBlEltSQLInjector.java
21,5 → 21,8
super(root, "COMMANDE_CLIENT_ELEMENT", "BON_DE_LIVRAISON_ELEMENT", false);
createDefaultMap();
mapDefaultValues(getDestination().getField("QTE_LIVREE"), Integer.valueOf(0));
if (getDestination().contains("ID_COMMANDE_CLIENT_ELEMENT")) {
map(getSource().getKey(), getDestination().getField("ID_COMMANDE_CLIENT_ELEMENT"));
}
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/CommandeBrEltSQLInjector.java
Nouveau fichier
0,0 → 1,27
/*
* 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.injector;
 
import org.openconcerto.sql.model.DBRoot;
import org.openconcerto.sql.model.SQLInjector;
 
public class CommandeBrEltSQLInjector extends SQLInjector {
public CommandeBrEltSQLInjector(final DBRoot root) {
super(root, "COMMANDE_ELEMENT", "BON_RECEPTION_ELEMENT", false);
createDefaultMap();
if (getDestination().contains("ID_COMMANDE_ELEMENT")) {
map(getSource().getKey(), getDestination().getField("ID_COMMANDE_ELEMENT"));
}
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/DevisFactureSQLInjector.java
13,6 → 13,7
package org.openconcerto.erp.injector;
 
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.sql.model.DBRoot;
import org.openconcerto.sql.model.SQLInjector;
import org.openconcerto.sql.model.SQLRowAccessor;
22,11 → 23,14
import java.math.BigDecimal;
import java.util.Collection;
 
import com.ibm.icu.util.Calendar;
 
public class DevisFactureSQLInjector extends SQLInjector {
public DevisFactureSQLInjector(final DBRoot root) {
super(root, "DEVIS", "SAISIE_VENTE_FACTURE", true);
final SQLTable tableDevis = getSource();
final SQLTable tableFacture = getDestination();
 
map(tableDevis.getField("PORT_HT"), tableFacture.getField("PORT_HT"));
map(tableDevis.getField("REMISE_HT"), tableFacture.getField("REMISE_HT"));
map(tableDevis.getField("ID_CLIENT"), tableFacture.getField("ID_CLIENT"));
61,6 → 65,7
protected void merge(SQLRowAccessor srcRow, SQLRowValues rowVals) {
super.merge(srcRow, rowVals);
 
 
// Merge elements
final SQLTable tableElementSource = getSource().getTable("DEVIS_ELEMENT");
final SQLTable tableElementDestination = getSource().getTable("SAISIE_VENTE_FACTURE_ELEMENT");
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/BonFactureSQLInjector.java
40,6 → 40,12
if (getSource().getTable().contains("ID_CLIENT_DEPARTEMENT")) {
map(getSource().getField("ID_CLIENT_DEPARTEMENT"), getDestination().getField("ID_CLIENT_DEPARTEMENT"));
}
if (getSource().getTable().contains("ID_ADRESSE") && getDestination().contains("ID_ADRESSE")) {
map(getSource().getField("ID_ADRESSE"), getDestination().getField("ID_ADRESSE"));
}
if (getSource().getTable().contains("ID_ADRESSE_LIVRAISON")) {
map(getSource().getField("ID_ADRESSE_LIVRAISON"), getDestination().getField("ID_ADRESSE_LIVRAISON"));
}
if (tableBon.contains("ID_TAXE_PORT")) {
map(tableBon.getField("ID_TAXE_PORT"), tableFacture.getField("ID_TAXE_PORT"));
}
52,7 → 58,9
if (getSource().getTable().contains("ID_TARIF") && getDestination().getTable().contains("ID_TARIF")) {
map(getSource().getField("ID_TARIF"), getDestination().getField("ID_TARIF"));
}
 
if (getSource().getTable().contains("ACOMPTE_COMMANDE")) {
map(getSource().getField("ACOMPTE_COMMANDE"), getDestination().getField("ACOMPTE_COMMANDE"));
}
}
 
@Override
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/DevisBlSQLInjector.java
39,6 → 39,12
if (getSource().getTable().contains("ID_CLIENT_DEPARTEMENT")) {
map(getSource().getField("ID_CLIENT_DEPARTEMENT"), getDestination().getField("ID_CLIENT_DEPARTEMENT"));
}
if (getSource().getTable().contains("ID_ADRESSE") && getDestination().contains("ID_ADRESSE")) {
map(getSource().getField("ID_ADRESSE"), getDestination().getField("ID_ADRESSE"));
}
if (getSource().getTable().contains("ID_ADRESSE_LIVRAISON")) {
map(getSource().getField("ID_ADRESSE_LIVRAISON"), getDestination().getField("ID_ADRESSE_LIVRAISON"));
}
}
 
@Override
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/RecapFactureProvider.java
19,7 → 19,6
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.utils.GestionDevise;
 
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Collection;
import java.util.HashSet;
27,6 → 26,16
 
public class RecapFactureProvider implements SpreadSheetCellValueProvider {
 
private enum TypeRecapFactureProvider {
HT, TTC;
};
 
private final TypeRecapFactureProvider type;
 
public RecapFactureProvider(TypeRecapFactureProvider t) {
this.type = t;
}
 
public Object getValue(SpreadSheetCellValueContext context) {
SQLRowAccessor row = context.getRow();
Calendar c = row.getDate("DATE");
46,7 → 55,8
}
 
public static void register() {
SpreadSheetCellValueProviderManager.put("sales.account.history", new RecapFactureProvider());
SpreadSheetCellValueProviderManager.put("sales.account.history", new RecapFactureProvider(TypeRecapFactureProvider.HT));
SpreadSheetCellValueProviderManager.put("sales.account.history.ttc", new RecapFactureProvider(TypeRecapFactureProvider.TTC));
}
 
public String getPreviousAcompte(SQLRowAccessor sqlRowAccessor, Set<SQLRowAccessor> alreadyAdded, Calendar c) {
60,7 → 70,8
 
if (rowFact != null && !rowFact.isUndefined() && !alreadyAdded.contains(rowFact) && rowFact.getDate("DATE").before(c)) {
alreadyAdded.add(rowFact);
result.append(rowFact.getString("NUMERO") + " (" + GestionDevise.currencyToString(rowFact.getLong("T_HT")) + "€), ");
final String fieldTotal = this.type == TypeRecapFactureProvider.HT ? "T_HT" : "T_TTC";
result.append(rowFact.getString("NUMERO") + " (" + GestionDevise.currencyToString(rowFact.getLong(fieldTotal)) + "€), ");
}
}
 
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/AdresseFullClientValueProvider.java
34,46 → 34,59
if (this.withName) {
result = context.getRow().getForeign("ID_CLIENT").getString("NOM") + "\n";
}
if (r.getString("LIBELLE").trim().length() > 0) {
result = r.getString("LIBELLE") + "\n";
result = getFormattedAddress(r, result);
 
return result;
}
 
public static String getFormattedAddress(final SQLRowAccessor rAddress, String prefix) {
String result = prefix;
if (getStringTrimmed(rAddress, "LIBELLE").length() > 0) {
result = getStringTrimmed(rAddress, "LIBELLE") + "\n";
}
if (r.getString("DEST").trim().length() > 0) {
result = r.getString("DEST") + "\n";
if (getStringTrimmed(rAddress, "DEST").length() > 0) {
result = getStringTrimmed(rAddress, "DEST") + "\n";
}
if (r.getString("RUE").trim().length() > 0) {
result += r.getString("RUE") + "\n";
if (getStringTrimmed(rAddress, "RUE").length() > 0) {
result += getStringTrimmed(rAddress, "RUE") + "\n";
}
result += "\n" + r.getString("CODE_POSTAL");
result += "\n" + getStringTrimmed(rAddress, "CODE_POSTAL");
result += " ";
if (r.getTable().contains("DISTRICT")) {
result += r.getString("DISTRICT") + " ";
if (rAddress.getTable().contains("DISTRICT")) {
result += getStringTrimmed(rAddress, "DISTRICT") + " ";
}
result += r.getString("VILLE");
if (r.getBoolean("HAS_CEDEX")) {
result += getStringTrimmed(rAddress, "VILLE");
if (rAddress.getBoolean("HAS_CEDEX")) {
result += " Cedex";
String cedex = r.getString("CEDEX");
if (cedex != null && cedex.trim().length() > 0) {
String cedex = getStringTrimmed(rAddress, "CEDEX");
if (cedex.length() > 0) {
result += " " + cedex;
}
}
if (r.getTable().contains("PROVINCE")) {
if (rAddress.getTable().contains("PROVINCE")) {
result += "\n";
if (r.getString("PROVINCE").trim().length() > 0) {
result += r.getString("PROVINCE") + " ";
if (getStringTrimmed(rAddress, "PROVINCE").length() > 0) {
result += getStringTrimmed(rAddress, ("PROVINCE")) + " ";
}
 
if (r.getTable().contains("DEPARTEMENT")) {
result += r.getString("DEPARTEMENT");
if (rAddress.getTable().contains("DEPARTEMENT")) {
result += getStringTrimmed(rAddress, "DEPARTEMENT");
}
}
 
if (r.getString("PAYS").trim().length() > 0) {
result += "\n" + r.getString("PAYS");
if (getStringTrimmed(rAddress, "PAYS").length() > 0) {
result += "\n" + getStringTrimmed(rAddress, "PAYS");
}
 
return result;
}
 
public static String getStringTrimmed(SQLRowAccessor r, String field) {
String result = r.getString(field);
if (result == null)
return "";
return result.trim();
}
 
public static void register() {
SpreadSheetCellValueProviderManager.put("address.customer.full", new AdresseFullClientValueProvider(ADRESSE_PRINCIPALE, false));
SpreadSheetCellValueProviderManager.put("address.customer.invoice.full", new AdresseFullClientValueProvider(ADRESSE_FACTURATION, false));
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/PaiementRemainedProvider.java
19,6 → 19,7
import org.openconcerto.sql.model.SQLRowAccessor;
 
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Collection;
 
public class PaiementRemainedProvider implements SpreadSheetCellValueProvider {
54,6 → 55,12
totalEch += row.getLong("MONTANT");
}
}
if (r.getTable().contains("ACOMPTE_COMMANDE") && r.getBigDecimal("ACOMPTE_COMMANDE") != null) {
long totalAcompte = r.getBigDecimal("ACOMPTE_COMMANDE").movePointRight(2).setScale(0, RoundingMode.HALF_UP).longValue();
if (totalEch > totalAcompte) {
totalEch -= totalAcompte;
}
}
 
long total = totalEch;
if (t == Type.DONE) {
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/DateProvider.java
Nouveau fichier
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.generationDoc.provider;
 
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueContext;
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProviderManager;
 
import java.util.Date;
 
public class DateProvider extends UserInitialsValueProvider {
 
private enum TypeDateProvider {
TODAY, CREATION, MODIFICATION
};
 
private final TypeDateProvider type;
 
public DateProvider(TypeDateProvider t) {
this.type = t;
}
 
@Override
public Object getValue(SpreadSheetCellValueContext context) {
 
if (this.type == TypeDateProvider.CREATION) {
return context.getRow().getCreationDate().getTime();
} else if (this.type == TypeDateProvider.MODIFICATION) {
return context.getRow().getModificationDate().getTime();
} else {
return new Date();
}
}
 
public static void register() {
SpreadSheetCellValueProviderManager.put("date.today", new DateProvider(TypeDateProvider.TODAY));
SpreadSheetCellValueProviderManager.put("date.creation", new DateProvider(TypeDateProvider.CREATION));
SpreadSheetCellValueProviderManager.put("date.modification", new DateProvider(TypeDateProvider.MODIFICATION));
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/RestantAReglerProvider.java
16,14 → 16,34
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueContext;
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProvider;
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProviderManager;
import org.openconcerto.erp.generationDoc.provider.TotalAcompteProvider.TypeTotalAcompteProvider;
import org.openconcerto.erp.generationDoc.provider.TotalCommandeClientProvider.TypeTotalCommandeClientProvider;
 
import java.math.BigDecimal;
 
public class RestantAReglerProvider implements SpreadSheetCellValueProvider {
 
TotalAcompteProvider acompteProv = new TotalAcompteProvider();
TotalCommandeClientProvider cmdProvider = new TotalCommandeClientProvider();
final TotalAcompteProvider acompteProv;
final TotalCommandeClientProvider cmdProvider;
 
private enum TypeRestantAReglerProvider {
HT, TTC;
};
 
private final TypeRestantAReglerProvider type;
 
public RestantAReglerProvider(TypeRestantAReglerProvider t) {
this.type = t;
if (this.type == TypeRestantAReglerProvider.HT) {
acompteProv = new TotalAcompteProvider(TypeTotalAcompteProvider.HT);
cmdProvider = new TotalCommandeClientProvider(TypeTotalCommandeClientProvider.HT);
} else {
acompteProv = new TotalAcompteProvider(TypeTotalAcompteProvider.TTC);
cmdProvider = new TotalCommandeClientProvider(TypeTotalCommandeClientProvider.TTC);
}
 
}
 
public Object getValue(SpreadSheetCellValueContext context) {
Object acompte = acompteProv.getValue(context);
Object cmd = cmdProvider.getValue(context);
35,7 → 55,8
}
 
public static void register() {
SpreadSheetCellValueProviderManager.put("sales.account.due", new RestantAReglerProvider());
SpreadSheetCellValueProviderManager.put("sales.account.due", new RestantAReglerProvider(TypeRestantAReglerProvider.HT));
SpreadSheetCellValueProviderManager.put("sales.account.due.ttc", new RestantAReglerProvider(TypeRestantAReglerProvider.TTC));
}
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/TotalCommandeClientProvider.java
23,6 → 23,16
 
public class TotalCommandeClientProvider implements SpreadSheetCellValueProvider {
 
public enum TypeTotalCommandeClientProvider {
HT, TTC;
};
 
private final TypeTotalCommandeClientProvider type;
 
public TotalCommandeClientProvider(TypeTotalCommandeClientProvider t) {
this.type = t;
}
 
public Object getValue(SpreadSheetCellValueContext context) {
SQLRowAccessor row = context.getRow();
Collection<? extends SQLRowAccessor> rows = row.getReferentRows(row.getTable().getTable("TR_COMMANDE_CLIENT"));
30,7 → 40,7
for (SQLRowAccessor sqlRowAccessor : rows) {
if (!sqlRowAccessor.isForeignEmpty("ID_COMMANDE_CLIENT")) {
SQLRowAccessor rowCmd = sqlRowAccessor.getForeign("ID_COMMANDE_CLIENT");
total += rowCmd.getLong("T_HT");
total += (this.type == TypeTotalCommandeClientProvider.HT ? rowCmd.getLong("T_HT") : rowCmd.getLong("T_TTC"));
}
}
return new BigDecimal(total).movePointLeft(2);
37,7 → 47,8
}
 
public static void register() {
SpreadSheetCellValueProviderManager.put("sales.account.command.total", new TotalCommandeClientProvider());
SpreadSheetCellValueProviderManager.put("sales.account.command.total", new TotalCommandeClientProvider(TypeTotalCommandeClientProvider.HT));
SpreadSheetCellValueProviderManager.put("sales.account.command.total.ttc", new TotalCommandeClientProvider(TypeTotalCommandeClientProvider.TTC));
}
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/RemiseTotalProvider.java
17,7 → 17,6
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProviderManager;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.utils.DecimalUtils;
 
import java.math.BigDecimal;
import java.math.RoundingMode;
25,6 → 24,16
 
public class RemiseTotalProvider extends UserInitialsValueProvider {
 
private enum TypeRemiseTotalProvider {
TTC, HT
};
 
private final TypeRemiseTotalProvider type;
 
public RemiseTotalProvider(TypeRemiseTotalProvider t) {
this.type = t;
}
 
@Override
public Object getValue(SpreadSheetCellValueContext context) {
SQLRowAccessor row = context.getRow();
34,25 → 43,38
BigDecimal total = BigDecimal.ZERO;
for (SQLRowAccessor sqlRowAccessor : cols) {
 
final BigDecimal montant = sqlRowAccessor.getBigDecimal("MONTANT_REMISE");
BigDecimal remise = (BigDecimal) sqlRowAccessor.getObject("POURCENT_REMISE");
if (!sqlRowAccessor.getTable().contains("NIVEAU") || sqlRowAccessor.getInt("NIVEAU") == 1) {
 
if (montant != null) {
total = total.add(montant.setScale(2, RoundingMode.HALF_UP));
} else if (remise != null && remise.signum() != 0) {
final BigDecimal subtract = BigDecimal.ONE.subtract(remise.movePointLeft(2));
if (subtract.signum() == 0) {
total = total.add(sqlRowAccessor.getBigDecimal("PV_HT").multiply(sqlRowAccessor.getBigDecimal("QTE_UNITAIRE").multiply(new BigDecimal(sqlRowAccessor.getInt("QTE")))));
} else {
total = total.add((sqlRowAccessor.getBigDecimal("T_PV_HT").divide(subtract, DecimalUtils.HIGH_PRECISION)).subtract(sqlRowAccessor.getBigDecimal("T_PV_HT")).setScale(2,
RoundingMode.HALF_UP));
BigDecimal lineDiscount = BigDecimal.ZERO;
lineDiscount = sqlRowAccessor.getBigDecimal("PV_HT").multiply(sqlRowAccessor.getBigDecimal("QTE_UNITAIRE").multiply(new BigDecimal(sqlRowAccessor.getInt("QTE"))));
 
if (this.type == TypeRemiseTotalProvider.TTC) {
if (sqlRowAccessor.getForeign("ID_TAXE") != null && !sqlRowAccessor.isForeignEmpty("ID_TAXE")) {
BigDecimal vat = new BigDecimal(sqlRowAccessor.getForeign("ID_TAXE").getFloat("TAUX")).movePointLeft(2).add(BigDecimal.ONE);
lineDiscount = lineDiscount.multiply(vat).setScale(2, RoundingMode.HALF_UP);
}
}
 
total = total.add(lineDiscount);
 
}
}
return total;
 
String prefix = "MONTANT_";
if (row.getTable().contains("T_HT")) {
prefix = "T_";
}
 
if (this.type == TypeRemiseTotalProvider.TTC) {
total = new BigDecimal(row.getLong(prefix + "TTC")).movePointLeft(2).subtract(total);
} else {
total = new BigDecimal(row.getLong(prefix + "HT")).movePointLeft(2).subtract(total);
}
return total.abs();
}
 
public static void register() {
SpreadSheetCellValueProviderManager.put("sales.discount.total", new RemiseTotalProvider());
SpreadSheetCellValueProviderManager.put("sales.discount.total", new RemiseTotalProvider(TypeRemiseTotalProvider.HT));
SpreadSheetCellValueProviderManager.put("sales.discount.total.ttc", new RemiseTotalProvider(TypeRemiseTotalProvider.TTC));
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/TotalAcompteProvider.java
26,6 → 26,16
 
public class TotalAcompteProvider implements SpreadSheetCellValueProvider {
 
public enum TypeTotalAcompteProvider {
HT, TTC;
};
 
private final TypeTotalAcompteProvider type;
 
public TotalAcompteProvider(TypeTotalAcompteProvider t) {
this.type = t;
}
 
public Object getValue(SpreadSheetCellValueContext context) {
SQLRowAccessor row = context.getRow();
Calendar c = row.getDate("DATE");
42,7 → 52,8
}
 
public static void register() {
SpreadSheetCellValueProviderManager.put("sales.account.total", new TotalAcompteProvider());
SpreadSheetCellValueProviderManager.put("sales.account.total", new TotalAcompteProvider(TypeTotalAcompteProvider.HT));
SpreadSheetCellValueProviderManager.put("sales.account.total.ttc", new TotalAcompteProvider(TypeTotalAcompteProvider.TTC));
}
 
public long getPreviousAcompte(SQLRowAccessor sqlRowAccessor, Set<SQLRowAccessor> alreadyAdded, Calendar c) {
56,7 → 67,7
 
if (rowFact != null && !rowFact.isUndefined() && !alreadyAdded.contains(rowFact) && rowFact.getDate("DATE").before(c)) {
alreadyAdded.add(rowFact);
l += rowFact.getLong("T_HT");
l += this.type == TypeTotalAcompteProvider.HT ? rowFact.getLong("T_HT") : rowFact.getLong("T_TTC");
}
}
return l;
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/SaledTotalNotDiscountedProvider.java
41,7 → 41,7
}
}
if (table.contains("PORT_HT")) {
total.add(new BigDecimal(row.getLong("PORT_HT")).movePointLeft(2));
total = total.add(new BigDecimal(row.getLong("PORT_HT")).movePointLeft(2));
}
return total;
}
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/OOXMLCache.java
210,7 → 210,7
final SQLTable tableArtElt = root.getTable("ARTICLE_ELEMENT");
SQLRowValues rowVals = new SQLRowValues(tableArtElt);
rowVals.putNulls("QTE", "QTE_UNITAIRE", "ID_UNITE_VENTE", "ID_ARTICLE_PARENT");
rowVals.putRowValues("ID_ARTICLE").putNulls("CODE", "NOM");
rowVals.putRowValues("ID_ARTICLE").setAllToNull();
SQLRowValuesListFetcher fetch = SQLRowValuesListFetcher.create(rowVals);
fetch.setSelTransf(new ITransformer<SQLSelect, SQLSelect>() {
 
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/gestcomm/ReportingEcoContributionSheetXML.java
Nouveau fichier
0,0 → 1,185
/*
* 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 19 nov. 2012
*/
package org.openconcerto.erp.generationDoc.gestcomm;
 
import org.openconcerto.erp.generationDoc.AbstractListeSheetXml;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLRowValuesListFetcher;
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.Where;
import org.openconcerto.utils.cc.ITransformer;
 
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
public class ReportingEcoContributionSheetXML extends AbstractListeSheetXml {
 
public static final String TEMPLATE_ID = "ReportingEcoContribution";
public static final String TEMPLATE_PROPERTY_NAME = DEFAULT_PROPERTY_NAME;
 
private Date dateD, dateF;
 
public ReportingEcoContributionSheetXML(Date debut, Date fin) {
super();
 
this.dateD = debut;
this.dateF = fin;
 
}
 
@Override
public String getStoragePathP() {
return "Autres";
}
 
@Override
public String getDefaultTemplateId() {
return TEMPLATE_ID;
};
 
@Override
public String getName() {
return "ReportingBA";
}
 
@Override
protected void createListeValues() {
 
this.mapAllSheetValues = new HashMap<Integer, Map<String, Object>>();
this.listAllSheetValues = new HashMap<Integer, List<Map<String, Object>>>();
this.styleAllSheetValues = new HashMap<Integer, Map<Integer, String>>();
 
fillSynthese();
 
}
 
private static SQLTable tableVF = Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE").getTable();
 
class EcoContribRecap {
private final String code, nom;
private BigDecimal totalEco, qte;
 
public EcoContribRecap(String code, String nom) {
this.code = code;
this.nom = nom;
this.qte = BigDecimal.ZERO;
this.totalEco = BigDecimal.ZERO;
}
 
public void cumul(BigDecimal qte, BigDecimal total) {
this.qte = qte.add(this.qte);
this.totalEco = total.add(this.totalEco);
}
 
public String getCode() {
return code;
}
 
public String getNom() {
return nom;
}
 
public BigDecimal getQte() {
return qte;
}
 
public BigDecimal getTotalEco() {
return totalEco;
}
}
 
private void fillSynthese() {
final SQLTable tableVF = Configuration.getInstance().getRoot().findTable("SAISIE_VENTE_FACTURE");
final SQLTable tableVFElt = Configuration.getInstance().getRoot().findTable("SAISIE_VENTE_FACTURE_ELEMENT");
 
SQLRowValues rowvalsVF = new SQLRowValues(tableVF);
rowvalsVF.put("NUMERO", null);
rowvalsVF.put("DATE", null);
 
SQLRowValues rowvalsVFElt = new SQLRowValues(tableVFElt);
rowvalsVFElt.put("ID_SAISIE_VENTE_FACTURE", rowvalsVF);
rowvalsVFElt.put("T_ECO_CONTRIBUTION", null);
rowvalsVFElt.put("QTE", null);
rowvalsVFElt.put("QTE_UNITAIRE", null);
rowvalsVFElt.putRowValues("ID_ECO_CONTRIBUTION").putNulls("CODE", "NOM");
 
SQLRowValuesListFetcher fetcher = SQLRowValuesListFetcher.create(rowvalsVFElt);
fetcher.setSelTransf(new ITransformer<SQLSelect, SQLSelect>() {
 
@Override
public SQLSelect transformChecked(SQLSelect input) {
Where w = new Where(input.getAlias(tableVF).getField("DATE"), dateD, dateF);
w = w.and(new Where(tableVFElt.getField("T_ECO_CONTRIBUTION"), ">", BigDecimal.ZERO));
input.setWhere(w);
return input;
}
});
 
Map<Integer, EcoContribRecap> recap = new HashMap<Integer, ReportingEcoContributionSheetXML.EcoContribRecap>();
List<SQLRowValues> results = fetcher.fetch();
for (SQLRowValues sqlRowValues : results) {
EcoContribRecap r;
if (recap.containsKey(sqlRowValues.getForeignID("ID_ECO_CONTRIBUTION"))) {
r = recap.get(sqlRowValues.getForeignID("ID_ECO_CONTRIBUTION"));
} else {
SQLRowAccessor rEco = sqlRowValues.getForeign("ID_ECO_CONTRIBUTION");
r = new EcoContribRecap(rEco.getString("CODE"), rEco.getString("NOM"));
recap.put(sqlRowValues.getForeignID("ID_ECO_CONTRIBUTION"), r);
}
r.cumul(sqlRowValues.getBigDecimal("QTE_UNITAIRE").multiply(new BigDecimal(sqlRowValues.getInt("QTE"))), sqlRowValues.getBigDecimal("T_ECO_CONTRIBUTION"));
}
 
List<Map<String, Object>> values = new ArrayList<Map<String, Object>>();
this.listAllSheetValues.put(0, values);
Map<Integer, String> style = new HashMap<Integer, String>();
this.styleAllSheetValues.put(0, style);
 
BigDecimal total = BigDecimal.ZERO;
BigDecimal qteTotal = BigDecimal.ZERO;
 
for (EcoContribRecap item : recap.values()) {
Map<String, Object> vals = new HashMap<String, Object>();
 
vals.put("CODE", item.getCode());
vals.put("NOM", item.getNom());
vals.put("QTE", item.getQte());
vals.put("TOTAL_ECO", item.getTotalEco());
style.put(values.size(), "Normal");
total = total.add(item.getTotalEco());
qteTotal = qteTotal.add(item.getQte());
values.add(vals);
}
 
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
Map<String, Object> vals = new HashMap<String, Object>();
vals.put("DATE_DEB", this.dateD);
vals.put("DATE_FIN", this.dateF);
vals.put("PERIODE", "Période du " + format.format(this.dateD) + " au " + format.format(this.dateF));
vals.put("TOTAL", total);
vals.put("TOTAL_QTE", qteTotal);
this.mapAllSheetValues.put(0, vals);
// style.put(values.size(), "Titre 1");
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/gestcomm/JournalPaieXmlSheet.java
37,7 → 37,7
*/
public class JournalPaieXmlSheet extends AbstractListeSheetXml {
 
private static final DateFormat DATE_FORMAT = new SimpleDateFormat("dd/MM/yy");
private final DateFormat DATE_FORMAT = new SimpleDateFormat("dd/MM/yy");
 
public static final String TEMPLATE_ID = "JournalPaie";
 
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/gestcomm/EtatVentesXmlSheet.java
13,6 → 13,8
package org.openconcerto.erp.generationDoc.gestcomm;
 
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
import org.openconcerto.erp.generationDoc.AbstractListeSheetXml;
import org.openconcerto.erp.preferences.PrinterNXProps;
import org.openconcerto.sql.Configuration;
20,6 → 22,8
import org.openconcerto.sql.element.SQLElementDirectory;
import org.openconcerto.sql.model.AliasedField;
import org.openconcerto.sql.model.AliasedTable;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.Where;
32,8 → 36,10
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
 
import org.apache.commons.dbutils.handlers.ArrayListHandler;
 
152,6 → 158,8
selQte.addSelect(tableFactureElement.getField("T_PA_HT"), "SUM");
selQte.addSelect(tableFactureElement.getField("T_PV_HT"), "SUM");
selQte.addSelect(tableFactureElement.getField("T_PV_TTC"), "SUM");
selQte.addSelect(tableFactureElement.getField("ID_TAXE"));
selQte.addSelect(tableFactureElement.getField("ID_ARTICLE"));
selQte.addJoin("LEFT", tableFactureElement.getField("ID_SAISIE_VENTE_FACTURE")).setWhere(w);
selQte.addJoin("LEFT", tableFactureElement.getField("ID_TICKET_CAISSE"), "ticket").setWhere(w2);
if (this.du != null && this.au != null) {
159,6 → 167,8
}
selQte.addGroupBy(tableFactureElement.getField("NOM"));
selQte.addGroupBy(tableFactureElement.getField("CODE"));
selQte.addGroupBy(tableFactureElement.getField("ID_TAXE"));
selQte.addGroupBy(tableFactureElement.getField("ID_ARTICLE"));
 
List<Object[]> listeQte = (List<Object[]>) Configuration.getInstance().getBase().getDataSource().execute(selQte.asString(), new ArrayListHandler());
 
171,7 → 181,10
Number ha = (Number) sqlRow[3];
Number ht = (Number) sqlRow[4];
Number ttc = (Number) sqlRow[5];
ArticleVendu a = new ArticleVendu(code, nom, qteVendu.intValue(), (BigDecimal) ht, (BigDecimal) ha, (BigDecimal) ttc);
Number tvaID = (Number) sqlRow[6];
Number articleID = (Number) sqlRow[7];
ArticleVendu a = new ArticleVendu(code, nom, qteVendu.intValue(), (BigDecimal) ht, (BigDecimal) ha, (BigDecimal) ttc, tvaID.intValue(),
tableFactureElement.getForeignTable("ID_ARTICLE").getRow(articleID.intValue()));
map.put(code + "##" + nom, a);
}
 
199,6 → 212,8
mValues.put("QTE", a.qte);
mValues.put("T_PA", a.ha);
mValues.put("T_PV_HT", a.ht);
mValues.put("TVA_TAUX", a.tva);
mValues.put("NUMERO_COMPTE", a.numeroCompte);
mValues.put("T_PV_TTC", a.ttc);
mValues.put("NB_CHEQUE", obj[2]);
mValues.put("NB_CB", obj[3]);
372,12 → 387,36
 
}
 
public static SQLRow rowDefaultCptService, rowDefaultCptProduit;
static {
final SQLTable tablePrefCompte = Configuration.getInstance().getRoot().findTable("PREFS_COMPTE");
final SQLRow rowPrefsCompte = tablePrefCompte.getRow(2);
rowDefaultCptService = rowPrefsCompte.getForeign("ID_COMPTE_PCE_VENTE_SERVICE");
if (rowDefaultCptService == null || rowDefaultCptService.isUndefined()) {
try {
rowDefaultCptService = ComptePCESQLElement.getRowComptePceDefault("VentesServices");
} catch (Exception e) {
e.printStackTrace();
}
}
 
rowDefaultCptProduit = rowPrefsCompte.getForeign("ID_COMPTE_PCE_VENTE_PRODUIT");
if (rowDefaultCptProduit == null || rowDefaultCptProduit.isUndefined()) {
try {
rowDefaultCptProduit = ComptePCESQLElement.getRowComptePceDefault("VentesProduits");
} catch (Exception e) {
e.printStackTrace();
}
}
}
 
class ArticleVendu {
public String code, nom;
public int qte;
public BigDecimal ht, ha, ttc;
public int qte, tvaID;
public BigDecimal ht, ha, ttc, tva;
public String numeroCompte;
 
public ArticleVendu(String code, String nom, int qte, BigDecimal ht, BigDecimal ha, BigDecimal ttc) {
public ArticleVendu(String code, String nom, int qte, BigDecimal ht, BigDecimal ha, BigDecimal ttc, int tvaID, SQLRow rowArticle) {
this.code = code;
this.nom = nom;
this.qte = qte;
384,6 → 423,51
this.ht = ht;
this.ha = ha;
this.ttc = ttc;
this.tvaID = tvaID;
this.tva = new BigDecimal(TaxeCache.getCache().getTauxFromId(tvaID));
 
SQLRowAccessor rowTVA = TaxeCache.getCache().getRowFromId(tvaID);
boolean service = rowArticle.getBoolean("SERVICE");
SQLRowAccessor rowCpt;
// Total Service
if (service) {
rowCpt = rowDefaultCptService;
if (rowTVA != null && !rowTVA.isForeignEmpty("ID_COMPTE_PCE_VENTE_SERVICE")) {
rowCpt = rowTVA.getForeign("ID_COMPTE_PCE_VENTE_SERVICE");
}
} else {
rowCpt = rowDefaultCptProduit;
// Compte defini par défaut dans la TVA
if (rowTVA != null && !rowTVA.isForeignEmpty("ID_COMPTE_PCE_VENTE")) {
rowCpt = rowTVA.getForeign("ID_COMPTE_PCE_VENTE");
}
 
}
 
if (rowArticle != null && !rowArticle.isUndefined()) {
SQLRowAccessor compteArticle = rowArticle.getForeign("ID_COMPTE_PCE");
if (compteArticle != null && !compteArticle.isUndefined()) {
rowCpt = compteArticle;
} else {
SQLRowAccessor familleArticle = rowArticle.getForeign("ID_FAMILLE_ARTICLE");
Set<SQLRowAccessor> unique = new HashSet<SQLRowAccessor>();
while (familleArticle != null && !familleArticle.isUndefined() && !unique.contains(familleArticle)) {
 
unique.add(familleArticle);
SQLRowAccessor compteFamilleArticle = familleArticle.getForeign("ID_COMPTE_PCE");
if (compteFamilleArticle != null && !compteFamilleArticle.isUndefined()) {
rowCpt = compteFamilleArticle;
break;
}
 
familleArticle = familleArticle.getForeign("ID_FAMILLE_ARTICLE_PERE");
}
}
}
if (rowCpt != null) {
 
this.numeroCompte = rowCpt.getString("NUMERO");
}
}
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/gestcomm/FicheRelanceSheet.java
28,7 → 28,7
 
public class FicheRelanceSheet 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 = "FicheRelance";
public static final String TEMPLATE_PROPERTY_NAME = DEFAULT_PROPERTY_NAME;
 
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/gestcomm/ReleveChequeSheet.java
32,7 → 32,7
public class ReleveChequeSheet extends AbstractListeSheetXml {
 
private List<Map<String, Object>> listValues;
private static final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yy");
private final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yy");
private Date date;
private long total = 0;
private long nb = 0;
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/ODTPrinterNX.java
54,7 → 54,7
(float) (paper.getImageableWidth() / POINTS_PER_INCH), (float) (paper.getImageableHeight() / POINTS_PER_INCH), Size2DSyntax.INCH);
attributes.add(printableArea);
 
final PageFormat format = job.getPageFormat(null);
final PageFormat format = printJob.getPageFormat(null);
format.setPaper(paper);
printJob.setPrintable(this, format);
printJob.print(attributes);
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/OOXMLField.java
238,6 → 238,7
String prefix = this.elt.getAttributeValue("prefix");
String suffix = this.elt.getAttributeValue("suffix");
String display = this.elt.getAttributeValue("display");
// FIXME attribut cellSize à mettre sur l'element
String cellSize = this.elt.getAttributeValue("cellSize");
if (prefix != null || suffix != null) {
 
346,8 → 347,19
}
} else if (typeComp.equalsIgnoreCase("cumulPaye")) {
double val = ((Number) result).doubleValue();
double valC = ((Number) this.row.getForeign("ID_CUMULS_PAYE").getObject(field + "_C")).doubleValue();
double valC;
if (this.row.getTable().getFieldsName().contains("ID_CUMULS_PAYE")) {
valC = ((Number) this.row.getForeign("ID_CUMULS_PAYE").getObject(field + "_C")).doubleValue();
} else {
SQLRowAccessor refRow = this.row.getReferentRows(this.row.getTable().getTable("FICHE_PAYE")).iterator().next();
valC = ((Number) refRow.getForeign("ID_CUMULS_PAYE").getObject(field + "_C")).doubleValue();
}
return new Double(val + valC);
} else if (typeComp.equalsIgnoreCase("cumulConges")) {
double val = ((Number) result).doubleValue();
SQLRowAccessor refRow = this.row.getReferentRows(this.row.getTable().getTable("FICHE_PAYE")).iterator().next();
double valC = ((Number) refRow.getObject("CONGES_ACQUIS")).doubleValue();
return new Double(val + valC);
} else if (typeComp.equalsIgnoreCase("globalAcompte")) {
Long prix = (Long) result;
int pourcent = this.row.getInt("POURCENT_ACOMPTE");
645,25 → 657,15
Nombre n1 = new Nombre(entier.intValue(), langue);
Nombre n2 = new Nombre(decimal.intValue(), langue);
 
// result.append(n1.getText() + " euros");
// 2.51 -> deux euros et cinquante et un centimes
result.append(n1.getText() + " " + deviseName.get0().trim());
 
if (decimal.intValue() > 0)
 
{
// result.append(" et " + n2.getText() + " cents");
result.append(" " + n1.getLocal().getSeparateurLabel() + " " + n2.getText() + deviseName.get1());
if (decimal.intValue() > 0) {
result.append(" " + n1.getSeparateurLabel() + " " + n2.getText() + deviseName.get1());
}
if (result != null && result.length() > 0)
 
{
if (result != null && result.length() > 0) {
return result.toString().replaceFirst(String.valueOf(result.charAt(0)), String.valueOf(result.charAt(0)).toUpperCase());
} else
 
{
return result.toString();
}
 
return "";
}
 
private static BigDecimal calcul(Object o1, Object o2, String op) {
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/OOgenerationXML.java
16,6 → 16,10
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.erp.config.Log;
import org.openconcerto.erp.core.common.element.StyleSQLElement;
import org.openconcerto.erp.core.common.ui.TotalCalculator;
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
import org.openconcerto.erp.preferences.DefaultNXProps;
import org.openconcerto.openoffice.ODPackage;
import org.openconcerto.openoffice.spreadsheet.MutableCell;
import org.openconcerto.openoffice.spreadsheet.Sheet;
25,10 → 29,11
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.SQLTable;
import org.openconcerto.utils.DecimalUtils;
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.StreamUtils;
import org.openconcerto.utils.Tuple2;
 
import java.awt.Point;
import java.io.File;
37,6 → 42,7
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Collection;
122,7 → 128,6
}
}
 
Date d = new Date();
SAXBuilder builder = new SAXBuilder();
try {
 
236,7 → 241,7
Map<String, Map<Integer, String>> mapStyle = searchStyle(sheet, lastColumn, endPageLine);
 
if (tableau.getAttributeValue("table").equalsIgnoreCase("TVA")) {
fillTaxe(tableau, sheet, mapStyle, false);
fillTaxeDocumentMap(tableau, sheet, mapStyle, false);
return;
}
int nbPage = fillTable(tableau, row, sheet, mapStyle, true, rowLanguage);
364,6 → 369,128
 
}
 
private void fillTaxe(Element tableau, List<? extends SQLRowAccessor> rows) {
// getValuesFromElement(boolean achat, String fieldTotalHT, SQLRow row, SQLTable foreign,
// BigDecimal portHT, SQLRow rowTVAPort, SQLTable tableEchantillon,
// SQLRow defaultCompte) {
SQLTable tableElt = Configuration.getInstance().getRoot().findTable(tableau.getAttributeValue("table"));
if (tableElt.contains("ID_TAXE") && tableElt.contains("T_PA_HT")) {
boolean achat = tableElt.contains("T_PA_TTC");
TotalCalculator calc = new TotalCalculator("T_PA_HT", achat ? "T_PA_HT" : "T_PV_HT", null, achat, null);
String val = DefaultNXProps.getInstance().getStringProperty("ArticleService");
Boolean bServiceActive = Boolean.valueOf(val);
 
calc.setServiceActive(bServiceActive != null && bServiceActive);
if (row.getTable().contains("ID_COMPTE_PCE_SERVICE") && !row.isForeignEmpty("ID_COMPTE_PCE_SERVICE")) {
SQLRowAccessor serviceCompte = row.getForeign("ID_COMPTE_PCE_SERVICE");
if (!serviceCompte.isUndefined()) {
calc.setRowDefaultCptService(serviceCompte);
}
}
if (row.getTable().contains("ID_COMPTE_PCE_VENTE") && !row.isForeignEmpty("ID_COMPTE_PCE_VENTE")) {
SQLRowAccessor produitCompte = row.getForeign("ID_COMPTE_PCE_VENTE");
if (!produitCompte.isUndefined()) {
calc.setRowDefaultCptProduit(produitCompte);
}
}
long remise = 0;
BigDecimal totalAvtRemise = BigDecimal.ZERO;
SQLTable tableEchantillon = null;
if (row.getTable().getName().equalsIgnoreCase("SAISIE_VENTE_FACTURE") && row.getTable().getDBRoot().contains("ECHANTILLON_ELEMENT")) {
tableEchantillon = row.getTable().getTable("ECHANTILLON_ELEMENT");
}
if (row.getTable().contains("REMISE_HT")) {
remise = row.getLong("REMISE_HT");
if (remise != 0) {
for (SQLRowAccessor sqlRow : rows) {
calc.addLine(sqlRow, sqlRow.getForeign("ID_ARTICLE"), 1, false);
}
 
if (tableEchantillon != null) {
List<SQLRow> rowsEch = row.getReferentRows(tableEchantillon);
for (SQLRow sqlRow : rowsEch) {
calc.addEchantillon((BigDecimal) sqlRow.getObject("T_PV_HT"), sqlRow.getForeign("ID_TAXE"));
}
}
calc.checkResult();
totalAvtRemise = calc.getTotalHT();
}
}
 
calc.initValues();
long valRemiseHTReel = remise;
if (row.getFields().contains("POURCENT_FACTURABLE") && row.getFields().contains("MONTANT_FACTURABLE")) {
BigDecimal montantFact = row.getBigDecimal("MONTANT_FACTURABLE");
BigDecimal percentFact = row.getBigDecimal("POURCENT_FACTURABLE");
 
if (montantFact != null && montantFact.signum() > 0) {
valRemiseHTReel = 0;
} else if (percentFact != null && percentFact.signum() > 0) {
valRemiseHTReel = percentFact.movePointLeft(2).multiply(new BigDecimal(remise)).setScale(0, RoundingMode.HALF_UP).longValue();
}
 
}
calc.setRemise(valRemiseHTReel, totalAvtRemise);
 
for (int i = 0; i < rows.size(); i++) {
SQLRowAccessor sqlRow = rows.get(i);
calc.addLine(sqlRow, sqlRow.getForeign("ID_ARTICLE"), i, i == rows.size() - 1);
}
 
if (tableEchantillon != null) {
List<SQLRow> rowsEch = row.getReferentRows(tableEchantillon);
for (SQLRow sqlRow : rowsEch) {
calc.addEchantillon((BigDecimal) sqlRow.getObject("T_PV_HT"), sqlRow.getForeign("ID_TAXE"));
}
}
SQLRowAccessor rowTVAPort = null;
if (row.getTable().contains("ID_TAXE_PORT")) {
rowTVAPort = row.getForeign("ID_TAXE_PORT");
}
if (rowTVAPort != null && !rowTVAPort.isUndefined()) {
SQLRowValues rowValsPort = new SQLRowValues(tableElt);
rowValsPort.put("T_PV_HT", BigDecimal.valueOf(row.getLong("PORT_HT")).movePointLeft(2));
rowValsPort.put("QTE", 1);
rowValsPort.put("ID_TAXE", rowTVAPort.getIDNumber());
 
final SQLTable tablePrefCompte = Configuration.getInstance().getRoot().findTable("PREFS_COMPTE");
final SQLRow rowPrefsCompte = tablePrefCompte.getRow(2);
SQLRow rowDefaultCptPort;
if (rowTVAPort.getFloat("TAUX") > 0) {
rowDefaultCptPort = rowPrefsCompte.getForeign("ID_COMPTE_PCE_PORT_SOUMIS");
if (rowDefaultCptPort == null || rowDefaultCptPort.isUndefined()) {
try {
rowDefaultCptPort = ComptePCESQLElement.getRowComptePceDefault("PortVenteSoumisTVA");
} catch (Exception e) {
e.printStackTrace();
}
}
} else {
rowDefaultCptPort = rowPrefsCompte.getForeign("ID_COMPTE_PCE_PORT_NON_SOUMIS");
if (rowDefaultCptPort == null || rowDefaultCptPort.isUndefined()) {
try {
rowDefaultCptPort = ComptePCESQLElement.getRowComptePceDefault("PortVenteNonSoumisTVA");
} catch (Exception e) {
e.printStackTrace();
}
}
}
rowValsPort.putRowValues("ID_ARTICLE").put("ID_COMPTE_PCE", rowDefaultCptPort.getID());
 
calc.addLine(rowValsPort, rowValsPort.getForeign("ID_ARTICLE"), 1, false);
}
calc.checkResult();
Map<SQLRowAccessor, Tuple2<BigDecimal, BigDecimal>> taxeCalc = calc.getMapHtTVARowTaux();
for (SQLRowAccessor sqlRow : taxeCalc.keySet()) {
Tuple2<BigDecimal, BigDecimal> v = taxeCalc.get(sqlRow);
Map<String, Object> m = new HashMap<String, Object>();
m.put("MONTANT_HT", v.get0());
m.put("MONTANT_TVA", v.get1());
taxe.put(sqlRow, m);
}
}
}
 
private int fillTable(Element tableau, SQLRow row, Sheet sheet, Map<String, Map<Integer, String>> mapStyle, boolean test, SQLRow rowLanguage) {
 
if (tableau == null) {
388,52 → 515,11
}
List<Element> listElts = tableau.getChildren("element");
 
if (row.getTable().contains("ID_TAXE_PORT") && row.getTable().contains("PORT_HT")) {
 
SQLRowAccessor rowTaxe = getForeignRow(row, row.getTable().getField("ID_TAXE_PORT"));
BigDecimal ht = BigDecimal.ZERO;
if (row.getTable().getFieldRaw("PORT_HT") != null) {
ht = new BigDecimal((Long) row.getObject("PORT_HT")).movePointLeft(2);
if (ht.signum() != 0) {
if (taxe.get(rowTaxe) != null) {
 
final Object object = taxe.get(rowTaxe).get("MONTANT_HT");
BigDecimal montant = (object == null) ? BigDecimal.ZERO : (BigDecimal) object;
taxe.get(rowTaxe).put("MONTANT_HT", montant.add(ht));
} else {
Map<String, Object> m = new HashMap<String, Object>();
m.put("MONTANT_HT", ht);
taxe.put(rowTaxe, m);
}
}
}
}
 
fillTaxe(tableau, rowsEltCache.get(ref));
// on remplit chaque ligne à partir des rows recuperées
int numeroRef = 0;
for (SQLRowAccessor rowElt : rowsEltCache.get(ref)) {
 
if (!cache && rowElt.getTable().getFieldRaw("ID_TAXE") != null) {
if (!rowElt.getTable().contains("NIVEAU") || rowElt.getInt("NIVEAU") == 1) {
SQLRowAccessor rowTaxe = getForeignRow(rowElt, rowElt.getTable().getField("ID_TAXE"));
BigDecimal ht = BigDecimal.ZERO;
if (rowElt.getTable().getFieldRaw("T_PV_HT") != null) {
ht = (BigDecimal) rowElt.getObject("T_PV_HT");
}
 
if (taxe.get(rowTaxe) != null) {
 
final Object object = taxe.get(rowTaxe).get("MONTANT_HT");
BigDecimal montant = (object == null) ? BigDecimal.ZERO : (BigDecimal) object;
taxe.get(rowTaxe).put("MONTANT_HT", montant.add(ht));
} else {
Map<String, Object> m = new HashMap<String, Object>();
m.put("MONTANT_HT", ht);
taxe.put(rowTaxe, m);
}
}
}
 
final boolean included = isIncluded(tableElement.getFilterId(), tableElement.getForeignTableWhere(), tableElement.getFilterId(), tableElement.getFieldWhere(), rowElt);
String styleName = null;
if (tableElement.getSQLElement().getTable().contains("ID_STYLE")) {
615,7 → 701,7
return nbCellule;
}
 
private void fillTaxe(Element tableau, Sheet sheet, Map<String, Map<Integer, String>> mapStyle, boolean test) {
private void fillTaxeDocumentMap(Element tableau, Sheet sheet, Map<String, Map<Integer, String>> mapStyle, boolean test) {
 
int line = Integer.valueOf(tableau.getAttributeValue("firstLine"));
List<Element> listElts = tableau.getChildren("element");
638,9 → 724,12
} else if (name.equalsIgnoreCase("MONTANT_TVA")) {
// value = Math.round(((Long) m.get("MONTANT_HT") * rowTaxe.getFloat("TAUX")
// / 100.0));
value = ((BigDecimal) m.get("MONTANT_HT")).multiply(new BigDecimal(rowTaxe.getFloat("TAUX")), DecimalUtils.HIGH_PRECISION).movePointLeft(2);
value = ((BigDecimal) m.get("MONTANT_TVA"));
// value = ((BigDecimal) m.get("MONTANT_HT")).multiply(new
// BigDecimal(rowTaxe.getFloat("TAUX")),
// DecimalUtils.HIGH_PRECISION).movePointLeft(2);
} else if (name.equalsIgnoreCase("NOM")) {
value = rowTaxe.getString("NOM");
value = TaxeCache.getCache().getRowFromId(rowTaxe.getID()).getString("NOM");
// TODO prefix et suffix
String prefix = e.getAttributeValue("prefix");
if (prefix != null) {
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/OOgenerationListeColumnXML.java
164,7 → 164,7
// int rowEndNew = rowEnd * (nbPage + 1);
// String sNew = s.replaceAll(String.valueOf(rowEnd), String.valueOf(rowEndNew));
// sheet.setPrintRanges(sNew);
// System.err.println(" ****** Replace print ranges; Old:" + rowEnd + "--" + s + " New:" +
// System.err.println(" ****** Replace print ranges; Old:" + rowEnd + "--" + s + " New:" +
// rowEndNew + "--" + sNew);
// }
// }
200,17 → 200,17
// int nbPage = 1;
// int currentLineTmp = Integer.valueOf(tableau.getAttributeValue("firstLine"));
// int currentLine = Integer.valueOf(tableau.getAttributeValue("firstLine"));
int endPageLine = Integer.valueOf(tableau.getAttributeValue("endPageLine"));
// int endPageLine = Integer.valueOf(tableau.getAttributeValue("endPageLine"));
int endLine = Integer.valueOf(tableau.getAttributeValue("endLine"));
 
List listElts = tableau.getChildren("element");
 
Object o = null;
String columnSousTotal = tableau.getAttributeValue("groupSousTotalColumn");
// String columnSousTotal = tableau.getAttributeValue("groupSousTotalColumn");
//
// Map<String, Double> mapSousTotal = new HashMap<String, Double>();
// Map<String, Double> mapTotal = new HashMap<String, Double>();
 
Map<String, Double> mapSousTotal = new HashMap<String, Double>();
Map<String, Double> mapTotal = new HashMap<String, Double>();
 
// on remplit chaque colonnes à partir des rows recuperées
sheet.setColumnCount(liste.size() + 5);
Integer firstCol = Integer.valueOf(tableau.getAttributeValue("firstLine"));
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtReglementChequeClient.java
68,14 → 68,21
 
// compte Clients
int idCompteClient = -1;
if (clientRow != null) {
idCompteClient = clientRow.getInt("ID_COMPTE_PCE");
}
if (idCompteClient <= 1) {
idCompteClient = rowPrefsCompte.getInt("ID_COMPTE_PCE_CLIENT");
if (chequeRow.getBoolean("SANS_VALEUR_ENCAISSEMENT")) {
if (clientRow != null) {
idCompteClient = clientRow.getInt("ID_COMPTE_PCE");
}
if (idCompteClient <= 1) {
idCompteClient = ComptePCESQLElement.getIdComptePceDefault("Clients");
idCompteClient = rowPrefsCompte.getInt("ID_COMPTE_PCE_CLIENT");
if (idCompteClient <= 1) {
idCompteClient = ComptePCESQLElement.getIdComptePceDefault("Clients");
}
}
} else {
idCompteClient = rowPrefsCompte.getInt("ID_COMPTE_PCE_VALEUR_ENCAISSEMENT");
if (idCompteClient <= 1) {
idCompteClient = ComptePCESQLElement.getIdComptePceDefault("ValeurEncaissement");
}
}
 
this.mEcritures.put("ID_COMPTE_PCE", new Integer(idCompteClient));
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationEcritures.java
33,6 → 33,7
import org.openconcerto.utils.ExceptionHandler;
 
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.SQLException;
import java.util.Collection;
import java.util.Date;
365,13 → 366,14
}
 
protected TotalCalculator getValuesFromElement(SQLRow row, SQLTable foreign, BigDecimal portHT, SQLRow rowTVAPort, SQLTable tableEchantillon) {
return getValuesFromElement(false, "T_PV_HT", row, foreign, portHT, rowTVAPort, tableEchantillon, null);
return getValuesFromElement(false, false, "T_PV_HT", row, foreign, portHT, rowTVAPort, tableEchantillon, null);
}
 
protected TotalCalculator getValuesFromElement(boolean achat, String fieldTotalHT, SQLRow row, SQLTable foreign, BigDecimal portHT, SQLRow rowTVAPort, SQLTable tableEchantillon,
protected TotalCalculator getValuesFromElement(boolean intra, boolean achat, String fieldTotalHT, SQLRow row, SQLTable foreign, BigDecimal portHT, SQLRow rowTVAPort, SQLTable tableEchantillon,
SQLRow defaultCompte) {
 
TotalCalculator calc = new TotalCalculator("T_PA_HT", fieldTotalHT, null, achat, defaultCompte);
calc.setIntraComm(intra);
String val = DefaultNXProps.getInstance().getStringProperty("ArticleService");
Boolean bServiceActive = Boolean.valueOf(val);
 
410,8 → 412,20
}
 
calc.initValues();
calc.setRemise(remise, totalAvtRemise);
long valRemiseHTReel = remise;
if (row.getFields().contains("POURCENT_FACTURABLE") && row.getFields().contains("MONTANT_FACTURABLE")) {
BigDecimal montantFact = row.getBigDecimal("MONTANT_FACTURABLE");
BigDecimal percentFact = row.getBigDecimal("POURCENT_FACTURABLE");
 
if (montantFact != null && montantFact.signum() > 0) {
valRemiseHTReel = 0;
} else if (percentFact != null && percentFact.signum() > 0) {
valRemiseHTReel = percentFact.movePointLeft(2).multiply(new BigDecimal(remise)).setScale(0, RoundingMode.HALF_UP).longValue();
}
 
}
calc.setRemise(valRemiseHTReel, totalAvtRemise);
 
List<SQLRow> rows = row.getReferentRows(foreign);
for (int i = 0; i < rows.size(); i++) {
SQLRow sqlRow = rows.get(i);
452,8 → 466,9
}
}
}
rowValsPort.putRowValues("ID_ARTICLE").put("ID_COMPTE_PCE", rowDefaultCptPort.getID());
 
final SQLRowValues rowValsArt = rowValsPort.putRowValues("ID_ARTICLE");
rowValsArt.put("ID_COMPTE_PCE", rowDefaultCptPort.getID());
rowValsArt.put("ID_TAXE_COMPLEMENTAIRE", null);
calc.addLine(rowValsPort, rowValsPort.getForeign("ID_ARTICLE"), 1, false);
}
calc.checkResult();
547,8 → 562,12
* @throws Exception
*/
protected void fillCompteBanqueFromRow(SQLRow sqlRow, String defaultProps, boolean achat) throws Exception {
 
int idPce = base.getTable("TYPE_REGLEMENT").getRow(2).getInt("ID_COMPTE_PCE_" + (achat ? "FOURN" : "CLIENT"));
int idPce = -1;
if (sqlRow.getTable().contains("ID_TYPE_REGLEMENT")) {
idPce = sqlRow.getForeign("ID_TYPE_REGLEMENT").getInt("ID_COMPTE_PCE_" + (achat ? "FOURN" : "CLIENT"));
} else {
idPce = base.getTable("TYPE_REGLEMENT").getRow(2).getInt("ID_COMPTE_PCE_" + (achat ? "FOURN" : "CLIENT"));
}
if (idPce <= 1) {
idPce = ComptePCESQLElement.getIdComptePceDefault(defaultProps);
}
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtSaisieAchat.java
20,6 → 20,7
import org.openconcerto.erp.model.PrixHT;
import org.openconcerto.erp.model.PrixTTC;
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;
37,16 → 38,12
private static final SQLTable tableFournisseur = base.getTable("FOURNISSEUR");
private static final SQLRow rowPrefsCompte = tablePrefCompte.getRow(2);
 
public GenerationMvtSaisieAchat(SQLRow row, int idMvt) {
public GenerationMvtSaisieAchat(SQLRow row) {
setRowAnalytiqueSource(row);
this.saisieRow = row;
this.idMvt = idMvt;
this.idMvt = row.getInt("ID_MOUVEMENT");
}
 
public GenerationMvtSaisieAchat(SQLRow row) {
this(row, 1);
}
 
public void genereMouvement() throws Exception {
SQLRow rowFournisseur = tableFournisseur.getRow(this.saisieRow.getInt("ID_FOURNISSEUR"));
 
105,9 → 102,14
idCompteTVA = ComptePCESQLElement.getIdComptePceDefault("TVAImmo");
}
} else {
idCompteTVA = rowPrefsCompte.getInt("ID_COMPTE_PCE_TVA_ACHAT");
if (idCompteTVA <= 1) {
idCompteTVA = ComptePCESQLElement.getIdComptePceDefault("TVADeductible");
SQLRowAccessor rowCptTva = this.saisieRow.getForeign("ID_TAXE").getForeign(rowFournisseur.getBoolean("UE") ? "ID_COMPTE_PCE_DED_INTRA" : "ID_COMPTE_PCE_DED");
if (rowCptTva == null || rowCptTva.isUndefined()) {
idCompteTVA = rowPrefsCompte.getInt("ID_COMPTE_PCE_TVA_ACHAT");
if (idCompteTVA <= 1) {
idCompteTVA = ComptePCESQLElement.getIdComptePceDefault("TVADeductible");
}
} else {
idCompteTVA = rowCptTva.getID();
}
}
this.mEcritures.put("ID_COMPTE_PCE", new Integer(idCompteTVA));
116,9 → 118,16
ajoutEcriture();
 
if (rowFournisseur.getBoolean("UE")) {
int idCompteTVAIntra = rowPrefsCompte.getInt("ID_COMPTE_PCE_TVA_INTRA");
if (idCompteTVAIntra <= 1) {
idCompteTVAIntra = ComptePCESQLElement.getIdComptePceDefault("TVAIntraComm");
SQLRowAccessor rowCptTva = this.saisieRow.getForeign("ID_TAXE").getForeign("ID_COMPTE_PCE_COLLECTE_INTRA");
int idCompteTVAIntra;
if (rowCptTva == null || rowCptTva.isUndefined()) {
idCompteTVAIntra = rowPrefsCompte.getInt("ID_COMPTE_PCE_TVA_INTRA");
 
if (idCompteTVAIntra <= 1) {
idCompteTVAIntra = ComptePCESQLElement.getIdComptePceDefault("TVAIntraComm");
}
} else {
idCompteTVAIntra = rowCptTva.getID();
}
this.mEcritures.put("ID_COMPTE_PCE", new Integer(idCompteTVAIntra));
this.mEcritures.put("DEBIT", new Long(0));
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtAvoirClient.java
100,11 → 100,27
 
TotalCalculator calc;
if (rowClient.getTable().contains("ID_COMPTE_PCE_PRODUIT") && !rowClient.isForeignEmpty("ID_COMPTE_PCE_PRODUIT")) {
calc = getValuesFromElement(false, "T_PV_HT", avoirRow, avoirRow.getTable().getTable("AVOIR_CLIENT_ELEMENT"), portHT, null, null, rowClient.getForeign("ID_COMPTE_PCE_PRODUIT"));
calc = getValuesFromElement(false, false, "T_PV_HT", avoirRow, avoirRow.getTable().getTable("AVOIR_CLIENT_ELEMENT"), portHT, null, null, rowClient.getForeign("ID_COMPTE_PCE_PRODUIT"));
} else {
calc = getValuesFromElement(avoirRow, avoirRow.getTable().getTable("AVOIR_CLIENT_ELEMENT"), portHT, null, null);
}
 
Map<SQLRowAccessor, BigDecimal> compl = calc.getMapHtTaxeCompl();
for (SQLRowAccessor rowCompl : compl.keySet()) {
if (compl.get(rowCompl) != null) {
long taxeC = compl.get(rowCompl).multiply(rowCompl.getBigDecimal("POURCENT").movePointLeft(2)).setScale(2, RoundingMode.HALF_UP).movePointRight(2).longValue();
this.mEcritures.put("ID_COMPTE_PCE", rowCompl.getForeignID("ID_COMPTE_PCE"));
this.mEcritures.put("CREDIT", Long.valueOf(0));
this.mEcritures.put("DEBIT", Long.valueOf(taxeC));
ajoutEcriture();
 
this.mEcritures.put("ID_COMPTE_PCE", rowCompl.getForeignID("ID_COMPTE_PCE_PRODUITS"));
this.mEcritures.put("CREDIT", Long.valueOf(taxeC));
this.mEcritures.put("DEBIT", Long.valueOf(0));
ajoutEcriture();
}
}
 
for (SQLRowAccessor row : calc.getMapHt().keySet()) {
long b = calc.getMapHt().get(row).setScale(2, RoundingMode.HALF_UP).movePointRight(2).longValue();
if (b != 0) {
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationReglementVenteNG.java
56,7 → 56,12
}
 
public GenerationReglementVenteNG(String label, SQLRow rowClient, PrixTTC ttc, Date d, SQLRow modeReglement, SQLRow source, SQLRow mvtSource, boolean createEncaisse) throws Exception {
this(label, rowClient, ttc, d, modeReglement, source, mvtSource, createEncaisse, false);
}
 
public GenerationReglementVenteNG(String label, SQLRow rowClient, PrixTTC ttc, Date d, SQLRow modeReglement, SQLRow source, SQLRow mvtSource, boolean createEncaisse, boolean avance)
throws Exception {
 
SQLRow typeRegRow = modeReglement.getForeignRow("ID_TYPE_REGLEMENT");
setRowAnalytiqueSource(source);
// iniatilisation des valeurs de la map
138,9 → 143,9
 
Calendar c = modeReglement.getDate("DATE_DEPOT");
if (c != null) {
paiementCheque(c.getTime(), source, ttc, rowClient.getID(), modeReglement, mvtSource.getTable().getRow(idMvt));
paiementCheque(c.getTime(), source, ttc, rowClient, modeReglement, mvtSource.getTable().getRow(idMvt), avance);
} else {
paiementCheque(this.date, source, ttc, rowClient.getID(), modeReglement, mvtSource.getTable().getRow(idMvt));
paiementCheque(this.date, source, ttc, rowClient, modeReglement, mvtSource.getTable().getRow(idMvt), avance);
}
 
} else {
160,19 → 165,27
this.mEcritures.put("ID_JOURNAL", JournalSQLElement.CAISSES);
}
 
// compte Clients
 
int idCompteClient = rowClient.getInt("ID_COMPTE_PCE");
if (idCompteClient <= 1) {
idCompteClient = rowPrefsCompte.getInt("ID_COMPTE_PCE_CLIENT");
if (avance) {
idCompteClient = rowPrefsCompte.getInt("ID_COMPTE_PCE_AVANCE_CLIENT");
if (idCompteClient <= 1) {
idCompteClient = ComptePCESQLElement.getIdComptePceDefault("Clients");
idCompteClient = ComptePCESQLElement.getIdComptePceDefault("AvanceClients");
}
} else {
 
// compte Clients
 
if (idCompteClient <= 1) {
idCompteClient = rowPrefsCompte.getInt("ID_COMPTE_PCE_CLIENT");
if (idCompteClient <= 1) {
idCompteClient = ComptePCESQLElement.getIdComptePceDefault("Clients");
}
}
}
 
this.mEcritures.put("ID_COMPTE_PCE", idCompteClient);
this.mEcritures.put("DEBIT", Long.valueOf(0));
this.mEcritures.put("CREDIT", Long.valueOf(ttc.getLongValue()));
 
this.ecrClient = ajoutEcriture();
 
// compte de reglement, caisse, cheque, ...
300,10 → 313,10
}
}
 
private void paiementCheque(Date dateEch, SQLRow source, PrixTTC ttc, int idClient, SQLRow modeRegl, SQLRow mvtSource) throws SQLException {
private void paiementCheque(Date dateEch, SQLRow source, PrixTTC ttc, SQLRow rowClient, SQLRow modeRegl, SQLRow mvtSource, boolean avance) throws Exception {
 
SQLRowValues valCheque = new SQLRowValues(base.getTable("CHEQUE_A_ENCAISSER"));
valCheque.put("ID_CLIENT", idClient);
valCheque.put("ID_CLIENT", rowClient.getID());
 
final String foreignBanqueFieldName = "ID_" + BanqueSQLElement.TABLENAME;
if (valCheque.getTable().contains(foreignBanqueFieldName))
326,5 → 339,40
rowVals.update(this.idMvt);
}
 
int idCompteClient = rowClient.getInt("ID_COMPTE_PCE");
if (avance) {
idCompteClient = rowPrefsCompte.getInt("ID_COMPTE_PCE_AVANCE_CLIENT");
if (idCompteClient <= 1) {
idCompteClient = ComptePCESQLElement.getIdComptePceDefault("AvanceClients");
}
} else {
 
// compte Clients
 
if (idCompteClient <= 1) {
idCompteClient = rowPrefsCompte.getInt("ID_COMPTE_PCE_CLIENT");
if (idCompteClient <= 1) {
idCompteClient = ComptePCESQLElement.getIdComptePceDefault("Clients");
}
}
}
this.mEcritures.put("ID_JOURNAL", JournalSQLElement.BANQUES);
this.mEcritures.put("ID_COMPTE_PCE", idCompteClient);
this.mEcritures.put("DEBIT", Long.valueOf(0));
this.mEcritures.put("CREDIT", Long.valueOf(ttc.getLongValue()));
 
this.ecrClient = ajoutEcriture();
 
// compte de reglement, caisse, cheque, ...
int idCompteRegl = rowPrefsCompte.getInt("ID_COMPTE_PCE_VALEUR_ENCAISSEMENT");
if (idCompteRegl <= 1) {
idCompteRegl = ComptePCESQLElement.getIdComptePceDefault("ValeurEncaissement");
}
this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idCompteRegl));
this.mEcritures.put("DEBIT", Long.valueOf(ttc.getLongValue()));
this.mEcritures.put("CREDIT", Long.valueOf(0));
 
ajoutEcriture();
 
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtSaisieVenteFacture.java
133,12 → 133,26
BigDecimal portHT = BigDecimal.valueOf(saisieRow.getLong("PORT_HT")).movePointLeft(2);
TotalCalculator calc;
if (clientRow.getTable().contains("ID_COMPTE_PCE_PRODUIT") && !clientRow.isForeignEmpty("ID_COMPTE_PCE_PRODUIT")) {
calc = getValuesFromElement(false, "T_PV_HT", saisieRow, saisieVFTable.getTable("SAISIE_VENTE_FACTURE_ELEMENT"), portHT, saisieRow.getForeign("ID_TAXE_PORT"), tableEchantillon,
calc = getValuesFromElement(false, false, "T_PV_HT", saisieRow, saisieVFTable.getTable("SAISIE_VENTE_FACTURE_ELEMENT"), portHT, saisieRow.getForeign("ID_TAXE_PORT"), tableEchantillon,
clientRow.getForeign("ID_COMPTE_PCE_PRODUIT"));
} else {
calc = getValuesFromElement(saisieRow, saisieVFTable.getTable("SAISIE_VENTE_FACTURE_ELEMENT"), portHT, saisieRow.getForeign("ID_TAXE_PORT"), tableEchantillon);
}
Map<SQLRowAccessor, BigDecimal> compl = calc.getMapHtTaxeCompl();
for (SQLRowAccessor rowCompl : compl.keySet()) {
if (compl.get(rowCompl) != null) {
long taxeC = compl.get(rowCompl).multiply(rowCompl.getBigDecimal("POURCENT").movePointLeft(2)).setScale(2, RoundingMode.HALF_UP).movePointRight(2).longValue();
this.mEcritures.put("ID_COMPTE_PCE", rowCompl.getForeignID("ID_COMPTE_PCE"));
this.mEcritures.put("DEBIT", Long.valueOf(0));
this.mEcritures.put("CREDIT", Long.valueOf(taxeC));
ajoutEcriture();
 
this.mEcritures.put("ID_COMPTE_PCE", rowCompl.getForeignID("ID_COMPTE_PCE_PRODUITS"));
this.mEcritures.put("DEBIT", Long.valueOf(taxeC));
this.mEcritures.put("CREDIT", Long.valueOf(0));
ajoutEcriture();
}
}
// On génére les ecritures si la facture n'est pas un acompte
long ttcLongValue = calc.getTotalTTC().movePointRight(2).longValue();
if (acompte == null || !acompte) {
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtSaisieVenteComptoir.java
18,6 → 18,7
import org.openconcerto.erp.model.PrixHT;
import org.openconcerto.erp.model.PrixTTC;
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;
116,10 → 117,18
// compte TVA
long tva = prixTTC.calculLongTVA(taxeRow.getFloat("TAUX") / 100.0);
if (tva > 0) {
int idCompteTVA = rowPrefsCompte.getInt("ID_COMPTE_PCE_TVA_VENTE");
if (idCompteTVA <= 1) {
idCompteTVA = ComptePCESQLElement.getIdComptePceDefault("TVACollectee");
int idCompteTVA;
 
SQLRowAccessor rowCptTva = saisieRow.getForeign("ID_TAXE").getForeign("ID_COMPTE_PCE_COLLECTE");
if (rowCptTva == null || rowCptTva.isUndefined()) {
idCompteTVA = rowPrefsCompte.getInt("ID_COMPTE_PCE_TVA_VENTE");
if (idCompteTVA <= 1) {
idCompteTVA = ComptePCESQLElement.getIdComptePceDefault("TVACollectee");
}
} else {
idCompteTVA = rowCptTva.getID();
}
 
this.mEcritures.put("ID_COMPTE_PCE", new Integer(idCompteTVA));
this.mEcritures.put("DEBIT", new Long(0));
this.mEcritures.put("CREDIT", new Long(tva));
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtFactureFournisseur.java
95,7 → 95,8
}
}
 
TotalCalculator calc = getValuesFromElement(true, "T_PA_HT", saisieRow, saisieRow.getTable().getTable("FACTURE_FOURNISSEUR_ELEMENT"), BigDecimal.ZERO, null, null, rowCompteAchat);
TotalCalculator calc = getValuesFromElement(rowFournisseur.getBoolean("UE"), true, "T_PA_HT", saisieRow, saisieRow.getTable().getTable("FACTURE_FOURNISSEUR_ELEMENT"), BigDecimal.ZERO, null,
null, rowCompteAchat);
 
long ttcLongValue = calc.getTotalTTC().movePointRight(2).longValue();
long htLongValue = calc.getTotalHT().movePointRight(2).longValue();
120,19 → 121,41
this.mEcritures.put("DEBIT", longValue);
ajoutEcriture();
 
if (rowFournisseur.getBoolean("UE")) {
int idCompteTVAIntra = rowPrefsCompte.getInt("ID_COMPTE_PCE_TVA_INTRA");
if (idCompteTVAIntra <= 1) {
idCompteTVAIntra = ComptePCESQLElement.getIdComptePceDefault("TVAIntraComm");
}
this.mEcritures.put("ID_COMPTE_PCE", new Integer(idCompteTVAIntra));
this.mEcritures.put("DEBIT", new Long(0));
this.mEcritures.put("CREDIT", new Long(longValue));
ajoutEcriture();
}
// if (rowFournisseur.getBoolean("UE")) {
// int idCompteTVAIntra = rowPrefsCompte.getInt("ID_COMPTE_PCE_TVA_INTRA");
// if (idCompteTVAIntra <= 1) {
// idCompteTVAIntra = ComptePCESQLElement.getIdComptePceDefault("TVAIntraComm");
// }
// this.mEcritures.put("ID_COMPTE_PCE", new Integer(idCompteTVAIntra));
// this.mEcritures.put("DEBIT", new Long(0));
// this.mEcritures.put("CREDIT", new Long(longValue));
// ajoutEcriture();
// }
}
}
Map<SQLRowAccessor, BigDecimal> tvaMapIntra = calc.getMapHtTVAIntra();
for (SQLRowAccessor rowAc : tvaMapIntra.keySet()) {
long longValue = tvaMapIntra.get(rowAc).setScale(2, RoundingMode.HALF_UP).movePointRight(2).longValue();
if (longValue != 0) {
this.mEcritures.put("ID_COMPTE_PCE", rowAc.getID());
this.mEcritures.put("DEBIT", Long.valueOf(0));
this.mEcritures.put("CREDIT", longValue);
ajoutEcriture();
 
// if (rowFournisseur.getBoolean("UE")) {
// int idCompteTVAIntra = rowPrefsCompte.getInt("ID_COMPTE_PCE_TVA_INTRA");
// if (idCompteTVAIntra <= 1) {
// idCompteTVAIntra = ComptePCESQLElement.getIdComptePceDefault("TVAIntraComm");
// }
// this.mEcritures.put("ID_COMPTE_PCE", new Integer(idCompteTVAIntra));
// this.mEcritures.put("DEBIT", new Long(0));
// this.mEcritures.put("CREDIT", new Long(longValue));
// ajoutEcriture();
// }
}
}
 
// compte Fournisseurs
int idCompteFourn = rowFournisseur.getInt("ID_COMPTE_PCE");
 
/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/edm/FilePanel.java
Nouveau fichier
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);
}
}
}
/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
/trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/odt-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: 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: OpenConcerto/src/org/openconcerto/erp/core/edm/xls-icon.png
===================================================================
--- OpenConcerto/src/org/openconcerto/erp/core/edm/xls-icon.png (revision 0)
+++ OpenConcerto/src/org/openconcerto/erp/core/edm/xls-icon.png (revision 142)
/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: OpenConcerto/src/org/openconcerto/erp/core/edm/AttachmentSQLElement.java
===================================================================
--- OpenConcerto/src/org/openconcerto/erp/core/edm/AttachmentSQLElement.java (revision 0)
+++ OpenConcerto/src/org/openconcerto/erp/core/edm/AttachmentSQLElement.java (revision 142)
@@ -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";
+ }
+}
Index: OpenConcerto/src/org/openconcerto/erp/core/edm/data-icon.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: OpenConcerto/src/org/openconcerto/erp/core/edm/data-icon.png
===================================================================
--- OpenConcerto/src/org/openconcerto/erp/core/edm/data-icon.png (revision 0)
+++ OpenConcerto/src/org/openconcerto/erp/core/edm/data-icon.png (revision 142)
/OpenConcerto/src/org/openconcerto/erp/core/edm/data-icon.png
Changements de propriété:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: 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: OpenConcerto/src/org/openconcerto/erp/core/edm/pdf-icon.png
===================================================================
--- OpenConcerto/src/org/openconcerto/erp/core/edm/pdf-icon.png (revision 0)
+++ OpenConcerto/src/org/openconcerto/erp/core/edm/pdf-icon.png (revision 142)
/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: OpenConcerto/src/org/openconcerto/erp/core/edm/AttachmentAction.java
===================================================================
--- OpenConcerto/src/org/openconcerto/erp/core/edm/AttachmentAction.java (revision 0)
+++ 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: 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: OpenConcerto/src/org/openconcerto/erp/core/edm/docx-icon.png
===================================================================
--- OpenConcerto/src/org/openconcerto/erp/core/edm/docx-icon.png (revision 0)
+++ OpenConcerto/src/org/openconcerto/erp/core/edm/docx-icon.png (revision 142)
/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: 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: OpenConcerto/src/org/openconcerto/erp/core/edm/xlsx-icon.png
===================================================================
--- OpenConcerto/src/org/openconcerto/erp/core/edm/xlsx-icon.png (revision 0)
+++ OpenConcerto/src/org/openconcerto/erp/core/edm/xlsx-icon.png (revision 142)
/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: OpenConcerto/src/org/openconcerto/erp/core/edm/AttachmentPanel.java
===================================================================
--- OpenConcerto/src/org/openconcerto/erp/core/edm/AttachmentPanel.java (revision 0)
+++ 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: OpenConcerto/src/org/openconcerto/erp/core/edm/AttachmentUtils.java
===================================================================
--- OpenConcerto/src/org/openconcerto/erp/core/edm/AttachmentUtils.java (revision 0)
+++ 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: 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: OpenConcerto/src/org/openconcerto/erp/core/edm/jpg-icon.png
===================================================================
--- OpenConcerto/src/org/openconcerto/erp/core/edm/jpg-icon.png (revision 0)
+++ OpenConcerto/src/org/openconcerto/erp/core/edm/jpg-icon.png (revision 142)
/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: 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: OpenConcerto/src/org/openconcerto/erp/core/edm/png-icon.png
===================================================================
--- OpenConcerto/src/org/openconcerto/erp/core/edm/png-icon.png (revision 0)
+++ OpenConcerto/src/org/openconcerto/erp/core/edm/png-icon.png (revision 142)
/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: 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: OpenConcerto/src/org/openconcerto/erp/core/edm/doc-icon.png
===================================================================
--- OpenConcerto/src/org/openconcerto/erp/core/edm/doc-icon.png (revision 0)
+++ OpenConcerto/src/org/openconcerto/erp/core/edm/doc-icon.png (revision 142)
/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: 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: OpenConcerto/src/org/openconcerto/erp/core/edm/ods-icon.png
===================================================================
--- OpenConcerto/src/org/openconcerto/erp/core/edm/ods-icon.png (revision 0)
+++ OpenConcerto/src/org/openconcerto/erp/core/edm/ods-icon.png (revision 142)
/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: OpenConcerto/src/org/openconcerto/erp/core/sales/quote/element/DevisItemSQLElement.java
===================================================================
--- OpenConcerto/src/org/openconcerto/erp/core/sales/quote/element/DevisItemSQLElement.java (revision 141)
+++ OpenConcerto/src/org/openconcerto/erp/core/sales/quote/element/DevisItemSQLElement.java (revision 142)
@@ -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.event.DocumentEvent;
178,7 → 182,16
c.gridx++;
c.weightx = 1;
c.fill = GridBagConstraints.NONE;
this.numeroUniqueDevis = new JUniqueTextField(15);
this.numeroUniqueDevis = new JUniqueTextField(15) {
@Override
public String getAutoRefreshNumber() {
if (getMode() == Mode.INSERTION) {
return NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), dateDevis.getDate());
} else {
return null;
}
}
};
 
DefaultGridBagConstraints.lockMinimumSize(this.numeroUniqueDevis);
DefaultGridBagConstraints.lockMaximumSize(this.numeroUniqueDevis);
597,6 → 610,7
this.fieldHT = new DeviseField();
final DeviseField fieldTVA = new DeviseField();
final DeviseField fieldTTC = new DeviseField();
final DeviseField fieldEco = new DeviseField();
final DeviseField fieldDevise = new DeviseField();
final DeviseField fieldService = new DeviseField();
this.fieldHT.setEditable(false);
603,7 → 617,9
fieldTVA.setEditable(false);
fieldTTC.setEditable(false);
fieldService.setEditable(false);
fieldEco.setEditable(false);
 
addSQLObject(fieldEco, "T_ECO_CONTRIBUTION");
addRequiredSQLObject(this.fieldHT, "T_HT");
addRequiredSQLObject(fieldTVA, "T_TVA");
addSQLObject(fieldDevise, "T_DEVISE");
622,7 → 638,7
addSQLObject(fieldHA, "T_HA");
}
 
final TotalPanel totalTTC = new TotalPanel(this.table, this.fieldHT, fieldTVA, fieldTTC, textPortHT, this.textRemiseHT, fieldService, fieldHA, fieldDevise, poids, null);
final TotalPanel totalTTC = new TotalPanel(this.table, fieldEco, this.fieldHT, fieldTVA, fieldTTC, textPortHT, this.textRemiseHT, fieldService, fieldHA, fieldDevise, poids, null);
 
cBottom.gridy = 0;
cBottom.gridx += 2;
768,54 → 784,92
cTabSite.fill = GridBagConstraints.HORIZONTAL;
cTabSite.weightx = 0;
 
// Coche
cTabSite.gridx = 0;
cTabSite.gridwidth = 2;
cTabSite.weightx = 0;
JCheckBox boxAsaisir = new JCheckBox("Rapport à saisir");
tabSite.add(boxAsaisir, cTabSite);
 
// Type Rapport
JLabel labelRapport = new JLabel(getLabelFor("TYPE_RAPPORT"));
cTabSite.gridx = 2;
tabSite.add(labelRapport, cTabSite);
SQLTextCombo comboType = new SQLTextCombo();
cTabSite.gridwidth = GridBagConstraints.REMAINDER;
cTabSite.gridx++;
cTabSite.weightx = 1;
tabSite.add(comboType, cTabSite);
cTabSite.gridwidth = 1;
 
// Date
// Nb Rapport
cTabSite.gridx = 0;
cTabSite.gridy++;
cTabSite.weightx = 0;
tabSite.add(new JLabel(getLabelFor("NB_RAPPORT_A_SAISIR")), cTabSite);
cTabSite.gridx++;
cTabSite.weightx = 1;
JTextField fieldNbRapportASaisir = new JTextField(5);
tabSite.add(fieldNbRapportASaisir, cTabSite);
 
// Date
cTabSite.gridx++;
cTabSite.weightx = 0;
tabSite.add(new JLabel(getLabelFor("DATE_DEMANDE_SAISIE")), cTabSite);
cTabSite.gridx++;
cTabSite.weightx = 0;
JDate dateDmdSaisie = new JDate();
tabSite.add(dateDmdSaisie, cTabSite);
 
cTabSite.gridx++;
tabSite.add(new JLabel(getLabelFor("DATE_SAISIE")), cTabSite);
cTabSite.gridx++;
JDate dateSaisie = new JDate();
tabSite.add(dateSaisie, cTabSite);
 
// Coche
cTabSite.gridx = 0;
cTabSite.gridy++;
cTabSite.gridwidth = 2;
JCheckBox boxAsaisir = new JCheckBox("Rapport à saisir");
tabSite.add(boxAsaisir, cTabSite);
 
cTabSite.gridx += 2;
cTabSite.weightx = 0;
JCheckBox boxAcceptSaisie = new JCheckBox("Accepté en saisie");
tabSite.add(boxAcceptSaisie, cTabSite);
cTabSite.gridwidth = 1;
 
// Nb Rapport
cTabSite.gridy++;
cTabSite.gridx = 0;
cTabSite.weightx = 0;
tabSite.add(new JLabel(getLabelFor("NB_RAPPORT_SAISI")), cTabSite);
cTabSite.gridx++;
cTabSite.weightx = 1;
JTextField fieldNbRapportSaisi = new JTextField(5);
tabSite.add(fieldNbRapportSaisi, cTabSite);
 
cTabSite.gridx++;
cTabSite.weightx = 0;
tabSite.add(new JLabel(getLabelFor("DATE_SAISIE")), cTabSite);
cTabSite.gridx++;
cTabSite.weightx = 0;
JDate dateSaisie = new JDate();
tabSite.add(dateSaisie, cTabSite);
if (!UserRightsManager.getCurrentUserRights().haveRight("VOIR_DEVIS_4_SEMAINES")) {
cTabSite.gridx++;
cTabSite.weightx = 0;
tabSite.add(new JLabel(getLabelFor("DATE_SAISIE_REELLE")), cTabSite);
cTabSite.gridx++;
cTabSite.weightx = 0;
JDate dateSaisieR = new JDate();
tabSite.add(dateSaisieR, cTabSite);
this.addView(dateSaisieR, "DATE_SAISIE_REELLE");
}
cTabSite.gridy++;
tabSite.add(new JLabel(getLabelFor("NB_RAPPORT_A_SAISIR")), cTabSite);
cTabSite.weightx = 0;
cTabSite.gridx = 0;
tabSite.add(new JLabel(getLabelFor("TEMPS_SAISIE")), cTabSite);
cTabSite.gridx++;
JTextField fieldNbRapportASaisir = new JTextField();
tabSite.add(fieldNbRapportASaisir, cTabSite);
cTabSite.weightx = 1;
JTextField fieldTpsSaisi = new JTextField(5);
tabSite.add(fieldTpsSaisi, cTabSite);
 
cTabSite.gridx++;
tabSite.add(new JLabel(getLabelFor("NB_RAPPORT_SAISI")), cTabSite);
cTabSite.weightx = 0;
tabSite.add(new JLabel(getLabelFor("ID_USER_COMMON_SAISIE")), cTabSite);
cTabSite.gridx++;
JTextField fieldNbRapportSaisi = new JTextField();
tabSite.add(fieldNbRapportSaisi, cTabSite);
cTabSite.weightx = 1;
SQLRequestComboBox boxUserSaisi = new SQLRequestComboBox();
tabSite.add(boxUserSaisi, cTabSite);
 
// Date de demande
// Nb rapport a saisie
829,6 → 883,8
this.addView(dateSaisie, "DATE_SAISIE");
this.addView(boxAcceptSaisie, "ACCEPTE_EN_SAISIE");
this.addView(boxAsaisir, "RAPPORT_A_SAISIR");
this.addView(boxUserSaisi, "ID_USER_COMMON_SAISIE");
this.addView(fieldTpsSaisi, "TEMPS_SAISIE");
}
return tabSite;
}
1086,7 → 1142,7
if (getTable().getFieldsName().contains("DATE_VALIDITE")) {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.MONTH, 1);
rowVals.put("DATE_VALIDITE", cal.getTime());
rowVals.put("DATE_VALIDITE", new java.sql.Date(cal.getTimeInMillis()));
}
return rowVals;
}
1117,8 → 1173,34
public int insert(final SQLRow order) {
 
final int idDevis;
int attempt = 0;
// on verifie qu'un devis du meme numero n'a pas été inséré entre temps
if (this.numeroUniqueDevis.checkValidation()) {
if (!this.numeroUniqueDevis.checkValidation(false)) {
while (attempt < JUniqueTextField.RETRY_COUNT) {
String num = NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), dateDevis.getDate());
this.numeroUniqueDevis.setText(num);
attempt++;
if (this.numeroUniqueDevis.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.numeroUniqueDevis.getText();
if (attempt == JUniqueTextField.RETRY_COUNT) {
idDevis = getSelectedID();
ExceptionHandler.handle("Impossible d'ajouter, numéro de devis existant.");
final Object root = SwingUtilities.getRoot(this);
if (root instanceof EditFrame) {
final EditFrame frame = (EditFrame) root;
frame.getPanel().setAlwaysVisible(true);
}
} else {
 
idDevis = super.insert(order);
this.table.updateField("ID_DEVIS", idDevis);
1146,13 → 1228,12
e.printStackTrace();
}
}
} else {
idDevis = getSelectedID();
ExceptionHandler.handle("Impossible d'ajouter, numéro de devis existant.");
final Object root = SwingUtilities.getRoot(this);
if (root instanceof EditFrame) {
final 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/sales/product/model/ProductHelper.java
137,16 → 137,21
public Map<Long, BigDecimal> getUnitCost(Map<Long, Integer> productQties, TypePrice type) {
final Map<Long, BigDecimal> result = new HashMap<Long, BigDecimal>();
 
String fieldPrice = (type == TypePrice.ARTICLE_TARIF_FOURNISSEUR ? "PRIX_ACHAT_DEVISE_F" : "PRIX");
String fieldDate = (type == TypePrice.ARTICLE_TARIF_FOURNISSEUR ? "DATE_PRIX" : "DATE");
String fieldPrice = (type == TypePrice.ARTICLE_TARIF_FOURNISSEUR || type == TypePrice.ARTICLE_TARIF_FOURNISSEUR_DDP ? "PRIX_ACHAT_DEVISE_F" : "PRIX");
String fieldDate = (type == TypePrice.ARTICLE_TARIF_FOURNISSEUR || type == TypePrice.ARTICLE_TARIF_FOURNISSEUR_DDP ? "DATE_PRIX" : "DATE");
 
// get all costs
final SQLTable costTable = root.getTable(type.name());
final SQLTable costTable = root.getTable(type == TypePrice.ARTICLE_TARIF_FOURNISSEUR_DDP ? "ARTICLE_TARIF_FOURNISSEUR" : type.name());
final SQLSelect sel = new SQLSelect();
sel.addSelect(costTable.getKey());
sel.addSelect(costTable.getField("ID_ARTICLE"));
sel.addSelect(costTable.getField("QTE"));
sel.addSelect(costTable.getField(fieldPrice));
if (type == TypePrice.ARTICLE_TARIF_FOURNISSEUR_DDP) {
for (SupplierPriceField f : SupplierPriceField.values()) {
sel.addSelect(costTable.getField(f.name()));
}
}
sel.addSelect(costTable.getField(fieldDate));
sel.setWhere(new Where(costTable.getField("ID_ARTICLE"), true, productQties.keySet()));
sel.addFieldOrder(costTable.getField("QTE"));
158,30 → 163,42
System.out.println(sqlRow.getID() + ":" + sqlRow.getAllValues());
}
final int size = l.size();
for (Long id : productQties.keySet()) {
BigDecimal cost = BigDecimal.ZERO;
final int qty = productQties.get(id);
for (int i = 0; i < size; i++) {
final SQLRow row = l.get(i);
if (row.getInt("ID_ARTICLE") == id.intValue()) {
// stop when the max qty is found
if (row.getLong("QTE") > qty) {
if (cost == null) {
if (size == 0 && type == TypePrice.ARTICLE_PRIX_REVIENT) {
return getUnitCost(productQties, TypePrice.ARTICLE_TARIF_FOURNISSEUR_DDP);
} else {
for (Long id : productQties.keySet()) {
BigDecimal cost = BigDecimal.ZERO;
final int qty = productQties.get(id);
for (int i = 0; i < size; i++) {
final SQLRow row = l.get(i);
if (row.getInt("ID_ARTICLE") == id.intValue()) {
// stop when the max qty is found
if (row.getLong("QTE") > qty) {
if (cost == null) {
if (type == TypePrice.ARTICLE_TARIF_FOURNISSEUR_DDP) {
cost = getEnumPrice(row, SupplierPriceField.COEF_TRANSPORT_SIEGE);
} else {
cost = row.getBigDecimal(fieldPrice);
}
}
break;
}
if (type == TypePrice.ARTICLE_TARIF_FOURNISSEUR_DDP) {
cost = getEnumPrice(row, SupplierPriceField.COEF_TRANSPORT_SIEGE);
} else {
cost = row.getBigDecimal(fieldPrice);
}
break;
 
}
cost = row.getBigDecimal(fieldPrice);
}
if (cost == null) {
cost = BigDecimal.ZERO;
}
 
}
result.put(id, cost);
}
if (cost == null) {
cost = BigDecimal.ZERO;
}
 
result.put(id, cost);
return result;
}
return result;
}
 
/**
210,7 → 227,11
final Map<Integer, BigDecimal> qtyParent = new HashMap<Integer, BigDecimal>();
for (ProductComponent p : items) {
parentsArticleIDs.add(p.getProduct().getID());
qtyParent.put(p.getProduct().getID(), p.getQty());
BigDecimal qty = BigDecimal.ZERO;
if (qtyParent.get(p.getProduct().getID()) != null) {
qty = qtyParent.get(p.getProduct().getID());
}
qtyParent.put(p.getProduct().getID(), qty.add(p.getQty()));
}
 
// get all childs
240,23 → 261,25
if (childs.size() > 0) {
 
for (SQLRowValues childRowValues : childs) {
 
final SQLRowAccessor foreignArticleParent = childRowValues.getForeign("ID_ARTICLE_PARENT");
ProductComponent childComponent = ProductComponent.createFrom(childRowValues);
// Test pour éviter les boucles dans les boms
if (!ancestors.contains(childComponent.getProduct().getID())) {
ancestors.add(foreignArticleParent.getID());
// parentsArticleIDs.remove(foreignArticleParent.getID());
// Calcul de la quantité qte_unit * qte * qteMergedParent
childComponent.setQty(childComponent.getQty().multiply(qtyParent.get(foreignArticleParent.getID()), DecimalUtils.HIGH_PRECISION));
 
// Cumul des valeurs si l'article est présent plusieurs fois dans le bom
ProductComponent existProduct = productCompByID.get(childComponent.getProduct().getID());
if (existProduct == null) {
result.add(childComponent);
productCompByID.put(childComponent.getProduct().getID(), childComponent);
} else {
existProduct.addQty(childComponent.getQty());
if (!childRowValues.isForeignEmpty("ID_ARTICLE") && childRowValues.getForeign("ID_ARTICLE") != null) {
ProductComponent childComponent = ProductComponent.createFrom(childRowValues);
// Test pour éviter les boucles dans les boms
if (!ancestors.contains(childComponent.getProduct().getID())) {
ancestors.add(foreignArticleParent.getID());
// parentsArticleIDs.remove(foreignArticleParent.getID());
// Calcul de la quantité qte_unit * qte * qteMergedParent
childComponent.setQty(childComponent.getQty().multiply(qtyParent.get(foreignArticleParent.getID()), DecimalUtils.HIGH_PRECISION));
 
// Cumul des valeurs si l'article est présent plusieurs fois dans le bom
ProductComponent existProduct = productCompByID.get(childComponent.getProduct().getID());
if (existProduct == null) {
result.add(childComponent);
productCompByID.put(childComponent.getProduct().getID(), childComponent);
} else {
existProduct.addQty(childComponent.getQty());
}
}
}
}
334,7 → 357,7
}
 
public enum TypePrice {
ARTICLE_PRIX_REVIENT, ARTICLE_PRIX_MIN_VENTE, ARTICLE_PRIX_PUBLIC, ARTICLE_TARIF_FOURNISSEUR
ARTICLE_PRIX_REVIENT, ARTICLE_PRIX_MIN_VENTE, ARTICLE_PRIX_PUBLIC, ARTICLE_TARIF_FOURNISSEUR, ARTICLE_TARIF_FOURNISSEUR_DDP
};
 
public BigDecimal getBomPriceForQuantity(int qty, Collection<? extends SQLRowAccessor> rowValuesProductItems, TypePrice type) {
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/component/ReferenceArticleSQLComponent.java
42,6 → 42,7
import org.openconcerto.sql.sqlobject.ElementComboBox;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.FormLayouter;
import org.openconcerto.ui.TitledSeparator;
import org.openconcerto.ui.component.ITextArea;
import org.openconcerto.ui.preferences.DefaultProps;
import org.openconcerto.utils.DecimalUtils;
399,7 → 400,32
panel.setOpaque(false);
GridBagConstraints c = new DefaultGridBagConstraints();
 
c.weightx = 0;
JLabel labelEco = new JLabel(getLabelFor("ID_ECO_CONTRIBUTION"));
c.fill = GridBagConstraints.BOTH;
panel.add(labelEco, c);
c.weightx = 1;
c.gridx++;
ElementComboBox box = new ElementComboBox();
panel.add(box, c);
 
c.weightx = 0;
c.gridy++;
c.gridx = 0;
JLabel labelTaxeCompl = new JLabel(getLabelFor("ID_TAXE_COMPLEMENTAIRE"));
c.fill = GridBagConstraints.BOTH;
panel.add(labelTaxeCompl, c);
c.weightx = 1;
c.gridx++;
ElementComboBox boxTaxeCompl = new ElementComboBox();
panel.add(boxTaxeCompl, c);
 
c.gridy++;
c.gridx = 0;
c.gridwidth = GridBagConstraints.REMAINDER;
TitledSeparator sep = new TitledSeparator(getLabelFor("INFOS"));
panel.add(sep, c);
c.gridy++;
c.weighty = 1;
ITextArea infos = new ITextArea();
c.fill = GridBagConstraints.BOTH;
406,7 → 432,8
panel.add(infos, c);
 
this.addSQLObject(infos, "INFOS");
 
this.addSQLObject(box, "ID_ECO_CONTRIBUTION");
this.addSQLObject(boxTaxeCompl, "ID_TAXE_COMPLEMENTAIRE");
return panel;
}
 
537,7 → 564,7
panel.setOpaque(false);
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/sales/product/element/EcoContributionSQLElement.java
Nouveau fichier
0,0 → 1,115
/*
* 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.product.element;
 
import org.openconcerto.sql.element.BaseSQLComponent;
import org.openconcerto.sql.element.ConfSQLElement;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.sqlobject.ElementComboBox;
import org.openconcerto.sql.sqlobject.SQLRequestComboBox;
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;
 
import javax.swing.JLabel;
import javax.swing.JTextField;
 
public class EcoContributionSQLElement extends ConfSQLElement {
 
public EcoContributionSQLElement() {
super("ECO_CONTRIBUTION");
}
 
protected List<String> getListFields() {
final List<String> list = new ArrayList<String>(2);
list.add("ID_FAMILLE_ECO_CONTRIBUTION");
list.add("CODE");
list.add("NOM");
list.add("TAUX");
return list;
}
 
protected List<String> getComboFields() {
final List<String> list = new ArrayList<String>(2);
list.add("CODE");
list.add("NOM");
list.add("TAUX");
return list;
}
 
@Override
public ListMap<String, String> getShowAs() {
return ListMap.singleton(null, "CODE", "NOM");
 
}
 
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(getLabelFor("CODE"));
c.weightx = 0;
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(getLabelFor("NOM"));
this.add(labelNom, c);
c.gridx++;
c.weightx = 1;
final JTextField textNom = new JTextField();
this.add(textNom, c);
 
// Famille
c.gridy++;
c.gridx = 0;
c.weightx = 0;
final JLabel labelFamille = new JLabel(getLabelFor("ID_FAMILLE_ECO_CONTRIBUTION"));
this.add(labelFamille, c);
c.gridx++;
c.weightx = 1;
ElementComboBox combo = new ElementComboBox();
this.add(combo, c);
 
// Taux
c.gridx++;
c.weightx = 0;
final JLabel labelTaux = new JLabel(getLabelFor("TAUX"));
this.add(labelTaux, c);
c.gridx++;
c.weightx = 1;
final JTextField textTaux = new JTextField();
this.add(textTaux, c);
 
this.addRequiredSQLObject(textTaux, "TAUX");
this.addSQLObject(combo, "ID_FAMILLE_ECO_CONTRIBUTION");
this.addRequiredSQLObject(textNom, "NOM");
this.addRequiredSQLObject(textCode, "CODE");
}
};
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/element/ReliquatSQLElement.java
13,16 → 13,6
package org.openconcerto.erp.core.sales.product.element;
 
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 javax.swing.AbstractAction;
import javax.swing.JLabel;
 
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.erp.core.sales.invoice.ui.FactureAffacturerTable;
import org.openconcerto.erp.core.supplychain.receipt.component.BonReceptionSQLComponent;
37,6 → 27,16
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
import org.openconcerto.ui.DefaultGridBagConstraints;
 
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 javax.swing.AbstractAction;
import javax.swing.JLabel;
 
public class ReliquatSQLElement extends ComptaSQLConfElement {
 
private final String tableBonName;
73,7 → 73,7
for (SQLRowValues rowVals : rows) {
try {
SQLRowValues upRowVals = rowVals.createEmptyUpdateRow();
upRowVals.put("ID_BON_RECEPTION", id);
upRowVals.put("ID_" + tableBonName, id);
upRowVals.update();
} catch (SQLException exn) {
exn.printStackTrace();
91,8 → 91,13
}
});
 
BonReceptionSQLComponent comp = (BonReceptionSQLComponent) frame.getSQLComponent();
comp.loadFromReliquat(rows);
SQLComponent comp = (SQLComponent) frame.getSQLComponent();
if (comp instanceof BonReceptionSQLComponent) {
((BonReceptionSQLComponent) comp).loadFromReliquat(rows);
} else {
// ((BonDeLivraisonSQLComponent) comp).loadFromReliquat(rows);
 
}
frame.setVisible(true);
 
}
107,7 → 112,6
 
@Override
protected String getParentFFName() {
 
return "ID_" + this.tableBonName;
}
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/element/FamilleEcoContributionSQLElement.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.sales.product.element;
 
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.utils.ListMap;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.ArrayList;
import java.util.List;
 
import javax.swing.JLabel;
import javax.swing.JTextField;
 
public class FamilleEcoContributionSQLElement extends ConfSQLElement {
 
public FamilleEcoContributionSQLElement() {
super("FAMILLE_ECO_CONTRIBUTION");
}
 
protected List<String> getListFields() {
final List<String> list = new ArrayList<String>(2);
list.add("NOM");
return list;
}
 
protected List<String> getComboFields() {
final List<String> list = new ArrayList<String>(2);
list.add("NOM");
return list;
}
 
@Override
public ListMap<String, String> getShowAs() {
ListMap<String, String> map = new ListMap<String, String>();
map.add(null, "NOM");
return map;
}
 
public SQLComponent createComponent() {
return new BaseSQLComponent(this) {
 
public void addViews() {
this.setLayout(new GridBagLayout());
final GridBagConstraints c = new DefaultGridBagConstraints();
 
// Nom
c.gridx++;
c.weightx = 0;
final JLabel labelNom = new JLabel(getLabelFor("NOM"));
this.add(labelNom, c);
c.gridx++;
c.weightx = 1;
final JTextField textNom = new JTextField();
this.add(textNom, c);
 
this.addRequiredSQLObject(textNom, "NOM");
}
};
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/element/ReferenceArticleSQLElement.java
16,6 → 16,7
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.erp.core.common.ui.PanelFrame;
import org.openconcerto.erp.core.edm.AttachmentAction;
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
import org.openconcerto.erp.core.sales.product.action.InventairePanel;
import org.openconcerto.erp.core.sales.product.component.ReferenceArticleSQLComponent;
36,7 → 37,6
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.model.graph.Path;
import org.openconcerto.sql.preferences.SQLPreferences;
import org.openconcerto.sql.request.ComboSQLRequest;
import org.openconcerto.sql.view.EditFrame;
import org.openconcerto.sql.view.EditPanel.EditMode;
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
44,9 → 44,8
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.SQLTableModelSourceOnline;
import org.openconcerto.sql.view.list.SQLTableModelSource;
import org.openconcerto.ui.FrameUtil;
import org.openconcerto.utils.ListMap;
import org.openconcerto.utils.CollectionUtils;
import org.openconcerto.utils.DecimalUtils;
import org.openconcerto.utils.ListMap;
55,7 → 54,6
import java.math.BigDecimal;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Set;
111,11 → 109,15
}, true, false);
clone.setPredicate(IListeEvent.getSingleSelectionPredicate());
getRowActions().add(clone);
 
PredicateRowAction actionAttachment = new PredicateRowAction(new AttachmentAction().getAction(), true);
actionAttachment.setPredicate(IListeEvent.getSingleSelectionPredicate());
getRowActions().add(actionAttachment);
}
 
@Override
protected SQLTableModelSourceOnline createTableSource() {
SQLTableModelSourceOnline source = super.createTableSource();
protected synchronized void _initTableSource(final SQLTableModelSource source) {
super._initTableSource(source);
source.init();
final SQLTableModelColumn pvHA1Col = source.getColumn(getTable().getField("PRIX_METRIQUE_HA_1"));
if (pvHA1Col != null) {
164,7 → 166,6
}
});
}
return source;
}
 
protected List<String> getListFields() {
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/action/ListeEcoContributionAction.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.sales.product.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 ListeEcoContributionAction extends CreateFrameAbstractAction {
 
public ListeEcoContributionAction() {
super();
this.putValue(Action.NAME, "Barème éco-contribution");
}
 
public JFrame createFrame() {
return new IListFrame(new ListeAddPanel(Configuration.getInstance().getDirectory().getElement("ECO_CONTRIBUTION")));
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/action/ListeDesArticlesAction.java
81,8 → 81,7
final SQLElement elt = Configuration.getInstance().getDirectory().getElement(this.sqlTableArticle);
final FamilleArticlePanel panelFam = new FamilleArticlePanel(elt.getForeignElement("ID_FAMILLE_ARTICLE"));
 
final SQLTableModelSourceOnline createTableSource = elt.initTableSource(elt.getTableSource(true));
createTableSource.init();
final SQLTableModelSourceOnline createTableSource = elt.createTableSource();
 
SQLTableModelColumn colStock;
if (elt.getTable().getDBRoot().contains("ARTICLE_PRIX_REVIENT")) {
139,7 → 138,7
c.gridx++;
panel.add(buttonSuppr, c);
 
final JFrame frame = new PanelFrame(panel, "Suppression d'ecritures");
final JFrame frame = new PanelFrame(panel, "Suppression d'article");
buttonObs.addActionListener(new ActionListener() {
 
@Override
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/ui/QtyToDeliverRowValuesRenderer.java
Nouveau fichier
0,0 → 1,73
/*
* 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.product.ui;
 
import org.openconcerto.erp.core.common.ui.DeviseNiceTableCellRenderer;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.view.list.RowValuesTable;
import org.openconcerto.sql.view.list.RowValuesTableModel;
import org.openconcerto.ui.table.AlternateTableCellRenderer;
import org.openconcerto.utils.CollectionUtils;
 
import java.awt.Color;
import java.awt.Component;
 
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.SwingConstants;
 
public class QtyToDeliverRowValuesRenderer extends DeviseNiceTableCellRenderer {
 
// Red
public static final Color red = new Color(255, 31, 52);
public static final Color redLightGrey = new Color(240, 65, 85);
 
// Orange
public final static Color orange = new Color(243, 125, 75);
public final static Color orangeGrey = new Color(222, 107, 47);
 
// Blue
public final static Color light = new Color(232, 238, 250);
public final static Color lightGrey = new Color(211, 220, 222);
 
// Black
public final static Color lightBlack = new Color(192, 192, 192);
public final static Color lightBlackGrey = new Color(155, 155, 155);
 
public QtyToDeliverRowValuesRenderer() {
AlternateTableCellRenderer.setBGColorMap(this, CollectionUtils.createMap(lightBlack, lightBlackGrey, red, redLightGrey, orange, orangeGrey));
}
 
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
 
Component comp = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
 
if (table instanceof RowValuesTable) {
 
((JLabel) comp).setHorizontalAlignment(SwingConstants.RIGHT);
RowValuesTableModel model = ((RowValuesTable) table).getRowValuesTableModel();
SQLRowValues rowVals = model.getRowValuesAt(row);
 
Number qte = (Number) rowVals.getObject("QTE");
Number qteL = (Number) rowVals.getObject("QTE_LIVREE");
if (qte != null && qteL != null) {
if (qte.intValue() <= 0) {
comp.setBackground(red);
}
}
}
return comp;
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/ui/DeliveredQtyRowValuesRenderer.java
Nouveau fichier
0,0 → 1,77
/*
* 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.product.ui;
 
import org.openconcerto.erp.core.common.ui.DeviseNiceTableCellRenderer;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.view.list.RowValuesTable;
import org.openconcerto.sql.view.list.RowValuesTableModel;
import org.openconcerto.ui.table.AlternateTableCellRenderer;
import org.openconcerto.utils.CollectionUtils;
 
import java.awt.Color;
import java.awt.Component;
 
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.SwingConstants;
 
public class DeliveredQtyRowValuesRenderer extends DeviseNiceTableCellRenderer {
 
// Red
public static final Color red = new Color(255, 31, 52);
public static final Color redLightGrey = new Color(240, 65, 85);
 
// Orange
public final static Color orange = new Color(243, 125, 75);
public final static Color orangeGrey = new Color(222, 107, 47);
 
// Blue
public final static Color light = new Color(232, 238, 250);
public final static Color lightGrey = new Color(211, 220, 222);
 
// Black
public final static Color lightBlack = new Color(192, 192, 192);
public final static Color lightBlackGrey = new Color(155, 155, 155);
 
public DeliveredQtyRowValuesRenderer() {
AlternateTableCellRenderer.setBGColorMap(this, CollectionUtils.createMap(lightBlack, lightBlackGrey, red, redLightGrey, orange, orangeGrey));
}
 
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
 
Component comp = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
 
if (table instanceof RowValuesTable) {
 
((JLabel) comp).setHorizontalAlignment(SwingConstants.RIGHT);
RowValuesTableModel model = ((RowValuesTable) table).getRowValuesTableModel();
SQLRowValues rowVals = model.getRowValuesAt(row);
 
Number qte = (Number) rowVals.getObject("QTE");
Number qteL = (Number) rowVals.getObject("QTE_LIVREE");
if (qte != null && qteL != null) {
if (qte.intValue() < qteL.intValue()) {
comp.setBackground(red);
} else if (qteL.intValue() <= 0) {
comp.setBackground(lightBlack);
} else if (qteL.intValue() != qte.intValue()) {
comp.setBackground(orange);
}
}
}
return comp;
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/ui/ProductItemListTable.java
59,7 → 59,7
 
final List<SQLTableElement> list = new Vector<SQLTableElement>();
 
SQLTableElement product = new SQLTableElement(productItemTable.getField("ID_ARTICLE"));
final SQLTableElement product = new SQLTableElement(productItemTable.getField("ID_ARTICLE"));
list.add(product);