Kimai time management system (PHP 5.6 / MySQL) with custom extensions: - Budget tracking (ki_budget) - Change request form (ki_changerequest) - Invoice generation (ki_invoice) - Expense tracking (ki_expenses) - Flexi time (ki_flexitime) - Export, admin panel, timesheets, tasks, summary Database: ~900K time entries, 2,000+ users, 439 projects. Config: includes/autoconf.php — localhost/kimai/kimai
48 lines
2.0 KiB
PHP
48 lines
2.0 KiB
PHP
<?php
|
|
require 'includes/autoconf.php';
|
|
|
|
if (isset($_GET['from_date'], $_GET['to_date'] , $_GET['kimaiuserid'] , $_GET['reportid'])) {
|
|
|
|
$conn = new mysqli($server_hostname, $server_username, $server_password, $server_database);
|
|
$sql = "SELECT usr_alias FROM kimai15_usr WHERE usr_ID = ". $_GET['kimaiuserid'];
|
|
|
|
$result = $conn->query($sql);
|
|
|
|
if ($result->num_rows > 0) {
|
|
// output data of each row
|
|
while($row = $result->fetch_assoc()) {
|
|
$usr_alias = $row["usr_alias"];
|
|
}
|
|
} else {
|
|
echo "0 results";
|
|
}
|
|
$conn->close();
|
|
|
|
$new_filename = 'Timesheet ' . $usr_alias . ' Week Ending '. $_GET['to_date'] ;
|
|
$curl = curl_init();
|
|
|
|
curl_setopt_array($curl, array(
|
|
//CURLOPT_URL => "http://160.119.100.178:8080/jasperserver/rest_v2/reports/Timesheets/".$_GET['reportid'].".pdf?from_date=".$_GET['from_date']."&to_date=".$_GET['to_date']."&KimaiUserId=".$_GET['kimaiuserid']."&j_username=jaco&j_password=Bollie0001",
|
|
CURLOPT_URL => "https://reportserver.alteram.co.za/jasperserver/rest_v2/reports/Timesheets/".$_GET['reportid'].".pdf?from_date=".$_GET['from_date']."&to_date=".$_GET['to_date']."&KimaiUserId=".$_GET['kimaiuserid']."&j_username=jaco&j_password=Bollie0001",
|
|
//CURLOPT_URL => "https://reportserver.alteram.co.za/jasperserver/rest_v2/reports/Timesheets/".$_GET['reportid'].".pdf?from_date=".$_GET['from_date']."&to_date=".$_GET['to_date']."&KimaiUserId=".$_GET['kimaiuserid']."&j_username=jaco&j_password=Bollie0001",
|
|
CURLOPT_RETURNTRANSFER => true,
|
|
CURLOPT_ENCODING => "",
|
|
CURLOPT_MAXREDIRS => 10,
|
|
CURLOPT_TIMEOUT => 0,
|
|
CURLOPT_FOLLOWLOCATION => true,
|
|
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
|
CURLOPT_CUSTOMREQUEST => "GET",
|
|
CURLOPT_SSL_VERIFYPEER => false, // Disable peer verification
|
|
|
|
CURLOPT_SSL_VERIFYHOST => false,
|
|
));
|
|
header('Content-type:application/pdf');
|
|
header('Content-Disposition: inline; filename="' .$new_filename.'.pdf"');
|
|
$response = curl_exec($curl);
|
|
|
|
curl_close($curl);
|
|
echo $response;
|
|
}
|
|
?>
|
|
|