OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Compare Revisions

Regard whitespace Rev 148 → Rev 149

/trunk/OpenConcerto/lib/postgresql-9.2-1003.jdbc4.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/OpenConcerto/lib/postgresql-42.2.2.jre7.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/OpenConcerto/lib/postgresql-42.2.2.jre7.jar
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/trunk/OpenConcerto/lib/jOpenCalendar.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/OpenConcerto/lib/jOpenDocument-1.4rc2.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/OpenConcerto/Configuration/Template/Default/EtatVentes.xml
3,10 → 3,10
<element0 location="A4" type="Value" ValueName="DATE">
</element0>
 
<element0 location="G54" type="Value" ValueName="TOTAL_PV_TTC">
</element0>
<!-- <element0 location="G54" type="Value" ValueName="TOTAL_PV_TTC">
</element0> -->
 
<table0 firstLine="7" endLine="51" endPageLine="54" lastColumn="E" base="Societe" table="SAISIE_VENTE_FACTURE_ELEMENT">
<table0 firstLine="7" endLine="52" endPageLine="54" lastColumn="H" base="Societe" table="SAISIE_VENTE_FACTURE_ELEMENT">
<element location="A" type="fill">
<field base="Societe" name="NOM" />
</element>
22,12 → 22,15
<element location="E" type="fill">
<field base="Societe" name="NB_ESPECES" />
</element>
<element location="F" type="fill">
<field base="Societe" name="NB_ESPECES" />
</element>
 
<element location="F" type="fill">
<element location="G" type="fill">
<field base="Societe" name="T_MARGE" />
</element>
 
<element location="G" type="fill">
<element location="H" type="fill">
<field base="Societe" name="T_PV_TTC" />
</element>
</table0>
80,4 → 83,45
<field base="Societe" name="TOTAL" />
</element>
</table2>
<element3 location="A1" type="Value" ValueName="DATE">
</element3>
<element3 location="C19" type="Value" ValueName="TOTAL_TVA">
</element3>
 
<table3 firstLine="4" endLine="52" endPageLine="54" lastColumn="I" base="Societe" table="SAISIE_VENTE_FACTURE_ELEMENT">
<element location="A" type="fill">
<field base="Societe" name="VT_TAUX_TVA" />
</element>
 
<element location="B" type="fill">
<field base="Societe" name="VT_HT" />
</element>
 
<element location="C" type="fill">
<field base="Societe" name="VT_TVA" />
</element>
 
<element location="D" type="fill">
<field base="Societe" name="VT_TTC" />
</element>
 
<element location="F" type="fill">
<field base="Societe" name="VT_TAUX_TVA" />
</element>
<element location="G" type="fill">
<field base="Societe" name="HA_HT" />
</element>
 
<element location="H" type="fill">
<field base="Societe" name="HA_TVA" />
</element>
<element location="I" type="fill">
<field base="Societe" name="HA_TTC" />
</element>
</table3>
</contentDocument>
/trunk/OpenConcerto/Configuration/Template/Default/DemandePrix.ods
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/OpenConcerto/Configuration/Template/Default/EtatVentes.ods
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/OpenConcerto/Configuration/Template/Default/Devis.ods
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/OpenConcerto/src/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java
File deleted
/trunk/OpenConcerto/src/org/openconcerto/ftp/IFtp.java
177,20 → 177,16
 
// our __storeFile use CopyStreamListener
private boolean __storeFile(int command, String remote, InputStream local) throws IOException {
OutputStream output;
Socket socket;
 
if ((socket = _openDataConnection_(command, remote)) == null)
try (final Socket socket = _openDataConnection_(command, remote); final OutputStream output = socket == null ? null : new BufferedOutputStream(socket.getOutputStream(), getBufferSize())) {
if (socket == null)
return false;
 
output = new BufferedOutputStream(socket.getOutputStream(), getBufferSize());
 
// __fileType is private, if we really want we could subclass setFileType() to have access
// __fileType is private, if we really want we could subclass setFileType() to have
// access
// if (__fileType == ASCII_FILE_TYPE)
// output = new ToNetASCIIOutputStream(output);
 
// Treat everything else as binary for now
try {
final CopyStreamListener l = this.streamListeners.get();
final long size = CopyStreamEvent.UNKNOWN_STREAM_SIZE;
if (l != null) {
198,15 → 194,7
l.bytesTransferred(0, 0, size);
}
Util.copyStream(local, output, getBufferSize(), size, l, false);
} catch (IOException e) {
try {
socket.close();
} catch (IOException f) {
}
throw e;
}
output.close();
socket.close();
return completePendingCommand();
}
 
/trunk/OpenConcerto/src/org/openconcerto/ftp/FTPUtils.java
30,7 → 30,7
}
 
// MAYBE use recurse, but can't recursively pass local
static public final void saveR(FTPClient ftp, File local) throws IOException {
public static final void saveR(FTPClient ftp, File local) throws IOException {
local.mkdirs();
for (FTPFile child : ftp.listFiles()) {
final String childName = child.getName();
40,15 → 40,18
saveR(ftp, new File(local, childName));
ftp.changeToParentDirectory();
} else {
final OutputStream outs = new FileOutputStream(new File(local, childName));
ftp.retrieveFile(childName, outs);
outs.close();
final File file = new File(local, childName);
try (final OutputStream outs = new FileOutputStream(file)) {
final boolean ok = ftp.retrieveFile(childName, outs);
if (!ok)
throw new IOException("failed to get " + childName + " to " + file.getAbsolutePath());
}
}
}
}
}
 
static public final void rmR(final FTPClient ftp, final String toRm) throws IOException {
public static final void rmR(final FTPClient ftp, final String toRm) throws IOException {
final String cwd = ftp.printWorkingDirectory();
// si on ne peut cd, le dossier n'existe pas
if (ftp.changeWorkingDirectory(toRm)) {
69,11 → 72,11
ftp.removeDirectory(toRm);
}
 
static public final void recurse(FTPClient ftp, ExnClosure<FTPFile, ?> c) throws IOException {
public static final void recurse(FTPClient ftp, ExnClosure<FTPFile, ?> c) throws IOException {
recurse(ftp, c, RecursionType.DEPTH_FIRST);
}
 
static public final void recurse(FTPClient ftp, ExnClosure<FTPFile, ?> c, RecursionType type) throws IOException {
public static final void recurse(FTPClient ftp, ExnClosure<FTPFile, ?> c, RecursionType type) throws IOException {
for (FTPFile child : ftp.listFiles()) {
if (child.getName().indexOf('.') != 0) {
if (type == RecursionType.BREADTH_FIRST)
/trunk/OpenConcerto/src/org/openconcerto/map/ui/ITextComboVilleViewer.java
77,8 → 77,10
this.text = new ISearchableCombo<Ville>(ComboLockedMode.ITEMS_LOCKED, 0, 17) {
 
@Override
protected Ville stringToT(String t) {
protected Ville stringToT(String t) throws IllegalArgumentException {
Ville v = Ville.getVilleFromVilleEtCode(t);
if (v == null)
throw new IllegalArgumentException("Unknown city");
return v;
}
};
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/desc/ReportTypes.java
135,4 → 135,8
return this.defines.get(name);
}
 
@Override
public String toString() {
return this.getClass().getSimpleName() + " with base dir : " + this.baseDir + "\nwith types : " + this.types.keySet();
}
}
/trunk/OpenConcerto/src/org/openconcerto/ui/RangedIntegerTableCellEditor.java
New file
0,0 → 1,67
/*
* 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.ui;
 
import javax.swing.DefaultCellEditor;
import javax.swing.JTextField;
 
public class RangedIntegerTableCellEditor extends DefaultCellEditor {
private int min, max;
 
public RangedIntegerTableCellEditor(int min, int max) {
super(new JTextField());
this.min = min;
this.max = max;
}
 
@Override
public boolean stopCellEditing() {
try {
// try to get the value
this.getCellEditorValue();
return super.stopCellEditing();
} catch (Exception ex) {
return false;
}
 
}
 
@Override
public Object getCellEditorValue() {
final String str = (String) super.getCellEditorValue();
if (str == null || str.length() == 0) {
return min;
}
try {
int i = Integer.parseInt(str);
if (i < min) {
i = min;
} else if (i > max) {
i = max;
}
return i;
} catch (Exception ex) {
throw new IllegalStateException();
}
 
}
 
public void setMax(int max) {
this.max = max;
}
 
public void setMin(int min) {
this.min = min;
}
}
/trunk/OpenConcerto/src/org/openconcerto/ui/validate_popup.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/OpenConcerto/src/org/openconcerto/ui/validate_popup.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/trunk/OpenConcerto/src/org/openconcerto/ui/light/LightUIRadioButtons.java
New file
0,0 → 1,112
/*
* 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.ui.light;
 
import java.util.ArrayList;
import java.util.List;
 
import net.minidev.json.JSONArray;
import net.minidev.json.JSONObject;
 
public class LightUIRadioButtons extends LightUserControl {
private final List<String> choices = new ArrayList<>();
 
// Init from json constructor
public LightUIRadioButtons(final JSONObject json) {
super(json);
}
 
// Clone constructor
public LightUIRadioButtons(final LightUIRadioButtons labelElement) {
super(labelElement);
}
 
public LightUIRadioButtons(final String id, final String label, final List<String> choices) {
this(id, label, choices, -1);
}
 
/**
*
* @param selectedIndex index of the selected value (-1 if nothing is selected)
*/
public LightUIRadioButtons(final String id, final String label, final List<String> choices, int selectedIndex) {
super(id);
this.setType(LightUIElement.TYPE_RADIO_BUTTONS);
this.setLabel(label);
if (selectedIndex >= choices.size()) {
throw new IllegalArgumentException("invalid index " + selectedIndex + ", it must be between 0 and " + choices.size());
}
if (selectedIndex < 0) {
this.setValue(null);
} else {
this.setValue(String.valueOf(selectedIndex));
}
this.setChoices(choices);
}
 
public void setChoices(List<String> choices) {
this.choices.clear();
this.choices.addAll(choices);
}
 
@Override
public JSONObject toJSON() {
final JSONObject json = super.toJSON();
final JSONArray array = new JSONArray();
for (String choice : choices) {
array.add(choice);
}
json.put("choices", array);
return json;
}
 
@Override
public void fromJSON(final JSONObject json) {
super.fromJSON(json);
final JSONArray array = (JSONArray) json.get("choices");
this.choices.clear();
for (Object o : array) {
this.choices.add(o.toString());
}
}
 
@Override
public JSONToLightUIConvertor getConvertor() {
return new JSONToLightUIConvertor() {
@Override
public LightUIElement convert(final JSONObject json) {
return new LightUIRadioButtons(json);
}
};
}
 
@Override
public void _setValueFromContext(Object value) {
if (value instanceof Number) {
this.setValue(value.toString());
} else {
throw new IllegalArgumentException("Incorrect value " + value + "type for ui element: " + this.getId());
}
}
 
@Override
public Object getValueForContext() {
if (this.getValue() == null) {
return null;
} else {
return Integer.parseInt(this.getValue());
}
}
 
}
/trunk/OpenConcerto/src/org/openconcerto/ui/light/LightUIRawHMTL.java
New file
0,0 → 1,53
/*
* 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.ui.light;
 
import org.openconcerto.utils.io.HTMLable;
 
import net.minidev.json.JSONObject;
 
public class LightUIRawHMTL extends LightUIElement implements HTMLable {
 
private String html = "";
 
public LightUIRawHMTL(final JSONObject json) {
super(json);
}
 
public LightUIRawHMTL(final String id) {
super(id);
this.setType(TYPE_RAW_HTML);
}
 
public LightUIRawHMTL(final String id, String html) {
super(id);
this.setType(TYPE_RAW_HTML);
this.html = html;
}
 
@Override
public JSONToLightUIConvertor getConvertor() {
return new JSONToLightUIConvertor() {
@Override
public LightUIElement convert(JSONObject json) {
return new LightUIRawHMTL(json);
}
};
}
 
@Override
public String getHTML() {
return this.html;
}
}
/trunk/OpenConcerto/src/org/openconcerto/ui/light/LightUIContainer.java
285,4 → 285,14
child.destroy();
}
}
 
@Override
public JSONToLightUIConvertor getConvertor() {
return new JSONToLightUIConvertor() {
@Override
public LightUIElement convert(JSONObject json) {
return new LightUIContainer(json);
}
};
}
}
/trunk/OpenConcerto/src/org/openconcerto/ui/light/LightUIElement.java
13,6 → 13,7
package org.openconcerto.ui.light;
 
import org.openconcerto.utils.io.HTMLable;
import org.openconcerto.utils.io.JSONConverter;
import org.openconcerto.utils.io.Transferable;
 
21,7 → 22,7
 
import net.minidev.json.JSONObject;
 
public class LightUIElement implements Transferable {
public abstract class LightUIElement implements Transferable {
 
private static final String HORIZONTALLY_RESIZABLE = "horizontally-resizable";
private static final String VERTICALLY_SCROLLABLE = "vertically-scrollable";
82,6 → 83,7
public static final int TYPE_AUTOCOMPLETE_COMBOBOX = 31;
public static final int TYPE_COLOR_PICKER = 32;
public static final int TYPE_HOUR_EDITOR = 33;
public static final int TYPE_RADIO_BUTTONS = 34;
// valueType
public static final int VALUE_TYPE_STRING = 0;
public static final int VALUE_TYPE_INTEGER = 1;
195,12 → 197,13
 
// Clone constructor
public LightUIElement(final LightUIElement element) {
this.id = element.id;
this.parent = element.parent;
this.UUID = element.UUID;
this.type = element.type;
 
this.copy(element);
throw new IllegalAccessError("??");
// this.id = element.id;
// this.parent = element.parent;
// this.UUID = element.UUID;
// this.type = element.type;
//
// this.copy(element);
}
 
public int getFontSize() {
778,15 → 781,15
return this.getClass().getName();
}
 
public JSONToLightUIConvertor getConvertor() {
return new JSONToLightUIConvertor() {
@Override
public LightUIElement convert(final JSONObject json) {
return new LightUIElement(json);
}
};
}
public abstract JSONToLightUIConvertor getConvertor();
 
/**
* { return new JSONToLightUIConvertor() {
*
* @Override public LightUIElement convert(final JSONObject json) { return new
* LightUIElement(json); } }; }
*/
 
protected void copy(final LightUIElement element) {
if (element == null) {
throw new IllegalArgumentException("Try to copy attributes of null element in " + this.getId());
1011,7 → 1014,9
if (this.foreColor != null) {
result.put("fore-color", JSONConverter.getJSON(this.foreColor));
}
 
if (this instanceof HTMLable) {
result.put("html", ((HTMLable) this).getHTML());
}
return result;
}
 
/trunk/OpenConcerto/src/org/openconcerto/ui/light/LightUIColorPicker.java
54,4 → 54,14
public Object getValueForContext() {
return this.getValue();
}
 
@Override
public JSONToLightUIConvertor getConvertor() {
return new JSONToLightUIConvertor() {
@Override
public LightUIElement convert(JSONObject json) {
return new LightUIColorPicker(json);
}
};
}
}
/trunk/OpenConcerto/src/org/openconcerto/ui/light/LightUIText.java
New file
0,0 → 1,45
/*
* 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.ui.light;
 
import net.minidev.json.JSONObject;
 
public class LightUIText extends LightUIElement {
// Init from json constructor
public LightUIText(final JSONObject json) {
super(json);
}
 
public LightUIText(final String id) {
this(id, "");
}
 
public LightUIText(final String id, final String label) {
super(id);
this.setType(TYPE_LABEL);
this.setLabel(label);
 
}
 
@Override
public JSONToLightUIConvertor getConvertor() {
return new JSONToLightUIConvertor() {
@Override
public LightUIElement convert(final JSONObject json) {
return new LightUIText(json);
}
};
}
 
}
/trunk/OpenConcerto/src/org/openconcerto/ui/light/LightUIButton.java
85,4 → 85,14
super.destroy();
this.clickListeners.clear();
}
 
@Override
public JSONToLightUIConvertor getConvertor() {
return new JSONToLightUIConvertor() {
@Override
public LightUIElement convert(JSONObject json) {
return new LightUIButton(json);
}
};
}
}
/trunk/OpenConcerto/src/org/openconcerto/ui/light/LightUISlider.java
15,12 → 15,16
 
import org.openconcerto.utils.io.JSONConverter;
 
import java.util.HashMap;
import java.util.Map;
 
import net.minidev.json.JSONObject;
 
public class LightUISlider extends LightUserControl {
Integer maxValue = 1;
Integer minValue = 0;
Integer increment = 1;
private Integer maxValue = 1;
private Integer minValue = 0;
private Integer increment = 1;
private Map<Integer, String> mapLabels = new HashMap<>();
 
public LightUISlider(final String id) {
super(id);
40,13 → 44,27
this.increment = slider.increment;
}
 
public void setLabel(int value, String label) {
mapLabels.put(Integer.valueOf(value), label);
}
 
public String getLabelForValue(int value) {
return mapLabels.get(Integer.valueOf(value));
}
 
public Integer getMaxValue() {
return this.maxValue;
}
 
public void setMaxValue(final int maxValue) {
if (maxValue < this.minValue) {
throw new IllegalArgumentException("max cannot be < " + this.minValue);
}
this.maxValue = maxValue;
if (this.getMinWidth() == null) {
this.setMinWidth((this.maxValue - this.minValue) * 50);
}
}
 
public Integer getMinValue() {
return this.minValue;
53,8 → 71,14
}
 
public void setMinValue(final int minValue) {
if (minValue > this.maxValue) {
throw new IllegalArgumentException("min cannot be > " + this.maxValue);
}
this.minValue = minValue;
if (this.getMinWidth() == null) {
this.setMinWidth((this.maxValue - this.minValue) * 50);
}
}
 
public Integer getIncrement() {
return this.increment;
64,6 → 88,14
this.increment = increment;
}
 
public void setSelectedValue(int value) {
setValue(String.valueOf(value));
}
 
public int getSelectedValue() {
return Integer.parseInt(getValue());
}
 
@Override
public JSONObject toJSON() {
final JSONObject json = super.toJSON();
70,7 → 102,15
json.put("max-value", this.maxValue);
json.put("min-value", this.minValue);
json.put("increment", this.increment);
 
if (!this.mapLabels.isEmpty()) {
final JSONObject labels = new JSONObject();
for (Map.Entry<Integer, String> entry : mapLabels.entrySet()) {
final Integer key = entry.getKey();
final String value = entry.getValue();
labels.put(String.valueOf(key), value);
}
json.put("labels", labels);
}
return json;
}
 
80,7 → 120,15
this.maxValue = JSONConverter.getParameterFromJSON(json, "max-value", Integer.class, 1);
this.minValue = JSONConverter.getParameterFromJSON(json, "min-value", Integer.class, 0);
this.increment = JSONConverter.getParameterFromJSON(json, "increment", Integer.class, 1);
this.mapLabels.clear();
if (json.containsKey("labels")) {
final JSONObject labels = (JSONObject) json.get("labels");
for (String key : labels.keySet()) {
final String v = labels.getAsString(key);
mapLabels.put(Integer.parseInt(key), v);
}
}
}
 
@Override
public void _setValueFromContext(Object value) {
99,4 → 147,14
return Integer.parseInt(this.getValue());
}
}
 
@Override
public JSONToLightUIConvertor getConvertor() {
return new JSONToLightUIConvertor() {
@Override
public LightUIElement convert(JSONObject json) {
return new LightUISlider(json);
}
};
}
}
/trunk/OpenConcerto/src/org/openconcerto/ui/light/LightUIFrame.java
30,6 → 30,7
 
private Boolean active = false;
private LightUIPanel titlePanel = null;
private LightUIPanel contentPanel;
private LightUIPanel footerPanel = new LightUIPanel(this.getId() + ".footer.panel");
 
private List<LightUIFrame> childrenFrame;
45,7 → 46,7
this.active = frame.active;
this.titlePanel = frame.titlePanel;
this.childrenFrame = frame.childrenFrame;
 
this.contentPanel = frame.contentPanel;
this.setFooterPanel(frame.footerPanel);
}
 
57,16 → 58,24
public LightUIFrame(final String id) {
super(id);
this.setType(TYPE_FRAME);
 
this.childrenFrame = new ArrayList<LightUIFrame>();
this.addChild(new LightUIPanel(this.getId() + ".main.panel"));
this.childrenFrame = new ArrayList<>();
this.contentPanel = new LightUIPanel(this.getId() + ".main.panel");
this.addChild(contentPanel);
this.footerPanel.setParent(this);
this.footerPanel.setFillHeight(false);
this.footerPanel.setHeight(50);
 
this.createTitlePanel();
}
 
public LightUIPanel getContentPanel() {
return this.contentPanel;
}
 
public void setContentPanel(LightUIPanel contentPanel) {
this.contentPanel = contentPanel;
this.addChild(contentPanel);
}
 
public LightUIPanel createTitlePanel(final String title) {
this.createTitlePanel();
final LightUILabel titleLabel = new LightUILabel(this.titlePanel.getId() + ".label", title, true);
86,6 → 95,11
return this.titlePanel;
}
 
public void setTitlePanel(LightUIPanel titlePanel) {
titlePanel.setId(this.getId() + ".title.panel");
this.titlePanel = titlePanel;
}
 
public LightUIPanel getFooterPanel() {
return this.footerPanel;
}
/trunk/OpenConcerto/src/org/openconcerto/ui/light/LightUIBadge.java
New file
0,0 → 1,41
/*
* 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.ui.light;
 
import net.minidev.json.JSONObject;
 
public class LightUIBadge extends LightUIElement {
 
public LightUIBadge(final JSONObject json) {
super(json);
}
 
public LightUIBadge(final String id, String label) {
super(id);
this.setType(TYPE_BADGE);
this.setVerticalAlignement(VALIGN_CENTER);
this.setHorizontalAlignement(HALIGN_CENTER);
this.setLabel(label);
}
 
@Override
public JSONToLightUIConvertor getConvertor() {
return new JSONToLightUIConvertor() {
@Override
public LightUIElement convert(JSONObject json) {
return new LightUIBadge(json);
}
};
}
}
/trunk/OpenConcerto/src/org/openconcerto/ui/light/LightUIButtonWithContext.java
15,7 → 15,7
 
import net.minidev.json.JSONObject;
 
public abstract class LightUIButtonWithContext extends LightUIButton {
public class LightUIButtonWithContext extends LightUIButton {
public LightUIButtonWithContext(final JSONObject json) {
super(json);
}
28,6 → 28,4
super(button);
}
 
@Override
public abstract LightUIElement clone();
}
/trunk/OpenConcerto/src/org/openconcerto/ui/light/SearchSpec.java
19,9 → 19,10
import org.openconcerto.utils.io.JSONConverter;
import org.openconcerto.utils.io.Transferable;
import net.minidev.json.JSONArray;
import net.minidev.json.JSONAware;
import net.minidev.json.JSONObject;
 
public class SearchSpec implements Transferable {
public class SearchSpec implements Transferable, JSONAware {
private String tableId;
private List<SearchContent> content = new ArrayList<SearchContent>();
 
60,4 → 61,12
}
}
}
 
/*
* JSONAware pour que le JSONArray.toString() fonctionne quand cet objet est dans un JSONArray
*/
@Override
public String toJSONString() {
return toJSON().toJSONString();
}
}
/trunk/OpenConcerto/src/org/openconcerto/ui/light/LightUIHTMLStrippedPanel.java
59,4 → 59,20
}
return b.toString();
}
 
@Override
public void addLine(LightUILine line) {
if (!(line instanceof HTMLable)) {
throw new IllegalArgumentException("line must be a subclass of be HTMLable");
}
super.addLine(line);
}
 
@Override
public void addChild(LightUIElement e) {
if (!(e instanceof LightUILine)) {
throw new IllegalArgumentException("line must be a subclass of LightUILine");
}
super.addLine((LightUILine) e);
}
}
/trunk/OpenConcerto/src/org/openconcerto/ui/TimestampEditorPanel.java
23,17 → 23,17
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Vector;
 
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
55,7 → 55,7
private TimeTextField timeText;
private JPanel panelHour;
private DatePickerPanel pickerPanel;
private List<ActionListener> listeners = new Vector<ActionListener>();
private List<ActionListener> listeners = new ArrayList<>();
private TimestampTableCellEditor aCellEditor;
private Calendar calendar = Calendar.getInstance();
private JDate dateEditor;
96,7 → 96,7
}
c.gridx++;
 
final JButton buttonClose = new JButton(new ImageIcon(TimestampEditorPanel.class.getResource("close_popup_gray.png")));
final JButton buttonClose = new JButton(new ImageIcon(TimestampEditorPanel.class.getResource("validate_popup.png")));
buttonClose.addActionListener(new ActionListener() {
 
public void actionPerformed(ActionEvent e) {
118,13 → 118,9
c.gridx++;
c.gridwidth = 2;
dateEditor = new JDate(true, true);
dateEditor.getTextComp().addFocusListener(new FocusListener() {
dateEditor.getTextComp().addFocusListener(new FocusAdapter() {
 
@Override
public void focusLost(FocusEvent e) {
}
 
@Override
public void focusGained(FocusEvent e) {
 
final JTextComponent textComp = dateEditor.getTextComp();
206,26 → 202,15
dateOrTimeChanged();
}
});
this.timeText.addKeyListener(new KeyListener() {
this.timeText.addKeyListener(new KeyAdapter() {
 
@Override
public void keyTyped(KeyEvent e) {
 
}
 
@Override
public void keyReleased(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_TAB || e.getKeyCode() == KeyEvent.VK_ENTER) {
if (aCellEditor != null) {
if ((e.getKeyCode() == KeyEvent.VK_TAB || e.getKeyCode() == KeyEvent.VK_ENTER) && aCellEditor != null) {
aCellEditor.stopCellEditing();
}
}
}
 
@Override
public void keyPressed(KeyEvent e) {
 
}
});
 
}
273,7 → 258,7
private void fireTimeChangedPerformed() {
final int size = this.listeners.size();
for (int i = 0; i < size; i++) {
final ActionListener element = (ActionListener) this.listeners.get(i);
final ActionListener element = this.listeners.get(i);
element.actionPerformed(null);
}
 
/trunk/OpenConcerto/src/org/openconcerto/ui/list/CheckListItem.java
14,6 → 14,7
package org.openconcerto.ui.list;
 
import java.awt.Color;
import java.util.Objects;
 
public class CheckListItem {
private final Object object;
33,6 → 34,10
return object;
}
 
public Object getKey() {
return this.getObject();
}
 
public boolean isSelected() {
return isSelected;
}
49,6 → 54,27
this.color = color;
}
 
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((this.object == null) ? 0 : this.object.hashCode());
return result;
}
 
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
CheckListItem other = (CheckListItem) obj;
return Objects.equals(this.object, other.object);
}
 
@Override
public String toString() {
return object.toString();
}
/trunk/OpenConcerto/src/org/openconcerto/ui/date/EventProviders.java
59,7 → 59,7
// we want a different day
c.add(Calendar.DAY_OF_WEEK, 1);
}
while (c.get(Calendar.WEEK_OF_YEAR) == currentWeekNumber) {
while (c.get(Calendar.WEEK_OF_YEAR) == currentWeekNumber || initialValue) {
if (this.days.contains(DayOfWeek.fromCalendar(c))) {
return;
}
94,7 → 94,7
if (!initialValue || currentPeriodBefore(c)) {
// GregorianCalendar calls pinDayOfMonth() so that January the 31st + 1 month stays
// in February
c.add(this.period.getCalendarField(), this.increment);
c.add(this.period.getCalendarField(), initialValue ? 1 : this.increment);
}
setDate(c);
}
/trunk/OpenConcerto/src/org/openconcerto/ui/date/DateRangeTable.java
14,15 → 14,22
package org.openconcerto.ui.date;
 
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.DisplayabilityListener;
import org.openconcerto.ui.PositiveIntegerTableCellEditor;
import org.openconcerto.ui.table.FocusAwareEditor;
import org.openconcerto.ui.table.TimestampTableCellEditor;
import org.openconcerto.utils.StringUtils;
 
import java.applet.Applet;
import java.awt.Component;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.KeyboardFocusManager;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Calendar;
47,6 → 54,83
import javax.swing.table.TableColumn;
 
public class DateRangeTable extends JPanel {
 
private static final List<JTable> FOCUS_TABLES = new ArrayList<>();
/**
* En remplacement de
* <code>this.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);</code>
* <p>
* Permet l'utilisation de {@link TimestampTableCellEditor}
*
* Arret de l'edition si la table perd le focus La perte de focus est ignorée sur le CellEditor
* gère lui même la perte de focus (FocusAwareEditor)
*
*/
private static final PropertyChangeListener FOCUS_LISTENER = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
Component c = ((KeyboardFocusManager) evt.getSource()).getPermanentFocusOwner();
if (c == null) {
// Personne n'a encore le focus, on ne stoppe pas l'édition dans les tables
// car on est dans ce cas quand on démarre l'édition
return;
}
final Component rootOfNewFocusOwner = SwingUtilities.getRoot(c);
for (final JTable t : FOCUS_TABLES) {
final Component rootOfTable = SwingUtilities.getRoot(t);
if (rootOfNewFocusOwner != rootOfTable) {
// le focus est dans un autre fenetre, la table doit donc stopper son édition
stopTableCellEditing(t);
} else {
while (c != null) {
if (c == t) {
// le focus reste "dans" la table, on ne fait rien
return;
} else if ((c instanceof Window) || (c instanceof Applet && c.getParent() == null)) {
if (c == rootOfTable) {
// le focus est dans un parent de la table, on stoppe l'édition
stopTableCellEditing(t);
}
break;
}
c = c.getParent();
}
}
}
}
 
public void stopTableCellEditing(final JTable t) {
if (t.getCellEditor() != null && !(t.getCellEditor() instanceof FocusAwareEditor) && !t.getCellEditor().stopCellEditing()) {
t.getCellEditor().cancelCellEditing();
}
}
};
 
private static final DisplayabilityListener DISP_FOCUS_LISTENER = new DisplayabilityListener() {
@Override
protected void displayabilityChanged(Component c) {
final String propertyName = "permanentFocusOwner";
if (c.isDisplayable()) {
final boolean wasEmpty = FOCUS_TABLES.isEmpty();
FOCUS_TABLES.add((JTable) c);
if (wasEmpty) {
final KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
focusManager.addPropertyChangeListener(propertyName, FOCUS_LISTENER);
}
} else {
FOCUS_TABLES.remove(c);
if (FOCUS_TABLES.isEmpty()) {
final KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
focusManager.removePropertyChangeListener(propertyName, FOCUS_LISTENER);
}
}
}
};
 
public static final void fixEditorFocus(final JTable t) {
t.addHierarchyListener(DISP_FOCUS_LISTENER);
}
 
private static final long serialVersionUID = 351767837995219468L;
public JButton bAdd = new JButton("Ajouter une plage horaire");
public JButton bRemove = new JButton("Supprimer");
70,6 → 154,7
};
};
this.rangeTable.setRowHeight((int) (new JLabel("A").getPreferredSize().height * 1.8));
DateRangeTable.fixEditorFocus(this.rangeTable);
 
// Start
final TableColumn columnStart = this.rangeTable.getColumnModel().getColumn(0);
232,7 → 317,7
}
 
public List<DateRange> getRanges() {
List<DateRange> result = new ArrayList<DateRange>();
List<DateRange> result = new ArrayList<>();
DateRangeTableModel model = getDateRangeTableModel();
for (int i = 0; i < model.getRowCount(); i++) {
result.add(model.getRange(i));
/trunk/OpenConcerto/src/org/openconcerto/ui/touch/ScrollableList.java
343,20 → 343,26
}
}
 
public void setSelectedValue(Object articleSelected, boolean scroll) {
if (articleSelected == null) {
/**
* Select a value
*
* @return true if the object is not null and was found in the model
*/
public boolean setSelectedValue(Object obj, boolean scroll) {
if (obj == null) {
clearSelection();
return;
return true;
}
 
int size = model.getSize();
for (int i = 0; i < size; i++) {
Object o = model.getElementAt(i);
if (o.equals(articleSelected)) {
if (o.equals(obj)) {
this.setSelectedIndex(i);
break;
return true;
}
}
return false;
}
 
public void addListSelectionListener(ListSelectionListener selectionListener) {
/trunk/OpenConcerto/src/org/openconcerto/ui/table/TimestampTableCellEditor.java
15,6 → 15,7
 
import org.openconcerto.ui.EnhancedTable;
import org.openconcerto.ui.FormatEditor;
import org.openconcerto.ui.Log;
import org.openconcerto.ui.TimestampEditorPanel;
 
import java.awt.BorderLayout;
27,6 → 28,8
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.util.Calendar;
33,6 → 36,7
import java.util.Date;
import java.util.EventObject;
 
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
87,6 → 91,17
 
this.aPopup = new JPopupMenu();
this.aPopup.add(this.content);
// JPopupMenu is hidden by Swing if the user clicks outside of it, but we still need to
// commit the value
this.aPopup.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals("visible") && Boolean.FALSE.equals(evt.getNewValue())) {
stopCellEditing();
}
}
});
 
this.popupOpen = true;
t.addMouseListener(new MouseAdapter() {
@Override
149,6 → 164,16
if (aPopup != null) {
try {
this.aPopup.show(c, p.x, p.y);
// if the user dismisses the popup (e.g. escape), revert the value
final String cancelName = "cancel";
if (this.aPopup.getRootPane().getActionMap().get(cancelName) == null)
Log.get().warning("missing cancel action, value won't be reverted");
this.aPopup.getRootPane().getActionMap().put(cancelName, new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
cancelCellEditing();
}
});
} catch (Exception e) {
// Se produit quand c n'est pas visible
System.err.println("cannot show popup : " + e.getMessage());
/trunk/OpenConcerto/src/org/openconcerto/ui/table/IconTableCellRenderer.java
65,6 → 65,10
}
 
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
if (value == null) {
// Bug remonté sur Linux
value = Integer.valueOf(0);
}
this.va = ((Integer) value).intValue();
final JImage image = this.images.get(this.va);
return image;
/trunk/OpenConcerto/src/org/openconcerto/ui/component/ITextCombo.java
335,7 → 335,7
if (!this.completing) {
this.completing = true;
// ne completer que si le texte fait plus de 2 char et n'est pas que des chiffres
if (originalText.length() > 2 && !DIGIT_PATTERN.matcher(originalText).matches()) {
if (canComplete(originalText)) {
String completion = this.getCompletion(originalText);
if (completion != null && !originalText.trim().equalsIgnoreCase(completion.trim())) {
fb.replace(0, fb.getDocument().getLength(), completion, null);
351,6 → 351,15
}
 
/**
* hook to activate or not complete for a given text
*
* @return true if completion must occur
*/
public boolean canComplete(final String originalText) {
return originalText.length() > 2 && !DIGIT_PATTERN.matcher(originalText).matches();
}
 
/**
* Recherche si on peut completer la string avec les items de completion
*
* @param string the start
569,8 → 578,16
 
public String getCurrentValue() {
// this.getSelectedItem() renvoie vide quand on tape du texte sans sélection
return (String) (this.isLocked() ? this.getSelectedItem() : this.getEditor().getItem());
final Object res;
if (this.isLocked()) {
res = this.getSelectedItem();
} else {
final ComboBoxEditor editor = this.getEditor();
// as documented in the constructor, the editor can sometimes be null
res = editor == null ? null : editor.getItem();
}
return (String) res;
}
 
public JComponent getComp() {
return this;
/trunk/OpenConcerto/src/org/openconcerto/ui/component/combo/ISearchableCombo.java
681,7 → 681,15
this.iconTransf = t;
}
 
protected T stringToT(final String t) {
/**
* Parse the passed string.
*
* @param t the string to parse.
* @return the parsed value.
* @throws IllegalArgumentException if <code>t</code> cannot be parsed.
* @see java.lang.Integer#parseInt(String)
*/
protected T stringToT(final String t) throws IllegalArgumentException {
throw new IllegalStateException("use " + ISearchableTextCombo.class);
}
 
/trunk/OpenConcerto/src/org/openconcerto/ui/component/combo/ISearchableComboCompletionThread.java
14,7 → 14,6
package org.openconcerto.ui.component.combo;
 
import org.openconcerto.ui.component.combo.SearchMode.ComboMatcher;
import org.openconcerto.utils.IFutureTask;
import org.openconcerto.utils.RTInterruptedException;
import org.openconcerto.utils.model.IListModel;
import org.openconcerto.utils.model.ISearchable;
22,10 → 21,12
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.util.concurrent.Callable;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
 
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
 
public class ISearchableComboCompletionThread<T> extends SwingWorker<List<ISearchableComboItem<T>>, Object> {
38,7 → 39,7
public ISearchableComboCompletionThread(final ISearchableCombo<T> combo, final String t) {
this.combo = combo;
this.sourceModel = combo.getCache();
this.toProcess = new ArrayList<>(combo.getModelValues());
this.toProcess = this.getModelValues();
this.t = t;
this.maxResults = this.getCombo().getMaximumResult();
}
47,6 → 48,11
return this.combo;
}
 
private final List<ISearchableComboItem<T>> getModelValues() {
assert SwingUtilities.isEventDispatchThread();
return new ArrayList<>(this.getCombo().getModelValues());
}
 
private final boolean isShowAll() {
return this.t == null;
}
99,6 → 105,7
// true : search changed
// false : search didn't change
Boolean searched = null;
List<ISearchableComboItem<T>> cache = this.toProcess;
// If there was a search and now the text is below minimum, we must unset the search
// Efficient since setSearch() only carry out its action if the search changes
if (this.sourceModel instanceof ISearchable) {
105,10 → 112,15
final ISearchable searchableListModel = (ISearchable) this.sourceModel;
if (searchableListModel.isSearchable()) {
// Wait for the new values, which will be added to the model by a listener
final FutureTask<Object> noOp = IFutureTask.createNoOp();
searched = searchableListModel.setSearch(normalizedText, noOp);
final FutureTask<List<ISearchableComboItem<T>>> searchedValues = new FutureTask<>(new Callable<List<ISearchableComboItem<T>>>() {
@Override
public List<ISearchableComboItem<T>> call() throws Exception {
return getModelValues();
}
});
searched = searchableListModel.setSearch(normalizedText, searchedValues);
try {
noOp.get();
cache = searchedValues.get();
} catch (InterruptedException e) {
throw new RTInterruptedException(e);
} catch (ExecutionException e) {
117,7 → 129,6
}
}
if (!normalizedText.isEmpty() && searched != Boolean.FALSE) {
final List<ISearchableComboItem<T>> cache = this.toProcess;
// don't filter twice
final ComboMatcher search = Boolean.TRUE.equals(searched) ? null : getCombo().getCompletionMode().matcher(normalizedText.toLowerCase());
final int maximumResult = this.maxResults;
/trunk/OpenConcerto/src/org/openconcerto/sql/view/list/RowValuesTable.java
23,24 → 23,20
import org.openconcerto.sql.view.IListPanel;
import org.openconcerto.ui.EnhancedTable;
import org.openconcerto.ui.component.InteractionMode;
import org.openconcerto.ui.date.DateRangeTable;
import org.openconcerto.ui.state.JTableStateManager;
import org.openconcerto.ui.table.AlternateTableCellRenderer;
import org.openconcerto.ui.table.FocusAwareEditor;
import org.openconcerto.ui.table.XTableColumnModel;
import org.openconcerto.utils.checks.EmptyListener;
import org.openconcerto.utils.checks.ValidListener;
import org.openconcerto.utils.checks.ValidState;
 
import java.applet.Applet;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.KeyboardFocusManager;
import java.awt.Rectangle;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.IOException;
53,7 → 49,6
import javax.swing.JComponent;
import javax.swing.JViewport;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener;
import javax.swing.event.TableModelEvent;
145,38 → 140,8
}
});
 
/**
* En remplacement de : this.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
*
* Arret de l'edition si la table perd le focus La perte de focus est ignorée sur le
* CellEditor gère lui même la perte de focus (FocusAwareEditor)
*
*/
final KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
focusManager.addPropertyChangeListener("permanentFocusOwner", new PropertyChangeListener() {
 
@Override
public void propertyChange(PropertyChangeEvent evt) {
 
Component c = focusManager.getPermanentFocusOwner();
while (c != null) {
if (c == RowValuesTable.this) {
// focus remains inside the table
return;
} else if ((c instanceof Window) || (c instanceof Applet && c.getParent() == null)) {
if (c == SwingUtilities.getRoot(RowValuesTable.this)) {
if (getCellEditor() != null && !(getCellEditor() instanceof FocusAwareEditor))
if (!getCellEditor().stopCellEditing()) {
getCellEditor().cancelCellEditing();
DateRangeTable.fixEditorFocus(this);
}
}
break;
}
c = c.getParent();
}
}
});
}
 
@Override
public void paint(Graphics g) {
/trunk/OpenConcerto/src/org/openconcerto/sql/view/list/RowValuesTableControlPanel.java
13,11 → 13,11
package org.openconcerto.sql.view.list;
 
import org.openconcerto.sql.TM;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.view.IListFrame;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.JComponentUtils;
import org.openconcerto.sql.TM;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
198,6 → 198,10
this.model.addRow(rowValsBis);
}
 
public void setButtonAjouterEnabled(boolean b) {
this.buttonAjouter.setEnabled(b);
}
 
public void setVisibleButtonClone(boolean b) {
this.buttonClone.setVisible(b);
}
/trunk/OpenConcerto/src/org/openconcerto/sql/view/list/SQLTableElement.java
26,6 → 26,7
import org.openconcerto.ui.TextAreaTableCellEditor;
import org.openconcerto.ui.table.TimestampTableCellEditor;
import org.openconcerto.utils.CompareUtils;
import org.openconcerto.utils.StringUtils;
 
import java.awt.event.ActionEvent;
import java.sql.Timestamp;
132,6 → 133,9
this.field = field;
 
this.name = Configuration.getInstance().getTranslator().getTitleFor(field);
if (name == null || name.trim().length() == 0) {
this.name = StringUtils.firstUp(field.getName().toLowerCase());
}
this.isEditable = (field != null);
}
 
200,9 → 204,11
if (this.field.getType().getJavaType() == String.class) {
final TextAreaTableCellEditor textEditor = new TextAreaTableCellEditor(table);
textEditor.setLimitedSize(this.field.getType().getSize());
this.editor = textEditor;
return textEditor;
} else if (this.field.getType().getJavaType() == Timestamp.class) {
final TimestampTableCellEditor textEditor = new TimestampTableCellEditor(false);
this.editor = textEditor;
return textEditor;
}
}
/trunk/OpenConcerto/src/org/openconcerto/sql/view/IListPanel.java
240,7 → 240,8
private EditFrame listeningFrame = null;
 
private final EditFrame createFrame(final boolean listening) {
final EditFrame res = new EditFrame(getElement(), EditPanel.READONLY);
Boolean rw = Boolean.getBoolean("org.openconcerto.sql.listPanel.rwOnDoubleClick");
final EditFrame res = new EditFrame(getElement(), !rw ? EditPanel.READONLY : EditPanel.MODIFICATION);
if (listening)
getListe().addIListener(res);
res.selectionId(getListe().getSelectedId());
/trunk/OpenConcerto/src/org/openconcerto/sql/PropsConfiguration.java
37,11 → 37,15
import org.openconcerto.utils.ProductInfo;
import org.openconcerto.utils.RTInterruptedException;
import org.openconcerto.utils.StreamUtils;
import org.openconcerto.utils.Tuple2;
import org.openconcerto.utils.Value;
import org.openconcerto.utils.cc.IClosure;
import org.openconcerto.utils.cc.IPredicate;
import org.openconcerto.utils.i18n.TranslationManager;
 
import java.awt.Dialog.ModalityType;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
76,6 → 80,11
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
 
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
 
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.Session;
 
210,7 → 219,9
@GuardedBy("treeLock")
private Session conn;
@GuardedBy("treeLock")
private boolean isUsingSSH;
private int tunnelLocalPort = -1;
@GuardedBy("treeLock")
private Thread sslThread;
 
private FieldMapper fieldMapper;
 
436,10 → 447,16
 
public final boolean isUsingSSH() {
synchronized (this.treeLock) {
return this.isUsingSSH;
return this.sslThread != null;
}
}
 
public final int getTunnelLocalPort() {
synchronized (this.treeLock) {
return this.tunnelLocalPort;
}
}
 
public final boolean hasWANProperties() {
final String wanAddr = getProperty("server.wan.addr");
final String wanPort = getProperty("server.wan.port");
456,21 → 473,17
if (!hasWANProperties(wanAddr, wanPort))
return doCreateServer();
 
final String serverPropVal = getProperty("server.ip");
// TODO add and use server.port
final List<String> serverAndPort = Arrays.asList(serverPropVal.split(":"));
if (serverAndPort.size() != 2)
throw new IllegalStateException("Not in 'host:port' format : " + serverPropVal);
final Tuple2<String, Integer> serverAndPort = parseServerAddressAndPort();
final String serverAndPortString = serverAndPort.get0() + ":" + serverAndPort.get1();
 
// if wanAddr is specified, always include it in ID, that way if we connect through the LAN
// or through the WAN we have the same ID
final String serverID = "tunnel to " + wanAddr + ":" + wanPort + " then " + serverPropVal;
final String serverID = "tunnel to " + wanAddr + ":" + wanPort + " then " + serverAndPortString;
final Logger log = Log.get();
Exception origExn = null;
final SQLServer defaultServer;
if (!"true".equals(getProperty("server.wan.only"))) {
try {
defaultServer = doCreateServer(serverID);
final SQLServer defaultServer = doCreateServer(serverAndPortString, null, serverID);
// works since all ds params are provided by doCreateServer()
defaultServer.getSystemRoot(getSystemRootName());
// ok
484,27 → 497,64
}
assert origExn != null;
}
this.openSSLConnection(wanAddr, Integer.valueOf(wanPort));
this.isUsingSSH = true;
log.info("ssl connection to " + this.conn.getHost() + ":" + this.conn.getPort());
final int localPort = NetUtils.findFreePort(5436);
final SQLServer serverThruSSL;
try {
log.info("ssl tunnel from local port " + localPort + " to remote " + serverAndPort);
this.conn.setPortForwardingL(localPort, serverAndPort.get(0), Integer.valueOf(serverAndPort.get(1)));
} catch (final Exception e1) {
throw new IllegalStateException("Impossible de créer la liaison sécurisée. Vérifier que le logiciel n'est pas déjà lancé.", e1);
}
final SQLServer serverThruSSL = doCreateServer("localhost:" + localPort, null, serverID);
try {
log.info("Connecting with SSL to " + wanAddr + ":" + wanPort);
this.openSSLConnection(wanAddr, Integer.valueOf(wanPort), serverAndPort.get0(), serverAndPort.get1());
serverThruSSL = doCreateServer("localhost:" + this.tunnelLocalPort, null, serverID);
serverThruSSL.getSystemRoot(getSystemRootName());
} catch (final Exception e) {
// even if the tunnel was set up successfully, close it if the SQLServer couldn't be
// created, that way the next time createServer() is called, we can start again the
// whole process (e.g. checking properties, retrying non-WAN server) without having to
// worry about a lingering tunnel.
this.closeSSLConnection();
throw new IllegalStateException("Couldn't connect through SSL : " + e.getLocalizedMessage(), origExn);
// no datasource will remain that uses the port, so forget about it and find a new one
// the next time
this.tunnelLocalPort = -1;
final IllegalStateException exn = new IllegalStateException("Couldn't connect to the DB through SSL", e);
if (origExn != null)
exn.addSuppressed(origExn);
throw exn;
}
return serverThruSSL;
 
}
 
// TODO add and use server.port
public final Tuple2<String, Integer> parseServerAddressAndPort() {
final String serverPropVal = getProperty("server.ip");
final List<String> serverAndPort = Arrays.asList(serverPropVal.split(":"));
if (serverAndPort.size() != 2)
throw new IllegalStateException("Not in 'host:port' format : " + serverPropVal);
return Tuple2.create(serverAndPort.get(0), Integer.valueOf(serverAndPort.get(1)));
}
 
protected final void reconnectSSL() throws Exception {
synchronized (this.treeLock) {
// already destroyed or still OK
if (this.conn == null || this.conn.isConnected())
return;
 
Log.get().log(Level.WARNING, "SSL disconnected, trying to reconnect");
 
final String wanAddr = getProperty("server.wan.addr");
final String wanPort = getProperty("server.wan.port");
final Tuple2<String, Integer> serverAndPort = parseServerAddressAndPort();
 
try {
// cannot just call connect() again, as Session is one-time use
// http://flyingjxswithjava.blogspot.fr/2015/03/comjcraftjschjschexception-packet.html
this.openSSLConnection(wanAddr, Integer.valueOf(wanPort), serverAndPort.get0(), serverAndPort.get1());
Log.get().log(Level.WARNING, "SSL successfully reconnected to " + this.conn.getHost() + ":" + this.conn.getPort());
} catch (Exception e) {
// don't leave an SSL connection without a tunnel
this.conn.disconnect();
throw e;
}
}
}
 
private SQLServer doCreateServer() {
return doCreateServer(null);
}
533,10 → 583,11
return res;
}
 
private void openSSLConnection(final String addr, final int port) {
private void openSSLConnection(final String addr, final int port, final String tunnelRemoteHost, final int tunnelRemotePort) {
checkDestroyed();
final String username = getSSLUserName();
final String pass = getSSLPassword();
final boolean reconnect = this.tunnelLocalPort > 0;
boolean isAuthenticated = false;
 
final JSch jsch = new JSch();
563,10 → 614,54
config.put("compression.c2s", "zlib@openssh.com,zlib,none");
this.conn.setConfig(config);
// wait no more than 6 seconds for TCP connection
this.conn.connect(6000);
this.conn.setTimeout(6000);
// ATTN for now this just calls setTimeout()
this.conn.setServerAliveInterval(6000);
this.conn.setServerAliveCountMax(1);
this.conn.connect();
 
afterSSLConnect(this.conn);
 
isAuthenticated = true;
 
// keep same local port so that we don't have to change the datasource
final int localPort = reconnect ? this.tunnelLocalPort : NetUtils.findFreePort(5436);
try {
Log.get().info("Creating SSL tunnel from local port " + localPort + " to remote " + tunnelRemoteHost + ":" + tunnelRemotePort);
this.conn.setPortForwardingL(localPort, tunnelRemoteHost, tunnelRemotePort);
} catch (final Exception e1) {
throw new IllegalStateException("Impossible de créer le tunnel sécurisé", e1);
}
assert reconnect == (this.sslThread != null);
if (!reconnect) {
this.tunnelLocalPort = localPort;
// With ServerAliveInterval & ServerAliveCount, the connection should disconnect
// itself in case of network failure, so we try to reconnect it
final Thread t = new Thread(new Runnable() {
@Override
public void run() {
while (true) {
try {
Thread.sleep(2000);
try {
reconnectSSL();
} catch (Exception e) {
// re-try later
Log.get().log(Level.WARNING, "Error while checking SSL connection", e);
}
} catch (InterruptedException e) {
// used by destroy()
break;
}
}
}
});
t.setDaemon(true);
t.setName("SSL connection watcher");
t.start();
this.sslThread = t;
}
assert this.sslThread != null;
} catch (final Exception e) {
throw new IllegalStateException("Connection failed", e);
}
587,6 → 682,10
 
private void closeSSLConnection() {
synchronized (this.treeLock) {
if (this.sslThread != null) {
this.sslThread.interrupt();
this.sslThread = null;
}
if (this.conn != null) {
this.conn.disconnect();
this.conn = null;
1077,6 → 1176,70
}
}
 
public final Thread createDBCheckThread(final JFrame mainFrame, final Runnable quitRunnable) {
final DBSystemRoot sysRoot = this.getSystemRoot();
final String quit = "Quitter le logiciel";
final JOptionPane optionPane = new JOptionPane("Impossible de contacter la base. Cette fenêtre se fermera dès le rétablissement de la connexion. Sinon vous pouvez quitter le logiciel.",
JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE, null, new Object[] { quit }, null);
final JDialog dialog = optionPane.createDialog(mainFrame, "Erreur de connexion");
dialog.setModalityType(ModalityType.APPLICATION_MODAL);
// can only be closed by us (if connection is restored) or by choosing quit
dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
dialog.addComponentListener(new ComponentAdapter() {
@Override
public void componentHidden(ComponentEvent e) {
if (optionPane.getValue().equals(quit))
quitRunnable.run();
else
// only the thread can change the dialog, otherwise pb would be incoherent
dialog.setVisible(true);
}
});
dialog.pack();
final Thread dbConn = new Thread(new Runnable() {
@Override
public void run() {
boolean pb = false;
while (true) {
try {
Thread.sleep((pb ? 4 : 20) * 1000);
} catch (InterruptedException e1) {
// ignore
e1.printStackTrace();
}
try {
sysRoot.getDataSource().validateDBConnectivity();
if (pb) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
// don't use setVisible(false) otherwise
// componentHidden() will be called
dialog.dispose();
}
});
pb = false;
}
} catch (Exception e) {
if (!pb) {
pb = true;
e.printStackTrace();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
dialog.setLocationRelativeTo(dialog.getOwner());
dialog.setVisible(true);
}
});
}
}
}
}
}, "databaseConnectivity");
dbConn.setDaemon(true);
return dbConn;
}
 
/**
* Get the node of the asked class, creating just the necessary instances (ie getNode(Server)
* won't do a getBase().getServer()).
/trunk/OpenConcerto/src/org/openconcerto/sql/ui/light/GroupToLightUIConvertor.java
77,7 → 77,7
}
 
final LightEditFrame editFrame = new LightEditFrame(this.configuration, group, defaultRow.asRowValues(), parentFrame, editMode);
final LightUIPanel framePanel = editFrame.getFirstChild(LightUIPanel.class);
final LightUIPanel framePanel = editFrame.getContentPanel();
append(sqlElement, framePanel, group);
 
String frameTitle = TranslationManager.getInstance().getTranslationForItem(group.getId());
/trunk/OpenConcerto/src/org/openconcerto/sql/ui/SoftwareInfoPanel.java
25,6 → 25,7
import org.openconcerto.utils.BaseDirs;
import org.openconcerto.utils.ProductInfo;
import org.openconcerto.utils.SystemInfo;
import org.openconcerto.utils.Tuple2;
import org.openconcerto.utils.cc.IFactory;
import org.openconcerto.utils.i18n.I18nUtils;
 
86,7 → 87,8
res.put(Info.APP_NAME, name);
res.put(Info.APP_VERSION, version);
if (propsConf != null && propsConf.isUsingSSH()) {
res.put(Info.SECURE_LINK, propsConf.getWanHostAndPort());
final Tuple2<String, Integer> serverAddressAndPort = propsConf.parseServerAddressAndPort();
res.put(Info.SECURE_LINK, "localhost:" + propsConf.getTunnelLocalPort() + " ⟷ (" + propsConf.getWanHostAndPort() + ") " + serverAddressAndPort.get0() + ":" + serverAddressAndPort.get1());
}
if (conf != null)
res.put(Info.DB_URL, conf.getSystemRoot().getDataSource().getUrl());
/trunk/OpenConcerto/src/org/openconcerto/sql/element/JoinSQLElement.java
166,7 → 166,7
 
@Override
protected DBRoot getOwnerRoot() {
return this.ownedT.getDBRoot();
return this.ownerT.getDBRoot();
}
 
@Override
202,7 → 202,7
 
@Override
protected DBRoot getOwnerRoot() {
return this.ownedT.getRoot();
return this.ownerT.getRoot();
}
 
@Override
/trunk/OpenConcerto/src/org/openconcerto/sql/element/SQLElement.java
336,10 → 336,10
editFrame.createTitlePanel(this.getCreationFrameTitle());
} else if (editMode.equals(EditMode.MODIFICATION)) {
editFrame.createTitlePanel(this.getModificationFrameTitle(sqlRow));
new LightUIPanelFiller(editFrame.getFirstChild(LightUIPanel.class)).fillFromRow(configuration, sqlRow);
new LightUIPanelFiller(editFrame.getContentPanel()).fillFromRow(configuration, sqlRow);
} else if (editMode.equals(EditMode.READONLY)) {
editFrame.createTitlePanel(this.getReadOnlyFrameTitle(sqlRow));
new LightUIPanelFiller(editFrame.getFirstChild(LightUIPanel.class)).fillFromRow(configuration, sqlRow);
new LightUIPanelFiller(editFrame.getContentPanel()).fillFromRow(configuration, sqlRow);
}
 
this.setEditFrameModifiers(editFrame, sessionSecurityToken);
/trunk/OpenConcerto/src/org/openconcerto/sql/model/SQLSyntaxPG.java
515,7 → 515,8
private final int getIndex(Map<String, Object> o) {
final int colNum = ((Number) o.get("colNum")).intValue();
try {
final Integer[] array = (Integer[]) ((Array) o.get("colsNum")).getArray();
// Integer for driver version 9, Short for version 42
final Number[] array = (Number[]) ((Array) o.get("colsNum")).getArray();
for (int i = 0; i < array.length; i++) {
if (array[i].intValue() == colNum)
return i;
/trunk/OpenConcerto/src/org/openconcerto/sql/model/AliasedField.java
20,6 → 20,17
*/
public class AliasedField implements FieldRef {
 
// only create instance if needed
static public FieldRef getFieldRef(final SQLField f, final String alias) {
return alias == null || alias.equals(f.getTable().getName()) ? f : new AliasedField(f, alias);
}
 
static public FieldRef getFieldRef(final SQLField f, final TableRef t) {
if (t.getTable() != f.getTable())
throw new IllegalArgumentException("Table mismatch");
return getFieldRef(f, t.getAlias());
}
 
private final TableRef t;
private final SQLField f;
 
/trunk/OpenConcerto/src/org/openconcerto/sql/model/Where.java
115,6 → 115,31
return new Where(ref, "is not", (Object) null);
}
 
static public Where between(final FieldRef ref, final FieldRef lowerBound, final FieldRef upperBound) {
return Where.createRaw(ref.getFieldRef() + " BETWEEN " + lowerBound.getFieldRef() + " AND " + upperBound.getFieldRef(), ref, lowerBound, upperBound);
}
 
static public Where inSubqueries(final FieldRef ref, final List<String> subQueries) {
return subqueries(ref, true, subQueries);
}
 
static public Where notInSubqueries(final FieldRef ref, final List<String> subQueries) {
return subqueries(ref, false, subQueries);
}
 
/**
* Create a Where for a field value contained or not contained in sub-queries.
*
* @param ref the field.
* @param in <code>true</code> if the field should be contained in the sub-queries.
* @param subQueries the sub-queries to use.
* @return a new Where.
* @see Where#Where(FieldRef, boolean, SQLSelect)
*/
static public Where subqueries(final FieldRef ref, final boolean in, final List<String> subQueries) {
return createRaw(getInClause(ref, in, CollectionUtils.join(subQueries, "\nUNION\n")), ref);
}
 
static public Where createRaw(final String clause, final FieldRef... refs) {
return createRaw(clause, Arrays.asList(refs));
}
/trunk/OpenConcerto/src/org/openconcerto/utils/StringUtils.java
789,4 → 789,35
return s;
return null;
}
 
public static String toAsciiString(String str) {
if (str == null) {
return null;
}
final int length = str.length();
final StringBuilder b = new StringBuilder(length);
for (int i = 0; i < length; i++) {
final char c = str.charAt(i);
final char newChar;
if (c < 128) {
newChar = c;
} else if (c == 'é' || c == 'è' || c == 'ê') {
newChar = 'e';
} else if (c == 'â' || c == 'à') {
newChar = 'a';
} else if (c == 'î') {
newChar = 'i';
} else if (c == 'ù' || c == 'û') {
newChar = 'u';
} else if (c == 'ô') {
newChar = 'o';
} else if (c == 'ç') {
newChar = 'c';
} else {
newChar = ' ';
}
b.append(newChar);
}
return b.toString();
}
}
/trunk/OpenConcerto/src/org/openconcerto/utils/io/MailAccount.java
39,6 → 39,27
}
 
/**
* Workaround for <code>ATT######.dat</code> attachments.
*
* @param props must currently be {@link System#getProperties()}.
*/
static public final void setEncodedParametersForOutlook(final Properties props) {
// don't use RFC 2231 for all parameters for 2 reasons :
// 1. Outlook (at least 2007) doesn't support it. Thunderbird seems to get around this by
// encoding the filename of Content-Disposition according to RFC 2231 and also encoding it
// in Content-Type using the old de facto standard.
// 2. Java Mail 1.6.0 doesn't always use Parameter Value Continuations (not for filenames :
// javax.mail.internet.MimeBodyPart.setFileName() uses ParameterList.Value which isn't
// split by toString())
// used in ParameterList.encodeParameters
props.setProperty("mail.mime.encodeparameters", "false");
// since we don't use RFC 2231, use the old de facto standard to have a charset specified
// somewhere.
// used in MimeBodyPart.encodeFileName
props.setProperty("mail.mime.encodefilename", "true");
}
 
/**
* Parse the given exception to a more human readable format.
*
* @param mex an exception.
/trunk/OpenConcerto/src/org/openconcerto/utils/SystemInfo.java
15,6 → 15,7
 
import static org.openconcerto.utils.CollectionUtils.join;
import static java.lang.System.getProperty;
 
import org.openconcerto.utils.cc.ITransformer;
import org.openconcerto.utils.i18n.TM;
 
26,9 → 27,9
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Formatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.NavigableMap;
import java.util.TreeMap;
 
import javax.swing.LookAndFeel;
import javax.swing.UIManager;
46,8 → 47,8
 
public static final String CLASS_PROTOCOL = "class";
 
static public Map<Info, String> get(final boolean html) {
final Map<Info, String> res = new HashMap<Info, String>(Info.values().length);
static public NavigableMap<Info, String> get(final boolean html) {
final NavigableMap<Info, String> res = new TreeMap<Info, String>();
 
final String lineBreak = getLineBreak(html);
 
76,8 → 77,7
res.put(Info.OS, "<b>" + getProperty("os.name") + "</b> " + getProperty("os.version") + " (" + getProperty("os.arch") + ")");
 
// * Sylvain ; C:\Documents and Settings\Sylvain ; D:\workspace\CTech
res.put(Info.USER,
getProperty("user.name") + " ; " + getLink(TM.tr("home.dir"), new File(getProperty("user.home")).toURI(), html) + " ; "
res.put(Info.USER, getProperty("user.name") + " ; " + getLink(TM.tr("home.dir"), new File(getProperty("user.home")).toURI(), html) + " ; "
+ getLink(TM.tr("cwd"), new File(getProperty("user.dir")).toURI(), html));
 
// * eth0 192.168.28.52/24, état: inactif, nom complet: ""
/trunk/OpenConcerto/src/org/openconcerto/utils/FileUtils.java
403,10 → 403,7
* @throws IOException if an error occurs.
*/
public static void copyFile(File in, File out, long maxCount) throws IOException {
final FileInputStream sourceIn = new FileInputStream(in);
FileOutputStream sourceOut = null;
try {
sourceOut = new FileOutputStream(out);
try (final FileInputStream sourceIn = new FileInputStream(in); final FileOutputStream sourceOut = new FileOutputStream(out);) {
final FileChannel sourceChannel = sourceIn.getChannel();
final long size = sourceChannel.size();
if (maxCount == 0)
416,10 → 413,6
while (position < size) {
position += sourceChannel.transferTo(position, maxCount, destinationChannel);
}
} finally {
sourceIn.close();
if (sourceOut != null)
sourceOut.close();
}
}
 
679,16 → 672,9
}
 
public static void write(String s, File f, Charset charset, boolean append) throws IOException {
final FileOutputStream fileStream = new FileOutputStream(f, append);
final OutputStreamWriter out = charset == null ? new OutputStreamWriter(fileStream) : new OutputStreamWriter(fileStream, charset);
final BufferedWriter w = new BufferedWriter(out);
try {
try (final FileOutputStream fileStream = new FileOutputStream(f, append);
final BufferedWriter w = new BufferedWriter(charset == null ? new OutputStreamWriter(fileStream) : new OutputStreamWriter(fileStream, charset))) {
w.write(s);
} finally {
w.close();
// should have already been closed by the writer but the documentation is vague and
// there's no way to check
fileStream.close();
}
}
 
788,13 → 774,8
// perhaps a thread to delete the file after a certain amount of time
shortcutFile.deleteOnExit();
files.put(url, shortcutFile);
final InputStream stream = url.openStream();
final FileOutputStream out = new FileOutputStream(shortcutFile);
try {
try (final InputStream stream = url.openStream(); final FileOutputStream out = new FileOutputStream(shortcutFile);) {
StreamUtils.copy(stream, out);
} finally {
out.close();
stream.close();
}
} else
shortcutFile = currentFile;
860,9 → 841,10
}
try {
ps.getErrorStream().close();
final BufferedReader reader = new BufferedReader(new InputStreamReader(ps.getInputStream()));
final String res = reader.readLine();
reader.close();
final String res;
try (final BufferedReader reader = new BufferedReader(new InputStreamReader(ps.getInputStream()));) {
res = reader.readLine();
}
if (ps.waitFor() != 0 || res == null || res.length() == 0)
return null;
else
/trunk/OpenConcerto/src/org/openconcerto/utils/PropertiesUtils.java
18,6 → 18,7
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
25,13 → 26,32
public class PropertiesUtils {
 
public static final Properties createFromMap(final Map<String, String> map) {
final Properties res = new Properties();
return loadFromMap(new Properties(), map);
}
 
public static final Properties loadFromMap(final Properties res, final Map<String, String> map) {
for (final Entry<String, String> e : map.entrySet()) {
res.setProperty(e.getKey(), e.getValue());
final String key = e.getKey();
if (key == null)
throw new NullPointerException("Null key : " + e);
final String val = e.getValue();
// Properties doesn't support nulls
if (val != null)
res.setProperty(key, val);
}
return res;
}
 
public static final Map<String, String> toMap(final Properties props) {
final Map<String, String> res = new HashMap<>();
for (final String key : props.stringPropertyNames()) {
final String value = props.getProperty(key);
assert value != null;
res.put(key, value);
}
return res;
}
 
public static final Properties createFromFile(final File f) throws IOException {
return create(new BufferedInputStream(new FileInputStream(f)));
}
/trunk/OpenConcerto/src/org/openconcerto/utils/prog/SVNUtils.java
16,6 → 16,8
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
 
public class SVNUtils {
 
47,4 → 49,23
return res;
}
 
// match placeholder $Rev$ fixed length $Rev:: $ and of course with value $Rev: 12 $
private static final Pattern KEYWORD_PATTERN = Pattern.compile("^\\$\\p{Alpha}+:{0,2}\\p{Blank}*(.*?)\\p{Blank}*\\$$");
 
/**
* Return the value of the svn keyword. E.g. use with
* <code>private static final String REV = getKeywordValue("$Rev$")</code> (don't forget to
* <code>svn propset svn:keywords</code>).
*
* @param substitute the svn substitute, e.g. "$Rev: 12 $".
* @return the value, empty string if none, e.g. "12".
* @throws IllegalArgumentException if substitute is not valid.
*/
public static String getKeywordValue(String substitute) throws IllegalArgumentException {
final Matcher matcher = KEYWORD_PATTERN.matcher(substitute);
if (!matcher.matches())
throw new IllegalArgumentException("SVN format not recognized");
 
return matcher.group(1);
}
}
/trunk/OpenConcerto/src/org/openconcerto/utils/ProductInfo.java
14,7 → 14,6
package org.openconcerto.utils;
 
import java.io.IOException;
import java.util.Collections;
import java.util.Map;
import java.util.Properties;
 
44,7 → 43,7
if (INSTANCE == null) {
try {
setInstance(createDefault());
} catch (IOException e) {
} catch (final IOException e) {
throw new IllegalStateException("unable to load default product properties", e);
}
}
56,7 → 55,7
*
* @param i the new instance, can be <code>null</code>.
*/
public synchronized static void setInstance(ProductInfo i) {
public synchronized static void setInstance(final ProductInfo i) {
INSTANCE = i;
}
 
82,13 → 81,17
private final Properties props;
 
public ProductInfo(final String name) {
this(name, "ILM Informatique", "fr.ilm-informatique");
this(name, null);
}
 
public ProductInfo(final String name, final String orgName, final String orgID) {
this(CollectionUtils.createMap(NAME, name, ORGANIZATION_NAME, orgName, ORGANIZATION_ID, orgID));
public ProductInfo(final String name, final String version) {
this(name, version, "ILM Informatique", "fr.ilm-informatique");
}
 
public ProductInfo(final String name, final String version, final String orgName, final String orgID) {
this(CollectionUtils.createMapFromList(NAME, name, VERSION, version, ORGANIZATION_NAME, orgName, ORGANIZATION_ID, orgID));
}
 
public ProductInfo(final Map<String, String> map) {
this(PropertiesUtils.createFromMap(map));
}
110,11 → 113,11
return this.props;
}
 
public final String getProperty(String name) {
public final String getProperty(final String name) {
return this.getProps().getProperty(name);
}
 
public final String getProperty(String name, String def) {
public final String getProperty(final String name, final String def) {
final String res = this.getProperty(name);
return StringUtils.isEmpty(res, true) ? def : res;
}
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/IncludeExclude.java
28,6 → 28,7
* A class to specify which objects to include or exclude.
*
* @author Sylvain
* @param <T> type of items
* @see #isIncluded(Object)
*/
@Immutable
46,11 → 47,11
return (IncludeExclude<T>) FULL;
}
 
public static <T> IncludeExclude<T> getNormalized(Collection<? extends T> includes) {
public static <T> IncludeExclude<T> getNormalized(final Collection<? extends T> includes) {
return getNormalized(includes, Collections.<T> emptySet());
}
 
public static <T> IncludeExclude<T> getNormalized(Collection<? extends T> includes, Collection<? extends T> excludes) {
public static <T> IncludeExclude<T> getNormalized(final Collection<? extends T> includes, final Collection<? extends T> excludes) {
return new IncludeExclude<T>(includes, excludes).normal;
}
 
58,7 → 59,7
private final Set<T> excludes;
private final IncludeExclude<T> normal;
 
public IncludeExclude(Collection<? extends T> includes) {
public IncludeExclude(final Collection<? extends T> includes) {
this(includes, Collections.<T> emptySet());
}
 
68,20 → 69,27
* @param includes which objects to include, <code>null</code> meaning all.
* @param excludes which objects to exclude, <code>null</code> meaning all.
*/
public IncludeExclude(Collection<? extends T> includes, Collection<? extends T> excludes) {
public IncludeExclude(final Collection<? extends T> includes, final Collection<? extends T> excludes) {
this(includes, excludes, false);
}
 
private IncludeExclude(Collection<? extends T> includes, Collection<? extends T> excludes, final boolean isNormal) {
private IncludeExclude(final Collection<? extends T> includes, final Collection<? extends T> excludes, final boolean isNormal) {
this(includes == null ? null : Collections.unmodifiableSet(new HashSet<T>(includes)), excludes == null ? null : Collections.unmodifiableSet(new HashSet<T>(excludes)), false, isNormal);
}
 
private IncludeExclude(final Set<T> includes, final Set<T> excludes, final boolean areMutable, final boolean isNormal) {
super();
this.includes = includes == null ? null : Collections.unmodifiableSet(new HashSet<T>(includes));
this.excludes = excludes == null ? null : Collections.unmodifiableSet(new HashSet<T>(excludes));
// parameter just to overload constructor
if (areMutable)
throw new IllegalStateException();
this.includes = includes;
this.excludes = excludes;
this.normal = isNormal ? this : this.normalize();
assert this.normal.excludes.isEmpty() || this.normal.includes == null;
}
 
private final IncludeExclude<T> normalize() {
if (this.excludes == null)
if (this.excludes == null || (this.includes != null && this.includes.isEmpty()))
return getEmpty();
if (this.excludes.isEmpty() && this.includes == null)
return getFull();
109,6 → 117,53
return (this.normal.includes == null || this.normal.includes.contains(s)) && !this.normal.excludes.contains(s);
}
 
public final <S extends T> Collection<S> getExcluded(final Collection<S> items) {
if (this.areNoneIncluded(items))
return items;
else if (this.areAllIncluded(items))
return Collections.emptySet();
 
final Set<S> res = new HashSet<>(items);
// avoid checks of getIncluded()
res.removeAll(this.createIncluded(items));
return res;
}
 
public final <S extends T> Collection<S> getIncluded(final Collection<S> items) {
if (this.areAllIncluded(items))
return items;
else if (this.isNoneIncluded())
return Collections.emptySet();
else
return createIncluded(items);
}
 
private <S extends T> Collection<S> createIncluded(final Collection<S> items) {
final Set<S> res = new HashSet<>(items);
if (this.normal.includes != null)
res.retainAll(this.normal.includes);
res.removeAll(this.normal.excludes);
return res;
}
 
public final boolean areAllIncluded(final Collection<? extends T> items) {
if (this.isAllIncluded() || items.isEmpty())
return true;
else if (this.isNoneIncluded())
return false;
else
return (this.normal.includes == null || this.normal.includes.containsAll(items)) && Collections.disjoint(this.normal.excludes, items);
}
 
public final boolean areNoneIncluded(final Collection<? extends T> items) {
if (this.isNoneIncluded() || items.isEmpty())
return true;
else if (this.isAllIncluded())
return false;
else
return (this.normal.includes != null && Collections.disjoint(this.normal.includes, items)) || this.normal.excludes.containsAll(items);
}
 
/**
* Whether this includes all objects.
*
157,17 → 212,54
return ifNoSole;
}
 
public final IncludeExclude<T> include(final Collection<? extends T> items) {
if (this.areAllIncluded(items))
return this;
else if (this.excludes == null)
throw new IllegalStateException("Cannot include an item when excluding all");
 
Set<T> newIncludes;
if (this.includes == null || this.includes.containsAll(items)) {
newIncludes = this.includes;
} else {
newIncludes = new HashSet<>(this.includes);
newIncludes.addAll(items);
newIncludes = Collections.unmodifiableSet(newIncludes);
}
Set<T> newExcludes;
if (Collections.disjoint(this.excludes, items)) {
newExcludes = this.excludes;
} else {
newExcludes = new HashSet<>(this.excludes);
newExcludes.removeAll(items);
newExcludes = Collections.unmodifiableSet(newExcludes);
}
 
return new IncludeExclude<T>(newIncludes, newExcludes, false, false);
}
 
public final IncludeExclude<T> exclude(final Collection<? extends T> items) {
if (this.areNoneIncluded(items))
return this;
 
assert this.excludes != null : "!areNoneIncluded() but this.excludes == null";
Set<T> newExcludes = new HashSet<>(this.excludes);
newExcludes.addAll(items);
newExcludes = Collections.unmodifiableSet(newExcludes);
return new IncludeExclude<T>(this.includes, Collections.unmodifiableSet(newExcludes), false, false);
}
 
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((excludes == null) ? 0 : excludes.hashCode());
result = prime * result + ((includes == null) ? 0 : includes.hashCode());
result = prime * result + ((this.excludes == null) ? 0 : this.excludes.hashCode());
result = prime * result + ((this.includes == null) ? 0 : this.includes.hashCode());
return result;
}
 
@Override
public boolean equals(Object obj) {
public boolean equals(final Object obj) {
if (this == obj)
return true;
if (obj == null)
178,4 → 270,15
return CompareUtils.equals(this.includes, other.includes) && CompareUtils.equals(this.excludes, other.excludes);
}
 
@Override
public String toString() {
final String suffix;
if (this == FULL)
suffix = " ALL";
else if (this == EMPTY)
suffix = " NONE";
else
suffix = " includes " + this.includes + " except " + this.excludes;
return this.getClass().getSimpleName() + suffix;
}
}
/trunk/OpenConcerto/src/org/openconcerto/utils/Value.java
145,6 → 145,19
public abstract V getValue() throws IllegalStateException;
 
/**
* Return the value if {@link #hasValue()}, otherwise the passed one, never throws an exception.
*
* @param def the default value.
* @return either {@link #getValue()} or <code>def</code>.
*/
public final V getValue(final V def) {
if (this.hasValue())
return this.getValue();
else
return def;
}
 
/**
* Return <code>null</code> if and only if this has no value.
*
* @return non <code>null</code> {@link #getValue()} if {@link #hasValue()}, otherwise
/trunk/OpenConcerto/src/org/openconcerto/utils/CollectionUtils.java
912,6 → 912,23
return res;
}
 
@SafeVarargs
public static <T> Map<T, T> createMapFromList(final T... keyAndVal) {
return createMapFromList(Arrays.asList(keyAndVal));
}
 
public static <T> Map<T, T> createMapFromList(final List<T> keyAndVal) {
final int size = keyAndVal.size();
if (size % 2 != 0)
throw new IllegalArgumentException(size + " is not an even number of values : " + keyAndVal);
// arguments are ordered, so should the result
final Map<T, T> res = new LinkedHashMap<>(size);
for (int i = 0; i < size; i += 2) {
res.put(keyAndVal.get(i), keyAndVal.get(i + 1));
}
return res;
}
 
/**
* Creates a map with null values.
*
/trunk/OpenConcerto/src/org/openconcerto/utils/TimeUtils.java
368,4 → 368,34
cal.clear(Calendar.MILLISECOND);
return cal;
}
 
/**
* Whether 2 dates are in the same day.
*
* @param date1 the first date, it won't be modified (it will be {@link Calendar#clone()
* cloned}).
* @param date2 the second date.
* @return <code>true</code> if both dates are in the same day according to the passed calendar.
*/
static public final boolean isSameDay(final Calendar date1, final Date date2) {
return isSameDay((Calendar) date1.clone(), date1.getTime(), date2);
}
 
/**
* Whether 2 dates are in the same day.
*
* @param cal the calendar to use, it will be modified.
* @param date1 the first date.
* @param date2 the second date.
* @return <code>true</code> if both dates are in the same day according to the passed calendar.
*/
static public final boolean isSameDay(final Calendar cal, final Date date1, final Date date2) {
cal.setTime(date1);
TimeUtils.clearTime(cal);
final long day1 = cal.getTimeInMillis();
cal.setTime(date2);
TimeUtils.clearTime(cal);
final long day2 = cal.getTimeInMillis();
return day1 == day2;
}
}
/trunk/OpenConcerto/src/org/openconcerto/utils/EmailClient.java
37,7 → 37,7
public abstract class EmailClient {
 
public static enum EmailClientType {
Thunderbird, AppleMail, Outlook
Thunderbird, AppleMail, Outlook, XDG
}
 
private static EmailClient PREFERRED = null;
134,7 → 134,11
// see http://kb.mozillazine.org/Command_line_arguments_(Thunderbird)
// The escape mechanism isn't specified, it turns out we can pass percent encoded strings
private final static String getTBParam(final String to, final String subject, final String body, final File... attachments) {
// "to='john@example.com,kathy@example.com',cc='britney@example.com',subject='dinner',body='How about dinner tonight?',attachment='file:///C:/cygwin/Cygwin.bat,file:///C:/cygwin/Cygwin.ico'";
/**
* <pre>
"to='john@example.com,kathy@example.com',cc='britney@example.com',subject='dinner',body='How about dinner tonight?',attachment='file:///C:/cygwin/Cygwin.bat,file:///C:/cygwin/Cygwin.ico'";
* </pre>
*/
 
final List<String> l = new ArrayList<String>(4);
if (to != null)
277,15 → 281,19
return new ThunderbirdPath(exe);
}
} else if (de instanceof Gnome) {
if (de.getVersion().startsWith("2.")) {
// evolution %s
final String cmdLine = cmdSubstitution("gconftool", "-g", "/desktop/gnome/url-handlers/mailto/command");
if (cmdLine.contains("thunderbird")) {
return new ThunderbirdCommandLine(cmdLine, "%s");
}
}
return XDG;
} else if (de instanceof KDE) {
// TODO look for EmailClient=/usr/bin/thunderbird in
// ~/.kde/share/config/emaildefaults or /etc/kde (ou /usr/share/config qui est un
// lien symbolique vers /etc/kde)
return XDG;
}
 
return MailTo;
298,6 → 306,33
}
};
 
public static final EmailClient XDG = new EmailClient(EmailClientType.XDG) {
@Override
public boolean composeNative(String to, String subject, String body, File... attachments) throws IOException, InterruptedException {
final ProcessBuilder pb = new ProcessBuilder("xdg-email");
if (subject != null) {
pb.command().add("--subject");
pb.command().add(subject);
}
if (body != null) {
pb.command().add("--body");
pb.command().add(body);
}
for (File attachment : attachments) {
pb.command().add("--attach");
pb.command().add(attachment.getAbsolutePath());
}
pb.command().add(to);
pb.inheritIO();
final Process process = pb.start();
process.getOutputStream().close();
final int returnCode = process.waitFor();
if (returnCode != 0)
throw new IllegalStateException("Non zero return code: " + returnCode);
return true;
}
};
 
public static final EmailClient Outlook = new EmailClient(EmailClientType.Outlook) {
@Override
protected boolean composeNative(String to, String subject, String body, File... attachments) throws IOException, InterruptedException {
371,7 → 406,12
protected Thunderbird() {
super(EmailClientType.Thunderbird);
}
 
@Override
public String toString() {
return this.getClass().getSimpleName();
}
}
 
private static final class ThunderbirdCommandLine extends Thunderbird {
 
390,7 → 430,12
// (BTW return code of 1 means the program was already launched)
return true;
}
 
@Override
public String toString() {
return super.toString() + " " + this.cmdLine;
}
}
 
private static final class ThunderbirdPath extends Thunderbird {
 
406,7 → 451,12
Runtime.getRuntime().exec(new String[] { this.exe.getPath(), "-compose", composeArg });
return true;
}
 
@Override
public String toString() {
return super.toString() + " " + this.exe;
}
}
 
private final EmailClientType type;
 
420,6 → 470,12
 
protected abstract boolean composeNative(final String to, final String subject, final String body, final File... attachments) throws IOException, InterruptedException;
 
@Override
public String toString() {
final EmailClientType t = this.getType();
return t == null ? "mailto" : t.toString();
}
 
public final static void main(String[] args) throws Exception {
if (args.length == 1 && "--help".equals(args[0])) {
System.out.println("Usage: java [-Dparam=value] " + EmailClient.class.getName() + " [EmailClientType args]");
429,6 → 485,7
}
 
final EmailClient client = createFromString(args);
System.out.println("Using " + (args.length == 0 ? "preferred" : "passed") + " client : " + client);
final String to = System.getProperty("to", "Pierre Dupond <p.dupond@example.com>, p.dupont@server.com");
// ',to=' to test escaping of Thunderbird (passing subject='foo'bar' works)
final String subject = System.getProperty("subject", "Sujé € du courrier ',to='&;\\<> \"autre'\n2nd line");
451,6 → 508,8
 
final EmailClientType t = EmailClientType.valueOf(args[0]);
switch (t) {
case XDG:
return XDG;
case Outlook:
return Outlook;
case AppleMail:
/trunk/OpenConcerto/src/org/openconcerto/task/config/ComptaBasePropsConfiguration.java
31,11 → 31,9
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;
45,11 → 43,6
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);
104,7 → 97,6
private int idSociete = SQLRow.NONEXISTANT_ID;
private SQLRow rowSociete = null;
private DBRoot baseSociete;
private Thread sslThread = null;
 
{
// * logs
126,49 → 118,6
}
 
 
@Override
protected void afterSSLConnect(final Session conn) {
if (conn.isConnected()) {
final Thread t = new Thread(new Runnable() {
@Override
public void run() {
while (true) {
try {
Thread.sleep(1000);
if (!conn.isConnected()) {
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) {
// used by destroy()
break;
}
}
}
});
t.setDaemon(true);
t.setName("SSL connection watcher");
t.start();
assert this.sslThread == null;
this.sslThread = t;
} else {
ExceptionHandler.die("Impossible d'établir la liaison sécurisée!\nVérifiez votre connexion internet et relancez le logiciel.");
}
}
 
@Override
public void destroy() {
if (this.sslThread != null) {
this.sslThread.interrupt();
this.sslThread = null;
}
super.destroy();
}
 
// use Configuration directory if it exists
@Override
protected FileMode getFileMode() {
/trunk/OpenConcerto/src/org/openconcerto/erp/config/mappingCompta_fr.xml
8,7 → 8,7
 
<TABLE name="ADRESSE">
<FIELD name="TYPE" label="Type" titlelabel="Type" />
<FIELD name="LIBELLE" label="Libellé" titlelabel="Libellé" />
<FIELD name="LIBELLE" label="Libellé" />
<FIELD name="RAISON_SOCIALE" label="Raison sociale" titlelabel="Raison sociale" />
<FIELD name="RUE" label="Rue" titlelabel="Rue" />
<FIELD name="PROVINCE" label="Province / état" titlelabel="Province" />
45,7 → 45,7
<FIELD name="ID_CONTACT_TECH" label="Contact technique" titlelabel="Contact technique" />
<FIELD name="ID_PROPOSITION" label="Proposition" titlelabel="Proposition" />
<FIELD name="OBJET" label="Affaire" titlelabel="Affaire" />
<FIELD name="TOTAL_HT" label="Total HT" titlelabel="Total HT" />
<FIELD name="TOTAL_HT" label="Total HT" />
<FIELD name="MONTANT_FACTURE" label="Montant HT facturé" titlelabel="Montant HT facturé" />
<FIELD name="REFERENCE" label="Nos références" titlelabel="Nos références" />
<FIELD name="SITUATION_ADMIN" label="Situation administrative" titlelabel="Situation administrative" />
62,11 → 62,11
<TABLE name="AFFAIRE_ELEMENT">
<FIELD name="FIN_CONTRAT" label="Fin de contrat" titlelabel="Fin de contrat" />
<FIELD name="DATE_FIN_CONTRAT" label="Date de fin de contrat" titlelabel="Date de fin de contrat" />
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="CODE" label="Code" />
<FIELD name="DUREE_PREVISIONNELLE" label="Durée prévue" titlelabel="Durée prévue" />
<FIELD name="ID_DOSSIER" label="Dossier" titlelabel="Dossier" />
<FIELD name="ID_TAXE" label="TVA" titlelabel="TVA" />
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="NOM" label="Libellé" />
<FIELD name="ACTIVITE" label="Activité" titlelabel="Activité" />
<FIELD name="SOUS_ACTIVITE" label="Sous activité" titlelabel="Sous activité" />
<FIELD name="MONTANT_HT" label="Montant HT" titlelabel="Montant HT" />
92,6 → 92,7
</TABLE>
 
<TABLE name="ARTICLE">
<FIELD name="MASQUE_CAISSE" label="Ne pas charger sur la caisse" />
<FIELD name="TARE" label="Tare" />
<FIELD name="IFCO" label="IFCO" />
<FIELD name="MATIERE" label="Matière" />
109,9 → 110,9
<FIELD name="ETIQUETTE" label="Libellé étiquette" titlelabel="Libellé étiquette" />
<FIELD name="CODE" label="Code article" titlelabel="Code article" />
<FIELD name="NOM" label="Désignation" titlelabel="Désignation" />
<FIELD name="PA_HT" label="Prix achat HT" titlelabel="Prix achat HT" />
<FIELD name="PV_HT" label="Prix vente HT" titlelabel="Prix vente HT" />
<FIELD name="PV_TTC" label="Prix vente TTC" titlelabel="Prix vente TTC" />
<FIELD name="PA_HT" label="Prix d'achat HT" />
<FIELD name="PV_HT" label="Prix de vente HT" />
<FIELD name="PV_TTC" label="Prix de vente TTC" />
<FIELD name="ID_TAXE" label="Taxe" titlelabel="Taxe" />
<FIELD name="POIDS" label="Poids en Kg" titlelabel="Poids" />
<FIELD name="SERVICE" label="Service" titlelabel="Service" />
120,12 → 121,12
<FIELD name="PRIX_METRIQUE_HA_1" label="P.A. UV HT" titlelabel="P.A. UV HT" />
<FIELD name="VALEUR_METRIQUE_1" label="Longueur par défaut" titlelabel="Longueur par défaut" />
<FIELD name="ID_METRIQUE_1" label="Métrique" titlelabel="Métrique" />
<FIELD name="PRIX_METRIQUE_VT_2" label="PV HT" titlelabel="PV HT" />
<FIELD name="PRIX_METRIQUE_HA_2" label="PHA HT" titlelabel="PHA HT" />
<FIELD name="PRIX_METRIQUE_VT_2" label="P.V. HT" titlelabel="P.V. HT" />
<FIELD name="PRIX_METRIQUE_HA_2" label="P.A. HT" titlelabel="P.A. HT" />
<FIELD name="VALEUR_METRIQUE_2" label="Largeur" titlelabel="Largeur" />
<FIELD name="ID_METRIQUE_2" label="Métrique" titlelabel="Métrique" />
<FIELD name="PRIX_METRIQUE_VT_3" label="PV HT" titlelabel="PV HT" />
<FIELD name="PRIX_METRIQUE_HA_3" label="PHA HT" titlelabel="PHA HT" />
<FIELD name="PRIX_METRIQUE_VT_3" label="P.V. HT" />
<FIELD name="PRIX_METRIQUE_HA_3" label="P.A. HT" />
<FIELD name="VALEUR_METRIQUE_3" label="poids / m²" titlelabel="poids / m²" />
<FIELD name="ID_METRIQUE_3" label="Métrique" titlelabel="Métrique" />
<FIELD name="ID_MODE_VENTE_ARTICLE" label="Mode de vente" titlelabel="Mode de vente" />
190,7 → 191,7
<FIELD name="TYPE_REAPPRO" label="Sys. réappro" />
<FIELD name="ACHETEUR" label="Acheteur" />
<FIELD name="CODE_PAYS_ORIGINE" label="Code pays origine" />
<FIELD name="PRIX_ACHAT_DEVISE_F" label="Prix achat devise fourn." />
<FIELD name="PRIX_ACHAT_DEVISE_F" label="Prix d'achat devise fourn." />
<FIELD name="PRIX_ACHAT" label="Prix en devise locale" />
<FIELD name="QTE" label="Quantité" />
<FIELD name="DATE_PRIX" label="Date" />
249,7 → 250,7
<FIELD name="REF_CLIENT" label="Références client" titlelabel="Références client" />
<FIELD name="ID_MODE_REGLEMENT" label="Mode de reglement" titlelabel="Mode de reglement" />
<FIELD name="ID_ADRESSE" label="Adresse spécifique" titlelabel="Adresse spécifique" />
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="NOM" label="Libellé" />
<FIELD name="ID_AFFAIRE" label="Affaire" titlelabel="Affaire" />
<FIELD name="AFFACTURE" label="Natexis" titlelabel="Natexis" />
<FIELD name="ID_CONTACT" label="Contact" titlelabel="Contact" />
262,13 → 263,13
<FIELD name="ID_CLIENT" label="Client" titlelabel="Client" />
<FIELD name="ID_POLE_PRODUIT" label="Pôle produit" titlelabel="Pôle produit" />
<FIELD name="ID_SAISIE_VENTE_FACTURE" label="Facture N°" titlelabel="Facture N°" />
<FIELD name="NUMERO" label="Numéro" titlelabel="Numéro" />
<FIELD name="NUMERO" label="Numéro" />
<FIELD name="MONTANT_TVA" label="Total TVA" titlelabel="Total TVA" />
<FIELD name="PORT_HT" label="Frais de port HT" titlelabel="Ports" />
<FIELD name="REMISE_HT" label="Remise HT" titlelabel="Remise" />
<FIELD name="MONTANT_SOLDE" label="Montant TTC soldé" titlelabel="Montant TTC soldé" />
<FIELD name="MONTANT_SERVICE" label="Frais de service" titlelabel="Service" />
<FIELD name="ID_VERIFICATEUR" label="Vérificateur" titlelabel="Vérificateur" />
<FIELD name="ID_VERIFICATEUR" label="Vérificateur" />
<FIELD name="ID_COMMERCIAL" label="Commercial" titlelabel="Commercial" />
<FIELD name="ID_COMPTE_PCE_SERVICE" label="Compte service" titlelabel="Compte service" />
<FIELD name="COMPTE_SERVICE_AUTO" label="Gestion automatique du compte de service" titlelabel="Gestion automatique du compte de service" />
302,17 → 303,17
<FIELD name="POURCENT_REMISE" label="% Remise" titlelabel="% Remise" />
<FIELD name="ID_AVOIR_CLIENT" label="Avoir" titlelabel="Avoir" />
<FIELD name="ID_STYLE" label="Style" titlelabel="Style" />
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="CODE" label="Code" />
<FIELD name="NOM" label="Désignation" titlelabel="Désignation" />
<FIELD name="PA_HT" label="PA Unitaire HT" titlelabel="PA Unitaire HT" />
<FIELD name="PV_HT" label="PV Unitaire HT" titlelabel="PV Unitaire HT" />
<FIELD name="ID_TAXE" label="Taxe" titlelabel="Taxe" />
<FIELD name="POIDS" label="Poids UV" titlelabel="Poids UV" />
<FIELD name="T_POIDS" label="Poids total" titlelabel="Poids total" />
<FIELD name="T_PA_HT" label="Total achat HT" titlelabel="Poids total" />
<FIELD name="T_PV_HT" label="Total HT" titlelabel="Total HT" />
<FIELD name="T_POIDS" label="Poids total" />
<FIELD name="T_PA_HT" label="Total d'achat HT" />
<FIELD name="T_PV_HT" label="Total HT" />
<FIELD name="MARGE_HT" label="Marge HT" titlelabel="Marge HT" />
<FIELD name="T_PV_TTC" label="Total TTC" titlelabel="Total TTC" />
<FIELD name="T_PV_TTC" label="Total TTC" />
<FIELD name="QTE" label="Quantité" titlelabel="Qté" />
<FIELD name="SERVICE" label="Service" titlelabel="Service" />
<FIELD name="PRIX_METRIQUE_VT_1" label="P.V. UV HT" titlelabel="P.V. UV HT" />
319,16 → 320,15
<FIELD name="PRIX_METRIQUE_HA_1" label="P.A. UV HT" titlelabel="P.A. UV HT" />
<FIELD name="VALEUR_METRIQUE_1" label="Longueur par défaut" titlelabel="Longueur par défaut" />
<FIELD name="ID_METRIQUE_1" label="Métrique" titlelabel="Métrique" />
<FIELD name="PRIX_METRIQUE_VT_2" label="PV au metre HT" titlelabel="PV au metre HT" />
<FIELD name="PRIX_METRIQUE_HA_2" label="PHA au metre HT" titlelabel="PHA au metre HT" />
<FIELD name="PRIX_METRIQUE_VT_2" label="P.V. HT au mètre" />
<FIELD name="PRIX_METRIQUE_HA_2" label="P.A. HT au mètre" />
<FIELD name="VALEUR_METRIQUE_2" label="Largeur" titlelabel="Largeur" />
<FIELD name="ID_METRIQUE_2" label="Métrique" titlelabel="Métrique" />
<FIELD name="PRIX_METRIQUE_VT_3" label="PV au kg HT" titlelabel="PV au kg HT" />
<FIELD name="PRIX_METRIQUE_HA_3" label="PHA au kg HT" titlelabel="PHA au kg HT" />
<FIELD name="PRIX_METRIQUE_VT_3" label="P.V. HT au kg" />
<FIELD name="PRIX_METRIQUE_HA_3" label="P.A. HT au kg" />
<FIELD name="VALEUR_METRIQUE_3" label="poids / m²" titlelabel="poids / m²" />
<FIELD name="ID_METRIQUE_3" label="Métrique" titlelabel="Métrique" />
<FIELD name="ID_MODE_VENTE_ARTICLE" label="Mode de vente" titlelabel="Mode de vente" />
 
<FIELD name="ID_STYLE" label="Style" titlelabel="Style" />
<FIELD name="CODE_MISSION" label="Code mission" titlelabel="Code mission" />
<FIELD name="NOM_MISSION" label="Nom mission" titlelabel="Nom mission" />
357,7 → 357,7
 
<TABLE name="AVOIR_FOURNISSEUR">
<FIELD name="INFOS" label="Informations complémentaires" titlelabel="Informations complémentaires" />
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="NOM" label="Libellé" />
<FIELD name="DATE" label="Date" titlelabel="Date" />
<FIELD name="SOLDE" label="Soldé" titlelabel="Soldé" />
<FIELD name="MONTANT_HT" label="Montant HT" titlelabel="Montant HT" />
364,7 → 364,7
<FIELD name="MONTANT_TTC" label="Montant TTC" titlelabel="Montant TTC" />
<FIELD name="ID_TAXE" label="Taxe" titlelabel="Taxe" />
<FIELD name="ID_FOURNISSEUR" label="Fournisseur" titlelabel="Fournisseur" />
<FIELD name="NUMERO" label="Numéro" titlelabel="Numéro" />
<FIELD name="NUMERO" label="Numéro" />
<FIELD name="ID_COMPTE_PCE" label="Compte charges" titlelabel="Compte charges" />
<FIELD name="MONTANT_TVA" label="Total TVA" titlelabel="Total TVA" />
<FIELD name="A_DEDUIRE" label="A déduire sur un prochain achat" titlelabel="A déduire sur un prochain achat" />
403,10 → 403,10
<FIELD name="DOMICILIATION" label="Domiciliation" titlelabel="Domiciliation" />
<FIELD name="BIC" label="BIC" titlelabel="BIC" />
<FIELD name="IBAN" label="IBAN" titlelabel="IBAN" />
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="CODE" label="Code" />
<FIELD name="ID_JOURNAL" label="Journal" titlelabel="Journal" />
<FIELD name="AFFACTURAGE" label="Banque d'affacturage" titlelabel="Banque d'affacturage" />
<FIELD name="INFOS" label="Informations" titlelabel="Informations" />
<FIELD name="INFOS" label="Informations" />
</TABLE>
<TABLE name="BANQUE">
<FIELD name="NOM" label="Nom" />
434,17 → 434,21
<FIELD name="NUMERO" label="Numéro du bon" titlelabel="Numéro BR" />
<FIELD name="TOTAL_POIDS" label="Poids total (en kg)" titlelabel="Poids total" />
<FIELD name="INFOS" label="Informations complémentaires" titlelabel="Informations complémentaires" />
<FIELD name="TOTAL_HT" label="Total HT" titlelabel="Total HT" />
<FIELD name="TOTAL_HT" label="Total HT" />
<FIELD name="TOTAL_TVA" label="Total TVA" titlelabel="Total TVA" />
<FIELD name="T_DEVISE" label="Total Devise" titlelabel="Total Devise" />
<FIELD name="TOTAL_TTC" label="Total TTC" titlelabel="Total TTC" />
<FIELD name="TOTAL_TTC" label="Total TTC" />
<FIELD name="NOM" label="Référence" titlelabel="Référence" />
<FIELD name="ID_COMMANDE" label="Commande" titlelabel="Commande" />
<FIELD name="ID_DEVISE" label="Devise" titlelabel="Devise" />
<FIELD name="T_ECO_CONTRIBUTION" label="Dont Eco-Contrib." />
<FIELD name="ID_TAXE_PORT" label="Taxe sur port" />
<FIELD name="PORT_HT" label="Frais de port HT" />
<FIELD name="REMISE_HT" label="Remise HT" />
</TABLE>
 
<TABLE name="BON_RECEPTION_ELEMENT">
<FIELD name="ID_DEMANDE_ACHAT_ELEMENT" label="Dmd Achat" />
<FIELD name="ID_DEPOT_STOCK" label="Dépôt Stock" />
<FIELD name="ID_ECO_CONTRIBUTION" label="Code Eco-Contrib." />
<FIELD name="ECO_CONTRIBUTION" label="Dont Eco-Contrib." />
454,33 → 458,33
<FIELD name="ID_ARTICLE" label="Article" titlelabel="Article" />
<FIELD name="ID_CODE_FOURNISSEUR" label="Code fournisseur" titlelabel="Code fournisseur" />
<FIELD name="DESCRIPTIF" label="Descriptif" titlelabel="Descriptif" />
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="CODE" label="Code" />
<FIELD name="NOM" label="Libellé" />
<FIELD name="PV_HT" label="PV Unitaire HT" titlelabel="PV Unitaire HT" />
<FIELD name="PA_HT" label="PA Unitaire HT" titlelabel="PA Unitaire HT" />
<FIELD name="ID_DEVISE" label="Devise" titlelabel="Devise" />
<FIELD name="PA_DEVISE" label="PA Devise" titlelabel="PA Devise" />
<FIELD name="PA_DEVISE_T" label="PA Devise Total" titlelabel="PA Devise Total" />
 
<FIELD name="QTE_ORIGINE" label="Qté cdée" titlelabel="Qté cdée" />
<FIELD name="QTE" label="Qté reçue" titlelabel="Qté reçue" />
<FIELD name="ID_TAXE" label="Taxe" titlelabel="Taxe" />
<FIELD name="POIDS" label="Poids UV" titlelabel="Poids UV" />
<FIELD name="PRIX_METRIQUE_VT_1" label="P.V. UV HT" titlelabel="P.V. UV HT" />
<FIELD name="PRIX_METRIQUE_HA_1" label="PHA UV² HT" titlelabel="P.A. UV HT" />
<FIELD name="PRIX_METRIQUE_HA_1" label="P.A. UV² HT" />
<FIELD name="VALEUR_METRIQUE_1" label="Longueur par défaut" titlelabel="Longueur par défaut" />
<FIELD name="ID_METRIQUE_1" label="Métrique" titlelabel="Métrique" />
<FIELD name="PRIX_METRIQUE_VT_2" label="PV au metre HT" titlelabel="PV au metre HT" />
<FIELD name="PRIX_METRIQUE_HA_2" label="PHA au metre HT" titlelabel="PHA au metre HT" />
<FIELD name="PRIX_METRIQUE_VT_2" label="P.V. HT au mètre" />
<FIELD name="PRIX_METRIQUE_HA_2" label="P.A. HT au mètre" />
<FIELD name="VALEUR_METRIQUE_2" label="Largeur" titlelabel="Largeur" />
<FIELD name="ID_METRIQUE_2" label="Métrique" titlelabel="Métrique" />
<FIELD name="PRIX_METRIQUE_VT_3" label="PV au kg HT" titlelabel="PV au kg HT" />
<FIELD name="PRIX_METRIQUE_HA_3" label="PHA au kg HT" titlelabel="PHA au kg HT" />
<FIELD name="PRIX_METRIQUE_VT_3" label="P.V. HT au kg" />
<FIELD name="PRIX_METRIQUE_HA_3" label="P.A. HT au kg" />
<FIELD name="VALEUR_METRIQUE_3" label="poids / m²" titlelabel="poids / m²" />
<FIELD name="ID_METRIQUE_3" label="Métrique" titlelabel="Métrique" />
<FIELD name="T_PV_TTC" label="Total TTC" titlelabel="Total TTC" />
<FIELD name="T_PV_HT" label="Total Vt HT" titlelabel="Total Vt HT" />
<FIELD name="T_PA_HT" label="Total Ha HT" titlelabel="Total Ha HT" />
<FIELD name="T_PA_TTC" label="Total Ha TTC" titlelabel="Total Ha TTC" />
<FIELD name="T_PV_TTC" label="Total TTC" />
<FIELD name="T_PV_HT" label="Total HT" />
<FIELD name="T_PA_HT" label="Total Achat HT" />
<FIELD name="T_PA_TTC" label="Total Achat TTC" />
<FIELD name="T_POIDS" label="Poids total" titlelabel="Poids total" />
<FIELD name="ID_STYLE" label="Style" titlelabel="Style" />
<FIELD name="SERVICE" label="Service" titlelabel="Service" />
500,9 → 504,9
<FIELD name="NUMERO" label="Numéro du bon" titlelabel="Numéro BL" />
<FIELD name="TOTAL_POIDS" label="Poids total (en kg)" titlelabel="Poids total" />
<FIELD name="INFOS" label="Informations complémentaires" titlelabel="Informations complémentaires" />
<FIELD name="TOTAL_HT" label="Total HT" titlelabel="Total HT" />
<FIELD name="TOTAL_TVA" label="Total TVA" titlelabel="Total TVA" />
<FIELD name="TOTAL_TTC" label="Total TTC" titlelabel="Total TTC" />
<FIELD name="TOTAL_HT" label="Total HT" />
<FIELD name="TOTAL_TVA" label="Total TVA" />
<FIELD name="TOTAL_TTC" label="Total TTC" />
<FIELD name="NOM" label="Référence" titlelabel="Référence" />
<FIELD name="T_ECOTAXE" label="Dont ecotaxe" titlelabel="Dont ecotaxe" />
<FIELD name="T_DEVISE" label="Total Devise" titlelabel="Total Devise" />
537,8 → 541,8
<FIELD name="POURCENT_REMISE" label="% Remise" titlelabel="Remise" />
<FIELD name="PRIX_FINAL_TTC" label="Prix de final de ttc" titlelabel="Prix de final de ttc" />
<FIELD name="T_PRIX_FINAL_TTC" label="T de prix de final de ttc" titlelabel="T de prix de final de ttc" />
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="CODE" label="Code" />
<FIELD name="NOM" label="Libellé" />
<FIELD name="PV_HT" label="PV Unitaire HT" titlelabel="PV Unitaire HT" />
<FIELD name="PA_HT" label="PA Unitaire HT" titlelabel="PA Unitaire HT" />
<FIELD name="QTE" label="Qté à livrer" titlelabel="Qté à livrer" />
550,17 → 554,17
<FIELD name="PRIX_METRIQUE_HA_1" label="P.A. UV HT" titlelabel="P.A. UV HT" />
<FIELD name="VALEUR_METRIQUE_1" label="Longueur par défaut" titlelabel="Longueur par défaut" />
<FIELD name="ID_METRIQUE_1" label="Métrique" titlelabel="Métrique" />
<FIELD name="PRIX_METRIQUE_VT_2" label="PV au metre HT" titlelabel="PV au metre HT" />
<FIELD name="PRIX_METRIQUE_HA_2" label="PHA au metre HT" titlelabel="PHA au metre HT" />
<FIELD name="PRIX_METRIQUE_VT_2" label="P.V. HT au mètre" />
<FIELD name="PRIX_METRIQUE_HA_2" label="P.A. HT au mètre" />
<FIELD name="VALEUR_METRIQUE_2" label="Largeur" titlelabel="Largeur" />
<FIELD name="ID_METRIQUE_2" label="Métrique" titlelabel="Métrique" />
<FIELD name="PRIX_METRIQUE_VT_3" label="PV au kg HT" titlelabel="PV au kg HT" />
<FIELD name="PRIX_METRIQUE_HA_3" label="PHA au kg HT" titlelabel="PHA au kg HT" />
<FIELD name="PRIX_METRIQUE_VT_3" label="P.V. HT au kg" />
<FIELD name="PRIX_METRIQUE_HA_3" label="P.A. HT au kg" titlelabel="P.A. HT au kg" />
<FIELD name="VALEUR_METRIQUE_3" label="poids / m²" titlelabel="poids / m²" />
<FIELD name="ID_METRIQUE_3" label="Métrique" titlelabel="Métrique" />
<FIELD name="T_PV_TTC" label="Total TTC" titlelabel="Total TTC" />
<FIELD name="T_PV_HT" label="Total Vt HT" titlelabel="Total Vt HT" />
<FIELD name="T_PA_HT" label="Total Ha HT" titlelabel="Total Ha HT" />
<FIELD name="T_PV_TTC" label="Total TTC" />
<FIELD name="T_PV_HT" label="Total vente HT" />
<FIELD name="T_PA_HT" label="Total achat HT" />
<FIELD name="T_POIDS" label="Poids total" titlelabel="Poids total" />
<FIELD name="T_POIDS_LIVREE" label="Poids total livré" titlelabel="Poids total livré" />
<FIELD name="ID_STYLE" label="Style" titlelabel="Style" />
574,7 → 578,7
 
<TABLE name="CAISSE">
<FIELD name="NOM" label="Caisse" titlelabel="Caisse" />
<FIELD name="NUMERO" label="Numéro" titlelabel="Numéro" />
<FIELD name="NUMERO" label="Numéro" />
</TABLE>
 
 
630,17 → 634,17
<FIELD name="ID_COMMANDE_CLIENT" label="Commande client" />
<FIELD name="NOM" label="Libellé" />
<FIELD name="QTE" label="Qté" />
<FIELD name="PA_HT" label="PA HT" />
<FIELD name="PV_HT" label="PV HT" />
<FIELD name="T_PA_HT" label="Total PA HT" />
<FIELD name="PA_HT" label="P.A. HT" />
<FIELD name="PV_HT" label="P.V. HT" />
<FIELD name="T_PA_HT" label="Total P.A. HT" />
<FIELD name="MARGE" label="Marge" />
<FIELD name="T_PV_HT" label="Total PV HT" />
<FIELD name="T_PV_HT" label="Total P.V. HT" />
<FIELD name="ID_FAMILLE_ARTICLE" label="Famille" />
<FIELD name="ID_UNITE_VENTE" label="Unité vente" />
</TABLE>
 
<TABLE name="CLASSE_COMPTE">
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="NOM" label="Libellé" />
<FIELD name="TYPE_NUMERO_COMPTE" label="Type numéro de compte" titlelabel="Type numéro de compte" />
</TABLE>
 
737,25 → 741,25
</TABLE>
 
<TABLE name="CODE_REGIME">
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="CODE" label="Code" />
<FIELD name="NOM" label="Libellé" />
</TABLE>
 
<TABLE name="CODE_CARACT_ACTIVITE">
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="CODE" label="Code" />
<FIELD name="NOM" label="Libellé" />
</TABLE>
<TABLE name="CODE_CONTRAT_TRAVAIL">
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="CODE" label="Code" />
<FIELD name="NOM" label="Libellé" />
</TABLE>
<TABLE name="CODE_DROIT_CONTRAT">
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="CODE" label="Code" />
<FIELD name="NOM" label="Libellé" />
</TABLE>
 
<TABLE name="CODE_FOURNISSEUR">
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="CODE" label="Code" />
<FIELD name="ID_FOURNISSEUR" label="Fournisseur" titlelabel="Fournisseur" />
</TABLE>
 
764,8 → 768,8
 
<TABLE name="CODE_MISSION">
<FIELD name="CONTROLE_TECHNIQUE" label="Mission controle technique" titlelabel="Mission controle technique" />
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="CODE" label="Code" />
<FIELD name="NOM" label="Libellé" />
<FIELD name="ID_DOMAINE" label="Domaine" titlelabel="Domaine" />
<FIELD name="ID_SERVICE" label="Service" titlelabel="Service" />
<FIELD name="ACTIVITE" label="Activité" titlelabel="Activité" />
780,20 → 784,27
</TABLE>
 
<TABLE name="CODE_STATUT_PROF">
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="CODE" label="Code" />
<FIELD name="NOM" label="Libellé" />
</TABLE>
 
<TABLE name="CODE_STATUT_CATEGORIEL">
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="CODE" label="Code" />
<FIELD name="NOM" label="Libellé" />
</TABLE>
 
<TABLE name="CODE_EMPLOI">
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="CODE" label="Code" />
<FIELD name="NOM" label="Libellé" />
</TABLE>
 
<TABLE name="COEFF_PRIME">
<FIELD name="PRIME_PERSO" label="Personnelle" />
<FIELD name="PRIME_RECONSTRUCTION" label="Reconstruction" />
<FIELD name="PRIME_ANCIENNETE" label="Anciennete" />
<FIELD name="PRIME_DEROULEMENT" label="Déroulement" />
</TABLE>
 
<TABLE name="CONTACT">
<FIELD name="PRENOM" label="Prénom du contact" titlelabel="Prénom du contact" />
<FIELD name="NOM" label="Nom du contact" titlelabel="Nom du contact" />
916,19 → 927,21
<FIELD name="DATE_RECEPTION_CONFIRMEE" label="Date réception confirmée" />
<FIELD name="INCOTERM" label="Incoterm" />
<FIELD name="ID_TAXE_PORT" label="Taxe sur port" />
<FIELD name="PORT_HT" label="Frais de port HT" />
<FIELD name="REMISE_HT" label="Remise HT" />
<FIELD name="EN_COURS" label="En cours" titlelabel="En cours" />
<FIELD name="NOM" label="Référence" titlelabel="Référence" />
<FIELD name="NUMERO" label="Numéro" titlelabel="Numéro" />
<FIELD name="INFOS" label="Informations" titlelabel="Informations" />
<FIELD name="NUMERO" label="Numéro" />
<FIELD name="INFOS" label="Informations" />
<FIELD name="DATE" label="Date" titlelabel="Date" />
<FIELD name="DATE_ECHEANCE" label="Date d'échéance" titlelabel="Date d'échéance" />
<FIELD name="ID_FOURNISSEUR" label="Fournisseur" titlelabel="Fournisseur" />
<FIELD name="ID_COMMERCIAL" label="Commercial" titlelabel="Commercial" />
<FIELD name="SOURCE" label="Source" titlelabel="Source" />
<FIELD name="T_HT" label="Total HT" titlelabel="Total HT" />
<FIELD name="T_HT" label="Total HT" />
<FIELD name="T_TVA" label="Total TVA" titlelabel="Total TVA" />
<FIELD name="T_TTC" label="Total TTC" titlelabel="Total TTC" />
<FIELD name="T_TTC" label="Total TTC" titlelabel="Total TTC" />
<FIELD name="T_TTC" label="Total TTC" />
<FIELD name="T_TTC" label="Total TTC" />
<FIELD name="T_DEVISE" label="Total Devise" titlelabel="Total Devise" />
<FIELD name="T_POIDS" label="Poids total" titlelabel="Poids total" />
<FIELD name="ID_POLE_PRODUIT" label="Pôle produit" titlelabel="Pôle produit" />
940,6 → 953,8
</TABLE>
 
<TABLE name="COMMANDE_ELEMENT">
<FIELD name="ID_DEMANDE_ACHAT_ELEMENT" label="Dmd Achat" />
<FIELD name="ID_FAMILLE_ARTICLE" label="Famille d'article" />
<FIELD name="ID_DEPOT_STOCK" label="Dépôt Stock" />
<FIELD name="ID_ECO_CONTRIBUTION" label="Code Eco-Contrib." />
<FIELD name="ECO_CONTRIBUTION" label="Dont Eco-Contrib." />
955,7 → 970,7
<FIELD name="DESCRIPTIF" label="Descriptif" titlelabel="Descriptif" />
<FIELD name="ID_COMMANDE" label="Commande" titlelabel="Commande" />
<FIELD name="ID_STYLE" label="Style" titlelabel="Style" />
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="CODE" label="Code" />
<FIELD name="NOM" label="Désignation" titlelabel="Désignation" />
<FIELD name="PA_HT" label="PA Unitaire HT" titlelabel="PA Unitaire HT" />
<FIELD name="PV_HT" label="PV Unitaire HT" titlelabel="PV Unitaire HT" />
967,18 → 982,18
<FIELD name="PRIX_METRIQUE_HA_1" label="P.A. UV HT" titlelabel="P.A. UV HT" />
<FIELD name="VALEUR_METRIQUE_1" label="Longueur par défaut" titlelabel="Longueur par défaut" />
<FIELD name="ID_METRIQUE_1" label="Métrique" titlelabel="Métrique" />
<FIELD name="PRIX_METRIQUE_VT_2" label="PV au metre HT" titlelabel="PV au metre HT" />
<FIELD name="PRIX_METRIQUE_HA_2" label="PHA au metre HT" titlelabel="PHA au metre HT" />
<FIELD name="PRIX_METRIQUE_VT_2" label="P.V. au mètre HT" titlelabel="P.V. au mètre HT" />
<FIELD name="PRIX_METRIQUE_HA_2" label="P.A. HT au mètre" titlelabel="P.A. HT au mètre" />
<FIELD name="VALEUR_METRIQUE_2" label="Largeur" titlelabel="Largeur" />
<FIELD name="ID_METRIQUE_2" label="Métrique" titlelabel="Métrique" />
<FIELD name="PRIX_METRIQUE_VT_3" label="PV au kg HT" titlelabel="PV au kg HT" />
<FIELD name="PRIX_METRIQUE_HA_3" label="PHA au kg HT" titlelabel="PHA au kg HT" />
<FIELD name="PRIX_METRIQUE_VT_3" label="P.V. HT au kg" titlelabel="P.V. HT au kg" />
<FIELD name="PRIX_METRIQUE_HA_3" label="P.A. HT au kg" titlelabel="P.A. HT au kg" />
<FIELD name="VALEUR_METRIQUE_3" label="poids / m²" titlelabel="poids / m²" />
<FIELD name="ID_METRIQUE_3" label="Métrique" titlelabel="Métrique" />
<FIELD name="T_PV_TTC" label="Total TTC" titlelabel="Total TTC" />
<FIELD name="T_PV_TTC" label="Total TTC" />
<FIELD name="T_PV_HT" label="Total Vt HT" titlelabel="Total Vt HT" />
<FIELD name="T_PA_TTC" label="Total Ha TTC" titlelabel="Total Ha TTC" />
<FIELD name="T_PA_HT" label="Total Ha HT" titlelabel="Total Ha HT" />
<FIELD name="T_PA_TTC" label="Total achat TTC" />
<FIELD name="T_PA_HT" label="Total achat HT" />
<FIELD name="POURCENT_REMISE" label="% Remise" titlelabel="% Remise" />
<FIELD name="T_POIDS" label="Poids total" titlelabel="Poids total" />
<FIELD name="ID_MODE_VENTE_ARTICLE" label="Mode de vente" titlelabel="Mode de vente" />
995,7 → 1010,7
<FIELD name="NUMERO_EXPEDITION" label="Numéro d'expédition" />
<FIELD name="EMBALLAGE" label="Type d'emballage" />
<FIELD name="ETAT_COMMANDE" label="Etat commande" />
<FIELD name="NUMERO" label="Numéro" titlelabel="Numéro" />
<FIELD name="NUMERO" label="Numéro" />
<FIELD name="DATE" label="Date" titlelabel="Date" />
<FIELD name="DATE_ECHEANCE" label="Date d'échéance" titlelabel="Date d'échéance" />
<FIELD name="ID_CLIENT" label="Client" titlelabel="Client" />
1002,9 → 1017,9
<FIELD name="PORT_HT" label="Frais de port HT" />
<FIELD name="REMISE_HT" label="Remise HT" />
<FIELD name="ID_TAXE_PORT" label="TVA sur Port" />
<FIELD name="T_HT" label="Total HT" titlelabel="Total HT" />
<FIELD name="T_HT" label="Total HT" />
<FIELD name="T_TVA" label="Total TVA" titlelabel="Total TVA" />
<FIELD name="T_TTC" label="Total TTC" titlelabel="Total TTC" />
<FIELD name="T_TTC" label="Total TTC" />
<FIELD name="T_DEVISE" label="Total Devise" />
<FIELD name="INFOS" label="Informations" />
<FIELD name="SOURCE" label="Source" />
1040,7 → 1055,7
<FIELD name="PV_T_DEVISE" label="Prix devise total" titlelabel="Prix devise total" />
<FIELD name="ID_COMMANDE_CLIENT" label="Commande" titlelabel="Commande" />
<FIELD name="ID_STYLE" label="Style" titlelabel="Style" />
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="CODE" label="Code" />
<FIELD name="NOM" label="Désignation" titlelabel="Désignation" />
<FIELD name="PA_HT" label="PA Unitaire HT" titlelabel="PA Unitaire HT" />
<FIELD name="MARGE_HT" label="Marge HT" titlelabel="Marge HT" />
1053,17 → 1068,17
<FIELD name="PRIX_METRIQUE_HA_1" label="P.A. UV HT" titlelabel="P.A. UV HT" />
<FIELD name="VALEUR_METRIQUE_1" label="Longueur par défaut" titlelabel="Longueur par défaut" />
<FIELD name="ID_METRIQUE_1" label="Métrique" titlelabel="Métrique" />
<FIELD name="PRIX_METRIQUE_VT_2" label="PV au metre HT" titlelabel="PV au metre HT" />
<FIELD name="PRIX_METRIQUE_HA_2" label="PHA au metre HT" titlelabel="PHA au metre HT" />
<FIELD name="PRIX_METRIQUE_VT_2" label="P.V. au mètre HT" titlelabel="P.V. au mètre HT" />
<FIELD name="PRIX_METRIQUE_HA_2" label="P.A. HT au mètre" titlelabel="P.A. HT au mètre" />
<FIELD name="VALEUR_METRIQUE_2" label="Largeur" titlelabel="Largeur" />
<FIELD name="ID_METRIQUE_2" label="Métrique" titlelabel="Métrique" />
<FIELD name="PRIX_METRIQUE_VT_3" label="PV au kg HT" titlelabel="PV au kg HT" />
<FIELD name="PRIX_METRIQUE_HA_3" label="PHA au kg HT" titlelabel="PHA au kg HT" />
<FIELD name="PRIX_METRIQUE_VT_3" label="P.V. HT au kg" titlelabel="P.V. HT au kg" />
<FIELD name="PRIX_METRIQUE_HA_3" label="P.A. HT au kg" titlelabel="P.A. HT au kg" />
<FIELD name="VALEUR_METRIQUE_3" label="poids / m²" titlelabel="poids / m²" />
<FIELD name="ID_METRIQUE_3" label="Métrique" titlelabel="Métrique" />
<FIELD name="T_PV_TTC" label="Total TTC" titlelabel="Total TTC" />
<FIELD name="T_PV_HT" label="Total Vt HT" titlelabel="Total Vt HT" />
<FIELD name="T_PA_HT" label="Total Ha HT" titlelabel="Total Ha HT" />
<FIELD name="T_PV_TTC" label="Total TTC" />
<FIELD name="T_PV_HT" label="Total vente HT" />
<FIELD name="T_PA_HT" label="Total achat HT" />
<FIELD name="T_POIDS" label="Poids total" titlelabel="Poids total" />
<FIELD name="ID_MODE_VENTE_ARTICLE" label="Mode de vente" titlelabel="Mode de vente" />
 
1096,7 → 1111,7
<TABLE name="COMPTE_PCE">
<FIELD name="NUMERO" label="N° de compte" titlelabel="N° de compte" />
<FIELD name="NOM" label="Compte" titlelabel="Compte" />
<FIELD name="INFOS" label="Informations" titlelabel="Informations" />
<FIELD name="INFOS" label="Informations" />
<FIELD name="RACINE" label="Racine" titlelabel="Racine" />
<FIELD name="TOTAL_DEBIT" label="Total débit" titlelabel="Total débit" />
<FIELD name="TOTAL_CREDIT" label="Total crédit" titlelabel="Total crédit" />
1105,8 → 1120,8
 
<TABLE name="COMPTE_PCG">
<FIELD name="NOM" label="Compte" titlelabel="Compte" />
<FIELD name="NUMERO" label="Numéro" titlelabel="Numéro" />
<FIELD name="INFOS" label="Informations" titlelabel="Informations" />
<FIELD name="NUMERO" label="Numéro" />
<FIELD name="INFOS" label="Informations" />
<FIELD name="ID_TYPE_COMPTE_PCG_BASE" label="Compte de base" titlelabel="Compte de base" />
<FIELD name="ID_TYPE_COMPTE_PCG_AB" label="Compte abrégé" titlelabel="Compte abrégé" />
<FIELD name="ID_TYPE_COMPTE_PCG_DEV" label="Compte développé" titlelabel="Compte développé" />
1115,9 → 1130,9
 
<TABLE name="COURRIER_CLIENT">
<FIELD name="NOM" label="Objet" titlelabel="Objet" />
<FIELD name="NUMERO" label="Numéro" titlelabel="Numéro" />
<FIELD name="INFOS" label="Informations" titlelabel="Informations" />
<FIELD name="ID_MODELE_COURRIER_CLIENT" label="Modéle" titlelabel="Modéle" />
<FIELD name="NUMERO" label="Numéro" />
<FIELD name="INFOS" label="Informations" />
<FIELD name="ID_MODELE_COURRIER_CLIENT" label="Modèle" titlelabel="Modèle" />
<FIELD name="ID_AFFAIRE" label="Numéro d'affaire" titlelabel="Numéro d'affaire" />
<FIELD name="DATE" label="Date" titlelabel="Date" />
<FIELD name="ID_SECRETAIRE" label="Secrétaire" titlelabel="Secrétaire" />
1152,6 → 1167,7
<FIELD name="DATE" label="Date" />
<FIELD name="ID_ETAT_DEMANDE_ACHAT_ELEMENT" label="Etat" />
<FIELD name="ID_ARTICLE" label="Article" />
<FIELD name="ID_FAMILLE_ARTICLE" label="Famille d'article" />
<FIELD name="CODE" label="Code" />
<FIELD name="NOM" label="Désignation" />
<FIELD name="ID_FABRICANT" label="Fabricant" />
1161,8 → 1177,11
<FIELD name="REPERE" label="Repère" />
<FIELD name="EN_STOCK" label="En stock" />
<FIELD name="REPERE_SOURCE" label="Repère Source" />
<FIELD name="REPRISE" label="Reprise" />
<FIELD name="ID_AFFAIRE" label="Affaire" />
<FIELD name="CODE_SOURCE" label="Code Source" />
<FIELD name="NOM_SOURCE" label="Désignation Source" />
<FIELD name="REVISION" label="Révision" />
</TABLE>
 
<TABLE name="DEMANDE_PRIX">
1208,7 → 1227,7
<FIELD name="DESCRIPTIF" label="Descriptif" titlelabel="Descriptif" />
<FIELD name="ID_DEMANDE_PRIX" label="Demande de prix" titlelabel="Demande de prix" />
<FIELD name="ID_STYLE" label="Style" titlelabel="Style" />
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="CODE" label="Code" />
<FIELD name="NOM" label="Désignation" titlelabel="Désignation" />
<FIELD name="PA_HT" label="PA Unitaire HT" titlelabel="PA Unitaire HT" />
<FIELD name="PV_HT" label="PV Unitaire HT" titlelabel="PV Unitaire HT" />
1216,22 → 1235,22
<FIELD name="POIDS" label="Poids" titlelabel="Poids" />
<FIELD name="QTE" label="Quantité" titlelabel="Qté" />
<FIELD name="SERVICE" label="Service" titlelabel="Service" />
<FIELD name="PRIX_METRIQUE_VT_1" label="PV UV HT" titlelabel="PV UV HT" />
<FIELD name="PRIX_METRIQUE_HA_1" label="PHA UV HT" titlelabel="PHA UV HT" />
<FIELD name="PRIX_METRIQUE_VT_1" label="P.V. HT U.V." />
<FIELD name="PRIX_METRIQUE_HA_1" label="P.A. HT U.V." />
<FIELD name="VALEUR_METRIQUE_1" label="Longueur par défaut" titlelabel="Longueur par défaut" />
<FIELD name="ID_METRIQUE_1" label="Métrique" titlelabel="Métrique" />
<FIELD name="PRIX_METRIQUE_VT_2" label="PV au metre HT" titlelabel="PV au metre HT" />
<FIELD name="PRIX_METRIQUE_HA_2" label="PHA au metre HT" titlelabel="PHA au metre HT" />
<FIELD name="PRIX_METRIQUE_VT_2" label="P.V. HT au mètre" />
<FIELD name="PRIX_METRIQUE_HA_2" label="P.A. HT au mètre" />
<FIELD name="VALEUR_METRIQUE_2" label="Largeur" titlelabel="Largeur" />
<FIELD name="ID_METRIQUE_2" label="Métrique" titlelabel="Métrique" />
<FIELD name="PRIX_METRIQUE_VT_3" label="PV au kg HT" titlelabel="PV au kg HT" />
<FIELD name="PRIX_METRIQUE_HA_3" label="PHA au kg HT" titlelabel="PHA au kg HT" />
<FIELD name="PRIX_METRIQUE_VT_3" label="P.V. HT au kg" titlelabel="P.V. HT au kg" />
<FIELD name="PRIX_METRIQUE_HA_3" label="P.A. HT au kg" titlelabel="P.A. HT au kg" />
<FIELD name="VALEUR_METRIQUE_3" label="poids / m²" titlelabel="poids / m²" />
<FIELD name="ID_METRIQUE_3" label="Métrique" titlelabel="Métrique" />
<FIELD name="T_PV_TTC" label="Total TTC" titlelabel="Total TTC" />
<FIELD name="T_PV_HT" label="Total Vt HT" titlelabel="Total Vt HT" />
<FIELD name="T_PA_TTC" label="Total Ha TTC" titlelabel="Total Ha TTC" />
<FIELD name="T_PA_HT" label="Total Ha HT" titlelabel="Total Ha HT" />
<FIELD name="T_PV_TTC" label="Total TTC" />
<FIELD name="T_PV_HT" label="Total vente HT" />
<FIELD name="T_PA_TTC" label="Total achat TTC" />
<FIELD name="T_PA_HT" label="Total achat HT" />
<FIELD name="T_POIDS" label="Poids total" titlelabel="Poids total" />
<FIELD name="ID_MODE_VENTE_ARTICLE" label="Mode de vente" titlelabel="Mode de vente" />
</TABLE>
1241,8 → 1260,8
</TABLE>
 
<TABLE name="DEPARTEMENT">
<FIELD name="NUMERO" label="Numéro" titlelabel="Numéro" />
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="NUMERO" label="Numéro" />
<FIELD name="NOM" label="Libellé" />
<FIELD name="CHEF_LIEU" label="Chef lieu" titlelabel="Chef lieu" />
<FIELD name="REGION_ADMIN" label="Région administrative" titlelabel="Région administrative" />
</TABLE>
1286,9 → 1305,10
<FIELD name="ID_COMMERCIAL" label="Commercial" titlelabel="Commercial" />
<FIELD name="ID_CLIENT" label="Client" titlelabel="Client" />
<FIELD name="T_HA" label="Total achat HT" titlelabel="Total achat HT" />
<FIELD name="T_HT" label="Total HT" titlelabel="Total HT" />
<FIELD name="T_HT" label="Total HT" />
<FIELD name="T_ACOMPTE" label="Acompte versé" />
<FIELD name="T_TVA" label="Total TVA" titlelabel="Total TVA" />
<FIELD name="T_TTC" label="Total TTC" titlelabel="Total TTC" />
<FIELD name="T_TTC" label="Total TTC" />
<FIELD name="PORT_HT" label="Frais de port HT" titlelabel="Ports" />
<FIELD name="REMISE_HT" label="Remise HT" titlelabel="Remise" />
<FIELD name="T_SERVICE" label="Frais de service" titlelabel="Service" />
1330,7 → 1350,7
<FIELD name="PV_T_DEVISE" label="Prix devise total" titlelabel="Prix devise total" />
<FIELD name="ID_DEVIS" label="Devis" titlelabel="Devis" />
<FIELD name="ID_STYLE" label="Style" titlelabel="Style" />
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="CODE" label="Code" />
<FIELD name="NOM" label="Désignation" titlelabel="Désignation" />
<FIELD name="PA_HT" label="PA Unitaire HT" titlelabel="PA Unitaire HT" />
<FIELD name="PV_HT" label="PV Unitaire HT" titlelabel="PV Unitaire HT" />
1338,8 → 1358,8
<FIELD name="POIDS" label="Poids UV" titlelabel="Poids UV" />
<FIELD name="T_POIDS" label="Poids total" titlelabel="Poids total" />
<FIELD name="T_PA_HT" label="Total achat HT" titlelabel="Total achat HT" />
<FIELD name="T_PV_HT" label="Total HT" titlelabel="Total HT" />
<FIELD name="T_PV_TTC" label="Total TTC" titlelabel="Total TTC" />
<FIELD name="T_PV_HT" label="Total HT" />
<FIELD name="T_PV_TTC" label="Total TTC" />
<FIELD name="QTE" label="Quantité" titlelabel="Qté" />
<FIELD name="SERVICE" label="Service" titlelabel="Service" />
<FIELD name="PRIX_METRIQUE_VT_1" label="P.V. UV HT" titlelabel="P.V. UV HT" />
1346,12 → 1366,12
<FIELD name="PRIX_METRIQUE_HA_1" label="P.A. UV HT" titlelabel="P.A. UV HT" />
<FIELD name="VALEUR_METRIQUE_1" label="Longueur par défaut" titlelabel="Longueur par défaut" />
<FIELD name="ID_METRIQUE_1" label="Métrique" titlelabel="Métrique" />
<FIELD name="PRIX_METRIQUE_VT_2" label="PV au metre HT" titlelabel="PV au metre HT" />
<FIELD name="PRIX_METRIQUE_HA_2" label="PHA au metre HT" titlelabel="PHA au metre HT" />
<FIELD name="PRIX_METRIQUE_VT_2" label="P.V. HT au mètre" />
<FIELD name="PRIX_METRIQUE_HA_2" label="P.A. HT au mètre" titlelabel="P.A. HT au mètre" />
<FIELD name="VALEUR_METRIQUE_2" label="Largeur" titlelabel="Largeur" />
<FIELD name="ID_METRIQUE_2" label="Métrique" titlelabel="Métrique" />
<FIELD name="PRIX_METRIQUE_VT_3" label="PV au kg HT" titlelabel="PV au kg HT" />
<FIELD name="PRIX_METRIQUE_HA_3" label="PHA au kg HT" titlelabel="PHA au kg HT" />
<FIELD name="PRIX_METRIQUE_VT_3" label="P.V. HT au kg" titlelabel="P.V. HT au kg" />
<FIELD name="PRIX_METRIQUE_HA_3" label="P.A. HT au kg" titlelabel="P.A. HT au kg" />
<FIELD name="VALEUR_METRIQUE_3" label="poids / m²" titlelabel="poids / m²" />
<FIELD name="ID_METRIQUE_3" label="Métrique" titlelabel="Métrique" />
<FIELD name="ID_MODE_VENTE_ARTICLE" label="Mode de vente" titlelabel="Mode de vente" />
1402,8 → 1422,8
<FIELD name="QTE" label="Quantité" titlelabel="Quantité" />
<FIELD name="PV_HT" label="Prix unit. HT" titlelabel="Prix unit. HT" />
<FIELD name="ID_TAXE" label="Taxe" titlelabel="Taxe" />
<FIELD name="T_PV_HT" label="Total HT" titlelabel="Total HT" />
<FIELD name="T_PV_TTC" label="Total TTC" titlelabel="Total TTC" />
<FIELD name="T_PV_HT" label="Total HT" />
<FIELD name="T_PV_TTC" label="Total TTC" />
</TABLE>
 
<TABLE name="ECHEANCE_CLIENT">
1472,6 → 1492,7
<FIELD name="MONTANT" label="Montant" titlelabel="Montant" />
<FIELD name="NOM" label="Libellé encaissement" titlelabel="Libellé encaissement" />
<FIELD name="ID_CLIENT" label="Client" titlelabel="Client" />
<FIELD name="ACOMPTE" label="Acompte" />
<FIELD name="ID_MODE_REGLEMENT" label="Mode de règlement" titlelabel="Mode de règlement" />
<FIELD name="ID_ECHEANCE_CLIENT" label="Echéance client" titlelabel="échéance" />
</TABLE>
1535,8 → 1556,8
 
<TABLE name="ETAT_STOCK_ELEMENT">
<FIELD name="ID_ARTICLE" label="Article" />
<FIELD name="PA" label="Prix achat" />
<FIELD name="T_PA" label="Total Prix achat" />
<FIELD name="PA" label="Prix d'achat" />
<FIELD name="T_PA" label="Total prix d'achat" />
<FIELD name="QTE" label="Quantité" />
<FIELD name="CODE" label="Code" />
<FIELD name="NOM" label="Nom" />
1561,19 → 1582,22
</TABLE>
 
<TABLE name="FACTURE_FOURNISSEUR">
<FIELD name="ID_TAXE_PORT" label="Taxe sur port" />
<FIELD name="PORT_HT" label="Frais de port HT" />
<FIELD name="REMISE_HT" label="Remise HT" />
<FIELD name="NOM" label="Référence" titlelabel="Référence" />
<FIELD name="TAUX_APPLIQUE" label="Taux de conversion" titlelabel="Taux de conversion" />
<FIELD name="NUMERO" label="Numéro" titlelabel="Numéro" />
<FIELD name="INFOS" label="Informations" titlelabel="Informations" />
<FIELD name="NUMERO" label="Numéro" />
<FIELD name="INFOS" label="Informations" />
<FIELD name="DATE" label="Date" titlelabel="Date" />
<FIELD name="DATE_ECHEANCE" label="Date d'échéance" titlelabel="Date d'échéance" />
<FIELD name="ID_FOURNISSEUR" label="Fournisseur" titlelabel="Fournisseur" />
<FIELD name="ID_COMMERCIAL" label="Commercial" titlelabel="Commercial" />
<FIELD name="SOURCE" label="Source" titlelabel="Source" />
<FIELD name="T_HT" label="Total HT" titlelabel="Total HT" />
<FIELD name="T_HT" label="Total HT" />
<FIELD name="T_TVA" label="Total TVA" titlelabel="Total TVA" />
<FIELD name="T_TTC" label="Total TTC" titlelabel="Total TTC" />
<FIELD name="T_TTC" label="Total TTC" titlelabel="Total TTC" />
<FIELD name="T_TTC" label="Total TTC" />
<FIELD name="T_TTC" label="Total TTC" />
<FIELD name="T_DEVISE" label="Total Devise" titlelabel="Total Devise" />
<FIELD name="T_POIDS" label="Poids total" titlelabel="Poids total" />
<FIELD name="ID_POLE_PRODUIT" label="Pôle produit" titlelabel="Pôle produit" />
1599,7 → 1623,7
<FIELD name="DESCRIPTIF" label="Descriptif" titlelabel="Descriptif" />
<FIELD name="ID_COMMANDE" label="Commande" titlelabel="Commande" />
<FIELD name="ID_STYLE" label="Style" titlelabel="Style" />
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="CODE" label="Code" />
<FIELD name="NOM" label="Désignation" titlelabel="Désignation" />
<FIELD name="PA_HT" label="PA Unitaire HT" titlelabel="PA Unitaire HT" />
<FIELD name="PV_HT" label="PV Unitaire HT" titlelabel="PV Unitaire HT" />
1611,18 → 1635,18
<FIELD name="PRIX_METRIQUE_HA_1" label="P.A. UV HT" titlelabel="P.A. UV HT" />
<FIELD name="VALEUR_METRIQUE_1" label="Longueur par défaut" titlelabel="Longueur par défaut" />
<FIELD name="ID_METRIQUE_1" label="Métrique" titlelabel="Métrique" />
<FIELD name="PRIX_METRIQUE_VT_2" label="PV au metre HT" titlelabel="PV au metre HT" />
<FIELD name="PRIX_METRIQUE_HA_2" label="PHA au metre HT" titlelabel="PHA au metre HT" />
<FIELD name="VALEUR_METRIQUE_2" label="Largeur" titlelabel="Largeur" />
<FIELD name="ID_METRIQUE_2" label="Métrique" titlelabel="Métrique" />
<FIELD name="PRIX_METRIQUE_VT_3" label="PV au kg HT" titlelabel="PV au kg HT" />
<FIELD name="PRIX_METRIQUE_HA_3" label="PHA au kg HT" titlelabel="PHA au kg HT" />
<FIELD name="PRIX_METRIQUE_VT_2" label="P.V. HT au mètre" />
<FIELD name="PRIX_METRIQUE_HA_2" label="P.A. HT au mètre" />
<FIELD name="VALEUR_METRIQUE_2" label="Largeur" />
<FIELD name="ID_METRIQUE_2" label="Métrique" />
<FIELD name="PRIX_METRIQUE_VT_3" label="P.V. HT au kg" />
<FIELD name="PRIX_METRIQUE_HA_3" label="P.A. HT au kg" />
<FIELD name="VALEUR_METRIQUE_3" label="poids / m²" titlelabel="poids / m²" />
<FIELD name="ID_METRIQUE_3" label="Métrique" titlelabel="Métrique" />
<FIELD name="T_PV_TTC" label="Total TTC" titlelabel="Total TTC" />
<FIELD name="T_PV_HT" label="Total Vt HT" titlelabel="Total Vt HT" />
<FIELD name="T_PA_TTC" label="Total Ha TTC" titlelabel="Total Ha TTC" />
<FIELD name="T_PA_HT" label="Total Ha HT" titlelabel="Total Ha HT" />
<FIELD name="T_PV_TTC" label="Total TTC" />
<FIELD name="T_PV_HT" label="Total vente HT" />
<FIELD name="T_PA_TTC" label="Total achat TTC" />
<FIELD name="T_PA_HT" label="Total achat HT" />
<FIELD name="POURCENT_REMISE" label="% Remise" titlelabel="% Remise" />
<FIELD name="T_POIDS" label="Poids total" titlelabel="Poids total" />
<FIELD name="ID_MODE_VENTE_ARTICLE" label="Mode de vente" titlelabel="Mode de vente" />
1632,7 → 1656,7
 
 
<TABLE name="FAMILLE_ARTICLE">
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="CODE" label="Code" />
<FIELD name="NOM" label="Famille" titlelabel="Famille" />
<FIELD name="ID_FAMILLE_ARTICLE_PERE" label="Sous Famille de" titlelabel="Sous Famille de" />
<FIELD name="ID_COMPTE_PCE" label="Compte spécifique de vente" titlelabel="Compte spécifique de vente" />
1667,7 → 1691,7
<FIELD name="DETAILS_CONGES" label="Détails des congés pris" />
</TABLE>
<TABLE name="FICHE_PAYE_ELEMENT">
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="NOM" label="Libellé" />
<FIELD name="NB_BASE" label="Base" titlelabel="Base" />
<FIELD name="TAUX_SAL" label="Taux Sal." titlelabel="Taux Sal." />
<FIELD name="MONTANT_SAL_AJ" label="Montant sal. à ajouter" titlelabel="Montant sal. à ajouter" />
1710,7 → 1734,7
<FIELD name="ID_MISSION" label="Mission" titlelabel="Mission" />
<FIELD name="ID_AFFAIRE_ELEMENT" label="Element d'affaire" titlelabel="Element d'affaire" />
<FIELD name="ID_AFFAIRE" label="Affaire" titlelabel="Affaire" />
<FIELD name="ID_VERIFICATEUR" label="Vérificateur" titlelabel="Vérificateur" />
<FIELD name="ID_VERIFICATEUR" label="Vérificateur" />
<FIELD name="ACTIVITE" label="Activité" titlelabel="Activité" />
<FIELD name="SOUS_ACTIVITE" label="Sous activité" titlelabel="Sous activité" />
<FIELD name="CODE" label="Code mission" titlelabel="Code mission" />
1760,11 → 1784,11
<FIELD name="MAIL" label="E-Mail" titlelabel="E-Mail" />
<FIELD name="ID_LANGUE" label="Langue" titlelabel="Langue" />
<FIELD name="NOM" label="Nom du fournisseur" titlelabel="Fournisseur" />
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="CODE" label="Code" />
<FIELD name="UE" label="Fournisseur étranger membre de l'UE" titlelabel="Fournisseur étranger membre de l'UE" />
<FIELD name="ID_ADRESSE" label="Adresse" titlelabel="Adresse" />
<FIELD name="ID_ADRESSE_E" label="Adresse enlevement" titlelabel="Adresse enlevement" />
<FIELD name="ID_COMPTE_PCE" label="Numéro" titlelabel="Numéro" />
<FIELD name="ID_COMPTE_PCE" label="Numéro" />
<FIELD name="TEL" label="Téléphone" titlelabel="Téléphone" />
<FIELD name="FAX" label="Fax" titlelabel="Fax" />
<FIELD name="ID_MODE_REGLEMENT" label="Mode de règlement par défaut" titlelabel="Mode de règlement par défaut" />
1771,8 → 1795,8
</TABLE>
 
<TABLE name="IDCC">
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="CODE" label="Code" />
<FIELD name="NOM" label="Libellé" />
</TABLE>
 
<TABLE name="INFOS_SALARIE_PAYE">
1820,8 → 1844,8
 
<TABLE name="MODE_REGLEMENT">
<FIELD name="ID_MODE_REGLEMENT" label="Mode de règlement" titlelabel="Mode de règlement" />
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="NOM" label="Libellé" />
<FIELD name="CODE" label="Code" />
<FIELD name="AJOURS" label="à" titlelabel="à" />
<FIELD name="LENJOUR" label="le" titlelabel="le" />
<FIELD name="ID_BANQUE_POLE_PRODUIT" label="Banque" titlelabel="Banque" />
1848,7 → 1872,7
 
 
<TABLE name="MODELE_COURRIER_CLIENT">
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="NOM" label="Libellé" />
<FIELD name="CONTENU" label="Contenu" titlelabel="Contenu" />
</TABLE>
 
1865,7 → 1889,7
<FIELD name="SOURCE" label="Source" titlelabel="Source" />
<FIELD name="IDSOURCE" label="IdSource" titlelabel="IdSource" />
<FIELD name="NUMERO" label="Numéro mvt stock" titlelabel="Numéro mvt stock" />
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="NOM" label="Libellé" />
<FIELD name="DATE" label="Date" titlelabel="Date" />
<FIELD name="ID_ARTICLE" label="Article" />
<FIELD name="REEL" label="Réel" />
1881,37 → 1905,37
</TABLE>
 
<TABLE name="NUMEROTATION_AUTO">
<FIELD name="AFFAIRE_FORMAT" label="Format" titlelabel="Format" />
<FIELD name="AFFAIRE_START" label="Prochain numéro" titlelabel="Prochain numéro" />
<FIELD name="AVOIR_FORMAT" label="Format" titlelabel="Format" />
<FIELD name="AVOIR_START" label="Prochain numéro" titlelabel="Prochain numéro" />
<FIELD name="AVOIR_F_FORMAT" label="Format" titlelabel="Format" />
<FIELD name="AVOIR_F_START" label="Prochain numéro" titlelabel="Prochain numéro" />
<FIELD name="CLIENT_FORMAT" label="Format" titlelabel="Format" />
<FIELD name="CLIENT_START" label="Prochain numéro" titlelabel="Prochain numéro" />
 
 
<FIELD name="DEVIS_FORMAT" label="Format" titlelabel="Format" />
<FIELD name="DEVIS_START" label="Prochain numéro" titlelabel="Prochain numéro" />
<FIELD name="BON_L_FORMAT" label="Format" titlelabel="Format" />
<FIELD name="BON_L_START" label="Prochain numéro" titlelabel="Prochain numéro" />
<FIELD name="FACT_FORMAT" label="Format" titlelabel="Format" />
<FIELD name="FACT_START" label="Prochain numéro" titlelabel="Prochain numéro" />
<FIELD name="SALARIE_FORMAT" label="Format" titlelabel="Format" />
<FIELD name="SALARIE_START" label="Prochain numéro" titlelabel="Prochain numéro" />
<FIELD name="PROPOSITION_FORMAT" label="Format" titlelabel="Format" />
<FIELD name="PROPOSITION_START" label="Prochain numéro" titlelabel="Prochain numéro" />
<FIELD name="RELANCE_FORMAT" label="Format" titlelabel="Format" />
<FIELD name="RELANCE_START" label="Prochain numéro" titlelabel="Prochain numéro" />
<FIELD name="COMMANDE_CLIENT_FORMAT" label="Format" titlelabel="Format" />
<FIELD name="COMMANDE_CLIENT_START" label="Prochain numéro" titlelabel="Prochain numéro" />
<FIELD name="COMMANDE_FORMAT" label="Format" titlelabel="Format" />
<FIELD name="COMMANDE_START" label="Prochain numéro" titlelabel="Prochain numéro" />
<FIELD name="BON_R_FORMAT" label="Format" titlelabel="Format" />
<FIELD name="BON_R_START" label="Prochain numéro" titlelabel="Prochain numéro" />
<FIELD name="AFFAIRE_FORMAT" label="Format" />
<FIELD name="AFFAIRE_START" label="Prochain numéro" />
<FIELD name="AVOIR_FORMAT" label="Format" />
<FIELD name="AVOIR_START" label="Prochain numéro" />
<FIELD name="AVOIR_F_FORMAT" label="Format" />
<FIELD name="AVOIR_F_START" label="Prochain numéro" />
<FIELD name="CLIENT_FORMAT" label="Format" />
<FIELD name="CLIENT_START" label="Prochain numéro" />
<FIELD name="DMD_PRIX_FORMAT" label="Format" />
<FIELD name="DMD_PRIX_START" label="Prochain numéro" />
<FIELD name="DEVIS_FORMAT" label="Format" />
<FIELD name="DEVIS_START" label="Prochain numéro" />
<FIELD name="BON_L_FORMAT" label="Format" />
<FIELD name="BON_L_START" label="Prochain numéro" />
<FIELD name="FACT_FORMAT" label="Format" />
<FIELD name="FACT_START" label="Prochain numéro" />
<FIELD name="SALARIE_FORMAT" label="Format" />
<FIELD name="SALARIE_START" label="Prochain numéro" />
<FIELD name="PROPOSITION_FORMAT" label="Format" />
<FIELD name="PROPOSITION_START" label="Prochain numéro" />
<FIELD name="RELANCE_FORMAT" label="Format" />
<FIELD name="RELANCE_START" label="Prochain numéro" />
<FIELD name="COMMANDE_CLIENT_FORMAT" label="Format" />
<FIELD name="COMMANDE_CLIENT_START" label="Prochain numéro" />
<FIELD name="COMMANDE_FORMAT" label="Format" />
<FIELD name="COMMANDE_START" label="Prochain numéro" />
<FIELD name="BON_R_FORMAT" label="Format" />
<FIELD name="BON_R_START" label="Prochain numéro" />
<FIELD name="CODE_LETTRAGE" label="Code de lettrage" titlelabel="Code de lettrage" />
<FIELD name="COURRIER_FORMAT" label="Format" titlelabel="Format" />
<FIELD name="COURRIER_START" label="Prochain numéro" titlelabel="Prochain numéro" />
<FIELD name="COURRIER_FORMAT" label="Format" />
<FIELD name="COURRIER_START" label="Prochain numéro" />
</TABLE>
<TABLE name="OBJECTIF_COMMERCIAL">
<FIELD name="ANNEE" label="Année" titlelabel="Année" />
1923,14 → 1947,14
</TABLE>
 
<TABLE name="ORDRE_MISSION">
<FIELD name="ID_VERIFICATEUR" label="Vérificateur" titlelabel="Vérificateur" />
<FIELD name="ID_VERIFICATEUR" label="Vérificateur" />
<FIELD name="ID_FICHE_RENDEZ_VOUS" label="Fiche de rendez vous" titlelabel="Fiche de rendez vous" />
<FIELD name="DATE" label="Date" titlelabel="Date" />
</TABLE>
 
<TABLE name="PAYS">
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="CODE" label="Code" />
<FIELD name="NOM" label="Libellé" />
<FIELD name="ID_TARIF" label="Tarif" titlelabel="Tarif" />
<FIELD name="ID_LANGUE" label="Langue" titlelabel="Langue" />
</TABLE>
1937,7 → 1961,7
 
<TABLE name="PERIODICITE">
<FIELD name="NOM" label="Périodicité" titlelabel="Périodicité" />
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="CODE" label="Code" />
<FIELD name="NB_SEMAINE" label="Nombre de semaine" titlelabel="Nombre de semaine" />
<FIELD name="NB_ANNEE" label="Nombre d'année" titlelabel="Nombre d'année" />
<FIELD name="NB_MOIS" label="Nombre de mois" titlelabel="Nombre de mois" />
1953,7 → 1977,7
<FIELD name="RAISON_SOCIALE" label="Raison sociale" titlelabel="Raison sociale" />
<FIELD name="TEL" label="Téléphone" titlelabel="Téléphone" />
<FIELD name="FAX" label="Fax" titlelabel="Fax" />
<FIELD name="INFOS" label="Informations" titlelabel="Informations" />
<FIELD name="INFOS" label="Informations" />
<FIELD name="MAIL" label="E-Mail" titlelabel="E-Mail" />
<FIELD name="NOM_SECRETAIRE" label="Nom secrétaire" titlelabel="Nom secrétaire" />
<FIELD name="NOM_DIRECTEUR" label="Nom directeur" titlelabel="Nom directeur" />
1968,19 → 1992,19
</TABLE>
 
<TABLE name="PIECE">
<FIELD name="ID" label="N° de pièce" titlelabel="N° de pièce" />
<FIELD name="NOM" label="Nom de la pièce" titlelabel="Nom de la pièce" />
<FIELD name="ID" label="N° de pièce" />
<FIELD name="NOM" label="Nom de la pièce" />
</TABLE>
 
<TABLE name="POURCENT_SERVICE">
<FIELD name="ID_SERVICE" label="Service" titlelabel="Service" />
<FIELD name="ID_VERIFICATEUR" label="Vérificateur" titlelabel="Vérificateur" />
<FIELD name="ID_VERIFICATEUR" label="Vérificateur" />
<FIELD name="POURCENT" label="Pourcent" titlelabel="Pourcent" />
</TABLE>
 
<TABLE name="POURCENT_CCIP">
<FIELD name="ID_MOIS" label="Mois CCIP" titlelabel="Mois CCIP" />
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="NOM" label="Libellé" />
<FIELD name="POURCENT" label="Pourcent" titlelabel="Pourcent" />
<FIELD name="FACTURE" label="Facturé" titlelabel="Facturé" />
<FIELD name="ID_FICHE_RENDEZ_VOUS_ELEMENT" label="Element de rendez vous" titlelabel="Element de rendez vous" />
2005,7 → 2029,7
<FIELD name="ID_COMMERCIAL" label="Commercial" titlelabel="Commercial" />
<FIELD name="ID_POLE_PRODUIT" label="Pôle produit" titlelabel="Pôle produit" />
<FIELD name="ID_CLIENT" label="Client" titlelabel="Client" />
<FIELD name="TOTAL_HT" label="Total HT" titlelabel="Total HT" />
<FIELD name="TOTAL_HT" label="Total HT" />
<FIELD name="ID_SECRETAIRE" label="Secrétaire" titlelabel="Secrétaire" />
<FIELD name="INFOS" label="Commentaires" titlelabel="Commentaires" />
<FIELD name="ID_ETAT_DEVIS" label="Etat" titlelabel="Etat" />
2020,8 → 2044,8
<FIELD name="FIN_CONTRAT" label="Fin de contrat" titlelabel="Fin de contrat" />
<FIELD name="ID_TAXE" label="TVA" titlelabel="TVA" />
<FIELD name="DATE_FIN_CONTRAT" label="Date de fin de contrat" titlelabel="Date de fin de contrat" />
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="CODE" label="Code" />
<FIELD name="NOM" label="Libellé" />
<FIELD name="ACTIVITE" label="Activité" titlelabel="Activité" />
<FIELD name="SOUS_ACTIVITE" label="Sous activité" titlelabel="Sous activité" />
<FIELD name="ID_PERIODICITE" label="Périodicité" titlelabel="Périodicité" />
2049,7 → 2073,7
<TABLE name="RAPPORT">
<FIELD name="ID_AFFAIRE" label="Affaire" titlelabel="Affaire" />
<FIELD name="ID_ETAT_RAPPORT" label="Etat" titlelabel="Etat" />
<FIELD name="ID_VERIFICATEUR" label="Vérificateur" titlelabel="Vérificateur" />
<FIELD name="ID_VERIFICATEUR" label="Vérificateur" />
<FIELD name="DATE_VISITE" label="Date de visite" titlelabel="Date de visite" />
<FIELD name="DATE_RAPPORT" label="Date remise rapport" titlelabel="Date remise rapport" />
<FIELD name="DATE_FRAPPE" label="Envoi sous traitance" titlelabel="Envoi sous traitance" />
2133,10 → 2157,10
</TABLE>
 
<TABLE name="REPARTITION_ANALYTIQUE">
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="NOM" label="Libellé" />
</TABLE>
<TABLE name="REPARTITION_ANALYTIQUE_ELEMENT">
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="NOM" label="Libellé" />
<FIELD name="ID_POSTE_ANALYTIQUE" label="Poste" titlelabel="Poste" />
<FIELD name="REPARTITION_ANALYTIQUE" label="Répartition" titlelabel="Répartition" />
<FIELD name="TAUX" label="Taux" titlelabel="Taux" />
2144,7 → 2168,7
 
<TABLE name="SAISIE_ACHAT">
<FIELD name="DATE" label="le" titlelabel="le" />
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="NOM" label="Libellé" />
<FIELD name="MONTANT_TTC" label="Montant TTC" titlelabel="TTC" />
<FIELD name="ID_TAXE" label="Taxe" titlelabel="Taxe" />
<FIELD name="ID_MODE_REGLEMENT" label="Mode de règlement" titlelabel="Mode de règlement" />
2178,7 → 2202,7
 
 
<TABLE name="SAISIE_VENTE_COMPTOIR">
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="NOM" label="Libellé" />
<FIELD name="ID_ARTICLE" label="Article" titlelabel="Article" />
<FIELD name="DATE" label="Date" titlelabel="Date" />
<FIELD name="ID_CLIENT" label="Client" titlelabel="Client" />
2203,7 → 2227,7
<FIELD name="ID_ADRESSE_LIVRAISON" label="Adresse livr. spéc." titlelabel="Adresse livr. spéc." />
<FIELD name="ID_COMPTE_PCE_VENTE" label="Compte vente" titlelabel="Compte vente" />
<FIELD name="ID_ADRESSE" label="Adresse spécifique" titlelabel="Adresse spécifique" />
<FIELD name="T_HA" label="Total achat" titlelabel="Total achat" />
<FIELD name="T_HA" label="Total achat" />
<FIELD name="SOURCE" label="Source" titlelabel="Source" />
<FIELD name="T_AVOIR_TTC" label="T de avoir de ttc" titlelabel="T de avoir de ttc" />
<FIELD name="IDSOURCE" label="Idsource" titlelabel="Idsource" />
2218,9 → 2242,9
<FIELD name="ID_COMMERCIAL" label="Commercial" titlelabel="Commercial" />
<FIELD name="ID_CLIENT" label="Client" titlelabel="Client" />
<FIELD name="ID_DEVIS" label="Devis" titlelabel="Devis" />
<FIELD name="T_HT" label="Total HT" titlelabel="Total HT" />
<FIELD name="T_HT" label="Total HT" />
<FIELD name="T_TVA" label="Total TVA" titlelabel="Total TVA" />
<FIELD name="T_TTC" label="Total TTC" titlelabel="Total TTC" />
<FIELD name="T_TTC" label="Total TTC" />
<FIELD name="ID_TAXE" label="Taxe" titlelabel="Taxe" />
<FIELD name="ID_TAXE_PORT" label="TVA sur port" titlelabel="TVA sur port" />
<FIELD name="ID_MOUVEMENT" label="N° de mouvement" titlelabel="N° de mouvement" />
2243,8 → 2267,8
<FIELD name="ID_SECRETAIRE" label="Secrétaire" titlelabel="Secrétaire" />
<FIELD name="TYPE_INTERVENTION" label="Type d'intervention" titlelabel="Type d'intervention" />
<FIELD name="ID_REFERENCE_CLIENT" label="Référence client" titlelabel="Référence client" />
<FIELD name="ID_VERIFICATEUR" label="Vérificateur" titlelabel="Vérificateur" />
<FIELD name="ID_MODELE" label="Modéle" titlelabel="Modéle" />
<FIELD name="ID_VERIFICATEUR" label="Vérificateur" />
<FIELD name="ID_MODELE" label="Modèle" titlelabel="Modèle" />
<FIELD name="CONTROLE_TECHNIQUE" label="Facture CTC" titlelabel="Facture CTC" />
<FIELD name="COMPTE_SERVICE_AUTO" label="Gestion automatique du compte de service" titlelabel="Gestion automatique du compte de service" />
<FIELD name="ID_TARIF" label="Tarif à appliquer" />
2278,7 → 2302,7
<FIELD name="POURCENT_ACOMPTE" label="% Acompte" titlelabel="% Acompte" />
<FIELD name="ID_STYLE" label="Style" titlelabel="Style" />
<FIELD name="NOM" label="Désignation" titlelabel="Désignation" />
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="CODE" label="Code" />
<FIELD name="PV_HT" label="PV Unitaire HT" titlelabel="PV Unitaire HT" />
<FIELD name="MARGE_HT" label="Marge HT" titlelabel="Marge HT" />
<FIELD name="PA_HT" label="PA Unitaire HT" titlelabel="PA Unitaire HT" />
2293,18 → 2317,18
<FIELD name="PRIX_METRIQUE_HA_1" label="Prix Achat UV HT" titlelabel="Prix Achat UV HT" />
<FIELD name="VALEUR_METRIQUE_1" label="Longueur par défaut" titlelabel="Longueur par défaut" />
<FIELD name="ID_METRIQUE_1" label="Métrique" titlelabel="Métrique" />
<FIELD name="PRIX_METRIQUE_VT_2" label="PV au metre HT" titlelabel="PV au metre HT" />
<FIELD name="PRIX_METRIQUE_HA_2" label="PHA au metre HT" titlelabel="PHA au metre HT" />
<FIELD name="PRIX_METRIQUE_VT_2" label="P.V. HT au mètre" />
<FIELD name="PRIX_METRIQUE_HA_2" label="P.A. HT au mètre" />
<FIELD name="VALEUR_METRIQUE_2" label="Largeur" titlelabel="Largeur" />
<FIELD name="ID_METRIQUE_2" label="Métrique" titlelabel="Métrique" />
<FIELD name="PRIX_METRIQUE_VT_3" label="PV au kg HT" titlelabel="PV au kg HT" />
<FIELD name="PRIX_METRIQUE_HA_3" label="PHA au kg HT" titlelabel="PHA au kg HT" />
<FIELD name="PRIX_METRIQUE_VT_3" label="P.V. HT au kg" titlelabel="P.V. HT au kg" />
<FIELD name="PRIX_METRIQUE_HA_3" label="P.A. HT au kg" titlelabel="P.A. HT au kg" />
<FIELD name="VALEUR_METRIQUE_3" label="poids / m²" titlelabel="poids / m²" />
<FIELD name="ID_METRIQUE_3" label="Métrique" titlelabel="Métrique" />
<FIELD name="T_POIDS" label="Poids total" titlelabel="Poids total" />
<FIELD name="T_PA_HT" label="Total Achat HT" titlelabel="Total Achat HT" />
<FIELD name="T_PV_HT" label="Total HT" titlelabel="Total HT" />
<FIELD name="T_PV_TTC" label="Total TTC" titlelabel="Total TTC" />
<FIELD name="T_PA_HT" label="Total achat HT" />
<FIELD name="T_PV_HT" label="Total HT" />
<FIELD name="T_PV_TTC" label="Total TTC" />
<FIELD name="CODE_MISSION" label="Code mission" titlelabel="Code mission" />
<FIELD name="NOM_MISSION" label="Nom mission" titlelabel="Nom mission" />
<FIELD name="ACTIVITE" label="Activité" titlelabel="Activité" />
2359,13 → 2383,13
 
<TABLE name="SECTEUR_ACTIVITE">
<FIELD name="NOM" label="Secteur d'activité" titlelabel="Secteur d'activité" />
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="CODE" label="Code" />
<FIELD name="CONDITIONS" label="Conditions" titlelabel="Conditions" />
<FIELD name="TEL" label="Téléphone" titlelabel="Téléphone" />
</TABLE>
 
<TABLE name="SITUATION_FAMILIALE">
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="NOM" label="Libellé" />
</TABLE>
 
<TABLE name="SITE_INTERVENTION">
2390,7 → 2414,7
 
<TABLE name="STYLE">
<FIELD name="NOM" label="Nom" titlelabel="Nom" />
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="CODE" label="Code" />
</TABLE>
 
<TABLE name="TARIF">
2426,19 → 2450,19
 
<TABLE name="TICKET_CAISSE">
<FIELD name="DATE" label="Date" titlelabel="Date" />
<FIELD name="TOTAL_HT" label="Total HT" titlelabel="Total HT" />
<FIELD name="TOTAL_TTC" label="Total TTC" titlelabel="Total TTC" />
<FIELD name="NUMERO" label="Numéro" titlelabel="Numéro" />
<FIELD name="TOTAL_HT" label="Total HT" />
<FIELD name="TOTAL_TTC" label="Total TTC" />
<FIELD name="NUMERO" label="Numéro" />
</TABLE>
 
 
<TABLE name="TITRE_PERSONNEL">
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="NOM" label="Libellé" />
<FIELD name="SEXE_M" label="Sexe Masculin" titlelabel="Sexe Masculin" />
</TABLE>
 
<TABLE name="TYPE_COMPTE_PCG">
<FIELD name="NOM" label="Libellé" titlelabel="Libellé" />
<FIELD name="NOM" label="Libellé" />
<FIELD name="RACINE" label="Racine" titlelabel="Racine" />
</TABLE>
 
2469,8 → 2493,8
</TABLE>
 
<TABLE name="UNITE_VENTE">
<FIELD name="CODE" label="Code" titlelabel="Code" />
<FIELD name="NOM" label="Libellè" titlelabel="Libellé" />
<FIELD name="CODE" label="Code" />
<FIELD name="NOM" label="Libellé" />
</TABLE>
 
</ROOT>
/trunk/OpenConcerto/src/org/openconcerto/erp/config/Gestion.java
310,7 → 310,11
System.setProperty("org.openconcerto.oo.useODSViewer", Boolean.valueOf(conf.getProperty("odsViewer")).toString());
}
 
if (conf.getProperty("rwOnDoubleClick") != null) {
System.setProperty("org.openconcerto.sql.listPanel.rwOnDoubleClick", Boolean.valueOf(conf.getProperty("rwOnDoubleClick")).toString());
}
 
 
RemoteShell.startDefaultInstance(conf.getDirectory(), conf.getRoot());
 
// Restore L&F and colors
/trunk/OpenConcerto/src/org/openconcerto/erp/config/mappingCompta_pl.xml
1169,6 → 1169,8
<FIELD name="CODE_LETTRAGE" label="Kod" titlelabel="Kod" />
<FIELD name="COURRIER_FORMAT" label="Format" />
<FIELD name="COURRIER_START" label="Next number" />
<FIELD name="DMD_PRIX_FORMAT" label="Format" />
<FIELD name="DMD_PRIX_START" label="Next number" />
</TABLE>
<TABLE name="OBJECTIF_COMMERCIAL">
<FIELD name="ANNEE" label="Year" />
/trunk/OpenConcerto/src/org/openconcerto/erp/config/ComptaPropsConfiguration.java
173,6 → 173,7
import org.openconcerto.erp.core.sales.product.element.ReliquatSQLElement.ReliquatBRSQLElement;
import org.openconcerto.erp.core.sales.product.element.UniteVenteArticleSQLElement;
import org.openconcerto.erp.core.sales.quote.element.DevisItemSQLElement;
import org.openconcerto.erp.core.sales.quote.element.DevisLogMailSQLElement;
import org.openconcerto.erp.core.sales.quote.element.DevisSQLElement;
import org.openconcerto.erp.core.sales.quote.element.EtatDevisSQLElement;
import org.openconcerto.erp.core.sales.quote.element.TransferQuoteSQLElement;
211,6 → 212,7
import org.openconcerto.erp.generationDoc.provider.AdresseVilleClientValueProvider;
import org.openconcerto.erp.generationDoc.provider.AdresseVilleNomClientValueProvider;
import org.openconcerto.erp.generationDoc.provider.ArticleCodeClientProvider;
import org.openconcerto.erp.generationDoc.provider.ConditionsReglementDetailsProvider;
import org.openconcerto.erp.generationDoc.provider.DateBLProvider;
import org.openconcerto.erp.generationDoc.provider.DateProvider;
import org.openconcerto.erp.generationDoc.provider.FacturableValueProvider;
218,6 → 220,7
import org.openconcerto.erp.generationDoc.provider.LabelAccountInvoiceProvider;
import org.openconcerto.erp.generationDoc.provider.MergedGlobalQtyTotalProvider;
import org.openconcerto.erp.generationDoc.provider.ModeDeReglementDetailsProvider;
import org.openconcerto.erp.generationDoc.provider.PaiementRemainedDevisProvider;
import org.openconcerto.erp.generationDoc.provider.PaiementRemainedProvider;
import org.openconcerto.erp.generationDoc.provider.PrixUVProvider;
import org.openconcerto.erp.generationDoc.provider.PrixUnitaireProvider;
289,6 → 292,7
import org.openconcerto.utils.BaseDirs;
import org.openconcerto.utils.DesktopEnvironment;
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.ExceptionUtils;
import org.openconcerto.utils.NetUtils;
import org.openconcerto.utils.ProductInfo;
import org.openconcerto.utils.StringInputStream;
516,7 → 520,9
 
} catch (Exception e) {
e.printStackTrace();
JOptionPane.showMessageDialog(new JFrame(), "Impossible récupérer les informations de connexion");
String s = ExceptionUtils.getStackTrace(e);
JOptionPane.showMessageDialog(new JFrame(), "Impossible récupérer les informations de connexion\n" + s + "\ntoken: " + token + "\nr: " + result);
ExceptionHandler.handle("Impossible récupérer les informations de connexion", e);
System.exit(1);
}
 
576,6 → 582,7
PrixUVProvider.register();
TotalAcompteProvider.register();
ArticleCodeClientProvider.register();
ConditionsReglementDetailsProvider.register();
FacturableValueProvider.register();
TotalCommandeClientProvider.register();
LabelAccountInvoiceProvider.register();
592,6 → 599,7
FormatedGlobalQtyTotalProvider.register();
MergedGlobalQtyTotalProvider.register();
PaiementRemainedProvider.register();
PaiementRemainedDevisProvider.register();
RemiseProvider.register();
DateProvider.register();
RemiseTotalProvider.register();
818,6 → 826,11
 
private void setSocieteDirectory() {
try {
// Check 1.5.3 updated
if (!this.getRootSociete().getTable("SAISIE_VENTE_FACTURE").contains("T_ACOMPTE")) {
throw new DBStructureItemNotFound("Base de données non à jour");
}
 
SQLElementDirectory dir = this.getDirectory();
 
dir.addSQLElement(AttachmentSQLElement.class);
1059,10 → 1072,25
}
} catch (DBStructureItemNotFound e) {
if (!GraphicsEnvironment.isHeadless()) {
 
if (this.getServer().getSQLSystem().equals(SQLSystem.H2)) {
JOptionPane.showMessageDialog(null,
"Une table ou un champ est manquant dans la base de données.\nMettez à jour la base de données si vous venez de changer de version d'Openconcerto.");
 
final JFrame f = new JFrame("Mise à jour de la base de données");
f.setContentPane(new InstallationPanel(null));
f.pack();
f.setVisible(true);
f.setLocationRelativeTo(null);
f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
 
} else {
JOptionPane.showMessageDialog(null,
"Une table ou un champ est manquant dans la base de données. Mettez à jour votre base de données via l'outil de configuration si vous venez de changer de version d'Openconcerto.");
 
}
 
}
throw e;
}
}
1148,7 → 1176,7
showAs.show("CODE_STATUT_PROF", SQLRow.toList("CODE,NOM"));
showAs.show("CODE_STATUT_CATEGORIEL", SQLRow.toList("CODE,NOM"));
showAs.show("CODE_REGIME", SQLRow.toList("CODE,NOM"));
showAs.show("COMMANDE", "NUMERO", "DATE", "NOM", "ID_FOURNISSEUR");
showAs.show("COMMANDE", "NUMERO", "DATE", "DATE_RECEPTION_DEMANDEE", "NOM", "ID_FOURNISSEUR");
if (root.contains("AFFAIRE")) {
showAs.show("COMMANDE_CLIENT", "NUMERO", "DATE", "ID_AFFAIRE", "NOM", "T_HT");
} else {
1174,6 → 1202,7
final List<String> lEchFact = new ArrayList<String>();
lEchFact.add("NUMERO");
lEchFact.add("DATE");
lEchFact.add("ID_COMMERCIAL");
SQLTable tableEch = root.getTable("ECHEANCE_CLIENT");
showAs.show(tableEch.getField("ID_SAISIE_VENTE_FACTURE"), lEchFact);
 
1210,6 → 1239,7
List<String> listFieldFactureElt = new ArrayList<String>();
listFieldFactureElt.add("NUMERO");
listFieldFactureElt.add("DATE");
listFieldFactureElt.add("ID_COMMERCIAL");
listFieldFactureElt.add("ID_CLIENT");
showAs.showField("SAISIE_VENTE_FACTURE_ELEMENT.ID_SAISIE_VENTE_FACTURE", listFieldFactureElt);
 
/trunk/OpenConcerto/src/org/openconcerto/erp/config/mappingCompta_en.xml
1306,6 → 1306,8
<FIELD name="CODE_LETTRAGE" label="Code de lettrage" />
<FIELD name="COURRIER_FORMAT" label="Format" />
<FIELD name="COURRIER_START" label="Next number" />
<FIELD name="DMD_PRIX_FORMAT" label="Format" />
<FIELD name="DMD_PRIX_START" label="Next number" />
</TABLE>
<TABLE name="OBJECTIF_COMMERCIAL">
<FIELD name="ANNEE" label="Year" />
/trunk/OpenConcerto/src/org/openconcerto/erp/config/DefaultMenuConfiguration.java
54,6 → 54,7
import org.openconcerto.erp.core.finance.accounting.action.NouveauPointageAction;
import org.openconcerto.erp.core.finance.accounting.action.NouvelleValidationAction;
import org.openconcerto.erp.core.finance.accounting.action.ResultatAnalytiqueAction;
import org.openconcerto.erp.core.finance.accounting.ui.SaisieJournalAction;
import org.openconcerto.erp.core.finance.payment.action.ListeDesChequesAEncaisserAction;
import org.openconcerto.erp.core.finance.payment.action.ListeDesChequesAvoirAction;
import org.openconcerto.erp.core.finance.payment.action.ListeDesChequesFournisseursAction;
99,6 → 100,7
import org.openconcerto.erp.core.sales.invoice.action.GenReportingVenteAction;
import org.openconcerto.erp.core.sales.invoice.action.ListeDebiteursAction;
import org.openconcerto.erp.core.sales.invoice.action.ListeDesElementsFactureAction;
import org.openconcerto.erp.core.sales.invoice.action.ListeDesFactureItemsAction;
import org.openconcerto.erp.core.sales.invoice.action.ListeDesVentesAction;
import org.openconcerto.erp.core.sales.invoice.action.ListeSaisieVenteFactureAction;
import org.openconcerto.erp.core.sales.invoice.action.ListesFacturesClientsImpayeesAction;
254,6 → 256,7
final Group accountingGroup = new Group("accounting");
if (rights.haveRight(ComptaUserRight.MENU)) {
accountingGroup.addItem("accounting.entry.create");
accountingGroup.addItem("accounting.entry.ledger.create");
}
group.add(accountingGroup);
 
485,6 → 488,7
}
 
gCustomer.addItem("customer.credit.list");
gCustomer.addItem("customer.invoice.details.list");
 
final Group gSupplier = new Group("menu.list.supplier", LayoutHints.DEFAULT_NOLABEL_SEPARATED_GROUP_HINTS);
gSupplier.addItem("supplier.list");
554,6 → 558,7
 
if (rights.haveRight(ComptaUserRight.MENU)) {
mManager.putAction(new NouvelleSaisieKmAction(), "accounting.entry.create");
mManager.putAction(new SaisieJournalAction(), "accounting.entry.ledger.create");
}
 
 
616,6 → 621,7
}
 
mManager.putAction(new ListeDesAvoirsClientsAction(), "customer.credit.list");
mManager.putAction(new ListeDesFactureItemsAction(), "customer.invoice.details.list");
 
mManager.putAction(new ListeDesFournisseursAction(), "supplier.list");
mManager.putAction(new ListeDesContactsFournisseursAction(), "supplier.contact.list");
/trunk/OpenConcerto/src/org/openconcerto/erp/config/update/Updater_1_5.java
17,6 → 17,7
import org.openconcerto.erp.core.sales.order.ui.TypeFactureCommandeClient;
import org.openconcerto.erp.core.sales.pos.element.TicketCaisseSQLElement;
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
import org.openconcerto.erp.core.sales.quote.element.DevisLogMailSQLElement;
import org.openconcerto.sql.changer.convert.AddMDFields;
import org.openconcerto.sql.model.DBRoot;
import org.openconcerto.sql.model.SQLField.Properties;
28,6 → 29,7
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.request.UpdateBuilder;
import org.openconcerto.sql.utils.AlterTable;
import org.openconcerto.sql.utils.ChangeTable;
import org.openconcerto.sql.utils.SQLCreateTable;
import org.openconcerto.sql.utils.UniqueConstraintCreatorHelper;
 
104,6 → 106,14
tCmdClient.fetchFields();
}
 
if (!tClient.contains("CONDITIONS_LIVRAISON")) {
final AlterTable alterClient = new AlterTable(tClient);
alterClient.addVarCharColumn("CONDITIONS_LIVRAISON", 512);
tClient.getBase().getDataSource().execute(alterClient.asString());
tClient.getSchema().updateVersion();
tClient.fetchFields();
}
 
{
// Ajout du champ SANS_VALEUR_ENCAISSEMENT pour gérer les anciens cheques sans le compte
// 511
207,6 → 217,13
tableAttachment.getSchema().updateVersion();
tableAttachment.fetchFields();
}
if (!tableAttachment.contains("ID_PARENT")) {
final AlterTable alter = new AlterTable(tableAttachment);
alter.addForeignColumn("ID_PARENT", tableAttachment);
tableAttachment.getBase().getDataSource().execute(alter.asString());
tableAttachment.getSchema().updateVersion();
tableAttachment.fetchFields();
}
 
if (!tableAttachment.contains("VERSION")) {
final AlterTable alter = new AlterTable(tableAttachment);
541,6 → 558,22
root.refetchTable("DEMANDE_ACHAT_ELEMENT");
root.getSchema().updateVersion();
}
if (!tableDmdAChat.contains("REPRISE")) {
final AlterTable alterB = new AlterTable(tableDmdAChat);
alterB.addBooleanColumn("REPRISE", Boolean.FALSE, false);
root.getBase().getDataSource().execute(alterB.asString());
root.refetchTable("DEMANDE_ACHAT_ELEMENT");
root.getSchema().updateVersion();
}
 
if (!tableDmdAChat.contains("IMPORT")) {
final AlterTable alterB = new AlterTable(tableDmdAChat);
alterB.addBooleanColumn("IMPORT", Boolean.FALSE, false);
root.getBase().getDataSource().execute(alterB.asString());
root.refetchTable("DEMANDE_ACHAT_ELEMENT");
root.getSchema().updateVersion();
}
 
if (!tableDmdAChat.contains("QTE_RECUE")) {
final AlterTable alterB = new AlterTable(tableDmdAChat);
alterB.addIntegerColumn("QTE_RECUE", 0);
751,12 → 784,13
}
 
// POS
if (!root.contains("CAISSE_JOURNAL")) {
final SQLTable caisseT = root.getTable("CAISSE");
final String registerLogTableName = "CAISSE_JOURNAL";
if (!root.contains(registerLogTableName)) {
final SQLTable receiptT = root.getTable("TICKET_CAISSE");
final SQLTable caisseT = root.getTable("CAISSE");
final SQLTable userT = root.findTable("USER_COMMON", true);
 
final SQLCreateTable createLogT = new SQLCreateTable(caisseT.getDBRoot(), "CAISSE_JOURNAL");
final SQLCreateTable createLogT = new SQLCreateTable(caisseT.getDBRoot(), registerLogTableName);
createLogT.setCreateOrder(false);
AddMDFields.addFields(createLogT, userT);
createLogT.addForeignColumn("ID_CAISSE", caisseT);
775,7 → 809,7
final String dateType = createClotureT.getSyntax().getTypeNames(java.sql.Date.class).iterator().next();
createClotureT.addColumn("DEBUT", dateType, null, false);
createClotureT.addColumn("FIN", dateType, null, false);
createClotureT.addDecimalColumn("TOTAL_TTC", 16, 6, java.math.BigDecimal.ZERO, false);
createClotureT.addDecimalColumn("TOTAL_TTC", 16, 6, BigDecimal.ZERO, false);
// don't use foreign keys, we actually want redundant info so that we can check
// coherence
// nullable to allow for days without any sales
821,6 → 855,40
alterReceipt.getTable().fetchFields();
}
 
SQLTable tableArt = root.getTable("ARTICLE");
if (!tableArt.contains("MASQUE_CAISSE")) {
final AlterTable alterArt = new AlterTable(tableArt);
alterArt.addBooleanColumn("MASQUE_CAISSE", Boolean.FALSE, false);
tableArt.getBase().getDataSource().execute(alterArt.asString());
tableArt.getSchema().updateVersion();
tableArt.fetchFields();
}
 
SQLTable tableDevisAcompte = root.getTable("DEVIS");
 
if (!tableDevisAcompte.contains("T_ACOMPTE")) {
final AlterTable alterB = new AlterTable(tableDevisAcompte);
alterB.addLongColumn("T_ACOMPTE", 0L, false);
root.getBase().getDataSource().execute(alterB.asString());
root.refetchTable("DEVIS");
root.getSchema().updateVersion();
 
SQLTable tableEncaisse = root.getTable("ENCAISSER_MONTANT");
final AlterTable alterC = new AlterTable(tableEncaisse);
alterC.addBooleanColumn("ACOMPTE", Boolean.FALSE, false);
alterC.addForeignColumn("ID_DEVIS", tableDevisAcompte);
root.getBase().getDataSource().execute(alterC.asString());
root.refetchTable("ENCAISSER_MONTANT");
root.getSchema().updateVersion();
 
SQLTable tableVF = root.getTable("SAISIE_VENTE_FACTURE");
final AlterTable alterF = new AlterTable(tableVF);
alterF.addLongColumn("T_ACOMPTE", 0L, false);
root.getBase().getDataSource().execute(alterF.asString());
root.refetchTable("SAISIE_VENTE_FACTURE");
root.getSchema().updateVersion();
}
 
// Paye Simplifiée
if (!tableFpaye.contains("ALLEGEMENT_COTISATION")) {
final AlterTable alterB = new AlterTable(tableFpaye);
878,6 → 946,115
root.refetchTable(tableDevis.getName());
root.getSchema().updateVersion();
}
 
// 1.5.3
List<String> tableRemiseF = Arrays.asList("COMMANDE", "BON_RECEPTION", "FACTURE_FOURNISSEUR");
for (String t : tableRemiseF) {
 
final SQLTable tableCommande = root.getTable(t);
AlterTable tCommande = new AlterTable(tableCommande);
boolean updateCmd = false;
if (!tableCommande.contains("ID_TAXE_PORT")) {
updateCmd = true;
tCommande.addForeignColumn("ID_TAXE_PORT", root.getTable("TAXE"));
}
 
if (!tableCommande.contains("PORT_HT")) {
updateCmd = true;
tCommande.addLongColumn("PORT_HT", Long.valueOf(0), false);
}
 
if (!tableCommande.contains("REMISE_HT")) {
updateCmd = true;
tCommande.addLongColumn("REMISE_HT", Long.valueOf(0), false);
}
 
if (updateCmd) {
tableCommande.getBase().getDataSource().execute(tCommande.asString());
tableCommande.getSchema().updateVersion();
tableCommande.fetchFields();
}
}
 
List<String> tableElement = Arrays.asList("FACTURE_FOURNISSEUR_ELEMENT", "COMMANDE_ELEMENT", "BON_RECEPTION_ELEMENT", "DEMANDE_PRIX_ELEMENT");
for (String tableName : tableElement) {
final SQLTable table = root.getTable(tableName);
if (!table.contains("ID_FAMILLE_ARTICLE")) {
AlterTable t = new AlterTable(table);
t.addForeignColumn("ID_FAMILLE_ARTICLE", root.getTable("FAMILLE_ARTICLE"));
table.getBase().getDataSource().execute(t.asString());
root.refetchTable(table.getName());
root.getSchema().updateVersion();
}
}
 
final SQLTable tableBlElt = root.getTable("BON_RECEPTION_ELEMENT");
if (!tableBlElt.contains("QTE_ORIGINE")) {
AlterTable t = new AlterTable(tableBlElt);
t.addIntegerColumn("QTE_ORIGINE", null, true);
tableBlElt.getBase().getDataSource().execute(t.asString());
root.refetchTable(tableBlElt.getName());
root.getSchema().updateVersion();
}
// Caisse 1.5.3
if (!root.getTable(registerLogTableName).contains("HOST_NAME")) {
final AlterTable alterRegisterLog = new AlterTable(root.getTable(registerLogTableName));
// to check for shared register installations
alterRegisterLog.addVarCharColumn("HOST_NAME", 128, true, null, true);
alterRegisterLog.addVarCharColumn("HOST_USER", 128, true, null, true);
 
// no longer needed since we need more than the last entry, just remove the duplicate
// data and select from CAISSE_JOURNAL
final AlterTable alterRegister = new AlterTable(caisseT);
alterRegister.dropColumn("ID_DERNIERE_ENTREE_JOURNAL");
 
for (final String sql : ChangeTable.cat(Arrays.asList(alterRegisterLog, alterRegister))) {
root.getDBSystemRoot().getDataSource().execute(sql);
}
caisseT.getSchema().updateVersion();
alterRegisterLog.getTable().fetchFields();
alterRegister.getTable().fetchFields();
}
// Prefs compte AN
SQLTable table = root.findTable("PREFS_COMPTE");
AlterTable t = new AlterTable(table);
 
if (!table.getFieldsName().contains("ID_JOURNAL_AN")) {
t.addForeignColumn("ID_JOURNAL_AN", root.getTable("JOURNAL"));
t.addBooleanColumn("CREATE_NUL_SOLDE_ECR", Boolean.TRUE, false);
table.getBase().getDataSource().execute(t.asString());
table.getSchema().updateVersion();
table.fetchFields();
}
 
SQLTable tableEcr = root.getTable("ECRITURE");
if (!tableEcr.contains("CLOTURE")) {
final AlterTable alter = new AlterTable(tableEcr);
alter.addBooleanColumn("CLOTURE", Boolean.FALSE, false);
alter.addBooleanColumn("RAN", Boolean.FALSE, false);
tableEcr.getBase().getDataSource().execute(alter.asString());
tableEcr.getSchema().updateVersion();
tableEcr.fetchFields();
}
 
// Jour Km Element
final SQLTable tkmElt = root.getTable("SAISIE_KM_ELEMENT");
if (!tkmElt.contains("JOUR")) {
final AlterTable alterKmElt = new AlterTable(tkmElt);
alterKmElt.addIntegerColumn("JOUR", 1);
tkmElt.getBase().getDataSource().execute(alterKmElt.asString());
tkmElt.getSchema().updateVersion();
tkmElt.fetchFields();
}
// Ref bancaires fournisseurs
if (!tableFournisseur.contains("IBAN")) {
final AlterTable alter = new AlterTable(tableFournisseur);
alter.addVarCharColumn("IBAN", 128);
alter.addVarCharColumn("BIC", 128);
tableFournisseur.getBase().getDataSource().execute(alter.asString());
tableFournisseur.getSchema().updateVersion();
tableFournisseur.fetchFields();
}
}
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/config/ServerFinderPanel.java
447,12 → 447,6
this.textPort.setEnabled(false);
this.textFile.setEnabled(true);
this.buttonDir.setEnabled(true);
} else if (mode.equals(ServerFinderConfig.MYSQL)) {
this.comboMode.setSelectedItem(ServerFinderConfig.MYSQL);
this.textIP.setEnabled(true);
this.textPort.setEnabled(true);
this.textFile.setEnabled(false);
this.buttonDir.setEnabled(false);
} else if (mode.equals(ServerFinderConfig.POSTGRESQL)) {
this.comboMode.setSelectedItem(ServerFinderConfig.POSTGRESQL);
this.textIP.setEnabled(true);
489,7 → 483,7
c.gridx++;
c.weightx = 1;
c.fill = GridBagConstraints.NONE;
this.comboMode = new JComboBox(new SQLSystem[] { ServerFinderConfig.H2, ServerFinderConfig.POSTGRESQL, ServerFinderConfig.MYSQL });
this.comboMode = new JComboBox(new SQLSystem[] { ServerFinderConfig.H2, ServerFinderConfig.POSTGRESQL });
this.comboMode.setRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
/trunk/OpenConcerto/src/org/openconcerto/erp/config/InstallationPanel.java
95,7 → 95,7
public class InstallationPanel extends JPanel {
private static final boolean DEBUG_FK = false;
 
static public void insertUndef(final SQLCreateTable ct) throws SQLException {
public static void insertUndef(final SQLCreateTable ct) throws SQLException {
// check that we can use insertReturnFirstField()
if (ct.getPrimaryKey().size() != 1)
throw new IllegalStateException("Not one and only one field in the PK : " + ct.getPrimaryKey());
106,7 → 106,7
SQLTable.setUndefID(ct.getRoot().getSchema(), ct.getName(), ((Number) insertion.getRows().get(0)).intValue());
}
 
static private SQLName getTableName(final SQLCreateTable ct) {
private static SQLName getTableName(final SQLCreateTable ct) {
return new SQLName(ct.getRoot().getName(), ct.getName());
}
 
126,7 → 126,9
 
@Override
public void actionPerformed(ActionEvent e) {
if (finderPanel != null) {
finderPanel.saveConfigFile();
}
bar.setIndeterminate(true);
up.setEnabled(false);
new Thread(new Runnable() {
136,360 → 138,8
System.setProperty(SQLSchema.NOAUTO_CREATE_METADATA, "false");
final ComptaPropsConfiguration conf = ComptaPropsConfiguration.create(true);
 
try {
final SQLDataSource ds = conf.getSystemRoot().getDataSource();
System.err.println("SystemRoot:" + conf.getSystemRoot());
System.err.println("Root:" + conf.getRoot());
updateDatabase(conf);
 
// FixUnbounded varchar
fixUnboundedVarchar(conf.getRoot());
 
// FIXME DROP CONSTRAINT UNIQUE ORDRE ON
// CONTACT_FOURNISSEUR
 
checkCompteDefault(conf.getRoot());
 
updateSocieteTable(conf.getRoot());
updateVille(conf.getRoot().getTable("ADRESSE"));
 
// Champ user 1.4.1
final SQLTable tableUser = conf.getRoot().getTable("USER_COMMON");
if (tableUser != null) {
final AlterTable alter = new AlterTable(tableUser);
boolean alterUser = false;
if (!tableUser.contains("DISABLED")) {
alter.addBooleanColumn("DISABLED", Boolean.FALSE, false);
alterUser = true;
}
if (!tableUser.contains("TEL")) {
alter.addVarCharColumn("TEL", 128);
alterUser = true;
}
 
if (alterUser) {
final String req = alter.asString();
conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
conf.getRoot().refetchTable(tableUser.getName());
conf.getRoot().getSchema().updateVersion();
}
}
 
// Champ Paye
final SQLTable tableCaisse = conf.getRoot().getTable("CAISSE_COTISATION");
if (!tableCaisse.contains("NUMERO_COMPTE_PCE")) {
final AlterTable alter = new AlterTable(tableCaisse);
alter.addVarCharColumn("NUMERO_COMPTE_PCE", 128);
alter.addVarCharColumn("NUMERO_COMPTE_PCE_CHARGES", 128);
final String req = alter.asString();
conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
conf.getRoot().refetchTable(tableCaisse.getName());
conf.getRoot().getSchema().updateVersion();
}
 
final SQLTable tableRC = conf.getRoot().getTable("RUBRIQUE_COTISATION");
if (!tableRC.contains("PART_CSG_SANS_ABATTEMENT")) {
final AlterTable alter = new AlterTable(tableRC);
alter.addBooleanColumn("PART_CSG_SANS_ABATTEMENT", Boolean.FALSE, false);
final String req = alter.asString();
conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
conf.getRoot().refetchTable(tableRC.getName());
conf.getRoot().getSchema().updateVersion();
}
 
// Paye simplifiee
{
final SQLTable tableRB = conf.getRoot().getTable("RUBRIQUE_BRUT");
if (!tableRB.contains("AVANTAGE_NATURE")) {
final AlterTable alter = new AlterTable(tableRB);
alter.addBooleanColumn("AVANTAGE_NATURE", Boolean.FALSE, false);
final String req = alter.asString();
conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
conf.getRoot().refetchTable(tableRB.getName());
conf.getRoot().getSchema().updateVersion();
}
 
if (!tableRC.contains("LIGNE_PAYE_SIMPLIFIEE")) {
final AlterTable alter = new AlterTable(tableRC);
 
alter.addBooleanColumn("ALLEGEMENT_COTISATION", Boolean.FALSE, false);
alter.addVarCharColumn("LIGNE_PAYE_SIMPLIFIEE", 256);
final String req = alter.asString();
conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
conf.getRoot().refetchTable(tableRC.getName());
conf.getRoot().getSchema().updateVersion();
Map<String, String> liaison = new HashMap<String, String>();
liaison.put("COTCSA", LignePayeSimplifiee.SANTE_SECURITE.getId());
liaison.put("COTMALADIE", LignePayeSimplifiee.SANTE_SECURITE.getId());
liaison.put("COTAF", LignePayeSimplifiee.FAMILLE_ALLOCATIONS.getId());
liaison.put("COTVEUV", LignePayeSimplifiee.SANTE_SECURITE.getId());
 
liaison.put("COTVIEIL", LignePayeSimplifiee.RETRAITE_SECURITE_NON_PLAF.getId());
liaison.put("COTVIEILPLAF", LignePayeSimplifiee.RETRAITE_SECURITE_PLAF.getId());
liaison.put("COTFNALPLAF", LignePayeSimplifiee.AUTRES_CONTRIBUTIONS.getId());
liaison.put("COTFNAL", LignePayeSimplifiee.AUTRES_CONTRIBUTIONS.getId());
liaison.put("COTAT", LignePayeSimplifiee.ACCIDENTS_TRAVAIL.getId());
 
liaison.put("COTVTRAN", LignePayeSimplifiee.AUTRES_CONTRIBUTIONS.getId());
liaison.put("COTCH", LignePayeSimplifiee.ASSURANCE_CHOMAGE_CHOMAGE.getId());
liaison.put("COTCHAGS", LignePayeSimplifiee.ASSURANCE_CHOMAGE_CHOMAGE.getId());
liaison.put("COTAGFF", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_T1.getId());
liaison.put("COTRNonCadre", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_T1.getId());
 
liaison.put("COTCSGIMP", LignePayeSimplifiee.CSG_IMP.getId());
liaison.put("COTCSGDED", LignePayeSimplifiee.CSG_NON_IMP.getId());
liaison.put("COTFILLON", LignePayeSimplifiee.ALLEGEMENT_COTISATIONS.getId());
liaison.put("COTFNGS", LignePayeSimplifiee.ASSURANCE_CHOMAGE_CHOMAGE.getId());
liaison.put("COTCADRET1", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_TA.getId());
liaison.put("COTCADRET2", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_TB.getId());
 
liaison.put("COT_CADRE_RET_C_A", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_TA.getId());
liaison.put("COT_CADRE_RET_C_B", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_TB.getId());
liaison.put("COT_CADRE_RET_C_C", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_TC.getId());
liaison.put("COTAPEC", LignePayeSimplifiee.ASSURANCE_CHOMAGE_APEC.getId());
liaison.put("COTAPECFORF", LignePayeSimplifiee.ASSURANCE_CHOMAGE_APEC.getId());
liaison.put("COTCET", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_TA.getId());
 
liaison.put("COTPREVCADRETA", LignePayeSimplifiee.SANTE_COMPLEMENAIRE_DECES.getId());
liaison.put("COTGMP", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_GMP.getId());
liaison.put("COTCRDSIMP", LignePayeSimplifiee.CSG_IMP.getId());
liaison.put("COTGMP2", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_GMP.getId());
liaison.put("TAXEAPPR", LignePayeSimplifiee.AUTRES_CONTRIBUTIONS.getId());
liaison.put("CDA", LignePayeSimplifiee.AUTRES_CONTRIBUTIONS.getId());
 
liaison.put("FOR", LignePayeSimplifiee.AUTRES_CONTRIBUTIONS.getId());
liaison.put("COTAPECTA", LignePayeSimplifiee.ASSURANCE_CHOMAGE_APEC.getId());
liaison.put("COTFILLON2011", LignePayeSimplifiee.ALLEGEMENT_COTISATIONS.getId());
liaison.put("COTSYNDIC", LignePayeSimplifiee.AUTRES_CONTRIBUTIONS.getId());
liaison.put("COTPREV", LignePayeSimplifiee.RETRAITE_SUPPLEMENTAIRE.getId());
liaison.put("COT_MUTUELLE", LignePayeSimplifiee.SANTE_COMPLEMENAIRE_SANTE.getId());
liaison.put("COT_PENIBLE", LignePayeSimplifiee.AUTRES_CONTRIBUTIONS.getId());
 
SQLSelect sel = new SQLSelect();
sel.addSelect(conf.getRoot().findTable("RUBRIQUE_COTISATION").getField("CODE"));
sel.addSelect(conf.getRoot().findTable("RUBRIQUE_COTISATION").getField("NOM"));
sel.addSelect(conf.getRoot().findTable("RUBRIQUE_COTISATION").getKey());
List<SQLRow> rubCotis = SQLRowListRSH.execute(sel);
 
for (SQLRow sqlRow : rubCotis) {
final String code = sqlRow.getString("CODE");
if (liaison.containsKey(code)) {
sqlRow.createEmptyUpdateRow().put("LIGNE_PAYE_SIMPLIFIEE", liaison.get(code)).commit();
}
if (sqlRow.getString("NOM").toUpperCase().contains("FILLON")) {
sqlRow.createEmptyUpdateRow().put("ALLEGEMENT_COTISATION", Boolean.TRUE).commit();
}
}
}
}
 
final SQLTable tableRnet = conf.getRoot().getTable("RUBRIQUE_NET");
if (!tableRnet.contains("NUMERO_COMPTE_PCE_CHARGES")) {
final AlterTable alter = new AlterTable(tableRnet);
alter.addVarCharColumn("NUMERO_COMPTE_PCE_CHARGES", 128);
final String req = alter.asString();
conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
conf.getRoot().refetchTable(tableCaisse.getName());
conf.getRoot().getSchema().updateVersion();
}
 
if (!tableRC.contains("PART_PAT_IMPOSABLE")) {
final AlterTable alter = new AlterTable(tableRC);
alter.addBooleanColumn("PART_PAT_IMPOSABLE", Boolean.FALSE, false);
final String req = alter.asString();
conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
conf.getRoot().refetchTable(tableRC.getName());
conf.getRoot().getSchema().updateVersion();
}
 
if (!tableRC.contains("REDUCTION_FILLON")) {
final AlterTable alter = new AlterTable(tableRC);
alter.addBooleanColumn("REDUCTION_FILLON", Boolean.FALSE, false);
final String req = alter.asString();
conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
conf.getRoot().refetchTable(tableRC.getName());
conf.getRoot().getSchema().updateVersion();
}
 
// Vérification des droits existants
checkRights(conf.getRoot());
 
if (!conf.getRoot().contains("DEVISE")) {
System.out.println("InstallationPanel.InstallationPanel() ADD DEVISE");
try {
SQLUtils.executeAtomic(ds, new SQLUtils.SQLFactory<Object>() {
@Override
public Object create() throws SQLException {
final SQLCreateTable createDevise = new SQLCreateTable(conf.getRoot(), "DEVISE");
createDevise.addVarCharColumn("CODE", 128);
createDevise.addVarCharColumn("NOM", 128);
createDevise.addVarCharColumn("LIBELLE", 128);
createDevise.addVarCharColumn("LIBELLE_CENT", 128);
createDevise.addDecimalColumn("TAUX", 16, 8, BigDecimal.ONE, false);
createDevise.addDecimalColumn("TAUX_COMMERCIAL", 16, 8, BigDecimal.ONE, false);
ds.execute(createDevise.asString());
insertUndef(createDevise);
conf.getRoot().getSchema().updateVersion();
return null;
}
});
} catch (Exception ex) {
throw new IllegalStateException("Erreur lors de la création de la table DEVISE", ex);
}
} else if (!conf.getRoot().getTable("DEVISE").contains("TAUX_COMMERCIAL")) {
final SQLTable tDevise = conf.getRoot().getTable("DEVISE");
final AlterTable alterDevise = new AlterTable(tDevise);
alterDevise.addDecimalColumn("TAUX_COMMERCIAL", 16, 8, BigDecimal.ONE, false);
ds.execute(alterDevise.asString());
tDevise.getSchema().updateVersion();
}
 
if (!conf.getRoot().contains("TYPE_MODELE")) {
System.out.println("InstallationPanel.InstallationPanel() ADD TYPE_MODELE");
try {
SQLUtils.executeAtomic(ds, new SQLUtils.SQLFactory<Object>() {
@Override
public Object create() throws SQLException {
final SQLCreateTable createTypeModele = new SQLCreateTable(conf.getRoot(), "TYPE_MODELE");
createTypeModele.addVarCharColumn("NOM", 128);
createTypeModele.addVarCharColumn("TABLE", 128);
createTypeModele.addVarCharColumn("DEFAULT_MODELE", 128);
ds.execute(createTypeModele.asString());
 
insertUndef(createTypeModele);
 
conf.getRoot().getSchema().updateVersion();
 
conf.getRoot().refetch();
 
return null;
}
});
final String[] type = new String[] { "Avoir client", "AVOIR_CLIENT", "Avoir", "Bon de livraison", "BON_DE_LIVRAISON", "BonLivraison", "Commande Client",
"COMMANDE_CLIENT", "CommandeClient", "Devis", "DEVIS", "Devis", "Facture", "SAISIE_VENTE_FACTURE", "VenteFacture" };
// ('FR', 'Français', 1.000), ('EN',
// 'Anglais', 2.000)
final List<String> values = new ArrayList<String>();
final SQLBase base = conf.getRoot().getBase();
 
for (int i = 0; i < type.length; i += 3) {
final int order = values.size() + 1;
values.add("(" + base.quoteString(type[i]) + ", " + base.quoteString(type[i + 1]) + ", " + base.quoteString(type[i + 2]) + ", " + order + ")");
}
final String valuesStr = CollectionUtils.join(values, ", ");
final String insertVals = "INSERT INTO " + conf.getRoot().getTable("TYPE_MODELE").getSQLName().quote() + "(" + SQLBase.quoteIdentifier("NOM") + ", "
+ SQLBase.quoteIdentifier("TABLE") + ", " + SQLBase.quoteIdentifier("DEFAULT_MODELE") + ", " + SQLBase.quoteIdentifier(SQLSyntax.ORDER_NAME) + ") VALUES"
+ valuesStr;
 
ds.execute(insertVals);
} catch (Exception ex) {
throw new IllegalStateException("Erreur lors de la création de la table TYPE_MODELE", ex);
}
}
 
SQLTable.setUndefID(conf.getRoot().getSchema(), "DEVISE", 1);
SQLTable.setUndefID(conf.getRoot().getSchema(), "TYPE_MODELE", 1);
 
// DSN
final DSNInstallationUtils dsnUtils = new DSNInstallationUtils();
dsnUtils.updateDSNCommonTable(conf.getRoot());
 
// ECo contribution
final EcoContributionInstallationUtils ecoUtils = new EcoContributionInstallationUtils();
ecoUtils.updateEcoCommonTable(conf.getRoot());
 
// we need to upgrade all roots
// ///////////////////////////
conf.getSystemRoot().mapAllRoots();
conf.getSystemRoot().refetch();
 
final Set<String> childrenNames = conf.getSystemRoot().getChildrenNames();
 
SwingUtilities.invokeLater(new Runnable() {
 
@Override
public void run() {
bar.setIndeterminate(false);
bar.setMaximum(childrenNames.size() + 1);
}
});
int i = 1;
for (final String childName : childrenNames) {
System.out.println("InstallationPanel.InstallationPanel() UPDATE SCHEMA " + childName);
final int barValue = i;
 
SwingUtilities.invokeLater(new Runnable() {
 
@Override
public void run() {
bar.setValue(barValue);
}
});
i++;
final DBRoot root = conf.getSystemRoot().getRoot(childName);
try {
conf.getSystemRoot().getDataSource().execute("CREATE LANGUAGE plpgsql;");
} catch (Exception e) {
System.err.println("Warning: cannot add language plpgsql" + e.getMessage());
}
final SQLTable tableUndef = root.getTable(SQLTable.undefTable);
if (tableUndef != null && tableUndef.getField("UNDEFINED_ID").isNullable() == Boolean.FALSE) {
final AlterTable alterUndef = new AlterTable(tableUndef);
alterUndef.alterColumn("TABLENAME", EnumSet.allOf(Properties.class), "varchar(250)", "''", false);
alterUndef.alterColumn("UNDEFINED_ID", EnumSet.allOf(Properties.class), "int", null, true);
try {
ds.execute(alterUndef.asString());
tableUndef.getSchema().updateVersion();
} catch (SQLException ex) {
throw new IllegalStateException("Erreur lors de la modification de UNDEFINED_ID", ex);
}
}
 
if (DEBUG_FK) {
findBadForeignKey(root);
}
 
if (childName.equalsIgnoreCase("Common")) {
updateCommon(root);
} else if (childName.startsWith(conf.getAppName()) || childName.equalsIgnoreCase("Default")
) {
SQLUtils.executeAtomic(ds, new SQLUtils.SQLFactory<Object>() {
@Override
public Object create() throws SQLException {
fixUnboundedVarchar(root);
fixUnboundedNumeric(root);
fixCompletion(root);
try {
updateSocieteSchema(root);
} catch (Exception e) {
throw new SQLException(e);
}
updateToV1Dot2(root);
updateToV1Dot3(root);
updateToV1Dot4(root);
// DSN
dsnUtils.updateDSN(root);
// Eco contribution
ecoUtils.updateEco(root);
updateStyle(root);
createBanque(root);
createAssocAnalytique(root, conf);
updateStock(root);
updateVille(root.getTable("ADRESSE"));
 
Updater_1_5.update(root);
return null;
}
 
});
}
 
}
error = false;
} catch (Throwable e1) {
ExceptionHandler.handle("Echec de mise à jour", e1);
error = true;
}
 
conf.destroy();
SwingUtilities.invokeLater(new Runnable() {
 
509,7 → 159,7
}
 
});
if (finderPanel.getToken() == null) {
if (finderPanel != null && finderPanel.getToken() == null) {
c.weightx = 1;
c.gridwidth = GridBagConstraints.REMAINDER;
this.add(new JLabelBold("Création de l'utilisateur openconcerto dans la base"), c);
563,124 → 213,6
}
});
 
// Injection SQL
// c.gridy++;
// c.weightx = 1;
// c.gridwidth = GridBagConstraints.REMAINDER;
// c.insets = new Insets(10, 3, 2, 2);
// this.add(new TitledSeparator("Injecter la base", true), c);
//
// c.gridy++;
// c.weightx = 0;
// c.gridwidth = 1;
// c.insets = DefaultGridBagConstraints.getDefaultInsets();
// this.add(new JLabel("Fichier"), c);
//
// final JTextField chemin = new JTextField();
// c.gridx++;
// c.weightx = 1;
// this.add(chemin, c);
//
// c.gridx++;
// c.weightx = 0;
// JButton browse = new JButton("...");
// browse.addActionListener(new ActionListener() {
//
// @Override
// public void actionPerformed(ActionEvent e) {
// JFileChooser choose = new JFileChooser();
// if (choose.showOpenDialog(InstallationPanel.this) ==
// JFileChooser.APPROVE_OPTION) {
// chemin.setText(choose.getSelectedFile().getAbsolutePath());
// }
// }
// });
// this.add(browse, c);
//
// c.gridy++;
// c.gridx = 0;
// JButton inject = new JButton("Injecter");
// this.add(inject, c);
// inject.addActionListener(new ActionListener() {
//
// @Override
// public void actionPerformed(ActionEvent e) {
// File f = new File(chemin.getText());
// if (!f.exists()) {
// JOptionPane.showMessageDialog(InstallationPanel.this,
// "Impossible de trouver le fichier "
// + chemin.getText());
// return;
// }
// BufferedReader input = null;
// try {
//
// input = new BufferedReader(new FileReader(f));
// StringBuffer sql = new StringBuffer();
// String s;
// while ((s = input.readLine()) != null) {
// sql.append(s + "\n");
// }
// input.close();
//
// try {
// final SQLServer sqlServer =
// finderPanel.getServerConfig().createSQLServer();
// Number n = (Number)
// sqlServer.getBase("postgres").getDataSource().executeScalar("select COUNT(*) from
// pg_database WHERE datname='OpenConcerto'");
// if (n.intValue() > 0) {
// JOptionPane.showMessageDialog(InstallationPanel.this,
// "La base OpenConcerto est déjà présente sur le serveur!");
// return;
// }
// // System.err.println(sqlServer.getBase("OpenConcerto"));
// sqlServer.getBase("postgres").getDataSource()
// .execute("CREATE DATABASE \"OpenConcerto\" WITH TEMPLATE = template0 ENCODING =
// 'UTF8' LC_COLLATE = 'fr_FR.UTF-8' LC_CTYPE = 'fr_FR.UTF-8';");
//
// sqlServer.getBase("postgres").getDataSource().execute("ALTER DATABASE
// \"OpenConcerto\" OWNER TO openconcerto;");
//
// SQLUtils.executeScript(sql.toString(),
// sqlServer.getSystemRoot("OpenConcerto"));
// sqlServer.destroy();
// JOptionPane.showMessageDialog(InstallationPanel.this,
// "Création de la base OpenConerto terminée.");
// System.err.println("Création de la base OpenConerto terminée.");
//
// } catch (SQLException e1) {
// // TODO Auto-generated catch block
//
// e1.printStackTrace();
// JOptionPane.showMessageDialog(InstallationPanel.this,
// "Une erreur s'est produite pendant l'injection du script, vérifier la connexion au
// serveur et le script.");
// }
//
// } catch (FileNotFoundException ex) {
// // TODO Auto-generated catch block
// ex.printStackTrace();
// } catch (IOException ex) {
// // TODO Auto-generated catch block
// ex.printStackTrace();
// } finally {
// if (input != null) {
// try {
// input.close();
// } catch (IOException ex) {
// // TODO Auto-generated catch block
// ex.printStackTrace();
// }
// }
// }
//
// }
// });
 
// c.gridy++;
// this.add(bd, c);
 
c.gridy++;
c.weightx = 1;
c.gridwidth = GridBagConstraints.REMAINDER;
1371,7 → 903,7
size = 2048;
else
// e.g. IDCC.NOM > 350
size = 512;
size = 1024;
alter.alterColumn(fName, EnumSet.allOf(Properties.class), "varchar(" + size + ")", "''", false);
}
}
1386,8 → 918,12
}
 
for (final String sql : ChangeTable.cat(alters, root.getName())) {
ds.execute(sql);
try {
// ds.execute(sql);
} catch (Exception e) {
e.printStackTrace();
}
}
root.refetch();
}
 
3838,7 → 3374,6
CorrectOrder orderCorrect = new CorrectOrder(sysRoot);
orderCorrect.change(tableCommercial);
 
// new AddFK(sysRoot).changeAll(root);
sysRoot.reload(Collections.singleton(root.getName()));
 
try {
4437,4 → 3972,360
}
}
 
public void updateDatabase(final ComptaPropsConfiguration conf) {
try {
final SQLDataSource ds = conf.getSystemRoot().getDataSource();
System.err.println("SystemRoot:" + conf.getSystemRoot());
System.err.println("Root:" + conf.getRoot());
 
// FixUnbounded varchar
fixUnboundedVarchar(conf.getRoot());
 
// FIXME DROP CONSTRAINT UNIQUE ORDRE ON
// CONTACT_FOURNISSEUR
 
checkCompteDefault(conf.getRoot());
 
updateSocieteTable(conf.getRoot());
updateVille(conf.getRoot().getTable("ADRESSE"));
 
// Champ user 1.4.1
final SQLTable tableUser = conf.getRoot().getTable("USER_COMMON");
if (tableUser != null) {
final AlterTable alter = new AlterTable(tableUser);
boolean alterUser = false;
if (!tableUser.contains("DISABLED")) {
alter.addBooleanColumn("DISABLED", Boolean.FALSE, false);
alterUser = true;
}
if (!tableUser.contains("TEL")) {
alter.addVarCharColumn("TEL", 128);
alterUser = true;
}
 
if (alterUser) {
final String req = alter.asString();
conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
conf.getRoot().refetchTable(tableUser.getName());
conf.getRoot().getSchema().updateVersion();
}
}
 
// Champ Paye
final SQLTable tableCaisse = conf.getRoot().getTable("CAISSE_COTISATION");
if (!tableCaisse.contains("NUMERO_COMPTE_PCE")) {
final AlterTable alter = new AlterTable(tableCaisse);
alter.addVarCharColumn("NUMERO_COMPTE_PCE", 128);
alter.addVarCharColumn("NUMERO_COMPTE_PCE_CHARGES", 128);
final String req = alter.asString();
conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
conf.getRoot().refetchTable(tableCaisse.getName());
conf.getRoot().getSchema().updateVersion();
}
 
final SQLTable tableRC = conf.getRoot().getTable("RUBRIQUE_COTISATION");
if (!tableRC.contains("PART_CSG_SANS_ABATTEMENT")) {
final AlterTable alter = new AlterTable(tableRC);
alter.addBooleanColumn("PART_CSG_SANS_ABATTEMENT", Boolean.FALSE, false);
final String req = alter.asString();
conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
conf.getRoot().refetchTable(tableRC.getName());
conf.getRoot().getSchema().updateVersion();
}
 
// Paye simplifiee
{
final SQLTable tableRB = conf.getRoot().getTable("RUBRIQUE_BRUT");
if (!tableRB.contains("AVANTAGE_NATURE")) {
final AlterTable alter = new AlterTable(tableRB);
alter.addBooleanColumn("AVANTAGE_NATURE", Boolean.FALSE, false);
final String req = alter.asString();
conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
conf.getRoot().refetchTable(tableRB.getName());
conf.getRoot().getSchema().updateVersion();
}
 
if (!tableRC.contains("LIGNE_PAYE_SIMPLIFIEE")) {
final AlterTable alter = new AlterTable(tableRC);
 
alter.addBooleanColumn("ALLEGEMENT_COTISATION", Boolean.FALSE, false);
alter.addVarCharColumn("LIGNE_PAYE_SIMPLIFIEE", 256);
final String req = alter.asString();
conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
conf.getRoot().refetchTable(tableRC.getName());
conf.getRoot().getSchema().updateVersion();
Map<String, String> liaison = new HashMap<String, String>();
liaison.put("COTCSA", LignePayeSimplifiee.SANTE_SECURITE.getId());
liaison.put("COTMALADIE", LignePayeSimplifiee.SANTE_SECURITE.getId());
liaison.put("COTAF", LignePayeSimplifiee.FAMILLE_ALLOCATIONS.getId());
liaison.put("COTVEUV", LignePayeSimplifiee.SANTE_SECURITE.getId());
 
liaison.put("COTVIEIL", LignePayeSimplifiee.RETRAITE_SECURITE_NON_PLAF.getId());
liaison.put("COTVIEILPLAF", LignePayeSimplifiee.RETRAITE_SECURITE_PLAF.getId());
liaison.put("COTFNALPLAF", LignePayeSimplifiee.AUTRES_CONTRIBUTIONS.getId());
liaison.put("COTFNAL", LignePayeSimplifiee.AUTRES_CONTRIBUTIONS.getId());
liaison.put("COTAT", LignePayeSimplifiee.ACCIDENTS_TRAVAIL.getId());
 
liaison.put("COTVTRAN", LignePayeSimplifiee.AUTRES_CONTRIBUTIONS.getId());
liaison.put("COTCH", LignePayeSimplifiee.ASSURANCE_CHOMAGE_CHOMAGE.getId());
liaison.put("COTCHAGS", LignePayeSimplifiee.ASSURANCE_CHOMAGE_CHOMAGE.getId());
liaison.put("COTAGFF", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_T1.getId());
liaison.put("COTRNonCadre", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_T1.getId());
 
liaison.put("COTCSGIMP", LignePayeSimplifiee.CSG_IMP.getId());
liaison.put("COTCSGDED", LignePayeSimplifiee.CSG_NON_IMP.getId());
liaison.put("COTFILLON", LignePayeSimplifiee.ALLEGEMENT_COTISATIONS.getId());
liaison.put("COTFNGS", LignePayeSimplifiee.ASSURANCE_CHOMAGE_CHOMAGE.getId());
liaison.put("COTCADRET1", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_TA.getId());
liaison.put("COTCADRET2", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_TB.getId());
 
liaison.put("COT_CADRE_RET_C_A", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_TA.getId());
liaison.put("COT_CADRE_RET_C_B", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_TB.getId());
liaison.put("COT_CADRE_RET_C_C", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_TC.getId());
liaison.put("COTAPEC", LignePayeSimplifiee.ASSURANCE_CHOMAGE_APEC.getId());
liaison.put("COTAPECFORF", LignePayeSimplifiee.ASSURANCE_CHOMAGE_APEC.getId());
liaison.put("COTCET", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_TA.getId());
 
liaison.put("COTPREVCADRETA", LignePayeSimplifiee.SANTE_COMPLEMENAIRE_DECES.getId());
liaison.put("COTGMP", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_GMP.getId());
liaison.put("COTCRDSIMP", LignePayeSimplifiee.CSG_IMP.getId());
liaison.put("COTGMP2", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_GMP.getId());
liaison.put("TAXEAPPR", LignePayeSimplifiee.AUTRES_CONTRIBUTIONS.getId());
liaison.put("CDA", LignePayeSimplifiee.AUTRES_CONTRIBUTIONS.getId());
 
liaison.put("FOR", LignePayeSimplifiee.AUTRES_CONTRIBUTIONS.getId());
liaison.put("COTAPECTA", LignePayeSimplifiee.ASSURANCE_CHOMAGE_APEC.getId());
liaison.put("COTFILLON2011", LignePayeSimplifiee.ALLEGEMENT_COTISATIONS.getId());
liaison.put("COTSYNDIC", LignePayeSimplifiee.AUTRES_CONTRIBUTIONS.getId());
liaison.put("COTPREV", LignePayeSimplifiee.RETRAITE_SUPPLEMENTAIRE.getId());
liaison.put("COT_MUTUELLE", LignePayeSimplifiee.SANTE_COMPLEMENAIRE_SANTE.getId());
liaison.put("COT_PENIBLE", LignePayeSimplifiee.AUTRES_CONTRIBUTIONS.getId());
 
SQLSelect sel = new SQLSelect();
sel.addSelect(conf.getRoot().findTable("RUBRIQUE_COTISATION").getField("CODE"));
sel.addSelect(conf.getRoot().findTable("RUBRIQUE_COTISATION").getField("NOM"));
sel.addSelect(conf.getRoot().findTable("RUBRIQUE_COTISATION").getKey());
List<SQLRow> rubCotis = SQLRowListRSH.execute(sel);
 
for (SQLRow sqlRow : rubCotis) {
final String code = sqlRow.getString("CODE");
if (liaison.containsKey(code)) {
sqlRow.createEmptyUpdateRow().put("LIGNE_PAYE_SIMPLIFIEE", liaison.get(code)).commit();
}
if (sqlRow.getString("NOM").toUpperCase().contains("FILLON")) {
sqlRow.createEmptyUpdateRow().put("ALLEGEMENT_COTISATION", Boolean.TRUE).commit();
}
}
}
}
 
final SQLTable tableRnet = conf.getRoot().getTable("RUBRIQUE_NET");
if (!tableRnet.contains("NUMERO_COMPTE_PCE_CHARGES")) {
final AlterTable alter = new AlterTable(tableRnet);
alter.addVarCharColumn("NUMERO_COMPTE_PCE_CHARGES", 128);
final String req = alter.asString();
conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
conf.getRoot().refetchTable(tableCaisse.getName());
conf.getRoot().getSchema().updateVersion();
}
 
if (!tableRC.contains("PART_PAT_IMPOSABLE")) {
final AlterTable alter = new AlterTable(tableRC);
alter.addBooleanColumn("PART_PAT_IMPOSABLE", Boolean.FALSE, false);
final String req = alter.asString();
conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
conf.getRoot().refetchTable(tableRC.getName());
conf.getRoot().getSchema().updateVersion();
}
 
if (!tableRC.contains("REDUCTION_FILLON")) {
final AlterTable alter = new AlterTable(tableRC);
alter.addBooleanColumn("REDUCTION_FILLON", Boolean.FALSE, false);
final String req = alter.asString();
conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
conf.getRoot().refetchTable(tableRC.getName());
conf.getRoot().getSchema().updateVersion();
}
 
// Vérification des droits existants
checkRights(conf.getRoot());
 
if (!conf.getRoot().contains("DEVISE")) {
System.out.println("InstallationPanel.InstallationPanel() ADD DEVISE");
try {
SQLUtils.executeAtomic(ds, new SQLUtils.SQLFactory<Object>() {
@Override
public Object create() throws SQLException {
final SQLCreateTable createDevise = new SQLCreateTable(conf.getRoot(), "DEVISE");
createDevise.addVarCharColumn("CODE", 128);
createDevise.addVarCharColumn("NOM", 128);
createDevise.addVarCharColumn("LIBELLE", 128);
createDevise.addVarCharColumn("LIBELLE_CENT", 128);
createDevise.addDecimalColumn("TAUX", 16, 8, BigDecimal.ONE, false);
createDevise.addDecimalColumn("TAUX_COMMERCIAL", 16, 8, BigDecimal.ONE, false);
ds.execute(createDevise.asString());
insertUndef(createDevise);
conf.getRoot().getSchema().updateVersion();
return null;
}
});
} catch (Exception ex) {
throw new IllegalStateException("Erreur lors de la création de la table DEVISE", ex);
}
} else if (!conf.getRoot().getTable("DEVISE").contains("TAUX_COMMERCIAL")) {
final SQLTable tDevise = conf.getRoot().getTable("DEVISE");
final AlterTable alterDevise = new AlterTable(tDevise);
alterDevise.addDecimalColumn("TAUX_COMMERCIAL", 16, 8, BigDecimal.ONE, false);
ds.execute(alterDevise.asString());
tDevise.getSchema().updateVersion();
}
 
if (!conf.getRoot().contains("TYPE_MODELE")) {
System.out.println("InstallationPanel.InstallationPanel() ADD TYPE_MODELE");
try {
SQLUtils.executeAtomic(ds, new SQLUtils.SQLFactory<Object>() {
@Override
public Object create() throws SQLException {
final SQLCreateTable createTypeModele = new SQLCreateTable(conf.getRoot(), "TYPE_MODELE");
createTypeModele.addVarCharColumn("NOM", 128);
createTypeModele.addVarCharColumn("TABLE", 128);
createTypeModele.addVarCharColumn("DEFAULT_MODELE", 128);
ds.execute(createTypeModele.asString());
 
insertUndef(createTypeModele);
 
conf.getRoot().getSchema().updateVersion();
 
conf.getRoot().refetch();
 
return null;
}
});
final String[] type = new String[] { "Avoir client", "AVOIR_CLIENT", "Avoir", "Bon de livraison", "BON_DE_LIVRAISON", "BonLivraison", "Commande Client", "COMMANDE_CLIENT",
"CommandeClient", "Devis", "DEVIS", "Devis", "Facture", "SAISIE_VENTE_FACTURE", "VenteFacture" };
// ('FR', 'Français', 1.000), ('EN',
// 'Anglais', 2.000)
final List<String> values = new ArrayList<String>();
final SQLBase base = conf.getRoot().getBase();
 
for (int i = 0; i < type.length; i += 3) {
final int order = values.size() + 1;
values.add("(" + base.quoteString(type[i]) + ", " + base.quoteString(type[i + 1]) + ", " + base.quoteString(type[i + 2]) + ", " + order + ")");
}
final String valuesStr = CollectionUtils.join(values, ", ");
final String insertVals = "INSERT INTO " + conf.getRoot().getTable("TYPE_MODELE").getSQLName().quote() + "(" + SQLBase.quoteIdentifier("NOM") + ", "
+ SQLBase.quoteIdentifier("TABLE") + ", " + SQLBase.quoteIdentifier("DEFAULT_MODELE") + ", " + SQLBase.quoteIdentifier(SQLSyntax.ORDER_NAME) + ") VALUES" + valuesStr;
 
ds.execute(insertVals);
} catch (Exception ex) {
throw new IllegalStateException("Erreur lors de la création de la table TYPE_MODELE", ex);
}
}
 
SQLTable.setUndefID(conf.getRoot().getSchema(), "DEVISE", 1);
SQLTable.setUndefID(conf.getRoot().getSchema(), "TYPE_MODELE", 1);
 
// DSN
final DSNInstallationUtils dsnUtils = new DSNInstallationUtils();
dsnUtils.updateDSNCommonTable(conf.getRoot());
 
// ECo contribution
final EcoContributionInstallationUtils ecoUtils = new EcoContributionInstallationUtils();
ecoUtils.updateEcoCommonTable(conf.getRoot());
 
 
// we need to upgrade all roots
// ///////////////////////////
conf.getSystemRoot().mapAllRoots();
conf.getSystemRoot().refetch();
 
final Set<String> childrenNames = conf.getSystemRoot().getChildrenNames();
 
SwingUtilities.invokeLater(new Runnable() {
 
@Override
public void run() {
bar.setIndeterminate(false);
bar.setMaximum(childrenNames.size() + 1);
}
});
int i = 1;
for (final String childName : childrenNames) {
System.out.println("InstallationPanel.InstallationPanel() UPDATE SCHEMA " + childName);
final int barValue = i;
 
SwingUtilities.invokeLater(new Runnable() {
 
@Override
public void run() {
bar.setValue(barValue);
}
});
i++;
final DBRoot root = conf.getSystemRoot().getRoot(childName);
try {
conf.getSystemRoot().getDataSource().execute("CREATE LANGUAGE plpgsql;");
} catch (Exception e) {
System.err.println("Warning: cannot add language plpgsql" + e.getMessage());
}
final SQLTable tableUndef = root.getTable(SQLTable.undefTable);
if (tableUndef != null && tableUndef.getField("UNDEFINED_ID").isNullable() == Boolean.FALSE) {
final AlterTable alterUndef = new AlterTable(tableUndef);
alterUndef.alterColumn("TABLENAME", EnumSet.allOf(Properties.class), "varchar(250)", "''", false);
alterUndef.alterColumn("UNDEFINED_ID", EnumSet.allOf(Properties.class), "int", null, true);
try {
ds.execute(alterUndef.asString());
tableUndef.getSchema().updateVersion();
} catch (SQLException ex) {
throw new IllegalStateException("Erreur lors de la modification de UNDEFINED_ID", ex);
}
}
 
if (DEBUG_FK) {
findBadForeignKey(root);
}
 
if (childName.equalsIgnoreCase("Common")) {
updateCommon(root);
} else if (childName.startsWith(conf.getAppName()) || childName.equalsIgnoreCase("Default")
) {
SQLUtils.executeAtomic(ds, new SQLUtils.SQLFactory<Object>() {
@Override
public Object create() throws SQLException {
fixUnboundedVarchar(root);
fixUnboundedNumeric(root);
fixCompletion(root);
try {
updateSocieteSchema(root);
} catch (Exception e) {
throw new SQLException(e);
}
updateToV1Dot2(root);
updateToV1Dot3(root);
updateToV1Dot4(root);
// DSN
dsnUtils.updateDSN(root);
// Eco contribution
ecoUtils.updateEco(root);
updateStyle(root);
createBanque(root);
createAssocAnalytique(root, conf);
updateStock(root);
updateVille(root.getTable("ADRESSE"));
 
Updater_1_5.update(root);
return null;
}
 
});
}
 
}
error = false;
} catch (Throwable e1) {
ExceptionHandler.handle("Echec de mise à jour", e1);
error = true;
}
}
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/config/MainFrame.java
16,8 → 16,11
import org.openconcerto.erp.action.AboutAction;
import org.openconcerto.erp.action.PreferencesAction;
import org.openconcerto.erp.core.common.ui.StatusPanel;
import org.openconcerto.erp.panel.UserExitConf;
import org.openconcerto.erp.panel.UserExitPanel;
import org.openconcerto.erp.rights.MenuComboRightEditor;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.PropsConfiguration;
import org.openconcerto.sql.users.UserManager;
import org.openconcerto.sql.users.rights.UserRightsManager;
import org.openconcerto.task.TodoListPanel;
196,6 → 199,17
});
 
setInstance(this);
 
final Thread dbConn = ((PropsConfiguration) conf).createDBCheckThread(this, new Runnable() {
@Override
public void run() {
// the user has already clicked "Quit" don't ask him again
// Further the DB is unavailable so most actions (e.g. backup) cannot run
UserExitPanel.exit(UserExitConf.DEFAULT);
}
});
dbConn.start();
 
// Overrive logo
final Image im = conf instanceof ComptaPropsConfiguration ? ((ComptaPropsConfiguration) conf).getCustomLogo() : null;
if (im != null) {
/trunk/OpenConcerto/src/org/openconcerto/erp/modules/ModulesStateChange.java
37,8 → 37,15
// is)
public Set<ModuleReference> getReferencesToInstall();
 
default public Set<String> getIDsToInstall() {
return ModuleReference.getIDs(this.getReferencesToInstall());
}
 
// the references to remove in uninstallation order
public Set<ModuleReference> getReferencesToRemove();
 
// MAYBE default public Set<String> getIDsToRemove(), but how are upgraded modules handled ?
// should the IDs in getIDsToInstall() be returned ?
 
public boolean forceRemove();
}
/trunk/OpenConcerto/src/org/openconcerto/erp/modules/DepSolverResultPanel.java
18,7 → 18,10
 
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
 
import javax.swing.JLabel;
import javax.swing.JPanel;
27,34 → 30,44
 
public DepSolverResultPanel(DepSolverResultMM depSolverResult) {
this.setLayout(new VFlowLayout());
final List<ModuleReference> lInstall = new ArrayList<ModuleReference>(depSolverResult.getReferencesToInstall());
Collections.sort(lInstall, ModuleReference.COMP_ID_ASC_VERSION_DESC);
if (lInstall.size() > 0) {
if (lInstall.size() == 1) {
this.add(new JLabelBold("Installation du module " + ModulePanel.format(lInstall.get(0))));
} else {
this.add(new JLabelBold("Modules à installer :"));
for (ModuleReference moduleReference : lInstall) {
this.add(new JLabel("- " + ModulePanel.format(moduleReference)));
 
final Set<String> idsToInstall = depSolverResult.getIDsToInstall();
final Map<String, ModuleVersion> versionsToUpgrade = new HashMap<>();
final List<ModuleReference> lRemove = new ArrayList<>();
for (final ModuleReference ref : depSolverResult.getReferencesToRemove()) {
if (idsToInstall.contains(ref.getID()))
versionsToUpgrade.put(ref.getID(), ref.getVersion());
else
lRemove.add(ref);
}
final List<ModuleReference> lInstall = new ArrayList<>();
final List<ModuleReference> lUpgrade = new ArrayList<>();
for (final ModuleReference ref : depSolverResult.getReferencesToInstall()) {
(versionsToUpgrade.containsKey(ref.getID()) ? lUpgrade : lInstall).add(ref);
}
 
addLabels(lUpgrade, versionsToUpgrade, "Mise à jour du module ", "Modules à mettre à jour :");
addLabels(lInstall, null, "Installation du module ", "Modules à installer :");
addLabels(lRemove, null, "Désinstallation du module ", "Modules à désinstaller :");
}
 
final List<ModuleReference> lRemove = new ArrayList<ModuleReference>(depSolverResult.getReferencesToRemove());
Collections.sort(lRemove, ModuleReference.COMP_ID_ASC_VERSION_DESC);
if (lRemove.size() > 0) {
if (lRemove.size() == 1) {
this.add(new JLabelBold("Désinstallation du module " + ModulePanel.format(lInstall.get(0))));
private void addLabels(final List<ModuleReference> l, final Map<String, ModuleVersion> oldVersions, final String single, final String multi) {
if (l.isEmpty())
return;
if (l.size() == 1) {
this.add(new JLabelBold(single + getVersionString(l.get(0), oldVersions)));
} else {
this.add(new JLabelBold("Modules à désinstaller :"));
for (ModuleReference moduleReference : lRemove) {
this.add(new JLabel("- " + ModulePanel.format(moduleReference)));
this.add(new JLabelBold(multi));
Collections.sort(l, ModuleReference.COMP_ID_ASC_VERSION_DESC);
for (ModuleReference moduleReference : l) {
this.add(new JLabel("- " + getVersionString(moduleReference, oldVersions)));
}
}
 
}
 
static private final String getVersionString(final ModuleReference ref, final Map<String, ModuleVersion> oldVersions) {
if (oldVersions == null)
return ModulePanel.format(ref);
return ref.getID() + " (" + oldVersions.get(ref.getID()) + " -> " + ref.getVersion() + ")";
}
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/modules/DBContext.java
13,6 → 13,7
package org.openconcerto.erp.modules;
 
import org.openconcerto.sql.element.SQLElementDirectory;
import org.openconcerto.sql.model.DBRoot;
import org.openconcerto.sql.model.SQLField;
import org.openconcerto.sql.model.SQLName;
45,6 → 46,7
private final ModuleVersion localVersion;
private final ModuleVersion lastInstalledVersion;
private final DBRoot root;
private final SQLElementDirectory elemDir;
private final List<ChangeTable<?>> changeTables;
private final List<AlterTableRestricted> alterTables;
// Data Manipulation
53,7 → 55,8
private final Set<String> tables;
private final SetMap<String, SQLField> fields;
 
DBContext(final File dir, final ModuleVersion localVersion, final DBRoot root, final ModuleVersion dbVersion, final Set<String> tables, final Set<SQLName> fields) {
DBContext(final File dir, final ModuleVersion localVersion, final DBRoot root, final ModuleVersion dbVersion, final Set<String> tables, final Set<SQLName> fields,
final SQLElementDirectory elemDir) {
super();
this.dir = dir;
this.localVersion = localVersion;
65,6 → 68,7
final String tableName = f.getItem(0);
this.fields.add(tableName, this.root.getTable(tableName).getField(f.getItem(1)));
}
this.elemDir = elemDir;
this.changeTables = new ArrayList<ChangeTable<?>>();
this.alterTables = new ArrayList<AlterTableRestricted>();
this.dm = new ArrayList<IClosure<? super DBRoot>>();
86,6 → 90,10
return this.root;
}
 
public final SQLElementDirectory getElementDirectory() {
return this.elemDir;
}
 
public final Set<String> getTablesPreviouslyCreated() {
return this.tables;
}
/trunk/OpenConcerto/src/org/openconcerto/erp/modules/DepSolverResultMM.java
24,6 → 24,7
import java.util.HashSet;
import java.util.Set;
 
import net.jcip.annotations.Immutable;
import net.jcip.annotations.ThreadSafe;
 
/**
54,8 → 55,10
return new ChangeAndValidity(ValidState.getTrueInstance(), toChange);
}
 
@Immutable
static private final class ChangeAndValidity {
private final Set<ModuleReference> toChange;
private final Set<String> toChangeIDs;
private final ValidState validity;
 
private ChangeAndValidity(final ValidState validity, final Set<ModuleReference> toChange) {
62,6 → 65,7
this.validity = validity;
this.toChange = toChange;
assert (this.toChange != null) == this.validity.isValid();
this.toChangeIDs = this.toChange == null ? null : Collections.unmodifiableSet(ModuleReference.getIDs(this.toChange));
}
}
 
149,21 → 153,25
* @see #getInstallValidity()
*/
@Override
public synchronized final Set<ModuleReference> getReferencesToInstall() {
setToInstall();
return this.toAdd.toChange;
public final Set<ModuleReference> getReferencesToInstall() {
return this.getToInstall().toChange;
}
 
private synchronized final void setToInstall() {
@Override
public final Set<String> getIDsToInstall() {
return this.getToInstall().toChangeIDs;
}
 
private synchronized final ChangeAndValidity getToInstall() {
if (this.toAdd == null) {
this.toAdd = computeReferencesToInstall();
assert this.toAdd != null;
}
return this.toAdd;
}
 
public synchronized final ValidState getInstallValidity() {
setToInstall();
return this.toAdd.validity;
public final ValidState getInstallValidity() {
return this.getToInstall().validity;
}
 
private final ChangeAndValidity computeReferencesToInstall() {
186,7 → 194,7
return createError("Current user cannot install " + toInst);
}
 
return createOK(toInstall);
return createOK(Collections.unmodifiableSet(toInstall));
}
 
/**
197,21 → 205,20
* @see #getUninstallValidity()
*/
@Override
public synchronized final Set<ModuleReference> getReferencesToRemove() {
setToUninstall();
return this.toRemove.toChange;
public final Set<ModuleReference> getReferencesToRemove() {
return this.getToUninstall().toChange;
}
 
private synchronized final void setToUninstall() {
private synchronized final ChangeAndValidity getToUninstall() {
if (this.toRemove == null) {
this.toRemove = computeReferencesToRemove();
assert this.toRemove != null;
}
return this.toRemove;
}
 
public synchronized final ValidState getUninstallValidity() {
setToUninstall();
return this.toRemove.validity;
public final ValidState getUninstallValidity() {
return this.getToUninstall().validity;
}
 
@Override
221,9 → 228,7
 
private final ChangeAndValidity computeReferencesToRemove() {
final Set<ModuleFactory> factories = this.getGraph().getFactories();
final Collection<ModuleFactory> installedFactories = this.getInstallState().getAllInstalledFactories();
if (installedFactories == null)
return createError("Missing some factories for installed modules");
final Collection<ModuleFactory> installedFactories = this.getInstallState().getInstalledFactories().values();
final Set<ModuleReference> conflicts = new HashSet<ModuleReference>();
for (final ModuleFactory f : installedFactories) {
if (f.conflictsWith(factories))
235,14 → 240,36
} catch (Exception e) {
throw new IllegalStateException("couldn't find needing modules for " + conflicts, e);
}
final ChangeAndValidity okRes = createOK(Collections.unmodifiableSet(toUninstall));
 
if (this.getNoChoiceSolution() != null && toUninstall.size() > 0)
return createError(this.getNoChoiceSolution() + " required but would uninstall " + toUninstall);
if (this.getNoChoiceSolution() != null) {
final Set<String> toInstallIDs = getIDsToInstall();
if (toInstallIDs == null)
return createError(this.getNoChoiceSolution() + " required but install is invalid : " + this.getInstallValidity());
if (!toInstallIDs.containsAll(okRes.toChangeIDs))
return createError(this.getNoChoiceSolution() + " required but would uninstall " + CollectionUtils.subtract(toInstallIDs, okRes.toChangeIDs));
}
 
for (final ModuleReference toInst : toUninstall) {
if (!getManager().canCurrentUserInstall(ModuleAction.UNINSTALL, toInst, getInstallState()))
return createError("Current user cannot uninstall " + toInst);
}
return createOK(toUninstall);
return okRes;
}
 
@Override
public String toString() {
final ChangeAndValidity installs, uninstalls;
synchronized (this) {
installs = this.toAdd;
uninstalls = this.toRemove;
}
final String installString = toString(installs, ", to install");
final String uninstallString = toString(uninstalls, ", to remove");
return super.toString() + installString + uninstallString;
}
 
private final String toString(final ChangeAndValidity ch, final String label) {
return ch == null ? "" : (ch.validity.isValid() ? label + " : " + ch.toChange : " " + ch.validity);
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/modules/ModuleReference.java
17,7 → 17,10
 
import java.beans.DefaultPersistenceDelegate;
import java.beans.PersistenceDelegate;
import java.util.Collection;
import java.util.Comparator;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.regex.Pattern;
 
import net.jcip.annotations.Immutable;
38,6 → 41,17
}
};
 
static public final Set<String> getIDs(final Set<ModuleReference> refs) {
return getIDs(refs, new LinkedHashSet<String>(refs.size()));
}
 
static public final <C extends Collection<String>> C getIDs(final Collection<ModuleReference> refs, final C res) {
for (final ModuleReference mref : refs) {
res.add(mref.getID());
}
return res;
}
 
static String checkMatch(final Pattern p, final String s, final String name) {
if (!p.matcher(s).matches())
throw new IllegalArgumentException(name + " doesn't match " + p.pattern());
62,6 → 76,8
if (id == null)
throw new NullPointerException();
this.id = checkMatch(idPatrn, id.trim(), "ID");
if (version != null)
version.checkValidity();
this.version = version;
}
 
/trunk/OpenConcerto/src/org/openconcerto/erp/modules/ModuleTableModel.java
359,6 → 359,8
public Class<?> getColumnClass(int columnIndex) {
if (BOOLEAN_COLS.contains(Columns.values()[columnIndex])) {
return Boolean.class;
} else if (columnIndex == Columns.VERSION.ordinal()) {
return ModuleVersion.class;
} else {
return String.class;
}
/trunk/OpenConcerto/src/org/openconcerto/erp/modules/ModuleManager.java
135,7 → 135,8
 
private static synchronized final Executor getExec() {
if (exec == null)
exec = new ThreadPoolExecutor(0, 2, 60L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new ThreadFactory(ModuleManager.class.getSimpleName()
exec = new ThreadPoolExecutor(0, 2, 60L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(),
new ThreadFactory(ModuleManager.class.getSimpleName()
// not daemon since install() is not atomic
+ " executor thread ", false));
return exec;
386,8 → 387,9
@Override
public void executeChecked(ModuleManager input) {
try {
startModule(f.getReference(), persistent);
} catch (Exception e) {
if (!startModule(f.getReference(), persistent))
throw new IllegalStateException("Couldn't be started");
} catch (Throwable e) {
ExceptionHandler.handle(MainFrame.getInstance(), "Unable to start " + f, e);
}
}
1013,7 → 1015,7
@Override
public Object handle(SQLDataSource ds) throws SQLException, IOException {
final Tuple2<Set<String>, Set<SQLName>> alreadyCreatedItems = getCreatedItems(factory.getID());
final DBContext ctxt = new DBContext(localDir, localVersion, getRoot(), lastInstalledVersion, alreadyCreatedItems.get0(), alreadyCreatedItems.get1());
final DBContext ctxt = new DBContext(localDir, localVersion, getRoot(), lastInstalledVersion, alreadyCreatedItems.get0(), alreadyCreatedItems.get1(), getDirectory());
// install local (i.e. ctxt stores the actions to carry on the DB)
// TODO pass a data source with no rights to modify the data definition (or
// even no rights to modify the data if DB version is up to date)
1514,11 → 1516,17
final Set<ModuleReference> toRemove = change.getReferencesToRemove();
final Set<ModuleReference> removed;
if (toRemove.size() > 0) {
final Set<String> idsToInstall = change.getIDsToInstall();
 
// limit the number of requests
final Map<String, ModuleVersion> dbVersions = this.getDBInstalledModules();
removed = new HashSet<ModuleReference>();
for (final ModuleReference ref : toRemove) {
if (this.uninstallUnsafe(ref, !change.forceRemove(), dbVersions))
// don't uninstall modules to upgrade but since this loop might uninstall modules
// needed by ref, at least stop it like uninstallUnsafe() does
if (idsToInstall.contains(ref.getID()))
this.stopModule(ref.getID(), false);
else if (this.uninstallUnsafe(ref, !change.forceRemove(), dbVersions))
removed.add(ref);
}
} else {
1533,7 → 1541,7
// is garbage collected, but
// 1. this cannot work if the module is in the class path
// 2. an ill-behaved modules might have modified a static value
assert noDisplayableFrame();
assert noDisplayableFrame() : "A change needs to exit but there still a displayable frame : " + change;
final Set<ModuleReference> toInstall = change.getReferencesToInstall();
// don't use only getReferencesToInstall() as even if no modules need installing, their
// state might need to change (e.g. start)
1613,8 → 1621,11
// don't test toStart emptiness as even if all modules were started, they might need to be
// made persistent
if (targetState.compareTo(ModuleState.INSTALLED) >= 0) {
for (final AbstractModule module : toStart)
// register each module just after install, so that the next module can use its elements
// in its install
for (final AbstractModule module : toStart) {
installAndRegister(module, graph);
}
 
if (targetState == ModuleState.STARTED) {
start(toStart);
/trunk/OpenConcerto/src/org/openconcerto/erp/modules/ModuleVersion.java
28,18 → 28,26
public static final int MAX = 10000;
public static final ModuleVersion MIN = new ModuleVersion(0);
private static final long MERGED_MAX = MAX * (long) MAX;
 
static public final long getMerged(int major, int minor) {
// for now, leave open the possibility of negative instance to replace null for "no version"
if (major >= MAX)
throw new IllegalArgumentException("Major too big " + major);
if (minor >= MAX)
throw new IllegalArgumentException("Minor too big " + minor);
if (minor < 0)
throw new IllegalArgumentException("Minor too small " + minor);
return major * MAX + minor;
}
 
private final int major, minor;
private final long merged;
 
public ModuleVersion(int major, int minor) {
super();
if (major >= MAX)
throw new IllegalArgumentException("Major too big " + major);
if (minor >= MAX)
throw new IllegalArgumentException("Minor too big " + minor);
this.major = major;
this.minor = minor;
this.merged = major * MAX + minor;
this.merged = getMerged(major, minor);
}
 
public ModuleVersion(long merged) {
/trunk/OpenConcerto/src/org/openconcerto/erp/modules/InstallationState.java
102,15 → 102,6
return this.installedFactories;
}
 
// factories for all installed (local or remote) modules
// null if some installed module lacks a factory
public final Collection<ModuleFactory> getAllInstalledFactories() {
if (this.isMissingFactories())
return null;
else
return this.getInstalledFactories().values();
}
 
private final Tuple2<Boolean, Map<String, ModuleFactory>> computeInstalledFactories(final FactoriesByID pool) {
boolean missing = false;
final Set<ModuleReference> localOrRemote = this.getLocalOrRemote();
/trunk/OpenConcerto/src/org/openconcerto/erp/action/CreateListFrameAbstractAction.java
26,6 → 26,7
import org.openconcerto.ui.light.ColumnSpec;
import org.openconcerto.ui.light.ColumnsSpec;
import org.openconcerto.ui.light.CustomEditorProvider;
import org.openconcerto.ui.light.LightUIButtonWithContext;
import org.openconcerto.ui.light.LightUIElement;
import org.openconcerto.ui.light.LightUIFrame;
import org.openconcerto.ui.light.LightUILine;
68,7 → 69,7
// Get actions associate to the SQLElement and create buttons for them
final Collection<IListeAction> actions = element.getRowActions();
 
final LightUIPanel panel = frame.getFirstChild(LightUIPanel.class);
final LightUIPanel panel = frame.getContentPanel();
final LightUILine l0 = new LightUILine();
 
l0.setGridAlignment(LightUILine.ALIGN_LEFT);
76,8 → 77,7
for (final Iterator<IListeAction> iterator = actions.iterator(); iterator.hasNext();) {
RowAction iListeAction = (RowAction) iterator.next();
if (iListeAction.inHeader()) {
LightUIElement element2 = new LightUIElement(iListeAction.getID());
element2.setType(LightUIElement.TYPE_BUTTON_WITH_CONTEXT);
LightUIButtonWithContext element2 = new LightUIButtonWithContext(iListeAction.getID());
element2.setValue(iListeAction.getID());
 
String label = TranslationManager.getInstance().getTranslationForAction(iListeAction.getID());
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/BonReceptionFactureFournisseurSQLInjector.java
28,7 → 28,13
map(getSource().getField("ID_FOURNISSEUR"), getDestination().getField("ID_FOURNISSEUR"));
map(getSource().getField("NOM"), getDestination().getField("NOM"));
map(getSource().getField("INFOS"), getDestination().getField("INFOS"));
if (getSource().contains("REMISE_HT")) {
map(getSource().getField("TOTAL_POIDS"), getDestination().getField("T_POIDS"));
map(getSource().getField("REMISE_HT"), getDestination().getField("REMISE_HT"));
map(getSource().getField("PORT_HT"), getDestination().getField("PORT_HT"));
map(getSource().getField("ID_TAXE_PORT"), getDestination().getField("ID_TAXE_PORT"));
}
}
 
@Override
protected void merge(SQLRowAccessor srcRow, SQLRowValues rowVals) {
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/CommandeBrSQLInjector.java
29,6 → 29,12
final SQLTable tableBr = getDestination();
map(tableCmd.getField("ID_FOURNISSEUR"), tableBr.getField("ID_FOURNISSEUR"));
map(tableCmd.getField("NOM"), tableBr.getField("NOM"));
if (tableCmd.contains("REMISE_HT")) {
map(tableCmd.getField("T_POIDS"), tableBr.getField("TOTAL_POIDS"));
map(tableCmd.getField("REMISE_HT"), tableBr.getField("REMISE_HT"));
map(tableCmd.getField("PORT_HT"), tableBr.getField("PORT_HT"));
map(tableCmd.getField("ID_TAXE_PORT"), tableBr.getField("ID_TAXE_PORT"));
}
map(tableCmd.getField("INFOS"), tableBr.getField("INFOS"));
map(tableCmd.getField("ID"), tableBr.getField("ID_COMMANDE"));
if (tableBr.contains("CREATE_VIRTUAL_STOCK")) {
49,6 → 55,7
final SQLInjector injector = SQLInjector.getInjector(tableElementSource, tableElementDestination);
for (SQLRowAccessor rowElt : myListItem) {
final SQLRowValues createRowValuesFrom = injector.createRowValuesFrom(rowElt.asRow());
createRowValuesFrom.put("QTE_ORIGINE", createRowValuesFrom.getObject("QTE"));
if (createRowValuesFrom.getTable().getFieldsName().contains("POURCENT_ACOMPTE")) {
if (createRowValuesFrom.getObject("POURCENT_ACOMPTE") == null) {
createRowValuesFrom.put("POURCENT_ACOMPTE", new BigDecimal(100.0));
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/DevisFactureSQLInjector.java
30,7 → 30,9
super(root, "DEVIS", "SAISIE_VENTE_FACTURE", true);
final SQLTable tableDevis = getSource();
final SQLTable tableFacture = getDestination();
 
if (tableDevis.contains("T_ACOMPTE")) {
map(tableDevis.getField("T_ACOMPTE"), tableFacture.getField("T_ACOMPTE"));
}
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"));
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/ODTPrinterNX.java
53,7 → 53,7
final MediaPrintableArea printableArea = new MediaPrintableArea((float) (paper.getImageableX() / POINTS_PER_INCH), (float) (paper.getImageableY() / POINTS_PER_INCH),
(float) (paper.getImageableWidth() / POINTS_PER_INCH), (float) (paper.getImageableHeight() / POINTS_PER_INCH), Size2DSyntax.INCH);
attributes.add(printableArea);
 
// hghghgh
final PageFormat format = printJob.getPageFormat(null);
format.setPaper(paper);
printJob.setPrintable(this, format);
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/OOgenerationXML.java
479,7 → 479,7
}
}
}
rowValsPort.putRowValues("ID_ARTICLE").put("ID_COMPTE_PCE", rowDefaultCptPort.getID());
rowValsPort.putRowValues("ID_ARTICLE").put("ID_COMPTE_PCE", rowDefaultCptPort.getID()).put("ID_COMPTE_PCE_ACHAT", rowDefaultCptPort.getID());
 
calc.addLine(rowValsPort, rowValsPort.getForeign("ID_ARTICLE"), 1, false);
}
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/OOgenerationListeColumnXML.java
58,6 → 58,9
final SAXBuilder builder = new SAXBuilder();
try {
InputStream xmlConfiguration = TemplateManager.getInstance().getTemplateConfiguration(templateId, rowLanguage != null ? rowLanguage.getString("CHEMIN") : null, null);
if (xmlConfiguration == null) {
throw new IllegalStateException("Template configuration " + templateId + " not found (" + TemplateManager.getInstance().getClass().getName() + ")");
}
Document doc = builder.build(xmlConfiguration);
 
// On initialise un nouvel élément racine avec l'élément racine du
66,7 → 69,9
 
// Création et génération du fichier OO
final InputStream template = TemplateManager.getInstance().getTemplate(templateId, rowLanguage != null ? rowLanguage.getString("CHEMIN") : null, null);
 
if (template == null) {
throw new IllegalStateException("Template " + templateId + " not found (" + TemplateManager.getInstance().getClass().getName() + ")");
}
final SpreadSheet spreadSheet = new ODPackage(template).getSpreadSheet();
Sheet sheet0 = spreadSheet.getSheet(0);
if (sheetName != null && sheetName.size() > 0) {
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/ConditionsReglementDetailsProvider.java
New file
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.
*/
/*
* Créé le 25 oct. 2012
*/
package org.openconcerto.erp.generationDoc.provider;
 
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueContext;
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProvider;
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProviderManager;
import org.openconcerto.sql.model.SQLRowAccessor;
 
public class ConditionsReglementDetailsProvider implements SpreadSheetCellValueProvider {
 
public ConditionsReglementDetailsProvider() {
 
}
 
@Override
public Object getValue(SpreadSheetCellValueContext context) {
SQLRowAccessor row = context.getRow();
String r = "";
final SQLRowAccessor foreignRow = row.getForeign("ID_MODE_REGLEMENT");
if (foreignRow != null) {
if (foreignRow.getForeign("ID_TYPE_REGLEMENT") != null) {
SQLRowAccessor rowT = foreignRow.getForeign("ID_TYPE_REGLEMENT");
if (!rowT.getString("NOM").equalsIgnoreCase("Indéfini")) {
r = rowT.getString("NOM");
}
}
int ajours = foreignRow.getInt("AJOURS");
int njour = foreignRow.getInt("LENJOUR");
 
if (ajours == 0 && njour == 0) {
if (foreignRow.getBoolean("COMPTANT") != null && !foreignRow.getBoolean("COMPTANT")) {
r = "Date de facture";
} else {
r = "Comptant";
}
} else {
 
if (ajours != 0) {
 
r = "à" + ajours + ((ajours > 1) ? " jours" : " jour");
}
if (njour > 0 && njour < 31) {
r += " le " + njour;
} else {
if (njour == 0) {
r += " date de facture";
} else {
r += " fin de mois";
}
}
}
}
return r;
}
 
public static void register() {
SpreadSheetCellValueProviderManager.put("conditions.paiement.details", new ConditionsReglementDetailsProvider());
 
}
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/PrixUnitaireRemiseProvider.java
23,9 → 23,25
 
public class PrixUnitaireRemiseProvider extends UserInitialsValueProvider {
 
public static int UNITAIRE_REMISE = 0;
public static int TOTAL_NON_ACOMPTE = 1;
public final int type;
 
public PrixUnitaireRemiseProvider(int t) {
this.type = t;
}
 
@Override
public Object getValue(SpreadSheetCellValueContext context) {
SQLRowAccessor row = context.getRow();
if (this.type == UNITAIRE_REMISE) {
return getPrixUnitaire(row);
} else {
return getPrixTotalOrigin(row);
}
}
 
public Object getPrixTotalOrigin(SQLRowAccessor row) {
final BigDecimal pv = row.getBigDecimal("PV_HT");
BigDecimal remise = (BigDecimal) row.getObject("POURCENT_REMISE");
if (remise == null) {
32,6 → 48,19
remise = BigDecimal.ZERO;
}
BigDecimal acompte = BigDecimal.ONE;
 
BigDecimal result = BigDecimal.ONE.subtract(remise.movePointLeft(2)).multiply(pv, DecimalUtils.HIGH_PRECISION).multiply(acompte, DecimalUtils.HIGH_PRECISION);
 
return result.multiply(row.getBigDecimal("QTE_UNITAIRE")).multiply(new BigDecimal(row.getInt("QTE"))).setScale(2, RoundingMode.HALF_UP);
}
 
public Object getPrixUnitaire(SQLRowAccessor row) {
final BigDecimal pv = row.getBigDecimal("PV_HT");
BigDecimal remise = (BigDecimal) row.getObject("POURCENT_REMISE");
if (remise == null) {
remise = BigDecimal.ZERO;
}
BigDecimal acompte = BigDecimal.ONE;
if (row.getTable().contains("POURCENT_ACOMPTE") && row.getObject("POURCENT_ACOMPTE") != null) {
acompte = ((BigDecimal) row.getObject("POURCENT_ACOMPTE")).movePointLeft(2);
}
41,6 → 70,7
}
 
public static void register() {
SpreadSheetCellValueProviderManager.put("PrixUnitaireRemise", new PrixUnitaireRemiseProvider());
SpreadSheetCellValueProviderManager.put("PrixUnitaireRemise", new PrixUnitaireRemiseProvider(UNITAIRE_REMISE));
SpreadSheetCellValueProviderManager.put("PrixTotalSansAcompte", new PrixUnitaireRemiseProvider(TOTAL_NON_ACOMPTE));
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/TotalAcompteProvider.java
16,6 → 16,7
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueContext;
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProvider;
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProviderManager;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
 
import java.math.BigDecimal;
45,7 → 46,7
Set<SQLRowAccessor> facture = new HashSet<SQLRowAccessor>();
facture.add(row);
for (SQLRowAccessor sqlRowAccessor : rows) {
total += getPreviousAcompte(sqlRowAccessor.getForeign("ID_COMMANDE_CLIENT"), facture, c);
total += getPreviousAcompte(sqlRowAccessor.getForeign("ID_COMMANDE_CLIENT"), facture, c, row);
}
 
return new BigDecimal(total).movePointLeft(2);
56,7 → 57,7
SpreadSheetCellValueProviderManager.put("sales.account.total.ttc", new TotalAcompteProvider(TypeTotalAcompteProvider.TTC));
}
 
public long getPreviousAcompte(SQLRowAccessor sqlRowAccessor, Set<SQLRowAccessor> alreadyAdded, Calendar c) {
public long getPreviousAcompte(SQLRowAccessor sqlRowAccessor, Set<SQLRowAccessor> alreadyAdded, Calendar c, SQLRowAccessor origin) {
if (sqlRowAccessor == null || sqlRowAccessor.isUndefined()) {
return 0L;
}
65,7 → 66,8
for (SQLRowAccessor sqlRowAccessor2 : rows) {
SQLRowAccessor rowFact = sqlRowAccessor2.getForeign("ID_SAISIE_VENTE_FACTURE");
 
if (rowFact != null && !rowFact.isUndefined() && !alreadyAdded.contains(rowFact) && rowFact.getDate("DATE").before(c)) {
if (rowFact != null && !rowFact.isUndefined() && !alreadyAdded.contains(rowFact)
&& (rowFact.getDate("DATE").before(c) || (rowFact.getDate("DATE").equals(c) && rowFact.getID() < origin.getID()))) {
alreadyAdded.add(rowFact);
l += this.type == TypeTotalAcompteProvider.HT ? rowFact.getLong("T_HT") : rowFact.getLong("T_TTC");
}
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/PaiementRemainedDevisProvider.java
New file
0,0 → 1,46
/*
* 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.SpreadSheetCellValueProvider;
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProviderManager;
import org.openconcerto.sql.model.SQLRowAccessor;
 
import java.math.BigDecimal;
 
public class PaiementRemainedDevisProvider implements SpreadSheetCellValueProvider {
 
private PaiementRemainedDevisProvider() {
}
 
public Object getValue(SpreadSheetCellValueContext context) {
SQLRowAccessor row = context.getRow();
return getRestant(row);
}
 
public static void register() {
SpreadSheetCellValueProviderManager.put("quote.payment.remained", new PaiementRemainedDevisProvider());
}
 
private BigDecimal getRestant(SQLRowAccessor r) {
long acompte = r.getLong("T_ACOMPTE");
long ttc = r.getLong("T_TTC");
 
long total = ttc - acompte;
 
return new BigDecimal(total).movePointLeft(2);
}
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/OOgenerationListeXML.java
60,7 → 60,7
try {
InputStream xmlConfiguration = TemplateManager.getInstance().getTemplateConfiguration(templateId, rowLanguage != null ? rowLanguage.getString("CHEMIN") : null, null);
if (xmlConfiguration == null) {
throw new IllegalStateException("Template configuration " + templateId + " not found");
throw new IllegalStateException("Template configuration " + templateId + " not found (" + TemplateManager.getInstance().getClass().getName() + ")");
}
Document doc = builder.build(xmlConfiguration);
 
70,7 → 70,9
 
// Création et génération du fichier OO
final InputStream template = TemplateManager.getInstance().getTemplate(templateId, rowLanguage != null ? rowLanguage.getString("CHEMIN") : null, null);
 
if (template == null) {
throw new IllegalStateException("Template " + templateId + " not found (" + TemplateManager.getInstance().getClass().getName() + ")");
}
final SpreadSheet spreadSheet = new ODPackage(template).getSpreadSheet();
Sheet sheet0 = spreadSheet.getSheet(0);
if (sheetName != null && sheetName.size() > 0) {
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/SheetXml.java
455,7 → 455,7
 
if (!Boolean.getBoolean("org.openconcerto.oo.useODSViewer")) {
final Component doc = ComptaPropsConfiguration.getOOConnexion().loadDocument(f, true);
doc.printDocument();
doc.printDocument(job);
doc.close();
} else {
// Load the spreadsheet.
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/gestcomm/EtatVentesXmlSheet.java
25,10 → 25,13
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.SQLSelectJoin;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.Where;
import org.openconcerto.utils.Tuple2;
 
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
58,10 → 61,12
public static final String TEMPLATE_PROPERTY_NAME = DEFAULT_PROPERTY_NAME;
 
private Timestamp du, au;
public boolean ticketCaisse = false;
 
public EtatVentesXmlSheet(Date du, Date au) {
public EtatVentesXmlSheet(Date du, Date au, boolean ticketCaisse) {
super();
this.printer = PrinterNXProps.getInstance().getStringProperty("BonPrinter");
this.ticketCaisse = ticketCaisse;
if (du != null) {
final Calendar c1 = Calendar.getInstance();
c1.setTime(du);
101,6 → 106,8
}
 
protected void createListeValues() {
Map<Integer, Tuple2<BigDecimal, BigDecimal>> mapTVAVT = new HashMap<Integer, Tuple2<BigDecimal, BigDecimal>>();
Map<Integer, Tuple2<BigDecimal, BigDecimal>> mapTVAHA = new HashMap<Integer, Tuple2<BigDecimal, BigDecimal>>();
final SQLElementDirectory directory = Configuration.getInstance().getDirectory();
final SQLElement eltVenteFacutreElement = directory.getElement("SAISIE_VENTE_FACTURE_ELEMENT");
final SQLElement eltVenteFacture = directory.getElement("SAISIE_VENTE_FACTURE");
110,19 → 117,38
final SQLTable tableModeReglement = eltModeReglement.getTable();
final SQLTable tableFactureElement = eltVenteFacutreElement.getTable();
final SQLTable tableFacture = eltVenteFacture.getTable();
BigDecimal totalTPVTTC = BigDecimal.ZERO;
BigDecimal totalTPA = BigDecimal.ZERO;
 
// Liste des valeurs de la feuille OO
ArrayList<Map<String, Object>> listValues = new ArrayList<Map<String, Object>>();
Map<Integer, String> style = styleAllSheetValues.get(0);
if (style == null) {
style = new HashMap<Integer, String>();
styleAllSheetValues.put(0, style);
}
 
// Ventes
{
 
final AliasedTable tableModeReglement1 = new AliasedTable(tableModeReglement, MODE1);
final AliasedTable tableModeReglement2 = new AliasedTable(tableModeReglement, MODE2);
final AliasedTable tableTicket = new AliasedTable(eltTicketCaisse.getTable(), "ticket");
 
// Requete Pour obtenir les quantités pour chaque type de réglement
SQLSelect sel = new SQLSelect(Configuration.getInstance().getBase());
SQLSelect sel = new SQLSelect();
 
sel.addSelect(tableFactureElement.getField("CODE"));
sel.addSelect(tableFactureElement.getField("NOM"));
sel.addSelect(tableFactureElement.getField("ID_ARTICLE"));
sel.addSelect(tableFactureElement.getField("ID_TAXE"));
 
// Elements assosciés à une facture
Where w = new Where(tableFactureElement.getField("ID_TICKET_CAISSE"), "=", tableTicket.getTable().getUndefinedID());
sel.addJoin("LEFT", tableFactureElement.getField("ID_SAISIE_VENTE_FACTURE")).setWhere(w);
SQLSelectJoin joinArt = sel.addJoin("LEFT", tableFactureElement.getField("ID_ARTICLE"));
SQLSelectJoin joinFamArt = sel.addJoin("LEFT", joinArt.getJoinedTable().getField("ID_FAMILLE_ARTICLE"));
sel.addSelect(joinFamArt.getJoinedTable().getField("NOM"));
 
// Elements associés à un ticket de caisse
Where w2 = new Where(tableFactureElement.getField("ID_SAISIE_VENTE_FACTURE"), "=", 1);
142,16 → 168,23
 
Where w3 = new Where(tableTicket.getField("DATE"), this.du, this.au);
Where w4 = new Where(tableFacture.getField("DATE"), this.du, this.au);
Where wN = new Where(tableFactureElement.getField("NIVEAU"), "=", 1);
if (this.du != null && this.au != null) {
sel.setWhere(w3.or(w4));
sel.setWhere(w3.or(w4).and(wN));
} else {
sel.setWhere(wN);
}
// FIXME traiter le cas du!=null et au==null et vice versa
sel.addGroupBy(tableFactureElement.getField("NOM"));
sel.addGroupBy(tableFactureElement.getField("CODE"));
sel.addGroupBy(tableFactureElement.getField("ID_ARTICLE"));
sel.addGroupBy(tableFactureElement.getField("ID_TAXE"));
sel.addGroupBy(joinFamArt.getJoinedTable().getField("NOM"));
sel.addFieldOrder(joinFamArt.getJoinedTable().getField("NOM"));
System.err.println(sel.asString());
 
// Requete pour obtenir les quantités vendus
SQLSelect selQte = new SQLSelect(Configuration.getInstance().getBase());
SQLSelect selQte = new SQLSelect();
selQte.addSelect(tableFactureElement.getField("CODE"));
selQte.addSelect(tableFactureElement.getField("NOM"));
selQte.addSelect(tableFactureElement.getField("QTE"), "SUM");
160,15 → 193,27
selQte.addSelect(tableFactureElement.getField("T_PV_TTC"), "SUM");
selQte.addSelect(tableFactureElement.getField("ID_TAXE"));
selQte.addSelect(tableFactureElement.getField("ID_ARTICLE"));
if (!this.ticketCaisse) {
selQte.addJoin("LEFT", tableFactureElement.getField("ID_SAISIE_VENTE_FACTURE")).setWhere(w);
} else {
selQte.addJoin("LEFT", tableFactureElement.getField("ID_SAISIE_VENTE_FACTURE")).setWhere(Where.FALSE);
}
selQte.addJoin("LEFT", tableFactureElement.getField("ID_TICKET_CAISSE"), "ticket").setWhere(w2);
SQLSelectJoin joinArt2 = selQte.addJoin("LEFT", tableFactureElement.getField("ID_ARTICLE"));
SQLSelectJoin joinFamArt2 = selQte.addJoin("LEFT", joinArt2.getJoinedTable().getField("ID_FAMILLE_ARTICLE"));
selQte.addSelect(joinFamArt2.getJoinedTable().getField("NOM"));
// FIXME traiter le cas du!=null et au==null et vice
// versa
if (this.du != null && this.au != null) {
selQte.setWhere(w3.or(w4)); // FIXME traiter le cas du!=null et au==null et vice versa
selQte.setWhere(w3.or(w4).and(wN));
} else {
selQte.setWhere(wN);
}
selQte.addGroupBy(tableFactureElement.getField("NOM"));
selQte.addGroupBy(tableFactureElement.getField("CODE"));
selQte.addGroupBy(tableFactureElement.getField("ID_TAXE"));
selQte.addGroupBy(tableFactureElement.getField("ID_ARTICLE"));
selQte.addGroupBy(joinFamArt2.getJoinedTable().getField("NOM"));
 
List<Object[]> listeQte = (List<Object[]>) Configuration.getInstance().getBase().getDataSource().execute(selQte.asString(), new ArrayListHandler());
 
180,12 → 225,19
Number qteVendu = (Number) sqlRow[2];
Number ha = (Number) sqlRow[3];
Number ht = (Number) sqlRow[4];
Number ttc = (Number) sqlRow[5];
BigDecimal ttc = (BigDecimal) sqlRow[5];
Number tvaID = (Number) sqlRow[6];
if (!mapTVAVT.containsKey(tvaID.intValue())) {
mapTVAVT.put(tvaID.intValue(), Tuple2.create((BigDecimal) ht, ttc));
} else {
Tuple2<BigDecimal, BigDecimal> t = mapTVAVT.get(tvaID.intValue());
mapTVAVT.put(tvaID.intValue(), Tuple2.create(t.get0().add((BigDecimal) ht), t.get1().add(ttc)));
}
Number articleID = (Number) sqlRow[7];
ArticleVendu a = new ArticleVendu(code, nom, qteVendu.intValue(), (BigDecimal) ht, (BigDecimal) ha, (BigDecimal) ttc, tvaID.intValue(),
ArticleVendu a = new ArticleVendu(code, nom, qteVendu.intValue(), (BigDecimal) ht, (BigDecimal) ha, ttc, tvaID.intValue(),
tableFactureElement.getForeignTable("ID_ARTICLE").getRow(articleID.intValue()));
map.put(code + "##" + nom, a);
map.put(articleID + "##" + code + "##" + nom + "##" + tvaID, a);
 
}
 
List<Object[]> listeIds = (List<Object[]>) Configuration.getInstance().getBase().getDataSource().execute(sel.asString(), new ArrayListHandler());
194,19 → 246,35
return;
}
 
// Liste des valeurs de la feuille OO
ArrayList<Map<String, Object>> listValues = new ArrayList<Map<String, Object>>(listeIds.size());
String famille = null;
 
BigDecimal totalTPA = BigDecimal.ZERO;
BigDecimal totalTPVTTC = BigDecimal.ZERO;
 
for (Object[] obj : listeIds) {
final Object valueFam = obj[4];
if ((valueFam == null && famille == null) || (famille != null && !famille.equalsIgnoreCase("Non classés") && (valueFam == null || valueFam.toString().trim().length() == 0))) {
famille = "Non classés";
Map<String, Object> mValues = new HashMap<String, Object>();
mValues.put("NOM", famille);
style.put(listValues.size(), "Titre 1");
listValues.add(mValues);
} else if (valueFam != null && !valueFam.toString().equalsIgnoreCase(famille)) {
famille = valueFam.toString();
Map<String, Object> mValues = new HashMap<String, Object>();
mValues.put("NOM", famille);
style.put(listValues.size(), "Titre 1");
listValues.add(mValues);
}
 
Map<String, Object> mValues = new HashMap<String, Object>();
 
String code = (String) obj[0];
String nom = (String) obj[1];
ArticleVendu a = map.get(code + "##" + nom);
 
Number articleID = (Number) obj[2];
Number taxeID = (Number) obj[3];
ArticleVendu a = map.get(articleID + "##" + code + "##" + nom + "##" + taxeID);
if (a == null) {
System.err.println("Aucune correspondance pour l'article " + articleID + "##" + code + "##" + nom + "##" + taxeID);
}
if (a != null && a.ttc != null && (a.ttc.signum() != 0 || (articleID != null && articleID.intValue() > 1))) {
mValues.put("CODE", code);
mValues.put("NOM", nom);
mValues.put("QTE", a.qte);
215,22 → 283,26
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]);
mValues.put("NB_ESPECES", obj[4]);
mValues.put("NB_CHEQUE", obj[5]);
mValues.put("NB_CB", obj[6]);
mValues.put("NB_ESPECES", obj[7]);
mValues.put("FAMILLE", valueFam);
totalTPA = totalTPA.add(a.ha);
totalTPVTTC = totalTPVTTC.add(a.ttc);
style.put(listValues.size(), "Normal");
listValues.add(mValues);
}
// System.out.println("EtatVentesXmlSheet.createListeValues():" + listValues);
}
 
}
// Liste des ventes comptoirs
final SQLTable venteComptoirT = directory.getElement("SAISIE_VENTE_COMPTOIR").getTable();
SQLSelect selVC = new SQLSelect(venteComptoirT.getBase());
SQLSelect selVC = new SQLSelect();
selVC.addSelect(venteComptoirT.getField("NOM"));
selVC.addSelect(venteComptoirT.getField("MONTANT_HT"), "SUM");
selVC.addSelect(venteComptoirT.getField("MONTANT_TTC"), "SUM");
selVC.addSelect(venteComptoirT.getField("NOM"), "COUNT");
selVC.addSelect(venteComptoirT.getField("ID_TAXE"));
 
if (this.du != null && this.au != null) {
Where wVC = new Where(venteComptoirT.getField("DATE"), this.du, this.au);
241,6 → 313,7
}
// FIXME traiter le cas du!=null et au==null et vice versa
selVC.addGroupBy(venteComptoirT.getField("NOM"));
selVC.addGroupBy(venteComptoirT.getField("ID_TAXE"));
List<Object[]> listVC = (List<Object[]>) venteComptoirT.getDBSystemRoot().getDataSource().execute(selVC.asString(), new ArrayListHandler());
long totalVCInCents = 0;
if (listVC.size() > 0) {
254,14 → 327,9
} else {
mValues2.put("NOM", "VENTE COMPTOIR");
}
Map<Integer, String> style = styleAllSheetValues.get(0);
if (style == null) {
style = new HashMap<Integer, String>();
}
 
style.put(listValues.size(), "Titre 1");
 
styleAllSheetValues.put(0, style);
listValues.add(mValues2);
 
}
270,49 → 338,240
// Nom
mValues.put("NOM", rowVenteComptoir[0]);
// HT
mValues.put("T_PV_HT", ((Number) rowVenteComptoir[1]).longValue() / 100.0D);
final long ht = ((Number) rowVenteComptoir[1]).longValue();
mValues.put("T_PV_HT", ht / 100.0D);
// TTC
final long ttcInCents = ((Number) rowVenteComptoir[2]).longValue();
mValues.put("T_PV_TTC", ttcInCents / 100.0D);
totalVCInCents += ttcInCents;
 
final Integer idTaxe = ((Number) rowVenteComptoir[4]).intValue();
mValues.put("ID_TAXE", idTaxe);
if (!mapTVAVT.containsKey(idTaxe)) {
mapTVAVT.put(idTaxe, Tuple2.create(new BigDecimal(ht).movePointLeft(2), new BigDecimal(ttcInCents).movePointLeft(2)));
} else {
Tuple2<BigDecimal, BigDecimal> t = mapTVAVT.get(idTaxe);
mapTVAVT.put(idTaxe, Tuple2.create(t.get0().add(new BigDecimal(ht).movePointLeft(2)), t.get1().add(new BigDecimal(ttcInCents).movePointLeft(2))));
}
 
// Quantité
mValues.put("QTE", rowVenteComptoir[3]);
listValues.add(mValues);
}
// Avoir
{
 
SQLTable tableAvoirElement = directory.getElement("AVOIR_CLIENT_ELEMENT").getTable();
 
// Requete Pour obtenir les quantités pour chaque type de réglement
SQLSelect sel = new SQLSelect();
 
sel.addSelect(tableAvoirElement.getField("CODE"));
sel.addSelect(tableAvoirElement.getField("NOM"));
sel.addSelect(tableAvoirElement.getField("ID_ARTICLE"));
sel.addSelect(tableAvoirElement.getField("ID_TAXE"));
 
// Elements assosciés à une facture
sel.addJoin("LEFT", tableAvoirElement.getField("ID_AVOIR_CLIENT"));
SQLSelectJoin joinArt = sel.addJoin("LEFT", tableAvoirElement.getField("ID_ARTICLE"));
SQLSelectJoin joinFamArt = sel.addJoin("LEFT", joinArt.getJoinedTable().getField("ID_FAMILLE_ARTICLE"));
sel.addSelect(joinFamArt.getJoinedTable().getField("NOM"));
 
Where w4 = new Where(tableAvoirElement.getTable("AVOIR_CLIENT").getField("DATE"), this.du, this.au);
Where wN = new Where(tableAvoirElement.getField("NIVEAU"), "=", 1);
if (this.du != null && this.au != null) {
sel.setWhere(w4.and(wN));
} else {
sel.setWhere(wN);
}
// FIXME traiter le cas du!=null et au==null et vice versa
sel.addGroupBy(tableAvoirElement.getField("NOM"));
sel.addGroupBy(tableAvoirElement.getField("CODE"));
sel.addGroupBy(tableAvoirElement.getField("ID_ARTICLE"));
sel.addGroupBy(tableAvoirElement.getField("ID_TAXE"));
sel.addGroupBy(joinFamArt.getJoinedTable().getField("NOM"));
sel.addFieldOrder(joinFamArt.getJoinedTable().getField("NOM"));
System.err.println(sel.asString());
 
// Requete pour obtenir les quantités vendus
SQLSelect selQte = new SQLSelect();
selQte.addSelect(tableAvoirElement.getField("CODE"));
selQte.addSelect(tableAvoirElement.getField("NOM"));
selQte.addSelect(tableAvoirElement.getField("QTE"), "SUM");
selQte.addSelect(tableAvoirElement.getField("T_PA_HT"), "SUM");
selQte.addSelect(tableAvoirElement.getField("T_PV_HT"), "SUM");
selQte.addSelect(tableAvoirElement.getField("T_PV_TTC"), "SUM");
selQte.addSelect(tableAvoirElement.getField("ID_TAXE"));
selQte.addSelect(tableAvoirElement.getField("ID_ARTICLE"));
selQte.addJoin("LEFT", tableAvoirElement.getField("ID_AVOIR_CLIENT"));
SQLSelectJoin joinArt2 = selQte.addJoin("LEFT", tableAvoirElement.getField("ID_ARTICLE"));
SQLSelectJoin joinFamArt2 = selQte.addJoin("LEFT", joinArt2.getJoinedTable().getField("ID_FAMILLE_ARTICLE"));
selQte.addSelect(joinFamArt2.getJoinedTable().getField("NOM"));
// FIXME traiter le cas du!=null et au==null et vice
// versa
if (this.du != null && this.au != null) {
selQte.setWhere(w4.and(wN));
} else {
selQte.setWhere(wN);
}
selQte.addGroupBy(tableAvoirElement.getField("NOM"));
selQte.addGroupBy(tableAvoirElement.getField("CODE"));
selQte.addGroupBy(tableAvoirElement.getField("ID_TAXE"));
selQte.addGroupBy(tableAvoirElement.getField("ID_ARTICLE"));
selQte.addGroupBy(joinFamArt2.getJoinedTable().getField("NOM"));
 
List<Object[]> listeQte = (List<Object[]>) Configuration.getInstance().getBase().getDataSource().execute(selQte.asString(), new ArrayListHandler());
 
// Récupération des quantités et des montant totaux pour chaque article
Map<String, ArticleVendu> map = new HashMap<String, ArticleVendu>();
for (Object[] sqlRow : listeQte) {
String code = (String) sqlRow[0];
String nom = (String) sqlRow[1];
Number qteVendu = (Number) sqlRow[2];
Number ha = (Number) sqlRow[3];
Number ht = (Number) sqlRow[4];
BigDecimal ttc = (BigDecimal) sqlRow[5];
Number tvaID = (Number) sqlRow[6];
if (!mapTVAVT.containsKey(tvaID.intValue())) {
mapTVAVT.put(tvaID.intValue(), Tuple2.create(((BigDecimal) ht).negate(), ttc.negate()));
} else {
Tuple2<BigDecimal, BigDecimal> t = mapTVAVT.get(tvaID.intValue());
mapTVAVT.put(tvaID.intValue(), Tuple2.create(t.get0().subtract((BigDecimal) ht), t.get1().subtract(ttc)));
}
Number articleID = (Number) sqlRow[7];
ArticleVendu a = new ArticleVendu(code, nom, -qteVendu.intValue(), ((BigDecimal) ht).negate(), ((BigDecimal) ha).negate(), ttc.negate(), tvaID.intValue(),
tableFactureElement.getForeignTable("ID_ARTICLE").getRow(articleID.intValue()));
map.put(articleID + "##" + code + "##" + nom + "##" + tvaID, a);
 
}
 
List<Object[]> listeIds = (List<Object[]>) Configuration.getInstance().getBase().getDataSource().execute(sel.asString(), new ArrayListHandler());
 
if (listeIds == null) {
return;
}
 
Map<String, Object> mValuesA = new HashMap<String, Object>();
mValuesA.put("NOM", "AVOIRS");
style.put(listValues.size(), "Titre 1");
listValues.add(mValuesA);
 
for (Object[] obj : listeIds) {
final Object valueFam = obj[4];
 
Map<String, Object> mValues = new HashMap<String, Object>();
 
String code = (String) obj[0];
String nom = (String) obj[1];
Number articleID = (Number) obj[2];
Number taxeID = (Number) obj[3];
ArticleVendu a = map.get(articleID + "##" + code + "##" + nom + "##" + taxeID);
if (a.ttc != null && a.ttc.signum() != 0) {
mValues.put("CODE", code);
mValues.put("NOM", nom);
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("FAMILLE", valueFam);
totalTPA = totalTPA.add(a.ha);
totalTPVTTC = totalTPVTTC.add(a.ttc);
style.put(listValues.size(), "Normal");
listValues.add(mValues);
}
// System.out.println("EtatVentesXmlSheet.createListeValues():" + listValues);
}
}
totalTPVTTC = totalTPVTTC.add(new BigDecimal(totalVCInCents).movePointLeft(2));
 
// Liste des Achats
final ArrayList<Map<String, Object>> listValuesAchat = new ArrayList<Map<String, Object>>(listeIds.size());
final ArrayList<Map<String, Object>> listValuesAchat = new ArrayList<Map<String, Object>>();
Map<String, Object> valuesAchat = this.mapAllSheetValues.get(1);
if (valuesAchat == null) {
valuesAchat = new HashMap<String, Object>();
}
// Saisie Achat
long totalAchatInCents = 0;
{
final SQLElement eltAchat = directory.getElement("SAISIE_ACHAT");
final SQLTable tableAchat = eltAchat.getTable();
final SQLSelect selAchat = new SQLSelect(Configuration.getInstance().getBase());
final SQLSelect selAchat = new SQLSelect();
 
selAchat.addSelect(tableAchat.getField("NOM"));
selAchat.addSelect(tableAchat.getField("MONTANT_HT"), "SUM");
selAchat.addSelect(tableAchat.getField("MONTANT_TTC"), "SUM");
selAchat.addSelect(tableAchat.getField("ID_TAXE"));
final Where wHA = new Where(tableAchat.getField("DATE"), this.du, this.au);
selAchat.setWhere(wHA);
selAchat.addGroupBy(tableAchat.getField("NOM"));
selAchat.addGroupBy(tableAchat.getField("ID_TAXE"));
List<Object[]> listAchat = (List<Object[]>) Configuration.getInstance().getBase().getDataSource().execute(selAchat.asString(), new ArrayListHandler());
 
long totalAchatInCents = 0;
 
for (Object[] row : listAchat) {
Map<String, Object> mValues = new HashMap<String, Object>();
mValues.put("NOM", row[0]);
final Integer tvaID = ((Number) row[3]).intValue();
mValues.put("TAXE", tvaID);
long ht = ((Number) row[1]).longValue();
long pA = ((Number) row[2]).longValue();
if (!mapTVAHA.containsKey(tvaID.intValue())) {
mapTVAHA.put(tvaID.intValue(), Tuple2.create(new BigDecimal(ht).movePointLeft(2), new BigDecimal(pA).movePointLeft(2)));
} else {
Tuple2<BigDecimal, BigDecimal> t = mapTVAHA.get(tvaID.intValue());
mapTVAHA.put(tvaID.intValue(), Tuple2.create(t.get0().add(new BigDecimal(ht).movePointLeft(2)), t.get1().add(new BigDecimal(pA).movePointLeft(2))));
}
mValues.put("T_PV_HT", -ht / 100.0D);
mValues.put("T_PV_TTC", -pA / 100.0D);
totalAchatInCents -= pA;
listValuesAchat.add(mValues);
}
}
// Facture Fournisseur
{
final SQLElement eltFactElt = directory.getElement("FACTURE_FOURNISSEUR_ELEMENT");
final SQLTable tableFactElt = eltFactElt.getTable();
final SQLTable tableFactF = eltFactElt.getTable().getForeignTable("ID_FACTURE_FOURNISSEUR");
final SQLSelect selAchat = new SQLSelect();
selAchat.addSelect(tableFactElt.getField("ID_ARTICLE"));
selAchat.addSelect(tableFactElt.getField("CODE"));
selAchat.addSelect(tableFactElt.getField("NOM"));
selAchat.addSelect(tableFactElt.getField("T_PA_HT"), "SUM");
selAchat.addSelect(tableFactElt.getField("T_PA_TTC"), "SUM");
selAchat.addSelect(tableFactElt.getField("ID_TAXE"));
selAchat.addSelect(tableFactElt.getField("QTE"), "SUM");
selAchat.addJoin("LEFT", tableFactElt.getField("ID_FACTURE_FOURNISSEUR"));
selAchat.addGroupBy(tableFactElt.getField("ID_ARTICLE"));
selAchat.addGroupBy(tableFactElt.getField("CODE"));
selAchat.addGroupBy(tableFactElt.getField("NOM"));
selAchat.addGroupBy(tableFactElt.getField("ID_TAXE"));
 
totalTPVTTC = totalTPVTTC.add(new BigDecimal(totalVCInCents).movePointLeft(2));
Where wFactF = new Where(tableFactF.getField("DATE"), this.du, this.au);
selAchat.setWhere(wFactF.and(new Where(tableFactElt.getField("NIVEAU"), "=", 1)));
List<Object[]> listAchat = (List<Object[]>) Configuration.getInstance().getBase().getDataSource().execute(selAchat.asString(), new ArrayListHandler());
 
for (Object[] row : listAchat) {
Map<String, Object> mValues = new HashMap<String, Object>();
mValues.put("NOM", row[2]);
final Integer tvaID = ((Number) row[5]).intValue();
mValues.put("TAXE", tvaID);
BigDecimal ht = ((BigDecimal) row[3]);
BigDecimal pA = ((BigDecimal) row[4]);
if (!mapTVAHA.containsKey(tvaID.intValue())) {
mapTVAHA.put(tvaID.intValue(), Tuple2.create(ht, pA));
} else {
Tuple2<BigDecimal, BigDecimal> t = mapTVAHA.get(tvaID.intValue());
mapTVAHA.put(tvaID.intValue(), Tuple2.create(t.get0().add(ht), t.get1().add(pA)));
}
mValues.put("T_PV_HT", ht.negate());
mValues.put("T_PV_TTC", pA.negate());
mValues.put("QTE", row[6]);
totalAchatInCents -= pA.movePointRight(2).setScale(0, RoundingMode.HALF_UP).longValue();
listValuesAchat.add(mValues);
}
}
 
// Récapitulatif
Map<String, Object> valuesE = this.mapAllSheetValues.get(2);
if (valuesE == null) {
321,7 → 580,7
SQLElement eltE = directory.getElement("ENCAISSER_MONTANT");
SQLElement eltM = directory.getElement("MODE_REGLEMENT");
SQLElement eltT = directory.getElement("TYPE_REGLEMENT");
SQLSelect selE = new SQLSelect(Configuration.getInstance().getBase());
SQLSelect selE = new SQLSelect();
selE.addSelect(eltT.getTable().getField("NOM"));
selE.addSelect(eltT.getTable().getField("NOM"), "COUNT");
selE.addSelect(eltE.getTable().getField("MONTANT"), "SUM");
332,7 → 591,7
selE.addGroupBy(eltT.getTable().getField("NOM"));
selE.addFieldOrder(eltT.getTable().getField("NOM"));
List<Object[]> listE = (List<Object[]>) Configuration.getInstance().getBase().getDataSource().execute(selE.asString(), new ArrayListHandler());
ArrayList<Map<String, Object>> listValuesE = new ArrayList<Map<String, Object>>(listeIds.size());
ArrayList<Map<String, Object>> listValuesE = new ArrayList<Map<String, Object>>();
long totalEInCents = 0;
 
for (Object[] o : listE) {
374,6 → 633,12
values.put("DATE", periode);
valuesAchat.put("DATE", periode);
valuesE.put("DATE", periode);
 
Map<String, Object> valuesTotalVT = new HashMap<String, Object>();
valuesTotalVT.put("T_MARGE", "Total");
valuesTotalVT.put("T_PV_TTC", totalTPVTTC);
style.put(listValues.size(), "Titre 2");
listValues.add(valuesTotalVT);
System.err.println(this.du);
System.err.println(this.au);
this.listAllSheetValues.put(0, listValues);
385,8 → 650,71
this.listAllSheetValues.put(2, listValuesE);
this.mapAllSheetValues.put(2, valuesE);
 
// Recap TVA
Map<Integer, String> styleTVA = styleAllSheetValues.get(3);
if (styleTVA == null) {
styleTVA = new HashMap<Integer, String>();
styleAllSheetValues.put(3, styleTVA);
}
ArrayList<Map<String, Object>> listValuesTVA = new ArrayList<Map<String, Object>>();
BigDecimal totalHT = BigDecimal.ZERO;
BigDecimal totalTTC = BigDecimal.ZERO;
BigDecimal totalHTHA = BigDecimal.ZERO;
BigDecimal totalTTCHA = BigDecimal.ZERO;
for (Integer idTaxe : mapTVAVT.keySet()) {
Map<String, Object> vals = new HashMap<String, Object>();
vals.put("VT_TAUX_TVA", TaxeCache.getCache().getTauxFromId(idTaxe));
BigDecimal ht = mapTVAVT.get(idTaxe).get0();
BigDecimal ttc = mapTVAVT.get(idTaxe).get1();
totalHT = totalHT.add(ht);
totalTTC = totalTTC.add(ttc);
vals.put("VT_HT", ht);
vals.put("VT_TVA", ttc.subtract(ht));
vals.put("VT_TTC", ttc);
if (mapTVAHA.containsKey(idTaxe)) {
BigDecimal haht = mapTVAHA.get(idTaxe).get0();
BigDecimal hattc = mapTVAHA.get(idTaxe).get1();
vals.put("HA_HT", haht);
vals.put("HA_TVA", hattc.subtract(haht));
vals.put("HA_TTC", hattc);
totalHTHA = totalHTHA.add(haht);
totalTTCHA = totalTTCHA.add(hattc);
mapTVAHA.remove(idTaxe);
}
styleTVA.put(listValuesTVA.size(), "Normal");
listValuesTVA.add(vals);
}
for (Integer idTaxe : mapTVAHA.keySet()) {
Map<String, Object> vals = new HashMap<String, Object>();
BigDecimal haht = mapTVAHA.get(idTaxe).get0();
BigDecimal hattc = mapTVAHA.get(idTaxe).get1();
vals.put("VT_TAUX_TVA", TaxeCache.getCache().getTauxFromId(idTaxe));
vals.put("HA_HT", haht);
vals.put("HA_TVA", hattc.subtract(haht));
vals.put("HA_TTC", hattc);
totalHTHA = totalHTHA.add(haht);
totalTTCHA = totalTTCHA.add(hattc);
styleTVA.put(listValuesTVA.size(), "Normal");
listValuesTVA.add(vals);
}
Map<String, Object> vals = new HashMap<String, Object>();
vals.put("VT_TAUX_TVA", "Total");
vals.put("VT_HT", totalHT);
vals.put("VT_TVA", totalTTC.subtract(totalHT));
vals.put("VT_TTC", totalTTC);
vals.put("HA_HT", totalHTHA);
vals.put("HA_TVA", totalTTCHA.subtract(totalHTHA));
vals.put("HA_TTC", totalTTCHA);
styleTVA.put(listValuesTVA.size(), "Titre 1");
listValuesTVA.add(vals);
 
Map<String, Object> valuesTVA = new HashMap<String, Object>();
valuesTVA.put("TOTAL_TVA", totalTTC.subtract(totalHT).subtract(totalTTCHA.subtract(totalHTHA)));
this.listAllSheetValues.put(3, listValuesTVA);
valuesTVA.put("DATE", periode);
this.mapAllSheetValues.put(3, valuesTVA);
}
 
public static SQLRow rowDefaultCptService, rowDefaultCptProduit;
static {
final SQLTable tablePrefCompte = Configuration.getInstance().getRoot().findTable("PREFS_COMPTE");
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtSaisieKm.java
41,10 → 41,10
this.date = (Date) saisieRow.getObject("DATE");
final String labelSaisie = saisieRow.getObject("NOM").toString();
this.nom = labelSaisie;
this.mEcritures.put("DATE", this.date);
this.mEcritures.put("NOM", this.nom);
this.mEcritures.put("ID_JOURNAL", saisieRow.getObject("ID_JOURNAL"));
this.mEcritures.put("ID_MOUVEMENT", new Integer(1));
this.putValue("DATE", this.date);
this.putValue("NOM", this.nom);
this.putValue("ID_JOURNAL", saisieRow.getObject("ID_JOURNAL"));
this.putValue("ID_MOUVEMENT", new Integer(1));
 
// on calcule le nouveau numero de mouvement
getNewMouvement(GenerationMvtSaisieKm.source, this.idSaisieKm, 1, (labelSaisie.length() == 0 ? "Saisie au km " : labelSaisie));
60,12 → 60,12
int idCpt = ComptePCESQLElement.getId(rowElement.getString("NUMERO"), rowElement.getString("NOM"));
 
// Ajout de l'écriture
this.mEcritures.put("ID_COMPTE_PCE", new Integer(idCpt));
this.mEcritures.put("NOM", rowElement.getString("NOM_ECRITURE"));
this.mEcritures.put("DEBIT", rowElement.getObject("DEBIT"));
this.mEcritures.put("CREDIT", rowElement.getObject("CREDIT"));
this.putValue("ID_COMPTE_PCE", new Integer(idCpt));
this.putValue("NOM", rowElement.getString("NOM_ECRITURE"));
this.putValue("DEBIT", rowElement.getObject("DEBIT"));
this.putValue("CREDIT", rowElement.getObject("CREDIT"));
if (tableElt.contains("NOM_PIECE")) {
this.mEcritures.put("NOM_PIECE", rowElement.getObject("NOM_PIECE"));
this.putValue("NOM_PIECE", rowElement.getObject("NOM_PIECE"));
}
SQLRow rowEcr = ajoutEcriture();
 
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtTicketCaisse.java
67,16 → 67,16
// iniatilisation des valeurs de la map
GenerationMvtTicketCaisse.this.date = GenerationMvtTicketCaisse.this.rowTicket.getDate("DATE").getTime();
GenerationMvtTicketCaisse.this.nom = "Ticket " + GenerationMvtTicketCaisse.this.rowTicket.getString("NUMERO");
GenerationMvtTicketCaisse.this.mEcritures.put("DATE", GenerationMvtTicketCaisse.this.date);
GenerationMvtTicketCaisse.this.mEcritures.put("NOM", GenerationMvtTicketCaisse.this.nom);
GenerationMvtTicketCaisse.this.mEcritures.put("ID_JOURNAL", GenerationMvtSaisieVenteFacture.journal);
GenerationMvtTicketCaisse.this.mEcritures.put("ID_MOUVEMENT", Integer.valueOf(1));
GenerationMvtTicketCaisse.this.putValue("DATE", GenerationMvtTicketCaisse.this.date);
GenerationMvtTicketCaisse.this.putValue("NOM", GenerationMvtTicketCaisse.this.nom);
GenerationMvtTicketCaisse.this.putValue("ID_JOURNAL", GenerationMvtSaisieVenteFacture.journal);
GenerationMvtTicketCaisse.this.putValue("ID_MOUVEMENT", Integer.valueOf(1));
 
// on calcule le nouveau numero de mouvement
if (GenerationMvtTicketCaisse.this.idMvt == 1) {
getNewMouvement(GenerationMvtTicketCaisse.source, GenerationMvtTicketCaisse.this.rowTicket.getID(), 1, GenerationMvtTicketCaisse.this.nom);
} else {
GenerationMvtTicketCaisse.this.mEcritures.put("ID_MOUVEMENT", Integer.valueOf(GenerationMvtTicketCaisse.this.idMvt));
GenerationMvtTicketCaisse.this.putValue("ID_MOUVEMENT", Integer.valueOf(GenerationMvtTicketCaisse.this.idMvt));
}
 
TotalCalculator calc = getValuesFromElement(rowTicket, rowTicket.getTable().getTable("SAISIE_VENTE_FACTURE_ELEMENT"), BigDecimal.ZERO, null, null);
87,9 → 87,9
for (SQLRowAccessor row : calc.getMapHt().keySet()) {
long b = calc.getMapHt().get(row).setScale(2, RoundingMode.HALF_UP).movePointRight(2).longValue();
if (b != 0) {
GenerationMvtTicketCaisse.this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(row.getID()));
GenerationMvtTicketCaisse.this.mEcritures.put("DEBIT", Long.valueOf(0));
GenerationMvtTicketCaisse.this.mEcritures.put("CREDIT", Long.valueOf(b));
GenerationMvtTicketCaisse.this.putValue("ID_COMPTE_PCE", Integer.valueOf(row.getID()));
GenerationMvtTicketCaisse.this.putValue("DEBIT", Long.valueOf(0));
GenerationMvtTicketCaisse.this.putValue("CREDIT", Long.valueOf(b));
ajoutEcriture();
}
}
99,9 → 99,9
for (SQLRowAccessor rowAc : tvaMap.keySet()) {
long longValue = tvaMap.get(rowAc).setScale(2, RoundingMode.HALF_UP).movePointRight(2).longValue();
if (longValue != 0) {
GenerationMvtTicketCaisse.this.mEcritures.put("ID_COMPTE_PCE", rowAc.getID());
GenerationMvtTicketCaisse.this.mEcritures.put("DEBIT", Long.valueOf(0));
GenerationMvtTicketCaisse.this.mEcritures.put("CREDIT", longValue);
GenerationMvtTicketCaisse.this.putValue("ID_COMPTE_PCE", rowAc.getID());
GenerationMvtTicketCaisse.this.putValue("DEBIT", Long.valueOf(0));
GenerationMvtTicketCaisse.this.putValue("CREDIT", longValue);
ajoutEcriture();
}
}
118,9 → 118,9
}
}
}
GenerationMvtTicketCaisse.this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idCompteClient));
GenerationMvtTicketCaisse.this.mEcritures.put("DEBIT", ttcLongValue);
GenerationMvtTicketCaisse.this.mEcritures.put("CREDIT", Long.valueOf(0));
GenerationMvtTicketCaisse.this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteClient));
GenerationMvtTicketCaisse.this.putValue("DEBIT", ttcLongValue);
GenerationMvtTicketCaisse.this.putValue("CREDIT", Long.valueOf(0));
ajoutEcriture();
 
return GenerationMvtTicketCaisse.this.idMvt;
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtReglementChequeClient.java
61,15 → 61,15
SQLRow clientRow = base.getTable("CLIENT").getRow(chequeRow.getInt("ID_CLIENT"));
 
// initialisation des valeurs de la map
this.mEcritures.put("DATE", new java.sql.Date(this.date.getTime()));
this.mEcritures.put("NOM", this.nom);
this.mEcritures.put("ID_MOUVEMENT", new Integer(this.idMvt));
this.putValue("DATE", new java.sql.Date(this.date.getTime()));
this.putValue("NOM", this.nom);
this.putValue("ID_MOUVEMENT", new Integer(this.idMvt));
 
if (this.banque == null || this.banque.isUndefined() || this.banque.isForeignEmpty("ID_JOURNAL")) {
fillJournalBanqueFromRow(chequeRow);
} else {
int idJrnl = this.banque.getForeignID("ID_JOURNAL");
this.mEcritures.put("ID_JOURNAL", idJrnl);
this.putValue("ID_JOURNAL", idJrnl);
}
 
setDateReglement(this.idCheque, this.date);
93,16 → 93,16
}
}
 
this.mEcritures.put("ID_COMPTE_PCE", new Integer(idCompteClient));
this.mEcritures.put("DEBIT", new Long(0));
this.mEcritures.put("CREDIT", new Long(this.montant));
this.putValue("ID_COMPTE_PCE", new Integer(idCompteClient));
this.putValue("DEBIT", new Long(0));
this.putValue("CREDIT", new Long(this.montant));
ajoutEcriture();
System.err.println("First ECriture for mvt " + this.idMvt);
 
// compte de reglement cheque, ...
fillCompteBanqueFromRow(chequeRow, "VenteCheque", false);
this.mEcritures.put("DEBIT", new Long(this.montant));
this.mEcritures.put("CREDIT", new Long(0));
this.putValue("DEBIT", new Long(this.montant));
this.putValue("CREDIT", new Long(0));
ajoutEcriture();
System.err.println("Ecritures générées pour le mouvement " + this.idMvt);
 
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtRetourNatexis.java
57,17 → 57,17
 
this.nom = "Retour natexis facture " + rowFacture.getObject("NUMERO").toString();
this.date = new Date();
this.mEcritures.put("DATE", this.date);
this.mEcritures.put("NOM", this.nom);
this.putValue("DATE", this.date);
this.putValue("NOM", this.nom);
 
this.mEcritures.put("ID_JOURNAL", GenerationMvtSaisieVenteFacture.journal);
this.putValue("ID_JOURNAL", GenerationMvtSaisieVenteFacture.journal);
 
int idJrnlFactor = rowPrefsCompte.getInt("ID_JOURNAL_FACTOR");
if (idJrnlFactor > 1) {
this.mEcritures.put("ID_JOURNAL", idJrnlFactor);
this.putValue("ID_JOURNAL", idJrnlFactor);
}
 
this.mEcritures.put("ID_MOUVEMENT", this.idMvt);
this.putValue("ID_MOUVEMENT", this.idMvt);
 
// compte Factor
int idComptefactor = rowPrefsCompte.getInt("ID_COMPTE_PCE_FACTOR");
78,9 → 78,9
}
}
 
this.mEcritures.put("ID_COMPTE_PCE", idComptefactor);
this.mEcritures.put("CREDIT", rowFacture.getObject("T_TTC"));
this.mEcritures.put("DEBIT", Long.valueOf(0));
this.putValue("ID_COMPTE_PCE", idComptefactor);
this.putValue("CREDIT", rowFacture.getObject("T_TTC"));
this.putValue("DEBIT", Long.valueOf(0));
ajoutEcriture();
 
// compte Clients
95,9 → 95,9
}
}
}
this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idCompteClient));
this.mEcritures.put("DEBIT", rowFacture.getObject("T_TTC"));
this.mEcritures.put("CREDIT", Long.valueOf(0));
this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteClient));
this.putValue("DEBIT", rowFacture.getObject("T_TTC"));
this.putValue("CREDIT", Long.valueOf(0));
ajoutEcriture();
 
SQLRowValues rowValsFacture = rowFacture.asRowValues();
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtReglementAvoirChequeClient.java
43,12 → 43,12
// initialisation des valeurs de la map
 
this.nom = "Reglement avoir client par chéque";
this.mEcritures.put("DATE", new java.sql.Date(this.date.getTime()));
this.mEcritures.put("NOM", this.nom);
this.putValue("DATE", new java.sql.Date(this.date.getTime()));
this.putValue("NOM", this.nom);
 
fillJournalBanqueFromRow(chequeAvoirRow);
 
this.mEcritures.put("ID_MOUVEMENT", new Integer(this.idMvt));
this.putValue("ID_MOUVEMENT", new Integer(this.idMvt));
 
// compte Clients
int idCompteClient = clientRow.getInt("ID_COMPTE_PCE");
59,15 → 59,15
}
}
 
this.mEcritures.put("ID_COMPTE_PCE", new Integer(idCompteClient));
this.mEcritures.put("DEBIT", new Long(this.montant));
this.mEcritures.put("CREDIT", new Long(0));
this.putValue("ID_COMPTE_PCE", new Integer(idCompteClient));
this.putValue("DEBIT", new Long(this.montant));
this.putValue("CREDIT", new Long(0));
ajoutEcriture();
 
// compte de reglement cheque, ...
fillCompteBanqueFromRow(chequeAvoirRow, "VenteCheque", false);
this.mEcritures.put("DEBIT", new Long(0));
this.mEcritures.put("CREDIT", new Long(this.montant));
this.putValue("DEBIT", new Long(0));
this.putValue("CREDIT", new Long(this.montant));
ajoutEcriture();
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtSaisieAchat.java
50,12 → 50,12
// iniatilisation des valeurs de la map
this.date = (Date) saisieRow.getObject("DATE");
this.nom = "Achat : " + rowFournisseur.getString("NOM") + " Facture : " + this.saisieRow.getObject("NUMERO_FACTURE").toString() + " " + saisieRow.getObject("NOM").toString();
this.mEcritures.put("DATE", this.date);
this.putValue("DATE", this.date);
AccountingRecordsProvider provider = AccountingRecordsProviderManager.get(ID);
provider.putLabel(saisieRow, this.mEcritures);
 
this.mEcritures.put("ID_JOURNAL", GenerationMvtSaisieAchat.journal);
this.mEcritures.put("ID_MOUVEMENT", new Integer(1));
this.putValue("ID_JOURNAL", GenerationMvtSaisieAchat.journal);
this.putValue("ID_MOUVEMENT", new Integer(1));
 
// Calcul des montants
PrixTTC prixTTC = new PrixTTC(this.saisieRow.getLong("MONTANT_TTC"));
72,7 → 72,7
provider.putPieceLabel(this.saisieRow, rowValsPiece);
rowValsPiece.update();
 
this.mEcritures.put("ID_MOUVEMENT", new Integer(this.idMvt));
this.putValue("ID_MOUVEMENT", new Integer(this.idMvt));
}
 
// generation des ecritures + maj des totaux du compte associe
86,9 → 86,9
idCompteAchat = ComptePCESQLElement.getIdComptePceDefault("Achats");
}
}
this.mEcritures.put("ID_COMPTE_PCE", new Integer(idCompteAchat));
this.mEcritures.put("DEBIT", new Long(prixHT.getLongValue()));
this.mEcritures.put("CREDIT", new Long(0));
this.putValue("ID_COMPTE_PCE", new Integer(idCompteAchat));
this.putValue("DEBIT", new Long(prixHT.getLongValue()));
this.putValue("CREDIT", new Long(0));
SQLRow rowEcr = ajoutEcriture();
 
// addAssocAnalytiqueFromProvider(rowEcr, saisieRow);
112,9 → 112,9
idCompteTVA = rowCptTva.getID();
}
}
this.mEcritures.put("ID_COMPTE_PCE", new Integer(idCompteTVA));
this.mEcritures.put("DEBIT", new Long(prixTVA.getLongValue()));
this.mEcritures.put("CREDIT", new Long(0));
this.putValue("ID_COMPTE_PCE", new Integer(idCompteTVA));
this.putValue("DEBIT", new Long(prixTVA.getLongValue()));
this.putValue("CREDIT", new Long(0));
ajoutEcriture();
 
if (rowFournisseur.getBoolean("UE")) {
129,9 → 129,9
} else {
idCompteTVAIntra = rowCptTva.getID();
}
this.mEcritures.put("ID_COMPTE_PCE", new Integer(idCompteTVAIntra));
this.mEcritures.put("DEBIT", new Long(0));
this.mEcritures.put("CREDIT", new Long(prixTVA.getLongValue()));
this.putValue("ID_COMPTE_PCE", new Integer(idCompteTVAIntra));
this.putValue("DEBIT", new Long(0));
this.putValue("CREDIT", new Long(prixTVA.getLongValue()));
ajoutEcriture();
}
}
145,12 → 145,12
idCompteFourn = ComptePCESQLElement.getIdComptePceDefault("Fournisseurs");
}
}
this.mEcritures.put("ID_COMPTE_PCE", new Integer(idCompteFourn));
this.mEcritures.put("DEBIT", new Long(0));
this.putValue("ID_COMPTE_PCE", new Integer(idCompteFourn));
this.putValue("DEBIT", new Long(0));
if (rowFournisseur.getBoolean("UE")) {
this.mEcritures.put("CREDIT", new Long(prixHT.getLongValue()));
this.putValue("CREDIT", new Long(prixHT.getLongValue()));
} else {
this.mEcritures.put("CREDIT", new Long(prixTTC.getLongValue()));
this.putValue("CREDIT", new Long(prixTTC.getLongValue()));
}
ajoutEcriture();
 
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationEcritures.java
44,6 → 44,8
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
 
import com.ibm.icu.text.SimpleDateFormat;
 
/**
* Generation des ecritures comptables, permet l'ajout d'ecriture, la creation des mouvements
*
71,11 → 73,11
private SQLRow rowAnalytiqueSource;
 
// Map contenant les valeurs pour la SQLRowValues de la table Ecritures à ajouter
public Map<String, Object> mEcritures = new HashMap<String, Object>();
protected final Map<String, Object> mEcritures = new HashMap<String, Object>();
 
// public GenerationEcritures(SQLRow rowSource) {
// this.rowAnalytiqueSource = rowSource;
// }
public void putValue(String field, Object value) {
mEcritures.put(field, value);
}
 
public void setRowAnalytiqueSource(SQLRow rowAnalytiqueSource) {
this.rowAnalytiqueSource = rowAnalytiqueSource;
145,19 → 147,15
 
if (dCloture != null) {
if (dCloture.after(d)) {
System.err.println("Impossible de générer l'écriture pour la date " + d + ". Cette période est cloturée.");
// ExceptionHandler.handle("Impossible de générer l'écriture pour la date " + d + ".
// Cette période est cloturée.");
throw new IllegalArgumentException("Impossible de générer l'écriture pour la date " + d + ". Cette période est cloturée.");
// return -1;
final String error = "Impossible de générer l'écriture pour la date " + SimpleDateFormat.getDateInstance(SimpleDateFormat.FULL).format(d)
+ ". Cette date est postérieure à la date de clôture (" + SimpleDateFormat.getDateInstance(SimpleDateFormat.FULL).format(dCloture) + ")";
throw new IllegalArgumentException(error);
}
} else {
if (dDebEx.after(d)) {
System.err.println("Impossible de générer l'écriture pour la date " + d + ". Cette période est cloturée.");
// ExceptionHandler.handle("Impossible de générer l'écriture pour la date " + d + ".
// Cette période est cloturée.");
// return -1;
throw new IllegalArgumentException("Impossible de générer l'écriture pour la date " + d + ". Cette période est cloturée.");
final String error = "Impossible de générer l'écriture pour la date " + SimpleDateFormat.getDateInstance(SimpleDateFormat.FULL).format(d)
+ ". Cette date est antérieure à la date de début d'exercice (" + SimpleDateFormat.getDateInstance(SimpleDateFormat.FULL).format(dDebEx) + ")";
throw new IllegalArgumentException(error);
}
}
 
440,7 → 438,7
}
if (rowTVAPort != null && !rowTVAPort.isUndefined()) {
SQLRowValues rowValsPort = new SQLRowValues(foreign);
rowValsPort.put("T_PV_HT", portHT);
rowValsPort.put(achat ? "T_PA_HT" : "T_PV_HT", portHT);
rowValsPort.put("QTE", 1);
rowValsPort.put("ID_TAXE", rowTVAPort.getIDNumber());
 
467,7 → 465,7
}
}
final SQLRowValues rowValsArt = rowValsPort.putRowValues("ID_ARTICLE");
rowValsArt.put("ID_COMPTE_PCE", rowDefaultCptPort.getID());
rowValsArt.put(achat ? "ID_COMPTE_PCE_ACHAT" : "ID_COMPTE_PCE", rowDefaultCptPort.getID());
rowValsArt.put("ID_TAXE_COMPLEMENTAIRE", null);
calc.addLine(rowValsPort, rowValsPort.getForeign("ID_ARTICLE"), 1, false);
}
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtAvoirClient.java
63,26 → 63,26
rowClient = avoirRow.getForeignRow("ID_CLIENT");
 
if (ecritureTable.contains("CODE_CLIENT")) {
this.mEcritures.put("CODE_CLIENT", rowClient.getString("CODE"));
this.putValue("CODE_CLIENT", rowClient.getString("CODE"));
}
 
// iniatilisation des valeurs de la map
this.date = (Date) avoirRow.getObject("DATE");
this.nom = avoirRow.getObject("NOM").toString();
this.mEcritures.put("DATE", new java.sql.Date(this.date.getTime()));
this.putValue("DATE", new java.sql.Date(this.date.getTime()));
AccountingRecordsProvider provider = AccountingRecordsProviderManager.get(ID);
provider.putLabel(avoirRow, this.mEcritures);
 
this.mEcritures.put("ID_JOURNAL", GenerationMvtAvoirClient.journal);
this.putValue("ID_JOURNAL", GenerationMvtAvoirClient.journal);
if (affacturage) {
 
int idJrnlFactor = rowPrefsCompte.getInt("ID_JOURNAL_FACTOR");
if (idJrnlFactor > 1) {
this.mEcritures.put("ID_JOURNAL", idJrnlFactor);
this.putValue("ID_JOURNAL", idJrnlFactor);
}
}
 
this.mEcritures.put("ID_MOUVEMENT", Integer.valueOf(1));
this.putValue("ID_MOUVEMENT", Integer.valueOf(1));
 
// on cree un nouveau mouvement
if (this.idMvt == 1) {
90,7 → 90,7
provider.putPieceLabel(avoirRow, rowValsPiece);
getNewMouvement(GenerationMvtAvoirClient.source, this.idAvoirClient, 1, rowValsPiece);
} else {
this.mEcritures.put("ID_MOUVEMENT", Integer.valueOf(this.idMvt));
this.putValue("ID_MOUVEMENT", Integer.valueOf(this.idMvt));
 
SQLRowValues rowValsPiece = pieceTable.getTable("MOUVEMENT").getRow(idMvt).getForeign("ID_PIECE").asRowValues();
provider.putPieceLabel(avoirRow, rowValsPiece);
116,23 → 116,23
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));
this.putValue("ID_COMPTE_PCE", rowCompl.getForeignID("ID_COMPTE_PCE"));
this.putValue("CREDIT", Long.valueOf(0));
this.putValue("DEBIT", Long.valueOf(taxeC));
ajoutEcriture();
taxe += taxeC;
// this.mEcritures.put("ID_COMPTE_PCE",
// this.putValue("ID_COMPTE_PCE",
// rowCompl.getForeignID("ID_COMPTE_PCE_PRODUITS"));
// this.mEcritures.put("CREDIT", Long.valueOf(taxeC));
// this.mEcritures.put("DEBIT", Long.valueOf(0));
// this.putValue("CREDIT", Long.valueOf(taxeC));
// this.putValue("DEBIT", Long.valueOf(0));
// ajoutEcriture();
}
}
}
 
this.mEcritures.put("ID_COMPTE_PCE", row.getID());
this.mEcritures.put("DEBIT", Long.valueOf(b - taxe));
this.mEcritures.put("CREDIT", Long.valueOf(0));
this.putValue("ID_COMPTE_PCE", row.getID());
this.putValue("DEBIT", Long.valueOf(b - taxe));
this.putValue("CREDIT", Long.valueOf(0));
SQLRow rowEcr = ajoutEcriture();
// addAssocAnalytiqueFromProvider(rowEcr, avoirRow);
}
143,9 → 143,9
for (SQLRowAccessor rowAc : tvaMap.keySet()) {
long longValue = tvaMap.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(longValue));
this.mEcritures.put("CREDIT", Long.valueOf(0));
this.putValue("ID_COMPTE_PCE", rowAc.getID());
this.putValue("DEBIT", Long.valueOf(longValue));
this.putValue("CREDIT", Long.valueOf(0));
ajoutEcriture();
}
}
159,10 → 159,10
}
}
 
this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idCompteClient));
this.mEcritures.put("DEBIT", Long.valueOf(0));
this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteClient));
this.putValue("DEBIT", Long.valueOf(0));
long ttc = calc.getTotalTTC().movePointRight(2).longValue();
this.mEcritures.put("CREDIT", Long.valueOf(ttc));
this.putValue("CREDIT", Long.valueOf(ttc));
ajoutEcriture();
 
// Mise à jour de mouvement associé à la facture d'avoir
175,9 → 175,9
}
 
if (affacturage) {
this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idCompteClient));
this.mEcritures.put("DEBIT", Long.valueOf(ttc));
this.mEcritures.put("CREDIT", Long.valueOf(0));
this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteClient));
this.putValue("DEBIT", Long.valueOf(ttc));
this.putValue("CREDIT", Long.valueOf(0));
ajoutEcriture();
 
// compte Factor
193,9 → 193,9
}
}
 
this.mEcritures.put("ID_COMPTE_PCE", idComptefactor);
this.mEcritures.put("DEBIT", Long.valueOf(0));
this.mEcritures.put("CREDIT", Long.valueOf(ttc));
this.putValue("ID_COMPTE_PCE", idComptefactor);
this.putValue("DEBIT", Long.valueOf(0));
this.putValue("CREDIT", Long.valueOf(ttc));
ajoutEcriture();
}
 
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationReglementVenteNG.java
68,17 → 68,25
setRowAnalytiqueSource(source);
// iniatilisation des valeurs de la map
this.date = d;
if (typeRegRow.getID() == TypeReglementSQLElement.CB && modeReglement.getObject("DATE") != null) {
this.date = (Date) modeReglement.getObject("DATE");
}
 
// TODO Nommage des ecritures
 
this.nom = label;
 
this.mEcritures.put("DATE", this.date);
this.mEcritures.put("NOM", this.nom);
this.putValue("DATE", this.date);
this.putValue("NOM", this.nom);
fillJournalBanqueFromRow(modeReglement);
 
this.mEcritures.put("ID_MOUVEMENT", Integer.valueOf(this.idMvt));
this.putValue("ID_MOUVEMENT", Integer.valueOf(this.idMvt));
if (source.getTable().getName().equalsIgnoreCase("ENCAISSER_MONTANT")) {
if (source.getBoolean("ACOMPTE")) {
final String numeroDevis = source.asRow().getForeign("ID_DEVIS").getString("NUMERO");
this.idMvt = getNewMouvement(source.getTable().getName(), source.getID(), 1, numeroDevis);
this.putValue("NOM_PIECE", numeroDevis);
} else {
List<SQLRow> l = source.getReferentRows(source.getTable().getTable("ENCAISSER_MONTANT_ELEMENT"));
for (SQLRow sqlRow : l) {
SQLRow mvtEch = sqlRow.getForeignRow("ID_MOUVEMENT_ECHEANCE");
87,6 → 95,7
}
}
}
}
// si paiement comptant
if ((!typeRegRow.getBoolean("ECHEANCE"))
&& ((modeReglement.getBoolean("COMPTANT")) || (!modeReglement.getBoolean("DATE_FACTURE") && (modeReglement.getInt("AJOURS") == 0 && modeReglement.getInt("LENJOUR") == 0)))) {
117,11 → 126,11
rowEncaisseElt = rowValsElt.insert();
 
}
 
if (!source.getTable().getName().equalsIgnoreCase("ENCAISSER_MONTANT") || !source.getBoolean("ACOMPTE")) {
this.idMvt = getNewMouvement(rowEncaisse.getTable().getName(), rowEncaisse.getID(), mvtSource.getID(), mvtSource.getInt("ID_PIECE"));
}
this.putValue("ID_MOUVEMENT", Integer.valueOf(this.idMvt));
 
this.mEcritures.put("ID_MOUVEMENT", Integer.valueOf(this.idMvt));
 
SQLRowValues rowVals = rowEncaisse.createEmptyUpdateRow();
rowVals.put("ID_MOUVEMENT", this.idMvt);
 
164,7 → 173,7
setDateReglement(source, this.date);
}
if (typeRegRow.getID() == TypeReglementSQLElement.ESPECE) {
this.mEcritures.put("ID_JOURNAL", JournalSQLElement.CAISSES);
this.putValue("ID_JOURNAL", JournalSQLElement.CAISSES);
}
 
int idCompteClient = rowClient.getInt("ID_COMPTE_PCE");
184,9 → 193,9
}
}
}
this.mEcritures.put("ID_COMPTE_PCE", idCompteClient);
this.mEcritures.put("DEBIT", Long.valueOf(0));
this.mEcritures.put("CREDIT", Long.valueOf(ttc.getLongValue()));
this.putValue("ID_COMPTE_PCE", idCompteClient);
this.putValue("DEBIT", Long.valueOf(0));
this.putValue("CREDIT", Long.valueOf(ttc.getLongValue()));
 
this.ecrClient = ajoutEcriture();
 
197,12 → 206,12
idCompteRegl = ComptePCESQLElement.getIdComptePceDefault("VenteEspece");
}
 
this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idCompteRegl));
this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteRegl));
} else {
fillCompteBanqueFromRow(modeReglement, "VenteCB", false);
}
this.mEcritures.put("DEBIT", Long.valueOf(ttc.getLongValue()));
this.mEcritures.put("CREDIT", Long.valueOf(0));
this.putValue("DEBIT", Long.valueOf(ttc.getLongValue()));
this.putValue("CREDIT", Long.valueOf(0));
ajoutEcriture();
 
}
363,10 → 372,10
}
}
 
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.putValue("ID_JOURNAL", JournalSQLElement.BANQUES);
this.putValue("ID_COMPTE_PCE", idCompteClient);
this.putValue("DEBIT", Long.valueOf(0));
this.putValue("CREDIT", Long.valueOf(ttc.getLongValue()));
 
this.ecrClient = ajoutEcriture();
 
375,9 → 384,9
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));
this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteRegl));
this.putValue("DEBIT", Long.valueOf(ttc.getLongValue()));
this.putValue("CREDIT", Long.valueOf(0));
 
ajoutEcriture();
}
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtReglementAchat.java
96,12 → 96,12
this.idMvt = this.idPere;
 
// iniatilisation des valeurs de la map
this.mEcritures.put("DATE", new java.sql.Date(this.date.getTime()));
this.mEcritures.put("NOM", this.nom);
this.mEcritures.put("ID_MOUVEMENT", Integer.valueOf(this.idMvt));
this.putValue("DATE", new java.sql.Date(this.date.getTime()));
this.putValue("NOM", this.nom);
this.putValue("ID_MOUVEMENT", Integer.valueOf(this.idMvt));
 
if (typeRegRow.getID() == 4) {
this.mEcritures.put("ID_JOURNAL", GenerationMvtReglementAchat.journalCaisse);
this.putValue("ID_JOURNAL", GenerationMvtReglementAchat.journalCaisse);
} else {
fillJournalBanqueFromRow(modeRegRow);
}
115,9 → 115,9
}
}
 
this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(compteFourn));
this.mEcritures.put("DEBIT", Long.valueOf(prixTTC.getLongValue()));
this.mEcritures.put("CREDIT", Long.valueOf(0));
this.putValue("ID_COMPTE_PCE", Integer.valueOf(compteFourn));
this.putValue("DEBIT", Long.valueOf(prixTTC.getLongValue()));
this.putValue("CREDIT", Long.valueOf(0));
ajoutEcriture();
 
// compte de reglement, caisse, CB, ...
126,13 → 126,13
if (idCompteRegl <= 1) {
idCompteRegl = ComptePCESQLElement.getIdComptePceDefault("VenteEspece");
}
this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idCompteRegl));
this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteRegl));
 
} else {
fillCompteBanqueFromRow(modeRegRow, "VenteCB", true);
}
this.mEcritures.put("DEBIT", Long.valueOf(0));
this.mEcritures.put("CREDIT", Long.valueOf(prixTTC.getLongValue()));
this.putValue("DEBIT", Long.valueOf(0));
this.putValue("CREDIT", Long.valueOf(prixTTC.getLongValue()));
ajoutEcriture();
}
} else {
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtReglementAvoir.java
66,15 → 66,15
} else {
 
if (typeRegRow.getID() == 4) {
this.mEcritures.put("ID_JOURNAL", GenerationMvtReglementAvoir.journalCaisse);
this.putValue("ID_JOURNAL", GenerationMvtReglementAvoir.journalCaisse);
} else {
fillJournalBanqueFromRow(modeRegRow);
}
 
this.idMvt = idPere;
this.mEcritures.put("DATE", new java.sql.Date(this.date.getTime()));
this.mEcritures.put("NOM", this.nom);
this.mEcritures.put("ID_MOUVEMENT", new Integer(this.idMvt));
this.putValue("DATE", new java.sql.Date(this.date.getTime()));
this.putValue("NOM", this.nom);
this.putValue("ID_MOUVEMENT", new Integer(this.idMvt));
 
// compte Clients
int idCompteClient = clientRow.getInt("ID_COMPTE_PCE");
87,9 → 87,9
}
}
 
this.mEcritures.put("ID_COMPTE_PCE", new Integer(idCompteClient));
this.mEcritures.put("DEBIT", new Long(prixTTC.getLongValue()));
this.mEcritures.put("CREDIT", new Long(0));
this.putValue("ID_COMPTE_PCE", new Integer(idCompteClient));
this.putValue("DEBIT", new Long(prixTTC.getLongValue()));
this.putValue("CREDIT", new Long(0));
ajoutEcriture();
 
// compte de reglement, caisse, cheque, ...
99,12 → 99,12
idCompteRegl = ComptePCESQLElement.getIdComptePceDefault("VenteEspece");
}
 
this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idCompteRegl));
this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteRegl));
} else {
fillCompteBanqueFromRow(modeRegRow, "VenteCB", false);
}
this.mEcritures.put("DEBIT", new Long(0));
this.mEcritures.put("CREDIT", new Long(prixTTC.getLongValue()));
this.putValue("DEBIT", new Long(0));
this.putValue("CREDIT", new Long(prixTTC.getLongValue()));
ajoutEcriture();
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtAvoirFournisseur.java
58,16 → 58,16
// iniatilisation des valeurs de la map
this.date = (Date) avoirRow.getObject("DATE");
this.nom = avoirRow.getObject("NOM").toString();
this.mEcritures.put("DATE", new java.sql.Date(this.date.getTime()));
this.mEcritures.put("NOM", "Avoir fournisseur : " + avoirRow.getString("NUMERO") + " " + rowFourn.getString("NOM"));
this.mEcritures.put("ID_JOURNAL", GenerationMvtAvoirFournisseur.journal);
this.mEcritures.put("ID_MOUVEMENT", Integer.valueOf(1));
this.putValue("DATE", new java.sql.Date(this.date.getTime()));
this.putValue("NOM", "Avoir fournisseur : " + avoirRow.getString("NUMERO") + " " + rowFourn.getString("NOM"));
this.putValue("ID_JOURNAL", GenerationMvtAvoirFournisseur.journal);
this.putValue("ID_MOUVEMENT", Integer.valueOf(1));
 
// on cree un nouveau mouvement
if (this.idMvt == 1) {
getNewMouvement(GenerationMvtAvoirFournisseur.source, this.idAvoirFourn, 1, "Avoir Fournisseur : " + avoirRow.getString("NUMERO"));
} else {
this.mEcritures.put("ID_MOUVEMENT", Integer.valueOf(this.idMvt));
this.putValue("ID_MOUVEMENT", Integer.valueOf(this.idMvt));
}
 
// generation des ecritures + maj des totaux du compte associe
85,9 → 85,9
}
}
}
this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idCompteAchat));
this.mEcritures.put("DEBIT", Long.valueOf(0));
this.mEcritures.put("CREDIT", Long.valueOf(prixHT.getLongValue()));
this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteAchat));
this.putValue("DEBIT", Long.valueOf(0));
this.putValue("CREDIT", Long.valueOf(prixHT.getLongValue()));
SQLRow rowEcr = ajoutEcriture();
// addAssocAnalytiqueFromProvider(rowEcr, avoirRow);
 
106,9 → 106,9
}
}
 
this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idCompteTVA));
this.mEcritures.put("DEBIT", Long.valueOf(0));
this.mEcritures.put("CREDIT", Long.valueOf(prixTVA.getLongValue()));
this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteTVA));
this.putValue("DEBIT", Long.valueOf(0));
this.putValue("CREDIT", Long.valueOf(prixTVA.getLongValue()));
ajoutEcriture();
 
if (rowFourn.getBoolean("UE")) {
116,9 → 116,9
if (idCompteTVAIntra <= 1) {
idCompteTVAIntra = ComptePCESQLElement.getIdComptePceDefault("TVAIntraComm");
}
this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idCompteTVAIntra));
this.mEcritures.put("DEBIT", Long.valueOf(prixTVA.getLongValue()));
this.mEcritures.put("CREDIT", Long.valueOf(0));
this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteTVAIntra));
this.putValue("DEBIT", Long.valueOf(prixTVA.getLongValue()));
this.putValue("CREDIT", Long.valueOf(0));
ajoutEcriture();
}
}
130,9 → 130,9
idCompteFourn = ComptePCESQLElement.getIdComptePceDefault("Fournisseurs");
}
}
this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idCompteFourn));
this.mEcritures.put("DEBIT", Long.valueOf(prixTTC.getLongValue()));
this.mEcritures.put("CREDIT", Long.valueOf(0));
this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteFourn));
this.putValue("DEBIT", Long.valueOf(prixTTC.getLongValue()));
this.putValue("CREDIT", Long.valueOf(0));
ajoutEcriture();
 
// Mise à jour de mouvement associé à la facture d'avoir
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtReglementChequeFourn.java
14,7 → 14,6
package org.openconcerto.erp.generationEcritures;
 
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
import org.openconcerto.erp.core.finance.accounting.element.JournalSQLElement;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLTable;
 
37,11 → 36,11
this.date = d;
SQLRow rowFournisseur = tableFourn.getRow(rowCheque.getInt("ID_FOURNISSEUR"));
this.nom = "Reglement cheque " + rowFournisseur.getString("NOM");
this.mEcritures.put("DATE", new java.sql.Date(this.date.getTime()));
this.mEcritures.put("NOM", this.nom);
this.putValue("DATE", new java.sql.Date(this.date.getTime()));
this.putValue("NOM", this.nom);
 
fillJournalBanqueFromRow(rowCheque);
this.mEcritures.put("ID_MOUVEMENT", new Integer(this.idMvt));
this.putValue("ID_MOUVEMENT", new Integer(this.idMvt));
 
// compte Fournisseurs
int idCompteFourn = rowFournisseur.getInt("ID_COMPTE_PCE");
54,15 → 53,15
 
}
}
this.mEcritures.put("ID_COMPTE_PCE", new Integer(idCompteFourn));
this.mEcritures.put("DEBIT", new Long(montant));
this.mEcritures.put("CREDIT", new Long(0));
this.putValue("ID_COMPTE_PCE", new Integer(idCompteFourn));
this.putValue("DEBIT", new Long(montant));
this.putValue("CREDIT", new Long(0));
ajoutEcriture();
 
// compte de reglement cheque, ...
fillCompteBanqueFromRow(rowCheque, "AchatCheque", true);
this.mEcritures.put("DEBIT", new Long(0));
this.mEcritures.put("CREDIT", new Long(montant));
this.putValue("DEBIT", new Long(0));
this.putValue("CREDIT", new Long(montant));
ajoutEcriture();
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtAcompte.java
56,10 → 56,10
this.date = new Date();
// TODO recuperer le mois et l'année
this.nom = "Acompte " + rowSal.getString("NOM");
this.mEcritures.put("DATE", new java.sql.Date(this.date.getTime()));
this.mEcritures.put("NOM", this.nom);
this.mEcritures.put("ID_JOURNAL", journalOD);
this.mEcritures.put("ID_MOUVEMENT", Integer.valueOf(this.idMvt));
this.putValue("DATE", new java.sql.Date(this.date.getTime()));
this.putValue("NOM", this.nom);
this.putValue("ID_JOURNAL", journalOD);
this.putValue("ID_MOUVEMENT", Integer.valueOf(this.idMvt));
 
// Acompte
int idCompteAcompte = rowPrefsCompte.getInt("ID_COMPTE_PCE_ACOMPTE");
67,10 → 67,10
idCompteAcompte = ComptePCESQLElement.getIdComptePceDefault("PayeAcompte");
}
 
this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idCompteAcompte));
this.mEcritures.put("NOM", this.nom);
this.mEcritures.put("DEBIT", Long.valueOf(this.montant));
this.mEcritures.put("CREDIT", Long.valueOf(0));
this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteAcompte));
this.putValue("NOM", this.nom);
this.putValue("DEBIT", Long.valueOf(this.montant));
this.putValue("CREDIT", Long.valueOf(0));
 
ajoutEcriture();
 
84,10 → 84,10
e.printStackTrace();
}
}
this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idCompteTresor));
this.mEcritures.put("NOM", this.nom);
this.mEcritures.put("DEBIT", Long.valueOf(0));
this.mEcritures.put("CREDIT", Long.valueOf(this.montant));
this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteTresor));
this.putValue("NOM", this.nom);
this.putValue("DEBIT", Long.valueOf(0));
this.putValue("CREDIT", Long.valueOf(this.montant));
 
ajoutEcriture();
 
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtSaisieVenteFacture.java
25,6 → 25,7
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.StringUtils;
 
import java.math.BigDecimal;
import java.math.RoundingMode;
103,7 → 104,7
} else {
this.nom = "Fact. vente " + saisieRow.getObject("NUMERO").toString();
}
this.mEcritures.put("NOM", this.nom);
this.putValue("NOM", this.nom);
 
// iniatilisation des valeurs de la map
this.date = (Date) saisieRow.getObject("DATE");
110,9 → 111,9
AccountingRecordsProvider provider = AccountingRecordsProviderManager.get(ID);
provider.putLabel(saisieRow, this.mEcritures);
 
this.mEcritures.put("DATE", this.date);
this.mEcritures.put("ID_JOURNAL", GenerationMvtSaisieVenteFacture.journal);
this.mEcritures.put("ID_MOUVEMENT", Integer.valueOf(1));
this.putValue("DATE", this.date);
this.putValue("ID_JOURNAL", GenerationMvtSaisieVenteFacture.journal);
this.putValue("ID_MOUVEMENT", Integer.valueOf(1));
 
// on calcule le nouveau numero de mouvement
if (this.idMvt == 1) {
120,7 → 121,7
provider.putPieceLabel(saisieRow, rowValsPiece);
getNewMouvement(GenerationMvtSaisieVenteFacture.source, this.idSaisieVenteFacture, 1, rowValsPiece);
} else {
this.mEcritures.put("ID_MOUVEMENT", Integer.valueOf(this.idMvt));
this.putValue("ID_MOUVEMENT", Integer.valueOf(this.idMvt));
SQLRowValues rowValsPiece = mvtTable.getRow(idMvt).getForeign("ID_PIECE").asRowValues();
provider.putPieceLabel(saisieRow, rowValsPiece);
rowValsPiece.update();
152,15 → 153,15
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));
this.putValue("ID_COMPTE_PCE", rowCompl.getForeignID("ID_COMPTE_PCE"));
this.putValue("DEBIT", Long.valueOf(0));
this.putValue("CREDIT", Long.valueOf(taxeC));
ajoutEcriture();
taxe += taxeC;
// this.mEcritures.put("ID_COMPTE_PCE",
// this.putValue("ID_COMPTE_PCE",
// rowCompl.getForeignID("ID_COMPTE_PCE_PRODUITS"));
// this.mEcritures.put("DEBIT", Long.valueOf(taxeC));
// this.mEcritures.put("CREDIT", Long.valueOf(0));
// this.putValue("DEBIT", Long.valueOf(taxeC));
// this.putValue("CREDIT", Long.valueOf(0));
// ajoutEcriture();
}
}
173,9 → 174,9
idComptePCE = Integer.valueOf(row.getID());
}
 
this.mEcritures.put("ID_COMPTE_PCE", idComptePCE);
this.mEcritures.put("DEBIT", Long.valueOf(0));
this.mEcritures.put("CREDIT", Long.valueOf(b - taxe));
this.putValue("ID_COMPTE_PCE", idComptePCE);
this.putValue("DEBIT", Long.valueOf(0));
this.putValue("CREDIT", Long.valueOf(b - taxe));
ajoutEcriture();
}
}
184,9 → 185,9
for (SQLRowAccessor rowAc : tvaMap.keySet()) {
long longValue = tvaMap.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);
this.putValue("ID_COMPTE_PCE", rowAc.getID());
this.putValue("DEBIT", Long.valueOf(0));
this.putValue("CREDIT", longValue);
ajoutEcriture();
}
}
199,12 → 200,12
idCompteClient = ComptePCESQLElement.getIdComptePceDefault("Clients");
}
}
this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idCompteClient));
this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteClient));
if (ecrTable.contains("CODE_CLIENT")) {
this.mEcritures.put("CODE_CLIENT", clientRow.getString("CODE"));
this.putValue("CODE_CLIENT", clientRow.getString("CODE"));
}
this.mEcritures.put("DEBIT", ttcLongValue);
this.mEcritures.put("CREDIT", Long.valueOf(0));
this.putValue("DEBIT", ttcLongValue);
this.putValue("CREDIT", Long.valueOf(0));
ajoutEcriture();
 
// TODO Gestion des factures d'acomptes
220,13 → 221,13
// for (SQLRow sqlRow : rowsAcompte) {
// long acompteTTC = sqlRow.getLong("T_TTC");
// long acompteHT = sqlRow.getLong("T_HT");
// this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idCompteAcompteClient));
// this.mEcritures.put("DEBIT", acompteTTC);
// this.mEcritures.put("CREDIT", Long.valueOf(0));
// this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteAcompteClient));
// this.putValue("DEBIT", acompteTTC);
// this.putValue("CREDIT", Long.valueOf(0));
// ajoutEcriture();
// this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idCompteClient));
// this.mEcritures.put("DEBIT", Long.valueOf(0));
// this.mEcritures.put("CREDIT", acompteTTC);
// this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteClient));
// this.putValue("DEBIT", Long.valueOf(0));
// this.putValue("CREDIT", acompteTTC);
// ajoutEcriture();
//
// montantAcompteTTC += acompteTTC;
235,9 → 236,9
// if (tva > 0) {
//
//
// this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idTVAAcompte));
// this.mEcritures.put("DEBIT", Long.valueOf(0));
// this.mEcritures.put("CREDIT", Long.valueOf(tva));
// this.putValue("ID_COMPTE_PCE", Integer.valueOf(idTVAAcompte));
// this.putValue("DEBIT", Long.valueOf(0));
// this.putValue("CREDIT", Long.valueOf(tva));
// ajoutEcriture();
//
// Map<Integer, Long> m = getMultiTVAFromRow(saisieRow,
251,23 → 252,23
// if (idCpt <= 1) {
// idCpt = idCompteTVA;
// }
// this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idCpt));
// this.mEcritures.put("DEBIT", Long.valueOf(0));
// this.mEcritures.put("CREDIT", Long.valueOf(l));
// this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCpt));
// this.putValue("DEBIT", Long.valueOf(0));
// this.putValue("CREDIT", Long.valueOf(l));
// ajoutEcriture();
// allTaxe += l;
// }
// }
// if (allTaxe < prixTVA.getLongValue()) {
// this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idCompteTVA));
// this.mEcritures.put("DEBIT", Long.valueOf(0));
// this.mEcritures.put("CREDIT", Long.valueOf(prixTVA.getLongValue() - allTaxe));
// this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteTVA));
// this.putValue("DEBIT", Long.valueOf(0));
// this.putValue("CREDIT", Long.valueOf(prixTVA.getLongValue() - allTaxe));
// ajoutEcriture();
// }
//
// this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(compteDebitTvaAcompte));
// this.mEcritures.put("DEBIT", Long.valueOf(tva));
// this.mEcritures.put("CREDIT", Long.valueOf(0));
// this.putValue("ID_COMPTE_PCE", Integer.valueOf(compteDebitTvaAcompte));
// this.putValue("DEBIT", Long.valueOf(tva));
// this.putValue("CREDIT", Long.valueOf(0));
// ajoutEcriture();
// }
// }
284,7 → 285,7
// Génération du reglement
SQLRow modeRegl = saisieRow.getForeignRow("ID_MODE_REGLEMENT");
final SQLRow typeRegRow = modeRegl.getForeignRow("ID_TYPE_REGLEMENT");
String label = this.nom + " (" + typeRegRow.getString("NOM") + ")";
String label = this.nom + " (" + typeRegRow.getString("NOM") + ") " + StringUtils.limitLength(clientRow.getString("NOM"), 20);
int idAvoir = saisieRow.getInt("ID_AVOIR_CLIENT");
if (idAvoir > 1) {
// SQLRow avoirRow = base.getTable("AVOIR_CLIENT").getRow(idAvoir);
293,7 → 294,7
}
prixTTC = new PrixTTC(saisieRow.getLong("NET_A_PAYER"));
if (prixTTC.getLongValue() > 0) {
new GenerationReglementVenteNG(label, clientRow, prixTTC, this.date, modeRegl, saisieRow, mvtTable.getRow(idMvt));
new GenerationReglementVenteNG(label.trim(), clientRow, prixTTC, this.date, modeRegl, saisieRow, mvtTable.getRow(idMvt));
}
}
// Mise à jour de mouvement associé à la facture
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtVirement.java
24,6 → 24,8
private long debit, credit;
private String labelPiece;
private boolean clearMvt = true;
private boolean fermeture = false;
private boolean ouverture = false;
 
/***********************************************************************************************
*
54,6 → 56,14
 
}
 
public void setOuverture(boolean ouverture) {
this.ouverture = ouverture;
}
 
public void setFermeture(boolean fermeture) {
this.fermeture = fermeture;
}
 
/**
* Permet de générer plusieurs virement pour une meme piece
*
79,10 → 89,12
public int genereMouvement() throws SQLException {
 
// iniatilisation des valeurs de la map
this.mEcritures.put("DATE", this.date);
this.mEcritures.put("NOM", this.nom);
this.mEcritures.put("ID_JOURNAL", this.id_journal);
this.mEcritures.put("ID_MOUVEMENT", Integer.valueOf(1));
this.putValue("DATE", this.date);
this.putValue("CLOTURE", this.fermeture);
this.putValue("RAN", this.ouverture);
this.putValue("NOM", this.nom);
this.putValue("ID_JOURNAL", this.id_journal);
this.putValue("ID_MOUVEMENT", Integer.valueOf(1));
 
// on calcule le nouveau numero de mouvement
if (this.idPiece <= 1) {
92,20 → 104,20
getNewMouvement("", 1, 1, this.idPiece);
}
}
this.mEcritures.put("ID_MOUVEMENT", this.idMvt);
this.putValue("ID_MOUVEMENT", this.idMvt);
 
// generation des ecritures + maj des totaux du compte associe
 
// compte Départ
this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(this.id_compte_depart));
this.mEcritures.put("DEBIT", Long.valueOf(this.debit));
this.mEcritures.put("CREDIT", Long.valueOf(this.credit));
this.putValue("ID_COMPTE_PCE", Integer.valueOf(this.id_compte_depart));
this.putValue("DEBIT", Long.valueOf(this.debit));
this.putValue("CREDIT", Long.valueOf(this.credit));
ajoutEcriture();
 
// compte arrivé
this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(this.id_compte_arrive));
this.mEcritures.put("DEBIT", Long.valueOf(this.credit));
this.mEcritures.put("CREDIT", Long.valueOf(this.debit));
this.putValue("ID_COMPTE_PCE", Integer.valueOf(this.id_compte_arrive));
this.putValue("DEBIT", Long.valueOf(this.credit));
this.putValue("CREDIT", Long.valueOf(this.debit));
ajoutEcriture();
 
return this.idMvt;
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtSaisieVenteComptoir.java
66,16 → 66,16
string += saisieRow.getForeignRow("ID_ARTICLE").getString("NOM");
}
this.nom = string;
this.mEcritures.put("DATE", this.date);
this.mEcritures.put("NOM", this.nom);
this.mEcritures.put("ID_JOURNAL", GenerationMvtSaisieVenteComptoir.journal);
this.mEcritures.put("ID_MOUVEMENT", new Integer(1));
this.putValue("DATE", this.date);
this.putValue("NOM", this.nom);
this.putValue("ID_JOURNAL", GenerationMvtSaisieVenteComptoir.journal);
this.putValue("ID_MOUVEMENT", new Integer(1));
 
// on calcule le nouveau numero de mouvement
if (this.idMvt == 1) {
this.idMvt = getNewMouvement(GenerationMvtSaisieVenteComptoir.source, this.idSaisieVenteComptoir, 1, string);
}
this.mEcritures.put("ID_MOUVEMENT", new Integer(this.idMvt));
this.putValue("ID_MOUVEMENT", new Integer(this.idMvt));
 
// generation des ecritures + maj des totaux du compte associe
 
86,9 → 86,9
if (idCompteVenteService <= 1) {
idCompteVenteService = ComptePCESQLElement.getIdComptePceDefault("VentesServices");
}
this.mEcritures.put("ID_COMPTE_PCE", new Integer(idCompteVenteService));
this.mEcritures.put("DEBIT", new Long(0));
this.mEcritures.put("CREDIT", new Long(service));
this.putValue("ID_COMPTE_PCE", new Integer(idCompteVenteService));
this.putValue("DEBIT", new Long(0));
this.putValue("CREDIT", new Long(service));
ajoutEcriture();
 
if ((prixHT.getLongValue() - service) > 0) {
96,9 → 96,9
if (idCompteVenteProduit <= 1) {
idCompteVenteProduit = ComptePCESQLElement.getIdComptePceDefault("VentesProduits");
}
this.mEcritures.put("ID_COMPTE_PCE", new Integer(idCompteVenteProduit));
this.mEcritures.put("DEBIT", new Long(0));
this.mEcritures.put("CREDIT", new Long(prixHT.getLongValue() - service));
this.putValue("ID_COMPTE_PCE", new Integer(idCompteVenteProduit));
this.putValue("DEBIT", new Long(0));
this.putValue("CREDIT", new Long(prixHT.getLongValue() - service));
ajoutEcriture();
}
 
108,9 → 108,9
if (idCompteVenteProduit <= 1) {
idCompteVenteProduit = ComptePCESQLElement.getIdComptePceDefault("VentesProduits");
}
this.mEcritures.put("ID_COMPTE_PCE", new Integer(idCompteVenteProduit));
this.mEcritures.put("DEBIT", new Long(0));
this.mEcritures.put("CREDIT", new Long(prixHT.getLongValue()));
this.putValue("ID_COMPTE_PCE", new Integer(idCompteVenteProduit));
this.putValue("DEBIT", new Long(0));
this.putValue("CREDIT", new Long(prixHT.getLongValue()));
ajoutEcriture();
}
 
129,9 → 129,9
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));
this.putValue("ID_COMPTE_PCE", new Integer(idCompteTVA));
this.putValue("DEBIT", new Long(0));
this.putValue("CREDIT", new Long(tva));
ajoutEcriture();
}
 
143,9 → 143,9
idCompteClient = ComptePCESQLElement.getIdComptePceDefault("Clients");
}
}
this.mEcritures.put("ID_COMPTE_PCE", new Integer(idCompteClient));
this.mEcritures.put("DEBIT", new Long(prixTTC.getLongValue()));
this.mEcritures.put("CREDIT", new Long(0));
this.putValue("ID_COMPTE_PCE", new Integer(idCompteClient));
this.putValue("DEBIT", new Long(prixTTC.getLongValue()));
this.putValue("CREDIT", new Long(0));
ajoutEcriture();
 
// Règlement
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationReglementAchat.java
85,7 → 85,7
} else {
 
if (typeRegRow.getID() == 4) {
this.mEcritures.put("ID_JOURNAL", GenerationReglementAchat.journalCaisse);
this.putValue("ID_JOURNAL", GenerationReglementAchat.journalCaisse);
} else {
fillJournalBanqueFromRow(modeRegRow);
}
94,9 → 94,9
 
this.idMvt = getNewMouvement("REGLER_MONTANT", idRegMontant, rowMvtSource.getID(), rowMvtSource.getInt("ID_PIECE"));
 
this.mEcritures.put("DATE", this.date);
this.mEcritures.put("NOM", this.nom);
this.mEcritures.put("ID_MOUVEMENT", new Integer(this.idMvt));
this.putValue("DATE", this.date);
this.putValue("NOM", this.nom);
this.putValue("ID_MOUVEMENT", new Integer(this.idMvt));
 
// compte Fournisseurs
int idCompteFourn = rowFournisseur.getInt("ID_COMPTE_PCE");
109,15 → 109,15
}
}
 
this.mEcritures.put("ID_COMPTE_PCE", new Integer(idCompteFourn));
this.mEcritures.put("DEBIT", new Long(prixTTC.getLongValue()));
this.mEcritures.put("CREDIT", new Long(0));
this.putValue("ID_COMPTE_PCE", new Integer(idCompteFourn));
this.putValue("DEBIT", new Long(prixTTC.getLongValue()));
this.putValue("CREDIT", new Long(0));
ajoutEcriture();
 
// compte de reglement, caisse, CB, ...
fillCompteBanqueFromRow(modeRegRow, "AchatCB", true);
this.mEcritures.put("DEBIT", new Long(0));
this.mEcritures.put("CREDIT", new Long(prixTTC.getLongValue()));
this.putValue("DEBIT", new Long(0));
this.putValue("CREDIT", new Long(prixTTC.getLongValue()));
ajoutEcriture();
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtFichePaye.java
103,10 → 103,10
// SQLRow rowMois = tableMois.getRow(rowFiche.getInt("ID_MOIS"));
// SQLRow rowSal = tableSalarie.getRow(rowFiche.getInt("ID_SALARIE"));
this.nom = "Paye " + this.mois + " " + this.annee;
this.mEcritures.put("DATE", new java.sql.Date(this.date.getTime()));
this.mEcritures.put("NOM", this.nom);
this.mEcritures.put("ID_JOURNAL", journalOD);
this.mEcritures.put("ID_MOUVEMENT", Integer.valueOf(this.idMvt));
this.putValue("DATE", new java.sql.Date(this.date.getTime()));
this.putValue("NOM", this.nom);
this.putValue("ID_JOURNAL", journalOD);
this.putValue("ID_MOUVEMENT", Integer.valueOf(this.idMvt));
 
int idComptePaye = rowPrefsCompte.getInt("ID_COMPTE_PCE_PAYE");
if (idComptePaye <= 1) {
144,14 → 144,14
 
SQLRow rowFiche = tableFichePaye.getRow(this.idFichePaye[i]);
SQLRow rowSal = tableSalarie.getRow(rowFiche.getInt("ID_SALARIE"));
this.mEcritures.put("NOM", rowSal.getString("NOM") + " " + this.nom);
this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idComptePaye));
this.putValue("NOM", rowSal.getString("NOM") + " " + this.nom);
this.putValue("ID_COMPTE_PCE", Integer.valueOf(idComptePaye));
 
// float sal = rowFiche.getFloat("SAL_BRUT");
// totalSalaireBrut += sal;
 
this.mEcritures.put("DEBIT", totalSalaireBrut.setScale(2, RoundingMode.HALF_UP).movePointRight(2).longValue());
this.mEcritures.put("CREDIT", Long.valueOf(0));
this.putValue("DEBIT", totalSalaireBrut.setScale(2, RoundingMode.HALF_UP).movePointRight(2).longValue());
this.putValue("CREDIT", Long.valueOf(0));
ajoutEcriture();
}
 
209,23 → 209,23
}
 
String nomRub = rowSource.getString("NOM");
this.mEcritures.put("ID_COMPTE_PCE", idCompteCharge);
this.mEcritures.put("NOM", nomRub + ", " + rowSal.getString("NOM") + ", " + this.nom);
this.putValue("ID_COMPTE_PCE", idCompteCharge);
this.putValue("NOM", nomRub + ", " + rowSal.getString("NOM") + ", " + this.nom);
if (montant > 0) {
this.mEcritures.put("DEBIT", montant);
this.mEcritures.put("CREDIT", Long.valueOf(0));
this.putValue("DEBIT", montant);
this.putValue("CREDIT", Long.valueOf(0));
ajoutEcriture();
// this.mEcritures.put("DEBIT", Long.valueOf(0));
// this.mEcritures.put("CREDIT", montant);
// this.mEcritures.put("ID_COMPTE_PCE", idComptePayeRegl);
// this.putValue("DEBIT", Long.valueOf(0));
// this.putValue("CREDIT", montant);
// this.putValue("ID_COMPTE_PCE", idComptePayeRegl);
// ajoutEcriture();
} else {
this.mEcritures.put("DEBIT", Long.valueOf(0));
this.mEcritures.put("CREDIT", -montant);
this.putValue("DEBIT", Long.valueOf(0));
this.putValue("CREDIT", -montant);
ajoutEcriture();
// this.mEcritures.put("CREDIT", Long.valueOf(0));
// this.mEcritures.put("DEBIT", -montant);
// this.mEcritures.put("ID_COMPTE_PCE", idComptePayeRegl);
// this.putValue("CREDIT", Long.valueOf(0));
// this.putValue("DEBIT", -montant);
// this.putValue("ID_COMPTE_PCE", idComptePayeRegl);
// ajoutEcriture();
}
}
268,20 → 268,20
if (idComptePayeRegl <= 1) {
idComptePayeRegl = ComptePCESQLElement.getIdComptePceDefault("PayeReglement");
}
this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idComptePayeRegl));
this.mEcritures.put("NOM", rowSal.getString("NOM") + " " + this.nom);
this.putValue("ID_COMPTE_PCE", Integer.valueOf(idComptePayeRegl));
this.putValue("NOM", rowSal.getString("NOM") + " " + this.nom);
 
// float sal = rowFiche.getFloat("NET_A_PAYER");
 
this.mEcritures.put("DEBIT", Long.valueOf(0));
this.mEcritures.put("CREDIT", totalSalaireNet.setScale(2, RoundingMode.HALF_UP).movePointRight(2).longValue());
this.putValue("DEBIT", Long.valueOf(0));
this.putValue("CREDIT", totalSalaireNet.setScale(2, RoundingMode.HALF_UP).movePointRight(2).longValue());
ajoutEcriture();
}
 
/*
* this.mEcritures.put("ID_COMPTE_PCE", new Integer(ComptePCESQLElement.getId("421")));
* this.mEcritures.put("NOM", this.nom); this.mEcritures.put("DEBIT", new Float(0));
* this.mEcritures.put("CREDIT", new Float(totalSalaireBrut)); ajoutEcriture();
* this.putValue("ID_COMPTE_PCE", new Integer(ComptePCESQLElement.getId("421")));
* this.putValue("NOM", this.nom); this.putValue("DEBIT", new Float(0));
* this.putValue("CREDIT", new Float(totalSalaireBrut)); ajoutEcriture();
*/
 
// Acomptes
296,10 → 296,10
// if (idCompteAcompte <= 1) {
// idCompteAcompte = ComptePCESQLElement.getIdComptePceDefault("PayeAcompte");
// }
// this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idCompteAcompte));
// this.mEcritures.put("NOM", rowSal.getString("NOM") + " Acompte sur " + this.nom);
// this.mEcritures.put("DEBIT", Long.valueOf(0));
// this.mEcritures.put("CREDIT", Long.valueOf(acompte));
// this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteAcompte));
// this.putValue("NOM", rowSal.getString("NOM") + " Acompte sur " + this.nom);
// this.putValue("DEBIT", Long.valueOf(0));
// this.putValue("CREDIT", Long.valueOf(acompte));
// ajoutEcriture();
//
// SQLRow rowRegl = tableReglementPaye.getRow(rowSal.getInt("ID_REGLEMENT_PAYE"));
307,10 → 307,10
// if (idComptePayeRegl <= 1) {
// idComptePayeRegl = ComptePCESQLElement.getIdComptePceDefault("PayeReglement");
// }
// this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idComptePayeRegl));
// this.mEcritures.put("NOM", rowSal.getString("NOM") + " Acompte sur " + this.nom);
// this.mEcritures.put("DEBIT", Long.valueOf(acompte));
// this.mEcritures.put("CREDIT", Long.valueOf(0));
// this.putValue("ID_COMPTE_PCE", Integer.valueOf(idComptePayeRegl));
// this.putValue("NOM", rowSal.getString("NOM") + " Acompte sur " + this.nom);
// this.putValue("DEBIT", Long.valueOf(acompte));
// this.putValue("CREDIT", Long.valueOf(0));
// ajoutEcriture();
// }
// }
395,36 → 395,36
// enregistrement des ecritures pour les cotisations salariales et patronales
for (Entry<Integer, Long> entry : mapCompteCredSal.entrySet()) {
Integer idCompte = entry.getKey();
this.mEcritures.put("ID_COMPTE_PCE", idCompte);
this.mEcritures.put("NOM", "Cotisations salariales, " + this.nom);
this.mEcritures.put("DEBIT", Long.valueOf(0));
this.mEcritures.put("CREDIT", entry.getValue());
this.putValue("ID_COMPTE_PCE", idCompte);
this.putValue("NOM", "Cotisations salariales, " + this.nom);
this.putValue("DEBIT", Long.valueOf(0));
this.putValue("CREDIT", entry.getValue());
ajoutEcriture();
}
for (Entry<Integer, Long> entry : mapCompteDebSal.entrySet()) {
Integer idCompte = entry.getKey();
this.mEcritures.put("ID_COMPTE_PCE", idCompte);
this.mEcritures.put("NOM", "Cotisations salariales, " + this.nom);
this.mEcritures.put("CREDIT", Long.valueOf(0));
this.mEcritures.put("DEBIT", entry.getValue());
this.putValue("ID_COMPTE_PCE", idCompte);
this.putValue("NOM", "Cotisations salariales, " + this.nom);
this.putValue("CREDIT", Long.valueOf(0));
this.putValue("DEBIT", entry.getValue());
ajoutEcriture();
}
 
for (Entry<Integer, Long> entry : mapCompteCredPat.entrySet()) {
Integer idCompte = entry.getKey();
this.mEcritures.put("ID_COMPTE_PCE", idCompte);
this.mEcritures.put("NOM", "Cotisations patronales, " + this.nom);
this.mEcritures.put("DEBIT", Long.valueOf(0));
this.mEcritures.put("CREDIT", entry.getValue());
this.putValue("ID_COMPTE_PCE", idCompte);
this.putValue("NOM", "Cotisations patronales, " + this.nom);
this.putValue("DEBIT", Long.valueOf(0));
this.putValue("CREDIT", entry.getValue());
ajoutEcriture();
}
 
for (Entry<Integer, Long> entry : mapCompteDebPat.entrySet()) {
Integer idCompte = entry.getKey();
this.mEcritures.put("ID_COMPTE_PCE", idCompte);
this.mEcritures.put("NOM", "Cotisations patronales, " + this.nom);
this.mEcritures.put("CREDIT", Long.valueOf(0));
this.mEcritures.put("DEBIT", entry.getValue());
this.putValue("ID_COMPTE_PCE", idCompte);
this.putValue("NOM", "Cotisations patronales, " + this.nom);
this.putValue("CREDIT", Long.valueOf(0));
this.putValue("DEBIT", entry.getValue());
ajoutEcriture();
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationReglementVente.java
25,7 → 25,6
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.utils.ExceptionHandler;
 
import java.sql.SQLException;
import java.sql.Timestamp;
57,11 → 56,11
String s = encaisseMontantRow.getString("NOM");
this.nom = "Règlement vente " + ((s == null) ? "" : s) + " (" + typeRegRow.getString("NOM") + ")";
 
this.mEcritures.put("DATE", this.date);
this.mEcritures.put("NOM", this.nom);
this.putValue("DATE", this.date);
this.putValue("NOM", this.nom);
 
fillJournalBanqueFromRow(modeRegRow);
this.mEcritures.put("ID_MOUVEMENT", Integer.valueOf(this.idMvt));
this.putValue("ID_MOUVEMENT", Integer.valueOf(this.idMvt));
 
// si paiement comptant
if ((modeRegRow.getInt("AJOURS") == 0) && (modeRegRow.getInt("LENJOUR") == 0)) {
76,7 → 75,7
} else {
setDateReglement(idEncaisseRegl, idEchCli, this.date);
if (typeRegRow.getID() == TypeReglementSQLElement.ESPECE) {
this.mEcritures.put("ID_JOURNAL", GenerationReglementVente.journalCaisse);
this.putValue("ID_JOURNAL", GenerationReglementVente.journalCaisse);
}
 
SQLRow echeanceRow = null;
100,9 → 99,9
}
}
 
this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idCompteClient));
this.mEcritures.put("DEBIT", Long.valueOf(0));
this.mEcritures.put("CREDIT", Long.valueOf(prixTTC.getLongValue()));
this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteClient));
this.putValue("DEBIT", Long.valueOf(0));
this.putValue("CREDIT", Long.valueOf(prixTTC.getLongValue()));
ajoutEcriture();
 
// compte de reglement, caisse, cheque, ...
112,12 → 111,12
idCompteRegl = ComptePCESQLElement.getIdComptePceDefault("VenteEspece");
}
 
this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idCompteRegl));
this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteRegl));
} else {
fillCompteBanqueFromRow(modeRegRow, "VenteCB", false);
}
this.mEcritures.put("DEBIT", Long.valueOf(prixTTC.getLongValue()));
this.mEcritures.put("CREDIT", Long.valueOf(0));
this.putValue("DEBIT", Long.valueOf(prixTTC.getLongValue()));
this.putValue("CREDIT", Long.valueOf(0));
ajoutEcriture();
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtReglementVenteFacture.java
17,11 → 17,13
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
import org.openconcerto.erp.core.finance.accounting.element.JournalSQLElement;
import org.openconcerto.erp.core.finance.payment.element.ModeDeReglementSQLElement;
import org.openconcerto.erp.core.finance.payment.element.TypeReglementSQLElement;
import org.openconcerto.erp.model.PrixTTC;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.StringUtils;
 
import java.sql.SQLException;
import java.sql.Timestamp;
70,9 → 72,11
}
 
// iniatilisation des valeurs de la map
 
this.date = (Date) saisieRow.getObject("DATE");
this.nom = "Saisie Vente facture " + saisieRow.getObject("NUMERO").toString() + " (" + typeRegRow.getString("NOM") + ")";
 
this.nom = "Facture " + saisieRow.getObject("NUMERO").toString() + " (" + typeRegRow.getString("NOM") + ") " + StringUtils.limitLength(clientRow.getString("NOM"), 20);
this.nom = this.nom.trim();
// si paiement comptant
if ((modeRegRow.getInt("AJOURS") == 0) && (modeRegRow.getInt("LENJOUR") == 0)) {
// test Cheque
80,17 → 84,21
// Ajout dans cheque à encaisser sans date minimum d'encaissement
paiementCheque(this.date);
} else {
 
if (typeRegRow.getID() == TypeReglementSQLElement.CB && modeRegRow.getObject("DATE") != null) {
this.date = (Date) modeRegRow.getObject("DATE");
}
setDateReglement(saisieRow);
if (typeRegRow.getID() == 4) {
this.mEcritures.put("ID_JOURNAL", GenerationMvtReglementVenteFacture.journalCaisse);
this.putValue("ID_JOURNAL", GenerationMvtReglementVenteFacture.journalCaisse);
} else {
fillJournalBanqueFromRow(modeRegRow);
}
 
this.idMvt = idPere;
this.mEcritures.put("DATE", new java.sql.Date(this.date.getTime()));
this.mEcritures.put("NOM", this.nom);
this.mEcritures.put("ID_MOUVEMENT", new Integer(this.idMvt));
this.putValue("DATE", new java.sql.Date(this.date.getTime()));
this.putValue("NOM", this.nom);
this.putValue("ID_MOUVEMENT", new Integer(this.idMvt));
 
// compte Clients
int idCompteClient = clientRow.getInt("ID_COMPTE_PCE");
101,15 → 109,15
}
}
 
this.mEcritures.put("ID_COMPTE_PCE", new Integer(idCompteClient));
this.mEcritures.put("DEBIT", new Long(0));
this.mEcritures.put("CREDIT", new Long(prixTTC.getLongValue()));
this.putValue("ID_COMPTE_PCE", new Integer(idCompteClient));
this.putValue("DEBIT", new Long(0));
this.putValue("CREDIT", new Long(prixTTC.getLongValue()));
ajoutEcriture();
 
// compte de reglement, caisse, cheque, ...
fillCompteBanqueFromRow(modeRegRow, "VenteCB", false);
this.mEcritures.put("DEBIT", new Long(prixTTC.getLongValue()));
this.mEcritures.put("CREDIT", new Long(0));
this.putValue("DEBIT", new Long(prixTTC.getLongValue()));
this.putValue("CREDIT", new Long(0));
ajoutEcriture();
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtFactureFournisseur.java
61,12 → 61,12
// iniatilisation des valeurs de la map
this.date = (Date) saisieRow.getObject("DATE");
this.nom = "Achat : " + rowFournisseur.getString("NOM") + " Facture : " + saisieRow.getObject("NUMERO").toString() + " " + saisieRow.getObject("NOM").toString();
this.mEcritures.put("DATE", this.date);
this.putValue("DATE", this.date);
// AccountingRecordsProvider provider = AccountingRecordsProviderManager.get(ID);
// provider.putLabel(saisieRow, this.mEcritures);
this.mEcritures.put("NOM", nom);
this.mEcritures.put("ID_JOURNAL", GenerationMvtFactureFournisseur.journal);
this.mEcritures.put("ID_MOUVEMENT", new Integer(1));
this.putValue("NOM", nom);
this.putValue("ID_JOURNAL", GenerationMvtFactureFournisseur.journal);
this.putValue("ID_MOUVEMENT", new Integer(1));
 
// on calcule le nouveau numero de mouvement
if (this.idMvt == 1) {
80,7 → 80,7
rowValsPiece.put("NOM", saisieRow.getObject("NUMERO").toString());
rowValsPiece.update();
 
this.mEcritures.put("ID_MOUVEMENT", new Integer(this.idMvt));
this.putValue("ID_MOUVEMENT", new Integer(this.idMvt));
}
 
// generation des ecritures + maj des totaux du compte associe
94,10 → 94,10
rowCompteAchat = ComptePCESQLElement.getRowComptePceDefault("Achats");
}
}
BigDecimal portHT = BigDecimal.valueOf(saisieRow.getLong("PORT_HT")).movePointLeft(2);
TotalCalculator calc = getValuesFromElement(rowFournisseur.getBoolean("UE"), true, "T_PA_HT", saisieRow, saisieRow.getTable().getTable("FACTURE_FOURNISSEUR_ELEMENT"), portHT,
saisieRow.getForeign("ID_TAXE_PORT"), 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();
 
104,9 → 104,9
for (SQLRowAccessor row : calc.getMapHt().keySet()) {
long b = calc.getMapHt().get(row).setScale(2, RoundingMode.HALF_UP).movePointRight(2).longValue();
if (b != 0) {
this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(row.getID()));
this.mEcritures.put("CREDIT", Long.valueOf(0));
this.mEcritures.put("DEBIT", Long.valueOf(b));
this.putValue("ID_COMPTE_PCE", Integer.valueOf(row.getID()));
this.putValue("CREDIT", Long.valueOf(0));
this.putValue("DEBIT", Long.valueOf(b));
SQLRow rowEcr = ajoutEcriture();
// addAssocAnalytiqueFromProvider(rowEcr, saisieRow);
}
116,9 → 116,9
for (SQLRowAccessor rowAc : tvaMap.keySet()) {
long longValue = tvaMap.get(rowAc).setScale(2, RoundingMode.HALF_UP).movePointRight(2).longValue();
if (longValue != 0) {
this.mEcritures.put("ID_COMPTE_PCE", rowAc.getID());
this.mEcritures.put("CREDIT", Long.valueOf(0));
this.mEcritures.put("DEBIT", longValue);
this.putValue("ID_COMPTE_PCE", rowAc.getID());
this.putValue("CREDIT", Long.valueOf(0));
this.putValue("DEBIT", longValue);
ajoutEcriture();
 
// if (rowFournisseur.getBoolean("UE")) {
126,9 → 126,9
// 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));
// this.putValue("ID_COMPTE_PCE", new Integer(idCompteTVAIntra));
// this.putValue("DEBIT", new Long(0));
// this.putValue("CREDIT", new Long(longValue));
// ajoutEcriture();
// }
}
138,9 → 138,9
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);
this.putValue("ID_COMPTE_PCE", rowAc.getID());
this.putValue("DEBIT", Long.valueOf(0));
this.putValue("CREDIT", longValue);
ajoutEcriture();
 
// if (rowFournisseur.getBoolean("UE")) {
148,9 → 148,9
// 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));
// this.putValue("ID_COMPTE_PCE", new Integer(idCompteTVAIntra));
// this.putValue("DEBIT", new Long(0));
// this.putValue("CREDIT", new Long(longValue));
// ajoutEcriture();
// }
}
165,12 → 165,12
idCompteFourn = ComptePCESQLElement.getIdComptePceDefault("Fournisseurs");
}
}
this.mEcritures.put("ID_COMPTE_PCE", new Integer(idCompteFourn));
this.mEcritures.put("DEBIT", new Long(0));
this.putValue("ID_COMPTE_PCE", new Integer(idCompteFourn));
this.putValue("DEBIT", new Long(0));
if (rowFournisseur.getBoolean("UE")) {
this.mEcritures.put("CREDIT", new Long(htLongValue));
this.putValue("CREDIT", new Long(htLongValue));
} else {
this.mEcritures.put("CREDIT", new Long(ttcLongValue));
this.putValue("CREDIT", new Long(ttcLongValue));
}
ajoutEcriture();
 
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtReglementVenteComptoir.java
79,12 → 79,12
this.idMvt = idPere;
 
// iniatilisation des valeurs de la map pour les ecritures
this.mEcritures.put("DATE", new java.sql.Date(this.date.getTime()));
this.mEcritures.put("NOM", this.nom);
this.mEcritures.put("ID_MOUVEMENT", new Integer(this.idMvt));
this.putValue("DATE", new java.sql.Date(this.date.getTime()));
this.putValue("NOM", this.nom);
this.putValue("ID_MOUVEMENT", new Integer(this.idMvt));
 
if (typeRegRow.getID() == 4) {
this.mEcritures.put("ID_JOURNAL", GenerationMvtReglementVenteComptoir.journalCaisse);
this.putValue("ID_JOURNAL", GenerationMvtReglementVenteComptoir.journalCaisse);
} else {
fillJournalBanqueFromRow(modeRegRow);
}
98,9 → 98,9
}
}
 
this.mEcritures.put("ID_COMPTE_PCE", new Integer(idCompteClient));
this.mEcritures.put("DEBIT", new Long(0));
this.mEcritures.put("CREDIT", new Long(prixTTC.getLongValue()));
this.putValue("ID_COMPTE_PCE", new Integer(idCompteClient));
this.putValue("DEBIT", new Long(0));
this.putValue("CREDIT", new Long(prixTTC.getLongValue()));
ajoutEcriture();
 
// compte de reglement
110,12 → 110,12
idCompteRegl = ComptePCESQLElement.getIdComptePceDefault("VenteEspece");
}
 
this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idCompteRegl));
this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteRegl));
} else {
fillCompteBanqueFromRow(modeRegRow, "VenteCB", false);
}
this.mEcritures.put("DEBIT", new Long(prixTTC.getLongValue()));
this.mEcritures.put("CREDIT", new Long(0));
this.putValue("DEBIT", new Long(prixTTC.getLongValue()));
this.putValue("CREDIT", new Long(0));
ajoutEcriture();
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtReglementFactureFournisseur.java
94,12 → 94,12
this.idMvt = this.idPere;
 
// iniatilisation des valeurs de la map
this.mEcritures.put("DATE", new java.sql.Date(this.date.getTime()));
this.mEcritures.put("NOM", this.nom);
this.mEcritures.put("ID_MOUVEMENT", Integer.valueOf(this.idMvt));
this.putValue("DATE", new java.sql.Date(this.date.getTime()));
this.putValue("NOM", this.nom);
this.putValue("ID_MOUVEMENT", Integer.valueOf(this.idMvt));
 
if (typeRegRow.getID() == 4) {
this.mEcritures.put("ID_JOURNAL", GenerationMvtReglementFactureFournisseur.journalCaisse);
this.putValue("ID_JOURNAL", GenerationMvtReglementFactureFournisseur.journalCaisse);
} else {
 
fillJournalBanqueFromRow(modeRegRow);
114,9 → 114,9
}
}
 
this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(compteFourn));
this.mEcritures.put("DEBIT", Long.valueOf(prixTTC.getLongValue()));
this.mEcritures.put("CREDIT", Long.valueOf(0));
this.putValue("ID_COMPTE_PCE", Integer.valueOf(compteFourn));
this.putValue("DEBIT", Long.valueOf(prixTTC.getLongValue()));
this.putValue("CREDIT", Long.valueOf(0));
ajoutEcriture();
 
// compte de reglement, caisse, CB, ...
126,12 → 126,12
idCompteRegl = ComptePCESQLElement.getIdComptePceDefault("AchatEspece");
}
 
this.mEcritures.put("ID_COMPTE_PCE", Integer.valueOf(idCompteRegl));
this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteRegl));
} else {
fillCompteBanqueFromRow(modeRegRow, "AchatCB", true);
}
this.mEcritures.put("DEBIT", Long.valueOf(0));
this.mEcritures.put("CREDIT", Long.valueOf(prixTTC.getLongValue()));
this.putValue("DEBIT", Long.valueOf(0));
this.putValue("CREDIT", Long.valueOf(prixTTC.getLongValue()));
ajoutEcriture();
}
} else {
/trunk/OpenConcerto/src/org/openconcerto/erp/core/reports/history/ui/ListeHistoriquePanel.java
20,6 → 20,7
import org.openconcerto.erp.core.finance.accounting.ui.SuppressionEcrituresPanel;
import org.openconcerto.erp.core.sales.invoice.report.VenteFactureElementXmlSheet;
import org.openconcerto.erp.core.sales.quote.ui.EtatDevisRenderer;
import org.openconcerto.erp.core.supplychain.order.action.ImportProductsToOrder;
import org.openconcerto.erp.generationDoc.AbstractSheetXml;
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
import org.openconcerto.sql.Configuration;
41,20 → 42,31
import org.openconcerto.sql.view.IListPanel;
import org.openconcerto.sql.view.ListeAddPanel;
import org.openconcerto.sql.view.list.IListe;
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
import org.openconcerto.sql.view.list.ITableModel;
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.SwingThreadUtils;
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.cc.ITransformer;
 
import java.awt.Color;
import java.awt.Component;
import java.awt.FileDialog;
import java.awt.Font;
import java.awt.Frame;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.math.BigInteger;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
64,6 → 76,7
import java.util.Set;
import java.util.Vector;
 
import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
361,8 → 374,51
}
}
};
if (createTableSource.getPrimaryTable().getName().equals("DEMANDE_ACHAT_ELEMENT")) {
final ListeAddPanel listeDmd = (ListeAddPanel) liste;
PredicateRowAction actionDrop = new PredicateRowAction(new AbstractAction("Importer depuis Fichier Inventor") {
 
@Override
public void actionPerformed(ActionEvent e) {
final Frame frame = SwingThreadUtils.getAncestorOrSelf(Frame.class, (Component) e.getSource());
final FileDialog fd = new FileDialog(frame, "Import fichier inventor", FileDialog.LOAD);
fd.setFilenameFilter(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.endsWith(".xls");
}
});
fd.setVisible(true);
if (fd.getFile() != null) {
 
ImportProductsToOrder importer = new ImportProductsToOrder();
if (getSelectedRow() == null) {
JOptionPane.showMessageDialog(frame, "Import impossible! Aucune affaire sélectionnée.");
} else {
int a = JOptionPane.showConfirmDialog(frame,
"Etes vous sûr de vouloir importer ces éléments dans l'affaire N°" + getSelectedRow().getString("NUMERO") + "?", "Import invertor",
JOptionPane.YES_NO_OPTION);
if (a == JOptionPane.YES_OPTION) {
importer.setRowAffaire(getSelectedRow());
importer.setRowFamille(sqlRow);
try {
importer.importFile(new File(fd.getDirectory(), fd.getFile()), createTableSource.getPrimaryTable().getDBRoot());
listeDmd.getListe().getModel().updateAll();
} catch (IOException e1) {
ExceptionHandler.handle("Erreur lors de l'import du fichier!", e1);
} catch (SQLException e1) {
ExceptionHandler.handle("Erreur lors de l'import du fichier!", e1);
}
}
}
}
}
}, true);
actionDrop.setPredicate(IListeEvent.createSelectionCountPredicate(0, Integer.MAX_VALUE));
liste.getListe().addIListeAction(actionDrop);
}
}
 
this.vectListePanel.add(liste);
 
setRenderer(liste);
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/supplier/component/FournisseurSQLComponent.java
321,8 → 321,9
 
// Contact
JPanel panelContact = new JPanel(new GridBagLayout());
 
panelContact.setOpaque(false);
this.table = new ContactItemTable(this.defaultContactRowVals);
this.table.setOpaque(false);
this.table.setPreferredSize(new Dimension(this.table.getSize().width, 150));
GridBagConstraints cContact = new DefaultGridBagConstraints();
cContact.fill = GridBagConstraints.BOTH;
332,14 → 333,14
tabbedPane.add("Contacts", panelContact);
c.gridx = 0;
c.gridy++;
c.anchor = GridBagConstraints.WEST;
c.anchor = GridBagConstraints.NORTHWEST;
c.fill = GridBagConstraints.BOTH;
c.gridwidth = GridBagConstraints.REMAINDER;
this.add(tabbedPane, c);
 
// Mode de régelement
// Mode de réglement
TitledSeparator reglSep = new TitledSeparator(getLabelFor("ID_MODE_REGLEMENT"));
c.gridwidth = GridBagConstraints.REMAINDER;
c.gridwidth = 2;
c.gridy++;
c.gridx = 0;
this.add(reglSep, c);
351,6 → 352,48
ElementSQLObject eltModeRegl = (ElementSQLObject) this.getView("ID_MODE_REGLEMENT");
this.add(eltModeRegl, c);
 
//
{
c.gridx = 2;
c.gridy--;
c.gridwidth = 2;
c.fill = GridBagConstraints.BOTH;
TitledSeparator ribSep = new TitledSeparator("Coordonnées bancaires");
 
this.add(ribSep, c);
 
final JPanel pCoordonneesBancaires = new JPanel();
pCoordonneesBancaires.setLayout(new GridBagLayout());
GridBagConstraints c2 = new DefaultGridBagConstraints();
 
c2.gridy++;
// IBAN
JLabel labelIBAN = new JLabel("IBAN", SwingConstants.RIGHT);
JTextField textIBAN = new JTextField(40);
c2.weightx = 0;
pCoordonneesBancaires.add(labelIBAN, c2);
c2.gridx++;
c2.weightx = 1;
pCoordonneesBancaires.add(textIBAN, c2);
 
// BIC
JLabel labelBIC = new JLabel("BIC", SwingConstants.RIGHT);
JTextField textBIC = new JTextField(12);
c2.gridx = 0;
c2.gridy++;
c2.weightx = 0;
pCoordonneesBancaires.add(labelBIC, c2);
c2.gridx++;
c2.weightx = 1;
c2.fill = GridBagConstraints.NONE;
pCoordonneesBancaires.add(textBIC, c2);
c.gridy++;
c.fill = GridBagConstraints.HORIZONTAL;
this.add(pCoordonneesBancaires, c);
 
this.addView(textIBAN, "IBAN");
this.addView(textBIC, "BIC");
}
// Compte associé
 
c.gridx = 0;
379,8 → 422,6
panel.add(compteSelCharge, c2);
addView(compteSelCharge, "ID_COMPTE_PCE_CHARGE");
 
 
 
c.gridwidth = GridBagConstraints.REMAINDER;
c.gridy++;
c.gridx = 0;
388,6 → 429,12
c.anchor = GridBagConstraints.NORTHWEST;
this.add(panel, c);
 
c.gridwidth = 1;
c.gridy++;
c.gridx = 0;
c.weightx = 1;
c.anchor = GridBagConstraints.NORTHWEST;
 
// INfos
c.gridx = 0;
c.gridy++;
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/element/DemandeAchatItemSQLElement.java
18,26 → 18,25
 
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.erp.core.common.element.StyleSQLElement;
import org.openconcerto.erp.core.common.ui.DeviseTableCellRenderer;
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
import org.openconcerto.erp.core.supplychain.order.ui.EtatDemandeAchatRenderer;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.model.FieldPath;
import org.openconcerto.sql.model.SQLInjector;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLRowValuesListFetcher;
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.model.graph.Path;
import org.openconcerto.sql.view.EditFrame;
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
import org.openconcerto.sql.view.list.IListe;
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
import org.openconcerto.sql.view.list.RowAction;
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
import org.openconcerto.sql.view.list.SQLTableModelSource;
import org.openconcerto.ui.FrameUtil;
import org.openconcerto.utils.CollectionUtils;
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.ListMap;
import org.openconcerto.utils.cc.ITransformer;
50,7 → 49,6
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Set;
 
import javax.swing.AbstractAction;
 
58,7 → 56,37
 
public DemandeAchatItemSQLElement() {
super("DEMANDE_ACHAT_ELEMENT", "une demande d'achat", "demandes d'achat");
{
PredicateRowAction actionP = new PredicateRowAction(new AbstractAction("Créer à partir de") {
 
@Override
public void actionPerformed(ActionEvent e) {
SQLRow row = IListe.get(e).getSelectedRow().asRow();
SQLRowValues rowDupl = new SQLRowValues(row.getTable());
List<String> copyFields = Arrays.asList("COLOR", "NUMERO_SE", "DESCRIPTIF_SE", "REVISION", "P_HT", "T_HT", "REPERE_SOURCE", "CODE_SOURCE", "NOM_SOURCE", "CODE", "NOM", "QTE",
"QTE_UNITAIRE", "REPERE", "REFERENCE", "ID_FABRICANT", "ID_UNITE_VENTE", "ID_ARTICLE", "ID_FOURNISSEUR", "ID_FAMILLE_ARTICLE", "ID_AFFAIRE");
// "CODE" character varying(256) NOT NULL DEFAULT ''::character varying,
//
// "DATE" date,
// "ID_ETAT_DEMANDE_ACHAT_ELEMENT" integer DEFAULT 1,
// "REPRISE" boolean NOT NULL DEFAULT false,
for (String string : copyFields) {
if (string.startsWith("ID_")) {
rowDupl.put(string, row.getForeignID(string));
} else {
rowDupl.put(string, row.getObject(string));
}
}
rowDupl.put("DATE", new Date());
EditFrame frame = new EditFrame(getDirectory().getElement("DEMANDE_ACHAT_ELEMENT"));
frame.getSQLComponent().select(rowDupl);
FrameUtil.showPacked(frame);
}
}, true);
 
actionP.setPredicate(IListeEvent.getSingleSelectionPredicate());
getRowActions().add(actionP);
}
{
RowAction actionP = new RowAction(new AbstractAction("Transfert en demande de prix") {
 
77,6 → 105,7
rowVals.put("ID_AFFAIRE", row.getForeignID("ID_AFFAIRE"));
SQLRowValues rowValsCmdElt = inj.createRowValuesFrom(row);
rowValsCmdElt.put("ID_STYLE", idNormal);
rowValsCmdElt.put("ID_MODE_VENTE_ARTICLE", ReferenceArticleSQLElement.A_LA_PIECE);
rowValsCmdElt.put("ID_TAXE", TaxeCache.getCache().getFirstTaxe().getID());
rowValsCmdElt.put("ID_DEMANDE_PRIX", rowVals);
rowValsCmdElt.put("ID_DEMANDE_ACHAT_ELEMENT", row.getID());
136,6 → 165,7
rowVals.put("ID_AFFAIRE", row.getForeignID("ID_AFFAIRE"));
SQLRowValues rowValsCmdElt = inj.createRowValuesFrom(row);
rowValsCmdElt.put("ID_STYLE", idNormal);
rowValsCmdElt.put("ID_MODE_VENTE_ARTICLE", ReferenceArticleSQLElement.A_LA_PIECE);
rowValsCmdElt.put("ID_TAXE", TaxeCache.getCache().getFirstTaxe().getID());
rowValsCmdElt.put("ID_COMMANDE", rowVals);
rowValsCmdElt.put("ID_DEMANDE_ACHAT_ELEMENT", row.getID());
209,6 → 239,7
 
SQLRowValues rowVals = new SQLRowValues(getTable());
rowVals.put("QTE", null);
rowVals.put("QTE_UNITAIRE", null);
rowVals.put("ID_ETAT_DEMANDE_ACHAT_ELEMENT", null);
 
final List<String> refTable = Arrays.asList("COMMANDE_ELEMENT", "DEMANDE_PRIX_ELEMENT", "BON_RECEPTION_ELEMENT");
215,6 → 246,7
for (String tableName : refTable) {
SQLRowValues rowValsRef = new SQLRowValues(getTable().getTable(tableName));
rowValsRef.put("QTE", null);
rowValsRef.put("PA_HT", null);
rowValsRef.put("ID_DEMANDE_ACHAT_ELEMENT", rowVals);
rowValsRef.put("QTE_UNITAIRE", null);
rowValsRef.put("ID_" + tableName.replaceAll("_ELEMENT", ""), null);
244,13 → 276,17
if (!rowValsBR.isEmpty()) {
int qte = 0;
int idBR = 1;
BigDecimal prix = BigDecimal.ZERO;
for (SQLRowValues sqlRowValues : rowValsBR) {
qte += sqlRowValues.getInt("QTE");
idBR = sqlRowValues.getForeignID("ID_BON_RECEPTION");
prix = sqlRowValues.getBigDecimal("PA_HT");
}
if (qte > 0) {
createEmptyUpdateRow.put("ID_BON_RECEPTION", idBR);
createEmptyUpdateRow.put("QTE_RECUE", qte);
createEmptyUpdateRow.put("P_HT", prix);
createEmptyUpdateRow.put("T_HT", prix.multiply(rowValsDmd.getBigDecimal("QTE_UNITAIRE").multiply(new BigDecimal(rowValsDmd.getInt("QTE")))));
if (qte >= rowValsDmd.getInt("QTE")) {
newStatus = EtatDemandeAchatItemSQLElement.RECPETION;
} else {
260,7 → 296,10
} else {
Collection<SQLRowValues> rowValsCmd = rowValsDmd.getReferentRows(getTable().getTable("COMMANDE_ELEMENT"));
if (!rowValsCmd.isEmpty()) {
createEmptyUpdateRow.put("ID_COMMANDE", rowValsCmd.iterator().next().getForeignID("ID_COMMANDE"));
final SQLRowValues next = rowValsCmd.iterator().next();
createEmptyUpdateRow.put("ID_COMMANDE", next.getForeignID("ID_COMMANDE"));
createEmptyUpdateRow.put("P_HT", next.getBigDecimal("PA_HT"));
createEmptyUpdateRow.put("T_HT", next.getBigDecimal("PA_HT").multiply(rowValsDmd.getBigDecimal("QTE_UNITAIRE").multiply(new BigDecimal(rowValsDmd.getInt("QTE")))));
newStatus = EtatDemandeAchatItemSQLElement.COMMANDE;
} else {
Collection<SQLRowValues> rowValsDmdElt = rowValsDmd.getReferentRows(getTable().getTable("DEMANDE_PRIX_ELEMENT"));
284,13 → 323,17
@Override
protected List<String> getListFields() {
final List<String> l = new ArrayList<String>();
 
l.add("DATE");
l.add("REVISION");
l.add("CODE");
l.add("NOM");
l.add("IMPORT");
l.add("REPRISE");
l.add("QTE_UNITAIRE");
l.add("ID_UNITE_VENTE");
l.add("P_HT");
l.add("QTE");
l.add("T_HT");
l.add("ID_FABRICANT");
l.add("ID_FOURNISSEUR");
l.add("CODE_SOURCE");
308,30 → 351,35
res.init();
res.getColumn(foreignTable.getField("NOM")).setRenderer(new EtatDemandeAchatRenderer(foreignTable));
 
BaseSQLTableModelColumn dpt = new BaseSQLTableModelColumn("Prix", BigDecimal.class) {
res.getColumn(getTable().getField("P_HT")).setRenderer(new DeviseTableCellRenderer());
res.getColumn(getTable().getField("T_HT")).setRenderer(new DeviseTableCellRenderer());
res.getColumn(getTable().getField("QTE_UNITAIRE")).setRenderer(new DeviseTableCellRenderer());
 
@Override
protected Object show_(SQLRowAccessor r) {
// BaseSQLTableModelColumn dpt = new BaseSQLTableModelColumn("Prix Total", BigDecimal.class)
// {
//
// @Override
// protected Object show_(SQLRowAccessor r) {
//
// if (r.getObject("ID_ARTICLE") != null && !r.isForeignEmpty("ID_ARTICLE")) {
// SQLRowAccessor rA = r.getForeign("ID_ARTICLE");
// return rA.getBigDecimal("PA_HT");
// } else {
// return null;
// }
// }
//
// @Override
// public Set<FieldPath> getPaths() {
// Path p = new Path(getTable());
// final SQLTable clientT = getTable().getForeignTable("ID_ARTICLE");
// p = p.add(clientT);
// return CollectionUtils.createSet(new FieldPath(p, "PA_HT"));
// }
// };
//
// res.getColumns().add(dpt);
 
if (r.getObject("ID_ARTICLE") != null && !r.isForeignEmpty("ID_ARTICLE")) {
SQLRowAccessor rA = r.getForeign("ID_ARTICLE");
return rA.getBigDecimal("PA_HT");
} else {
return null;
}
}
 
@Override
public Set<FieldPath> getPaths() {
Path p = new Path(getTable());
final SQLTable clientT = getTable().getForeignTable("ID_ARTICLE");
p = p.add(clientT);
return CollectionUtils.createSet(new FieldPath(p, "PA_HT"));
}
};
 
res.getColumns().add(dpt);
 
super._initTableSource(res);
}
 
345,7 → 393,14
@Override
protected List<String> getComboFields() {
final List<String> l = new ArrayList<String>();
l.add("ID_FOURNISSEUR");
if (getTable().contains("ID_AFFAIRE")) {
l.add("ID_AFFAIRE");
}
l.add("DATE");
l.add("REVISION");
l.add("CODE");
l.add("NOM");
 
return l;
}
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/element/DemandeAchatItemSQLComponent.java
78,7 → 78,7
c.weightx = 1;
final ElementComboBox boxCmd = new ElementComboBox();
this.add(boxCmd, c);
this.addView(boxCmd, "ID_ETAT_DEMANDE_ACHAT_ELEMENT", REQ);
this.addView(boxCmd, "ID_ETAT_DEMANDE_ACHAT_ELEMENT");
 
c.gridx = 0;
c.gridy++;
201,8 → 201,21
 
c.gridx++;
c.weightx = 0;
this.add(new JCheckBox("En stock"), c);
final JCheckBox checkReprise = new JCheckBox("Reprise");
this.add(checkReprise, c);
addView(checkReprise, "REPRISE");
 
c.weightx = 0;
c.gridy++;
c.gridx = 0;
c.weightx = 0;
this.add(new JLabel(getLabelFor("REVISION"), SwingConstants.RIGHT), c);
c.gridx++;
c.weightx = 1;
final JTextField textRev = new JTextField(15);
this.add(textRev, c);
this.addView(textRev, "REVISION");
 
boxArticle.addValueListener(new PropertyChangeListener() {
 
@Override
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/action/ImportProductsToOrder.java
14,7 → 14,6
package org.openconcerto.erp.core.supplychain.order.action;
 
import org.openconcerto.erp.core.sales.product.element.UniteVenteArticleSQLElement;
import org.openconcerto.erp.core.supplychain.order.element.EtatDemandeAchatItemSQLElement;
import org.openconcerto.erp.importer.ArrayTableModel;
import org.openconcerto.erp.importer.DataImporter;
import org.openconcerto.sql.model.DBRoot;
52,7 → 51,6
public static void main(String[] args) throws IOException, SQLException {
ImportProductsToOrder importer = new ImportProductsToOrder();
importer.importFile(new File("export-inventor-17-819.xls"), null);
 
}
 
private SQLRowAccessor rowAffaire = null;
61,6 → 59,12
this.rowAffaire = rowAffaire;
}
 
private SQLRowAccessor rowFamille = null;
 
public void setRowFamille(SQLRowAccessor rowFamille) {
this.rowFamille = rowFamille;
}
 
public void importFile(File file, DBRoot root) throws IOException, SQLException {
this.root = root;
DataImporter importer = new DataImporter();
106,8 → 110,9
importer.map(10, table.getField("REPERE_SOURCE"));
importer.map(11, table.getField("CODE_SOURCE"));
importer.map(12, table.getField("NOM_SOURCE"));
importer.map(13, table.getField("ID_FAMILLE_ARTICLE"));
if (table.contains("ID_AFFAIRE")) {
importer.map(13, table.getField("ID_AFFAIRE"));
importer.map(14, table.getField("ID_AFFAIRE"));
}
importer.importFromModel(cleanModel);
// importer.commit();
128,7 → 133,7
for (SQLRowValues rowValsToInsert : rowsToInsert) {
 
String query = "INSERT INTO " + rowValsToInsert.getTable().getSQLName();
query += " (\"REPERE\", \"QTE\", \"QTE_UNITAIRE\", \"ID_UNITE_VENTE\", \"NOM\", \"CODE\", \"ID_FABRICANT\", \"ID_ETAT_DEMANDE_ACHAT_ELEMENT\", \"ID_ARTICLE\",\"REVISION\",\"REPERE_SOURCE\",\"CODE_SOURCE\",\"NOM_SOURCE\", ";
query += " (\"REPERE\", \"QTE\", \"QTE_UNITAIRE\", \"ID_UNITE_VENTE\", \"NOM\", \"CODE\", \"ID_FABRICANT\", \"ID_ETAT_DEMANDE_ACHAT_ELEMENT\", \"ID_ARTICLE\",\"REVISION\",\"REPERE_SOURCE\",\"CODE_SOURCE\",\"NOM_SOURCE\",\"IMPORT\",\"ID_FAMILLE_ARTICLE\", ";
if (table.contains("ID_AFFAIRE")) {
query += "\"ID_AFFAIRE\",";
}
148,9 → 153,16
query += foreignID + ", ";
query += SQLBase.quoteStringStd(rowValsToInsert.getString("REVISION")) + ", ";
query += SQLBase.quoteStringStd(rowValsToInsert.getString("REPERE_SOURCE")) + ", ";
query += SQLBase.quoteStringStd(rowValsToInsert.getString("CODE_SOURCE")) + ", ";
String codeSource = rowValsToInsert.getString("CODE_SOURCE");
if (table.contains("ID_AFFAIRE")) {
if (codeSource == null || codeSource.trim().length() == 0) {
codeSource = rowValsToInsert.getForeign("ID_AFFAIRE").getString("NUMERO") + "_000";
}
}
query += SQLBase.quoteStringStd(codeSource) + ", ";
query += SQLBase.quoteStringStd(rowValsToInsert.getString("NOM_SOURCE")) + ", ";
 
query += "true" + ", ";
query += rowValsToInsert.getForeignID("ID_FAMILLE_ARTICLE") + ", ";
if (table.contains("ID_AFFAIRE")) {
query += rowValsToInsert.getForeignID("ID_AFFAIRE") + ", ";
}
176,13 → 188,25
return size;
}
 
// - NORMAL: Ligne Appparente dans ERP
//
// - ACHETE: 1ere Ligne Apparente Uniquement
//
// - INDIVISIBLE: Ne doit PAS Apparaitre Dans l'ERP
 
while (index < size) {
List<Object> line = m.getLineValuesAt(index);
String structure = (line.get(6) == null ? "" : line.get(6)).toString();
// repere
String repere = line.get(0).toString();
if (repere.trim().length() == 0) {
return size;
}
 
if (repere.endsWith(".0")) {
repere = repere.replaceAll(".0", "");
}
 
// qty
Object c1 = line.get(1);
int qty = 1;
212,8 → 236,8
// ref
Object des = line.get(2);
Object ref = line.get(3);
if (parent == null || parent.get0() == null || repere.startsWith(parent.get0())) {
if (repereNext != null && repereNext.startsWith(repere)) {
if (parent == null || parent.get0() == null || repere.startsWith(parent.get0() + ".")) {
if (repereNext != null && repereNext.startsWith(repere + ".") && !structure.equalsIgnoreCase("Acheté") && !structure.equalsIgnoreCase("Indivisible")) {
BigDecimal qtyMultChild = qtyMult.multiply(uQty).multiply(new BigDecimal(qty));
index = fetch(result, m, index + 1, qtyMultChild, Tuple3.create(repere, ref.toString(), des.toString()));
} else {
281,15 → 305,37
cleanLine.add(repereSource.toString());
cleanLine.add(refSource.toString());
cleanLine.add(desSource.toString());
 
if (this.rowFamille != null) {
cleanLine.add(this.rowFamille.getID());
} else {
cleanLine.add(1);
}
if (this.rowAffaire != null) {
cleanLine.add(this.rowAffaire.getID());
}
 
if (!structure.equalsIgnoreCase("Indivisible")) {
result.add(cleanLine);
}
if (structure.equalsIgnoreCase("Acheté") || structure.equalsIgnoreCase("Indivisible")) {
String repereOrigin = repere;
while (index < size && (repere.equalsIgnoreCase(repereOrigin) || repere.startsWith(repereOrigin + "."))) {
index++;
if (index < size) {
line = m.getLineValuesAt(index);
repere = line.get(0).toString();
if (repere.trim().length() == 0) {
return size;
}
}
}
 
} else {
 
index++;
}
}
} else {
return index;
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/ui/EtatDemandeAchatRenderer.java
14,9 → 14,13
package org.openconcerto.erp.core.supplychain.order.ui;
 
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.view.list.ITableModel;
import org.openconcerto.sql.view.list.ListSQLLine;
import org.openconcerto.ui.table.TableCellRendererUtils;
 
import java.awt.Color;
28,6 → 32,8
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
 
import com.ibm.icu.util.Calendar;
 
public class EtatDemandeAchatRenderer extends DefaultTableCellRenderer {
Map<String, Color> map = new HashMap<String, Color>();
 
51,6 → 57,22
this.setBackground(c);
}
 
final ListSQLLine line = ITableModel.getLine(table.getModel(), row);
final SQLRowValues rowAt = line.getRow();
SQLRowAccessor rowCmd = rowAt.getForeign("ID_COMMANDE");
SQLRowAccessor rowBl = rowAt.getForeign("ID_BON_RECEPTION");
if (rowCmd != null && !rowCmd.isUndefined() && (rowBl == null || rowBl.isUndefined())) {
Calendar cal = Calendar.getInstance();
 
if (rowCmd.getDate("DATE_RECEPTION_DEMANDEE") != null && rowCmd.getDate("DATE_RECEPTION_DEMANDEE").getTime().before(cal.getTime())) {
this.setText("A Relancer");
final Color c2 = map.get("A Relancer");
if (c2 != null) {
this.setBackground(c2);
}
}
}
 
return this;
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/component/FactureFournisseurSQLComponent.java
439,9 → 439,10
 
DeviseField textPortHT = new DeviseField();
ElementComboBox comboTaxePort = new ElementComboBox();
DeviseField textRemiseHT = new DeviseField();
 
if (getTable().contains("PORT_HT")) {
addRequiredSQLObject(textPortHT, "PORT_HT");
addSQLObject(textPortHT, "PORT_HT");
final JPanel panelPoids = new JPanel(new GridBagLayout());
GridBagConstraints cPort = new DefaultGridBagConstraints();
cPort.gridx = 0;
471,10 → 472,21
c.anchor = GridBagConstraints.NORTHEAST;
panel.add(panelPoids, c);
DefaultGridBagConstraints.lockMinimumSize(panelPoids);
 
addSQLObject(textRemiseHT, "REMISE_HT");
cPort.gridy++;
cPort.gridx = 0;
cPort.fill = GridBagConstraints.NONE;
cPort.weightx = 0;
panelPoids.add(new JLabel(getLabelFor("REMISE_HT")), cPort);
textRemiseHT.setHorizontalAlignment(JTextField.RIGHT);
cPort.gridx++;
cPort.weightx = 1;
panelPoids.add(textRemiseHT, cPort);
 
}
// Total
 
DeviseField textRemiseHT = new DeviseField();
DeviseField fieldHT = new DeviseField();
DeviseField fieldEco = new DeviseField();
DeviseField fieldTVA = new DeviseField();
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/component/CommandeSQLComponent.java
23,6 → 23,7
import org.openconcerto.erp.core.common.ui.TotalPanel;
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
import org.openconcerto.erp.core.supplychain.order.element.DemandeAchatItemSQLElement;
import org.openconcerto.erp.core.supplychain.order.ui.CommandeItemTable;
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater;
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater.TypeStockUpdate;
91,7 → 92,7
private final SQLTable tableNum = getTable().getBase().getTable("NUMEROTATION_AUTO");
private final ITextArea infos = new ITextArea(3, 3);
private ElementComboBox fourn = new ElementComboBox();
final JCheckBox boxLivrClient = new JCheckBox("Livrer directement le client");
private final JCheckBox boxLivrClient = new JCheckBox("Livrer directement le client");
private DefaultElementSQLObject compAdr;
final JPanel panelAdrSpec = new JPanel(new GridBagLayout());
protected ElementComboBox boxAdr;
166,6 → 167,7
c.weighty = 0;
c.fill = GridBagConstraints.NONE;
this.add(this.fourn, c);
addRequiredSQLObject(this.fourn, "ID_FOURNISSEUR");
 
if (!getTable().getFieldsName().contains("LIVRER")) {
// Commande en cours
347,9 → 349,8
} else {
 
c.gridy++;
c.gridx = 0;
this.add(new JLabel(TM.tr("address.type.delivery"), SwingConstants.RIGHT), c);
c.gridx++;
c.gridx = 1;
c.gridwidth = GridBagConstraints.REMAINDER;
this.add(boxLivrClient, c);
c.gridwidth = 1;
584,7 → 585,6
this.panelOO = new PanelOOSQLComponent(this);
this.add(this.panelOO, c);
 
addRequiredSQLObject(this.fourn, "ID_FOURNISSEUR");
addSQLObject(textNom, "NOM");
addRequiredSQLObject(dateCommande, "DATE");
// addRequiredSQLObject(radioEtat, "ID_ETAT_DEVIS");
675,10 → 675,12
}
 
DeviseField textPortHT = new DeviseField();
DeviseField textRemiseHT = new DeviseField();
ElementComboBox comboTaxePort = new ElementComboBox(false, 10);
 
if (getTable().contains("PORT_HT")) {
addRequiredSQLObject(textPortHT, "PORT_HT");
 
addSQLObject(textPortHT, "PORT_HT");
final JPanel panelPoids = new JPanel(new GridBagLayout());
GridBagConstraints cPort = new DefaultGridBagConstraints();
cPort.gridx = 0;
699,6 → 701,17
cPort.weightx = 1;
panelPoids.add(comboTaxePort, cPort);
 
addSQLObject(textRemiseHT, "REMISE_HT");
cPort.gridy++;
cPort.gridx = 0;
cPort.fill = GridBagConstraints.NONE;
cPort.weightx = 0;
panelPoids.add(new JLabel(getLabelFor("REMISE_HT")), cPort);
textRemiseHT.setHorizontalAlignment(JTextField.RIGHT);
cPort.gridx++;
cPort.weightx = 1;
panelPoids.add(textRemiseHT, cPort);
 
c.gridx++;
c.gridy = 0;
c.weightx = 0;
712,7 → 725,6
}
// Total
 
DeviseField textRemiseHT = new DeviseField();
DeviseField fieldHT = new DeviseField();
DeviseField fieldEco = new DeviseField();
DeviseField fieldTVA = new DeviseField();
870,6 → 882,9
e.printStackTrace();
}
}
DemandeAchatItemSQLElement elt = getElement().getDirectory().getElement(DemandeAchatItemSQLElement.class);
elt.updateStatus(getTable(), getTable().getTable("COMMANDE_ELEMENT"), idCommande);
 
if (attempt > 0) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
934,6 → 949,10
}
}
});
 
DemandeAchatItemSQLElement elt = getElement().getDirectory().getElement(DemandeAchatItemSQLElement.class);
elt.updateStatus(getTable(), getTable().getTable("COMMANDE_ELEMENT"), getSelectedID());
 
// generation du document
final CommandeXmlSheet sheet = new CommandeXmlSheet(getTable().getRow(id));
sheet.createDocumentAsynchronous();
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/table/ChiffrageCommandeTable.java
32,11 → 32,15
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Vector;
 
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
187,7 → 191,16
 
c.gridy++;
c.gridx = 0;
final JPanel control = new RowValuesTableControlPanel(this.table);
JButton loadDefaultButton = new JButton(new AbstractAction("Charger les valeurs par défaut") {
 
@Override
public void actionPerformed(ActionEvent e) {
for (SQLRowValues sqlRowValues : lists) {
getModel().addRow(sqlRowValues);
}
}
});
final JPanel control = new RowValuesTableControlPanel(this.table, Arrays.asList(loadDefaultButton));
control.setOpaque(false);
this.add(control, c);
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/receipt/component/BonReceptionSQLComponent.java
19,6 → 19,7
import org.openconcerto.erp.core.common.element.NumerotationAutoSQLElement;
import org.openconcerto.erp.core.common.ui.DeviseField;
import org.openconcerto.erp.core.common.ui.TotalPanel;
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
import org.openconcerto.erp.core.sales.product.ui.ReliquatRowValuesTable;
import org.openconcerto.erp.core.supplychain.order.element.DemandeAchatItemSQLElement;
29,6 → 30,7
import org.openconcerto.erp.core.supplychain.stock.element.StockLabel;
import org.openconcerto.erp.generationDoc.gestcomm.BonReceptionXmlSheet;
import org.openconcerto.erp.panel.PanelOOSQLComponent;
import org.openconcerto.erp.preferences.DefaultNXProps;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.model.SQLRow;
44,10 → 46,12
import org.openconcerto.ui.JDate;
import org.openconcerto.ui.TitledSeparator;
import org.openconcerto.ui.component.ITextArea;
import org.openconcerto.ui.preferences.DefaultProps;
import org.openconcerto.utils.DecimalUtils;
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;
66,6 → 70,10
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
 
public class BonReceptionSQLComponent extends TransfertBaseSQLComponent {
private BonReceptionItemTable tableBonItem;
91,6 → 99,9
if (getTable().contains("CREATE_VIRTUAL_STOCK")) {
rowVals.put("CREATE_VIRTUAL_STOCK", Boolean.TRUE);
}
if (getTable().contains("ID_TAXE_PORT")) {
rowVals.put("ID_TAXE_PORT", TaxeCache.getCache().getFirstTaxe().getID());
}
return rowVals;
}
 
185,6 → 196,9
c.fill = GridBagConstraints.NONE;
this.add(this.fournisseur, c);
 
this.tableBonItem = new BonReceptionItemTable();
this.addRequiredSQLObject(this.fournisseur, "ID_FOURNISSEUR");
 
// Devise
c.gridx = 0;
c.gridy++;
214,7 → 228,7
});
 
// Element du bon
this.tableBonItem = new BonReceptionItemTable();
 
boxDevise.addValueListener(new PropertyChangeListener() {
 
@Override
240,62 → 254,15
 
c.anchor = GridBagConstraints.EAST;
 
// Poids Total
c.gridx = 0;
c.gridy++;
c.gridx = 1;
c.weightx = 0;
c.weighty = 0;
c.anchor = GridBagConstraints.EAST;
c.gridwidth = 1;
c.fill = GridBagConstraints.NONE;
 
c.gridx = 2;
c.gridwidth = GridBagConstraints.REMAINDER;
c.weightx = 0;
c.weighty = 0;
c.anchor = GridBagConstraints.EAST;
c.fill = GridBagConstraints.HORIZONTAL;
 
DeviseField fieldHT = new DeviseField();
DeviseField fieldEco = new DeviseField();
DeviseField fieldTVA = new DeviseField();
DeviseField fieldTTC = new DeviseField();
DeviseField fieldDevise = new DeviseField();
JTextField fieldPoids = new JTextField();
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");
addRequiredSQLObject(fieldPoids, "TOTAL_POIDS");
 
addRequiredSQLObject(fieldTTC, "TOTAL_TTC");
 
// Disable
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();
DeviseField fieldService = new DeviseField();
DeviseField textPortHT = new DeviseField();
 
final TotalPanel totalTTC = new TotalPanel(this.tableBonItem, fieldEco, fieldHT, fieldTVA, fieldTTC, textPortHT, textRemiseHT, fieldService, null, fieldDevise, fieldPoids, null, null, null);
 
c.gridx++;
c.gridy++;
c.gridwidth = GridBagConstraints.REMAINDER;
c.gridheight = 2;
c.anchor = GridBagConstraints.NORTHEAST;
c.fill = GridBagConstraints.BOTH;
c.weighty = 0;
DefaultGridBagConstraints.lockMinimumSize(totalTTC);
 
this.add(totalTTC, c);
this.add(getBottomPanel(), c);
c.gridy++;
c.gridheight = 1;
c.anchor = GridBagConstraints.WEST;
324,34 → 291,8
this.tableBonItem.setReliquatTable(tableBonReliquatItem);
}
 
/*******************************************************************************************
* * INFORMATIONS COMPLEMENTAIRES
******************************************************************************************/
c.gridwidth = GridBagConstraints.REMAINDER;
c.weightx = 1;
c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 0;
c.gridy++;
TitledSeparator sep = new TitledSeparator("Informations complémentaires");
c.insets = new Insets(10, 2, 1, 2);
this.add(sep, c);
c.insets = new Insets(2, 2, 1, 2);
 
c.gridx = 0;
c.gridy++;
c.gridheight = 1;
c.gridwidth = GridBagConstraints.REMAINDER;
c.weightx = 1;
c.weighty = 0;
c.fill = GridBagConstraints.BOTH;
final ITextArea textInfos = new ITextArea(4, 4);
JScrollPane scrollPane = new JScrollPane(textInfos);
DefaultGridBagConstraints.lockMinimumSize(scrollPane);
 
this.add(textInfos, c);
 
c.gridx = 0;
c.gridy++;
c.fill = GridBagConstraints.NONE;
c.anchor = GridBagConstraints.SOUTHEAST;
c.gridwidth = GridBagConstraints.REMAINDER;
360,11 → 301,9
this.add(this.panelOO, c);
 
this.addRequiredSQLObject(date, "DATE");
this.addSQLObject(textInfos, "INFOS");
this.addSQLObject(this.textReference, "NOM");
this.addSQLObject(this.selectCommande, "ID_COMMANDE");
this.addRequiredSQLObject(this.textNumeroUnique, "NUMERO");
this.addRequiredSQLObject(this.fournisseur, "ID_FOURNISSEUR");
 
this.textNumeroUnique.setText(NumerotationAutoSQLElement.getNextNumero(getElement().getClass()));
 
373,6 → 312,191
 
}
 
private JPanel getBottomPanel() {
final JPanel panel = new JPanel(new GridBagLayout());
final GridBagConstraints c = new DefaultGridBagConstraints();
ITextArea infos = new ITextArea(3, 3);
addView(infos, "INFOS");
// Colonne 1 : Infos
c.gridx = 0;
c.weightx = 1;
c.anchor = GridBagConstraints.WEST;
c.fill = GridBagConstraints.HORIZONTAL;
 
panel.add(new TitledSeparator(getLabelFor("INFOS")), c);
 
c.gridy++;
c.weighty = 0;
c.weightx = 1;
c.fill = GridBagConstraints.BOTH;
final JScrollPane scrollPane = new JScrollPane(infos);
scrollPane.setBorder(null);
panel.add(scrollPane, c);
 
// Colonne 2 : Poids & autres
DefaultProps props = DefaultNXProps.getInstance();
Boolean b = props.getBooleanValue("ArticleShowPoids");
final JTextField textPoidsTotal = new JTextField(8);
JTextField poids = new JTextField();
if (b) {
final JPanel panelPoids = new JPanel(new GridBagLayout());
GridBagConstraints cPoids = new DefaultGridBagConstraints();
cPoids.weightx = 0;
panelPoids.add(new JLabel(getLabelFor("TOTAL_POIDS")), cPoids);
cPoids.weightx = 1;
textPoidsTotal.setEnabled(false);
textPoidsTotal.setHorizontalAlignment(JTextField.RIGHT);
textPoidsTotal.setDisabledTextColor(Color.BLACK);
cPoids.gridx++;
panelPoids.add(textPoidsTotal, cPoids);
 
c.gridx++;
c.gridy = 0;
c.weightx = 0;
c.weighty = 0;
c.gridwidth = 1;
c.gridheight = 2;
c.fill = GridBagConstraints.NONE;
c.anchor = GridBagConstraints.NORTHEAST;
panel.add(panelPoids, c);
DefaultGridBagConstraints.lockMinimumSize(panelPoids);
addSQLObject(textPoidsTotal, "TOTAL_POIDS");
} else {
addSQLObject(poids, "TOTAL_POIDS");
}
 
DeviseField textPortHT = new DeviseField();
DeviseField textRemiseHT = new DeviseField();
ElementComboBox comboTaxePort = new ElementComboBox(false, 10);
 
if (getTable().contains("PORT_HT")) {
 
addSQLObject(textPortHT, "PORT_HT");
final JPanel panelPoids = new JPanel(new GridBagLayout());
GridBagConstraints cPort = new DefaultGridBagConstraints();
cPort.gridx = 0;
cPort.fill = GridBagConstraints.NONE;
cPort.weightx = 0;
panelPoids.add(new JLabel(getLabelFor("PORT_HT")), cPort);
textPortHT.setHorizontalAlignment(JTextField.RIGHT);
cPort.gridx++;
cPort.weightx = 1;
panelPoids.add(textPortHT, cPort);
 
cPort.gridy++;
cPort.gridx = 0;
cPort.weightx = 0;
addRequiredSQLObject(comboTaxePort, "ID_TAXE_PORT");
panelPoids.add(new JLabel(getLabelFor("ID_TAXE_PORT")), cPort);
cPort.gridx++;
cPort.weightx = 1;
panelPoids.add(comboTaxePort, cPort);
 
addSQLObject(textRemiseHT, "REMISE_HT");
cPort.gridy++;
cPort.gridx = 0;
cPort.fill = GridBagConstraints.NONE;
cPort.weightx = 0;
panelPoids.add(new JLabel(getLabelFor("REMISE_HT")), cPort);
textRemiseHT.setHorizontalAlignment(JTextField.RIGHT);
cPort.gridx++;
cPort.weightx = 1;
panelPoids.add(textRemiseHT, cPort);
 
c.gridx++;
c.gridy = 0;
c.weightx = 0;
c.weighty = 0;
c.gridwidth = 1;
c.gridheight = 2;
c.fill = GridBagConstraints.NONE;
c.anchor = GridBagConstraints.NORTHEAST;
panel.add(panelPoids, c);
DefaultGridBagConstraints.lockMinimumSize(panelPoids);
}
// Total
 
DeviseField fieldHT = new DeviseField();
DeviseField fieldEco = new DeviseField();
DeviseField fieldTVA = new DeviseField();
DeviseField fieldTTC = new DeviseField();
DeviseField fieldDevise = new DeviseField();
DeviseField fieldService = new DeviseField();
fieldHT.setOpaque(false);
fieldTVA.setOpaque(false);
fieldTTC.setOpaque(false);
fieldService.setOpaque(false);
addRequiredSQLObject(fieldEco, "T_ECO_CONTRIBUTION");
addRequiredSQLObject(fieldDevise, "T_DEVISE");
addRequiredSQLObject(fieldHT, "TOTAL_HT");
addRequiredSQLObject(fieldTVA, "TOTAL_TVA");
addRequiredSQLObject(fieldTTC, "TOTAL_TTC");
 
// Disable
this.allowEditable("T_ECO_CONTRIBUTION", false);
this.allowEditable("TOTAL_HT", false);
this.allowEditable("TOTAL_TVA", false);
this.allowEditable("TOTAL_TTC", false);
 
final TotalPanel totalTTC = new TotalPanel(this.tableBonItem, fieldEco, fieldHT, fieldTVA, fieldTTC, textPortHT, textRemiseHT, fieldService, null, fieldDevise, null, null,
(getTable().contains("ID_TAXE_PORT") ? comboTaxePort : null), null);
 
c.gridx++;
c.gridy--;
c.gridwidth = GridBagConstraints.REMAINDER;
c.gridheight = 2;
c.anchor = GridBagConstraints.NORTHEAST;
c.fill = GridBagConstraints.BOTH;
c.weighty = 0;
c.weightx = 0;
DefaultGridBagConstraints.lockMinimumSize(totalTTC);
 
panel.add(totalTTC, c);
tableBonItem.getModel().addTableModelListener(new TableModelListener() {
 
public void tableChanged(TableModelEvent e) {
textPoidsTotal.setText(String.valueOf(tableBonItem.getPoidsTotal()));
}
});
 
textPortHT.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
totalTTC.updateTotal();
}
 
public void removeUpdate(DocumentEvent e) {
totalTTC.updateTotal();
}
 
public void insertUpdate(DocumentEvent e) {
totalTTC.updateTotal();
}
});
 
comboTaxePort.addValueListener(new PropertyChangeListener() {
 
@Override
public void propertyChange(PropertyChangeEvent evt) {
totalTTC.updateTotal();
}
});
 
textRemiseHT.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
totalTTC.updateTotal();
}
 
public void removeUpdate(DocumentEvent e) {
totalTTC.updateTotal();
}
 
public void insertUpdate(DocumentEvent e) {
totalTTC.updateTotal();
}
});
return panel;
}
 
public int insert(SQLRow order) {
 
int idBon = SQLRow.NONEXISTANT_ID;
539,6 → 663,9
}
});
 
DemandeAchatItemSQLElement elt = getElement().getDirectory().getElement(DemandeAchatItemSQLElement.class);
elt.updateStatus(getTable(), getTable().getTable("BON_RECEPTION_ELEMENT"), id);
 
// generation du document
final BonReceptionXmlSheet sheet = new BonReceptionXmlSheet(getTable().getRow(id));
sheet.createDocumentAsynchronous();
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/ContactSQLElementBase.java
13,12 → 13,6
package org.openconcerto.erp.core.customerrelationship.customer.element;
 
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
 
import org.openconcerto.sql.element.ConfSQLElement;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.element.SQLElement;
27,9 → 21,17
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.ui.EmailComposer;
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.ListMap;
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.StringUtils;
import org.openconcerto.utils.Value;
 
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
 
public abstract class ContactSQLElementBase extends ConfSQLElement {
 
public ContactSQLElementBase() {
45,6 → 47,13
return this.getTable().getName();
}
 
// @Override
// public String getDescription(SQLRowValues r, DescLength l) {
// final Value<String> firstName = r.getNonDefaultObject("PRENOM", String.class);
// return (firstName.hasValue() && !StringUtils.isEmpty(firstName.getValue()) ?
// firstName.getValue() + " " : "") + r.getString("NOM");
// }
 
protected List<String> getListFields() {
final List<String> l = new ArrayList<String>();
if (getTable().contains("ID_TITRE_PERSONNEL")) {
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/ClientNormalSQLElement.java
154,6 → 154,7
l.add("ID_COMPTE_PCE");
l.add("ID_MODE_REGLEMENT");
l.add("INFOS");
l.add("ID_COMMERCIAL");
return l;
}
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/report/FicheClientXmlSheet.java
23,7 → 23,7
public class FicheClientXmlSheet extends AbstractSheetXMLWithDate {
 
public static final String TEMPLATE_ID = "FicheClient";
public static final String TEMPLATE_PROPERTY_NAME = DEFAULT_PROPERTY_NAME;
public static final String TEMPLATE_PROPERTY_NAME = "LocationFicheClient";
 
public FicheClientXmlSheet(SQLRow row) {
super(row);
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/element/ComptePCESQLElement.java
19,6 → 19,7
import org.openconcerto.sql.element.BaseSQLComponent;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.element.TreesOfSQLRows;
import org.openconcerto.sql.model.DBRoot;
import org.openconcerto.sql.model.DBSystemRoot;
import org.openconcerto.sql.model.SQLBackgroundTableCache;
import org.openconcerto.sql.model.SQLBackgroundTableCacheItem;
152,6 → 153,8
protected void _initComboRequest(ComboSQLRequest req) {
super._initComboRequest(req);
req.setWhere(new Where(getTable().getField("OBSOLETE"), "=", Boolean.FALSE));
// Ne pas écraser l'ordre de la base (equals, startwith, etc..)
req.setItemsOrder(null);
}
 
protected List<String> getListFields() {
325,9 → 328,13
}
 
public static SQLRow getRow(String numero, String nom) {
SQLBase base = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
SQLTable compteTable = base.getTable("COMPTE_PCE");
return getRow(numero, nom, ((ComptaPropsConfiguration) Configuration.getInstance()).getRootSociete());
}
 
public static SQLRow getRow(String numero, String nom, DBRoot root) {
 
SQLTable compteTable = root.getTable("COMPTE_PCE");
 
final SQLBackgroundTableCacheItem cacheForTable = SQLBackgroundTableCache.getInstance().getCacheForTable(compteTable);
if (numero == null) {
throw new IllegalArgumentException("null numero");
423,4 → 430,5
protected String createCode() {
return createCodeFromPackage() + ".code.enterprise";
}
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/Map2033B.java
431,12 → 431,12
******************************************************************************************/
// 312
// 374 SommeSoldeDebit( 4457, 4457* )
// TODO répartir les comptes crediteurs
long v374 = this.sommeCompte.soldeCompteDebiteur(4457, 4457, true, this.dateDeb, this.dateFin);
// TODO répartir les comptes débiteurs
long v374 = this.sommeCompte.soldeCompteCrediteur(4457, 4457, true, this.dateDeb, this.dateFin);
this.m.put("T1.41", GestionDevise.currencyToString(v374, false));
 
// 378 SommeSoldeCredit( 44566 )
long v378 = this.sommeCompte.soldeCompteCrediteur(44566, 44566, true, this.dateDeb, this.dateFin);
long v378 = this.sommeCompte.soldeCompteDebiteur(44566, 44566, true, this.dateDeb, this.dateFin);
this.m.put("T1.42", GestionDevise.currencyToString(v378, false));
 
SwingUtilities.invokeLater(new Runnable() {
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/GrandLivreSheetXML.java
100,7 → 100,9
this.excludeCompteSolde = excludeCptSolde;
this.centralClient = centralClient;
this.centralFourn = centralFourn;
 
Map<String, Object> map = new HashMap<>();
recapSousTotaux.add(map);
map.put("DATE", "Récapitulatif");
// createMap();
}
 
120,8 → 122,9
// this.mCell.put("E" + row, "Période du " + dateFormatEcr.format(this.dateDu) + " au " +
// dateFormatEcr.format(this.dateAu));
// }
private List<Map<String, Object>> recapSousTotaux = new ArrayList<>();
 
private void makeSousTotal(Map<String, Object> line, Map<Integer, String> style, int pos, long debit, long credit) {
private void makeSousTotal(String numCpt, String nomCpt, Map<String, Object> line, Map<Integer, String> style, int pos, long debit, long credit) {
style.put(pos, "Titre 1");
 
line.put("DATE", "");
131,6 → 134,14
line.put("DEBIT", Double.valueOf(GestionDevise.currencyToString(debit, false)));
line.put("CREDIT", Double.valueOf(GestionDevise.currencyToString(credit, false)));
line.put("SOLDE", Double.valueOf(GestionDevise.currencyToString(debit - credit, false)));
 
Map<String, Object> lineRecap = new HashMap<>();
lineRecap.putAll(line);
lineRecap.put("DATE", numCpt);
lineRecap.put("JOURNAL", nomCpt);
lineRecap.put("LIBELLE", "");
recapSousTotaux.add(lineRecap);
 
}
 
protected void createListeValues() {
271,6 → 282,8
setTitle = true;
// ligne vide avant de mettre le setTitle
setLine = false;
String nomCpt = "";
String numCpt = "";
for (int i = 0; i < size;) {
// System.err.println(i);
// // System.err.println("START NEW PAGE; POS : " + posLine);
289,8 → 302,8
SQLRowValues rowEcr = list.get(i);
 
int idCpt = rowEcr.getInt("ID_COMPTE_PCE");
String nomCpt = rowEcr.getString("COMPTE_NOM");
String numCpt = rowEcr.getString("COMPTE_NUMERO");
nomCpt = rowEcr.getString("COMPTE_NOM");
numCpt = rowEcr.getString("COMPTE_NUMERO");
 
Map<String, Object> ooLine = new HashMap<String, Object>();
tableauVals.add(ooLine);
373,7 → 386,7
rowFirstEcr = rowEcr;
idCptFirstEcr = rowFirstEcr.getInt("ID_COMPTE_PCE");
numCptFirstEcr = rowEcr.getString("COMPTE_NUMERO");
makeSousTotal(ooLine, style, tableauVals.size() - 1, sousTotalDebit, sousTotalCredit);
makeSousTotal(numCpt, nomCpt, ooLine, style, tableauVals.size() - 1, sousTotalDebit, sousTotalCredit);
 
sousTotalCredit = 0;
sousTotalDebit = 0;
507,14 → 520,32
this.mapAllSheetValues.put(0, sheetVals);
 
if (size > 0) {
 
Map<String, Object> ooLine = new HashMap<String, Object>();
tableauVals.add(ooLine);
makeSousTotal(ooLine, style, tableauVals.size() - 1, sousTotalDebit, sousTotalCredit);
makeSousTotal(numCpt, nomCpt, ooLine, style, tableauVals.size() - 1, sousTotalDebit, sousTotalCredit);
 
sheetVals.put("TOTAL_DEBIT", (totalDebit == 0) ? 0 : new Double(GestionDevise.currencyToString(totalDebit, false)));
sheetVals.put("TOTAL_CREDIT", (totalCredit == 0) ? 0 : new Double(GestionDevise.currencyToString(totalCredit, false)));
sheetVals.put("TOTAL_SOLDE", (totalDebit - totalCredit == 0) ? 0 : new Double(GestionDevise.currencyToString(totalDebit - totalCredit, false)));
 
Map<String, Object> emptyLine = new HashMap<String, Object>();
style.put(tableauVals.size(), "Normal");
tableauVals.add(emptyLine);
for (Map<String, Object> recap : recapSousTotaux) {
style.put(tableauVals.size(), "Titre 1");
tableauVals.add(recap);
}
Map<String, Object> lineRecap = new HashMap<>();
lineRecap.put("DEBIT", (totalDebit == 0) ? 0 : new Double(GestionDevise.currencyToString(totalDebit, false)));
lineRecap.put("CREDIT", (totalCredit == 0) ? 0 : new Double(GestionDevise.currencyToString(totalCredit, false)));
lineRecap.put("SOLDE", (totalDebit - totalCredit == 0) ? 0 : new Double(GestionDevise.currencyToString(totalDebit - totalCredit, false)));
lineRecap.put("DATE", "");
lineRecap.put("JOURNAL", "");
lineRecap.put("LIBELLE", "Global");
style.put(tableauVals.size(), "Titre 1");
tableauVals.add(lineRecap);
}
 
sheetVals.put("TITRE_1", "GRAND LIVRE " + this.rowSociete.getString("TYPE") + " " + this.rowSociete.getString("NOM"));
sheetVals.put("DATE_EDITION", new Date());
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/ui/ImportEcriturePanel.java
15,16 → 15,16
 
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
import org.openconcerto.erp.core.finance.accounting.element.JournalSQLElement;
import org.openconcerto.erp.generationEcritures.GenerationEcritures;
import org.openconcerto.erp.importer.ArrayTableModel;
import org.openconcerto.erp.importer.DataImporter;
import org.openconcerto.openoffice.ContentTypeVersioned;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.model.ConnectionHandlerNoSetup;
import org.openconcerto.sql.model.DBRoot;
import org.openconcerto.sql.model.SQLDataSource;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowListRSH;
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.utils.SQLUtils;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.ReloadPanel;
46,6 → 46,7
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import javax.swing.JButton;
57,20 → 58,12
 
public class ImportEcriturePanel extends JPanel {
 
private final Map<String, Integer> mapJournal;
private final SQLTable tableEcr;
private final Map<String, Integer> mapJournal = new HashMap<>();
private final Map<String, Integer> mapCompte = new HashMap<>();
 
public ImportEcriturePanel() {
super(new GridBagLayout());
 
this.tableEcr = Configuration.getInstance().getDirectory().getElement("ECRITURE").getTable();
this.mapJournal = new HashMap<String, Integer>();
this.mapJournal.put("HA", JournalSQLElement.ACHATS);
this.mapJournal.put("VE", JournalSQLElement.VENTES);
this.mapJournal.put("BA", JournalSQLElement.BANQUES);
this.mapJournal.put("CA", JournalSQLElement.CAISSES);
this.mapJournal.put("OD", JournalSQLElement.OD);
 
JLabel label = new JLabel("Import depuis un fichier CSV, XLS ou ODT.");
JLabel label2 = new JLabel("Le fichier doit contenir les colonnes :");
JLabel label3 = new JLabel(" - Date dd/MM/yyyy (dd/MM/yy pour le CSV)");
128,32 → 121,56
rlPanel.setMode(ReloadPanel.MODE_ROTATE);
if (fd.getFile() != null) {
 
final DBRoot rootSociete = ((ComptaPropsConfiguration) ComptaPropsConfiguration.getInstance()).getRootSociete();
new Thread() {
@Override
public void run() {
final File fileToImport = new File(fd.getDirectory(), fd.getFile());
try {
final ArrayTableModel model = loadData(fileToImport);
try {
final DBRoot rootSociete = ((ComptaPropsConfiguration) ComptaPropsConfiguration.getInstance()).getRootSociete();
SQLUtils.executeAtomic(rootSociete.getDBSystemRoot().getDataSource(), new ConnectionHandlerNoSetup<Object, IOException>() {
@Override
public Object handle(final SQLDataSource ds) throws SQLException, IOException {
 
try {
DateFormat format = new SimpleDateFormat("dd/MM/yyyy");
importData(new File(fd.getDirectory(), fd.getFile()), "Import " + format.format(new Date()), frame);
SQLSelect sel = new SQLSelect();
sel.addSelectStar(rootSociete.getTable("JOURNAL"));
List<SQLRow> rowsJrnl = SQLRowListRSH.execute(sel);
for (SQLRow sqlRow : rowsJrnl) {
mapJournal.put(sqlRow.getString("CODE"), sqlRow.getID());
}
final DateFormat format = new SimpleDateFormat("dd/MM/yyyy");
final String mouvementName = "Import " + format.format(new Date());
// Vérification des données
boolean ok = importTableModel(model, mouvementName, frame, true);
if (ok) {
// Importation des données
importTableModel(model, mouvementName, frame, false);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
JOptionPane.showMessageDialog(null, "Importation des écritures terminée");
}
});
}
} catch (Exception exn) {
if (exn.getMessage().toLowerCase().contains("file format")) {
JOptionPane.showMessageDialog(ImportEcriturePanel.this, "Mauvais format de fichier");
} else {
ExceptionHandler.handle("Erreur pendant l'importation", exn);
}
}
return null;
}
});
} catch (IOException exn) {
ExceptionHandler.handle(frame, "Erreur lors de la lecture du fichier", exn);
} catch (SQLException exn) {
} catch (Exception exn) {
ExceptionHandler.handle(frame, "Erreur lors de l'insertion dans la base", exn);
}
 
} catch (Exception e) {
if (e.getMessage().toLowerCase().contains("file format")) {
JOptionPane.showMessageDialog(ImportEcriturePanel.this, "Format de fichier non pris en charge");
} else {
ExceptionHandler.handle(frame, "Erreur lors de la lecture du fichier " + fileToImport.getAbsolutePath(), e);
}
}
 
frame.dispose();
}
}.start();
162,106 → 179,145
});
}
 
public void importData(File f, String mvtName, final Frame owner) throws Exception {
DataImporter importer = new DataImporter(this.tableEcr);
public ArrayTableModel loadData(File f) throws IOException {
final DataImporter importer = new DataImporter();
importer.setSkipFirstLine(false);
DateFormat dF = new SimpleDateFormat("dd/MM/yyyy");
ArrayTableModel m = importer.createModelFrom(f);
return importer.createModelFrom(f);
}
 
GenerationEcritures gen = new GenerationEcritures();
int idMvt = gen.getNewMouvement("", 1, 1, mvtName);
 
long solde = 0;
for (int i = 0; i < m.getRowCount(); i++) {
 
final Object valueAt = m.getValueAt(i, 0);
 
if (valueAt == null) {
public boolean importTableModel(ArrayTableModel m, String mvtName, final Frame owner, boolean dryRun) throws Exception {
final DateFormat dF = new SimpleDateFormat("dd/MM/yyyy");
final GenerationEcritures gen = new GenerationEcritures();
int idMvt = -1;
if (!dryRun) {
idMvt = gen.getNewMouvement("", 1, 1, mvtName);
}
long soldeGlobal = 0;
String dateOrigin = null;
final int rowCount = m.getRowCount();
for (int i = 0; i < rowCount; i++) {
int column = 0;
try {
// Column 0
final Object firstValue = m.getValueAt(i, column);
if (firstValue == null) {
break;
}
final Date dateValue;
if (valueAt.getClass().isAssignableFrom(Date.class)) {
dateValue = (Date) valueAt;
if (firstValue.getClass().isAssignableFrom(Date.class)) {
dateValue = (Date) firstValue;
} else if (firstValue.toString().trim().isEmpty()) {
break;
} else {
if (valueAt.toString().trim().length() == 0) {
break;
dateValue = dF.parse(firstValue.toString());
}
dateValue = dF.parse(valueAt.toString());
final String dateStringValue = dF.format(dateValue);
if (dateOrigin == null) {
dateOrigin = dateStringValue;
}
// Mouvement
gen.mEcritures.put("ID_MOUVEMENT", idMvt);
// Date
gen.putValue("DATE", dateValue);
column++;
 
// Cpt
final String trim = m.getValueAt(i, 2).toString().trim();
String numCompt = trim;
if (trim.contains(".")) {
numCompt = trim.substring(0, trim.indexOf('.'));
if (!dateOrigin.equals(dateStringValue)) {
dateOrigin = dateStringValue;
if (!dryRun) {
idMvt = gen.getNewMouvement("", 1, 1, mvtName);
} else if (soldeGlobal != 0) {
final double soldeMvt = soldeGlobal / 100.0;
SwingUtilities.invokeLater(new Runnable() {
 
@Override
public void run() {
JOptionPane.showMessageDialog(null,
"Le mouvement du " + dateStringValue + " ne respecte pas la partie double (Solde du mouvement : " + soldeMvt + ")!\nImport annulé!");
}
int idCpt = ComptePCESQLElement.getId(numCompt);
gen.mEcritures.put("ID_COMPTE_PCE", idCpt);
});
return false;
}
}
 
// Montant
final String stringValueD = m.getValueAt(i, 5).toString();
long montantD = GestionDevise.parseLongCurrency(stringValueD);
final String stringValueC = m.getValueAt(i, 6).toString();
long montantC = GestionDevise.parseLongCurrency(stringValueC);
gen.mEcritures.put("CREDIT", montantC);
gen.mEcritures.put("DEBIT", montantD);
solde += montantD;
solde -= montantC;
 
System.err.println("(" + stringValueD + " : " + stringValueC + ") ---- (" + montantD + " : " + montantC + ")");
// Journal
 
final String valueJrnl = m.getValueAt(i, 1).toString();
if (mapJournal.get(valueJrnl) == null) {
 
try {
System.err.println("LOCKED");
 
// Column 1
final String valueJrnl = m.getValueAt(i, column).toString();
if (!dryRun && mapJournal.get(valueJrnl) == null) {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
// try {
JDialog diag = new JDialog(owner);
final JDialog diag = new JDialog(owner);
diag.setModal(true);
diag.setContentPane(new SelectionJournalImportPanel(valueJrnl, mapJournal, null));
diag.setTitle("Import écritures");
diag.setTitle("Import d'écritures");
diag.setLocationRelativeTo(null);
diag.pack();
diag.setVisible(true);
}
});
}
gen.putValue("ID_JOURNAL", this.mapJournal.get(valueJrnl));
column++;
 
System.err.println("PASSED");
} catch (InterruptedException e1) {
e1.printStackTrace();
// Compte
// Column 2
final String trim = m.getValueAt(i, column).toString().trim();
String numCompt = trim;
if (trim.contains(".")) {
numCompt = trim.substring(0, trim.indexOf('.'));
}
numCompt = numCompt.trim();
if (!dryRun) {
int idCpt = getOrCreateCompte(numCompt);
gen.putValue("ID_COMPTE_PCE", idCpt);
}
column++;
 
// Nom de la pièce
// Column 3
String stringPiece = m.getValueAt(i, column).toString();
if (stringPiece != null && stringPiece.length() > 0 && stringPiece.contains(".")) {
stringPiece = stringPiece.substring(0, stringPiece.indexOf('.'));
}
column++;
// Column 4
gen.putValue("NOM", m.getValueAt(i, column).toString() + " " + stringPiece);
column++;
 
gen.mEcritures.put("ID_JOURNAL", this.mapJournal.get(valueJrnl));
// Montants
// Column 5
final String stringValueD = m.getValueAt(i, column).toString();
long montantD = GestionDevise.parseLongCurrency(stringValueD);
column++;
// Column 6
final String stringValueC = m.getValueAt(i, column).toString();
long montantC = GestionDevise.parseLongCurrency(stringValueC);
gen.putValue("CREDIT", montantC);
gen.putValue("DEBIT", montantD);
soldeGlobal += montantD;
soldeGlobal -= montantC;
 
// Date
gen.mEcritures.put("DATE", dateValue);
// Mouvement
gen.putValue("ID_MOUVEMENT", idMvt);
 
String stringPiece = m.getValueAt(i, 3).toString();
if (stringPiece != null && stringPiece.length() > 0 && stringPiece.contains(".")) {
stringPiece = stringPiece.substring(0, stringPiece.indexOf('.'));
gen.putValue("NOM", m.getValueAt(i, 4).toString() + " " + stringPiece);
} catch (Exception e) {
throw new IllegalStateException("Donnée invalide sur la ligne " + (i + 1) + " , colonne " + (column + 1), e);
}
gen.mEcritures.put("NOM", m.getValueAt(i, 4).toString() + " " + stringPiece);
 
if (!dryRun) {
gen.ajoutEcriture();
}
if (solde != 0) {
throw new IllegalArgumentException("La partie double n'est respectée (solde = " + solde + "). Import annulé!");
}
SwingUtilities.invokeLater(new Runnable() {
 
@Override
public void run() {
JOptionPane.showMessageDialog(owner, "Importation des écritures terminée");
if (soldeGlobal != 0) {
throw new IllegalArgumentException("La partie double n'est respectée (solde = " + soldeGlobal + "). Import annulé!");
}
});
return true;
}
 
private int getOrCreateCompte(String numeroCompte) {
if (mapCompte.containsKey(numeroCompte)) {
return mapCompte.get(numeroCompte);
}
int id = ComptePCESQLElement.getId(numeroCompte);
mapCompte.put(numeroCompte, id);
return id;
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/ui/SaisieJournalItemTable.java
New file
0,0 → 1,684
/*
* 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.accounting.ui;
 
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.erp.core.common.ui.DeviseCellEditor;
import org.openconcerto.erp.core.common.ui.MultiLineTableCellEditor;
import org.openconcerto.erp.core.common.ui.RowValuesMultiLineEditTable;
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
import org.openconcerto.erp.generationEcritures.GenerationMvtSaisieKm;
import org.openconcerto.erp.preferences.DefaultNXProps;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.sqlobject.ITextWithCompletion;
import org.openconcerto.sql.view.list.AutoCompletionManager;
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.SQLTableElement;
import org.openconcerto.sql.view.list.TextTableCellEditorWithCompletion;
import org.openconcerto.sql.view.list.ValidStateChecker;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.RangedIntegerTableCellEditor;
import org.openconcerto.utils.DecimalUtils;
import org.openconcerto.utils.GestionDevise;
import org.openconcerto.utils.Tuple2;
import org.openconcerto.utils.checks.ValidState;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.SQLException;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Vector;
 
import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.ToolTipManager;
import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
 
public class SaisieJournalItemTable extends JPanel implements MouseListener {
 
private final RowValuesTable table;
private final SQLTableElement debit;
private final SQLTableElement credit;
private JLabel labelTotalDebit;
private JLabel labelTotalCredit;
private JLabel labelTotalSolde;
private final SQLTableElement tableElementNumeroCompte;
private final CompteRowValuesRenderer numeroCompteRenderer = new CompteRowValuesRenderer();
private final DeviseKmRowValuesRenderer deviseRenderer = new DeviseKmRowValuesRenderer();
final RangedIntegerTableCellEditor rangedIntegerTableCellEditor = new RangedIntegerTableCellEditor(1, 31);
private final RowValuesTableControlPanel controlPanel;
 
private SaisieJournalPanel panel;
private final JCheckBox boxAutoInsert;
private boolean hideAnalytique = false;
 
public SaisieJournalItemTable(final SQLRowValues defaultRowVals, JCheckBox boxAutoInsert) {
setLayout(new GridBagLayout());
this.boxAutoInsert = boxAutoInsert;
final GridBagConstraints c = new DefaultGridBagConstraints();
c.weightx = 1;
 
final SQLElement elt = Configuration.getInstance().getDirectory().getElement("SAISIE_KM_ELEMENT");
 
// TODO Obligation de choisir un compte correct
final List<SQLTableElement> list = new Vector<SQLTableElement>();
final SQLTable tableElement = elt.getTable();
final SQLTableElement tableElementJour = new SQLTableElement(tableElement.getField("JOUR"), Integer.class, rangedIntegerTableCellEditor) {
@Override
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) {
 
return super.isCellEditable(vals, rowIndex, columnIndex) && rowIndex == 0;
}
 
@Override
protected Object getDefaultNullValue() {
return 1;
}
 
};
 
list.add(tableElementJour);
 
this.tableElementNumeroCompte = new SQLTableElement(tableElement.getField("NUMERO"));
list.add(this.tableElementNumeroCompte);
 
final SQLTableElement tableElementNomCompte = new SQLTableElement(tableElement.getField("NOM"));
list.add(tableElementNomCompte);
 
final SQLTableElement tableElementNomPiece = new SQLTableElement(tableElement.getField("NOM_PIECE"));
list.add(tableElementNomPiece);
 
final SQLTableElement tableElementNomEcriture = new SQLTableElement(tableElement.getField("NOM_ECRITURE"));
list.add(tableElementNomEcriture);
 
//
DeviseCellEditor deviseDebitEditor = new DeviseCellEditor();
DeviseCellEditor deviseCreditEditor = new DeviseCellEditor();
this.debit = new SQLTableElement(tableElement.getField("DEBIT"), Long.class, deviseDebitEditor);
list.add(this.debit);
this.credit = new SQLTableElement(tableElement.getField("CREDIT"), Long.class, deviseCreditEditor);
list.add(this.credit);
this.hideAnalytique = DefaultNXProps.getInstance().getBooleanValue("HideAnalytique");
if (!this.hideAnalytique) {
final AnalytiqueItemTable analytiqueAssocTable = new AnalytiqueItemTable(true, new AbstractAction() {
 
@Override
public void actionPerformed(ActionEvent e) {
montantValid(defaultRowVals, true);
}
});
final MultiLineTableCellEditor multiLineTableCellEditor = new MultiLineTableCellEditor((RowValuesMultiLineEditTable) analytiqueAssocTable.getTable(), analytiqueAssocTable);
 
SQLTableElement eltPourcentAnalytique = new SQLTableElement(tableElement.getField("ANALYTIQUE"), String.class, multiLineTableCellEditor) {
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) {
return vals.getString("NUMERO") != null && (vals.getString("NUMERO").startsWith("6") || vals.getString("NUMERO").startsWith("7"));
};
};
list.add(eltPourcentAnalytique);
}
 
final RowValuesTableModel model = new RowValuesTableModel(elt, list, tableElement.getField("NUMERO"), false, defaultRowVals) {
@Override
public void setValueAt(final Object aValue, final int rowIndex, final int columnIndex) {
super.setValueAt(aValue, rowIndex, columnIndex);
 
final int debitIndex = getColumnIndexForElement(SaisieJournalItemTable.this.debit);
final int creditIndex = getColumnIndexForElement(SaisieJournalItemTable.this.credit);
 
// float debitVal = ((Float) model.getValueAt(rowIndex, debitIndex);
 
if (debitIndex == columnIndex && ((Long) aValue).longValue() != 0 && ((Long) getValueAt(rowIndex, creditIndex)).longValue() != 0) {
setValueAt(Long.valueOf(0), rowIndex, creditIndex);
} else {
if (creditIndex == columnIndex && ((Long) aValue).longValue() != 0 && ((Long) getValueAt(rowIndex, debitIndex)).longValue() != 0) {
setValueAt(Long.valueOf(0), rowIndex, debitIndex);
}
}
}
};
 
this.table = new RowValuesTable(model, null);
ToolTipManager.sharedInstance().unregisterComponent(this.table);
ToolTipManager.sharedInstance().unregisterComponent(this.table.getTableHeader());
 
tableElementNomEcriture.getTableCellEditor(table).addCellEditorListener(new CellEditorListener() {
 
@Override
public void editingStopped(ChangeEvent e) {
e.getSource();
int row = table.getSelectedRow();
int col = 4;
if (table.getValueAt(row, col) != null) {
defaultRowVals.put("NOM_ECRITURE", table.getValueAt(row, col));
}
// defaultRowVals.put
}
 
@Override
public void editingCanceled(ChangeEvent e) {
// TODO Auto-generated method stub
 
}
});
tableElementNomPiece.getTableCellEditor(table).addCellEditorListener(new CellEditorListener() {
 
@Override
public void editingStopped(ChangeEvent e) {
e.