Skip to content

Commit

Permalink
Piano Economico: Gestione Variazioni
Browse files Browse the repository at this point in the history
  • Loading branch information
raffaelepagano committed Jan 11, 2019
1 parent 3745201 commit 05c385a
Show file tree
Hide file tree
Showing 9 changed files with 651 additions and 370 deletions.
@@ -1,2 +1,2 @@
"esercizio","cd_unita_funzionale","cd_chiave_primaria","cd_chiave_secondaria","val01","val02","val03","val04","im01","im02","dt01","dt02","dacr","utcr","duva","utuv","pg_ver_rec"
"0","*","BANCAITALIA","ABI","01000","null","null","null","2019","null","null","null","2019-01-11","CED","2019-01-11","CED","1"
"0","*","CONTO_CORRENTE_SPECIALE","BANCA_ITALIA","01000","null","null","null","null","null","null","null","2019-01-11","CED","2019-01-11","CED","1"
@@ -1,3 +1,3 @@
"esercizio","cd_unita_funzionale","cd_chiave_primaria","cd_chiave_secondaria","val01","val02","val03","val04","im01","im02","dt01","dt02","dacr","utcr","duva","utuv","pg_ver_rec"
"0","*","PROGETTI","NATURA_REIMPIEGO","6","null","null","null","2019","null","null","null","2019-01-11","CED","2019-01-11","CED","1"
"0","*","ELEMENTO_VOCE_SPECIALE","TEMPO_IND_SU_PROGETTI_FINANZIATI","11048","null","null","null","2019","null","null","null","2019-01-11","CED","2019-01-11","CED","1"
"0","*","PROGETTI","NATURA_REIMPIEGO","6","null","null","null","null","null","null","null","2019-01-11","CED","2019-01-11","CED","1"
"0","*","ELEMENTO_VOCE_SPECIALE","TEMPO_IND_SU_PROGETTI_FINANZIATI","11048","null","null","null","null","null","null","null","2019-01-11","CED","2019-01-11","CED","1"

Large diffs are not rendered by default.

