1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

additional column on company and expenses table

This commit is contained in:
David Bomba 2021-01-08 21:27:49 +11:00
parent 13420a93b9
commit c82d6fa270
5 changed files with 17 additions and 3 deletions

View File

@ -82,6 +82,8 @@ class Company extends BaseModel
'is_disabled',
'default_task_is_date_based',
'enable_product_discount',
'expense_inclusive_taxes',
'expense_amount_is_pretax',
];
protected $hidden = [

View File

@ -51,6 +51,11 @@ class Expense extends BaseModel
'custom_value3',
'custom_value4',
'number',
'tax_amount1',
'tax_amount2',
'tax_amount3',
'uses_inclusive_taxes',
'amount_is_pretax',
];
protected $casts = [

View File

@ -150,6 +150,8 @@ class CompanyTransformer extends EntityTransformer
'enable_product_discount' => (bool)$company->enable_product_discount,
'calculate_expense_tax_by_amount' =>(bool)$company->calculate_expense_tax_by_amount,
'hide_empty_columns_on_pdf' => false, //@deprecate
'expense_inclusive_taxes' => (bool)$company->expense_inclusive_taxes,
'expense_amount_is_pretax' =>( bool)$company->expense_amount_is_pretax,
];
}

View File

@ -91,6 +91,11 @@ class ExpenseTransformer extends EntityTransformer
'archived_at' => (int) $expense->deleted_at,
'created_at' => (int) $expense->created_at,
'project_id' => $this->encodePrimaryKey($expense->project_id),
'tax_amount1' => (float) $expense->tax_amount1,
'tax_amount2' => (float) $expense->tax_amount2,
'tax_amount3' => (float) $expense->tax_amount3,
'uses_inclusive_taxes' => (bool) $expense->uses_inclusive_taxes,
'amount_is_pretax' => (bool) $expense->amount_is_pretax,
];
}
}

View File

@ -15,9 +15,9 @@ class ExpensesTableAdditionalFields extends Migration
{
Schema::table('expenses', function (Blueprint $table) {
$table->decimal('tax_amount1', 20, 6)->change();
$table->decimal('tax_amount2', 20, 6)->change();
$table->decimal('tax_amount3', 20, 6)->change();
$table->decimal('tax_amount1', 20, 6)->default();
$table->decimal('tax_amount2', 20, 6)->default();
$table->decimal('tax_amount3', 20, 6)->default();
$table->boolean('uses_inclusive_taxes')->default(0);
$table->boolean('amount_is_pretax')->default(1);
});