PluginProbe
Easy Invoice – Invoice Generator, PDF Quotes & Payments / 2.4.3
Easy Invoice – Invoice Generator, PDF Quotes & Payments v2.4.3
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/professional.php +98 -36 2.2.0 → 2.4.3 View file →
@@ -3,13 +3,17 @@
3 3 * Professional Template - Sophisticated Design
4 4 * Professional, sophisticated, and business-focused invoice template
5 5 */
6 6
7 +if ( ! defined( 'ABSPATH' ) ) {
8 + exit;
9 +}
7 10 if (!$formatter && $invoice) {
8 11 $formatter = new \EasyInvoice\Helpers\InvoiceFormatter($invoice);
9 12 }
10 13
11 -$text_settings = \EasyInvoice\Helpers\TemplateTextHelper::getInvoiceTextSettings();
14 +$text_settings = \EasyInvoice\Helpers\TemplateTextHelper::forDocument(\EasyInvoice\Helpers\TemplateTextHelper::getInvoiceTextSettings(), $invoice);
15 +$ei_is_credit_note = \EasyInvoice\Helpers\TemplateTextHelper::isCreditNote($invoice);
12 16 $company_info = \EasyInvoice\Helpers\TemplateTextHelper::getCompanyInfo();
13 17 ?>
14 18 <style>
15 19 /* Professional Template - Sophisticated Design */
@@ -332,9 +336,9 @@
332 336 font-weight: 600;
333 337 color: var(--text-primary);
334 338 }
335 339
336 -.template-professional .invoice-grand-total {
340 +.template-professional .invoice-totals .invoice-grand-total {
337 341 font-size: var(--font-size-xl);
338 342 font-weight: 700;
339 343 color: var(--primary-color);
340 344 border-top: 2px solid var(--primary-color);
@@ -430,27 +434,65 @@
430 434 .template-professional .invoice-totals {
431 435 width: 100%;
432 436 }
433 437 }
438 +
439 +/* Shared polish: numbers line up, numeric headings sit over their figures. */
440 +.template-professional .invoice-items th + th { text-align: right; }
441 +.template-professional .invoice-items .item-quantity,
442 +.template-professional .invoice-items .item-price,
443 +.template-professional .invoice-items .item-adjust,
444 +.template-professional .invoice-items .item-total,
445 +.template-professional .invoice-total-value { font-variant-numeric: tabular-nums; white-space: nowrap; }
446 +.template-professional .meta-value { white-space: nowrap; }
447 +.template-professional .invoice-items .item-adjust { text-align: right; }
448 +.template-professional .client-contact { font-weight: 500; margin-bottom: 0.15em; }
449 +.template-professional .client-tax-number,
450 +.template-professional .company-tax-number { margin-top: 0.35em; }
451 +.template-professional .invoice-items .item-description { white-space: pre-line; }
452 +.template-professional .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; }
453 +
454 +/* Professional: the same navy, with the sections closer together and quieter shadows. */
455 +.template-professional .invoice-header { margin-bottom: var(--spacing-8); padding-bottom: var(--spacing-6); }
456 +.template-professional .invoice-meta { box-shadow: none; gap: 0; padding: var(--spacing-5) var(--spacing-6); }
457 +.template-professional .invoice-title { margin-bottom: var(--spacing-2); font-size: var(--font-size-xl); letter-spacing: 0.04em; }
458 +.template-professional .meta-item { padding: var(--spacing-2) 0; }
459 +.template-professional .meta-item:last-child { border-bottom: 0; }
460 +.template-professional .address-section { margin-bottom: var(--spacing-8); }
461 +.template-professional .address-block { padding: var(--spacing-5); }
462 +.template-professional .address-block h2 { font-size: var(--font-size-xs); letter-spacing: 0.14em; color: var(--text-muted); margin-bottom: var(--spacing-2); }
463 +.template-professional .invoice-items { box-shadow: none; border: 1px solid var(--border-color); margin-bottom: var(--spacing-8); }
464 +.template-professional .invoice-items th { padding: var(--spacing-3) var(--spacing-5); font-size: var(--font-size-xs); letter-spacing: 0.1em; }
465 +.template-professional .invoice-items td { padding: var(--spacing-4) var(--spacing-5); }
466 +.template-professional .invoice-items tr:hover { background: transparent; }
467 +.template-professional .invoice-totals { box-shadow: none; padding: var(--spacing-5) var(--spacing-6); width: 360px; }
468 +.template-professional .invoice-total-row { padding: var(--spacing-2) 0; }
469 +.template-professional .invoice-totals .invoice-grand-total { padding-top: var(--spacing-3); margin-top: var(--spacing-2); }
470 +.template-professional .invoice-notes, .template-professional .invoice-terms { margin-top: var(--spacing-8); padding: var(--spacing-5) var(--spacing-6); }
471 +.template-professional .invoice-notes h3, .template-professional .invoice-terms h3 { font-size: var(--font-size-xs); text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-muted); border: 0; padding: 0; margin-bottom: var(--spacing-2); }
472 +.template-professional .invoice-totals .invoice-paid-row .invoice-total-value { color: var(--success-color, #047857); }
473 +.template-professional .invoice-totals .invoice-balance-due { font-weight: 700; }
474 +.template-professional .invoice-totals .invoice-balance-due .invoice-total-label { color: inherit; font-weight: 700; }
475 +.template-professional .meta-amount-due .meta-value { font-weight: 700; font-size: 1.08em; }
434 476 </style>
435 477
436 478 <div class="template template-professional">
437 - <!-- Header -->
438 479 <div class="invoice-header">
439 480 <div class="company-info">
481 + <?php if (!empty($company_info['logo'])): ?>
440 482 <div class="company-logo">
441 - <?php if (!empty($company_info['logo'])): ?>
442 - <img src="<?php echo esc_url($company_info['logo']); ?>" alt="<?php echo esc_attr($company_info['name']); ?>" class="logo-image">
443 - <?php endif; ?>
483 + <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)">
444 484 </div>
485 + <?php endif; ?>
445 486 <div class="company-name"><?php echo esc_html($company_info['name']); ?></div>
446 487 <div class="company-details">
447 - <?php echo \EasyInvoice\Helpers\TemplateTextHelper::generateFromSection($company_info, false, 'details-only'); ?>
488 + <?php echo wp_kses_post(\EasyInvoice\Helpers\TemplateTextHelper::generateFromSection($company_info, false, 'details-only')); ?>
448 489 </div>
449 490 </div>
450 491
451 492 <div class="invoice-meta">
452 - <div class="invoice-title"><?php echo esc_html($invoice->getTitle() ?: __('Invoice', 'easy-invoice')); ?></div>
493 + <?php $ei_kind = \EasyInvoice\Helpers\TemplateTextHelper::documentKind($invoice); $ei_title = trim((string) $invoice->getTitle()); ?>
494 + <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>
453 495 <div class="meta-item">
454 496 <span class="meta-label"><?php echo esc_html($text_settings['invoice_number']); ?></span>
455 497 <span class="meta-value"><?php echo esc_html($invoice->getNumber()); ?></span>
456 498 </div>
@@ -457,32 +499,44 @@
457 499 <div class="meta-item">
458 500 <span class="meta-label"><?php echo esc_html($text_settings['invoice_date']); ?></span>
459 501 <span class="meta-value"><?php echo esc_html(\EasyInvoice\Controllers\SettingsController::formatDate($invoice->getIssueDate())); ?></span>
460 502 </div>
503 + <?php if (empty($ei_is_credit_note)) : ?>
461 504 <div class="meta-item">
462 505 <span class="meta-label"><?php echo esc_html($text_settings['due_date']); ?></span>
463 506 <span class="meta-value"><?php echo esc_html(\EasyInvoice\Controllers\SettingsController::formatDate($invoice->getDueDate())); ?></span>
464 507 </div>
508 + <?php endif; ?>
509 + <?php if (empty($ei_is_credit_note)) : ?>
510 + <div class="meta-item meta-amount-due">
511 + <span class="meta-label"><?php echo esc_html($text_settings['total_due']); ?></span>
512 + <span class="meta-value"><?php echo esc_html($formatter->format(\EasyInvoice\Helpers\TemplateTextHelper::amountDue($invoice))); ?></span>
513 + </div>
514 + <?php endif; ?>
465 515 </div>
466 516 </div>
467 517
468 - <!-- Address Section -->
518 + <?php $ei_client_html = \EasyInvoice\Helpers\TemplateTextHelper::generateClientBlock($invoice); if ('' !== $ei_client_html) : ?>
469 519 <div class="address-section">
470 520 <div class="address-block">
471 521 <h2><?php echo esc_html($text_settings['to']); ?></h2>
472 522 <div class="address-content">
473 - <div class="client-name"><?php echo esc_html($invoice->getCustomerName()); ?></div>
474 - <?php if ($invoice->getCustomerAddress()): ?>
475 - <?php echo nl2br(esc_html($invoice->getCustomerAddress())); ?><br>
476 - <?php endif; ?>
477 - <?php if ($invoice->getCustomerEmail()): ?>
478 - <?php echo esc_html($invoice->getCustomerEmail()); ?><br>
479 - <?php endif; ?>
523 + <?php echo wp_kses_post($ei_client_html); ?>
480 524 </div>
481 525 </div>
482 526 </div>
527 + <?php endif; ?>
483 528
484 - <!-- Invoice Items -->
529 + <?php
530 + // The adjustment column appears only when at least one line uses it.
531 + $ei_show_adjust = \EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField();
532 + if ($ei_show_adjust) {
533 + $ei_show_adjust = false;
534 + foreach ($invoice->getItems() as $ei_item) {
535 + if ((float) $ei_item->getAdjustPercentage() != 0.0) { $ei_show_adjust = true; break; }
536 + }
537 + }
538 + ?>
485 539 <table class="invoice-items">
486 540 <thead>
487 541 <tr>
488 542 <th><?php echo esc_html($text_settings['service']); ?></th>
@@ -487,15 +541,18 @@
487 541 <tr>
488 542 <th><?php echo esc_html($text_settings['service']); ?></th>
489 543 <th><?php echo esc_html($text_settings['qty']); ?></th>
490 544 <th><?php echo esc_html($text_settings['rate_price']); ?></th>
491 - <?php if (\EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField()): ?>
545 + <?php if ($ei_show_adjust): ?>
492 546 <th><?php echo esc_html($text_settings['adjust']); ?> (%)</th>
493 547 <?php endif; ?>
494 - <th><?php echo esc_html($text_settings['total']); ?></th>
548 + <th><?php echo esc_html($text_settings['line_total'] ?? $text_settings['total']); ?></th>
495 549 </tr>
496 550 </thead>
497 551 <tbody>
552 + <?php if (!$invoice->getItems()) : ?>
553 + <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>
554 + <?php endif; ?>
498 555 <?php foreach ($invoice->getItems() as $item): ?>
499 556 <tr>
500 557 <td class="item-name">
501 558 <div class="item-title"><?php echo esc_html($item->getName()); ?></div>
@@ -504,9 +561,9 @@
504 561 <?php endif; ?>
505 562 </td>
506 563 <td class="item-quantity"><?php echo esc_html($item->getQuantity() ?: '0'); ?></td>
507 564 <td class="item-price"><?php echo esc_html($formatter->format($item->getPrice())); ?></td>
508 - <?php if (\EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField()): ?>
565 + <?php if ($ei_show_adjust): ?>
509 566 <td class="item-adjust"><?php
510 567 $adjust_percentage = $item->getAdjustPercentage();
511 568 if ($adjust_percentage != 0) {
512 569 echo esc_html($adjust_percentage > 0 ? '+' : '') . esc_html($adjust_percentage) . '%';
@@ -520,17 +577,15 @@
520 577 <?php endforeach; ?>
521 578 </tbody>
522 579 </table>
523 580
524 - <!-- Invoice Totals -->
525 581 <div class="invoice-totals">
526 - <?php echo \EasyInvoice\Helpers\TemplateTextHelper::generateTotalsSection($invoice, $text_settings, $formatter, 'invoice'); ?>
582 + <?php echo wp_kses_post(\EasyInvoice\Helpers\TemplateTextHelper::generateTotalsSection($invoice, $text_settings, $formatter, 'invoice')); ?>
527 583 </div>
528 584
529 - <!-- Notes -->
530 585 <?php if ($invoice->getNotes()): ?>
531 586 <div class="invoice-notes">
532 - <h3><?php _e('Notes:', 'easy-invoice'); ?></h3>
587 + <h3><?php esc_html_e('Notes', 'easy-invoice'); ?></h3>
533 588 <div class="notes-content">
534 589 <?php echo wp_kses_post($invoice->getNotes() ?: ''); ?>
535 590 </div>
536 591 </div>
@@ -535,15 +590,14 @@
535 590 </div>
536 591 </div>
537 592 <?php endif; ?>
538 593
539 - <!-- Terms and Conditions -->
540 594 <?php
541 - $terms_conditions = $invoice->getTerms() ?: \EasyInvoice\Controllers\SettingsController::getInvoiceTermsConditions();
595 + $terms_conditions = empty($ei_is_credit_note) ? ($invoice->getTerms() ?: \EasyInvoice\Controllers\SettingsController::getInvoiceTermsConditions()) : '';
542 596 if ($terms_conditions):
543 597 ?>
544 598 <div class="invoice-terms">
545 - <h3><?php _e('Terms & Conditions:', 'easy-invoice'); ?></h3>
599 + <h3><?php esc_html_e('Terms & Conditions', 'easy-invoice'); ?></h3>
546 600 <div class="terms-content">
547 601 <?php echo wp_kses_post($terms_conditions); ?>
548 602 </div>
549 603 </div>
@@ -548,15 +602,23 @@
548 602 </div>
549 603 </div>
550 604 <?php endif; ?>
551 605
552 - <!-- Footer -->
606 + <?php
607 + /**
608 + * Fires inside the document card, after notes and terms and before the
609 + * footer text: attachments, the signature block, e-invoicing notes. Being
610 + * inside the card, it is part of what "Download as PDF" captures.
611 + *
612 + * @param object $document The invoice model.
613 + * @param string $type 'invoice'.
614 + */
615 + do_action('easy_invoice_document_body_after', $invoice, 'invoice');
616 +
617 + $ei_footer_text = \EasyInvoice\Helpers\TemplateTextHelper::footerText($invoice, 'invoice');
618 + if ('' !== trim(wp_strip_all_tags((string) $ei_footer_text))) :
619 + ?>
553 620 <div class="invoice-footer">
554 - <?php
555 - $invoice_footer_text = $invoice->getFooterText();
556 - if (!$invoice_footer_text) {
557 - $invoice_footer_text = \EasyInvoice\Controllers\SettingsController::getInvoiceFooterText();
558 - }
559 - ?>
560 - <p><?php echo wp_kses_post($invoice_footer_text); ?></p>
621 + <p><?php echo wp_kses_post($ei_footer_text); ?></p>
561 622 </div>
562 -</div>
623 + <?php endif; ?>
624 +</div>