Expand Up @@ -33,6 +33,7 @@ public class Configurazione_cnrBulk extends Configurazione_cnrBase {

public final static String PK_ELEMENTO_VOCE_SPECIALE = "ELEMENTO_VOCE_SPECIALE";
public final static String SK_VOCE_IVA_FATTURA_ESTERA = "VOCE_IVA_FATTURA_ESTERA";
public final static String SK_TEMPO_IND_SU_PROGETTI_FINANZIATI = "TEMPO_IND_SU_PROGETTI_FINANZIATI";

public final static String PK_CONTO_CORRENTE_SPECIALE = "CONTO_CORRENTE_SPECIALE";
public final static String SK_ENTE = "ENTE";
Expand Down Expand Up @@ -98,6 +99,7 @@ public class Configurazione_cnrBulk extends Configurazione_cnrBase {

public final static String PK_GESTIONE_PROGETTI = "PROGETTI";
public final static String SK_PROGETTO_PIANO_ECONOMICO = "PIANO_ECONOMICO";
public final static String SK_NATURA_REIMPIEGO = "NATURA_REIMPIEGO";

public final static String PK_FLUSSO_ORDINATIVI = "FLUSSO_ORDINATIVI";
public final static String SK_CODICE_ABI_BT = "CODICE_ABI_BT";
Expand Down
@@ -1,6 +1,7 @@
package it.cnr.contab.config00.pdcfin.bulk;

import java.util.Dictionary;
import java.util.Optional;

import it.cnr.jada.bulk.*;
import it.cnr.jada.persistency.*;
Expand Down Expand Up @@ -36,12 +37,18 @@ public boolean equals(Object obj) {
}
return super.equals(obj);
}
/**
* Restituisce il valore della proprietà 'cd_ds_natura'
*
* @return Il valore della proprietà 'cd_ds_natura'
*/
public String getCd_ds_natura() {
return getCd_natura() + " - " + getDs_natura();
}
}
/**
* Restituisce il valore della proprietà 'cd_ds_natura'
*
* @return Il valore della proprietà 'cd_ds_natura'
*/
public String getCd_ds_natura() {
return getCd_natura() + " - " + getDs_natura();
}
public boolean isFonteInterna() {
return NaturaBulk.TIPO_NATURA_FONTI_INTERNE.equals(this.getTipo());
}
public boolean isFonteEsterna() {
return NaturaBulk.TIPO_NATURA_FONTI_ESTERNE.equals(this.getTipo());
}
}
Expand Up @@ -86,6 +86,7 @@
import it.cnr.contab.prevent00.bulk.Voce_f_saldi_cdr_lineaBulk;
import it.cnr.contab.prevent00.bulk.Voce_f_saldi_cmpBulk;
import it.cnr.contab.progettiric00.core.bulk.ProgettoBulk;
import it.cnr.contab.progettiric00.core.bulk.ProgettoHome;
import it.cnr.contab.progettiric00.core.bulk.Progetto_other_fieldBulk;
import it.cnr.contab.utenze00.bp.CNRUserContext;
import it.cnr.contab.utenze00.bulk.UtenteBulk;
Expand Down Expand Up @@ -1672,38 +1673,25 @@ private void validaCdrLineaVoce(UserContext userContext, ObbligazioneBulk obblig
if (list.size()>1)
throw new ApplicationException("Errore in fase di ricerca linea_attivita.");
WorkpackageBulk linea = list.get(0);
ProgettoBulk progetto = (ProgettoBulk)getHome(userContext, ProgettoBulk.class).findByPrimaryKey(userContext, linea.getProgetto());
Progetto_other_fieldBulk other = (Progetto_other_fieldBulk)getHome(userContext, Progetto_other_fieldBulk.class).findByPrimaryKey(new Progetto_other_fieldBulk(linea.getPg_progetto()));
if (Optional.ofNullable(other).isPresent()) {
if (Optional.ofNullable(other.getDtInizio())
.map(el->{
Calendar gc = GregorianCalendar.getInstance();
gc.setTime(el);
return gc;
})
.map(el->el.get(Calendar.YEAR)>CNRUserContext.getEsercizio(userContext))
.orElse(Boolean.FALSE)) {
throw new ApplicationException("Attenzione! GAE "+latt+" non selezionabile. "
+ "La data inizio ("+new java.text.SimpleDateFormat("dd/MM/yyyy").format(other.getDtInizio())
+ ") del progetto "+progetto.getCd_progetto()+" associato è successiva "
+ "rispetto all'anno contabile di scrivania.");
}
if (Optional.ofNullable(
Optional.ofNullable(other.getDtProroga()).orElse(other.getDtFine()))
.map(el->{
Calendar gc = GregorianCalendar.getInstance();
gc.setTime(el);
return gc;
})
.map(el->el.get(Calendar.YEAR)<CNRUserContext.getEsercizio(userContext))
.orElse(Boolean.FALSE)) {
throw new ApplicationException("Attenzione! GAE "+latt+" non selezionabile. "
+ "La data fine/proroga ("
+ new java.text.SimpleDateFormat("dd/MM/yyyy").format(Optional.ofNullable(other.getDtProroga())
.orElse(other.getDtFine()))
ProgettoHome home = (ProgettoHome)getHome(userContext, ProgettoBulk.class);
home.setFetchPolicy("it.cnr.contab.progettiric00.comp.ProgettoRicercaComponent.find");
ProgettoBulk progetto = (ProgettoBulk)home.findByPrimaryKey(linea.getProgetto());
getHomeCache(userContext).fetchAll(userContext);
if (Optional.ofNullable(progetto.getOtherField()).isPresent()) {
Optional.ofNullable(progetto.getOtherField().getDtInizio())
.filter(dt->!dt.after(obbligazione.getDt_registrazione()))
.orElseThrow(()->new ApplicationException("Attenzione! GAE "+linea.getCd_linea_attivita()+" non selezionabile. "
+ "La data inizio ("+new java.text.SimpleDateFormat("dd/MM/yyyy").format(progetto.getOtherField().getDtInizio())
+ ") del progetto "+progetto.getCd_progetto()+" associato è successiva "
+ "rispetto alla data di registrazione dell'impegno ("+new java.text.SimpleDateFormat("dd/MM/yyyy").format(obbligazione.getDt_registrazione())+")."));

Optional.ofNullable(
Optional.ofNullable(progetto.getOtherField().getDtProroga()).orElse(progetto.getOtherField().getDtFine()))
.filter(dt->!dt.before(obbligazione.getDt_registrazione()))
.orElseThrow(()->new ApplicationException("Attenzione! GAE "+linea.getCd_linea_attivita()+" non selezionabile. "
+ "La data fine/proroga ("+new java.text.SimpleDateFormat("dd/MM/yyyy").format(Optional.ofNullable(progetto.getOtherField().getDtProroga()).orElse(progetto.getOtherField().getDtFine()))
+ ") del progetto "+progetto.getCd_progetto()+" associato è precedente "
+ "rispetto all'anno contabile di scrivania.");
}
+ "rispetto alla data di registrazione dell'impegno ("+new java.text.SimpleDateFormat("dd/MM/yyyy").format(obbligazione.getDt_registrazione())+")."));
}
}
}
Expand Down

0 comments on commit 05c385a

Please sign in to comment.