在一个列表MVC 5中获取当前和旧记录

时间:2018-10-24 07:18:21

标签: asp.net asp.net-mvc-5 rotativa

我的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。如果user2018-10-24上添加具有相同con_id = 2的新记录,则将使用userRotativa显示一个列表,其中将包含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  

我该如何实现?
任何帮助将不胜感激。

0 个答案:

没有答案