root 4 years ago
parent
commit
65521cf2a4

+ 32
- 4
app/Console/Commands/CalculateStatisticCompound.php View File

$dataS->modul = 'all'; $dataS->modul = 'all';
$dataS->save(); $dataS->save();
} }

//calculate compound [modul = 02, status = Belum Bayar]
$n1 = ReportOverallCompound::where('status','Belum Bayar')->where('department','all')->where('modul','02')->first();
if(!empty($n1)){
$n1->total = count(Compound::where('modul','02')->where('status','Belum Bayar')->get());
$n1->save();
}else {
$dataB = new ReportOverallCompound;
$dataB->total = count(Compound::where('modul','02')->where('status','Belum Bayar')->get());
$dataB->status = 'Belum Bayar';
$dataB->department = 'all';
$dataB->modul = '02';
$dataB->save();
}
//calculate compound [modul = 03, status = Belum Bayar] //calculate compound [modul = 03, status = Belum Bayar]
$b1 = ReportOverallCompound::where('status','Belum Bayar')->where('department','all')->where('modul','03')->first();
$b1 = ReportOverallCompound::where('status','Belum Bayar')->where('department','all')->where('modul','03')->orWhere('modul','02')->first();
if(!empty($b1)){ if(!empty($b1)){
$b1->total = count(Compound::where('modul','03')->where('status','Belum Bayar')->get());
$b1->total = count(Compound::where('modul','03')->orWhere('modul','02')->where('status','Belum Bayar')->get());
$b1->save(); $b1->save();
}else { }else {
$dataB = new ReportOverallCompound; $dataB = new ReportOverallCompound;
$dataB->total = count(Compound::where('modul','03')->where('status','Belum Bayar')->get());
$dataB->total = count(Compound::where('modul','03')->orWhere('modul','02')->where('status','Belum Bayar')->get());
$dataB->status = 'Belum Bayar'; $dataB->status = 'Belum Bayar';
$dataB->department = 'all'; $dataB->department = 'all';
$dataB->modul = '03'; $dataB->modul = '03';
$dataJS1->save(); $dataJS1->save();
} }


//calcculate compound by department [status = Belum Bayar, modul = 02]
$n2 = ReportOverallCompound::where('status','Belum Bayar')->where('department',$d->_id)->where('modul','02')->orWhere('modul','02')->first();
if(!empty($n2)){
$n2->total = count(Compound::where('jbkod',$d->_id)->where('modul','02')->where('status','Belum Bayar')->get());
$n2->save();
}else {
$dataJB1 = new ReportOverallCompound;
$dataJB1->total = count(Compound::where('jbkod',$d->_id)->where('modul','02')->where('status','Belum Bayar')->get());
$dataJB1->status = 'Belum Bayar';
$dataJB1->department = $d->_id;
$dataJB1->modul = '03';
$dataJB1->save();
}

//calcculate compound by department [status = Belum Bayar, modul = 03] //calcculate compound by department [status = Belum Bayar, modul = 03]
$b2 = ReportOverallCompound::where('status','Belum Bayar')->where('department',$d->_id)->where('modul','03')->first();
$b2 = ReportOverallCompound::where('status','Belum Bayar')->where('department',$d->_id)->where('modul','03')->orWhere('modul','02')->first();
if(!empty($b2)){ if(!empty($b2)){
$b2->total = count(Compound::where('jbkod',$d->_id)->where('modul','03')->where('status','Belum Bayar')->get()); $b2->total = count(Compound::where('jbkod',$d->_id)->where('modul','03')->where('status','Belum Bayar')->get());
$b2->save(); $b2->save();

+ 260
- 17
app/Http/Controllers/Api/CompoundResourceController.php View File

use App\Model\Module\Attachment; use App\Model\Module\Attachment;


use App\Jobs\StoreCompound; use App\Jobs\StoreCompound;
use App\Jobs\StoreNotice;
use App\Jobs\StoreCompoundEPBT; use App\Jobs\StoreCompoundEPBT;
use App\Jobs\UpdateCompoundPrice; use App\Jobs\UpdateCompoundPrice;
use App\Http\Resources\CompoundResource; use App\Http\Resources\CompoundResource;
} }


