Copy link to clipboard
Copied
Hello Forum,
I am sure you're all doing great.
Please I have a project that I seem not to know where to start from. Here is the description below.
I have a database with a table called tbl_items and the records in the table are as described below in 4 tables of items 2014 to items 2017.
The columns with Cars, Trucks, Long Vehicles, Trains and Boats represent the data in the items column and the column with month and year periods (January 2014, February 2014, March 2014, April 2014, May 2014 and the others) represent data in the period column.
Please note that the records items 2014 to items 2017 tables are supposed to be in the same tbl_items table in the database. For clarity purpose I had to break the records down in same years so my description will be easier to understand
Items 2014 | |||||
Cars | Trucks | Long Vehicles | Trains | Boats | |
Period | |||||
January 2014 | $ 2,500.00 | $ 3,456.00 | $ 2,500.00 | $ 2,500.00 | $ 2,500.00 |
February 2014 | $ 5,870.00 | $ 5,870.00 | $ 5,870.00 | $ 54,467.00 | $ 5,870.00 |
March 2014 | $ 4,875.00 | $ 4,875.00 | $ 43,567.00 | $ 4,875.00 | $ 4,875.00 |
April 2014 | $ 2,588.00 | $ 2,588.00 | $ 2,588.00 | $ 2,588.00 | $ 2,588.00 |
May 2014 | $ 4,554.00 | $ 4,554.00 | $ 4,554.00 | $ 4,554.00 | $ 345,656.00 |
Total | $ 20,387.00 | $ 21,343.00 | $ 59,079.00 | $ 68,984.00 | $ 361,489.00 |
Table for 2014
Items 2015 | |||||
Cars | Trucks | Long Vehicles | Trains | Boats | |
Period | |||||
January 2015 | $ 2,500.00 | $ 3,456.00 | $ 2,500.00 | $ 2,500.00 | $ 2,500.00 |
February 2015 | $ 5,870.00 | $ 5,870.00 | $ 5,870.00 | $ 54,467.00 | $ 5,870.00 |
March 2015 | $ 4,875.00 | $ 4,875.00 | $ 43,567.00 | $ 4,875.00 | $ 4,875.00 |
April 2015 | $ 2,588.00 | $ 2,588.00 | $ 2,588.00 | $ 2,588.00 | $ 2,588.00 |
May 2015 | $ 4,554.00 | $ 4,554.00 | $ 4,554.00 | $ 4,554.00 | $ 345,656.00 |
Total | $ 20,387.00 | $ 21,343.00 | $ 59,079.00 | $ 68,984.00 | $ 361,489.00 |
Table for 2015
Items 2016 | |||||
Cars | Trucks | Long Vehicles | Trains | Boats | |
Period | |||||
January 2016 | $ 2,500.00 | $ 3,456.00 | $ 2,500.00 | $ 2,500.00 | $ 2,500.00 |
February 2016 | $ 5,870.00 | $ 5,870.00 | $ 5,870.00 | $ 54,467.00 | $ 5,870.00 |
March 2016 | $ 4,875.00 | $ 4,875.00 | $ 43,567.00 | $ 4,875.00 | $ 4,875.00 |
April 2016 | $ 2,588.00 | $ 2,588.00 | $ 2,588.00 | $ 2,588.00 | $ 2,588.00 |
May 2016 | $ 4,554.00 | $ 4,554.00 | $ 4,554.00 | $ 4,554.00 | $ 345,656.00 |
Total | $ 20,387.00 | $ 21,343.00 | $ 59,079.00 | $ 68,984.00 | $ 361,489.00 |
Table for 2016
Items 2017 | |||||
Cars | Trucks | Long Vehicles | Trains | Boats | |
Period | |||||
January 2017 | $ 2,500.00 | $ 3,456.00 | $ 2,500.00 | $ 2,500.00 | $ 2,500.00 |
February 2017 | $ 5,870.00 | $ 5,870.00 | $ 5,870.00 | $ 54,467.00 | $ 5,870.00 |
March 2017 | $ 5,875.00 | $ 4,875.00 | $ 87,792.00 | $ 52,258.00 | $ 4,875.00 |
April 2017 | $ 2,588.00 | $ 2,588.00 | $ 2,588.00 | $ 2,588.00 | $ 2,588.00 |
May 2017 | $ 4,554.00 | $ 5,268.00 | $ 4,554.00 | $ 4,554.00 | $ 95,535.00 |
Total | $ 21,387.00 | $ 22,057.00 | $ 103,304.00 | $ 116,367.00 | $ 111,368.00 |
Table for 2017
Now based on the records in the tables above, I want to be able to filter the table to populate my report table with the totals as seen below. This means if I want to see only payments for Cars and Boats for the years 2014, 2015 and 2016. After selecting them from the select options, the table below should show with only the details of the items I selected
2014 | 2015 | 2016 | Grand Total | |
Cars | $ 20,387.00 | $ 20,387.00 | $ 20,387.00 | $61,161.00 |
Boats | $ 361,489.00 | $ 361,489.00 | $ 361,489.00 | $1,084,467.00 |
Grand Total | $381,876.00 | $381,876.00 | $381,876.00 | $1,145,628.00 |
I don't know how to write the php code to filter this records and populate them on the table. It's more than one week I have been on this. Please I need your help.
Thank you in advance
Michael
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I am working with someone to resolve this issue. When I am done, I will show us how...