mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-23 14:33:59 +00:00
Merge branch 'dillon/accounting-bank-mapping' into development
This commit is contained in:
@@ -24,6 +24,7 @@ use Maatwebsite\Excel\Facades\Excel;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use DateTime;
|
||||
|
||||
|
||||
@@ -93,13 +94,22 @@ class BankStatementController extends Controller
|
||||
]
|
||||
);
|
||||
|
||||
$statement = new AccountStatement([
|
||||
'date_from' => $dateFrom,
|
||||
'date_to' => $dateTo,
|
||||
'total_amount' => $totalDebit ?: $totalCredit,
|
||||
'begin_balance' => $beginBalance,
|
||||
'end_balance' => $endBalance,
|
||||
]);
|
||||
$statement = AccountStatement::where('date_from', $dateFrom)
|
||||
->where('date_to', $dateTo)
|
||||
->where('total_amount', $totalDebit ?: $totalCredit,)
|
||||
->where('begin_balance', $beginBalance)
|
||||
->where('end_balance', $endBalance)->first();
|
||||
|
||||
|
||||
if(!$statement){
|
||||
$statement = new AccountStatement([
|
||||
'date_from' => $dateFrom,
|
||||
'date_to' => $dateTo,
|
||||
'total_amount' => $totalDebit ?: $totalCredit,
|
||||
'begin_balance' => $beginBalance,
|
||||
'end_balance' => $endBalance,
|
||||
]);
|
||||
}
|
||||
|
||||
// $existingStatement = AccountStatement::where('date_from', $dateFrom)
|
||||
// ->where('date_to', $dateTo)
|
||||
@@ -154,6 +164,7 @@ class BankStatementController extends Controller
|
||||
->where('teller_id', $tellerId)
|
||||
->where('branch_channel', $branchChannel)
|
||||
->where('transaction_code', $transactionCode)
|
||||
->where('end_balance', $endBalance)
|
||||
->first();
|
||||
|
||||
if (!$existingTransaction) {
|
||||
@@ -168,6 +179,12 @@ class BankStatementController extends Controller
|
||||
return redirect()->back()->with('success', 'Statement imported successfully.')->with('newTransactions', $newTransactions);
|
||||
}
|
||||
|
||||
public function rerun(AccountStatement $statement, Request $request)
|
||||
{
|
||||
CreateBankStatementDetails::dispatch($statement)->delay(30);
|
||||
return redirect()->back()->with('success', 'Rerun triggered successfully');
|
||||
}
|
||||
|
||||
public function show(AccountStatement $statement, Request $request)
|
||||
{
|
||||
$transactions = $statement->transactions();
|
||||
@@ -247,7 +264,7 @@ class BankStatementController extends Controller
|
||||
$count = 0;
|
||||
|
||||
foreach ($transactions as $row) {
|
||||
$isExist = StatementTransactionsDetail::where('statement_transactions_id', $row->id)->first();
|
||||
$isExist = StatementTransactionsDetail::where('statement_transaction_id', $row->id)->first();
|
||||
|
||||
if ($isExist) {
|
||||
continue;
|
||||
@@ -356,7 +373,7 @@ class BankStatementController extends Controller
|
||||
|
||||
$statementTransactionsDetail = new StatementTransactionsDetail([
|
||||
'date' => $date,
|
||||
'statement_transactions_id' => $row->id,
|
||||
'statement_transaction_id' => $row->id,
|
||||
'description' => is_null($description) ? "" : $description,
|
||||
'credit' => $credit,
|
||||
'debit' => $debit,
|
||||
|
||||
Reference in New Issue
Block a user