101 lines
3.8 KiB
PHP
101 lines
3.8 KiB
PHP
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Trip Plan Report</title>
|
|
<style>
|
|
body { font-family: Arial, sans-serif; font-size: 12px; }
|
|
h2 { text-align: center; background-color: #e8b7b7; padding: 7px; color: white; border-radius: 5px;}
|
|
table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
|
|
th, td { border: 1px solid #aaaaaa; padding: 6px; text-align: left; }
|
|
.section-title {
|
|
margin:20px 0 20px 0;
|
|
padding-bottom: 5px;
|
|
border-bottom: 3px dotted #aaaaaa;
|
|
position: relative;
|
|
font-size: 20px;
|
|
font-weight: 500;
|
|
}
|
|
.child{ background-color: #f1d5d5; }
|
|
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<h2>Trip Plan Report</h2>
|
|
|
|
<!-- <div class="section-title">Basic Info</div> -->
|
|
<table>
|
|
<tr>
|
|
<th>Trip Title</th><td colspan="3"><?= esc($data['trip_title']) ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th>Traveller</th><td><?= esc( $data['user_name'] ?? $data['traveller_name'] ) ?></td>
|
|
<th>Department</th><td><?= esc( $data['functional_department_value'] ) ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th>Trip Type</th><td><?= esc($data['trip_type_value']) ?></td>
|
|
<th>Is Billable</th><td><?= esc($data['is_billable_value']) ?></td>
|
|
</tr>
|
|
<tr>
|
|
<th>Cost Center</th><td><?= esc($data['cost_center_value']) ?></td>
|
|
<th>Plan Status</th><td><?= esc($data['status_value']) ?></td>
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<?php if (!empty($data['flight'])): ?>
|
|
<div class="section-title">Flights</div>
|
|
<?php foreach ($data['flight'] as $flight): ?>
|
|
<table>
|
|
<tr><th>Flight ID</th><td><?= esc($flight['flight_id']) ?></td></tr>
|
|
<tr><th>Comments</th><td><?= esc($flight['comments']) ?></td></tr>
|
|
</table>
|
|
<table>
|
|
<thead>
|
|
<tr class="child">
|
|
<th>From</th><th>To</th><th>Date</th><th>Time</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($flight['trips'] as $trip): ?>
|
|
<tr>
|
|
<td><?= esc($trip['from_place']) ?></td>
|
|
<td><?= esc($trip['to_place']) ?></td>
|
|
<td><?= esc($trip['date']) ?></td>
|
|
<td><?= esc($trip['time']) ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
|
|
<?php
|
|
$sections = ['accomodation', 'bus', 'insurance', 'miscellaneous', 'taxi', 'train', 'visa'];
|
|
foreach ($sections as $section) {
|
|
if (!empty($data[$section])) {
|
|
echo "<div class='section-title'>" . ucfirst($section) . "</div><table><thead><tr>";
|
|
foreach (array_keys($data[$section][0]) as $key) {
|
|
if (!in_array($key, ['created_on', 'created_by', 'updated_on', 'updated_by', 'is_active', 'plan_id'])) {
|
|
echo "<th class='child'>" . ucfirst(str_replace('_', ' ', $key)) . "</th>";
|
|
}
|
|
}
|
|
echo "</tr></thead><tbody>";
|
|
foreach ($data[$section] as $item) {
|
|
echo "<tr>";
|
|
foreach ($item as $k => $v) {
|
|
if (!in_array($k, ['created_on', 'created_by', 'updated_on', 'updated_by', 'is_active', 'plan_id'])) {
|
|
echo "<td>" . esc($v) . "</td>";
|
|
}
|
|
}
|
|
echo "</tr>";
|
|
}
|
|
echo "</tbody></table>";
|
|
}
|
|
}
|
|
?>
|
|
|
|
</body>
|
|
</html>
|