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