public function searchDataCase()
 {
     $start_date = Input::get('start_date');
     $end_date = Input::get('end_date');
     // return $start_date;
     $datacase = DataCase::with('criminalhistory', 'criminalhistory.nametitle')->whereBetween('date_case', [$start_date, $end_date])->get();
     $person = CriminalHistory::with('datacase', 'nametitle')->whereBetween('date', [$start_date, $end_date])->get();
     $person_general = GuestHistory::with('nametitle')->whereBetween('date', [$start_date, $end_date])->get();
     $data = [$person, $person_general, $datacase];
     return $data;
 }
 public function printPhotoPerson($id)
 {
     //return $id;
     $guesthistory = GuestHistory::with('datachild', 'datachild', 'employee', 'employee', 'personfamily', 'personfamily', 'addresspresent', 'vehicle', 'addressoriginal', 'datafather', 'datamother', 'dataspouse', 'dataspouse', 'addressoffice')->find($id);
     Event::fire(new PrintPhotoDataPersonGeneralEvent($guesthistory));
     //   return $criminalhistory;
     //$pdf = \App::make('mpdf.wrapper',['ภาษา','ขนาดการดาษ-L=แนวนอน ไม่- แนวตั้ง','','',ขอบซ้ายกระดาษ,ขอบขวากระดาษ,ขอบขนกระดาษ,ขอบล่างกระดาษ,ระยะ title,ระยะ footter]);
     $pdf = \App::make('mpdf.wrapper', ['th', 'A4', '', '', 20, 15, 20, 25, 10, 10]);
     $pdf->setTitle("export_annoucement");
     $pdf->SetHeader('
     <table width="100%" style="vertical-align: bottom; font-family: TH SarabunPSK; font-size: 14pt; color: #000000; font-weight: bold; font-style: italic;"><tr>
     <td width="20%"></td>
     <td width="30%" style="text-align: right; "></td>
     <td width="55%" style="text-align: right; "> ตรวจคนเข้าเมืองจังหวัดเชียงราย</td>
     </tr></table>
     ');
     $user = Auth::user();
     $rank = $user->rank->rank;
     \Carbon\Carbon::setLocale('th');
     setlocale(LC_TIME, 'th_TH');
     $date = \Carbon\Carbon::now();
     $daymonth = $date->formatLocalized('%d/%m/');
     $year = $date->year + 543;
     $pdf->SetFooter("\n        <table width='100%' style='vertical-align: bottom; font-family: garuda; font-size: 8pt; color: #000000; font-weight: bold; font-style: italic;'><tr>\n      \n        <td width='45%'>พิมพ์โดย {$rank} {$user->name_police} {$user->surname_police}</td>\n        <td width='55%' style='text-align: right; '>พิมพ์เมื่อ {$daymonth}{$year}</td>\n        </tr></table>\n        ");
     $pdf->SetWatermarkText("");
     $pdf->SetDisplayMode('fullpage');
     $html = view('PDF.photo_person_general')->with('guesthistory', $guesthistory)->render();
     // return $html;
     $pdf->WriteHTML($html);
     $pdf->stream();
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($personId, $officeId)
 {
     $person = GuestHistory::find($personId);
     if ($officeId) {
         $addressoffice = AddressOffice::find($officeId)->delete();
         return $person;
     } else {
         return null;
     }
 }
 public function searchDataCase()
 {
     $start_date = Input::get('start_date');
     $end_date = Input::get('end_date');
     // return $start_date;
     $datacase = DataCase::with('criminalhistory', 'criminalhistory.nametitle')->whereBetween('date_case', [$start_date, $end_date])->get();
     $person = CriminalHistory::with('datacase', 'nametitle')->whereBetween('date', [$start_date, $end_date])->get();
     $person_general = GuestHistory::with('nametitle')->whereBetween('created_at', [$start_date, $end_date])->get();
     $data = [$person, $person_general, $datacase];
     $start_date = Input::get('start_date');
     $end_date = Input::get('end_date');
     // return $start_date;
     $datacase = DataCase::with('criminalhistory', 'criminalhistory.nametitle')->whereBetween('date_case', [$start_date, $end_date])->get();
     $person = CriminalHistory::with('datacase', 'nametitle')->whereBetween('date', [$start_date, $end_date])->get();
     $person_general = GuestHistory::with('nametitle')->whereBetween('created_at', [$start_date, $end_date])->get();
     $data = [$person, $person_general, $datacase];
     $pdf = \App::make('mpdf.wrapper', ['th', 'A4', '', '', 20, 15, 20, 25, 10, 10]);
     $pdf->SetHeader('
     <table width="100%" style="vertical-align: bottom; font-family: TH SarabunPSK; font-size: 14pt; color: #000000; font-weight: bold; font-style: italic;"><tr>
     <td width="20%"><img src="img/police.jpg" width="20" height="20"></td>
     <td width="30%" style="text-align: right; ">{PAGENO}</td>
     <td width="55%" style="text-align: right; "> สำนักงานตำรวจตรวจคนเข้าเมือง จังหวัด เชียงราย</td>
     </tr></table>
     ');
     $pdf->SetFooter('
     <table width="100%" style="vertical-align: bottom; font-family: garuda; font-size: 8pt; color: #000000; font-weight: bold; font-style: italic;"><tr>
     <td width="33%"></td>
     <td width="33%"></td>
     <td width="55%" style="text-align: right; ">พิมพ์เมื่อ {DATE D} ที่ {DATE j-m-Y} เวลา {DATE H:i:s}  </td>
     </tr></table>
     ');
     $pdf->SetWatermarkText("");
     $pdf->SetDisplayMode('fullpage');
     $html = view('PDF.statistic')->with('data', $data)->render();
     //        return $html;
     $pdf->WriteHTML($html);
     return $data;
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($personId, $vehicleId)
 {
     $person = GuestHistory::find($personId);
     if ($vehicleId) {
         $vehicle = Vehicle::find($vehicleId)->delete();
         return $person;
     } else {
         return null;
     }
 }
 public function searchIdCardPersonGeneral()
 {
     $idcard_keyword = Input::get('idcard');
     $person_general = GuestHistory::with('datachild', 'datachild.nametitle', 'employee', 'employee.nametitle', 'personfamily', 'personfamily.nametitle', 'addresspresent', 'vehicle', 'addressoriginal', 'datafather', 'datamother', 'dataspouse', 'dataspouse.nametitle', 'nametitle', 'addressoffice')->where(function ($q) use($idcard_keyword) {
         return $q->where('idcard', '=', "{$idcard_keyword}");
     })->get();
     //        $dataperson = CriminalHistory::with('nametitle','addresspresent',
     //            'addressoriginal','datafather','datamother','dataspouse','dataspouse.nametitle','datachild','datachild.nametitle'
     //            ,'addressoffice')->find($person);
     return $person_general;
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($personId, $childId)
 {
     $person = GuestHistory::find($personId);
     if ($childId) {
         $datachild = DataChild::find($childId)->delete();
         return $person;
     } else {
         return null;
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($personId, $personFamilyId)
 {
     $person = GuestHistory::find($personId);
     if ($personFamilyId) {
         $personFamily = PersonFamily::find($personFamilyId)->delete();
         return $person;
     } else {
         return null;
     }
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function edit($id)
 {
     return GuestHistory::find($id);
 }