diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index ba5fc11..09e6482 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -5,6 +5,11 @@ namespace App\Http\Controllers; use App\Http\Requests\ProfileRequest; use App\Http\Requests\PasswordRequest; use Illuminate\Support\Facades\Hash; +use Illuminate\Http\Request; +use Carbon\Carbon; +use Illuminate\Support\Facades\Http; +use Illuminate\Support\Facades\Session; +use PDF; class ProfileController extends Controller { @@ -52,4 +57,98 @@ class ProfileController extends Controller return back()->withPasswordStatus(__('Password successfully updated.')); } + + public function printSuratWakil($kodcaw, $norujukan) + { + $api_url = config('api.url'); + $current = Carbon::now(); + $current = new Carbon(); + $t_cetak = $current->toDateString(); + + $tarikh_cetak = date('d-m-Y'); + $check_norujukan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/checksurat/' . $kodcaw . '/' . $norujukan)->json(); + if ($check_norujukan == $norujukan) { + + //get details gadai && detail customer + + $update_wakil = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/updatewakil/' . $kodcaw . '/' . $norujukan)->json(); + + $gadai = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/gadai/norujukan/' . $norujukan)->json(); + $gadai_details = $gadai[0][0]; + + $noic = $gadai_details['nokp']; + $customer_detail = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customers/' . $noic)->json(); + + $cawangan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/detail/' . $kodcaw)->json(); + + $cawangan_detail = $cawangan[0]; + + $nosiri = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/nosiri/wakil/' . $kodcaw . '/' . $norujukan)->json(); + + // $pdf=PDF::loadView('print.surat_wakil', compact('customer_detail','current','auth_user','api_url','cawangan_detail')) + // ->setPaper('A4','potrait'); + // return $pdf->download('notislelong_'.'.pdf'); + // dd($gadai_details); + + + // return view('print.surat_wakil', compact('customer_detail', 'current', 'kodcaw', 'api_url', 'cawangan_detail', 'tarikh_cetak', 'gadai_details', 'noic', 'nosiri')); + $pdf = PDF::loadView('print.surat_wakil', compact('customer_detail', 'current', 'kodcaw', 'api_url', 'cawangan_detail', 'tarikh_cetak', 'gadai_details', 'noic', 'nosiri')) + ->setPaper('a4', 'potrait'); + return $pdf->download('Surat Wakil.pdf'); + } else { + + // insert into wakil_surat + + $current_year = substr($current->year, 2, 2); + $current_month = sprintf("%02d", $current->month); + $current_day = sprintf("%02d", $current->day); + + + $surat_wakil = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/wakil/' . $kodcaw . '/' . $t_cetak)->json(); + if ($surat_wakil) { + $new_suratid = $surat_wakil['nosiri'] + 1; + } else { + $new_suratid = 1; + } + + + $new_surat = sprintf("%04d", $new_suratid); + + $no_surat = 'WK' . $current_year . $current_month . $current_day . '-' . $new_surat; + Session::put('norujukan', $norujukan); + Session::put('no_surat', $no_surat); + Session::put('page_reload', true); + $gadai = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url') . '/api/wakil/' . $kodcaw, [ + 'nosiri' => $new_suratid, + 'no_surat' => $no_surat, + 'norujukan' => $norujukan, + 't_cetak' => $t_cetak, + + ]); + + //get details gadai && detail customer + + $gadai = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/gadai/norujukan/' . $norujukan)->json(); + $gadai_details = $gadai[0][0]; + + $noic = $gadai_details['nokp']; + $customer_detail = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customers/' . $noic)->json(); + + $cawangan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/detail/' . $kodcaw)->json(); + + $cawangan_detail = $cawangan[0]; + + $nosiri = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/nosiri/wakil/' . $kodcaw . '/' . $norujukan)->json(); + + + // $pdf=PDF::loadView('print.surat_wakil', compact('customer_detail','current','auth_user','api_url','cawangan_detail')) + // ->setPaper('A4','potrait'); + // return $pdf->download('notislelong_'.'.pdf'); + + // return view('print.surat_wakil', compact('customer_detail', 'current', 'kodcaw', 'api_url', 'cawangan_detail', 'tarikh_cetak', 'gadai_details', 'noic', 'nosiri')); + $pdf = PDF::loadView('print.surat_wakil', compact('customer_detail', 'current', 'kodcaw', 'api_url', 'cawangan_detail', 'tarikh_cetak', 'gadai_details', 'noic', 'nosiri')) + ->setPaper('a4', 'potrait'); + return $pdf->download('Surat Wakil.pdf'); + } + } } diff --git a/config/api.php b/config/api.php index e8ea7a3..a64a030 100644 --- a/config/api.php +++ b/config/api.php @@ -1,4 +1,4 @@ env('API_URL') -]; \ No newline at end of file + 'url' => env('API_URL'), +]; diff --git a/public/img/ARRAHN1.png b/public/img/ARRAHN1.png new file mode 100644 index 0000000..50c0e08 Binary files /dev/null and b/public/img/ARRAHN1.png differ diff --git a/public/img/kopkb.png b/public/img/kopkb.png new file mode 100644 index 0000000..c0ca932 Binary files /dev/null and b/public/img/kopkb.png differ diff --git a/resources/views/includes/partials/table-pembiayaan.blade.php b/resources/views/includes/partials/table-pembiayaan.blade.php index 42aaaab..f998ee3 100644 --- a/resources/views/includes/partials/table-pembiayaan.blade.php +++ b/resources/views/includes/partials/table-pembiayaan.blade.php @@ -8,6 +8,7 @@
|
+
+
+ KOPERASI PERMODALAN KELANTAN BERHAD (D-5-0228) +{{ $cawangan_detail['namacaw'] }} +{{ $cawangan_detail['alamat1'] }} +{{ $cawangan_detail['alamat2'] }} +{{ $cawangan_detail['notel'] }} + |
+
+
+
+
+
+
+
+ |
+
+
+
+ Tarikh Cetak: {{$tarikh_cetak}} +No Siri: {{$nosiri}} + |
+
SURAT PELANTIKAN WAKIL
TUJUAN PENYELESAIAN PEMBIAYAAN DI AR-RAHN
| Nama Pelanggan | +: {{$customer_detail['nama']}} | +||
|---|---|---|---|
| No Surat Akuan Gadai | +: {{$gadai_details['norujukan']}} | +Nilai Marhun | +: RM{{number_format($gadai_details['nilaimarhun'],2) }} | +
| No MyKad / Passport | +: {{$noic}} | +Nilai Pembiayaan | +: RM{{number_format($gadai_details['pinjaman'],2)}} | +
| No Telefon | +: {{$customer_detail['telefon']}} | +Baki Pembiayaan | +: RM{{number_format($gadai_details['bakipjm'],2)}} | +
| + | + | Harga Jualan | +: RM{{number_format($gadai_details['hargajualan'],2)}} | +
| + Saya seperti nama di atas, ingin memaklumkan kepada Ar-Rahn Koperasi Permodalan Kelantan Berhad + bagi Cawangan {{ $cawangan_detail['namacaw'] }}, bahawa saya tidak dapat hadir untuk melakukan transaksi: + | +|||
| + + | + | Penyelesaian Penuh + + + + | |
|---|---|---|---|
| 1. Saya melantik nama dibawah sebagai wakil bagi pihak saya untuk transaksi sebagaimana di atas. Maklumat wakil adalah seperti berikut: | +|
| 2. Saya mengaku tidak akan membuat apa-apa Tuntutan @ Ganti Rugi atas kebarangkalian @ kerugian yang berlaku disebabkan perlantikan wakil bagi apa-apa transaksi sebagai wakil saya. + | +
| Nama + | : | +
|---|---|
| No. Kad Pengenalan + | : | +
| No. Telefon + | : | +
| Hubungan + | : | +
| Tandatangan Pelanggan | +Tandatangan Wakil | +
|---|---|
|
+ ___________________________________ + Nama : {{$customer_detail['nama']}} + Tarikh : + |
+
+ ___________________________________ + Nama : + Tarikh : + |
+
| Tandatangan Pengurus Cawangan | +
|---|
|
+ ___________________________________ + Nama : + Tarikh : + |
+
*Penting:
+a) Sila lampirkan bersama:
+i. Salinan kad pengenalan diri pelanggan dan kad pengenalan diri wakil yang dilantik.
+ii. SAG asal pelanggan
+b) Pastikan tandatangan pelanggan adalah sama dengan tandatangan di Surat Akuan Gadai.
+