Added Swiss Franc

This commit is contained in:
Hillel Coren 2015-02-18 14:59:25 +02:00
parent ffebf2eb26
commit c1bc3f5a3f
4 changed files with 46 additions and 44 deletions

View File

@ -138,6 +138,8 @@ class ConstantsSeeder extends Seeder
Currency::create(array('name' => 'Norske Kroner', 'code' => 'NOK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
Currency::create(array('name' => 'New Zealand Dollar', 'code' => 'NZD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
Currency::create(array('name' => 'Vietnamese Dong', 'code' => 'VND', 'symbol' => 'VND ', 'precision' => '0', 'thousand_separator' => ',', 'decimal_separator' => '.'));
Currency::create(array('name' => 'Swiss Franc', 'code' => 'CHF', 'symbol' => 'CHF ', 'precision' => '2', 'thousand_separator' => '\'', 'decimal_separator' => '.'));
DatetimeFormat::create(array('format' => 'd/M/Y g:i a', 'label' => '10/Mar/2013'));
DatetimeFormat::create(array('format' => 'd-M-Yk g:i a', 'label' => '10-Mar-2013'));

View File

@ -1201,60 +1201,60 @@
});
this.totals.total = ko.computed(function() {
var total = accounting.toFixed(self.totals.rawSubtotal(),2);
var discount = self.totals.rawDiscounted();
total -= discount;
var total = accounting.toFixed(self.totals.rawSubtotal(),2);
var discount = self.totals.rawDiscounted();
total -= discount;
/*
var discount = parseFloat(self.discount());
if (discount > 0) {
total = roundToTwo(total * ((100 - discount)/100));
}
*/
/*
var discount = parseFloat(self.discount());
if (discount > 0) {
total = roundToTwo(total * ((100 - discount)/100));
}
*/
var customValue1 = roundToTwo(self.custom_value1());
var customValue2 = roundToTwo(self.custom_value2());
var customTaxes1 = self.custom_taxes1() == 1;
var customTaxes2 = self.custom_taxes2() == 1;
var customValue1 = roundToTwo(self.custom_value1());
var customValue2 = roundToTwo(self.custom_value2());
var customTaxes1 = self.custom_taxes1() == 1;
var customTaxes2 = self.custom_taxes2() == 1;
if (customValue1 && customTaxes1) {
total = NINJA.parseFloat(total) + customValue1;
}
if (customValue2 && customTaxes2) {
total = NINJA.parseFloat(total) + customValue2;
}
if (customValue1 && customTaxes1) {
total = NINJA.parseFloat(total) + customValue1;
}
if (customValue2 && customTaxes2) {
total = NINJA.parseFloat(total) + customValue2;
}
var taxRate = parseFloat(self.tax_rate());
if (taxRate > 0) {
total = NINJA.parseFloat(total) + roundToTwo((total * (taxRate/100)));
}
var taxRate = parseFloat(self.tax_rate());
if (taxRate > 0) {
total = NINJA.parseFloat(total) + roundToTwo((total * (taxRate/100)));
}
if (customValue1 && !customTaxes1) {
total = NINJA.parseFloat(total) + customValue1;
}
if (customValue2 && !customTaxes2) {
total = NINJA.parseFloat(total) + customValue2;
}
if (customValue1 && !customTaxes1) {
total = NINJA.parseFloat(total) + customValue1;
}
if (customValue2 && !customTaxes2) {
total = NINJA.parseFloat(total) + customValue2;
}
var paid = self.totals.rawPaidToDate();
if (paid > 0) {
total -= paid;
}
var paid = self.totals.rawPaidToDate();
if (paid > 0) {
total -= paid;
}
return formatMoney(total, self.client().currency_id());
});
return formatMoney(total, self.client().currency_id());
});
self.onDragged = function(item) {
refreshPDF();
}
self.onDragged = function(item) {
refreshPDF();
}
}
function ClientModel(data) {
var self = this;
self.public_id = ko.observable(0);
self.name = ko.observable('');
self.id_number = ko.observable('');
self.vat_number = ko.observable('');
self.id_number = ko.observable('');
self.vat_number = ko.observable('');
self.work_phone = ko.observable('');
self.custom_value1 = ko.observable('');
self.custom_value2 = ko.observable('');

View File

@ -33024,7 +33024,7 @@ function toggleDatePicker(field) {
function roundToTwo(num, toString) {
var val = +(Math.round(num + "e+2") + "e-2");
return toString ? val.toFixed(2) : val;
return toString ? val.toFixed(2) : val || 0;
}
function truncate(str, length) {

View File

@ -1501,7 +1501,7 @@ function toggleDatePicker(field) {
function roundToTwo(num, toString) {
var val = +(Math.round(num + "e+2") + "e-2");
return toString ? val.toFixed(2) : val;
return toString ? val.toFixed(2) : (val || 0);
}
function truncate(str, length) {