Skip to Content
0
Former Member
May 30, 2011 at 01:36 PM

informe de ventas por articulos

1110 Views

Hola!!!

Retomando un query sobre ventas por productos

SELECT 
T0.[DocDate], 
T0.[DocNum],
 T1.[ItemCode], 
T1.[Dscription],
 T1.[VendorNum],
 T1.[Quantity], 
T1.[Price], 
T1.[LineTotal], 
T2.[SlpName] 

FROM OINV T0  
INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
INNER JOIN OSLP T2 ON T0.SlpCode = T2.SlpCode 
WHERE T0.[DocDate] >=[%0] and  T0.[DocDate] <=[%1]

me di cuenta, que me esta tomando saldos iniciales que no me interesan tenerlos en cuenta. ya que estos estan creados como factura de clientes tipo servicio, por lo cual anexe al query and T0.[DocType]='I' , pero no obtuve los resultados esperados porque me siguen registrando estos saldos, además habia creado otra consulta teniendo en cuenta la serie pero no me sale las facturas que se hicieron manuales:

SELECT 
T3.[SeriesName],
T0.[DocNum] as 'COD_FACT',
T0.[CardCode] as 'COD_CLIENTE', 
T0.[CardName] as 'NOMBRE DE CLIENTE', 
T0.[DocDate] AS ' FECHA DE FACTURA', 
T1.[ItemCode] AS 'COD_ARTICULO', 
T1.[Dscription] AS 'DESCRIPCION',
T1.[Quantity] AS ' CANTIDAD',
T1.[GrossBuyPr] AS ' PRECIO DE COSTO',
(T1.[Quantity]*T1.[GrossBuyPr])as 'TOTAL COSTO',
T1.[PriceBefDi] AS 'PRECIO UNITARIO',
T1.[Price] AS 'PRECIO TRAS EL DESCUENTO',
T1.[LineTotal] AS 'PRECIO TOTAL DE ARTICULO',
T2.[SlpName] AS 'NOM_EMPLEADO' 

FROM OINV T0  
INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry 
INNER JOIN OSLP T2 ON T0.SlpCode = T2.SlpCode
INNER JOIN NNM1 T3 ON T0.Series = T3.Series

WHERE T0.[DocType]='I' AND (T0.[DocDate] >=[%0] AND T0.[DocDate] <=[%1]) and  left(T3.[SeriesName],3) in ('1P','2P','1E','2E','1C','2C','11P','12P','11E','12E','12C','11C')

Edited by: jcarito on May 30, 2011 8:36 AM