Line 112... |
Line 112... |
112 |
SQLPreferences prefs = new SQLPreferences(getSQLElement().getTable().getDBRoot());
|
112 |
SQLPreferences prefs = new SQLPreferences(getSQLElement().getTable().getDBRoot());
|
113 |
final boolean selectArticle = prefs.getBoolean(GestionArticleGlobalPreferencePanel.USE_CREATED_ARTICLE, false);
|
113 |
final boolean selectArticle = prefs.getBoolean(GestionArticleGlobalPreferencePanel.USE_CREATED_ARTICLE, false);
|
114 |
final boolean createAuto = prefs.getBoolean(GestionArticleGlobalPreferencePanel.CREATE_ARTICLE_AUTO, true);
|
114 |
final boolean createAuto = prefs.getBoolean(GestionArticleGlobalPreferencePanel.CREATE_ARTICLE_AUTO, true);
|
115 |
final boolean filterFamilleArticle = prefs.getBoolean(GestionArticleGlobalPreferencePanel.FILTER_BY_FAMILY, false);
|
115 |
final boolean filterFamilleArticle = prefs.getBoolean(GestionArticleGlobalPreferencePanel.FILTER_BY_FAMILY, false);
|
116 |
final boolean showEco = prefs.getBoolean(AbstractVenteArticleItemTable.SHOW_ECO_CONTRIBUTION_COLUMNS, false);
|
116 |
final boolean showEco = prefs.getBoolean(AbstractVenteArticleItemTable.SHOW_ECO_CONTRIBUTION_COLUMNS, false);
|
- |
|
117 |
final boolean showDevise = prefs.getBoolean(AbstractVenteArticleItemTable.ARTICLE_SHOW_DEVISE, false);
|
117 |
|
118 |
|
118 |
final UserRights rights = UserRightsManager.getCurrentUserRights();
|
119 |
final UserRights rights = UserRightsManager.getCurrentUserRights();
|
119 |
final boolean editVTPrice = rights.haveRight(EDIT_PRIX_VENTE_CODE);
|
120 |
final boolean editVTPrice = rights.haveRight(EDIT_PRIX_VENTE_CODE);
|
120 |
final boolean showHAPrice = rights.haveRight(SHOW_PRIX_ACHAT_CODE);
|
121 |
final boolean showHAPrice = rights.haveRight(SHOW_PRIX_ACHAT_CODE);
|
121 |
final boolean lockVTMinPrice = rights.haveRight(LOCK_PRIX_MIN_VENTE_CODE);
|
122 |
final boolean lockVTMinPrice = rights.haveRight(LOCK_PRIX_MIN_VENTE_CODE);
|
Line 302... |
Line 303... |
302 |
list.add(this.tableElementEco);
|
303 |
list.add(this.tableElementEco);
|
303 |
}
|
304 |
}
|
304 |
|
305 |
|
305 |
SQLTableElement eltDevise = null;
|
306 |
SQLTableElement eltDevise = null;
|
306 |
SQLTableElement eltUnitDevise = null;
|
307 |
SQLTableElement eltUnitDevise = null;
|
307 |
if (DefaultNXProps.getInstance().getBooleanValue(ARTICLE_SHOW_DEVISE, false)) {
|
308 |
if (showDevise) {
|
308 |
// Devise
|
309 |
// Devise
|
309 |
eltDevise = new SQLTableElement(e.getTable().getField("ID_DEVISE"));
|
310 |
eltDevise = new SQLTableElement(e.getTable().getField("ID_DEVISE"));
|
310 |
list.add(eltDevise);
|
311 |
list.add(eltDevise);
|
311 |
|
312 |
|
312 |
// Prix vente devise
|
313 |
// Prix vente devise
|
Line 460... |
Line 461... |
460 |
|
461 |
|
461 |
// Service
|
462 |
// Service
|
462 |
// this.service = new SQLTableElement(e.getTable().getField("SERVICE"), Boolean.class);
|
463 |
// this.service = new SQLTableElement(e.getTable().getField("SERVICE"), Boolean.class);
|
463 |
// list.add(this.service);
|
464 |
// list.add(this.service);
|
464 |
|
465 |
|
465 |
if (DefaultNXProps.getInstance().getBooleanValue(ARTICLE_SHOW_DEVISE, false)) {
|
466 |
if (showDevise) {
|
466 |
// Total HT
|
467 |
// Total HT
|
467 |
this.tableElementTotalDevise = new SQLTableElement(e.getTable().getField("PV_T_DEVISE"), BigDecimal.class) {
|
468 |
this.tableElementTotalDevise = new SQLTableElement(e.getTable().getField("PV_T_DEVISE"), BigDecimal.class) {
|
468 |
@Override
|
469 |
@Override
|
469 |
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) {
|
470 |
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) {
|
470 |
return isCellNiveauEditable(vals, rowIndex, columnIndex);
|
471 |
return isCellNiveauEditable(vals, rowIndex, columnIndex);
|
Line 581... |
Line 582... |
581 |
|
582 |
|
582 |
SQLRowValues defautRow = new SQLRowValues(UndefinedRowValuesCache.getInstance().getDefaultRowValues(e.getTable()));
|
583 |
SQLRowValues defautRow = new SQLRowValues(UndefinedRowValuesCache.getInstance().getDefaultRowValues(e.getTable()));
|
583 |
defautRow.put("ID_TAXE", TaxeCache.getCache().getFirstTaxe().getID());
|
584 |
defautRow.put("ID_TAXE", TaxeCache.getCache().getFirstTaxe().getID());
|
584 |
defautRow.put("CODE", "");
|
585 |
defautRow.put("CODE", "");
|
585 |
defautRow.put("NOM", "");
|
586 |
defautRow.put("NOM", "");
|
586 |
final RowValuesTableModel model = new RowValuesTableModel(e, list, e.getTable().getField("NOM"), false, defautRow);
|
587 |
final RowValuesTableModel model = new RowValuesTableModel(e, list, e.getTable().getField("NOM"), false, defautRow) {
|
- |
|
588 |
@Override
|
- |
|
589 |
public void commitData() {
|
- |
|
590 |
int size = getRowCount();
|
- |
|
591 |
for (int i = 0; i < size; i++) {
|
- |
|
592 |
SQLRowValues rowVals = getRowValuesAt(i);
|
- |
|
593 |
if (rowVals.getObject("PV_U_DEVISE") == null) {
|
- |
|
594 |
rowVals.put("PV_U_DEVISE", rowVals.getObject("PRIX_METRIQUE_VT_1"));
|
- |
|
595 |
final BigDecimal globalQty = rowVals.getBigDecimal("QTE_UNITAIRE").multiply(new BigDecimal(rowVals.getInt("QTE")));
|
- |
|
596 |
rowVals.put("PV_T_DEVISE", rowVals.getBigDecimal("PRIX_METRIQUE_VT_1").multiply(globalQty));
|
- |
|
597 |
}
|
- |
|
598 |
}
|
- |
|
599 |
super.commitData();
|
- |
|
600 |
}
|
- |
|
601 |
};
|
587 |
this.setModel(model);
|
602 |
this.setModel(model);
|
588 |
this.table = new RowValuesTable(model, getConfigurationFile());
|
603 |
this.table = new RowValuesTable(model, getConfigurationFile());
|
589 |
ToolTipManager.sharedInstance().unregisterComponent(this.table);
|
604 |
ToolTipManager.sharedInstance().unregisterComponent(this.table);
|
590 |
ToolTipManager.sharedInstance().unregisterComponent(this.table.getTableHeader());
|
605 |
ToolTipManager.sharedInstance().unregisterComponent(this.table.getTableHeader());
|
591 |
|
606 |
|
Line 593... |
Line 608... |
593 |
((SQLTextComboTableCellEditor) tableElementArticle.getTableCellEditor(this.table)).setDynamicWhere(e.getTable().getTable("ARTICLE").getField("ID_FAMILLE_ARTICLE"));
|
608 |
((SQLTextComboTableCellEditor) tableElementArticle.getTableCellEditor(this.table)).setDynamicWhere(e.getTable().getTable("ARTICLE").getField("ID_FAMILLE_ARTICLE"));
|
594 |
}
|
609 |
}
|
595 |
|
610 |
|
596 |
List<String> completionField = new ArrayList<String>();
|
611 |
List<String> completionField = new ArrayList<String>();
|
597 |
final SQLTable sqlTableArticle = ((ComptaPropsConfiguration) Configuration.getInstance()).getRootSociete().getTable("ARTICLE");
|
612 |
final SQLTable sqlTableArticle = ((ComptaPropsConfiguration) Configuration.getInstance()).getRootSociete().getTable("ARTICLE");
|
598 |
if (DefaultNXProps.getInstance().getBooleanValue(ARTICLE_SHOW_DEVISE, false)) {
|
613 |
if (showDevise) {
|
599 |
|
- |
|
600 |
completionField.add("CODE_DOUANIER");
|
614 |
completionField.add("CODE_DOUANIER");
|
601 |
}
|
- |
|
602 |
if (DefaultNXProps.getInstance().getBooleanValue(ARTICLE_SHOW_DEVISE, false)) {
|
- |
|
603 |
completionField.add("ID_PAYS");
|
615 |
completionField.add("ID_PAYS");
|
604 |
}
|
616 |
}
|
605 |
if (e.getTable().getFieldsName().contains("ID_ECO_CONTRIBUTION")) {
|
617 |
if (e.getTable().getFieldsName().contains("ID_ECO_CONTRIBUTION")) {
|
606 |
completionField.add("ID_ECO_CONTRIBUTION");
|
618 |
completionField.add("ID_ECO_CONTRIBUTION");
|
607 |
}
|
619 |
}
|
608 |
completionField.add("ID_UNITE_VENTE");
|
620 |
completionField.add("ID_UNITE_VENTE");
|
- |
|
621 |
completionField.add("QTE_UNITAIRE");
|
609 |
completionField.add("PA_HT");
|
622 |
completionField.add("PA_HT");
|
610 |
completionField.add("PV_HT");
|
623 |
completionField.add("PV_HT");
|
611 |
completionField.add("ID_TAXE");
|
624 |
completionField.add("ID_TAXE");
|
612 |
completionField.add("POIDS");
|
625 |
completionField.add("POIDS");
|
613 |
completionField.add("PRIX_METRIQUE_HA_1");
|
626 |
completionField.add("PRIX_METRIQUE_HA_1");
|
Line 623... |
Line 636... |
623 |
completionField.add("SERVICE");
|
636 |
completionField.add("SERVICE");
|
624 |
completionField.add("ID_FAMILLE_ARTICLE");
|
637 |
completionField.add("ID_FAMILLE_ARTICLE");
|
625 |
if (getSQLElement().getTable().getFieldsName().contains("DESCRIPTIF")) {
|
638 |
if (getSQLElement().getTable().getFieldsName().contains("DESCRIPTIF")) {
|
626 |
completionField.add("DESCRIPTIF");
|
639 |
completionField.add("DESCRIPTIF");
|
627 |
}
|
640 |
}
|
628 |
if (DefaultNXProps.getInstance().getBooleanValue(ARTICLE_SHOW_DEVISE, false)) {
|
641 |
if (showDevise) {
|
629 |
completionField.add("ID_DEVISE");
|
642 |
completionField.add("ID_DEVISE");
|
630 |
}
|
- |
|
631 |
if (DefaultNXProps.getInstance().getBooleanValue(ARTICLE_SHOW_DEVISE, false)) {
|
- |
|
632 |
completionField.add("PV_U_DEVISE");
|
643 |
completionField.add("PV_U_DEVISE");
|
633 |
}
|
644 |
}
|
634 |
if (getSQLElement().getTable().getFieldsName().contains("QTE_ACHAT") && sqlTableArticle.getTable().getFieldsName().contains("QTE_ACHAT")) {
|
645 |
if (getSQLElement().getTable().getFieldsName().contains("QTE_ACHAT") && sqlTableArticle.getTable().getFieldsName().contains("QTE_ACHAT")) {
|
635 |
completionField.add("QTE_ACHAT");
|
646 |
completionField.add("QTE_ACHAT");
|
636 |
}
|
647 |
}
|
Line 927... |
Line 938... |
927 |
}
|
938 |
}
|
928 |
}
|
939 |
}
|
929 |
|
940 |
|
930 |
});
|
941 |
});
|
931 |
|
942 |
|
932 |
if (DefaultNXProps.getInstance().getBooleanValue(ARTICLE_SHOW_DEVISE, false)) {
|
943 |
if (showDevise) {
|
933 |
if (eltUnitDevise != null) {
|
944 |
if (eltUnitDevise != null) {
|
934 |
eltUnitDevise.addModificationListener(tableElement_PrixMetrique1_VenteHT);
|
945 |
eltUnitDevise.addModificationListener(tableElement_PrixMetrique1_VenteHT);
|
935 |
}
|
946 |
}
|
936 |
|
947 |
|
937 |
if (eltUnitDevise != null) {
|
948 |
if (eltUnitDevise != null) {
|
Line 1086... |
Line 1097... |
1086 |
final boolean gestionUV = prefs.getBoolean(GestionArticleGlobalPreferencePanel.UNITE_VENTE, true);
|
1097 |
final boolean gestionUV = prefs.getBoolean(GestionArticleGlobalPreferencePanel.UNITE_VENTE, true);
|
1087 |
setColumnVisible(model.getColumnForField("QTE_UNITAIRE"), gestionUV);
|
1098 |
setColumnVisible(model.getColumnForField("QTE_UNITAIRE"), gestionUV);
|
1088 |
setColumnVisible(model.getColumnForField("ID_UNITE_VENTE"), gestionUV);
|
1099 |
setColumnVisible(model.getColumnForField("ID_UNITE_VENTE"), gestionUV);
|
1089 |
|
1100 |
|
1090 |
setColumnVisible(model.getColumnForField("PRIX_METRIQUE_HA_1"), showHAPrice);
|
1101 |
setColumnVisible(model.getColumnForField("PRIX_METRIQUE_HA_1"), showHAPrice);
|
- |
|
1102 |
setColumnVisible(model.getColumnForField("MARGE_HT"), showHAPrice);
|
1091 |
setColumnVisible(model.getColumnForField("T_PA_HT"), showHAPrice);
|
1103 |
setColumnVisible(model.getColumnForField("T_PA_HT"), showHAPrice);
|
1092 |
|
1104 |
|
1093 |
if (e.getTable().contains("ID_COMMANDE_CLIENT_ELEMENT")) {
|
1105 |
if (e.getTable().contains("ID_COMMANDE_CLIENT_ELEMENT")) {
|
1094 |
setColumnVisible(model.getColumnForField("ID_COMMANDE_CLIENT_ELEMENT"), false);
|
1106 |
setColumnVisible(model.getColumnForField("ID_COMMANDE_CLIENT_ELEMENT"), false);
|
1095 |
}
|
1107 |
}
|