# Controllers and Views

**URL:** <https://www.ruby-forum.com/t/controllers-and-views/146778>\
**Category:** Rails\
**Created:** [August 25, 2008, 12:44pm UTC](https://www.ruby-forum.com/t/controllers-and-views/146778 "2008-08-25T12:44:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yung-Rick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/dec6dc/32.png) [@Yung-Rick](https://www.ruby-forum.com/u/Yung-Rick)\
**Post date:** [August 25, 2008, 12:44pm UTC](https://www.ruby-forum.com/t/controllers-and-views/146778/1 "2008-08-25T12:44:48Z")

</div>

Hi all,  
I have two tables: tbl1 and tbl2. Both tables tracks ‘stocks’ that  
have been sent and those that have been retrieved for a particular  
date. information is stored in a database explained below

tbl1 has fiels id, name, stock, date\_retrv (retrv = retrieved),  
totl\_retrv (totl=total)  
tbl2 has fields id, name, stock, date\_sent, totl\_sent

I want to format an inventory detail to show like this.

Date (Common Date,Literally) | Initial Stock | Retrieved | Sent |  
Remaining Cards

```auto
2008-08-08 | 0 |
10 |5 | 20
2008-08-08 | 20 |
15 |10 | 25

Remaining = (Initial Stock + Retrieved) - Sent

So now my problem is to be able to use my controller and view to get
this information formatted like the above table into a view page.

Any Suggestions.

Thanks
Yung-Rick :-)
```
