Merge branch 'master' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250210123529 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createOrUpdateView("avw_contratti_acquisto","ALTER VIEW [dbo].[avw_contratti_acquisto] AS\n" +
|
||||
"SELECT atb_offt.cod_alis,\n" +
|
||||
" atb_list.descrizione AS descrizione_lisa,\n" +
|
||||
" atb_offt.data_iniz,\n" +
|
||||
" atb_offt.data_fine,\n" +
|
||||
" IsNull(atb_offt.num_off, atb_offt.id_contratto) as num_off,\n" +
|
||||
" atb_offt.note,\n" +
|
||||
" atb_offt.cod_vage,\n" +
|
||||
" vtb_agen.rag_soc AS rag_soc_age,\n" +
|
||||
" atb_offt.cod_vvet,\n" +
|
||||
" vtb_vett.rag_soc AS rag_soc_vet,\n" +
|
||||
" atb_offr.cod_mart,\n" +
|
||||
" ISNULL(mtb_aart.descrizione_estesa, mtb_aart.descrizione) AS descrizione_art,\n" +
|
||||
" atb_offr.unt_mis as unt_mis_acq,\n" +
|
||||
" atb_offr.rap_conv,\n" +
|
||||
" atb_offr.val_unt as prz_acq,\n" +
|
||||
" atb_offr.sconto5 as perc_1,\n" +
|
||||
" atb_offr.sconto6 as perc_2,\n" +
|
||||
" atb_offr.sconto7 as perc_3,\n" +
|
||||
" atb_offr.sconto8 as perc_4,\n" +
|
||||
" ISNULL(atb_offr.qta_off, 0) AS qta_acq_contr,\n" +
|
||||
" ISNULL(atb_offr.qta_ord, 0) AS qta_ord,\n" +
|
||||
" ISNULL(atb_offr.qta_doc, 0) AS qta_doc,\n" +
|
||||
"\t ISNULL(atb_offr.qta_off, 0) - ISNULL(atb_offr.qta_ord, 0) - ISNULL(atb_offr.qta_doc, 0) AS qta_saldo,\n" +
|
||||
" atb_offr.perc_prov,\n" +
|
||||
" atb_offr.val_prov,\n" +
|
||||
" gtb_anag.cod_anag,\n" +
|
||||
" gtb_anag.rag_soc,\n" +
|
||||
" mtb_aart.cod_mgrp,\n" +
|
||||
" atb_forn.cod_atip,\n" +
|
||||
"\t atb_offt.cod_mdep,\n" +
|
||||
"\t atb_offt.id_contratto,\n" +
|
||||
"\t atb_offt.compilato_da,\n" +
|
||||
"\t atb_offr.riga_off,\n" +
|
||||
"\t atb_offr.cod_art_forn,\n" +
|
||||
"\t atb_offt.flag_chiudi_a_scad,\n" +
|
||||
"\t case when atb_offt.flag_chiudi_a_scad = 0 and ISNULL(atb_offr.qta_off, 0) - ISNULL(atb_offr.qta_ord, 0) - ISNULL(atb_offr.qta_doc, 0) < 0 THEN 1\n" +
|
||||
"\t\t\twhen atb_offt.data_fine < Cast(getdate() as date) THEN 1\n" +
|
||||
"\t\t\twhen DateDiff(day, GETDATE(), data_fine) <= 30 THEN 2 ELSE 0 END stato_scadenza\n" +
|
||||
"FROM atb_offt\n" +
|
||||
" INNER JOIN atb_list ON atb_offt.cod_alis = atb_list.cod_alis\t\t\n" +
|
||||
"\t\t INNER JOIN atb_forn ON atb_offt.cod_anag = atb_forn.cod_anag\n" +
|
||||
" INNER JOIN gtb_anag ON atb_offt.cod_anag = gtb_anag.cod_anag\n" +
|
||||
" INNER JOIN atb_offr ON atb_offt.id_contratto = atb_offr.id_contratto\n" +
|
||||
" INNER JOIN mtb_aart ON atb_offr.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" LEFT OUTER JOIN vtb_agen ON atb_offt.cod_vage = vtb_agen.cod_vage\n" +
|
||||
" LEFT OUTER JOIN vtb_vett ON atb_offt.cod_vvet = vtb_vett.cod_vvet\n" +
|
||||
"WHERE atb_offt.data_iniz is not null;\n");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user