Add statistics to the pembiayaan report in adminv3
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Carbon\Carbon;
|
||||
|
||||
use Barryvdh\DomPDF\Facade as PDF;
|
||||
@@ -314,7 +315,7 @@ class AkaunController extends Controller
|
||||
|
||||
// return view('akaun.laporan_imbanduga',compact('tarikh_imbangan', 'tarikh_imbangan2','hartasemasa','untungrugifield','tanggungansemasa','totalhartasemasa','totaluntungrugi','totaltanggungansemasa','tarikh_cetak','cawangan_info','cawangan','api_url','cawangan_detail'));
|
||||
}
|
||||
|
||||
////ainizazi
|
||||
public function cetakLaporanGadai(Request $request){
|
||||
$api_url = $request->hostname;
|
||||
$auth_user = Auth::user();
|
||||
@@ -337,10 +338,20 @@ class AkaunController extends Controller
|
||||
}
|
||||
// $gadai = Http::get($request->hostname. '/api/gadai/laporan/'. $request->kodcaw .'/'. $gadai_date)->json();
|
||||
|
||||
$gadai = Http::get($request->hostname. '/api/gadailaporanRangeDate/'. $request->kodcaw,['mula' => $tarikh_mula,'akhir' => $tarikh_akhir])->json();
|
||||
$reportGadai = Http::get($request->hostname. '/api/gadailaporanRangeDate/'. $request->kodcaw,['mula' => $tarikh_mula,'akhir' => $tarikh_akhir])->json();
|
||||
$gadai = $reportGadai['gadai'];
|
||||
// dd($reportsGadai);
|
||||
$statistik =$reportGadai['statistik'];
|
||||
$reportPembiayaan= $statistik['reportPembiayaan'];
|
||||
$reportLoanAmount=$statistik['reportLoanAmount'];
|
||||
$reportMarhunValue=$statistik['reportMarhunValue'];
|
||||
$reportMarhunMargin=$statistik['reportMarhunMargin'];
|
||||
$reportCustomerJob=$statistik['reportCustomerJob'];
|
||||
$reportCustomerRace=$statistik['reportCustomerRace'];
|
||||
|
||||
|
||||
$cawangan=Http::get($request->hostname.'/api/cawangan/detail/'.$request->kodcaw)->json();
|
||||
$cawangan_detail=$cawangan[0];
|
||||
$cawangan_detail=$cawangan[0];
|
||||
|
||||
if(isset($request->jenis))
|
||||
{
|
||||
@@ -349,10 +360,9 @@ class AkaunController extends Controller
|
||||
$pdf = PDF::loadView('akaun.laporan_gadaian', compact('gadai','cawangan_detail','tarikh_cetak','tarikh_mula','tarikh_akhir','api_url'))->setPaper('a4', 'landscape');
|
||||
return $pdf->download('laporan_gadaian_' . $request->kodcaw .'_'. $tarikh_mula .'-'. $tarikh_akhir .'.pdf');
|
||||
}else{
|
||||
return view('akaun.laporan_gadaian', compact('gadai','cawangan_detail','tarikh_cetak','tarikh_mula','tarikh_akhir','api_url'));
|
||||
return view('akaun.laporan_gadaian', compact('gadai','cawangan_detail','tarikh_cetak','tarikh_mula','tarikh_akhir','api_url','reportGadai','gadai','statistik','reportPembiayaan','reportLoanAmount','reportMarhunValue','reportMarhunMargin','reportCustomerJob','reportCustomerRace'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function cetakLaporanPenebusan(Request $request){
|
||||
@@ -416,8 +426,6 @@ class AkaunController extends Controller
|
||||
return view('akaun.laporan_ansuran', compact('tebus','cawangan_detail','tarikh_cetak','tebus_date','api_url'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Exports\GadaianDetailExport;
|
||||
|
||||
class StatistikController extends Controller
|
||||
{
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
$current = Carbon::now();
|
||||
|
||||
$getReportDate = function ($date_string) use ($current) {
|
||||
return $date_string ? $date_string : $current->toDateString();
|
||||
};
|
||||
|
||||
$request->hostname = config('api.url');
|
||||
|
||||
$startDate = $getReportDate($request->startDate);
|
||||
$endDate = $getReportDate($request->endDate);
|
||||
|
||||
|
||||
$gadaian = Http::get($request->hostname . '/api/statistik', [
|
||||
'startDate' => $startDate,
|
||||
'endDate' => $endDate,
|
||||
])->json();
|
||||
dd($gadaian);
|
||||
|
||||
return view('akaun.laporan_gadaian', compact('gadaian', 'startDate', 'endDate'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user