close #421 Fixed: Payments for expenses, wrong calculation error
This commit is contained in:
		| @@ -66,9 +66,15 @@ class Bills extends Controller | |||||||
|         $paid = 0; |         $paid = 0; | ||||||
|  |  | ||||||
|         foreach ($bill->payments as $item) { |         foreach ($bill->payments as $item) { | ||||||
|             $item->default_currency_code = $bill->currency_code; |             $amount = $item->amount; | ||||||
|  |  | ||||||
|             $paid += $item->getDynamicConvertedAmount(); |             if ($bill->currency_code != $item->currency_code) { | ||||||
|  |                 $item->default_currency_code = $bill->currency_code; | ||||||
|  |  | ||||||
|  |                 $amount = $item->getDynamicConvertedAmount(); | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             $paid += $amount; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         $bill->paid = $paid; |         $bill->paid = $paid; | ||||||
| @@ -713,9 +719,15 @@ class Bills extends Controller | |||||||
|         $paid = 0; |         $paid = 0; | ||||||
|  |  | ||||||
|         foreach ($bill->payments as $item) { |         foreach ($bill->payments as $item) { | ||||||
|             $item->default_currency_code = $bill->currency_code; |             $amount = $item->amount; | ||||||
|  |  | ||||||
|             $paid += $item->getDynamicConvertedAmount(); |             if ($bill->currency_code != $item->currency_code) { | ||||||
|  |                 $item->default_currency_code = $bill->currency_code; | ||||||
|  |  | ||||||
|  |                 $amount = $item->getDynamicConvertedAmount(); | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             $paid += $amount; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         $bill->paid = $paid; |         $bill->paid = $paid; | ||||||
|   | |||||||
| @@ -691,7 +691,7 @@ class Invoices extends Controller | |||||||
|             $request['payment_method'] = setting('general.default_payment_method', 'offlinepayment.cash.1'); |             $request['payment_method'] = setting('general.default_payment_method', 'offlinepayment.cash.1'); | ||||||
|             $request['currency_code'] = $invoice->currency_code; |             $request['currency_code'] = $invoice->currency_code; | ||||||
|             $request['amount'] = $amount; |             $request['amount'] = $amount; | ||||||
|             $request['paid_at'] = Date::now(); |             $request['paid_at'] = Date::now()->format('Y-m-d'); | ||||||
|             $request['_token'] = csrf_token(); |             $request['_token'] = csrf_token(); | ||||||
|  |  | ||||||
|             $this->payment($request); |             $this->payment($request); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user