Fixes for displaying purchase order table in pdf

This commit is contained in:
David Bomba 2023-01-11 23:46:45 +11:00
parent ff9bd79449
commit 66571b1cbd

View File

@ -30,6 +30,7 @@ class PdfBuilder
private CommonMarkConverter $commonmark; private CommonMarkConverter $commonmark;
private float $payment_amount_total = 0;
/** /**
* an array of sections to be injected into the template * an array of sections to be injected into the template
* *
@ -266,6 +267,7 @@ class PdfBuilder
$tbody[] = $element; $tbody[] = $element;
$this->payment_amount_total += $payment->pivot->amount;
} }
} }
@ -295,7 +297,8 @@ class PdfBuilder
$payment = $this->service->options['payments']->first(); $payment = $this->service->options['payments']->first();
return [ return [
['element' => 'p', 'content' => \sprintf('%s: %s', ctrans('texts.amount_paid'), Number::formatMoney($this->service->options['payments']->sum('amount'), $this->service->config->client))], // ['element' => 'p', 'content' => \sprintf('%s: %s', ctrans('texts.amount_paid'), Number::formatMoney($this->service->options['payments']->sum('amount'), $this->service->config->client))],
['element' => 'p', 'content' => \sprintf('%s: %s', ctrans('texts.amount_paid'), Number::formatMoney($this->payment_amount_total, $this->client))],
]; ];
} }
@ -338,6 +341,7 @@ class PdfBuilder
{ {
$this->genericSectionBuilder() $this->genericSectionBuilder()
->getProductAndTaskTables()
->getProductTotals(); ->getProductTotals();
$this->mergeSections([ $this->mergeSections([
@ -1100,7 +1104,7 @@ class PdfBuilder
} }
/** /**
* Generates the product table * Generates the product table
* *
* @return array * @return array