Line 24... |
Line 24... |
24 |
|
24 |
|
25 |
public class FormatedGlobalQtyTotalProvider implements SpreadSheetCellValueProvider {
|
25 |
public class FormatedGlobalQtyTotalProvider implements SpreadSheetCellValueProvider {
|
26 |
|
26 |
|
27 |
private final boolean shortName, alwaysShowOnZeroQty, pieceName;
|
27 |
private final boolean shortName, alwaysShowOnZeroQty, pieceName;
|
28 |
|
28 |
|
29 |
private static enum Type {
|
29 |
public static enum Type {
|
30 |
NORMAL, SHIPMENT
|
30 |
NORMAL, SHIPMENT
|
31 |
}
|
31 |
}
|
32 |
|
32 |
|
33 |
private final Type type;
|
33 |
public final Type type;
|
34 |
|
34 |
|
35 |
private FormatedGlobalQtyTotalProvider(Type t, boolean shortName) {
|
35 |
private FormatedGlobalQtyTotalProvider(Type t, boolean shortName) {
|
36 |
this(t, shortName, false, false);
|
36 |
this(t, shortName, false, false);
|
37 |
}
|
37 |
}
|
38 |
|
38 |
|
Line 44... |
Line 44... |
44 |
}
|
44 |
}
|
45 |
|
45 |
|
46 |
public Object getValue(SpreadSheetCellValueContext context) {
|
46 |
public Object getValue(SpreadSheetCellValueContext context) {
|
47 |
final SQLRowAccessor row = context.getRow();
|
47 |
final SQLRowAccessor row = context.getRow();
|
48 |
final BigDecimal pv = row.getBigDecimal("PV_HT");
|
48 |
final BigDecimal pv = row.getBigDecimal("PV_HT");
|
49 |
if (!alwaysShowOnZeroQty && pv.compareTo(BigDecimal.ZERO) == 0) {
|
49 |
if (!this.alwaysShowOnZeroQty && pv.compareTo(BigDecimal.ZERO) == 0) {
|
50 |
return null;
|
50 |
return null;
|
51 |
}
|
51 |
}
|
52 |
|
52 |
|
53 |
final String field = this.type == Type.NORMAL ? "QTE" : "QTE_LIVREE";
|
53 |
final String field = this.type == Type.NORMAL ? "QTE" : "QTE_LIVREE";
|
54 |
if (row.getObject(field) == null) {
|
54 |
if (row.getObject(field) == null) {
|
Line 59... |
Line 59... |
59 |
|
59 |
|
60 |
if (!this.pieceName && row.getInt("ID_UNITE_VENTE") == UniteVenteArticleSQLElement.A_LA_PIECE) {
|
60 |
if (!this.pieceName && row.getInt("ID_UNITE_VENTE") == UniteVenteArticleSQLElement.A_LA_PIECE) {
|
61 |
return String.valueOf(qte);
|
61 |
return String.valueOf(qte);
|
62 |
}
|
62 |
}
|
63 |
String result = "";
|
63 |
String result = "";
|
64 |
if (qte > 0) {
|
64 |
if (this.alwaysShowOnZeroQty || qte != 0) {
|
65 |
if (qte > 1) {
|
- |
|
66 |
result += qte + " x ";
|
65 |
result += qte + " x ";
|
67 |
}
|
- |
|
68 |
final BigDecimal qteUV = row.getBigDecimal("QTE_UNITAIRE");
|
66 |
final BigDecimal qteUV = row.getBigDecimal("QTE_UNITAIRE");
|
69 |
|
67 |
|
70 |
result += NumericFormat.getQtyDecimalFormat().format(qteUV);
|
68 |
result += NumericFormat.getQtyDecimalFormat().format(qteUV);
|
71 |
final SQLRowAccessor rMode = row.getForeign("ID_UNITE_VENTE");
|
69 |
final SQLRowAccessor rMode = row.getForeign("ID_UNITE_VENTE");
|
72 |
result += " " + ((this.shortName) ? rMode.getString("CODE") : rMode.getString("NOM"));
|
70 |
result += " " + ((this.shortName) ? rMode.getString("CODE") : rMode.getString("NOM"));
|
Line 80... |
Line 78... |
80 |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.short.with.quantity", new FormatedGlobalQtyTotalProvider(Type.NORMAL, true, true, false));
|
78 |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.short.with.quantity", new FormatedGlobalQtyTotalProvider(Type.NORMAL, true, true, false));
|
81 |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.short", new FormatedGlobalQtyTotalProvider(Type.NORMAL, true));
|
79 |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.short", new FormatedGlobalQtyTotalProvider(Type.NORMAL, true));
|
82 |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit", new FormatedGlobalQtyTotalProvider(Type.NORMAL, false));
|
80 |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit", new FormatedGlobalQtyTotalProvider(Type.NORMAL, false));
|
83 |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.deliver.short", new FormatedGlobalQtyTotalProvider(Type.SHIPMENT, true));
|
81 |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.deliver.short", new FormatedGlobalQtyTotalProvider(Type.SHIPMENT, true));
|
84 |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.deliver", new FormatedGlobalQtyTotalProvider(Type.SHIPMENT, false));
|
82 |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.deliver", new FormatedGlobalQtyTotalProvider(Type.SHIPMENT, false));
|
85 |
|
- |
|
- |
|
83 |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.deliver.short.with.quantity", new FormatedGlobalQtyTotalProvider(Type.SHIPMENT, true, true, true));
|
86 |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.alwaysnamed.short.with.quantity", new FormatedGlobalQtyTotalProvider(Type.NORMAL, true, true, true));
|
84 |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.alwaysnamed.short.with.quantity", new FormatedGlobalQtyTotalProvider(Type.NORMAL, true, true, true));
|
87 |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.alwaysnamed.short", new FormatedGlobalQtyTotalProvider(Type.NORMAL, true, false, true));
|
85 |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.alwaysnamed.short", new FormatedGlobalQtyTotalProvider(Type.NORMAL, true, false, true));
|
88 |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.alwaysnamed", new FormatedGlobalQtyTotalProvider(Type.NORMAL, false, false, true));
|
86 |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.alwaysnamed", new FormatedGlobalQtyTotalProvider(Type.NORMAL, false, false, true));
|
89 |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.alwaysnamed.deliver.short", new FormatedGlobalQtyTotalProvider(Type.SHIPMENT, true, false, true));
|
87 |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.alwaysnamed.deliver.short", new FormatedGlobalQtyTotalProvider(Type.SHIPMENT, true, false, true));
|
90 |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.alwaysnamed.deliver", new FormatedGlobalQtyTotalProvider(Type.SHIPMENT, false, false, true));
|
88 |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.alwaysnamed.deliver", new FormatedGlobalQtyTotalProvider(Type.SHIPMENT, false, false, true));
|