OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Compare Revisions

Regard whitespace Rev 179 → Rev 180

/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/table/FacturationCommandeTable.java
20,6 → 20,7
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.UndefinedRowValuesCache;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.request.ComboSQLRequest;
32,6 → 33,7
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.table.PercentTableCellRenderer;
import org.openconcerto.ui.table.TimestampTableCellEditor;
import org.openconcerto.ui.table.XTableColumnModel;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
40,7 → 42,9
import java.math.BigDecimal;
import java.sql.Date;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;
 
import javax.swing.JButton;
55,6 → 59,12
private RowValuesTableModel model;
private SQLComponent comp;
 
public static Map<String, Boolean> map = new HashMap<String, Boolean>();
 
protected Map<String, Boolean> getCustomVisibilityMap() {
return map;
}
 
public FacturationCommandeTable(SQLComponent comp) {
this.comp = comp;
init();
89,6 → 99,7
final SQLTableElement comptant = new SQLTableElement(e.getTable().getField("COMPTANT"));
list.add(comptant);
 
// TODO fix return value of timestamp if not show hour return date object
final SQLTableElement date = new SQLTableElement(e.getTable().getField("DATE_PREVISIONNELLE"), Date.class, new TimestampTableCellEditor(false) {
@Override
public Object getCellEditorValue() {
110,30 → 121,21
ToolTipManager.sharedInstance().unregisterComponent(this.table);
ToolTipManager.sharedInstance().unregisterComponent(this.table.getTableHeader());
 
// Autocompletion
// AutoCompletionManager m = new AutoCompletionManager(tableElementNom,
// ((ComptaPropsConfiguration)
// Configuration.getInstance()).getSQLBaseSociete().getField("ECHANTILLON.NOM"), this.table,
// this.table.getRowValuesTableModel());
// m.fill("NOM", "NOM");
// m.fill("PV_HT", "PV_HT");
Map<String, Boolean> mapCustom = getCustomVisibilityMap();
if (mapCustom != null) {
for (String string : mapCustom.keySet()) {
setColumnVisible(model.getColumnForField(string), mapCustom.get(string));
}
}
 
// // Calcul automatique du total HT
// qteElement.addModificationListener(this.totalHT);
// this.pvHT.addModificationListener(this.totalHT);
// this.totalHT.setModifier(new CellDynamicModifier() {
// public Object computeValueFrom(final SQLRowValues row, SQLTableElement source) {
// System.out.println("Compute totalHT");
//
// int qte = Integer.parseInt(row.getObject("QTE").toString());
// BigDecimal f = row.getBigDecimal("PV_HT");
// BigDecimal r = f.multiply(new BigDecimal(qte), DecimalUtils.HIGH_PRECISION);
// return r;
// }
//
// });
}
 
protected void setColumnVisible(int col, boolean visible) {
if (col >= 0) {
XTableColumnModel columnModel = this.table.getColumnModel();
columnModel.setColumnVisible(columnModel.getColumnByModelIndex(col), visible);
}
}
 
/**
*
152,7 → 154,7
this.add(new JLabel("Ajouter un terme"), c);
 
final ElementComboBox boxCat = new ElementComboBox();
final SQLElement element = Configuration.getInstance().getDirectory().getElement("FACTURATION_COMMANDE_CLIENT");
final SQLElement element = getSQLElement();
ComboSQLRequest req = element.getComboRequest(true);
req.setWhere(new Where(element.getTable().getField("CHOICE"), "=", Boolean.TRUE));
boxCat.init(element, req);
178,10 → 180,13
return;
}
 
SQLRowValues rowVals = new SQLRowValues(Configuration.getInstance().getBase().getTable("FACTURATION_COMMANDE_CLIENT"));
if (comp.getSelectedID() > 1) {
final SQLTable table2 = getSQLElement().getTable();
SQLRowValues rowVals = new SQLRowValues(table2);
if (table2.getName().equals("FACTURATION_COMMANDE_CLIENT")) {
if (comp != null && comp.getSelectedID() > 1) {
rowVals.put("ID_COMMANDE_CLIENT", comp.getSelectedID());
}
}
rowVals.put("NOM", rowCat.getObject("NOM"));
rowVals.put("ID_TYPE_REGLEMENT", rowCat.getObject("ID_TYPE_REGLEMENT"));
rowVals.put("AJOURS", rowCat.getObject("AJOURS"));