1163 lines
42 KiB
PHP
1163 lines
42 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
use App\Events\LelongNotify;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Spatie\Permission\Models\Role;
|
|
use Spatie\Permission\Models\Permission;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use PDF;
|
|
use App\Models\User;
|
|
use App\Models\Cawangan;
|
|
use App\Models\Gadai;
|
|
use App\Models\JenisEmas;
|
|
use App\Models\JenisKarat;
|
|
|
|
use App\Models\Simulasi;
|
|
use App\Models\SimulasiBid;
|
|
use App\Models\SimulasiBidMarhun;
|
|
use App\Models\SimKarat;
|
|
use App\Models\SimKarat_temp;
|
|
use App\Models\CawanganSimulasi;
|
|
|
|
|
|
use App\Models\Lelong;
|
|
use App\Models\CawanganLelong;
|
|
use App\Models\LelongBid;
|
|
use App\Models\LelongBidder;
|
|
use App\Models\LelongBidMarhun;
|
|
use App\Models\LelKarat;
|
|
use App\Models\LelKarat_temp;
|
|
use App\Models\Resit;
|
|
use App\Models\Customer;
|
|
use App\Models\TransaksiKeuntungan;
|
|
use Carbon\Carbon;
|
|
use Illuminate\Support\Facades\Http;
|
|
|
|
class ReportCawanganController extends Controller
|
|
{
|
|
/**
|
|
* Create a new controller instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
$this->middleware('auth');
|
|
}
|
|
|
|
/**
|
|
* Show the application dashboard.
|
|
*
|
|
* @return \Illuminate\Contracts\Support\Renderable
|
|
*/
|
|
|
|
|
|
|
|
// Laporan by cawangan
|
|
public function laporancawindex(request $request)
|
|
{
|
|
$user = Auth::user();
|
|
|
|
$lelongid = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
|
|
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('cawangan.caw_code','=',$user->kodcaw)
|
|
->get();
|
|
|
|
$cawname = Cawangan::where('caw_code','=',$user->kodcaw)
|
|
->get();
|
|
|
|
|
|
return view('lelong.laporancawindex',compact('lelongid','cawname'));
|
|
}
|
|
|
|
public function laporanbrglelcaw($lelong_id){
|
|
|
|
$user = Auth::user();
|
|
$caw = Cawangan::where('caw_code','=',$user->kodcaw)
|
|
->first();
|
|
|
|
$brglelongcaw = LelongBid::join('cawangan', 'lelongbid.caw_id', '=', 'cawangan.id')
|
|
->where('lelongbid.lelong_id', $lelong_id)
|
|
->where('lelongbid.kodcaw','=',$user['kodcaw'])
|
|
->get()->toArray();
|
|
|
|
$keuntungan=0;
|
|
$total_hargaasas = 0;
|
|
$total_berat = 0;
|
|
|
|
foreach($brglelongcaw as $index1=>$upah)
|
|
{
|
|
|
|
$total_hargaasas = $total_hargaasas + $upah['hargaasas'];
|
|
$total_berat = $total_berat + $upah['berat'];
|
|
|
|
}
|
|
|
|
$info = Lelong::join('cawangan_lelong','lelong.id','=','cawangan_lelong.lelong_id')
|
|
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('cawangan_lelong.lelong_id','=',$lelong_id)
|
|
->where('cawangan.caw_code','=',$user['kodcaw'])
|
|
->select('lelong_id','tarikh_lelong','caw_name','lelong.fasa')
|
|
->groupBy('lelong_id','caw_name')
|
|
->get()->toArray();
|
|
|
|
|
|
$pdf = PDF::loadView('pdf.brglelcaw',compact('brglelongcaw','lelong_id','keuntungan','total_hargaasas','total_berat','info'))
|
|
->setPaper('a4', 'potrait');
|
|
|
|
return $pdf->download('Senarai Barang Lelong.pdf');
|
|
|
|
|
|
}
|
|
|
|
public function indexbrgleldetailscaw(request $request)
|
|
{
|
|
$user = Auth::user();
|
|
|
|
$lelongid = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
|
|
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('cawangan.caw_code','=',$user->kodcaw)
|
|
->get();
|
|
|
|
$cawname = Cawangan::where('caw_code','=',$user->kodcaw)
|
|
->get();
|
|
|
|
return view('lelong.indexbrgleldetailscaw',compact('lelongid','cawname'));
|
|
}
|
|
|
|
public function laporanbrgleldetailscaw($lelong_id){
|
|
|
|
$user = Auth::user();
|
|
$caw = Cawangan::where('caw_code','=',$user->kodcaw)
|
|
->first();
|
|
|
|
$lelongs= LelongBid::where('lelong_id','=',$lelong_id)
|
|
->where('kodcaw','=',$user['kodcaw'])
|
|
->get()->toArray();
|
|
|
|
$arraycaw= [];
|
|
|
|
$total_berat = 0;
|
|
$berat = 0;
|
|
|
|
$total_harga = 0;
|
|
$harga = 0;
|
|
|
|
$total_nmarhun = 0;
|
|
$nilai_marhun = 0;
|
|
|
|
$total_hargaasas = 0;
|
|
$hargaasas = 0;
|
|
|
|
$arrayinfo = [];
|
|
|
|
|
|
$lelongid = Lelong::join('cawangan_lelong','lelong.id','=','cawangan_lelong.lelong_id')
|
|
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('cawangan_lelong.lelong_id','=',$lelong_id)
|
|
->where('cawangan.caw_code',$user->kodcaw)
|
|
->select('lelong_id','tarikh_lelong','lelong.fasa')
|
|
->groupBy('lelong_id')
|
|
->get()->toArray();
|
|
|
|
foreach($lelongid as $laporan)
|
|
{
|
|
$details = CawanganLelong::join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('lelong_id',$laporan['lelong_id'])
|
|
->where('cawangan.caw_code','=',$user['kodcaw'])
|
|
->get()
|
|
->toArray();
|
|
array_push($arrayinfo,['laporan' => $laporan,'details' => $details]);
|
|
}
|
|
|
|
foreach($lelongs as $index1=>$lelong){
|
|
|
|
$marhun= LelongBidMarhun::where('lelongbid_id','=',$lelong['id'])
|
|
// ->where('kodcaw','=',$user['kodcaw'])
|
|
->get();
|
|
|
|
$total_berat = $total_berat + ($marhun->sum('berat'));
|
|
$total_harga = $total_harga + ($marhun->sum('harga'));
|
|
$total_nmarhun = $total_nmarhun + ($marhun->sum('n_marhun'));
|
|
$total_hargaasas = $total_hargaasas + ($marhun->sum('hargaasas'));
|
|
|
|
$lelongs[$index1]['detailmarhun']=$marhun;
|
|
|
|
}
|
|
|
|
array_push($arraycaw,[
|
|
'berat'=>$berat,
|
|
'harga'=>$harga,
|
|
'n_marhun'=>$nilai_marhun,
|
|
'hargaasas'=>$hargaasas
|
|
|
|
]);
|
|
|
|
$pdf = PDF::loadView('pdf.laporanbrgleldetailscaw',compact('lelongs','arraycaw','total_nmarhun','total_berat','total_harga','total_hargaasas','arrayinfo'
|
|
))->setPaper('a4', 'potrait');
|
|
|
|
return $pdf->download('Senarai Lelong Details.pdf');
|
|
|
|
|
|
}
|
|
|
|
|
|
public function indexnamapembidacaw(){
|
|
$user = Auth::user();
|
|
|
|
$lelongid = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
|
|
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('cawangan.caw_code','=',$user->kodcaw)
|
|
->get();
|
|
|
|
$cawname = Cawangan::where('caw_code','=',$user->kodcaw)
|
|
->get();
|
|
|
|
return view('lelong.indexnamapembidacaw',compact('lelongid','cawname'));
|
|
|
|
|
|
}
|
|
|
|
public function laporannamapembidacaw($lelong_id){
|
|
|
|
$user = Auth::user();
|
|
$caw = Cawangan::where('caw_code','=',$user->kodcaw)
|
|
->first();
|
|
|
|
|
|
$arraydetails = [];
|
|
$arrayinfocaw = [];
|
|
|
|
$lelongid = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
|
|
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('cawangan_lelong.lelong_id','=',$lelong_id)
|
|
->where('cawangan.caw_code','=',$user['kodcaw'])
|
|
->select('lelong_id','tarikh_lelong','lelong.fasa')
|
|
->groupBy('lelong_id')
|
|
->get();
|
|
|
|
foreach($lelongid as $laporancaw)
|
|
{
|
|
$cawangan = CawanganLelong::join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('lelong_id',$laporancaw['lelong_id'])
|
|
->where('cawangan.caw_code','=',$user['kodcaw'])
|
|
->get()
|
|
->toArray();
|
|
array_push($arrayinfocaw,['laporancaw' => $laporancaw,'cawangan' => $cawangan]);
|
|
}
|
|
|
|
|
|
$laporanpembida= LelongBid::join('lelongbidder','lelongbid.id','=','lelongbidder.lelongbid_id')
|
|
->select('lelongbid_id','norujukan','hargaasas')
|
|
->where('lelongbid.lelong_id','=',$lelong_id)
|
|
->where('lelongbid.kodcaw','=',$user['kodcaw'])
|
|
->groupBy('lelongbid_id')
|
|
->get()
|
|
->toArray();
|
|
|
|
|
|
foreach($laporanpembida as $laporan)
|
|
{
|
|
$details = LelongBidder::where('lelongbid_id',$laporan['lelongbid_id'])
|
|
->orderBy('hargabida','desc')
|
|
->orderBy('masa_bidaan','asc')
|
|
->get()
|
|
->toArray();
|
|
array_push($arraydetails,['laporan' => $laporan,'details' => $details]);
|
|
}
|
|
|
|
$pdf = PDF::loadView('pdf.laporannamapembidacaw', compact('lelongid','arraydetails','lelong_id','lelongid','cawangan','arrayinfocaw'))
|
|
->setPaper('a4', 'potrait');
|
|
|
|
return $pdf->download('Senarai Nama Bidaan Pembida.pdf');
|
|
|
|
|
|
|
|
}
|
|
|
|
public function indexlelfullcaw (){
|
|
|
|
$user = Auth::user();
|
|
|
|
$lelongid = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
|
|
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('cawangan.caw_code','=',$user->kodcaw)
|
|
->get();
|
|
|
|
$cawname = Cawangan::where('caw_code','=',$user->kodcaw)
|
|
->get();
|
|
|
|
return view('lelong.indexlelfullcaw',compact('lelongid','cawname'));
|
|
|
|
}
|
|
|
|
public function laporanlelfullcaw($lelong_id){
|
|
|
|
$user = Auth::user();
|
|
$caw = Cawangan::where('caw_code','=',$user->kodcaw)
|
|
->first();
|
|
|
|
$total_nmarhun = 0;
|
|
$total_pembiayaan = 0;
|
|
$total_upahsimpan = 0;
|
|
$total_cajlelong = 0;
|
|
$total_hargalelong = 0;
|
|
$total_bakirugi = 0;
|
|
$total_hargaasas = 0;
|
|
$arrayinfocaw = [];
|
|
|
|
$info = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
|
|
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('cawangan.caw_code','=',$user['kodcaw'])
|
|
->where('cawangan_lelong.lelong_id','=',$lelong_id)
|
|
->select('lelong_id','tarikh_lelong','lelong.fasa')
|
|
->groupBy('lelong_id')
|
|
->get();
|
|
|
|
foreach($info as $laporancaw)
|
|
{
|
|
$cawangan = CawanganLelong::join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('lelong_id',$laporancaw['lelong_id'])
|
|
->where('cawangan.caw_code','=',$user['kodcaw'])
|
|
->get()
|
|
->toArray();
|
|
array_push($arrayinfocaw,['laporancaw' => $laporancaw,'cawangan' => $cawangan]);
|
|
}
|
|
|
|
$laporanlelong= LelongBid::join('lelongbidder','lelongbid.id','=','lelongbidder.lelongbid_id')
|
|
->where('lelongbid.lelong_id','=',$lelong_id)
|
|
->where('lelongbid.kodcaw','=',$user['kodcaw'])
|
|
->where('lelongbidder.status_bidder','=','1')
|
|
->select('lelongbid.norujukan','lelongbid.nilaimarhun','lelongbid.pinjaman','lelongbid.bakiupah',
|
|
'lelongbid.cajlelong','lelongbidder.hargabida','lelongbid.baki','lelongbid.hargaasas','lelongbidder.nama_bidder')
|
|
->get()->toArray();
|
|
|
|
foreach($laporanlelong as $index1=>$laplelong)
|
|
{
|
|
$margin = ($laplelong['pinjaman']/ $laplelong['nilaimarhun'])*100;
|
|
|
|
$total_nmarhun = $total_nmarhun + $laplelong['nilaimarhun'];
|
|
$total_pembiayaan = $total_pembiayaan + $laplelong['pinjaman'];
|
|
$total_upahsimpan = $total_upahsimpan + $laplelong['bakiupah'];
|
|
$total_cajlelong = $total_cajlelong + $laplelong['cajlelong'];
|
|
$total_hargalelong = $total_hargalelong + $laplelong['hargabida'];
|
|
$total_bakirugi = $total_bakirugi + $laplelong['baki'];
|
|
$total_hargaasas = $total_hargaasas + $laplelong['hargaasas'];
|
|
|
|
$laporanlelong[$index1]['margin']=$margin;
|
|
|
|
}
|
|
|
|
|
|
$pdf = PDF::loadView('pdf.laporanlelfullcaw',compact('info','lelong_id','laporanlelong','lelong_id','total_nmarhun','total_pembiayaan',
|
|
'total_upahsimpan','total_cajlelong','total_hargalelong','total_bakirugi','total_hargaasas','arrayinfocaw'))
|
|
|
|
->setPaper('a4', 'landscape');
|
|
return $pdf->download('Laporan Lelong Keseluruhan.pdf');
|
|
|
|
|
|
}
|
|
|
|
public function indexbrglelpembidacaw(){
|
|
|
|
$user = Auth::user();
|
|
|
|
$lelongid = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
|
|
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('cawangan.caw_code','=',$user->kodcaw)
|
|
->get();
|
|
|
|
$cawname = Cawangan::where('caw_code','=',$user->kodcaw)
|
|
->get();
|
|
|
|
return view('lelong.indexbrglelpembidacaw',compact('lelongid','cawname'));
|
|
|
|
}
|
|
|
|
public function laporanbrglelpembidacaw($lelong_id){
|
|
|
|
$user = Auth::user();
|
|
$caw = Cawangan::where('caw_code','=',$user->kodcaw)
|
|
->first();
|
|
|
|
$total_berat = 0;
|
|
$total_hargaasas = 0;
|
|
$total_hargalelong = 0;
|
|
$arrayinfocaw = [];
|
|
|
|
|
|
$info = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
|
|
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('cawangan_lelong.lelong_id','=',$lelong_id)
|
|
->where('cawangan.caw_code','=',$user['kodcaw'])
|
|
->select('lelong_id','tarikh_lelong','lelong.fasa')
|
|
->groupBy('lelong_id')
|
|
->get();
|
|
// dd($info);
|
|
|
|
foreach($info as $laporancaw)
|
|
{
|
|
$cawangan = CawanganLelong::join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('lelong_id',$laporancaw['lelong_id'])
|
|
->where('cawangan.caw_code','=',$user['kodcaw'])
|
|
->get()
|
|
->toArray();
|
|
array_push($arrayinfocaw,['laporancaw' => $laporancaw,'cawangan' => $cawangan]);
|
|
}
|
|
|
|
$brglelpembida = LelongBid::join('lelongbidder','lelongbid.id','=','lelongbidder.lelongbid_id')
|
|
->where('lelongbid.kodcaw','=',$user['kodcaw'])
|
|
->where('lelongbid.lelong_id','=',$lelong_id)
|
|
->where('lelongbidder.status_bidder','=','1')
|
|
->get()->toArray();
|
|
|
|
foreach( $brglelpembida as $index1=>$totalbrglelpembida){
|
|
|
|
$total_berat = $total_berat + $totalbrglelpembida['berat'];
|
|
$total_hargaasas = $total_hargaasas + $totalbrglelpembida['hargaasas'];
|
|
$total_hargalelong = $total_hargalelong + $totalbrglelpembida['hargabida'];
|
|
|
|
|
|
}
|
|
|
|
|
|
$pdf = PDF::loadView('pdf.laporanbrglelpembidacaw',compact('lelong_id','info','brglelpembida','total_berat','total_hargaasas','total_hargalelong','arrayinfocaw'))
|
|
->setPaper('a4','potrait');
|
|
|
|
return $pdf->download('Laporan Barang Lelong Pembida.pdf');
|
|
}
|
|
|
|
|
|
public function sandarankpkt(request $request)
|
|
{
|
|
$user = Auth::user();
|
|
|
|
$lelongid = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
|
|
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('cawangan.caw_code','=',$user->kodcaw)
|
|
->get();
|
|
|
|
$cawname = Cawangan::where('caw_code','=',$user->kodcaw)
|
|
->get();
|
|
|
|
|
|
return view('lelongkhas.sandarankpkt',compact('lelongid','cawname'));
|
|
}
|
|
|
|
public function sandaranpembida(request $request)
|
|
{
|
|
$user = Auth::user();
|
|
|
|
$lelongid = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
|
|
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('cawangan.caw_code','=',$user->kodcaw)
|
|
->get();
|
|
|
|
$cawname = Cawangan::where('caw_code','=',$user->kodcaw)
|
|
->get();
|
|
|
|
|
|
return view('lelongkhas.sandaranpembida',compact('lelongid','cawname'));
|
|
}
|
|
public function cetaksandarankpkt(request $request)
|
|
{
|
|
$lelong_id = $request->lelong_id;
|
|
// dd($lelong_id);
|
|
$user = Auth::user();
|
|
$caw = Cawangan::where('caw_code','=',$user->kodcaw)
|
|
->first();
|
|
|
|
$brglelongcaw = LelongBid::where('lelongbid.lelong_id', $lelong_id)
|
|
->where('lelongbid.kodcaw','=',$user['kodcaw'])
|
|
->get()->toArray();
|
|
// dd($brglelongcaw);
|
|
|
|
$keuntungan=0;
|
|
$total_hargaasas = 0;
|
|
$total_berat = 0;
|
|
$total_pinjaman = 0;
|
|
$total_pinj10 = 0;
|
|
$total_sumpinj10 = 0;
|
|
|
|
foreach($brglelongcaw as $index1=>$upah)
|
|
{
|
|
$pinj10 = $upah['pinjaman'] * 0.10;
|
|
$sumpinj10 = $upah['pinjaman'] + ($upah['pinjaman'] * 0.10);
|
|
$total_pinj10 = $total_pinj10 + $pinj10;
|
|
$total_sumpinj10 = $total_sumpinj10 + $sumpinj10;
|
|
$total_pinjaman = $total_pinjaman + $upah['pinjaman'];
|
|
$total_hargaasas = $total_hargaasas + $upah['hargaasas'];
|
|
$total_berat = $total_berat + $upah['berat'];
|
|
|
|
$upah[$index1]['pinj10']=$pinj10;
|
|
}
|
|
|
|
$info = Lelong::join('cawangan_lelong','lelong.id','=','cawangan_lelong.lelong_id')
|
|
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('cawangan_lelong.lelong_id','=',$lelong_id)
|
|
->where('cawangan.caw_code','=',$user['kodcaw'])
|
|
->select('lelong_id','tarikh_lelong','caw_name','lelong.fasa')
|
|
->groupBy('lelong_id','caw_name')
|
|
->get()->toArray();
|
|
|
|
// return view('pdfkhas.cetaksandarankpkt',compact('brglelongcaw','lelong_id','keuntungan','total_hargaasas','total_berat','info','upah','pinj10','total_pinjaman','total_pinj10','total_sumpinj10'));
|
|
$pdf = PDF::loadView('pdfkhas.cetaksandarankpkt',compact('brglelongcaw','lelong_id','keuntungan','total_hargaasas','total_berat','info','upah','pinj10','total_pinjaman','total_pinj10','total_sumpinj10'))
|
|
->setPaper('a4', 'potrait');
|
|
|
|
return $pdf->download('Senarai Sandaran KPKT.pdf');
|
|
|
|
|
|
}
|
|
|
|
public function cetaksandaranpembida(request $request)
|
|
{
|
|
$lelong_id = $request->lelong_id;
|
|
// dd($lelong_id);
|
|
$user = Auth::user();
|
|
$caw = Cawangan::where('caw_code','=',$user->kodcaw)
|
|
->first();
|
|
|
|
$brglelongcaw = LelongBid::where('lelongbid.lelong_id', $lelong_id)
|
|
->where('lelongbid.kodcaw','=',$user['kodcaw'])
|
|
->get()->toArray();
|
|
// dd($brglelongcaw);
|
|
|
|
$keuntungan=0;
|
|
$total_hargaasas = 0;
|
|
$total_berat = 0;
|
|
$total_pinjaman = 0;
|
|
$total_pinj10 = 0;
|
|
$total_sumpinj10 = 0;
|
|
|
|
foreach($brglelongcaw as $index1=>$upah)
|
|
{
|
|
$pinj10 = $upah['pinjaman'] * 0.10;
|
|
$sumpinj10 = $upah['pinjaman'] + ($upah['pinjaman'] * 0.10);
|
|
$total_pinj10 = $total_pinj10 + $pinj10;
|
|
$total_sumpinj10 = $total_sumpinj10 + $sumpinj10;
|
|
$total_pinjaman = $total_pinjaman + $upah['pinjaman'];
|
|
$total_hargaasas = $total_hargaasas + $upah['hargaasas'];
|
|
$total_berat = $total_berat + $upah['berat'];
|
|
|
|
$upah[$index1]['pinj10']=$pinj10;
|
|
}
|
|
|
|
$info = Lelong::join('cawangan_lelong','lelong.id','=','cawangan_lelong.lelong_id')
|
|
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('cawangan_lelong.lelong_id','=',$lelong_id)
|
|
->where('cawangan.caw_code','=',$user['kodcaw'])
|
|
->select('lelong_id','tarikh_lelong','caw_name','lelong.fasa')
|
|
->groupBy('lelong_id','caw_name')
|
|
->get()->toArray();
|
|
|
|
// return view('pdfkhas.cetaksandarankpkt',compact('brglelongcaw','lelong_id','keuntungan','total_hargaasas','total_berat','info','upah','pinj10','total_pinjaman','total_pinj10','total_sumpinj10'));
|
|
$pdf = PDF::loadView('pdfkhas.cetaksandaranpembida',compact('brglelongcaw','lelong_id','keuntungan','total_hargaasas','total_berat','info','upah','pinj10','total_pinjaman','total_pinj10','total_sumpinj10'))
|
|
->setPaper('a4', 'potrait');
|
|
|
|
return $pdf->download('Senarai Sandaran Pembida.pdf');
|
|
|
|
|
|
}
|
|
public function jadualN(request $request)
|
|
{
|
|
$user = Auth::user();
|
|
|
|
$lelongid = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
|
|
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('cawangan.caw_code','=',$user->kodcaw)
|
|
->get();
|
|
|
|
$cawname = Cawangan::where('caw_code','=',$user->kodcaw)
|
|
->get();
|
|
|
|
|
|
return view('lelongkhas.jadualN',compact('lelongid','cawname'));
|
|
}
|
|
public function cetakjadualN(request $request)
|
|
{
|
|
$totalbakipjm = 0;
|
|
$totalbakiupah = 0;
|
|
$total_pinjaman = 0;
|
|
$total_hargaasas = 0;
|
|
$totalcajlelong = 0;
|
|
$totalhargajual = 0;
|
|
$totalbaki = 0;
|
|
$lelong_id = $request->lelong_id;
|
|
// dd($lelong_id);
|
|
$user = Auth::user();
|
|
$caw = Cawangan::where('caw_code','=',$user->kodcaw)
|
|
->first();
|
|
|
|
$marhuns = LelongBid::where('lelongbid.lelong_id', $lelong_id)
|
|
->where('lelongbid.kodcaw','=',$user['kodcaw'])
|
|
->where('lelongbid.status_payment','=',1)
|
|
->get()->toArray();
|
|
|
|
foreach ($marhuns as $index1=> $cal) {
|
|
$gadai = Gadai::on($user->kodcaw)
|
|
->where('norujukan','=',$cal['norujukan'])
|
|
->first();
|
|
|
|
$customer = Customer::where('kpbaru','=',$gadai['nokp'])
|
|
->orWhere('kplama','=',$gadai['nokp'])
|
|
->first();
|
|
// dd($customer);
|
|
|
|
$listsag = Gadai::on($user->kodcaw)->where('norujukan', $cal['norujukan'])
|
|
->where('nokp','=',$gadai['nokp'])
|
|
->first();
|
|
// dd($listsag);
|
|
|
|
$marhuns[$index1]['nama'] = $customer;
|
|
$marhuns[$index1]['list'] = $listsag;
|
|
|
|
$totalbakipjm = $totalbakipjm + $cal['pinjaman'];
|
|
$totalbakiupah = $totalbakiupah + $cal['bakiupah'];
|
|
$total_pinjaman = $total_pinjaman + $cal['pinjaman'];
|
|
$total_hargaasas = $total_hargaasas + $cal['hargaasas'];
|
|
$totalcajlelong = $totalcajlelong + $cal['cajlelong'];
|
|
$totalhargajual = $totalhargajual + $cal['hargajual'];
|
|
$totalbaki = $totalbaki + $cal['baki'];
|
|
}
|
|
|
|
$info = Lelong::join('cawangan_lelong','lelong.id','=','cawangan_lelong.lelong_id')
|
|
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('cawangan_lelong.lelong_id','=',$lelong_id)
|
|
->where('cawangan.caw_code','=',$user['kodcaw'])
|
|
->select('lelong_id','tarikh_lelong','caw_name','lelong.fasa')
|
|
->groupBy('lelong_id','caw_name')
|
|
->get()->toArray();
|
|
|
|
// return view('pdfkhas.cetakjadualN',compact('marhuns','lelong_id','info','totalbakipjm','total_pinjaman','total_hargaasas','totalbakiupah','totalcajlelong','totalhargajual','totalbaki'));
|
|
$pdf = PDF::loadView('pdfkhas.cetakjadualN',compact('marhuns','lelong_id','info','totalbakipjm','total_pinjaman','total_hargaasas','totalbakiupah','totalcajlelong','totalhargajual','totalbaki'))
|
|
->setPaper('a4', 'landscape');
|
|
|
|
return $pdf->download('Jadual N.pdf');
|
|
|
|
|
|
}
|
|
public function jadualO(request $request)
|
|
{
|
|
$user = Auth::user();
|
|
|
|
$lelongid = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
|
|
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('cawangan.caw_code','=',$user->kodcaw)
|
|
->get();
|
|
|
|
$cawname = Cawangan::where('caw_code','=',$user->kodcaw)
|
|
->get();
|
|
|
|
|
|
return view('lelongkhas.jadualO',compact('lelongid','cawname'));
|
|
}
|
|
public function cetakjadualO(request $request)
|
|
{
|
|
$totalbakipjm = 0;
|
|
$totalbakiupah = 0;
|
|
$total_pinjaman = 0;
|
|
$total_hargaasas = 0;
|
|
$totalcajlelong = 0;
|
|
$totalhargajual = 0;
|
|
$totalbaki = 0;
|
|
$lelong_id = $request->lelong_id;
|
|
// dd($lelong_id);
|
|
$user = Auth::user();
|
|
$caw = Cawangan::where('caw_code','=',$user->kodcaw)
|
|
->first();
|
|
|
|
$marhuns = LelongBid::where('lelongbid.lelong_id', $lelong_id)
|
|
->where('lelongbid.kodcaw','=',$user['kodcaw'])
|
|
->where('lelongbid.status_payment','=',1)
|
|
->where('lelongbid.baki','>','0.00')
|
|
->get()->toArray();
|
|
|
|
foreach ($marhuns as $index1=> $cal) {
|
|
$gadai = Gadai::on($user->kodcaw)
|
|
->where('norujukan','=',$cal['norujukan'])
|
|
->first();
|
|
|
|
$customer = Customer::where('kpbaru','=',$gadai['nokp'])
|
|
->orWhere('kplama','=',$gadai['nokp'])
|
|
->first();
|
|
// dd($customer);
|
|
|
|
$listsag = Gadai::on($user->kodcaw)->where('norujukan', $cal['norujukan'])
|
|
->where('nokp','=',$gadai['nokp'])
|
|
->first();
|
|
// dd($listsag);
|
|
|
|
$marhuns[$index1]['nama'] = $customer;
|
|
$marhuns[$index1]['list'] = $listsag;
|
|
|
|
$totalbakipjm = $totalbakipjm + $cal['pinjaman'];
|
|
$totalbakiupah = $totalbakiupah + $cal['bakiupah'];
|
|
$total_pinjaman = $total_pinjaman + $cal['pinjaman'];
|
|
$total_hargaasas = $total_hargaasas + $cal['hargaasas'];
|
|
$totalcajlelong = $totalcajlelong + $cal['cajlelong'];
|
|
$totalhargajual = $totalhargajual + $cal['hargajual'];
|
|
$totalbaki = $totalbaki + $cal['baki'];
|
|
}
|
|
|
|
$info = Lelong::join('cawangan_lelong','lelong.id','=','cawangan_lelong.lelong_id')
|
|
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('cawangan_lelong.lelong_id','=',$lelong_id)
|
|
->where('cawangan.caw_code','=',$user['kodcaw'])
|
|
->select('lelong_id','tarikh_lelong','caw_name','lelong.fasa')
|
|
->groupBy('lelong_id','caw_name')
|
|
->get()->toArray();
|
|
|
|
// return view('pdfkhas.cetakjadualO',compact('marhuns','lelong_id','info','totalbakipjm','total_pinjaman','total_hargaasas','totalbakiupah','totalcajlelong','totalhargajual','totalbaki'));
|
|
$pdf = PDF::loadView('pdfkhas.cetakjadualO',compact('marhuns','lelong_id','info','totalbakipjm','total_pinjaman','total_hargaasas','totalbakiupah','totalcajlelong','totalhargajual','totalbaki'))
|
|
->setPaper('a4', 'landscape');
|
|
|
|
return $pdf->download('Jadual O.pdf');
|
|
|
|
|
|
}
|
|
|
|
public function laporanlelong(request $request)
|
|
{
|
|
$user = Auth::user();
|
|
|
|
$lelongid = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
|
|
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('cawangan.caw_code','=',$user->kodcaw)
|
|
->get();
|
|
|
|
$cawname = Cawangan::where('caw_code','=',$user->kodcaw)
|
|
->get();
|
|
|
|
return view('lelongkhas.laporanlelong',compact('lelongid','cawname'));
|
|
}
|
|
|
|
public function cetaklaporanlelong(request $request)
|
|
{
|
|
$totalbakipjm = 0;
|
|
$totalbakiupah = 0;
|
|
$totalpinjaman = 0;
|
|
$totalhargaasas = 0;
|
|
$totalcajlelong = 0;
|
|
$totalhargajual = 0;
|
|
$totalbaki = 0;
|
|
$totalnilaimarhun = 0;
|
|
$totalbakilelong = 0;
|
|
$totalrugilelong = 0;
|
|
$lelong_id = $request->lelong_id;
|
|
// dd($lelong_id);
|
|
$user = Auth::user();
|
|
$caw = Cawangan::where('caw_code','=',$user->kodcaw)
|
|
->first();
|
|
|
|
$marhuns = LelongBid::where('lelongbid.lelong_id', $lelong_id)
|
|
->where('lelongbid.kodcaw','=',$user['kodcaw'])
|
|
->where('lelongbid.status_payment','=',1)
|
|
->get()->toArray();
|
|
|
|
foreach ($marhuns as $index1=> $cal) {
|
|
$gadai = Gadai::on($user->kodcaw)
|
|
->where('norujukan','=',$cal['norujukan'])
|
|
->first();
|
|
|
|
$customer = Customer::where('kpbaru','=',$gadai['nokp'])
|
|
->orWhere('kplama','=',$gadai['nokp'])
|
|
->first();
|
|
// dd($customer);
|
|
|
|
$listsag = Gadai::on($user->kodcaw)->where('norujukan', $cal['norujukan'])
|
|
->where('nokp','=',$gadai['nokp'])
|
|
->first();
|
|
// dd($listsag);
|
|
|
|
$namapembeli = User::where('id','=',$cal['nopembeli'])
|
|
->first();
|
|
|
|
$bakilelong = LelongBid::where('lelongbid.lelong_id', $lelong_id)
|
|
// ->where('norujukan', $cal['norujukan'])
|
|
->where('lelongbid.kodcaw','=',$user['kodcaw'])
|
|
->where('lelongbid.status_payment','=',1)
|
|
->where('lelongbid.baki','>','0.00')
|
|
->sum('baki');
|
|
|
|
$rugilelong = LelongBid::where('lelongbid.lelong_id', $lelong_id)
|
|
// ->where('norujukan', $cal['norujukan'])
|
|
->where('lelongbid.kodcaw','=',$user['kodcaw'])
|
|
->where('lelongbid.status_payment','=',1)
|
|
->where('lelongbid.baki','<','0.00')
|
|
->sum('baki');
|
|
|
|
$marhuns[$index1]['nama'] = $customer;
|
|
$marhuns[$index1]['list'] = $listsag;
|
|
$marhuns[$index1]['namapembeli'] = $namapembeli;
|
|
$marhuns[$index1]['bakilelong'] = $bakilelong;
|
|
$marhuns[$index1]['rugilelong'] = $rugilelong;
|
|
|
|
$totalbakipjm = $totalbakipjm + $cal['pinjaman'];
|
|
$totalbakiupah = $totalbakiupah + $cal['bakiupah'];
|
|
$totalpinjaman = $totalpinjaman + $cal['pinjaman'];
|
|
$totalhargaasas = $totalhargaasas + $cal['hargaasas'];
|
|
$totalcajlelong = $totalcajlelong + $cal['cajlelong'];
|
|
$totalhargajual = $totalhargajual + $cal['hargajual'];
|
|
$totalbaki = $totalbaki + $cal['baki'];
|
|
$totalnilaimarhun = $totalnilaimarhun + $cal['nilaimarhun'];
|
|
$totalbakilelong = $bakilelong;
|
|
$totalrugilelong = $rugilelong;
|
|
// dd($bakilelong->baki);
|
|
}
|
|
|
|
$info = Lelong::join('cawangan_lelong','lelong.id','=','cawangan_lelong.lelong_id')
|
|
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('cawangan_lelong.lelong_id','=',$lelong_id)
|
|
->where('cawangan.caw_code','=',$user->kodcaw)
|
|
->select('lelong_id','tarikh_lelong','caw_name','lelong.fasa')
|
|
->groupBy('lelong_id','caw_name')
|
|
->get()->toArray();
|
|
// dd($info);
|
|
|
|
|
|
// dd($bakilelong);
|
|
|
|
// return view('pdfkhas.cetaklaporanlelong',compact('marhuns','lelong_id','info','totalbakipjm','totalpinjaman','totalhargaasas','totalbakiupah','totalcajlelong','totalhargajual','totalbaki','totalnilaimarhun','totalbakilelong','totalrugilelong'));
|
|
$pdf = PDF::loadView('pdfkhas.cetaklaporanlelong',compact('marhuns','lelong_id','info','totalbakipjm','totalpinjaman','totalhargaasas','totalbakiupah','totalcajlelong','totalhargajual','totalbaki','totalnilaimarhun','totalbakilelong','totalrugilelong'))
|
|
->setPaper('a4', 'landscape');
|
|
|
|
return $pdf->download('Laporan Lelongan.pdf');
|
|
|
|
|
|
}
|
|
public function laporantuntutbaki(request $request)
|
|
{
|
|
$user = Auth::user();
|
|
|
|
$lelongid = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id')
|
|
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('cawangan.caw_code','=',$user->kodcaw)
|
|
->get();
|
|
|
|
$cawname = Cawangan::where('caw_code','=',$user->kodcaw)
|
|
->get();
|
|
|
|
return view('lelongkhas.laporantuntutbaki',compact('lelongid','cawname'));
|
|
}
|
|
|
|
public function cetaklaporantuntutbaki(request $request)
|
|
{
|
|
$totalbakipjm = 0;
|
|
$totalbakiupah = 0;
|
|
$total_pinjaman = 0;
|
|
$total_hargaasas = 0;
|
|
$totalcajlelong = 0;
|
|
$totalhargajual = 0;
|
|
$totalbaki = 0;
|
|
$lelong_id = $request->lelong_id;
|
|
// dd($lelong_id);
|
|
$user = Auth::user();
|
|
$caw = Cawangan::where('caw_code','=',$user->kodcaw)
|
|
->first();
|
|
|
|
$marhuns = LelongBid::where('lelongbid.lelong_id', $lelong_id)
|
|
->where('lelongbid.kodcaw','=',$user['kodcaw'])
|
|
->where('lelongbid.status_payment','=',1)
|
|
->where('lelongbid.baki','>','0.00')
|
|
->get()->toArray();
|
|
|
|
foreach ($marhuns as $index1=> $cal) {
|
|
$gadai = Gadai::on($user->kodcaw)
|
|
->where('norujukan','=',$cal['norujukan'])
|
|
->first();
|
|
|
|
$customer = Customer::where('kpbaru','=',$gadai['nokp'])
|
|
->orWhere('kplama','=',$gadai['nokp'])
|
|
->first();
|
|
// dd($customer);
|
|
|
|
$listsag = Gadai::on($user->kodcaw)->where('norujukan', $cal['norujukan'])
|
|
->where('nokp','=',$gadai['nokp'])
|
|
->first();
|
|
// dd($listsag);
|
|
|
|
$marhuns[$index1]['nama'] = $customer;
|
|
$marhuns[$index1]['list'] = $listsag;
|
|
|
|
$totalbakipjm = $totalbakipjm + $cal['pinjaman'];
|
|
$totalbakiupah = $totalbakiupah + $cal['bakiupah'];
|
|
$total_pinjaman = $total_pinjaman + $cal['pinjaman'];
|
|
$total_hargaasas = $total_hargaasas + $cal['hargaasas'];
|
|
$totalcajlelong = $totalcajlelong + $cal['cajlelong'];
|
|
$totalhargajual = $totalhargajual + $cal['hargajual'];
|
|
$totalbaki = $totalbaki + $cal['baki'];
|
|
}
|
|
|
|
$info = Lelong::join('cawangan_lelong','lelong.id','=','cawangan_lelong.lelong_id')
|
|
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('cawangan_lelong.lelong_id','=',$lelong_id)
|
|
->where('cawangan.caw_code','=',$user['kodcaw'])
|
|
->select('lelong_id','tarikh_lelong','caw_name','lelong.fasa')
|
|
->groupBy('lelong_id','caw_name')
|
|
->get()->toArray();
|
|
|
|
// return view('pdfkhas.cetaklaporantuntutbaki',compact('marhuns','lelong_id','info','totalbakipjm','total_pinjaman','total_hargaasas','totalbakiupah','totalcajlelong','totalhargajual','totalbaki'));
|
|
$pdf = PDF::loadView('pdfkhas.cetaklaporantuntutbaki',compact('marhuns','lelong_id','info','totalbakipjm','total_pinjaman','total_hargaasas','totalbakiupah','totalcajlelong','totalhargajual','totalbaki'))
|
|
->setPaper('a4', 'landscape');
|
|
|
|
return $pdf->download('Laporan Tuntut/Belum Baki Lelong.pdf');
|
|
|
|
}
|
|
|
|
public function indexubahmarhun (){
|
|
|
|
$arraydetails = [];
|
|
|
|
$user = Auth::user();
|
|
$caw = Cawangan::where('caw_code','=',$user->kodcaw)
|
|
->first();
|
|
// dd($caw);
|
|
|
|
$laporan= Lelong::join('cawangan_lelong','lelong.id','=','cawangan_lelong.lelong_id')
|
|
->join('pengesahan','lelong.id','=','pengesahan.lelong_id')
|
|
->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('cawangan.caw_code','=',$user['kodcaw'])
|
|
->select('cawangan_lelong.lelong_id','tarikh_lelong','lelong.fasa')
|
|
->distinct()
|
|
->orderBy('cawangan_lelong.lelong_id')
|
|
->get()
|
|
->toArray();
|
|
// dd($laporan);
|
|
|
|
|
|
foreach($laporan as $brg)
|
|
{
|
|
$details = CawanganLelong::join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
|
->where('lelong_id', $brg['lelong_id'])
|
|
->where('cawangan.caw_code','=',$user['kodcaw'])
|
|
->distinct()
|
|
->orderBy('lelong_id')
|
|
->get()
|
|
->toArray();
|
|
array_push($arraydetails,['brg' => $brg, 'detailsbrg' => $details ]);
|
|
}
|
|
|
|
|
|
return view('marhun.ubahmarhuncaw', compact('arraydetails'));
|
|
|
|
}
|
|
|
|
Public function marhunpermatabycaw (){
|
|
$user = Auth::user();
|
|
$cawangan_all = Cawangan::where('caw_code','=',$user->kodcaw)
|
|
->get();
|
|
// dd($cawangan_all);
|
|
foreach($cawangan_all as $index3=>$cawangan){
|
|
$cawangan_all_groupby_caw = $cawangan->groupBy('caw_code');
|
|
|
|
$cawangan_all[$index3]["cawangan_info"] = $cawangan;
|
|
}
|
|
return view('laporan.marhunpermatabycaw',compact('cawangan_all'));
|
|
}
|
|
|
|
Public function marhunpermatabycawdetail($cawid){
|
|
$senarai = [];
|
|
$cawangan = Cawangan::where('id','=',$cawid)->first();
|
|
$cawanganDetail = $cawangan->caw_name;
|
|
$kodcaw = $cawangan->caw_code;
|
|
$cawid = $cawangan->id;
|
|
$datalelong = Http::get(config('app.api_url'). 'get/listbatchlelong/'. $kodcaw ,[
|
|
'kodcaw' => $kodcaw,
|
|
])->json();
|
|
$data = [
|
|
'kodcaw'=>$kodcaw,
|
|
'caw_name'=>$cawangan->caw_name,
|
|
'lelong' => $datalelong ? $datalelong : '',
|
|
];
|
|
array_push($senarai,$data);
|
|
// dd($bycaw_all);
|
|
return view('laporan.marhunpermatabycawangan',compact('senarai','cawanganDetail','cawid'));
|
|
}
|
|
|
|
Public function marhunpermatabycawdetailbatch($kodcaw,$batchno){
|
|
$senarai = [];
|
|
$cawangan = Cawangan::where('caw_code','=',$kodcaw)->first();
|
|
$cawanganDetail = $cawangan->caw_name;
|
|
|
|
// $kodcaw = $cawangan->caw_code;
|
|
$datalelong = Http::get(config('app.api_url'). 'get/listlelongbybatch/'.$kodcaw.'/'.$batchno ,[
|
|
'kodcaw' => $kodcaw,
|
|
'batchno' => $batchno,
|
|
])->json();
|
|
// dd($datalelong);
|
|
$data = [
|
|
'kodcaw'=>$kodcaw,
|
|
'batchno'=>$batchno,
|
|
'caw_name'=>$cawangan->caw_name,
|
|
'lelong' => $datalelong ? $datalelong : '',
|
|
];
|
|
array_push($senarai,$data);
|
|
// dd($senarai);
|
|
return view('laporan.marhunpermatabycawanganbybatch',compact('senarai','cawanganDetail'));
|
|
|
|
|
|
}
|
|
|
|
Public function marhunpermatabycawdetailall($cawid){
|
|
$senarai = [];
|
|
$cawangan = Cawangan::where('id','=',$cawid)->first();
|
|
$cawanganDetail = $cawangan->caw_name;
|
|
$kodcaw = $cawangan->caw_code;
|
|
$cawid = $cawangan->id;
|
|
$datalelong = Http::get(config('app.api_url'). 'get/listbatchlelongall/'. $kodcaw ,[
|
|
'kodcaw' => $kodcaw,
|
|
])->json();
|
|
// dd($datalelong);
|
|
$data = [
|
|
'kodcaw'=>$kodcaw,
|
|
'caw_name'=>$cawangan->caw_name,
|
|
'lelong' => $datalelong ? $datalelong : '',
|
|
];
|
|
array_push($senarai,$data);
|
|
// dd($bycaw_all);
|
|
return view('laporan.marhunpermatabycawanganall',compact('senarai','cawanganDetail','cawid'));
|
|
}
|
|
|
|
Public function marhunpermatabycawdetailallpdf($cawid, request $request){
|
|
$senarai = [];
|
|
$cawangan = Cawangan::where('id','=',$cawid)->first();
|
|
// dd($cawangan);
|
|
$cawanganDetail = $cawangan->caw_name;
|
|
$kodcaw = $cawangan->caw_code;
|
|
$datalelong = Http::get(config('app.api_url'). 'get/listbatchlelongall/'. $kodcaw ,[
|
|
'kodcaw' => $kodcaw,
|
|
])->json();
|
|
$data = [
|
|
'kodcaw'=>$kodcaw,
|
|
'caw_name'=>$cawangan->caw_name,
|
|
'lelong' => $datalelong ? $datalelong : '',
|
|
];
|
|
array_push($senarai,$data);
|
|
if($request->type == 'excel')
|
|
{
|
|
return view('kpi.datakpibycawdetailall_excel',compact('collection_datakpi','kodcaw'));
|
|
}
|
|
elseif($request->type == 'pdf')
|
|
{
|
|
$pdf = PDF::loadView('laporan.keseluruhanmarhunpermata_pdf',compact('senarai','cawanganDetail'))
|
|
->setPaper('a4', 'landscape');
|
|
|
|
return $pdf->download('Marhun Permata Keseluruhan '.$cawanganDetail.'.pdf');
|
|
}
|
|
return view('laporan.marhunpermatabycawanganall',compact('senarai','cawanganDetail'));
|
|
|
|
|
|
}
|
|
|
|
Public function marhunpermatabycawdetailallT($cawid){
|
|
$senarai = [];
|
|
$cawangan = Cawangan::where('id','=',$cawid)->first();
|
|
$cawanganDetail = $cawangan->caw_name;
|
|
$kodcaw = $cawangan->caw_code;
|
|
$cawid = $cawangan->id;
|
|
$datalelong = Http::get(config('app.api_url'). 'get/listbatchlelongallT/'. $kodcaw ,[
|
|
'kodcaw' => $kodcaw,
|
|
])->json();
|
|
$data = [
|
|
'kodcaw'=>$kodcaw,
|
|
'caw_name'=>$cawangan->caw_name,
|
|
'lelong' => $datalelong ? $datalelong : '',
|
|
];
|
|
array_push($senarai,$data);
|
|
// dd($bycaw_all);
|
|
return view('laporan.marhunpermatabycawanganallT',compact('senarai','cawanganDetail','cawid'));
|
|
|
|
|
|
}
|
|
|
|
Public function marhunpermatabycawdetailallpdfT($cawid, request $request){
|
|
$senarai = [];
|
|
$cawangan = Cawangan::where('id','=',$cawid)->first();
|
|
// dd($cawangan);
|
|
$cawanganDetail = $cawangan->caw_name;
|
|
$kodcaw = $cawangan->caw_code;
|
|
$datalelong = Http::get(config('app.api_url'). 'get/listbatchlelongallT/'. $kodcaw ,[
|
|
'kodcaw' => $kodcaw,
|
|
])->json();
|
|
$data = [
|
|
'kodcaw'=>$kodcaw,
|
|
'caw_name'=>$cawangan->caw_name,
|
|
'lelong' => $datalelong ? $datalelong : '',
|
|
];
|
|
array_push($senarai,$data);
|
|
if($request->type == 'excel')
|
|
{
|
|
|
|
return view('kpi.datakpibycawdetailall_excel',compact('collection_datakpi','kodcaw'));
|
|
|
|
}
|
|
elseif($request->type == 'pdf')
|
|
{
|
|
$pdf = PDF::loadView('laporan.keseluruhanmarhunpermata_pdfT',compact('senarai','cawanganDetail'))
|
|
->setPaper('a4', 'landscape');
|
|
|
|
return $pdf->download('Marhun Permata Keseluruhan '.$cawanganDetail.'.pdf');
|
|
}
|
|
// return view('laporan.marhunpermatabycawanganall',compact('senarai','cawanganDetail'));
|
|
|
|
|
|
}
|
|
|
|
Public function marhunpermatabycawdetailT($cawid){
|
|
$senarai = [];
|
|
$cawangan = Cawangan::where('id','=',$cawid)->first();
|
|
$cawanganDetail = $cawangan->caw_name;
|
|
$kodcaw = $cawangan->caw_code;
|
|
$cawid = $cawangan->id;
|
|
$datalelong = Http::get(config('app.api_url'). 'get/listbatchlelongT/'. $kodcaw ,[
|
|
'kodcaw' => $kodcaw,
|
|
])->json();
|
|
$data = [
|
|
'kodcaw'=>$kodcaw,
|
|
'caw_name'=>$cawangan->caw_name,
|
|
'lelong' => $datalelong ? $datalelong : '',
|
|
];
|
|
array_push($senarai,$data);
|
|
// dd($bycaw_all);
|
|
return view('laporan.marhunpermatabycawangan',compact('senarai','cawanganDetail','cawid'));
|
|
}
|
|
|
|
Public function marhunpermatabycawdetailbatchT($kodcaw,$batchno){
|
|
$senarai = [];
|
|
$cawangan = Cawangan::where('caw_code','=',$kodcaw)->first();
|
|
$cawanganDetail = $cawangan->caw_name;
|
|
|
|
// $kodcaw = $cawangan->caw_code;
|
|
$datalelong = Http::get(config('app.api_url'). 'get/listlelongbybatchT/'.$kodcaw.'/'.$batchno ,[
|
|
'kodcaw' => $kodcaw,
|
|
'batchno' => $batchno,
|
|
])->json();
|
|
// dd($datalelong);
|
|
$data = [
|
|
'kodcaw'=>$kodcaw,
|
|
'batchno'=>$batchno,
|
|
'caw_name'=>$cawangan->caw_name,
|
|
'lelong' => $datalelong ? $datalelong : '',
|
|
];
|
|
array_push($senarai,$data);
|
|
// dd($senarai);
|
|
return view('laporan.marhunpermatabycawanganbybatchT',compact('senarai','cawanganDetail'));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|