OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 177 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 177 Rev 182
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 62... Line 62...
62
    }
62
    }
63
 
63
 
64
    @Override
64
    @Override
65
    protected JFrame instantiateFrame() {
65
    protected JFrame instantiateFrame() {
66
        final JFrame frame = new JFrame(String.valueOf(getValue(NAME)));
66
        final JFrame frame = new JFrame(String.valueOf(getValue(NAME)));
67
        PredicateRowAction toInvoiceAction = new PredicateRowAction(new AbstractAction() {
67
        RowAction toInvoiceAction = new RowAction(new AbstractAction() {
68
            public void actionPerformed(ActionEvent e) {
68
            public void actionPerformed(ActionEvent e) {
69
                transfertFactureClient(IListe.get(e).getSelectedRows());
69
                transfertFactureClient(IListe.get(e).getSelectedRows());
70
            }
70
            }
71
        }, false, "sales.shipment.create.invoice");
71
        }, false, "sales.shipment.create.invoice") {
-
 
72
            @Override
72
        toInvoiceAction.setPredicate(IListeEvent.getNonEmptySelectionPredicate());
73
            public boolean enabledFor(List<SQLRowValues> selection) {
73
 
74
 
-
 
75
                if (!selection.isEmpty()) {
-
 
76
                    for (SQLRowValues sqlRowValues : selection) {
-
 
77
                        if (sqlRowValues.getBoolean("VERROU_FACTURATION")) {
-
 
78
                            return false;
-
 
79
                        }
-
 
80
                    }
-
 
81
                    return true;
-
 
82
                }
-
 
83
                return false;
-
 
84
 
-
 
85
            }
-
 
86
        };
74
        // Tabs
87
        // Tabs
75
        final JTabbedPane tabs = new JTabbedPane();
88
        final JTabbedPane tabs = new JTabbedPane();
76
        tabs.addTab(getConf().getERP_TM().translate("sales.shipment.allShipments"), createAllDeliveryPanel(toInvoiceAction));
89
        tabs.addTab(getConf().getERP_TM().translate("sales.shipment.allShipments"), createAllDeliveryPanel(toInvoiceAction));
77
        tabs.addTab(getConf().getERP_TM().translate("sales.shipment.nonInvoicedShipments"), createDeliveryWithoutInvoicePanel(toInvoiceAction));
90
        tabs.addTab(getConf().getERP_TM().translate("sales.shipment.nonInvoicedShipments"), createDeliveryWithoutInvoicePanel(toInvoiceAction));
78
        tabs.addTab(getConf().getERP_TM().translate("sales.shipment.invoicedShipments"), createDeliveryWithInvoicePanel());
91
        tabs.addTab(getConf().getERP_TM().translate("sales.shipment.invoicedShipments"), createDeliveryWithInvoicePanel());
Line 96... Line 109...
96
        c.gridy = 4;
109
        c.gridy = 4;
97
 
110
 
98
        // Date panel
111
        // Date panel
99
        final IListFilterDatePanel datePanel = new IListFilterDatePanel(panel.getListe(), eltCmd.getTable().getField("DATE"), IListFilterDatePanel.getDefaultMap());
112
        final IListFilterDatePanel datePanel = new IListFilterDatePanel(panel.getListe(), eltCmd.getTable().getField("DATE"), IListFilterDatePanel.getDefaultMap());
100
 
113
 
101
        panel.getListe().addIListeActions(new MouseSheetXmlListeListener(BonLivraisonXmlSheet.class) {
114
        panel.getListe().addIListeActions(new MouseSheetXmlListeListener(eltCmd, BonLivraisonXmlSheet.class) {
102
            @Override
115
            @Override
103
            public List<RowAction> addToMenu() {
116
            public List<RowAction> addToMenu() {
104
                return allowedActions;
117
                return allowedActions;
105
            }
118
            }
106
        }.getRowActions());
119
        }.getRowActions());
Line 124... Line 137...
124
 
137
 
125
        panel.add(bottomPanel, c);
138
        panel.add(bottomPanel, c);
126
        return panel;
139
        return panel;
127
    }
140
    }
128
 
141
 
129
    JPanel createAllDeliveryPanel(final PredicateRowAction toInvoiceAction) {
142
    JPanel createAllDeliveryPanel(final RowAction toInvoiceAction) {
130
        final BonDeLivraisonSQLElement eltCmd = getElem();
143
        final BonDeLivraisonSQLElement eltCmd = getElem();
131
        final SQLTableModelSourceOnline tableSource = eltCmd.getTableSource(true);
144
        final SQLTableModelSourceOnline tableSource = eltCmd.getTableSource(true);
132
        final List<RowAction> allowedActions = new ArrayList<RowAction>();
145
        final List<RowAction> allowedActions = new ArrayList<RowAction>();
133
        allowedActions.add(toInvoiceAction);
146
        allowedActions.add(toInvoiceAction);
134
        BaseSQLTableModelColumn colAvancement = new BaseSQLTableModelColumn(eltCmd.getDirectory().getTranslator().getDescFor(eltCmd.getTable(), "invoiceProgress").getTitleLabel(), BigDecimal.class) {
147
        BaseSQLTableModelColumn colAvancement = new BaseSQLTableModelColumn(eltCmd.getDirectory().getTranslator().getDescFor(eltCmd.getTable(), "invoiceProgress").getTitleLabel(), BigDecimal.class) {
Line 180... Line 193...
180
 
193
 
181
        final ListeAddPanel panel = getPanel(eltCmd, tableSource, allowedActions);
194
        final ListeAddPanel panel = getPanel(eltCmd, tableSource, allowedActions);
182
        return panel;
195
        return panel;
183
    }
196
    }
184
 
197
 
185
    JPanel createDeliveryWithoutInvoicePanel(PredicateRowAction toInvoiceAction) {
198
    JPanel createDeliveryWithoutInvoicePanel(RowAction toInvoiceAction) {
186
        final BonDeLivraisonSQLElement eltCmd = getElem();
199
        final BonDeLivraisonSQLElement eltCmd = getElem();
187
        final SQLTableModelSourceOnline tableSource = eltCmd.getTableSource(true);
200
        final SQLTableModelSourceOnline tableSource = eltCmd.getTableSource(true);
188
        final List<RowAction> allowedActions = new ArrayList<RowAction>();
201
        final List<RowAction> allowedActions = new ArrayList<RowAction>();
189
        allowedActions.add(toInvoiceAction);
202
        allowedActions.add(toInvoiceAction);
190
 
203