Skip to content

Commit

Permalink
Ajuste sincronismo
Browse files Browse the repository at this point in the history
  • Loading branch information
williamfl2007 committed Sep 10, 2024
1 parent 41cc3fc commit fe38846
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/transacao-bq/transacao-view.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class TransacaoViewRepository {
const where: string[] = [];
if (args?.dataOrdem_between) {
const [start, end] = args.dataOrdem_between.map((d) => d.toISOString());
where.push(`DATE(tv."datetimeProcessamento") BETWEEN (DATE('${start}') - INTERVAL '1 DAY') AND '${end}'`);
where.push(`DATE(tv."datetimeTransacao") BETWEEN (DATE('${start}') - INTERVAL '1 DAY') AND '${end}'`);
}
if (args?.nomeFavorecido?.length) {
where.push(`cf.nome ILIKE ANY(ARRAY['%${args.nomeFavorecido.join("%', '%")}%'])`);
Expand All @@ -75,9 +75,9 @@ export class TransacaoViewRepository {
AND tv."idOperadora" = ita."idOperadora"
AND tv."operadoraCpfCnpj" = cf."cpfCnpj"
AND tv."datetimeTransacao"::DATE BETWEEN
(da."dataVencimento"::DATE - (CASE WHEN ita."nomeConsorcio" = 'VLT' THEN INTERVAL '2 DAYS' ELSE INTERVAL '8 DAYS' END)) -- VENCIMENTO - 2 SE VLT; SENÃO QUINTA PGTO
AND (DATE(da."dataVencimento") - INTERVAL '2 DAYS') -- VENCIMENTO - 2 (OU QUARTA PGTO SE NÃO for VLT)
WHERE tv."valorPago" > 0 ${where.length ? `AND ${where.join(' AND ')}` : ''}
(ita."dataOrdem"::DATE - (CASE WHEN ita."nomeConsorcio" = 'VLT' THEN INTERVAL '2 DAYS' ELSE INTERVAL '8 DAYS' END)) -- VENCIMENTO - 2 SE VLT; SENÃO QUINTA PGTO
AND (DATE(ita."dataOrdem") - INTERVAL '2 DAYS') -- VENCIMENTO - 2 (OU QUARTA PGTO SE NÃO for VLT)
WHERE ${where.length ? `AND ${where.join(' AND ')}` : ''}
ORDER BY tv.id ASC, ita.id DESC
) associados
WHERE id = associados.tv_id
Expand Down

0 comments on commit fe38846

Please sign in to comment.