Line 17... |
Line 17... |
17 |
import org.openconcerto.erp.core.finance.accounting.model.CurrencyConverter;
|
17 |
import org.openconcerto.erp.core.finance.accounting.model.CurrencyConverter;
|
18 |
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
|
18 |
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
|
19 |
import org.openconcerto.erp.core.sales.pos.io.BarcodeReader;
|
19 |
import org.openconcerto.erp.core.sales.pos.io.BarcodeReader;
|
20 |
import org.openconcerto.erp.core.sales.pos.ui.BarcodeListener;
|
20 |
import org.openconcerto.erp.core.sales.pos.ui.BarcodeListener;
|
21 |
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
|
21 |
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
|
- |
|
22 |
import org.openconcerto.erp.core.sales.product.element.UniteVenteArticleSQLElement;
|
22 |
import org.openconcerto.erp.core.sales.product.model.ProductComponent;
|
23 |
import org.openconcerto.erp.core.sales.product.model.ProductComponent;
|
23 |
import org.openconcerto.erp.core.sales.product.model.ProductHelper;
|
24 |
import org.openconcerto.erp.core.sales.product.model.ProductHelper;
|
24 |
import org.openconcerto.erp.core.sales.product.model.ProductHelper.TypePrice;
|
25 |
import org.openconcerto.erp.core.sales.product.model.ProductHelper.TypePrice;
|
25 |
import org.openconcerto.erp.core.sales.product.ui.ArticleRowValuesRenderer;
|
26 |
import org.openconcerto.erp.core.sales.product.ui.ArticleRowValuesRenderer;
|
26 |
import org.openconcerto.erp.core.sales.product.ui.CurrencyWithSymbolRenderer;
|
27 |
import org.openconcerto.erp.core.sales.product.ui.CurrencyWithSymbolRenderer;
|
27 |
import org.openconcerto.erp.core.sales.product.ui.QteMultipleRowValuesRenderer;
|
28 |
import org.openconcerto.erp.core.sales.product.ui.QteMultipleRowValuesRenderer;
|
28 |
import org.openconcerto.erp.core.sales.product.ui.QteUnitRowValuesRenderer;
|
29 |
import org.openconcerto.erp.core.sales.product.ui.QteUnitRowValuesRenderer;
|
- |
|
30 |
import org.openconcerto.erp.core.supplychain.stock.element.DepotStockSQLElement;
|
29 |
import org.openconcerto.erp.core.supplychain.stock.element.StockSQLElement;
|
31 |
import org.openconcerto.erp.core.supplychain.stock.element.StockSQLElement;
|
30 |
import org.openconcerto.erp.importer.ArrayTableModel;
|
32 |
import org.openconcerto.erp.importer.ArrayTableModel;
|
31 |
import org.openconcerto.erp.importer.DataImporter;
|
33 |
import org.openconcerto.erp.importer.DataImporter;
|
32 |
import org.openconcerto.erp.preferences.DefaultNXProps;
|
34 |
import org.openconcerto.erp.preferences.DefaultNXProps;
|
33 |
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel;
|
35 |
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel;
|
Line 56... |
Line 58... |
56 |
import org.openconcerto.sql.view.list.RowValuesTable;
|
58 |
import org.openconcerto.sql.view.list.RowValuesTable;
|
57 |
import org.openconcerto.sql.view.list.RowValuesTableModel;
|
59 |
import org.openconcerto.sql.view.list.RowValuesTableModel;
|
58 |
import org.openconcerto.sql.view.list.SQLTableElement;
|
60 |
import org.openconcerto.sql.view.list.SQLTableElement;
|
59 |
import org.openconcerto.sql.view.list.SQLTextComboTableCellEditor;
|
61 |
import org.openconcerto.sql.view.list.SQLTextComboTableCellEditor;
|
60 |
import org.openconcerto.sql.view.list.ValidStateChecker;
|
62 |
import org.openconcerto.sql.view.list.ValidStateChecker;
|
- |
|
63 |
import org.openconcerto.ui.preferences.DefaultProps;
|
61 |
import org.openconcerto.utils.CompareUtils;
|
64 |
import org.openconcerto.utils.CompareUtils;
|
62 |
import org.openconcerto.utils.DecimalUtils;
|
65 |
import org.openconcerto.utils.DecimalUtils;
|
63 |
import org.openconcerto.utils.StringUtils;
|
66 |
import org.openconcerto.utils.StringUtils;
|
64 |
import org.openconcerto.utils.Tuple3;
|
67 |
import org.openconcerto.utils.Tuple3;
|
65 |
import org.openconcerto.utils.cc.ITransformer;
|
68 |
import org.openconcerto.utils.cc.ITransformer;
|
Line 134... |
Line 137... |
134 |
|
137 |
|
135 |
SQLTableElement tableElementFacturable;
|
138 |
SQLTableElement tableElementFacturable;
|
136 |
protected SQLTableElement tableElementRemise;
|
139 |
protected SQLTableElement tableElementRemise;
|
137 |
|
140 |
|
138 |
public enum TypeCalcul {
|
141 |
public enum TypeCalcul {
|
139 |
CALCUL_FACTURABLE("MONTANT_FACTURABLE", "POURCENT_FACTURABLE"), CALCUL_REMISE("MONTANT_REMISE", "POURCENT_REMISE");
|
142 |
CALCUL_MONTANT_TOTAL("MONTANT_FACTURABLE", "POURCENT_FACTURABLE"), CALCUL_FACTURABLE("MONTANT_FACTURABLE", "POURCENT_FACTURABLE"), CALCUL_REMISE("MONTANT_REMISE", "POURCENT_REMISE");
|
140 |
|
143 |
|
141 |
String fieldMontant, fieldPourcent;
|
144 |
String fieldMontant, fieldPourcent;
|
142 |
|
145 |
|
143 |
TypeCalcul(String fieldMontant, String fieldPourcent) {
|
146 |
TypeCalcul(String fieldMontant, String fieldPourcent) {
|
144 |
this.fieldMontant = fieldMontant;
|
147 |
this.fieldMontant = fieldMontant;
|
Line 152... |
Line 155... |
152 |
public String getFieldPourcent() {
|
155 |
public String getFieldPourcent() {
|
153 |
return fieldPourcent;
|
156 |
return fieldPourcent;
|
154 |
}
|
157 |
}
|
155 |
};
|
158 |
};
|
156 |
|
159 |
|
- |
|
160 |
private Acompte acompteFacturer = null;
|
- |
|
161 |
|
157 |
public void calculPourcentage(final Acompte a, final TypeCalcul type) {
|
162 |
public void calculPourcentage(final Acompte a, final TypeCalcul type) {
|
- |
|
163 |
this.acompteFacturer = a;
|
158 |
Runnable r = new Runnable() {
|
164 |
Runnable r = new Runnable() {
|
159 |
|
165 |
|
160 |
@Override
|
166 |
@Override
|
161 |
public void run() {
|
167 |
public void run() {
|
162 |
SwingUtilities.invokeLater(new Runnable() {
|
168 |
SwingUtilities.invokeLater(new Runnable() {
|
Line 176... |
Line 182... |
176 |
model.putValue(a.getPercent(), i, type.getFieldPourcent());
|
182 |
model.putValue(a.getPercent(), i, type.getFieldPourcent());
|
177 |
model.putValue(null, i, type.getFieldMontant());
|
183 |
model.putValue(null, i, type.getFieldMontant());
|
178 |
tableElement.fireModification(model.getRowValuesAt(i));
|
184 |
tableElement.fireModification(model.getRowValuesAt(i));
|
179 |
}
|
185 |
}
|
180 |
} else {
|
186 |
} else {
|
181 |
// FIXME repartition du montant sur chaque ligne
|
- |
|
182 |
BigDecimal totalHT = BigDecimal.ZERO;
|
187 |
BigDecimal totalHT = getTotalHT(type);
|
183 |
for (SQLRowValues rowVals : getRowValuesAtLevel(1)) {
|
- |
|
184 |
int qte = rowVals.getInt("QTE");
|
- |
|
185 |
BigDecimal qteU = rowVals.getBigDecimal("QTE_UNITAIRE");
|
- |
|
186 |
BigDecimal pU = rowVals.getBigDecimal("PV_HT");
|
- |
|
187 |
|
- |
|
188 |
BigDecimal totalLine = pU.multiply(qteU, DecimalUtils.HIGH_PRECISION).multiply(new BigDecimal(qte), DecimalUtils.HIGH_PRECISION).setScale(2, RoundingMode.HALF_UP);
|
- |
|
189 |
|
- |
|
190 |
// BigDecimal lremise = (type == TypeCalcul.CALCUL_FACTURABLE ?
|
- |
|
191 |
// rowVals.getBigDecimal("POURCENT_REMISE") : BigDecimal.ZERO);
|
- |
|
192 |
//
|
- |
|
193 |
// if (lremise.compareTo(BigDecimal.ZERO) > 0 &&
|
- |
|
194 |
// lremise.compareTo(BigDecimal.valueOf(100)) < 100) {
|
- |
|
195 |
// totalLine =
|
- |
|
196 |
// totalLine.multiply(BigDecimal.valueOf(100).subtract(lremise),
|
- |
|
197 |
// DecimalUtils.HIGH_PRECISION).movePointLeft(2);
|
- |
|
198 |
// }
|
- |
|
199 |
if (type == TypeCalcul.CALCUL_FACTURABLE) {
|
- |
|
200 |
if (rowVals.getTable().getFieldsName().contains("MONTANT_REMISE")) {
|
- |
|
201 |
final BigDecimal acomptePercent = rowVals.getBigDecimal("POURCENT_REMISE");
|
- |
|
202 |
final BigDecimal acompteMontant = rowVals.getBigDecimal("MONTANT_REMISE");
|
- |
|
203 |
Remise remise = new Remise(acomptePercent, acompteMontant);
|
- |
|
204 |
totalLine = remise.getResultFrom(totalLine);
|
- |
|
205 |
}
|
- |
|
206 |
}
|
- |
|
207 |
totalHT = totalHT.add(totalLine);
|
- |
|
208 |
}
|
- |
|
209 |
|
- |
|
210 |
// BigDecimal percent = (totalHT.signum() != 0 ?
|
- |
|
211 |
// a.getMontant().divide(totalHT, DecimalUtils.HIGH_PRECISION) :
|
- |
|
212 |
// BigDecimal.ZERO);
|
- |
|
213 |
|
188 |
|
214 |
for (int i = 0; i < model.getRowCount(); i++) {
|
189 |
for (int i = 0; i < model.getRowCount(); i++) {
|
215 |
// Restrict to level 1
|
190 |
// Restrict to level 1
|
216 |
if (model.getRowValuesAt(i).getInt("NIVEAU") != 1) {
|
191 |
if (model.getRowValuesAt(i).getInt("NIVEAU") != 1) {
|
217 |
continue;
|
192 |
continue;
|
Line 222... |
Line 197... |
222 |
BigDecimal qteU = rowVals.getBigDecimal("QTE_UNITAIRE");
|
197 |
BigDecimal qteU = rowVals.getBigDecimal("QTE_UNITAIRE");
|
223 |
BigDecimal pU = rowVals.getBigDecimal("PV_HT");
|
198 |
BigDecimal pU = rowVals.getBigDecimal("PV_HT");
|
224 |
|
199 |
|
225 |
BigDecimal totalLine = pU.multiply(qteU, DecimalUtils.HIGH_PRECISION).multiply(new BigDecimal(qte), DecimalUtils.HIGH_PRECISION).setScale(2, RoundingMode.HALF_UP);
|
200 |
BigDecimal totalLine = pU.multiply(qteU, DecimalUtils.HIGH_PRECISION).multiply(new BigDecimal(qte), DecimalUtils.HIGH_PRECISION).setScale(2, RoundingMode.HALF_UP);
|
226 |
|
201 |
|
227 |
// BigDecimal lremise = (type == TypeCalcul.CALCUL_FACTURABLE ?
|
- |
|
228 |
// rowVals.getBigDecimal("POURCENT_REMISE") : BigDecimal.ZERO);
|
- |
|
229 |
//
|
- |
|
230 |
// if (lremise.compareTo(BigDecimal.ZERO) > 0 &&
|
- |
|
231 |
// lremise.compareTo(BigDecimal.valueOf(100)) < 100) {
|
- |
|
232 |
// totalLine =
|
- |
|
233 |
// totalLine.multiply(BigDecimal.valueOf(100).subtract(lremise),
|
- |
|
234 |
// DecimalUtils.HIGH_PRECISION).movePointLeft(2);
|
- |
|
235 |
// }
|
- |
|
236 |
if (rowVals.getTable().getFieldsName().contains("MONTANT_REMISE")) {
|
202 |
if (rowVals.getTable().getFieldsName().contains("MONTANT_REMISE")) {
|
237 |
final BigDecimal acomptePercent = rowVals.getBigDecimal("POURCENT_REMISE");
|
203 |
final BigDecimal acomptePercent = rowVals.getBigDecimal("POURCENT_REMISE");
|
238 |
final BigDecimal acompteMontant = rowVals.getBigDecimal("MONTANT_REMISE");
|
204 |
final BigDecimal acompteMontant = rowVals.getBigDecimal("MONTANT_REMISE");
|
239 |
Remise remise = new Remise(acomptePercent, acompteMontant);
|
205 |
Remise remise = new Remise(acomptePercent, acompteMontant);
|
240 |
totalLine = remise.getResultFrom(totalLine);
|
206 |
totalLine = remise.getResultFrom(totalLine);
|
Line 246... |
Line 212... |
246 |
tableElement.fireModification(model.getRowValuesAt(i));
|
212 |
tableElement.fireModification(model.getRowValuesAt(i));
|
247 |
}
|
213 |
}
|
248 |
}
|
214 |
}
|
249 |
model.fireTableDataChanged();
|
215 |
model.fireTableDataChanged();
|
250 |
}
|
216 |
}
|
- |
|
217 |
|
251 |
});
|
218 |
});
|
252 |
}
|
219 |
}
|
253 |
};
|
220 |
};
|
254 |
getModel().submit(r);
|
221 |
getModel().submit(r);
|
255 |
|
222 |
|
256 |
}
|
223 |
}
|
257 |
|
224 |
|
- |
|
225 |
public BigDecimal getTotalHT(final TypeCalcul type) {
|
- |
|
226 |
BigDecimal totalHT = BigDecimal.ZERO;
|
- |
|
227 |
for (SQLRowValues rowVals : getRowValuesAtLevel(1)) {
|
- |
|
228 |
int qte = rowVals.getInt("QTE");
|
- |
|
229 |
BigDecimal qteU = rowVals.getBigDecimal("QTE_UNITAIRE");
|
- |
|
230 |
BigDecimal pU = rowVals.getBigDecimal("PV_HT");
|
- |
|
231 |
|
- |
|
232 |
BigDecimal totalLine = pU.multiply(qteU, DecimalUtils.HIGH_PRECISION).multiply(new BigDecimal(qte), DecimalUtils.HIGH_PRECISION).setScale(2, RoundingMode.HALF_UP);
|
- |
|
233 |
|
- |
|
234 |
if (type == TypeCalcul.CALCUL_FACTURABLE || type == TypeCalcul.CALCUL_MONTANT_TOTAL) {
|
- |
|
235 |
if (rowVals.getTable().getFieldsName().contains("MONTANT_REMISE")) {
|
- |
|
236 |
final BigDecimal acomptePercent = rowVals.getBigDecimal("POURCENT_REMISE");
|
- |
|
237 |
final BigDecimal acompteMontant = rowVals.getBigDecimal("MONTANT_REMISE");
|
- |
|
238 |
Remise remise = new Remise(acomptePercent, acompteMontant);
|
- |
|
239 |
totalLine = remise.getResultFrom(totalLine);
|
- |
|
240 |
}
|
- |
|
241 |
}
|
- |
|
242 |
|
- |
|
243 |
if (type == TypeCalcul.CALCUL_MONTANT_TOTAL) {
|
- |
|
244 |
if (rowVals.getTable().getFieldsName().contains("POURCENT_FACTURABLE")) {
|
- |
|
245 |
final BigDecimal acomptePercent = rowVals.getBigDecimal("POURCENT_FACTURABLE");
|
- |
|
246 |
final BigDecimal acompteMontant = rowVals.getBigDecimal("MONTANT_FACTURABLE");
|
- |
|
247 |
Acompte acompte = new Acompte(acomptePercent, acompteMontant);
|
- |
|
248 |
totalLine = acompte.getResultFrom(totalLine);
|
- |
|
249 |
}
|
- |
|
250 |
}
|
- |
|
251 |
totalHT = totalHT.add(totalLine);
|
- |
|
252 |
}
|
- |
|
253 |
return totalHT;
|
- |
|
254 |
}
|
- |
|
255 |
|
258 |
private static Map<String, Boolean> visibilityMap = new HashMap<String, Boolean>();
|
256 |
private static Map<String, Boolean> visibilityMap = new HashMap<String, Boolean>();
|
259 |
|
257 |
|
260 |
public static Map<String, Boolean> getVisibilityMap() {
|
258 |
public static Map<String, Boolean> getVisibilityMap() {
|
261 |
return visibilityMap;
|
259 |
return visibilityMap;
|
262 |
}
|
260 |
}
|
Line 266... |
Line 264... |
266 |
|
264 |
|
267 |
protected void init() {
|
265 |
protected void init() {
|
268 |
|
266 |
|
269 |
SQLPreferences prefs = SQLPreferences.getMemCached(getSQLElement().getTable().getDBRoot());
|
267 |
SQLPreferences prefs = SQLPreferences.getMemCached(getSQLElement().getTable().getDBRoot());
|
270 |
final boolean selectArticle = prefs.getBoolean(GestionArticleGlobalPreferencePanel.USE_CREATED_ARTICLE, false);
|
268 |
final boolean selectArticle = prefs.getBoolean(GestionArticleGlobalPreferencePanel.USE_CREATED_ARTICLE, false);
|
- |
|
269 |
final boolean activeCalculM2 = prefs.getBoolean(GestionArticleGlobalPreferencePanel.ACTIVE_CALCUL_M2, false);
|
271 |
final boolean filterFamilleArticle = prefs.getBoolean(GestionArticleGlobalPreferencePanel.FILTER_BY_FAMILY, false);
|
270 |
final boolean filterFamilleArticle = prefs.getBoolean(GestionArticleGlobalPreferencePanel.FILTER_BY_FAMILY, false);
|
272 |
final boolean createAuto = prefs.getBoolean(GestionArticleGlobalPreferencePanel.CREATE_ARTICLE_AUTO, true);
|
271 |
final boolean createAuto = prefs.getBoolean(GestionArticleGlobalPreferencePanel.CREATE_ARTICLE_AUTO, true);
|
273 |
final boolean showEco = prefs.getBoolean(AbstractVenteArticleItemTable.SHOW_ECO_CONTRIBUTION_COLUMNS, false);
|
272 |
final boolean showEco = prefs.getBoolean(AbstractVenteArticleItemTable.SHOW_ECO_CONTRIBUTION_COLUMNS, false);
|
274 |
final boolean showDevise = prefs.getBoolean(AbstractVenteArticleItemTable.ARTICLE_SHOW_DEVISE, false);
|
273 |
final boolean showDevise = prefs.getBoolean(AbstractVenteArticleItemTable.ARTICLE_SHOW_DEVISE, false);
|
275 |
|
274 |
|
Line 479... |
Line 478... |
479 |
if (e.getTable().getFieldsName().contains("ECO_CONTRIBUTION")) {
|
478 |
if (e.getTable().getFieldsName().contains("ECO_CONTRIBUTION")) {
|
480 |
this.tableElementEco = new SQLTableElement(e.getTable().getField("ECO_CONTRIBUTION"));
|
479 |
this.tableElementEco = new SQLTableElement(e.getTable().getField("ECO_CONTRIBUTION"));
|
481 |
list.add(this.tableElementEco);
|
480 |
list.add(this.tableElementEco);
|
482 |
}
|
481 |
}
|
483 |
|
482 |
|
- |
|
483 |
SQLTableElement eltLongueur = new SQLTableElement(e.getTable().getField("LONGUEUR")) {
|
- |
|
484 |
@Override
|
- |
|
485 |
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) {
|
- |
|
486 |
|
- |
|
487 |
int idUv = vals.getForeignID("ID_UNITE_VENTE");
|
484 |
// // Prix d'achat HT de la métrique 1
|
488 |
return idUv == UniteVenteArticleSQLElement.M2;
|
- |
|
489 |
}
|
- |
|
490 |
};
|
- |
|
491 |
list.add(eltLongueur);
|
- |
|
492 |
|
- |
|
493 |
SQLTableElement eltLargeur = new SQLTableElement(e.getTable().getField("LARGEUR")) {
|
- |
|
494 |
@Override
|
- |
|
495 |
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) {
|
- |
|
496 |
|
- |
|
497 |
int idUv = vals.getForeignID("ID_UNITE_VENTE");
|
- |
|
498 |
return idUv == UniteVenteArticleSQLElement.M2;
|
- |
|
499 |
}
|
- |
|
500 |
};
|
- |
|
501 |
list.add(eltLargeur);
|
- |
|
502 |
|
- |
|
503 |
SQLTableElement eltHauteur = new SQLTableElement(e.getTable().getField("HAUTEUR"));
|
- |
|
504 |
list.add(eltHauteur);
|
485 |
|
505 |
|
486 |
SQLTableElement qteU = new SQLTableElement(e.getTable().getField("QTE_UNITAIRE"), BigDecimal.class) {
|
506 |
SQLTableElement qteU = new SQLTableElement(e.getTable().getField("QTE_UNITAIRE"), BigDecimal.class) {
|
487 |
@Override
|
507 |
@Override
|
488 |
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) {
|
508 |
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) {
|
489 |
|
509 |
|
490 |
SQLRowAccessor row = vals.getForeign("ID_UNITE_VENTE");
|
510 |
SQLRowAccessor row = vals.getForeign("ID_UNITE_VENTE");
|
491 |
if (row != null && !row.isUndefined() && row.getBoolean("A_LA_PIECE")) {
|
511 |
if (row != null && !row.isUndefined() && row.getBoolean("A_LA_PIECE")) {
|
492 |
return false;
|
512 |
return false;
|
- |
|
513 |
} else if (activeCalculM2 && row != null && !row.isUndefined() && row.getID() == UniteVenteArticleSQLElement.M2) {
|
- |
|
514 |
return false;
|
493 |
} else {
|
515 |
} else {
|
494 |
return super.isCellEditable(vals, rowIndex, columnIndex);
|
516 |
return super.isCellEditable(vals, rowIndex, columnIndex);
|
495 |
}
|
517 |
}
|
496 |
}
|
518 |
}
|
497 |
|
519 |
|
Line 598... |
Line 620... |
598 |
};
|
620 |
};
|
599 |
this.tableElementPoidsTotal.setEditable(false);
|
621 |
this.tableElementPoidsTotal.setEditable(false);
|
600 |
list.add(this.tableElementPoidsTotal);
|
622 |
list.add(this.tableElementPoidsTotal);
|
601 |
|
623 |
|
602 |
// Packaging
|
624 |
// Packaging
|
603 |
if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.ITEM_PACKAGING, false)) {
|
625 |
if (e.getTable().contains("POIDS_COLIS_NET") && prefs.getBoolean(GestionArticleGlobalPreferencePanel.ITEM_PACKAGING, false)) {
|
- |
|
626 |
|
- |
|
627 |
SQLTableElement tareColis = new SQLTableElement(e.getTable().getField("TARE"), BigDecimal.class) {
|
- |
|
628 |
@Override
|
- |
|
629 |
public TableCellRenderer getTableCellRenderer() {
|
- |
|
630 |
return new QteUnitRowValuesRenderer();
|
- |
|
631 |
}
|
- |
|
632 |
|
- |
|
633 |
};
|
- |
|
634 |
list.add(tareColis);
|
604 |
|
635 |
|
605 |
SQLTableElement poidsColis = new SQLTableElement(e.getTable().getField("POIDS_COLIS_NET"), BigDecimal.class) {
|
636 |
SQLTableElement poidsColis = new SQLTableElement(e.getTable().getField("POIDS_COLIS_NET"), BigDecimal.class) {
|
606 |
@Override
|
637 |
@Override
|
607 |
public TableCellRenderer getTableCellRenderer() {
|
638 |
public TableCellRenderer getTableCellRenderer() {
|
608 |
return new QteUnitRowValuesRenderer();
|
639 |
return new QteUnitRowValuesRenderer();
|
Line 625... |
Line 656... |
625 |
|
656 |
|
626 |
poidsColis.addModificationListener(totalPoidsColis);
|
657 |
poidsColis.addModificationListener(totalPoidsColis);
|
627 |
nbColis.addModificationListener(totalPoidsColis);
|
658 |
nbColis.addModificationListener(totalPoidsColis);
|
628 |
totalPoidsColis.setModifier(new CellDynamicModifier() {
|
659 |
totalPoidsColis.setModifier(new CellDynamicModifier() {
|
629 |
public Object computeValueFrom(final SQLRowValues row, SQLTableElement source) {
|
660 |
public Object computeValueFrom(final SQLRowValues row, SQLTableElement source) {
|
630 |
final Object o2 = row.getObject("POIDS_COLIS_NET");
|
661 |
final BigDecimal pdsColis = row.getBigDecimal("POIDS_COLIS_NET");
|
631 |
final Object o3 = row.getObject("NB_COLIS");
|
662 |
final Object o3 = row.getObject("NB_COLIS");
|
- |
|
663 |
|
632 |
if (o2 != null && o3 != null) {
|
664 |
BigDecimal pdsColisTotal = BigDecimal.ZERO;
|
- |
|
665 |
|
633 |
BigDecimal poids = (BigDecimal) o2;
|
666 |
if (pdsColis != null && o3 != null) {
|
634 |
int nb = (Integer) o3;
|
667 |
int nb = (Integer) o3;
|
635 |
return poids.multiply(new BigDecimal(nb), DecimalUtils.HIGH_PRECISION).setScale(totalPoidsColis.getDecimalDigits(), RoundingMode.HALF_UP);
|
668 |
pdsColisTotal = pdsColis.multiply(new BigDecimal(nb), DecimalUtils.HIGH_PRECISION);
|
636 |
} else {
|
- |
|
637 |
return row.getObject("T_POIDS_COLIS_NET");
|
- |
|
638 |
}
|
669 |
}
|
- |
|
670 |
return pdsColisTotal.setScale(totalPoidsColis.getDecimalDigits(), RoundingMode.HALF_UP);
|
- |
|
671 |
}
|
- |
|
672 |
});
|
- |
|
673 |
|
- |
|
674 |
final SQLTableElement totalPoidsBrut = new SQLTableElement(e.getTable().getField("T_POIDS_BRUT"), BigDecimal.class) {
|
- |
|
675 |
@Override
|
- |
|
676 |
public TableCellRenderer getTableCellRenderer() {
|
- |
|
677 |
return new QteUnitRowValuesRenderer();
|
- |
|
678 |
}
|
- |
|
679 |
|
- |
|
680 |
};
|
- |
|
681 |
list.add(totalPoidsBrut);
|
- |
|
682 |
|
- |
|
683 |
tareColis.addModificationListener(totalPoidsBrut);
|
- |
|
684 |
poidsColis.addModificationListener(totalPoidsBrut);
|
- |
|
685 |
nbColis.addModificationListener(totalPoidsBrut);
|
- |
|
686 |
this.tableElementPoidsTotal.addModificationListener(totalPoidsBrut);
|
- |
|
687 |
totalPoidsBrut.setModifier(new CellDynamicModifier() {
|
- |
|
688 |
public Object computeValueFrom(final SQLRowValues row, SQLTableElement source) {
|
- |
|
689 |
final BigDecimal tare = row.getBigDecimal("TARE");
|
- |
|
690 |
final int qte = row.getInt("QTE");
|
- |
|
691 |
final BigDecimal pdsColis = row.getBigDecimal("POIDS_COLIS_NET");
|
- |
|
692 |
final Object o3 = row.getObject("NB_COLIS");
|
- |
|
693 |
|
- |
|
694 |
BigDecimal pdsBrutTotal = BigDecimal.ZERO;
|
- |
|
695 |
|
- |
|
696 |
if (row.getObject("T_POIDS") != null) {
|
- |
|
697 |
pdsBrutTotal = new BigDecimal(row.getFloat("T_POIDS"));
|
- |
|
698 |
}
|
- |
|
699 |
|
- |
|
700 |
if (tare != null) {
|
- |
|
701 |
pdsBrutTotal = pdsBrutTotal.add(tare.multiply(new BigDecimal(qte)));
|
- |
|
702 |
}
|
- |
|
703 |
|
- |
|
704 |
if (pdsColis != null && o3 != null) {
|
- |
|
705 |
int nb = (Integer) o3;
|
- |
|
706 |
pdsBrutTotal = pdsBrutTotal.add(pdsColis.multiply(new BigDecimal(nb), DecimalUtils.HIGH_PRECISION));
|
- |
|
707 |
}
|
- |
|
708 |
return pdsBrutTotal.setScale(totalPoidsBrut.getDecimalDigits(), RoundingMode.HALF_UP);
|
639 |
}
|
709 |
}
|
640 |
});
|
710 |
});
|
641 |
|
711 |
|
642 |
}
|
712 |
}
|
643 |
|
713 |
|
Line 655... |
Line 725... |
655 |
};
|
725 |
};
|
656 |
CurrencyWithSymbolRenderer totalRenderer = new CurrencyWithSymbolRenderer();
|
726 |
CurrencyWithSymbolRenderer totalRenderer = new CurrencyWithSymbolRenderer();
|
657 |
totalRenderer.setHideZeroValue(true);
|
727 |
totalRenderer.setHideZeroValue(true);
|
658 |
this.totalHT.setRenderer(totalRenderer);
|
728 |
this.totalHT.setRenderer(totalRenderer);
|
659 |
this.totalHT.setEditable(false);
|
729 |
this.totalHT.setEditable(false);
|
- |
|
730 |
this.totalHA = new SQLTableElement(e.getTable().getField("T_PA_HT"), BigDecimal.class);
|
- |
|
731 |
|
660 |
if (e.getTable().getFieldsName().contains("MONTANT_FACTURABLE")) {
|
732 |
if (e.getTable().getFieldsName().contains("MONTANT_FACTURABLE")) {
|
661 |
// SQLTableElement tableElementAcompte = new
|
733 |
// SQLTableElement tableElementAcompte = new
|
662 |
// SQLTableElement(e.getTable().getField("POURCENT_ACOMPTE"));
|
734 |
// SQLTableElement(e.getTable().getField("POURCENT_ACOMPTE"));
|
663 |
// list.add(tableElementAcompte);
|
735 |
// list.add(tableElementAcompte);
|
664 |
|
736 |
|
Line 688... |
Line 760... |
688 |
label.setText(a.toPlainString(true));
|
760 |
label.setText(a.toPlainString(true));
|
689 |
return label;
|
761 |
return label;
|
690 |
}
|
762 |
}
|
691 |
});
|
763 |
});
|
692 |
tableElementFacturable.addModificationListener(this.totalHT);
|
764 |
tableElementFacturable.addModificationListener(this.totalHT);
|
- |
|
765 |
tableElementFacturable.addModificationListener(this.totalHA);
|
693 |
list.add(tableElementFacturable);
|
766 |
list.add(tableElementFacturable);
|
694 |
}
|
767 |
}
|
695 |
|
768 |
|
696 |
final SQLField fieldRemise = e.getTable().getField("POURCENT_REMISE");
|
769 |
final SQLField fieldRemise = e.getTable().getField("POURCENT_REMISE");
|
697 |
|
770 |
|
Line 736... |
Line 809... |
736 |
tableElementRG = new SQLTableElement(e.getTable().getField("POURCENT_RG"));
|
809 |
tableElementRG = new SQLTableElement(e.getTable().getField("POURCENT_RG"));
|
737 |
list.add(tableElementRG);
|
810 |
list.add(tableElementRG);
|
738 |
}
|
811 |
}
|
739 |
|
812 |
|
740 |
// Total HT
|
813 |
// Total HT
|
741 |
this.totalHA = new SQLTableElement(e.getTable().getField("T_PA_HT"), BigDecimal.class);
|
- |
|
742 |
this.totalHA.setRenderer(totalRenderer);
|
814 |
this.totalHA.setRenderer(totalRenderer);
|
743 |
this.totalHA.setEditable(false);
|
815 |
this.totalHA.setEditable(false);
|
744 |
list.add(this.totalHA);
|
816 |
list.add(this.totalHA);
|
745 |
|
817 |
|
746 |
if (showDevise) {
|
818 |
if (showDevise) {
|
Line 854... |
Line 926... |
854 |
|
926 |
|
855 |
this.defaultRowVals = new SQLRowValues(UndefinedRowValuesCache.getInstance().getDefaultRowValues(e.getTable()));
|
927 |
this.defaultRowVals = new SQLRowValues(UndefinedRowValuesCache.getInstance().getDefaultRowValues(e.getTable()));
|
856 |
defaultRowVals.put("ID_TAXE", TaxeCache.getCache().getFirstTaxe().getID());
|
928 |
defaultRowVals.put("ID_TAXE", TaxeCache.getCache().getFirstTaxe().getID());
|
857 |
defaultRowVals.put("CODE", "");
|
929 |
defaultRowVals.put("CODE", "");
|
858 |
defaultRowVals.put("NOM", "");
|
930 |
defaultRowVals.put("NOM", "");
|
- |
|
931 |
if (e.getTable().contains("ID_DEPOT_STOCK")) {
|
- |
|
932 |
DefaultProps props = DefaultNXProps.getInstance();
|
- |
|
933 |
Integer depotDefault = props.getIntProperty("DepotStockDefault", DepotStockSQLElement.DEFAULT_ID);
|
- |
|
934 |
this.defaultRowVals.put("ID_DEPOT_STOCK", depotDefault);
|
- |
|
935 |
}
|
- |
|
936 |
|
859 |
final RowValuesTableModel model = new RowValuesTableModel(e, list, e.getTable().getField("ID_TAXE"), false, defaultRowVals) {
|
937 |
final RowValuesTableModel model = new RowValuesTableModel(e, list, e.getTable().getField("ID_TAXE"), false, defaultRowVals) {
|
860 |
@Override
|
938 |
@Override
|
861 |
public void commitData() {
|
939 |
public void commitData() {
|
862 |
int size = getRowCount();
|
940 |
int size = getRowCount();
|
863 |
for (int i = 0; i < size; i++) {
|
941 |
for (int i = 0; i < size; i++) {
|
Line 866... |
Line 944... |
866 |
rowVals.put("PV_U_DEVISE", rowVals.getObject("PRIX_METRIQUE_VT_1"));
|
944 |
rowVals.put("PV_U_DEVISE", rowVals.getObject("PRIX_METRIQUE_VT_1"));
|
867 |
final BigDecimal globalQty = rowVals.getBigDecimal("QTE_UNITAIRE").multiply(new BigDecimal(rowVals.getInt("QTE")));
|
945 |
final BigDecimal globalQty = rowVals.getBigDecimal("QTE_UNITAIRE").multiply(new BigDecimal(rowVals.getInt("QTE")));
|
868 |
rowVals.put("PV_T_DEVISE", rowVals.getBigDecimal("PRIX_METRIQUE_VT_1").multiply(globalQty));
|
946 |
rowVals.put("PV_T_DEVISE", rowVals.getBigDecimal("PRIX_METRIQUE_VT_1").multiply(globalQty));
|
869 |
}
|
947 |
}
|
870 |
}
|
948 |
}
|
871 |
super.commitData();
|
949 |
super.commitData(true);
|
872 |
}
|
950 |
}
|
873 |
};
|
951 |
};
|
874 |
setModel(model);
|
952 |
setModel(model);
|
875 |
|
953 |
|
876 |
this.table = new RowValuesTable(model, getConfigurationFile());
|
954 |
this.table = new RowValuesTable(model, getConfigurationFile());
|
877 |
ToolTipManager.sharedInstance().unregisterComponent(this.table);
|
955 |
ToolTipManager.sharedInstance().unregisterComponent(this.table);
|
878 |
ToolTipManager.sharedInstance().unregisterComponent(this.table.getTableHeader());
|
956 |
ToolTipManager.sharedInstance().unregisterComponent(this.table.getTableHeader());
|
- |
|
957 |
if (getSQLElement().getTable().getName().equals("COMMANDE_CLIENT_ELEMENT")) {
|
- |
|
958 |
this.table.getClearCloneTableElement().add("QTE_LIVREE");
|
- |
|
959 |
this.table.getClearCloneTableElement().add("LIVRE");
|
- |
|
960 |
this.table.getClearCloneTableElement().add("LIVRE_FORCED");
|
- |
|
961 |
}
|
879 |
|
962 |
|
880 |
this.table.getTableHeader().addMouseListener(new MouseAdapter() {
|
963 |
this.table.getTableHeader().addMouseListener(new MouseAdapter() {
|
881 |
@Override
|
964 |
@Override
|
882 |
public void mousePressed(MouseEvent e) {
|
965 |
public void mousePressed(MouseEvent e) {
|
883 |
if (e.isPopupTrigger()) {
|
966 |
if (e.isPopupTrigger()) {
|
Line 923... |
Line 1006... |
923 |
final SQLTable sqlTableArticle = ((ComptaPropsConfiguration) Configuration.getInstance()).getRootSociete().getTable("ARTICLE");
|
1006 |
final SQLTable sqlTableArticle = ((ComptaPropsConfiguration) Configuration.getInstance()).getRootSociete().getTable("ARTICLE");
|
924 |
List<String> completionField = new ArrayList<String>();
|
1007 |
List<String> completionField = new ArrayList<String>();
|
925 |
if (e.getTable().getFieldsName().contains("ID_ECO_CONTRIBUTION")) {
|
1008 |
if (e.getTable().getFieldsName().contains("ID_ECO_CONTRIBUTION")) {
|
926 |
completionField.add("ID_ECO_CONTRIBUTION");
|
1009 |
completionField.add("ID_ECO_CONTRIBUTION");
|
927 |
}
|
1010 |
}
|
- |
|
1011 |
|
928 |
if (showDevise) {
|
1012 |
if (showDevise) {
|
929 |
completionField.add("CODE_DOUANIER");
|
1013 |
completionField.add("CODE_DOUANIER");
|
930 |
completionField.add("ID_PAYS");
|
1014 |
completionField.add("ID_PAYS");
|
931 |
}
|
1015 |
}
|
932 |
completionField.add("POURCENT_REMISE");
|
1016 |
completionField.add("POURCENT_REMISE");
|
Line 946... |
Line 1030... |
946 |
completionField.add("PRIX_METRIQUE_VT_1");
|
1030 |
completionField.add("PRIX_METRIQUE_VT_1");
|
947 |
completionField.add("PRIX_METRIQUE_VT_2");
|
1031 |
completionField.add("PRIX_METRIQUE_VT_2");
|
948 |
completionField.add("PRIX_METRIQUE_VT_3");
|
1032 |
completionField.add("PRIX_METRIQUE_VT_3");
|
949 |
completionField.add("SERVICE");
|
1033 |
completionField.add("SERVICE");
|
950 |
completionField.add("ID_FAMILLE_ARTICLE");
|
1034 |
completionField.add("ID_FAMILLE_ARTICLE");
|
- |
|
1035 |
completionField.add("LONGUEUR");
|
- |
|
1036 |
completionField.add("LARGEUR");
|
- |
|
1037 |
completionField.add("HAUTEUR");
|
951 |
if (getSQLElement().getTable().getFieldsName().contains("DESCRIPTIF")) {
|
1038 |
if (getSQLElement().getTable().getFieldsName().contains("DESCRIPTIF")) {
|
952 |
completionField.add("DESCRIPTIF");
|
1039 |
completionField.add("DESCRIPTIF");
|
953 |
}
|
1040 |
}
|
954 |
if (showDevise) {
|
1041 |
if (showDevise) {
|
955 |
completionField.add("ID_DEVISE");
|
1042 |
completionField.add("ID_DEVISE");
|
Line 957... |
Line 1044... |
957 |
}
|
1044 |
}
|
958 |
if (getSQLElement().getTable().getFieldsName().contains("QTE_ACHAT") && sqlTableArticle.getTable().getFieldsName().contains("QTE_ACHAT")) {
|
1045 |
if (getSQLElement().getTable().getFieldsName().contains("QTE_ACHAT") && sqlTableArticle.getTable().getFieldsName().contains("QTE_ACHAT")) {
|
959 |
completionField.add("QTE_ACHAT");
|
1046 |
completionField.add("QTE_ACHAT");
|
960 |
}
|
1047 |
}
|
961 |
|
1048 |
|
- |
|
1049 |
if (getSQLElement().getTable().getFieldsName().contains("POIDS_COLIS_NET") && sqlTableArticle.getTable().getFieldsName().contains("POIDS_COLIS_NET")) {
|
- |
|
1050 |
completionField.add("POIDS_COLIS_NET");
|
- |
|
1051 |
}
|
- |
|
1052 |
if (getSQLElement().getTable().getFieldsName().contains("TARE") && sqlTableArticle.getTable().getFieldsName().contains("TARE")) {
|
- |
|
1053 |
completionField.add("TARE");
|
- |
|
1054 |
}
|
- |
|
1055 |
|
962 |
final AutoCompletionManager m = new AutoCompletionManager(tableElementCode, sqlTableArticle.getField("CODE"), this.table, this.table.getRowValuesTableModel()) {
|
1056 |
final AutoCompletionManager m = new AutoCompletionManager(tableElementCode, sqlTableArticle.getField("CODE"), this.table, this.table.getRowValuesTableModel()) {
|
963 |
|
1057 |
|
964 |
@Override
|
1058 |
@Override
|
965 |
protected Object getValueFrom(SQLRow row, String field, SQLRowAccessor rowDest) {
|
1059 |
protected Object getValueFrom(SQLRow row, String field, SQLRowAccessor rowDest) {
|
966 |
Object res = tarifCompletion(row, field, rowDest, true);
|
1060 |
Object res = tarifCompletion(row, field, rowDest, true);
|
Line 1233... |
Line 1327... |
1233 |
}
|
1327 |
}
|
1234 |
}
|
1328 |
}
|
1235 |
|
1329 |
|
1236 |
BigDecimal fVT = (BigDecimal) row.getObject("PV_HT");
|
1330 |
BigDecimal fVT = (BigDecimal) row.getObject("PV_HT");
|
1237 |
BigDecimal r = b.multiply(fVT.multiply(BigDecimal.valueOf(qte), DecimalUtils.HIGH_PRECISION), DecimalUtils.HIGH_PRECISION);
|
1331 |
BigDecimal r = b.multiply(fVT.multiply(BigDecimal.valueOf(qte), DecimalUtils.HIGH_PRECISION), DecimalUtils.HIGH_PRECISION);
|
1238 |
if (lremise.compareTo(BigDecimal.ZERO) > 0 && lremise.compareTo(BigDecimal.valueOf(100)) < 100) {
|
1332 |
if (lremise.compareTo(BigDecimal.ZERO) > 0) {
|
1239 |
r = r.multiply(BigDecimal.valueOf(100).subtract(lremise), DecimalUtils.HIGH_PRECISION).movePointLeft(2);
|
1333 |
r = r.multiply(BigDecimal.valueOf(100).subtract(lremise), DecimalUtils.HIGH_PRECISION).movePointLeft(2);
|
1240 |
}
|
1334 |
}
|
1241 |
|
1335 |
|
1242 |
if (row.getTable().getFieldsName().contains("MONTANT_REMISE")) {
|
1336 |
if (row.getTable().getFieldsName().contains("MONTANT_REMISE")) {
|
1243 |
final BigDecimal acomptePercentR = row.getBigDecimal("POURCENT_REMISE");
|
1337 |
final BigDecimal acomptePercentR = row.getBigDecimal("POURCENT_REMISE");
|
1244 |
final BigDecimal acompteMontantR = row.getBigDecimal("MONTANT_REMISE");
|
1338 |
final BigDecimal acompteMontantR = row.getBigDecimal("MONTANT_REMISE");
|
1245 |
Remise remise = new Remise(acomptePercentR, acompteMontantR);
|
1339 |
Remise remise = new Remise(acomptePercentR, acompteMontantR);
|
1246 |
r = remise.getResultFrom(r);
|
1340 |
r = remise.getResultFrom(r);
|
- |
|
1341 |
// Si factrue d'avancement et remise =100% ou pv =0 alors on
|
- |
|
1342 |
// applique le
|
- |
|
1343 |
// ratio entre le montant facturer et le montant global
|
- |
|
1344 |
if (acompteMontant.signum() == 0 && (acomptePercentR != null && acomptePercentR.compareTo(BigDecimal.ONE.movePointRight(2)) == 0)) {
|
- |
|
1345 |
r = BigDecimal.ZERO;
|
- |
|
1346 |
BigDecimal totalHTGlobal = getTotalHT(TypeCalcul.CALCUL_FACTURABLE);
|
- |
|
1347 |
if (acompteFacturer != null && acompteFacturer.getMontant() != null && totalHTGlobal != null && totalHTGlobal.signum() != 0) {
|
- |
|
1348 |
rHA = rHA.multiply(acompteFacturer.getMontant().divide(totalHTGlobal, DecimalUtils.HIGH_PRECISION), DecimalUtils.HIGH_PRECISION);
|
- |
|
1349 |
}
|
- |
|
1350 |
}
|
1247 |
}
|
1351 |
}
|
1248 |
if (r.signum() != 0) {
|
1352 |
if (r.signum() != 0) {
|
1249 |
rHA = rHA.multiply(acompteMontant.divide(r, DecimalUtils.HIGH_PRECISION), DecimalUtils.HIGH_PRECISION);
|
1353 |
rHA = rHA.multiply(acompteMontant.divide(r, DecimalUtils.HIGH_PRECISION), DecimalUtils.HIGH_PRECISION);
|
1250 |
}
|
1354 |
}
|
1251 |
}
|
1355 |
}
|
Line 1362... |
Line 1466... |
1362 |
return b.multiply(new BigDecimal(f.floatValue() * qte)).floatValue();
|
1466 |
return b.multiply(new BigDecimal(f.floatValue() * qte)).floatValue();
|
1363 |
}
|
1467 |
}
|
1364 |
|
1468 |
|
1365 |
});
|
1469 |
});
|
1366 |
uniteVente.addModificationListener(qteU);
|
1470 |
uniteVente.addModificationListener(qteU);
|
- |
|
1471 |
eltLargeur.addModificationListener(qteU);
|
- |
|
1472 |
eltLongueur.addModificationListener(qteU);
|
1367 |
qteU.setModifier(new CellDynamicModifier() {
|
1473 |
qteU.setModifier(new CellDynamicModifier() {
|
1368 |
public Object computeValueFrom(SQLRowValues row, SQLTableElement source) {
|
1474 |
public Object computeValueFrom(SQLRowValues row, SQLTableElement source) {
|
1369 |
SQLRowAccessor rowUnite = row.getForeign("ID_UNITE_VENTE");
|
1475 |
SQLRowAccessor rowUnite = row.getForeign("ID_UNITE_VENTE");
|
1370 |
if (rowUnite != null && !rowUnite.isUndefined() && rowUnite.getBoolean("A_LA_PIECE")) {
|
1476 |
if (rowUnite != null && !rowUnite.isUndefined() && rowUnite.getBoolean("A_LA_PIECE")) {
|
1371 |
return BigDecimal.ONE;
|
1477 |
return BigDecimal.ONE;
|
- |
|
1478 |
} else if (activeCalculM2 && rowUnite != null && !rowUnite.isUndefined() && rowUnite.getID() == UniteVenteArticleSQLElement.M2) {
|
- |
|
1479 |
BigDecimal longueur = row.getBigDecimal("LONGUEUR");
|
- |
|
1480 |
BigDecimal largeur = row.getBigDecimal("LARGEUR");
|
- |
|
1481 |
if (longueur == null || largeur == null) {
|
- |
|
1482 |
return BigDecimal.ONE;
|
- |
|
1483 |
}
|
- |
|
1484 |
return longueur.multiply(largeur);
|
1372 |
} else {
|
1485 |
} else {
|
1373 |
return row.getObject("QTE_UNITAIRE");
|
1486 |
return row.getObject("QTE_UNITAIRE");
|
1374 |
}
|
1487 |
}
|
1375 |
}
|
1488 |
}
|
1376 |
|
1489 |
|
Line 1495... |
Line 1608... |
1495 |
setColumnVisible(model.getColumnForField("ID_ECO_CONTRIBUTION"), showEco);
|
1608 |
setColumnVisible(model.getColumnForField("ID_ECO_CONTRIBUTION"), showEco);
|
1496 |
setColumnVisible(model.getColumnForField("ECO_CONTRIBUTION"), showEco);
|
1609 |
setColumnVisible(model.getColumnForField("ECO_CONTRIBUTION"), showEco);
|
1497 |
setColumnVisible(model.getColumnForField("T_ECO_CONTRIBUTION"), showEco);
|
1610 |
setColumnVisible(model.getColumnForField("T_ECO_CONTRIBUTION"), showEco);
|
1498 |
}
|
1611 |
}
|
1499 |
|
1612 |
|
- |
|
1613 |
// ACtivation calcul m2
|
- |
|
1614 |
setColumnVisible(model.getColumnForField("HAUTEUR"), false);
|
- |
|
1615 |
setColumnVisible(model.getColumnForField("LARGEUR"), activeCalculM2);
|
- |
|
1616 |
setColumnVisible(model.getColumnForField("LONGUEUR"), activeCalculM2);
|
- |
|
1617 |
|
1500 |
// Gestion des unités de vente
|
1618 |
// Gestion des unités de vente
|
1501 |
final boolean gestionUV = prefs.getBoolean(GestionArticleGlobalPreferencePanel.UNITE_VENTE, true);
|
1619 |
final boolean gestionUV = prefs.getBoolean(GestionArticleGlobalPreferencePanel.UNITE_VENTE, true);
|
1502 |
setColumnVisible(model.getColumnForField("QTE_UNITAIRE"), gestionUV);
|
1620 |
setColumnVisible(model.getColumnForField("QTE_UNITAIRE"), gestionUV);
|
1503 |
setColumnVisible(model.getColumnForField("ID_UNITE_VENTE"), gestionUV);
|
1621 |
setColumnVisible(model.getColumnForField("ID_UNITE_VENTE"), gestionUV);
|
1504 |
|
1622 |
|
Line 1522... |
Line 1640... |
1522 |
setColumnVisible(model.getColumnForField("T_PA_HT"), showHAPrice);
|
1640 |
setColumnVisible(model.getColumnForField("T_PA_HT"), showHAPrice);
|
1523 |
|
1641 |
|
1524 |
|
1642 |
|
1525 |
setColumnVisible(model.getColumnForField("ID_DEPOT_STOCK"), prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_MULTI_DEPOT, false));
|
1643 |
setColumnVisible(model.getColumnForField("ID_DEPOT_STOCK"), prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_MULTI_DEPOT, false));
|
1526 |
|
1644 |
|
- |
|
1645 |
setColumnVisible(model.getColumnForField("T_POIDS_COLIS_NET"), false);
|
- |
|
1646 |
setColumnVisible(model.getColumnForField("T_POIDS_BRUT"), false);
|
- |
|
1647 |
|
1527 |
for (String string : visibilityMap.keySet()) {
|
1648 |
for (String string : visibilityMap.keySet()) {
|
1528 |
setColumnVisible(model.getColumnForField(string), visibilityMap.get(string));
|
1649 |
setColumnVisible(model.getColumnForField(string), visibilityMap.get(string));
|
1529 |
}
|
1650 |
}
|
1530 |
|
1651 |
|
1531 |
Map<String, Boolean> mapCustom = getCustomVisibilityMap();
|
1652 |
Map<String, Boolean> mapCustom = getCustomVisibilityMap();
|
Line 1796... |
Line 1917... |
1796 |
public void setClient(SQLRowAccessor rowClient, boolean ask) {
|
1917 |
public void setClient(SQLRowAccessor rowClient, boolean ask) {
|
1797 |
if (rowClient == null || getRowClient() == null || rowClient.getID() != getRowClient().getID()) {
|
1918 |
if (rowClient == null || getRowClient() == null || rowClient.getID() != getRowClient().getID()) {
|
1798 |
super.setClient(rowClient, ask);
|
1919 |
super.setClient(rowClient, ask);
|
1799 |
if (getRowClient() != null && !getRowClient().isUndefined()) {
|
1920 |
if (getRowClient() != null && !getRowClient().isUndefined()) {
|
1800 |
this.cacheRemise = getRowClient().getReferentRows(getSQLElement().getTable().getTable("TARIF_ARTICLE_CLIENT"));
|
1921 |
this.cacheRemise = getRowClient().getReferentRows(getSQLElement().getTable().getTable("TARIF_ARTICLE_CLIENT"));
|
1801 |
if (ask && getRowValuesTable().getRowCount() > 0
|
1922 |
if (ask && this.cacheRemise.size() > 0 && getRowValuesTable().getRowCount() > 0
|
1802 |
&& JOptionPane.showConfirmDialog(null, "Appliquer les remises associées au client sur les lignes déjà présentes?") == JOptionPane.YES_OPTION) {
|
1923 |
&& JOptionPane.showConfirmDialog(null, "Appliquer les remises associées au client sur les lignes déjà présentes?") == JOptionPane.YES_OPTION) {
|
1803 |
int nbRows = this.table.getRowCount();
|
1924 |
int nbRows = this.table.getRowCount();
|
1804 |
for (int i = 0; i < nbRows; i++) {
|
1925 |
for (int i = 0; i < nbRows; i++) {
|
1805 |
SQLRowValues rowVals = getRowValuesTable().getRowValuesTableModel().getRowValuesAt(i);
|
1926 |
SQLRowValues rowVals = getRowValuesTable().getRowValuesTableModel().getRowValuesAt(i);
|
1806 |
|
1927 |
|
Line 1828... |
Line 1949... |
1828 |
|
1949 |
|
1829 |
@Override
|
1950 |
@Override
|
1830 |
public void setTarif(SQLRowAccessor rowValuesTarif, boolean ask) {
|
1951 |
public void setTarif(SQLRowAccessor rowValuesTarif, boolean ask) {
|
1831 |
if (rowValuesTarif == null || getTarif() == null || rowValuesTarif.getID() != getTarif().getID()) {
|
1952 |
if (rowValuesTarif == null || getTarif() == null || rowValuesTarif.getID() != getTarif().getID()) {
|
1832 |
super.setTarif(rowValuesTarif, ask);
|
1953 |
super.setTarif(rowValuesTarif, ask);
|
1833 |
if (ask && getRowValuesTable().getRowCount() > 0
|
1954 |
if (ask && getRowValuesTable().getRowCount() > 0 && (rowValuesTarif == null || getTarif() == null || rowValuesTarif.isUndefined()
|
1834 |
&& JOptionPane.showConfirmDialog(null, "Appliquer les tarifs associés au client sur les lignes déjà présentes?") == JOptionPane.YES_OPTION) {
|
1955 |
|| JOptionPane.showConfirmDialog(null, "Appliquer les tarifs associés au client sur les lignes déjà présentes?") == JOptionPane.YES_OPTION)) {
|
1835 |
int nbRows = this.table.getRowCount();
|
1956 |
int nbRows = this.table.getRowCount();
|
1836 |
for (int i = 0; i < nbRows; i++) {
|
1957 |
for (int i = 0; i < nbRows; i++) {
|
1837 |
SQLRowValues rowVals = getRowValuesTable().getRowValuesTableModel().getRowValuesAt(i);
|
1958 |
SQLRowValues rowVals = getRowValuesTable().getRowValuesTableModel().getRowValuesAt(i);
|
1838 |
|
1959 |
|
1839 |
if (!rowVals.isForeignEmpty("ID_ARTICLE")) {
|
1960 |
if (!rowVals.isForeignEmpty("ID_ARTICLE")) {
|
Line 1863... |
Line 1984... |
1863 |
// if (o != null) {
|
1984 |
// if (o != null) {
|
1864 |
// return o;
|
1985 |
// return o;
|
1865 |
// }
|
1986 |
// }
|
1866 |
|
1987 |
|
1867 |
SQLRowAccessor rowA = row.getForeign("ID_ARTICLE");
|
1988 |
SQLRowAccessor rowA = row.getForeign("ID_ARTICLE");
|
- |
|
1989 |
|
1868 |
if (rowA != null && !rowA.isUndefined() && rowA.getTable().contains("AUTO_PRIX_MIN_VENTE_NOMENCLATURE") && rowA.getBoolean("AUTO_PRIX_MIN_VENTE_NOMENCLATURE")) {
|
1990 |
if (rowA != null && !rowA.isUndefined() && rowA.getTable().getDBRoot().contains("ARTICLE_PRIX_PUBLIC") && rowA.getTable().contains("AUTO_PRIX_MIN_VENTE_NOMENCLATURE")
|
- |
|
1991 |
&& rowA.getBoolean("AUTO_PRIX_MIN_VENTE_NOMENCLATURE")) {
|
1869 |
BigDecimal b = row.getBigDecimal("QTE_UNITAIRE");
|
1992 |
BigDecimal b = row.getBigDecimal("QTE_UNITAIRE");
|
1870 |
int q = row.getInt("QTE");
|
1993 |
int q = row.getInt("QTE");
|
1871 |
BigDecimal qteTotal = b.multiply(new BigDecimal(q), DecimalUtils.HIGH_PRECISION);
|
1994 |
BigDecimal qteTotal = b.multiply(new BigDecimal(q), DecimalUtils.HIGH_PRECISION);
|
1872 |
ProductHelper helper = new ProductHelper(rowA.getTable().getDBRoot());
|
1995 |
ProductHelper helper = new ProductHelper(rowA.getTable().getDBRoot());
|
1873 |
|
1996 |
|