Skip to Content

Facturas no muestran lotes de los productos a vender

Hola.

Estoy trabado con una query, donde necesito me muestre el resultado de las facturas que tienen un producto especifico y un lote especifico.

La que desarrollo me muestra más facturas (un total de 9) siendo que sólo 2 tienen esas condiciones entregadas.

La query es la siguiente:

SELECT

T0.[DocNum],

T0.[DocDate],

T0.[CardCode],

T1.[ItemCode],

T1.[Dscription],

T1.[Quantity],

T1.[unitMsr]

FROM OINV T0 INNER JOIN INV1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OITM T2 ON T1.[ItemCode] = T2.[ItemCode] INNER JOIN OBTN T3 ON T2.[ItemCode] = T3.[ItemCode]

WHERE T1.[ItemCode] ='pt-2020' and T3.[DistNumber] ='PT-20203336-1'

El resultado es el de la foto, cuando debiese mostrar sólo las facturas de la linea 1 y la linea 9 que cumplen esas condiciones.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Aug 10, 2016 at 08:56 PM

    Intenta con esto, en lo personal me funciona

    SELECT

    T1.[DocEntry],T0.[DocNum],T0.[DocDate],T0.[CardCode],T0.[CardName],

    T1.[ItemCode],T1.[Dscription],T1.[Quantity],T1.[unitMsr],T2.BatchNum

    FROM OINV T0 INNER JOIN INV1 T1 ON T0.[DocEntry] = T1.[DocEntry]

    INNER JOIN IBT1 T2 on T1.DocEntry =T2.BaseEntry and T1.ItemCode=T2.ItemCode and T1.LineNum=T2.BaseLinNum

    WHERE T1.[ItemCode] ='PT0016' and T2.[BatchNum] ='ABC'

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 10, 2016 at 06:19 PM

    Hola Daniel

    Prueba con el campo BatchNum

    Add a comment
    10|10000 characters needed characters exceeded

    • SELECT

      T1.[DocEntry],

      T0.[DocNum],

      T0.[DocDate],

      T0.[CardCode],

      T0.[CardName],

      T1.[ItemCode],

      T1.[Dscription],

      T1.[Quantity],

      T1.[unitMsr],

      T3.[DistNumber]

      FROM OINV T0 INNER JOIN INV1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OITM T2 ON T1.[ItemCode] = T2.[ItemCode] INNER JOIN OBTN T3 ON T2.[ItemCode] = T3.[ItemCode]

      WHERE T1.[ItemCode] ='pt-2020' and T3.[DistNumber] ='PT-20203336-1'

      Gracias por tu tiempo-

  • author's profile photo Former Member
    Former Member
    Posted on Aug 10, 2016 at 06:44 PM

    Hola Daniel!!

    Que te muestra la consulta si al select le agregas el "DistNumber"?

    Saludos!

    Add a comment
    10|10000 characters needed characters exceeded

    • es lo mismo, sería decirle que busque en la factura, si le coloco el Nro. de la factura me arroja sólo lo de esa factura pero no es la idea.

      Se pretende que si cumple la condición arroje el resultado.

      Aún sigo buscando como generar dicho resultado, no he podido llegar al correcto.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.