mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Bug fixes
This commit is contained in:
parent
c9b7f79d7c
commit
3688669963
@ -86,7 +86,7 @@ class AccountController extends \BaseController {
|
||||
'account' => Account::with('users')->findOrFail(Auth::user()->account_id),
|
||||
'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
|
||||
'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(),
|
||||
'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(),
|
||||
'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
|
||||
'timezones' => Timezone::remember(DEFAULT_QUERY_CACHE)->orderBy('location')->get(),
|
||||
'dateFormats' => DateFormat::remember(DEFAULT_QUERY_CACHE)->get(),
|
||||
'datetimeFormats' => DatetimeFormat::remember(DEFAULT_QUERY_CACHE)->get(),
|
||||
|
@ -154,7 +154,7 @@ class ClientController extends \BaseController {
|
||||
return [
|
||||
'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(),
|
||||
'paymentTerms' => PaymentTerm::remember(DEFAULT_QUERY_CACHE)->orderBy('num_days')->get(['name', 'num_days']),
|
||||
'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(),
|
||||
'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
|
||||
'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
|
||||
'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
|
||||
'customLabel1' => Auth::user()->account->custom_client_label1,
|
||||
|
@ -241,7 +241,7 @@ class InvoiceController extends \BaseController {
|
||||
'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
|
||||
'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(),
|
||||
'paymentTerms' => PaymentTerm::remember(DEFAULT_QUERY_CACHE)->orderBy('num_days')->get(['name', 'num_days']),
|
||||
'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(),
|
||||
'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
|
||||
'invoiceDesigns' => InvoiceDesign::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(),
|
||||
'invoiceLabels' => Auth::user()->account->getInvoiceLabels(),
|
||||
'frequencies' => array(
|
||||
|
@ -94,7 +94,7 @@ class QuoteController extends \BaseController {
|
||||
'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
|
||||
'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(),
|
||||
'paymentTerms' => PaymentTerm::remember(DEFAULT_QUERY_CACHE)->orderBy('num_days')->get(['name', 'num_days']),
|
||||
'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(),
|
||||
'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
|
||||
'invoiceDesigns' => InvoiceDesign::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(),
|
||||
'invoiceLabels' => Auth::user()->account->getInvoiceLabels()
|
||||
];
|
||||
|
@ -105,6 +105,7 @@ class ConstantsSeeder extends Seeder
|
||||
Industry::create(array('name' => 'Transportation'));
|
||||
Industry::create(array('name' => 'Travel & Luxury'));
|
||||
Industry::create(array('name' => 'Other'));
|
||||
Industry::create(array('name' => 'Photography'));
|
||||
|
||||
Size::create(array('name' => '1 - 3'));
|
||||
Size::create(array('name' => '4 - 10'));
|
||||
@ -119,6 +120,7 @@ class ConstantsSeeder extends Seeder
|
||||
PaymentTerm::create(array('num_days' => 15, 'name' => 'Net 15'));
|
||||
PaymentTerm::create(array('num_days' => 30, 'name' => 'Net 30'));
|
||||
PaymentTerm::create(array('num_days' => 60, 'name' => 'Net 60'));
|
||||
PaymentTerm::create(array('num_days' => 90, 'name' => 'Net 90'));
|
||||
|
||||
Currency::create(array('name' => 'US Dollar', 'code' => 'USD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
|
||||
Currency::create(array('name' => 'Pound Sterling', 'code' => 'GBP', 'symbol' => '£', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
|
||||
|
@ -251,7 +251,8 @@ class InvoiceRepository
|
||||
}
|
||||
|
||||
$lineTotal = $invoiceItemCost * $invoiceItemQty;
|
||||
$total += $lineTotal + ($lineTotal * $invoiceItemTaxRate / 100);
|
||||
|
||||
$total += round($lineTotal + ($lineTotal * $invoiceItemTaxRate / 100), 2);
|
||||
}
|
||||
|
||||
if ($invoice->discount > 0)
|
||||
@ -260,6 +261,7 @@ class InvoiceRepository
|
||||
}
|
||||
|
||||
$total += $total * $invoice->tax_rate / 100;
|
||||
$total = round($total, 2);
|
||||
|
||||
if ($publicId)
|
||||
{
|
||||
|
@ -1106,7 +1106,7 @@
|
||||
});
|
||||
|
||||
this.totals.rawDiscounted = ko.computed(function() {
|
||||
return self.totals.rawSubtotal() * (self.discount()/100);
|
||||
return roundToTwo(self.totals.rawSubtotal() * (self.discount()/100));
|
||||
});
|
||||
|
||||
this.totals.discounted = ko.computed(function() {
|
||||
@ -1118,12 +1118,12 @@
|
||||
|
||||
var discount = parseFloat(self.discount());
|
||||
if (discount > 0) {
|
||||
total = total * ((100 - discount)/100);
|
||||
total = roundToTwo(total * ((100 - discount)/100));
|
||||
}
|
||||
|
||||
var taxRate = parseFloat(self.tax_rate());
|
||||
if (taxRate > 0) {
|
||||
var tax = total * (taxRate/100);
|
||||
var tax = roundToTwo(total * (taxRate/100));
|
||||
return formatMoney(tax, self.client().currency_id());
|
||||
} else {
|
||||
return formatMoney(0);
|
||||
@ -1144,12 +1144,12 @@
|
||||
|
||||
var discount = parseFloat(self.discount());
|
||||
if (discount > 0) {
|
||||
total = total * ((100 - discount)/100);
|
||||
total = roundToTwo(total * ((100 - discount)/100));
|
||||
}
|
||||
|
||||
var taxRate = parseFloat(self.tax_rate());
|
||||
if (taxRate > 0) {
|
||||
total = NINJA.parseFloat(total) + (total * (taxRate/100));
|
||||
total = NINJA.parseFloat(total) + roundToTwo((total * (taxRate/100)));
|
||||
}
|
||||
|
||||
var paid = self.totals.rawPaidToDate();
|
||||
@ -1396,7 +1396,7 @@
|
||||
if (taxRate > 0) {
|
||||
value += value * (taxRate/100);
|
||||
}
|
||||
return value ? value : '';
|
||||
return value ? roundToTwo(value) : '';
|
||||
});
|
||||
|
||||
this.totals.total = ko.computed(function() {
|
||||
|
@ -39195,7 +39195,7 @@ function calculateAmounts(invoice) {
|
||||
|
||||
var lineTotal = NINJA.parseFloat(item.cost) * NINJA.parseFloat(item.qty);
|
||||
if (tax) {
|
||||
lineTotal += lineTotal * tax / 100;
|
||||
lineTotal += roundToTwo(lineTotal * tax / 100);
|
||||
}
|
||||
if (lineTotal) {
|
||||
total += lineTotal;
|
||||
@ -39210,7 +39210,7 @@ function calculateAmounts(invoice) {
|
||||
|
||||
if (invoice.discount > 0) {
|
||||
|
||||
var discount = total * (invoice.discount/100);
|
||||
var discount = roundToTwo(total * (invoice.discount/100));
|
||||
total -= discount;
|
||||
}
|
||||
|
||||
@ -39222,11 +39222,11 @@ function calculateAmounts(invoice) {
|
||||
}
|
||||
|
||||
if (tax) {
|
||||
var tax = total * (tax/100);
|
||||
var tax = roundToTwo(total * (tax/100));
|
||||
total = parseFloat(total) + parseFloat(tax);
|
||||
}
|
||||
|
||||
invoice.balance_amount = accounting.toFixed(total,2) - (accounting.toFixed(invoice.amount,2) - accounting.toFixed(invoice.balance,2));
|
||||
invoice.balance_amount = roundToTwo(total) - roundToTwo(invoice.amount) - roundToTwo(invoice.balance);
|
||||
invoice.tax_amount = tax;
|
||||
invoice.discount_amount = discount;
|
||||
invoice.has_taxes = hasTaxes;
|
||||
@ -39463,3 +39463,6 @@ function toggleDatePicker(field) {
|
||||
$('#'+field).datepicker('show');
|
||||
}
|
||||
|
||||
function roundToTwo(num) {
|
||||
return +(Math.round(num + "e+2") + "e-2");
|
||||
}
|
||||
|
@ -1479,7 +1479,7 @@ function calculateAmounts(invoice) {
|
||||
|
||||
var lineTotal = NINJA.parseFloat(item.cost) * NINJA.parseFloat(item.qty);
|
||||
if (tax) {
|
||||
lineTotal += lineTotal * tax / 100;
|
||||
lineTotal += roundToTwo(lineTotal * tax / 100);
|
||||
}
|
||||
if (lineTotal) {
|
||||
total += lineTotal;
|
||||
@ -1494,7 +1494,7 @@ function calculateAmounts(invoice) {
|
||||
|
||||
if (invoice.discount > 0) {
|
||||
|
||||
var discount = total * (invoice.discount/100);
|
||||
var discount = roundToTwo(total * (invoice.discount/100));
|
||||
total -= discount;
|
||||
}
|
||||
|
||||
@ -1506,11 +1506,11 @@ function calculateAmounts(invoice) {
|
||||
}
|
||||
|
||||
if (tax) {
|
||||
var tax = total * (tax/100);
|
||||
var tax = roundToTwo(total * (tax/100));
|
||||
total = parseFloat(total) + parseFloat(tax);
|
||||
}
|
||||
|
||||
invoice.balance_amount = accounting.toFixed(total,2) - (accounting.toFixed(invoice.amount,2) - accounting.toFixed(invoice.balance,2));
|
||||
invoice.balance_amount = roundToTwo(total) - roundToTwo(invoice.amount) - roundToTwo(invoice.balance);
|
||||
invoice.tax_amount = tax;
|
||||
invoice.discount_amount = discount;
|
||||
invoice.has_taxes = hasTaxes;
|
||||
@ -1747,3 +1747,6 @@ function toggleDatePicker(field) {
|
||||
$('#'+field).datepicker('show');
|
||||
}
|
||||
|
||||
function roundToTwo(num) {
|
||||
return +(Math.round(num + "e+2") + "e-2");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user