OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 156 Rev 174
Line 16... Line 16...
16
import org.openconcerto.erp.config.ComptaPropsConfiguration;
16
import org.openconcerto.erp.config.ComptaPropsConfiguration;
17
import org.openconcerto.erp.core.finance.payment.element.ChequeAEncaisserSQLElement;
17
import org.openconcerto.erp.core.finance.payment.element.ChequeAEncaisserSQLElement;
18
import org.openconcerto.erp.rights.ComptaTotalUserRight;
18
import org.openconcerto.erp.rights.ComptaTotalUserRight;
19
import org.openconcerto.sql.Configuration;
19
import org.openconcerto.sql.Configuration;
20
import org.openconcerto.sql.model.SQLRow;
20
import org.openconcerto.sql.model.SQLRow;
-
 
21
import org.openconcerto.sql.model.SQLRowListRSH;
21
import org.openconcerto.sql.model.SQLRowValues;
22
import org.openconcerto.sql.model.SQLRowValues;
22
import org.openconcerto.sql.sqlobject.SQLRequestComboBox;
23
import org.openconcerto.sql.sqlobject.SQLRequestComboBox;
23
import org.openconcerto.sql.users.rights.UserRightsManager;
24
import org.openconcerto.sql.users.rights.UserRightsManager;
24
import org.openconcerto.sql.view.EditFrame;
25
import org.openconcerto.sql.view.EditFrame;
25
import org.openconcerto.sql.view.EditPanel.EditMode;
26
import org.openconcerto.sql.view.EditPanel.EditMode;
Line 51... Line 52...
51
        return new JButton("Aperçu du relevé");
52
        return new JButton("Aperçu du relevé");
52
    }
53
    }
53
 
54
 
54
    @Override
55
    @Override
55
    protected JTextComponent createLabelText() {
56
    protected JTextComponent createLabelText() {
56
        if (fieldLabel == null) {
57
        if (this.fieldLabel == null) {
57
            this.fieldLabel = new JTextField();
58
            this.fieldLabel = new JTextField();
58
        }
59
        }
59
        return fieldLabel;
60
        return this.fieldLabel;
60
    }
61
    }
61
 
62
 
62
    @Override
63
    @Override
63
    protected JButton createSubmitBtn(final SQLRequestComboBox banqueSelect, final JDate dateDepot, final JCheckBox checkImpression, final JTextComponent text) {
64
    protected JButton createSubmitBtn(final SQLRequestComboBox banqueSelect, final JDate dateDepot, final JCheckBox checkImpression, final JTextComponent text) {
64
        final JButton res = new JButton("Valider le dépôt");
65
        final JButton res = new JButton("Valider le dépôt");
65
        res.addActionListener(new ActionListener() {
66
        res.addActionListener(new ActionListener() {
66
            @Override
67
            @Override
67
            public void actionPerformed(ActionEvent e) {
68
            public void actionPerformed(ActionEvent e) {
68
                final String s = text.getText();
69
                final String s = text.getText();
69
                SQLRowValues rowValsDepot = new SQLRowValues(element.getTable().getTable("DEPOT_CHEQUE"));
70
                SQLRowValues rowValsDepot = new SQLRowValues(ListeDesChequesAEncaisserPanel.this.element.getTable().getTable("DEPOT_CHEQUE"));
70
                rowValsDepot.put("DATE", dateDepot.getValue());
71
                rowValsDepot.put("DATE", dateDepot.getValue());
71
                rowValsDepot.put("NOM", fieldLabel.getText());
72
                rowValsDepot.put("NOM", ListeDesChequesAEncaisserPanel.this.fieldLabel.getText());
72
                final SQLRow selectedBanque = banqueSelect.getSelectedRow();
73
                final SQLRow selectedBanque = banqueSelect.getSelectedRow();
73
                if (selectedBanque != null) {
74
                if (selectedBanque != null) {
74
                    rowValsDepot.put("ID_" + selectedBanque.getTable().getName(), selectedBanque.getID());
75
                    rowValsDepot.put("ID_" + selectedBanque.getTable().getName(), selectedBanque.getID());
75
                }
76
                }
76
                List<SQLRowValues> chq = getListe().getSelectedRows();
77
                final List<SQLRow> chq = SQLRowListRSH.fetch(getListe().getRequest().getPrimaryTable(), getListe().getSelection().getSelectedIDs());
77
                for (SQLRowValues sqlRowValues : chq) {
78
                for (SQLRow rowChq : chq) {
78
                    SQLRow rowChq = sqlRowValues.asRow();
-
 
79
                    rowChq.fetchValues();
-
 
80
                    SQLRowValues rowValsDepotElt = new SQLRowValues(element.getTable().getTable("DEPOT_CHEQUE_ELEMENT"));
79
                    SQLRowValues rowValsDepotElt = new SQLRowValues(ListeDesChequesAEncaisserPanel.this.element.getTable().getTable("DEPOT_CHEQUE_ELEMENT"));
81
                    rowValsDepotElt.put("ID_DEPOT_CHEQUE", rowValsDepot);
80
                    rowValsDepotElt.put("ID_DEPOT_CHEQUE", rowValsDepot);
82
                    if (rowChq.getObject("ID_CLIENT") != null && !rowChq.isForeignEmpty("ID_CLIENT")) {
81
                    if (rowChq.getObject("ID_CLIENT") != null && !rowChq.isForeignEmpty("ID_CLIENT")) {
83
                        rowValsDepotElt.put("ID_CLIENT", rowChq.getForeignID("ID_CLIENT"));
82
                        rowValsDepotElt.put("ID_CLIENT", rowChq.getForeignID("ID_CLIENT"));
84
                    }
83
                    }
85
                    rowValsDepotElt.put("TIERS", rowChq.getString("TIERS"));
84
                    rowValsDepotElt.put("TIERS", rowChq.getString("TIERS"));
Line 94... Line 93...
94
                        rowValsDepotElt.put("PIECE", rowChq.getForeign("ID_MOUVEMENT").getForeign("ID_PIECE").getString("NOM"));
93
                        rowValsDepotElt.put("PIECE", rowChq.getForeign("ID_MOUVEMENT").getForeign("ID_PIECE").getString("NOM"));
95
                    }
94
                    }
96
                    rowValsDepotElt.put("NUMERO", (rowChq.getObject("NUMERO") == null ? "" : rowChq.getObject("NUMERO")));
95
                    rowValsDepotElt.put("NUMERO", (rowChq.getObject("NUMERO") == null ? "" : rowChq.getObject("NUMERO")));
97
                    rowValsDepotElt.put("MONTANT", rowChq.getObject("MONTANT"));
96
                    rowValsDepotElt.put("MONTANT", rowChq.getObject("MONTANT"));
98
                }
97
                }
99
                EditFrame frame = new EditFrame(element.getDirectory().getElement("DEPOT_CHEQUE"), EditMode.CREATION);
98
                EditFrame frame = new EditFrame(ListeDesChequesAEncaisserPanel.this.element.getDirectory().getElement("DEPOT_CHEQUE"), EditMode.CREATION);
100
                frame.getSQLComponent().select(rowValsDepot);
99
                frame.getSQLComponent().select(rowValsDepot);
101
                frame.setVisible(true);
100
                frame.setVisible(true);
102
                text.setText("");
101
                text.setText("");
103
            }
102
            }
104
        });
103
        });