1515 lines
70 KiB
PHP
1515 lines
70 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
use Carbon\Carbon;
|
|
use App\Models\Cawangan;
|
|
use App\Models\Tetapan;
|
|
use App\Models\Gadai;
|
|
use App\Models\Simulasi;
|
|
use App\Models\JenisKarat;
|
|
use App\Models\SimKarat;
|
|
use App\Models\CawanganSimulasi;
|
|
use App\Models\SimulasiBid;
|
|
use App\Models\GadaiMarhun;
|
|
use App\Models\SimulasiBidMarhun;
|
|
use Illuminate\Support\Facades\Http;
|
|
use App\Models\CawanganLelong;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use App\Models\LelongTebus;
|
|
use App\Models\LogUser;
|
|
use App\Models\TransaksiKeuntungan;
|
|
use App\Models\Customer;
|
|
use App\Models\SimKarat_temp;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
use Illuminate\Http\Request;
|
|
use PDF;
|
|
|
|
class SimulasiUjrahController extends Controller
|
|
{
|
|
/**
|
|
* Create a new controller instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
$this->middleware('auth');
|
|
}
|
|
|
|
/**
|
|
* Show the application dashboard.
|
|
*
|
|
* @return \Illuminate\Contracts\Support\Renderable
|
|
*/
|
|
|
|
public function index()
|
|
{
|
|
$currentDate = Carbon::now();
|
|
$currentDate = $currentDate->toDateString();
|
|
$caw = Cawangan::all();
|
|
$tetapan = Tetapan::where('id','=',1)->first();
|
|
return view('simulasiujrah.janasimulasi',compact('caw','tetapan', 'currentDate'));
|
|
}
|
|
|
|
|
|
public function senaraitempsimulasi(Request $request)
|
|
{
|
|
$t_lelong1 = date('d-m-Y', strtotime($request->tarikh_lelong));
|
|
$t_lelong2 = $request->tarikh_lelong;
|
|
$t_lelong = Carbon::parse($request->tarikh_lelong);
|
|
$bulan = (int)round($request->jbg);
|
|
$fasa = $request->fasa;
|
|
$jbg = $request->jbg;
|
|
$cajlelong = $request->cajlelong;
|
|
$kali = $request->kali;
|
|
$jbgadai = ($t_lelong->subMonths($bulan))->toDateString();
|
|
$t_lelongdisplay = $t_lelong->format('d-m-Y');
|
|
$tetapan = Tetapan::where('id','=',1)->first();
|
|
if($t_lelong != null)
|
|
{
|
|
|
|
if($request->fasa == '1'){
|
|
$cawangan_all = Cawangan::orderBy('caw_name')->get();
|
|
// dd($cawangan_all);
|
|
$senarai = [];
|
|
$total_bil_lelong = 0;
|
|
foreach($cawangan_all as $cawangan){
|
|
$getsurat = Gadai::on($cawangan->caw_code)
|
|
->where('t_gadai','<=',$jbgadai)
|
|
->where('sttebus','=','')
|
|
->where('tagpalsu','=',0)
|
|
->where('tagpalsu2','=',0)
|
|
->where('taglel','=',0)
|
|
->where('lelong_tawarruq','=',1)
|
|
->where('tagbaru','=',1)
|
|
->whereNotNull('upah12');
|
|
|
|
$cawangan_simulasi = CawanganLelong::where('caw_id',$cawangan->id)->where('kali', '=' ,$kali)->count();
|
|
if($cawangan_simulasi == 0){
|
|
$bil_lelong = $getsurat->count('norujukan');
|
|
$total_bil_lelong += $bil_lelong;
|
|
$total_berat = $getsurat->sum('berat');
|
|
$total_nilaimarhun = $getsurat->sum('nilaimarhun');
|
|
$total_pembiayaan = $getsurat->sum('pinjaman');
|
|
$total_bakipjm = $getsurat->sum('bakipjm');
|
|
$data = [
|
|
'bil_lelong'=>$bil_lelong,
|
|
'total_berat'=>$total_berat,
|
|
'total_nilaimarhun'=>$total_nilaimarhun,
|
|
'total_pembiayaan'=>$total_pembiayaan,
|
|
'total_bakipjm'=>$total_bakipjm,
|
|
'kodcaw'=>$cawangan->caw_code,
|
|
'caw_name'=>$cawangan->caw_name];
|
|
array_push($senarai,$data);
|
|
}
|
|
}
|
|
}
|
|
|
|
else if($request->fasa == '2'){
|
|
$cawangan_all = Cawangan::all();
|
|
$senarai = [];
|
|
$total_bil_lelong = 0;
|
|
//dd($jbgadai);
|
|
foreach($cawangan_all as $cawangan){
|
|
$getsurat = Gadai::on($cawangan->caw_code)->where('t_gadai','<=',$jbgadai)
|
|
->where('sttebus','=','')
|
|
->where('tagpalsu','=',0)
|
|
->where('tagpalsu2','=',0)
|
|
->where('taglel','=',0)
|
|
->where('tagbaru','=',1)
|
|
// ->where('lelong_tawarruq','=',1)
|
|
->whereNotNull('upah12');
|
|
|
|
$cawangan_simulasi = CawanganLelong::where('caw_id',$cawangan->id)->where('kali', '=' ,$kali)->count();
|
|
if($cawangan_simulasi == 0){
|
|
$bil_lelong = $getsurat->count('norujukan');
|
|
$total_bil_lelong += $bil_lelong;
|
|
$total_berat = $getsurat->sum('berat');
|
|
$total_nilaimarhun = $getsurat->sum('nilaimarhun');
|
|
$total_pembiayaan = $getsurat->sum('pinjaman');
|
|
$total_bakipjm = $getsurat->sum('bakipjm');
|
|
$data = [
|
|
'bil_lelong'=>$bil_lelong,
|
|
'total_berat'=>$total_berat,
|
|
'total_nilaimarhun'=>$total_nilaimarhun,
|
|
'total_pembiayaan'=>$total_pembiayaan,
|
|
'total_bakipjm'=>$total_bakipjm,
|
|
'kodcaw'=>$cawangan->caw_code,
|
|
'caw_name'=>$cawangan->caw_name];
|
|
array_push($senarai,$data);
|
|
}
|
|
}
|
|
}
|
|
// dd($total_bil_lelong);
|
|
|
|
if($total_bil_lelong == 0)
|
|
{
|
|
return redirect()->route('analisaujrah.janasimulasi')
|
|
->with('failed','Tiada surat untuk di lelong');
|
|
}
|
|
|
|
|
|
|
|
return view('simulasiujrah.senaraitempsimulasi', compact( 't_lelong',
|
|
'getsurat',
|
|
'senarai',
|
|
't_lelong1',
|
|
't_lelong2',
|
|
't_lelongdisplay',
|
|
'jbgadai',
|
|
'fasa',
|
|
'jbg',
|
|
'cajlelong',
|
|
'tetapan'
|
|
|
|
|
|
));
|
|
}
|
|
else
|
|
{
|
|
return redirect()->route('analisaujrah.janasimulasi')
|
|
->with('failed','Sila Masukkan Tarikh Lelongan');
|
|
}
|
|
}
|
|
|
|
public function janadata2(Request $request)
|
|
{
|
|
$t_lelong = Carbon::parse($request->tarikh_lelong);
|
|
$bulan = (int)round($request->jbg);
|
|
$fasa = $request->fasa;
|
|
$jbg = $request->jbg;
|
|
$kali = $request->kali;
|
|
$hargaasas = $request->hargaasas; //rial
|
|
$selected_caw = $request->caw;
|
|
if(!empty($selected_caw))
|
|
{
|
|
$jbgadai = ($t_lelong->subMonths($bulan))->toDateString();
|
|
$caws = Cawangan::whereIn('caw_code',$selected_caw)->get();
|
|
// dd($caws);
|
|
$bil_surat = 0;
|
|
$sag_cawangans = [];
|
|
foreach($caws as $caw){
|
|
if($fasa == '1'){
|
|
$surat = Gadai::on($caw->caw_code)
|
|
->where('t_gadai','<=',$jbgadai)
|
|
->where('sttebus','=','')
|
|
->where('tagpalsu','=',0)
|
|
->where('tagpalsu2','=',0)
|
|
->where('taglel','=',0)
|
|
->where('tagbaru','=',1)
|
|
->where('lelong_tawarruq','=',1);
|
|
|
|
// ->count('norujukan');
|
|
|
|
}
|
|
else if($fasa == '2'){
|
|
$surat = Gadai::on($caw->caw_code)
|
|
->where('t_gadai','<=',$jbgadai)
|
|
->where('sttebus','=','')
|
|
->where('tagpalsu','=',0)
|
|
->where('tagpalsu2','=',0)
|
|
->where('tagbaru','=',1)
|
|
->where('taglel','=',0);
|
|
// ->count('norujukan');
|
|
}
|
|
$bil_sag_cawangan = $surat->count('norujukan');
|
|
array_push($sag_cawangans,['cawangan'=>$caw,'data'=>$surat->get()]);
|
|
$bil_surat += $bil_sag_cawangan;
|
|
}
|
|
|
|
if($bil_surat == 0)
|
|
{
|
|
return redirect()->route('analisaujrah.janasimulasi')
|
|
->with('failed','Tiada surat untuk di lelong');
|
|
}
|
|
|
|
//create simulasi
|
|
$simulasi = Simulasi::create([
|
|
'tarikh_lelong' => $request->tarikh_lelong,
|
|
'harga_emas_asas' => $hargaasas,
|
|
'jbg' => $jbg,
|
|
'cajlelong' => $request->cajlelong,
|
|
'fasa' => $fasa,
|
|
'kali' => $kali,
|
|
'success_import' => 1,
|
|
'tagujrah' => 1
|
|
]);
|
|
|
|
//create harga asas berdasarkan input harga asas
|
|
$karat = JenisKarat::all();
|
|
$karat_data = [];
|
|
foreach($karat as $item)
|
|
{
|
|
$data_karat = [
|
|
'simulasi_id' => $simulasi->id,
|
|
'karat' => $item->karat,
|
|
'keterangan' => $item->keterangan,
|
|
'harga' => ($hargaasas + ($item->dariharga916)),
|
|
'harga2' => $hargaasas + ($item->dariharga916)
|
|
];
|
|
|
|
array_push($karat_data,$data_karat);
|
|
}
|
|
|
|
$simkarat = SimKarat::insert($karat_data);
|
|
|
|
$simkarattemp = SimKarat::where('simulasi_id','=',$simulasi->id)->get()->keyBy('karat');
|
|
|
|
foreach($sag_cawangans as $index=>$cawsimulasi){
|
|
|
|
$caw_simulasi = new CawanganSimulasi;
|
|
$caw_simulasi->simulasi_id = $simulasi->id;
|
|
$caw_simulasi->caw_id = $cawsimulasi['cawangan']->id;
|
|
$caw_simulasi->online = 'Online';
|
|
$caw_simulasi->lokasi = $cawsimulasi['cawangan']->lokasi;
|
|
$caw_simulasi->fasa = $request->fasa;
|
|
$caw_simulasi->kali = $request->kali;
|
|
$caw_simulasi->tagujrah = 1;
|
|
$caw_simulasi->save();
|
|
|
|
$suratcaw = $cawsimulasi['data'];
|
|
|
|
$simulasi_bid_arr = [];
|
|
$now = Carbon::now();
|
|
foreach($suratcaw as $surat)
|
|
{
|
|
$simulasi_to_be_inserted = new SimulasiBid();
|
|
$simulasi_to_be_inserted->simulasi_id = $simulasi->id;
|
|
$simulasi_to_be_inserted->caw_id = $cawsimulasi['cawangan']->id;
|
|
$simulasi_to_be_inserted->kodcaw = $surat->kodcaw;
|
|
$simulasi_to_be_inserted->norujukan = $surat->norujukan;
|
|
$simulasi_to_be_inserted->t_lelong = $request->tarikh_lelong;
|
|
$simulasi_to_be_inserted->hargaasas = 0.00;
|
|
$simulasi_to_be_inserted->hargajual = 0.00;
|
|
$simulasi_to_be_inserted->jbg = $surat->tempoh;
|
|
$simulasi_to_be_inserted->kadarupah = $surat->kadarupah;
|
|
$simulasi_to_be_inserted->nilaimarhun = $surat->nilaimarhun;
|
|
$simulasi_to_be_inserted->pinjaman = $surat->bakipjm;
|
|
$simulasi_to_be_inserted->bakiupah = $surat->bakiupah;
|
|
$simulasi_to_be_inserted->cajlain = $surat->cajlain;
|
|
$simulasi_to_be_inserted->cajlelong = 0.00;
|
|
$simulasi_to_be_inserted->baki = 0.00;
|
|
$simulasi_to_be_inserted->berat = $surat->berat;
|
|
$simulasi_to_be_inserted->marhun = $surat->marhun;
|
|
$simulasi_to_be_inserted->percent = $surat->percentpinj;
|
|
$simulasi_to_be_inserted->status_jual = 0;
|
|
$simulasi_to_be_inserted->status_payment = 0;
|
|
$simulasi_to_be_inserted->mora_upah = 0;
|
|
$simulasi_to_be_inserted->fasa = $request->fasa;
|
|
$simulasi_to_be_inserted->tagujrah = 1;
|
|
$simulasi_bid_arr[] = $simulasi_to_be_inserted->attributesToArray();
|
|
}
|
|
|
|
$simulasi_bid_collection = collect($simulasi_bid_arr);
|
|
|
|
SimulasiBid::insert($simulasi_bid_arr);
|
|
|
|
$gadaimarhun_to_update = $simulasi_bid_collection->pluck('norujukan');
|
|
|
|
|
|
$gadaimarhun = GadaiMarhun::on($cawsimulasi['cawangan']->caw_code)->whereIn('norujukan',$gadaimarhun_to_update)->get();
|
|
|
|
|
|
|
|
$simulasi_bid_ = SimulasiBid::whereIn('norujukan',$gadaimarhun_to_update)->get()->keyBy('norujukan');
|
|
|
|
$simulasi_bid_marhun_arr = [];
|
|
|
|
foreach($gadaimarhun as $marhun) {
|
|
|
|
if($simkarattemp[$marhun->karat] && $simulasi_bid_[$marhun->norujukan] ) {
|
|
|
|
$val = round($marhun->berat * $simkarattemp[$marhun->karat]->harga);
|
|
|
|
$simmarhun = new SimulasiBidMarhun();
|
|
$simmarhun->simulasibid_id = $simulasi_bid_[$marhun->norujukan]->id;
|
|
$simmarhun->bil = $marhun->bil;
|
|
$simmarhun->marhun = $marhun->marhun;
|
|
$simmarhun->nota = $marhun->nota;
|
|
$simmarhun->karat = $marhun->karat;
|
|
$simmarhun->berat = $marhun->berat;
|
|
$simmarhun->harga = $simkarattemp[$marhun->karat]->harga;
|
|
$simmarhun->n_marhun = $marhun->n_marhun;
|
|
$simmarhun->hargaasas = $val;
|
|
|
|
$simulasi_bid_marhun_arr[] = $simmarhun->attributesToArray();
|
|
}
|
|
}
|
|
SimulasiBidMarhun::insert($simulasi_bid_marhun_arr);
|
|
|
|
foreach($simulasi_bid_arr as $index) {
|
|
$updategadai = Http::withOptions(['verify' => config('app.api_verify')])
|
|
->post(config('app.api_url').'taglel/update',[
|
|
'kodcaw'=>$index['kodcaw'],
|
|
'norujukan'=>$index['norujukan']
|
|
])
|
|
->json();
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
return redirect()->route('analisaujrah.janasimulasi')->with('failed','Tiada surat untuk di lelong');
|
|
}
|
|
|
|
return redirect()->route('analisaujrah.show',$simulasi->id);
|
|
// return redirect()->route('analisa.senaraisimulasi')->with('success',"Success daftar simulasi!");
|
|
|
|
}
|
|
public function senaraisimulasi()
|
|
{
|
|
$simulasiAll = Simulasi::with('cawangan')->where('tagujrah', 1)->orderBy('id', 'desc')->get();
|
|
|
|
return view('simulasiujrah.senaraisimulasi',compact('simulasiAll'));
|
|
}
|
|
|
|
public function kemaskinidata($simulasi_id)
|
|
{
|
|
$user = Auth::user();
|
|
$currentdate = Carbon::now();
|
|
$currentdate = $currentdate->toDateTimeString();
|
|
$data = [];
|
|
|
|
$getcaw = Simulasi::join('cawangan_simulasi','cawangan_simulasi.simulasi_id','=','simulasi.id')
|
|
->join('simulasibid','cawangan_simulasi.caw_id','=','simulasibid.caw_id')
|
|
->where('simulasi.id', $simulasi_id)
|
|
->groupBy('simulasibid.caw_id')
|
|
->select('simulasibid.caw_id')
|
|
->get();
|
|
// dd($getcaw);
|
|
foreach($getcaw as $index=>$caw)
|
|
{
|
|
$cawid = $caw['caw_id'];
|
|
$marhun = SimulasiBid::join('cawangan', 'simulasibid.caw_id', '=', 'cawangan.id')
|
|
->where('simulasi_id','=',$simulasi_id)
|
|
->where('caw_id','=',$caw['caw_id']);
|
|
|
|
$arraynorujukan = $marhun->pluck('norujukan')->toArray();
|
|
$datasimulasi = $marhun->get();
|
|
// dd($datasimulasi[$index]['fasa']);
|
|
|
|
$senaraisag = Gadai::on($datasimulasi[$index]['kodcaw'])->whereIn('norujukan', $arraynorujukan)
|
|
->get();
|
|
// dd($senaraisag);
|
|
foreach($senaraisag as $data)
|
|
{
|
|
// dd($data['norujukan']);
|
|
// dd($datasimulasi[$index]['fasa']);
|
|
if($datasimulasi[$index]['fasa'] == 1){
|
|
//insert lelong_tebus
|
|
if($data['sttebus'] == "T")
|
|
{
|
|
$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();
|
|
|
|
$updategadai = Http::withOptions(['verify' => config('app.api_verify')])
|
|
->post(config('app.api_url').'taglel/revert',[
|
|
'kodcaw'=>$data['kodcaw'],
|
|
'norujukan'=>$data['norujukan']
|
|
])
|
|
->json();
|
|
|
|
// 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 = ' LELONG TEBUS '.$simulasi_id;
|
|
$loguser->save();
|
|
|
|
|
|
}
|
|
else if($data['sttebus'] == ""){
|
|
$ktlhbyr = $data['hargajualan']-$data['bakihargajualan'];
|
|
if($ktlhbyr >= $data['bakiupah'])
|
|
{
|
|
$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 = 'A';
|
|
$lelongtebus->save();
|
|
|
|
$updategadai = Http::withOptions(['verify' => config('app.api_verify')])
|
|
->post(config('app.api_url').'taglel/revert',[
|
|
'kodcaw'=>$data['kodcaw'],
|
|
'norujukan'=>$data['norujukan']
|
|
])
|
|
->json();
|
|
|
|
// 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 = ' KELUAR LELONG '.$simulasi_id;
|
|
$loguser->save();
|
|
}
|
|
else{
|
|
//kemaskini keuntungan
|
|
$total_untung_rebet = TransaksiKeuntungan::on('main')->where('norujukan','=',$data['norujukan'])->sum('keuntungan_rebet');
|
|
$total_untung_asal = TransaksiKeuntungan::on('main')->where('norujukan','=',$data['norujukan'])->sum('bayaran_keuntungan');
|
|
$beza_keuntungan = $total_untung_asal - $total_untung_rebet;
|
|
|
|
if($data['tempohbayar'] == 12){
|
|
$keuntungan = 0.00;
|
|
$rounded_ujrah = 0.00;
|
|
$rounded_onepercent = 0.00;
|
|
}
|
|
elseif($data['tempoh'] == $data['tempohbayar']){
|
|
$keuntungan = 0.00;
|
|
$rounded_ujrah = 0.00;
|
|
$rounded_onepercent = 0.00;
|
|
}
|
|
else{
|
|
if($data['tagbaru'] == '0'){
|
|
//kemaskini keuntungan
|
|
$total_untung_rebet = TransaksiKeuntungan::on('main')->where('norujukan','=',$data['norujukan'])->sum('keuntungan_rebet');
|
|
$total_untung_asal = TransaksiKeuntungan::on('main')->where('norujukan','=',$data['norujukan'])->sum('bayaran_keuntungan');
|
|
$beza_keuntungan = $total_untung_asal - $total_untung_rebet;
|
|
// $keuntungan = bcdiv(($data['tempoh']-$data['tempohbayar'])*$data['kadarupah']/100*$data['bakipjm'],1,1)-$beza_keuntungan;
|
|
if($data['tempohbayar'] == $data['tempoh'] ){
|
|
$keuntungan = 0.00;
|
|
}else{
|
|
$jbg = $data['tempoh']-$data['tempohbayar'];
|
|
$jbg2 = 12- $data['tempohbayar'];
|
|
if($data['tempoh'] <= '12.00'){
|
|
$keuntungan = bcdiv(($jbg)*$data['kadarupah']/100*$data['bakipjm'],1,1)-$beza_keuntungan;
|
|
}else{
|
|
$keuntungan = bcdiv(($jbg2)*$data['kadarupah']/100*$data['bakipjm'],1,1)-$beza_keuntungan;
|
|
}
|
|
}
|
|
// dd($keuntungan);
|
|
//update dalam simulasibid
|
|
$updatetempoh = LelongBid::where('norujukan', $data['norujukan'])
|
|
->where('lelong_id', $lelong_id)
|
|
->first();
|
|
$updatetempoh->jbg = $data['tempoh'];
|
|
$updatetempoh->pinjaman = $data['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 = $data['norujukan'];
|
|
$loguser->nota = $lelong_id.' Kemaskini Tempoh/Bakipjm/Keuntungan' ;
|
|
$loguser->save();
|
|
}elseif($data['tagbaru'] == '1'){
|
|
//kiraan keuntungan ujrah
|
|
$jeniskeuntungan = 'onepercent';
|
|
// $keuntungan1 = Http::get(config('app.api_ujrah_url'). 'upahrebettawarruq/'.$data['kodcaw'].'/'.$data['norujukan'].'/'.$jeniskeuntungan)->json();
|
|
$ujrahonepercentrebet = Http::get(config('app.api_ujrah_url'). 'kiraupahUjrahOnePercentRebate/'.$data['kodcaw'].'/'.$data['norujukan'])->json();
|
|
$rounded_ujrah = $ujrahonepercentrebet['ujrah'];
|
|
$rounded_onepercent = $ujrahonepercentrebet['onepercent'];
|
|
$keuntungan = $rounded_ujrah + $rounded_onepercent;
|
|
}
|
|
//update dalam simulasibid
|
|
$updatetempoh = SimulasiBid::where('norujukan', $data['norujukan'])
|
|
->where('simulasi_id', $simulasi_id)
|
|
->first();
|
|
$updatetempoh->jbg = $data['tempoh'];
|
|
$updatetempoh->pinjaman = $data['bakipjm'];
|
|
// $updatetempoh->bakiupah = bcdiv($keuntungan,1,1);
|
|
$updatetempoh->bakiupah = $keuntungan;
|
|
$updatetempoh->ujrah = $rounded_ujrah;
|
|
$updatetempoh->onepercent = $rounded_onepercent;
|
|
$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 = $data['norujukan'];
|
|
$loguser->nota = $simulasi_id.' Kemaskini Tempoh/Bakipjm/Keuntungan '.$rounded_ujrah ;
|
|
$loguser->save();
|
|
}
|
|
}
|
|
|
|
$date = Carbon::now()->toDateTimeString();
|
|
$simulasi = Simulasi::where('id','=',$simulasi_id)->first();
|
|
$simulasi->masakemaskini_data = $date;
|
|
$simulasi->save();
|
|
}
|
|
}else if($datasimulasi[$index]['fasa'] == 2){
|
|
// dd($datasimulasi[$index]['fasa']);
|
|
if($data['sttebus'] == "T")
|
|
{
|
|
$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();
|
|
|
|
$updategadai = Http::withOptions(['verify' => config('app.api_verify')])
|
|
->post(config('app.api_url').'taglel/revert',[
|
|
'kodcaw'=>$data['kodcaw'],
|
|
'norujukan'=>$data['norujukan']
|
|
])
|
|
->json();
|
|
|
|
// 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 = ' LELONG TEBUS '.$simulasi_id;
|
|
$loguser->save();
|
|
}
|
|
else{
|
|
if($data['tagbaru'] == '1'){
|
|
//kiraan keuntungan ujrah
|
|
$jeniskeuntungan = 'onepercent';
|
|
// $keuntungan1 = Http::get(config('app.api_ujrah_url'). 'upahrebettawarruq/'.$data['kodcaw'].'/'.$data['norujukan'].'/'.$jeniskeuntungan)->json();
|
|
$ujrahonepercentrebet = Http::get(config('app.api_ujrah_url'). 'kiraupahUjrahOnePercentRebate/'.$data['kodcaw'].'/'.$data['norujukan'])->json();
|
|
$rounded_ujrah = $ujrahonepercentrebet['ujrah'];
|
|
$rounded_onepercent = $ujrahonepercentrebet['onepercent'];
|
|
$keuntungan = $rounded_ujrah + $rounded_onepercent;
|
|
|
|
// dd($keuntungan);
|
|
//update dalam simulasibid
|
|
$updatetempoh = SimulasiBid::where('norujukan', $data['norujukan'])
|
|
->where('simulasi_id', $simulasi_id)
|
|
->first();
|
|
$updatetempoh->jbg = $data['tempoh'];
|
|
$updatetempoh->pinjaman = $data['bakipjm'];
|
|
// $updatetempoh->bakiupah = bcdiv($keuntungan,1,1);
|
|
$updatetempoh->bakiupah = $keuntungan;
|
|
$updatetempoh->ujrah = $rounded_ujrah;
|
|
$updatetempoh->onepercent = $rounded_onepercent;
|
|
$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 = $data['norujukan'];
|
|
$loguser->nota = $simulasi_id.' Kemaskini Tempoh/Bakipjm/Keuntungan UJRAH' ;
|
|
$loguser->save();
|
|
}elseif($data['tagbaru'] == '0'){
|
|
//kemaskini keuntungan
|
|
$total_untung_rebet = TransaksiKeuntungan::on('main')->where('norujukan','=',$data['norujukan'])->sum('keuntungan_rebet');
|
|
$total_untung_asal = TransaksiKeuntungan::on('main')->where('norujukan','=',$data['norujukan'])->sum('bayaran_keuntungan');
|
|
$beza_keuntungan = $total_untung_asal - $total_untung_rebet;
|
|
// $keuntungan = bcdiv(($data['tempoh']-$data['tempohbayar'])*$data['kadarupah']/100*$data['bakipjm'],1,1)-$beza_keuntungan;
|
|
if($data['tempohbayar'] == $data['tempoh'] ){
|
|
$keuntungan = 0.00;
|
|
}else{
|
|
$jbg = $data['tempoh']-$data['tempohbayar'];
|
|
$jbg2 = 12- $data['tempohbayar'];
|
|
if($data['tempoh'] <= '12.00'){
|
|
$keuntungan = bcdiv(($jbg)*$data['kadarupah']/100*$data['bakipjm'],1,1)-$beza_keuntungan;
|
|
}else{
|
|
$keuntungan = bcdiv(($jbg2)*$data['kadarupah']/100*$data['bakipjm'],1,1)-$beza_keuntungan;
|
|
}
|
|
}
|
|
// dd($keuntungan);
|
|
//update dalam simulasibid
|
|
$updatetempoh = LelongBid::where('norujukan', $data['norujukan'])
|
|
->where('lelong_id', $lelong_id)
|
|
->first();
|
|
$updatetempoh->jbg = $data['tempoh'];
|
|
$updatetempoh->pinjaman = $data['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 = $data['norujukan'];
|
|
$loguser->nota = $lelong_id.' Kemaskini Tempoh/Bakipjm/Keuntungan SAG LAMA' ;
|
|
$loguser->save();
|
|
}
|
|
}
|
|
$date = Carbon::now()->toDateTimeString();
|
|
$simulasi = Simulasi::where('id','=',$simulasi_id)->first();
|
|
$simulasi->masakemaskini_data = $date;
|
|
$simulasi->save();
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|
|
return redirect()->route('analisaujrah.senaraisimulasi')
|
|
->with('success','Kemaskini Berjaya');
|
|
}
|
|
|
|
public function show($id)
|
|
{
|
|
$simulasi_id = $id;
|
|
$simulasi = Simulasi::with(['cawangan', 'simulasiBid.simulasiBidMarhun', 'simkarat'])
|
|
->where('tagujrah',1)
|
|
->find($id);
|
|
$data = $simulasi;
|
|
$simkarat = $simulasi->simkarat;
|
|
$jeniskarat = JenisKarat::all();
|
|
|
|
$cawanganAll = $simulasi->cawangan;
|
|
$simBidGroupByCawId = $simulasi->simulasiBid->groupBy('caw_id');
|
|
|
|
foreach($cawanganAll as $caw_key_by_id)
|
|
{
|
|
if($simBidGroupByCawId[$caw_key_by_id['id']]);
|
|
{
|
|
$caw_key_by_id['simulasiBid'] = $simBidGroupByCawId[$caw_key_by_id['id']];
|
|
}
|
|
}
|
|
|
|
$total24Kgb = 0;
|
|
$total24K = 0;
|
|
$total23k = 0;
|
|
$total22K = 0;
|
|
$total21K = 0;
|
|
$total20K = 0;
|
|
$total18Kp = 0;
|
|
$total18K = 0;
|
|
$total14Kp = 0;
|
|
$total14K = 0;
|
|
|
|
$total_marhun = 0;
|
|
$total_nilaimarhun = 0;
|
|
$total_pinjaman = 0;
|
|
$total_bakiupah = 0;
|
|
$total_rugilelong = 0;
|
|
$total_bakilelong = 0;
|
|
$total_cazlelong = 0;
|
|
$total_berat = 0;
|
|
$total_hargaasas = 0;
|
|
$total_onepercent = 0;
|
|
$total_ujrah = 0;
|
|
$arraycaw = [];
|
|
|
|
foreach ($cawanganAll as $caw) {
|
|
$berat = 0;
|
|
$nilai_marhun = 0;
|
|
$pinjaman = 0;
|
|
$bakiupah = 0;
|
|
$hargaasas = 0;
|
|
$cajlelong = 0;
|
|
$rugilelong = 0;
|
|
$bakilelong = 0;
|
|
$onepercent = 0;
|
|
$ujrah = 0;
|
|
foreach ($caw['simulasiBid'] as $sim_bid) {
|
|
$total_marhun += 1;
|
|
$nilai_marhun += $sim_bid->nilaimarhun;
|
|
$pinjaman += $sim_bid->pinjaman;
|
|
$bakiupah += $sim_bid->bakiupah;
|
|
$berat += $sim_bid->berat;
|
|
$hargaasas += $sim_bid->hargaasas;
|
|
$onepercent += $sim_bid->onepercent;
|
|
$ujrah += $sim_bid->ujrah;
|
|
|
|
|
|
$sumcajlelong = $sim_bid['hargaasas'] * ($simulasi['cajlelong']/100);
|
|
$cajlelongnew = round($sumcajlelong, 1, 1);
|
|
// $cajlelong = $cajlelong + bcdiv($sumcajlelong,1,1);
|
|
$cajlelong = $cajlelong + $cajlelongnew;
|
|
$totalbaki = $sim_bid['hargaasas'] - $sim_bid['pinjaman'] - $sim_bid['bakiupah'] - $cajlelongnew;
|
|
if(strpos($totalbaki, '-') !== false)
|
|
{
|
|
$rugi = -$totalbaki;
|
|
$rugilelong += $rugi;
|
|
}
|
|
else {
|
|
$baki = $totalbaki;
|
|
$bakilelong += $baki;
|
|
}
|
|
|
|
foreach ($sim_bid->simulasiBidMarhun as $sim_bid_marhun) {
|
|
if ($sim_bid_marhun->karat == "24.0Kgb") {
|
|
$total24Kgb += $sim_bid_marhun->berat;
|
|
} else if ($sim_bid_marhun->karat == "24.0K") {
|
|
$total24K += $sim_bid_marhun->berat;
|
|
} else if ($sim_bid_marhun->karat == "23.0K") {
|
|
$total23k += $sim_bid_marhun->berat;
|
|
} else if ($sim_bid_marhun->karat == "22.0K") {
|
|
$total22K += $sim_bid_marhun->berat;
|
|
} else if ($sim_bid_marhun->karat == "21.0K") {
|
|
$total21K += $sim_bid_marhun->berat;
|
|
} else if ($sim_bid_marhun->karat == "20.0K") {
|
|
$total20K += $sim_bid_marhun->berat;
|
|
} else if ($sim_bid_marhun->karat == "18.0Kp") {
|
|
$total18Kp += $sim_bid_marhun->berat;
|
|
} else if ($sim_bid_marhun->karat == "18.0K") {
|
|
$total18K += $sim_bid_marhun->berat;
|
|
} else if ($sim_bid_marhun->karat == "14.0Kp") {
|
|
$total14Kp += $sim_bid_marhun->berat;
|
|
} else if ($sim_bid_marhun->karat == "14.0K") {
|
|
$total14K += $sim_bid_marhun->berat;
|
|
}
|
|
}
|
|
}
|
|
|
|
array_push($arraycaw, [
|
|
'id_cawangan' => $caw['id'],
|
|
'cawangan' => $caw->caw_name,
|
|
't_lelong' => $simulasi['tarikh_lelong'],
|
|
'bil_marhun' => count($caw['simulasiBid']),
|
|
'berat' => $berat,
|
|
'n_marhun' => $nilai_marhun,
|
|
'pinjaman' => $pinjaman,
|
|
'upahsimpan' => $bakiupah,
|
|
'bakiupah' => $bakiupah,
|
|
'hargaasas' => $hargaasas,
|
|
'cajlelong' => $cajlelong,
|
|
'rugilelong' => $rugilelong,
|
|
'bakilelong' => $bakilelong,
|
|
'onepercent' => $onepercent,
|
|
'ujrah' => $ujrah,
|
|
]);
|
|
|
|
$total_nilaimarhun += $nilai_marhun;
|
|
$total_pinjaman += $pinjaman;
|
|
$total_bakiupah += $bakiupah;
|
|
$total_rugilelong += $rugilelong;
|
|
$total_bakilelong += $bakilelong;
|
|
$total_cazlelong += $cajlelong;
|
|
$total_berat += $berat;
|
|
$total_hargaasas += $hargaasas;
|
|
$total_onepercent += $onepercent;
|
|
$total_ujrah += $ujrah;
|
|
}
|
|
$tarikhkemaskini = $simulasi->simkarat[0];
|
|
$data = $simulasi;
|
|
|
|
return view('simulasiujrah.showsimulasi', compact(
|
|
'tarikhkemaskini',
|
|
'data',
|
|
'simkarat',
|
|
'jeniskarat',
|
|
'arraycaw',
|
|
'total_marhun',
|
|
'total_berat',
|
|
'total_pinjaman',
|
|
'total_hargaasas',
|
|
'total_cazlelong',
|
|
'total_rugilelong',
|
|
'total_bakilelong',
|
|
'total_onepercent',
|
|
'total_ujrah',
|
|
'total24Kgb',
|
|
'total24K',
|
|
'total23k',
|
|
'total22K',
|
|
'total21K',
|
|
'total20K',
|
|
'total18Kp',
|
|
'total18K',
|
|
'total14Kp',
|
|
'total14K',
|
|
'simulasi_id',
|
|
'total_bakiupah',
|
|
'total_nilaimarhun',
|
|
'simulasi'
|
|
));
|
|
}
|
|
|
|
public function delete($id)
|
|
{
|
|
$simulasibid = SimulasiBid::where('simulasi_id','=',$id)->get();
|
|
foreach($simulasibid as $data)
|
|
{
|
|
$updategadai = Http::withOptions(['verify' => config('app.api_verify')])
|
|
->post(config('app.api_url').'taglel/revert',[
|
|
'kodcaw'=>$data->kodcaw,
|
|
'norujukan'=>$data->norujukan
|
|
])
|
|
->json();
|
|
}
|
|
$role = Simulasi::where('id','=',$id)->first();
|
|
$role->delete();
|
|
return redirect()->route('analisaujrah.senaraisimulasi')
|
|
->with('success','Padam Simulasi Berjaya');
|
|
}
|
|
|
|
public function senaraimarhunlel($simulasi_id, $cawid)
|
|
{
|
|
$total_berat = 0;
|
|
$total_pinjaman = 0;
|
|
$total_upah = 0;
|
|
$total_hargaasas = 0;
|
|
$total_bakiupah = 0;
|
|
$total_nilaimarhun = 0;
|
|
$total_cazlelong = 0;
|
|
$rugilelong = 0;
|
|
$bakilelong = 0;
|
|
$keuntungan = 0;
|
|
$total_baki = 0;
|
|
$total_onepercent = 0;
|
|
$total_ujrah = 0;
|
|
|
|
$simulasilel = Simulasi::with('cawangan')->find($simulasi_id);
|
|
|
|
$cawanganDetail = $simulasilel->cawangan->find($cawid);
|
|
|
|
$marhuns = SimulasiBid::where('caw_id', '=', $cawid)
|
|
->where('simulasi_id', '=', $simulasi_id)
|
|
->get();
|
|
|
|
// $gadaiAll = Gadai::on($cawanganDetail->caw_code)->whereIn('norujukan', $marhuns->pluck('norujukan'))->get()->keyBy('norujukan');
|
|
|
|
$arraymarhun = [];
|
|
foreach($marhuns->toArray() as $index1=>$cal){
|
|
// $gadai = Gadai::on($cal['kodcaw'])
|
|
// ->where('norujukan','=',$cal['norujukan'])
|
|
// ->first();
|
|
// // dd($gadai);
|
|
// $customer = Customer::where('kpbaru','=',$gadai['nokp'])
|
|
// ->orWhere('kplama','=',$gadai['nokp'])
|
|
// ->first();
|
|
|
|
// $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;
|
|
|
|
// $simulasilel = Simulasi::where('id',$simulasi_id)->get();
|
|
$sumcajlelong = $cal['hargaasas'] * ($simulasilel->cajlelong/100);
|
|
$cajlelongnew = round($sumcajlelong,1,1);
|
|
$baki = $cal['hargaasas'] - $cal['pinjaman'] - $cal['bakiupah'] - $cajlelongnew;
|
|
$marhuns[$index1]['cajlelong'] = $cal['cajlelong'];
|
|
$marhuns[$index1]['baki'] = $baki;
|
|
|
|
$total_berat = $total_berat + $cal['berat'];
|
|
$total_pinjaman = $total_pinjaman + $cal['pinjaman'];
|
|
$total_hargaasas = $total_hargaasas + $cal['hargaasas'];
|
|
$total_nilaimarhun = $total_nilaimarhun + $cal['nilaimarhun'];
|
|
$total_bakiupah = $total_bakiupah + $cal['bakiupah'];
|
|
$total_baki = $total_baki + $baki;
|
|
$total_cazlelong = $total_cazlelong + $cajlelongnew;
|
|
$total_onepercent += $cal['onepercent'];
|
|
$total_ujrah += $cal['ujrah'];
|
|
|
|
|
|
array_push($arraymarhun,[
|
|
'norujukan' => $cal['norujukan'],
|
|
'tempoh' => $cal['jbg'],
|
|
// 'nama' => $customer['nama'],
|
|
'berat' => $cal['berat'],
|
|
'nilaimarhun' => $cal['nilaimarhun'],
|
|
'hargaasas' => $cal['hargaasas'],
|
|
'pinjaman' => $cal['pinjaman'],
|
|
'bakiupah' => $cal['bakiupah'],
|
|
'cajlelong' => $cajlelongnew,
|
|
'baki' => $baki,
|
|
'onepercent' => $cal['onepercent'],
|
|
'ujrah' => $cal['ujrah'],
|
|
]);
|
|
}
|
|
|
|
|
|
return view('simulasiujrah.senaraimarhunlel',compact('arraymarhun','marhuns','simulasi_id','cawid','keuntungan','total_berat',
|
|
'total_nilaimarhun',
|
|
'total_pinjaman',
|
|
'total_bakiupah',
|
|
'total_hargaasas',
|
|
'simulasilel',
|
|
'cawanganDetail',
|
|
'total_cazlelong',
|
|
'total_baki','total_onepercent','total_ujrah'));
|
|
}
|
|
|
|
public function listsagbycust($simulasi_id, $cawid)
|
|
{
|
|
// dd($simulasi_id);
|
|
$keuntungan = 0;
|
|
$arraylistgadai = 0;
|
|
|
|
$simulasilel = Simulasi::with('cawangan')->find($simulasi_id);
|
|
|
|
$cawanganDetail = $simulasilel->cawangan->find($cawid);
|
|
|
|
$marhun = SimulasiBid::join('cawangan', 'simulasibid.caw_id', '=', 'cawangan.id')
|
|
->where('simulasi_id','=',$simulasi_id)
|
|
->where('caw_id','=',$cawid);
|
|
|
|
$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 = 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);
|
|
// $jbg = $listing['tempoh']-$listing['tempohbayar'];
|
|
// $jbg2 = 12- $listing['tempohbayar'];
|
|
// if($listing['tempoh'] <= '12.00'){
|
|
// $keuntungan = bcdiv(($jbg)*$listing['kadarupah']/100*$listing['bakipjm'],1,1)-$beza_keuntungan;
|
|
// }else{
|
|
// $keuntungan = bcdiv(($jbg2)*$listing['kadarupah']/100*$listing['bakipjm'],1,1)-$beza_keuntungan;
|
|
// }
|
|
|
|
if($listing['tempohbayar'] == 12){
|
|
$keuntungan = 0.00;
|
|
}
|
|
elseif($listing['tempohbayar'] == $listing['tempoh'] ){
|
|
$keuntungan = 0.00;
|
|
}
|
|
else{
|
|
|
|
//kiraan keuntungan ujrah
|
|
$jeniskeuntungan = 'onepercent';
|
|
// $keuntungan1 = Http::get(config('app.api_ujrah_url'). 'upahrebettawarruq/'.$cawanganDetail->caw_code.'/'.$datagadai->norujukan.'/'.$jeniskeuntungan)->json();
|
|
$ujrahonepercentrebet = Http::get(config('app.api_ujrah_url'). 'kiraupahUjrahOnePercentRebate/'.$cawanganDetail->caw_code.'/'.$listing['norujukan'])->json();
|
|
$rounded_ujrah = $ujrahonepercentrebet['ujrah'];
|
|
$rounded_onepercent = $ujrahonepercentrebet['onepercent'];
|
|
$keuntungan = $rounded_ujrah + $rounded_onepercent;
|
|
|
|
}
|
|
|
|
$listsag[$index]['ktlhbyr'] = $ktlhbyr;
|
|
$listsag[$index]['keuntungan'] = $keuntungan;
|
|
}
|
|
$marhuns[$index1]['nama'] = $customer;
|
|
$marhuns[$index1]['listsag'] = $listsag;
|
|
|
|
}
|
|
return view('simulasiujrah.listsagbycust',compact('simulasilel','cawanganDetail','marhuns','simulasi_id','cawid','ktlhbyr'));
|
|
}
|
|
|
|
public function kemaskini2(Request $request)
|
|
{
|
|
$user = Auth::user();
|
|
|
|
$currentNow = Carbon::now();
|
|
|
|
$sim_karats = SimKarat::where('simulasi_id', $request->idsimulasi)->get();
|
|
|
|
$insert_harga2 = $request->harga2;
|
|
|
|
$simkarat_temp_arr = [];
|
|
$cases = '';
|
|
|
|
foreach ($sim_karats as $index => $sim_karat) {
|
|
if ($insert_harga2[$index]) {
|
|
$sim_karats[$index]['harga_baru'] = $insert_harga2[$index];
|
|
}
|
|
$sim_karat_temp_to_be_inserted = [
|
|
'simulasi_id' => $request->idsimulasi,
|
|
'karat' => $sim_karat->karat,
|
|
'keterangan' => $sim_karat->keterangan,
|
|
'harga' => $sim_karat->harga,
|
|
'harga2' => $sim_karat->harga2,
|
|
'created_at' => $currentNow,
|
|
'updated_at' => $currentNow,
|
|
];
|
|
|
|
array_push($simkarat_temp_arr, $sim_karat_temp_to_be_inserted);
|
|
|
|
$cases .= sprintf(' WHEN id = %d THEN %s ', $sim_karat->id, $sim_karat->harga_baru);
|
|
}
|
|
|
|
$build_query = sprintf("CASE %s END", $cases);
|
|
|
|
SimKarat_temp::insert($simkarat_temp_arr);
|
|
|
|
SimKarat::query()->where('simulasi_id', $request->idsimulasi)->update(['harga2' => DB::raw($build_query)]);
|
|
|
|
Simulasi::find($request->idsimulasi)->update(['harga_emas_asas' => $request->harga2[3]]);
|
|
|
|
$new_sim_karat = SimKarat::where('simulasi_id', $request->idsimulasi)->select('simulasi_id', 'karat', 'harga2')->get()->keyBy('karat');
|
|
|
|
$simulasi_bid = SimulasiBid::with('simulasiBidMarhun')->where('simulasi_id', $request->idsimulasi)->select('id', 'kodcaw', 'norujukan')->get();
|
|
|
|
/** -------------UPDATE SIMULASI BID MARHUN------------- */
|
|
$list_simulasi_bid_marhun = collect();
|
|
foreach($simulasi_bid->keyBy('norujukan') as $index90 => $item)
|
|
{
|
|
foreach($item->simulasiBidMarhun as $index55 => $lel_bid_marhun_collect)
|
|
{
|
|
$item->simulasiBidMarhun[$index55]['norujukan'] = $index90;
|
|
}
|
|
$list_simulasi_bid_marhun = $list_simulasi_bid_marhun->concat($item->simulasiBidMarhun);
|
|
}
|
|
|
|
$cases_update_harga = '';
|
|
$cases_update_n_marhun = '';
|
|
$cases_update_hargaasas = '';
|
|
$simulasi_bid_marhun_array = [];
|
|
|
|
foreach($list_simulasi_bid_marhun as $index => $marhun)
|
|
{
|
|
array_push($simulasi_bid_marhun_array, $marhun->id);
|
|
if ($new_sim_karat[$marhun->karat])
|
|
{
|
|
|
|
$harga_to_be_inserted = $new_sim_karat[$marhun->karat]->harga2;
|
|
$n_marhun_to_be_inserted = $marhun->berat * $new_sim_karat[$marhun->karat]->harga2;
|
|
$harga_asas_to_be_inserted = round($marhun->berat * $new_sim_karat[$marhun->karat]->harga2);
|
|
|
|
$list_simulasi_bid_marhun[$index]['new_n_marhun'] = $n_marhun_to_be_inserted;
|
|
$list_simulasi_bid_marhun[$index]['new_hargaasas'] = $harga_asas_to_be_inserted;
|
|
|
|
$cases_update_harga .= sprintf(' WHEN id = %d THEN %s ', $marhun->id, $harga_to_be_inserted);
|
|
$cases_update_n_marhun .= sprintf(' WHEN id = %d THEN %s ', $marhun->id, $n_marhun_to_be_inserted);
|
|
$cases_update_hargaasas .= sprintf(' WHEN id = %d THEN %s ', $marhun->id, $harga_asas_to_be_inserted);
|
|
}
|
|
|
|
}
|
|
$build_query_update_harga = sprintf("CASE %s END", $cases_update_harga);
|
|
$build_query_update_n_marhun = sprintf("CASE %s END", $cases_update_n_marhun);
|
|
$build_query_update_hargaasas = sprintf("CASE %s END", $cases_update_hargaasas);
|
|
|
|
SimulasiBidMarhun::query()->whereIn('id', $simulasi_bid_marhun_array)
|
|
->update([
|
|
'harga' => DB::raw($build_query_update_harga),
|
|
'n_marhun' => DB::raw($build_query_update_n_marhun),
|
|
'hargaasas' => DB::raw($build_query_update_hargaasas)
|
|
]);
|
|
|
|
/** -------------UPDATE SIMULASI BID------------- */
|
|
$list_simulasi_bid_marhun_updated = $list_simulasi_bid_marhun->groupBy('simulasibid_id');
|
|
$collection_simulasi_bid_marhun_updated = collect();
|
|
|
|
foreach($list_simulasi_bid_marhun_updated as $index2 => $simulasi_bid_updated)
|
|
{
|
|
$array_to_be_inserted = [];
|
|
$array_to_be_inserted['id'] = $index2;
|
|
$array_to_be_inserted['norujukan'] = $simulasi_bid_updated[0]->norujukan;
|
|
$array_to_be_inserted['total_n_marhun'] = $simulasi_bid_updated->sum('new_n_marhun');
|
|
$array_to_be_inserted['total_hargaasas'] = $simulasi_bid_updated->sum('new_hargaasas');
|
|
$collection_simulasi_bid_marhun_updated = $collection_simulasi_bid_marhun_updated->push($array_to_be_inserted);
|
|
}
|
|
|
|
// $cases_update_n_marhuns_simulasi_bid = '';
|
|
$cases_update_hargaasas_simulasi_bid = '';
|
|
$log_user_array = [];
|
|
|
|
foreach($collection_simulasi_bid_marhun_updated as $collection_simulasi_bid)
|
|
{
|
|
$log_user_array_to_be_inserted = [
|
|
"user_id" => $user->id,
|
|
"date" => $currentNow->toDateTimeString(),
|
|
"username" => $user->username,
|
|
"nama_user" => $user->name,
|
|
"norujukan" => $collection_simulasi_bid['norujukan'],
|
|
"nota" => "Simulasi, Kemaskini Harga Asas RM" . $collection_simulasi_bid['total_hargaasas'],
|
|
'created_at' => $currentNow,
|
|
'updated_at' => $currentNow,
|
|
];
|
|
array_push($log_user_array, $log_user_array_to_be_inserted);
|
|
// $cases_update_n_marhuns_simulasi_bid .= sprintf(' WHEN id = %d THEN %s ', $collection_simulasi_bid['id'], $collection_simulasi_bid['total_n_marhun']);
|
|
$cases_update_hargaasas_simulasi_bid .= sprintf(' WHEN id = %d THEN %s ', $collection_simulasi_bid['id'], $collection_simulasi_bid['total_hargaasas']);
|
|
}
|
|
|
|
// $build_query_update_nmarhuns_simulasi_bid = sprintf("CASE %s END", $cases_update_n_marhuns_simulasi_bid);
|
|
$build_query_update_hargaasas_simulasi_bid = sprintf("CASE %s END", $cases_update_hargaasas_simulasi_bid);
|
|
|
|
SimulasiBid::query()->where('simulasi_id', $request->idsimulasi)
|
|
->update([
|
|
// 'nmarhuns' => DB::raw($build_query_update_nmarhuns_simulasi_bid),
|
|
'hargaasas' => DB::raw($build_query_update_hargaasas_simulasi_bid),
|
|
]);
|
|
|
|
LogUser::insert($log_user_array);
|
|
|
|
return redirect()->route('analisaujrah.show',$request->idsimulasi)->with('success','Kemaskini Harga Emas Berjaya');
|
|
}
|
|
|
|
public function tempbycawsimulasi($details, $t_gadai1, $fasa)
|
|
{
|
|
$jbgadai = $t_gadai1;
|
|
//$fasa = $request->fasa;
|
|
// dd($details);
|
|
|
|
if($fasa == '1'){
|
|
$getsurat = Gadai::on($details)
|
|
->where('t_gadai', '<=', $jbgadai)
|
|
->where('kodcaw', $details)
|
|
->where('sttebus', '=', '')
|
|
->where('lelong_tawarruq','=',1)
|
|
->where('taglel', '=', 0)
|
|
->where('tagpalsu', '=', 0)
|
|
->where('tagpalsu2', '=', 0)
|
|
->where('tagbaru', '=', 1)
|
|
->whereNotNull('upah12')
|
|
->get();
|
|
|
|
$t_gadais = Gadai::on($details)
|
|
->where('t_gadai', '<=', $jbgadai)
|
|
->where('sttebus', '=', '')
|
|
->where('taglel', '=', 0)
|
|
->where('tagpalsu', '=', 0)
|
|
->where('tagpalsu2', '=', 0)
|
|
->where('tagbaru', '=', 1)
|
|
->whereNotNull('upah12')
|
|
->orderBy('t_gadai')
|
|
->select('t_gadai')
|
|
->first();
|
|
}else{
|
|
$getsurat = Gadai::on($details)
|
|
->where('t_gadai', '<=', $jbgadai)
|
|
->where('kodcaw', $details)
|
|
->where('sttebus', '=', '')
|
|
->where('taglel', '=', 0)
|
|
->where('tagpalsu', '=', 0)
|
|
->where('tagpalsu2', '=', 0)
|
|
->where('tagbaru', '=', 1)
|
|
->whereNotNull('upah12')
|
|
->get();
|
|
|
|
$t_gadais = Gadai::on($details)
|
|
->where('t_gadai', '<=', $jbgadai)
|
|
->where('sttebus', '=', '')
|
|
->where('taglel', '=', 0)
|
|
->where('tagpalsu', '=', 0)
|
|
->where('tagpalsu2', '=', 0)
|
|
->where('tagbaru', '=', 1)
|
|
->whereNotNull('upah12')
|
|
->orderBy('t_gadai')
|
|
->select('t_gadai')
|
|
->first();
|
|
}
|
|
|
|
// $tarikh_lelong = Carbon::parse($t_lelong);
|
|
// $t_anggaran = ($tarikh_lelong->subMonths(1))->toDateString();
|
|
// $t_lelongdisplay = $tarikh_lelong->format('d-m-Y');
|
|
//$t_anggaran = ($tarikh_lelong->subDays(20))->format('d/m/Y');
|
|
//$t_daftarlelong = ($tarikh_lelong->subMonths(1))->format('d/m/Y');
|
|
//dd($getsurat);
|
|
|
|
foreach($getsurat as $index1=>$surats)
|
|
{
|
|
$senarai = Gadai::on($details)
|
|
->where('norujukan', $surats['norujukan'])
|
|
->get();
|
|
// dd($surats['tempoh']);
|
|
|
|
|
|
$total_untung_rebet = TransaksiKeuntungan::on('main')->where('norujukan','=',$surats['norujukan'])->sum('keuntungan_rebet');
|
|
$total_untung_asal = TransaksiKeuntungan::on('main')->where('norujukan','=',$surats['norujukan'])->sum('bayaran_keuntungan');
|
|
$beza_keuntungan = $total_untung_asal - $total_untung_rebet;
|
|
|
|
|
|
//kiraan keuntungan ujrah
|
|
$jeniskeuntungan = 'onepercent';
|
|
// $keuntungan1 = Http::get(config('app.api_ujrah_url'). 'upahrebettawarruq/'.$details.'/'.$surats['norujukan'].'/'.$jeniskeuntungan)->json();
|
|
$ujrahonepercentrebet = Http::get(config('app.api_ujrah_url'). 'kiraupahUjrahOnePercentRebate/'.$details.'/'.$surats['norujukan'])->json();
|
|
$rounded_ujrah = $ujrahonepercentrebet['ujrah'];
|
|
$rounded_onepercent = $ujrahonepercentrebet['onepercent'];
|
|
$keuntungan = $rounded_ujrah + $rounded_onepercent;
|
|
|
|
// dd($surats['hargajualan']);
|
|
$ktlhbyr = $surats['hargajualan']-$surats['bakihargajualan'];
|
|
// dd($ktlhbyr);
|
|
$getsurat[$index1]['list_norujukan'] = $senarai;
|
|
$getsurat[$index1]['keuntungan'] = $keuntungan;
|
|
$getsurat[$index1]['ktlhbyr'] = $ktlhbyr;
|
|
// dd($surats['norujukan']);
|
|
}
|
|
|
|
|
|
// $keuntungantlhbyr = TransaksiKeuntungan::on('mysql2')
|
|
// ->sum('bayaran_keuntungan');
|
|
|
|
return view('simulasiujrah.tempbycawsimulasi', compact( 'getsurat',
|
|
'details',
|
|
'senarai',
|
|
'keuntungan',
|
|
't_gadais',
|
|
'ktlhbyr','rounded_ujrah','rounded_onepercent'
|
|
|
|
));
|
|
}
|
|
|
|
public function export(Request $request)
|
|
{
|
|
$simulasi_id = $request->simulasiid;
|
|
|
|
$simulasi = Simulasi::where('id','=',$simulasi_id)->first();
|
|
$cawangansim = CawanganSimulasi::where('simulasi_id','=',$simulasi_id)->get();
|
|
$simkarat = SimKarat::where('simulasi_id','=',$simulasi_id)->get();
|
|
$jeniskarat = JenisKarat::all();
|
|
|
|
$arraydata = [];
|
|
$arraycaw = [];
|
|
$data = [];
|
|
|
|
$total_marhun = 0;
|
|
$total_berat = 0;
|
|
$total_nmarhun = 0;
|
|
$total_pinjaman = 0;
|
|
$total_upah = 0;
|
|
$total_hargaasas = 0;
|
|
$total_cazlelong = 0;
|
|
$total_rugilelong = 0;
|
|
$total_bakilelong = 0;
|
|
|
|
$total24Kgb = 0;
|
|
$total24K = 0;
|
|
$total23k = 0;
|
|
$total22K = 0;
|
|
$total21K = 0;
|
|
$total20K = 0;
|
|
$total18Kp = 0;
|
|
$total18K = 0;
|
|
$total14Kp = 0;
|
|
$total14K = 0;
|
|
$total9K = 0;
|
|
$total_bakiupah = 0;
|
|
$total_nilaimarhun = 0;
|
|
$total_onepercent = 0;
|
|
$total_ujrah = 0;
|
|
|
|
foreach($cawangansim as $cawsim)
|
|
{
|
|
$cawangan = Cawangan::where('id','=',$cawsim->caw_id)->first();
|
|
// $databid = SimulasiBid::join('gadai','simulasibid.norujukan','=','gadai.norujukan')
|
|
// ->select('simulasibid.id','simulasibid.berat','simulasibid.marhun','simulasibid.cajlelong','simulasibid.baki','simulasibid.nilaimarhun',
|
|
// 'simulasibid.pinjaman','simulasibid.hargaasas','simulasibid.cajlelong','gadai.bakipjm','gadai.bakihargajualan','gadai.upah12',
|
|
// 'gadai.ansakhir','gadai.tempoh','gadai.kadarupah','gadai.tempohbayar')
|
|
// ->where('caw_id','=',$cawsim->caw_id)->where('simulasi_id','=',$simulasi_id)->get();
|
|
$databid = SimulasiBid::select('simulasibid.id','simulasibid.berat','simulasibid.marhun','simulasibid.cajlelong','simulasibid.baki','simulasibid.nilaimarhun',
|
|
'simulasibid.pinjaman','simulasibid.hargaasas','simulasibid.cajlelong','simulasibid.bakiupah','simulasibid.onepercent','simulasibid.ujrah')
|
|
->where('caw_id','=',$cawsim->caw_id)->where('simulasi_id','=',$simulasi_id)->get();
|
|
// ->toArray();
|
|
|
|
$packet = 0;
|
|
$berat = 0;
|
|
$nilai_marhun = 0;
|
|
$pinjaman =0;
|
|
$bakiupah = 0;
|
|
$onepercent = 0;
|
|
$ujrah = 0;
|
|
$hargaasas = 0;
|
|
$cajlelong = 0;
|
|
$rugilelong = 0;
|
|
$bakilelong = 0;
|
|
|
|
// $keuntungan = 0;
|
|
// $total_upahkeuntungan = 0;
|
|
|
|
|
|
foreach($databid as $index1=>$bid)
|
|
{
|
|
$marhun = SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])->get();
|
|
$berat = $berat + $bid['berat'];
|
|
// $nilai_marhun = $nilai_marhun + ($marhun->sum('n_marhun'));
|
|
$nilai_marhun = $nilai_marhun + $bid['nilaimarhun'];
|
|
$pinjaman =$pinjaman + $bid['pinjaman'];
|
|
$bakiupah = $bakiupah + $bid['bakiupah'];
|
|
$onepercent = $onepercent + $bid['onepercent'];
|
|
$ujrah = $ujrah + $bid['ujrah'];
|
|
$hargaasas = $hargaasas + $bid['hargaasas'];
|
|
// $cajlelong = $cajlelong + $bid['cajlelong'];
|
|
|
|
|
|
// $keuntungan = $bid['bakipjm'] - ($bid['bakihargajualan'] - ($bid['upah12'] - $bid['ansakhir'])-(($bid['tempoh']-$bid['tempohbayar'])*$bid['kadarupah']/100*$bid['bakipjm']) );
|
|
// $databid[$index1]['keuntungan'] = $keuntungan;
|
|
|
|
// // $total_upahkeuntungan = $total_upahkeuntungan + $keuntungan;
|
|
// $total_upahkeuntungan = bcdiv($total_upahkeuntungan,1,1) + bcdiv($keuntungan,1,1);
|
|
|
|
$sumcajlelong = $bid['hargaasas'] * ($simulasi['cajlelong']/100);
|
|
$cajlelongnew = round($sumcajlelong, 1, 1);
|
|
$cajlelong = $cajlelong + $cajlelongnew;
|
|
$totalbaki = $bid['hargaasas'] - $bid['pinjaman'] - $bid['bakiupah'] - $cajlelongnew;
|
|
if(strpos($totalbaki, '-') !== false)
|
|
{
|
|
$rugi = -$totalbaki;
|
|
$rugilelong += $rugi;
|
|
}
|
|
else {
|
|
$baki = $totalbaki;
|
|
$bakilelong += $baki;
|
|
}
|
|
|
|
$total24Kgb += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
|
|
->where('karat','=','24.0Kgb')
|
|
->sum('berat');
|
|
|
|
$total24K += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
|
|
->where('karat','=','24.0K')
|
|
->sum('berat');
|
|
|
|
$total23k += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
|
|
->where('karat','=','23.0K')
|
|
->sum('berat');
|
|
|
|
$total22K += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
|
|
->where('karat','=','22.0K')
|
|
->sum('berat');
|
|
|
|
$total21K += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
|
|
->where('karat','=','21.0K')
|
|
->sum('berat');
|
|
|
|
$total20K += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
|
|
->where('karat','=','20.0K')
|
|
->sum('berat');
|
|
|
|
$total18Kp += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
|
|
->where('karat','=','18.0Kp')
|
|
->sum('berat');
|
|
|
|
$total18K += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
|
|
->where('karat','=','18.0K')
|
|
->sum('berat');
|
|
|
|
$total14Kp += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
|
|
->where('karat','=','14.0Kp')
|
|
->sum('berat');
|
|
|
|
$total14K += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
|
|
->where('karat','=','14.0K')
|
|
->sum('berat');
|
|
|
|
$total9K += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
|
|
->where('karat','=','9.0K')
|
|
->sum('berat');
|
|
|
|
|
|
|
|
}
|
|
|
|
array_push($arraycaw,[
|
|
'id_cawangan'=> $cawangan['id'],
|
|
'cawangan'=>$cawangan['caw_name'],
|
|
't_lelong'=>$simulasi['tarikh_lelong'],
|
|
'bil_marhun'=>sizeof($databid),
|
|
'berat'=>$berat,
|
|
'n_marhun'=>$nilai_marhun,
|
|
'pinjaman'=>$pinjaman,
|
|
'upahsimpan'=>$bakiupah,
|
|
'bakiupah'=>$bakiupah,
|
|
'onepercent'=>$onepercent,
|
|
'ujrah'=>$ujrah,
|
|
'hargaasas'=>$hargaasas,
|
|
'cajlelong'=>$cajlelong,
|
|
'rugilelong'=>$rugilelong,
|
|
'bakilelong'=>$bakilelong,
|
|
]);
|
|
|
|
|
|
$total_marhun = $total_marhun + sizeof($databid);
|
|
$total_berat = $total_berat + $berat;
|
|
$total_nilaimarhun = $total_nilaimarhun + $nilai_marhun;
|
|
$total_pinjaman = $total_pinjaman + $pinjaman;
|
|
$total_hargaasas = $total_hargaasas + $hargaasas;
|
|
$total_cazlelong = $total_cazlelong + $cajlelong;
|
|
$total_rugilelong = $total_rugilelong + $rugilelong;
|
|
$total_bakilelong = $total_bakilelong + $bakilelong;
|
|
$total_bakiupah = $total_bakiupah + $bakiupah;
|
|
$total_onepercent = $total_onepercent + $onepercent;
|
|
$total_ujrah = $total_ujrah + $ujrah;
|
|
|
|
|
|
$data = Simulasi::where('simulasi.id','=',$simulasi_id)
|
|
->first();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$pdf = PDF::loadView('pdf.simrpt2ujrah',compact('arraycaw',
|
|
'total_marhun',
|
|
'total_berat',
|
|
'total_nmarhun',
|
|
'total_pinjaman',
|
|
'total_upah',
|
|
'total_hargaasas',
|
|
'total_cazlelong',
|
|
'total_rugilelong',
|
|
'total_bakilelong',
|
|
'total24Kgb',
|
|
'total24K',
|
|
'total23k',
|
|
'total22K',
|
|
'total21K',
|
|
'total20K',
|
|
'total18Kp',
|
|
'total18K',
|
|
'total14Kp',
|
|
'total14K',
|
|
'total9K',
|
|
'simkarat',
|
|
'simulasi_id',
|
|
'jeniskarat',
|
|
'data',
|
|
'total_bakiupah',
|
|
'total_onepercent',
|
|
'total_ujrah',
|
|
'total_nilaimarhun'
|
|
))->setPaper('a4', 'landscape');
|
|
return $pdf->download('Simulasi Keseluruhan.pdf');
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|