diff --git a/app/DataMapper/Tax/ClientTaxData.php b/app/DataMapper/Tax/ClientTaxData.php new file mode 100644 index 0000000000..6ec89b628c --- /dev/null +++ b/app/DataMapper/Tax/ClientTaxData.php @@ -0,0 +1,21 @@ + (bool) $company->convert_expense_currency, '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_all_products' => (bool) $company->tax_all_products, ]; } diff --git a/app/Transformers/InvoiceTransformer.php b/app/Transformers/InvoiceTransformer.php index a35e1d4c20..5e3b0a9395 100644 --- a/app/Transformers/InvoiceTransformer.php +++ b/app/Transformers/InvoiceTransformer.php @@ -149,6 +149,7 @@ class InvoiceTransformer extends EntityTransformer 'paid_to_date' => (float) $invoice->paid_to_date, 'subscription_id' => $this->encodePrimaryKey($invoice->subscription_id), 'auto_bill_enabled' => (bool) $invoice->auto_bill_enabled, + 'tax_data' => $invoice->tax_data ?: '', ]; } } diff --git a/app/Transformers/ProductTransformer.php b/app/Transformers/ProductTransformer.php index 3d0247da00..4f3f6706d9 100644 --- a/app/Transformers/ProductTransformer.php +++ b/app/Transformers/ProductTransformer.php @@ -95,6 +95,7 @@ class ProductTransformer extends EntityTransformer 'stock_notification_threshold' => (int) $product->stock_notification_threshold, 'max_quantity' => (int) $product->max_quantity, 'product_image' => (string) $product->product_image ?: '', + 'tax_id' => (int) $product->tax_id ?: 1, ]; } } diff --git a/database/migrations/2023_03_21_053933_tax_calculations_for_invoices.php b/database/migrations/2023_03_21_053933_tax_calculations_for_invoices.php index e70b119609..1c6d885e9f 100644 --- a/database/migrations/2023_03_21_053933_tax_calculations_for_invoices.php +++ b/database/migrations/2023_03_21_053933_tax_calculations_for_invoices.php @@ -20,12 +20,17 @@ return new class extends Migration Schema::table('companies', function (Blueprint $table) { $table->boolean('calculate_taxes')->default(false); //setting to turn on/off tax calculations $table->boolean('tax_all_products')->default(false); //globally tax all products if none defined + $table->boolean('tax_data'); }); Schema::table('products', function (Blueprint $table){ $table->unsignedInteger('tax_id')->nullable(); // the product tax constant }); + Schema::table('clients', function (Blueprint $table){ + $table->boolean('tax_data'); + }); + } /**