mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-21 05:23:58 +00:00
Merge branch 'dillon/accounting-bank-mapping' into development
This commit is contained in:
@@ -55,9 +55,8 @@ class CreateBankStatementDetailsProcessor
|
||||
$count = 0;
|
||||
|
||||
foreach ($transactions as $row) {
|
||||
$isExist = StatementTransactionsDetail::where('statement_transactions_id', $row->id)->first();
|
||||
|
||||
if ($isExist) {
|
||||
$existingRecord = StatementTransactionsDetail::where('statement_transaction_id', $row->id)->first();
|
||||
if ($existingRecord && $existingRecord->pay_for != "") {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -140,21 +139,16 @@ class CreateBankStatementDetailsProcessor
|
||||
|
||||
$matches = $systemReference == $row['remarkreferences'] ? $yes : $no;
|
||||
|
||||
$statementTransactionsDetail = new StatementTransactionsDetail([
|
||||
'date' => $date,
|
||||
'statement_transactions_id' => $row->id,
|
||||
// 'description' => is_null($description) ? "" : $description,
|
||||
// 'credit' => $credit,
|
||||
// 'debit' => $debit,
|
||||
'pay_for' => is_null($system) ? "" : $system,
|
||||
'system_references' => is_null($systemReference) ? "" : $systemReference,
|
||||
// 'remark_references' => is_null($row['remarkreferences']) ? "" : $row['remarkreferences'],
|
||||
// 'is_multiple' => $multiple == "Yes" ? 1 : 0,
|
||||
// 'is_matches' => $matches == "Yes" ? 1 : 0,
|
||||
'system_amounts'=> is_null($systemAmount) ? "" : $systemAmount,
|
||||
]);
|
||||
|
||||
$statementTransactionsDetail->save();
|
||||
StatementTransactionsDetail::updateOrCreate(
|
||||
['statement_transaction_id' => $row->id],
|
||||
[
|
||||
'date' => $date,
|
||||
'pay_for' => is_null($system) ? "" : $system,
|
||||
'system_references' => is_null($systemReference) ? "" : $systemReference,
|
||||
'system_amounts'=> is_null($systemAmount) ? "" : $systemAmount,
|
||||
'remark_references'=> is_null($row['remarkreferences']) ? "" : $row['remarkreferences'],
|
||||
]
|
||||
);
|
||||
|
||||
// if($count == 10){
|
||||
// break;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -23,6 +23,7 @@ class StatementTransaction extends Model
|
||||
'teller_id',
|
||||
'branch_channel',
|
||||
'transaction_code',
|
||||
'end_balance',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
|
||||
@@ -11,7 +11,7 @@ class StatementTransactionsDetail extends Model
|
||||
|
||||
protected $fillable = [
|
||||
'date',
|
||||
'statement_transactions_id',
|
||||
'statement_transaction_id',
|
||||
// 'description',
|
||||
// 'credit',
|
||||
// 'debit',
|
||||
@@ -25,6 +25,6 @@ class StatementTransactionsDetail extends Model
|
||||
|
||||
public function statementTransaction()
|
||||
{
|
||||
return $this->belongsTo(StatementTransaction::class, 'statement_transactions_id', 'id');
|
||||
return $this->belongsTo(StatementTransaction::class, 'statement_transaction_id', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ class CreateStatementTransactionsTable extends Migration
|
||||
$table->string('teller_id')->nullable();
|
||||
$table->string('branch_channel');
|
||||
$table->string('transaction_code');
|
||||
$table->string('end_balance')->nullable();
|
||||
$table->string('owner_system')->nullable();
|
||||
$table->string('owner_type')->nullable();
|
||||
$table->unsignedBigInteger('owner_id')->nullable();
|
||||
|
||||
+2
-2
@@ -16,8 +16,8 @@ class CreateStatementTransactionsDetailsTable extends Migration
|
||||
Schema::create('statement_transactions_details', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->date('date');
|
||||
$table->unsignedBigInteger('statement_transactions_id');
|
||||
$table->foreign('statement_transactions_id')->references('id')->on('statement_transactions');
|
||||
$table->unsignedBigInteger('statement_transaction_id');
|
||||
$table->foreign('statement_transaction_id')->references('id')->on('statement_transactions');
|
||||
// $table->string('description');
|
||||
// $table->decimal('credit', 8, 2);
|
||||
// $table->decimal('debit', 8, 2);
|
||||
|
||||
+6
-1
@@ -133,7 +133,7 @@ export default {
|
||||
days: []
|
||||
},
|
||||
|
||||
filters: {'per_page': 10, order_by: {column: 'id', DESC: true}, 'has_account_statement_id': this.statement},
|
||||
filters: {'per_page': 10, order_by: {column: 'id', DESC: true}},
|
||||
page: 1,
|
||||
|
||||
days: [],
|
||||
@@ -183,6 +183,11 @@ export default {
|
||||
},
|
||||
created(){
|
||||
this.setDecoratorDefault();
|
||||
if (this.statement === 0) {
|
||||
this.filters = { 'per_page': 10, order_by: {column: 'id', DESC: true} };
|
||||
} else {
|
||||
this.filters = { 'per_page': 10, order_by: {column: 'id', DESC: true}, 'has_account_statement_id': this.statement };
|
||||
}
|
||||
this.$store.dispatch('updateListQueue', {'name': this.section, 'page': 1, 'filters': this.filters});
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -31,8 +31,14 @@
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">Bank Statements</div>
|
||||
|
||||
@if (session('message'))
|
||||
<div class="alert alert-success">
|
||||
{{ session('message') }}
|
||||
</div>
|
||||
@endif
|
||||
<div class="card-header">Bank Statements
|
||||
<a href="{{ route('statements.transactions.details', 0) }}" class="btn btn-primary btn-sm ml-2">View All</a>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="GET" action="{{ route('statements.index') }}" class="form-inline mb-3">
|
||||
<div class="form-group mr-3">
|
||||
@@ -65,7 +71,7 @@
|
||||
<th>Total Amount</th>
|
||||
<th>Begin Balance</th>
|
||||
<th>End Balance</th>
|
||||
<th>Actions</th>
|
||||
<th colspan="2">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -80,6 +86,9 @@
|
||||
<td>
|
||||
<a href="{{ route('statements.transactions.details', $statement) }}" class="btn btn-primary btn-sm">View</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ route('statements.rerun', $statement) }}" class="btn btn-primary btn-sm">Rerun</a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
||||
@@ -565,6 +565,7 @@ Route::get('/statements/{statement}/details', function ($statement) {
|
||||
return view('pages.accounting.bank-statements.details', ['statement' => $statement]);
|
||||
})->name('statements.transactions.details');
|
||||
Route::get('/statements/{statement}', [BankStatementController::class, 'show'])->name('statements.show');
|
||||
Route::get('/statements/{statement}/rerun', [BankStatementController::class, 'rerun'])->name('statements.rerun');
|
||||
Route::get('/statements/{statement}/download', 'StatementController@download')->name('statements.download');
|
||||
Route::get('/bank-record', 'Imports\ImportBankRecordController@import');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user