|
|
|
|
@ -97,7 +97,8 @@ public class RelatorioPrintDataProvider
|
|
|
|
|
},
|
|
|
|
|
new String[]{ "empresas.id", "empresas.designacao_social", "empresas.actividade",
|
|
|
|
|
"estabelecimentos.id", "estabelecimentos.nome",
|
|
|
|
|
"hs_relatorio.data", "marcacoes_estabelecimento.data" },
|
|
|
|
|
"hs_relatorio.data", "marcacoes_estabelecimento.data",
|
|
|
|
|
"hs_relatorio.acompanhante1", "hs_relatorio.funcao_acompanhante1" },
|
|
|
|
|
new Field( "hs_relatorio.id" ).isEqual( id ),
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
@ -112,15 +113,19 @@ public class RelatorioPrintDataProvider
|
|
|
|
|
Integer logoId = getLogotipoIdForEmpresaId( empresaId );
|
|
|
|
|
Date dataRelatorio = ( Date ) array.get( 0, 5 );
|
|
|
|
|
Date dataVisita = ( Date ) array.get( 0, 6 );
|
|
|
|
|
Date dataProximaVisita = getDataProximaVisita( estabelecimentoId, dataVisita );
|
|
|
|
|
String nomeAcompanhante = ( String ) array.get( 0, 7 );
|
|
|
|
|
String funcaoAcompanhante = ( String ) array.get( 0, 8 );
|
|
|
|
|
EmpresaToPrint empresa = new EmpresaToPrint( nomeEmpresa,
|
|
|
|
|
"http://www.evolute.pt:13080/SIPRPImages/image?id=" + logoId,
|
|
|
|
|
nomeEstabelecimento, actividadeEmpresa );
|
|
|
|
|
nomeEstabelecimento, actividadeEmpresa,
|
|
|
|
|
nomeAcompanhante, funcaoAcompanhante );
|
|
|
|
|
RelatorioToPrint plano =
|
|
|
|
|
new RelatorioToPrint(
|
|
|
|
|
empresa,
|
|
|
|
|
dataRelatorio != null ? new DataToPrint( "data-relatorio", dataRelatorio ) : null,
|
|
|
|
|
dataVisita != null ? new DataToPrint( "data-hs", dataVisita ) : null,
|
|
|
|
|
null, //TODO: proxima hs
|
|
|
|
|
dataProximaVisita != null ? new DataToPrint( "data-proxima-hs", dataProximaVisita ) : null,
|
|
|
|
|
getLegislacaoAplicavel( id ),
|
|
|
|
|
getNormalizacaoAplicavel( id ),
|
|
|
|
|
getEquipamento( id ),
|
|
|
|
|
@ -128,6 +133,33 @@ public class RelatorioPrintDataProvider
|
|
|
|
|
return plano;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Date getDataProximaVisita( Integer estabelecimentoId, Date dataVisita )
|
|
|
|
|
throws Exception
|
|
|
|
|
{
|
|
|
|
|
Select select =
|
|
|
|
|
new Select2(
|
|
|
|
|
new String[]{ "marcacoes_estabelecimento" },
|
|
|
|
|
new Integer[]{},
|
|
|
|
|
new Expression[]{},
|
|
|
|
|
new String[]{ "MIN( marcacoes_estabelecimento.data )" },
|
|
|
|
|
new Field( "marcacoes_estabelecimento.estabelecimento_id" ).isEqual( estabelecimentoId ).and(
|
|
|
|
|
new Field( "marcacoes_estabelecimento.data" ).isGreater( dataVisita ) ).and(
|
|
|
|
|
new Field( "marcacoes_estabelecimento.estado" ).isEqual( 0 ) ),
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
null );
|
|
|
|
|
Virtual2DArray array = EXECUTER.executeQuery( select );
|
|
|
|
|
if( array.columnLength() == 0 )
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return ( Date ) array.get( 0, 0 );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Integer getLogotipoIdForEmpresaId( Integer empresaId )
|
|
|
|
|
throws Exception
|
|
|
|
|
{
|
|
|
|
|
|