Skip to content

Commit

Permalink
show invoice/bill totals sorted
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Apr 18, 2020
1 parent ec07675 commit 88f64ad
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 11 deletions.
5 changes: 5 additions & 0 deletions app/Abstracts/DocumentModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ abstract class DocumentModel extends Model
{
use Cloneable, Currencies, DateTime, Media, Recurring;

public function totals_sorted()
{
return $this->totals()->orderBy('sort_order');
}

public function scopeDue($query, $date)
{
return $query->whereDate('due_at', '=', $date);
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Purchases/Bills.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function show(Bill $bill)
$date_format = $this->getCompanyDateFormat();

// Get Bill Totals
foreach ($bill->totals as $bill_total) {
foreach ($bill->totals_sorted as $bill_total) {
$bill->{$bill_total->code} = $bill_total->amount;
}

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Sales/Invoices.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function show(Invoice $invoice)
$date_format = $this->getCompanyDateFormat();

// Get Invoice Totals
foreach ($invoice->totals as $invoice_total) {
foreach ($invoice->totals_sorted as $invoice_total) {
$invoice->{$invoice_total->code} = $invoice_total->amount;
}

Expand Down
2 changes: 1 addition & 1 deletion resources/views/portal/invoices/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
<div class="table-responsive">
<table class="table">
<tbody>
@foreach ($invoice->totals as $total)
@foreach ($invoice->totals_sorted as $total)
@if ($total->code != 'total')
@stack($total->code . '_td_start')
<tr>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/portal/invoices/signed.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
<div class="table-responsive">
<table class="table">
<tbody>
@foreach($invoice->totals as $total)
@foreach($invoice->totals_sorted as $total)
@if($total->code != 'total')
<tr>
<th>{{ trans($total['name']) }}:</th>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/purchases/bills/print.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@

<div class="col-42">
<div class="text company pr-2">
@foreach ($bill->totals as $total)
@foreach ($bill->totals_sorted as $total)
@if ($total->code != 'total')
@stack($total->code . '_td_start')
<div class="border-top-1 py-2">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/purchases/bills/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@
<div class="table-responsive">
<table class="table">
<tbody>
@foreach ($bill->totals as $total)
@foreach ($bill->totals_sorted as $total)
@if ($total->code != 'total')
@stack($total->code . '_td_start')
<tr>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/sales/invoices/print_classic.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<span class="float-right">@date($invoice->due_at)</span><br><br>
@stack('due_at_input_end')

@foreach ($invoice->totals as $total)
@foreach ($invoice->totals_sorted as $total)
@if ($total->code == 'total')
<strong>{{ trans($total->name) }}:</strong>
<span class="float-right">@money($total->amount - $invoice->paid, $invoice->currency_code, true)</span><br><br>
Expand Down Expand Up @@ -189,7 +189,7 @@

<div class="col-42 float-right text-right">
<div class="text company pr-2">
@foreach ($invoice->totals as $total)
@foreach ($invoice->totals_sorted as $total)
@if ($total->code != 'total')
@stack($total->code . '_td_start')
<div class="border-top-dashed py-2">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/sales/invoices/print_default.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@

<div class="col-42 float-right text-right">
<div class="text company">
@foreach ($invoice->totals as $total)
@foreach ($invoice->totals_sorted as $total)
@if ($total->code != 'total')
@stack($total->code . '_td_start')
<div class="border-top-1 py-2">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/sales/invoices/print_modern.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@

<div class="col-42 float-right text-right">
<div class="text company pr-2">
@foreach ($invoice->totals as $total)
@foreach ($invoice->totals_sorted as $total)
@if ($total->code != 'total')
@stack($total->code . '_td_start')
<strong class="float-left">{{ trans($total->title) }}:</strong>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/sales/invoices/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@
<div class="table-responsive">
<table class="table">
<tbody>
@foreach ($invoice->totals as $total)
@foreach ($invoice->totals_sorted as $total)
@if ($total->code != 'total')
@stack($total->code . '_td_start')
<tr>
Expand Down

0 comments on commit 88f64ad

Please sign in to comment.