| 1 |
<?php |
| 2 |
/** |
| 3 |
* Legacy Invoice Template |
| 4 |
* Clean, minimalist design with traditional business layout |
| 5 |
*/ |
| 6 |
|
| 7 |
if ( ! defined( 'ABSPATH' ) ) { |
| 8 |
exit; |
| 9 |
} |
| 10 |
$text_settings = \EasyInvoice\Helpers\TemplateTextHelper::forDocument(\EasyInvoice\Helpers\TemplateTextHelper::getInvoiceTextSettings(), $invoice); |
| 11 |
$ei_is_credit_note = \EasyInvoice\Helpers\TemplateTextHelper::isCreditNote($invoice); |
| 12 |
$company_info = \EasyInvoice\Helpers\TemplateTextHelper::getCompanyInfo(); |
| 13 |
?> |
| 14 |
|
| 15 |
<style> |
| 16 |
/* Legacy Template Styles - Clean Minimalist Design */ |
| 17 |
.template-legacy { |
| 18 |
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; |
| 19 |
max-width: 800px; |
| 20 |
margin: 0 auto; |
| 21 |
padding: 40px; |
| 22 |
background: #ffffff; |
| 23 |
color: #000000; |
| 24 |
line-height: 1.6; |
| 25 |
font-weight: 400; |
| 26 |
} |
| 27 |
|
| 28 |
/* Header Section */ |
| 29 |
.template-legacy .invoice-header { |
| 30 |
display: flex; |
| 31 |
justify-content: space-between; |
| 32 |
align-items: flex-start; |
| 33 |
|
| 34 |
} |
| 35 |
|
| 36 |
.template-legacy .company-info { |
| 37 |
flex: 1; |
| 38 |
} |
| 39 |
|
| 40 |
.template-legacy .company-logo { |
| 41 |
margin-bottom: 1rem; |
| 42 |
} |
| 43 |
|
| 44 |
.template-legacy .logo-image { |
| 45 |
max-height: 50px; |
| 46 |
max-width: 180px; |
| 47 |
object-fit: contain; |
| 48 |
} |
| 49 |
|
| 50 |
.template-legacy .company-name { |
| 51 |
font-size: 22px; |
| 52 |
font-weight: 800; |
| 53 |
color: #2563eb; |
| 54 |
margin-bottom: 8px; |
| 55 |
letter-spacing: -0.025em; |
| 56 |
} |
| 57 |
|
| 58 |
.template-legacy .company-details { |
| 59 |
color: #333333; |
| 60 |
font-size: 14px; |
| 61 |
line-height: 1.6; |
| 62 |
font-weight: 500; |
| 63 |
} |
| 64 |
|
| 65 |
.template-legacy .invoice-title-section { |
| 66 |
text-align: right; |
| 67 |
flex: 1; |
| 68 |
} |
| 69 |
|
| 70 |
.template-legacy .invoice-title { |
| 71 |
font-size: 20px; |
| 72 |
font-weight: 700; |
| 73 |
color: #111827; |
| 74 |
margin-bottom: 5px; |
| 75 |
} |
| 76 |
|
| 77 |
.template-legacy .invoice-meta { |
| 78 |
border: 1px solid #d1d5db; |
| 79 |
background: #ffffff; |
| 80 |
width: 280px; |
| 81 |
margin-left: auto; |
| 82 |
} |
| 83 |
|
| 84 |
.template-legacy .meta-item { |
| 85 |
display: flex; |
| 86 |
justify-content: space-between; |
| 87 |
align-items: center; |
| 88 |
padding: 12px 16px; |
| 89 |
border-bottom: 1px solid #d1d5db; |
| 90 |
} |
| 91 |
|
| 92 |
.template-legacy .meta-item:last-child { |
| 93 |
border-bottom: none; |
| 94 |
} |
| 95 |
|
| 96 |
.template-legacy .meta-label { |
| 97 |
font-weight: 600; |
| 98 |
color: #000000; |
| 99 |
font-size: 14px; |
| 100 |
} |
| 101 |
|
| 102 |
.template-legacy .meta-value { |
| 103 |
color: #111827; |
| 104 |
font-size: 14px; |
| 105 |
} |
| 106 |
|
| 107 |
.template-legacy .total-due { |
| 108 |
font-weight: 700; |
| 109 |
font-size: 16px; |
| 110 |
color: #111827; |
| 111 |
} |
| 112 |
|
| 113 |
/* Address Section */ |
| 114 |
.template-legacy .address-section { |
| 115 |
margin-bottom: 20px; |
| 116 |
} |
| 117 |
|
| 118 |
.template-legacy .address-block { |
| 119 |
margin-bottom: 20px; |
| 120 |
} |
| 121 |
|
| 122 |
.template-legacy .address-block h2 { |
| 123 |
font-size: 16px; |
| 124 |
font-weight: 600; |
| 125 |
color: #000000; |
| 126 |
margin-bottom: 8px; |
| 127 |
text-transform: uppercase; |
| 128 |
letter-spacing: 0.5px; |
| 129 |
} |
| 130 |
|
| 131 |
.template-legacy .address-content { |
| 132 |
color: #333333; |
| 133 |
font-size: 14px; |
| 134 |
line-height: 1.5; |
| 135 |
} |
| 136 |
|
| 137 |
.template-legacy .client-name { |
| 138 |
font-weight: 600; |
| 139 |
color: #111827; |
| 140 |
margin-bottom: 4px; |
| 141 |
} |
| 142 |
|
| 143 |
/* Description Section */ |
| 144 |
.template-legacy .description-section { |
| 145 |
margin-bottom: 30px; |
| 146 |
padding: 16px; |
| 147 |
background: #f9fafb; |
| 148 |
border-radius: 8px; |
| 149 |
border-left: 4px solid #e5e7eb; |
| 150 |
} |
| 151 |
|
| 152 |
.template-legacy .description-content { |
| 153 |
color: #000000; |
| 154 |
font-size: 14px; |
| 155 |
line-height: 1.6; |
| 156 |
} |
| 157 |
|
| 158 |
/* Invoice Items Table */ |
| 159 |
.template-legacy .invoice-items { |
| 160 |
width: 100%; |
| 161 |
border-collapse: collapse; |
| 162 |
margin-bottom: 20px; |
| 163 |
border: 1px solid #d1d5db; |
| 164 |
} |
| 165 |
|
| 166 |
.template-legacy .invoice-items thead { |
| 167 |
background: #f3f4f6; |
| 168 |
} |
| 169 |
|
| 170 |
.template-legacy .invoice-items th { |
| 171 |
padding: 14px 16px; |
| 172 |
text-align: left; |
| 173 |
font-weight: 700; |
| 174 |
color: #000000; |
| 175 |
font-size: 14px; |
| 176 |
border: 1px solid #d1d5db; |
| 177 |
text-transform: uppercase; |
| 178 |
letter-spacing: 0.5px; |
| 179 |
} |
| 180 |
|
| 181 |
.template-legacy .invoice-items td { |
| 182 |
padding: 14px 16px; |
| 183 |
border: 1px solid #d1d5db; |
| 184 |
font-size: 14px; |
| 185 |
vertical-align: top; |
| 186 |
color: #000000; |
| 187 |
} |
| 188 |
|
| 189 |
/* PDF-specific border fixes to prevent 2px borders */ |
| 190 |
.template-legacy .invoice-items th, |
| 191 |
.template-legacy .invoice-items td { |
| 192 |
border-width: 1px !important; |
| 193 |
border-style: solid !important; |
| 194 |
border-color: #d1d5db !important; |
| 195 |
} |
| 196 |
|
| 197 |
.template-legacy .invoice-meta { |
| 198 |
border-width: 1px !important; |
| 199 |
border-style: solid !important; |
| 200 |
border-color: #d1d5db !important; |
| 201 |
} |
| 202 |
|
| 203 |
.template-legacy .meta-item { |
| 204 |
border-bottom-width: 1px !important; |
| 205 |
border-bottom-style: solid !important; |
| 206 |
border-bottom-color: #d1d5db !important; |
| 207 |
} |
| 208 |
|
| 209 |
.template-legacy .invoice-items tbody tr:hover { |
| 210 |
background-color: #f9fafb; |
| 211 |
} |
| 212 |
|
| 213 |
.template-legacy .item-name .item-title { |
| 214 |
font-weight: 600; |
| 215 |
color: #111827; |
| 216 |
margin-bottom: 4px; |
| 217 |
} |
| 218 |
|
| 219 |
.template-legacy .item-name .item-description { |
| 220 |
color: #6b7280; |
| 221 |
font-size: 13px; |
| 222 |
} |
| 223 |
|
| 224 |
.template-legacy .item-quantity, |
| 225 |
.template-legacy .item-price, |
| 226 |
.template-legacy .item-adjust, |
| 227 |
.template-legacy .item-total { |
| 228 |
text-align: right; |
| 229 |
} |
| 230 |
|
| 231 |
/* Invoice Totals */ |
| 232 |
.template-legacy .invoice-totals { |
| 233 |
margin-left: auto; |
| 234 |
width: 300px; |
| 235 |
border: 1px solid #e5e7eb; |
| 236 |
border-radius: 8px; |
| 237 |
overflow: hidden; |
| 238 |
background: #ffffff; |
| 239 |
} |
| 240 |
|
| 241 |
.template-legacy .invoice-total-row { |
| 242 |
display: flex; |
| 243 |
justify-content: space-between; |
| 244 |
align-items: center; |
| 245 |
padding: 12px 16px; |
| 246 |
border-bottom: 1px solid #e5e7eb; |
| 247 |
} |
| 248 |
|
| 249 |
.template-legacy .invoice-total-row:last-child { |
| 250 |
border-bottom: none; |
| 251 |
} |
| 252 |
|
| 253 |
.template-legacy .invoice-total-label { |
| 254 |
font-weight: 600; |
| 255 |
color: #374151; |
| 256 |
font-size: 14px; |
| 257 |
} |
| 258 |
|
| 259 |
.template-legacy .invoice-total-value { |
| 260 |
color: #111827; |
| 261 |
font-size: 14px; |
| 262 |
} |
| 263 |
|
| 264 |
.template-legacy .invoice-totals .invoice-grand-total { |
| 265 |
background: #f9fafb; |
| 266 |
border-top: 1px solid #e5e7eb; |
| 267 |
margin-top: 0; |
| 268 |
padding-top: 12px; |
| 269 |
} |
| 270 |
|
| 271 |
.template-legacy .invoice-grand-total .invoice-total-label, |
| 272 |
.template-legacy .invoice-totals .invoice-grand-total .invoice-total-value { |
| 273 |
font-weight: 700; |
| 274 |
font-size: 16px; |
| 275 |
color: #111827; |
| 276 |
} |
| 277 |
|
| 278 |
/* Footer */ |
| 279 |
.template-legacy .invoice-footer { |
| 280 |
margin-top: 20px; |
| 281 |
border-top: 1px solid #e5e7eb; |
| 282 |
text-align: center; |
| 283 |
} |
| 284 |
|
| 285 |
.template-legacy .invoice-footer p { |
| 286 |
color: #6b7280; |
| 287 |
font-size: 14px; |
| 288 |
margin-bottom: 16px; |
| 289 |
} |
| 290 |
|
| 291 |
.template-legacy .footer-company { |
| 292 |
color: #9ca3af; |
| 293 |
font-size: 13px; |
| 294 |
} |
| 295 |
|
| 296 |
.template-legacy .terms-section { |
| 297 |
margin-top: 20px; |
| 298 |
padding: 20px; |
| 299 |
background: #f9fafb; |
| 300 |
border-radius: 8px; |
| 301 |
border-left: 4px solid #e5e7eb; |
| 302 |
} |
| 303 |
|
| 304 |
.template-legacy .terms-section h3 { |
| 305 |
font-size: 16px; |
| 306 |
font-weight: 600; |
| 307 |
color: #374151; |
| 308 |
margin-bottom: 12px; |
| 309 |
text-transform: uppercase; |
| 310 |
letter-spacing: 0.5px; |
| 311 |
} |
| 312 |
|
| 313 |
.template-legacy .terms-content { |
| 314 |
color: #6b7280; |
| 315 |
font-size: 14px; |
| 316 |
line-height: 1.6; |
| 317 |
} |
| 318 |
|
| 319 |
/* Shared polish: numbers line up, numeric headings sit over their figures. */ |
| 320 |
.template-legacy .invoice-items th + th { text-align: right; } |
| 321 |
.template-legacy .invoice-items .item-quantity, |
| 322 |
.template-legacy .invoice-items .item-price, |
| 323 |
.template-legacy .invoice-items .item-adjust, |
| 324 |
.template-legacy .invoice-items .item-total, |
| 325 |
.template-legacy .invoice-total-value { font-variant-numeric: tabular-nums; white-space: nowrap; } |
| 326 |
.template-legacy .meta-value { white-space: nowrap; } |
| 327 |
.template-legacy .invoice-items .item-adjust { text-align: right; } |
| 328 |
.template-legacy .client-contact { font-weight: 500; margin-bottom: 0.15em; } |
| 329 |
.template-legacy .client-tax-number, |
| 330 |
.template-legacy .company-tax-number { margin-top: 0.35em; } |
| 331 |
.template-legacy .invoice-items .item-description { white-space: pre-line; } |
| 332 |
.template-legacy .document-kind { display: block; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-muted, #8a8a8a); font-family: var(--font-family-body, inherit); font-style: normal; margin-bottom: 0.3em; line-height: 1.2; } |
| 333 |
|
| 334 |
/* Legacy: keeps its ruled grid, with softer rules and the same type size as the other designs. */ |
| 335 |
.template-legacy .invoice-items th, .template-legacy .invoice-items td { border-color: #e5e7eb !important; } |
| 336 |
.template-legacy .invoice-items th { background: #f9fafb; font-size: 12px; letter-spacing: 0.08em; color: #374151; } |
| 337 |
.template-legacy .invoice-meta, .template-legacy .meta-item { border-color: #e5e7eb !important; } |
| 338 |
.template-legacy .company-name { color: #111827; } |
| 339 |
.template-legacy .address-block h2 { font-size: 12px; letter-spacing: 0.12em; color: #6b7280; text-transform: uppercase; } |
| 340 |
.template-legacy .terms-section, .template-legacy .description-section { background: transparent; border: 0; border-top: 1px solid #e5e7eb; border-radius: 0; padding: 16px 0 0; } |
| 341 |
.template-legacy .terms-section h3 { font-size: 12px; letter-spacing: 0.12em; color: #6b7280; } |
| 342 |
.template-legacy .invoice-header { margin-bottom: 24px; } |
| 343 |
.template-legacy .invoice-totals .invoice-paid-row .invoice-total-value { color: var(--success-color, #047857); } |
| 344 |
.template-legacy .invoice-totals .invoice-balance-due { font-weight: 700; } |
| 345 |
.template-legacy .invoice-totals .invoice-balance-due .invoice-total-label { color: inherit; font-weight: 700; } |
| 346 |
</style> |
| 347 |
|
| 348 |
<div class="template-legacy"> |
| 349 |
<div class="invoice-header"> |
| 350 |
<div class="company-info"> |
| 351 |
<?php if (!empty($company_info['logo'])): ?> |
| 352 |
<div class="company-logo"> |
| 353 |
<img src="<?php echo esc_url($company_info['logo']); ?>" alt="<?php echo esc_attr($company_info['name']); ?>" class="logo-image" onerror="this.parentNode.parentNode.removeChild(this.parentNode)"> |
| 354 |
</div> |
| 355 |
<?php endif; ?> |
| 356 |
<div class="company-name"><?php echo esc_html($company_info['name']); ?></div> |
| 357 |
<div class="company-details"> |
| 358 |
<?php echo wp_kses_post(\EasyInvoice\Helpers\TemplateTextHelper::generateFromSection($company_info, false, 'details-only')); ?> |
| 359 |
</div> |
| 360 |
</div> |
| 361 |
|
| 362 |
<div class="invoice-title-section"> |
| 363 |
<?php $ei_kind = \EasyInvoice\Helpers\TemplateTextHelper::documentKind($invoice); $ei_title = trim((string) $invoice->getTitle()); ?> |
| 364 |
<div class="invoice-title"><?php if ('' !== $ei_title && 0 !== strcasecmp($ei_title, $ei_kind)) : ?><span class="document-kind"><?php echo esc_html($ei_kind); ?></span><?php endif; ?><?php echo esc_html('' !== $ei_title ? $ei_title : $ei_kind); ?></div> |
| 365 |
<div class="invoice-meta"> |
| 366 |
<div class="meta-item"> |
| 367 |
<span class="meta-label"><?php echo esc_html($text_settings['invoice_number']); ?></span> |
| 368 |
<span class="meta-value"><?php echo esc_html($invoice->getNumber()); ?></span> |
| 369 |
</div> |
| 370 |
<div class="meta-item"> |
| 371 |
<span class="meta-label"><?php echo esc_html($text_settings['invoice_date']); ?></span> |
| 372 |
<span class="meta-value"><?php echo esc_html(\EasyInvoice\Controllers\SettingsController::formatDate($invoice->getIssueDate())); ?></span> |
| 373 |
</div> |
| 374 |
<?php if (empty($ei_is_credit_note)) : ?> |
| 375 |
<div class="meta-item"> |
| 376 |
<span class="meta-label"><?php echo esc_html($text_settings['due_date']); ?></span> |
| 377 |
<span class="meta-value"><?php echo esc_html(\EasyInvoice\Controllers\SettingsController::formatDate($invoice->getDueDate())); ?></span> |
| 378 |
</div> |
| 379 |
<?php endif; ?> |
| 380 |
<?php if (empty($ei_is_credit_note)) : ?> |
| 381 |
<div class="meta-item"> |
| 382 |
<span class="meta-label"><?php echo esc_html($text_settings['total_due']); ?></span> |
| 383 |
<span class="meta-value total-due"><?php echo esc_html($formatter->format(\EasyInvoice\Helpers\TemplateTextHelper::amountDue($invoice))); ?></span> |
| 384 |
</div> |
| 385 |
<?php endif; ?> |
| 386 |
</div> |
| 387 |
</div> |
| 388 |
</div> |
| 389 |
|
| 390 |
<?php $ei_client_html = \EasyInvoice\Helpers\TemplateTextHelper::generateClientBlock($invoice); if ('' !== $ei_client_html) : ?> |
| 391 |
<div class="address-section"> |
| 392 |
<div class="address-block"> |
| 393 |
<h2><?php echo esc_html($text_settings['to']); ?></h2> |
| 394 |
<div class="address-content"> |
| 395 |
<?php echo wp_kses_post($ei_client_html); ?> |
| 396 |
</div> |
| 397 |
</div> |
| 398 |
</div> |
| 399 |
<?php endif; ?> |
| 400 |
|
| 401 |
<?php if ($invoice->getNotes()): ?> |
| 402 |
<div class="description-section"> |
| 403 |
<div class="description-content"> |
| 404 |
<?php echo nl2br(esc_html($invoice->getNotes())); ?> |
| 405 |
</div> |
| 406 |
</div> |
| 407 |
<?php endif; ?> |
| 408 |
|
| 409 |
<?php |
| 410 |
// The adjustment column appears only when at least one line uses it. |
| 411 |
$ei_show_adjust = \EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField(); |
| 412 |
if ($ei_show_adjust) { |
| 413 |
$ei_show_adjust = false; |
| 414 |
foreach ($invoice->getItems() as $ei_item) { |
| 415 |
if ((float) $ei_item->getAdjustPercentage() != 0.0) { $ei_show_adjust = true; break; } |
| 416 |
} |
| 417 |
} |
| 418 |
?> |
| 419 |
<table class="invoice-items"> |
| 420 |
<thead> |
| 421 |
<tr> |
| 422 |
<th><?php echo esc_html($text_settings['service']); ?></th> |
| 423 |
<th><?php echo esc_html($text_settings['qty']); ?></th> |
| 424 |
<th><?php echo esc_html($text_settings['rate_price']); ?></th> |
| 425 |
<?php if ($ei_show_adjust): ?> |
| 426 |
<th><?php echo esc_html($text_settings['adjust']); ?> (%)</th> |
| 427 |
<?php endif; ?> |
| 428 |
<th><?php echo esc_html($text_settings['line_total'] ?? $text_settings['total']); ?></th> |
| 429 |
</tr> |
| 430 |
</thead> |
| 431 |
<tbody> |
| 432 |
<?php if (!$invoice->getItems()) : ?> |
| 433 |
<tr class="no-items"><td colspan="<?php echo $ei_show_adjust ? 5 : 4; ?>" style="text-align:center;color:#9ca3af;padding:18px;"><?php esc_html_e('No items yet.', 'easy-invoice'); ?></td></tr> |
| 434 |
<?php endif; ?> |
| 435 |
<?php foreach ($invoice->getItems() as $item): ?> |
| 436 |
<tr> |
| 437 |
<td class="item-name"> |
| 438 |
<div class="item-title"><?php echo esc_html($item->getName()); ?></div> |
| 439 |
<?php if ($item->getDescription()): ?> |
| 440 |
<div class="item-description"><?php echo esc_html($item->getDescription()); ?></div> |
| 441 |
<?php endif; ?> |
| 442 |
</td> |
| 443 |
<td class="item-quantity"><?php echo esc_html($item->getQuantity() ?: '0'); ?></td> |
| 444 |
<td class="item-price"><?php echo esc_html($formatter->format($item->getPrice())); ?></td> |
| 445 |
<?php if ($ei_show_adjust): ?> |
| 446 |
<td class="item-adjust"><?php |
| 447 |
$adjust_percentage = $item->getAdjustPercentage(); |
| 448 |
if ($adjust_percentage != 0) { |
| 449 |
echo esc_html($adjust_percentage > 0 ? '+' : '') . esc_html($adjust_percentage) . '%'; |
| 450 |
} else { |
| 451 |
echo esc_html__('—', 'easy-invoice'); |
| 452 |
} |
| 453 |
?></td> |
| 454 |
<?php endif; ?> |
| 455 |
<td class="item-total"><?php echo esc_html($formatter->format($item->getAmount())); ?></td> |
| 456 |
</tr> |
| 457 |
<?php endforeach; ?> |
| 458 |
</tbody> |
| 459 |
</table> |
| 460 |
|
| 461 |
<div class="invoice-totals"> |
| 462 |
<?php echo wp_kses_post(\EasyInvoice\Helpers\TemplateTextHelper::generateTotalsSection($invoice, $text_settings, $formatter, 'invoice')); ?> |
| 463 |
</div> |
| 464 |
|
| 465 |
<?php |
| 466 |
$terms_conditions = empty($ei_is_credit_note) ? ($invoice->getTerms() ?: \EasyInvoice\Controllers\SettingsController::getInvoiceTermsConditions()) : ''; |
| 467 |
if ($terms_conditions): |
| 468 |
?> |
| 469 |
<div class="terms-section"> |
| 470 |
<h3><?php esc_html_e('Terms & Conditions', 'easy-invoice'); ?></h3> |
| 471 |
<div class="terms-content"> |
| 472 |
<?php echo wp_kses_post($terms_conditions); ?> |
| 473 |
</div> |
| 474 |
</div> |
| 475 |
<?php endif; ?> |
| 476 |
|
| 477 |
<?php |
| 478 |
/** |
| 479 |
* Fires inside the document card, after notes and terms and before the |
| 480 |
* footer text: attachments, the signature block, e-invoicing notes. Being |
| 481 |
* inside the card, it is part of what "Download as PDF" captures. |
| 482 |
* |
| 483 |
* @param object $document The invoice model. |
| 484 |
* @param string $type 'invoice'. |
| 485 |
*/ |
| 486 |
do_action('easy_invoice_document_body_after', $invoice, 'invoice'); |
| 487 |
|
| 488 |
$ei_footer_text = \EasyInvoice\Helpers\TemplateTextHelper::footerText($invoice, 'invoice'); |
| 489 |
if ('' !== trim(wp_strip_all_tags((string) $ei_footer_text))) : |
| 490 |
?> |
| 491 |
<div class="invoice-footer"> |
| 492 |
<p><?php echo wp_kses_post($ei_footer_text); ?></p> |
| 493 |
</div> |
| 494 |
<?php endif; ?> |
| 495 |
</div> |
| 496 |
|