Line 23... |
Line 23... |
23 |
import org.openconcerto.erp.core.common.ui.TotalPanel;
|
23 |
import org.openconcerto.erp.core.common.ui.TotalPanel;
|
24 |
import org.openconcerto.erp.core.customerrelationship.customer.ui.AddressChoiceUI;
|
24 |
import org.openconcerto.erp.core.customerrelationship.customer.ui.AddressChoiceUI;
|
25 |
import org.openconcerto.erp.core.customerrelationship.customer.ui.AdresseType;
|
25 |
import org.openconcerto.erp.core.customerrelationship.customer.ui.AdresseType;
|
26 |
import org.openconcerto.erp.core.customerrelationship.customer.ui.CategorieComptableChoiceUI;
|
26 |
import org.openconcerto.erp.core.customerrelationship.customer.ui.CategorieComptableChoiceUI;
|
27 |
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
|
27 |
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
|
- |
|
28 |
import org.openconcerto.erp.core.sales.order.element.CommandeClientSQLElement;
|
28 |
import org.openconcerto.erp.core.sales.order.report.CommandeClientXmlSheet;
|
29 |
import org.openconcerto.erp.core.sales.order.report.CommandeClientXmlSheet;
|
29 |
import org.openconcerto.erp.core.sales.order.ui.CommandeClientItemTable;
|
30 |
import org.openconcerto.erp.core.sales.order.ui.CommandeClientItemTable;
|
30 |
import org.openconcerto.erp.core.sales.order.ui.EtatCommandeClient;
|
31 |
import org.openconcerto.erp.core.sales.order.ui.EtatCommandeClient;
|
31 |
import org.openconcerto.erp.core.sales.order.ui.EtatCommandeClientComboBox;
|
32 |
import org.openconcerto.erp.core.sales.order.ui.EtatCommandeClientComboBox;
|
32 |
import org.openconcerto.erp.core.sales.order.ui.EtatCommandeRowItemView;
|
33 |
import org.openconcerto.erp.core.sales.order.ui.EtatCommandeRowItemView;
|
Line 60... |
Line 61... |
60 |
import org.openconcerto.ui.FormLayouter;
|
61 |
import org.openconcerto.ui.FormLayouter;
|
61 |
import org.openconcerto.ui.JDate;
|
62 |
import org.openconcerto.ui.JDate;
|
62 |
import org.openconcerto.ui.TitledSeparator;
|
63 |
import org.openconcerto.ui.TitledSeparator;
|
63 |
import org.openconcerto.ui.component.ITextArea;
|
64 |
import org.openconcerto.ui.component.ITextArea;
|
64 |
import org.openconcerto.utils.ExceptionHandler;
|
65 |
import org.openconcerto.utils.ExceptionHandler;
|
65 |
import org.openconcerto.utils.text.SimpleDocumentListener;
|
- |
|
66 |
|
66 |
|
67 |
import java.awt.Color;
|
67 |
import java.awt.Color;
|
68 |
import java.awt.GridBagConstraints;
|
68 |
import java.awt.GridBagConstraints;
|
69 |
import java.awt.GridBagLayout;
|
69 |
import java.awt.GridBagLayout;
|
70 |
import java.beans.PropertyChangeEvent;
|
70 |
import java.beans.PropertyChangeEvent;
|
71 |
import java.beans.PropertyChangeListener;
|
71 |
import java.beans.PropertyChangeListener;
|
72 |
import java.sql.SQLException;
|
72 |
import java.sql.SQLException;
|
73 |
import java.util.Date;
|
73 |
import java.util.Date;
|
74 |
import java.util.HashSet;
|
74 |
import java.util.HashSet;
|
- |
|
75 |
import java.util.List;
|
75 |
import java.util.Set;
|
76 |
import java.util.Set;
|
76 |
|
77 |
|
77 |
import javax.swing.JLabel;
|
78 |
import javax.swing.JLabel;
|
78 |
import javax.swing.JOptionPane;
|
79 |
import javax.swing.JOptionPane;
|
79 |
import javax.swing.JPanel;
|
80 |
import javax.swing.JPanel;
|
Line 254... |
Line 255... |
254 |
// foreignRow = rowValsD;
|
255 |
// foreignRow = rowValsD;
|
255 |
//
|
256 |
//
|
256 |
// }
|
257 |
// }
|
257 |
// table.setTarif(foreignRow, true);
|
258 |
// table.setTarif(foreignRow, true);
|
258 |
}
|
259 |
}
|
259 |
if (!isFilling()) {
|
- |
|
260 |
table.setClient(row, true);
|
260 |
table.setClient(row, !isFilling());
|
261 |
}
|
- |
|
262 |
|
261 |
|
263 |
} else {
|
262 |
} else {
|
264 |
if (!isFilling()) {
|
263 |
if (!isFilling()) {
|
265 |
table.setClient(null, true);
|
264 |
table.setClient(null, true);
|
266 |
}
|
265 |
}
|
Line 550... |
Line 549... |
550 |
pane.add("Eléments", this.table);
|
549 |
pane.add("Eléments", this.table);
|
551 |
this.tableFacturationItem = new FacturationCommandeTable(this);
|
550 |
this.tableFacturationItem = new FacturationCommandeTable(this);
|
552 |
pane.add("Facturation", this.tableFacturationItem);
|
551 |
pane.add("Facturation", this.tableFacturationItem);
|
553 |
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.CHIFFRAGE_COMMANDE_CLIENT, false)) {
|
552 |
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.CHIFFRAGE_COMMANDE_CLIENT, false)) {
|
554 |
this.tableChiffrageItem = new ChiffrageCommandeTable(this);
|
553 |
this.tableChiffrageItem = new ChiffrageCommandeTable(this);
|
- |
|
554 |
this.tableChiffrageItem.getRowValuesTable().setEditable(((CommandeClientSQLElement) getElement()).isChiffrageEditableInUI());
|
555 |
pane.add("Chiffrage", this.tableChiffrageItem);
|
555 |
pane.add("Chiffrage", this.tableChiffrageItem);
|
556 |
}
|
556 |
}
|
- |
|
557 |
if (this.getTable().contains("INFOS_DEVIS")) {
|
- |
|
558 |
JPanel panelInfosDevis = new JPanel(new GridBagLayout());
|
- |
|
559 |
DefaultGridBagConstraints cI = new DefaultGridBagConstraints();
|
- |
|
560 |
cI.weightx = 1;
|
- |
|
561 |
cI.weighty = 1;
|
- |
|
562 |
cI.fill = GridBagConstraints.BOTH;
|
- |
|
563 |
ITextArea infosDevis = new ITextArea();
|
- |
|
564 |
panelInfosDevis.add(new JScrollPane(infosDevis), cI);
|
- |
|
565 |
this.addView(infosDevis, "INFOS_DEVIS");
|
- |
|
566 |
pane.add("Informations devis", panelInfosDevis);
|
- |
|
567 |
}
|
557 |
this.add(pane, c);
|
568 |
this.add(pane, c);
|
558 |
|
569 |
|
559 |
DeviseField textPortHT = new DeviseField(5);
|
570 |
DeviseField textPortHT = new DeviseField(5);
|
560 |
DeviseField textRemiseHT = new DeviseField();
|
571 |
DeviseField textRemiseHT = new DeviseField();
|
561 |
|
572 |
|
Line 745... |
Line 756... |
745 |
|
756 |
|
746 |
public void tableChanged(TableModelEvent e) {
|
757 |
public void tableChanged(TableModelEvent e) {
|
747 |
textPoidsTotal.setText(String.valueOf(CommandeClientSQLComponent.this.table.getPoidsTotal()));
|
758 |
textPoidsTotal.setText(String.valueOf(CommandeClientSQLComponent.this.table.getPoidsTotal()));
|
748 |
}
|
759 |
}
|
749 |
});
|
760 |
});
|
- |
|
761 |
|
- |
|
762 |
this.addView(this.table.getRowValuesTable(), "");
|
750 |
DefaultGridBagConstraints.lockMinimumSize(comboClient);
|
763 |
DefaultGridBagConstraints.lockMinimumSize(comboClient);
|
751 |
DefaultGridBagConstraints.lockMinimumSize(comboCommercial);
|
764 |
DefaultGridBagConstraints.lockMinimumSize(comboCommercial);
|
752 |
DefaultGridBagConstraints.lockMinimumSize(comboDevis);
|
765 |
DefaultGridBagConstraints.lockMinimumSize(comboDevis);
|
753 |
DefaultGridBagConstraints.lockMinimumSize(totalTTC);
|
766 |
DefaultGridBagConstraints.lockMinimumSize(totalTTC);
|
754 |
DefaultGridBagConstraints.lockMaximumSize(totalTTC);
|
767 |
DefaultGridBagConstraints.lockMaximumSize(totalTTC);
|
Line 1004... |
Line 1017... |
1004 |
protected void refreshAfterSelect(SQLRowAccessor r) {
|
1017 |
protected void refreshAfterSelect(SQLRowAccessor r) {
|
1005 |
if (this.dateCommande.getValue() != null && r.getObject("DATE") != null) {
|
1018 |
if (this.dateCommande.getValue() != null && r.getObject("DATE") != null) {
|
1006 |
this.table.setDateDevise(r.getDate("DATE").getTime());
|
1019 |
this.table.setDateDevise(r.getDate("DATE").getTime());
|
1007 |
}
|
1020 |
}
|
1008 |
}
|
1021 |
}
|
- |
|
1022 |
|
- |
|
1023 |
/**
|
- |
|
1024 |
* Création d'une commande à partir d'un devis existant
|
- |
|
1025 |
*
|
- |
|
1026 |
* @param idCommande
|
- |
|
1027 |
*
|
- |
|
1028 |
*/
|
- |
|
1029 |
public void loadCommandeExistant(final int idCommande) {
|
- |
|
1030 |
|
- |
|
1031 |
final SQLElement commande =getElement();
|
- |
|
1032 |
final SQLElement commandeElt = getElement().getDirectory().getElement("COMMANDE_CLIENT_ELEMENT");
|
- |
|
1033 |
|
- |
|
1034 |
// On duplique la commande
|
- |
|
1035 |
if (idCommande > 1) {
|
- |
|
1036 |
final SQLRow row = getTable().getRow(idCommande);
|
- |
|
1037 |
final SQLRowValues rowVals = new SQLRowValues(getTable());
|
- |
|
1038 |
rowVals.put("ID_CLIENT", row.getInt("ID_CLIENT"));
|
- |
|
1039 |
if (row.getObject("ID_TARIF") != null && !row.isForeignEmpty("ID_TARIF")) {
|
- |
|
1040 |
rowVals.put("ID_TARIF", row.getInt("ID_TARIF"));
|
- |
|
1041 |
}
|
- |
|
1042 |
rowVals.put("NUMERO", NumerotationAutoSQLElement.getNextNumero(getElement().getClass()));
|
- |
|
1043 |
|
- |
|
1044 |
this.select(rowVals);
|
- |
|
1045 |
}
|
- |
|
1046 |
|
- |
|
1047 |
// On duplique les elements des commandes
|
- |
|
1048 |
final List<SQLRow> myListItem = getTable().getRow(idCommande).getReferentRows(commandeElt.getTable());
|
- |
|
1049 |
|
- |
|
1050 |
if (myListItem.size() != 0) {
|
- |
|
1051 |
this.table.getModel().clearRows();
|
- |
|
1052 |
|
- |
|
1053 |
for (final SQLRow rowElt : myListItem) {
|
- |
|
1054 |
|
- |
|
1055 |
final SQLRowValues rowVals = rowElt.createUpdateRow();
|
- |
|
1056 |
rowVals.clearPrimaryKeys();
|
- |
|
1057 |
this.table.getModel().addRow(rowVals);
|
- |
|
1058 |
final int rowIndex = this.table.getModel().getRowCount() - 1;
|
- |
|
1059 |
this.table.getModel().fireTableModelModified(rowIndex);
|
- |
|
1060 |
}
|
- |
|
1061 |
} else {
|
- |
|
1062 |
this.table.getModel().clearRows();
|
- |
|
1063 |
}
|
- |
|
1064 |
this.table.getModel().fireTableDataChanged();
|
- |
|
1065 |
this.table.repaint();
|
- |
|
1066 |
}
|
- |
|
1067 |
|
1009 |
}
|
1068 |
}
|