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
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function countDocuments()
|
public function countDocuments($expenses = false)
|
||||||
{
|
{
|
||||||
$count = count($this->documents);
|
$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;
|
return $count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@
|
|||||||
@if ($account->hasFeature(FEATURE_DOCUMENTS))
|
@if ($account->hasFeature(FEATURE_DOCUMENTS))
|
||||||
<li role="presentation"><a href="#attached-documents" aria-controls="attached-documents" role="tab" data-toggle="tab">
|
<li role="presentation"><a href="#attached-documents" aria-controls="attached-documents" role="tab" data-toggle="tab">
|
||||||
{{ trans("texts.invoice_documents") }}
|
{{ trans("texts.invoice_documents") }}
|
||||||
@if ($count = $invoice->countDocuments())
|
@if ($count = ($invoice->countDocuments($expenses)))
|
||||||
({{ $count }})
|
({{ $count }})
|
||||||
@endif
|
@endif
|
||||||
</a></li>
|
</a></li>
|
||||||
@ -340,7 +340,7 @@
|
|||||||
<input type="hidden" name="document_ids[]" data-bind="value: public_id"/>
|
<input type="hidden" name="document_ids[]" data-bind="value: public_id"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@if ($invoice->hasExpenseDocuments())
|
@if ($invoice->hasExpenseDocuments() || count($expenses))
|
||||||
<h4>{{trans('texts.documents_from_expenses')}}</h4>
|
<h4>{{trans('texts.documents_from_expenses')}}</h4>
|
||||||
@foreach($invoice->expenses as $expense)
|
@foreach($invoice->expenses as $expense)
|
||||||
@if ($expense->invoice_documents)
|
@if ($expense->invoice_documents)
|
||||||
@ -348,6 +348,13 @@
|
|||||||
<div>{{$document->name}}</div>
|
<div>{{$document->name}}</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
|
@endforeach
|
||||||
|
@foreach($expenses as $expense)
|
||||||
|
@if ($expense->invoice_documents)
|
||||||
|
@foreach($expense->documents as $document)
|
||||||
|
<div>{{$document->name}}</div>
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user