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-26 21:36:58 +03:00
parent 68ec5291b7
commit ab06b72e66
4 changed files with 15 additions and 0 deletions

View File

@ -112,6 +112,10 @@ class ExpenseController extends BaseController
}
}
if ($expense->recurring_expense_id) {
$actions[] = ['url' => URL::to("recurring_expenses/{$expense->recurring_expense->public_id}/edit"), 'label' => trans('texts.view_recurring_expense')];
}
$actions[] = \DropdownButton::DIVIDER;
if (! $expense->trashed()) {
$actions[] = ['url' => 'javascript:submitAction("archive")', 'label' => trans('texts.archive_expense')];

View File

@ -142,6 +142,15 @@ class Expense extends EntityModel
return $this->belongsTo('App\Models\PaymentType');
}
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function recurring_expense()
{
return $this->belongsTo('App\Models\RecurringExpense');
}
/**
* @return mixed
*/

View File

@ -183,6 +183,7 @@ class RecurringExpenseRepository extends BaseRepository
$expense->expense_date = $account->getDateTime()->format('Y-m-d');
$expense->exchange_rate = 1;
$expense->invoice_currency_id = $recurringExpense->expense_currency_id;
$expense->recurring_expense_id = $recurringExpense->id;
$expense->save();
$recurringExpense->last_sent_date = $account->getDateTime()->format('Y-m-d');

View File

@ -2287,6 +2287,7 @@ $LANG = array(
'delete_recurring_expense' => 'Delete Recurring Expense',
'deleted_recurring_expense' => 'Successfully deleted project',
'deleted_recurring_expense' => 'Successfully deleted :count projects',
'view_recurring_expense' => 'View Recurring Expense',
);