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 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.
|
10 |
*
|
10 |
*
|
11 |
* When distributing the software, include this License Header Notice in each file.
|
11 |
* When distributing the software, include this License Header Notice in each file.
|
12 |
*/
|
12 |
*/
|
13 |
|
13 |
|
14 |
package org.openconcerto.erp.core.sales.invoice.element;
|
14 |
package org.openconcerto.erp.core.sales.invoice.element;
|
15 |
|
15 |
|
16 |
import org.openconcerto.erp.config.ComptaPropsConfiguration;
|
16 |
import org.openconcerto.erp.config.ComptaPropsConfiguration;
|
17 |
import org.openconcerto.erp.config.Gestion;
|
17 |
import org.openconcerto.erp.config.Gestion;
|
18 |
import org.openconcerto.erp.core.common.component.TransfertBaseSQLComponent;
|
18 |
import org.openconcerto.erp.core.common.component.TransfertBaseSQLComponent;
|
19 |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
|
19 |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
|
20 |
import org.openconcerto.erp.core.common.ui.AbstractVenteArticleItemTable;
|
20 |
import org.openconcerto.erp.core.common.ui.AbstractVenteArticleItemTable;
|
21 |
import org.openconcerto.erp.core.common.ui.DeviseField;
|
21 |
import org.openconcerto.erp.core.common.ui.DeviseField;
|
22 |
import org.openconcerto.erp.core.common.ui.PanelFrame;
|
22 |
import org.openconcerto.erp.core.common.ui.PanelFrame;
|
23 |
import org.openconcerto.erp.core.edm.AttachmentAction;
|
23 |
import org.openconcerto.erp.core.edm.AttachmentAction;
|
24 |
import org.openconcerto.erp.core.finance.accounting.element.EcritureSQLElement;
|
24 |
import org.openconcerto.erp.core.finance.accounting.element.EcritureSQLElement;
|
- |
|
25 |
import org.openconcerto.erp.core.finance.payment.element.ModeDeReglementSQLElement;
|
25 |
import org.openconcerto.erp.core.sales.account.PartialInvoiceEditGroup;
|
26 |
import org.openconcerto.erp.core.sales.account.PartialInvoiceEditGroup;
|
26 |
import org.openconcerto.erp.core.sales.account.VenteFactureSituationSQLComponent;
|
27 |
import org.openconcerto.erp.core.sales.account.VenteFactureSituationSQLComponent;
|
27 |
import org.openconcerto.erp.core.sales.account.VenteFactureSoldeEditGroup;
|
28 |
import org.openconcerto.erp.core.sales.account.VenteFactureSoldeEditGroup;
|
28 |
import org.openconcerto.erp.core.sales.account.VenteFactureSoldeSQLComponent;
|
29 |
import org.openconcerto.erp.core.sales.account.VenteFactureSoldeSQLComponent;
|
29 |
import org.openconcerto.erp.core.sales.invoice.component.SaisieVenteFactureSQLComponent;
|
30 |
import org.openconcerto.erp.core.sales.invoice.component.SaisieVenteFactureSQLComponent;
|
30 |
import org.openconcerto.erp.core.sales.invoice.report.VenteFactureXmlSheet;
|
31 |
import org.openconcerto.erp.core.sales.invoice.report.VenteFactureXmlSheet;
|
- |
|
32 |
import org.openconcerto.erp.core.sales.invoice.ui.DateReglementRenderer;
|
31 |
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
|
33 |
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
|
32 |
import org.openconcerto.erp.core.sales.shipment.component.BonDeLivraisonSQLComponent;
|
34 |
import org.openconcerto.erp.core.sales.shipment.component.BonDeLivraisonSQLComponent;
|
33 |
import org.openconcerto.erp.core.supplychain.stock.element.MouvementStockSQLElement;
|
35 |
import org.openconcerto.erp.core.supplychain.stock.element.MouvementStockSQLElement;
|
34 |
import org.openconcerto.erp.generationEcritures.GenerationMvtRetourNatexis;
|
36 |
import org.openconcerto.erp.generationEcritures.GenerationMvtRetourNatexis;
|
35 |
import org.openconcerto.erp.generationEcritures.GenerationMvtSaisieVenteFacture;
|
37 |
import org.openconcerto.erp.generationEcritures.GenerationMvtSaisieVenteFacture;
|
36 |
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
|
38 |
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
|
37 |
import org.openconcerto.erp.preferences.DefaultNXProps;
|
39 |
import org.openconcerto.erp.preferences.DefaultNXProps;
|
38 |
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel;
|
40 |
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel;
|
39 |
import org.openconcerto.erp.preferences.PrinterNXProps;
|
41 |
import org.openconcerto.erp.preferences.PrinterNXProps;
|
40 |
import org.openconcerto.erp.rights.NXRights;
|
42 |
import org.openconcerto.erp.rights.NXRights;
|
41 |
import org.openconcerto.sql.Configuration;
|
43 |
import org.openconcerto.sql.Configuration;
|
42 |
import org.openconcerto.sql.element.GlobalMapper;
|
44 |
import org.openconcerto.sql.element.GlobalMapper;
|
43 |
import org.openconcerto.sql.element.SQLComponent;
|
45 |
import org.openconcerto.sql.element.SQLComponent;
|
44 |
import org.openconcerto.sql.element.SQLElement;
|
46 |
import org.openconcerto.sql.element.SQLElement;
|
45 |
import org.openconcerto.sql.element.SQLElementLink.LinkType;
|
47 |
import org.openconcerto.sql.element.SQLElementLink.LinkType;
|
46 |
import org.openconcerto.sql.element.SQLElementLinksSetup;
|
48 |
import org.openconcerto.sql.element.SQLElementLinksSetup;
|
47 |
import org.openconcerto.sql.element.TreesOfSQLRows;
|
49 |
import org.openconcerto.sql.element.TreesOfSQLRows;
|
48 |
import org.openconcerto.sql.model.FieldPath;
|
50 |
import org.openconcerto.sql.model.FieldPath;
|
49 |
import org.openconcerto.sql.model.SQLField;
|
51 |
import org.openconcerto.sql.model.SQLField;
|
50 |
import org.openconcerto.sql.model.SQLInjector;
|
52 |
import org.openconcerto.sql.model.SQLInjector;
|
51 |
import org.openconcerto.sql.model.SQLRow;
|
53 |
import org.openconcerto.sql.model.SQLRow;
|
52 |
import org.openconcerto.sql.model.SQLRowAccessor;
|
54 |
import org.openconcerto.sql.model.SQLRowAccessor;
|
53 |
import org.openconcerto.sql.model.SQLRowListRSH;
|
55 |
import org.openconcerto.sql.model.SQLRowListRSH;
|
54 |
import org.openconcerto.sql.model.SQLRowValues;
|
56 |
import org.openconcerto.sql.model.SQLRowValues;
|
55 |
import org.openconcerto.sql.model.SQLSelect;
|
57 |
import org.openconcerto.sql.model.SQLSelect;
|
56 |
import org.openconcerto.sql.model.SQLTable;
|
58 |
import org.openconcerto.sql.model.SQLTable;
|
57 |
import org.openconcerto.sql.model.Where;
|
59 |
import org.openconcerto.sql.model.Where;
|
58 |
import org.openconcerto.sql.model.graph.Path;
|
60 |
import org.openconcerto.sql.model.graph.Path;
|
59 |
import org.openconcerto.sql.preferences.SQLPreferences;
|
61 |
import org.openconcerto.sql.preferences.SQLPreferences;
|
60 |
import org.openconcerto.sql.request.ListSQLRequest;
|
62 |
import org.openconcerto.sql.request.ListSQLRequest;
|
61 |
import org.openconcerto.sql.sqlobject.ElementComboBox;
|
63 |
import org.openconcerto.sql.sqlobject.ElementComboBox;
|
62 |
import org.openconcerto.sql.users.rights.UserRightsManager;
|
64 |
import org.openconcerto.sql.users.rights.UserRightsManager;
|
63 |
import org.openconcerto.sql.view.EditFrame;
|
65 |
import org.openconcerto.sql.view.EditFrame;
|
64 |
import org.openconcerto.sql.view.EditPanel;
|
66 |
import org.openconcerto.sql.view.EditPanel;
|
65 |
import org.openconcerto.sql.view.EditPanel.EditMode;
|
67 |
import org.openconcerto.sql.view.EditPanel.EditMode;
|
66 |
import org.openconcerto.sql.view.EditPanelListener;
|
68 |
import org.openconcerto.sql.view.EditPanelListener;
|
67 |
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
|
69 |
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
|
68 |
import org.openconcerto.sql.view.list.IListe;
|
70 |
import org.openconcerto.sql.view.list.IListe;
|
69 |
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
|
71 |
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
|
70 |
import org.openconcerto.sql.view.list.RowAction;
|
72 |
import org.openconcerto.sql.view.list.RowAction;
|
71 |
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
|
73 |
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
|
72 |
import org.openconcerto.sql.view.list.SQLTableModelSource;
|
74 |
import org.openconcerto.sql.view.list.SQLTableModelSource;
|
73 |
import org.openconcerto.ui.DefaultGridBagConstraints;
|
75 |
import org.openconcerto.ui.DefaultGridBagConstraints;
|
74 |
import org.openconcerto.ui.FrameUtil;
|
76 |
import org.openconcerto.ui.FrameUtil;
|
75 |
import org.openconcerto.ui.table.PercentTableCellRenderer;
|
77 |
import org.openconcerto.ui.table.PercentTableCellRenderer;
|
76 |
import org.openconcerto.utils.CollectionUtils;
|
78 |
import org.openconcerto.utils.CollectionUtils;
|
77 |
import org.openconcerto.utils.DecimalUtils;
|
79 |
import org.openconcerto.utils.DecimalUtils;
|
78 |
import org.openconcerto.utils.ExceptionHandler;
|
80 |
import org.openconcerto.utils.ExceptionHandler;
|
79 |
import org.openconcerto.utils.ListMap;
|
81 |
import org.openconcerto.utils.ListMap;
|
80 |
import org.openconcerto.utils.Tuple2;
|
82 |
import org.openconcerto.utils.Tuple2;
|
81 |
import org.openconcerto.utils.cc.IClosure;
|
83 |
import org.openconcerto.utils.cc.IClosure;
|
82 |
import org.openconcerto.utils.cc.ITransformer;
|
84 |
import org.openconcerto.utils.cc.ITransformer;
|
83 |
import org.openconcerto.utils.i18n.TranslationManager;
|
85 |
import org.openconcerto.utils.i18n.TranslationManager;
|
84 |
|
86 |
|
85 |
import java.awt.GridBagConstraints;
|
87 |
import java.awt.GridBagConstraints;
|
86 |
import java.awt.GridBagLayout;
|
88 |
import java.awt.GridBagLayout;
|
87 |
import java.awt.event.ActionEvent;
|
89 |
import java.awt.event.ActionEvent;
|
88 |
import java.awt.event.ActionListener;
|
90 |
import java.awt.event.ActionListener;
|
89 |
import java.math.BigDecimal;
|
91 |
import java.math.BigDecimal;
|
90 |
import java.math.RoundingMode;
|
92 |
import java.math.RoundingMode;
|
- |
|
93 |
import java.sql.Date;
|
91 |
import java.sql.SQLException;
|
94 |
import java.sql.SQLException;
|
92 |
import java.util.ArrayList;
|
95 |
import java.util.ArrayList;
|
93 |
import java.util.Arrays;
|
96 |
import java.util.Arrays;
|
94 |
import java.util.Collection;
|
97 |
import java.util.Collection;
|
95 |
import java.util.Collections;
|
98 |
import java.util.Collections;
|
96 |
import java.util.HashMap;
|
99 |
import java.util.HashMap;
|
97 |
import java.util.HashSet;
|
100 |
import java.util.HashSet;
|
98 |
import java.util.List;
|
101 |
import java.util.List;
|
99 |
import java.util.Map;
|
102 |
import java.util.Map;
|
100 |
import java.util.Set;
|
103 |
import java.util.Set;
|
101 |
|
104 |
|
102 |
import javax.swing.AbstractAction;
|
105 |
import javax.swing.AbstractAction;
|
103 |
import javax.swing.ImageIcon;
|
106 |
import javax.swing.ImageIcon;
|
104 |
import javax.swing.JButton;
|
107 |
import javax.swing.JButton;
|
105 |
import javax.swing.JFrame;
|
108 |
import javax.swing.JFrame;
|
106 |
import javax.swing.JLabel;
|
109 |
import javax.swing.JLabel;
|
107 |
import javax.swing.JPanel;
|
110 |
import javax.swing.JPanel;
|
108 |
import javax.swing.SwingUtilities;
|
111 |
import javax.swing.SwingUtilities;
|
109 |
|
112 |
|
110 |
import org.apache.commons.dbutils.handlers.ArrayListHandler;
|
113 |
import org.apache.commons.dbutils.handlers.ArrayListHandler;
|
111 |
|
114 |
|
112 |
// Depuis le 1er juillet 2003, la règlementation fiscale impose la délivrance d'une facture pour
|
115 |
// Depuis le 1er juillet 2003, la règlementation fiscale impose la délivrance d'une facture pour
|
113 |
// tous les versements d'acomptes, même lorsqu'ils ne donnent pas lieu à exigibilité de la TVA
|
116 |
// tous les versements d'acomptes, même lorsqu'ils ne donnent pas lieu à exigibilité de la TVA
|
114 |
// (article 289 I -1-c du CGI).
|
117 |
// (article 289 I -1-c du CGI).
|
115 |
// Avant la loi de finances rectificative pour 2002, il n'y avait obligation de délivrer une facture
|
118 |
// Avant la loi de finances rectificative pour 2002, il n'y avait obligation de délivrer une facture
|
116 |
// pour les acomptes que lorsque la TVA était exigible sur ces versements. Depuis l'entrée en
|
119 |
// pour les acomptes que lorsque la TVA était exigible sur ces versements. Depuis l'entrée en
|
117 |
// vigueur de cette loi, initialement fixée au 1er juillet 2003, et reportée par tolérance
|
120 |
// vigueur de cette loi, initialement fixée au 1er juillet 2003, et reportée par tolérance
|
118 |
// administrative au 1er janvier 2004, il faut désormais délivrer une facture pour tous les acomptes
|
121 |
// administrative au 1er janvier 2004, il faut désormais délivrer une facture pour tous les acomptes
|
119 |
// perçus.
|
122 |
// perçus.
|
120 |
// L'obligation nouvelle de facturer tous les versements d'acomptes ne modifie pas les règles
|
123 |
// L'obligation nouvelle de facturer tous les versements d'acomptes ne modifie pas les règles
|
121 |
// d'exigibilité de la TVA.
|
124 |
// d'exigibilité de la TVA.
|
122 |
// La date du versement de l'acompte doit être indiquée sur la facture d'acompte si elle est
|
125 |
// La date du versement de l'acompte doit être indiquée sur la facture d'acompte si elle est
|
123 |
// différente de la date de délivrance de cette facture, et si elle est connue à cette date.
|
126 |
// différente de la date de délivrance de cette facture, et si elle est connue à cette date.
|
124 |
|
127 |
|
125 |
// La facture d'acompte peut ne pas mentionner l'ensemble des mentions obligatoires lorsque les
|
128 |
// La facture d'acompte peut ne pas mentionner l'ensemble des mentions obligatoires lorsque les
|
126 |
// informations nécessaires à son établissement ne sont pas connues au moment de son émission (par
|
129 |
// informations nécessaires à son établissement ne sont pas connues au moment de son émission (par
|
127 |
// exemple, quantité ou prix exact du produit).
|
130 |
// exemple, quantité ou prix exact du produit).
|
128 |
public class SaisieVenteFactureSQLElement extends ComptaSQLConfElement {
|
131 |
public class SaisieVenteFactureSQLElement extends ComptaSQLConfElement {
|
129 |
|
132 |
|
130 |
public static final String TABLENAME = "SAISIE_VENTE_FACTURE";
|
133 |
public static final String TABLENAME = "SAISIE_VENTE_FACTURE";
|
131 |
static public final String MESSAGE_FIELD_NAME = "ID_SDD_MESSAGE";
|
134 |
static public final String MESSAGE_FIELD_NAME = "ID_SDD_MESSAGE";
|
132 |
static public final String END2END_FIELD_NAME = "SDD_EndToEndId";
|
135 |
static public final String END2END_FIELD_NAME = "SDD_EndToEndId";
|
133 |
|
136 |
|
134 |
public SaisieVenteFactureSQLElement() {
|
137 |
public SaisieVenteFactureSQLElement() {
|
135 |
super(TABLENAME, "une facture", "factures");
|
138 |
super(TABLENAME, "une facture", "factures");
|
136 |
|
139 |
|
137 |
GlobalMapper.getInstance().map(VenteFactureSituationSQLComponent.ID, new PartialInvoiceEditGroup());
|
140 |
GlobalMapper.getInstance().map(VenteFactureSituationSQLComponent.ID, new PartialInvoiceEditGroup());
|
138 |
addComponentFactory(VenteFactureSituationSQLComponent.ID, new ITransformer<Tuple2<SQLElement, String>, SQLComponent>() {
|
141 |
addComponentFactory(VenteFactureSituationSQLComponent.ID, new ITransformer<Tuple2<SQLElement, String>, SQLComponent>() {
|
139 |
|
142 |
|
140 |
@Override
|
143 |
@Override
|
141 |
public SQLComponent transformChecked(Tuple2<SQLElement, String> input) {
|
144 |
public SQLComponent transformChecked(Tuple2<SQLElement, String> input) {
|
142 |
|
145 |
|
143 |
return new VenteFactureSituationSQLComponent(SaisieVenteFactureSQLElement.this);
|
146 |
return new VenteFactureSituationSQLComponent(SaisieVenteFactureSQLElement.this);
|
144 |
}
|
147 |
}
|
145 |
});
|
148 |
});
|
146 |
GlobalMapper.getInstance().map(VenteFactureSoldeSQLComponent.ID, new VenteFactureSoldeEditGroup());
|
149 |
GlobalMapper.getInstance().map(VenteFactureSoldeSQLComponent.ID, new VenteFactureSoldeEditGroup());
|
147 |
addComponentFactory(VenteFactureSoldeSQLComponent.ID, new ITransformer<Tuple2<SQLElement, String>, SQLComponent>() {
|
150 |
addComponentFactory(VenteFactureSoldeSQLComponent.ID, new ITransformer<Tuple2<SQLElement, String>, SQLComponent>() {
|
148 |
|
151 |
|
149 |
@Override
|
152 |
@Override
|
150 |
public SQLComponent transformChecked(Tuple2<SQLElement, String> input) {
|
153 |
public SQLComponent transformChecked(Tuple2<SQLElement, String> input) {
|
151 |
|
154 |
|
152 |
return new VenteFactureSoldeSQLComponent(SaisieVenteFactureSQLElement.this);
|
155 |
return new VenteFactureSoldeSQLComponent(SaisieVenteFactureSQLElement.this);
|
153 |
}
|
156 |
}
|
154 |
});
|
157 |
});
|
155 |
|
158 |
|
156 |
final boolean affact = UserRightsManager.getCurrentUserRights().haveRight(NXRights.ACCES_RETOUR_AFFACTURAGE.getCode());
|
159 |
final boolean affact = UserRightsManager.getCurrentUserRights().haveRight(NXRights.ACCES_RETOUR_AFFACTURAGE.getCode());
|
157 |
List<RowAction> l = new ArrayList<RowAction>(5);
|
160 |
List<RowAction> l = new ArrayList<RowAction>(5);
|
158 |
PredicateRowAction actionBL = new PredicateRowAction(new AbstractAction() {
|
161 |
PredicateRowAction actionBL = new PredicateRowAction(new AbstractAction() {
|
159 |
public void actionPerformed(ActionEvent e) {
|
162 |
public void actionPerformed(ActionEvent e) {
|
160 |
TransfertBaseSQLComponent.openTransfertFrame(IListe.get(e).getSelectedRows(), "BON_DE_LIVRAISON");
|
163 |
TransfertBaseSQLComponent.openTransfertFrame(IListe.get(e).getSelectedRows(), "BON_DE_LIVRAISON");
|
161 |
}
|
164 |
}
|
162 |
}, false, "sales.invoice.create.delivery");
|
165 |
}, false, "sales.invoice.create.delivery");
|
163 |
actionBL.setPredicate(IListeEvent.getSingleSelectionPredicate());
|
166 |
actionBL.setPredicate(IListeEvent.getSingleSelectionPredicate());
|
164 |
l.add(actionBL);
|
167 |
l.add(actionBL);
|
165 |
if (getTable().contains("ATTACHMENTS")) {
|
168 |
if (getTable().contains("ATTACHMENTS")) {
|
166 |
PredicateRowAction actionAttachment = new PredicateRowAction(new AttachmentAction().getAction(), true);
|
169 |
PredicateRowAction actionAttachment = new PredicateRowAction(new AttachmentAction().getAction(), true);
|
167 |
actionAttachment.setPredicate(IListeEvent.getSingleSelectionPredicate());
|
170 |
actionAttachment.setPredicate(IListeEvent.getSingleSelectionPredicate());
|
168 |
getRowActions().add(actionAttachment);
|
171 |
getRowActions().add(actionAttachment);
|
169 |
}
|
172 |
}
|
170 |
|
173 |
|
171 |
PredicateRowAction actionAvoir = new PredicateRowAction(new AbstractAction() {
|
174 |
PredicateRowAction actionAvoir = new PredicateRowAction(new AbstractAction() {
|
172 |
public void actionPerformed(ActionEvent e) {
|
175 |
public void actionPerformed(ActionEvent e) {
|
173 |
TransfertBaseSQLComponent.openTransfertFrame(IListe.get(e).getSelectedRows(), "AVOIR_CLIENT");
|
176 |
TransfertBaseSQLComponent.openTransfertFrame(IListe.get(e).getSelectedRows(), "AVOIR_CLIENT");
|
174 |
}
|
177 |
}
|
175 |
}, false, "sales.invoice.create.credit");
|
178 |
}, false, "sales.invoice.create.credit");
|
176 |
actionAvoir.setPredicate(IListeEvent.getSingleSelectionPredicate());
|
179 |
actionAvoir.setPredicate(IListeEvent.getSingleSelectionPredicate());
|
177 |
l.add(actionAvoir);
|
180 |
l.add(actionAvoir);
|
178 |
|
181 |
|
179 |
final String property = PrinterNXProps.getInstance().getProperty("QLPrinter");
|
182 |
final String property = PrinterNXProps.getInstance().getProperty("QLPrinter");
|
180 |
if (property != null && property.trim().length() > 0) {
|
183 |
if (property != null && property.trim().length() > 0) {
|
181 |
PredicateRowAction actionPrintLabel = new PredicateRowAction(new AbstractAction() {
|
184 |
PredicateRowAction actionPrintLabel = new PredicateRowAction(new AbstractAction() {
|
182 |
public void actionPerformed(ActionEvent e) {
|
185 |
public void actionPerformed(ActionEvent e) {
|
183 |
// ((ClientNormalSQLElement)
|
186 |
// ((ClientNormalSQLElement)
|
184 |
// getForeignElement("ID_CLIENT")).printLabel(IListe.get(e).getSelectedRow().getForeign("ID_CLIENT"),
|
187 |
// getForeignElement("ID_CLIENT")).printLabel(IListe.get(e).getSelectedRow().getForeign("ID_CLIENT"),
|
185 |
// property);
|
188 |
// property);
|
186 |
}
|
189 |
}
|
187 |
}, false, "customerrelationship.customer.label.print");
|
190 |
}, false, "customerrelationship.customer.label.print");
|
188 |
actionPrintLabel.setPredicate(IListeEvent.getSingleSelectionPredicate());
|
191 |
actionPrintLabel.setPredicate(IListeEvent.getSingleSelectionPredicate());
|
189 |
// l.add(actionPrintLabel);
|
192 |
// l.add(actionPrintLabel);
|
190 |
}
|
193 |
}
|
191 |
RowAction actionClone = new RowAction(new AbstractAction() {
|
194 |
RowAction actionClone = new RowAction(new AbstractAction() {
|
192 |
public void actionPerformed(ActionEvent e) {
|
195 |
public void actionPerformed(ActionEvent e) {
|
193 |
|
196 |
|
194 |
SQLElement eltFact = Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE");
|
197 |
SQLElement eltFact = Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE");
|
195 |
EditFrame editFrame = new EditFrame(eltFact, EditPanel.CREATION);
|
198 |
EditFrame editFrame = new EditFrame(eltFact, EditPanel.CREATION);
|
196 |
|
199 |
|
197 |
((SaisieVenteFactureSQLComponent) editFrame.getSQLComponent()).loadFactureExistante(IListe.get(e).getSelectedId());
|
200 |
((SaisieVenteFactureSQLComponent) editFrame.getSQLComponent()).loadFactureExistante(IListe.get(e).getSelectedId());
|
198 |
editFrame.setVisible(true);
|
201 |
editFrame.setVisible(true);
|
199 |
}
|
202 |
}
|
200 |
}, true, "sales.invoice.clone") {
|
203 |
}, true, "sales.invoice.clone") {
|
201 |
public boolean enabledFor(IListeEvent evt) {
|
204 |
public boolean enabledFor(IListeEvent evt) {
|
202 |
List<? extends SQLRowAccessor> l = evt.getSelectedRows();
|
205 |
List<? extends SQLRowAccessor> l = evt.getSelectedRows();
|
203 |
if (l != null && l.size() == 1) {
|
206 |
if (l != null && l.size() == 1) {
|
204 |
SQLRowAccessor r = l.get(0);
|
207 |
SQLRowAccessor r = l.get(0);
|
205 |
return !r.getBoolean("PARTIAL") && !r.getBoolean("SOLDE");
|
208 |
return !r.getBoolean("PARTIAL") && !r.getBoolean("SOLDE");
|
206 |
}
|
209 |
}
|
207 |
return false;
|
210 |
return false;
|
208 |
}
|
211 |
}
|
209 |
};
|
212 |
};
|
210 |
|
213 |
|
211 |
l.add(actionClone);
|
214 |
l.add(actionClone);
|
212 |
getRowActions().addAll(l);
|
215 |
getRowActions().addAll(l);
|
213 |
|
216 |
|
214 |
|
217 |
|
215 |
PredicateRowAction actionClient = new PredicateRowAction(new AbstractAction("Détails client") {
|
218 |
PredicateRowAction actionClient = new PredicateRowAction(new AbstractAction("Détails client") {
|
216 |
EditFrame edit;
|
219 |
EditFrame edit;
|
217 |
private SQLElement eltClient = Configuration.getInstance().getDirectory().getElement(((ComptaPropsConfiguration) Configuration.getInstance()).getRootSociete().getTable("CLIENT"));
|
220 |
private SQLElement eltClient = Configuration.getInstance().getDirectory().getElement(((ComptaPropsConfiguration) Configuration.getInstance()).getRootSociete().getTable("CLIENT"));
|
218 |
|
221 |
|
219 |
public void actionPerformed(ActionEvent e) {
|
222 |
public void actionPerformed(ActionEvent e) {
|
220 |
if (edit == null) {
|
223 |
if (edit == null) {
|
221 |
edit = new EditFrame(eltClient, EditMode.READONLY);
|
224 |
edit = new EditFrame(eltClient, EditMode.READONLY);
|
222 |
}
|
225 |
}
|
223 |
edit.selectionId(IListe.get(e).fetchSelectedRow().getInt("ID_CLIENT"));
|
226 |
edit.selectionId(IListe.get(e).fetchSelectedRow().getInt("ID_CLIENT"));
|
224 |
edit.setVisible(true);
|
227 |
edit.setVisible(true);
|
225 |
}
|
228 |
}
|
226 |
}, false, "sales.invoice.info.show");
|
229 |
}, false, "sales.invoice.info.show");
|
227 |
actionClient.setPredicate(IListeEvent.getSingleSelectionPredicate());
|
230 |
actionClient.setPredicate(IListeEvent.getSingleSelectionPredicate());
|
228 |
getRowActions().add(actionClient);
|
231 |
getRowActions().add(actionClient);
|
229 |
|
232 |
|
230 |
PredicateRowAction actionCommande = new PredicateRowAction(new AbstractAction() {
|
233 |
PredicateRowAction actionCommande = new PredicateRowAction(new AbstractAction() {
|
231 |
public void actionPerformed(ActionEvent e) {
|
234 |
public void actionPerformed(ActionEvent e) {
|
232 |
SaisieVenteFactureSQLElement elt = (SaisieVenteFactureSQLElement) Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE");
|
235 |
SaisieVenteFactureSQLElement elt = (SaisieVenteFactureSQLElement) Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE");
|
233 |
elt.transfertCommande(IListe.get(e).getSelectedId());
|
236 |
elt.transfertCommande(IListe.get(e).getSelectedId());
|
234 |
}
|
237 |
}
|
235 |
}, false, "sales.invoice.create.supplier.order");
|
238 |
}, false, "sales.invoice.create.supplier.order");
|
236 |
actionCommande.setPredicate(IListeEvent.getSingleSelectionPredicate());
|
239 |
actionCommande.setPredicate(IListeEvent.getSingleSelectionPredicate());
|
237 |
getRowActions().add(actionCommande);
|
240 |
getRowActions().add(actionCommande);
|
238 |
|
241 |
|
239 |
RowAction actionCancelAvoir = new PredicateRowAction(new AbstractAction() {
|
242 |
RowAction actionCancelAvoir = new PredicateRowAction(new AbstractAction() {
|
240 |
public void actionPerformed(ActionEvent e) {
|
243 |
public void actionPerformed(ActionEvent e) {
|
241 |
cancelAvoir(IListe.get(e).getSelectedRow());
|
244 |
cancelAvoir(IListe.get(e).getSelectedRow());
|
242 |
}
|
245 |
}
|
243 |
}, false, "sales.invoice.cancel.credit") {
|
246 |
}, false, "sales.invoice.cancel.credit") {
|
244 |
@Override
|
247 |
@Override
|
245 |
public boolean enabledFor(IListeEvent evt) {
|
248 |
public boolean enabledFor(IListeEvent evt) {
|
246 |
final SQLRowAccessor selectedRow = evt.getSelectedRow().asRow();
|
249 |
final SQLRowAccessor selectedRow = evt.getSelectedRow().asRow();
|
247 |
final List<SQLRowValues> rows = evt.getSelectedRows();
|
250 |
final List<SQLRowValues> rows = evt.getSelectedRows();
|
248 |
return rows != null && rows.size() == 1 && selectedRow != null && !selectedRow.isForeignEmpty("ID_AVOIR_CLIENT");
|
251 |
return rows != null && rows.size() == 1 && selectedRow != null && !selectedRow.isForeignEmpty("ID_AVOIR_CLIENT");
|
249 |
}
|
252 |
}
|
250 |
};
|
253 |
};
|
251 |
getRowActions().add(actionCancelAvoir);
|
254 |
getRowActions().add(actionCancelAvoir);
|
252 |
|
255 |
|
253 |
MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(VenteFactureXmlSheet.class);
|
256 |
MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(VenteFactureXmlSheet.class);
|
254 |
getRowActions().addAll(mouseSheetXmlListeListener.getRowActions());
|
257 |
getRowActions().addAll(mouseSheetXmlListeListener.getRowActions());
|
255 |
// this.frame.getPanel().getListe().addRowActions(mouseListener.getRowActions());
|
258 |
// this.frame.getPanel().getListe().addRowActions(mouseListener.getRowActions());
|
256 |
|
259 |
|
257 |
}
|
260 |
}
|
258 |
|
261 |
|
259 |
@Override
|
262 |
@Override
|
260 |
protected void setupLinks(SQLElementLinksSetup links) {
|
263 |
protected void setupLinks(SQLElementLinksSetup links) {
|
261 |
super.setupLinks(links);
|
264 |
super.setupLinks(links);
|
262 |
if (getTable().contains("ID_ADRESSE")) {
|
265 |
if (getTable().contains("ID_ADRESSE")) {
|
263 |
links.get("ID_ADRESSE").setType(LinkType.ASSOCIATION);
|
266 |
links.get("ID_ADRESSE").setType(LinkType.ASSOCIATION);
|
264 |
}
|
267 |
}
|
265 |
if (getTable().contains("ID_ADRESSE_LIVRAISON")) {
|
268 |
if (getTable().contains("ID_ADRESSE_LIVRAISON")) {
|
266 |
links.get("ID_ADRESSE_LIVRAISON").setType(LinkType.ASSOCIATION);
|
269 |
links.get("ID_ADRESSE_LIVRAISON").setType(LinkType.ASSOCIATION);
|
267 |
}
|
270 |
}
|
268 |
links.get(MESSAGE_FIELD_NAME).setType(LinkType.ASSOCIATION, ReferenceAction.RESTRICT);
|
271 |
links.get(MESSAGE_FIELD_NAME).setType(LinkType.ASSOCIATION, ReferenceAction.RESTRICT);
|
269 |
}
|
272 |
}
|
270 |
|
273 |
|
271 |
@Override
|
274 |
@Override
|
272 |
public ListMap<String, String> getShowAs() {
|
275 |
public ListMap<String, String> getShowAs() {
|
273 |
ListMap<String, String> map = new ListMap<String, String>();
|
276 |
ListMap<String, String> map = new ListMap<String, String>();
|
274 |
map.putCollection(null, "NUMERO", "DATE", "ID_COMMERCIAL");
|
277 |
map.putCollection(null, "NUMERO", "DATE", "ID_COMMERCIAL");
|
275 |
return map;
|
278 |
return map;
|
276 |
}
|
279 |
}
|
277 |
|
280 |
|
278 |
protected List<String> getListFields() {
|
281 |
protected List<String> getListFields() {
|
279 |
final List<String> l = new ArrayList<String>();
|
282 |
final List<String> l = new ArrayList<String>();
|
280 |
|
283 |
|
281 |
l.add("NUMERO");
|
284 |
l.add("NUMERO");
|
282 |
l.add("DATE");
|
285 |
l.add("DATE");
|
283 |
l.add("NOM");
|
286 |
l.add("NOM");
|
284 |
l.add("ID_CLIENT");
|
287 |
l.add("ID_CLIENT");
|
285 |
l.add("ID_MODE_REGLEMENT");
|
288 |
l.add("ID_MODE_REGLEMENT");
|
286 |
l.add("ID_COMMERCIAL");
|
289 |
l.add("ID_COMMERCIAL");
|
287 |
if (UserRightsManager.getCurrentUserRights().haveRight(AbstractVenteArticleItemTable.SHOW_PRIX_ACHAT_CODE)) {
|
290 |
if (UserRightsManager.getCurrentUserRights().haveRight(AbstractVenteArticleItemTable.SHOW_PRIX_ACHAT_CODE)) {
|
288 |
l.add("T_HA");
|
291 |
l.add("T_HA");
|
289 |
}
|
292 |
}
|
290 |
l.add("T_HT");
|
293 |
l.add("T_HT");
|
291 |
l.add("T_TTC");
|
294 |
l.add("T_TTC");
|
292 |
l.add("INFOS");
|
295 |
l.add("INFOS");
|
293 |
|
296 |
|
294 |
l.add("DATE_ENVOI");
|
297 |
l.add("DATE_ENVOI");
|
295 |
l.add("DATE_REGLEMENT");
|
298 |
l.add("DATE_REGLEMENT");
|
296 |
return l;
|
299 |
return l;
|
297 |
}
|
300 |
}
|
298 |
|
301 |
|
299 |
@Override
|
302 |
@Override
|
300 |
protected void _initListRequest(ListSQLRequest req) {
|
303 |
protected void _initListRequest(ListSQLRequest req) {
|
301 |
super._initListRequest(req);
|
304 |
super._initListRequest(req);
|
302 |
req.changeGraphToFetch(new IClosure<SQLRowValues>() {
|
305 |
req.changeGraphToFetch(new IClosure<SQLRowValues>() {
|
303 |
@Override
|
306 |
@Override
|
304 |
public void executeChecked(SQLRowValues graphToFetch) {
|
307 |
public void executeChecked(SQLRowValues graphToFetch) {
|
305 |
graphToFetch.put("ACOMPTE", null);
|
308 |
graphToFetch.put("ACOMPTE", null);
|
306 |
graphToFetch.put("PARTIAL", null);
|
309 |
graphToFetch.put("PARTIAL", null);
|
307 |
graphToFetch.put("SOLDE", null);
|
310 |
graphToFetch.put("SOLDE", null);
|
308 |
graphToFetch.put("COMPLEMENT", null);
|
311 |
graphToFetch.put("COMPLEMENT", null);
|
309 |
|
312 |
|
310 |
graphToFetch.put("PREVISIONNELLE", null);
|
313 |
graphToFetch.put("PREVISIONNELLE", null);
|
311 |
graphToFetch.grow("ID_MODE_REGLEMENT").put("AJOURS", null).put("LENJOUR", null);
|
314 |
graphToFetch.grow("ID_MODE_REGLEMENT").put("AJOURS", null).put("LENJOUR", null);
|
312 |
SQLRowValues value = new SQLRowValues(graphToFetch.getTable().getTable("MOUVEMENT"));
|
315 |
SQLRowValues value = new SQLRowValues(graphToFetch.getTable().getTable("MOUVEMENT"));
|
313 |
value.put("ID_PIECE", null);
|
316 |
value.put("ID_PIECE", null);
|
314 |
graphToFetch.put("ID_MOUVEMENT", value);
|
317 |
graphToFetch.put("ID_MOUVEMENT", value);
|
315 |
graphToFetch.put("T_AVOIR_TTC", null);
|
318 |
graphToFetch.put("T_AVOIR_TTC", null);
|
316 |
}
|
319 |
}
|
317 |
});
|
320 |
});
|
318 |
}
|
321 |
}
|
319 |
|
322 |
|
320 |
private BigDecimal getAvancement(SQLRowAccessor r) {
|
323 |
private BigDecimal getAvancement(SQLRowAccessor r) {
|
321 |
Collection<? extends SQLRowAccessor> rows = r.getReferentRows(r.getTable().getTable("ECHEANCE_CLIENT"));
|
324 |
Collection<? extends SQLRowAccessor> rows = r.getReferentRows(r.getTable().getTable("ECHEANCE_CLIENT"));
|
322 |
long totalEch = 0;
|
325 |
long totalEch = 0;
|
323 |
|
326 |
|
324 |
for (SQLRowAccessor row : rows) {
|
327 |
for (SQLRowAccessor row : rows) {
|
325 |
if (!row.getBoolean("REGLE") && !row.getBoolean("REG_COMPTA")) {
|
328 |
if (!row.getBoolean("REGLE") && !row.getBoolean("REG_COMPTA")) {
|
326 |
totalEch += row.getLong("MONTANT");
|
329 |
totalEch += row.getLong("MONTANT");
|
327 |
}
|
330 |
}
|
328 |
}
|
331 |
}
|
329 |
|
332 |
|
330 |
SQLRowAccessor avoir = r.getForeign("ID_AVOIR_CLIENT");
|
333 |
SQLRowAccessor avoir = r.getForeign("ID_AVOIR_CLIENT");
|
331 |
BigDecimal avoirTTC = BigDecimal.ZERO;
|
334 |
BigDecimal avoirTTC = BigDecimal.ZERO;
|
332 |
if (avoir != null && !avoir.isUndefined()) {
|
335 |
if (avoir != null && !avoir.isUndefined()) {
|
333 |
avoirTTC = new BigDecimal(avoir.getLong("MONTANT_TTC"));
|
336 |
avoirTTC = new BigDecimal(avoir.getLong("MONTANT_TTC"));
|
334 |
}
|
337 |
}
|
335 |
|
338 |
|
336 |
final BigDecimal totalAregler = new BigDecimal(r.getLong("T_TTC")).subtract(avoirTTC);
|
339 |
final BigDecimal totalAregler = new BigDecimal(r.getLong("T_TTC")).subtract(avoirTTC);
|
337 |
if (totalAregler.signum() > 0 && totalEch > 0) {
|
340 |
if (totalAregler.signum() > 0 && totalEch > 0) {
|
338 |
return totalAregler.subtract(new BigDecimal(totalEch)).divide(totalAregler, DecimalUtils.HIGH_PRECISION).movePointRight(2).setScale(2, RoundingMode.HALF_UP);
|
341 |
return totalAregler.subtract(new BigDecimal(totalEch)).divide(totalAregler, DecimalUtils.HIGH_PRECISION).movePointRight(2).setScale(2, RoundingMode.HALF_UP);
|
339 |
} else {
|
342 |
} else {
|
340 |
return BigDecimal.ONE.movePointRight(2);
|
343 |
return BigDecimal.ONE.movePointRight(2);
|
341 |
}
|
344 |
}
|
342 |
}
|
345 |
}
|
343 |
|
346 |
|
344 |
@Override
|
347 |
@Override
|
345 |
protected synchronized void _initTableSource(final SQLTableModelSource table) {
|
348 |
protected synchronized void _initTableSource(final SQLTableModelSource table) {
|
346 |
super._initTableSource(table);
|
349 |
super._initTableSource(table);
|
347 |
|
350 |
|
348 |
final BaseSQLTableModelColumn colAvancement = new BaseSQLTableModelColumn("Avancement réglement", BigDecimal.class) {
|
351 |
final BaseSQLTableModelColumn colAvancement = new BaseSQLTableModelColumn("Avancement réglement", BigDecimal.class) {
|
349 |
|
352 |
|
350 |
@Override
|
353 |
@Override
|
351 |
protected Object show_(SQLRowAccessor r) {
|
354 |
protected Object show_(SQLRowAccessor r) {
|
352 |
|
355 |
|
353 |
return getAvancement(r);
|
356 |
return getAvancement(r);
|
354 |
}
|
357 |
}
|
355 |
|
358 |
|
356 |
@Override
|
359 |
@Override
|
357 |
public Set<FieldPath> getPaths() {
|
360 |
public Set<FieldPath> getPaths() {
|
358 |
Path p = new Path(SaisieVenteFactureSQLElement.this.getTable());
|
361 |
Path p = new Path(SaisieVenteFactureSQLElement.this.getTable());
|
359 |
p = p.add(getTable().getTable("ECHEANCE_CLIENT"));
|
362 |
p = p.add(getTable().getTable("ECHEANCE_CLIENT"));
|
360 |
|
363 |
|
361 |
Path p2 = new Path(SaisieVenteFactureSQLElement.this.getTable());
|
364 |
Path p2 = new Path(SaisieVenteFactureSQLElement.this.getTable());
|
362 |
p2 = p2.add(getTable().getField("ID_AVOIR_CLIENT"));
|
365 |
p2 = p2.add(getTable().getField("ID_AVOIR_CLIENT"));
|
363 |
|
366 |
|
364 |
return CollectionUtils.createSet(new FieldPath(p, "MONTANT"), new FieldPath(p, "REG_COMPTA"), new FieldPath(p, "REGLE"), new FieldPath(p2, "MONTANT_TTC"));
|
367 |
return CollectionUtils.createSet(new FieldPath(p, "MONTANT"), new FieldPath(p, "REG_COMPTA"), new FieldPath(p, "REGLE"), new FieldPath(p2, "MONTANT_TTC"));
|
365 |
}
|
368 |
}
|
366 |
};
|
369 |
};
|
367 |
table.getColumns().add(colAvancement);
|
370 |
table.getColumns().add(colAvancement);
|
368 |
colAvancement.setRenderer(new PercentTableCellRenderer());
|
371 |
colAvancement.setRenderer(new PercentTableCellRenderer());
|
369 |
|
372 |
|
370 |
}
|
373 |
}
|
371 |
|
374 |
|
372 |
protected List<String> getComboFields() {
|
375 |
protected List<String> getComboFields() {
|
373 |
final List<String> l = new ArrayList<String>();
|
376 |
final List<String> l = new ArrayList<String>();
|
374 |
l.add("NUMERO");
|
377 |
l.add("NUMERO");
|
375 |
return l;
|
378 |
return l;
|
376 |
}
|
379 |
}
|
377 |
|
380 |
|
378 |
@Override
|
381 |
@Override
|
379 |
public Set<String> getReadOnlyFields() {
|
382 |
public Set<String> getReadOnlyFields() {
|
380 |
Set<String> s = new HashSet<String>(1);
|
383 |
Set<String> s = new HashSet<String>(1);
|
381 |
s.add("CONTROLE_TECHNIQUE");
|
384 |
s.add("CONTROLE_TECHNIQUE");
|
382 |
return s;
|
385 |
return s;
|
383 |
}
|
386 |
}
|
384 |
|
387 |
|
385 |
@Override
|
388 |
@Override
|
386 |
public Set<String> getInsertOnlyFields() {
|
389 |
public Set<String> getInsertOnlyFields() {
|
387 |
Set<String> s = new HashSet<String>(1);
|
390 |
Set<String> s = new HashSet<String>(1);
|
388 |
s.add("ACOMPTE");
|
391 |
s.add("ACOMPTE");
|
389 |
return s;
|
392 |
return s;
|
390 |
}
|
393 |
}
|
391 |
|
394 |
|
392 |
/*
|
395 |
/*
|
393 |
* (non-Javadoc)
|
396 |
* (non-Javadoc)
|
394 |
*
|
397 |
*
|
395 |
* @see org.openconcerto.devis.SQLElement#getComponent()
|
398 |
* @see org.openconcerto.devis.SQLElement#getComponent()
|
396 |
*/
|
399 |
*/
|
397 |
public SQLComponent createComponent() {
|
400 |
public SQLComponent createComponent() {
|
398 |
return new SaisieVenteFactureSQLComponent();
|
401 |
return new SaisieVenteFactureSQLComponent();
|
399 |
}
|
402 |
}
|
400 |
|
403 |
|
401 |
@Override
|
404 |
@Override
|
402 |
protected void archive(TreesOfSQLRows trees, boolean cutLinks) throws SQLException {
|
405 |
protected void archive(TreesOfSQLRows trees, boolean cutLinks) throws SQLException {
|
403 |
for (SQLRow row : trees.getRows()) {
|
406 |
for (SQLRow row : trees.getRows()) {
|
404 |
|
407 |
|
405 |
// On retire l'avoir
|
408 |
// On retire l'avoir
|
406 |
if (row.getInt("ID_AVOIR_CLIENT") > 1) {
|
409 |
if (row.getInt("ID_AVOIR_CLIENT") > 1) {
|
407 |
SQLElement eltAvoir = Configuration.getInstance().getDirectory().getElement("AVOIR_CLIENT");
|
410 |
SQLElement eltAvoir = Configuration.getInstance().getDirectory().getElement("AVOIR_CLIENT");
|
408 |
SQLRow rowAvoir = eltAvoir.getTable().getRow(row.getInt("ID_AVOIR_CLIENT"));
|
411 |
SQLRow rowAvoir = eltAvoir.getTable().getRow(row.getInt("ID_AVOIR_CLIENT"));
|
409 |
|
412 |
|
410 |
Long montantSolde = (Long) rowAvoir.getObject("MONTANT_SOLDE");
|
413 |
Long montantSolde = (Long) rowAvoir.getObject("MONTANT_SOLDE");
|
411 |
|
414 |
|
412 |
Long avoirTTC = (Long) row.getObject("T_AVOIR_TTC");
|
415 |
Long avoirTTC = (Long) row.getObject("T_AVOIR_TTC");
|
413 |
|
416 |
|
414 |
long montant = montantSolde - avoirTTC;
|
417 |
long montant = montantSolde - avoirTTC;
|
415 |
if (montant < 0) {
|
418 |
if (montant < 0) {
|
416 |
montant = 0;
|
419 |
montant = 0;
|
417 |
}
|
420 |
}
|
418 |
|
421 |
|
419 |
SQLRowValues rowVals = rowAvoir.createEmptyUpdateRow();
|
422 |
SQLRowValues rowVals = rowAvoir.createEmptyUpdateRow();
|
420 |
|
423 |
|
421 |
// Soldé
|
424 |
// Soldé
|
422 |
rowVals.put("SOLDE", Boolean.FALSE);
|
425 |
rowVals.put("SOLDE", Boolean.FALSE);
|
423 |
rowVals.put("MONTANT_SOLDE", montant);
|
426 |
rowVals.put("MONTANT_SOLDE", montant);
|
424 |
Long restant = (Long) rowAvoir.getObject("MONTANT_TTC") - montantSolde;
|
427 |
Long restant = (Long) rowAvoir.getObject("MONTANT_TTC") - montantSolde;
|
425 |
rowVals.put("MONTANT_RESTANT", restant);
|
428 |
rowVals.put("MONTANT_RESTANT", restant);
|
426 |
try {
|
429 |
try {
|
427 |
rowVals.update();
|
430 |
rowVals.update();
|
428 |
} catch (SQLException e) {
|
431 |
} catch (SQLException e) {
|
429 |
e.printStackTrace();
|
432 |
e.printStackTrace();
|
430 |
}
|
433 |
}
|
431 |
}
|
434 |
}
|
432 |
|
435 |
|
433 |
super.archive(new TreesOfSQLRows(this, row), cutLinks);
|
436 |
super.archive(new TreesOfSQLRows(this, row), cutLinks);
|
434 |
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot());
|
437 |
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot());
|
435 |
if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_FACT, true)) {
|
438 |
if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_FACT, true)) {
|
436 |
|
439 |
|
437 |
// Mise à jour des stocks
|
440 |
// Mise à jour des stocks
|
438 |
SQLElement eltMvtStock = Configuration.getInstance().getDirectory().getElement("MOUVEMENT_STOCK");
|
441 |
SQLElement eltMvtStock = Configuration.getInstance().getDirectory().getElement("MOUVEMENT_STOCK");
|
439 |
SQLSelect sel = new SQLSelect();
|
442 |
SQLSelect sel = new SQLSelect();
|
440 |
sel.addSelect(eltMvtStock.getTable().getField("ID"));
|
443 |
sel.addSelect(eltMvtStock.getTable().getField("ID"));
|
441 |
Where w = new Where(eltMvtStock.getTable().getField("IDSOURCE"), "=", row.getID());
|
444 |
Where w = new Where(eltMvtStock.getTable().getField("IDSOURCE"), "=", row.getID());
|
442 |
Where w2 = new Where(eltMvtStock.getTable().getField("SOURCE"), "=", getTable().getName());
|
445 |
Where w2 = new Where(eltMvtStock.getTable().getField("SOURCE"), "=", getTable().getName());
|
443 |
sel.setWhere(w.and(w2));
|
446 |
sel.setWhere(w.and(w2));
|
444 |
|
447 |
|
445 |
@SuppressWarnings("rawtypes")
|
448 |
@SuppressWarnings("rawtypes")
|
446 |
List l = (List) eltMvtStock.getTable().getBase().getDataSource().execute(sel.asString(), new ArrayListHandler());
|
449 |
List l = (List) eltMvtStock.getTable().getBase().getDataSource().execute(sel.asString(), new ArrayListHandler());
|
447 |
if (l != null) {
|
450 |
if (l != null) {
|
448 |
for (int i = 0; i < l.size(); i++) {
|
451 |
for (int i = 0; i < l.size(); i++) {
|
449 |
Object[] tmp = (Object[]) l.get(i);
|
452 |
Object[] tmp = (Object[]) l.get(i);
|
450 |
eltMvtStock.archive(((Number) tmp[0]).intValue());
|
453 |
eltMvtStock.archive(((Number) tmp[0]).intValue());
|
451 |
}
|
454 |
}
|
452 |
}
|
455 |
}
|
453 |
}
|
456 |
}
|
454 |
}
|
457 |
}
|
455 |
}
|
458 |
}
|
456 |
|
459 |
|
457 |
public void transfertBL(int idFacture) {
|
460 |
public void transfertBL(int idFacture) {
|
458 |
final SQLElement elt = Configuration.getInstance().getDirectory().getElement("BON_DE_LIVRAISON");
|
461 |
final SQLElement elt = Configuration.getInstance().getDirectory().getElement("BON_DE_LIVRAISON");
|
459 |
final EditFrame editAvoirFrame = new EditFrame(elt);
|
462 |
final EditFrame editAvoirFrame = new EditFrame(elt);
|
460 |
editAvoirFrame.setIconImage(new ImageIcon(Gestion.class.getResource("frameicon.png")).getImage());
|
463 |
editAvoirFrame.setIconImage(new ImageIcon(Gestion.class.getResource("frameicon.png")).getImage());
|
461 |
|
464 |
|
462 |
final BonDeLivraisonSQLComponent comp = (BonDeLivraisonSQLComponent) editAvoirFrame.getSQLComponent();
|
465 |
final BonDeLivraisonSQLComponent comp = (BonDeLivraisonSQLComponent) editAvoirFrame.getSQLComponent();
|
463 |
final SQLInjector inject = SQLInjector.getInjector(this.getTable(), elt.getTable());
|
466 |
final SQLInjector inject = SQLInjector.getInjector(this.getTable(), elt.getTable());
|
464 |
SQLRowValues createRowValuesFrom = inject.createRowValuesFrom(idFacture);
|
467 |
SQLRowValues createRowValuesFrom = inject.createRowValuesFrom(idFacture);
|
465 |
SQLRow rowFacture = getTable().getRow(idFacture);
|
468 |
SQLRow rowFacture = getTable().getRow(idFacture);
|
466 |
String string = rowFacture.getString("NOM");
|
469 |
String string = rowFacture.getString("NOM");
|
467 |
createRowValuesFrom.put("NOM", string + (string.trim().length() == 0 ? "" : ", ") + rowFacture.getString("NUMERO"));
|
470 |
createRowValuesFrom.put("NOM", string + (string.trim().length() == 0 ? "" : ", ") + rowFacture.getString("NUMERO"));
|
468 |
comp.select(createRowValuesFrom);
|
471 |
comp.select(createRowValuesFrom);
|
469 |
// comp.loadFactureItem(idFacture);
|
472 |
// comp.loadFactureItem(idFacture);
|
470 |
|
473 |
|
471 |
editAvoirFrame.pack();
|
474 |
editAvoirFrame.pack();
|
472 |
editAvoirFrame.setState(JFrame.NORMAL);
|
475 |
editAvoirFrame.setState(JFrame.NORMAL);
|
473 |
editAvoirFrame.setVisible(true);
|
476 |
editAvoirFrame.setVisible(true);
|
474 |
|
477 |
|
475 |
}
|
478 |
}
|
476 |
|
479 |
|
477 |
/**
|
480 |
/**
|
478 |
* Transfert en commande fournisseur
|
481 |
* Transfert en commande fournisseur
|
479 |
*/
|
482 |
*/
|
480 |
public void transfertCommande(final int idFacture) {
|
483 |
public void transfertCommande(final int idFacture) {
|
481 |
ComptaPropsConfiguration.getInstanceCompta().getNonInteractiveSQLExecutor().execute(new Runnable() {
|
484 |
ComptaPropsConfiguration.getInstanceCompta().getNonInteractiveSQLExecutor().execute(new Runnable() {
|
482 |
|
485 |
|
483 |
@Override
|
486 |
@Override
|
484 |
public void run() {
|
487 |
public void run() {
|
485 |
SQLElement elt = Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE_ELEMENT");
|
488 |
SQLElement elt = Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE_ELEMENT");
|
486 |
SQLTable tableCmdElt = Configuration.getInstance().getDirectory().getElement("COMMANDE_ELEMENT").getTable();
|
489 |
SQLTable tableCmdElt = Configuration.getInstance().getDirectory().getElement("COMMANDE_ELEMENT").getTable();
|
487 |
SQLElement eltArticle = Configuration.getInstance().getDirectory().getElement("ARTICLE");
|
490 |
SQLElement eltArticle = Configuration.getInstance().getDirectory().getElement("ARTICLE");
|
488 |
List<SQLRow> rows = getTable().getRow(idFacture).getReferentRows(elt.getTable());
|
491 |
List<SQLRow> rows = getTable().getRow(idFacture).getReferentRows(elt.getTable());
|
489 |
final ListMap<SQLRow, SQLRowValues> map = new ListMap<SQLRow, SQLRowValues>();
|
492 |
final ListMap<SQLRow, SQLRowValues> map = new ListMap<SQLRow, SQLRowValues>();
|
490 |
SQLRow rowDeviseF = null;
|
493 |
SQLRow rowDeviseF = null;
|
491 |
for (SQLRow sqlRow : rows) {
|
494 |
for (SQLRow sqlRow : rows) {
|
492 |
// on récupére l'article qui lui correspond
|
495 |
// on récupére l'article qui lui correspond
|
493 |
SQLRowValues rowArticle = new SQLRowValues(eltArticle.getTable());
|
496 |
SQLRowValues rowArticle = new SQLRowValues(eltArticle.getTable());
|
494 |
for (SQLField field : eltArticle.getTable().getFields()) {
|
497 |
for (SQLField field : eltArticle.getTable().getFields()) {
|
495 |
if (sqlRow.getTable().getFieldsName().contains(field.getName())) {
|
498 |
if (sqlRow.getTable().getFieldsName().contains(field.getName())) {
|
496 |
rowArticle.put(field.getName(), sqlRow.getObject(field.getName()));
|
499 |
rowArticle.put(field.getName(), sqlRow.getObject(field.getName()));
|
497 |
}
|
500 |
}
|
498 |
}
|
501 |
}
|
499 |
|
502 |
|
500 |
int idArticle = ReferenceArticleSQLElement.getIdForCNM(rowArticle, true);
|
503 |
int idArticle = ReferenceArticleSQLElement.getIdForCNM(rowArticle, true);
|
501 |
SQLRow rowArticleFind = eltArticle.getTable().getRow(idArticle);
|
504 |
SQLRow rowArticleFind = eltArticle.getTable().getRow(idArticle);
|
502 |
if (rowArticleFind != null) {
|
505 |
if (rowArticleFind != null) {
|
503 |
SQLInjector inj = SQLInjector.getInjector(rowArticle.getTable(), tableCmdElt);
|
506 |
SQLInjector inj = SQLInjector.getInjector(rowArticle.getTable(), tableCmdElt);
|
504 |
SQLRowValues rowValsElt = new SQLRowValues(inj.createRowValuesFrom(rowArticleFind));
|
507 |
SQLRowValues rowValsElt = new SQLRowValues(inj.createRowValuesFrom(rowArticleFind));
|
505 |
rowValsElt.put("ID_STYLE", sqlRow.getObject("ID_STYLE"));
|
508 |
rowValsElt.put("ID_STYLE", sqlRow.getObject("ID_STYLE"));
|
506 |
rowValsElt.put("QTE", sqlRow.getObject("QTE"));
|
509 |
rowValsElt.put("QTE", sqlRow.getObject("QTE"));
|
507 |
rowValsElt.put("T_POIDS", rowValsElt.getLong("POIDS") * rowValsElt.getInt("QTE"));
|
510 |
rowValsElt.put("T_POIDS", rowValsElt.getLong("POIDS") * rowValsElt.getInt("QTE"));
|
508 |
|
511 |
|
509 |
// gestion de la devise
|
512 |
// gestion de la devise
|
510 |
rowDeviseF = sqlRow.getForeignRow("ID_DEVISE");
|
513 |
rowDeviseF = sqlRow.getForeignRow("ID_DEVISE");
|
511 |
SQLRow rowDeviseHA = rowArticleFind.getForeignRow("ID_DEVISE_HA");
|
514 |
SQLRow rowDeviseHA = rowArticleFind.getForeignRow("ID_DEVISE_HA");
|
512 |
BigDecimal qte = new BigDecimal(rowValsElt.getInt("QTE"));
|
515 |
BigDecimal qte = new BigDecimal(rowValsElt.getInt("QTE"));
|
513 |
if (rowDeviseF != null && !rowDeviseF.isUndefined()) {
|
516 |
if (rowDeviseF != null && !rowDeviseF.isUndefined()) {
|
514 |
if (rowDeviseF.getID() == rowDeviseHA.getID()) {
|
517 |
if (rowDeviseF.getID() == rowDeviseHA.getID()) {
|
515 |
rowValsElt.put("PA_DEVISE", rowArticleFind.getObject("PA_DEVISE"));
|
518 |
rowValsElt.put("PA_DEVISE", rowArticleFind.getObject("PA_DEVISE"));
|
516 |
rowValsElt.put("PA_DEVISE_T", ((BigDecimal) rowArticleFind.getObject("PA_DEVISE")).multiply(qte, DecimalUtils.HIGH_PRECISION));
|
519 |
rowValsElt.put("PA_DEVISE_T", ((BigDecimal) rowArticleFind.getObject("PA_DEVISE")).multiply(qte, DecimalUtils.HIGH_PRECISION));
|
517 |
rowValsElt.put("ID_DEVISE", rowDeviseF.getID());
|
520 |
rowValsElt.put("ID_DEVISE", rowDeviseF.getID());
|
518 |
} else {
|
521 |
} else {
|
519 |
BigDecimal taux = (BigDecimal) rowDeviseF.getObject("TAUX");
|
522 |
BigDecimal taux = (BigDecimal) rowDeviseF.getObject("TAUX");
|
520 |
rowValsElt.put("PA_DEVISE", taux.multiply((BigDecimal) rowValsElt.getObject("PA_HT")));
|
523 |
rowValsElt.put("PA_DEVISE", taux.multiply((BigDecimal) rowValsElt.getObject("PA_HT")));
|
521 |
rowValsElt.put("PA_DEVISE_T", ((BigDecimal) rowValsElt.getObject("PA_DEVISE")).multiply(qte, DecimalUtils.HIGH_PRECISION));
|
524 |
rowValsElt.put("PA_DEVISE_T", ((BigDecimal) rowValsElt.getObject("PA_DEVISE")).multiply(qte, DecimalUtils.HIGH_PRECISION));
|
522 |
rowValsElt.put("ID_DEVISE", rowDeviseF.getID());
|
525 |
rowValsElt.put("ID_DEVISE", rowDeviseF.getID());
|
523 |
}
|
526 |
}
|
524 |
}
|
527 |
}
|
525 |
|
528 |
|
526 |
BigDecimal prixHA = (BigDecimal) rowValsElt.getObject("PA_HT");
|
529 |
BigDecimal prixHA = (BigDecimal) rowValsElt.getObject("PA_HT");
|
527 |
rowValsElt.put("T_PA_HT", prixHA.multiply(qte, DecimalUtils.HIGH_PRECISION));
|
530 |
rowValsElt.put("T_PA_HT", prixHA.multiply(qte, DecimalUtils.HIGH_PRECISION));
|
528 |
|
531 |
|
529 |
rowValsElt.put("T_PA_HT", prixHA.multiply(qte, DecimalUtils.HIGH_PRECISION));
|
532 |
rowValsElt.put("T_PA_HT", prixHA.multiply(qte, DecimalUtils.HIGH_PRECISION));
|
530 |
rowValsElt.put("T_PA_TTC",
|
533 |
rowValsElt.put("T_PA_TTC",
|
531 |
((BigDecimal) rowValsElt.getObject("T_PA_HT")).multiply(new BigDecimal(rowValsElt.getForeign("ID_TAXE").getFloat("TAUX") / 100.0 + 1.0), DecimalUtils.HIGH_PRECISION));
|
534 |
((BigDecimal) rowValsElt.getObject("T_PA_HT")).multiply(new BigDecimal(rowValsElt.getForeign("ID_TAXE").getFloat("TAUX") / 100.0 + 1.0), DecimalUtils.HIGH_PRECISION));
|
532 |
|
535 |
|
533 |
map.add(rowArticleFind.getForeignRow("ID_FOURNISSEUR"), rowValsElt);
|
536 |
map.add(rowArticleFind.getForeignRow("ID_FOURNISSEUR"), rowValsElt);
|
534 |
}
|
537 |
}
|
535 |
}
|
538 |
}
|
536 |
MouvementStockSQLElement.createCommandeF(map, rowDeviseF);
|
539 |
MouvementStockSQLElement.createCommandeF(map, rowDeviseF);
|
537 |
|
540 |
|
538 |
}
|
541 |
}
|
539 |
|
542 |
|
540 |
});
|
543 |
});
|
541 |
|
544 |
|
542 |
}
|
545 |
}
|
543 |
|
546 |
|
544 |
public interface DoWithRow {
|
547 |
public interface DoWithRow {
|
545 |
public void process(SQLRow row);
|
548 |
public void process(SQLRow row);
|
546 |
}
|
549 |
}
|
547 |
|
550 |
|
548 |
Map<String, DoWithRow> specialAction = new HashMap<String, DoWithRow>();
|
551 |
Map<String, DoWithRow> specialAction = new HashMap<String, DoWithRow>();
|
549 |
|
552 |
|
550 |
public DoWithRow getSpecialAction(String key) {
|
553 |
public DoWithRow getSpecialAction(String key) {
|
551 |
return specialAction.get(key);
|
554 |
return specialAction.get(key);
|
552 |
}
|
555 |
}
|
553 |
|
556 |
|
554 |
public void putSpecialAction(String key, DoWithRow action) {
|
557 |
public void putSpecialAction(String key, DoWithRow action) {
|
555 |
specialAction.put(key, action);
|
558 |
specialAction.put(key, action);
|
556 |
}
|
559 |
}
|
557 |
|
560 |
|
558 |
public void cancelAvoir(final SQLRowAccessor rowFactureOrigin) {
|
561 |
public void cancelAvoir(final SQLRowAccessor rowFactureOrigin) {
|
559 |
JPanel p = new JPanel(new GridBagLayout());
|
562 |
JPanel p = new JPanel(new GridBagLayout());
|
560 |
GridBagConstraints c = new DefaultGridBagConstraints();
|
563 |
GridBagConstraints c = new DefaultGridBagConstraints();
|
561 |
c.gridwidth = GridBagConstraints.REMAINDER;
|
564 |
c.gridwidth = GridBagConstraints.REMAINDER;
|
562 |
p.add(new JLabel("Voulez annuler l'avoir affecté sur cette facture?"), c);
|
565 |
p.add(new JLabel("Voulez annuler l'avoir affecté sur cette facture?"), c);
|
563 |
c.gridwidth = 1;
|
566 |
c.gridwidth = 1;
|
564 |
c.gridy++;
|
567 |
c.gridy++;
|
565 |
c.gridx = 0;
|
568 |
c.gridx = 0;
|
566 |
final JButton buttonApply = new JButton("Appliquer");
|
569 |
final JButton buttonApply = new JButton("Appliquer");
|
567 |
JButton buttonAnnuler = new JButton("Fermer");
|
570 |
JButton buttonAnnuler = new JButton("Fermer");
|
568 |
p.add(buttonApply, c);
|
571 |
p.add(buttonApply, c);
|
569 |
|
572 |
|
570 |
c.gridx++;
|
573 |
c.gridx++;
|
571 |
p.add(buttonAnnuler, c);
|
574 |
p.add(buttonAnnuler, c);
|
572 |
final PanelFrame f = new PanelFrame(p, "Suppression d'un avoir client sur facture");
|
575 |
final PanelFrame f = new PanelFrame(p, "Suppression d'un avoir client sur facture");
|
573 |
|
576 |
|
574 |
buttonAnnuler.addActionListener(new ActionListener() {
|
577 |
buttonAnnuler.addActionListener(new ActionListener() {
|
575 |
|
578 |
|
576 |
@Override
|
579 |
@Override
|
577 |
public void actionPerformed(ActionEvent e) {
|
580 |
public void actionPerformed(ActionEvent e) {
|
578 |
f.dispose();
|
581 |
f.dispose();
|
579 |
}
|
582 |
}
|
580 |
});
|
583 |
});
|
581 |
|
584 |
|
582 |
buttonApply.addActionListener(new ActionListener() {
|
585 |
buttonApply.addActionListener(new ActionListener() {
|
583 |
|
586 |
|
584 |
@Override
|
587 |
@Override
|
585 |
public void actionPerformed(ActionEvent e) {
|
588 |
public void actionPerformed(ActionEvent e) {
|
586 |
long ttc = rowFactureOrigin.getLong("T_TTC");
|
589 |
long ttc = rowFactureOrigin.getLong("T_TTC");
|
587 |
// long netAPayer = rowFactureOrigin.getLong("NET_A_PAYER");
|
590 |
// long netAPayer = rowFactureOrigin.getLong("NET_A_PAYER");
|
588 |
long avoirTTC = rowFactureOrigin.getLong("T_AVOIR_TTC");
|
591 |
long avoirTTC = rowFactureOrigin.getLong("T_AVOIR_TTC");
|
589 |
SQLRowAccessor rowAvoir = rowFactureOrigin.getForeign("ID_AVOIR_CLIENT");
|
592 |
SQLRowAccessor rowAvoir = rowFactureOrigin.getForeign("ID_AVOIR_CLIENT");
|
590 |
|
593 |
|
591 |
final SQLRowValues createEmptyUpdateRow = rowFactureOrigin.createEmptyUpdateRow();
|
594 |
final SQLRowValues createEmptyUpdateRow = rowFactureOrigin.createEmptyUpdateRow();
|
592 |
createEmptyUpdateRow.put("ID_AVOIR_CLIENT", rowFactureOrigin.getTable().getTable("AVOIR_CLIENT").getUndefinedID());
|
595 |
createEmptyUpdateRow.put("ID_AVOIR_CLIENT", rowFactureOrigin.getTable().getTable("AVOIR_CLIENT").getUndefinedID());
|
593 |
createEmptyUpdateRow.put("NET_A_PAYER", ttc);
|
596 |
createEmptyUpdateRow.put("NET_A_PAYER", ttc);
|
594 |
createEmptyUpdateRow.put("T_AVOIR_TTC", 0L);
|
597 |
createEmptyUpdateRow.put("T_AVOIR_TTC", 0L);
|
595 |
try {
|
598 |
try {
|
596 |
SQLRow rowFacture = createEmptyUpdateRow.commit();
|
599 |
SQLRow rowFacture = createEmptyUpdateRow.commit();
|
597 |
|
600 |
|
598 |
// long restant = totalAvoirTTC - totalAvoirApplique;
|
601 |
// long restant = totalAvoirTTC - totalAvoirApplique;
|
599 |
|
602 |
|
600 |
SQLRowValues rowVals = rowAvoir.createEmptyUpdateRow();
|
603 |
SQLRowValues rowVals = rowAvoir.createEmptyUpdateRow();
|
601 |
rowVals.put("SOLDE", Boolean.FALSE);
|
604 |
rowVals.put("SOLDE", Boolean.FALSE);
|
602 |
rowVals.put("MONTANT_SOLDE", 0L);
|
605 |
rowVals.put("MONTANT_SOLDE", 0L);
|
603 |
rowVals.put("MONTANT_RESTANT", avoirTTC);
|
606 |
rowVals.put("MONTANT_RESTANT", avoirTTC);
|
604 |
rowVals.update();
|
607 |
rowVals.update();
|
605 |
|
608 |
|
606 |
EcritureSQLElement eltEcr = (EcritureSQLElement) Configuration.getInstance().getDirectory().getElement("ECRITURE");
|
609 |
EcritureSQLElement eltEcr = (EcritureSQLElement) Configuration.getInstance().getDirectory().getElement("ECRITURE");
|
607 |
final int foreignIDmvt = rowFacture.getForeignID("ID_MOUVEMENT");
|
610 |
final int foreignIDmvt = rowFacture.getForeignID("ID_MOUVEMENT");
|
608 |
eltEcr.archiveMouvementProfondeur(foreignIDmvt, false);
|
611 |
eltEcr.archiveMouvementProfondeur(foreignIDmvt, false);
|
609 |
|
612 |
|
610 |
System.err.println("Regeneration des ecritures");
|
613 |
System.err.println("Regeneration des ecritures");
|
611 |
new GenerationMvtSaisieVenteFacture(rowFacture.getID(), foreignIDmvt);
|
614 |
new GenerationMvtSaisieVenteFacture(rowFacture.getID(), foreignIDmvt);
|
612 |
System.err.println("Fin regeneration");
|
615 |
System.err.println("Fin regeneration");
|
613 |
} catch (SQLException e1) {
|
616 |
} catch (SQLException e1) {
|
614 |
ExceptionHandler.handle("Erreur lors de l'affection de l'avoir sur la facture!", e1);
|
617 |
ExceptionHandler.handle("Erreur lors de l'affection de l'avoir sur la facture!", e1);
|
615 |
} finally {
|
618 |
} finally {
|
616 |
f.dispose();
|
619 |
f.dispose();
|
617 |
}
|
620 |
}
|
618 |
|
621 |
|
619 |
}
|
622 |
}
|
620 |
});
|
623 |
});
|
621 |
SwingUtilities.invokeLater(new Runnable() {
|
624 |
SwingUtilities.invokeLater(new Runnable() {
|
622 |
|
625 |
|
623 |
@Override
|
626 |
@Override
|
624 |
public void run() {
|
627 |
public void run() {
|
625 |
|
628 |
|
626 |
FrameUtil.showPacked(f);
|
629 |
FrameUtil.showPacked(f);
|
627 |
}
|
630 |
}
|
628 |
|
631 |
|
629 |
});
|
632 |
});
|
630 |
}
|
633 |
}
|
- |
|
634 |
|
- |
|
635 |
@Override
|
- |
|
636 |
protected String createCode() {
|
- |
|
637 |
return "sales.invoice";
|
- |
|
638 |
}
|
631 |
}
|
639 |
}
|