OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 76 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
76 ilm 1
/*
2
 * Créé le 18 mai 2012
3
 */
4
package org.openconcerto.modules.subscription.panel;
5
 
6
import java.sql.SQLException;
7
import java.util.Date;
8
import java.util.List;
9
 
10
import org.openconcerto.erp.core.common.element.NumerotationAutoSQLElement;
11
import org.openconcerto.erp.core.sales.order.report.CommandeClientXmlSheet;
12
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
13
import org.openconcerto.sql.Configuration;
181 ilm 14
import org.openconcerto.sql.element.SQLElement;
76 ilm 15
import org.openconcerto.sql.model.SQLRow;
16
import org.openconcerto.sql.model.SQLRowValues;
17
import org.openconcerto.sql.model.SQLTable;
18
import org.openconcerto.sql.view.list.RowAction;
19
 
20
public class BonCommandeAboPanel extends AboPanel {
21
 
22
    public BonCommandeAboPanel() {
23
 
24
        super(Configuration.getInstance().getDirectory().getElement("COMMANDE_CLIENT"), Configuration.getInstance().getDirectory().getElement("COMMANDE_CLIENT_ELEMENT"), "COMMANDE");
25
 
26
    }
27
 
28
    private SQLTable tableNum = Configuration.getInstance().getRoot().findTable("NUMEROTATION_AUTO");
181 ilm 29
    private SQLElement eltCmd = Configuration.getInstance().getDirectory().getElement("COMMANDE_CLIENT");
76 ilm 30
 
31
    @Override
32
    protected void injectRow(SQLRow row, SQLRowValues rowVals, Date dateNew, SQLRow rowAbonnement) {
33
        // TODO Raccord de méthode auto-généré
34
        super.injectRow(row, rowVals, dateNew, rowAbonnement);
181 ilm 35
        rowVals.put("NUMERO", NumerotationAutoSQLElement.getNextNumero(this.eltCmd.getClass()));
76 ilm 36
        // incrémentation du numéro auto
37
        final SQLRowValues rowValsNum = new SQLRowValues(this.tableNum);
181 ilm 38
        int val = this.tableNum.getRow(2).getInt(NumerotationAutoSQLElement.getLabelNumberFor(this.eltCmd.getClass()));
76 ilm 39
        val++;
181 ilm 40
        rowValsNum.put(NumerotationAutoSQLElement.getLabelNumberFor(this.eltCmd.getClass()), new Integer(val));
76 ilm 41
        try {
42
            rowValsNum.update(2);
43
        } catch (final SQLException e) {
44
            e.printStackTrace();
45
        }
46
 
47
        rowVals.put("NOM", row.getObject("NOM"));
48
        rowVals.put("T_POIDS", row.getObject("T_POIDS"));
49
    }
50
 
51
    @Override
52
    protected List<RowAction> getAdditionnalRowActions() {
53
        return new MouseSheetXmlListeListener(CommandeClientXmlSheet.class).getRowActions();
54
    }
55
 
56
}