From 8367b388ef502c60b2901d994786d5a22986fed8 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 25 Nov 2023 09:09:17 +1100 Subject: [PATCH] Add service class --- app/Services/Company/CompanyService.php | 76 +++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 app/Services/Company/CompanyService.php diff --git a/app/Services/Company/CompanyService.php b/app/Services/Company/CompanyService.php new file mode 100644 index 000000000000..49d8cb5cb7fc --- /dev/null +++ b/app/Services/Company/CompanyService.php @@ -0,0 +1,76 @@ +company->settings->country_id) { + + case '36': // Australia + $taxes[] = ['name' => 'GST', 'rate' => 10]; + break; + case '40': // Austria + $taxes[] = ['name' => 'USt', 'rate' => 20]; + break; + case '56': // Belgium + $taxes[] = ['name' => 'BTW', 'rate' => 21]; + break; + case '100': // Bulgaria + $taxes[] = ['name' => 'ДДС', 'rate' => 20]; + break; + case '250': // France + $taxes[] = ['name' => 'TVA', 'rate' => 20]; + break; + case '276': // Germany + $taxes[] = ['name' => 'MwSt', 'rate' => 19]; + break; + case '554': // New Zealand + $taxes[] = ['name' => 'GST', 'rate' => 15]; + break; + case '710': // South Africa + $taxes[] = ['name' => 'VAT', 'rate' => 15]; + break; + case '724': // Spain + $taxes[] = ['name' => 'IVA', 'rate' => 21]; + break; + + default: + return; + } + + foreach($taxes as $tax) { + $tax_rate = TaxRateFactory::create($this->company->id, $user->id); + $tax_rate->fill($tax); + $tax_rate->save(); + } + + }catch(\Exception $e){ + nlog($e->getMessage()); + } + + } + +} \ No newline at end of file