Skip to content

Commit

Permalink
invoice and bill item price issue solved
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Sep 1, 2018
1 parent 4e2c428 commit e1b5f59
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 4 deletions.
4 changes: 4 additions & 0 deletions app/Http/Middleware/Money.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public function handle($request, Closure $next)
if (isset($bill_number) || isset($invoice_number) || !empty($items)) {
if (!empty($items)) {
foreach ($items as $key => $item) {
if (!isset($item['price'])) {
continue;
}

if (isset($item['currency']) && $item['currency'] != $currency_code) {
$items[$key]['price'] = money($item['price'], $item['currency'])->getAmount();
} else {
Expand Down
18 changes: 17 additions & 1 deletion resources/views/expenses/bills/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,24 @@
totalItem();
});
var focus = false;
$(document).on('focusin', '#items .input-price', function(){
focus = true;
});
$(document).on('blur', '#items .input-price', function(){
if (focus) {
totalItem();
focus = false;
}
});
$(document).on('keyup', '#items tbody .form-control', function(){
totalItem();
if (!$(this).hasClass('input-price')) {
totalItem();
}
});
$(document).on('change', '#vendor_id', function (e) {
Expand Down
18 changes: 17 additions & 1 deletion resources/views/expenses/bills/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,24 @@
totalItem();
});
var focus = false;
$(document).on('focusin', '#items .input-price', function(){
focus = true;
});
$(document).on('blur', '#items .input-price', function(){
if (focus) {
totalItem();
focus = false;
}
});
$(document).on('keyup', '#items tbody .form-control', function(){
totalItem();
if (!$(this).hasClass('input-price')) {
totalItem();
}
});
$(document).on('change', '#vendor_id', function (e) {
Expand Down
18 changes: 17 additions & 1 deletion resources/views/incomes/invoices/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,24 @@
totalItem();
});
var focus = false;
$(document).on('focusin', '#items .input-price', function(){
focus = true;
});
$(document).on('blur', '#items .input-price', function(){
if (focus) {
totalItem();
focus = false;
}
});
$(document).on('keyup', '#items tbody .form-control', function(){
totalItem();
if (!$(this).hasClass('input-price')) {
totalItem();
}
});
$(document).on('change', '#customer_id', function (e) {
Expand Down
18 changes: 17 additions & 1 deletion resources/views/incomes/invoices/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,24 @@
totalItem();
});
var focus = false;
$(document).on('focusin', '#items .input-price', function(){
focus = true;
});
$(document).on('blur', '#items .input-price', function(){
if (focus) {
totalItem();
focus = false;
}
});
$(document).on('keyup', '#items tbody .form-control', function(){
totalItem();
if (!$(this).hasClass('input-price')) {
totalItem();
}
});
$(document).on('change', '#customer_id', function (e) {
Expand Down

0 comments on commit e1b5f59

Please sign in to comment.