From a2ab244c919626924b9062c24d628482269992ab Mon Sep 17 00:00:00 2001 From: Nur Izzati Zulkifli Date: Thu, 14 Jul 2022 16:54:51 +0800 Subject: [PATCH] update function simulasi rekod --- app/Http/Controllers/LelongController.php | 52 +++- app/Http/Controllers/SimulasiController.php | 287 +++++++++++------- app/Models/Customer.php | 2 +- resources/views/includes/sidebar.blade.php | 4 +- .../views/lelong/listsagbycust.blade.php | 263 ++++++++++++++++ .../views/lelong/senaraimarhun.blade.php | 33 +- resources/views/lelong/showsimulasi.blade.php | 11 +- .../views/simulasi/listsagbycust.blade.php | 120 ++++---- .../views/simulasi/senaraimarhunlel.blade.php | 4 +- .../views/simulasi/senaraisimulasi.blade.php | 12 +- .../views/simulasi/showsimulasi.blade.php | 11 +- routes/web.php | 3 +- 12 files changed, 598 insertions(+), 204 deletions(-) create mode 100644 resources/views/lelong/listsagbycust.blade.php diff --git a/app/Http/Controllers/LelongController.php b/app/Http/Controllers/LelongController.php index 9b0e2f8f..3b7a31fc 100644 --- a/app/Http/Controllers/LelongController.php +++ b/app/Http/Controllers/LelongController.php @@ -999,6 +999,7 @@ class LelongController extends Controller 'lelongbid.bakiupah', 'lelongbid.status_jual', 'lelongbid.jbg', + 'gadai.pinjaman as pinjasal', 'gadai.bakipjm', 'gadai.bakihargajualan', 'gadai.upah12', @@ -1006,9 +1007,11 @@ class LelongController extends Controller 'gadai.tempoh', 'gadai.tempohbayar', 'gadai.kadarupah', - 'gadai.nokp' + 'gadai.nokp', + 'gadai.bakiupah as upah6bulan' ) ->get()->toArray(); + // dd($marhuns); foreach ($marhuns as $index1=> $cal) { @@ -1017,6 +1020,10 @@ class LelongController extends Controller ->orWhere('kplama','=',$cal['nokp']) ->first(); + $ktlhbyr = TransaksiKeuntungan::on('mysql2')->where('norujukan','=',$cal['norujukan'])->sum('bayaran_keuntungan'); + // dd($ktlhbyr); + $marhuns[$index1]['ktlhbyr'] = $ktlhbyr; + $keuntungan = $cal['bakipjm'] - ($cal['bakihargajualan'] - ($cal['upah12'] - $cal['ansakhir'])-(($cal['tempoh']-$cal['tempohbayar'])*$cal['kadarupah']/100*$cal['bakipjm']) ); $marhuns[$index1]['keuntungan'] = bcdiv($keuntungan,1,1); $marhuns[$index1]['nama'] = $customer; @@ -2635,6 +2642,49 @@ class LelongController extends Controller ->with('success','Create Lelong Berjaya'); } + public function listsagbycust($lelongid, $cawid) + { + $keuntungan = 0; + + $marhuns = LelongBid::join('cawangan', 'lelongbid.caw_id', '=', 'cawangan.id') + ->join('gadai','lelongbid.norujukan','=','gadai.norujukan') + ->where('lelong_id','=',$lelongid) + ->where('caw_id','=',$cawid) + ->groupBy('gadai.nokp') + ->select('gadai.nokp') + ->get()->toArray(); + // dd($marhuns); + + foreach($marhuns as $index1=>$cal){ + $customer = Customer::on('mysql2') + ->where('kpbaru','=',$cal['nokp']) + ->orWhere('kplama','=',$cal['nokp']) + ->first(); + + $listsag = LelongBid::join('gadai', 'gadai.norujukan','=','lelongbid.norujukan') + ->where('gadai.nokp','=',$cal['nokp']) + ->select('lelongbid.bakiupah', 'gadai.bakiupah as 6bulan','lelongbid.norujukan','lelongbid.nilaimarhun','lelongbid.berat','lelongbid.hargaasas','lelongbid.pinjaman','gadai.pinjaman as pinjasal','gadai.tempoh' ) + ->get(); + // dd($listsag); + foreach($listsag as $index=>$listing){ + $ktlhbyr = TransaksiKeuntungan::on('mysql2')->where('norujukan','=',$listing['norujukan'])->sum('bayaran_keuntungan'); + // dd($ktlhbyr); + $listsag[$index]['ktlhbyr'] = $ktlhbyr; + } + + + + // $keuntungan = $cal['bakipjm'] - ($cal['bakihargajualan'] - ($cal['upah12'] - $cal['ansakhir'])-(($cal['tempoh']-$cal['tempohbayar'])*$cal['kadarupah']/100*$cal['bakipjm']) ); + // $marhuns[$index1]['keuntungan'] = $keuntungan; + $marhuns[$index1]['nama'] = $customer; + $marhuns[$index1]['listsag'] = $listsag; + // $marhuns[$index1]['ktlhbyr'] = $ktlhbyr; + // dd($total_untung_asal); + + + } + return view('lelong.listsagbycust',compact('marhuns','lelongid','cawid','listsag','ktlhbyr')); + } diff --git a/app/Http/Controllers/SimulasiController.php b/app/Http/Controllers/SimulasiController.php index c2082164..81b9fbb4 100644 --- a/app/Http/Controllers/SimulasiController.php +++ b/app/Http/Controllers/SimulasiController.php @@ -111,7 +111,7 @@ class SimulasiController extends Controller //create simulasi $simulasi = Simulasi::create([ - 'tarikh_lelong' => $t_lelong, + 'tarikh_lelong' => $request->tarikh_lelong, 'harga_emas_asas' => $hargaasas, 'jbg' => $jbg, 'cajlelong' => $request->cajlelong, @@ -801,7 +801,7 @@ class SimulasiController extends Controller $keuntungan = 0; $marhuns = SimulasiBid::join('cawangan', 'simulasibid.caw_id', '=', 'cawangan.id') - ->join('gadai','simulasibid.norujukan','=','gadai.norujukan') + // ->join('gadai','simulasibid.norujukan','=','gadai.norujukan') ->where('simulasi_id','=',$simulasi_id) ->where('caw_id','=',$cawid) ->select( @@ -817,34 +817,51 @@ class SimulasiController extends Controller 'simulasibid.cajlelong', 'simulasibid.baki', 'simulasibid.status_jual', - 'simulasibid.jbg', - 'gadai.bakipjm', - 'gadai.bakihargajualan', - 'gadai.upah12', - 'gadai.ansakhir', - 'gadai.tempoh', - 'gadai.tempohbayar', - 'gadai.kadarupah', - 'gadai.nokp' + 'simulasibid.jbg' + // 'gadai.bakipjm', + // 'gadai.bakihargajualan', + // 'gadai.upah12', + // 'gadai.ansakhir', + // 'gadai.tempoh', + // 'gadai.tempohbayar', + // 'gadai.kadarupah', + // 'gadai.nokp' ) ->get()->toArray(); - + // dd($marhuns); + $arraymarhun = []; foreach($marhuns as $index1=>$cal){ - $customer = Customer::on('mysql2') - ->where('kpbaru','=',$cal['nokp']) - ->orWhere('kplama','=',$cal['nokp']) - ->first(); + // dd($cal); + $gadai = Gadai::on($cal['kodcaw']) + ->where('norujukan','=',$cal['norujukan']) + ->first(); + // dd($gadai); + $customer = Customer::where('kpbaru','=',$gadai['nokp']) + ->orWhere('kplama','=',$gadai['nokp']) + ->first(); + // dd($customer); - $keuntungan = $cal['bakipjm'] - ($cal['bakihargajualan'] - ($cal['upah12'] - $cal['ansakhir'])-(($cal['tempoh']-$cal['tempohbayar'])*$cal['kadarupah']/100*$cal['bakipjm']) ); + // $keuntungan = $cal['bakipjm'] - ($cal['bakihargajualan'] - ($cal['upah12'] - $cal['ansakhir'])-(($cal['tempoh']-$cal['tempohbayar'])*$cal['kadarupah']/100*$cal['bakipjm']) ); $marhuns[$index1]['keuntungan'] = $keuntungan; $marhuns[$index1]['nama'] = $customer; - + array_push($arraymarhun,[ + 'norujukan' => $cal['norujukan'], + 'tempoh' => $gadai['tempoh'], + 'nama' => $customer['nama'], + 'berat' => $cal['berat'], + 'nilaimarhun' => $cal['nilaimarhun'], + 'hargaasas' => $cal['hargaasas'], + 'pinjaman' => $cal['pinjaman'], + 'bakiupah' => $cal['bakiupah'], + 'cajlelong' => $cal['cajlelong'], + 'baki' => $cal['baki'], + ]); } - return view('simulasi.senaraimarhunlel',compact('marhuns','simulasi_id','cawid','keuntungan')); + return view('simulasi.senaraimarhunlel',compact('arraymarhun','marhuns','simulasi_id','cawid','keuntungan')); } public function deletemarhunlel(Request $request){ @@ -1054,118 +1071,151 @@ class SimulasiController extends Controller $currentdate = Carbon::now(); $currentdate = $currentdate->toDateTimeString(); $data = []; - $senaraisag = SimulasiBid::where('simulasibid.simulasi_id', $simulasi_id) - ->whereNotIn('simulasibid.norujukan', function($query) { - $query->select('norujukan') - ->from('gadai'); - }) - ->get()->toArray(); - // dd($senaraisag); - - foreach($senaraisag as $data) + + $getcaw = Simulasi::where('simulasibid.simulasi_id', $simulasi_id)->get(); + dd($getcaw); + foreach($getcaw as $caw) { - //insert lelong_tebus - $lelongtebus = new LelongTebus; - $lelongtebus->tarikh = $currentdate; - $lelongtebus->kodcaw = $data['kodcaw']; - $lelongtebus->teller = $user->name; - $lelongtebus->norujukan = $data['norujukan']; - $lelongtebus->batch_no = $simulasi_id; - $lelongtebus->nilaimarhun = $data['nilaimarhun']; - $lelongtebus->pinjaman = $data['pinjaman']; - $lelongtebus->upah = $data['bakiupah']; - $lelongtebus->jbg = $data['jbg']; - $lelongtebus->jenis_tebus = 'T'; - $lelongtebus->save(); + $bycaw = + $senaraisag = SimulasiBid::where('simulasibid.simulasi_id', $simulasi_id) + ->whereNotIn('simulasibid.norujukan', function($datagadai) { + $datagadai = Gadai::all(); + }) + ->get()->toArray(); + dd($senaraisag); - // dd($data['norujukan']); - $updatesimulasi = SimulasiBid::where('norujukan','=',$data['norujukan'])->first(); - $updatesimulasi->delete(); - //insert loguser - $loguser = new LogUser; - $loguser->user_id = $user->id; - $loguser->date = $currentdate; - $loguser->username = $user->username; - $loguser->nama_user = $user->name; - $loguser->norujukan = $data['norujukan']; - $loguser->nota = ' Kemaskini Data Simulasi '.$simulasi_id; - $loguser->save(); + foreach($senaraisag as $data) + { + //insert lelong_tebus + $lelongtebus = new LelongTebus; + $lelongtebus->tarikh = $currentdate; + $lelongtebus->kodcaw = $data['kodcaw']; + $lelongtebus->teller = $user->name; + $lelongtebus->norujukan = $data['norujukan']; + $lelongtebus->batch_no = $simulasi_id; + $lelongtebus->nilaimarhun = $data['nilaimarhun']; + $lelongtebus->pinjaman = $data['pinjaman']; + $lelongtebus->upah = $data['bakiupah']; + $lelongtebus->jbg = $data['jbg']; + $lelongtebus->jenis_tebus = 'T'; + $lelongtebus->save(); + + // dd($data['norujukan']); + $updatesimulasi = SimulasiBid::where('norujukan','=',$data['norujukan'])->first(); + $updatesimulasi->delete(); + //insert loguser + $loguser = new LogUser; + $loguser->user_id = $user->id; + $loguser->date = $currentdate; + $loguser->username = $user->username; + $loguser->nama_user = $user->name; + $loguser->norujukan = $data['norujukan']; + $loguser->nota = ' Kemaskini Data Simulasi '.$simulasi_id; + $loguser->save(); + } + + $datatempoh = []; + $senaraisagtempoh = SimulasiBid::join('gadai','gadai.norujukan','=','simulasibid.norujukan') + ->where('simulasibid.simulasi_id', $simulasi_id) + ->whereIn('simulasibid.norujukan', function($query) { + $query->select('norujukan') + ->from('gadai'); + }) + ->select('gadai.tempoh','gadai.tempohbayar','gadai.kadarupah','gadai.norujukan','gadai.tempoh','gadai.bakipjm') + ->get()->toArray(); + // dd($senaraisagtempoh); + + foreach($senaraisagtempoh as $datatempoh) + { + //kemaskini keuntungan + $total_untung_rebet = TransaksiKeuntungan::on('mysql2')->where('norujukan','=',$datatempoh['norujukan'])->sum('keuntungan_rebet'); + $total_untung_asal = TransaksiKeuntungan::on('mysql2')->where('norujukan','=',$datatempoh['norujukan'])->sum('bayaran_keuntungan'); + $beza_keuntungan = $total_untung_asal - $total_untung_rebet; + $keuntungan = bcdiv(($datatempoh['tempoh']-$datatempoh['tempohbayar'])*$datatempoh['kadarupah']/100*$datatempoh['bakipjm'],1,1)-$beza_keuntungan; + // dd($keuntungan); + //update dalam simulasibid + $updatetempoh = SimulasiBid::where('norujukan', $datatempoh['norujukan']) + ->where('simulasi_id', $simulasi_id) + ->first(); + $updatetempoh->jbg = $datatempoh['tempoh']; + $updatetempoh->pinjaman = $datatempoh['bakipjm']; + $updatetempoh->bakiupah = bcdiv($keuntungan,1,1); + $updatetempoh->update(); + + //insert loguser + $loguser = new LogUser; + $loguser->user_id = $user->id; + $loguser->date = $currentdate; + $loguser->username = $user->username; + $loguser->nama_user = $user->name; + $loguser->norujukan = $datatempoh['norujukan']; + $loguser->nota = $simulasi_id.' Kemaskini Tempoh/Bakipjm/Keuntungan' ; + $loguser->save(); + } + + + + $date = Carbon::now()->toDateTimeString(); + $simulasi = Simulasi::where('id','=',$simulasi_id)->first(); + $simulasi->masakemaskini_data = $date; + $simulasi->save(); + + return redirect()->route('analisa.senaraisimulasi') + ->with('success','Kemaskini Berjaya'); } - - $datatempoh = []; - $senaraisagtempoh = SimulasiBid::join('gadai','gadai.norujukan','=','simulasibid.norujukan') - ->where('simulasibid.simulasi_id', $simulasi_id) - ->whereIn('simulasibid.norujukan', function($query) { - $query->select('norujukan') - ->from('gadai'); - }) - ->select('gadai.tempoh','gadai.tempohbayar','gadai.kadarupah','gadai.norujukan','gadai.tempoh','gadai.bakipjm') - ->get()->toArray(); - // dd($senaraisagtempoh); - - foreach($senaraisagtempoh as $datatempoh) - { - //kemaskini keuntungan - $total_untung_rebet = TransaksiKeuntungan::on('mysql2')->where('norujukan','=',$datatempoh['norujukan'])->sum('keuntungan_rebet'); - $total_untung_asal = TransaksiKeuntungan::on('mysql2')->where('norujukan','=',$datatempoh['norujukan'])->sum('bayaran_keuntungan'); - $beza_keuntungan = $total_untung_asal - $total_untung_rebet; - $keuntungan = bcdiv(($datatempoh['tempoh']-$datatempoh['tempohbayar'])*$datatempoh['kadarupah']/100*$datatempoh['bakipjm'],1,1)-$beza_keuntungan; - // dd($keuntungan); - //update dalam simulasibid - $updatetempoh = SimulasiBid::where('norujukan', $datatempoh['norujukan']) - ->where('simulasi_id', $simulasi_id) - ->first(); - $updatetempoh->jbg = $datatempoh['tempoh']; - $updatetempoh->pinjaman = $datatempoh['bakipjm']; - $updatetempoh->bakiupah = bcdiv($keuntungan,1,1); - $updatetempoh->update(); - - //insert loguser - $loguser = new LogUser; - $loguser->user_id = $user->id; - $loguser->date = $currentdate; - $loguser->username = $user->username; - $loguser->nama_user = $user->name; - $loguser->norujukan = $datatempoh['norujukan']; - $loguser->nota = $simulasi_id.' Kemaskini Tempoh/Bakipjm/Keuntungan' ; - $loguser->save(); - } - - - - $date = Carbon::now()->toDateTimeString(); - $simulasi = Simulasi::where('id','=',$simulasi_id)->first(); - $simulasi->masakemaskini_data = $date; - $simulasi->save(); - - return redirect()->route('analisa.senaraisimulasi') - ->with('success','Kemaskini Berjaya'); } public function listsagbycust($simulasi_id, $cawid) { $keuntungan = 0; - - $marhuns = SimulasiBid::join('cawangan', 'simulasibid.caw_id', '=', 'cawangan.id') - ->join('gadai','simulasibid.norujukan','=','gadai.norujukan') + $arraylistgadai = 0; + $marhun = SimulasiBid::join('cawangan', 'simulasibid.caw_id', '=', 'cawangan.id') ->where('simulasi_id','=',$simulasi_id) - ->where('caw_id','=',$cawid) - ->groupBy('gadai.nokp') - ->select('gadai.nokp') - ->get()->toArray(); - // dd($marhuns); + ->where('caw_id','=',$cawid); - foreach($marhuns as $index1=>$cal){ - $customer = Customer::on('mysql2') - ->where('kpbaru','=',$cal['nokp']) + $arraynorujukan = $marhun->pluck('norujukan')->toArray(); + $datasimulasi = $marhun->get(); + $marhuns = Gadai::on($datasimulasi[0]['kodcaw'])->whereIn('norujukan', $arraynorujukan) + ->select('nokp') + ->groupBy('nokp')->get(); + // dd($datagadai); + $arraysag = []; + + foreach($marhuns as $index1=>$cal) + { + $customer = Customer::where('kpbaru','=',$cal['nokp']) ->orWhere('kplama','=',$cal['nokp']) ->first(); + // dd($customer); - $listsag = SimulasiBid::join('gadai', 'gadai.norujukan','=','simulasibid.norujukan') - ->where('gadai.nokp','=',$cal['nokp']) + $listsag = Gadai::on($datasimulasi[0]['kodcaw'])->whereIn('norujukan', $arraynorujukan) + ->where('nokp','=',$cal['nokp']) ->get(); + // dd($listgadai); + foreach($listsag as $index=>$listing){ + $ktlhbyr = TransaksiKeuntungan::on('main')->where('norujukan','=',$listing['norujukan'])->sum('bayaran_keuntungan'); + // dd($ktlhbyr); + $total_untung_rebet = TransaksiKeuntungan::on('main')->where('norujukan','=',$listing['norujukan'])->sum('keuntungan_rebet'); + $total_untung_asal = TransaksiKeuntungan::on('main')->where('norujukan','=',$listing['norujukan'])->sum('bayaran_keuntungan'); + $beza_keuntungan = $total_untung_asal - $total_untung_rebet; + $keuntungan = bcdiv(($listing['tempoh']-$listing['tempohbayar'])*$listing['kadarupah']/100*$listing['bakipjm'],1,1)-$beza_keuntungan; + // dd($keuntungan); + $listsag[$index]['ktlhbyr'] = $ktlhbyr; + $listsag[$index]['keuntungan'] = $keuntungan; + } + + + + + + + + // $listsag = SimulasiBid::join($dbname.'.gadai as db2','SimulasiBid.norujukan','=','db2.norujukan') + // ->where('db2.nokp','=',$cal['nokp']) + // ->where('SimulasiBid.simulasi_id','=',$simulasi_id) + // ->get(); // dd($listsag); // $keuntungan = $cal['bakipjm'] - ($cal['bakihargajualan'] - ($cal['upah12'] - $cal['ansakhir'])-(($cal['tempoh']-$cal['tempohbayar'])*$cal['kadarupah']/100*$cal['bakipjm']) ); @@ -1173,8 +1223,13 @@ class SimulasiController extends Controller $marhuns[$index1]['nama'] = $customer; $marhuns[$index1]['listsag'] = $listsag; + // array_push($arraylistgadai,[ + // 'hargaasas' => $cal[0]['hargaasas'] + + // ]); + } - return view('simulasi.listsagbycust',compact('marhuns','simulasi_id','cawid','listsag')); + return view('simulasi.listsagbycust',compact('marhuns','simulasi_id','cawid','ktlhbyr')); } } diff --git a/app/Models/Customer.php b/app/Models/Customer.php index 443204a7..a7dc8963 100644 --- a/app/Models/Customer.php +++ b/app/Models/Customer.php @@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Model; class Customer extends Model { use HasFactory; - protected $connection = 'mysql2'; + protected $connection = 'main'; protected $table = 'customer'; protected $fillable = [ diff --git a/resources/views/includes/sidebar.blade.php b/resources/views/includes/sidebar.blade.php index 1eb03aeb..777b7d4b 100644 --- a/resources/views/includes/sidebar.blade.php +++ b/resources/views/includes/sidebar.blade.php @@ -157,9 +157,9 @@
  • Tetapan
  • -
  • + diff --git a/resources/views/lelong/listsagbycust.blade.php b/resources/views/lelong/listsagbycust.blade.php new file mode 100644 index 00000000..2b2bb73c --- /dev/null +++ b/resources/views/lelong/listsagbycust.blade.php @@ -0,0 +1,263 @@ +@extends('layouts.app') + +@section('content') + +
    +
    +
    + + + @if ($message = Session::get('success')) +
    +

    {{ $message }}

    +
    + @endif + +
    + @csrf + + + + + + + + + + + + + + + + + + + + + + + @foreach ($marhuns as $index=> $marhun) + + + + + + + + + + + + + + + + + + + + + + @endforeach + + +
    NoNama PelangganNo.RujukanTempohBerat (gm)Nilai Marhun (RM)Harga Asas (RM)Pembiayaan (RM)Pembiayaan Asal (RM)K.6Bulan (RM)K.Telah Bayar (RM)K.Semasa (RM)
    {{$loop->iteration}}{{ $marhun['nama']['nama']}}@foreach ($marhun['listsag'] as $item) + {{$loop->iteration}}. {{ $item['norujukan'] }}
    + @endforeach
    @foreach ($marhun['listsag'] as $item) + {{ $item['tempoh'] }}
    + @endforeach
    + @php $jumberat = 0;@endphp + @foreach ($marhun['listsag'] as $item) + @php + $jumberat = $jumberat + $item['berat']; + @endphp + {{ number_format($item['berat'], 2, '.', ',') }}
    + @endforeach + Total: {{ number_format($jumberat, 2, '.', ',') }} +
    + @php $jumnilaimarhun = 0;@endphp + @foreach ($marhun['listsag'] as $item) + @php + $jumnilaimarhun = $jumnilaimarhun + $item['nilaimarhun']; + @endphp + {{ number_format($item['nilaimarhun'], 2, '.', ',') }}
    + @endforeach + Total: {{ number_format($jumnilaimarhun, 2, '.', ',') }} + +
    + @php $jumhargaasas = 0;@endphp + @foreach ($marhun['listsag'] as $item) + @php + $jumhargaasas = $jumhargaasas + $item['hargaasas']; + @endphp + {{ number_format($item['hargaasas'], 2, '.', ',') }}
    + @endforeach + Total: {{ number_format($jumhargaasas, 2, '.', ',') }} + +
    + @php $jumpinjaman = 0;@endphp + @foreach ($marhun['listsag'] as $item) + @php + $jumpinjaman = $jumpinjaman + $item['pinjaman']; + @endphp + {{ number_format($item['pinjaman'], 2, '.', ',') }}
    + @endforeach + Total: {{ number_format($jumpinjaman, 2, '.', ',') }} + +
    + @php $jumpinjasal = 0;@endphp + @foreach ($marhun['listsag'] as $item) + @php + $jumpinjasal = $jumpinjasal + $item['pinjasal']; + @endphp + {{ number_format($item['pinjasal'], 2, '.', ',') }}
    + @endforeach + Total: {{ number_format($jumpinjaman, 2, '.', ',') }} + +
    + @php $jum6bulan = 0;@endphp + @foreach ($marhun['listsag'] as $item) + @php + $jum6bulan = $jum6bulan + $item['6bulan']; + @endphp + {{ number_format($item['6bulan'], 2, '.', ',') }}
    + @endforeach + Total: {{ number_format($jum6bulan, 2, '.', ',') }} + +
    + @php $jumktlhbyr = 0;@endphp + @foreach ($marhun['listsag'] as $item) + @php + $jumktlhbyr = $jumktlhbyr + $item['ktlhbyr']; + @endphp + {{ number_format($item['ktlhbyr'], 2, '.', ',') }}
    + @endforeach + Total: {{ number_format($jumktlhbyr, 2, '.', ',') }} + +
    + @php $jumbakiupah = 0;@endphp + @foreach ($marhun['listsag'] as $item) + @php + $jumbakiupah = $jumbakiupah + $item['bakiupah']; + @endphp + {{ number_format($item['bakiupah'], 2, '.', ',') }}
    + @endforeach + Total: {{ number_format($jumbakiupah, 2, '.', ',') }} + +
    + +
    +
    + +
    +
    + +@endsection diff --git a/resources/views/lelong/senaraimarhun.blade.php b/resources/views/lelong/senaraimarhun.blade.php index 3a92f283..f5d2553c 100644 --- a/resources/views/lelong/senaraimarhun.blade.php +++ b/resources/views/lelong/senaraimarhun.blade.php @@ -39,6 +39,9 @@

    {{ $message }}

    @endif +
    @csrf @@ -55,8 +58,11 @@ Tarikh Jual (RM) Harga Asas (RM) Harga Jual (RM) - Pembiayaan (RM) - Keuntungan (RM) + Pembiayaan Asal (RM) + Baki Pembiayaan (RM) + K.Tlh Byr (RM) + K.6bulan (RM) + K.Semasa (RM) Caj (%) Rugi (RM) Baki (RM) @@ -70,16 +76,19 @@ {{ $marhun['norujukan']}} {{ $marhun['nama']['nama']}} {{ $marhun['jbg']}} - {{ $marhun['berat'] }} - {{ number_format($marhun['nilaimarhun'], 2, '.', ',') }} - {{ $marhun['t_jual'] }} - {{ number_format($marhun['hargaasas'], 2, '.', ',') }} - {{ number_format($marhun['hargajual'], 2, '.', ',') }} - {{ number_format($marhun['pinjaman'], 2, '.', ',') }} - {{ number_format($marhun['bakiupah'], 2, '.', ',') }} + {{ $marhun['berat'] }} + {{ number_format($marhun['nilaimarhun'], 2, '.', ',') }} + {{ $marhun['t_jual'] }} + {{ number_format($marhun['hargaasas'], 2, '.', ',') }} + {{ number_format($marhun['hargajual'], 2, '.', ',') }} + {{ number_format($marhun['pinjasal'], 2, '.', ',') }} + {{ number_format($marhun['pinjaman'], 2, '.', ',') }} + {{ number_format($marhun['ktlhbyr'], 2, '.', ',') }} + {{ number_format($marhun['upah6bulan'], 2, '.', ',') }} + {{ number_format($marhun['bakiupah'], 2, '.', ',') }} {{-- {{ $marhun['keuntungan'] }} --}} - {{ $marhun['cajlelong'] }} + {{ $marhun['cajlelong'] }} - {{$rugi}} - {{$baki}} + {{$rugi}} + {{$baki}} diff --git a/resources/views/lelong/showsimulasi.blade.php b/resources/views/lelong/showsimulasi.blade.php index 5b049c56..fa5b6881 100644 --- a/resources/views/lelong/showsimulasi.blade.php +++ b/resources/views/lelong/showsimulasi.blade.php @@ -39,12 +39,11 @@ @foreach($data as $data1) Tarikh Lelong : - @php - $myDateTime = DateTime::createFromFormat('Y-m-d', $data1['tarikh_lelong'] ); - $datez = $myDateTime->format('d-m-Y'); - echo($datez); - - @endphp + @php + $myDateTime = DateTime::createFromFormat('Y-m-d', $data1['tarikh_lelong'] ); + $t_lelong = $myDateTime->format('d-m-Y'); + echo($t_lelong); + @endphp @endforeach diff --git a/resources/views/simulasi/listsagbycust.blade.php b/resources/views/simulasi/listsagbycust.blade.php index 422074e7..c15c99c9 100644 --- a/resources/views/simulasi/listsagbycust.blade.php +++ b/resources/views/simulasi/listsagbycust.blade.php @@ -26,13 +26,16 @@ Nama Pelanggan No.Rujukan Tempoh + K.Tlh Byr(RM) + K.6Bulan(RM) + K.Semasa(RM) + Pembiayaan Asal(RM) + Baki Pembiayaan(RM) Berat (gm) Nilai Marhun (RM) - Harga Asas (RM) - Pembiayaan (RM) - Keuntungan (RM) - Caj Lelong (%) - Baki Lelong (RM) + + @@ -46,7 +49,63 @@ @endforeach @foreach ($marhun['listsag'] as $item) {{ $item['tempoh'] }}
    - @endforeach + @endforeach + + @php $jumktlhbyr = 0;@endphp + @foreach ($marhun['listsag'] as $item) + @php + $jumktlhbyr = $jumktlhbyr + $item['ktlhbyr']; + @endphp + {{ number_format($item['ktlhbyr'], 2, '.', ',') }}
    + @endforeach + Total: {{ number_format($jumktlhbyr, 2, '.', ',') }} + + + + @php $jum6bulan = 0;@endphp + @foreach ($marhun['listsag'] as $item) + @php + $jum6bulan = $jum6bulan + $item['bakiupah']; + @endphp + {{ number_format($item['bakiupah'], 2, '.', ',') }}
    + @endforeach + Total: {{ number_format($jum6bulan, 2, '.', ',') }} + + + + @php $jum6bulan = 0;@endphp + @foreach ($marhun['listsag'] as $item) + @php + $jum6bulan = $jum6bulan + $item['keuntungan']; + @endphp + {{ number_format($item['keuntungan'], 2, '.', ',') }}
    + @endforeach + Total: {{ number_format($jum6bulan, 2, '.', ',') }} + + + + @php $jumpinjasal = 0;@endphp + @foreach ($marhun['listsag'] as $item) + @php + $jumpinjasal = $jumpinjasal + $item['pinjaman']; + @endphp + {{ number_format($item['pinjaman'], 2, '.', ',') }}
    + @endforeach + Total: {{ number_format($jumpinjasal, 2, '.', ',') }} + + + + @php $jumpinjaman = 0;@endphp + @foreach ($marhun['listsag'] as $item) + @php + $jumpinjaman = $jumpinjaman + $item['bakipjm']; + @endphp + {{ number_format($item['bakipjm'], 2, '.', ',') }}
    + @endforeach + Total: {{ number_format($jumpinjaman, 2, '.', ',') }} + + + @php $jumberat = 0;@endphp @foreach ($marhun['listsag'] as $item) @@ -68,7 +127,7 @@ Total: {{ number_format($jumnilaimarhun, 2, '.', ',') }} - + + diff --git a/resources/views/simulasi/senaraimarhunlel.blade.php b/resources/views/simulasi/senaraimarhunlel.blade.php index 72b66b63..26830635 100644 --- a/resources/views/simulasi/senaraimarhunlel.blade.php +++ b/resources/views/simulasi/senaraimarhunlel.blade.php @@ -38,11 +38,11 @@ - @foreach ($marhuns as $index=> $marhun) + @foreach ($arraymarhun as $index=> $marhun) {{$loop->iteration}} {{ $marhun['norujukan']}} - {{ $marhun['nama']['nama']}} + {{ $marhun['nama']}} {{ number_format($marhun['tempoh'], 2, '.', ',') }} {{ number_format($marhun['berat'], 2, '.', ',') }} {{ number_format($marhun['nilaimarhun'], 2, '.', ',') }} diff --git a/resources/views/simulasi/senaraisimulasi.blade.php b/resources/views/simulasi/senaraisimulasi.blade.php index 1a8edba4..e87e34d9 100644 --- a/resources/views/simulasi/senaraisimulasi.blade.php +++ b/resources/views/simulasi/senaraisimulasi.blade.php @@ -30,11 +30,13 @@ {{$loop->iteration}} {{$info['info']['simulasi_id']}} - @php - $myDateTime = DateTime::createFromFormat('Y-m-d H:i:s', $info['info']['tarikh_lelong'] ); - $t_lelong = $myDateTime->format('d-m-Y'); - echo($t_lelong); - @endphp + + @php + $myDateTime = DateTime::createFromFormat('Y-m-d', $info['info']['tarikh_lelong'] ); + $t_lelong = $myDateTime->format('d-m-Y'); + echo($t_lelong); + @endphp + {{$info['info']['fasa']}} @foreach($info['detailsinfo'] as $info2) diff --git a/resources/views/simulasi/showsimulasi.blade.php b/resources/views/simulasi/showsimulasi.blade.php index ee5024c3..f5720d78 100644 --- a/resources/views/simulasi/showsimulasi.blade.php +++ b/resources/views/simulasi/showsimulasi.blade.php @@ -35,13 +35,12 @@ Keuntungan Keseluruhan : RM{{ number_format($total_bakiupah, 2, '.', ',') }} - Tarikh Lelong : - @php - $myDateTime = DateTime::createFromFormat('Y-m-d H:i:s', $data['tarikh_lelong'] ); - // dd($data['tarikh_lelong']) - $datez = $myDateTime->format('d-m-Y'); - echo($datez); + Tarikh Lelong : @php + $myDateTime = DateTime::createFromFormat('Y-m-d', $data['tarikh_lelong'] ); + $t_lelong = $myDateTime->format('d-m-Y'); + echo($t_lelong); @endphp + diff --git a/routes/web.php b/routes/web.php index e28c36eb..d026112b 100644 --- a/routes/web.php +++ b/routes/web.php @@ -128,7 +128,8 @@ Route::group(['prefix'=>'lelong'], function () { Route::post('/renewxlakujanadata',['as'=>'lelong.renewxlakujanadata','uses'=>'LelongController@renewxlakujanadata']); //export data lelong to live Route::get('/exportdata/{lelong_id}',['as'=>'lelong.exportdata','uses'=>'LelongController@exportdata']); - + //listsagbycust + Route::get('/listsagbycust/{lelongid}/{cawid}',['as'=>'lelong.listsagbycust','uses'=>'LelongController@listsagbycust']); }); Route::get('/showsimulasi/{id}',['as'=>'lelong.showsimulasi','uses'=>'LelongController@showsimulasi']);