Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9190

Re: Reporte de Factura de Proveedor vs Orden de Compra

$
0
0

Gracias por el dato, hace tiempo que no hago reportes para ejecutarlos desde el Query Manager , prueba de esta manera:

 

-- VISTA PRINCIPAL
SELECT DISTINCT
T0.DocNum [Doc SAP] ,T0.NumAtCard [Referencia] ,T0.DocDate [Fecha],
T1.DocNum [Fact. SAP], T1.NumAtCard [Referencia], T1.DocDate [Fecha]
FROM OPOR T0
LEFT JOIN
(
-- VISTA "FACTURA - ÓRDEN DE COMPRA
SELECT DISTINCT T1.DocNum, T1.NumAtCard, T1.DocDate, T0.BaseEntry, T0.BaseType
FROM PCH1 T0
INNER JOIN OPCH T1 ON T0.DocEntry = T1.DocEntry
WHERE T0.BaseType = 22

UNION ALL

-- VISTA "FACTURA - ENTRADA - ÓRDEN DE COMPRA
SELECT DISTINCT T1.DocNum, T1.NumAtCard, T1.DocDate, T2.BaseEntry, T2.BaseType
FROM PCH1 T0
INNER JOIN OPCH T1 ON T0.DocEntry = T1.DocEntry
INNER JOIN PDN1 T2 ON T0.BaseEntry = T2.DocEntry AND T0.BaseType = T2.ObjType
WHERE T2.BaseType = 22
) T1
ON T0.DocEntry = T1.BaseEntry AND T0.ObjType = T1.BaseType
WHERE T0.DocDate >= [%0] AND T0.DocDate <= [%1]
ORDER BY 1

 

Espero sea de utilidad.

 

Saludos,

 

 

 



Viewing all articles
Browse latest Browse all 9190

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>