Final Exam

Complete this final exam on your class web server. Grading will be partially automated so you must follow instructions exactly as stated. Please watch this video on how to get started. The exam is due by Friday December 16th at midnight, with a 1% per day late fee.

Before you start:

  1. Create a directory on your server named final-00000000 where "00000000" is your 8-digit UHID. If you don't want to use your actual 8-digit ID then email me another 8-digit number to use.
  2. Create a database names FINAL.
  3. Copy in the Invoices, LineItems and Product tables from the database used in Exercise 13-1. Make their names exactly the same.

Place all your files, including APIs in this directory.

Database and Directory Setup 15 Points
Invoices copied correctly 2
LineItems copied correctly 2
Products copied correctly 2
Database name correct 1
Directory name correct 2
_global.php 2
Bootstrap files copied correctly 2
Angular files copied correctly 2

Q1: PHP Bootstrap Future Value Application using POST

On your server, using PHP, JavaScript and MySQL, create the exact same functioning website you completed in Exercise 13-1 except add the Product Name as the first column (for 5 columns total). Make the file names the same (except their extensions). You can just copy over all the directories and files to make sure you get the right ones for Bootstrap.

PHP Version 40 Points
Filename is Default.php 2
Uses _global.php 1
Invoices SELECT statement correct 2
REQUEST[] or equivalent used 2
Form tag action correct 2
Select tag name field correct 2
Select event handler invocation 2
Invoices While loop position correct 2
Option tag echo 2
Option tag selected mechanism 2
InvoiceNumber defaults to first invoice 2
LineItems SELECT joins Product 2
Select fields specified unambiguously 1
LineItems WHILE position correct 2
Bootstrap column class columns=12 2
Fields echo correct 5
InvoiceNumber defaults to first invoice 2
Unnecessary code removed 3
Extra 2

Q2: PHP Bootstrap Future Value Application using Angular

Export the files from a blank Ionic Creator project into your directory. Rename the index.html file to angular.html. Replace the html file in the templates folder with code from your Default.php file from Q1 and make it work using Angular directives. You will also need to add code to the controllers.js and services.js files in the js directory.

For GetInvoices.php use:

<?php
include('_global.php');
$records = [];
$return = mysql_query("SELECT * FROM Invoices WHERE Total>300", $conn);
$message = mysql_error($conn);
if($message == '') while($record = mysql_fetch_assoc($return)) array_push($records,$record);
echo json_encode(["message" => $message, "records" => $records ], JSON_PRETTY_PRINT);
?>

For GetLineItems.php use:

<?php
include('_global.php');
$records = [];
$InvoiceNumber = $_REQUEST['InvoiceNumber'];
$return = mysql_query("SELECT InvoiceNumber, LineItems.ProductID, LineItems.UnitPrice, Quantity, Extension, Name FROM LineItems LEFT JOIN Products ON LineItems.ProductID=Products.ProductID WHERE InvoiceNumber='$InvoiceNumber'", $conn);
$message = mysql_error($conn);
if($message == '') while($record = mysql_fetch_assoc($return)) array_push($records,$record);
echo json_encode(["message" => $message, "records" => $records ], JSON_PRETTY_PRINT);
?>

Rubric:

Angular Version 45 Points
index.html renamed angular.html 2
Bootstrap tags 2
Remove header bar 1
Unnecessary code removed 2
Select ng-model 2
Select ng-options 2
Select ng-change 2
tr ng-repeat 2
Bootstrap column class columns=12 2
Fields echo correct 5
.controller declaration services 2
function parameters 1
GetInvoices scope.invoices 2
GetInvoices default invoice 2
GetLineItem scope function 2
GetInvoices scope.items 2
.service GetLineItem 2
Query string 2
URL to GetLineItem.php (http: ok) 1
GetLineItems.php 2
.service GetInvoices 2
URL to GetInvoices.php (http: ok) 1
GetInvoices.php 2

Due: Friday December 16th at midnight. There will be a 1% late fee assessed for each day late.