OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 156 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 156 Rev 177
Line 65... Line 65...
65
import javax.swing.JOptionPane;
65
import javax.swing.JOptionPane;
66
import javax.swing.JTextField;
66
import javax.swing.JTextField;
67
import javax.swing.SwingConstants;
67
import javax.swing.SwingConstants;
68
import javax.swing.SwingUtilities;
68
import javax.swing.SwingUtilities;
69
import javax.swing.event.DocumentEvent;
69
import javax.swing.event.DocumentEvent;
-
 
70
import javax.swing.event.TableModelEvent;
-
 
71
import javax.swing.event.TableModelListener;
70
 
72
 
71
public class VenteFactureSituationSQLComponent extends TransfertGroupSQLComponent {
73
public class VenteFactureSituationSQLComponent extends TransfertGroupSQLComponent {
72
    public static final String ID = "sales.invoice.partial";
74
    public static final String ID = "sales.invoice.partial";
73
 
75
 
74
    private PanelOOSQLComponent panelOO;
76
    private PanelOOSQLComponent panelOO;
Line 199... Line 201...
199
            }
201
            }
200
        });
202
        });
201
        sqlRequestComboBox.setEnabled(false);
203
        sqlRequestComboBox.setEnabled(false);
202
 
204
 
203
        final AcompteField acompteField = ((AcompteField) getEditor("sales.invoice.partial.amount"));
205
        final AcompteField acompteField = ((AcompteField) getEditor("sales.invoice.partial.amount"));
204
        acompteField.getDocument().addDocumentListener(new SimpleDocumentListener() {
206
        listenerAcompteField = new SimpleDocumentListener() {
205
 
207
 
206
            @Override
208
            @Override
207
            public void update(DocumentEvent e) {
209
            public void update(DocumentEvent e) {
208
                Acompte a = acompteField.getValue();
210
                Acompte a = acompteField.getValue();
209
                table.calculPourcentage(a, TypeCalcul.CALCUL_FACTURABLE);
211
                table.calculPourcentage(a, TypeCalcul.CALCUL_FACTURABLE);
210
            }
212
            }
-
 
213
 
211
        });
214
        };
-
 
215
        acompteField.getDocument().addDocumentListener(listenerAcompteField);
-
 
216
 
-
 
217
        listenerTable = new TableModelListener() {
-
 
218
 
-
 
219
            @Override
-
 
220
            public void tableChanged(TableModelEvent e) {
-
 
221
                acompteField.getDocument().removeDocumentListener(listenerAcompteField);
-
 
222
                if (e.getColumn() == table.getModel().getColumnForField("POURCENT_FACTURABLE")) {
-
 
223
                    Acompte a = new Acompte(null, table.getTotalHT(TypeCalcul.CALCUL_MONTANT_TOTAL));
-
 
224
                    acompteField.setValue(a);
-
 
225
 
-
 
226
                }
-
 
227
                acompteField.getDocument().addDocumentListener(listenerAcompteField);
-
 
228
            }
-
 
229
 
-
 
230
        };
-
 
231
        table.getRowValuesTable().getModel().addTableModelListener(listenerTable);
212
        total.addValueListener(new PropertyChangeListener() {
232
        total.addValueListener(new PropertyChangeListener() {
213
 
233
 
214
            @Override
234
            @Override
215
            public void propertyChange(PropertyChangeEvent evt) {
235
            public void propertyChange(PropertyChangeEvent evt) {
216
                acompteField.setTotal(new BigDecimal(total.getTotalHT()).movePointLeft(2));
236
                acompteField.setTotal(new BigDecimal(total.getTotalHT()).movePointLeft(2));
Line 218... Line 238...
218
            }
238
            }
219
        });
239
        });
220
 
240
 
221
    }
241
    }
222
 
242
 
223
    int countPole = 0;
-
 
224
 
-
 
225
    // @Override
-
 
226
    // public Component addView(MutableRowItemView rowItemView, String fields, Object specObj) {
-
 
227
    //
-
 
228
    // if (fields.contains("ID_POLE_PRODUIT") && countPole == 0) {
243
    private SimpleDocumentListener listenerAcompteField;
229
    // countPole++;
-
 
230
    // return null;
-
 
231
    // } else {
-
 
232
    // return super.addView(rowItemView, fields, specObj);
244
    private TableModelListener listenerTable;
233
    // }
-
 
234
    // }
-
 
235
 
245
 
236
    @Override
246
    @Override
237
    public JComponent getLabel(String id) {
247
    public JComponent getLabel(String id) {
238
        if (id.equals("sales.invoice.partial.amount")) {
248
        if (id.equals("sales.invoice.partial.amount")) {
239
            final JLabel jLabel = new JLabel("Montant HT (ou %) à facturer");
249
            final JLabel jLabel = new JLabel("Montant HT (ou %) à facturer");
Line 281... Line 291...
281
        } else if (id.equals("sales.invoice.partial.total.amount")) {
291
        } else if (id.equals("sales.invoice.partial.total.amount")) {
282
            final AbstractArticleItemTable items = (AbstractArticleItemTable) getEditor("sales.invoice.partial.items.list");
292
            final AbstractArticleItemTable items = (AbstractArticleItemTable) getEditor("sales.invoice.partial.items.list");
283
            // Set only VAT Editable
293
            // Set only VAT Editable
284
            for (int i = 0; i < items.getRowValuesTable().getColumnModel().getColumnCount(false); i++) {
294
            for (int i = 0; i < items.getRowValuesTable().getColumnModel().getColumnCount(false); i++) {
285
                final SQLTableElement sqlTableElementAt = items.getRowValuesTable().getRowValuesTableModel().getSQLTableElementAt(i);
295
                final SQLTableElement sqlTableElementAt = items.getRowValuesTable().getRowValuesTableModel().getSQLTableElementAt(i);
286
                if (sqlTableElementAt.getField() == null || !sqlTableElementAt.getField().getName().equalsIgnoreCase("ID_TAXE")) {
296
                if (sqlTableElementAt.getField() != null && (sqlTableElementAt.getField().getName().equalsIgnoreCase("ID_STYLE")
287
                    sqlTableElementAt.setEditable(false);
297
                        || sqlTableElementAt.getField().getName().equalsIgnoreCase("POURCENT_FACTURABLE") || sqlTableElementAt.getField().getName().equalsIgnoreCase("ID_TAXE"))) {
288
                } else {
-
 
289
                    sqlTableElementAt.setEditable(true);
298
                    sqlTableElementAt.setEditable(true);
-
 
299
                } else {
-
 
300
                    sqlTableElementAt.setEditable(false);
290
                }
301
                }
291
            }
302
            }
292
 
303
 
293
            final DeviseField totalHT = (DeviseField) getEditor("T_HT");
304
            final DeviseField totalHT = (DeviseField) getEditor("T_HT");
294
            final DeviseField totalEco = (DeviseField) getEditor("T_ECO_CONTRIBUTION");
305
            final DeviseField totalEco = (DeviseField) getEditor("T_ECO_CONTRIBUTION");