You are on page 1of 2

ELECTIVE 3 – Activity No.

2
Data Dashboard: Generation of Reports in Graphical Representation

REQUIREMENTS:
1. Installed XAMPP
2. Sublime Text 3 (Text Editor)/ any available text editor
3. Browser (Google or Mozilla Firefox)
4. Internet Connectivity
NOTE: Make it sure that you have done working with Activity #1 with sample records inserted in
your Database Tables.

DO THE FOLLOWING STEPS:

STEP 1: Download the file folder Data Dashboard. Copy and paste it in the C:/xampp/htdocs
folder.

STEP 2: Extract the file.

STEP 3: Open dbconn.php using Sublime Text Editor or any text editor, it contains connections
from your database. Make it sure you created a database name scm_project.

STEP 4: Open index.php in the browser. Take Note: every time you have changes in your php files,
always reload your browser to see the result/output.

STEP 5: Open salesreport.php using text editor. See the line of codes below in the
salesreport.php, change/replace the following fieldnames (in bold text) based on your actual
fieldnames in your database table name “tbl_orders”.

Note: The Data Type of your fieldname dateordered should be DATE.

$query = "SELECT total_amount, dateplaced, SUM(total_amount) as number FROM tbl_orders


GROUP BY dateplaced ORDER BY orderid ASC";

echo "['".date("F d, Y", strtotime($row["dateplaced"]))."', ".$row["number"]."],";

STEP 6: Open numberofcustomers.php using text editor. See the line of codes below in the
numberofcustomers.php, change/replace the following fieldnames (in bold text) based on your
actual fieldnames in your database table name “tbl_customers”.

$query = "SELECT lname, gender, count(*) as number FROM tbl_customers GROUP BY gender ORDER
BY customerid ASC";
STEP 7: Open numberofsuppliers.php using text editor. See the line of codes below in the
numberofsuppliers.php, change/replace the following fieldnames (in bold text) based on your
actual fieldnames in your database table name “tbl_suppliers”.

$query = "SELECT lname, count(*) as number FROM tbl_suppliers ORDER BY supplierid ASC";

STEP 8: Open productstockreports.php using text editor. See the line of codes below in the
productstockreports.php, change/replace the following fieldnames (in bold text) based on your
actual fieldnames in your database table name “tbl_products and tbl_product_category”.

$query = "SELECT productname, category_name, item_avail, SUM(item_avail) as number FROM


tblproducts LEFT JOIN tblproduct_category ON tblproduct_category.prodcatid=tblproducts.prodcatid
GROUP BY item_avail ORDER BY productid ASC";

echo "['".$row["category_name"]."', ".$row["number"]."],";

You might also like