Merge pull request 'correcion de saldos temporales' (#258) from fix/saldos_temporales_procesadas into development

Reviewed-on: ADUANASOFT/anexo76#258
This commit is contained in:
2026-03-30 14:49:04 +00:00

View File

@@ -262,7 +262,7 @@ BASE_JOINS = """
WHERE tenant_id = :tenant_id
ORDER BY import_item_line_id, id DESC
) lm ON lm.import_item_line_id = il.id
LEFT JOIN (
JOIN (
SELECT
import_item_line_id,
SUM(
@@ -356,6 +356,7 @@ def _query_ped(filters: SaldosFilter) -> tuple:
{BASE_JOINS}
WHERE ih.tenant_id = :tenant_id
AND ih.operation_type = 'imp'
AND ent.qty_impo > 0
{company_filter}
{date_filter}
{level_filter}
@@ -380,6 +381,7 @@ def _query_fpp(filters: SaldosFilter) -> tuple:
{BASE_JOINS}
WHERE ih.tenant_id = :tenant_id
AND ih.operation_type = 'imp'
AND ent.qty_impo > 0
{company_filter}
{date_filter}
{level_filter}
@@ -403,6 +405,7 @@ def _query_ffa(filters: SaldosFilter) -> tuple:
{BASE_JOINS}
WHERE ih.tenant_id = :tenant_id
AND ih.operation_type = 'imp'
AND ent.qty_impo > 0
{company_filter}
{date_filter}
{level_filter}
@@ -434,6 +437,7 @@ def _query_par(filters: SaldosFilter) -> tuple:
{BASE_JOINS}
WHERE ih.tenant_id = :tenant_id
AND ih.operation_type = 'imp'
AND ent.qty_impo > 0
{company_filter}
{id_filter}
{date_filter}
@@ -466,6 +470,7 @@ def _query_cla(filters: SaldosFilter) -> tuple:
{BASE_JOINS}
WHERE ih.tenant_id = :tenant_id
AND ih.operation_type = 'imp'
AND ent.qty_impo > 0
{company_filter}
{id_filter}
{date_filter}