OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 169 Rev 181
Line 9... Line 9...
9
 
9
 
10
import javax.swing.JOptionPane;
10
import javax.swing.JOptionPane;
11
 
11
 
12
import org.openconcerto.erp.core.common.element.NumerotationAutoSQLElement;
12
import org.openconcerto.erp.core.common.element.NumerotationAutoSQLElement;
13
import org.openconcerto.erp.core.finance.accounting.element.EcritureSQLElement;
13
import org.openconcerto.erp.core.finance.accounting.element.EcritureSQLElement;
14
import org.openconcerto.erp.core.sales.invoice.element.SaisieVenteFactureSQLElement;
-
 
15
import org.openconcerto.erp.core.sales.invoice.report.VenteFactureXmlSheet;
14
import org.openconcerto.erp.core.sales.invoice.report.VenteFactureXmlSheet;
16
import org.openconcerto.erp.generationEcritures.GenerationMvtSaisieVenteFacture;
15
import org.openconcerto.erp.generationEcritures.GenerationMvtSaisieVenteFacture;
17
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
16
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
18
import org.openconcerto.sql.Configuration;
17
import org.openconcerto.sql.Configuration;
-
 
18
import org.openconcerto.sql.element.SQLElement;
19
import org.openconcerto.sql.model.IResultSetHandler;
19
import org.openconcerto.sql.model.IResultSetHandler;
20
import org.openconcerto.sql.model.SQLDataSource;
20
import org.openconcerto.sql.model.SQLDataSource;
21
import org.openconcerto.sql.model.SQLRow;
21
import org.openconcerto.sql.model.SQLRow;
22
import org.openconcerto.sql.model.SQLRowAccessor;
22
import org.openconcerto.sql.model.SQLRowAccessor;
23
import org.openconcerto.sql.model.SQLRowValues;
23
import org.openconcerto.sql.model.SQLRowValues;
Line 31... Line 31...
31
    public FacturesAboPanel() {
31
    public FacturesAboPanel() {
32
        super(Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE"), Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE_ELEMENT"), "FACTURE");
32
        super(Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE"), Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE_ELEMENT"), "FACTURE");
33
    }
33
    }
34
 
34
 
35
    private final SQLTable tableNum = Configuration.getInstance().getRoot().findTable("NUMEROTATION_AUTO");
35
    private final SQLTable tableNum = Configuration.getInstance().getRoot().findTable("NUMEROTATION_AUTO");
-
 
36
    private SQLElement eltFact = Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE");
36
 
37
 
37
    @Override
38
    @Override
38
    protected void validItem(SQLRowAccessor sqlRowAccessor) {
39
    protected void validItem(SQLRowAccessor sqlRowAccessor) {
39
        // Affectation d'un numero
40
        // Affectation d'un numero
40
        SQLRowValues rowVals = sqlRowAccessor.createEmptyUpdateRow();
41
        SQLRowValues rowVals = sqlRowAccessor.createEmptyUpdateRow();
41
        String nextNumero = NumerotationAutoSQLElement.getNextNumero(SaisieVenteFactureSQLElement.class);
42
        String nextNumero = NumerotationAutoSQLElement.getNextNumero(this.eltFact.getClass());
42
        rowVals.put("DATE", new Date());
43
        rowVals.put("DATE", new Date());
43
        rowVals.put("NUMERO", nextNumero);
44
        rowVals.put("NUMERO", nextNumero);
44
 
45
 
45
        SQLRowValues rowValsNum = new SQLRowValues(tableNum);
46
        SQLRowValues rowValsNum = new SQLRowValues(tableNum);
46
 
47
 
47
        String labelNumberFor = NumerotationAutoSQLElement.getLabelNumberFor(SaisieVenteFactureSQLElement.class);
48
        String labelNumberFor = NumerotationAutoSQLElement.getLabelNumberFor(this.eltFact.getClass());
48
        int val = tableNum.getRow(2).getInt(labelNumberFor);
49
        int val = tableNum.getRow(2).getInt(labelNumberFor);
49
        val++;
50
        val++;
50
        rowValsNum.put(labelNumberFor, Integer.valueOf(val));
51
        rowValsNum.put(labelNumberFor, Integer.valueOf(val));
51
 
52
 
52
        if (!checkUniciteNumero(nextNumero, sqlRowAccessor.getID())) {
53
        if (!checkUniciteNumero(nextNumero, sqlRowAccessor.getID())) {
Line 107... Line 108...
107
    }
108
    }
108
 
109
 
109
    @Override
110
    @Override
110
    protected void injectRow(SQLRow row, SQLRowValues rowVals, Date dateNew, SQLRow rowAbonnement) {
111
    protected void injectRow(SQLRow row, SQLRowValues rowVals, Date dateNew, SQLRow rowAbonnement) {
111
        super.injectRow(row, rowVals, dateNew, rowAbonnement);
112
        super.injectRow(row, rowVals, dateNew, rowAbonnement);
112
        rowVals.put("NUMERO", "ABO--" + NumerotationAutoSQLElement.getNextNumero(SaisieVenteFactureSQLElement.class));
113
        rowVals.put("NUMERO", "ABO--" + NumerotationAutoSQLElement.getNextNumero(this.eltFact.getClass()));
113
        rowVals.put("ID_ADRESSE", row.getObject("ID_ADRESSE"));
114
        rowVals.put("ID_ADRESSE", row.getObject("ID_ADRESSE"));
114
        rowVals.put("ID_COMPTE_PCE_SERVICE", row.getObject("ID_COMPTE_PCE_SERVICE"));
115
        rowVals.put("ID_COMPTE_PCE_SERVICE", row.getObject("ID_COMPTE_PCE_SERVICE"));
115
        rowVals.put("PORT_HT", row.getObject("PORT_HT"));
116
        rowVals.put("PORT_HT", row.getObject("PORT_HT"));
116
        rowVals.put("NET_A_PAYER", row.getObject("T_TTC"));
117
        rowVals.put("NET_A_PAYER", row.getObject("T_TTC"));
117
        rowVals.put("REMISE_HT", row.getObject("REMISE_HT"));
118
        rowVals.put("REMISE_HT", row.getObject("REMISE_HT"));