diff --git a/app/Http/Controllers/GadaianController.php b/app/Http/Controllers/GadaianController.php
index df906a9..f33508a 100644
--- a/app/Http/Controllers/GadaianController.php
+++ b/app/Http/Controllers/GadaianController.php
@@ -59,6 +59,33 @@ class GadaianController extends Controller
$cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
return view('gadaian.index',compact('customer_info','limit_pinjaman_semasa','cawangan_info','norujukan','api_url'));
}
+
+ public function edit(Request $request,$norujukan){
+
+ $api_url = config('api.url');
+ $current = Carbon::now();
+ $current = new Carbon();
+ $curent_year = substr($current->year,2,2);
+ $curent_month = sprintf("%02d", $current->month);
+ $current_day = sprintf("%02d", $current->day);
+ // dd($current_day);
+
+
+ $gadaiannorujukan = Http::get(config('api.url') . '/api/gadai/norujukan/'. $norujukan)->json();
+
+ if(sizeof($gadaiannorujukan) != 0)
+ $gadaiannorujukan = $gadaiannorujukan[0][0];
+
+ $noic = $request->noic;
+ $customers_info = Http::get(config('api.url') . '/api/customers/'. $gadaiannorujukan['nokp'])->json();
+ $customer_info = $customers_info[0];
+
+ $limit_pinjaman_semasa = 0;
+ $auth_user = Auth::user();
+
+ $cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
+ return view('gadaian.edit',compact('customer_info','limit_pinjaman_semasa','cawangan_info','norujukan','api_url'));
+ }
public function store(Request $request){
$auth_user = Auth::user();
@@ -91,6 +118,37 @@ class GadaianController extends Controller
return redirect()->route('customer_info');
}
+ public function editstore(Request $request){
+ $auth_user = Auth::user();
+ // dd($request);
+ $total_nilai_marhun = $request->total_nilai_marhun;
+ $total_nilai_marhun = str_replace(',','',$total_nilai_marhun);
+
+ $margin_pinjaman = $request->pinjaman / $total_nilai_marhun;
+ // dd($margin_pinjaman);
+ $kadarupah = $request->kadarkeuntungan * 100;
+ $keuntungan6bulan = $request->keuntungan_6bln;
+ $keuntungan12bulan = $request->keuntungan_sebulan*12;
+ $hargajualan = $request->pinjaman + $keuntungan12bulan;
+ $gadai = Http::put(config('api.url').'/api/gadai/norujukan/'. $auth_user['cawangan'] .'/' . $request->norujukan_gadai,[
+ 'kodcaw' => $auth_user['cawangan'],
+ 'nilaimarhun' => round($total_nilai_marhun, 2),
+ 'berat' => round($request->total_berat, 2),
+ 'pinjaman' => round($request->pinjaman, 2),
+ 'kadarupah' => round($kadarupah, 2),
+ 'marhun' => $request->marhun_detail,
+ 'percentpinj' => $margin_pinjaman,
+ 'teller'=> $auth_user['name'],
+ 'upah6' => $keuntungan6bulan,
+ 'upah12' => $keuntungan12bulan,
+ 'hargajualan' => $hargajualan,
+ 'kuantiti_marhun' => $request->kuantiti_marhun
+ ])->json();
+ $request->session()->forget('page_reload');
+ $request->session()->forget('norujukan');
+ return redirect()->route('customer_info');
+ }
+
public function batal(Request $request){
$norujukan = $request->norujukan;
$auth_user = Auth::user();
@@ -181,6 +239,37 @@ class GadaianController extends Controller
return view('print.resitansuran',compact('transaction','gadai','customers_info'));
}
+ public function resittebus($id)
+ {
+
+ $gadai = Http::get(config('api.url') . '/api/gadai/norujukan/'. $id)->json();
+
+
+
+ if(sizeof($gadai) != 0)
+ $gadai = $gadai[0][0];
+
+ $customers_info = Http::get(config('api.url') . '/api/customers/'. $gadai['nokp'])->json();
+
+ if(sizeof($customers_info) != 0)
+ $customers_info = $customers_info[0];
+
+
+ $penebusan = Http::get(config('api.url') . '/api/listpenebusanhistory/ALS',[ "norujukan" => $id])->json();
+
+ if(sizeof($penebusan) != 0)
+ $penebusan = $penebusan[0];
+
+
+ $wakil = Http::get(config('api.url') . '/api/getwakil/ALS/code/' . $penebusan['nowakil'])->json();
+
+ // dd($wakil);
+ if(sizeof($wakil) != 0)
+ $wakil = $wakil[0];
+
+ return view('print.resittebus',compact('transaction','gadai','customers_info','penebusan','wakil'));
+ }
+
public function history(Request $request)
{
$auth_user = Auth::user();
diff --git a/resources/views/customers/info.blade.php b/resources/views/customers/info.blade.php
index 6e234f9..5a8da72 100644
--- a/resources/views/customers/info.blade.php
+++ b/resources/views/customers/info.blade.php
@@ -510,18 +510,10 @@
}
else
{
- $.ajax({
- method:'get',
- url:'{{ route("gadai.history") }}',
- data:{ "norujukan" : ubahid},
- success:function(data)
- {
-
- },error: function(xhr, status, error) {
- var err = eval("(" + xhr.responseText + ")");
- alert(xhr.responseText);
- }
- });
+ var urlroute = '{{ route("gadaian.edit", ":id") }}';
+ urlroute = urlroute.replace(':id', ubahid);
+
+ window.location.replace(urlroute);
}
}
diff --git a/resources/views/gadaian/edit.blade.php b/resources/views/gadaian/edit.blade.php
new file mode 100644
index 0000000..00da599
--- /dev/null
+++ b/resources/views/gadaian/edit.blade.php
@@ -0,0 +1,803 @@
+@extends('layouts.app')
+
+@section('content')
+
+
+
+
gadaian
+
+
+
+
+
+
+
+
+
+ | Bil |
+ Marhun |
+ Nilai Marhun |
+ Karat |
+ Berat |
+ Nota |
+
+
+
+
+
+
+
+
+
+
+
+
+@endsection
diff --git a/resources/views/penebusan/index.blade.php b/resources/views/penebusan/index.blade.php
index ac6a000..9e03cfe 100644
--- a/resources/views/penebusan/index.blade.php
+++ b/resources/views/penebusan/index.blade.php
@@ -183,7 +183,7 @@
-
+
TAMBAH PEMBIAYAAN(RM)
@@ -193,7 +193,8 @@
@php
- $maxgadai = ($gadai['nilaimarhun'] * 0.7) - $gadai['pinjaman'];
+ $maxgadai = ($gadai['nilaimarhun'] * 0.8) - $gadai['bakipjm'];
+
@endphp
@@ -683,10 +684,14 @@ function bayaransemua()
var pinjaman = "{{ $gadai['pinjaman']}}";
var ansuran = 0;
var addpinjaman = 0;
- var bakipinjaman = 0;
+ var bakipinjaman = $('#perludibayar').val();
var bakiupah = 0;
var historygadaian = 0;
var marhun = "{{ $gadai['marhun'] }}";
+ var nowakil = nw;
+
+ var urlroute = '{{ route("resit.tebus", ":id") }}';
+ urlroute = urlroute.replace(':id', norujukan);
$.ajax({
method:'PUT',
@@ -703,14 +708,18 @@ function bayaransemua()
"bakipinjaman" : bakipinjaman,
"bakiupah" : bakiupah,
"historygadaian" : historygadaian,
- "marhun" : marhun
+ "marhun" : marhun,
+ "nowakil" : nowakil
},
success:function(success_data){
- Swal.fire(
- 'Good job!',
- 'You clicked the button!',
- 'success'
- ).then(function() {
+ Swal.fire({
+ icon: 'success',
+ title: 'Good job!',
+ text: 'You clicked the button!',
+ footer: '
Why do I have this issue?'
+
+ }).then(function() {
+ window.open(urlroute, '_blank');
window.location.replace("{{ url()->previous() }}");
})
}
@@ -902,7 +911,7 @@ function bayaransemua()
var pinjaman = parseFloat("{{ $gadai['pinjaman']}}");
var marhun_detail = marhun_baru;
var kuantiti_marhun = Number("{{sizeof($marhun)}}") - array_recno.length;
- var nowakil = '';
+ var nowakil = nw;
console.log("Pinjaman Baru Sekali Lagi: " + pinjamanbaru);
// console.log('lebihan : ' + lebihan + ' ');
@@ -910,9 +919,9 @@ function bayaransemua()
console.log("nilai_marhun_lama:" + nilai_marhun_lama + " " + "nilai_marhun:" + nilai_marhun + " " + "pinjamanbaru:" + pinjamanbaru + " " + "bakipinjaman:" + bakipinjaman + " ");
console.log("historygadaian:" + historygadaian + " " + "marhun:" + marhun + " " + "total_berat:" + total_berat + " " + "pinjaman:" + pinjaman + " ");
console.log("marhun_detail: " + marhun_detail + "kuantiti_marhun: " + kuantiti_marhun);
-
+ console.log(nowakil);
- // return;
+ return;
var kadarupahbaru = 0;
@@ -1079,6 +1088,7 @@ function bayaransemua()
}
+let nw = 0;
function wakilfunction(e)
{
@@ -1116,6 +1126,9 @@ function wakilfunction(e)
title: 'Maklumat anda Berjaya Direkodkan!'
});
+ console.log(data.NOWAKIL);
+ nw = data.NOWAKIL;
+
$('#wakiltxt').prop( "disabled", true );
$(e).html("Ubah");
$(e).attr("onclick","ubahwakil(this)");
@@ -1169,7 +1182,7 @@ function daftarwakil()
{
$('#WakilModal').hide();
$('#WakilModal').modal('hide');
-
+ nw = nowakil;
Swal.fire({
allowOutsideClick: false,
allowEscapeKey: false,
diff --git a/resources/views/print/resitansuran.blade.php b/resources/views/print/resitansuran.blade.php
index d64df8f..17b698e 100644
--- a/resources/views/print/resitansuran.blade.php
+++ b/resources/views/print/resitansuran.blade.php
@@ -431,9 +431,6 @@ hr.new5 {
| (-) Bayaran Pelanggan | | RM {{ number_format($transaction['duit_masuk'],2) }} |
-
- | (-) Rebate | | RM {{ number_format($transaction['duit_masuk'],2) }} |
-
| Baki Harga Jualan | | RM {{ number_format($transaction['bakiharga'],2) }} |
diff --git a/resources/views/print/resittebus.blade.php b/resources/views/print/resittebus.blade.php
index 17b698e..48517b0 100644
--- a/resources/views/print/resittebus.blade.php
+++ b/resources/views/print/resittebus.blade.php
@@ -393,28 +393,26 @@ hr.new5 {
+
-| Marhun | : {{ $gadai['marhun'] }} | | | | No SAG | {{ $transaction['norujukan'] }} |
+Marhun | : {{ $gadai['marhun'] }} | | | | No SAG | {{ $gadai['norujukan'] }} |
| |
-| Nama | : {{ $customers_info['nama'] }} | | | | Tarikh Bayar | @php $time = new DateTime($transaction['created_at']); $date = $time->format('n/j/Y'); echo $date; @endphp |
+Nama | : {{ $customers_info['nama'] }} | | | | Tarikh Bayar | @php $time = new DateTime($penebusan['t_tebus']); $date = $time->format('n/j/Y'); echo $date; @endphp |
| |
| No K/P | : {{ $customers_info['kpbaru'] }} | | | | Tempoh Simpan | {{ $gadai['tempoh'] }} |
|
-
-
-| Nama Wakil | : | | | | | |
+Nama Wakil | : @php if(sizeof($wakil) != 0){ echo $wakil['NAMA'];} else echo ''; @endphp | | | | | |
| |
-
-| No K/P Wakil | : | | | | | |
+No K/P Wakil | : @php if(sizeof($wakil) != 0) echo $wakil['NOKP']; else echo ''; @endphp | | | | | |
| |
@@ -423,16 +421,19 @@ hr.new5 {
-| Tarikh Bayaran | | @php $time = new DateTime($transaction['created_at']); $date = $time->format('n/j/Y'); echo $date; @endphp |
+ Tarikh Bayaran | | @php $time = new DateTime($penebusan['t_tebus']); $date = $time->format('n/j/Y'); echo $date; @endphp |
-| Harga Jualan | | RM {{ number_format(($transaction['bakiharga'] + $transaction['duit_masuk']),2) }} |
+Harga Jualan | | RM {{ number_format(($gadai['hargajualan']),2) }} |
-| (-) Bayaran Pelanggan | | RM {{ number_format($transaction['duit_masuk'],2) }} |
+(-) Bayaran Pelanggan | | RM {{ number_format($penebusan['BakiPjm'],2) }} |
-| Baki Harga Jualan | | RM {{ number_format($transaction['bakiharga'],2) }} |
+ (-) Rebate | | RM {{ number_format($penebusan['rebate'],2) }} |
+
+
+| Baki Harga Jualan | | RM {{ number_format($gadai['bakihargajualan'],2) }} |
@@ -492,10 +493,10 @@ hr.new5 {
-| Marhun | : {{ $gadai['marhun'] }} | | | | No SAG | {{ $transaction['norujukan'] }} |
+Marhun | : {{ $gadai['marhun'] }} | | | | No SAG | {{ $gadai['norujukan'] }} |
| |
-| Nama | : {{ $customers_info['nama'] }} | | | | Tarikh Bayar | @php $time = new DateTime($transaction['created_at']); $date = $time->format('n/j/Y'); echo $date; @endphp |
+Nama | : {{ $customers_info['nama'] }} | | | | Tarikh Bayar | @php $time = new DateTime($penebusan['t_tebus']); $date = $time->format('n/j/Y'); echo $date; @endphp |
| |
@@ -505,12 +506,12 @@ hr.new5 {
-| Nama Wakil | : | | | | | |
+Nama Wakil | : @php if(sizeof($wakil) != 0){ echo $wakil['NAMA'];} else echo ''; @endphp | | | | | |
| |
-| No K/P Wakil | : | | | | | |
+No K/P Wakil | : @php if(sizeof($wakil) != 0) echo $wakil['NOKP']; else echo ''; @endphp | | | | | |
|
@@ -519,16 +520,19 @@ hr.new5 {
-| Tarikh Bayaran | | @php $time = new DateTime($transaction['created_at']); $date = $time->format('n/j/Y'); echo $date; @endphp |
+ Tarikh Bayaran | | @php $time = new DateTime($penebusan['t_tebus']); $date = $time->format('n/j/Y'); echo $date; @endphp |
-| Harga Jualan | | RM {{ number_format(($transaction['bakiharga'] + $transaction['duit_masuk']),2) }} |
+Harga Jualan | | RM {{ number_format(($gadai['hargajualan']),2) }} |
-| (-) Bayaran Pelanggan | | RM {{ number_format($transaction['duit_masuk'],2) }} |
+(-) Bayaran Pelanggan | | RM {{ number_format($penebusan['BakiPjm'],2) }} |
-| Baki Harga Jualan | | RM {{ number_format($transaction['bakiharga'],2) }} |
+ (-) Rebate | | RM {{ number_format($penebusan['rebate'],2) }} |
+
+
+| Baki Harga Jualan | | RM {{ number_format($gadai['bakihargajualan'],2) }} |
diff --git a/routes/web.php b/routes/web.php
index fbcd7bc..de32889 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -121,7 +121,8 @@ Route::get('/getkelulusan',['as'=>'khazanah.getkelulusan','uses'=>'KhazanahContr
Route::post('/createkelulusan',['as'=>'khazanah.createkelulusan','uses'=>'KhazanahController@createkelulusan'])->middleware('auth','teller');
Route::put('/updatekelulusan',['as'=>'khazanah.updatekelulusan','uses'=>'KhazanahController@updatekelulusan'])->middleware('auth','khazanah');
Route::post('/createpanjar',['as'=>'khazanah.createpanjar','uses'=>'KhazanahController@createkelulusan'])->middleware('auth','teller');
-
+Route::get('/gadaian/edit/{norujukan}',['as'=>'gadaian.edit','uses'=>'GadaianController@edit'])->middleware('auth','teller');
+Route::post('/gadai/edit/store',['as'=>'gadai.editstore','uses'=>'GadaianController@editstore'])->middleware('auth','teller');
//Laporan Baru
Route::get('/laporan/lelongan',['as'=>'laporan.lelongan','uses'=>'KhazanahController@laporanLelongan'])->middleware('auth','khazanah');
@@ -145,6 +146,7 @@ Route::get('laporan/ringkasanterkumpul/cetak',['as'=>'ringkasanterkumpul.laporan
//Resit Ansurans
Route::get('/resit/{id}',['as'=>'resit.ansuran','uses'=>'GadaianController@resit'])->middleware('auth','teller');
+Route::get('/resit/tebus/{id}',['as'=>'resit.tebus','uses'=>'GadaianController@resittebus'])->middleware('auth','teller');
Route::post('/barcodescanned',['as'=>'barcode.scanned','uses'=>'KhazanahController@barcodescanned'])->middleware('auth','khazanah');