diff --git a/app/DataMapper/CompanySettings.php b/app/DataMapper/CompanySettings.php index befa5cb8331f..7bce5b18aee2 100644 --- a/app/DataMapper/CompanySettings.php +++ b/app/DataMapper/CompanySettings.php @@ -124,6 +124,8 @@ class CompanySettings extends BaseSettings public $tax_rate1 = 0; public $tax_name2 = ''; public $tax_rate2 = 0; + public $tax_name3 = ''; + public $tax_rate3 = 0; public $enable_second_tax_rate = false; public $payment_type_id = ''; public $convert_products = false; @@ -184,8 +186,12 @@ class CompanySettings extends BaseSettings 'has_custom_design1' => 'bool', 'has_custom_design2' => 'bool', 'has_custom_design3' => 'bool', + 'tax_name1' => 'string', + 'tax_name2' => 'string', + 'tax_name3' => 'string', 'tax_rate1' => 'float', 'tax_rate2' => 'float', + 'tax_rate3' => 'float', 'require_invoice_signature' => 'bool', 'require_quote_signature' => 'bool', 'show_accept_quote_terms' => 'bool', diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 166c569ce795..b6f87fa42967 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -63,6 +63,8 @@ class Invoice extends BaseModel 'tax_rate1', 'tax_name2', 'tax_rate2', + 'tax_name3', + 'tax_rate3', 'is_amount_discount', 'invoice_footer', 'partial', diff --git a/app/Models/Product.php b/app/Models/Product.php index 36eca4d1f0df..b630f48f0cc4 100644 --- a/app/Models/Product.php +++ b/app/Models/Product.php @@ -34,8 +34,10 @@ class Product extends BaseModel 'quantity', 'tax_name1', 'tax_name2', + 'tax_name3', 'tax_rate1', 'tax_rate2', + 'tax_rate3', ]; public function company() diff --git a/app/Models/Quote.php b/app/Models/Quote.php index 92fd4c833224..323ff1871899 100644 --- a/app/Models/Quote.php +++ b/app/Models/Quote.php @@ -36,8 +36,10 @@ class Quote extends BaseModel 'terms', 'tax_name1', 'tax_name2', + 'tax_name3', 'tax_rate1', 'tax_rate2', + 'tax_rate3', 'custom_value1', 'custom_value2', 'custom_value3', diff --git a/app/Models/RecurringInvoice.php b/app/Models/RecurringInvoice.php index 551a7d16cc72..30239bc29bb1 100644 --- a/app/Models/RecurringInvoice.php +++ b/app/Models/RecurringInvoice.php @@ -68,8 +68,10 @@ class RecurringInvoice extends BaseModel 'terms', 'tax_name1', 'tax_name2', + 'tax_name3', 'tax_rate1', 'tax_rate2', + 'tax_rate3', 'custom_value1', 'custom_value2', 'custom_value3', diff --git a/app/Models/RecurringQuote.php b/app/Models/RecurringQuote.php index 75ccffbab956..2288dfcc8ec5 100644 --- a/app/Models/RecurringQuote.php +++ b/app/Models/RecurringQuote.php @@ -67,8 +67,10 @@ class RecurringQuote extends BaseModel 'terms', 'tax_name1', 'tax_name2', + 'tax_name3', 'tax_rate1', 'tax_rate2', + 'tax_rate3', 'custom_value1', 'custom_value2', 'custom_value3', diff --git a/app/Transformers/Contact/InvoiceTransformer.php b/app/Transformers/Contact/InvoiceTransformer.php index 67e63bd5f181..061802d462d1 100644 --- a/app/Transformers/Contact/InvoiceTransformer.php +++ b/app/Transformers/Contact/InvoiceTransformer.php @@ -48,6 +48,8 @@ class InvoiceTransformer extends EntityTransformer 'tax_rate1' => (float) $invoice->tax_rate1, 'tax_name2' => $invoice->tax_name2 ? $invoice->tax_name2 : '', 'tax_rate2' => (float) $invoice->tax_rate2, + 'tax_name3' => $invoice->tax_name3 ? $invoice->tax_name3 : '', + 'tax_rate3' => (float) $invoice->tax_rate3, 'is_amount_discount' => (bool) ($invoice->is_amount_discount ?: false), 'invoice_footer' => $invoice->invoice_footer ?: '', 'partial' => (float) ($invoice->partial ?: 0.0), diff --git a/app/Transformers/InvoiceTransformer.php b/app/Transformers/InvoiceTransformer.php index 2d64412c7fcf..bff8c5cbdfda 100644 --- a/app/Transformers/InvoiceTransformer.php +++ b/app/Transformers/InvoiceTransformer.php @@ -103,6 +103,8 @@ class InvoiceTransformer extends EntityTransformer 'tax_rate1' => (float) $invoice->tax_rate1, 'tax_name2' => $invoice->tax_name2 ? $invoice->tax_name2 : '', 'tax_rate2' => (float) $invoice->tax_rate2, + 'tax_name3' => $invoice->tax_name3 ? $invoice->tax_name3 : '', + 'tax_rate3' => (float) $invoice->tax_rate3, 'is_amount_discount' => (bool) ($invoice->is_amount_discount ?: false), 'invoice_footer' => $invoice->invoice_footer ?: '', 'partial' => (float) ($invoice->partial ?: 0.0), diff --git a/app/Transformers/ProductTransformer.php b/app/Transformers/ProductTransformer.php index 11a35c606b26..74111f46a9a2 100644 --- a/app/Transformers/ProductTransformer.php +++ b/app/Transformers/ProductTransformer.php @@ -64,11 +64,13 @@ class ProductTransformer extends EntityTransformer 'notes' => $product->notes ?: '', 'cost' => (float) $product->cost ?: 0, 'price' => (float) $product->price ?: 0, - 'quantity' => (float) ($product->quantity ?: 0.0), + 'quantity' => (float) $product->quantity ?: 1.0, 'tax_name1' => $product->tax_name1 ?: '', 'tax_rate1' => (float) $product->tax_rate1 ?: 0, 'tax_name2' => $product->tax_name2 ?: '', 'tax_rate2' => (float) $product->tax_rate2 ?: 0, + 'tax_name3' => $product->tax_name3 ?: '', + 'tax_rate3' => (float) $product->tax_rate3 ?: 0, 'updated_at' => $product->updated_at, 'archived_at' => $product->deleted_at, 'custom_value1' => $product->custom_value1 ?: '', diff --git a/app/Transformers/QuoteTransformer.php b/app/Transformers/QuoteTransformer.php index 15ecb5470186..74d6b314550f 100644 --- a/app/Transformers/QuoteTransformer.php +++ b/app/Transformers/QuoteTransformer.php @@ -100,6 +100,8 @@ class QuoteTransformer extends EntityTransformer 'tax_rate1' => (float) $quote->tax_rate1 ?: '', 'tax_name2' => $quote->tax_name2 ? $quote->tax_name2 : '', 'tax_rate2' => (float) $quote->tax_rate2 ?: '', + 'tax_name3' => $quote->tax_name3 ? $quote->tax_name3 : '', + 'tax_rate3' => (float) $quote->tax_rate3 ?: '', 'is_amount_discount' => (bool) ($quote->is_amount_discount ?: false), 'quote_footer' => $quote->quote_footer ?: '', 'partial' => (float) ($quote->partial ?: 0.0), diff --git a/app/Transformers/RecurringInvoiceTransformer.php b/app/Transformers/RecurringInvoiceTransformer.php index b1e90393153a..68460a99b687 100644 --- a/app/Transformers/RecurringInvoiceTransformer.php +++ b/app/Transformers/RecurringInvoiceTransformer.php @@ -99,6 +99,8 @@ class RecurringInvoiceTransformer extends EntityTransformer 'tax_rate1' => (float) $invoice->tax_rate1 ?: '', 'tax_name2' => $invoice->tax_name2 ? $invoice->tax_name2 : '', 'tax_rate2' => (float) $invoice->tax_rate2 ?: '', + 'tax_name3' => $invoice->tax_name3 ? $invoice->tax_name3 : '', + 'tax_rate3' => (float) $invoice->tax_rate3 ?: '', 'is_amount_discount' => (bool) ($invoice->is_amount_discount ?: false), 'invoice_footer' => $invoice->invoice_footer ?: '', 'partial' => (float) ($invoice->partial ?: 0.0), diff --git a/app/Transformers/RecurringQuoteTransformer.php b/app/Transformers/RecurringQuoteTransformer.php index f3f3d1af4f91..ab7ddcfe8cdd 100644 --- a/app/Transformers/RecurringQuoteTransformer.php +++ b/app/Transformers/RecurringQuoteTransformer.php @@ -99,6 +99,8 @@ class RecurringQuoteTransformer extends EntityTransformer 'tax_rate1' => (float) $quote->tax_rate1 ?: '', 'tax_name2' => $quote->tax_name2 ? $quote->tax_name2 : '', 'tax_rate2' => (float) $quote->tax_rate2 ?: '', + 'tax_name3' => $quote->tax_name3 ? $quote->tax_name3 : '', + 'tax_rate3' => (float) $quote->tax_rate3 ?: '', 'is_amount_discount' => (bool) ($quote->is_amount_discount ?: false), 'quote_footer' => $quote->quote_footer ?: '', 'partial' => (float) ($quote->partial ?: 0.0), diff --git a/app/Utils/Traits/MakesInvoiceValues.php b/app/Utils/Traits/MakesInvoiceValues.php index 74874067e48f..3642d78dd18d 100644 --- a/app/Utils/Traits/MakesInvoiceValues.php +++ b/app/Utils/Traits/MakesInvoiceValues.php @@ -33,6 +33,7 @@ trait MakesInvoiceValues 'quantity', 'tax_name1', 'tax_name2', + 'tax_name3', 'line_total', 'custom_label1', 'custom_label2', diff --git a/database/factories/InvoiceFactory.php b/database/factories/InvoiceFactory.php index 25085f4bd837..25506e619349 100644 --- a/database/factories/InvoiceFactory.php +++ b/database/factories/InvoiceFactory.php @@ -15,6 +15,8 @@ $factory->define(App\Models\Invoice::class, function (Faker $faker) { 'tax_rate1' => 10, 'tax_name2' => 'VAT', 'tax_rate2' => 17.5, + 'tax_name3' => 'THIRDTAX', + 'tax_rate3' => 5, 'custom_value1' => $faker->numberBetween(1,4), 'custom_value2' => $faker->numberBetween(1,4), 'custom_value3' => $faker->numberBetween(1,4), diff --git a/database/factories/ProductFactory.php b/database/factories/ProductFactory.php index 00b978e27891..fdedf2592982 100644 --- a/database/factories/ProductFactory.php +++ b/database/factories/ProductFactory.php @@ -13,6 +13,8 @@ $factory->define(App\Models\Product::class, function (Faker $faker) { 'tax_rate1' => 10, 'tax_name2' => 'VAT', 'tax_rate2' => 17.5, + 'tax_name3' => 'THIRDTAX', + 'tax_rate3' => 5, 'custom_value1' => $faker->text(20), 'custom_value2' => $faker->text(20), 'custom_value3' => $faker->text(20), diff --git a/database/factories/QuoteFactory.php b/database/factories/QuoteFactory.php index f092d3ecce8e..d0a4c25c94a5 100644 --- a/database/factories/QuoteFactory.php +++ b/database/factories/QuoteFactory.php @@ -14,6 +14,8 @@ $factory->define(App\Models\Quote::class, function (Faker $faker) { 'tax_rate1' => 10, 'tax_name2' => 'VAT', 'tax_rate2' => 17.5, + 'tax_name3' => 'THIRDTAX', + 'tax_rate3' => 5, 'custom_value1' => $faker->numberBetween(1,4), 'custom_value2' => $faker->numberBetween(1,4), 'custom_value3' => $faker->numberBetween(1,4), diff --git a/database/factories/RecurringInvoiceFactory.php b/database/factories/RecurringInvoiceFactory.php index af8efcf3ac53..a630d8b44524 100644 --- a/database/factories/RecurringInvoiceFactory.php +++ b/database/factories/RecurringInvoiceFactory.php @@ -13,6 +13,8 @@ $factory->define(App\Models\RecurringInvoice::class, function (Faker $faker) { 'tax_rate1' => 10, 'tax_name2' => 'VAT', 'tax_rate2' => 17.5, + 'tax_name3' => 'THIRDTAX', + 'tax_rate3' => 5, 'custom_value1' => $faker->numberBetween(1,4), 'custom_value2' => $faker->numberBetween(1,4), 'custom_value3' => $faker->numberBetween(1,4), diff --git a/database/factories/RecurringQuoteFactory.php b/database/factories/RecurringQuoteFactory.php index 5394ddccd6b6..bf84367ba91e 100644 --- a/database/factories/RecurringQuoteFactory.php +++ b/database/factories/RecurringQuoteFactory.php @@ -14,6 +14,8 @@ $factory->define(App\Models\RecurringQuote::class, function (Faker $faker) { 'tax_rate1' => 10, 'tax_name2' => 'VAT', 'tax_rate2' => 17.5, + 'tax_name3' => 'THIRDTAX', + 'tax_rate3' => 5, 'custom_value1' => $faker->numberBetween(1,4), 'custom_value2' => $faker->numberBetween(1,4), 'custom_value3' => $faker->numberBetween(1,4), diff --git a/database/migrations/2014_10_13_000000_create_users_table.php b/database/migrations/2014_10_13_000000_create_users_table.php index 3e340cb203e5..2d12900341fb 100644 --- a/database/migrations/2014_10_13_000000_create_users_table.php +++ b/database/migrations/2014_10_13_000000_create_users_table.php @@ -367,10 +367,12 @@ class CreateUsersTable extends Migration $table->decimal('max_limit', 13, 2)->nullable(); $table->decimal('fee_amount', 13, 2)->nullable(); $table->decimal('fee_percent', 13, 2)->nullable(); - $table->decimal('fee_tax_name1', 13, 2)->nullable(); - $table->decimal('fee_tax_name2', 13, 2)->nullable(); + $table->string('fee_tax_name1')->nullable(); + $table->string('fee_tax_name2')->nullable(); + $table->string('fee_tax_name3')->nullable(); $table->decimal('fee_tax_rate1', 13, 2)->nullable(); $table->decimal('fee_tax_rate2', 13, 2)->nullable(); + $table->decimal('fee_tax_rate3', 13, 2)->nullable(); $table->unsignedInteger('fee_cap')->default(0); $table->boolean('adjust_fee_percent'); @@ -420,6 +422,10 @@ class CreateUsersTable extends Migration $t->string('tax_name2')->nullable(); $t->decimal('tax_rate2', 13, 3)->default(0); + $t->string('tax_name3')->nullable(); + $t->decimal('tax_rate3', 13, 3)->default(0); + + $t->string('custom_value1')->nullable(); $t->string('custom_value2')->nullable(); $t->string('custom_value3')->nullable(); @@ -476,6 +482,9 @@ class CreateUsersTable extends Migration $t->string('tax_name2')->nullable(); $t->decimal('tax_rate2', 13, 3)->default(0); + $t->string('tax_name3')->nullable(); + $t->decimal('tax_rate3', 13, 3)->default(0); + $t->string('custom_value1')->nullable(); $t->string('custom_value2')->nullable(); $t->string('custom_value3')->nullable(); @@ -535,6 +544,9 @@ class CreateUsersTable extends Migration $t->string('tax_name2')->nullable(); $t->decimal('tax_rate2', 13, 3)->default(0); + $t->string('tax_name3')->nullable(); + $t->decimal('tax_rate3', 13, 3)->default(0); + $t->string('custom_value1')->nullable(); $t->string('custom_value2')->nullable(); $t->string('custom_value3')->nullable(); @@ -593,6 +605,9 @@ class CreateUsersTable extends Migration $t->string('tax_name2')->nullable(); $t->decimal('tax_rate2', 13, 3)->default(0); + $t->string('tax_name3')->nullable(); + $t->decimal('tax_rate3', 13, 3)->default(0); + $t->string('custom_value1')->nullable(); $t->string('custom_value2')->nullable(); $t->string('custom_value3')->nullable(); @@ -682,6 +697,8 @@ class CreateUsersTable extends Migration $t->decimal('tax_rate1', 13, 3)->default(0); $t->string('tax_name2')->nullable(); $t->decimal('tax_rate2', 13, 3)->default(0); + $t->string('tax_name3')->nullable(); + $t->decimal('tax_rate3', 13, 3)->default(0); $t->boolean('is_deleted')->default(false);