mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-14 15:13:29 +01:00
Merge pull request #7665 from turbo124/v5-develop
Fixes for custom surcharges on invoice and purchase order tax currency
This commit is contained in:
commit
5ca1a133dc
@ -499,20 +499,6 @@ class Design extends BaseDesign
|
|||||||
|
|
||||||
$tbody = [];
|
$tbody = [];
|
||||||
|
|
||||||
// foreach ($this->payments as $payment) {
|
|
||||||
// foreach ($payment->invoices as $invoice) {
|
|
||||||
// $element = ['element' => 'tr', 'elements' => []];
|
|
||||||
|
|
||||||
// $element['elements'][] = ['element' => 'td', 'content' => $invoice->number];
|
|
||||||
// $element['elements'][] = ['element' => 'td', 'content' => $this->translateDate($payment->date, $this->client->date_format(), $this->client->locale()) ?: ' '];
|
|
||||||
// $element['elements'][] = ['element' => 'td', 'content' => $payment->type ? $payment->type->name : ctrans('texts.manual_entry')];
|
|
||||||
// $element['elements'][] = ['element' => 'td', 'content' => Number::formatMoney($payment->amount, $this->client) ?: ' '];
|
|
||||||
|
|
||||||
// $tbody[] = $element;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
//24-03-2022 show payments per invoice
|
//24-03-2022 show payments per invoice
|
||||||
foreach ($this->invoices as $invoice) {
|
foreach ($this->invoices as $invoice) {
|
||||||
foreach ($invoice->payments as $payment) {
|
foreach ($invoice->payments as $payment) {
|
||||||
@ -816,7 +802,7 @@ class Design extends BaseDesign
|
|||||||
foreach ($taxes as $i => $tax) {
|
foreach ($taxes as $i => $tax) {
|
||||||
$elements[1]['elements'][] = ['element' => 'div', 'elements' => [
|
$elements[1]['elements'][] = ['element' => 'div', 'elements' => [
|
||||||
['element' => 'span', 'content', 'content' => $tax['name'], 'properties' => ['data-ref' => 'totals-table-total_tax_' . $i . '-label']],
|
['element' => 'span', 'content', 'content' => $tax['name'], 'properties' => ['data-ref' => 'totals-table-total_tax_' . $i . '-label']],
|
||||||
['element' => 'span', 'content', 'content' => Number::formatMoney($tax['total'], $this->client_or_vendor_entity), 'properties' => ['data-ref' => 'totals-table-total_tax_' . $i]],
|
['element' => 'span', 'content', 'content' => Number::formatMoney($tax['total'], $this->entity instanceof \App\Models\PurchaseOrder ? $this->company : $this->client_or_vendor_entity), 'properties' => ['data-ref' => 'totals-table-total_tax_' . $i]],
|
||||||
]];
|
]];
|
||||||
}
|
}
|
||||||
} elseif ($variable == '$line_taxes') {
|
} elseif ($variable == '$line_taxes') {
|
||||||
@ -829,13 +815,13 @@ class Design extends BaseDesign
|
|||||||
foreach ($taxes as $i => $tax) {
|
foreach ($taxes as $i => $tax) {
|
||||||
$elements[1]['elements'][] = ['element' => 'div', 'elements' => [
|
$elements[1]['elements'][] = ['element' => 'div', 'elements' => [
|
||||||
['element' => 'span', 'content', 'content' => $tax['name'], 'properties' => ['data-ref' => 'totals-table-line_tax_' . $i . '-label']],
|
['element' => 'span', 'content', 'content' => $tax['name'], 'properties' => ['data-ref' => 'totals-table-line_tax_' . $i . '-label']],
|
||||||
['element' => 'span', 'content', 'content' => Number::formatMoney($tax['total'], $this->client_or_vendor_entity), 'properties' => ['data-ref' => 'totals-table-line_tax_' . $i]],
|
['element' => 'span', 'content', 'content' => Number::formatMoney($tax['total'], $this->entity instanceof \App\Models\PurchaseOrder ? $this->company : $this->client_or_vendor_entity), 'properties' => ['data-ref' => 'totals-table-line_tax_' . $i]],
|
||||||
]];
|
]];
|
||||||
}
|
}
|
||||||
} elseif (Str::startsWith($variable, '$custom_surcharge')) {
|
} elseif (Str::startsWith($variable, '$custom_surcharge')) {
|
||||||
$_variable = ltrim($variable, '$'); // $custom_surcharge1 -> custom_surcharge1
|
$_variable = ltrim($variable, '$'); // $custom_surcharge1 -> custom_surcharge1
|
||||||
|
|
||||||
$visible = (int)$this->entity->{$_variable} > 0 || (int)$this->entity->{$_variable} < 0 || !$this->entity->{$_variable};
|
$visible = intval($this->entity->{$_variable}) != 0;
|
||||||
|
|
||||||
$elements[1]['elements'][] = ['element' => 'div', 'elements' => [
|
$elements[1]['elements'][] = ['element' => 'div', 'elements' => [
|
||||||
['element' => 'span', 'content' => $variable . '_label', 'properties' => ['hidden' => !$visible, 'data-ref' => 'totals_table-' . substr($variable, 1) . '-label']],
|
['element' => 'span', 'content' => $variable . '_label', 'properties' => ['hidden' => !$visible, 'data-ref' => 'totals_table-' . substr($variable, 1) . '-label']],
|
||||||
|
@ -13,6 +13,7 @@ namespace App\Utils;
|
|||||||
|
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\Currency;
|
use App\Models\Currency;
|
||||||
|
use App\Models\Vendor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Number.
|
* Class Number.
|
||||||
@ -118,6 +119,7 @@ class Number
|
|||||||
*/
|
*/
|
||||||
public static function formatMoney($value, $entity) :string
|
public static function formatMoney($value, $entity) :string
|
||||||
{
|
{
|
||||||
|
|
||||||
$currency = $entity->currency();
|
$currency = $entity->currency();
|
||||||
|
|
||||||
$thousand = $currency->thousand_separator;
|
$thousand = $currency->thousand_separator;
|
||||||
|
Loading…
Reference in New Issue
Block a user