fix A4 printed cut out and added gadaian

This commit is contained in:
Hafifie PKB
2025-12-01 19:49:00 +08:00
committed by Nur Izzati
parent 554d570710
commit 863388ac6a
2 changed files with 200 additions and 81 deletions
+197 -69
View File
@@ -4,7 +4,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bank Statement - {{ $bankDetails['name'] }}</title>
<title>Account Statements - {{ $bankDetails['name'] }}</title>
<!-- Load Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script>
<style>
@@ -22,20 +22,26 @@
/* 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; /* Reduced from 10pt */
font-size: 9pt;
-webkit-print-color-adjust: exact;
color-adjust: exact;
}
.statement-container {
width: 210mm;
max-width: 210mm;
margin: 0;
padding: 10mm 10mm; /* Reduced padding from 20mm 15mm */
width: 100%;
max-width: 100%;
margin: 0 !important;
padding: 3mm 5mm !important; /* Minimal padding */
box-shadow: none;
border: none;
border-radius: 0;
@@ -51,17 +57,17 @@
/* Optimize table for print */
.statement-table {
font-size: 8pt; /* Smaller font for table */
font-size: 8pt;
width: 100%;
}
.statement-table th {
padding: 4px 6px !important; /* Reduced padding */
padding: 4px 6px !important;
font-size: 7pt;
}
.statement-table td {
padding: 3px 6px !important; /* Reduced padding */
padding: 3px 6px !important;
font-size: 8pt;
}
@@ -92,8 +98,6 @@
/* Reduce final summary box */
.max-w-lg {
max-width: 100% !important;
padding: 12px !important;
margin-top: 12px !important;
}
/* Prevent page breaks inside table rows */
@@ -109,6 +113,32 @@
.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 {
@@ -126,9 +156,9 @@
@php
// Helper function to format currency for the template
function formatCurrency($amount)
function formatCurrency($amount, $currency = 'RM')
{
return is_numeric($amount) ? 'RM ' . number_format($amount, 2) : '-';
return is_numeric($amount) ? `$currency ` . number_format($amount, 2) : '-';
}
@endphp
@@ -137,7 +167,7 @@
<!-- 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-2xl font-extrabold text-gray-800 uppercase tracking-widest">{{ $bankDetails['name'] }}
<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>
@@ -226,15 +256,15 @@
<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</th>
<th class="py-3 px-4 border border-gray-300 w-1/12 text-right">Upah</th>
<th class="py-3 px-4 border border-gray-300 w-1/12 text-right">Pembiayaan</th>
<th class="py-3 px-4 border border-gray-300 w-1/12 text-right">Rebet</th>
<th class="py-3 px-4 border border-gray-300 w-2/12 text-right">Baki</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 $totalUpah = 0; $totalBayaran = 0; $totalPembiayaan = 0; $totalRebet = 0; @endphp
@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>
@@ -270,19 +300,59 @@
{{ formatCurrency($transaction['bakipinjaman']) }}
</td>
</tr>
@php $totalUpah += $transaction['bayaran_keuntungan']; $totalBayaran += $transaction['duit_masuk']; $totalPembiayaan += $transaction['bayaran_pembiayaan']; $totalRebet += ($transaction['bayaran_keuntungan'] - $transaction['keuntungan_rebet']);@endphp
@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-right">Jumlah:</td>
<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) }}</td>
{{ 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) }}</td>
{{ formatCurrency($totalRebet + $tebusRebet) }}</td>
<td class="py-3 px-4 border border-gray-300 text-right">
</td>
</tr>
@@ -290,60 +360,118 @@
</table>
</div>
<div class="print:page-break-before 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 TERAKHIR</h2>
<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="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($tebusTransaction['bayaran_pembiayaan']) }}
<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>
{{-- Deposits and Additions --}}
<div class="col-span-1">Keuntungan 1%</div>
<div class="col-span-1 text-right">
{{ formatCurrency($tebusTransaction['onepercent']) }}
</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
{{-- ATM & Debit Card Withdrawals --}}
<div class="col-span-1">Rebet Keuntungan 1%</div>
<div class="col-span-1 text-right text-red-600">
{{ formatCurrency($tebusTransaction['onepercent'] - $tebusTransaction['onepercent_rebet']) }}
</div>
<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>
{{-- Deposits and Additions --}}
<div class="col-span-1">Ujrah</div>
<div class="col-span-1 text-right">
{{ formatCurrency($tebusTransaction['ujrah']) }}
</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>
{{-- ATM & Debit Card Withdrawals --}}
<div class="col-span-1">Rebet Ujrah</div>
<div class="col-span-1 text-right text-red-600">
{{ formatCurrency($tebusTransaction['ujrah'] - $tebusTransaction['ujrah_rebet']) }}
</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>
{{--
<div class="col-span-1">Ujrah</div>
<div class="col-span-1 flex justify-end items-center">
<span class="border-t border-black w-2/5"></span>
<span class="ml-2 text-right text-red-600">-122.50</span>
</div> --}}
{{-- ATM & Debit Card Withdrawals --}}
<div class="col-span-1">(+) Jumlah Rebet</div>
<div class="col-span-1 text-right ">
{{ formatCurrency($totalUpahRebet) }}
</div>
{{-- Separator Line (Visual emphasis for Ending Balance calculation) --}}
<div class="col-span-2 my-2"></div>
{{-- Deposits and Additions --}}
<div class="col-span-1">(+) Upah Tebus Rebet</div>
<div class="col-span-1 text-right">
{{ formatCurrency($tebusRebet) }}
</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($tebusTransaction['duit_masuk']) }}
{{-- 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>
@@ -370,4 +498,4 @@
</body>
</html>
</html>