diff --git a/app/Services/PdfMaker/Design.php b/app/Services/PdfMaker/Design.php index 88c85b3fce40..1d9192707db8 100644 --- a/app/Services/PdfMaker/Design.php +++ b/app/Services/PdfMaker/Design.php @@ -448,11 +448,11 @@ class Design extends BaseDesign continue; } - foreach ($taxes as $tax) { + foreach ($taxes as $i => $tax) { $elements[] = ['element' => 'div', 'elements' => [ ['element' => 'span', 'content' => 'This is placeholder for the 3rd fraction of element.', 'properties' => ['style' => 'opacity: 0%']], // Placeholder for fraction of element (3fr) - ['element' => 'span', 'content', 'content' => $tax['name']], - ['element' => 'span', 'content', 'content' => Number::formatMoney($tax['total'], $this->context['client'])], + ['element' => 'span', 'content', 'content' => $tax['name'], 'properties' => ['data-ref' => 'totals-table-total_tax_' . $i . '-label']], + ['element' => 'span', 'content', 'content' => Number::formatMoney($tax['total'], $this->context['client']), 'properties' => ['data-ref' => 'totals-table-total_tax_' . $i]], ]]; } } elseif ($variable == '$line_taxes') { @@ -462,18 +462,18 @@ class Design extends BaseDesign continue; } - foreach ($taxes as $tax) { + foreach ($taxes as $i => $tax) { $elements[] = ['element' => 'div', 'elements' => [ ['element' => 'span', 'content' => 'This is placeholder for the 3rd fraction of element.', 'properties' => ['style' => 'opacity: 0%']], // Placeholder for fraction of element (3fr) - ['element' => 'span', 'content', 'content' => $tax['name']], - ['element' => 'span', 'content', 'content' => Number::formatMoney($tax['total'], $this->context['client'])], + ['element' => 'span', 'content', 'content' => $tax['name'], 'properties' => ['data-ref' => 'totals-table-line_tax_' . $i . '-label']], + ['element' => 'span', 'content', 'content' => Number::formatMoney($tax['total'], $this->context['client']), 'properties' => ['data-ref' => 'totals-table-line_tax_' . $i]], ]]; } } else { $elements[] = ['element' => 'div', 'elements' => [ ['element' => 'span', 'content' => 'This is placeholder for the 3rd fraction of element.', 'properties' => ['style' => 'opacity: 0%']], // Placeholder for fraction of element (3fr) - ['element' => 'span', 'content' => $variable . '_label', 'properties' => ['data-ref' => 'totals_table-' . substr($variable, 1)]], - ['element' => 'span', 'content' => $variable], + ['element' => 'span', 'content' => $variable . '_label', 'properties' => ['data-ref' => 'totals_table-' . substr($variable, 1) . '-label']], + ['element' => 'span', 'content' => $variable, 'properties' => ['data-ref' => 'totals_table-' . substr($variable, 1)]], ]]; } }