瀏覽代碼

cronjob

master
Siti Rahayu 5 年之前
父節點
當前提交
5f5d086746

+ 252
- 0
app/Console/Commands/CalculateStatisticCompound.php 查看文件

@@ -0,0 +1,252 @@
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Log;
use App\Model\Module\Compound;
use App\Model\Module\Department;
use App\Model\Module\ReportOverallCompound;

class CalculateStatisticCompound extends Command
{
/**
* The name and signature of the console command
*
* @var string
*/
protected $signature = 'update:statistic__overall_compound';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Store and calculate statistic overall compound';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//calculate all compound [status = Belum Bayar, Bayar & Batal]
$s1 = ReportOverallCompound::where('status','all')->where('department','all')->where('modul','all')->first();
if(!empty($s1)){
$s1->total = count(Compound::where('status', ['Belum Bayar', 'Berbayar', 'Batal'])->get();
$s1->save();
}else {
$dataS = new ReportOverallCompound;
// $dataS->total = count(Compound::all());
$dataS->total = count(Compound::where('status', ['Belum Bayar', 'Berbayar', 'Batal'])->get();
$dataS->status = 'all';
$dataS->department = 'all';
$dataS->modul = 'all';
$dataS->save();
}
//calculate compound [modul = 03, status = Belum Bayar]
$b1 = ReportOverallCompound::where('status','Belum Bayar')->where('department','all')->where('modul','03')->first();
if(!empty($b1)){
$b1->total = count(Compound::where('modul','03')->where('status','Belum Bayar')->get());
$b1->save();
}else {
$dataB = new ReportOverallCompound;
$dataB->total = count(Compound::where('modul','03')->where('status','Belum Bayar')->get());
$dataB->status = 'Belum Bayar';
$dataB->department = 'all';
$dataB->modul = '03';
$dataB->save();
}
//calculate compound [modul = 04, status = Belum Bayar]
$pk1 = ReportOverallCompound::where('status','Belum Bayar')->where('department','all')->where('modul','04')->first();
if(!empty($pk1)){
$pk1->total = count(Compound::where('modul','04')->where('status','Belum Bayar')->get());
$pk1->save();
}else {
$dataPK = new ReportOverallCompound;
$dataPK->total = count(Compound::where('modul','04')->where('status','Belum Bayar')->get());
$dataPK->status = 'Belum Bayar';
$dataPK->department = 'all';
$dataPK->modul = '04';
$dataPK->save();
}

//calculate compound [modul = 05, status = Belum Bayar]
$na1 = ReportOverallCompound::where('status','Belum Bayar')->where('department','all')->where('modul','05')->first();
if(!empty($na1)){
$na1->total = count(Compound::where('modul','05')->where('status','Belum Bayar')->get());
$na1->save();
}else {
$dataNA = new ReportOverallCompound;
$dataNA->total = count(Compound::where('modul','05')->where('status','Belum Bayar')->get());
$dataNA->status = 'Belum Bayar';
$dataNA->department = 'all';
$dataNA->modul = '05';
$dataNA->save();
}

//calculate compound [modul = 06-07, status = Belum Bayar]
$si1 = ReportOverallCompound::where('status','Belum Bayar')->where('department','all')->where('modul','06-07')->first();
if(!empty($si1)){
$si1->total = count(Compound::where('modul','06')->orWhere('modul','07')->where('status','Belum Bayar')->get());
$si1->save();
}else {
$dataSI = new ReportOverallCompound;
$dataSI->total = count(Compound::where('modul','06')->orWhere('modul','07')->where('status','Belum Bayar')->get());
$dataSI->status = 'Belum Bayar';
$dataSI->department = 'all';
$dataSI->modul = '06-07';
$dataSI->save();
}

//calculate compound [modul = 08, status = Belum Bayar]
$rb1 = ReportOverallCompound::where('status','Belum Bayar')->where('department','all')->where('modul','08')->first();
if(!empty($rb1)){
$rb1->total = count(Compound::where('modul','08')->where('status','Belum Bayar')->get());
$rb1->save();
}else {
$dataRB = new ReportOverallCompound;
$dataRB->total = count(Compound::where('modul','08')->where('status','Belum Bayar')->get());
$dataRB->status = 'Belum Bayar';
$dataRB->department = 'all';
$dataRB->modul = '08';
$dataRB->save();
}

//calculate compound [status = Berbayar]
$by1 = ReportOverallCompound::where('status','Berbayar')->where('department','all')->first();
if(!empty($by1)){
$by1->total = count(Compound::where('status','Berbayar')->get());
$by1->save();
}else {
$dataBy = new ReportOverallCompound;
$dataBy->total = count(Compound::where('status','Berbayar')->get());
$dataBy->status = 'Berbayar';
$dataBy->department = 'all';
$dataBy->modul = 'all';
$dataBy->save();
}

//////////////////////////////////////////////////////////////////////////////////////////

//calcculate compound by department
$department = Department::all();

foreach ($department as $key => $d) {

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

//calcculate compound by department [status = Belum Bayar, modul = 03]
$b2 = ReportOverallCompound::where('status','Belum Bayar')->where('department',$d->_id)->where('modul','03')->first();
if(!empty($b2)){
$b2->total = count(Compound::where('jbkod',$d->_id)->where('modul','03')->where('status','Belum Bayar')->get());
$b2->save();
}else {
$dataJB1 = new ReportOverallCompound;
$dataJB1->total = count(Compound::where('jbkod',$d->_id)->where('modul','03')->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 = 04]
$pk2 = ReportOverallCompound::where('status','Belum Bayar')->where('department',$d->_id)->where('modul','04')->first();
if(!empty($pk2)){
$pk2->total = count(Compound::where('jbkod',$d->_id)->where('modul','04')->where('status','Belum Bayar')->get());
$pk2->save();
}else {
$dataJPK1 = new ReportOverallCompound;
$dataJPK1->total = count(Compound::where('jbkod',$d->_id)->where('modul','04')->where('status','Belum Bayar')->get());
$dataJPK1->status = 'Belum Bayar';
$dataJPK1->department = $d->_id;
$dataJPK1->modul = '04';
$dataJPK1->save();
}

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

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

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

//calcculate compound by department [status = Berbayar]
$by2 = ReportOverallCompound::where('status','Berbayar')->where('department',$d->_id)->first();
if(!empty($by2)){
$by2->total = count(Compound::where('jbkod',$d->_id)->where('status','Berbayar')->get());
$by2->save();
}else {
$dataJBy1 = new ReportOverallCompound;
$dataJBy1->total = count(Compound::where('jbkod',$d->_id)->where('status','Berbayar')->get());
$dataJBy1->status = 'Berbayar';
$dataJBy1->department = $d->_id;
$dataJBy1->modul = 'all';
$dataJBy1->save();
}
}

Log::info('Overall Compound been saved');
$this->info('Overall Compound been saved');
}
}

+ 8
- 2
app/Console/Kernel.php 查看文件

@@ -24,8 +24,14 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')
// ->hourly();
// $schedule->command('update:price')
// ->daily();
$schedule->command('update:statistic__overall_compound')
->everyTenMinutes();
// $schedule->command('update:compound_compound')
// ->everyFiveMinutes();
// $schedule->command('push:epbt')
// ->everyTenMinutes();
}

/**

+ 216
- 59
app/Http/Controllers/Main/CompoundController.php 查看文件

@@ -24,6 +24,7 @@ use App\Model\Module\History;
use App\Model\Module\SubHistory;
use App\Model\Module\Memo;
use App\Model\Module\Attachment;
use App\Model\Module\ReportOverallCompound;
use App\Jobs\StoreCompound;
use App\Jobs\StoreCompoundManual;
@@ -41,84 +42,219 @@ class CompoundController extends Controller
$id = Auth::guard('sadmin')->id();
$user = Staff::with('StaffDetail')->find($id);
$baru = count(Compound::where('modul','03')->where('status','Belum Bayar')->get());
$invest = count(Compound::where('modul','04')->where('status','Belum Bayar')->get());
$notice = count(Compound::where('modul','05')->where('status','Belum Bayar')->get());
$inven = count(Compound::where('modul','06')->orWhere('modul','07')->where('status','Belum Bayar')->get());
$collap = count(Compound::where('modul','08')->where('status','Belum Bayar')->get());
$comp = count(Compound::where('status','Berbayar')->get());
// $department = Department::all();
if(count($user->StaffDetail->department_ids) > 1){
$overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->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();
$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;
$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')->get();
$faulty = Deedlaw::with('Faulty')->get();
return view('main-dashboard.compound.compound_index', compact('user','site','staff','faulty','baru','invest','notice','inven','collap','comp'));
$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 = 'All';
return view('main-dashboard.compound.compound_index', compact('user','site','staff','deedlaw','now','modul','semua','baru','invest','notice','inven','collap','comp'));
}
public function new_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();
$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();
$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;
$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 investigation_index(){
$id = Auth::guard('sadmin')->id();
$user = Staff::with('StaffDetail')->find($id);
$baru = count(Compound::where('modul','03')->where('status','Belum Bayar')->get());
$invest = count(Compound::where('modul','04')->where('status','Belum Bayar')->get());
$notice = count(Compound::where('modul','05')->where('status','Belum Bayar')->get());
$inven = count(Compound::where('modul','06')->orWhere('modul','07')->where('status','Belum Bayar')->get());
$collap = count(Compound::where('modul','08')->where('status','Belum Bayar')->get());
$comp = count(Compound::where('status','Berbayar')->get());
// $department = Department::all();
if(count($user->StaffDetail->department_ids) > 1){
$overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->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();
$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;
$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')->get();
$faulty = Deedlaw::with('Faulty')->get();
return view('main-dashboard.compound.investigation_index', compact('user','site','staff','faulty','baru','invest','notice','inven','collap','comp'));
$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 = '04';
return view('main-dashboard.compound.investigation_index', compact('user','site','staff','deedlaw','now','modul','semua','baru','invest','notice','inven','collap','comp'));
}
public function notice_index(){
$id = Auth::guard('sadmin')->id();
$user = Staff::with('StaffDetail')->find($id);
$baru = count(Compound::where('modul','03')->where('status','Belum Bayar')->get());
$invest = count(Compound::where('modul','04')->where('status','Belum Bayar')->get());
$notice = count(Compound::where('modul','05')->where('status','Belum Bayar')->get());
$inven = count(Compound::where('modul','06')->orWhere('modul','07')->where('status','Belum Bayar')->get());
$collap = count(Compound::where('modul','08')->where('status','Belum Bayar')->get());
$comp = count(Compound::where('status','Berbayar')->get());
// $department = Department::all();
if(count($user->StaffDetail->department_ids) > 1){
$overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->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();
$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;
$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')->get();
$faulty = Deedlaw::with('Faulty')->get();
return view('main-dashboard.compound.notice_index', compact('user','site','staff','faulty','baru','invest','notice','inven','collap','comp'));
$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 = '05';
return view('main-dashboard.compound.notice_index', compact('user','site','staff','deedlaw','now','modul','semua','baru','invest','notice','inven','collap','comp'));
}
public function confiscated_index(){
$id = Auth::guard('sadmin')->id();
$user = Staff::with('StaffDetail')->find($id);
$baru = count(Compound::where('modul','03')->where('status','Belum Bayar')->get());
$invest = count(Compound::where('modul','04')->where('status','Belum Bayar')->get());
$notice = count(Compound::where('modul','05')->where('status','Belum Bayar')->get());
$inven = count(Compound::where('modul','06')->orWhere('modul','07')->where('status','Belum Bayar')->get());
$collap = count(Compound::where('modul','08')->where('status','Belum Bayar')->get());
$comp = count(Compound::where('status','Berbayar')->get());
// $department = Department::all();
if(count($user->StaffDetail->department_ids) > 1){
$overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->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();
$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;
$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')->get();
$faulty = Deedlaw::with('Faulty')->get();
return view('main-dashboard.compound.confiscated_index', compact('user','site','staff','faulty','baru','invest','notice','inven','collap','comp'));
$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 = '06-07';
return view('main-dashboard.compound.confiscated_index', compact('user','site','staff','deedlaw','now','modul','semua','baru','invest','notice','inven','collap','comp'));
}
public function collapsed_index(){
$id = Auth::guard('sadmin')->id();
$user = Staff::with('StaffDetail')->find($id);
$baru = count(Compound::where('modul','03')->where('status','Belum Bayar')->get());
$invest = count(Compound::where('modul','04')->where('status','Belum Bayar')->get());
$notice = count(Compound::where('modul','05')->where('status','Belum Bayar')->get());
$inven = count(Compound::where('modul','06')->orWhere('modul','07')->where('status','Belum Bayar')->get());
$collap = count(Compound::where('modul','08')->where('status','Belum Bayar')->get());
$comp = count(Compound::where('status','Berbayar')->get());
// $department = Department::all();
if(count($user->StaffDetail->department_ids) > 1){
$overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->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();
$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;
$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')->get();
$faulty = Deedlaw::with('Faulty')->get();
$staff = StaffDetail::where('roles_access','PenguatKuasa')->whereIn('department_ids',$user->StaffDetail->department_ids)->get();
$faulty = Deedlaw::with('Faulty')->whereIn('department_ids',$user->StaffDetail->department_ids)->get();
return view('main-dashboard.compound.collapsed_index', compact('user','site','staff','faulty','baru','invest','notice','inven','collap','comp'));
}
@@ -126,19 +262,40 @@ class CompoundController extends Controller
$id = Auth::guard('sadmin')->id();
$user = Staff::with('StaffDetail')->find($id);
$baru = count(Compound::where('modul','03')->where('status','Belum Bayar')->get());
$invest = count(Compound::where('modul','04')->where('status','Belum Bayar')->get());
$notice = count(Compound::where('modul','05')->where('status','Belum Bayar')->get());
$inven = count(Compound::where('modul','06')->orWhere('modul','07')->where('status','Belum Bayar')->get());
$collap = count(Compound::where('modul','08')->where('status','Belum Bayar')->get());
$comp = count(Compound::where('status','Berbayar')->get());
// $department = Department::all();
if(count($user->StaffDetail->department_ids) > 1){
$overall = ReportOverallCompound::where('department','all')->where('modul','all')->where('status','all')->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();
$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;
$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')->get();
$faulty = Deedlaw::with('Faulty')->get();
return view('main-dashboard.compound.completed_index', compact('user','site','staff','faulty','baru','invest','notice','inven','collap','comp'));
$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 = 'All';
return view('main-dashboard.compound.completed_index', compact('user','site','staff','deedlaw','now','modul','semua','baru','invest','notice','inven','collap','comp'));
}
public function viewCompoundHistoryDetail($kpd){
$id = Auth::guard('sadmin')->id();
$user = Staff::with('StaffDetail')->find($id);

+ 16
- 0
app/Model/Module/ReportOverallCompound.php 查看文件

@@ -0,0 +1,16 @@
<?php

namespace App\Model\Module;

use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
use Jenssegers\Mongodb\Eloquent\SoftDeletes;

class ReportOverallCompound extends Eloquent
{
use SoftDeletes;
//
protected $connection = 'mongodb';
protected $collection = 'report_overall_compound';
protected $guarded = ['_id'];
}

二進制
public/uploads/bg_compound .png 查看文件


二進制
public/uploads/bg_compound.png 查看文件


Loading…
取消
儲存