2018-10-15 15:14:36 -04:00
< ? php
/*
2021-06-12 09:29:10 -04:00
* Copyright ( C ) 2018 josh . north @ point808 . com
2018-10-15 15:14:36 -04:00
*
* This program is free software : you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation , either version 3 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program . If not , see < http :// www . gnu . org / licenses />.
*/
2018-10-19 19:00:44 -04:00
ini_set ( 'session.gc_maxlifetime' , 24 * 60 * 60 ); // MIN SESSION
ini_set ( 'session.gc_probability' , 1 ); // GC RATES
ini_set ( 'session.gc_divisor' , 100 ); // TIMES
2021-05-28 17:02:01 -04:00
ini_set ( 'session.use_cookies' , '1' );
ini_set ( 'session.use_only_cookies' , '1' );
2021-08-11 10:54:25 -04:00
ini_set ( 'session.cookie_lifetime' , '0' );
2021-06-03 09:40:50 -04:00
ini_set ( 'session.cookie_secure' , '0' );
ini_set ( 'session.cookie_httponly' , '0' );
2021-06-01 10:52:51 -04:00
ini_set ( 'session.cookie_samesite' , 'Lax' );
2018-10-19 19:00:44 -04:00
session_save_path ( '.tmp' ); // TEMP
session_start (); // START
require_once __DIR__ . '/autoload.php' ; // AUTOLOAD
2021-09-02 11:23:35 -04:00
require_once __DIR__ . '/src/Misc/defuse-crypto.phar' ;
2021-05-07 12:44:04 -04:00
use App\LobbySIO\Config\Registry ;
2021-09-02 11:23:35 -04:00
use Defuse\Crypto\Crypto ;
2021-05-07 12:44:04 -04:00
$Users = new \App\LobbySIO\Database\Users ();
if ( Registry :: AUTHMETHOD == 'SAML' ) {
//simplesaml
require_once ( '../simplesamlphp/lib/_autoload.php' );
$auth = new \SimpleSAML\Auth\Simple ( Registry :: AUTHIDP );
//$auth->requireAuth();
$auth -> isAuthenticated ();
if ( ! $auth -> isAuthenticated ()) {
$attributes = 'none' ;
} else {
$attributes = $auth -> getAttributes ();
$saml_user_email = $attributes [ 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress' ][ 0 ];
$saml_user_info = $Users -> getUserInfoByEmail ( $saml_user_email , " 1 " , " 0 " );
$saml_user_id = $saml_user_info [ " 0 " ][ " users_id " ];
}
$session = \SimpleSAML\Session :: getSessionFromRequest ();
$session -> cleanup ();
}
2018-10-19 19:00:44 -04:00
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions (); // DEFAULT CLASSES
2021-09-02 11:23:35 -04:00
$encKey = $StaticFunctions -> loadEncryptionKeyFromConfig ();
2018-10-15 15:14:36 -04:00
$SiteInfo = new \App\LobbySIO\Database\SiteInfo ();
2018-10-19 19:00:44 -04:00
if ( isset ( $_SESSION [ 'user_id' ])) { // LOGGED IN? GET USER OBJECT
2021-05-07 12:44:04 -04:00
if ( isset ( $saml_user_id )) {
$sessuserid = $saml_user_id ;
} else {
$sessuserid = $_SESSION [ 'user_id' ];
}
} elseif ( ! isset ( $_SESSION [ 'user_id' ])) {
if ( isset ( $saml_user_id )) {
$sessuserid = $saml_user_id ;
} else {
2021-05-07 13:34:29 -04:00
$sessuserid = '2' ;
2021-05-07 12:44:04 -04:00
}
$session_user = $Users -> getUserInfo ( $sessuserid , " 1 " , " 0 " ); }
2018-10-19 19:00:44 -04:00
if ( isset ( $session_user )) { // GET UID OR SET TO KIOSK
$uid = $session_user [ " 0 " ][ " users_id " ];} else { $uid = " 2 " ; }
2021-08-12 14:49:45 -04:00
$app_disp_lang = filter_input ( INPUT_COOKIE , 'app_disp_lang' , FILTER_SANITIZE_FULL_SPECIAL_CHARS ); // SETUP LANGUAGE
2018-10-19 19:00:44 -04:00
if ( ! isset ( $app_disp_lang )) {
$app_disp_lang = $StaticFunctions -> getDefaultLanguage (); }
$siteidcookie = filter_input ( INPUT_COOKIE , 'app_site' ); // SETUP SITE
foreach ( $SiteInfo -> getSite ( " 0 " , $uid , " 0 " , " 0 " ) as $arr ) {
$lookup_array [ $arr [ 'sites_id' ]] = 1 ; }
if ( isset ( $lookup_array [ $siteidcookie ])) {
$siteid = $siteidcookie ; } else { $siteid = " 1 " ; }
if ( ! isset ( $siteid )) { $siteid = " 1 " ; }
$Translate = new \App\LobbySIO\Language\Translate ( $app_disp_lang ); // SETUP TRANSLATOR
$transLang = $Translate -> userLanguage ();
2018-10-15 15:14:36 -04:00
$VisitTypeInfo = new \App\LobbySIO\Database\VisitTypeInfo ();
$IDTypeInfo = new \App\LobbySIO\Database\IDTypeInfo ();
$VisitInfo = new \App\LobbySIO\Database\VisitInfo ();
2018-10-19 19:00:44 -04:00
$app_current_pagename = $transLang [ 'REPORTS' ]; // PAGE SETUP
$app_current_pageicon = '<i class="fas fa-chart-pie"></i> ' ;
require_once ( " inc/header.inc.php " );
2021-05-07 12:44:04 -04:00
if ( $StaticFunctions -> getUserSessionStatus () == false ) { // CHECK STATUS
2018-10-19 19:00:44 -04:00
echo $StaticFunctions -> killSession (); // ELSE DIE
2018-10-15 15:14:36 -04:00
} else { ?>
<!-- CONTENT START -->
2021-06-17 18:42:12 -04:00
< ? php
// FILTER POSTED DATA
$form_data = filter_input_array ( INPUT_POST , [
'reporttype' => ( string ) FILTER_SANITIZE_STRING ,
'repsite' => ( string ) FILTER_SANITIZE_STRING ,
'starttime' => ( string ) FILTER_SANITIZE_STRING ,
'endtime' => ( string ) FILTER_SANITIZE_STRING
]);
?>
<!-- REPORT RUNNER -->
2021-06-03 11:04:49 -04:00
< div class = " container-fluid " >
2021-06-17 18:42:12 -04:00
< form method = " post " >
< div class = " row row-cols-3 mb-2 " >
< div class = " col d-grid gap-2 " >
2021-06-03 11:04:49 -04:00
< h2 >< i class = " fas fa-chart-pie " ></ i > < ? php echo $transLang [ 'REPORTS' ]; ?> </h2>
2021-06-17 18:42:12 -04:00
</ div >
< div class = " col text-start " >
& nbsp ;
</ div >
< div class = " col text-end " >
< button type = " submit " class = " btn btn-success btn-lg " >< i class = " fas fa-play " ></ i > < ? php echo $transLang [ 'STR_REPORT_EXECUTE_TITLE' ]; ?> </button>
< a href = " reports.php " type = " button " class = " btn btn-primary btn-lg " >< i class = " fa fa-redo " ></ i ></ a >
2021-06-03 11:04:49 -04:00
</ div >
</ div >
2021-06-17 18:42:12 -04:00
< div class = " row row-cols-1 mb-2 " >
2021-06-03 11:04:49 -04:00
< div class = " col d-grid gap-2 " >
2021-06-17 18:42:12 -04:00
< p >< ? php echo $transLang [ 'REPORTS_DESC' ]; ?> </p>
</ div >
</ div >
< div class = " row row-cols-4 mb-2 " >
< div class = " col d-grid gap-2 " >
< div class = " input-group " >
< span class = " input-group-text form-control-lg " >< ? php echo $transLang [ 'REPORTS' ]; ?> </span>
2021-06-03 11:04:49 -04:00
< select name = " reporttype " class = " form-control form-control-lg " >
2021-06-17 18:42:12 -04:00
< ? php if ( isset ( $form_data [ 'reporttype' ])) { ?>
< option value = " <?php echo $form_data['reporttype'] ; ?> " placeholder = " <?php echo $transLang['REPORTS'] ; ?> " >< ? php echo $form_data [ 'reporttype' ]; ?> </option>
< ? php } ?>
2021-06-03 11:04:49 -04:00
< option value = " Default " selected >< ? php echo $transLang [ 'DEFAULT' ]; ?> </option>
2021-06-10 05:20:29 -04:00
< option value = " Vendors " > Vendors </ option >
2021-06-03 11:04:49 -04:00
</ select >
</ div >
</ div >
< div class = " col d-grid gap-2 " >
2021-06-17 18:42:12 -04:00
< div class = " input-group " >
< span class = " input-group-text form-control-lg " >< ? php echo $transLang [ 'STR_COMMON_SITE' ]; ?> </span>
< ? php if ( isset ( $form_data [ 'repsite' ])) { $currentrepsite = $form_data [ 'repsite' ]; } else { $currentrepsite = " 0 " ; }; ?>
2021-06-03 11:04:49 -04:00
< select name = " repsite " class = " form-control form-control-lg " >
2021-06-17 18:42:12 -04:00
< ? php if ( $session_user [ " 0 " ][ " users_usertype " ] == " USER-TYPES-ADMIN " ) { ?>
2021-06-15 11:14:55 -04:00
< option value = " all " < ? php if ( $currentrepsite == " all " ) { echo " selected " ;}; ?> ><?php echo $transLang['STR_COMMON_ALL']; ?></option>
2021-06-17 18:42:12 -04:00
< ? php } ?>
< ? php foreach ( $SiteInfo -> getSite ( " 0 " , $uid , " 0 " , " 0 " ) as $row ) : ?>
2021-06-03 11:04:49 -04:00
< option value = " <?php echo $row['sites_id'] ; ?> " < ? php if ( $currentrepsite == $row [ 'sites_id' ]) { echo " selected " ;}; ?> ><?php echo $row['sites_name']; ?></option>
2021-06-17 18:42:12 -04:00
< ? php endforeach ; ?>
2021-06-03 11:04:49 -04:00
</ select >
</ div >
</ div >
< div class = " col d-grid gap-2 " >
2021-06-17 18:42:12 -04:00
< div class = " input-group " >
< span class = " input-group-text date form-control-lg " data - bs - toggle = " datetimepicker " data - target = " .datetimepicker-1 " >< i class = " fas fa-calendar " ></ i >& nbsp < ? php echo $transLang [ 'STR_COMMON_START' ]; ?> </span>
< input name = " starttime " type = " text " class = " form-control form-control-lg bg-white datetimepicker-input datetimepicker-1 " id = " datetimepicker-1 " data - toggle = " datetimepicker " data - target = " .datetimepicker-1 " required />
2021-06-03 11:04:49 -04:00
</ div >
</ div >
< div class = " col d-grid gap-2 " >
2021-06-17 18:42:12 -04:00
< div class = " input-group " >
< span class = " input-group-text date form-control-lg " data - bs - toggle = " datetimepicker " data - target = " .datetimepicker-2 " >< i class = " fas fa-calendar " ></ i >& nbsp < ? php echo $transLang [ 'END' ]; ?> </span>
< input name = " endtime " type = " text " class = " form-control form-control-lg bg-white datetimepicker-input datetimepicker-2 " id = " datetimepicker-2 " data - toggle = " datetimepicker " data - target = " .datetimepicker-2 " required />
2021-08-11 20:12:35 -04:00
< script type = " text/javascript " nonce = " <?= $_SESSION['nonceStr'] ?> " >
2021-06-17 18:42:12 -04:00
$ ( function () {
$ ( '.datetimepicker-1' ) . datetimepicker ({ defaultDate : '<?php if (isset($form_data[' starttime '])) { echo $form_data[' starttime ']; }; ?>' , 'sideBySide' : true , 'format' : 'YYYY-MM-DD HH:mm:ss' , 'allowInputToggle' : true });
});
</ script >
2021-08-11 20:12:35 -04:00
< script type = " text/javascript " nonce = " <?= $_SESSION['nonceStr'] ?> " >
2021-06-17 18:42:12 -04:00
$ ( function () {
$ ( '.datetimepicker-2' ) . datetimepicker ({ defaultDate : '<?php if (isset($form_data[' endtime '])) { echo $form_data[' endtime ']; }; ?>' , 'sideBySide' : true , 'format' : 'YYYY-MM-DD HH:mm:ss' , 'allowInputToggle' : true });
});
</ script >
2021-06-03 11:04:49 -04:00
</ div >
</ div >
</ div >
</ form >
</ div >
2021-06-17 18:42:12 -04:00
< hr />
<!-- REPORT RUNNER END -->
2021-06-15 11:14:55 -04:00
2021-06-17 20:03:13 -04:00
< ? php if ( isset ( $form_data [ 'reporttype' ])) { ?>
2021-06-17 18:42:12 -04:00
< ? php if ( $form_data [ 'reporttype' ] == " Default " ) { ?>
<!-- DEFAULT REPORT -->
< ? php
$approval = " 2 " ;
if ( $form_data [ 'repsite' ] == " all " ) { $selsite = " % " ; } else { $selsite = $form_data [ 'repsite' ];}
2021-06-15 11:14:55 -04:00
?>
2021-06-17 18:42:12 -04:00
< div class = " container-fluid " >
< table id = " report " class = " table table-striped table-bordered table-sm table-responsive-sm text-nowrap " >
< thead >
< tr >
< th >< ? php echo $transLang [ 'IN' ]; ?> </th>
< th >< ? php echo $transLang [ 'OUT' ]; ?> </th>
< th >< ? php echo $transLang [ 'STR_COMMON_SITE' ]; ?> </th>
< th >< ? php echo $transLang [ 'COMPANY' ]; ?> </th>
< th >< ? php echo $transLang [ 'REASON' ]; ?> </th>
< th >< ? php echo $transLang [ 'NAME' ]; ?> </th>
< th >< ? php echo $transLang [ 'ESCORT' ]; ?> </th>
< th >< ? php echo $transLang [ 'BADGE' ]; ?> </th>
< th >< ? php echo $transLang [ 'SIGNINBY' ]; ?> </th>
< ? php if ( $selsite == " % " || $SiteInfo -> getSite ( $siteid , $uid , " 0 " , " 0 " )[ 0 ][ " sites_region " ] == " EMEA " ) { ?>
< th >< ? php echo $transLang [ 'CARNUM' ]; ?> </th>
< th >< ? php echo $transLang [ 'SSANUM' ]; ?> </th>
< ? php } ?>
< ? php if ( $selsite == " % " || $SiteInfo -> getSite ( $siteid , $uid , " 0 " , " 0 " )[ 0 ][ " sites_region " ] == " US " ) { ?>
< th >< ? php echo $transLang [ 'CITIZEN' ]; ?> </th>
< ? php } ?>
< th >< ? php echo $transLang [ 'ID_TYPE' ]; ?> </th>
< th >< ? php echo $transLang [ 'TICKET' ]; ?> </th>
< th >< ? php echo $transLang [ 'DECLINE' ]; ?> </th>
</ tr >
</ thead >
< tbody >
< ? php foreach ( $VisitInfo -> getVisitInfo ( $selsite , " % " , " % " , " % " , " % " , $form_data [ 'starttime' ], $form_data [ 'endtime' ], " % " , " % " ) as $row ){
$timein = new DateTime ( $row [ 'visits_intime' ], new DateTimeZone ( 'UTC' ));
$timeout = new DateTime ( $row [ 'visits_outtime' ], new DateTimeZone ( 'UTC' ));
$timein -> setTimezone ( new DateTimeZone ( " $timezone " ));
$timeout -> setTimezone ( new DateTimeZone ( " $timezone " ));
$timein_disp = $timein -> format ( 'Y-m-d H:i:s' );
$timeout_disp = $timeout -> format ( 'Y-m-d H:i:s' );
if ( ! empty ( $row [ 'visits_carnum' ])) { $carnum = $row [ 'visits_carnum' ]; } else { $carnum = " - " ;}
if ( ! empty ( $row [ 'visits_ssanum' ])) { $ssanum = $row [ 'visits_ssanum' ]; } else { $ssanum = " - " ;}
if ( ! empty ( $row [ 'visits_citizen' ])) { $citizen = $row [ 'visits_citizen' ]; } else { $citizen = " - " ;}
?>
< tr >
< td >< ? php echo $timein_disp ; ?> </td>
< td >< ? php if ( ! empty ( $row [ 'visits_outtime' ])) { echo $timeout_disp ; } else { echo $transLang [ 'IN' ];} ?> </td>
< td >< ? php echo $SiteInfo -> getSite ( $row [ 'visits_site_id' ], $uid , " 0 " , " 0 " )[ 0 ][ " sites_name " ]; ?> </td>
2021-09-02 11:23:35 -04:00
< td >< ? php echo Crypto :: decrypt ( $row [ 'visits_company' ], $encKey ); ?> </td>
2021-06-17 18:42:12 -04:00
< td >< ? php echo $transLang [ $VisitTypeInfo -> getInfoVisitType ( " % " , $row [ 'visits_reason' ])[ 0 ][ 'visittypes_name' ]]; ?> </td>
2021-09-02 11:23:35 -04:00
< td >< ? php echo Crypto :: decrypt ( $row [ 'visits_lastname' ], $encKey ) . " , " . Crypto :: decrypt ( $row [ 'visits_firstname' ], $encKey ); ?> <br /><img src="<?php echo $row['visits_signature']; ?>" width="200" height="50" alt="Signature" /></td>
2021-06-17 18:42:12 -04:00
< td >< ? php if ( ! empty ( $row [ 'visits_escort' ])) { echo $row [ 'visits_escort' ] . '<br /><img src="' . $row [ 'visits_escort_signature' ] . '" width="200" height="50" alt="Escort Signature" />' ; } ?> </td>
< td >< ? php echo $row [ 'visits_badge' ]; ?> </td>
< td >< ? php if ( ! empty ( $Users -> readUserFirstAndLast ( $row [ 'visits_initials' ]))){ echo $Users -> readUserFirstAndLast ( $row [ 'visits_initials' ])[ 0 ][ " users_firstname " ] . " " . $Users -> readUserFirstAndLast ( $row [ 'visits_initials' ])[ 0 ][ " users_lastname " ]; } ?> </td>
< ? php if ( $selsite == " % " || $SiteInfo -> getSite ( $siteid , $uid , " 0 " , " 0 " )[ 0 ][ " sites_region " ] == " EMEA " ) { ?>
< td >< ? php echo $carnum ; ?> </td>
< td >< ? php echo $ssanum ; ?> </td>
< ? php } ?>
< ? php if ( $selsite == " % " || $SiteInfo -> getSite ( $siteid , $uid , " 0 " , " 0 " )[ 0 ][ " sites_region " ] == " US " ) { ?>
< td >< ? php echo $citizen ; ?> </td>
< ? php } ?>
< td >< ? php echo $transLang [ $IDTypeInfo -> getIDTypeInfo ( $row [ 'visits_id_type' ])[ 0 ][ 'idtypes_name' ]]; ?> </td>
< td >< ? php echo $row [ 'visits_id_reference' ]; ?> </td>
< td >< ? php echo $row [ 'visits_notes' ]; ?> </td>
</ tr >
2021-06-15 11:14:55 -04:00
< ? php } ?>
2021-06-17 18:42:12 -04:00
</ tbody >
</ table >
</ div >
<!-- DEFAULT REPORT END -->
2021-06-15 11:14:55 -04:00
2021-06-17 20:03:13 -04:00
< ? php } elseif ( $form_data [ 'reporttype' ] == " Vendors " ) { ?>
2021-06-17 18:42:12 -04:00
<!-- DEFAULT REPORT -->
< ? php
$approval = " 2 " ;
if ( $form_data [ 'repsite' ] == " all " ) { $selsite = " % " ; } else { $selsite = $form_data [ 'repsite' ];}
?>
< div class = " container-fluid " >
< table id = " report " class = " table table-striped table-bordered table-sm table-responsive-sm text-nowrap " >
< thead >
< tr >
< th >< ? php echo $transLang [ 'IN' ]; ?> </th>
< th >< ? php echo $transLang [ 'OUT' ]; ?> </th>
< th >< ? php echo $transLang [ 'STR_COMMON_SITE' ]; ?> </th>
< th >< ? php echo $transLang [ 'COMPANY' ]; ?> </th>
< th >< ? php echo $transLang [ 'REASON' ]; ?> </th>
< th >< ? php echo $transLang [ 'NAME' ]; ?> </th>
< th >< ? php echo $transLang [ 'BADGE' ]; ?> </th>
< th >< ? php echo $transLang [ 'SIGNINBY' ]; ?> </th>
< ? php if ( $selsite == " % " || $SiteInfo -> getSite ( $siteid , $uid , " 0 " , " 0 " )[ 0 ][ " sites_region " ] == " EMEA " ) { ?>
< th >< ? php echo $transLang [ 'CARNUM' ]; ?> </th>
< th >< ? php echo $transLang [ 'SSANUM' ]; ?> </th>
< ? php } ?>
< ? php if ( $selsite == " % " || $SiteInfo -> getSite ( $siteid , $uid , " 0 " , " 0 " )[ 0 ][ " sites_region " ] == " US " ) { ?>
< th >< ? php echo $transLang [ 'CITIZEN' ]; ?> </th>
< ? php } ?>
< th >< ? php echo $transLang [ 'ID_TYPE' ]; ?> </th>
< th >< ? php echo $transLang [ 'TICKET' ]; ?> </th>
< th >< ? php echo $transLang [ 'DECLINE' ]; ?> </th>
< th >< ? php echo $transLang [ 'STR_VENDORINFO_FORM_TITLE' ]; ?> </th>
2021-06-15 11:14:55 -04:00
</ tr >
2021-06-17 18:42:12 -04:00
</ thead >
< tbody >
< ? php foreach ( $VisitInfo -> getVisitInfo ( $selsite , " % " , " % " , " % " , " % " , $form_data [ 'starttime' ], $form_data [ 'endtime' ], " % " , " % " ) as $row ){
$timein = new DateTime ( $row [ 'visits_intime' ], new DateTimeZone ( 'UTC' ));
$timeout = new DateTime ( $row [ 'visits_outtime' ], new DateTimeZone ( 'UTC' ));
$timein -> setTimezone ( new DateTimeZone ( " $timezone " ));
$timeout -> setTimezone ( new DateTimeZone ( " $timezone " ));
$timein_disp = $timein -> format ( 'Y-m-d H:i:s' );
$timeout_disp = $timeout -> format ( 'Y-m-d H:i:s' );
if ( ! empty ( $row [ 'visits_carnum' ])) { $carnum = $row [ 'visits_carnum' ]; } else { $carnum = " - " ;}
if ( ! empty ( $row [ 'visits_ssanum' ])) { $ssanum = $row [ 'visits_ssanum' ]; } else { $ssanum = " - " ;}
if ( ! empty ( $row [ 'visits_citizen' ])) { $citizen = $row [ 'visits_citizen' ]; } else { $citizen = " - " ;}
if ( $row [ 'visits_isvendor' ] === 1 ) {
?>
< tr >
< td >< ? php echo $timein_disp ; ?> </td>
< td >< ? php if ( ! empty ( $row [ 'visits_outtime' ])) { echo $timeout_disp ; } else { echo $transLang [ 'IN' ];} ?> </td>
< td >< ? php echo $SiteInfo -> getSite ( $row [ 'visits_site_id' ], $uid , " 0 " , " 0 " )[ 0 ][ " sites_name " ]; ?> </td>
2021-09-02 11:23:35 -04:00
< td >< ? php echo Crypto :: decrypt ( $row [ 'visits_company' ], $encKey ); ?> </td>
2021-06-17 18:42:12 -04:00
< td >< ? php echo $transLang [ $VisitTypeInfo -> getInfoVisitType ( " % " , $row [ 'visits_reason' ])[ 0 ][ 'visittypes_name' ]]; ?> </td>
2021-09-02 11:23:35 -04:00
< td >< ? php echo Crypto :: decrypt ( $row [ 'visits_lastname' ], $encKey ) . " , " . Crypto :: decrypt ( $row [ 'visits_firstname' ], $encKey ); ?> <br /><img src="<?php echo $row['visits_signature']; ?>" width="200" height="50" alt="Signature" /></td>
2021-06-17 18:42:12 -04:00
< td >< ? php echo $row [ 'visits_badge' ]; ?> </td>
< td >< ? php if ( ! empty ( $Users -> readUserFirstAndLast ( $row [ 'visits_initials' ]))){ echo $Users -> readUserFirstAndLast ( $row [ 'visits_initials' ])[ 0 ][ " users_firstname " ] . " " . $Users -> readUserFirstAndLast ( $row [ 'visits_initials' ])[ 0 ][ " users_lastname " ]; } ?> </td>
< ? php if ( $selsite == " % " || $SiteInfo -> getSite ( $siteid , $uid , " 0 " , " 0 " )[ 0 ][ " sites_region " ] == " EMEA " ) { ?>
< td >< ? php echo $carnum ; ?> </td>
< td >< ? php echo $ssanum ; ?> </td>
< ? php } ?>
< ? php if ( $selsite == " % " || $SiteInfo -> getSite ( $siteid , $uid , " 0 " , " 0 " )[ 0 ][ " sites_region " ] == " US " ) { ?>
< td >< ? php echo $citizen ; ?> </td>
< ? php } ?>
< td >< ? php echo $transLang [ $IDTypeInfo -> getIDTypeInfo ( $row [ 'visits_id_type' ])[ 0 ][ 'idtypes_name' ]]; ?> </td>
< td >< ? php echo $row [ 'visits_id_reference' ]; ?> </td>
< td >< ? php echo $row [ 'visits_notes' ]; ?> </td>
< td >
< ? php foreach ( $VisitInfo -> getInfoVendorVisitFinal ( $row [ 'visits_id' ]) as $vnrow ) {
$db_vendorinfo_id = $vnrow [ 'db_vendorinfo_id' ];
$db_vendorinfo_contact1 = $vnrow [ 'db_vendorinfo_contact1' ];
$db_vendorinfo_contact2 = $vnrow [ 'db_vendorinfo_contact2' ];
$db_vendorinfo_workstart = $vnrow [ 'db_vendorinfo_workstart' ];
$db_vendorinfo_workend = $vnrow [ 'db_vendorinfo_workend' ];
$db_vendorinfo_customerimpacted = $vnrow [ 'db_vendorinfo_customerimpacted' ];
$db_vendorinfo_checklistrequired = $vnrow [ 'db_vendorinfo_checklistrequired' ];
$db_vendorinfo_routinework = $vnrow [ 'db_vendorinfo_routinework' ];
$db_vendorinfo_nonroutinework = $vnrow [ 'db_vendorinfo_nonroutinework' ];
$db_vendorinfo_coi = $vnrow [ 'db_vendorinfo_coi' ];
$db_vendorinfo_worksummary = $vnrow [ 'db_vendorinfo_worksummary' ];
$db_vendorinfo_equipmentsummary = $vnrow [ 'db_vendorinfo_equipmentsummary' ];
$db_vendorinfo_checklistcompleted = $vnrow [ 'db_vendorinfo_checklistcompleted' ];
$db_vendorinfo_workcompleted = $vnrow [ 'db_vendorinfo_workcompleted' ];
$db_vendorinfo_sitecleanup = $vnrow [ 'db_vendorinfo_sitecleanup' ];
$db_vendorinfo_doccompleted = $vnrow [ 'db_vendorinfo_doccompleted' ];
$db_vendorinfo_approverid = $vnrow [ 'db_vendorinfo_approverid' ];
?>
< form action = " printvwf.php " method = " post " target = " _blank " >
< input type = " hidden " name = " form_data_timein " id = " form_data_timein " value = " <?php echo $timein_disp ; ?> " />
< input type = " hidden " name = " form_data_timeout " id = " form_data_timeout " value = " <?php if (!empty( $row['visits_outtime'] )) { echo $timeout_disp ; } else { echo $transLang['IN'] ;} ?> " />
< input type = " hidden " name = " form_data_sitename " id = " form_data_sitename " value = " <?php echo $SiteInfo->getSite ( $row['visits_site_id'] , $uid , " 0 " , " 0 " )[0][ " sites_name " ]; ?> " />
2021-09-02 11:23:35 -04:00
< input type = " hidden " name = " form_data_firstname " id = " form_data_firstname " value = " <?php echo Crypto::decrypt( $row['visits_firstname'] , $encKey ); ?> " />
< input type = " hidden " name = " form_data_lastname " id = " form_data_lastname " value = " <?php echo Crypto::decrypt( $row['visits_lastname'] , $encKey ); ?> " />
2021-06-17 18:42:12 -04:00
< input type = " hidden " name = " form_data_carnum " id = " form_data_carnum " value = " <?php echo $form_data['form_data_carnum'] ; ?> " />
< input type = " hidden " name = " form_data_ssanum " id = " form_data_ssanum " value = " <?php echo $form_data['form_data_ssanum'] ; ?> " />
2021-09-02 11:23:35 -04:00
< input type = " hidden " name = " form_data_company " id = " form_data_company " value = " <?php echo Crypto::decrypt( $row['visits_company'] , $encKey ); ?> " />
2021-06-17 18:42:12 -04:00
< input type = " hidden " name = " form_data_contact1 " id = " form_data_contact1 " value = " <?php echo $db_vendorinfo_contact1 ; ?> " />
< input type = " hidden " name = " form_data_contact2 " id = " form_data_contact2 " value = " <?php echo $db_vendorinfo_contact2 ; ?> " />
< input type = " hidden " name = " form_data_workstart " id = " form_data_workstart " value = " <?php echo $db_vendorinfo_workstart ; ?> " />
< input type = " hidden " name = " form_data_workend " id = " form_data_workend " value = " <?php echo $db_vendorinfo_workend ; ?> " />
< input type = " hidden " name = " form_data_customerimpacted " id = " form_data_customerimpacted " value = " <?php echo $db_vendorinfo_customerimpacted ; ?> " />
< input type = " hidden " name = " form_data_reason " id = " form_data_reason " value = " <?php echo $transLang [ $VisitTypeInfo->getInfoVisitType ( " % " , $row['visits_reason'] )[0]['visittypes_name']]; ?> " />
< input type = " hidden " name = " form_data_idtypename " id = " form_data_idtypename " value = " <?php echo $transLang[$IDTypeInfo->getIDTypeInfo($row['visits_id_type'] )[0]['idtypes_name']]; ?> " />
< input type = " hidden " name = " form_data_v_signature " id = " form_data_v_signature " value = " <?php echo $row['visits_signature'] ; ?> " />
< input type = " hidden " name = " form_data_badge " id = " form_data_badge " value = " <?php echo $row['visits_badge'] ; ?> " />
< input type = " hidden " name = " form_data_signinby " id = " form_data_signinby " value = " <?php echo $Users->readUserFirstAndLast ( $row['visits_initials'] )[0][ " users_firstname " ] . " " . $Users->readUserFirstAndLast ( $row['visits_initials'] )[0][ " users_lastname " ]; ?> " />
< input type = " hidden " name = " form_data_vwfby " id = " form_data_vwfby " value = " <?php echo $Users->readUserFirstAndLast ( $db_vendorinfo_approverid )[0][ " users_firstname " ] . " " . $Users->readUserFirstAndLast ( $db_vendorinfo_approverid )[0][ " users_lastname " ]; ?> " />
< input type = " hidden " name = " form_data_checklistrequired " id = " form_data_checklistrequired " value = " <?php if( $db_vendorinfo_checklistrequired ===0) { echo $transLang['STR_COMMON_NO'] ;}elseif( $db_vendorinfo_checklistrequired ===1) { echo $transLang['STR_COMMON_YES'] ;} ?> " />
< input type = " hidden " name = " form_data_routinework " id = " form_data_routinework " value = " <?php if( $db_vendorinfo_routinework ===0) { echo $transLang['STR_COMMON_NO'] ;}elseif( $db_vendorinfo_routinework ===1) { echo $transLang['STR_COMMON_YES'] ;} ?> " />
< input type = " hidden " name = " form_data_country " id = " form_data_country " value = " <?php echo $VisitInfo->getCountryInfo ( $row['visits_citizen'] )[0][ " countries_name " ]; ?> " />
< input type = " hidden " name = " form_data_nonroutinework " id = " form_data_nonroutinework " value = " <?php if( $db_vendorinfo_nonroutinework ===0) { echo $transLang['STR_COMMON_NO'] ;}elseif( $db_vendorinfo_nonroutinework ===1) { echo $transLang['STR_COMMON_YES'] ;} ?> " />
< input type = " hidden " name = " form_data_coi " id = " form_data_coi " value = " <?php if( $db_vendorinfo_coi ===0) { echo $transLang['STR_COMMON_NO'] ;}elseif( $db_vendorinfo_coi ===1) { echo $transLang['STR_COMMON_YES'] ;} ?> " />
< input type = " hidden " name = " form_data_worksummary " id = " form_data_worksummary " value = " <?php echo $db_vendorinfo_worksummary ; ?> " />
< input type = " hidden " name = " form_data_checklistcompleted " id = " form_data_checklistcompleted " value = " <?php if( $db_vendorinfo_checklistcompleted ===0) { echo $transLang['STR_COMMON_NO'] ;}elseif( $db_vendorinfo_checklistcompleted ===1) { echo $transLang['STR_COMMON_YES'] ;} ?> " />
< input type = " hidden " name = " form_data_workcompleted " id = " form_data_workcompleted " value = " <?php if( $db_vendorinfo_workcompleted ===0) { echo $transLang['STR_COMMON_NO'] ;}elseif( $db_vendorinfo_workcompleted ===1) { echo $transLang['STR_COMMON_YES'] ;} ?> " />
< input type = " hidden " name = " form_data_sitecleanup " id = " form_data_sitecleanup " value = " <?php if( $db_vendorinfo_sitecleanup ===0) { echo $transLang['STR_COMMON_NO'] ;}elseif( $db_vendorinfo_sitecleanup ===1) { echo $transLang['STR_COMMON_YES'] ;} ?> " />
< input type = " hidden " name = " form_data_doccompleted " id = " form_data_doccompleted " value = " <?php if( $db_vendorinfo_doccompleted ===0) { echo $transLang['STR_COMMON_NO'] ;}elseif( $db_vendorinfo_doccompleted ===1) { echo $transLang['STR_COMMON_YES'] ;} ?> " />
< input type = " hidden " name = " form_data_equipmentsummary " id = " form_data_equipmentsummary " value = " <?php echo $db_vendorinfo_equipmentsummary ; ?> " />
< button type = " submit " name = " print " id = " print " class = " btn btn-primary btn-block btn-sm " >< i class = " fa fa-print " ></ i >& nbsp ; < ? php echo $transLang [ 'PRINT' ]; ?> </button>
</ form >
< ? php } ?>
</ td >
</ tr >
< ? php } } ?>
</ tbody >
</ table >
</ div >
<!-- DEFAULT REPORT END -->
2021-06-15 11:14:55 -04:00
< ? php } ?>
2021-06-10 05:20:29 -04:00
2021-06-17 20:03:13 -04:00
< ? php } else { ?>
2021-06-10 05:20:29 -04:00
2018-10-15 15:14:36 -04:00
< div class = " container " >
< div class = " row " >
< p >- - - - - - - - - - -</ p >
</ div >
</ div >
2021-06-17 20:03:13 -04:00
< ? php } ?>
2021-08-11 20:12:35 -04:00
< script nonce = " <?= $_SESSION['nonceStr'] ?> " >
2018-10-15 15:14:36 -04:00
$ ( document ) . ready ( function () {
$ ( '#report' ) . DataTable ( {
" order " : [[ 0 , " desc " ]],
" lengthMenu " : [[ 50 , 100 , - 1 ], [ 50 , 100 , " All " ]],
dom : 'Blfrtip' ,
buttons : [
{
extend : 'collection' ,
text : '<?php echo $transLang[' EXPORT ']; ?>' ,
buttons : [
{
extend : 'print' ,
text : '<?php echo $transLang[' PRINT ']; ?>' ,
orientation : 'landscape' ,
autoPrint : false ,
exportOptions : {
stripNewlines : false ,
stripHtml : false ,
},
},
{
extend : 'pdf' ,
text : '<?php echo $transLang[' PDF ']; ?>' ,
orientation : 'landscape' ,
exportOptions : {
stripNewlines : false ,
2021-06-03 12:50:50 -04:00
//pageSize : 'A5',
2021-06-17 20:03:13 -04:00
< ? php if ( $selsite == " % " && $form_data [ 'reporttype' ] == " Default " ) { ?>
columns : [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 ],
< ? php } elseif ( $selsite == " % " && $form_data [ 'reporttype' ] == " Vendors " ) { ?>
columns : [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 ],
< ? php } elseif ( $SiteInfo -> getSite ( $siteid , $uid , " 0 " , " 0 " )[ 0 ][ " sites_region " ] == " EMEA " && $form_data [ 'reporttype' ] == " Default " ) { ?>
columns : [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 ],
< ? php } elseif ( $SiteInfo -> getSite ( $siteid , $uid , " 0 " , " 0 " )[ 0 ][ " sites_region " ] == " US " && $form_data [ 'reporttype' ] == " Default " ) { ?>
columns : [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 ],
< ? php } elseif ( $SiteInfo -> getSite ( $siteid , $uid , " 0 " , " 0 " )[ 0 ][ " sites_region " ] == " EMEA " && $form_data [ 'reporttype' ] == " Vendors " ) { ?>
columns : [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 ],
< ? php } elseif ( $SiteInfo -> getSite ( $siteid , $uid , " 0 " , " 0 " )[ 0 ][ " sites_region " ] == " US " && $form_data [ 'reporttype' ] == " Vendors " ) { ?>
columns : [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 ],
< ? php } ?>
2018-10-15 15:14:36 -04:00
},
customize : function ( doc ) {
2021-06-03 12:50:50 -04:00
doc . defaultStyle . fontSize = '6' ; //<-- set fontsize to 16 instead of 10
2018-10-15 15:14:36 -04:00
doc [ 'content' ][ '1' ] . layout = 'lightHorizontalLines' ;
2021-06-17 20:03:13 -04:00
< ? php if ( $selsite == " % " && $form_data [ 'reporttype' ] == " Default " ) { ?>
doc . content [ 1 ] . table . widths = [ " 5% " , " 5% " , " 4% " , " 10% " , " 15% " , " 8% " , " 8% " , " 7% " , " 5% " , " 4% " , " 4% " , " 6% " , " 5% " , " 9% " , " 6% " ];
< ? php } elseif ( $selsite == " % " && $form_data [ 'reporttype' ] == " Vendors " ) { ?>
doc . content [ 1 ] . table . widths = [ " 5% " , " 5% " , " 4% " , " 10% " , " 15% " , " 8% " , " 8% " , " 7% " , " 6% " , " 5% " , " 5% " , " 7% " , " 6% " , " 9% " ];
< ? php } elseif ( $SiteInfo -> getSite ( $siteid , $uid , " 0 " , " 0 " )[ 0 ][ " sites_region " ] == " EMEA " && $form_data [ 'reporttype' ] == " Default " ) { ?>
doc . content [ 1 ] . table . widths = [ " 5% " , " 5% " , " 4% " , " 10% " , " 15% " , " 8% " , " 8% " , " 7% " , " 5% " , " 4% " , " 4% " , " 6% " , " 5% " , " 14% " ];
< ? php } elseif ( $SiteInfo -> getSite ( $siteid , $uid , " 0 " , " 0 " )[ 0 ][ " sites_region " ] == " US " && $form_data [ 'reporttype' ] == " Default " ) { ?>
doc . content [ 1 ] . table . widths = [ " 5% " , " 5% " , " 4% " , " 10% " , " 15% " , " 8% " , " 8% " , " 7% " , " 6% " , " 7% " , " 6% " , " 5% " , " 14% " ];
< ? php } elseif ( $SiteInfo -> getSite ( $siteid , $uid , " 0 " , " 0 " )[ 0 ][ " sites_region " ] == " EMEA " && $form_data [ 'reporttype' ] == " Vendors " ) { ?>
doc . content [ 1 ] . table . widths = [ " 6% " , " 6% " , " 5% " , " 11% " , " 16% " , " 9% " , " 9% " , " 8% " , " 6% " , " 6% " , " 5% " , " 7% " , " 5% " ];
< ? php } elseif ( $SiteInfo -> getSite ( $siteid , $uid , " 0 " , " 0 " )[ 0 ][ " sites_region " ] == " US " && $form_data [ 'reporttype' ] == " Vendors " ) { ?>
doc . content [ 1 ] . table . widths = [ " 6% " , " 6% " , " 6% " , " 12% " , " 16% " , " 9% " , " 9% " , " 8% " , " 7% " , " 8% " , " 7% " , " 5% " ];
< ? php } ?>
2018-10-15 15:14:36 -04:00
},
},
{
extend : 'excel' ,
text : '<?php echo $transLang[' EXCEL ']; ?>' ,
2021-06-03 12:50:50 -04:00
orientation : 'landscape' ,
2018-10-15 15:14:36 -04:00
},
]
}
],
} );
} );
</ script >
<!-- CONTENT END -->
< ? php }; require_once ( " inc/footer.inc.php " );