Fixes for taxes

This commit is contained in:
David Bomba 2023-04-19 16:51:01 +10:00
parent 3661f4d50b
commit 78e429d559
5 changed files with 12 additions and 2 deletions

View File

@ -176,7 +176,13 @@ class BaseRule implements RuleInterface
return $this;
}
elseif($this->client_region == 'AU'){
$this->tax_rate1 = 10;
$this->tax_name1 = 'GST';
return $this;
}
$this->tax_rate1 = $this->client->company->tax_data->regions->{$this->client_region}->subregions->{$this->client_subregion}->tax_rate;
$this->tax_name1 = $this->client->company->tax_data->regions->{$this->client_region}->subregions->{$this->client_subregion}->tax_name;

View File

@ -97,6 +97,8 @@ class Response
public function __construct($data)
{
if(!$data)
return;
foreach($data as $key => $value){
$this->{$key} = $value;

View File

@ -146,7 +146,7 @@ class InvoiceItemSum
$class = "App\DataMapper\Tax\\".$this->client->company->country()->iso_3166_2."\\Rule";
$tax_data = new Response($this->invoice->tax_data);
$tax_data = new Response($this->invoice?->tax_data);
$this->rule = new $class();
$this->rule

View File

@ -20,6 +20,8 @@ class CreateXInvoice implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $deleteWhenMissingModels = true;
public function __construct(private Invoice $invoice, private bool $alterPDF, private string $custom_pdf_path = "")
{
}

View File

@ -195,7 +195,7 @@ class CompanyTransformer extends EntityTransformer
'notify_vendor_when_paid' => (bool) $company->notify_vendor_when_paid,
'invoice_task_hours' => (bool) $company->invoice_task_hours,
'calculate_taxes' => (bool) $company->calculate_taxes,
'tax_data' => $company->tax_data ?: '',
'tax_data' => $company->tax_data ?: new \stdClass,
];
}