From a5e08b3ab43f19e096adde4f3e6e7720409901e0 Mon Sep 17 00:00:00 2001 From: ridgarou Date: Fri, 22 Jan 2016 01:07:24 +0100 Subject: [PATCH 1/2] Update knockout.blade.php Contabilizar correctamente Impuestos Negativos en el total de la Factura --- resources/views/invoices/knockout.blade.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/resources/views/invoices/knockout.blade.php b/resources/views/invoices/knockout.blade.php index 24138c1af378..d9aec7fea5be 100644 --- a/resources/views/invoices/knockout.blade.php +++ b/resources/views/invoices/knockout.blade.php @@ -388,12 +388,14 @@ function InvoiceModel(data) { } var taxRate = parseFloat(self.tax_rate()); - if (taxRate > 0) { - var tax = roundToTwo(total * (taxRate/100)); - return self.formatMoney(tax); - } else { - return self.formatMoney(0); - } + //if (taxRate > 0) { + // var tax = roundToTwo(total * (taxRate/100)); + // return self.formatMoney(tax); + //} else { + // return self.formatMoney(0); + //} + var tax = roundToTwo(total * (taxRate/100)); + return self.formatMoney(tax); }); self.totals.itemTaxes = ko.computed(function() { @@ -482,9 +484,10 @@ function InvoiceModel(data) { } var taxRate = parseFloat(self.tax_rate()); - if (taxRate > 0) { - total = NINJA.parseFloat(total) + roundToTwo((total * (taxRate/100))); - } + //if (taxRate > 0) { + // total = NINJA.parseFloat(total) + roundToTwo((total * (taxRate/100))); + //} + total = NINJA.parseFloat(total) + roundToTwo((total * (taxRate/100))); var taxes = self.totals.itemTaxes(); for (var key in taxes) { From 91187eb06d14df91e5a09c015b0025e0a8d6e51f Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sat, 23 Jan 2016 20:36:11 +0200 Subject: [PATCH 2/2] Bug fixes --- app/Models/Account.php | 2 +- app/Services/ExpenseService.php | 1 + .../migrations/2016_01_04_175228_create_vendors_table.php | 5 ++--- database/seeds/PaymentLibrariesSeeder.php | 1 + resources/lang/en/texts.php | 2 +- resources/views/expenses/edit.blade.php | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/Models/Account.php b/app/Models/Account.php index 08c10017c0a0..9af3350dd094 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -26,7 +26,7 @@ class Account extends Eloquent ACCOUNT_USER_DETAILS, ACCOUNT_LOCALIZATION, ACCOUNT_PAYMENTS, - ACCOUNT_BANKS, + //ACCOUNT_BANKS, ACCOUNT_TAX_RATES, ACCOUNT_PRODUCTS, ACCOUNT_NOTIFICATIONS, diff --git a/app/Services/ExpenseService.php b/app/Services/ExpenseService.php index 92a2a048c14f..4680bfc0fedd 100644 --- a/app/Services/ExpenseService.php +++ b/app/Services/ExpenseService.php @@ -69,6 +69,7 @@ class ExpenseService extends BaseService [ 'amount', function ($model) { + // show both the amount and the converted amount $str = Utils::formatMoney($model->amount, $model->account_currency_id, $model->account_country_id, true); if ($model->exchange_rate != 1) { $str .= ' | ' . Utils::formatMoney(round($model->amount * $model->exchange_rate,2), $model->currency_id, $model->client_country_id, true); diff --git a/database/migrations/2016_01_04_175228_create_vendors_table.php b/database/migrations/2016_01_04_175228_create_vendors_table.php index 252463266214..b1e3f7b4e8c4 100644 --- a/database/migrations/2016_01_04_175228_create_vendors_table.php +++ b/database/migrations/2016_01_04_175228_create_vendors_table.php @@ -96,12 +96,11 @@ class CreateVendorsTable extends Migration $table->softDeletes(); $table->unsignedInteger('user_id'); $table->unsignedInteger('account_id'); + $table->unsignedInteger('public_id')->index(); //$table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); //$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - - $table->unsignedInteger('public_id')->index(); - $table->unique(array('account_id', 'public_id')); + //$table->unique(array('account_id', 'public_id')); }); // Update public id diff --git a/database/seeds/PaymentLibrariesSeeder.php b/database/seeds/PaymentLibrariesSeeder.php index b34d7182492e..7fd66881ba05 100644 --- a/database/seeds/PaymentLibrariesSeeder.php +++ b/database/seeds/PaymentLibrariesSeeder.php @@ -125,6 +125,7 @@ class PaymentLibrariesSeeder extends Seeder ['name' => 'Ghanaian Cedi', 'code' => 'GHS', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Bulgarian Lev', 'code' => 'BGN', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ' ', 'decimal_separator' => '.'], ['name' => 'Aruban Florin', 'code' => 'AWG', 'symbol' => 'Afl. ', 'precision' => '2', 'thousand_separator' => ' ', 'decimal_separator' => '.'], + ['name' => 'Turkish Lira', 'code' => 'TRY', 'symbol' => 'TL ', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ]; foreach ($currencies as $currency) { diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index b2d035a0c4d2..be6ce2cc9d4b 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -1037,7 +1037,7 @@ return array( 'expense_date' => 'Expense Date', 'expense_should_be_invoiced' => 'Should this expense be invoiced?', 'public_notes' => 'Public Notes', - 'converted_amount' => 'Converted Amount', + 'invoice_amount' => 'Invoice Amount', 'exchange_rate' => 'Exchange Rate', 'yes' => 'Yes', 'no' => 'No', diff --git a/resources/views/expenses/edit.blade.php b/resources/views/expenses/edit.blade.php index 8071c0b44ef6..949e9b73ebe4 100644 --- a/resources/views/expenses/edit.blade.php +++ b/resources/views/expenses/edit.blade.php @@ -68,7 +68,7 @@ {!! Former::text('exchange_rate') ->data_bind("value: exchange_rate, enable: enableExchangeRate, valueUpdate: 'afterkeydown'") !!} - {!! Former::text('converted_amount') + {!! Former::text('invoice_amount') ->addGroupClass('converted-amount') ->data_bind("value: convertedAmount, enable: enableExchangeRate") ->append('') !!}