From 80ff5b218a384ae7a38f939c0b2eae5c65cb8f43 Mon Sep 17 00:00:00 2001 From: ollyvergithub Date: Wed, 5 Oct 2022 06:06:14 -0300 Subject: [PATCH 1/4] =?UTF-8?q?fix(76004):=20Inicia=20corre=C3=A7=C3=A3o?= =?UTF-8?q?=20tabela=20total=20demonstrativo=20financeiro?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../services/relatorio_consolidado_service.py | 9 +- .../tabela-sintese-execucao-financeira.html | 234 +++++++++--------- 2 files changed, 125 insertions(+), 118 deletions(-) diff --git a/sme_ptrf_apps/dre/services/relatorio_consolidado_service.py b/sme_ptrf_apps/dre/services/relatorio_consolidado_service.py index ce65009f8..8762246b8 100644 --- a/sme_ptrf_apps/dre/services/relatorio_consolidado_service.py +++ b/sme_ptrf_apps/dre/services/relatorio_consolidado_service.py @@ -964,9 +964,12 @@ def _totaliza_previsoes_repasses_sme(associacao, periodo, tipo_conta, totais): return totais - def _totaliza_devolucoes_ao_tesouro(prestacao_conta, periodo, totais): + def _totaliza_devolucoes_ao_tesouro(prestacao_conta, periodo, totais, tipo_conta): # Devoluções ao tesouro de PCs de Associações da DRE, no período e concluídas - devolucoes = prestacao_conta.devolucoes_ao_tesouro_da_prestacao.all() + # Acrescentado o filtro por conta para não permitir a exibição da coluna com valores zerados no Demonstrativo Financeiro + devolucoes = prestacao_conta.devolucoes_ao_tesouro_da_prestacao.filter( + despesa__rateios__conta_associacao__tipo_conta=tipo_conta + ) for devolucao in devolucoes: totais['devolucoes_ao_tesouro_no_periodo_total'] += devolucao.valor @@ -1008,7 +1011,7 @@ def _totaliza_devolucoes_ao_tesouro(prestacao_conta, periodo, totais): if prestacao_conta: totais = _totaliza_fechamentos(associacao, periodo, tipo_conta, totais) totais = _atualiza_demais_creditos(totais) - totais = _totaliza_devolucoes_ao_tesouro(prestacao_conta, periodo, totais) + totais = _totaliza_devolucoes_ao_tesouro(prestacao_conta, periodo, totais, tipo_conta) totais = _totaliza_previsoes_repasses_sme(associacao, periodo, tipo_conta, totais) diff --git a/sme_ptrf_apps/templates/pdf/demonstrativo_execucao_fisico_financeiro/partials/tabela-sintese-execucao-financeira.html b/sme_ptrf_apps/templates/pdf/demonstrativo_execucao_fisico_financeiro/partials/tabela-sintese-execucao-financeira.html index cef2aa2d4..659b61a33 100644 --- a/sme_ptrf_apps/templates/pdf/demonstrativo_execucao_fisico_financeiro/partials/tabela-sintese-execucao-financeira.html +++ b/sme_ptrf_apps/templates/pdf/demonstrativo_execucao_fisico_financeiro/partials/tabela-sintese-execucao-financeira.html @@ -201,157 +201,161 @@ {% endfor %} -{% for valor in dados.execucao_financeira.total_todas_as_contas %} +{% if dados.execucao_financeira.por_tipo_de_conta|length > 1 %} + + {% for valor in dados.execucao_financeira.total_todas_as_contas %} {% comment %} - *************** Não remover
*************** - Esta tag HTML que tem display block impede que a tabela quebre dentro da linha mesclada durante o for. - Na tabela, para evitar a quebra, foi utilizado a classe CSS nao-quebra-linha, que usa a regra break-after: avoid !important;. - Ref: Documentação do WeasyPrint. Its a miracle. - {% endcomment %} -
- {% comment %} - *************** FIM Não remover
*************** - {% endcomment %} + *************** Não remover
*************** + Esta tag HTML que tem display block impede que a tabela quebre dentro da linha mesclada durante o for. + Na tabela, para evitar a quebra, foi utilizado a classe CSS nao-quebra-linha, que usa a regra break-after: avoid !important;. + Ref: Documentação do WeasyPrint. Its a miracle. + {% endcomment %} +
+ {% comment %} + *************** FIM Não remover
*************** + {% endcomment %} - - - - - +
Execução financeira - {{ valor.tipo_conta }}
+ - - + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - - + + + - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - - - - + + + + + + + - - + + - - + + - - + + - - + + - - - + + + - - - - - - - - + + + + + + + + - - + + - - + + - - + + - - + + - - - - - + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - -
01 - Saldo reprogramado do período anterior Execução financeira - {{ valor.tipo_conta }}
01 - Saldo reprogramado do período anterior 02 - Previsto pela SME 02 - Previsto pela SME 03 - Transferido pela DRE 03 - Transferido pela DRE 04 - Outros créditos 04 - Outros créditos 05 - Valor total disponível 05 - Valor total disponível 06 - Despesa realizada 06 - Despesa realizada 07 - Saldo reprogramado para o próximo período 07 - Saldo reprogramado para o próximo período 08 - Devolução ao Tesouro
08 - Devolução ao Tesouro
C{{ valor.custeio.saldo_reprogramado_periodo_anterior_custeio }} C{{ valor.custeio.saldo_reprogramado_periodo_anterior_custeio }} C{{ valor.custeio.repasses_previstos_sme_custeio }} C{{ valor.custeio.repasses_previstos_sme_custeio }} C{{ valor.custeio.repasses_no_periodo_custeio }} C{{ valor.custeio.repasses_no_periodo_custeio }} C{{ valor.custeio.outros_creditos }} C{{ valor.custeio.outros_creditos }} C{{ valor.custeio.valor_total_custeio }} C{{ valor.custeio.valor_total_custeio }} C{{ valor.custeio.despesas_no_periodo_custeio }} C{{ valor.custeio.despesas_no_periodo_custeio }} C{{ valor.custeio.saldo_reprogramado_proximo_periodo_custeio }} C{{ valor.custeio.saldo_reprogramado_proximo_periodo_custeio }} T{{ valor.totais.devolucoes_ao_tesouro_no_periodo_total }}
L{{ valor.livre.saldo_reprogramado_periodo_anterior_livre }}T{{ valor.totais.devolucoes_ao_tesouro_no_periodo_total }}
L{{ valor.livre.saldo_reprogramado_periodo_anterior_livre }}L{{ valor.livre.repasses_previstos_sme_livre }}L{{ valor.livre.repasses_previstos_sme_livre }}L{{ valor.livre.repasses_no_periodo_livre }}L{{ valor.livre.repasses_no_periodo_livre }} L{{ valor.livre.outros_creditos }} L{{ valor.livre.outros_creditos }} L{{ valor.livre.valor_total_livre }} L{{ valor.livre.valor_total_livre }} L{{ valor.livre.saldo_reprogramado_proximo_periodo_livre }} L{{ valor.livre.saldo_reprogramado_proximo_periodo_livre }}
K{{ valor.capital.despesas_no_periodo_capital }}
K{{ valor.capital.saldo_reprogramado_periodo_anterior_capital }}
K{{ valor.capital.despesas_no_periodo_capital }}
K{{ valor.capital.saldo_reprogramado_periodo_anterior_capital }} K{{ valor.capital.repasses_previstos_sme_capital }} K{{ valor.capital.repasses_previstos_sme_capital }} K{{ valor.capital.repasses_no_periodo_capital }} K{{ valor.capital.repasses_no_periodo_capital }} K{{ valor.capital.outros_creditos }} K{{ valor.capital.outros_creditos }} K{{ valor.capital.valor_total_capital }} K{{ valor.capital.valor_total_capital }} K{{ valor.capital.saldo_reprogramado_proximo_periodo_capital }}
K{{ valor.capital.saldo_reprogramado_proximo_periodo_capital }}
T{{ valor.totais.saldo_reprogramado_periodo_anterior_total }}T{{ valor.totais.saldo_reprogramado_periodo_anterior_total }}T{{ valor.totais.repasses_previstos_sme_total }}T{{ valor.totais.repasses_previstos_sme_total }}T{{ valor.totais.repasses_no_periodo_total }}T{{ valor.totais.repasses_no_periodo_total }}T{{ valor.totais.outros_creditos }}T{{ valor.totais.outros_creditos }}T{{ valor.totais.valor_total }}T{{ valor.totais.valor_total }}T{{ valor.totais.despesas_no_periodo_total }}T{{ valor.totais.despesas_no_periodo_total }}T{{ valor.totais.saldo_reprogramado_proximo_periodo_total }}
+ T + {{ valor.totais.saldo_reprogramado_proximo_periodo_total }} + + + -{% endfor %} + {% endfor %} + +{% endif %} From bd9468ee46c976ddd8d80fb5de7515fb8f02fc11 Mon Sep 17 00:00:00 2001 From: ollyvergithub Date: Wed, 5 Oct 2022 11:42:27 -0300 Subject: [PATCH 2/4] =?UTF-8?q?fix(76004):=20Corrige=20exibi=C3=A7=C3=A3o?= =?UTF-8?q?=20de=20conta=20sem=20valores=20quando:=20Uma=20associa=C3=A7?= =?UTF-8?q?=C3=A3o=20tiver=2002=20contas,=20por=C3=A9m=20valor=20cadastrad?= =?UTF-8?q?o=20em=20apenas=20uma=20delas=20E=20tiver=20devolu=C3=A7=C3=B5e?= =?UTF-8?q?s=20ao=20tesouro=20cadastradas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../services/relatorio_consolidado_service.py | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/sme_ptrf_apps/dre/services/relatorio_consolidado_service.py b/sme_ptrf_apps/dre/services/relatorio_consolidado_service.py index 8762246b8..968ecf19f 100644 --- a/sme_ptrf_apps/dre/services/relatorio_consolidado_service.py +++ b/sme_ptrf_apps/dre/services/relatorio_consolidado_service.py @@ -1,3 +1,7 @@ +from celery import current_app +current_app.conf.CELERY_ALWAYS_EAGER = True +current_app.conf.CELERY_EAGER_PROPAGATES_EXCEPTIONS = True + import logging from django.db.models import Count, Sum, Q @@ -966,10 +970,8 @@ def _totaliza_previsoes_repasses_sme(associacao, periodo, tipo_conta, totais): def _totaliza_devolucoes_ao_tesouro(prestacao_conta, periodo, totais, tipo_conta): # Devoluções ao tesouro de PCs de Associações da DRE, no período e concluídas - # Acrescentado o filtro por conta para não permitir a exibição da coluna com valores zerados no Demonstrativo Financeiro - devolucoes = prestacao_conta.devolucoes_ao_tesouro_da_prestacao.filter( - despesa__rateios__conta_associacao__tipo_conta=tipo_conta - ) + devolucoes = prestacao_conta.devolucoes_ao_tesouro_da_prestacao.all() + for devolucao in devolucoes: totais['devolucoes_ao_tesouro_no_periodo_total'] += devolucao.valor @@ -1015,7 +1017,16 @@ def _totaliza_devolucoes_ao_tesouro(prestacao_conta, periodo, totais, tipo_conta totais = _totaliza_previsoes_repasses_sme(associacao, periodo, tipo_conta, totais) - soma_dos_totais = sum(totais.values()) + """ + Corrige exibição de conta sem valores quando uma associação + tiver 02 contas, porém valor cadastrado em apenas uma delas + e tiver devoluções ao tesouro cadastrada. + """ + totais_sem_devolucao_ao_tesouro = totais.copy() + key_to_remove = 'devolucoes_ao_tesouro_no_periodo_total' + totais_sem_devolucao_ao_tesouro.pop(key_to_remove, None) # No `KeyError` here + + soma_dos_totais = sum(totais_sem_devolucao_ao_tesouro.values()) """ Verificando se existe algum valor para incluir os dados no resultado From 527780ca55134bf8cc7fcd9b35e33b0be9f562e9 Mon Sep 17 00:00:00 2001 From: ollyvergithub Date: Wed, 5 Oct 2022 11:44:32 -0300 Subject: [PATCH 3/4] =?UTF-8?q?fix(76004):=20Remove=20c=C3=B3digo=20de=20d?= =?UTF-8?q?epura=C3=A7=C3=A3o=20do=20Celery?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sme_ptrf_apps/dre/services/relatorio_consolidado_service.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sme_ptrf_apps/dre/services/relatorio_consolidado_service.py b/sme_ptrf_apps/dre/services/relatorio_consolidado_service.py index 968ecf19f..c969749e0 100644 --- a/sme_ptrf_apps/dre/services/relatorio_consolidado_service.py +++ b/sme_ptrf_apps/dre/services/relatorio_consolidado_service.py @@ -1,7 +1,3 @@ -from celery import current_app -current_app.conf.CELERY_ALWAYS_EAGER = True -current_app.conf.CELERY_EAGER_PROPAGATES_EXCEPTIONS = True - import logging from django.db.models import Count, Sum, Q From 2d62acbac331028bcb102590409a5e3acdeeb164 Mon Sep 17 00:00:00 2001 From: ollyvergithub Date: Mon, 10 Oct 2022 07:06:59 -0300 Subject: [PATCH 4/4] hotfix(1.33.8) --- hotfixes.md | 3 +++ sme_ptrf_apps/__init__.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/hotfixes.md b/hotfixes.md index aab729387..05feaabda 100644 --- a/hotfixes.md +++ b/hotfixes.md @@ -1,3 +1,6 @@ +### 1.33.8 - 10/10/2022 - Hotfix - Soluções de bugs urgentes durante a sprint 51 +* (76004) Demonstrativo de Execução Físico-Financeira exibindo linha de total mesmo quando há apenas uma conta + ### 1.33.7 - 05/10/2022 - Hotfix - Soluções de bugs urgentes durante a sprint 51 * (74981) Cadastro de membros: Código EOL de estudante não encontrado diff --git a/sme_ptrf_apps/__init__.py b/sme_ptrf_apps/__init__.py index 3016b6553..34db0a0ed 100644 --- a/sme_ptrf_apps/__init__.py +++ b/sme_ptrf_apps/__init__.py @@ -1,4 +1,4 @@ -__version__ = "1.33.7" +__version__ = "1.33.8" __version_info__ = tuple(