tambah function stok audit excel pdf dan job blast wasap
This commit is contained in:
@@ -4176,4 +4176,102 @@ class KhazanahController extends Controller
|
||||
return view('print.laporan_imbangduga-akru',compact('tarikh_imbangan', 'tarikh_imbangan2','hartasemasa','tanggungansemasa','totalhartasemasa','totaltanggungansemasa','tarikh_cetak','cawangan_info','cawangan','api_url','cawangan_detail'));
|
||||
}
|
||||
|
||||
public function laporanStokAuditKhas(){
|
||||
$auth_user = Auth::user();
|
||||
$api_url = config('api.url');
|
||||
|
||||
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
|
||||
$stokaudit = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/api/gadai/cawangan/'. $auth_user['cawangan'])->json();
|
||||
|
||||
return view('khazanah.laporan.stokauditkhas',compact('cawangan_info','api_url'));
|
||||
}
|
||||
|
||||
public function cetakLaporanStokAuditKhas(Request $request){
|
||||
$api_url = config('api.url');
|
||||
$auth_user = Auth::user();
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
$tarikh_cetak = $current->toDateString();
|
||||
$daritempoh = $request->daritempoh;
|
||||
$hinggatempoh = $request->hinggatempoh;
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
|
||||
// if($request->datetimepicker1 == null){
|
||||
// $tebus_date = $current->toDateString();
|
||||
// }else{
|
||||
// $split_date = explode('-',$request->datetimepicker1);
|
||||
// $tebus_date = $split_date[2] . '-' . $split_date[1] . '-' . $split_date[0];
|
||||
// }
|
||||
|
||||
$cawangan=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/cawangan/detail/'.$auth_user['cawangan'])->json();
|
||||
$cawangan_detail=$cawangan[0];
|
||||
|
||||
if($request->radaktif === 'aktif')
|
||||
{
|
||||
$stokaudit = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/api/stokauditkhas/aktif/'. $auth_user['cawangan'],['daritempoh' => $daritempoh, 'hinggatempoh' => $hinggatempoh])->json();
|
||||
// dd($stokaudit);
|
||||
return view('print.laporan_stokauditkhas', compact('stokaudit','cawangan_detail','tarikh_cetak','daritempoh','hinggatempoh','api_url','cawangan_info'));
|
||||
}
|
||||
// else{
|
||||
// $stokaudit = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/api/stokauditkhas/takaktif/'. $auth_user['cawangan'],['daritempoh' => $daritempoh, 'hinggatempoh' => $hinggatempoh])->json();
|
||||
// return view('print.laporan_stokauditkhasbelumaktif', compact('stokaudit','cawangan_detail','tarikh_cetak','daritempoh','hinggatempoh','api_url'));
|
||||
// }
|
||||
|
||||
|
||||
// dd($gadai);
|
||||
}
|
||||
|
||||
public function cetakExportLaporanStokAuditKhas(Request $request){
|
||||
// dd($request->all());
|
||||
$api_url = config('api.url');
|
||||
$auth_user = Auth::user();
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
$tarikh_cetak = $current->toDateString();
|
||||
$daritempoh = $request->daritempoh;
|
||||
$hinggatempoh = $request->hinggatempoh;
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
|
||||
|
||||
$cawangan=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/cawangan/detail/'.$auth_user['cawangan'])->json();
|
||||
$cawangan_detail=$cawangan[0];
|
||||
|
||||
$stokaudit = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/api/stokauditkhas/aktif/'. $auth_user['cawangan'],['daritempoh' => $daritempoh, 'hinggatempoh' => $hinggatempoh])->json();
|
||||
|
||||
if($request->type == 'excel')
|
||||
{
|
||||
return view('excel.excel_stokauditkhas', compact('stokaudit','cawangan_detail','tarikh_cetak','daritempoh','hinggatempoh','api_url','cawangan_info'));
|
||||
}
|
||||
elseif($request->type == 'whatsapp')
|
||||
{
|
||||
|
||||
$blastwhatsapp = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/blastwasap/'.$auth_user['cawangan'],
|
||||
['daritempoh' => $daritempoh, 'hinggatempoh' => $hinggatempoh, 'namapengguna' => $auth_user['name'],])->json();
|
||||
// dd($blastwhatsapp);
|
||||
if($blastwhatsapp == 'success'){
|
||||
return redirect()->route('laporan.stokauditkhas')
|
||||
->with('success','Blast Whatsapp Dalam Proses.');
|
||||
}
|
||||
elseif($blastwhatsapp == 'failed'){
|
||||
return redirect()->route('laporan.stokauditkhas')
|
||||
->with('failed','Blast Whatsapp Tidak Berjaya, Sila Semak Semula Rekod Blasted.');
|
||||
}
|
||||
|
||||
// return view('excel.excel_stokauditkhas', compact('stokaudit','cawangan_detail','tarikh_cetak','daritempoh','hinggatempoh','api_url','cawangan_info'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$stokaudit = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/api/stokauditkhas/aktif/'. $auth_user['cawangan'],['daritempoh' => $daritempoh, 'hinggatempoh' => $hinggatempoh])->json();
|
||||
return view('pdf.pdf_stokauditkhas', compact('stokaudit','cawangan_detail','tarikh_cetak','daritempoh','hinggatempoh','api_url','cawangan_info'));
|
||||
|
||||
// $pdf = PDF::loadView('pdf.pdf_stokauditkhas',compact('stokaudit','cawangan_detail','tarikh_cetak','daritempoh','hinggatempoh','api_url','cawangan_info'))
|
||||
// ->setPaper('a4', 'potrait');
|
||||
|
||||
// return $pdf->download('Stok Audit Khas.pdf');
|
||||
|
||||
}
|
||||
|
||||
|
||||
// dd($gadai);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user