refs #451 Banking -> Account currency issue solved
This commit is contained in:
parent
e9d6cecf14
commit
e83eade56a
@ -270,16 +270,15 @@ class Currencies extends Controller
|
|||||||
{
|
{
|
||||||
$json = new \stdClass();
|
$json = new \stdClass();
|
||||||
|
|
||||||
$account_id = request('account_id');
|
$code = request('code');
|
||||||
|
|
||||||
if ($account_id) {
|
// Get currency object
|
||||||
$currencies = Currency::enabled()->pluck('name', 'code')->toArray();
|
$currency = Currency::where('code', $code)->first();
|
||||||
|
|
||||||
$json->currency_code = Account::where('id', $account_id)->pluck('currency_code')->first();
|
// it should be integer for amount mask
|
||||||
$json->currency_name = $currencies[$json->currency_code];
|
$currency->precision = (int) $currency->precision;
|
||||||
}
|
|
||||||
|
|
||||||
return response()->json($json);
|
return response()->json($currency);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function config()
|
public function config()
|
||||||
@ -288,9 +287,13 @@ class Currencies extends Controller
|
|||||||
|
|
||||||
$code = request('code');
|
$code = request('code');
|
||||||
|
|
||||||
// Get currency object
|
if ($code) {
|
||||||
$currency = Currency::where('code', $code)->first();
|
$currency = config('money.' . $code);
|
||||||
|
$currency['symbol_first'] = $currency['symbol_first'] ? 1 : 0;
|
||||||
|
|
||||||
return response()->json($currency);
|
$json = (object) $currency;
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json($json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,8 @@
|
|||||||
|
|
||||||
opening_balance = $('#opening_balance').maskMoney('unmasked')[0];
|
opening_balance = $('#opening_balance').maskMoney('unmasked')[0];
|
||||||
|
|
||||||
|
alert(opening_balance);
|
||||||
|
|
||||||
$("#opening_balance").maskMoney({
|
$("#opening_balance").maskMoney({
|
||||||
thousands : data.thousands_separator,
|
thousands : data.thousands_separator,
|
||||||
decimal : data.decimal_mark,
|
decimal : data.decimal_mark,
|
||||||
@ -91,7 +93,7 @@
|
|||||||
|
|
||||||
$('#opening_balance').val(opening_balance);
|
$('#opening_balance').val(opening_balance);
|
||||||
|
|
||||||
$('#opening_balance').trigger('focus');
|
$('#opening_balance').trigger('focusout');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -93,7 +93,7 @@
|
|||||||
|
|
||||||
$('#opening_balance').val(opening_balance);
|
$('#opening_balance').val(opening_balance);
|
||||||
|
|
||||||
$('#opening_balance').trigger('focus');
|
$('#opening_balance').trigger('focusout');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user