| 1 |
<?php |
| 2 |
|
| 3 |
$companyName = (string) ($company_name ?? ''); |
| 4 |
$companyAddress = (string) ($company_address ?? ''); |
| 5 |
$companyEmail = (string) ($company_email ?? ''); |
| 6 |
$companyPhone = (string) ($company_phone ?? ''); |
| 7 |
|
| 8 |
$customerName = (string) ($customer_name ?? ''); |
| 9 |
$customerEmail = (string) ($customer_email ?? ''); |
| 10 |
|
| 11 |
$paymentRef = (string) ($payment_ref ?? ''); |
| 12 |
$paymentDate = (string) ($payment_date ?? ''); |
| 13 |
$paymentStatus = (string) ($payment_status ?? ''); |
| 14 |
$statusClass = (string) ($status_class ?? 'pending'); |
| 15 |
|
| 16 |
$tripTitle = (string) ($trip_title ?? ''); |
| 17 |
$paymentMethod = (string) ($payment_method ?? ''); |
| 18 |
$bookingRef = (string) ($booking_ref ?? ''); |
| 19 |
$travelDate = (string) ($travel_date ?? ''); |
| 20 |
|
| 21 |
$currencySymbol = (string) ($currency_symbol ?? ''); |
| 22 |
$amount = (string) ($amount ?? '0.00'); |
| 23 |
$bookingTotal = (string) ($booking_total ?? '0.00'); |
| 24 |
$amountPaid = (string) ($amount_paid ?? '0.00'); |
| 25 |
$amountDue = (string) ($amount_due ?? '0.00'); |
| 26 |
|
| 27 |
?><!DOCTYPE html> |
| 28 |
<html lang="en"> |
| 29 |
<head> |
| 30 |
<meta charset="UTF-8"> |
| 31 |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 32 |
<title>Invoice - <?php echo htmlspecialchars($paymentRef, ENT_QUOTES, 'UTF-8'); ?></title> |
| 33 |
<style> |
| 34 |
@page { size: A4 portrait; margin: 0mm; } |
| 35 |
* { margin: 0; padding: 0; box-sizing: border-box; } |
| 36 |
body { margin: 0; padding: 0; font-family: "DejaVu Sans", sans-serif; font-size: 12px; color: #111; } |
| 37 |
.content { padding: 12mm 12mm 14mm 12mm; } |
| 38 |
|
| 39 |
.header { width: 100%; border-collapse: collapse; } |
| 40 |
.header td { vertical-align: top; } |
| 41 |
.brand { background: #1e40af; color: #fff; padding: 6mm 6mm; } |
| 42 |
.brand h1 { font-size: 18px; font-weight: 700; margin: 0; } |
| 43 |
.brand p { font-size: 11px; margin-top: 4px; } |
| 44 |
|
| 45 |
.panel { width: 100%; border: 1px solid #e5e7eb; border-collapse: collapse; margin-top: 6mm; margin-bottom: 6mm; } |
| 46 |
.panel td { padding: 5mm 5mm; vertical-align: top; } |
| 47 |
.panel h3 { font-size: 11px; text-transform: uppercase; color: #6b7280; margin-bottom: 8px; letter-spacing: 0.5px; } |
| 48 |
.muted { color: #6b7280; } |
| 49 |
|
| 50 |
.details { width: 100%; border-collapse: collapse; } |
| 51 |
.details td { padding: 1.5mm 0; vertical-align: top; } |
| 52 |
.details .k { width: 18mm; white-space: nowrap; font-weight: 700; } |
| 53 |
.details .v { white-space: nowrap; } |
| 54 |
.details .v-wrap { white-space: normal; } |
| 55 |
|
| 56 |
.badge { display: inline-block; padding: 2px 10px; font-size: 10px; border-radius: 12px; border: 1px solid #e5e7eb; margin-left: 6px; vertical-align: middle; line-height: 1.4; } |
| 57 |
.badge-paid { background: #d1fae5; color: #065f46; border-color: #a7f3d0; } |
| 58 |
.badge-pending { background: #fef3c7; color: #92400e; border-color: #fde68a; } |
| 59 |
|
| 60 |
.items { width: 100%; border-collapse: collapse; margin-top: 4mm; } |
| 61 |
.items th { text-align: left; font-size: 10px; text-transform: uppercase; color: #6b7280; background: #f9fafb; border-bottom: 1px solid #e5e7eb; padding: 10px 12px; } |
| 62 |
.items td { border-bottom: 1px solid #e5e7eb; padding: 12px; vertical-align: top; } |
| 63 |
.right { text-align: right; } |
| 64 |
|
| 65 |
.totals { width: 100%; border-collapse: collapse; margin-top: 6mm; } |
| 66 |
.totals td { padding: 7px 12px; } |
| 67 |
.totals .label { color: #374151; } |
| 68 |
.totals .value { text-align: right; } |
| 69 |
.totals .grand { font-weight: 700; color: #1e40af; border-top: 2px solid #1e40af; padding-top: 12px; } |
| 70 |
</style> |
| 71 |
</head> |
| 72 |
<body> |
| 73 |
<table class="header"> |
| 74 |
<tr> |
| 75 |
<td class="brand"> |
| 76 |
<h1><?php echo htmlspecialchars($companyName, ENT_QUOTES, 'UTF-8'); ?></h1> |
| 77 |
<p><?php esc_html_e('Payment Invoice', 'yatra'); ?></p> |
| 78 |
</td> |
| 79 |
</tr> |
| 80 |
</table> |
| 81 |
|
| 82 |
<div class="content"> |
| 83 |
<table class="panel"> |
| 84 |
<tr> |
| 85 |
<td style="width: 40%;"> |
| 86 |
<h3><?php esc_html_e('Invoice To', 'yatra'); ?></h3> |
| 87 |
<div><strong><?php echo htmlspecialchars($customerName, ENT_QUOTES, 'UTF-8'); ?></strong></div> |
| 88 |
<div class="muted"><?php echo htmlspecialchars($customerEmail, ENT_QUOTES, 'UTF-8'); ?></div> |
| 89 |
</td> |
| 90 |
<td style="width: 30%;"> |
| 91 |
<h3><?php esc_html_e('Invoice Details', 'yatra'); ?></h3> |
| 92 |
<table class="details"> |
| 93 |
<tr> |
| 94 |
<td class="k"><?php esc_html_e('Invoice #:', 'yatra'); ?></td> |
| 95 |
<td class="v-wrap"><?php echo htmlspecialchars($paymentRef, ENT_QUOTES, 'UTF-8'); ?></td> |
| 96 |
</tr> |
| 97 |
<tr> |
| 98 |
<td class="k"><?php esc_html_e('Date:', 'yatra'); ?></td> |
| 99 |
<td class="v"><?php echo htmlspecialchars($paymentDate, ENT_QUOTES, 'UTF-8'); ?></td> |
| 100 |
</tr> |
| 101 |
<tr> |
| 102 |
<td class="k"><?php esc_html_e('Status:', 'yatra'); ?></td> |
| 103 |
<td class="v"><span class="badge badge-<?php echo htmlspecialchars($statusClass, ENT_QUOTES, 'UTF-8'); ?>"><?php echo htmlspecialchars($paymentStatus, ENT_QUOTES, 'UTF-8'); ?></span></td> |
| 104 |
</tr> |
| 105 |
</table> |
| 106 |
</td> |
| 107 |
<td style="width: 30%;"> |
| 108 |
<h3><?php esc_html_e('Company', 'yatra'); ?></h3> |
| 109 |
<div><?php echo htmlspecialchars($companyName, ENT_QUOTES, 'UTF-8'); ?></div> |
| 110 |
<?php if ($companyAddress !== ''): ?> |
| 111 |
<div class="muted"><?php echo htmlspecialchars($companyAddress, ENT_QUOTES, 'UTF-8'); ?></div> |
| 112 |
<?php endif; ?> |
| 113 |
<?php if ($companyEmail !== ''): ?> |
| 114 |
<div class="muted"><?php echo htmlspecialchars($companyEmail, ENT_QUOTES, 'UTF-8'); ?></div> |
| 115 |
<?php endif; ?> |
| 116 |
<?php if ($companyPhone !== ''): ?> |
| 117 |
<div class="muted"><?php echo htmlspecialchars($companyPhone, ENT_QUOTES, 'UTF-8'); ?></div> |
| 118 |
<?php endif; ?> |
| 119 |
</td> |
| 120 |
</tr> |
| 121 |
</table> |
| 122 |
|
| 123 |
<table class="items"> |
| 124 |
<thead> |
| 125 |
<tr> |
| 126 |
<th><?php esc_html_e('Description', 'yatra'); ?></th> |
| 127 |
<th><?php esc_html_e('Booking Ref', 'yatra'); ?></th> |
| 128 |
<th><?php esc_html_e('Travel Date', 'yatra'); ?></th> |
| 129 |
<th class="right"><?php esc_html_e('Amount', 'yatra'); ?></th> |
| 130 |
</tr> |
| 131 |
</thead> |
| 132 |
<tbody> |
| 133 |
<tr> |
| 134 |
<td> |
| 135 |
<div><strong><?php echo htmlspecialchars($tripTitle, ENT_QUOTES, 'UTF-8'); ?></strong></div> |
| 136 |
<div class="muted"><?php esc_html_e('Payment via', 'yatra'); ?> <?php echo htmlspecialchars($paymentMethod, ENT_QUOTES, 'UTF-8'); ?></div> |
| 137 |
</td> |
| 138 |
<td><?php echo htmlspecialchars($bookingRef, ENT_QUOTES, 'UTF-8'); ?></td> |
| 139 |
<td><?php echo htmlspecialchars($travelDate, ENT_QUOTES, 'UTF-8'); ?></td> |
| 140 |
<td class="right"><strong><?php echo $currencySymbol . htmlspecialchars($amount, ENT_QUOTES, 'UTF-8'); ?></strong></td> |
| 141 |
</tr> |
| 142 |
</tbody> |
| 143 |
</table> |
| 144 |
|
| 145 |
<table class="totals"> |
| 146 |
<?php if (!empty($tax_breakdown)): ?> |
| 147 |
<tr> |
| 148 |
<td class="label"><?php esc_html_e('Subtotal', 'yatra'); ?></td> |
| 149 |
<td class="value"><?php echo $currencySymbol . htmlspecialchars($subtotal, ENT_QUOTES, 'UTF-8'); ?></td> |
| 150 |
</tr> |
| 151 |
<?php foreach ($tax_breakdown as $tax): ?> |
| 152 |
<tr> |
| 153 |
<td class="label"><?php echo htmlspecialchars($tax['name'], ENT_QUOTES, 'UTF-8'); ?> (<?php echo htmlspecialchars($tax['rate'], ENT_QUOTES, 'UTF-8'); ?>%)</td> |
| 154 |
<td class="value"><?php echo $currencySymbol . htmlspecialchars($tax['amount'], ENT_QUOTES, 'UTF-8'); ?></td> |
| 155 |
</tr> |
| 156 |
<?php endforeach; ?> |
| 157 |
<?php endif; ?> |
| 158 |
<tr> |
| 159 |
<td class="label"><?php esc_html_e('Booking Total', 'yatra'); ?></td> |
| 160 |
<td class="value"><?php echo $currencySymbol . htmlspecialchars($bookingTotal, ENT_QUOTES, 'UTF-8'); ?></td> |
| 161 |
</tr> |
| 162 |
<tr> |
| 163 |
<td class="label"><?php esc_html_e('Total Paid', 'yatra'); ?></td> |
| 164 |
<td class="value"><?php echo $currencySymbol . htmlspecialchars($amountPaid, ENT_QUOTES, 'UTF-8'); ?></td> |
| 165 |
</tr> |
| 166 |
<tr> |
| 167 |
<td class="label"><?php esc_html_e('Balance Due', 'yatra'); ?></td> |
| 168 |
<td class="value"><?php echo $currencySymbol . htmlspecialchars($amountDue, ENT_QUOTES, 'UTF-8'); ?></td> |
| 169 |
</tr> |
| 170 |
<tr> |
| 171 |
<td class="label grand"><?php esc_html_e('This Payment', 'yatra'); ?></td> |
| 172 |
<td class="value grand"><?php echo $currencySymbol . htmlspecialchars($amount, ENT_QUOTES, 'UTF-8'); ?></td> |
| 173 |
</tr> |
| 174 |
</table> |
| 175 |
</div> |
| 176 |
</body> |
| 177 |
</html> |
| 178 |
|