OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 174 Rev 177
Line 57... Line 57...
57
import java.awt.event.ActionEvent;
57
import java.awt.event.ActionEvent;
58
import java.math.BigDecimal;
58
import java.math.BigDecimal;
59
import java.sql.SQLException;
59
import java.sql.SQLException;
60
import java.util.ArrayList;
60
import java.util.ArrayList;
61
import java.util.Collection;
61
import java.util.Collection;
62
import java.util.HashMap;
-
 
63
import java.util.List;
62
import java.util.List;
64
import java.util.Map;
-
 
65
import java.util.Set;
63
import java.util.Set;
66
 
64
 
67
import javax.swing.AbstractAction;
65
import javax.swing.AbstractAction;
68
 
66
 
69
import org.apache.commons.dbutils.handlers.ArrayListHandler;
67
import org.apache.commons.dbutils.handlers.ArrayListHandler;
Line 214... Line 212...
214
        l.add("PV_HT");
212
        l.add("PV_HT");
215
            l.add("ID_TAXE");
213
            l.add("ID_TAXE");
216
        l.add("PV_TTC");
214
        l.add("PV_TTC");
217
        l.add("ID_FAMILLE_ARTICLE");
215
        l.add("ID_FAMILLE_ARTICLE");
218
        l.add("ID_FOURNISSEUR");
216
        l.add("ID_FOURNISSEUR");
-
 
217
        l.add("POIDS");
219
        l.add("SKU");
218
        l.add("SKU");
220
 
219
 
221
        // if (!prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_MULTI_DEPOT, false)) {
220
        // if (!prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_MULTI_DEPOT, false)) {
222
        l.add("GESTION_STOCK");
221
        l.add("GESTION_STOCK");
223
        l.add("ID_STOCK");
222
        l.add("ID_STOCK");
Line 248... Line 247...
248
        if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.SHOW_PRODUCT_BAR_CODE, false)) {
247
        if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.SHOW_PRODUCT_BAR_CODE, false)) {
249
            l.add("CODE_BARRE");
248
            l.add("CODE_BARRE");
250
        }
249
        }
251
 
250
 
252
        l.add("NOM");
251
        l.add("NOM");
-
 
252
        l.add("PA_HT");
-
 
253
        l.add("PV_HT");
-
 
254
        l.add("DERNIER_DATE_ACHAT");
253
        return l;
255
        return l;
254
    }
256
    }
255
 
257
 
256
    /*
258
    /*
257
     * (non-Javadoc)
259
     * (non-Javadoc)
Line 539... Line 541...
539
        super._initComboRequest(req);
541
        super._initComboRequest(req);
540
        req.addToGraphToFetch("ID_DEPOT_STOCK");
542
        req.addToGraphToFetch("ID_DEPOT_STOCK");
541
        // req.addForeignToGraphToFetch("ID_DEPOT_STOCK", Arrays.asList("ID"));
543
        // req.addForeignToGraphToFetch("ID_DEPOT_STOCK", Arrays.asList("ID"));
542
    }
544
    }
543
 
545
 
-
 
546
    static public void updateDateAchat(final SQLTable tableArticle, final SQLRow article) {
-
 
547
 
-
 
548
        assert article == null || article.getTable() == tableArticle;
-
 
549
        SQLTable tableTarifF = tableArticle.getTable("ARTICLE_TARIF_FOURNISSEUR");
-
 
550
        String up = "UPDATE " + tableArticle.getSQLName().quote() + " a SET " + tableArticle.getField("DERNIER_DATE_ACHAT").getQuotedName();
-
 
551
        up += " =(select MAX(" + tableTarifF.getField("DATE_PRIX").getQuotedName() + ")  ";
-
 
552
        up += " FROM " + tableTarifF.getSQLName().quote() + "  t" + " WHERE (t." + tableTarifF.getKey().getQuotedName() + " <> 1) ";
-
 
553
        up += " AND (t." + tableTarifF.getField("ARCHIVE").getQuotedName() + " = 0) ";
-
 
554
        up += "AND t." + tableTarifF.getField("ID_ARTICLE").getQuotedName() + " = " + (article == null ? "a." + tableArticle.getKey().getQuotedName() : article.getID()) + ")";
-
 
555
        if (article != null) {
-
 
556
            up += "WHERE " + tableArticle.getKey().getQuotedName() + " = " + article.getID();
-
 
557
        }
-
 
558
 
-
 
559
        tableArticle.getDBSystemRoot().getDataSource().execute(up);
-
 
560
    }
-
 
561
 
544
}
562
}