Project

General

Profile

Actions

Tareas #4467

open

NUEVO reporte de retenciones autorizadas de facturas reversadas

Added by Jose Orlando over 1 year ago. Updated over 1 year ago.

Status:
Resuelta
Priority:
Normal
Assignee:
Start date:
01/30/2024
Due date:
% Done:

0%

Estimated time:

Description

select
i.documentno no_factura,
i.dateinvoiced::date as fecha_factura,
bp.name as proveedor,
i.docstatus,
i.withholdingno no_retencion,
a.SRI_AuthorizationCode
from c_invoice i
inner join c_bpartner bp on bp.c_bpartner_id = i.c_bpartner_id
inner join SRI_Authorization a on a.SRI_Authorization_ID=i.SRI_Authorization_ID and a.SRI_AuthorizationDate notnull
where i.docstatus not in ('CO')
and i.issotrx='N'
and not exists (select 1 from c_invoice ic
where ic.issotrx='N'
and ic.docstatus in ('CO')
and ic.withholdingno=i.withholdingno)
and i.dateinvoiced::date>= '2021-01-01'
order by 5


Files

Actions

Also available in: Atom PDF