diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index ba5fc11..de3b83a 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -5,6 +5,10 @@ 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; class ProfileController extends Controller { @@ -52,4 +56,92 @@ class ProfileController extends Controller return back()->withPasswordStatus(__('Password successfully updated.')); } + + public function printSuratWakil($kodcaw, $norujukan) + { + $api_url = config('api.urlujrah'); + $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.urlujrah') . '/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.urlujrah') . '/api/updatewakil/' . $kodcaw . '/' . $norujukan)->json(); + + $gadai = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.urlujrah') . '/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.urlujrah') . '/api/customers/' . $noic)->json(); + + $cawangan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.urlujrah') . '/api/cawangan/detail/' . $kodcaw)->json(); + + $cawangan_detail = $cawangan[0]; + + $nosiri = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.urlujrah') . '/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')); + } 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.urlujrah') . '/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.urlujrah') . '/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.urlujrah') . '/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.urlujrah') . '/api/customers/' . $noic)->json(); + + $cawangan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.urlujrah') . '/api/cawangan/detail/' . $kodcaw)->json(); + + $cawangan_detail = $cawangan[0]; + + $nosiri = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.urlujrah') . '/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')); + } + } } diff --git a/config/api.php b/config/api.php index e8ea7a3..39fdff4 100644 --- a/config/api.php +++ b/config/api.php @@ -1,4 +1,5 @@ env('API_URL') + 'url' => env('API_URL'), + 'urlujrah' => env('API_UJRAH_URL') ]; \ No newline at end of file diff --git a/config/app.php b/config/app.php index ed9f19b..3d4befa 100644 --- a/config/app.php +++ b/config/app.php @@ -234,4 +234,6 @@ return [ 'api_verify' => env('API_VERIFY',true), + 'api_ujrah_url' => env('API_UJRAH_URL', 'http://localhost'), + ]; diff --git a/resources/views/includes/partials/table-pembiayaan.blade.php b/resources/views/includes/partials/table-pembiayaan.blade.php index 42aaaab..da474fd 100644 --- a/resources/views/includes/partials/table-pembiayaan.blade.php +++ b/resources/views/includes/partials/table-pembiayaan.blade.php @@ -8,6 +8,7 @@ T Akhir Keuntungan Cawangan + Surat Wakil @@ -27,6 +28,8 @@ {{ $data->tarikh_akhir }} {{ $data->upah_tawarruq_formatted }} {{ $data->cawangan_name }} + + @endforeach diff --git a/resources/views/print/surat_wakil.blade.php b/resources/views/print/surat_wakil.blade.php new file mode 100644 index 0000000..0b7e6be --- /dev/null +++ b/resources/views/print/surat_wakil.blade.php @@ -0,0 +1,288 @@ + + + + + + + + + + +
+
+

KOPERASI PERMODALAN KELANTAN BERHAD (D-5-0228)

+

{{ $cawangan_detail['namacaw'] }}

+

{{ $cawangan_detail['alamat1'] }}

+

{{ $cawangan_detail['alamat2'] }}

+

{{ $cawangan_detail['notel'] }}

+
+
+
+ User Image + User Image +
+
+
+
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 +
+ Penyelesaian Penuh dan Permohonan Pembiayaan Baru +
+ + + + + + + + + +
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 + :
+ + + + + + +
2. Saya mengaku tidak akan membuat apa-apa TUNTUTAN @ GANTI RUGI atas kebarangkalian @ + kerugian yang berlaku disebabkan perlantikan wakil bagi menyelesaikan pembiayaan saya.
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Tandatangan PelangganTandatangan Wakil
__________________________________________________________________
Nama: {{$customer_detail['nama']}}Nama:
Tarikh: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.

+
+ + + + + + + + + + \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 84e4ed8..3e31c35 100644 --- a/routes/web.php +++ b/routes/web.php @@ -249,6 +249,7 @@ Route::group(['middleware' => 'auth','verified'], function () { Route::get('/resit', 'App\Http\Controllers\BayaranController@ResitBayaran')->name('action.resit'); Route::get('profile', ['as' => 'profile.edit', 'uses' => 'App\Http\Controllers\ProfileController@edit']); 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']); });