PluginProbe
Easy Invoice – Invoice Generator, PDF Quotes & Payments / 2.4.4
Easy Invoice – Invoice Generator, PDF Quotes & Payments v2.4.4
2.4.3 2.4.4 2.4.2 2.4.0 2.4.1 2.3.8 2.3.7 2.3.6 2.3.5 2.3.4 2.3.3 2.3.2 2.3.1 2.2.0 2.1.21 2.1.20 2.1.19 2.1.18 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 All 60 releases
← All changes | templates/invoice-templates/corporate.php +114 -29 2.3.5 → 2.4.4 View file →
@@ -3,9 +3,13 @@
3 3 * Corporate Template - Business-Focused Design
4 4 * Professional, corporate, and business-oriented invoice template
5 5 */
6 6
7 -$text_settings = \EasyInvoice\Helpers\TemplateTextHelper::getInvoiceTextSettings();
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);
8 12 $company_info = \EasyInvoice\Helpers\TemplateTextHelper::getCompanyInfo();
9 13 ?>
10 14 <style>
11 15 /* Corporate Template - Business-Focused Design */
@@ -329,9 +333,9 @@
329 333 font-weight: 600;
330 334 color: var(--text-primary);
331 335 }
332 336
333 -.template-corporate .invoice-grand-total {
337 +.template-corporate .invoice-totals .invoice-grand-total {
334 338 font-size: var(--font-size-xl);
335 339 font-weight: 700;
336 340 color: var(--primary-color);
337 341 border-top: 2px solid var(--primary-color);
@@ -427,26 +431,81 @@
427 431 .template-corporate .invoice-totals {
428 432 width: 100%;
429 433 }
430 434 }
435 +
436 +/* Shared polish: numbers line up, numeric headings sit over their figures. */
437 +.template-corporate .invoice-items th + th { text-align: right; }
438 +.template-corporate .invoice-items .item-quantity,
439 +.template-corporate .invoice-items .item-price,
440 +.template-corporate .invoice-items .item-adjust,
441 +.template-corporate .invoice-items .item-total,
442 +.template-corporate .invoice-total-value { font-variant-numeric: tabular-nums; white-space: nowrap; }
443 +.template-corporate .meta-value { white-space: nowrap; }
444 +.template-corporate .invoice-items .item-adjust { text-align: right; }
445 +.template-corporate .client-contact { font-weight: 500; margin-bottom: 0.15em; }
446 +.template-corporate .client-tax-number,
447 +.template-corporate .company-tax-number { margin-top: 0.35em; }
448 +.template-corporate .invoice-items .item-description { white-space: pre-line; }
449 +
450 +/* Corporate: a navy masthead across the full width of the sheet, rules below it. */
451 +.template-corporate { border-radius: 0; }
452 +.template-corporate::before { display: none; }
453 +.template-corporate .invoice-header { background: var(--primary-color); color: #ffffff; margin: calc(-1 * var(--spacing-8)) calc(-1 * var(--spacing-8)) var(--spacing-10); padding: var(--spacing-8); border-bottom: 0; align-items: start; }
454 +.template-corporate .invoice-header::after { display: none; }
455 +.template-corporate .company-name { color: #ffffff; }
456 +.template-corporate .company-details { color: rgba(255, 255, 255, 0.78); }
457 +.template-corporate .logo-image { filter: none; background: #ffffff; padding: 6px; border-radius: var(--radius-sm); }
458 +.template-corporate .invoice-meta { background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.22); box-shadow: none; border-radius: var(--radius-sm); padding: var(--spacing-5) var(--spacing-6); gap: 0; }
459 +.template-corporate .invoice-title { color: #ffffff; text-align: left; letter-spacing: 0.1em; font-size: var(--font-size-xl); margin-bottom: var(--spacing-3); }
460 +.template-corporate .meta-item { border-bottom: 1px solid rgba(255, 255, 255, 0.18); padding: var(--spacing-2) 0; }
461 +.template-corporate .meta-item:last-child { border-bottom: 0; }
462 +.template-corporate .meta-label { color: rgba(255, 255, 255, 0.72); }
463 +.template-corporate .meta-value { color: #ffffff; }
464 +.template-corporate .address-section { margin-bottom: var(--spacing-10); }
465 +.template-corporate .address-block { background: transparent; border: 0; border-left: 3px solid var(--primary-color); border-radius: 0; padding: var(--spacing-1) var(--spacing-5); overflow: visible; }
466 +.template-corporate .address-block::before { display: none; }
467 +.template-corporate .address-block h2 { font-size: var(--font-size-xs); color: var(--text-muted); margin-bottom: var(--spacing-2); letter-spacing: 0.12em; }
468 +.template-corporate .invoice-items { border-radius: 0; box-shadow: none; border: 0; border-top: 2px solid var(--primary-color); margin-bottom: var(--spacing-10); }
469 +.template-corporate .invoice-items th { background: var(--background-accent); color: var(--text-primary); border-bottom: 1px solid var(--border-color); padding: var(--spacing-3) var(--spacing-5); font-size: var(--font-size-xs); letter-spacing: 0.08em; }
470 +.template-corporate .invoice-items td { padding: var(--spacing-4) var(--spacing-5); }
471 +.template-corporate .invoice-items tr:last-child td { border-bottom: 1px solid var(--border-light); }
472 +.template-corporate .invoice-items tr:hover { background: transparent; }
473 +.template-corporate .invoice-totals { border-radius: 0; box-shadow: none; background: transparent; border: 0; padding: 0; width: 380px; }
474 +.template-corporate .invoice-total-row { padding: var(--spacing-2) var(--spacing-4); }
475 +.template-corporate .invoice-totals .invoice-grand-total { background: var(--primary-color); margin-top: var(--spacing-3); padding: var(--spacing-3) var(--spacing-4); border: 0; }
476 +.template-corporate .invoice-grand-total .invoice-total-label, .template-corporate .invoice-grand-total .invoice-total-value { color: #ffffff; }
477 +.template-corporate .invoice-notes, .template-corporate .invoice-terms { border-radius: 0; background: transparent; border: 0; border-top: 1px solid var(--border-color); padding: var(--spacing-5) 0 0; margin-top: var(--spacing-6); }
478 +.template-corporate .invoice-notes h3, .template-corporate .invoice-terms h3 { border: 0; padding: 0; font-size: var(--font-size-xs); text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); margin-bottom: var(--spacing-2); }
479 +.template-corporate .invoice-footer { border-top: 1px solid var(--border-color); }
480 +@media (max-width: 768px) {
481 + .template-corporate .invoice-header { margin: calc(-1 * var(--spacing-4)) calc(-1 * var(--spacing-4)) var(--spacing-8); padding: var(--spacing-5) var(--spacing-4); }
482 +}
483 +.template-corporate .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; }
484 +.template-corporate .invoice-totals .invoice-paid-row .invoice-total-value { color: var(--success-color, #047857); }
485 +.template-corporate .invoice-totals .invoice-balance-due { font-weight: 700; }
486 +.template-corporate .invoice-totals .invoice-balance-due .invoice-total-label { color: inherit; font-weight: 700; }
487 +.template-corporate .meta-amount-due .meta-value { font-weight: 700; font-size: 1.08em; }
488 +.template-corporate .invoice-title .document-kind { color: rgba(255, 255, 255, 0.65); }
431 489 </style>
432 490
433 491 <div class="template template-corporate">
434 492 <div class="invoice-header">
435 493 <div class="company-info">
494 + <?php if (!empty($company_info['logo'])): ?>
436 495 <div class="company-logo">
437 - <?php if (!empty($company_info['logo'])): ?>
438 - <img src="<?php echo esc_url($company_info['logo']); ?>" alt="<?php echo esc_attr($company_info['name']); ?>" class="logo-image">
439 - <?php endif; ?>
496 + <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)">
440 497 </div>
498 + <?php endif; ?>
441 499 <div class="company-name"><?php echo esc_html($company_info['name']); ?></div>
442 500 <div class="company-details">
443 - <?php echo \EasyInvoice\Helpers\TemplateTextHelper::generateFromSection($company_info, false, 'details-only'); ?>
501 + <?php echo wp_kses_post(\EasyInvoice\Helpers\TemplateTextHelper::generateFromSection($company_info, false, 'details-only')); ?>
444 502 </div>
445 503 </div>
446 504
447 505 <div class="invoice-meta">
448 - <div class="invoice-title"><?php echo esc_html($invoice->getTitle() ?: __('Invoice', 'easy-invoice')); ?></div>
506 + <?php $ei_kind = \EasyInvoice\Helpers\TemplateTextHelper::documentKind($invoice); $ei_title = trim((string) $invoice->getTitle()); ?>
507 + <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>
449 508 <div class="meta-item">
450 509 <span class="meta-label"><?php echo esc_html($text_settings['invoice_number']); ?></span>
451 510 <span class="meta-value"><?php echo esc_html($invoice->getNumber()); ?></span>
452 511 </div>
@@ -453,30 +512,44 @@
453 512 <div class="meta-item">
454 513 <span class="meta-label"><?php echo esc_html($text_settings['invoice_date']); ?></span>
455 514 <span class="meta-value"><?php echo esc_html(\EasyInvoice\Controllers\SettingsController::formatDate($invoice->getIssueDate())); ?></span>
456 515 </div>
516 + <?php if (empty($ei_is_credit_note)) : ?>
457 517 <div class="meta-item">
458 518 <span class="meta-label"><?php echo esc_html($text_settings['due_date']); ?></span>
459 519 <span class="meta-value"><?php echo esc_html(\EasyInvoice\Controllers\SettingsController::formatDate($invoice->getDueDate())); ?></span>
460 520 </div>
521 + <?php endif; ?>
522 + <?php if (empty($ei_is_credit_note)) : ?>
523 + <div class="meta-item meta-amount-due">
524 + <span class="meta-label"><?php echo esc_html($text_settings['total_due']); ?></span>
525 + <span class="meta-value"><?php echo esc_html($formatter->format(\EasyInvoice\Helpers\TemplateTextHelper::amountDue($invoice))); ?></span>
526 + </div>
527 + <?php endif; ?>
461 528 </div>
462 529 </div>
463 530
531 + <?php $ei_client_html = \EasyInvoice\Helpers\TemplateTextHelper::generateClientBlock($invoice); if ('' !== $ei_client_html) : ?>
464 532 <div class="address-section">
465 533 <div class="address-block">
466 534 <h2><?php echo esc_html($text_settings['to']); ?></h2>
467 535 <div class="address-content">
468 - <div class="client-name"><?php echo esc_html($invoice->getCustomerName()); ?></div>
469 - <?php if ($invoice->getCustomerAddress()): ?>
470 - <?php echo nl2br(esc_html($invoice->getCustomerAddress())); ?><br>
471 - <?php endif; ?>
472 - <?php if ($invoice->getCustomerEmail()): ?>
473 - <?php echo esc_html($invoice->getCustomerEmail()); ?><br>
474 - <?php endif; ?>
536 + <?php echo wp_kses_post($ei_client_html); ?>
475 537 </div>
476 538 </div>
477 539 </div>
540 + <?php endif; ?>
478 541
542 + <?php
543 + // The adjustment column appears only when at least one line uses it.
544 + $ei_show_adjust = \EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField();
545 + if ($ei_show_adjust) {
546 + $ei_show_adjust = false;
547 + foreach ($invoice->getItems() as $ei_item) {
548 + if ((float) $ei_item->getAdjustPercentage() != 0.0) { $ei_show_adjust = true; break; }
549 + }
550 + }
551 + ?>
479 552 <table class="invoice-items">
480 553 <thead>
481 554 <tr>
482 555 <th><?php echo esc_html($text_settings['service']); ?></th>
@@ -481,15 +554,18 @@
481 554 <tr>
482 555 <th><?php echo esc_html($text_settings['service']); ?></th>
483 556 <th><?php echo esc_html($text_settings['qty']); ?></th>
484 557 <th><?php echo esc_html($text_settings['rate_price']); ?></th>
485 - <?php if (\EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField()): ?>
558 + <?php if ($ei_show_adjust): ?>
486 559 <th><?php echo esc_html($text_settings['adjust']); ?> (%)</th>
487 560 <?php endif; ?>
488 - <th><?php echo esc_html($text_settings['total']); ?></th>
561 + <th><?php echo esc_html($text_settings['line_total'] ?? $text_settings['total']); ?></th>
489 562 </tr>
490 563 </thead>
491 564 <tbody>
565 + <?php if (!$invoice->getItems()) : ?>
566 + <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>
567 + <?php endif; ?>
492 568 <?php foreach ($invoice->getItems() as $item): ?>
493 569 <tr>
494 570 <td class="item-name">
495 571 <div class="item-title"><?php echo esc_html($item->getName()); ?></div>
@@ -498,9 +574,9 @@
498 574 <?php endif; ?>
499 575 </td>
500 576 <td class="item-quantity"><?php echo esc_html($item->getQuantity() ?: '0'); ?></td>
501 577 <td class="item-price"><?php echo esc_html($formatter->format($item->getPrice())); ?></td>
502 - <?php if (\EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField()): ?>
578 + <?php if ($ei_show_adjust): ?>
503 579 <td class="item-adjust"><?php
504 580 $adjust_percentage = $item->getAdjustPercentage();
505 581 if ($adjust_percentage != 0) {
506 582 echo esc_html($adjust_percentage > 0 ? '+' : '') . esc_html($adjust_percentage) . '%';
@@ -515,14 +591,14 @@
515 591 </tbody>
516 592 </table>
517 593
518 594 <div class="invoice-totals">
519 - <?php echo \EasyInvoice\Helpers\TemplateTextHelper::generateTotalsSection($invoice, $text_settings, $formatter, 'invoice'); ?>
595 + <?php echo wp_kses_post(\EasyInvoice\Helpers\TemplateTextHelper::generateTotalsSection($invoice, $text_settings, $formatter, 'invoice')); ?>
520 596 </div>
521 597
522 598 <?php if ($invoice->getNotes()): ?>
523 599 <div class="invoice-notes">
524 - <h3><?php _e('Notes:', 'easy-invoice'); ?></h3>
600 + <h3><?php esc_html_e('Notes', 'easy-invoice'); ?></h3>
525 601 <div class="notes-content">
526 602 <?php echo wp_kses_post($invoice->getNotes() ?: ''); ?>
527 603 </div>
528 604 </div>
@@ -528,13 +604,13 @@
528 604 </div>
529 605 <?php endif; ?>
530 606
531 607 <?php
532 - $terms_conditions = $invoice->getTerms() ?: \EasyInvoice\Controllers\SettingsController::getInvoiceTermsConditions();
608 + $terms_conditions = empty($ei_is_credit_note) ? ($invoice->getTerms() ?: \EasyInvoice\Controllers\SettingsController::getInvoiceTermsConditions()) : '';
533 609 if ($terms_conditions):
534 610 ?>
535 611 <div class="invoice-terms">
536 - <h3><?php _e('Terms & Conditions:', 'easy-invoice'); ?></h3>
612 + <h3><?php esc_html_e('Terms & Conditions', 'easy-invoice'); ?></h3>
537 613 <div class="terms-content">
538 614 <?php echo wp_kses_post($terms_conditions); ?>
539 615 </div>
540 616 </div>
@@ -539,14 +615,23 @@
539 615 </div>
540 616 </div>
541 617 <?php endif; ?>
542 618
619 + <?php
620 + /**
621 + * Fires inside the document card, after notes and terms and before the
622 + * footer text: attachments, the signature block, e-invoicing notes. Being
623 + * inside the card, it is part of what "Download as PDF" captures.
624 + *
625 + * @param object $document The invoice model.
626 + * @param string $type 'invoice'.
627 + */
628 + do_action('easy_invoice_document_body_after', $invoice, 'invoice');
629 +
630 + $ei_footer_text = \EasyInvoice\Helpers\TemplateTextHelper::footerText($invoice, 'invoice');
631 + if ('' !== trim(wp_strip_all_tags((string) $ei_footer_text))) :
632 + ?>
543 633 <div class="invoice-footer">
544 - <?php
545 - $invoice_footer_text = $invoice->getFooterText();
546 - if (!$invoice_footer_text) {
547 - $invoice_footer_text = \EasyInvoice\Controllers\SettingsController::getInvoiceFooterText();
548 - }
549 - ?>
550 - <p><?php echo wp_kses_post($invoice_footer_text); ?></p>
634 + <p><?php echo wp_kses_post($ei_footer_text); ?></p>
551 635 </div>
552 -</div>
636 + <?php endif; ?>
637 +</div>