Siti Rahayu 4 лет назад
Родитель
Сommit
ec83455de9

+ 30
- 2
app/Console/Commands/CalculateStatisticCompound.php Просмотреть файл

@@ -55,6 +55,20 @@ class CalculateStatisticCompound extends Command
$dataS->modul = 'all';
$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]
$b1 = ReportOverallCompound::where('status','Belum Bayar')->where('department','all')->where('modul','03')->orWhere('modul','02')->first();
@@ -161,14 +175,28 @@ class CalculateStatisticCompound extends Command
$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]
$b2 = ReportOverallCompound::where('status','Belum Bayar')->where('department',$d->_id)->where('modul','03')->orWhere('modul','02')->first();
if(!empty($b2)){
$b2->total = count(Compound::where('jbkod',$d->_id)->where('modul','03')->orWhere('modul','02')->where('status','Belum Bayar')->get());
$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')->orWhere('modul','02')->where('status','Belum Bayar')->get());
$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';

+ 7
- 11
app/Http/Controllers/Api/CompoundResourceController.php Просмотреть файл

@@ -19,6 +19,7 @@ use App\Model\Module\Memo;
use App\Model\Module\Attachment;

use App\Jobs\StoreCompound;
use App\Jobs\StoreNotice;
use App\Jobs\StoreCompoundEPBT;
use App\Jobs\UpdateCompoundPrice;
use App\Http\Resources\CompoundResource;
@@ -339,7 +340,7 @@ class CompoundResourceController extends BaseController
}

/**
* Store a newly created resource in storage.
* Store a created compound from notice.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
@@ -418,14 +419,6 @@ class CompoundResourceController extends BaseController

$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();
if (!empty($compound)) {
@@ -570,6 +563,9 @@ class CompoundResourceController extends BaseController
}


/*********************************************
| Store a newly created notice
*********************************************/
public function storeNotice(Request $request)
{
$staff = Staff::with('StaffDetail')->where('api_token',$request->api_token)->first();
@@ -780,7 +776,7 @@ class CompoundResourceController extends BaseController
// }else{
// $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));

return $this->sendResponse($data, 'Berjaya simpan rekod notis!');
@@ -791,7 +787,7 @@ class CompoundResourceController extends BaseController
}

/**
* Store a newly created resource in storage.
* Store a newly created compound (parkir, KT, JPB).
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response

+ 61
- 0
app/Http/Controllers/Main/CompoundController.php Просмотреть файл

@@ -44,6 +44,7 @@ class CompoundController extends Controller
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();
@@ -51,6 +52,7 @@ class CompoundController extends Controller
$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();
@@ -59,6 +61,7 @@ class CompoundController extends Controller
}
$semua = $overall->total;
// $pre_notice = $n->total;
$baru = $b->total;
$invest = $pk->total;
$notice = $na->total;
@@ -75,12 +78,53 @@ class CompoundController extends Controller
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(){
$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();
@@ -88,6 +132,7 @@ class CompoundController extends Controller
$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();
@@ -96,6 +141,7 @@ class CompoundController extends Controller
}
$semua = $overall->total;
// $pre_notice = $n->total;
$baru = $b->total;
$invest = $pk->total;
$notice = $na->total;
@@ -118,6 +164,7 @@ class CompoundController extends Controller
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();
@@ -125,6 +172,7 @@ class CompoundController extends Controller
$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();
@@ -133,6 +181,7 @@ class CompoundController extends Controller
}
$semua = $overall->total;
// $pre_notice = $n->total;
$baru = $b->total;
$invest = $pk->total;
$notice = $na->total;
@@ -155,6 +204,7 @@ class CompoundController extends Controller
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();
@@ -162,6 +212,7 @@ class CompoundController extends Controller
$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();
@@ -170,6 +221,7 @@ class CompoundController extends Controller
}
$semua = $overall->total;
// $pre_notice = $n->total;
$baru = $b->total;
$invest = $pk->total;
$notice = $na->total;
@@ -192,6 +244,7 @@ class CompoundController extends Controller
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();
@@ -199,6 +252,7 @@ class CompoundController extends Controller
$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();
@@ -207,6 +261,7 @@ class CompoundController extends Controller
}
$semua = $overall->total;
// $pre_notice = $n->total;
$baru = $b->total;
$invest = $pk->total;
$notice = $na->total;
@@ -229,6 +284,7 @@ class CompoundController extends Controller
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();
@@ -236,6 +292,7 @@ class CompoundController extends Controller
$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();
@@ -244,6 +301,7 @@ class CompoundController extends Controller
}
$semua = $overall->total;
// $pre_notice = $n->total;
$baru = $b->total;
$invest = $pk->total;
$notice = $na->total;
@@ -264,6 +322,7 @@ class CompoundController extends Controller
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();
@@ -271,6 +330,7 @@ class CompoundController extends Controller
$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();
@@ -279,6 +339,7 @@ class CompoundController extends Controller
}
$semua = $overall->total;
// $pre_notice = $n->total;
$baru = $b->total;
$invest = $pk->total;
$notice = $na->total;

+ 4
- 2
resources/views/main-dashboard/compound/_part/menu_category.blade.php Просмотреть файл

@@ -25,9 +25,11 @@
</div>

<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>


+ 1
- 0
routes/web.php Просмотреть файл

@@ -73,6 +73,7 @@ Route::group(['middleware' => 'sysadminauth'], function () {
| 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/investigation', ['uses' => 'Main\CompoundController@investigation_index', 'as' => 'investL']);
Route::get('/main/compound/notice', ['uses' => 'Main\CompoundController@notice_index', 'as' => 'noticeL']);

Загрузка…
Отмена
Сохранить