//get employee username
$user_id = $_GET['uid'];
// Check required parameters
if (!$user_id) {
    die('ERROR: No parameters passed');
}
// Get Employee Profile
// $empinfo = get_employeeProfile($user_id);
// $employeeProfile = $empinfo['return'];
// if ($employeeProfile['currStatus'] != 'ON') {
//    // return 0 if not signing on
//    $resultObj = new ResultObject();
//    echo(json_encode($resultObj));
// } else {
// Get LOE data
$result = get_employeeLOE($user_id, '');
$empLOEinfo = $result['return']['listEmployeeLOE'];
$hasLOE = !empty($empLOEinfo) || is_array($empLOEinfo) ? 1 : 0;
//if (array_key_exists('0',$empLOEinfo)){
// $employeeLOE = $empLOEinfo[0];
// }/*else{
//$employeeLOE = $empLOEinfo;
//}*/
$insuranceHelper = new EmpViewInsuranceHelper();
$employeeLOE = $insuranceHelper->checkShipInsuranceInfo($empLOEinfo);
// Check if valid to have LOI
if (!empty($employeeLOE)) {
    $result = array();
    for ($i = 0; $i < count($employeeLOE); $i++) {
        $currentloe = $employeeLOE[$i];
        // print_r($currentloe);
ini_set('display_errors', '1');*/
// Set flag that this is a parent file
define('_JEXEC', 1);
define('JPATH_BASE', dirname(__FILE__));
define('DS', DIRECTORY_SEPARATOR);
require_once JPATH_BASE . DS . 'includes' . DS . 'defines.php';
require_once JPATH_BASE . DS . 'includes' . DS . 'framework.php';
require_once 'api_new/nusoap/nusoap.php';
require_once 'api_new/db.inc';
require_once 'api_new/settings.inc';
require_once 'api/swift/lib/swift_required.php';
require_once dirname(__FILE__) . '/html2pdf/html2pdf.class.php';
$employee_ID = $_GET['uid'];
$controlNumber = isset($_GET['ctrlno']) ? trim($_GET['ctrlno']) : "";
// get the items to display from the helper
$LOEList = get_employeeLOE($employee_ID, $controlNumber);
$LOE_Details = $LOEList['return']['listEmployeeLOE'];
if (array_key_exists('0', $LOE_Details)) {
    $employeeLOE = $LOE_Details[0];
} else {
    $employeeLOE = $LOE_Details;
}
//get exipire date
$expireDate = date('m/d/y', strtotime($employeeLOE['signOnDate'] . "+7 day"));
$activeEmployeeLOEInfo = array('controlNumber' => $employeeLOE['controlNumber'], 'airportCode' => $employeeLOE['airportCode'], 'airportName' => $employeeLOE['airportName'], 'arrivalSequence' => $employeeLOE['arrivalSequence'], 'costCenter' => $employeeLOE['costCenter'], 'countryCode' => $employeeLOE['countryCode'], 'countryName' => $employeeLOE['countryName'], 'dateOfBirth' => $employeeLOE['dateOfBirth'], 'employeeName' => $employeeLOE['employeeName'], 'passportNo' => $employeeLOE['passportNo'], 'fileName' => $employeeLOE['fileName'], 'IDNumber' => $employeeLOE['IDNumber'], 'isNewHire' => $employeeLOE['isNewHire'], 'isReEmployment' => $employeeLOE['isReEmployment'], 'issueDate' => $employeeLOE['issueDate'], 'issueID' => $employeeLOE['issueID'], 'lemcu' => $employeeLOE['lemcu'], 'nationalityCode' => $employeeLOE['nationalityCode'], 'nationalityName' => $employeeLOE['nationalityName'], 'positionCode' => $employeeLOE['positionCode'], 'positionName' => $employeeLOE['positionName'], 'registryCode' => $employeeLOE['registryCode'], 'seaportCode' => $employeeLOE['seaportCode'], 'seaportName' => $employeeLOE['seaportName'], 'shipCode' => $employeeLOE['shipCode'], 'shipName' => $employeeLOE['shipName'], 'signOnDate' => $employeeLOE['signOnDate'], 'signOffDate' => $employeeLOE['signOffDate']);
$shipName = $employeeLOE['shipName'];
$rci = 'SEAS';
$cel = 'CELEBRITY';
$aza = 'AZA';
$pul = 'PUL';
if (strpos($shipName, $rci) !== false) {