mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Show documents when invoicing an expense #1598
This commit is contained in:
parent
7e1f01373d
commit
9cc3fe9237
@ -1332,7 +1332,7 @@ class Invoice extends EntityModel implements BalanceAffecting
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function countDocuments()
|
||||
public function countDocuments($expenses = false)
|
||||
{
|
||||
$count = count($this->documents);
|
||||
|
||||
@ -1342,6 +1342,14 @@ class Invoice extends EntityModel implements BalanceAffecting
|
||||
}
|
||||
}
|
||||
|
||||
if ($expenses) {
|
||||
foreach ($expenses as $expense) {
|
||||
if ($expense->invoice_documents) {
|
||||
$count += count($expense->documents);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
|
@ -285,7 +285,7 @@
|
||||
@if ($account->hasFeature(FEATURE_DOCUMENTS))
|
||||
<li role="presentation"><a href="#attached-documents" aria-controls="attached-documents" role="tab" data-toggle="tab">
|
||||
{{ trans("texts.invoice_documents") }}
|
||||
@if ($count = $invoice->countDocuments())
|
||||
@if ($count = ($invoice->countDocuments($expenses)))
|
||||
({{ $count }})
|
||||
@endif
|
||||
</a></li>
|
||||
@ -340,7 +340,7 @@
|
||||
<input type="hidden" name="document_ids[]" data-bind="value: public_id"/>
|
||||
</div>
|
||||
</div>
|
||||
@if ($invoice->hasExpenseDocuments())
|
||||
@if ($invoice->hasExpenseDocuments() || count($expenses))
|
||||
<h4>{{trans('texts.documents_from_expenses')}}</h4>
|
||||
@foreach($invoice->expenses as $expense)
|
||||
@if ($expense->invoice_documents)
|
||||
@ -348,6 +348,13 @@
|
||||
<div>{{$document->name}}</div>
|
||||
@endforeach
|
||||
@endif
|
||||
@endforeach
|
||||
@foreach($expenses as $expense)
|
||||
@if ($expense->invoice_documents)
|
||||
@foreach($expense->documents as $document)
|
||||
<div>{{$document->name}}</div>
|
||||
@endforeach
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user