Skip to content

Commit

Permalink
Aggiornamento Progetti
Browse files Browse the repository at this point in the history
  • Loading branch information
raffaelepagano committed Oct 8, 2018
1 parent 4014691 commit 4f18357
Show file tree
Hide file tree
Showing 12 changed files with 125 additions and 6 deletions.
18 changes: 18 additions & 0 deletions sigla-backend/src/main/resources/liquibase/db.changelog-5.0.0.xml
Expand Up @@ -1091,4 +1091,22 @@
<column name="pg_ver_rec" type="BIGINT" value="0"/>
</insert>
</changeSet>

<changeSet author="marco.spasiano" id="alter-table-finanziamento-e-voce-economica">
<addColumn tableName="tipo_finanziamento">
<column name="fl_all_prev_fin" remarks="Previsione totale quota finanziata" type="CHAR(1)" />
</addColumn>
<update tableName="tipo_finanziamento">
<column name="fl_all_prev_fin" value='N' type="CHAR(1)"/>
</update>
<addNotNullConstraint columnName="fl_all_prev_fin" tableName="tipo_finanziamento"/>

<addColumn tableName="voce_piano_economico_prg">
<column name="fl_all_prev_fin" remarks="Previsione totale quota finanziata" type="CHAR(1)" />
</addColumn>
<update tableName="voce_piano_economico_prg">
<column name="fl_all_prev_fin" value='N' type="CHAR(1)"/>
</update>
<addNotNullConstraint columnName="fl_all_prev_fin" tableName="voce_piano_economico_prg"/>
</changeSet>
</databaseChangeLog>
Expand Up @@ -5,6 +5,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;

import javax.ejb.EJBException;
Expand Down Expand Up @@ -35,6 +36,7 @@
import it.cnr.contab.prevent01.bulk.Pdg_modulo_speseBulk;
import it.cnr.contab.progettiric00.core.bulk.Progetto_piano_economicoBulk;
import it.cnr.contab.progettiric00.core.bulk.Progetto_piano_economicoHome;
import it.cnr.contab.progettiric00.core.bulk.TipoFinanziamentoBulk;
import it.cnr.contab.progettiric00.core.bulk.V_saldi_piano_econom_progettoBulk;
import it.cnr.contab.progettiric00.core.bulk.V_saldi_piano_econom_progettoHome;
import it.cnr.contab.progettiric00.tabrif.bulk.Voce_piano_economico_prgBulk;
Expand Down Expand Up @@ -1274,6 +1276,23 @@ public void checkDispPianoEconomicoProgetto(UserContext userContext, Pdg_modulo_
" diventerebbe negativo ("+new it.cnr.contab.util.EuroFormat().format(dispResiduaFin.abs())+
") per la quota finanziata.");

if (Optional.ofNullable(moduloCosti)
.flatMap(el->Optional.ofNullable(el.getPdg_modulo()))
.flatMap(el->Optional.ofNullable(el.getProgetto()))
.flatMap(el->Optional.ofNullable(el.getOtherField()))
.flatMap(el->Optional.ofNullable(el.getTipoFinanziamento()))
.map(TipoFinanziamentoBulk::getFlAllPrevFin)
.orElse(Boolean.TRUE) &&
Optional.ofNullable(e.getVoce_piano_economico())
.map(Voce_piano_economico_prgBulk::getFlAllPrevFin)
.orElse(Boolean.TRUE) &&
dispResiduaFin.compareTo(BigDecimal.ZERO)!=0)
throw new ApplicationException(
"Impossibile effettuare l'operazione !\n"+
"L'importo finanziato del progetto "+(e.getEsercizio_piano().equals(0)?"":"per l'esercizio "+e.getEsercizio_piano())+
" non corrisponde all'importo totale della previsione " +
"(diff: "+new it.cnr.contab.util.EuroFormat().format(dispResiduaFin.abs())+").");

BigDecimal dispResiduaCofin = saldo.getDispResiduaCofinanziamento();

