new update
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
<?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 Carbon\Carbon;
|
||||
|
||||
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();
|
||||
|
||||
return view('lelong.laporancawindex',compact('lelongid'));
|
||||
}
|
||||
|
||||
public function laporanbrglelcaw($lelong_id){
|
||||
|
||||
$user = Auth::user();
|
||||
$caw = Cawangan::where('caw_code','=',$user->kodcaw)
|
||||
->first();
|
||||
|
||||
$brglelongcaw = LelongBid::join('gadai','lelongbid.norujukan','=','gadai.norujukan')
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->where('gadai.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')
|
||||
->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');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user