1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 20:52:56 +01:00

Working on recurring expenses

This commit is contained in:
Hillel Coren 2017-06-23 18:10:57 +03:00
parent 337f57e1ac
commit f492cca9fe
2 changed files with 39 additions and 3 deletions

View File

@ -23,7 +23,42 @@ class UpdateDarkMode extends Migration
left join invoices on invoices.id = invoice_items.invoice_id
set invoice_item_type_id = 2
where invoices.has_tasks = 1
and invoice_item_type_id = 1');
and invoice_item_type_id = 1');
Schema::create('recurring_expenses', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->softDeletes();
$table->unsignedInteger('account_id')->index();
$table->unsignedInteger('vendor_id')->nullable();
$table->unsignedInteger('user_id');
$table->unsignedInteger('client_id')->nullable();
$table->boolean('is_deleted')->default(false);
$table->decimal('amount', 13, 2);
$table->text('private_notes');
$table->text('public_notes');
$table->unsignedInteger('invoice_currency_id')->nullable(false);
$table->unsignedInteger('expense_currency_id')->nullable()->index();
$table->boolean('should_be_invoiced')->default(true);
$table->unsignedInteger('expense_category_id')->nullable()->index();
$table->string('tax_name1')->nullable();
$table->decimal('tax_rate1', 13, 3);
$table->string('tax_name2')->nullable();
$table->decimal('tax_rate2', 13, 3);
// Relations
$table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->foreign('invoice_currency_id')->references('id')->on('currencies');
$table->foreign('expense_currency_id')->references('id')->on('currencies');
$table->foreign('expense_category_id')->references('id')->on('expense_categories')->onDelete('cascade');
// Indexes
$table->unsignedInteger('public_id')->index();
$table->unique(['account_id', 'public_id']);
});
}
/**
@ -33,6 +68,6 @@ class UpdateDarkMode extends Migration
*/
public function down()
{
//
Schema::drop('recurring_expenses');
}
}

View File

@ -50,7 +50,8 @@
class="form-control pull-left" placeholder="{{ trans('texts.filter') }}" value="{{ Input::get('filter') }}"/>
@if ($entityType == ENTITY_EXPENSE)
{!! Button::normal(trans('texts.categories'))->asLinkTo(URL::to('/expense_categories'))->appendIcon(Icon::create('list')) !!}
{!! Button::normal(trans('texts.recurring'))->asLinkTo(URL::to('/recurring_categories'))->appendIcon(Icon::create('list')) !!}
{!! Button::normal(trans('texts.categories'))->asLinkTo(URL::to('/expense_categories'))->appendIcon(Icon::create('list')) !!}
@elseif ($entityType == ENTITY_TASK)
{!! Button::normal(trans('texts.projects'))->asLinkTo(URL::to('/projects'))->appendIcon(Icon::create('list')) !!}
@endif