Show outstanding in customer/vendor list #89
This commit is contained in:
parent
45c14ca9e2
commit
56d64b35a1
@ -71,10 +71,16 @@ class Vendor extends Model
|
|||||||
return $this->getMedia('logo')->last();
|
return $this->getMedia('logo')->last();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAmountAttribute()
|
public function getUnpaidAttribute()
|
||||||
{
|
{
|
||||||
$invoice_total = $this->bills()->notPaid()->sum('amount');
|
$amount = 0;
|
||||||
|
$bills = $this->bills()->accrued()->notPaid()->get();
|
||||||
|
|
||||||
return $invoice_total;
|
foreach ($bills as $bill) {
|
||||||
|
|
||||||
|
$bill_amount = $bill->amount - $bill->paid;
|
||||||
|
$amount += $this->dynamicConvert(setting('general.default_currency'), $bill_amount, $bill->currency_code, $bill->currency_rate, false);
|
||||||
|
}
|
||||||
|
return $amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,10 +65,16 @@ class Customer extends Model
|
|||||||
$this->user_id = null;
|
$this->user_id = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAmountAttribute()
|
public function getUnpaidAttribute()
|
||||||
{
|
{
|
||||||
$invoice_total = $this->invoices()->notPaid()->sum('amount');
|
$amount = 0;
|
||||||
|
$invoices = $this->invoices()->accrued()->notPaid()->get();
|
||||||
|
|
||||||
return $invoice_total;
|
foreach ($invoices as $invoice) {
|
||||||
|
|
||||||
|
$invoice_amount = $invoice->amount - $invoice->paid;
|
||||||
|
$amount += $this->dynamicConvert(setting('general.default_currency'), $invoice_amount, $invoice->currency_code, $invoice->currency_rate, false);
|
||||||
|
}
|
||||||
|
return $amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,6 +106,7 @@ return [
|
|||||||
'disable' => 'Disable',
|
'disable' => 'Disable',
|
||||||
'select_all' => 'Select All',
|
'select_all' => 'Select All',
|
||||||
'unselect_all' => 'Unselect All',
|
'unselect_all' => 'Unselect All',
|
||||||
|
'outstanding' => 'Outstanding',
|
||||||
'title' => [
|
'title' => [
|
||||||
'new' => 'New :type',
|
'new' => 'New :type',
|
||||||
'edit' => 'Edit :type',
|
'edit' => 'Edit :type',
|
||||||
|
@ -33,10 +33,10 @@
|
|||||||
<table class="table table-striped table-hover" id="tbl-vendors">
|
<table class="table table-striped table-hover" id="tbl-vendors">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="col-md-4">@sortablelink('name', trans('general.name'))</th>
|
<th class="col-md-3">@sortablelink('name', trans('general.name'))</th>
|
||||||
<th class="col-md-3 hidden-xs">@sortablelink('email', trans('general.email'))</th>
|
<th class="col-md-3 hidden-xs">@sortablelink('email', trans('general.email'))</th>
|
||||||
<th class="col-md-2">@sortablelink('phone', trans('general.phone'))</th>
|
<th class="col-md-2">@sortablelink('phone', trans('general.phone'))</th>
|
||||||
<th class="col-md-1 hidden-xs">@sortablelink('amount', trans('general.amount'))</th>
|
<th class="col-md-2 hidden-xs">@sortablelink('outstanding', trans('general.outstanding'))</th>
|
||||||
<th class="col-md-1 hidden-xs">@sortablelink('enabled', trans_choice('general.statuses', 1))</th>
|
<th class="col-md-1 hidden-xs">@sortablelink('enabled', trans_choice('general.statuses', 1))</th>
|
||||||
<th class="col-md-1 text-center">{{ trans('general.actions') }}</th>
|
<th class="col-md-1 text-center">{{ trans('general.actions') }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -47,7 +47,7 @@
|
|||||||
<td><a href="{{ url('expenses/vendors/' . $item->id) }}">{{ $item->name }}</a></td>
|
<td><a href="{{ url('expenses/vendors/' . $item->id) }}">{{ $item->name }}</a></td>
|
||||||
<td class="hidden-xs">{{ !empty($item->email) ? $item->email : trans('general.na') }}</td>
|
<td class="hidden-xs">{{ !empty($item->email) ? $item->email : trans('general.na') }}</td>
|
||||||
<td>{{ $item->phone }}</td>
|
<td>{{ $item->phone }}</td>
|
||||||
<td>@money($item->amount, setting('general.default_currency'), true)</td>
|
<td>@money($item->unpaid, setting('general.default_currency'), true)</td>
|
||||||
<td class="hidden-xs">
|
<td class="hidden-xs">
|
||||||
@if ($item->enabled)
|
@if ($item->enabled)
|
||||||
<span class="label label-success">{{ trans('general.enabled') }}</span>
|
<span class="label label-success">{{ trans('general.enabled') }}</span>
|
||||||
|
@ -33,10 +33,10 @@
|
|||||||
<table class="table table-striped table-hover" id="tbl-customers">
|
<table class="table table-striped table-hover" id="tbl-customers">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="col-md-4">@sortablelink('name', trans('general.name'))</th>
|
<th class="col-md-3">@sortablelink('name', trans('general.name'))</th>
|
||||||
<th class="col-md-3 hidden-xs">@sortablelink('email', trans('general.email'))</th>
|
<th class="col-md-3 hidden-xs">@sortablelink('email', trans('general.email'))</th>
|
||||||
<th class="col-md-2">@sortablelink('phone', trans('general.phone'))</th>
|
<th class="col-md-2">@sortablelink('phone', trans('general.phone'))</th>
|
||||||
<th class="col-md-1 hidden-xs">@sortablelink('amounts', trans('general.amount'))</th>
|
<th class="col-md-2 hidden-xs">@sortablelink('outstanding', trans('general.outstanding'))</th>
|
||||||
<th class="col-md-1 hidden-xs">@sortablelink('enabled', trans_choice('general.statuses', 1))</th>
|
<th class="col-md-1 hidden-xs">@sortablelink('enabled', trans_choice('general.statuses', 1))</th>
|
||||||
<th class="col-md-1 text-center">{{ trans('general.actions') }}</th>
|
<th class="col-md-1 text-center">{{ trans('general.actions') }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -47,7 +47,7 @@
|
|||||||
<td><a href="{{ url('incomes/customers/' . $item->id) }}">{{ $item->name }}</a></td>
|
<td><a href="{{ url('incomes/customers/' . $item->id) }}">{{ $item->name }}</a></td>
|
||||||
<td class="hidden-xs">{{ !empty($item->email) ? $item->email : trans('general.na') }}</td>
|
<td class="hidden-xs">{{ !empty($item->email) ? $item->email : trans('general.na') }}</td>
|
||||||
<td>{{ $item->phone }}</td>
|
<td>{{ $item->phone }}</td>
|
||||||
<td>@money($item->amount, setting('general.default_currency'), true)</td>
|
<td>@money($item->unpaid, setting('general.default_currency'), true)</td>
|
||||||
<td class="hidden-xs">
|
<td class="hidden-xs">
|
||||||
@if ($item->enabled)
|
@if ($item->enabled)
|
||||||
<span class="label label-success">{{ trans('general.enabled') }}</span>
|
<span class="label label-success">{{ trans('general.enabled') }}</span>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user