1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Update texts for tax info placeholders

This commit is contained in:
David Bomba 2023-08-09 10:26:47 +10:00
parent 35394670fe
commit 721bc60f64
4 changed files with 41 additions and 3 deletions

View File

@ -58,7 +58,7 @@ use Illuminate\Contracts\Translation\HasLocalePreference;
* @property string|null $city
* @property string|null $state
* @property string|null $postal_code
* @property string|null $country_id
* @property int|null $country_id
* @property string|null $custom_value1
* @property string|null $custom_value2
* @property string|null $custom_value3

View File

@ -58,7 +58,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
* @property string|null $portal_domain
* @property int $enable_modules
* @property object $custom_fields
* @property object $settings
* @property \App\DataMapper\CompanySettings $settings
* @property string $slack_webhook_url
* @property string $google_analytics_key
* @property int|null $created_at

View File

@ -35,16 +35,22 @@ class HtmlEngine
use MakesHash;
use DesignCalculator;
/** @var \App\Models\Invoice | \App\Models\Credit | \App\Models\RecurringInvoice | \App\Models\Quote $entity **/
public $entity;
/** @var \App\Models\CreditInvitation | CreditInvitation | \App\Models\RecurringInvoiceInvitation | \App\Models\QuoteInvitation $invitation **/
public $invitation;
/** @var \App\Models\Client $client */
public $client;
/** @var \App\Models\ClientContact $contact */
public $contact;
/** @var \App\Models\Company $company */
public $company;
/** @var \App\DataMapper\CompanySettings $settings **/
public $settings;
public $entity_calc;
@ -53,6 +59,13 @@ class HtmlEngine
private $helpers;
/**
* __construct
*
* @param InvoiceInvitation | CreditInvitation | RecurringInvoiceInvitation | QuoteInvitation $invitation
* @return void
*/
public function __construct($invitation)
{
$this->invitation = $invitation;
@ -150,7 +163,9 @@ class HtmlEngine
$data['$payment_link'] = ['value' => $this->invitation->getPaymentLink(), 'label' => ctrans('texts.pay_now')];
$data['$payment_qrcode'] = ['value' => $this->invitation->getPaymentQrCode(), 'label' => ctrans('texts.pay_now')];
$data['$exchange_rate'] = ['value' => $this->entity->exchange_rate ?: ' ', 'label' => ctrans('texts.exchange_rate')];
$data['$triangular_tax'] = ['value' => ctrans('texts.triangular_tax'), 'label' => ''];
$data['$tax_info'] = ['value' => $this->taxLabel(), 'label' => ''];
if ($this->entity_string == 'invoice' || $this->entity_string == 'recurring_invoice') {
$data['$entity'] = ['value' => ctrans('texts.invoice'), 'label' => ctrans('texts.invoice')];
$data['$number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.invoice_number')];
@ -676,6 +691,26 @@ class HtmlEngine
return $data;
}
/**
* Returns a localized string for tax compliance purposes
*
* @return string
*/
private function taxLabel(): string
{
$tax_label = '';
if (collect($this->entity->line_items)->contains('tax_id', \App\Models\Product::PRODUCT_TYPE_REVERSE_TAX)) {
$tax_label .= ctrans('texts.reverse_tax_info') . "\n";
}
if($this->client->country_id !== (int)$this->company->settings->country_id){
$tax_label .= ctrans('texts.tax_info') . "\n";
}
return $tax_label;
}
private function getBalance()
{

View File

@ -5143,6 +5143,9 @@ $LANG = array(
'is_tax_exempt' => 'Tax Exempt',
'drop_files_here' => 'Drop files here',
'upload_files' => 'Upload Files',
'triangular_tax_info' => 'Intra-community triangular transaction',
'intracommunity_tax_info' => 'Tax-free intra-community delivery',
'reverse_tax_info' => 'Please note that this supply is subject to reverse charge',
);
return $LANG;