dispResiduaCofin = dispResiduaCofin.add(
Expand Down
Expand Up @@ -384,10 +384,22 @@ public void setFlPrgPianoEconomico(boolean flPrgPianoEconomico) {
public void basicEdit(ActionContext actioncontext, OggettoBulk oggettobulk, boolean flag)
throws BusinessProcessException {
super.basicEdit(actioncontext, oggettobulk, flag);
if (((ProgettoBulk)oggettobulk).getCd_unita_organizzativa() ==null ||
!((ProgettoBulk)oggettobulk).getCd_unita_organizzativa().equals(CNRUserContext.getCd_unita_organizzativa(actioncontext.getUserContext())) ||
!Optional.ofNullable(((ProgettoBulk)oggettobulk).getOtherField()).filter(el->el.isStatoIniziale()||el.isStatoMigrazione()).isPresent())
ProgettoBulk progetto = (ProgettoBulk)oggettobulk;
if (progetto.getCd_unita_organizzativa() ==null ||
!progetto.getCd_unita_organizzativa().equals(CNRUserContext.getCd_unita_organizzativa(actioncontext.getUserContext())))
this.setStatus(VIEW);
else {
if (!Optional.ofNullable(progetto.getOtherField()).filter(el->el.isStatoIniziale()||el.isStatoMigrazione()).isPresent() &&
progetto.getPianoEconomicoSummary().stream()
.filter(el->Optional.ofNullable(el.getSaldoEntrata())
.filter(saldo->saldo.getAssestato().compareTo(BigDecimal.ZERO)!=0)
.isPresent() ||
Optional.ofNullable(el.getSaldoSpesa())
.filter(saldo->saldo.getAssestato().compareTo(BigDecimal.ZERO)!=0)
.isPresent())
.findFirst().isPresent())
this.setStatus(VIEW);
}
}

public String[][] getTabs(HttpSession session) {
Expand Down
@@ -1,5 +1,7 @@
package it.cnr.contab.progettiric00.core.bulk;

import java.util.Optional;

import it.cnr.contab.config00.pdcfin.bulk.Elemento_voceBulk;
import it.cnr.contab.progettiric00.tabrif.bulk.Voce_piano_economico_prgBulk;

Expand Down Expand Up @@ -134,3 +136,4 @@ public void setCd_elemento_voce(String cd_elemento_voce) {
this.getElemento_voce().setCd_elemento_voce(cd_elemento_voce);
}
}

Expand Up @@ -43,7 +43,10 @@ public class TipoFinanziamentoBase extends TipoFinanziamentoKey implements Keyed

// FL_INC_CONS CHAR(1) NOT NULL
private Boolean flIncCons;


// FL_ALL_PREV_FIN CHAR(1) NOT NULL
private Boolean flAllPrevFin;

/**
* Created by BulkGenerator 2.0 [07/12/2009]
* Table name: TIPO_FINANZIAMENTO
Expand Down Expand Up @@ -236,4 +239,12 @@ public Boolean getFlIncCons() {
public void setFlIncCons(Boolean flIncCons) {
this.flIncCons=flIncCons;
}

public Boolean getFlAllPrevFin() {
return flAllPrevFin;
}

public void setFlAllPrevFin(Boolean flAllPrevFin) {
this.flAllPrevFin = flAllPrevFin;
}
}
Expand Up @@ -15,6 +15,9 @@ public class Voce_piano_economico_prgBase extends Voce_piano_economico_prgKey im
// FL_ADD_VOCIBIL CHAR(1 BYTE) DEFAULT 'N' NOT NULL
private java.lang.Boolean fl_add_vocibil;

// FL_ALL_PREV_FIN CHAR(1) NOT NULL
private Boolean flAllPrevFin;

// FL_VALIDO CHAR(1 BYTE) DEFAULT 'Y' NOT NULL
private java.lang.Boolean fl_valido;

Expand Down Expand Up @@ -64,6 +67,14 @@ public void setFl_add_vocibil(java.lang.Boolean fl_add_vocibil) {
this.fl_add_vocibil = fl_add_vocibil;
}

public Boolean getFlAllPrevFin() {
return flAllPrevFin;
}

public void setFlAllPrevFin(Boolean flAllPrevFin) {
this.flAllPrevFin = flAllPrevFin;
}

public java.lang.Boolean getFl_valido() {
return fl_valido;
}
Expand Down
Expand Up @@ -8,8 +8,7 @@
property="elemento_voce"
inputType="SEARCHTOOL"
formName="searchtool"
enabledOnEdit="false"
enabledOnInsert="true"
readonlyProperty= "notNew"
label="Voce di Bilancio" />
<fieldProperty
name="cd_elemento_voce"
Expand Down
Expand Up @@ -94,6 +94,13 @@
columnSize="1"
nullable="false"
converterClassName="it.cnr.jada.persistency.sql.CHARToBooleanConverter" />
<columnMapping
columnName="FL_ALL_PREV_FIN"
propertyName="flAllPrevFin"
sqlTypeName="CHAR"
columnSize="1"
nullable="false"
converterClassName="it.cnr.jada.persistency.sql.CHARToBooleanConverter" />
<columnMapping
columnName="DACR"
propertyName="dacr"
Expand Down Expand Up @@ -151,6 +158,8 @@
name="flVarCons" />
<persistentProperty
name="flIncCons" />
<persistentProperty
name="flAllPrevFin" />
<persistentProperty
name="dacr" />
<persistentProperty
Expand Down
Expand Up @@ -105,6 +105,13 @@
inputType="CHECKBOX"
nullable="false"
label="Incassi consentiti"/>
<fieldProperty
name="flAllPrevFin"
property="flAllPrevFin"
enabledOnSearch="true"
inputType="CHECKBOX"
nullable="false"
label="Previsione totale quota finanziata"/>
<form
name="searchtool">
<formFieldProperty
Expand Down Expand Up @@ -140,6 +147,8 @@
name="flVarCons"/>
<formFieldProperty
name="flIncCons"/>
<formFieldProperty
name="flAllPrevFin" />

<findFieldProperty
name="id"/>
Expand Down Expand Up @@ -169,6 +178,9 @@
name="flVarCons"/>
<findFieldProperty
name="flIncCons"/>
<findFieldProperty
name="flAllPrevFin" />

<columnFieldProperty
name="id"/>
<columnFieldProperty
Expand Down Expand Up @@ -197,4 +209,6 @@
name="flVarCons"/>
<columnFieldProperty
name="flIncCons"/>
<columnFieldProperty
name="flAllPrevFin" />
</bulkInfo>
Expand Up @@ -31,6 +31,13 @@
columnSize="1"
nullable="false"
converterClassName="it.cnr.jada.persistency.sql.CHARToBooleanConverter" />
<columnMapping
columnName="FL_ALL_PREV_FIN"
propertyName="flAllPrevFin"
sqlTypeName="CHAR"
columnSize="1"
nullable="false"
converterClassName="it.cnr.jada.persistency.sql.CHARToBooleanConverter" />
<columnMapping
columnName="FL_VALIDO"
propertyName="fl_valido"
Expand Down Expand Up @@ -77,6 +84,8 @@
name="fl_link_vocibil_associate" />
<persistentProperty
name="fl_add_vocibil" />
<persistentProperty
name="flAllPrevFin" />
<persistentProperty
name="fl_valido" />
<persistentProperty
Expand Down
Expand Up @@ -70,6 +70,13 @@
property="fl_add_vocibil"
inputType="CHECKBOX"
label="Associazione Manuale Voci Bilancio" />
<fieldProperty
name="flAllPrevFin"
property="flAllPrevFin"
enabledOnSearch="true"
inputType="CHECKBOX"
nullable="false"
label="Previsione totale quota finanziata"/>
<fieldProperty
name="fl_valido"
property="fl_valido"
Expand All @@ -83,6 +90,7 @@
<formFieldProperty name="tipologia" />
<formFieldProperty name="fl_link_vocibil_associate" />
<formFieldProperty name="fl_add_vocibil" />
<formFieldProperty name="flAllPrevFin" />
<formFieldProperty name="fl_valido" />

<columnFieldProperty name="cd_voce_piano" />
Expand All @@ -91,6 +99,7 @@
<columnFieldProperty name="ds_unita_organizzativa" />
<columnFieldProperty name="fl_link_vocibil_associate" />
<columnFieldProperty name="fl_add_vocibil" />
<columnFieldProperty name="flAllPrevFin" />
<columnFieldProperty name="fl_valido" />

<findFieldProperty name="cd_voce_piano" />
Expand Down
Expand Up @@ -51,6 +51,11 @@
</TD><TD colspan="3">
<% bp.getController().writeFormInput(out,"fl_add_vocibil");%>
</TD></TR>
<TR><TD>
<% bp.getController().writeFormLabel(out,"flAllPrevFin");%>
</TD><TD colspan="3">
<% bp.getController().writeFormInput(out,"flAllPrevFin");%>
</TD></TR>
<TR><TD>
<% bp.getController().writeFormLabel(out,"fl_valido");%>
</TD><TD colspan="3">
Expand Down

0 comments on commit 4f18357

Please sign in to comment.