$compound = Compound::where('jenis', $jenis)->whereBetween('created_at', array($start, $end)); $compound = Compound::where('jenis', $jenis)->whereBetween('created_at', array($start, $end));
if($modul == 'All'){ if($modul == 'All'){
$compound = $compound; $compound = $compound;
}else if($modul == '06-07'){ }else if($modul == '06-07'){
$compound = $compound->where(function($q){ $compound = $compound->where(function($q){
$q->where(function($query){
$query->where('modul', '06')->orWhere('modul','07');
});
// $q->where(function($query){
$q->where('modul', '06')->orWhere('modul','07');
// });
});
}else if(($modul == '03') || ($modul == '02')){
$compound = $compound->where(function($q){
// $q->where(function($query){
$q->where('modul', '02')->orWhere('modul', '03');
// });
}); });
}else { }else {
$compound = $compound->where('modul', $modul); $compound = $compound->where('modul', $modul);
$query->where('modul', '06')->orWhere('modul','07'); $query->where('modul', '06')->orWhere('modul','07');
}); });
}); });
}else if($modul == '03'){
$compound = $compound->where(function($q){
$q->where('modul', '02')->orWhere('modul', '03');
});
}else { }else {
$compound = $compound->where('modul', $modul); $compound = $compound->where('modul', $modul);
} }
} }


private function filterCompoundByEnforcer($enforcer,$jenis,$modul,$status,$start_date,$end_date){ private function filterCompoundByEnforcer($enforcer,$jenis,$modul,$status,$start_date,$end_date){

if(!empty($start_date)){ if(!empty($start_date)){
$compound = $this->searchCompoundAll($jenis,$modul,$status,$start_date,$end_date); $compound = $this->searchCompoundAll($jenis,$modul,$status,$start_date,$end_date);
}else{ }else{
// $per_page = ''; // $per_page = '';
// $kpd = ''; // $kpd = '';


// $modul = 'All';
// $modul = '02';
// $status = 'All'; // $status = 'All';
// $jenis = 'Pelbagai_JPB'; // $jenis = 'Pelbagai_JPB';
// if(!empty($request->department)){ // if(!empty($request->department)){
// }else { // }else {
// $department = []; // $department = [];
// } // }
// $start_date = '2020-07-18';
// $end_date = '2020-08-14';
// $start_date = '2020-08-18';
// $end_date = '2020-09-20';


// $enforcer = 'All'; // $enforcer = 'All';
// $faulty = 'All'; // $faulty = 'All';
} }


/** /**
* Store a newly created resource in storage.
* Store a created compound from notice.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response


$kpd = $request->kpd; $kpd = $request->kpd;


// $no_siri = date('yn').'-'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT);

// $fileData = [
// 'no_siri' => $no_siri,
// ];

// $file = ConfidentialFile::create($fileData);

$compound = Compound::where('jenis', $request->jenis)->where('kpd', $kpd)->first(); $compound = Compound::where('jenis', $request->jenis)->where('kpd', $kpd)->first();
if (!empty($compound)) { if (!empty($compound)) {
} }




/*********************************************
| Store a newly created notice
*********************************************/
public function storeNotice(Request $request) public function storeNotice(Request $request)
{ {
$staff = Staff::with('StaffDetail')->where('api_token',$request->api_token)->first(); $staff = Staff::with('StaffDetail')->where('api_token',$request->api_token)->first();
// }else{ // }else{
// $tawaran = $compound->jumlah_asal_kompaun; // $tawaran = $compound->jumlah_asal_kompaun;
// } // }
$this->dispatch(new StoreCompound($request->all(), $kpd, $staff->_id, $no_siri));
$this->dispatch(new StoreNotice($request->all(), $kpd, $staff->_id, $no_siri));
array_push($data, array('kpd' => $kpd)); array_push($data, array('kpd' => $kpd));


return $this->sendResponse($data, 'Berjaya simpan rekod notis!'); return $this->sendResponse($data, 'Berjaya simpan rekod notis!');
} }
} }


