Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

opening & closing stock like in tally

$
0
0

hi

i am using sql server and my table is 

CREATE

TABLE #x
(
   TransactionDate SMALLDATETIME,
   Item CHAR(1), 
   RecQty INT, 
   RecRate INT,
   IssueQty INT,
   IssueRate INT, 
);

INSERT

#x

SELECT     '20110601','A',10,30,50,100
UNION
ALL SELECT '20110602','A',15,1,30,12
UNION
ALL SELECT '20110603','C',20,20,10,30
UNION
ALL SELECT '20110604','A',1,5,20,20
UNION
ALL SELECT '20110604','B',3,2,5,50;

select * from #x

DROP TABLE #x;

i want the result as telly 9 erp giving stock in FIFO method as given format


openingQty |Rate | value  |InwordQty|Rate|Value| OutwordQty|Rate|Value|ClosingQty |Rate|Value

I have table with data

TransactionDate         Item            RecQty      RecRate     IssueQty    IssueRate

----------------------- ---- ----------- ----------- ----------- -----------

2011-06-01 00:00:00     A                10                30         50             100

2011-06-02 00:00:00     A                15                  1           30              12

2011-06-03 00:00:00     C                  20                20         10             30

2011-06-04 00:00:00     A                1                     5           20             20

2011-06-04 00:00:00     B                 3                    2             5              50

If  I want stock  from  2011-06-02 00:00:00      to 2011-06-04 00:00:00     , how to you calculate stock in following format with  data please let me know

openingQty |Rate | value  |InwordQty|Rate|Value| OutwordQty|Rate|Value|ClosingQty |Rate|Value



Thanks Best Regard Naweez



Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>