Exemplo n.º 1
0
 public function syncdata()
 {
     $sync = Input::get('Sync');
     if ($sync) {
         $response["error"] = "false";
         $EquipmentDetails = Equipment::all();
         foreach ($EquipmentDetails as $index => $equip) {
             $response["Equipment"][$index]["Ecode"] = $equip->Ecode;
             $response["Equipment"][$index]["Value"] = $equip->Name;
         }
         $MaintainenceDetails = Maintainence::all();
         foreach ($MaintainenceDetails as $index => $Maintain) {
             $response["Maintainence"][$index]["Ecode"] = $Maintain->Ecode;
             $response["Maintainence"][$index]["Value"] = $Maintain->Name;
         }
         return json_encode($response);
     }
 }
Exemplo n.º 2
0
 public function report()
 {
     $assetcode = Input::get('assetcode');
     $operator = Input::get('username');
     $AssetDet = AssetCodes::where('assetcode', $assetcode)->first();
     $Ecode = $AssetDet->Ecode;
     $MachineDet = Equipment::where('Ecode', $Ecode)->first();
     $MachineName = $MachineDet->Name;
     $Maintain = Maintainence::where('Ecode', $Ecode)->get();
     foreach ($Maintain as $index => $maintain) {
         $MachineDesc[] = $maintain->Name;
     }
     $query = "SELECT * FROM " . $MachineName . " WHERE AssetCode ='" . $assetcode . "'";
     $Details = DB::connection('mysql2')->select($query);
     foreach ($Maintain as $i => $maintain) {
         $desc = $MachineDesc[$i];
         $Machvalue[] = $Details[0]->{$desc};
     }
     return view('report', compact('assetcode', 'operator', 'Maintain', 'AssetDet', 'MachineDesc', 'Machvalue'));
 }
 public function addpage()
 {
     $Equip = Equipment::all();
     $lastmain = Maintainence::orderBy('mnid', 'desc')->first();
     return view('maintainence.add', compact('Equip', 'lastmain'));
 }