Merged in feature/account-statements (pull request #134)
Feature/account statements
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AccountStatementController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display the bank statement view with mock data.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showStatement(Request $request)
|
||||
{
|
||||
$gadaian = Http::get(config('api.url').'/api/gadai/norujukan/'.$request->norujukan)->json()[0][0];
|
||||
$transaction = Http::get(config('api.url').'/portal/transaksipelanggan',['norujukan' => $request->norujukan])->json();
|
||||
$cawangan=Http::get(config('api.url').'/api/cawangan/detail/'. $gadaian['kodcaw'])->json()[0];
|
||||
$customer = Http::get(config('api.url') . '/api/customers/' . $gadaian['nokp'])->json();
|
||||
$poskod = Http::get(config('api.url') . '/api/poskod/' . $customer['poskod'])->json();
|
||||
|
||||
$accountHolder = [
|
||||
'name' => $customer['nama'],
|
||||
'address' => $customer['alamat1'] . '<br>' . $customer['alamat2'],
|
||||
'city_state_zip' => $customer['poskod'] . ', ' . $poskod['daerah']['namadaerah'] . ', ' . $poskod['negeri']['negeri'],
|
||||
];
|
||||
|
||||
$bankDetails = [
|
||||
'name' => $cawangan['cawangan'],
|
||||
'address' => $cawangan['alamat1'] . '<br>' . $cawangan['alamat2'],
|
||||
'branch' => $cawangan['namacaw'],
|
||||
];
|
||||
|
||||
|
||||
$transaction_count = count(array_filter($transaction, fn($trans) => $trans['trans_type'] == 'A'));
|
||||
$totalPages = ceil($transaction_count / 10);
|
||||
|
||||
$ansuranTransaction = array_values(array_filter($transaction, fn($trans) => $trans['trans_type'] == 'A'));
|
||||
$originLoan = $gadaian['pinjaman'];
|
||||
$bakipinjaman = $originLoan;
|
||||
$ansuranTransaction = array_map(function($trans) use(&$bakipinjaman) {
|
||||
$bakipinjaman -= $trans['bayaran_pembiayaan'];
|
||||
return array_merge($trans, ['bakipinjaman' => $bakipinjaman]);
|
||||
}, $ansuranTransaction);
|
||||
|
||||
$tebusTransaction = array_values(array_filter($transaction, fn($trans) => $trans['trans_type'] == 'T'))[0];
|
||||
|
||||
return view('accounts-statements', compact('tebusTransaction','ansuranTransaction','transaction_count','gadaian','transaction','accountHolder', 'bankDetails'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to format currency.
|
||||
* In a real app, this would be a Blade helper or filter.
|
||||
* We'll format it directly in the view for simplicity in this example.
|
||||
*/
|
||||
}
|
||||
@@ -43,6 +43,9 @@
|
||||
<th class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
||||
Tarikh Bayaran
|
||||
</th>
|
||||
<th class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
||||
Masa Bayaran
|
||||
</th>
|
||||
<th class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
||||
Bayaran
|
||||
</th>
|
||||
@@ -54,12 +57,11 @@
|
||||
<tbody>
|
||||
<tr v-if="objbayaran.length === 0">
|
||||
<td colspan="9" class="text-center px-5 py-5 border-b border-gray-200 bg-white text-sm">
|
||||
<div class="flex items-center">
|
||||
<div class="ml-3">
|
||||
<p class="text-gray-900 whitespace-no-wrap">
|
||||
Tiada Data Diperolehi
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex flex-col items-center justify-center py-8">
|
||||
<svg class="w-16 h-16 text-gray-300 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
|
||||
</svg>
|
||||
<p class="text-gray-700 font-semibold text-lg">Tiada Data Diperolehi</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -75,7 +77,15 @@
|
||||
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
|
||||
<div class="flex items-center">
|
||||
<div class="ml-3">
|
||||
<p class="text-gray-900 whitespace-no-wrap" v-text="bayaran.created_at">
|
||||
<p class="text-gray-900 whitespace-no-wrap" v-text="formatDate(bayaran.created_at,'date')">
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
|
||||
<div class="flex items-center">
|
||||
<div class="ml-3">
|
||||
<p class="text-gray-900 whitespace-no-wrap" v-text="formatDate(bayaran.created_at,'time')">
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -125,12 +135,11 @@
|
||||
<tbody>
|
||||
<tr v-if="objupah.length === 0">
|
||||
<td colspan="9" class="text-center px-5 py-5 border-b border-gray-200 bg-white text-sm">
|
||||
<div class="flex items-center">
|
||||
<div class="ml-3">
|
||||
<p class="text-gray-900 whitespace-no-wrap">
|
||||
Tiada Data Diperolehi
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex flex-col items-center justify-center py-8">
|
||||
<svg class="w-16 h-16 text-gray-300 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
|
||||
</svg>
|
||||
<p class="text-gray-700 font-semibold text-lg">Tiada Data Diperolehi</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -179,25 +188,25 @@
|
||||
<table class="min-w-full leading-normal">
|
||||
<thead class="text-center">
|
||||
<tr>
|
||||
<th class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
||||
<th class="w-1/8 px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
||||
Bil
|
||||
</th>
|
||||
<th class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
||||
<th class="w-1/8 px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
||||
No Rujukan
|
||||
</th>
|
||||
<th class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
||||
Jenis Penyelesaian Pembiayaan
|
||||
<th class="w-1/8 px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
||||
Jenis
|
||||
</th>
|
||||
<th class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
||||
<th class="w-1/8 px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
||||
Pembiayaan Asal
|
||||
</th>
|
||||
<th class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
||||
<th class="w-1/8 px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
||||
Tempoh
|
||||
</th>
|
||||
<th class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
||||
Tarikh Penyelesaian Pembiayaan
|
||||
<th class="w-1/8 px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
||||
Tarikh
|
||||
</th>
|
||||
<th class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
||||
<th class="w-1/8 px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
||||
Action
|
||||
</th>
|
||||
</tr>
|
||||
@@ -205,12 +214,11 @@
|
||||
<tbody>
|
||||
<tr v-if="objrekod.length === 0">
|
||||
<td colspan="9" class="text-center px-5 py-5 border-b border-gray-200 bg-white text-sm">
|
||||
<div class="flex items-center">
|
||||
<div class="ml-3">
|
||||
<p class="text-gray-900 whitespace-no-wrap">
|
||||
Tiada Data Diperolehi
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex flex-col items-center justify-center py-8">
|
||||
<svg class="w-16 h-16 text-gray-300 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
|
||||
</svg>
|
||||
<p class="text-gray-700 font-semibold text-lg">Tiada Data Diperolehi</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -266,12 +274,15 @@
|
||||
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
|
||||
<div class="flex items-center">
|
||||
<div class="ml-3">
|
||||
<button type="button" @click="rekodfunc(rekod.norujukan,rekod.jenistebus,rekod.hargajualan)" data-modal-toggle="popup-modal" class="border border-yellow-600 text-yellow-600 font-montserrat py-2 px-4 font-medium rounded-xl hover:bg-yellow-600 hover:text-white transition-all duration-300">
|
||||
<button type="button" @click="rekodfunc(rekod.norujukan,rekod.jenistebus,rekod.hargajualan)" data-modal-toggle="popup-modal" class="mt-2 border border-yellow-600 text-yellow-600 font-montserrat py-2 px-4 font-medium rounded-xl hover:bg-yellow-600 hover:text-white transition-all duration-300">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
|
||||
</svg>
|
||||
</button>
|
||||
<button v-if="rekod.ujrah > 0" type="button" @click="rekodSAGStatements(rekod.norujukan)" data-modal-toggle="popup-modal" class="border border-green-600 text-green-600 font-montserrat py-2 px-4 font-medium rounded-xl hover:bg-green-600 hover:text-white transition-all duration-300">
|
||||
<i class="fa-solid fa-box-archive"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@@ -390,6 +401,53 @@ export default {
|
||||
break;
|
||||
}
|
||||
},
|
||||
rekodSAGStatements: function(norujukan){
|
||||
let urlroute = window.route('accountstatement.rekod', norujukan)
|
||||
window.open(urlroute, '_blank');
|
||||
},
|
||||
formatDate(datetime, type) {
|
||||
if (!datetime) return '';
|
||||
|
||||
const date = new Date(datetime);
|
||||
|
||||
if (type === 'date') {
|
||||
// Return date only in dd/mm/yyyy format
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const year = date.getFullYear();
|
||||
return `${day}/${month}/${year}`;
|
||||
}
|
||||
|
||||
if (type === 'time') {
|
||||
// Return time in 12-hour format with AM/PM
|
||||
let hours = date.getHours();
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||
const ampm = hours >= 12 ? 'PM' : 'AM';
|
||||
|
||||
hours = hours % 12;
|
||||
hours = hours ? hours : 12; // the hour '0' should be '12'
|
||||
hours = String(hours).padStart(2, '0');
|
||||
|
||||
return `${hours}:${minutes}:${seconds} ${ampm}`;
|
||||
}
|
||||
|
||||
// Default: return both date and time
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const year = date.getFullYear();
|
||||
|
||||
let hours = date.getHours();
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||
const ampm = hours >= 12 ? 'PM' : 'AM';
|
||||
|
||||
hours = hours % 12;
|
||||
hours = hours ? hours : 12;
|
||||
hours = String(hours).padStart(2, '0');
|
||||
|
||||
return `${day}/${month}/${year} ${hours}:${minutes}:${seconds} ${ampm}`;
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div>
|
||||
<modal ref="modal" @clickEvent_="getDataSenaraiSAG"></modal>
|
||||
|
||||
<form :class="{ 'w-2/3' : this.showsag}" class="w-1/2 mt-10 p-6 bg-white rounded-xl shadow mx-auto">
|
||||
<form :class="{ 'w-2/3' : this.showsag}" class="min-h-[50vh] w-1/2 mt-10 p-6 bg-white rounded-xl shadow mx-auto">
|
||||
|
||||
<ul class="flex hidden rounded-lg divide-x divide-gray-200 shadow sm:flex dark:divide-gray-700 mb-4">
|
||||
<li class="w-full">
|
||||
@@ -207,13 +207,14 @@
|
||||
<tbody>
|
||||
<tr v-if="objbelumtebus.from === null">
|
||||
<td colspan="9" class="text-center px-5 py-5 border-b border-gray-200 bg-white text-sm">
|
||||
<div class="flex items-center">
|
||||
<div class="ml-3">
|
||||
<div class="flex flex-col items-center justify-center py-8">
|
||||
<svg class="w-14 h-14 text-gray-400 mb-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
|
||||
</svg>
|
||||
<p class="text-gray-900 whitespace-no-wrap">
|
||||
Tiada data yang diperolehi dalam carian
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-for="(belumtebus,i) in objbelumtebus.data" :key="i">
|
||||
@@ -334,13 +335,14 @@
|
||||
<tbody>
|
||||
<tr v-if="objsudahtebus.from === null">
|
||||
<td colspan="9" class="text-center px-5 py-5 border-b border-gray-200 bg-white text-sm">
|
||||
<div class="flex items-center">
|
||||
<div class="ml-3">
|
||||
<div class="flex flex-col items-center justify-center py-8">
|
||||
<svg class="w-14 h-14 text-gray-400 mb-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
|
||||
</svg>
|
||||
<p class="text-gray-900 whitespace-no-wrap">
|
||||
Tiada data yang diperolehi dalam carian
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-for="(sudahtebus,i) in objsudahtebus.data" :key="i">
|
||||
@@ -457,13 +459,14 @@
|
||||
<tbody>
|
||||
<tr v-if="objlelong.from === null">
|
||||
<td colspan="9" class="text-center px-5 py-5 border-b border-gray-200 bg-white text-sm">
|
||||
<div class="flex items-center">
|
||||
<div class="ml-3">
|
||||
<div class="flex flex-col items-center justify-center py-8">
|
||||
<svg class="w-14 h-14 text-gray-400 mb-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
|
||||
</svg>
|
||||
<p class="text-gray-900 whitespace-no-wrap">
|
||||
Tiada data yang diperolehi dalam carian
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-for="(lelong,i) in objlelong.data" :key="i">
|
||||
|
||||
@@ -0,0 +1,501 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Account Statements - {{ $bankDetails['name'] }}</title>
|
||||
<!-- Load Tailwind CSS -->
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<style>
|
||||
/* Custom styles for the Inter font */
|
||||
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');
|
||||
|
||||
body {
|
||||
font-family: 'Inter', sans-serif;
|
||||
background-color: #f3f4f6;
|
||||
}
|
||||
|
||||
.statement-table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
/* A4 Print Optimization */
|
||||
@media print {
|
||||
@page {
|
||||
size: A4;
|
||||
margin: 8mm; /* Minimal margin to prevent printer cutoff */
|
||||
padding: 8mm;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background-color: white;
|
||||
font-size: 9pt;
|
||||
-webkit-print-color-adjust: exact;
|
||||
color-adjust: exact;
|
||||
}
|
||||
|
||||
.statement-container {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
margin: 0 !important;
|
||||
padding: 3mm 5mm !important; /* Minimal padding */
|
||||
box-shadow: none;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.no-print {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
header {
|
||||
border-color: #1f2937 !important;
|
||||
}
|
||||
|
||||
/* Optimize table for print */
|
||||
.statement-table {
|
||||
font-size: 8pt;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.statement-table th {
|
||||
padding: 4px 6px !important;
|
||||
font-size: 7pt;
|
||||
}
|
||||
|
||||
.statement-table td {
|
||||
padding: 3px 6px !important;
|
||||
font-size: 8pt;
|
||||
}
|
||||
|
||||
/* Reduce header size */
|
||||
header h1 {
|
||||
font-size: 20pt !important;
|
||||
}
|
||||
|
||||
header .text-sm {
|
||||
font-size: 8pt !important;
|
||||
}
|
||||
|
||||
/* Reduce summary section */
|
||||
.bg-blue-50 {
|
||||
padding: 8px !important;
|
||||
margin-bottom: 12px !important;
|
||||
}
|
||||
|
||||
.bg-blue-50 h2 {
|
||||
font-size: 14pt !important;
|
||||
margin-bottom: 8px !important;
|
||||
}
|
||||
|
||||
.bg-blue-50 .text-sm {
|
||||
font-size: 8pt !important;
|
||||
}
|
||||
|
||||
/* Reduce final summary box */
|
||||
.max-w-lg {
|
||||
max-width: 100% !important;
|
||||
}
|
||||
|
||||
/* Prevent page breaks inside table rows */
|
||||
.statement-table tr {
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
|
||||
/* Keep header rows on every page if table spans multiple pages */
|
||||
.statement-table thead {
|
||||
display: table-header-group;
|
||||
}
|
||||
|
||||
.statement-table tfoot {
|
||||
display: table-footer-group;
|
||||
}
|
||||
|
||||
/* Reduce margins and padding throughout */
|
||||
header {
|
||||
padding-bottom: 4mm !important;
|
||||
margin-bottom: 4mm !important;
|
||||
}
|
||||
|
||||
.mb-8 {
|
||||
margin-bottom: 4mm !important;
|
||||
}
|
||||
|
||||
.mb-6 {
|
||||
margin-bottom: 3mm !important;
|
||||
}
|
||||
|
||||
.p-8 {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.p-4 {
|
||||
padding: 6px !important;
|
||||
}
|
||||
|
||||
.p-6 {
|
||||
padding: 8px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.statement-container {
|
||||
max-width: 80rem;
|
||||
}
|
||||
|
||||
.print\:page-break-before {
|
||||
page-break-before: always;
|
||||
break-before: page;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body class="p-8">
|
||||
|
||||
@php
|
||||
// Helper function to format currency for the template
|
||||
function formatCurrency($amount, $currency = 'RM')
|
||||
{
|
||||
return is_numeric($amount) ? `$currency ` . number_format($amount, 2) : '-';
|
||||
}
|
||||
@endphp
|
||||
|
||||
<div class="statement-container mx-auto bg-white p-8 shadow-lg rounded-lg border border-gray-200">
|
||||
|
||||
<!-- Header Section -->
|
||||
<header class="flex justify-between items-start pb-6 border-b-4 border-gray-800 mb-6">
|
||||
<div class="flex-shrink-0">
|
||||
<h1 class="text-xl font-extrabold text-gray-800 uppercase tracking-widest">{{ $bankDetails['name'] }}
|
||||
</h1>
|
||||
<p class="text-sm mt-1 text-gray-600">{!! $bankDetails['address'] !!}</p>
|
||||
</div>
|
||||
<div class="text-right flex flex-col items-end">
|
||||
<div class="text-xl font-bold text-gray-700 mb-2">{{ $gadaian['norujukan'] }}</div>
|
||||
<div class="bg-gray-100 p-3 rounded-lg text-sm grid grid-cols-2 gap-x-4 gap-y-1 w-full">
|
||||
<span class="font-semibold text-gray-700">IC:</span>
|
||||
<span class="text-gray-900 font-mono">{{ $gadaian['nokp'] }}</span>
|
||||
|
||||
<span class="font-semibold text-gray-700">Tarikh Pembiayaan:</span>
|
||||
<span class="text-gray-900">{{ $gadaian['t_gadai'] }}</span>
|
||||
|
||||
<span class="font-semibold text-gray-700">Tempoh Pembiayaan:</span>
|
||||
<span class="text-gray-900 text-xs">{{ $gadaian['tempoh'] }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- Address and Statement Info -->
|
||||
<div class="flex justify-between items-start mb-8">
|
||||
<!-- Account Holder Address -->
|
||||
<div class="w-1/2 pr-4">
|
||||
<p class="text-lg font-bold text-gray-900 uppercase">{{ $accountHolder['name'] }}</p>
|
||||
<p class="text-sm text-gray-700 uppercase">{!! $accountHolder['address'] !!}</p>
|
||||
<p class="text-sm text-gray-700 uppercase">{{ $accountHolder['city_state_zip'] }}</p>
|
||||
</div>
|
||||
<!-- Branch Info (from PDF structure) -->
|
||||
<div class="w-1/2 text-right">
|
||||
<p class="text-sm font-semibold text-gray-700">{{ $bankDetails['branch'] }}</p>
|
||||
<p class="text-xs text-gray-500 mt-1">Page 1 of 1</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Account Summary -->
|
||||
<div class="mb-8 p-4 bg-blue-50 rounded-lg shadow-inner">
|
||||
<h2 class="text-xl font-bold text-blue-800 mb-3 border-b pb-2">Ringkasan Pembiayaan</h2>
|
||||
<div class="grid grid-cols-2 sm:grid-cols-3 gap-4 text-sm">
|
||||
<!-- Row 1 -->
|
||||
<div>
|
||||
<div class="font-semibold text-gray-700">Pembiayaan:</div>
|
||||
<div class="text-gray-900 font-bold text-lg">{{ formatCurrency($gadaian['pinjaman']) }}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="font-semibold text-gray-700">Nilai Marhun:</div>
|
||||
<div class="text-green-600 font-bold text-lg">{{ formatCurrency($gadaian['nilaimarhun']) }}</div>
|
||||
</div>
|
||||
<div class="flex justify-between">
|
||||
<div>
|
||||
<div class="font-semibold text-gray-700">1 Percent:</div>
|
||||
<div class="text-red-600 font-bold text-lg">{{ formatCurrency($gadaian['ujrah']) }}</div>
|
||||
<div class="font-semibold text-gray-700">Ujrah:</div>
|
||||
<div class="text-red-600 font-bold text-lg">{{ formatCurrency($gadaian['onepercent']) }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="font-semibold text-gray-700">Keuntungan:</div>
|
||||
<div class="text-red-600 font-bold text-lg">{{ formatCurrency($gadaian['ujrah'] + $gadaian['onepercent']) }}</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Row 2 -->
|
||||
<div>
|
||||
<div class="font-semibold text-gray-700">Harga Jualan:</div>
|
||||
<div class="text-gray-900">{{ formatCurrency($gadaian['hargajualan']) }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="font-semibold text-gray-700">Jumlah Transaksi:</div>
|
||||
<div class="text-gray-900">{{ $transaction_count }}</div>
|
||||
</div>
|
||||
<div class="bg-blue-200 p-2 rounded-md shadow-md">
|
||||
<div class="font-semibold text-blue-900">Harga Tebus:</div>
|
||||
<div class="text-blue-900 font-extrabold text-xl">{{ formatCurrency($tebusTransaction['duit_masuk']) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Transactions Table -->
|
||||
<div class="mb-6">
|
||||
<h2 class="text-xl font-bold text-gray-800 mb-3 border-b pb-2">Transaksi</h2>
|
||||
|
||||
<table class="w-full statement-table text-left text-sm">
|
||||
<thead>
|
||||
<tr class="bg-gray-100 text-gray-700 uppercase tracking-wider">
|
||||
<th class="py-3 px-4 border border-gray-300 w-1/12">Tarikh</th>
|
||||
<th class="py-3 px-4 border border-gray-300 w-2/12">Deskripsi</th>
|
||||
<th class="py-3 px-4 border border-gray-300 w-1/12">Tempoh</th>
|
||||
<th class="py-3 px-4 border border-gray-300 w-2/12 text-right">Bayaran (RM)</th>
|
||||
<th class="py-3 px-4 border border-gray-300 w-1/12 text-right">Upah (RM)</th>
|
||||
<th class="py-3 px-4 border border-gray-300 w-2/12 text-right">Pembiayaan (RM)</th>
|
||||
<th class="py-3 px-4 border border-gray-300 w-1/12 text-right">Rebet (RM)</th>
|
||||
<th class="py-3 px-4 border border-gray-300 w-2/12 text-right">Baki (RM)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@php $totalUpahRebet=0;$totalUpah = 0; $totalBayaran = 0; $totalPembiayaan = 0; $totalRebet = 0; @endphp
|
||||
@foreach ($ansuranTransaction as $transaction)
|
||||
<tr class="hover:bg-gray-50">
|
||||
<td class="py-2 px-4 border border-gray-300">{{ date('d/m/Y', strtotime($transaction['created_at'])) }}</td>
|
||||
<td class="py-2 px-4 border border-gray-300">{{ ($transaction['teller'] == 'Online') ? 'Bayaran Online' : 'Bayaran Kaunter' }}</td>
|
||||
<td class="py-2 px-4 border border-gray-300 text-right font-semibold text-gray-800">
|
||||
{{ $transaction['beza_tempoh'] }}
|
||||
</td>
|
||||
<td class="py-2 px-4 border border-gray-300 text-right text-green-700 font-medium">
|
||||
@if ($transaction['duit_masuk'])
|
||||
{{ formatCurrency($transaction['duit_masuk']) }}
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
<td class="py-2 px-4 border border-gray-300 text-right text-red-700 font-medium">
|
||||
@if ($transaction['bayaran_keuntungan'])
|
||||
{{ formatCurrency($transaction['bayaran_keuntungan']) }}
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
<td class="py-2 px-4 border border-gray-300 text-right text-red-700 font-medium">
|
||||
@if ($transaction['bayaran_pembiayaan'])
|
||||
{{ formatCurrency($transaction['bayaran_pembiayaan']) }}
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
<td class="py-2 px-4 border border-gray-300 text-right font-semibold text-gray-800">
|
||||
{{ formatCurrency($transaction['bayaran_keuntungan'] - $transaction['keuntungan_rebet']) }}
|
||||
</td>
|
||||
<td class="py-2 px-4 border border-gray-300 text-right font-semibold text-gray-800">
|
||||
{{ formatCurrency($transaction['bakipinjaman']) }}
|
||||
</td>
|
||||
</tr>
|
||||
@php $totalUpahRebet += $transaction['keuntungan_rebet']; $totalUpah += $transaction['bayaran_keuntungan']; $totalBayaran += $transaction['duit_masuk']; $totalPembiayaan += $transaction['bayaran_pembiayaan']; $totalRebet += ($transaction['bayaran_keuntungan'] - $transaction['keuntungan_rebet']);@endphp
|
||||
@endforeach
|
||||
|
||||
<!-- Tebus Transaction Row -->
|
||||
<tr class="hover:bg-gray-50">
|
||||
<td class="py-2 px-4 border border-gray-300">{{ date('d/m/Y', strtotime($tebusTransaction['created_at'])) }}</td>
|
||||
<td class="py-2 px-4 border border-gray-300">Tebus Kaunter</td>
|
||||
<td class="py-2 px-4 border border-gray-300 text-right font-semibold text-gray-800">
|
||||
{{ $tebusTransaction['beza_tempoh'] }}
|
||||
</td>
|
||||
<td class="py-2 px-4 border border-gray-300 text-right text-green-700 font-medium">
|
||||
@if ($tebusTransaction['duit_masuk'])
|
||||
{{-- {{ formatCurrency($tebusTransaction['duit_masuk']) }} --}}
|
||||
-
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
<td class="py-2 px-4 border border-gray-300 text-right text-red-700 font-medium">
|
||||
@if ($tebusTransaction['bayaran_keuntungan'])
|
||||
{{ formatCurrency($tebusTransaction['bayaran_keuntungan']) }}
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
<td class="py-2 px-4 border border-gray-300 text-right text-red-700 font-medium">
|
||||
@if ($tebusTransaction['bayaran_pembiayaan'])
|
||||
{{-- {{ formatCurrency($tebusTransaction['bayaran_pembiayaan']) }} --}}
|
||||
-
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
<td class="py-2 px-4 border border-gray-300 text-right font-semibold text-gray-800">
|
||||
@php $tebusRebet = ($tebusTransaction['bayaran_keuntungan'] - $tebusTransaction['keuntungan_rebet']) - $totalRebet;@endphp
|
||||
{{ formatCurrency($tebusRebet) }}
|
||||
</td>
|
||||
<td class="py-2 px-4 border border-gray-300 text-right font-semibold text-gray-800">
|
||||
0
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- Closing Balance Row -->
|
||||
<tr class="bg-blue-100 font-bold text-base text-blue-900">
|
||||
<td colspan="3" class="py-3 px-4 border border-gray-300 text-center">Jumlah</td>
|
||||
<td class="py-3 px-4 border border-gray-300 text-right">
|
||||
{{ formatCurrency($totalBayaran) }}</td>
|
||||
<td class="py-3 px-4 border border-gray-300 text-right">
|
||||
{{ formatCurrency($totalUpah + $tebusTransaction['bayaran_keuntungan']) }}</td>
|
||||
<td class="py-3 px-4 border border-gray-300 text-right">
|
||||
{{ formatCurrency($totalPembiayaan) }}</td>
|
||||
<td class="py-3 px-4 border border-gray-300 text-right">
|
||||
{{ formatCurrency($totalRebet + $tebusRebet) }}</td>
|
||||
<td class="py-3 px-4 border border-gray-300 text-right">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="print:page-break-before flex">
|
||||
<div class="p-6 bg-white border border-gray-200 rounded-lg shadow-md max-w-lg mx-auto font-sans">
|
||||
<div class="flex items-center mb-4 border-b-2 border-black pb-1">
|
||||
<h2 class="text-xl font-bold bg-white px-2 py-1 border border-black inline-block tracking-widest">
|
||||
SEMAKAN BAKI PEMBIAYAAN</h2>
|
||||
</div>
|
||||
@php
|
||||
/*Calculation Baki Pembiayaan*/
|
||||
$bakiPembiayaan = $tebusTransaction['bayaran_pembiayaan'];
|
||||
$onePercent = $tebusTransaction['onepercent'];
|
||||
$onePercentRebet = $tebusTransaction['onepercent'] - $tebusTransaction['onepercent_rebet'];
|
||||
$ujrah = $tebusTransaction['ujrah'];
|
||||
$ujrahRebet = $tebusTransaction['ujrah'] - $tebusTransaction['ujrah_rebet'];
|
||||
$totalBayaranPembiayaan = $bakiPembiayaan + $onePercent - $onePercentRebet + $ujrah - $ujrahRebet;
|
||||
@endphp
|
||||
|
||||
<div class="grid grid-cols-2 gap-y-2 text-sm">
|
||||
<div class="col-span-1"></div>
|
||||
<div class="col-span-1 text-right font-bold tracking-widest text-xs">JUMLAH</div>
|
||||
|
||||
{{-- Beginning Balance --}}
|
||||
<div class="col-span-1 font-semibold">Baki Pembiayaan</div>
|
||||
<div class="col-span-1 text-right font-bold text-base border-b border-black">
|
||||
{{ formatCurrency($bakiPembiayaan) }}
|
||||
</div>
|
||||
|
||||
{{-- Deposits and Additions --}}
|
||||
<div class="col-span-1">(+) Keuntungan 1%</div>
|
||||
<div class="col-span-1 text-right">
|
||||
{{ formatCurrency($onePercent) }}
|
||||
</div>
|
||||
|
||||
{{-- ATM & Debit Card Withdrawals --}}
|
||||
<div class="col-span-1">(-) Rebet Keuntungan 1%</div>
|
||||
<div class="col-span-1 text-right text-red-600">
|
||||
{{ formatCurrency($onePercentRebet) }}
|
||||
</div>
|
||||
|
||||
{{-- Deposits and Additions --}}
|
||||
<div class="col-span-1">(+) Ujrah</div>
|
||||
<div class="col-span-1 text-right">
|
||||
{{ formatCurrency($ujrah) }}
|
||||
</div>
|
||||
|
||||
{{-- ATM & Debit Card Withdrawals --}}
|
||||
<div class="col-span-1">(-) Rebet Ujrah</div>
|
||||
<div class="col-span-1 text-right text-red-600">
|
||||
{{ formatCurrency($ujrahRebet) }}
|
||||
</div>
|
||||
|
||||
{{-- Separator Line (Visual emphasis for Ending Balance calculation) --}}
|
||||
<div class="col-span-2 my-2"></div>
|
||||
|
||||
{{-- Ending Balance --}}
|
||||
<div class="col-span-1 font-extrabold text-base">Jumlah Bayaran</div>
|
||||
<div class="col-span-1 text-right font-bold text-lg">
|
||||
{{ formatCurrency($totalBayaranPembiayaan) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="p-6 bg-white border border-gray-200 rounded-lg shadow-md max-w-lg mx-auto font-sans">
|
||||
<div class="flex items-center mb-4 border-b-2 border-black pb-1">
|
||||
<h2 class="text-xl font-bold bg-white px-2 py-1 border border-black inline-block tracking-widest">
|
||||
SEMAKAN BAKI HARGA JUALAN</h2>
|
||||
</div>
|
||||
|
||||
@php
|
||||
/*Calculation Baki Harga Jualan*/
|
||||
$bakiHargaJualan = $gadaian['hargajualan'] - $totalBayaran;
|
||||
$upah12 = $gadaian['upah12'];
|
||||
$totalUpahRebet = $totalUpahRebet;
|
||||
$tebusRebet = ($tebusTransaction['bayaran_keuntungan'] - $tebusRebet);
|
||||
$totalBayaranBakiHargaJualan = $bakiHargaJualan - $upah12 + $totalUpahRebet + $tebusRebet;
|
||||
@endphp
|
||||
|
||||
<div class="grid grid-cols-2 gap-y-2 text-sm">
|
||||
<div class="col-span-1"></div>
|
||||
<div class="col-span-1 text-right font-bold tracking-widest text-xs">JUMLAH</div>
|
||||
|
||||
{{-- Beginning Balance --}}
|
||||
<div class="col-span-1 font-semibold">Baki Harga Jualan</div>
|
||||
<div class="col-span-1 text-right font-bold text-base border-b border-black">
|
||||
{{ formatCurrency($bakiHargaJualan) }}
|
||||
</div>
|
||||
|
||||
{{-- Deposits and Additions --}}
|
||||
<div class="col-span-1">(-) Upah 12</div>
|
||||
<div class="col-span-1 text-right text-red-600">
|
||||
{{ formatCurrency($upah12) }}
|
||||
</div>
|
||||
|
||||
{{-- ATM & Debit Card Withdrawals --}}
|
||||
<div class="col-span-1">(+) Jumlah Rebet</div>
|
||||
<div class="col-span-1 text-right ">
|
||||
{{ formatCurrency($totalUpahRebet) }}
|
||||
</div>
|
||||
|
||||
{{-- Deposits and Additions --}}
|
||||
<div class="col-span-1">(+) Upah Tebus Rebet</div>
|
||||
<div class="col-span-1 text-right">
|
||||
{{ formatCurrency($tebusRebet) }}
|
||||
</div>
|
||||
|
||||
{{-- Separator Line (Visual emphasis for Ending Balance calculation) --}}
|
||||
<div class="col-span-2 my-2"></div>
|
||||
|
||||
{{-- Ending Balance --}}
|
||||
<div class="col-span-1 font-extrabold text-base">Jumlah Bayaran</div>
|
||||
<div class="col-span-1 text-right font-bold text-lg">
|
||||
{{ formatCurrency($totalBayaranBakiHargaJualan) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Footer / Notices -->
|
||||
<footer class="pt-6 border-t border-gray-300 text-center text-xs text-gray-500">
|
||||
<p>Ini ialah penyata akaun yang dijana secara automatik. Sila hubungi kami untuk sebarang percanggahan</p>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<!-- Print Button (non-functional in this environment, but useful in a real app) -->
|
||||
<div class="no-print max-w-4xl mx-auto mt-4 text-center">
|
||||
<button onclick="window.print()"
|
||||
class="px-6 py-2 bg-indigo-600 text-white font-semibold rounded-lg shadow-md hover:bg-indigo-700 transition duration-150">
|
||||
<svg class="w-4 h-4 inline-block mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2z">
|
||||
</path>
|
||||
</svg>
|
||||
Print Statement
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -6,6 +6,7 @@ use App\Http\Controllers\OnlineTransactionController;
|
||||
use App\Http\Controllers\OnlineTransactionGadaianController;
|
||||
use App\Http\Controllers\OnlineTransactionLogController;
|
||||
use App\Http\Controllers\OnlineTransactionTrailController;
|
||||
use App\Http\Controllers\AccountStatementController;
|
||||
use App\Http\Controllers\AutoSerahanController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
@@ -200,6 +201,9 @@ Route::get('/autoserahan/reject', [AutoSerahanController::class,'reject'])->nam
|
||||
Route::get('/autoserahan/list', [AutoSerahanController::class,'getList'])->name('autoserahan.get');
|
||||
Route::get('/autoserahan/rekod', [AutoSerahanController::class,'record'])->name('autoserahan.rekod');
|
||||
|
||||
//Account Statements
|
||||
Route::get('/accounts/statements/{norujukan}', [AccountStatementController::class,'showStatement'])->name('accountstatement.rekod');
|
||||
|
||||
Route::get('{any}', function () {
|
||||
return view('home');
|
||||
})->where('any','.*');
|
||||
|
||||
Reference in New Issue
Block a user