Skip to content

Commit

Permalink
Merge pull request #446 from RJ-SMTR/feature/relatorio_sintetico
Browse files Browse the repository at this point in the history
Ajuste relatorio sintetico
  • Loading branch information
williamfl2007 committed Sep 4, 2024
2 parents ec4dbe7 + 42e6208 commit 8e785e2
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/cron-jobs/cron-jobs.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class CronJobsService {
});
}

async onModuleLoad() {
async onModuleLoad() {
const THIS_CLASS_WITH_METHOD = 'CronJobsService.onModuleLoad';

this.jobsConfig.push(
Expand Down
2 changes: 1 addition & 1 deletion src/relatorio/dtos/relatorio-sintetico.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class RelatorioSinteticoDto {
Object.assign(this, consolidado);
}
}
@SetValue(val=>+val.toFixed(2))

valor: number = 0;
nome: String;
@Exclude()
Expand Down
40 changes: 20 additions & 20 deletions src/relatorio/relatorio-sintetico.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,26 @@ export class RelatorioSinteticoRepository {
let query = ` select distinct res.* from ( `;
if(args.aPagar === undefined || args.aPagar === false){
query = query + `
select distinct
case
when (it."nomeConsorcio" = 'VLT') THEN (da."dataVencimento" - INTERVAL '2 day')::varchar
else '' end as datatransacao,
da."dataVencimento"::date::Varchar As datapagamento,
it."nomeConsorcio" AS consorcio,
cf.nome AS favorecido,
it."valor"::float as valor,
case when (ap."isPago") then 'pago'
when (not (ap."isPago")) then 'naopago'
else 'apagar' end AS status,
case when (not (ap."isPago")) then oc."message" else '' end As mensagem_status
from transacao_view tv
inner join item_transacao_agrupado ita on tv."itemTransacaoAgrupadoId"=ita.id
inner join detalhe_a da on da."itemTransacaoAgrupadoId"= ita.id
inner join item_transacao it on ita.id = it."itemTransacaoAgrupadoId"
inner join arquivo_publicacao ap on ap."itemTransacaoId"=it.id
inner join cliente_favorecido cf on cf.id=it."clienteFavorecidoId"
inner join ocorrencia oc on oc."detalheAId"=da.id
where (1=1) `;
select distinct
case
when (it."nomeConsorcio" = 'VLT') THEN (da."dataVencimento" - INTERVAL '2 day')::varchar
else '' end as datatransacao,
da."dataVencimento"::date::Varchar As datapagamento,
it."nomeConsorcio" AS consorcio,
cf.nome AS favorecido,
it."valor"::float as valor,
case when (ap."isPago") then 'pago'
when (not (ap."isPago")) then 'naopago'
else 'apagar' end AS status,
case when (not (ap."isPago")) then oc."message" else '' end As mensagem_status
from transacao_view tv
inner join item_transacao_agrupado ita on tv."itemTransacaoAgrupadoId"=ita.id
inner join detalhe_a da on da."itemTransacaoAgrupadoId"= ita.id
inner join item_transacao it on ita.id = it."itemTransacaoAgrupadoId"
inner join arquivo_publicacao ap on ap."itemTransacaoId"=it.id
inner join cliente_favorecido cf on cf.id=it."clienteFavorecidoId"
inner join ocorrencia oc on oc."detalheAId"=da.id
where (1=1) `;
if(dataInicio!==undefined && dataFim!==undefined &&
(dataFim === dataInicio || new Date(dataFim)>new Date(dataInicio)))
query = query + ` and da."dataVencimento" between '${dataInicio}' and '${dataFim}'`;
Expand Down
2 changes: 2 additions & 0 deletions src/transacao-bq/transacao-view.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export class TransacaoViewRepository {
) associados
WHERE id = associados.tv_id
`;
this.logger.debug(query);
const queryRunner = this.dataSource.createQueryRunner();
await queryRunner.connect();
let count = 0;
Expand Down Expand Up @@ -110,6 +111,7 @@ export class TransacaoViewRepository {
}
const updatedAt: keyof ITransacaoView = 'updatedAt';
const query = EntityHelper.getQueryUpdate('transacao_view', dtos, fields, TransacaoView.sqlFieldTypes, reference, updatedAt);
this.logger.debug(query);
const [, count] = await (manager || this.transacaoViewRepository).query(compactQuery(query));
return count;
}
Expand Down

0 comments on commit 8e785e2

Please sign in to comment.