close #665 Fixed: Reconciliation missing currency then it wrong calculate
This commit is contained in:
parent
bc8a1305a5
commit
f8ba2721a8
@ -4,6 +4,7 @@ namespace App\Http\Controllers\Banking;
|
|||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Requests\Banking\Reconciliation as Request;
|
use App\Http\Requests\Banking\Reconciliation as Request;
|
||||||
|
use App\Http\Requests\Banking\ReconciliationCalculate as CalculateRequest;
|
||||||
use App\Models\Banking\Account;
|
use App\Models\Banking\Account;
|
||||||
use App\Models\Banking\Reconciliation;
|
use App\Models\Banking\Reconciliation;
|
||||||
use App\Models\Setting\Currency;
|
use App\Models\Setting\Currency;
|
||||||
@ -278,17 +279,17 @@ class Reconciliations extends Controller
|
|||||||
return $total;
|
return $total;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function calculate()
|
public function calculate(CalculateRequest $request)
|
||||||
{
|
{
|
||||||
$currency_code = request('currency_code');
|
$currency_code = $request['currency_code'];
|
||||||
$closing_balance = request('closing_balance');
|
$closing_balance = $request['closing_balance'];
|
||||||
|
|
||||||
$json = new \stdClass();
|
$json = new \stdClass();
|
||||||
|
|
||||||
$cleared_amount = $difference = $income_total = $expense_total = 0;
|
$cleared_amount = $difference = $income_total = $expense_total = 0;
|
||||||
|
|
||||||
if ($transactions = request('transactions')) {
|
if ($transactions = $request['transactions']) {
|
||||||
$opening_balance = request('opening_balance');
|
$opening_balance = $request['opening_balance'];
|
||||||
|
|
||||||
foreach ($transactions as $key => $value) {
|
foreach ($transactions as $key => $value) {
|
||||||
$model = explode('_', $key);
|
$model = explode('_', $key);
|
||||||
|
32
app/Http/Requests/Banking/ReconciliationCalculate.php
Normal file
32
app/Http/Requests/Banking/ReconciliationCalculate.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\Banking;
|
||||||
|
|
||||||
|
use App\Http\Requests\Request;
|
||||||
|
|
||||||
|
class ReconciliationCalculate extends Request
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function authorize()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'currency_code' => 'required|string|currency',
|
||||||
|
'closing_balance' => 'required',
|
||||||
|
'transactions' => 'required',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user