PluginProbe
Easy Invoice – Invoice Generator, PDF Quotes & Payments / 2.4.0
Easy Invoice – Invoice Generator, PDF Quotes & Payments v2.4.0
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 2.1.15 2.1.16 2.1.2 All 57 releases
← All changes | templates/invoice-templates/standard.php +107 -29 2.3.6 → 2.4.0 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,26 +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 268 <div class="invoice-header">
218 269 <div class="company-info">
270 + <?php if (!empty($company_info['logo'])): ?>
219 271 <div class="company-logo">
220 - <?php if (!empty($company_info['logo'])): ?>
221 - <img src="<?php echo esc_url($company_info['logo']); ?>" alt="<?php echo esc_attr($company_info['name']); ?>" class="logo-image">
222 - <?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)">
223 273 </div>
274 + <?php endif; ?>
224 275 <div class="company-name"><?php echo esc_html($company_info['name']); ?></div>
225 276 <div class="company-details">
226 - <?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')); ?>
227 278 </div>
228 279 </div>
229 280
230 281 <div class="invoice-meta">
231 - <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>
232 284 <div class="meta-item">
233 285 <span class="meta-label"><?php echo esc_html($text_settings['invoice_number']); ?></span>
234 286 <span class="meta-value"><?php echo esc_html($invoice->getNumber()); ?></span>
235 287 </div>
@@ -236,30 +288,44 @@
236 288 <div class="meta-item">
237 289 <span class="meta-label"><?php echo esc_html($text_settings['invoice_date']); ?></span>
238 290 <span class="meta-value"><?php echo esc_html(\EasyInvoice\Controllers\SettingsController::formatDate($invoice->getIssueDate())); ?></span>
239 291 </div>
292 + <?php if (empty($ei_is_credit_note)) : ?>
240 293 <div class="meta-item">
241 294 <span class="meta-label"><?php echo esc_html($text_settings['due_date']); ?></span>
242 295 <span class="meta-value"><?php echo esc_html(\EasyInvoice\Controllers\SettingsController::formatDate($invoice->getDueDate())); ?></span>
243 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; ?>
244 304 </div>
245 305 </div>
246 306
307 + <?php $ei_client_html = \EasyInvoice\Helpers\TemplateTextHelper::generateClientBlock($invoice); if ('' !== $ei_client_html) : ?>
247 308 <div class="address-section">
248 309 <div class="address-block">
249 310 <h2><?php echo esc_html($text_settings['to']); ?></h2>
250 311 <div class="address-content">
251 - <div class="client-name"><?php echo esc_html($invoice->getCustomerName()); ?></div>
252 - <?php if ($invoice->getCustomerAddress()): ?>
253 - <?php echo nl2br(esc_html($invoice->getCustomerAddress())); ?><br>
254 - <?php endif; ?>
255 - <?php if ($invoice->getCustomerEmail()): ?>
256 - <?php echo esc_html($invoice->getCustomerEmail()); ?><br>
257 - <?php endif; ?>
312 + <?php echo wp_kses_post($ei_client_html); ?>
258 313 </div>
259 314 </div>
260 315 </div>
316 + <?php endif; ?>
261 317
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 + ?>
262 328 <table class="invoice-items">
263 329 <thead>
264 330 <tr>
265 331 <th><?php echo esc_html($text_settings['service']); ?></th>
@@ -264,15 +330,18 @@
264 330 <tr>
265 331 <th><?php echo esc_html($text_settings['service']); ?></th>
266 332 <th><?php echo esc_html($text_settings['qty']); ?></th>
267 333 <th><?php echo esc_html($text_settings['rate_price']); ?></th>
268 - <?php if (\EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField()): ?>
334 + <?php if ($ei_show_adjust): ?>
269 335 <th><?php echo esc_html($text_settings['adjust']); ?> (%)</th>
270 336 <?php endif; ?>
271 - <th><?php echo esc_html($text_settings['total']); ?></th>
337 + <th><?php echo esc_html($text_settings['line_total'] ?? $text_settings['total']); ?></th>
272 338 </tr>
273 339 </thead>
274 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; ?>
275 344 <?php foreach ($invoice->getItems() as $item): ?>
276 345 <tr>
277 346 <td class="item-name">
278 347 <div class="item-title"><?php echo esc_html($item->getName()); ?></div>
@@ -281,9 +350,9 @@
281 350 <?php endif; ?>
282 351 </td>
283 352 <td class="item-quantity"><?php echo esc_html($item->getQuantity() ?: '0'); ?></td>
284 353 <td class="item-price"><?php echo esc_html($formatter->format($item->getPrice())); ?></td>
285 - <?php if (\EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField()): ?>
354 + <?php if ($ei_show_adjust): ?>
286 355 <td class="item-adjust"><?php
287 356 $adjust_percentage = $item->getAdjustPercentage();
288 357 if ($adjust_percentage != 0) {
289 358 echo esc_html($adjust_percentage > 0 ? '+' : '') . esc_html($adjust_percentage) . '%';
@@ -298,14 +367,14 @@
298 367 </tbody>
299 368 </table>
300 369
301 370 <div class="invoice-totals">
302 - <?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')); ?>
303 372 </div>
304 373
305 374 <?php if ($invoice->getNotes()): ?>
306 375 <div class="invoice-notes">
307 - <h3><?php _e('Notes:', 'easy-invoice'); ?></h3>
376 + <h3><?php esc_html_e('Notes', 'easy-invoice'); ?></h3>
308 377 <div class="notes-content">
309 378 <?php echo wp_kses_post($invoice->getNotes() ?: ''); ?>
310 379 </div>
311 380 </div>
@@ -311,13 +380,13 @@
311 380 </div>
312 381 <?php endif; ?>
313 382
314 383 <?php
315 - $terms_conditions = $invoice->getTerms() ?: \EasyInvoice\Controllers\SettingsController::getInvoiceTermsConditions();
384 + $terms_conditions = empty($ei_is_credit_note) ? ($invoice->getTerms() ?: \EasyInvoice\Controllers\SettingsController::getInvoiceTermsConditions()) : '';
316 385 if ($terms_conditions):
317 386 ?>
318 387 <div class="invoice-terms">
319 - <h3><?php _e('Terms & Conditions:', 'easy-invoice'); ?></h3>
388 + <h3><?php esc_html_e('Terms & Conditions', 'easy-invoice'); ?></h3>
320 389 <div class="terms-content">
321 390 <?php echo wp_kses_post($terms_conditions); ?>
322 391 </div>
323 392 </div>
@@ -322,14 +391,23 @@
322 391 </div>
323 392 </div>
324 393 <?php endif; ?>
325 394
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 + ?>
326 409 <div class="invoice-footer">
327 - <?php
328 - $invoice_footer_text = $invoice->getFooterText();
329 - if (!$invoice_footer_text) {
330 - $invoice_footer_text = \EasyInvoice\Controllers\SettingsController::getInvoiceFooterText();
331 - }
332 - ?>
333 - <p><?php echo wp_kses_post($invoice_footer_text); ?></p>
410 + <p><?php echo wp_kses_post($ei_footer_text); ?></p>
334 411 </div>
335 -</div>
412 + <?php endif; ?>
413 +</div>