Compare commits
No commits in common. "d5be958de0fbc6e6cc6334b73813f4830e5035a1" and "a56d67e1a1f0445a9ba0a77232a81527dd7b64f6" have entirely different histories.
d5be958de0
...
a56d67e1a1
@ -350,12 +350,13 @@ class User extends Authenticatable implements IDs
|
|||||||
->select([
|
->select([
|
||||||
'invoice_id',
|
'invoice_id',
|
||||||
DB::raw('invoice_items.id AS invoice_item_id'),
|
DB::raw('invoice_items.id AS invoice_item_id'),
|
||||||
DB::raw('COALESCE(invoice_items.discount_amt,0) AS discount'),
|
DB::raw('IFNULL(invoice_items.discount_amt,0) AS discount'),
|
||||||
DB::raw('quantity*price_base AS base'),
|
DB::raw('ROUND(CAST(quantity*price_base AS decimal(8,2)),2) AS base'),
|
||||||
DB::raw('invoice_item_taxes.amount AS tax'),
|
DB::raw('ROUND(invoice_item_taxes.amount,2) AS tax'),
|
||||||
|
|
||||||
])
|
])
|
||||||
->leftjoin('invoice_item_taxes',['invoice_item_taxes.invoice_item_id'=>'invoice_items.id'])
|
->leftjoin('invoice_item_taxes',['invoice_item_taxes.invoice_item_id'=>'invoice_items.id'])
|
||||||
->where('invoice_items.active',TRUE);
|
->where('active',TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -380,7 +381,6 @@ class User extends Authenticatable implements IDs
|
|||||||
*
|
*
|
||||||
* @return \Illuminate\Database\Query\Builder
|
* @return \Illuminate\Database\Query\Builder
|
||||||
* @todo change this to just return outstanding invoices as a collection.
|
* @todo change this to just return outstanding invoices as a collection.
|
||||||
* @deprecated Use account->invoiceSummary
|
|
||||||
*/
|
*/
|
||||||
public function query_invoice_summary()
|
public function query_invoice_summary()
|
||||||
{
|
{
|
||||||
@ -390,23 +390,23 @@ class User extends Authenticatable implements IDs
|
|||||||
DB::raw('SUM(discount) AS discount'),
|
DB::raw('SUM(discount) AS discount'),
|
||||||
DB::raw('SUM(base) AS base'),
|
DB::raw('SUM(base) AS base'),
|
||||||
DB::raw('SUM(tax) AS tax'),
|
DB::raw('SUM(tax) AS tax'),
|
||||||
DB::raw('base+tax-discount AS total'),
|
DB::raw('ROUND(SUM(base)+SUM(tax)-SUM(discount),2) AS total'),
|
||||||
DB::raw('0 AS payments'),
|
DB::raw('false AS payments'),
|
||||||
DB::raw('0 AS payment_fees'),
|
DB::raw('false AS payment_fees'),
|
||||||
])
|
])
|
||||||
->from($this->query_invoice_items(),'II')
|
->from($this->query_invoice_items(),'II')
|
||||||
->join('invoices',['invoices.id'=>'II.invoice_id'])
|
->join('invoices',['invoices.id'=>'II.invoice_id'])
|
||||||
->whereIN('account_id',$this->accounts->pluck('id'))
|
->whereIN('account_id',$this->accounts->pluck('id'))
|
||||||
->where('invoices.active',TRUE)
|
->where('invoices.active',TRUE)
|
||||||
->groupBy(['invoice_id','base','tax','discount']);
|
->groupBy(['invoice_id']);
|
||||||
|
|
||||||
$payments = (new Payment)
|
$payments = (new Payment)
|
||||||
->select([
|
->select([
|
||||||
'invoice_id',
|
'invoice_id',
|
||||||
DB::raw('0 AS discount'),
|
DB::raw('false AS discount'),
|
||||||
DB::raw('0 AS base'),
|
DB::raw('false AS base'),
|
||||||
DB::raw('0 AS tax'),
|
DB::raw('false AS tax'),
|
||||||
DB::raw('0 AS total'),
|
DB::raw('false AS total'),
|
||||||
DB::raw('SUM(allocate) AS payments'),
|
DB::raw('SUM(allocate) AS payments'),
|
||||||
DB::raw('SUM(fees_amt) AS payment_fees'),
|
DB::raw('SUM(fees_amt) AS payment_fees'),
|
||||||
])
|
])
|
||||||
@ -442,12 +442,11 @@ class User extends Authenticatable implements IDs
|
|||||||
'invoice_total',
|
'invoice_total',
|
||||||
'payments',
|
'payments',
|
||||||
'payment_fees',
|
'payment_fees',
|
||||||
DB::raw('invoice_total-payments AS balance'),
|
DB::raw('ROUND(invoice_total-payments,2) AS balance'),
|
||||||
])
|
])
|
||||||
->join('invoices',['invoices.id'=>'invoice_id'])
|
->join('invoices',['invoices.id'=>'invoice_id'])
|
||||||
->with(['items.taxes'])
|
->with(['items.taxes'])
|
||||||
->from($summary,'summary')
|
->from($summary,'summary');
|
||||||
->groupBy(['id','account_id','discount','invoice_base','invoice_tax','invoice_total','payments','payment_fees']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<div class="error-page">
|
<div class="error-page">
|
||||||
<h2 class="headline text-red">500</h2>
|
<h2 class="headline text-red">500</h2>
|
||||||
<div class="error-content">
|
<div class="error-content">
|
||||||
<h3><i class="fa fa-warning text-red pt-4"></i> Oops!</h3>
|
<h3><i class="fa fa-warning text-red pt-4"></i> Oops! {{ $exception->getMessage() }}</h3>
|
||||||
<p>
|
<p>
|
||||||
{{ trans('adminlte_lang::message.wewillwork') }}
|
{{ trans('adminlte_lang::message.wewillwork') }}
|
||||||
{{ trans('adminlte_lang::message.mainwhile') }} <a href='{{ url('/home') }}'>{{ trans('adminlte_lang::message.returndashboard') }}</a>.
|
{{ trans('adminlte_lang::message.mainwhile') }} <a href='{{ url('/home') }}'>{{ trans('adminlte_lang::message.returndashboard') }}</a>.
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@if($o->query_invoice_summary()->havingRaw('invoice_total-payments > 0')->count())
|
@if($o->query_invoice_summary()->having('balance','>',0)->count())
|
||||||
<table class="table table-bordered w-100" id="reseller_invoices_due">
|
<table class="table table-bordered w-100" id="reseller_invoices_due">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -21,7 +21,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach ($o->query_invoice_summary()->havingRaw('invoice_total-payments > 0')->get() as $oo)
|
@foreach ($o->query_invoice_summary()->having('balance','>',0)->get() as $oo)
|
||||||
<tr @if ($oo->due_at->isPast()) class="table-danger" @endif>
|
<tr @if ($oo->due_at->isPast()) class="table-danger" @endif>
|
||||||
<td>{{ $oo->account->name }}</td>
|
<td>{{ $oo->account->name }}</td>
|
||||||
<td><a href="{{ url('u/invoice',$oo->id) }}">{{ $oo->sid }}</a></td>
|
<td><a href="{{ url('u/invoice',$oo->id) }}">{{ $oo->sid }}</a></td>
|
||||||
|
Loading…
Reference in New Issue
Block a user