Line 1... |
Line 1... |
1 |
/*
|
1 |
/*
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
3 |
*
|
3 |
*
|
4 |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
|
4 |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
|
5 |
*
|
5 |
*
|
6 |
* The contents of this file are subject to the terms of the GNU General Public License Version 3
|
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
|
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
|
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.
|
9 |
* language governing permissions and limitations under the License.
|
Line 20... |
Line 20... |
20 |
import org.openconcerto.erp.core.sales.account.VenteFactureSituationSQLComponent;
|
20 |
import org.openconcerto.erp.core.sales.account.VenteFactureSituationSQLComponent;
|
21 |
import org.openconcerto.erp.core.sales.account.VenteFactureSoldeSQLComponent;
|
21 |
import org.openconcerto.erp.core.sales.account.VenteFactureSoldeSQLComponent;
|
22 |
import org.openconcerto.erp.core.sales.order.component.CommandeClientSQLComponent;
|
22 |
import org.openconcerto.erp.core.sales.order.component.CommandeClientSQLComponent;
|
23 |
import org.openconcerto.erp.core.sales.order.report.CommandeClientXmlSheet;
|
23 |
import org.openconcerto.erp.core.sales.order.report.CommandeClientXmlSheet;
|
24 |
import org.openconcerto.erp.core.sales.order.ui.EtatCommandeClient;
|
24 |
import org.openconcerto.erp.core.sales.order.ui.EtatCommandeClient;
|
- |
|
25 |
import org.openconcerto.erp.core.sales.order.ui.ReliquatCommandeTableModel;
|
25 |
import org.openconcerto.erp.core.sales.product.element.UniteVenteArticleSQLElement;
|
26 |
import org.openconcerto.erp.core.sales.product.element.UniteVenteArticleSQLElement;
|
26 |
import org.openconcerto.erp.core.sales.product.model.ProductComponent;
|
27 |
import org.openconcerto.erp.core.sales.product.model.ProductComponent;
|
27 |
import org.openconcerto.erp.core.sales.product.model.ProductHelper;
|
28 |
import org.openconcerto.erp.core.sales.product.model.ProductHelper;
|
28 |
import org.openconcerto.erp.core.sales.shipment.component.BonDeLivraisonSQLComponent;
|
29 |
import org.openconcerto.erp.core.sales.shipment.component.BonDeLivraisonSQLComponent;
|
29 |
import org.openconcerto.erp.core.supplychain.stock.element.MouvementStockSQLElement;
|
30 |
import org.openconcerto.erp.core.supplychain.stock.element.MouvementStockSQLElement;
|
Line 45... |
Line 46... |
45 |
import org.openconcerto.sql.model.SQLRowValues;
|
46 |
import org.openconcerto.sql.model.SQLRowValues;
|
46 |
import org.openconcerto.sql.model.SQLRowValuesListFetcher;
|
47 |
import org.openconcerto.sql.model.SQLRowValuesListFetcher;
|
47 |
import org.openconcerto.sql.model.SQLSelect;
|
48 |
import org.openconcerto.sql.model.SQLSelect;
|
48 |
import org.openconcerto.sql.model.SQLSelectJoin;
|
49 |
import org.openconcerto.sql.model.SQLSelectJoin;
|
49 |
import org.openconcerto.sql.model.SQLTable;
|
50 |
import org.openconcerto.sql.model.SQLTable;
|
- |
|
51 |
import org.openconcerto.sql.model.SQLTableEvent;
|
- |
|
52 |
import org.openconcerto.sql.model.SQLTableEvent.Mode;
|
- |
|
53 |
import org.openconcerto.sql.model.SQLTableModifiedListener;
|
50 |
import org.openconcerto.sql.model.Where;
|
54 |
import org.openconcerto.sql.model.Where;
|
51 |
import org.openconcerto.sql.preferences.SQLPreferences;
|
55 |
import org.openconcerto.sql.preferences.SQLPreferences;
|
52 |
import org.openconcerto.sql.request.UpdateBuilder;
|
56 |
import org.openconcerto.sql.request.UpdateBuilder;
|
53 |
import org.openconcerto.sql.utils.SQLUtils;
|
57 |
import org.openconcerto.sql.utils.SQLUtils;
|
54 |
import org.openconcerto.sql.view.EditFrame;
|
58 |
import org.openconcerto.sql.view.EditFrame;
|
55 |
import org.openconcerto.sql.view.EditPanel;
|
59 |
import org.openconcerto.sql.view.EditPanel;
|
- |
|
60 |
import org.openconcerto.sql.view.EditPanel.EditMode;
|
- |
|
61 |
import org.openconcerto.sql.view.EditPanelListener;
|
56 |
import org.openconcerto.sql.view.list.IListe;
|
62 |
import org.openconcerto.sql.view.list.IListe;
|
57 |
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
|
63 |
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
|
58 |
import org.openconcerto.sql.view.list.RowAction;
|
64 |
import org.openconcerto.sql.view.list.RowAction;
|
59 |
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
|
65 |
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
|
60 |
import org.openconcerto.sql.view.list.SQLTableModelColumn;
|
66 |
import org.openconcerto.sql.view.list.SQLTableModelColumn;
|
61 |
import org.openconcerto.sql.view.list.SQLTableModelSource;
|
67 |
import org.openconcerto.sql.view.list.SQLTableModelSource;
|
- |
|
68 |
import org.openconcerto.ui.PanelFrame;
|
- |
|
69 |
import org.openconcerto.utils.CollectionUtils;
|
62 |
import org.openconcerto.utils.CompareUtils;
|
70 |
import org.openconcerto.utils.CompareUtils;
|
63 |
import org.openconcerto.utils.DecimalUtils;
|
71 |
import org.openconcerto.utils.DecimalUtils;
|
64 |
import org.openconcerto.utils.ExceptionHandler;
|
72 |
import org.openconcerto.utils.ExceptionHandler;
|
65 |
import org.openconcerto.utils.ListMap;
|
73 |
import org.openconcerto.utils.ListMap;
|
66 |
import org.openconcerto.utils.NumberUtils;
|
74 |
import org.openconcerto.utils.NumberUtils;
|
67 |
import org.openconcerto.utils.cc.ITransformer;
|
75 |
import org.openconcerto.utils.cc.ITransformer;
|
68 |
|
76 |
|
69 |
import java.awt.Component;
|
77 |
import java.awt.Component;
|
- |
|
78 |
import java.awt.GridBagConstraints;
|
- |
|
79 |
import java.awt.GridBagLayout;
|
70 |
import java.awt.event.ActionEvent;
|
80 |
import java.awt.event.ActionEvent;
|
71 |
import java.io.IOException;
|
81 |
import java.io.IOException;
|
72 |
import java.math.BigDecimal;
|
82 |
import java.math.BigDecimal;
|
73 |
import java.math.RoundingMode;
|
83 |
import java.math.RoundingMode;
|
74 |
import java.sql.SQLException;
|
84 |
import java.sql.SQLException;
|
Line 80... |
Line 90... |
80 |
import java.util.Map;
|
90 |
import java.util.Map;
|
81 |
import java.util.Set;
|
91 |
import java.util.Set;
|
82 |
|
92 |
|
83 |
import javax.swing.AbstractAction;
|
93 |
import javax.swing.AbstractAction;
|
84 |
import javax.swing.JLabel;
|
94 |
import javax.swing.JLabel;
|
- |
|
95 |
import javax.swing.JOptionPane;
|
- |
|
96 |
import javax.swing.JPanel;
|
- |
|
97 |
import javax.swing.JScrollPane;
|
85 |
import javax.swing.JTable;
|
98 |
import javax.swing.JTable;
|
86 |
import javax.swing.SwingUtilities;
|
99 |
import javax.swing.SwingUtilities;
|
87 |
import javax.swing.table.DefaultTableCellRenderer;
|
100 |
import javax.swing.table.DefaultTableCellRenderer;
|
88 |
|
101 |
|
89 |
import org.apache.commons.dbutils.ResultSetHandler;
|
102 |
import org.apache.commons.dbutils.ResultSetHandler;
|
Line 114... |
Line 127... |
114 |
PredicateRowAction actionTransfertBL = new PredicateRowAction(new AbstractAction("Transfert automatique vers BL") {
|
127 |
PredicateRowAction actionTransfertBL = new PredicateRowAction(new AbstractAction("Transfert automatique vers BL") {
|
115 |
|
128 |
|
116 |
@Override
|
129 |
@Override
|
117 |
public void actionPerformed(ActionEvent e) {
|
130 |
public void actionPerformed(ActionEvent e) {
|
118 |
TransfertCommandeAutoUtils transfert = new TransfertCommandeAutoUtils(getTable());
|
131 |
TransfertCommandeAutoUtils transfert = new TransfertCommandeAutoUtils(getTable());
|
- |
|
132 |
List<SQLRowValues> selectedRows = IListe.get(e).getSelectedRows();
|
- |
|
133 |
Set<String> clientBloque = checkClient(selectedRows);
|
- |
|
134 |
if (clientBloque.isEmpty()) {
|
119 |
transfert.transfertMultiBL(IListe.get(e).getSelectedRows());
|
135 |
transfert.transfertMultiBL(IListe.get(e).getSelectedRows());
|
- |
|
136 |
} else if (clientBloque.size() == 1) {
|
- |
|
137 |
JOptionPane.showMessageDialog(null, "Impossible de faire le transfert car le client " + clientBloque.iterator().next() + " est bloqué!");
|
- |
|
138 |
} else {
|
- |
|
139 |
JOptionPane.showMessageDialog(null, "Impossible de faire le transfert car les clients " + CollectionUtils.join(clientBloque, ",") + " sont bloqués!");
|
- |
|
140 |
}
|
- |
|
141 |
|
120 |
}
|
142 |
}
|
121 |
}, false);
|
143 |
}, false);
|
122 |
actionTransfertBL.setPredicate(IListeEvent.getNonEmptySelectionPredicate());
|
144 |
actionTransfertBL.setPredicate(IListeEvent.getNonEmptySelectionPredicate());
|
123 |
getRowActions().add(actionTransfertBL);
|
145 |
getRowActions().add(actionTransfertBL);
|
124 |
|
146 |
|
Line 144... |
Line 166... |
144 |
PredicateRowAction actionFacture = new PredicateRowAction(new AbstractAction("Transfert automatique en facture") {
|
166 |
PredicateRowAction actionFacture = new PredicateRowAction(new AbstractAction("Transfert automatique en facture") {
|
145 |
|
167 |
|
146 |
@Override
|
168 |
@Override
|
147 |
public void actionPerformed(ActionEvent e) {
|
169 |
public void actionPerformed(ActionEvent e) {
|
148 |
TransfertCommandeAutoUtils transfert = new TransfertCommandeAutoUtils(getTable());
|
170 |
TransfertCommandeAutoUtils transfert = new TransfertCommandeAutoUtils(getTable());
|
- |
|
171 |
List<SQLRowValues> selectedRows = IListe.get(e).getSelectedRows();
|
- |
|
172 |
Set<String> clientBloque = checkClient(selectedRows);
|
- |
|
173 |
if (clientBloque.isEmpty()) {
|
149 |
transfert.transfertFacture(IListe.get(e).getSelectedRows());
|
174 |
transfert.transfertFacture(IListe.get(e).getSelectedRows());
|
- |
|
175 |
} else if (clientBloque.size() == 1) {
|
- |
|
176 |
JOptionPane.showMessageDialog(null, "Impossible de faire le transfert car le client " + clientBloque.iterator().next() + " est bloqué!");
|
- |
|
177 |
} else {
|
- |
|
178 |
JOptionPane.showMessageDialog(null, "Impossible de faire le transfert car les clients " + CollectionUtils.join(clientBloque, ",") + " sont bloqués!");
|
- |
|
179 |
}
|
- |
|
180 |
|
150 |
}
|
181 |
}
|
151 |
}, false);
|
182 |
}, false);
|
152 |
actionFacture.setPredicate(IListeEvent.getNonEmptySelectionPredicate());
|
183 |
actionFacture.setPredicate(IListeEvent.getNonEmptySelectionPredicate());
|
153 |
getRowActions().add(actionFacture);
|
184 |
getRowActions().add(actionFacture);
|
154 |
|
185 |
|
155 |
}
|
186 |
}
|
156 |
|
187 |
|
- |
|
188 |
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.ACOMPTE_DEVIS, false)) {
|
- |
|
189 |
PredicateRowAction actionClient = new PredicateRowAction(new AbstractAction("Saisir un acompte") {
|
- |
|
190 |
EditFrame edit;
|
- |
|
191 |
|
- |
|
192 |
public void actionPerformed(ActionEvent e) {
|
- |
|
193 |
final SQLElement eltEncaisser = Configuration.getInstance().getDirectory()
|
- |
|
194 |
.getElement(((ComptaPropsConfiguration) Configuration.getInstance()).getRootSociete().getTable("ENCAISSER_MONTANT"));
|
- |
|
195 |
|
- |
|
196 |
if (this.edit == null) {
|
- |
|
197 |
this.edit = new EditFrame(eltEncaisser, EditMode.CREATION);
|
- |
|
198 |
}
|
- |
|
199 |
final SQLRowAccessor selRow = IListe.get(e).getSelectedRow();
|
- |
|
200 |
SQLRowValues rowVals = new SQLRowValues(eltEncaisser.getTable());
|
- |
|
201 |
rowVals.put("ACOMPTE", true);
|
- |
|
202 |
rowVals.put("NOM", "Acompte commande " + selRow.getString("NUMERO"));
|
- |
|
203 |
rowVals.put("ID_CLIENT", selRow.getForeignID("ID_CLIENT"));
|
- |
|
204 |
rowVals.put("ID_COMMANDE_CLIENT", selRow.getID());
|
- |
|
205 |
SQLRowValues rowValsElt = new SQLRowValues(eltEncaisser.getTable().getTable("ENCAISSER_MONTANT_ELEMENT"));
|
- |
|
206 |
rowValsElt.put("MONTANT_A_REGLER", selRow.getLong("T_TTC"));
|
- |
|
207 |
rowValsElt.put("DATE", selRow.getObject("DATE"));
|
- |
|
208 |
rowValsElt.put("ID_ENCAISSER_MONTANT", rowVals);
|
- |
|
209 |
this.edit.getSQLComponent().select(rowVals);
|
- |
|
210 |
this.edit.setVisible(true);
|
- |
|
211 |
this.edit.addEditPanelListener(new EditPanelListener() {
|
- |
|
212 |
|
- |
|
213 |
@Override
|
- |
|
214 |
public void modified() {
|
- |
|
215 |
}
|
- |
|
216 |
|
- |
|
217 |
@Override
|
- |
|
218 |
public void inserted(int id) {
|
- |
|
219 |
// Put id devis and refresh devis.t_acompte
|
- |
|
220 |
SQLRow rowE = eltEncaisser.getTable().getRow(id);
|
- |
|
221 |
String up = "UPDATE " + selRow.getTable().getSQLName().quote() + " set \"T_ACOMPTE\"=(SELECT COALESCE(SUM(\"MONTANT\"),0) from " + rowE.getTable().getSQLName().quote()
|
- |
|
222 |
+ " where \"ARCHIVE\"=0 and \"ID_COMMANDE_CLIENT\"=" + selRow.getID() + ") where \"ID\"=" + selRow.getID();
|
- |
|
223 |
eltEncaisser.getTable().getDBSystemRoot().getDataSource().execute(up);
|
- |
|
224 |
}
|
- |
|
225 |
|
- |
|
226 |
@Override
|
- |
|
227 |
public void deleted() {
|
- |
|
228 |
}
|
- |
|
229 |
|
- |
|
230 |
@Override
|
- |
|
231 |
public void cancelled() {
|
- |
|
232 |
}
|
- |
|
233 |
});
|
- |
|
234 |
}
|
- |
|
235 |
}, false);
|
- |
|
236 |
actionClient.setPredicate(IListeEvent.getSingleSelectionPredicate());
|
- |
|
237 |
getRowActions().add(actionClient);
|
- |
|
238 |
}
|
- |
|
239 |
|
157 |
final List<RowAction> allowedActions = new ArrayList<RowAction>();
|
240 |
final List<RowAction> allowedActions = new ArrayList<RowAction>();
|
158 |
// Transfert vers facture
|
241 |
// Transfert vers facture
|
159 |
PredicateRowAction bonAction = new PredicateRowAction(new AbstractAction() {
|
242 |
PredicateRowAction bonAction = new PredicateRowAction(new AbstractAction() {
|
160 |
public void actionPerformed(ActionEvent e) {
|
243 |
public void actionPerformed(ActionEvent e) {
|
161 |
transfertBonLivraisonClient(IListe.get(e).getSelectedRows());
|
244 |
transfertBonLivraisonClient(IListe.get(e).getSelectedRows());
|
Line 240... |
Line 323... |
240 |
|
323 |
|
241 |
cmdAction.setPredicate(IListeEvent.getSingleSelectionPredicate());
|
324 |
cmdAction.setPredicate(IListeEvent.getSingleSelectionPredicate());
|
242 |
|
325 |
|
243 |
bonAction.setPredicate(IListeEvent.getSingleSelectionPredicate());
|
326 |
bonAction.setPredicate(IListeEvent.getSingleSelectionPredicate());
|
244 |
|
327 |
|
- |
|
328 |
// Reliquat
|
- |
|
329 |
PredicateRowAction reliquatAction = new PredicateRowAction(new AbstractAction() {
|
- |
|
330 |
public void actionPerformed(ActionEvent e) {
|
- |
|
331 |
JPanel panelReliquat = new JPanel(new GridBagLayout());
|
- |
|
332 |
GridBagConstraints c = new GridBagConstraints();
|
- |
|
333 |
final ReliquatCommandeTableModel dm = new ReliquatCommandeTableModel(IListe.get(e).getSelectedRowAccessor());
|
- |
|
334 |
if (dm.getRowCount() > 0) {
|
- |
|
335 |
JTable table = new JTable(dm);
|
- |
|
336 |
JScrollPane comp = new JScrollPane(table);
|
- |
|
337 |
c.weightx = 1;
|
- |
|
338 |
c.weighty = 1;
|
- |
|
339 |
c.fill = GridBagConstraints.BOTH;
|
- |
|
340 |
panelReliquat.add(comp, c);
|
- |
|
341 |
PanelFrame frame = new PanelFrame(panelReliquat, "Reliquat commande");
|
- |
|
342 |
frame.pack();
|
- |
|
343 |
frame.setVisible(true);
|
- |
|
344 |
} else {
|
- |
|
345 |
JOptionPane.showMessageDialog(null, "Aucun reliquat restant");
|
- |
|
346 |
}
|
- |
|
347 |
}
|
- |
|
348 |
|
- |
|
349 |
}, false, "sales.order.reliquat.show");
|
- |
|
350 |
|
- |
|
351 |
reliquatAction.setPredicate(IListeEvent.getSingleSelectionPredicate());
|
- |
|
352 |
|
245 |
MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(CommandeClientXmlSheet.class);
|
353 |
MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(this, CommandeClientXmlSheet.class);
|
246 |
mouseSheetXmlListeListener.setGenerateHeader(true);
|
354 |
mouseSheetXmlListeListener.setGenerateHeader(true);
|
247 |
mouseSheetXmlListeListener.setShowHeader(true);
|
355 |
mouseSheetXmlListeListener.setShowHeader(true);
|
248 |
|
356 |
|
249 |
// Dupliquer
|
357 |
// Dupliquer
|
250 |
RowAction cloneAction = getCloneAction();
|
358 |
RowAction cloneAction = getCloneAction();
|
Line 253... |
Line 361... |
253 |
allowedActions.add(bonAction);
|
361 |
allowedActions.add(bonAction);
|
254 |
allowedActions.add(factureAction);
|
362 |
allowedActions.add(factureAction);
|
255 |
allowedActions.add(acompteAction);
|
363 |
allowedActions.add(acompteAction);
|
256 |
allowedActions.add(soldeAction);
|
364 |
allowedActions.add(soldeAction);
|
257 |
allowedActions.add(cmdAction);
|
365 |
allowedActions.add(cmdAction);
|
- |
|
366 |
allowedActions.add(reliquatAction);
|
258 |
allowedActions.addAll(mouseSheetXmlListeListener.getRowActions());
|
367 |
allowedActions.addAll(mouseSheetXmlListeListener.getRowActions());
|
259 |
getRowActions().addAll(allowedActions);
|
368 |
getRowActions().addAll(allowedActions);
|
260 |
}
|
369 |
}
|
261 |
|
370 |
|
262 |
private boolean chiffrageEditableInUI = true;
|
371 |
private boolean chiffrageEditableInUI = true;
|
Line 462... |
Line 571... |
462 |
builder.setObject("ETAT_COMMANDE", etat.getId());
|
571 |
builder.setObject("ETAT_COMMANDE", etat.getId());
|
463 |
builder.setWhere(new Where(getTable().getKey(), ids));
|
572 |
builder.setWhere(new Where(getTable().getKey(), ids));
|
464 |
|
573 |
|
465 |
getTable().getDBSystemRoot().getDataSource().execute(builder.asString());
|
574 |
getTable().getDBSystemRoot().getDataSource().execute(builder.asString());
|
466 |
getTable().fireTableModified(-1);
|
575 |
getTable().fireTableModified(-1);
|
- |
|
576 |
|
- |
|
577 |
if (etat == EtatCommandeClient.ANNULEE) {
|
- |
|
578 |
|
- |
|
579 |
// Suppression des stocks si commande annulée
|
- |
|
580 |
SQLElement eltMvtStock = getDirectory().getElement("MOUVEMENT_STOCK");
|
- |
|
581 |
SQLSelect sel = new SQLSelect();
|
- |
|
582 |
sel.addSelect(eltMvtStock.getTable().getField("ID"));
|
- |
|
583 |
Where w = new Where(eltMvtStock.getTable().getField("IDSOURCE"), ids);
|
- |
|
584 |
Where w2 = new Where(eltMvtStock.getTable().getField("SOURCE"), "=", getTable().getName());
|
- |
|
585 |
sel.setWhere(w.and(w2));
|
- |
|
586 |
|
- |
|
587 |
try {
|
- |
|
588 |
@SuppressWarnings("rawtypes")
|
- |
|
589 |
List res = (List) eltMvtStock.getTable().getBase().getDataSource().execute(sel.asString(), new ArrayListHandler());
|
- |
|
590 |
if (res != null) {
|
- |
|
591 |
for (int i = 0; i < res.size(); i++) {
|
- |
|
592 |
Object[] tmp = (Object[]) res.get(i);
|
- |
|
593 |
eltMvtStock.archive(((Number) tmp[0]).intValue());
|
- |
|
594 |
}
|
- |
|
595 |
}
|
- |
|
596 |
} catch (SQLException e) {
|
- |
|
597 |
ExceptionHandler.handle("Erreur lors de la suppression des mouvements de stocks", e);
|
- |
|
598 |
}
|
- |
|
599 |
}
|
467 |
}
|
600 |
}
|
468 |
|
601 |
|
469 |
/*
|
602 |
/*
|
470 |
* (non-Javadoc)
|
603 |
* (non-Javadoc)
|
471 |
*
|
604 |
*
|
Line 491... |
Line 624... |
491 |
}
|
624 |
}
|
492 |
l.add("ID_CLIENT");
|
625 |
l.add("ID_CLIENT");
|
493 |
l.add("ID_COMMERCIAL");
|
626 |
l.add("ID_COMMERCIAL");
|
494 |
l.add("T_HT");
|
627 |
l.add("T_HT");
|
495 |
l.add("T_TTC");
|
628 |
l.add("T_TTC");
|
- |
|
629 |
SQLPreferences prefs = SQLPreferences.getMemCached(getTable().getDBRoot());
|
- |
|
630 |
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.ACOMPTE_DEVIS, false)) {
|
- |
|
631 |
l.add("T_ACOMPTE");
|
- |
|
632 |
}
|
496 |
if (getTable().getFieldsName().contains("ACOMPTE_COMMANDE")) {
|
633 |
if (getTable().getFieldsName().contains("ACOMPTE_COMMANDE")) {
|
497 |
l.add("ACOMPTE_COMMANDE");
|
634 |
l.add("ACOMPTE_COMMANDE");
|
498 |
}
|
635 |
}
|
499 |
l.add("NOM");
|
636 |
l.add("NOM");
|
500 |
l.add("INFOS");
|
637 |
l.add("INFOS");
|
501 |
SQLPreferences prefs = SQLPreferences.getMemCached(getTable().getDBRoot());
|
- |
|
502 |
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.ORDER_PACKAGING_MANAGEMENT, true)) {
|
638 |
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.ORDER_PACKAGING_MANAGEMENT, true)) {
|
503 |
l.add("NUMERO_EXPEDITION");
|
639 |
l.add("NUMERO_EXPEDITION");
|
504 |
l.add("ETAT_COMMANDE");
|
640 |
l.add("ETAT_COMMANDE");
|
505 |
}
|
641 |
}
|
506 |
return l;
|
642 |
return l;
|
Line 508... |
Line 644... |
508 |
|
644 |
|
509 |
@Override
|
645 |
@Override
|
510 |
public Set<String> getReadOnlyFields() {
|
646 |
public Set<String> getReadOnlyFields() {
|
511 |
final Set<String> s = new HashSet<String>();
|
647 |
final Set<String> s = new HashSet<String>();
|
512 |
s.add("ID_DEVIS");
|
648 |
s.add("ID_DEVIS");
|
- |
|
649 |
if (getTable().contains("T_ACOMPTE")) {
|
- |
|
650 |
s.add("T_ACOMPTE");
|
- |
|
651 |
}
|
513 |
return s;
|
652 |
return s;
|
514 |
}
|
653 |
}
|
515 |
|
654 |
|
516 |
@Override
|
655 |
@Override
|
517 |
protected void archive(TreesOfSQLRows trees, boolean cutLinks) throws SQLException {
|
656 |
protected void archive(TreesOfSQLRows trees, boolean cutLinks) throws SQLException {
|
Line 645... |
Line 784... |
645 |
|
784 |
|
646 |
rowValsElt.put("T_POIDS", rowValsElt.getLong("POIDS") * rowValsElt.getInt("QTE"));
|
785 |
rowValsElt.put("T_POIDS", rowValsElt.getLong("POIDS") * rowValsElt.getInt("QTE"));
|
647 |
rowValsElt.put("T_PA_HT", ((BigDecimal) rowValsElt.getObject("PA_HT")).multiply(new BigDecimal(rowValsElt.getInt("QTE")), DecimalUtils.HIGH_PRECISION));
|
786 |
rowValsElt.put("T_PA_HT", ((BigDecimal) rowValsElt.getObject("PA_HT")).multiply(new BigDecimal(rowValsElt.getInt("QTE")), DecimalUtils.HIGH_PRECISION));
|
648 |
rowValsElt.put("T_PA_TTC", ((BigDecimal) rowValsElt.getObject("T_PA_HT")).multiply(new BigDecimal((rowValsElt.getForeign("ID_TAXE").getFloat("TAUX") / 100.0 + 1.0)),
|
787 |
rowValsElt.put("T_PA_TTC", ((BigDecimal) rowValsElt.getObject("T_PA_HT")).multiply(new BigDecimal((rowValsElt.getForeign("ID_TAXE").getFloat("TAUX") / 100.0 + 1.0)),
|
649 |
DecimalUtils.HIGH_PRECISION));
|
788 |
DecimalUtils.HIGH_PRECISION));
|
- |
|
789 |
final SQLRow asRow = rowArticleFind.getForeign("ID_FOURNISSEUR").asRow();
|
- |
|
790 |
final SQLRowAccessor rowDeviseF = asRow.getNonEmptyForeign("ID_DEVISE");
|
650 |
// rowValsElt.put("ID_DEVISE",
|
791 |
if (rowDeviseF != null) {
|
651 |
// rowCmd.getForeignRow("ID_TARIF").getForeignID("ID_DEVISE"));
|
792 |
rowValsElt.put("ID_DEVISE", rowDeviseF.getID());
|
- |
|
793 |
}
|
652 |
map.add(rowArticleFind.getForeign("ID_FOURNISSEUR").asRow(), rowValsElt);
|
794 |
map.add(rowArticleFind.getForeign("ID_FOURNISSEUR").asRow(), rowValsElt);
|
653 |
}
|
795 |
}
|
654 |
|
796 |
|
655 |
}
|
797 |
}
|
656 |
MouvementStockSQLElement.createCommandeF(map, null, "");
|
798 |
MouvementStockSQLElement.createCommandeF(map, null, "");
|
Line 689... |
Line 831... |
689 |
System.err.println(input.asString());
|
831 |
System.err.println(input.asString());
|
690 |
return input;
|
832 |
return input;
|
691 |
}
|
833 |
}
|
692 |
});
|
834 |
});
|
693 |
comp.loadQuantity(fetcher.fetch(), "COMMANDE_CLIENT_ELEMENT");
|
835 |
comp.loadQuantity(fetcher.fetch(), "COMMANDE_CLIENT_ELEMENT");
|
694 |
|
- |
|
- |
|
836 |
comp.removeZeroQtyLines();
|
695 |
}
|
837 |
}
|
696 |
|
838 |
|
697 |
/**
|
839 |
/**
|
698 |
* Transfert en Facture
|
840 |
* Transfert en Facture
|
699 |
*
|
841 |
*
|
Line 760... |
Line 902... |
760 |
}
|
902 |
}
|
761 |
|
903 |
|
762 |
@Override
|
904 |
@Override
|
763 |
protected String createCode() {
|
905 |
protected String createCode() {
|
764 |
return "sales.order";
|
906 |
return "sales.order";
|
- |
|
907 |
|
- |
|
908 |
// r32617 | ludo | 2021-12-20 11:42:44 CET
|
- |
|
909 |
//
|
- |
|
910 |
// blocage des intéractions
|
- |
|
911 |
// ----------------------------------------------------------------------------
|
- |
|
912 |
}
|
- |
|
913 |
|
- |
|
914 |
private final List<SQLTableModifiedListener> listenerCmdInserted = new ArrayList<>();
|
- |
|
915 |
|
- |
|
916 |
public void addInsertedCmdListener(SQLTableModifiedListener l) {
|
- |
|
917 |
this.listenerCmdInserted.add(l);
|
- |
|
918 |
}
|
- |
|
919 |
|
- |
|
920 |
public void removeInsertedCmdListener(SQLTableModifiedListener l) {
|
- |
|
921 |
this.listenerCmdInserted.remove(l);
|
- |
|
922 |
}
|
- |
|
923 |
|
- |
|
924 |
public void fireInsertedCmdListener(SQLRow row) {
|
- |
|
925 |
for (SQLTableModifiedListener sqlTableModifiedListener : this.listenerCmdInserted) {
|
- |
|
926 |
sqlTableModifiedListener.tableModified(new SQLTableEvent(row, Mode.ROW_ADDED, null));
|
- |
|
927 |
}
|
- |
|
928 |
}
|
- |
|
929 |
|
- |
|
930 |
private Set<String> checkClient(List<? extends SQLRowAccessor> rows) {
|
- |
|
931 |
|
- |
|
932 |
Set<String> clientBloque = new HashSet<>();
|
- |
|
933 |
for (SQLRowAccessor sqlRowAccessor : rows) {
|
- |
|
934 |
SQLRowAccessor client = sqlRowAccessor.getForeign("ID_CLIENT").fetchNewRow();
|
- |
|
935 |
if (client.getBoolean("BLOQUE_LIVRAISON") || client.getBoolean("BLOQUE")) {
|
- |
|
936 |
clientBloque.add(client.getString("CODE") + " " + client.getString("NOM"));
|
- |
|
937 |
}
|
- |
|
938 |
}
|
- |
|
939 |
return clientBloque;
|
765 |
}
|
940 |
}
|
766 |
|
941 |
|
767 |
}
|
942 |
}
|