none
how to calculate stock cost LIFO RRS feed

  • Domanda

  • hi;

    I have a table that called INVOICE like this

    DATE_ , AMOUNT , PRICE , IOCODE

    and We insert the record like this

    INPUT operations is SET IOCODE=1 and the OUTPUT operations is SET IOCODE=2

    and I want calculate the stock cost AS LIFO

    The Sample data like this ;

    create table #SampleData
    (
        ID int identity (1,1) not null,
        ITEMID int  not null,  
        IOCODE int  not null,   
        DATE_ datetime not null,
        AMOUNT DECIMAL(38,2) not null,
        PRICE DECIMAL(38,2) not null
    );
    insert into #SampleData (ITEMID , IOCODE, DATE_, AMOUNT, PRICE) values
        (1,1, '01.01.2018', 11, 100),
        (1,1, '01.03.2018', 10, 200),
        (1,2, '01.04.2018',  2, 200),
        (1,2, '01.06.2018', 4, 200),
        (1,2, '01.07.2018',  7, 157.44),
        (1,1, '01.08.2018',  10, 500);

    Thanks in advance .

    domenica 7 marzo 2021 09:37

Risposte

  • Hello Demir,

    US MSDN/Technet are read-only from 6th of January 2021 and they were migrated to Microsoft Q&A.

    Please follow the link to Q&A, where you will be able to ask/reply questions in English.



    Microsoft offre questo servizio gratuitamente, per aiutare gli utenti e aumentare il database dei prodotti e delle tecnologie. Il contenuto fornito “as is“ non comporta alcuna responsabilità da parte dell’azienda.

    lunedì 8 marzo 2021 06:18
    Moderatore

Tutte le risposte