18 |
ilm |
1 |
/*
|
|
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
|
|
3 |
*
|
|
|
4 |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
|
|
|
5 |
*
|
|
|
6 |
* The contents of this file are subject to the terms of the GNU General Public License Version 3
|
|
|
7 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
|
|
|
8 |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
|
|
|
9 |
* language governing permissions and limitations under the License.
|
|
|
10 |
*
|
|
|
11 |
* When distributing the software, include this License Header Notice in each file.
|
|
|
12 |
*/
|
|
|
13 |
|
|
|
14 |
package org.openconcerto.erp.core.finance.accounting.ui;
|
|
|
15 |
|
|
|
16 |
import org.openconcerto.erp.config.ComptaPropsConfiguration;
|
|
|
17 |
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
|
|
|
18 |
import org.openconcerto.erp.generationEcritures.GenerationMvtSaisieVenteFacture;
|
|
|
19 |
import org.openconcerto.erp.model.ISQLCompteSelector;
|
|
|
20 |
import org.openconcerto.erp.preferences.DefaultNXProps;
|
|
|
21 |
import org.openconcerto.sql.Configuration;
|
|
|
22 |
import org.openconcerto.sql.model.SQLBase;
|
|
|
23 |
import org.openconcerto.sql.model.SQLRow;
|
73 |
ilm |
24 |
import org.openconcerto.sql.model.SQLRowAccessor;
|
18 |
ilm |
25 |
import org.openconcerto.sql.model.SQLRowValues;
|
|
|
26 |
import org.openconcerto.sql.model.SQLTable;
|
156 |
ilm |
27 |
import org.openconcerto.sql.request.SQLFieldTranslator;
|
18 |
ilm |
28 |
import org.openconcerto.sql.sqlobject.ElementComboBox;
|
|
|
29 |
import org.openconcerto.ui.DefaultGridBagConstraints;
|
|
|
30 |
import org.openconcerto.ui.TitledSeparator;
|
|
|
31 |
import org.openconcerto.ui.preferences.DefaultPreferencePanel;
|
|
|
32 |
|
|
|
33 |
import java.awt.GridBagConstraints;
|
|
|
34 |
import java.awt.GridBagLayout;
|
|
|
35 |
import java.awt.Insets;
|
|
|
36 |
import java.sql.SQLException;
|
|
|
37 |
|
|
|
38 |
import javax.swing.JCheckBox;
|
|
|
39 |
import javax.swing.JLabel;
|
156 |
ilm |
40 |
import javax.swing.JOptionPane;
|
18 |
ilm |
41 |
import javax.swing.JPanel;
|
156 |
ilm |
42 |
import javax.swing.SwingUtilities;
|
18 |
ilm |
43 |
|
|
|
44 |
public class CompteGestCommPreferencePanel extends DefaultPreferencePanel {
|
|
|
45 |
|
142 |
ilm |
46 |
private ISQLCompteSelector selCompteTVAIntraComm, selCompteFourn, selCompteAchat, selCompteValeurEncaissement, selCompteAvanceClient, selCompteClient, selCompteVenteProduits,
|
|
|
47 |
selCompteVenteService, selCompteTVACol, selCompteTVADed, selCompteTVAImmo, selCompteAchatIntra, selCompteFactor, selComptePortSoumis, selComptePortNonSoumis;
|
18 |
ilm |
48 |
private ElementComboBox selJrnlFactor;
|
|
|
49 |
private final static SQLBase base = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
|
|
|
50 |
private static final SQLTable tablePrefCompte = base.getTable("PREFS_COMPTE");
|
|
|
51 |
private SQLRowValues rowPrefCompteVals = new SQLRowValues(tablePrefCompte);
|
151 |
ilm |
52 |
private JCheckBox checkLettrageAuto = new JCheckBox("Activer le lettrage automatique.");
|
18 |
ilm |
53 |
private JCheckBox checkHideCompteFacture = new JCheckBox("Ne pas afficher les comptes dans les factures.");
|
|
|
54 |
private JCheckBox checkHideCompteClient = new JCheckBox("Ne pas afficher les comptes dans les clients.");
|
149 |
ilm |
55 |
private JCheckBox checkHideAnalytique = new JCheckBox("Ne pas afficher l'analytique dans les saisies au kilomètre.");
|
18 |
ilm |
56 |
|
|
|
57 |
public CompteGestCommPreferencePanel() {
|
|
|
58 |
super();
|
|
|
59 |
|
|
|
60 |
final SQLRow rowPrefCompte = tablePrefCompte.getRow(2);
|
|
|
61 |
this.rowPrefCompteVals.loadAbsolutelyAll(rowPrefCompte);
|
|
|
62 |
|
|
|
63 |
final Insets separatorInsets = new Insets(10, 2, 1, 2);
|
|
|
64 |
|
|
|
65 |
this.setLayout(new GridBagLayout());
|
|
|
66 |
|
|
|
67 |
final GridBagConstraints c = new DefaultGridBagConstraints();
|
|
|
68 |
final Insets normalInsets = c.insets;
|
|
|
69 |
|
|
|
70 |
c.fill = GridBagConstraints.HORIZONTAL;
|
|
|
71 |
c.anchor = GridBagConstraints.WEST;
|
|
|
72 |
c.gridx = 0;
|
|
|
73 |
c.gridy = 0;
|
|
|
74 |
c.gridwidth = 1;
|
|
|
75 |
c.gridheight = 1;
|
|
|
76 |
c.weightx = 1;
|
|
|
77 |
c.weighty = 0;
|
|
|
78 |
|
|
|
79 |
c.gridwidth = GridBagConstraints.REMAINDER;
|
151 |
ilm |
80 |
this.add(this.checkLettrageAuto, c);
|
|
|
81 |
c.gridy++;
|
18 |
ilm |
82 |
this.add(this.checkHideCompteClient, c);
|
|
|
83 |
c.gridy++;
|
|
|
84 |
this.add(this.checkHideCompteFacture, c);
|
|
|
85 |
c.gridy++;
|
93 |
ilm |
86 |
this.add(this.checkHideAnalytique, c);
|
|
|
87 |
c.gridy++;
|
18 |
ilm |
88 |
|
|
|
89 |
/*******************************************************************************************
|
|
|
90 |
* SAISIE DES ACHATS
|
|
|
91 |
******************************************************************************************/
|
|
|
92 |
TitledSeparator sep = new TitledSeparator("Saisie des Achats");
|
|
|
93 |
c.gridwidth = GridBagConstraints.REMAINDER;
|
|
|
94 |
this.add(sep, c);
|
|
|
95 |
c.gridwidth = 1;
|
|
|
96 |
|
|
|
97 |
// Compte Fournisseur
|
|
|
98 |
c.gridy++;
|
|
|
99 |
c.weightx = 0;
|
|
|
100 |
this.add(new JLabel("Compte Fournisseur"), c);
|
|
|
101 |
c.weightx = 1;
|
|
|
102 |
|
|
|
103 |
c.gridx++;
|
|
|
104 |
this.selCompteFourn = new ISQLCompteSelector();
|
|
|
105 |
this.selCompteFourn.init();
|
|
|
106 |
this.add(this.selCompteFourn, c);
|
|
|
107 |
|
|
|
108 |
// Compte Achat
|
|
|
109 |
c.gridy++;
|
|
|
110 |
c.weightx = 0;
|
|
|
111 |
c.gridx = 0;
|
|
|
112 |
this.add(new JLabel("Compte Achat"), c);
|
|
|
113 |
c.weightx = 1;
|
|
|
114 |
c.gridx++;
|
|
|
115 |
this.selCompteAchat = new ISQLCompteSelector();
|
|
|
116 |
this.selCompteAchat.init();
|
|
|
117 |
this.add(this.selCompteAchat, c);
|
|
|
118 |
|
|
|
119 |
// Compte Achat intra
|
|
|
120 |
c.gridy++;
|
|
|
121 |
c.weightx = 0;
|
|
|
122 |
c.gridx = 0;
|
|
|
123 |
this.add(new JLabel("Compte Achat Intracommunautaire"), c);
|
|
|
124 |
c.weightx = 1;
|
|
|
125 |
c.gridx++;
|
|
|
126 |
this.selCompteAchatIntra = new ISQLCompteSelector();
|
|
|
127 |
this.selCompteAchatIntra.init();
|
|
|
128 |
this.add(this.selCompteAchatIntra, c);
|
|
|
129 |
|
|
|
130 |
/*******************************************************************************************
|
|
|
131 |
* SAISIE DES VENTES
|
|
|
132 |
******************************************************************************************/
|
|
|
133 |
c.gridy++;
|
|
|
134 |
c.gridx = 0;
|
|
|
135 |
TitledSeparator sepVenteC = new TitledSeparator("Saisie des ventes");
|
|
|
136 |
c.gridwidth = GridBagConstraints.REMAINDER;
|
|
|
137 |
c.insets = separatorInsets;
|
|
|
138 |
this.add(sepVenteC, c);
|
|
|
139 |
c.insets = normalInsets;
|
|
|
140 |
c.gridwidth = 1;
|
|
|
141 |
|
|
|
142 |
// Compte client
|
|
|
143 |
c.gridy++;
|
|
|
144 |
c.weightx = 0;
|
|
|
145 |
this.add(new JLabel("Compte Client"), c);
|
|
|
146 |
c.weightx = 1;
|
|
|
147 |
c.gridx++;
|
|
|
148 |
|
|
|
149 |
this.selCompteClient = new ISQLCompteSelector();
|
|
|
150 |
this.selCompteClient.init();
|
|
|
151 |
this.add(this.selCompteClient, c);
|
|
|
152 |
|
142 |
ilm |
153 |
// Avance Compte client
|
|
|
154 |
c.gridy++;
|
149 |
ilm |
155 |
c.gridx = 0;
|
142 |
ilm |
156 |
c.weightx = 0;
|
|
|
157 |
this.add(new JLabel("Compte Avance Client"), c);
|
|
|
158 |
c.weightx = 1;
|
|
|
159 |
c.gridx++;
|
|
|
160 |
|
|
|
161 |
this.selCompteAvanceClient = new ISQLCompteSelector();
|
|
|
162 |
this.selCompteAvanceClient.init();
|
|
|
163 |
this.add(this.selCompteAvanceClient, c);
|
|
|
164 |
|
|
|
165 |
// Valeur à l'encaissement
|
|
|
166 |
c.gridy++;
|
149 |
ilm |
167 |
c.gridx = 0;
|
142 |
ilm |
168 |
c.weightx = 0;
|
|
|
169 |
this.add(new JLabel("Compte dépôt chèque"), c);
|
|
|
170 |
c.weightx = 1;
|
|
|
171 |
c.gridx++;
|
|
|
172 |
|
|
|
173 |
this.selCompteValeurEncaissement = new ISQLCompteSelector();
|
|
|
174 |
this.selCompteValeurEncaissement.init();
|
|
|
175 |
this.add(this.selCompteValeurEncaissement, c);
|
|
|
176 |
|
18 |
ilm |
177 |
// Compte vente produits
|
|
|
178 |
c.gridy++;
|
|
|
179 |
c.weightx = 0;
|
|
|
180 |
c.gridx = 0;
|
|
|
181 |
this.add(new JLabel("Compte Vente de produits"), c);
|
|
|
182 |
c.weightx = 1;
|
|
|
183 |
c.gridx++;
|
|
|
184 |
this.selCompteVenteProduits = new ISQLCompteSelector();
|
|
|
185 |
this.selCompteVenteProduits.init();
|
|
|
186 |
this.add(this.selCompteVenteProduits, c);
|
|
|
187 |
|
|
|
188 |
// Compte vente service
|
|
|
189 |
c.gridy++;
|
|
|
190 |
c.weightx = 0;
|
|
|
191 |
c.gridx = 0;
|
|
|
192 |
this.add(new JLabel("Compte Vente de service"), c);
|
|
|
193 |
c.weightx = 1;
|
|
|
194 |
c.gridx++;
|
|
|
195 |
this.selCompteVenteService = new ISQLCompteSelector();
|
|
|
196 |
this.selCompteVenteService.init();
|
|
|
197 |
this.add(this.selCompteVenteService, c);
|
|
|
198 |
|
|
|
199 |
// Factor NATEXIS
|
|
|
200 |
c.gridy++;
|
|
|
201 |
c.weightx = 0;
|
|
|
202 |
c.gridx = 0;
|
|
|
203 |
this.add(new JLabel("Compte affacturage"), c);
|
|
|
204 |
c.weightx = 1;
|
|
|
205 |
c.gridx++;
|
|
|
206 |
this.selCompteFactor = new ISQLCompteSelector();
|
|
|
207 |
this.selCompteFactor.init();
|
|
|
208 |
this.add(this.selCompteFactor, c);
|
|
|
209 |
|
|
|
210 |
// Journal Factor NATEXIS
|
|
|
211 |
c.gridy++;
|
|
|
212 |
c.weightx = 0;
|
|
|
213 |
c.gridx = 0;
|
|
|
214 |
this.add(new JLabel("Journal affacturage"), c);
|
|
|
215 |
c.weightx = 1;
|
|
|
216 |
c.gridx++;
|
|
|
217 |
this.selJrnlFactor = new ElementComboBox();
|
|
|
218 |
this.selJrnlFactor.init(Configuration.getInstance().getDirectory().getElement("JOURNAL"));
|
|
|
219 |
this.add(this.selJrnlFactor, c);
|
|
|
220 |
|
94 |
ilm |
221 |
/**
|
|
|
222 |
* Frais de port sur vente
|
|
|
223 |
*/
|
|
|
224 |
|
|
|
225 |
c.gridy++;
|
|
|
226 |
c.gridx = 0;
|
|
|
227 |
TitledSeparator sepPort = new TitledSeparator("Ports sur vente");
|
|
|
228 |
c.insets = separatorInsets;
|
|
|
229 |
c.gridwidth = GridBagConstraints.REMAINDER;
|
|
|
230 |
this.add(sepPort, c);
|
|
|
231 |
c.insets = normalInsets;
|
|
|
232 |
c.gridwidth = 1;
|
|
|
233 |
|
|
|
234 |
// Compte TVA Collectee
|
|
|
235 |
c.gridy++;
|
|
|
236 |
c.weightx = 0;
|
|
|
237 |
this.add(new JLabel("Compte Port soumis à TVA"), c);
|
|
|
238 |
c.weightx = 1;
|
|
|
239 |
c.gridx++;
|
|
|
240 |
this.selComptePortSoumis = new ISQLCompteSelector();
|
|
|
241 |
this.selComptePortSoumis.init();
|
|
|
242 |
this.add(this.selComptePortSoumis, c);
|
|
|
243 |
|
|
|
244 |
// Compte TVA Deductible
|
|
|
245 |
c.gridy++;
|
|
|
246 |
c.weightx = 0;
|
|
|
247 |
c.gridx = 0;
|
|
|
248 |
this.add(new JLabel("Compte Port non soumis à TVA)"), c);
|
|
|
249 |
c.weightx = 1;
|
|
|
250 |
c.gridx++;
|
|
|
251 |
this.selComptePortNonSoumis = new ISQLCompteSelector();
|
|
|
252 |
this.selComptePortNonSoumis.init();
|
|
|
253 |
this.add(this.selComptePortNonSoumis, c);
|
|
|
254 |
|
18 |
ilm |
255 |
/*******************************************************************************************
|
|
|
256 |
* TVA
|
|
|
257 |
******************************************************************************************/
|
|
|
258 |
c.gridy++;
|
|
|
259 |
c.gridx = 0;
|
|
|
260 |
TitledSeparator sepTVA = new TitledSeparator("TVA");
|
|
|
261 |
c.insets = separatorInsets;
|
|
|
262 |
c.gridwidth = GridBagConstraints.REMAINDER;
|
|
|
263 |
this.add(sepTVA, c);
|
|
|
264 |
c.insets = normalInsets;
|
|
|
265 |
c.gridwidth = 1;
|
|
|
266 |
|
|
|
267 |
// Compte TVA Collectee
|
|
|
268 |
c.gridy++;
|
|
|
269 |
c.weightx = 0;
|
|
|
270 |
this.add(new JLabel("Compte TVA Collectée (Ventes)"), c);
|
|
|
271 |
c.weightx = 1;
|
|
|
272 |
c.gridx++;
|
|
|
273 |
this.selCompteTVACol = new ISQLCompteSelector();
|
|
|
274 |
this.selCompteTVACol.init();
|
|
|
275 |
this.add(this.selCompteTVACol, c);
|
|
|
276 |
|
|
|
277 |
// Compte TVA Deductible
|
|
|
278 |
c.gridy++;
|
|
|
279 |
c.weightx = 0;
|
|
|
280 |
c.gridx = 0;
|
|
|
281 |
this.add(new JLabel("Compte TVA déductible (Achats)"), c);
|
|
|
282 |
c.weightx = 1;
|
|
|
283 |
c.gridx++;
|
|
|
284 |
this.selCompteTVADed = new ISQLCompteSelector();
|
|
|
285 |
this.selCompteTVADed.init();
|
|
|
286 |
this.add(this.selCompteTVADed, c);
|
|
|
287 |
|
|
|
288 |
// Compte TVA intracommunautaire
|
|
|
289 |
c.gridy++;
|
|
|
290 |
c.weightx = 0;
|
|
|
291 |
c.gridx = 0;
|
|
|
292 |
this.add(new JLabel("Compte TVA due intracommunautaire"), c);
|
|
|
293 |
c.weightx = 1;
|
|
|
294 |
c.gridx++;
|
|
|
295 |
this.selCompteTVAIntraComm = new ISQLCompteSelector();
|
|
|
296 |
this.selCompteTVAIntraComm.init();
|
|
|
297 |
this.add(this.selCompteTVAIntraComm, c);
|
|
|
298 |
|
|
|
299 |
// Compte TVA intracommunautaire
|
|
|
300 |
c.gridy++;
|
19 |
ilm |
301 |
c.weighty = 0;
|
18 |
ilm |
302 |
c.weightx = 0;
|
|
|
303 |
c.gridx = 0;
|
|
|
304 |
this.add(new JLabel("Compte TVA sur immobilisations"), c);
|
|
|
305 |
c.weightx = 1;
|
|
|
306 |
c.gridx++;
|
|
|
307 |
this.selCompteTVAImmo = new ISQLCompteSelector();
|
|
|
308 |
this.selCompteTVAImmo.init();
|
|
|
309 |
this.add(this.selCompteTVAImmo, c);
|
|
|
310 |
|
|
|
311 |
// Spacer
|
|
|
312 |
c.weighty = 1;
|
|
|
313 |
c.gridy++;
|
|
|
314 |
this.add(new JPanel(), c);
|
|
|
315 |
|
|
|
316 |
setValues();
|
|
|
317 |
}
|
|
|
318 |
|
|
|
319 |
public void storeValues() {
|
|
|
320 |
|
|
|
321 |
this.rowPrefCompteVals.put("ID_COMPTE_PCE_ACHAT", this.selCompteAchat.getValue());
|
|
|
322 |
this.rowPrefCompteVals.put("ID_COMPTE_PCE_ACHAT_INTRA", this.selCompteAchatIntra.getValue());
|
|
|
323 |
this.rowPrefCompteVals.put("ID_COMPTE_PCE_VENTE_PRODUIT", this.selCompteVenteProduits.getValue());
|
|
|
324 |
this.rowPrefCompteVals.put("ID_COMPTE_PCE_VENTE_SERVICE", this.selCompteVenteService.getValue());
|
|
|
325 |
this.rowPrefCompteVals.put("ID_COMPTE_PCE_FACTOR", this.selCompteFactor.getValue());
|
|
|
326 |
final int selectedId = this.selJrnlFactor.getSelectedId();
|
|
|
327 |
this.rowPrefCompteVals.put("ID_JOURNAL_FACTOR", (selectedId > 1) ? selectedId : 1);
|
|
|
328 |
this.rowPrefCompteVals.put("ID_COMPTE_PCE_FOURNISSEUR", this.selCompteFourn.getValue());
|
|
|
329 |
this.rowPrefCompteVals.put("ID_COMPTE_PCE_CLIENT", this.selCompteClient.getValue());
|
142 |
ilm |
330 |
this.rowPrefCompteVals.put("ID_COMPTE_PCE_AVANCE_CLIENT", this.selCompteAvanceClient.getValue());
|
|
|
331 |
this.rowPrefCompteVals.put("ID_COMPTE_PCE_VALEUR_ENCAISSEMENT", this.selCompteValeurEncaissement.getValue());
|
18 |
ilm |
332 |
this.rowPrefCompteVals.put("ID_COMPTE_PCE_TVA_ACHAT", this.selCompteTVADed.getValue());
|
|
|
333 |
this.rowPrefCompteVals.put("ID_COMPTE_PCE_TVA_VENTE", this.selCompteTVACol.getValue());
|
|
|
334 |
this.rowPrefCompteVals.put("ID_COMPTE_PCE_TVA_INTRA", this.selCompteTVAIntraComm.getValue());
|
|
|
335 |
this.rowPrefCompteVals.put("ID_COMPTE_PCE_TVA_IMMO", this.selCompteTVAImmo.getValue());
|
94 |
ilm |
336 |
this.rowPrefCompteVals.put("ID_COMPTE_PCE_PORT_SOUMIS", this.selComptePortSoumis.getValue());
|
|
|
337 |
this.rowPrefCompteVals.put("ID_COMPTE_PCE_PORT_NON_SOUMIS", this.selComptePortNonSoumis.getValue());
|
151 |
ilm |
338 |
this.rowPrefCompteVals.put("AUTO_LETTRAGE", this.checkLettrageAuto.isSelected());
|
18 |
ilm |
339 |
DefaultNXProps.getInstance().setProperty("HideCompteClient", String.valueOf(this.checkHideCompteClient.isSelected()));
|
|
|
340 |
DefaultNXProps.getInstance().setProperty("HideCompteFacture", String.valueOf(this.checkHideCompteFacture.isSelected()));
|
93 |
ilm |
341 |
DefaultNXProps.getInstance().setProperty("HideAnalytique", String.valueOf(this.checkHideAnalytique.isSelected()));
|
18 |
ilm |
342 |
DefaultNXProps.getInstance().store();
|
|
|
343 |
try {
|
156 |
ilm |
344 |
final Object[] pb = this.rowPrefCompteVals.getInvalid();
|
|
|
345 |
if (pb != null) {
|
|
|
346 |
final SQLFieldTranslator trans = Configuration.getInstance().getTranslator();
|
|
|
347 |
JOptionPane.showMessageDialog(SwingUtilities.getRoot(this), "Impossible de valider les modifications! Le champ <"
|
|
|
348 |
+ trans.getLabelFor(this.rowPrefCompteVals.getTable().getField(pb[0].toString())) + "> pointe sur un compte invalide!(" + pb[1] + ")");
|
|
|
349 |
} else {
|
|
|
350 |
this.rowPrefCompteVals.update();
|
|
|
351 |
}
|
18 |
ilm |
352 |
} catch (SQLException e) {
|
|
|
353 |
e.printStackTrace();
|
|
|
354 |
}
|
|
|
355 |
}
|
|
|
356 |
|
|
|
357 |
public void restoreToDefaults() {
|
|
|
358 |
|
|
|
359 |
try {
|
|
|
360 |
// Achats
|
|
|
361 |
String compte;
|
|
|
362 |
|
|
|
363 |
compte = ComptePCESQLElement.getComptePceDefault("Achats");
|
|
|
364 |
|
151 |
ilm |
365 |
this.checkLettrageAuto.setSelected(false);
|
|
|
366 |
|
18 |
ilm |
367 |
int value = ComptePCESQLElement.getId(compte);
|
|
|
368 |
this.selCompteAchat.setValue(value);
|
|
|
369 |
|
|
|
370 |
// Achats Intra
|
|
|
371 |
compte = ComptePCESQLElement.getComptePceDefault("AchatsIntra");
|
|
|
372 |
value = ComptePCESQLElement.getId(compte);
|
|
|
373 |
this.selCompteAchatIntra.setValue(value);
|
|
|
374 |
|
|
|
375 |
// Ventes Produits
|
|
|
376 |
compte = ComptePCESQLElement.getComptePceDefault("VentesProduits");
|
|
|
377 |
value = ComptePCESQLElement.getId(compte);
|
|
|
378 |
this.selCompteVenteProduits.setValue(value);
|
|
|
379 |
|
|
|
380 |
// Ventes Services
|
|
|
381 |
compte = ComptePCESQLElement.getComptePceDefault("VentesServices");
|
|
|
382 |
value = ComptePCESQLElement.getId(compte);
|
|
|
383 |
this.selCompteVenteService.setValue(value);
|
|
|
384 |
|
|
|
385 |
// Ventes factor
|
|
|
386 |
compte = ComptePCESQLElement.getComptePceDefault("Factor");
|
|
|
387 |
value = ComptePCESQLElement.getId(compte);
|
|
|
388 |
this.selCompteFactor.setValue(value);
|
|
|
389 |
|
|
|
390 |
this.selJrnlFactor.setValue(GenerationMvtSaisieVenteFacture.journal);
|
|
|
391 |
|
|
|
392 |
// Fournisseurs
|
|
|
393 |
compte = ComptePCESQLElement.getComptePceDefault("Fournisseurs");
|
|
|
394 |
value = ComptePCESQLElement.getId(compte);
|
|
|
395 |
this.selCompteFourn.setValue(value);
|
|
|
396 |
|
|
|
397 |
// Client
|
|
|
398 |
compte = ComptePCESQLElement.getComptePceDefault("Clients");
|
|
|
399 |
value = ComptePCESQLElement.getId(compte);
|
|
|
400 |
this.selCompteClient.setValue(value);
|
|
|
401 |
|
142 |
ilm |
402 |
// AvanceClient
|
|
|
403 |
compte = ComptePCESQLElement.getComptePceDefault("AvanceClients");
|
|
|
404 |
value = ComptePCESQLElement.getId(compte);
|
|
|
405 |
this.selCompteAvanceClient.setValue(value);
|
|
|
406 |
|
|
|
407 |
compte = ComptePCESQLElement.getComptePceDefault("ValeurEncaissement");
|
|
|
408 |
value = ComptePCESQLElement.getId(compte);
|
|
|
409 |
this.selCompteValeurEncaissement.setValue(value);
|
94 |
ilm |
410 |
// Port
|
|
|
411 |
compte = ComptePCESQLElement.getComptePceDefault("PortVenteSoumisTVA");
|
|
|
412 |
value = ComptePCESQLElement.getId(compte);
|
|
|
413 |
this.selComptePortSoumis.setValue(value);
|
|
|
414 |
|
|
|
415 |
// Port non soumis
|
|
|
416 |
compte = ComptePCESQLElement.getComptePceDefault("PortVenteNonSoumisTVA");
|
|
|
417 |
value = ComptePCESQLElement.getId(compte);
|
|
|
418 |
this.selComptePortNonSoumis.setValue(value);
|
|
|
419 |
|
18 |
ilm |
420 |
// TVA Coll
|
|
|
421 |
compte = ComptePCESQLElement.getComptePceDefault("TVACollectee");
|
|
|
422 |
value = ComptePCESQLElement.getId(compte);
|
|
|
423 |
this.selCompteTVACol.setValue(value);
|
|
|
424 |
|
|
|
425 |
// TVA Ded
|
|
|
426 |
compte = ComptePCESQLElement.getComptePceDefault("TVADeductible");
|
|
|
427 |
value = ComptePCESQLElement.getId(compte);
|
|
|
428 |
this.selCompteTVADed.setValue(value);
|
|
|
429 |
|
|
|
430 |
// TVA IntraComm
|
|
|
431 |
compte = ComptePCESQLElement.getComptePceDefault("TVAIntraComm");
|
|
|
432 |
value = ComptePCESQLElement.getId(compte);
|
|
|
433 |
this.selCompteTVAIntraComm.setValue(value);
|
|
|
434 |
|
|
|
435 |
// TVA Immo
|
|
|
436 |
compte = ComptePCESQLElement.getComptePceDefault("TVAImmo");
|
|
|
437 |
value = ComptePCESQLElement.getId(compte);
|
|
|
438 |
this.selCompteTVAImmo.setValue(value);
|
|
|
439 |
} catch (Exception e) {
|
|
|
440 |
e.printStackTrace();
|
|
|
441 |
}
|
|
|
442 |
}
|
|
|
443 |
|
|
|
444 |
public String getTitleName() {
|
|
|
445 |
return "Gestion commerciale";
|
|
|
446 |
}
|
|
|
447 |
|
|
|
448 |
private void setValues() {
|
|
|
449 |
|
|
|
450 |
try {
|
|
|
451 |
|
73 |
ilm |
452 |
setComboValues(selCompteAchat, "ID_COMPTE_PCE_ACHAT", "Achats");
|
|
|
453 |
setComboValues(selCompteAchatIntra, "ID_COMPTE_PCE_ACHAT_INTRA", "AchatsIntra");
|
|
|
454 |
setComboValues(selCompteVenteProduits, "ID_COMPTE_PCE_VENTE_PRODUIT", "VentesProduits");
|
|
|
455 |
setComboValues(selCompteVenteService, "ID_COMPTE_PCE_VENTE_SERVICE", "VentesServices");
|
|
|
456 |
setComboValues(selCompteFactor, "ID_COMPTE_PCE_FACTOR", "Factor");
|
18 |
ilm |
457 |
|
|
|
458 |
// Journal Factor
|
73 |
ilm |
459 |
int value = (this.rowPrefCompteVals.getObject("ID_JOURNAL_FACTOR") == null ? 1 : this.rowPrefCompteVals.getInt("ID_JOURNAL_FACTOR"));
|
18 |
ilm |
460 |
if (value <= 1) {
|
|
|
461 |
|
|
|
462 |
value = GenerationMvtSaisieVenteFacture.journal;
|
|
|
463 |
}
|
|
|
464 |
this.selJrnlFactor.setValue(value);
|
|
|
465 |
|
73 |
ilm |
466 |
setComboValues(selCompteFourn, "ID_COMPTE_PCE_FOURNISSEUR", "Fournisseurs");
|
|
|
467 |
setComboValues(selCompteClient, "ID_COMPTE_PCE_CLIENT", "Clients");
|
142 |
ilm |
468 |
setComboValues(selCompteAvanceClient, "ID_COMPTE_PCE_AVANCE_CLIENT", "AvanceClients");
|
|
|
469 |
setComboValues(selCompteValeurEncaissement, "ID_COMPTE_PCE_VALEUR_ENCAISSEMENT", "ValeurEncaissement");
|
94 |
ilm |
470 |
setComboValues(selComptePortSoumis, "ID_COMPTE_PCE_PORT_SOUMIS", "PortVenteSoumisTVA");
|
|
|
471 |
setComboValues(selComptePortNonSoumis, "ID_COMPTE_PCE_PORT_NON_SOUMIS", "PortVenteNonSoumisTVA");
|
73 |
ilm |
472 |
setComboValues(selCompteTVACol, "ID_COMPTE_PCE_TVA_VENTE", "TVACollectee");
|
|
|
473 |
setComboValues(selCompteTVADed, "ID_COMPTE_PCE_TVA_ACHAT", "TVADeductible");
|
|
|
474 |
setComboValues(selCompteTVAIntraComm, "ID_COMPTE_PCE_TVA_INTRA", "TVAIntraComm");
|
|
|
475 |
setComboValues(selCompteTVAImmo, "ID_COMPTE_PCE_TVA_IMMO", "TVAImmo");
|
151 |
ilm |
476 |
this.checkLettrageAuto.setSelected(rowPrefCompteVals.getBoolean("AUTO_LETTRAGE"));
|
18 |
ilm |
477 |
this.checkHideCompteClient.setSelected(Boolean.valueOf(DefaultNXProps.getInstance().getProperty("HideCompteClient")));
|
|
|
478 |
this.checkHideCompteFacture.setSelected(Boolean.valueOf(DefaultNXProps.getInstance().getProperty("HideCompteFacture")));
|
93 |
ilm |
479 |
this.checkHideAnalytique.setSelected(Boolean.valueOf(DefaultNXProps.getInstance().getProperty("HideAnalytique")));
|
18 |
ilm |
480 |
} catch (Exception e) {
|
|
|
481 |
e.printStackTrace();
|
|
|
482 |
}
|
|
|
483 |
}
|
73 |
ilm |
484 |
|
|
|
485 |
private void setComboValues(ISQLCompteSelector combo, String field, String defaultName) {
|
|
|
486 |
int value = 1;
|
|
|
487 |
SQLRowAccessor row = this.rowPrefCompteVals.getForeign(field);
|
|
|
488 |
if (row == null || row.isUndefined()) {
|
|
|
489 |
String compte = ComptePCESQLElement.getComptePceDefault(defaultName);
|
|
|
490 |
value = ComptePCESQLElement.getId(compte);
|
|
|
491 |
} else {
|
|
|
492 |
value = row.getID();
|
|
|
493 |
}
|
|
|
494 |
combo.setValue(value);
|
|
|
495 |
}
|
|
|
496 |
|
18 |
ilm |
497 |
}
|