PluginProbe
Easy Invoice – Invoice Generator, PDF Quotes & Payments / 2.4.2
Easy Invoice – Invoice Generator, PDF Quotes & Payments v2.4.2
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/standard.php +107 -36 2.1.21 → 2.4.2 View file →
@@ -3,9 +3,13 @@
3 3 * Standard Template - Clean SaaS Design
4 4 * Clean, modern, and professional 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 /* Standard Template - Clean and Simple Design */
@@ -158,9 +162,9 @@
158 162 .template-standard .invoice-total-label {
159 163 color: #666666;
160 164 }
161 165
162 -.template-standard .invoice-grand-total {
166 +.template-standard .invoice-totals .invoice-grand-total {
163 167 font-weight: 600;
164 168 border-top: 2px solid #333333;
165 169 padding-top: 0.5rem;
166 170 margin-top: 0.5rem;
@@ -210,27 +214,74 @@
210 214 .template-standard .invoice-totals {
211 215 width: 100%;
212 216 }
213 217 }
218 +
219 +/* Shared polish: numbers line up, numeric headings sit over their figures. */
220 +.template-standard .invoice-items th + th { text-align: right; }
221 +.template-standard .invoice-items .item-quantity,
222 +.template-standard .invoice-items .item-price,
223 +.template-standard .invoice-items .item-adjust,
224 +.template-standard .invoice-items .item-total,
225 +.template-standard .invoice-total-value { font-variant-numeric: tabular-nums; white-space: nowrap; }
226 +.template-standard .meta-value { white-space: nowrap; }
227 +.template-standard .invoice-items .item-adjust { text-align: right; }
228 +.template-standard .client-contact { font-weight: 500; margin-bottom: 0.15em; }
229 +.template-standard .client-tax-number,
230 +.template-standard .company-tax-number { margin-top: 0.35em; }
231 +.template-standard .invoice-items .item-description { white-space: pre-line; }
232 +.template-standard .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; }
233 +
234 +/* Standard: ink on white, one rule per section, nothing boxed. */
235 +.template-standard { color: #1f2937; }
236 +.template-standard .invoice-header { border-bottom: 2px solid #1f2937; padding-bottom: 1.5rem; margin-bottom: 1.75rem; align-items: flex-start; }
237 +.template-standard .company-name { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.01em; color: #111827; }
238 +.template-standard .company-details, .template-standard .address-content, .template-standard .meta-label, .template-standard .invoice-total-label { color: #6b7280; }
239 +.template-standard .invoice-title { font-size: 1.625rem; font-weight: 700; letter-spacing: -0.015em; color: #111827; margin-bottom: 0.75rem; }
240 +.template-standard .meta-item { display: flex; justify-content: flex-end; gap: 1rem; margin-bottom: 0.35rem; font-size: 0.9rem; }
241 +.template-standard .meta-value { font-weight: 600; color: #111827; }
242 +.template-standard .address-block { background: transparent; padding: 0; border: 0; }
243 +.template-standard .address-block h2 { font-size: 0.72rem; letter-spacing: 0.14em; color: #6b7280; margin-bottom: 0.5rem; }
244 +.template-standard .client-name { font-weight: 600; color: #111827; font-size: 1rem; }
245 +.template-standard .invoice-items { border: 0; margin-bottom: 1.25rem; }
246 +.template-standard .invoice-items th { background: transparent; color: #6b7280; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; padding: 0.6rem 0.5rem; border-bottom: 1px solid #1f2937; }
247 +.template-standard .invoice-items td { padding: 0.8rem 0.5rem; border-bottom: 1px solid #e5e7eb; color: #1f2937; }
248 +.template-standard .invoice-items th:first-child, .template-standard .invoice-items td:first-child { padding-left: 0; }
249 +.template-standard .invoice-items th:last-child, .template-standard .invoice-items td:last-child { padding-right: 0; }
250 +.template-standard .item-name .item-title { font-weight: 600; color: #111827; }
251 +.template-standard .item-description { font-weight: 400; color: #6b7280; font-size: 0.85rem; }
252 +.template-standard .invoice-totals { width: 320px; margin-bottom: 1.5rem; }
253 +.template-standard .invoice-total-row { padding: 0.45rem 0; border-bottom: 1px solid #e5e7eb; font-size: 0.95rem; }
254 +.template-standard .invoice-total-value { font-weight: 600; color: #111827; }
255 +.template-standard .invoice-totals .invoice-grand-total { border-top: 2px solid #1f2937; border-bottom: 0; margin-top: 0.25rem; padding-top: 0.75rem; font-size: 1.125rem; }
256 +.template-standard .invoice-totals .invoice-grand-total .invoice-total-label { color: #111827; font-weight: 700; }
257 +.template-standard .invoice-totals .invoice-grand-total .invoice-total-value { font-size: 1.25rem; font-weight: 700; }
258 +.template-standard .invoice-notes, .template-standard .invoice-terms { background: transparent; padding: 1.25rem 0 0; margin-top: 1.25rem; border: 0; border-top: 1px solid #e5e7eb; border-radius: 0; color: #4b5563; font-size: 0.9rem; }
259 +.template-standard .invoice-notes h3, .template-standard .invoice-terms h3 { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: #6b7280; font-weight: 600; margin-bottom: 0.5rem; }
260 +.template-standard .invoice-footer { border-top: 1px solid #e5e7eb; color: #6b7280; font-size: 0.85rem; }
261 +.template-standard .invoice-totals .invoice-paid-row .invoice-total-value { color: var(--success-color, #047857); }
262 +.template-standard .invoice-totals .invoice-balance-due { font-weight: 700; }
263 +.template-standard .invoice-totals .invoice-balance-due .invoice-total-label { color: inherit; font-weight: 700; }
264 +.template-standard .meta-amount-due .meta-value { font-weight: 700; font-size: 1.08em; }
214 265 </style>
215 266
216 267 <div class="template template-standard">
217 - <!-- Header -->
218 268 <div class="invoice-header">
219 269 <div class="company-info">
270 + <?php if (!empty($company_info['logo'])): ?>
220 271 <div class="company-logo">
221 - <?php if (!empty($company_info['logo'])): ?>
222 - <img src="<?php echo esc_url($company_info['logo']); ?>" alt="<?php echo esc_attr($company_info['name']); ?>" class="logo-image">
223 - <?php endif; ?>
272 + <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)">
224 273 </div>
274 + <?php endif; ?>
225 275 <div class="company-name"><?php echo esc_html($company_info['name']); ?></div>
226 276 <div class="company-details">
227 - <?php echo \EasyInvoice\Helpers\TemplateTextHelper::generateFromSection($company_info, false, 'details-only'); ?>
277 + <?php echo wp_kses_post(\EasyInvoice\Helpers\TemplateTextHelper::generateFromSection($company_info, false, 'details-only')); ?>
228 278 </div>
229 279 </div>
230 280
231 281 <div class="invoice-meta">
232 - <div class="invoice-title"><?php echo esc_html($invoice->getTitle() ?: __('Invoice', 'easy-invoice')); ?></div>
282 + <?php $ei_kind = \EasyInvoice\Helpers\TemplateTextHelper::documentKind($invoice); $ei_title = trim((string) $invoice->getTitle()); ?>
283 + <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>
233 284 <div class="meta-item">
234 285 <span class="meta-label"><?php echo esc_html($text_settings['invoice_number']); ?></span>
235 286 <span class="meta-value"><?php echo esc_html($invoice->getNumber()); ?></span>
236 287 </div>
@@ -237,32 +288,44 @@
237 288 <div class="meta-item">
238 289 <span class="meta-label"><?php echo esc_html($text_settings['invoice_date']); ?></span>
239 290 <span class="meta-value"><?php echo esc_html(\EasyInvoice\Controllers\SettingsController::formatDate($invoice->getIssueDate())); ?></span>
240 291 </div>
292 + <?php if (empty($ei_is_credit_note)) : ?>
241 293 <div class="meta-item">
242 294 <span class="meta-label"><?php echo esc_html($text_settings['due_date']); ?></span>
243 295 <span class="meta-value"><?php echo esc_html(\EasyInvoice\Controllers\SettingsController::formatDate($invoice->getDueDate())); ?></span>
244 296 </div>
297 + <?php endif; ?>
298 + <?php if (empty($ei_is_credit_note)) : ?>
299 + <div class="meta-item meta-amount-due">
300 + <span class="meta-label"><?php echo esc_html($text_settings['total_due']); ?></span>
301 + <span class="meta-value"><?php echo esc_html($formatter->format(\EasyInvoice\Helpers\TemplateTextHelper::amountDue($invoice))); ?></span>
302 + </div>
303 + <?php endif; ?>
245 304 </div>
246 305 </div>
247 306
248 - <!-- Address Section -->
307 + <?php $ei_client_html = \EasyInvoice\Helpers\TemplateTextHelper::generateClientBlock($invoice); if ('' !== $ei_client_html) : ?>
249 308 <div class="address-section">
250 309 <div class="address-block">
251 310 <h2><?php echo esc_html($text_settings['to']); ?></h2>
252 311 <div class="address-content">
253 - <div class="client-name"><?php echo esc_html($invoice->getCustomerName()); ?></div>
254 - <?php if ($invoice->getCustomerAddress()): ?>
255 - <?php echo nl2br(esc_html($invoice->getCustomerAddress())); ?><br>
256 - <?php endif; ?>
257 - <?php if ($invoice->getCustomerEmail()): ?>
258 - <?php echo esc_html($invoice->getCustomerEmail()); ?><br>
259 - <?php endif; ?>
312 + <?php echo wp_kses_post($ei_client_html); ?>
260 313 </div>
261 314 </div>
262 315 </div>
316 + <?php endif; ?>
263 317
264 - <!-- Invoice Items -->
318 + <?php
319 + // The adjustment column appears only when at least one line uses it.
320 + $ei_show_adjust = \EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField();
321 + if ($ei_show_adjust) {
322 + $ei_show_adjust = false;
323 + foreach ($invoice->getItems() as $ei_item) {
324 + if ((float) $ei_item->getAdjustPercentage() != 0.0) { $ei_show_adjust = true; break; }
325 + }
326 + }
327 + ?>
265 328 <table class="invoice-items">
266 329 <thead>
267 330 <tr>
268 331 <th><?php echo esc_html($text_settings['service']); ?></th>
@@ -267,15 +330,18 @@
267 330 <tr>
268 331 <th><?php echo esc_html($text_settings['service']); ?></th>
269 332 <th><?php echo esc_html($text_settings['qty']); ?></th>
270 333 <th><?php echo esc_html($text_settings['rate_price']); ?></th>
271 - <?php if (\EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField()): ?>
334 + <?php if ($ei_show_adjust): ?>
272 335 <th><?php echo esc_html($text_settings['adjust']); ?> (%)</th>
273 336 <?php endif; ?>
274 - <th><?php echo esc_html($text_settings['total']); ?></th>
337 + <th><?php echo esc_html($text_settings['line_total'] ?? $text_settings['total']); ?></th>
275 338 </tr>
276 339 </thead>
277 340 <tbody>
341 + <?php if (!$invoice->getItems()) : ?>
342 + <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>
343 + <?php endif; ?>
278 344 <?php foreach ($invoice->getItems() as $item): ?>
279 345 <tr>
280 346 <td class="item-name">
281 347 <div class="item-title"><?php echo esc_html($item->getName()); ?></div>
@@ -284,9 +350,9 @@
284 350 <?php endif; ?>
285 351 </td>
286 352 <td class="item-quantity"><?php echo esc_html($item->getQuantity() ?: '0'); ?></td>
287 353 <td class="item-price"><?php echo esc_html($formatter->format($item->getPrice())); ?></td>
288 - <?php if (\EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField()): ?>
354 + <?php if ($ei_show_adjust): ?>
289 355 <td class="item-adjust"><?php
290 356 $adjust_percentage = $item->getAdjustPercentage();
291 357 if ($adjust_percentage != 0) {
292 358 echo esc_html($adjust_percentage > 0 ? '+' : '') . esc_html($adjust_percentage) . '%';
@@ -300,17 +366,15 @@
300 366 <?php endforeach; ?>
301 367 </tbody>
302 368 </table>
303 369
304 - <!-- Invoice Totals -->
305 370 <div class="invoice-totals">
306 - <?php echo \EasyInvoice\Helpers\TemplateTextHelper::generateTotalsSection($invoice, $text_settings, $formatter, 'invoice'); ?>
371 + <?php echo wp_kses_post(\EasyInvoice\Helpers\TemplateTextHelper::generateTotalsSection($invoice, $text_settings, $formatter, 'invoice')); ?>
307 372 </div>
308 373
309 - <!-- Notes -->
310 374 <?php if ($invoice->getNotes()): ?>
311 375 <div class="invoice-notes">
312 - <h3><?php _e('Notes:', 'easy-invoice'); ?></h3>
376 + <h3><?php esc_html_e('Notes', 'easy-invoice'); ?></h3>
313 377 <div class="notes-content">
314 378 <?php echo wp_kses_post($invoice->getNotes() ?: ''); ?>
315 379 </div>
316 380 </div>
@@ -315,15 +379,14 @@
315 379 </div>
316 380 </div>
317 381 <?php endif; ?>
318 382
319 - <!-- Terms and Conditions -->
320 383 <?php
321 - $terms_conditions = $invoice->getTerms() ?: \EasyInvoice\Controllers\SettingsController::getInvoiceTermsConditions();
384 + $terms_conditions = empty($ei_is_credit_note) ? ($invoice->getTerms() ?: \EasyInvoice\Controllers\SettingsController::getInvoiceTermsConditions()) : '';
322 385 if ($terms_conditions):
323 386 ?>
324 387 <div class="invoice-terms">
325 - <h3><?php _e('Terms & Conditions:', 'easy-invoice'); ?></h3>
388 + <h3><?php esc_html_e('Terms & Conditions', 'easy-invoice'); ?></h3>
326 389 <div class="terms-content">
327 390 <?php echo wp_kses_post($terms_conditions); ?>
328 391 </div>
329 392 </div>
@@ -328,15 +391,23 @@
328 391 </div>
329 392 </div>
330 393 <?php endif; ?>
331 394
332 - <!-- Footer -->
395 + <?php
396 + /**
397 + * Fires inside the document card, after notes and terms and before the
398 + * footer text: attachments, the signature block, e-invoicing notes. Being
399 + * inside the card, it is part of what "Download as PDF" captures.
400 + *
401 + * @param object $document The invoice model.
402 + * @param string $type 'invoice'.
403 + */
404 + do_action('easy_invoice_document_body_after', $invoice, 'invoice');
405 +
406 + $ei_footer_text = \EasyInvoice\Helpers\TemplateTextHelper::footerText($invoice, 'invoice');
407 + if ('' !== trim(wp_strip_all_tags((string) $ei_footer_text))) :
408 + ?>
333 409 <div class="invoice-footer">
334 - <?php
335 - $invoice_footer_text = $invoice->getFooterText();
336 - if (!$invoice_footer_text) {
337 - $invoice_footer_text = \EasyInvoice\Controllers\SettingsController::getInvoiceFooterText();
338 - }
339 - ?>
340 - <p><?php echo wp_kses_post($invoice_footer_text); ?></p>
410 + <p><?php echo wp_kses_post($ei_footer_text); ?></p>
341 411 </div>
342 -</div>
412 + <?php endif; ?>
413 +</div>