close #466 Fixed: Bill Payment Problem

This commit is contained in:
cuneytsenturk 2018-08-30 13:08:31 +03:00
parent 37f9fbe622
commit 3589a0b5fc
6 changed files with 19 additions and 4 deletions

View File

@ -74,7 +74,7 @@ class Bills extends Controller
$default_amount = $item->amount;
if ($bill->currency_code != $item->currency_code) {
$default_amount_model = new InvoicePayment();
$default_amount_model = new BillPayment();
$default_amount_model->default_currency_code = $bill->currency_code;
$default_amount_model->amount = $default_amount;
@ -84,7 +84,7 @@ class Bills extends Controller
$default_amount = (double) $default_amount_model->getDivideConvertedAmount();
}
$convert_amount = new InvoicePayment();
$convert_amount = new BillPayment();
$convert_amount->default_currency_code = $item->currency_code;
$convert_amount->amount = $default_amount;

View File

@ -3,7 +3,7 @@
namespace App\Http\Controllers\Modals;
use App\Http\Controllers\Controller;
use App\Http\Requests\Expsense\BillPayment as Request;
use App\Http\Requests\Expense\BillPayment as Request;
use App\Models\Expense\Bill;
use App\Models\Banking\Account;
use App\Models\Expense\BillPayment;

View File

@ -101,4 +101,9 @@ class BillPayment extends Model
return $this->getMedia('attachment')->last();
}
public function getDivideConvertedAmount($format = false)
{
return $this->divide($this->amount, $this->currency_code, $this->currency_rate, $format);
}
}

View File

@ -373,6 +373,11 @@
$('#currency_rate').val(data.currency_rate);
$('.input-price').each(function(){
input_price_id = $(this).attr('id');
input_currency_id = input_price_id.replace('price', 'currency');
$('#' + input_currency_id).val(data.currency_code);
amount = $(this).maskMoney('unmasked')[0];
$(this).maskMoney({

View File

@ -381,6 +381,11 @@
$('#currency_rate').val(data.currency_rate);
$('.input-price').each(function(){
input_price_id = $(this).attr('id');
input_currency_id = input_price_id.replace('price', 'currency');
$('#' + input_currency_id).val(data.currency_code);
amount = $(this).maskMoney('unmasked')[0];
$(this).maskMoney({

View File

@ -24,7 +24,7 @@
@stack('price_td_start')
<td>
@stack('price_input_start')
<input value="{{ empty($item) ? '' : $item->price }}" class="form-control text-right" required="required" name="item[{{ $item_row }}][price]" type="text" id="item-price-{{ $item_row }}">
<input value="{{ empty($item) ? '' : $item->price }}" class="form-control text-right input-price" required="required" name="item[{{ $item_row }}][price]" type="text" id="item-price-{{ $item_row }}">
<input value="{{ $currency->code }}" name="item[{{ $item_row }}][currency]" type="hidden" id="item-currency-{{ $item_row }}">
@stack('price_input_end')
</td>