update, simulasi pdf, lelong pdf, simulasi by caw pdf
This commit is contained in:
@@ -88,7 +88,7 @@ class LelongController extends Controller
|
||||
return view('lelong.senarailelong',compact('lelong', 'arraydetails'));
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
$lelong_id = $id;
|
||||
$lelong = Lelong::where('id','=',$id)->first();
|
||||
@@ -423,18 +423,7 @@ class LelongController extends Controller
|
||||
->with('success','Create Lelong Berjaya');
|
||||
|
||||
}
|
||||
public function exportnotis($id)
|
||||
{
|
||||
$currentdate = Carbon::now();
|
||||
$currentdate = $currentdate->toDateString();
|
||||
|
||||
$lelong = Lelong::where('id','=',$id)->first();
|
||||
$lelongbid = LelongBid::where('lelong_id','=',$lelong->id)->get();
|
||||
// return view('pdf.notislelong',compact('currentdate','lelongbid')); //page for editing
|
||||
|
||||
$pdf = PDF::loadView('pdf.notislelong',compact('currentdate','lelongbid'));
|
||||
return $pdf->download('Notis Lelong.pdf');
|
||||
}
|
||||
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
@@ -2606,8 +2595,6 @@ class LelongController extends Controller
|
||||
return redirect()->route('lelong.senarailelongtaklaku');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function renewxlakujanadata(Request $request)
|
||||
@@ -2770,6 +2757,195 @@ class LelongController extends Controller
|
||||
return view('lelong.listsagbycust',compact('marhuns','lelongid','cawid','listsag','ktlhbyr','arrayinfo'));
|
||||
}
|
||||
|
||||
public function exportlelong(Request $request)
|
||||
{
|
||||
|
||||
$lelong_id = $request->lelongid;
|
||||
|
||||
|
||||
$lelong = Lelong::where('id','=',$lelong_id)->first();
|
||||
$cawanganlel = CawanganLelong::where('lelong_id','=',$lelong_id)->get();
|
||||
$lelkarat = LelKarat::where('lelong_id','=',$lelong_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_nilaimarhun = 0;
|
||||
$nilai_marhun = 0;
|
||||
$total_bakiupah = 0;
|
||||
|
||||
foreach($cawanganlel as $cawlel)
|
||||
{
|
||||
$cawangan = Cawangan::where('id','=',$cawlel->caw_id)->first();
|
||||
$databid = LelongBid::select('lelongbid.id','lelongbid.berat','lelongbid.marhun','lelongbid.cajlelong','lelongbid.baki','lelongbid.nilaimarhun',
|
||||
'lelongbid.pinjaman','lelongbid.hargaasas','lelongbid.cajlelong','lelongbid.bakiupah')
|
||||
->where('caw_id','=',$cawlel->caw_id)->where('lelong_id','=',$lelong_id)->get();
|
||||
|
||||
// dd($databid->toArray());
|
||||
$packet = 0;
|
||||
$berat = 0;
|
||||
$pinjaman =0;
|
||||
$nilai_marhun = 0;
|
||||
$bakiupah = 0;
|
||||
$hargaasas = 0;
|
||||
$cajlelong = 0;
|
||||
$rugilelong = 0;
|
||||
$bakilelong = 0;
|
||||
|
||||
foreach($databid as $index1=>$bid)
|
||||
{
|
||||
$marhun = LelongBidMarhun::where('lelongbid_id','=',$bid['id'])->get();
|
||||
$berat = $berat + $bid['berat'];
|
||||
$nilai_marhun = $nilai_marhun + $bid['nilaimarhun'];
|
||||
$pinjaman =$pinjaman + $bid['pinjaman'];
|
||||
$bakiupah = $bakiupah + $bid['bakiupah'];
|
||||
$hargaasas = $hargaasas + $bid['hargaasas'];
|
||||
$cajlelong = $cajlelong + $bid['cajlelong'];
|
||||
|
||||
|
||||
if($bid['baki'] > 0)
|
||||
{
|
||||
$bakilelong = $bakilelong + $bid['baki'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$rugilelong = $rugilelong - $bid['baki'];
|
||||
}
|
||||
|
||||
|
||||
$total24Kgb += LelongBidMarhun::where('lelongbid_id','=',$bid['id'])
|
||||
->where('karat','=','24.0Kgb')
|
||||
->sum('berat');
|
||||
|
||||
$total24K += LelongBidMarhun::where('lelongbid_id','=',$bid['id'])
|
||||
->where('karat','=','24.0K')
|
||||
->sum('berat');
|
||||
|
||||
$total23k += LelongBidMarhun::where('lelongbid_id','=',$bid['id'])
|
||||
->where('karat','=','23.0K')
|
||||
->sum('berat');
|
||||
|
||||
$total22K += LelongBidMarhun::where('lelongbid_id','=',$bid['id'])
|
||||
->where('karat','=','22.0K')
|
||||
->sum('berat');
|
||||
|
||||
$total21K += LelongBidMarhun::where('lelongbid_id','=',$bid['id'])
|
||||
->where('karat','=','21.0K')
|
||||
->sum('berat');
|
||||
|
||||
$total20K += LelongBidMarhun::where('lelongbid_id','=',$bid['id'])
|
||||
->where('karat','=','20.0K')
|
||||
->sum('berat');
|
||||
|
||||
$total18Kp += LelongBidMarhun::where('lelongbid_id','=',$bid['id'])
|
||||
->where('karat','=','18.0Kp')
|
||||
->sum('berat');
|
||||
|
||||
$total18K += LelongBidMarhun::where('lelongbid_id','=',$bid['id'])
|
||||
->where('karat','=','18.0K')
|
||||
->sum('berat');
|
||||
|
||||
$total14Kp += LelongBidMarhun::where('lelongbid_id','=',$bid['id'])
|
||||
->where('karat','=','14.0Kp')
|
||||
->sum('berat');
|
||||
|
||||
$total14K += LelongBidMarhun::where('lelongbid_id','=',$bid['id'])
|
||||
->where('karat','=','14.0K')
|
||||
->sum('berat');
|
||||
|
||||
$total9K += LelongBidMarhun::where('lelongbid_id','=',$bid['id'])
|
||||
->where('karat','=','9.0K')
|
||||
->sum('berat');
|
||||
|
||||
|
||||
|
||||
}
|
||||
array_push($arraycaw,[
|
||||
'id_cawangan'=> $cawangan['id'],
|
||||
'cawangan'=>$cawangan['caw_name'],
|
||||
't_lelong'=>$lelong['tarikh_lelong'],
|
||||
'bil_marhun'=>sizeof($databid),
|
||||
'berat'=>$berat,
|
||||
'n_marhun'=>$nilai_marhun,
|
||||
'pinjaman'=>$pinjaman,
|
||||
'upahsimpan'=>$bakiupah,
|
||||
'bakiupah'=>$bakiupah,
|
||||
'hargaasas'=>$hargaasas,
|
||||
'cajlelong'=>$cajlelong,
|
||||
'rugilelong'=>$rugilelong,
|
||||
'bakilelong'=>$bakilelong,
|
||||
]);
|
||||
|
||||
$total_marhun = $total_marhun + sizeof($databid);
|
||||
$total_berat = $total_berat + $berat;
|
||||
$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_nilaimarhun = $total_nilaimarhun + $nilai_marhun;
|
||||
$total_bakiupah = $total_bakiupah + $bakiupah;
|
||||
|
||||
|
||||
$data = Lelong::where('lelong.id','=',$lelong_id)
|
||||
->first();
|
||||
}
|
||||
|
||||
$pdf = PDF::loadView('pdf.lelreport',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',
|
||||
'lelkarat',
|
||||
'lelong_id',
|
||||
'jeniskarat',
|
||||
'data',
|
||||
'total_bakiupah',
|
||||
'total_nilaimarhun'
|
||||
))->setPaper('a4', 'potrait');
|
||||
return $pdf->download('Lelong Keseluruhan.pdf');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@ use App\Models\LelongBidMarhun;
|
||||
use App\Models\LelKarat;
|
||||
use App\Models\LelKarat_temp;
|
||||
use App\Models\Resit;
|
||||
use App\Models\Customer;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
class ReportController extends Controller
|
||||
@@ -501,6 +503,86 @@ class ReportController extends Controller
|
||||
}
|
||||
|
||||
|
||||
Public function simulasireport ($simulasi_id, $cawid){
|
||||
|
||||
$keuntungan = 0;
|
||||
|
||||
$marhuns = SimulasiBid::join('cawangan', 'simulasibid.caw_id', '=', 'cawangan.id')
|
||||
// ->join('gadai','simulasibid.norujukan','=','gadai.norujukan')
|
||||
->where('simulasi_id','=',$simulasi_id)
|
||||
->where('caw_id','=',$cawid)
|
||||
->select(
|
||||
'simulasibid.t_lelong',
|
||||
'simulasibid.kodcaw',
|
||||
'cawangan.caw_name',
|
||||
'simulasibid.norujukan',
|
||||
'simulasibid.pinjaman',
|
||||
'simulasibid.berat',
|
||||
'simulasibid.nilaimarhun',
|
||||
'simulasibid.hargaasas',
|
||||
'simulasibid.bakiupah',
|
||||
'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'
|
||||
|
||||
)
|
||||
->get()->toArray();
|
||||
// dd($marhuns);
|
||||
$arraymarhun = [];
|
||||
foreach($marhuns as $index1=>$cal){
|
||||
// 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']) );
|
||||
$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'],
|
||||
]);
|
||||
|
||||
|
||||
$datacaw = Cawangan::where('id','=',$cawid)
|
||||
|
||||
->get();
|
||||
}
|
||||
|
||||
$pdf = PDF::loadView('pdf.pdfsimulasireport',compact('arraymarhun','marhuns','simulasi_id','cawid','keuntungan','datacaw'))
|
||||
->setPaper('a4','potrait');
|
||||
|
||||
return $pdf->download('Laporan Barang Lelong Pembida.pdf');
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -585,13 +585,9 @@ class SimulasiController extends Controller
|
||||
{
|
||||
$simulasi_id = $request->simulasiid;
|
||||
|
||||
// $simulasi = Simulasi::where('id','=',$request->simulasiid)->first();
|
||||
// $cawangansim = CawanganSimulasi::where('simulasi_id','=',$request->simulasiid)->get();
|
||||
// $simkarat = SimKarat::where('simulasi_id','=',$request->simulasiid)->get();
|
||||
|
||||
$simulasi = Simulasi::where('id','=',$request->simulasiid)->first();
|
||||
$cawangansim = CawanganSimulasi::where('simulasi_id','=',$request->simulasiid)->get();
|
||||
$simkarat = SimKarat::where('simulasi_id','=',$request->simulasiid)->get();
|
||||
$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 = [];
|
||||
@@ -619,16 +615,19 @@ class SimulasiController extends Controller
|
||||
$total14Kp = 0;
|
||||
$total14K = 0;
|
||||
$total9K = 0;
|
||||
$total_upahkeuntungan2 = 0;
|
||||
$total_bakiupah = 0;
|
||||
$total_nilaimarhun = 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')
|
||||
// $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')
|
||||
->where('caw_id','=',$cawsim->caw_id)->where('simulasi_id','=',$simulasi_id)->get();
|
||||
// ->toArray();
|
||||
|
||||
@@ -636,14 +635,14 @@ class SimulasiController extends Controller
|
||||
$berat = 0;
|
||||
$nilai_marhun = 0;
|
||||
$pinjaman =0;
|
||||
$upah = 0;
|
||||
$bakiupah = 0;
|
||||
$hargaasas = 0;
|
||||
$cajlelong = 0;
|
||||
$rugilelong = 0;
|
||||
$bakilelong = 0;
|
||||
|
||||
$keuntungan = 0;
|
||||
$total_upahkeuntungan = 0;
|
||||
// $keuntungan = 0;
|
||||
// $total_upahkeuntungan = 0;
|
||||
|
||||
|
||||
foreach($databid as $index1=>$bid)
|
||||
@@ -653,16 +652,16 @@ class SimulasiController extends Controller
|
||||
// $nilai_marhun = $nilai_marhun + ($marhun->sum('n_marhun'));
|
||||
$nilai_marhun = $nilai_marhun + $bid['nilaimarhun'];
|
||||
$pinjaman =$pinjaman + $bid['pinjaman'];
|
||||
// $upah = $upah + $bid['upah'];
|
||||
$bakiupah = $bakiupah + $bid['bakiupah'];
|
||||
$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;
|
||||
// $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);
|
||||
// // $total_upahkeuntungan = $total_upahkeuntungan + $keuntungan;
|
||||
// $total_upahkeuntungan = bcdiv($total_upahkeuntungan,1,1) + bcdiv($keuntungan,1,1);
|
||||
|
||||
|
||||
|
||||
@@ -732,7 +731,8 @@ class SimulasiController extends Controller
|
||||
'berat'=>$berat,
|
||||
'n_marhun'=>$nilai_marhun,
|
||||
'pinjaman'=>$pinjaman,
|
||||
'upahsimpan'=>bcdiv($total_upahkeuntungan,1,1),
|
||||
'upahsimpan'=>$bakiupah,
|
||||
'bakiupah'=>$bakiupah,
|
||||
'hargaasas'=>$hargaasas,
|
||||
'cajlelong'=>$cajlelong,
|
||||
'rugilelong'=>$rugilelong,
|
||||
@@ -743,23 +743,23 @@ class SimulasiController extends Controller
|
||||
$total_marhun = $total_marhun + sizeof($databid);
|
||||
$total_berat = $total_berat + $berat;
|
||||
$total_nilaimarhun = $total_nilaimarhun + $nilai_marhun;
|
||||
//dd($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_upahkeuntungan2 = $total_upahkeuntungan2 + $total_upahkeuntungan;
|
||||
$total_bakiupah = $total_bakiupah + $bakiupah;
|
||||
|
||||
|
||||
$data = Simulasi::where('simulasi.id','=',$simulasi_id)
|
||||
->get();
|
||||
->first();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$pdf = PDF::loadView('pdf.simrpt2',compact('arraycaw',
|
||||
'total_marhun',
|
||||
'total_berat',
|
||||
@@ -775,7 +775,7 @@ class SimulasiController extends Controller
|
||||
'total23k',
|
||||
'total22K',
|
||||
'total21K',
|
||||
'total20K',
|
||||
'total20K',
|
||||
'total18Kp',
|
||||
'total18K',
|
||||
'total14Kp',
|
||||
@@ -785,13 +785,9 @@ class SimulasiController extends Controller
|
||||
'simulasi_id',
|
||||
'jeniskarat',
|
||||
'data',
|
||||
'total_upahkeuntungan',
|
||||
'total_nilaimarhun',
|
||||
'total_upahkeuntungan2',
|
||||
'databid',
|
||||
'cawangan',
|
||||
'simulasi_id',
|
||||
'bid'))->setPaper('a4', 'potrait');
|
||||
'total_bakiupah',
|
||||
'total_nilaimarhun'
|
||||
))->setPaper('a4', 'potrait');
|
||||
return $pdf->download('Simulasi Keseluruhan.pdf');
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user