include $_SERVER['DOCUMENT_ROOT'] . "/WebBuilder/pdf.class.php";
$db = new DBMain();
$booking_id = $_GET['booking_id'];
$booking_res = $db->exec_query('bookings', ['*'], '', '', '', '', "record_id = '{$booking_id}'", "", false);
// echo "SELECT * FROM bookings WHERE record_id = '{$booking_id}'";
$booking = $booking_res->fetch_assoc();
if (explode(',', substr($booking['assessments'], 1))) {
$assess = explode(',', substr($booking['assessments'], 1));
$client_employee = explode(',', substr($booking['client_employees'], 1));
$assesment_res = $db->exec_query('assesses', ['*'], '', '', '', '', "booking = {$booking_id}", "", false);
// echo "SELECT * FROM assesses WHERE booking = {$booking_id}";
$assessor = $assesment_res->fetch_assoc();
$candidate_res = $db->exec_query('client_employees', ['*'], '', '', '', '', "record_id = {$assessor['client_employees_id']}", "", false);
// echo "SELECT * FROM client_employees WHERE record_id = {$booking['client_employees_id']}";
$candidate = $candidate_res->fetch_assoc();
$client_res = $db->exec_query('clients', ['*'], '', '', '', '', "record_id = {$assessor['clients_id']}", 'ORDER BY clients_name ASC');
// echo "SELECT * FROM clients WHERE record_id = {$tests_sec['clients_id']}";
$client = $client_res->fetch_assoc();
$date = date("Y-m-d", strtotime($booking['date_done']));
$newDate = date("Y-m-d", strtotime($date . " +12 months"));
// echo "../uploads/$assessor[image_file_path]";
$html .= "
ASSESSOR LICENSE
INDUCTION EXP :
$booking[induction_date]
MEDICAL EXP :
$booking[medical_date]
EMPLOYEE :
$candidate[client_employees_name] $candidate[surname]
ASSESSMENT DATE :
$date
EXPIRY DATE :
$newDate
AUTHORISED TO OPERATE :
$assessor[assesses_name]
EXPIRE DATE :
$newDate
DATE :
$newDate
";
} else {
$tests = explode(',', substr($booking['tests'], 1));
// TEST
$test_sec_res = $db->exec_query('tests_sec', ['*'], '', '', '', '', "test_id = {$tests[0]}");
// echo "SELECT * FROM tests_sec WHERE test_id = {$tests[0]}";
$tests_sec = $test_sec_res->fetch_assoc();
$test_res = $db->exec_query('tests', ['*'], '', '', '', '', "record_id = {$tests_sec['test_id']}", "ORDER BY test_name ASC");
// echo "SELECT * FROM tests WHERE record_id = {$tests[0]}";
$test = $test_res->fetch_assoc();
$candidate_res = $db->exec_query('client_employees', ['*'], '', '', '', '', "record_id = {$tests_sec['client_employees_id']}");
// echo "SELECT * FROM client_employees WHERE record_id = {$tests_sec['client_employees_id']}";
$test_candidate = $candidate_res->fetch_assoc();
$client_res = $db->exec_query('clients', ['*'], '', '', '', '', "record_id = {$tests_sec['clients_id']}", 'ORDER BY clients_name ASC');
// echo "SELECT * FROM clients WHERE record_id = {$tests_sec['clients_id']}";
$test_client = $client_res->fetch_assoc();
$test_date = date("Y-m-d", strtotime($booking['date_done']));
$newTestDate = date("Y-m-d", strtotime($test_date . " +12 months"));
$html .= "
ASSESSOR LICENSE
INDUCTION EXP :
$booking[induction_date]
MEDICAL EXP :
$booking[medical_date]
EMPLOYEE :
$test_candidate[client_employees_name] $test_candidate[surname]
ASSESSMENT DATE :
$test_date
EXPIRY DATE :
$newTestDate
AUTHORISED TO OPERATE :
$test_sec[assesses_name]
EXPIRE DATE :
$newTestDate
DATE :
$newTestDate
|
|
|
|
AUTHORISED TO OPERATE :
|
$test[test_name]
|
EXP DATE :
|
$newTestDate
|
INDUCTION EXP :
|
$booking[induction_date]
|
MEDICAL EXP :
|
$booking[medical_date]
|
|
|
EMPLOYEE :
|
$test_candidate[client_employees_name] $test_candidate[surname]
|
INDUSTRY # :
|
$booking[industry]
|
ASSESSMENT DATE :
|
$test_date
|
EXPIRY DATE :
|
$newTestDate
|
";
}
echo $html;