我的db
中有2个表:
Table 1
list_type_id list_num con_id date_added
1 1st list 2 2018-08-20
2 2nd list 2 2018-10-20
3 1st list 3 2018-6-10
4 1st list 4 2018-5-15
5 3rd list 2 2018-10-23
Table 2
table_two_id list_type_id rates quantity
1 1 2500 560
2 1 2600 590
3 1 5600 450
4 2 9500 960
5 2 6300 56
6 2 950 456
7 2 850 960
8 3 96000 150
9 3 96450 25
//so on
当用户添加新记录时,它将被分为这些2 Tables
。如果user
在2018-10-24
上添加具有相同con_id = 2
的新记录,则将使用user
向Rotativa
显示一个列表,其中将包含2 columns
:
Old Present
9500000 85000
1050000 95000
1950000 4560
//so on..
//Old column will contain the Sum (rates * quantity) of previous added records of same con_id
//Present column will contain the Sum (rates * quantity) of this current list that user just added of same con_id
我该如何实现?
任何帮助将不胜感激。