Sistemare val premio nell'importazione dei listini di apulia e aggiunta possibilità di importare la percentuale del premio
This commit is contained in:
@@ -368,6 +368,8 @@ public class ImportListiniAcquistoApuliaCarrefourService {
|
|||||||
|
|
||||||
String existHeader = setup.get("EXIST_HEADER");
|
String existHeader = setup.get("EXIST_HEADER");
|
||||||
boolean importPrezzoNetto = UtilityHashMap.getValueIfExists(setup, "PREZZO_NETTO", "S").equalsIgnoreCase("S");
|
boolean importPrezzoNetto = UtilityHashMap.getValueIfExists(setup, "PREZZO_NETTO", "S").equalsIgnoreCase("S");
|
||||||
|
boolean setPercPremio = UtilityHashMap.getValueIfExists(setup, "SET_PERC_PREMIO", "S").equalsIgnoreCase("S");
|
||||||
|
String valPremioString = UtilityHashMap.getValueIfExists(setup, "VAL_PREMIO");
|
||||||
BigDecimal percMaggPrzBase = BigDecimal.ZERO;
|
BigDecimal percMaggPrzBase = BigDecimal.ZERO;
|
||||||
if (!UtilityString.isNullOrEmpty(setup.get("PERC_MAGG_PRZ_BASE"))) {
|
if (!UtilityString.isNullOrEmpty(setup.get("PERC_MAGG_PRZ_BASE"))) {
|
||||||
percMaggPrzBase = new BigDecimal(setup.get("PERC_MAGG_PRZ_BASE"));
|
percMaggPrzBase = new BigDecimal(setup.get("PERC_MAGG_PRZ_BASE"));
|
||||||
@@ -562,8 +564,12 @@ public class ImportListiniAcquistoApuliaCarrefourService {
|
|||||||
|
|
||||||
String columnPrzAcq = "CAST(REPLACE(tabp.prz_acq, ',', '.') AS NUMERIC(20, 5)) ";
|
String columnPrzAcq = "CAST(REPLACE(tabp.prz_acq, ',', '.') AS NUMERIC(20, 5)) ";
|
||||||
String columnValPremio = "CAST(0 AS NUMERIC)";
|
String columnValPremio = "CAST(0 AS NUMERIC)";
|
||||||
|
String columnPercPremio = "CAST(0 AS NUMERIC)";
|
||||||
if (!importPrezzoNetto)
|
if (!importPrezzoNetto)
|
||||||
columnValPremio = "case when premi.cod_art_for IS not null AND premi.prz_acq_netto <> 0 then [COLUMN_PRZ_ACQ] - premi.prz_acq_netto ELSE 0 END ";
|
if (setPercPremio)
|
||||||
|
columnPercPremio = "case when premi.cod_art_for IS not null AND premi.prz_acq_netto <> 0 then " + valPremioString +" ELSE 0 END ";
|
||||||
|
else
|
||||||
|
columnValPremio = "case when premi.cod_art_for IS not null AND premi.prz_acq_netto <> 0 then [COLUMN_PRZ_ACQ] - premi.prz_acq_netto ELSE 0 END ";
|
||||||
|
|
||||||
sql =
|
sql =
|
||||||
"INSERT INTO mtb_lisa_apulia_succ\n" +
|
"INSERT INTO mtb_lisa_apulia_succ\n" +
|
||||||
@@ -651,7 +657,7 @@ public class ImportListiniAcquistoApuliaCarrefourService {
|
|||||||
" CASE\n" +
|
" CASE\n" +
|
||||||
" WHEN [MAGG_PRZ] = 0 THEN 0\n" +
|
" WHEN [MAGG_PRZ] = 0 THEN 0\n" +
|
||||||
" ELSE [COLUMN_PRZ_ACQ] * (1 + [MAGG_PRZ] / 100) END AS prz_base_prop,\n" +
|
" ELSE [COLUMN_PRZ_ACQ] * (1 + [MAGG_PRZ] / 100) END AS prz_base_prop,\n" +
|
||||||
" CAST(0 AS NUMERIC) AS perc_premio,\n" +
|
" [COLUMN_PERC_PREMIO] AS perc_premio,\n" +
|
||||||
" [COLUMN_VAL_PREMIO] as val_premio\n" +
|
" [COLUMN_VAL_PREMIO] as val_premio\n" +
|
||||||
" FROM [TABLE_NAME] tabp\n" +
|
" FROM [TABLE_NAME] tabp\n" +
|
||||||
" INNER JOIN atb_list_apulia ON atb_list_apulia.linea = tabp.linea AND\n" +
|
" INNER JOIN atb_list_apulia ON atb_list_apulia.linea = tabp.linea AND\n" +
|
||||||
@@ -675,6 +681,7 @@ public class ImportListiniAcquistoApuliaCarrefourService {
|
|||||||
.replace("[MAGG_PRZ]", UtilityString.bigDecimalToString(percMaggPrzBase, "##0.00####").replace(",","."))
|
.replace("[MAGG_PRZ]", UtilityString.bigDecimalToString(percMaggPrzBase, "##0.00####").replace(",","."))
|
||||||
.replace("[TABLE_NAME]", tableAggPrz)
|
.replace("[TABLE_NAME]", tableAggPrz)
|
||||||
.replace("[COLUMN_VAL_PREMIO]", columnValPremio)
|
.replace("[COLUMN_VAL_PREMIO]", columnValPremio)
|
||||||
|
.replace("[COLUMN_PERC_PREMIO]", columnPercPremio)
|
||||||
.replace("[COLUMN_PRZ_ACQ]", columnPrzAcq);
|
.replace("[COLUMN_PRZ_ACQ]", columnPrzAcq);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user