Reporte Comisiones Query

Buenas tengo esta consulta en el Query de comisiones pero ocupo que me jale las facturas que están canceladas por medio de conciliación con un pago a cuenta


Select Vendedor,TipoDocumento,Moneda,Documento,FechaRecibo,FechaDocumento,MontoFacturaColon,MontoFacturaDolar,(MontoFacturaColon * (select Commission/100 from OSLP where SlpCode=Comisiones.SlpCode) ) ComisionColon,
(MontoFacturaDolar * (select Commission/100 from OSLP where SlpCode=Comisiones.SlpCode) )ComisionDolar,
CardName from (SELECT Distinct
	t4.SlpName as Vendedor,
	t4.slpcode,
	'FA' AS TipoDocumento,DocCur Moneda,
	T3.[DocNum] as Documento,
	(select DocDate from ORCT where DocNum = (SELECT max(T0.[DocNum]) as ConsecutivoSAP FROM ORCT T0  
		INNER JOIN RCT2 T1 ON T0.DocEntry = T1.DocNum 
		INNER JOIN OINV T2 ON T1.DocEntry = T2.DocEntry 
 		WHERE  T2.[DocNum] = T3.[DocNum] )) as FechaRecibo,
	T3.[DocDate] as FechaDocumento,
	(((T3.DocTotalSy)-t3.VatSumSy)- ISNULL((SELECT (sum(T10. TotalSumSy)-sum(T10.TotalSumSy*T13.DiscPrcnt/100 ))		
								FROM ORIN T13 INNER JOIN RIN1 T10 ON T10.DocEntry = T13.DocEntry
									
									INNER JOIN OSLP T14 ON T13.SlpCode = T14.SlpCode
								WHERE T13.DocStatus = 'C' 
								and T10.BaseType = 13
								and T10.BaseRef = T3.[DocNum]),0.00)
	) AS [MontoFacturaDolar],
		(((T3.DocTotal)-t3.VatSum)- ISNULL((SELECT (sum( T10.LineTotal)-sum(T10.LineTotal*T13.DiscPrcnt/100 ))		
								FROM ORIN T13 INNER JOIN RIN1 T10 ON T10.DocEntry = T13.DocEntry
									
									INNER JOIN OSLP T14 ON T13.SlpCode = T14.SlpCode
								WHERE T13.DocStatus = 'C' 
								and T10.BaseType = 13
								and T10.BaseRef = T3.[DocNum]),0.00)
	) AS [MontoFacturaColon],
	T3.[CardName]

FROM ORCT T6 INNER JOIN RCT2 T5 ON T5.DocNum = T6.DocEntry
	INNER JOIN OINV T3 ON T3.DocEntry = T5.DocEntry
	INNER JOIN OSLP T4 ON T3.SlpCode = T4.SlpCode
WHERE T3.DocStatus = 'C' and (T6.[DocDate] >= [%0] and T6.[DocDate] <= [%1]) and T5.InvType=13
	and T6.Canceled <> 'Y' and T3.SlpCode != -1 ) As Comisiones

Hola @Natalia2502 debes utilizar las tablas OITR, ITR1 para mostrar facturas que han sido reconciliadas con un pago.

Slds,

Gracias, una consulta en que parte de la consulta debo de incluir estas tablas ?

Una opción es unir a tu query otro con documentos que han sido reconciliados.

Este tema se cerró automáticamente 30 días después de la última publicación. No se permiten nuevas respuestas.