Browse Source

modul 02

master
Siti Rahayu 4 years ago
parent
commit
119ba4f7ff
1 changed files with 6 additions and 6 deletions
  1. 6
    6
      app/Console/Commands/CalculateStatisticCompound.php

+ 6
- 6
app/Console/Commands/CalculateStatisticCompound.php View File

} }
//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';
} }


//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')->orWhere('modul','02')->where('status','Belum Bayar')->get());
$b2->save(); $b2->save();
}else { }else {
$dataJB1 = new ReportOverallCompound; $dataJB1 = new ReportOverallCompound;
$dataJB1->total = count(Compound::where('jbkod',$d->_id)->where('modul','03')->where('status','Belum Bayar')->get());
$dataJB1->total = count(Compound::where('jbkod',$d->_id)->where('modul','03')->orWhere('modul','02')->where('status','Belum Bayar')->get());
$dataJB1->status = 'Belum Bayar'; $dataJB1->status = 'Belum Bayar';
$dataJB1->department = $d->_id; $dataJB1->department = $d->_id;
$dataJB1->modul = '03'; $dataJB1->modul = '03';

Loading…
Cancel
Save