mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-05-29 14:44:55 +00:00
Adding Flat Tax support with fixed amount (#253)
* Possibility to set a fixed amount on tax types settings * Pint and manage flat taxes on items * Fix display errors and handle global taxes * Tests * Pint with PHP 8.2 cause with PHP 8.3 version it cause workflow error * Merging percent and fixed amount into one column * Now display the currency on SelectTaxPopup on fixed taxes
This commit is contained in:
@@ -22,8 +22,10 @@ class TaxTypeFactory extends Factory
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->word(),
|
||||
'calculation_type' => 'percentage',
|
||||
'company_id' => User::find(1)->companies()->first()->id,
|
||||
'percent' => $this->faker->numberBetween($min = 0, $max = 100),
|
||||
'fixed_amount' => null,
|
||||
'description' => $this->faker->text(),
|
||||
'compound_tax' => 0,
|
||||
'collective_tax' => 0,
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('tax_types', function (Blueprint $table) {
|
||||
$table->enum('calculation_type', ['percentage', 'fixed'])->default('percentage')->after('name');
|
||||
$table->integer('fixed_amount')->nullable()->after('percent');
|
||||
$table->decimal('percent', 5, 2)->nullable()->change();
|
||||
});
|
||||
|
||||
Schema::table('taxes', function (Blueprint $table) {
|
||||
$table->enum('calculation_type', ['percentage', 'fixed'])->default('percentage')->after('name');
|
||||
$table->integer('fixed_amount')->nullable()->after('percent');
|
||||
$table->decimal('percent', 5, 2)->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('tax_types', function (Blueprint $table) {
|
||||
$table->dropColumn(['calculation_type', 'fixed_amount']);
|
||||
$table->decimal('percent', 5, 2)->change();
|
||||
});
|
||||
|
||||
Schema::table('taxes', function (Blueprint $table) {
|
||||
$table->dropColumn(['calculation_type', 'fixed_amount']);
|
||||
$table->decimal('percent', 5, 2)->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user