Skip to Content
author's profile photo Former Member
Former Member

Informe inventario

Buen dia

Alguien que me pueda ayudar con una pista o algo le agradeceria mucho

mi jefe me pidio un informe que me muestre en el 2010 mes a mes

el estado del inventario

es decir al finalizar el mes cuanta cantidad habia en inventario de productos por grupo

y no tengo ni idea de informes de inventarios se los agradeceria mucho

que salga por ejemplo asi

producto enero febrero marzo abril

limpieza 10 0 3 4

Le agradezco mucho al que me pueda ayudar con cualquier cosa

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Sep 05, 2011 at 06:27 PM

    Revisa este query

    declare @dataInicio datetime
    declare @dataFinal datetime
    declare @tempo int
    
    SET @tempo=(SELECT TOP 1 T0.TRANSNUM FROM OINM T0 WHERE T0.[DocDate] >=[%0] 
    AND T0.[DocDate] <=[%1])
    SET @dataInicio=(SELECT '[%0]')
    SET @dataFinal=(SELECT '[%1]')
    
    select [Artículo]=t1.itemcode, Consumo=isnull(t1.consumo,0), [Consumo medio diario]=isnull(t1.consumo/datediff(day,@dataInicio,@dataFinal),0), [Stock inicial]
    =isnull(coalesce(t0.saldoinic,0),0),
     [Stock final]=isnull(coalesce(t0.saldoinic,0)+coalesce(t1.saldofin,0),0),
     [Stock promedio]= isnull((coalesce(t0.saldoinic,0)+(coalesce(t0.saldoinic,0)+t1.saldofin))/2,0),
     [Rotación stock]= case isnull((coalesce(t0.saldoinic,0)+(coalesce(t0.saldoinic,0
    )+t1.saldofin))/2,0) 
    when 0 then 0 else isnull(t1.consumo / ((coalesce(t0.saldoinic,0)+
    (coalesce(t0.saldoinic,0)+t1.saldofin))/2) ,0)
     end , [Cobertura de stock]= case isnull(coalesce(t1.consumo/datediff(day,@dataInicio,@dataFinal),0),0)
     when 0 then 0 else isnull(((coalesce(t0.saldoinic,0)+(coalesce(t0.saldoinic,0)
    +t1.saldofin))/2)/
     ( t1.consumo/datediff(day,@dataInicio,@dataFinal)),0) end from (select a1.itemcode, saldoInic=isnull(sum(coalesce(s1.Inqty,0))-sum(coalesce(s1.outqty,0)),0) from oitm
     a1 join oinm s1
     on a1.itemcode=s1.itemcode where s1.docdate<@dataInicio group by a1.itemcode) as t0 right join
     (select a.itemcode, entradas=isnull(sum(s.Inqty),0), consumo=isnull(sum(s.outqty),0),
     saldoFin=isnull(sum(s.Inqty)-sum(s.outqty),0) FROM oinm s join oitm a on a.itemcode=s.itemcode
     WHERE s.docdate BETWEEN @dataInicio and @dataFinal group by a.itemcode) t1
     on t1.itemcode=t0.itemcode 
    

    Add a comment
    10|10000 characters needed characters exceeded

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.