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;
     $criminalhistory = CriminalHistory::with('nametitle')->find($id);
     //   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");
     $pdf->SetWatermarkText("TEST");
     $pdf->SetDisplayMode('fullpage');
     $html = view('PDF.photo_person')->with('criminalhistory', $criminalhistory)->render();
     // return $html;
     $pdf->WriteHTML($html);
     $pdf->stream();
 }
Esempio n. 3
0
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/test', 'WelcomeController@test');
Route::get('/pdfrank', 'WelcomeController@pdfrank');
Route::get('/profile', 'WelcomeController@typecase');
Route::get('/test', function () {
    $criminalhistory = \App\Models\CriminalHistory::with('datacase.cases.typecase', 'typepeople', 'sex', 'addresspresent', 'addressoriginal', 'datafather', 'datamother', 'dataspouse', 'datachild', 'addressoffice')->find(8);
    return View('test3')->with('criminalhistory', $criminalhistory);
});
Route::get('/pdf', function () {
    $profile = App\Models\DataCase::with('criminalhistory')->find(29);
    return $profile;
    //$pdf = \App::make('mpdf.wrapper',['ภาษา','ขนาดการดาษ-L=แนวนอน ไม่- แนวตั้ง','','',ขอบซ้ายกระดาษ,ขอบขวากระดาษ,ขอบขนกระดาษ,ขอบล่างกระดาษ,ระยะ title,ระยะ footter]);
    $pdf = \App::make('mpdf.wrapper', ['th', 'A4', '', '', 20, 15, 20, 25, 10, 10]);
    $pdf->SetWatermarkText("TEST");
    $pdf->SetDisplayMode('fullpage');
    $html = view('test')->with('profile', $profile)->render();
    $pdf->WriteHTML($html);
    $pdf->stream();
});
Route::get('/testqq', function () {
    $type = App\Models\TypeCase::with('cases')->find(5);
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($personId, $childId)
 {
     $person = CriminalHistory::find($personId);
     if ($childId) {
         $datachild = DataChild::find($childId)->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, $officeId)
 {
     $person = CriminalHistory::find($personId);
     if ($officeId) {
         $addressoffice = AddressOffice::find($officeId)->delete();
         return $person;
     } else {
         return null;
     }
 }
 public function generatedPdfPerson($id)
 {
     $criminalhistory = CriminalHistory::with('datacase', 'nametitle', 'addresspresent', 'addressoriginal', 'datafather', 'datamother', 'dataspouse', 'datachild', 'addressoffice', 'datacase.vehicle', 'datacase.weapon')->find($id);
     Event::fire(new PrintPdfDataPersonCrimeEvent($criminalhistory));
     //return $dataperson;
     //$pdf = \App::make('mpdf.wrapper',['ภาษา','ขนาดการดาษ-L=แนวนอน ไม่- แนวตั้ง','','',ขอบซ้ายกระดาษ,ขอบขวากระดาษ,ขอบขนกระดาษ,ขอบล่างกระดาษ,ระยะ title,ระยะ footter]);
     //return $datacase;
     $pdf = \App::make('mpdf.wrapper', ['th', 'A4', '', '', 20, 15, 20, 25, 10, 10]);
     //$pdf->SetHeader('|{PAGENO}/{nbpg}|สำนักงานตำรวจตรวจคนเข้าเมือง จังหวัด เชียงราย');
     // $pdf->SetFooter('พิมพ์เมื่อ วัน {DATE D} ที่ {DATE j-m-Y} เวลา {DATE H:i:s}  ');
     $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.personOne')->with('dataperson', $criminalhistory)->render();
     //return $html;
     $pdf->WriteHTML($html);
     $pdf->stream();
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($caseId, $personId)
 {
     /* @var Datacase $case */
     $case = DataCase::find($caseId);
     $person = CriminalHistory::find($personId);
     if ($person) {
         $case->criminalhistory()->detach($person->id);
         return $case;
     } else {
         return null;
     }
 }
 public function generatedPdfPerson($id)
 {
     $criminalhistory = CriminalHistory::find($id);
     $idcard = $criminalhistory->idcard;
     $datacasesPerson = CriminalHistory::with('datacase', 'addresspresent', 'addressoriginal', 'datafather', 'datamother', 'dataspouse', 'datachild', 'addressoffice', 'datacase.vehicle', 'datacase.weapon')->where(function ($q) use($idcard) {
         return $q->where('idcard', '=', "{$idcard}");
     })->get();
     $criminalhistory = CriminalHistory::with('datacase', 'addresspresent', 'addressoriginal', 'datafather', 'datamother', 'dataspouse', 'datachild', 'addressoffice', 'datacase.vehicle', 'datacase.weapon')->find($id);
     Event::fire(new PrintPdfDataPersonCrimeEvent($criminalhistory));
     //return $dataperson;
     //$pdf = \App::make('mpdf.wrapper',['ภาษา','ขนาดการดาษ-L=แนวนอน ไม่- แนวตั้ง','','',ขอบซ้ายกระดาษ,ขอบขวากระดาษ,ขอบขนกระดาษ,ขอบล่างกระดาษ,ระยะ title,ระยะ footter]);
     //return $datacase;
     $pdf = \App::make('mpdf.wrapper', ['th', 'A4', '', '', 20, 15, 20, 25, 10, 10]);
     $pdf->setTitle("export");
     //$pdf->SetHeader('|{PAGENO}/{nbpg}|สำนักงานตำรวจตรวจคนเข้าเมือง จังหวัด เชียงราย');
     // $pdf->SetFooter('พิมพ์เมื่อ วัน {DATE D} ที่ {DATE j-m-Y} เวลา {DATE H:i:s}  ');
     $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; ">{PAGENO}</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.personOne')->with('dataperson', $criminalhistory)->with('datacases', $datacasesPerson)->render();
     //return $html;
     $pdf->WriteHTML($html);
     $pdf->stream();
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($personId, $employeeId)
 {
     $person = CriminalHistory::find($personId);
     if ($employeeId) {
         $employee = Employee::find($employeeId)->delete();
         return $person;
     } else {
         return null;
     }
 }