/**
* Store a newly created compound (parkir, KT, JPB).
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function storeCompound(Request $request)
{

$staff = Staff::with('StaffDetail')->where('api_token',$request->api_token)->first();
if(empty($staff)){
return $this->sendError('Invalid', 'Staff not existed');
}else {

$data = array();

$faulty = Faulty::where('_id',$request->get('seksyen'))->first();
if(!empty($faulty)){
$countKPD = $this->compound->withTrashed()->count();

do {
$countKPD = $countKPD + 1;
} while (Compound::where("kpd", "=", 'KP'.$countKPD)->first() instanceof Compound);

$kpd = $countKPD;
$no_siri = date('yn').'-'.$countKPD;

$fileData = [
'no_siri' => $no_siri,
];

if($request->jenis == 'Parkir')
{

//only for compound parkir
$compoundData = [
'jenis' => 'Parkir',
'kpd' => $kpd,
'nama' => '-',
'identity' => '-',
'alamat' => '-',
"no_plate" => strtolower($request->no_plate),
"no_cukai_jalan" => $request->noCukaijalan,
"jenis_kenderaan" => $request->jenisKenderaan,
"model_kenderaan" => $request->modelKenderaan,
"warna_kenderaan" => $request->warnakenderaan,
"nama_kawasan" => $request->namaKawasan,
"nama_taman" => $request->namaTaman,
"nama_jalan" => $request->namaJalan,
"no_parking" => $request->noParking,
"catatan" => $request->catatan,
"lokasi_kejadian" => '-',
'latlong' => $request->Latlong,
'jbkod' => $request->jabatan,
'akta' => $faulty->deed_law_id,
'seksyen_kesalahan' => $faulty->_id,
'jumlah_asal_kompaun' => $faulty->amount,
'jumlah_kemaskini_kompaun' => '',
'dikeluarkan' => $staff->_id,
"status" => 'Belum Bayar',
"amount_payment" => '',
"receipt" => '',
"modul" => '03',
"penguatkuasa" => '',
"cpn_created" => Carbon::now()->toDateTimeString(),
];
}
if ($request->jenis == 'Pelbagai_KT') {
$compoundData = [
'jenis' => $request->jenis,
'kpd' => $kpd,
'nama' => $request->namaP,
'identity' => $request->noIc,
'nama_syarikat' => $request->namaS,
'no_daftar_syarikat' => strtolower($request->daftarNo),
'alamat' => $request->alamat,
"no_plate" => $request->no_plate,
"no_cukai_jalan" => $request->no_cukai_jalan,
"nama_kawasan" => $request->namaKawasan,
"nama_taman" => $request->namaTaman,
"nama_jalan" => $request->namaJalan,
"catatan" => $request->catatan,
"lokasi_kejadian" => '-',
'latlong' => $request->Latlong,
'jbkod' => $request->jabatan,
'akta' => $faulty->deed_law_id,
'seksyen_kesalahan' => $faulty->_id,
'jumlah_asal_kompaun' => $faulty->amount,
'jumlah_kemaskini_kompaun' => '',
'dikeluarkan' => $staff->_id,
"status" => 'Belum Bayar',
"amount_payment" => '',
"receipt" => '',
"modul" => $request->modul,
"penguatkuasa" => '',
"no_telefon" => $request->tel,
"no_akaun_lesen" => $request->lesen,
"maklumat_tambahan" => '-',
"tindakan" => $request->tindakan,
"tempoh" => $request->tempoh,
"notis_created" => Carbon::now()->toDateTimeString(),
];
}
elseif ($request->jenis == 'Pelbagai_JPB') {
$compoundData = [
'jenis' => $request->jenis,
'kpd' => $kpd,
'nama' => $request->namaP,
'identity' => $request->noIc,
'nama_syarikat' => $request->namaS,
'no_daftar_syarikat' => strtolower($request->daftarNo),
'alamat' => $request->alamat,
"no_plate" => $request->no_plate,
"no_cukai_jalan" => $request->no_cukai_jalan,
"nama_kawasan" => $request->namaKawasan,
"nama_taman" => $request->namaTaman,
"nama_jalan" => $request->namaJalan,
"catatan" => $request->catatan,
"lokasi_kejadian" => '-',
'latlong' => $request->Latlong,
'jbkod' => $request->jabatan,
'akta' => $faulty->deed_law_id,
'seksyen_kesalahan' => $faulty->_id,
'jumlah_asal_kompaun' => $faulty->amount,
'jumlah_kemaskini_kompaun' => '',
'dikeluarkan' => $staff->_id,
"status" => 'Belum Bayar',
"amount_payment" => '',
"receipt" => '',
"modul" => $request->modul,
"penguatkuasa" => '',
"no_telefon" => $request->tel,
"no_akaun_lesen" => $request->lesen,
"maklumat_tambahan" => '-',
"tindakan" => $request->tindakan,
"tempoh" => $request->tempoh,
"notis_created" => Carbon::now()->toDateTimeString(),
];
}
elseif ($request->jenis == 'Pelbagai_LESEN') {
$compoundData = [
'jenis' => $request->jenis,
'kpd' => $kpd,
'nama' => $request->namaP,
'identity' => $request->noIc,
'nama_syarikat' => $request->namaS,
'no_daftar_syarikat' => strtolower($request->daftarNo),
'alamat' => $request->alamat,
"no_plate" => $request->no_plate,
"no_cukai_jalan" => $request->no_cukai_jalan,
"nama_kawasan" => $request->namaKawasan,
"nama_taman" => $request->namaTaman,
"nama_jalan" => $request->namaJalan,
"catatan" => $request->catatan,
"lokasi_kejadian" => '-',
'latlong' => $request->Latlong,
'jbkod' => $request->jabatan,
'akta' => $faulty->deed_law_id,
'seksyen_kesalahan' => $faulty->_id,
'jumlah_asal_kompaun' => $faulty->amount,
'jumlah_kemaskini_kompaun' => '',
'dikeluarkan' => $staff->_id,
"status" => 'Belum Bayar',
"amount_payment" => '',
"receipt" => '',
"modul" => $request->modul,
"penguatkuasa" => '',
"no_telefon" => $request->tel,
"no_akaun_lesen" => $request->lesen,
"maklumat_tambahan" => '-',
"notis_created" => Carbon::now()->toDateTimeString(),
];
}
else if($request->jenis == 'Pelbagai_PA'){
$compoundData = [
'jenis' => $request->jenis,
'kpd' => $kpd,
'nama' => $request->namaP,
'identity' => $request->noIc,
'nama_syarikat' => $request->namaS,
'no_daftar_syarikat' => strtolower($request->daftarNo),
'alamat' => $request->alamat,
"no_plate" => $request->no_plate,
"no_cukai_jalan" => $request->no_cukai_jalan,
"nama_kawasan" => $request->namaKawasan,
"nama_taman" => $request->namaTaman,
"nama_jalan" => $request->namaJalan,
"catatan" => $request->catatan,
"lokasi_kejadian" => '-',
'latlong' => $request->Latlong,
'jbkod' => $request->jabatan,
'akta' => $faulty->deed_law_id,
'seksyen_kesalahan' => $faulty->_id,
'jumlah_asal_kompaun' => $faulty->amount,
'jumlah_kemaskini_kompaun' => '',
'dikeluarkan' => $staff->_id,
"status" => 'Belum Bayar',
"amount_payment" => '',
"receipt" => '',
"modul" => $request->modul,
"penguatkuasa" => '',
"no_telefon" => $request->tel,
"no_akaun_lesen" => $request->lesen,
"maklumat_tambahan" => '-',
"bil_haiwan" => $request->bil_haiwan,
"notis_created" => Carbon::now()->toDateTimeString(),
];
}
$file = ConfidentialFile::create($fileData);
$saved = $file->compound()->create($compoundData);
}

if($saved){
// $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->first();
// if(!empty($compound)){
dispatch(new UpdateCompoundPrice($kpd));
// $tawaran = '';
// if($compound->jumlah_kemaskini_kompaun != ''){
// $tawaran = $compound->jumlah_kemaskini_kompaun;
// }else{
// $tawaran = $compound->jumlah_asal_kompaun;
// }
$this->dispatch(new StoreCompound($request->all(), $kpd, $staff->_id, $no_siri));
array_push($data, array('kpd' => $kpd));
// $this->dispatch(new StoreCompoundEPBT($request->all(), $kpd, $staff->StaffDetail->full_name, $staff->StaffDetail->no_badan, $faulty->nama));

return $this->sendResponse($data, 'Berjaya simpan rekod kompaun!');
// }
}
}
}



/** /**
* Display the specified resource. * Display the specified resource.

+ 61
- 0
app/Http/Controllers/Main/CompoundController.php View File

if(count($user->StaffDetail->department_ids) > 1){ if(count($user->StaffDetail->department_ids) > 1){
$overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first(); $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first();
// $n = ReportOverallCompound::where('department','all')->where('modul','02')->where('status','Belum Bayar')->first();
$b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first();
$pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first();
$na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first();
$by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first(); $by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first();
}else { }else {
$overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first(); $overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first();
// $n = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','02')->where('status','Belum Bayar')->first();
$b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first();
$pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first();
$na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first();
} }
$semua = $overall->total; $semua = $overall->total;
// $pre_notice = $n->total;
$baru = $b->total; $baru = $b->total;
$invest = $pk->total; $invest = $pk->total;
$notice = $na->total; $notice = $na->total;
return view('main-dashboard.compound.compound_index', compact('user','site','staff','deedlaw','now','modul','semua','baru','invest','notice','inven','collap','comp')); return view('main-dashboard.compound.compound_index', compact('user','site','staff','deedlaw','now','modul','semua','baru','invest','notice','inven','collap','comp'));
} }
public function pre_notice_index(){
$id = Auth::guard('sadmin')->id();
$user = Staff::with('StaffDetail')->find($id);
if(count($user->StaffDetail->department_ids) > 1){
$overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first();
// $n = ReportOverallCompound::where('department','all')->where('modul','02')->where('status','Belum Bayar')->first();
$b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first();
$pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first();
$na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first();
$si = ReportOverallCompound::where('department','all')->where('modul','06-07')->where('status','Belum Bayar')->first();
$by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first();
}else {
$overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first();
// $n = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','02')->where('status','Belum Bayar')->first();
$b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first();
$pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first();
$na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first();
$si = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','06-07')->where('status','Belum Bayar')->first();
$by = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('status','Berbayar')->first();
}
$semua = $overall->total;
// $pre_notice = $n->total;
$baru = $b->total;
$invest = $pk->total;
$notice = $na->total;
$inven = $si->total;
$collap = 0;
$comp = $by->total;
$site = SiteSetting::first();
$staff = StaffDetail::where('roles_access','PenguatKuasa')->whereIn('department_ids',$user->StaffDetail->department_ids)->get();
$deedlaw = Deedlaw::with('Faulty')->whereIn('department_ids',$user->StaffDetail->department_ids)->get();
$now = Carbon::now()->format('Y-m-d');
$modul = '03';
return view('main-dashboard.compound.new_index', compact('user','site','staff','deedlaw','now','modul','semua','baru','invest','notice','inven','collap','comp'));
}
public function new_index(){ public function new_index(){
$id = Auth::guard('sadmin')->id(); $id = Auth::guard('sadmin')->id();
$user = Staff::with('StaffDetail')->find($id); $user = Staff::with('StaffDetail')->find($id);
if(count($user->StaffDetail->department_ids) > 1){ if(count($user->StaffDetail->department_ids) > 1){
$overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first(); $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first();
// $n = ReportOverallCompound::where('department','all')->where('modul','02')->where('status','Belum Bayar')->first();
$b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first();
$pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first();
$na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first();
$by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first(); $by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first();
}else { }else {
$overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first(); $overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first();
// $n = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','02')->where('status','Belum Bayar')->first();
$b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first();
$pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first();
$na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first();
} }
$semua = $overall->total; $semua = $overall->total;
// $pre_notice = $n->total;
$baru = $b->total; $baru = $b->total;
$invest = $pk->total; $invest = $pk->total;
$notice = $na->total; $notice = $na->total;
if(count($user->StaffDetail->department_ids) > 1){ if(count($user->StaffDetail->department_ids) > 1){
$overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first(); $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first();
// $n = ReportOverallCompound::where('department','all')->where('modul','02')->where('status','Belum Bayar')->first();
$b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first();
$pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first();
$na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first();
$by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first(); $by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first();
}else { }else {
$overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first(); $overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first();
// $n = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','02')->where('status','Belum Bayar')->first();
$b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first();
$pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first();
$na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first();
} }
$semua = $overall->total; $semua = $overall->total;
// $pre_notice = $n->total;
$baru = $b->total; $baru = $b->total;
$invest = $pk->total; $invest = $pk->total;
$notice = $na->total; $notice = $na->total;
if(count($user->StaffDetail->department_ids) > 1){ if(count($user->StaffDetail->department_ids) > 1){
$overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first(); $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first();
// $n = ReportOverallCompound::where('department','all')->where('modul','02')->where('status','Belum Bayar')->first();
$b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first();
$pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first();
$na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first();
$by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first(); $by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first();
}else { }else {
$overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first(); $overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first();
// $n = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','02')->where('status','Belum Bayar')->first();
$b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first();
$pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first();
$na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first();
} }
$semua = $overall->total; $semua = $overall->total;
// $pre_notice = $n->total;
$baru = $b->total; $baru = $b->total;
$invest = $pk->total; $invest = $pk->total;
$notice = $na->total; $notice = $na->total;
if(count($user->StaffDetail->department_ids) > 1){ if(count($user->StaffDetail->department_ids) > 1){
$overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first(); $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first();
// $n = ReportOverallCompound::where('department','all')->where('modul','02')->where('status','Belum Bayar')->first();
$b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first();
$pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first();
$na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first();
$by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first(); $by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first();
}else { }else {
$overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first(); $overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first();
// $n = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','02')->where('status','Belum Bayar')->first();
$b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first();
$pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first();
$na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first();
} }
$semua = $overall->total; $semua = $overall->total;
// $pre_notice = $n->total;
$baru = $b->total; $baru = $b->total;
$invest = $pk->total; $invest = $pk->total;
$notice = $na->total; $notice = $na->total;
if(count($user->StaffDetail->department_ids) > 1){ if(count($user->StaffDetail->department_ids) > 1){
$overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first(); $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first();
// $n = ReportOverallCompound::where('department','all')->where('modul','02')->where('status','Belum Bayar')->first();
$b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first();
$pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first();
$na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first();
$by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first(); $by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first();
}else { }else {
$overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first(); $overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first();
// $n = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','02')->where('status','Belum Bayar')->first();
$b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first();
$pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first();
$na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first();
} }
$semua = $overall->total; $semua = $overall->total;
// $pre_notice = $n->total;
$baru = $b->total; $baru = $b->total;
$invest = $pk->total; $invest = $pk->total;
$notice = $na->total; $notice = $na->total;
if(count($user->StaffDetail->department_ids) > 1){ if(count($user->StaffDetail->department_ids) > 1){
$overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first(); $overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->first();
// $n = ReportOverallCompound::where('department','all')->where('modul','02')->where('status','Belum Bayar')->first();
$b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department','all')->where('modul','03')->where('status','Belum Bayar')->first();
$pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department','all')->where('modul','04')->where('status','Belum Bayar')->first();
$na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department','all')->where('modul','05')->where('status','Belum Bayar')->first();
$by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first(); $by = ReportOverallCompound::where('department','all')->where('status','Berbayar')->first();
}else { }else {
$overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first(); $overall = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','all')->where('status','all')->first();
// $n = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','02')->where('status','Belum Bayar')->first();
$b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first(); $b = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','03')->where('status','Belum Bayar')->first();
$pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first(); $pk = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','04')->where('status','Belum Bayar')->first();
$na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first(); $na = ReportOverallCompound::where('department',$user->StaffDetail->department_ids[0])->where('modul','05')->where('status','Belum Bayar')->first();
} }
$semua = $overall->total; $semua = $overall->total;
// $pre_notice = $n->total;
$baru = $b->total; $baru = $b->total;
$invest = $pk->total; $invest = $pk->total;
$notice = $na->total; $notice = $na->total;

+ 4
- 2
resources/views/main-dashboard/compound/_part/menu_category.blade.php View File

</div> </div>


<div class="panel-body"> <div class="panel-body">
<div class="{{ Request::is('main/compound') ? 'menu-active' : 'menu' }}"><a href="/main/compound">Semua Kompaun</a>&nbsp;<label class="badge badge-success">{{ $semua }} </label></div>
<div class="{{ Request::is('main/compound') ? 'menu-active' : 'menu' }}"><a href="/main/compound">Semua Kompaun & Notis</a>&nbsp;<label class="badge badge-success">{{ $semua }} </label></div>


<div class="{{ Request::is('main/compound/new') ? 'menu-active' : 'menu' }}"><a href="/main/compound/new">Baru (02-03)</a>&nbsp;<label class="badge badge-success">{{ $baru }}</label></div>
<!-- <div class="{{ Request::is('main/pre-notice/new') ? 'menu-active' : 'menu' }}"><a href="/main/pre-notice/new">Notis (02)</a>&nbsp;<label class="badge badge-success">{{ $baru }}</label></div>
-->
<div class="{{ Request::is('main/compound/new') ? 'menu-active' : 'menu' }}"><a href="/main/compound/new">Baru (03)</a>&nbsp;<label class="badge badge-success">{{ $baru }}</label></div>


<div class="{{ Request::is('main/compound/investigation') ? 'menu-active' : 'menu' }}"><a href="/main/compound/investigation">Pengesahan Kompaun (04)</a>&nbsp;<label class="badge badge-success">{{ $invest }}</label></div> <div class="{{ Request::is('main/compound/investigation') ? 'menu-active' : 'menu' }}"><a href="/main/compound/investigation">Pengesahan Kompaun (04)</a>&nbsp;<label class="badge badge-success">{{ $invest }}</label></div>



+ 1
- 0
routes/api.php View File

Route::post('/mobile/staff/notice/today/list', 'Api\CompoundController@viewNoticeToday'); Route::post('/mobile/staff/notice/today/list', 'Api\CompoundController@viewNoticeToday');
Route::post('/mobile/store/compound', 'Api\CompoundResourceController@store'); Route::post('/mobile/store/compound', 'Api\CompoundResourceController@store');
Route::post('/mobile/store/notice', 'Api\CompoundResourceController@storeNotice'); Route::post('/mobile/store/notice', 'Api\CompoundResourceController@storeNotice');
Route::post('/mobile/store', 'Api\CompoundResourceController@storeCompound');
Route::post('/mobile/store/compound/picture', 'Api\CompoundController@storeCompoundAttachment'); Route::post('/mobile/store/compound/picture', 'Api\CompoundController@storeCompoundAttachment');
Route::post('/mobile/store/acceptance/compound', 'Api\CompoundController@storeAcceptanceCompound'); Route::post('/mobile/store/acceptance/compound', 'Api\CompoundController@storeAcceptanceCompound');
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------

+ 1
- 0
routes/web.php View File

| Compound | Compound
|-------------------------------------------------------------------------*/ |-------------------------------------------------------------------------*/
Route::get('/main/compound', ['uses' => 'Main\CompoundController@index', 'as' => 'compound']); Route::get('/main/compound', ['uses' => 'Main\CompoundController@index', 'as' => 'compound']);
Route::get('/main/pre-notice/new', ['uses' => 'Main\CompoundController@pre_notice_index', 'as' => 'noticeN']);
Route::get('/main/compound/new', ['uses' => 'Main\CompoundController@new_index', 'as' => 'compoundN']); Route::get('/main/compound/new', ['uses' => 'Main\CompoundController@new_index', 'as' => 'compoundN']);
Route::get('/main/compound/investigation', ['uses' => 'Main\CompoundController@investigation_index', 'as' => 'investL']); Route::get('/main/compound/investigation', ['uses' => 'Main\CompoundController@investigation_index', 'as' => 'investL']);
Route::get('/main/compound/notice', ['uses' => 'Main\CompoundController@notice_index', 'as' => 'noticeL']); Route::get('/main/compound/notice', ['uses' => 'Main\CompoundController@notice_index', 'as' => 'noticeL']);

Loading…
Cancel
Save