added pdf and fix surat wakil no pdf and added pdf for resit

This commit is contained in:
hafifierahman
2025-01-21 00:07:48 +08:00
parent 8df8551f83
commit b489855d11
5 changed files with 154 additions and 13 deletions
+44 -1
View File
@@ -16,6 +16,7 @@ use Illuminate\Support\Facades\Log;
use Money\Money; use Money\Money;
use App\Services\OnlineTransactionLoggerService; use App\Services\OnlineTransactionLoggerService;
use Illuminate\Support\Facades\Session; use Illuminate\Support\Facades\Session;
use PDF;
class BayaranController extends Controller class BayaranController extends Controller
{ {
@@ -215,7 +216,49 @@ class BayaranController extends Controller
->json(); ->json();
$gadai = $gadai_details[0][0]; $gadai = $gadai_details[0][0];
return view('pembayaran.resit.resitportal', compact('customer_details', 'payment_details', 'cawangan_detail', 'nama_cawangan', 'gadai')); $company = Session::get('company');
return view('pembayaran.resit.resitportal', compact('customer_details', 'payment_details', 'cawangan_detail', 'nama_cawangan', 'gadai','company'));
}
public function generateResit(Request $request)
{
$this->serviceCallHttp($request->company);
$kpbaru = Auth::User()->icno;
$customer = $this->CallableHttp
->get('/api/customers/' . $kpbaru)
->json();
$customer_details = $customer;
$current = Carbon::now();
$current = new Carbon();
$date = $current->toDateTimeString();
$payment_details = $this->CallableHttp
->get('/api/transaction/online/express', ['billplz_id' => $request->billplzid])
->json();
$cawangan_info = $this->CallableHttp
->get('/api/cawangan/' . $payment_details['kodcaw'])
->json();
$cawangan = $this->CallableHttp
->get('/api/cawangan/detail/' . $payment_details['kodcaw'])
->json();
$cawangan_detail = $cawangan[0];
$nama_cawangan = $cawangan_info['details_caw'];
$gadai_details = $this->CallableHttp
->get('/api/gadai/norujukan/' . $payment_details['norujukan'])
->json();
$gadai = $gadai_details[0][0];
// Load a view and pass data to it
$pdf = PDF::loadView('pembayaran.resit.resitpdf', compact('customer_details', 'payment_details', 'cawangan_detail', 'nama_cawangan', 'gadai'));
// Return the generated PDF (inline display in browser)
return $pdf->stream('resit_pembayaran.pdf');
} }
public function callback(Request $request) public function callback(Request $request)
+1
View File
@@ -6,6 +6,7 @@
"license": "MIT", "license": "MIT",
"require": { "require": {
"php": "^7.3|^8.0", "php": "^7.3|^8.0",
"barryvdh/laravel-dompdf": "^2.2",
"fideloper/proxy": "^4.4", "fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0", "fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1", "guzzlehttp/guzzle": "^7.0.1",
@@ -0,0 +1,93 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{{ config('app.name') }} | Pembayaran Berjaya</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<link href="{{ mix('css/app.css') }}" rel="stylesheet">
<style>
.card_shadow{
box-shadow:0 0 6px 0 rgb(0 0 0 / 20%);
border-radius:4px;
}
hr.dashed {
border-top: 1px dashed;
}
</style>
</head>
<body>
<div style="font-family: Arial, sans-serif; font-size: 12px; margin: 20px;">
<div style="text-align: center; margin-bottom: 20px;">
<img src="{{ asset('argon') }}/img/brand/arrahnlogo.png" height="50" alt="Logo Ar Rahn" />
<img src="{{ asset('argon') }}/img/brand/nama.png" height="50" alt="Logo Ar Rahn" />
</div>
<div style="margin-bottom: 10px;">
<small>Pelanggan yang dihargai,</small>
</div>
<div style="margin-bottom: 20px;">
<small>Terima kasih kerana menggunakan perkhidmatan kami.</small>
</div>
<hr />
<div style="display: flex; justify-content: space-between; margin-bottom: 10px;">
<div>Status Bayaran</div>
<div style="color: #4BB543;">Berjaya</div>
</div>
<hr style="border-style: dashed;" />
<div style="display: flex; justify-content: space-between; margin-bottom: 10px;">
<div>ID Transaksi</div>
<div>{{ $payment_details['reference_no'] }}</div>
</div>
<hr style="border-style: dashed;" />
<div style="display: flex; justify-content: space-between; margin-bottom: 10px;">
<div>No. Surat Akuan Gadai</div>
<div>{{ $payment_details['norujukan'] }}</div>
</div>
<hr style="border-style: dashed;" />
<div style="display: flex; justify-content: space-between; margin-bottom: 10px;">
<div>Nama Pelanggan</div>
<div>{{ $payment_details['customer_name'] }}</div>
</div>
<hr style="border-style: dashed;" />
<div style="display: flex; justify-content: space-between; margin-bottom: 10px;">
<div>Tarikh Transaksi</div>
@php
$myDateTime = DateTime::createFromFormat('Y-m-d', $payment_details['tarikh'] );
$formattedweddingdate = $myDateTime->format('d/m/Y');
@endphp
<div>{{ $formattedweddingdate . ' ' . $payment_details['masa'] }}</div>
</div>
<hr style="border-style: dashed;" />
<div style="display: flex; justify-content: space-between; margin-bottom: 10px;">
<div>Jumlah Bayaran</div>
<div>RM {{ number_format($payment_details['total_payment'], 2) }}</div>
</div>
@if($gadai['hargajualan'] == 0)
<hr style="border-style: dashed;" />
<div style="display: flex; justify-content: space-between; margin-bottom: 10px; color: red;">
<div>Tarikh Lanjutan</div>
<div>31/12/2021</div>
</div>
@endif
<hr />
<div style="color: red; margin-bottom: 10px;">
<small>Sebarang pembayaran akan dikemaskini selepas <b>1 Jam</b> sebaik pembayaran dilakukan</small>
</div>
<div style="margin-bottom: 20px;">
<small>Nota: Resit ini adalah cetakan komputer dan tandatangan tidak diperlukan.</small>
</div>
<div style="text-align: center; margin-top: 20px;">
<small><b>{{ $cawangan_detail['namacaw'] }}</b></small><br />
<small>{{ $cawangan_detail['alamat1'] . ' ' . $cawangan_detail['alamat2'] }}</small>
</div>
</div>
</body>
</html>
@@ -126,12 +126,17 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row justify-content-center"> <form method="POST" name="generateresit" action="{{ route('resit.pdf') }}">
<div class="col-12 text-center" id="rem"> <div class="row justify-content-center">
<a class="btn btn-primary"onclick="loadingbtn();" href="{{ route('home') }}">Kembali Muka Hadapan</a> <div class="col-12 text-center" id="rem">
<button class="btn btn-primary" onclick="cetakresit()">Cetak Resit</button> @csrf
<input type="hidden" name="billplzid" value="{{ $payment_details['billplz_id'] }}">
<input type="hidden" name="company" value="{{ $company }}">
<a class="btn btn-primary"onclick="loadingbtn();" href="{{ route('home') }}">Kembali Muka Hadapan</a>
<button class="btn btn-primary" onclick="cetakresit()">Cetak Resit</button>
</div>
</div> </div>
</div> </form>
</div> </div>
</div> </div>
</div> </div>
@@ -139,13 +144,11 @@
<script> <script>
function cetakresit() function cetakresit()
{ {
let hiding = document.getElementById("rem"); let form = document.getElementById("myForm");
hiding.style.display = "none"; form.submit();
window.print(); }
hiding.style.display = "block";
}
</script> </script>
</body> </body>
+1
View File
@@ -119,6 +119,7 @@ Route::group(['middleware' => 'auth','verified'], function () {
Route::put('profile', ['as' => 'profile.update', 'uses' => 'App\Http\Controllers\ProfileController@update']); Route::put('profile', ['as' => 'profile.update', 'uses' => 'App\Http\Controllers\ProfileController@update']);
Route::get('/cust/print.suratwakil/{kodcaw}/{norujukan}',['as'=>'cust.print.suratwakil','uses'=>'App\Http\Controllers\ProfileController@printSuratWakil']); Route::get('/cust/print.suratwakil/{kodcaw}/{norujukan}',['as'=>'cust.print.suratwakil','uses'=>'App\Http\Controllers\ProfileController@printSuratWakil']);
Route::post('/generate-resit', 'App\Http\Controllers\BayaranController@generateResit')->name('resit.pdf');
}); });
Route::get('/requestic', 'App\Http\Controllers\TacController@requestKadPengenalan')->name('requestic'); Route::get('/requestic', 'App\Http\Controllers\TacController@requestKadPengenalan')->name('requestic');