refs #451 Items
This commit is contained in:
@ -365,6 +365,19 @@ class Items extends Controller
|
||||
|
||||
$json->grand_total = money($grand_total, $currency_code, true)->format();
|
||||
|
||||
// Get currency object
|
||||
$currency = Currency::where('code', $currency_code)->first();
|
||||
|
||||
$json->currency_name = $currency->name;
|
||||
$json->currency_code = $currency_code;
|
||||
$json->currency_rate = $currency->rate;
|
||||
|
||||
$json->thousands_separator = $currency->thousands_separator;
|
||||
$json->decimal_mark = $currency->decimal_mark;
|
||||
$json->precision = (int) $currency->precision;
|
||||
$json->symbol_first = $currency->symbol_first;
|
||||
$json->symbol = $currency->symbol;
|
||||
|
||||
return response()->json($json);
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@ class Money
|
||||
$purchase_price = $request->get('purchase_price');
|
||||
$opening_balance = $request->get('opening_balance');
|
||||
$currency_code = $request->get('currency_code');
|
||||
$items = $request->get('item');
|
||||
|
||||
if (empty($currency_code)) {
|
||||
$currency_code = setting('general.default_currency');
|
||||
@ -34,9 +35,7 @@ class Money
|
||||
$request->request->set('amount', $amount);
|
||||
}
|
||||
|
||||
if (isset($bill_number) || isset($invoice_number)) {
|
||||
$items = $request->get('item');
|
||||
|
||||
if (isset($bill_number) || isset($invoice_number) || !empty($items)) {
|
||||
if (!empty($items)) {
|
||||
foreach ($items as $key => $item) {
|
||||
$items[$key]['price'] = money($item['price'], $currency_code)->getAmount();
|
||||
|
Reference in New Issue
Block a user