TSQL Calc Cost of goods Sold with the three method FIFO ,LIFO ,Avg
$10-1000 USD
Κλειστή
Αναρτήθηκε περίπου 6 χρόνια πριν
$10-1000 USD
Πληρωμή κατά την παράδοση
I Use Sql server 2012
I have ERP System and I need to calc FIFO,LIFO and Average cost in for the inventory Item
I have 4 types of transaction 'IN' (Purchase) ,'OUT' Sale ,'INR' Returned Purchase , ''OUTR' for Sales return
Database Structure
- Items Table ( Has ItemID, And ItemID and Calculation Method )
-Transaction Table (has ItemID,Date,Qty,Price,TransactionCode)
I need To calculate the Avg ,Fifo And Lifo after any Update or save in the Transaction table because all data depened on the Transaction Date ,
for example After Purchase
ID ItemID Qty Price TransCode CurrentQty CurrentValue
1 1000 10 10 IN 10 100
2 1000 10 20 IN 20 300
If In FIFO
3 1000 6 0 Out 14 240
If In LIFO
3 1000 6 0 Out 14 180
If In Avg
3 1000 6 0 Out 14 210
the Problem Will happen If the Customer Need to Delete the Transaction With ID=1
then I must re Calc All Rows again depend to the change , and this need very fast TSQL Code
Hi, I would like to write t sql code for getting the average value in case of fifo, lifo, avg
Get in touch to discuss more.
Available to start now.
Regards,
Manish
Sir I have vast experience in databases and TSQL,u can view my profile and complete on time.I am a full time freelancer,
working for more than 2 years now. Have clients from different parts of the world.
I have extensive experience as a Commercial Analyst including work on costings, which lead on to work as a Database Developer and DBA with most of my current work in database development. I would be pleased to do this work for you and would ensure it was done efficiently and carefully, with test examples written up as tSQLt tests to ensure the results were as expected. As well as attending to code I would if required / allowed advise on indexing of the relevent database tables (reduction in overall price if this is not required or allowed)
I am currently very busy with some deadlines in August so would not be able to do the work until early September hence the long time period quoted.
Hello Sir,
I have read your problem. You need calculate your Avg, Fifo and Lifo after any entry update or insert.
I can do it for you. I have work before this type of task in my office. If any Item Purchase then store will update by increase If sale then decrease stock