Merge pull request #1161 from burakcakirel/show-grand-total-for-bills-invoices
Show grand total for bills/invoices
This commit is contained in:
commit
5aef495563
@ -13,6 +13,7 @@ use App\Jobs\Purchase\DeleteBill;
|
||||
use App\Jobs\Purchase\DuplicateBill;
|
||||
use App\Jobs\Purchase\UpdateBill;
|
||||
use App\Models\Banking\Account;
|
||||
use App\Models\Banking\Transaction;
|
||||
use App\Models\Common\Contact;
|
||||
use App\Models\Common\Item;
|
||||
use App\Models\Purchase\Bill;
|
||||
@ -73,6 +74,19 @@ class Bills extends Controller
|
||||
|
||||
$date_format = $this->getCompanyDateFormat();
|
||||
|
||||
// Get Bill Totals
|
||||
foreach ($bill->totals as $bill_total) {
|
||||
$bill->{$bill_total->code} = $bill_total->amount;
|
||||
}
|
||||
|
||||
$total = money($bill->total, $currency->code, true)->format();
|
||||
|
||||
$bill->grand_total = money($total, $currency->code)->getAmount();
|
||||
|
||||
if (!empty($bill->paid)) {
|
||||
$bill->grand_total = round($bill->total - $bill->paid, $currency->precision) ;
|
||||
}
|
||||
|
||||
return view('purchases.bills.show', compact('bill', 'accounts', 'currencies', 'currency', 'account_currency_code', 'vendors', 'categories', 'payment_methods', 'date_format'));
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ use App\Jobs\Sale\DeleteInvoice;
|
||||
use App\Jobs\Sale\DuplicateInvoice;
|
||||
use App\Jobs\Sale\UpdateInvoice;
|
||||
use App\Models\Banking\Account;
|
||||
use App\Models\Banking\Transaction;
|
||||
use App\Models\Common\Contact;
|
||||
use App\Models\Common\Item;
|
||||
use App\Models\Sale\Invoice;
|
||||
@ -77,6 +78,19 @@ class Invoices extends Controller
|
||||
|
||||
$date_format = $this->getCompanyDateFormat();
|
||||
|
||||
// Get Invoice Totals
|
||||
foreach ($invoice->totals as $invoice_total) {
|
||||
$invoice->{$invoice_total->code} = $invoice_total->amount;
|
||||
}
|
||||
|
||||
$total = money($invoice->total, $currency->code, true)->format();
|
||||
|
||||
$invoice->grand_total = money($total, $currency->code)->getAmount();
|
||||
|
||||
if (!empty($invoice->paid)) {
|
||||
$invoice->grand_total = round($invoice->total - $invoice->paid, $currency->precision);
|
||||
}
|
||||
|
||||
return view('sales.invoices.show', compact('invoice', 'accounts', 'currencies', 'currency', 'account_currency_code', 'customers', 'categories', 'payment_methods', 'signed_url', 'date_format'));
|
||||
}
|
||||
|
||||
|
1
resources/assets/js/views/purchases/bills.js
vendored
1
resources/assets/js/views/purchases/bills.js
vendored
@ -206,7 +206,6 @@ const app = new Vue({
|
||||
this.transaction_form.paid_at = form.paid_at;
|
||||
this.transaction_form.account_id = form.account_id;
|
||||
this.transaction_form.payment_method = form.payment_method;
|
||||
this.transaction_form.amount = form.amount;
|
||||
},
|
||||
|
||||
addPayment() {
|
||||
|
1
resources/assets/js/views/sales/invoices.js
vendored
1
resources/assets/js/views/sales/invoices.js
vendored
@ -206,7 +206,6 @@ const app = new Vue({
|
||||
this.transaction_form.paid_at = form.paid_at;
|
||||
this.transaction_form.account_id = form.account_id;
|
||||
this.transaction_form.payment_method = form.payment_method;
|
||||
this.transaction_form.amount = form.amount;
|
||||
},
|
||||
|
||||
addPayment() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user