diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 5a14ea6244..260aaef3ba 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -324,11 +324,17 @@ class InvoiceController extends BaseController } } + // Tax rate options + $rates = TaxRate::scope()->orderBy('name')->get(); + foreach ($rates as $rate) { + $options[$rate->rate . ' ' . $rate->name] = $rate->name . ' ' . ($rate->rate+0) . '%'; + } + return [ 'data' => Input::old('data'), 'account' => Auth::user()->account->load('country'), 'products' => Product::scope()->with('default_tax_rate')->orderBy('product_key')->get(), - 'taxRates' => TaxRate::scope()->orderBy('name')->get(), + 'taxRates' => $options, 'currencies' => Cache::get('currencies'), 'languages' => Cache::get('languages'), 'sizes' => Cache::get('sizes'), diff --git a/database/migrations/2016_03_23_215049_support_multiple_tax_rates.php b/database/migrations/2016_03_23_215049_support_multiple_tax_rates.php new file mode 100644 index 0000000000..f9b9fd2218 --- /dev/null +++ b/database/migrations/2016_03_23_215049_support_multiple_tax_rates.php @@ -0,0 +1,38 @@ +decimal('tax_rate', 13, 3)->change(); + }); + + Schema::table('invoice_items', function($table) { + $table->decimal('tax_rate', 13, 3)->change(); + }); + } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('invoices', function($table) { + $table->decimal('tax_rate', 13, 2)->change(); + }); + + Schema::table('invoice_items', function($table) { + $table->decimal('tax_rate', 13, 2)->change(); + }); + } +} \ No newline at end of file diff --git a/database/seeds/CurrenciesSeeder.php b/database/seeds/CurrenciesSeeder.php index 9a8304b181..b3da84dad0 100644 --- a/database/seeds/CurrenciesSeeder.php +++ b/database/seeds/CurrenciesSeeder.php @@ -55,6 +55,7 @@ class CurrenciesSeeder extends Seeder ['name' => 'Saudi Riyal', 'code' => 'SAR', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Japanese Yen', 'code' => 'JPY', 'symbol' => '¥', 'precision' => '0', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Maldivian Rufiyaa', 'code' => 'MVR', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], + ['name' => 'Costa Rican Colón', 'code' => 'CRC', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ]; foreach ($currencies as $currency) { diff --git a/resources/views/invoices/edit.blade.php b/resources/views/invoices/edit.blade.php index a12ab9e1f9..505f0d332d 100644 --- a/resources/views/invoices/edit.blade.php +++ b/resources/views/invoices/edit.blade.php @@ -53,7 +53,7 @@