Пример #1
0
 public function index()
 {
     $allAtk = Atk::all();
     foreach ($allAtk as $atk) {
         $atk['itemCount'] = $this->atkService->getItemCount($atk);
     }
     return view('atk.index', ['atkList' => $allAtk]);
 }
Пример #2
0
 public function haveSufficientItem(array $pemakaianRecords)
 {
     $atkService = new AtkService();
     foreach ($pemakaianRecords as $pemakaianRecord) {
         $atk = Atk::find($pemakaianRecord['atk_id']);
         $itemAvailable = $atkService->getItemCount($atk);
         if ($itemAvailable < $pemakaianRecord['jumlah']) {
             return false;
         }
     }
     return true;
 }
 public function showUser(Request $request)
 {
     $startdate = $request->input('startdate');
     $enddate = $request->input('enddate');
     $allAtk = Atk::all();
     $allUser = User::all();
     $allUserAtk = [];
     foreach ($allUser as $user) {
         $atkList = [];
         foreach ($allAtk as $atk) {
             $atkTemp = clone $atk;
             $atkTemp['stokCount'] = $this->statistikService->getAtkPerUser($atk, $startdate, $enddate, $user->id);
             if ($atkTemp['stokCount'] > 0) {
                 $atkList[] = $atkTemp;
             }
         }
         $allUserAtk[] = [$user, $atkList];
     }
     return view('statistik.user', ['allUserAtk' => $allUserAtk, 'startDate' => $startdate, 'endDate' => $enddate]);
 }
 public function add()
 {
     $supplierList = Supplier::all();
     $atkList = Atk::all();
     return view('pengadaan.add', ['supplierList' => $supplierList, 'atkList' => $atkList]);
 }
 public function add()
 {
     $userList = User::all();
     $atkList = Atk::all();
     return view('pemakaian.add', ['userList' => $userList, 'atkList' => $atkList]);
 }
Пример #6
0
 public function save($jenis)
 {
     $atk = new Atk();
     $atk->jenis = $jenis;
     $atk->save();
 }