Aircraft can have its own expenses #130

This commit is contained in:
Nabeel Shahzad
2018-03-06 17:32:56 -06:00
parent c7925db0e7
commit a325470b8f
8 changed files with 206 additions and 17 deletions

View File

@@ -127,6 +127,7 @@ class PirepFinanceService extends BaseService
/**
* Collect all of the expenses and apply those to the journal
* @param Pirep $pirep
* @throws \Prettus\Validator\Exceptions\ValidatorException
* @throws \UnexpectedValueException
* @throws \InvalidArgumentException
*/
@@ -142,9 +143,9 @@ class PirepFinanceService extends BaseService
*/
$expenses->map(function ($expense, $i) use ($pirep)
{
if ($expense->multiplier) {
/*if ($expense->multiplier) {
# TODO: Modify the amount
}
}*/
Log::info('Finance: PIREP: '.$pirep->id.', expense:', $expense->toArray());
@@ -166,7 +167,8 @@ class PirepFinanceService extends BaseService
$transaction_group = "Subfleet: {$expense->name} ({$pirep->aircraft->subfleet->name})";
} elseif ($klass === 'Aircraft') {
$memo = "Aircraft Expense: {$expense->name} ({$pirep->aircraft->name})";
$transaction_group = "Aircraft: {$expense->name} ({$pirep->aircraft->name})";
$transaction_group = "Aircraft: {$expense->name} "
."({$pirep->aircraft->name}-{$pirep->aircraft->registration})";
} else {
$memo = "Expense: {$expense->name}";
$transaction_group = "Expense: {$expense->name}";