Add taxes and discounts to html viewer in portal

This commit is contained in:
David Bomba 2023-12-12 20:49:44 +11:00
parent 1d438d14d3
commit a3be388a3d
2 changed files with 17 additions and 0 deletions

View File

@ -55,6 +55,8 @@ class PdfSlot extends Component
public $is_quote = false;
private $entity_calc;
public function mount()
{
MultiDB::setDb($this->db);
@ -123,6 +125,7 @@ class PdfSlot extends Component
{
$this->entity_type = $this->resolveEntityType();
$this->entity_calc = $this->entity->calc();
$this->settings = $this->entity->client ? $this->entity->client->getMergedSettings() : $this->entity->company->settings;
@ -149,6 +152,8 @@ class PdfSlot extends Component
'services' => $this->getServices(),
'amount' => Number::formatMoney($this->entity->amount, $this->entity->client ?: $this->entity->vendor),
'balance' => Number::formatMoney($this->entity->balance, $this->entity->client ?: $this->entity->vendor),
'discount' => $this->entity_calc->getTotalDiscount() > 0 ? Number::formatMoney($this->entity_calc->getTotalDiscount(), $this->entity->client ?: $this->entity->vendor) : false,
'taxes' => $this->entity_calc->getTotalTaxes() > 0 ? Number::formatMoney($this->entity_calc->getTotalTaxes(), $this->entity->client ?: $this->entity->vendor) : false,
'company_details' => $this->getCompanyDetails(),
'company_address' => $this->getCompanyAddress(),
'entity_details' => $this->getEntityDetails(),

View File

@ -132,6 +132,18 @@ span {
<div id="totals" class="mb-10 mr-3 ml-3">
<table width="100%">
<tbody>
@if($discount)
<tr>
<td style="text-align:left; padding-right:10px;" class="text-lg">{{ ctrans('texts.discount') }}</td>
<td style="text-align:right; padding-right:10px;" class="text-lg">{{ $discount }}</td>
</tr>
@endif
@if($taxes)
<tr>
<td style="text-align:left; padding-right:10px;" class="text-lg">{{ ctrans('texts.tax') }}</td>
<td style="text-align:right; padding-right:10px;" class="text-lg">{{ $taxes }}</td>
</tr>
@endif
<tr>
<td style="text-align:left; padding-right:10px;" class="text-lg">{{ ctrans('texts.total') }}</td>
<td style="text-align:right; padding-right:10px;" class="text-lg">{{ $amount }}</td>