Hi everyone,
I am using PHP and Mysql to make a small inventory program. I have a problem with end_stock field. Detail:
I have 2 tables:
1. Receiving:
ID_Receive | ProductID | Date | Quantity | Price
1 | A | 01/07/2012 | 5 | 1500
2 | B | 02/07/2012 | 3 | 1100
3 | C | 03/07/2012 | 5 | 920
4 | A | 10/07/2012 | 5 | 1550
5 | C | 01/08/2012 | 4 | 1010
6 | A | 15/08/2012 | 3 | 1420
2. Deliveried
ID_Deliver| ProductID | Date | Quantity
1 | B | 02/07/2012 | 1 |
2 | A | 03/07/2012 | 1 |
3 | C | 04/07/2012 | 1 |
4 | A | 05/07/2012 | 1 |
5 | C | 01/08/2012 | 1 |
6 | A | 03/08/2012 | 1 |
7 | B | 04/08/2012 | 1 |
8 | A | 05/08/2012 | 1 |
Now, I need calculator stock_end of August-2012. The result table is
Product ID | Start Quant. | Price | Receiv Quant. | Price | Deliver Quant. | Price | End Quant. | Price|
A | 4 | 1500 | - | - | 2 | 1500 | 2 | 1500 |
A | 5 | 1550 | - | - | - | - | 5 | 1550 |
A | - | - | 3 | 1420 | - | - | 3 | 1420 |
B | 2 | 1100 | - | - | 1 | 1100 | 1 | 1100 |
C | 4 | 920 | - | - | 1 | 920 | 3 | 920 |
C | - | - | 4 | 1010 | - | - | 4 | 1010 |
Any help me? I can't display and calculator it?
ngocham2001 0 Newbie Poster
dinacristi 2 Newbie Poster
ngocham2001 0 Newbie Poster
LastMitch
ngocham2001 0 Newbie Poster
dinacristi 2 Newbie Poster
ngocham2001 0 Newbie Poster
dinacristi 2 Newbie Poster
LastMitch commented: Nice work! +2
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.