show invoice/bill totals sorted
This commit is contained in:
parent
ec07675437
commit
88f64ad4ab
@ -15,6 +15,11 @@ abstract class DocumentModel extends Model
|
|||||||
{
|
{
|
||||||
use Cloneable, Currencies, DateTime, Media, Recurring;
|
use Cloneable, Currencies, DateTime, Media, Recurring;
|
||||||
|
|
||||||
|
public function totals_sorted()
|
||||||
|
{
|
||||||
|
return $this->totals()->orderBy('sort_order');
|
||||||
|
}
|
||||||
|
|
||||||
public function scopeDue($query, $date)
|
public function scopeDue($query, $date)
|
||||||
{
|
{
|
||||||
return $query->whereDate('due_at', '=', $date);
|
return $query->whereDate('due_at', '=', $date);
|
||||||
|
@ -74,7 +74,7 @@ class Bills extends Controller
|
|||||||
$date_format = $this->getCompanyDateFormat();
|
$date_format = $this->getCompanyDateFormat();
|
||||||
|
|
||||||
// Get Bill Totals
|
// Get Bill Totals
|
||||||
foreach ($bill->totals as $bill_total) {
|
foreach ($bill->totals_sorted as $bill_total) {
|
||||||
$bill->{$bill_total->code} = $bill_total->amount;
|
$bill->{$bill_total->code} = $bill_total->amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ class Invoices extends Controller
|
|||||||
$date_format = $this->getCompanyDateFormat();
|
$date_format = $this->getCompanyDateFormat();
|
||||||
|
|
||||||
// Get Invoice Totals
|
// Get Invoice Totals
|
||||||
foreach ($invoice->totals as $invoice_total) {
|
foreach ($invoice->totals_sorted as $invoice_total) {
|
||||||
$invoice->{$invoice_total->code} = $invoice_total->amount;
|
$invoice->{$invoice_total->code} = $invoice_total->amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@
|
|||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach ($invoice->totals as $total)
|
@foreach ($invoice->totals_sorted as $total)
|
||||||
@if ($total->code != 'total')
|
@if ($total->code != 'total')
|
||||||
@stack($total->code . '_td_start')
|
@stack($total->code . '_td_start')
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -184,7 +184,7 @@
|
|||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach($invoice->totals as $total)
|
@foreach($invoice->totals_sorted as $total)
|
||||||
@if($total->code != 'total')
|
@if($total->code != 'total')
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ trans($total['name']) }}:</th>
|
<th>{{ trans($total['name']) }}:</th>
|
||||||
|
@ -173,7 +173,7 @@
|
|||||||
|
|
||||||
<div class="col-42">
|
<div class="col-42">
|
||||||
<div class="text company pr-2">
|
<div class="text company pr-2">
|
||||||
@foreach ($bill->totals as $total)
|
@foreach ($bill->totals_sorted as $total)
|
||||||
@if ($total->code != 'total')
|
@if ($total->code != 'total')
|
||||||
@stack($total->code . '_td_start')
|
@stack($total->code . '_td_start')
|
||||||
<div class="border-top-1 py-2">
|
<div class="border-top-1 py-2">
|
||||||
|
@ -410,7 +410,7 @@
|
|||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach ($bill->totals as $total)
|
@foreach ($bill->totals_sorted as $total)
|
||||||
@if ($total->code != 'total')
|
@if ($total->code != 'total')
|
||||||
@stack($total->code . '_td_start')
|
@stack($total->code . '_td_start')
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -111,7 +111,7 @@
|
|||||||
<span class="float-right">@date($invoice->due_at)</span><br><br>
|
<span class="float-right">@date($invoice->due_at)</span><br><br>
|
||||||
@stack('due_at_input_end')
|
@stack('due_at_input_end')
|
||||||
|
|
||||||
@foreach ($invoice->totals as $total)
|
@foreach ($invoice->totals_sorted as $total)
|
||||||
@if ($total->code == 'total')
|
@if ($total->code == 'total')
|
||||||
<strong>{{ trans($total->name) }}:</strong>
|
<strong>{{ trans($total->name) }}:</strong>
|
||||||
<span class="float-right">@money($total->amount - $invoice->paid, $invoice->currency_code, true)</span><br><br>
|
<span class="float-right">@money($total->amount - $invoice->paid, $invoice->currency_code, true)</span><br><br>
|
||||||
@ -189,7 +189,7 @@
|
|||||||
|
|
||||||
<div class="col-42 float-right text-right">
|
<div class="col-42 float-right text-right">
|
||||||
<div class="text company pr-2">
|
<div class="text company pr-2">
|
||||||
@foreach ($invoice->totals as $total)
|
@foreach ($invoice->totals_sorted as $total)
|
||||||
@if ($total->code != 'total')
|
@if ($total->code != 'total')
|
||||||
@stack($total->code . '_td_start')
|
@stack($total->code . '_td_start')
|
||||||
<div class="border-top-dashed py-2">
|
<div class="border-top-dashed py-2">
|
||||||
|
@ -177,7 +177,7 @@
|
|||||||
|
|
||||||
<div class="col-42 float-right text-right">
|
<div class="col-42 float-right text-right">
|
||||||
<div class="text company">
|
<div class="text company">
|
||||||
@foreach ($invoice->totals as $total)
|
@foreach ($invoice->totals_sorted as $total)
|
||||||
@if ($total->code != 'total')
|
@if ($total->code != 'total')
|
||||||
@stack($total->code . '_td_start')
|
@stack($total->code . '_td_start')
|
||||||
<div class="border-top-1 py-2">
|
<div class="border-top-1 py-2">
|
||||||
|
@ -158,7 +158,7 @@
|
|||||||
|
|
||||||
<div class="col-42 float-right text-right">
|
<div class="col-42 float-right text-right">
|
||||||
<div class="text company pr-2">
|
<div class="text company pr-2">
|
||||||
@foreach ($invoice->totals as $total)
|
@foreach ($invoice->totals_sorted as $total)
|
||||||
@if ($total->code != 'total')
|
@if ($total->code != 'total')
|
||||||
@stack($total->code . '_td_start')
|
@stack($total->code . '_td_start')
|
||||||
<strong class="float-left">{{ trans($total->title) }}:</strong>
|
<strong class="float-left">{{ trans($total->title) }}:</strong>
|
||||||
|
@ -427,7 +427,7 @@
|
|||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach ($invoice->totals as $total)
|
@foreach ($invoice->totals_sorted as $total)
|
||||||
@if ($total->code != 'total')
|
@if ($total->code != 'total')
|
||||||
@stack($total->code . '_td_start')
|
@stack($total->code . '_td_start')
|
||||||
<tr>
|
<tr>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user