From 991d39e0f57275719731a4d4f3ec037de2d385d2 Mon Sep 17 00:00:00 2001 From: Velz2020 Date: Tue, 31 Dec 2019 17:58:30 +0530 Subject: [PATCH] IMAGE PDF --- api/application/controllers/PD_Controller.php | 13 +++++++++---- .../views/report_templates/JSONTOREPORT_SAL.php | 4 ++-- .../views/report_templates/PDIMG_PDF.php | 10 +++++----- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index a26181a3..83e1cd01 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -4845,7 +4845,7 @@ public function getPDFormDetailsJSON_post() $pdid = $records['pd_id']; $random_string = $records['random_string']; $pd_master_details = $this->PD_Model->getPDMasterDetails($pdid,$random_string); - + set_time_limit(60); if(!file_exists($this->external_path.'/pd_reports/'.$pdid)) { mkdir($this->external_path.'/pd_reports/'.$pdid,0777); @@ -4883,8 +4883,13 @@ public function getPDFormDetailsJSON_post() // } $data_to_view['all_pd_images'] = $all_pd_images; $img_pdf_data = $this->load->view('report_templates/PDIMG_PDF',$data_to_view,true); - print_r($img_pdf_data);die(); - $bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>($this->external_path.'/pd_reports/'.$pdid.'/'.$temp_path)); + //print_r($img_pdf_data);die(); + $pdf_doc = $this->pdfgenerator->generate($img_pdf_data, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait"); + //End of PDF Gen using DOM PDF + $output_file2 = $this->external_path ."/pd_reports/" . $pdid . "/pd_images_pdf.pdf"; + $ti = file_put_contents($output_file2, $pdf_doc); + + $bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>($output_file2)); $s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data); //print_r($s3result); @@ -4894,7 +4899,7 @@ public function getPDFormDetailsJSON_post() $where_condition_array = array("pd_id" => $pdid); $temp_array['is_zip_created'] = 1; $id = $this->PD_Model->updateRecords($temp_array,PDTRIGGER,$where_condition_array); - - unlink($this->external_path.'/pd_reports/'.$pdid.'/'.$temp_path); + unlink($output_file2); } diff --git a/api/application/views/report_templates/JSONTOREPORT_SAL.php b/api/application/views/report_templates/JSONTOREPORT_SAL.php index 559e7d44..761c9201 100644 --- a/api/application/views/report_templates/JSONTOREPORT_SAL.php +++ b/api/application/views/report_templates/JSONTOREPORT_SAL.php @@ -1146,7 +1146,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); echo !($employeement_data['total_business_experience'] == $employeement_data['how_long_year'])? ("

Out of ".$employeement_data['total_business_experience']." Yr(s) of total experience, t") :"

T"; echo "he applicant has served ". $employeement_data['how_long_year'] ." Years ".($employeement_data['how_long_month'] ? ' and '.$employeement_data['how_long_month'].' months' : '' )." as employee in this firm." ; echo $employeement_data['total_business_previous_experience'] ? ("
Previous Work Experience : ".$employeement_data['total_business_previous_experience']) : '';echo "

"; - echo "

During PD visit, ". ($employeement_data['was_met'] == 'no'? 'the employer was not met.' : $employeement_data['name_person_met'].' '.$employeement_data['designation_person_met'] .' of the firm has been met'); + echo "

During PD visit, ". ($employeement_data['was_met'] == 'no'? 'the employer was not met.' : $employeement_data['name_person_met'].' '.$employeement_data['designation_person_met_master'] .' the firm has been met'); echo ($employeement_data['confirm_salary'] == 'no'? ' and salary amount was not confirmed because '.$employeement_data['sal_amount_was_not_confirmed'] : ' and '.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($employeement_data['confirm_salary_amount']).' ('.(MYUTIL::numtowords($employeement_data['confirm_salary_amount'])).') was confirmed as salary.'); if($employeement_data['attendance_seen'] == $employeement_data['sal_reg_seen'] ) { @@ -1184,7 +1184,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); echo $employeement_data['net_monthly_salary'] == 'Yes' ? 'there is a delay in salary payment.' : 'Generally there is no delay in salary payment.'; echo "

"; - echo $employeement_data['bonus_incentive'] ? "The applicant receives a bonus ( ".($employeement_data['bonus_type'] == 'others' ? $employeement_data['bonus_type_other']: $employeement_data['bonus_type']).") of ".$rupee_symbol." ".MYUTIL::customIndianNumberFormat($employeement_data['bonus_incentive'])." ( " .MYUTIL::numtowords($employeement_data['bonus_incentive']).") "." ".$employeement_data['bonus_frequency'].'.': ''; + echo $employeement_data['bonus_incentive'] ? "The applicant receives a bonus ( ".($employeement_data['bonus_type'] == 'others' ? $employeement_data['bonus_type_other']: $employeement_data['bonus_type']).") of ".$rupee_symbol." ".MYUTIL::customIndianNumberFormat($employeement_data['bonus_incentive'])." ( " .MYUTIL::numtowords($employeement_data['bonus_incentive']).") "." ".$employeement_data['bonus_frequency_master'].'.': ''; echo "

"; echo "

".$employeement_data['id_card_issued_company'] == 'yes' ? 'ID card issued by employer was seen by PD officer.(image attatched end of the report)': 'ID card issued by employer was not seen by PD officer.'."

"; //echo "
***********************************"; diff --git a/api/application/views/report_templates/PDIMG_PDF.php b/api/application/views/report_templates/PDIMG_PDF.php index 72271d74..e83d63e4 100644 --- a/api/application/views/report_templates/PDIMG_PDF.php +++ b/api/application/views/report_templates/PDIMG_PDF.php @@ -502,19 +502,19 @@ defined('BASEPATH') OR exit('No direct script access allowed'); //$all_pd_images_count = count($all_pd_images); $img_row_count = ceil(count($all_pd_images) / 3); - if(count($all_pd_images)){ echo '
'; echo '

PD Photograph`s :

'; echo '
'; echo ''; - + $add_factor = 0; for($img_row = 0; $img_row < $img_row_count; $img_row++) { - if($img_row > 0) { break; } + //if($img_row > 0) { break; } echo ''; - $from = $img_row == 0 ? $img_row : ($img_row+2); + $from = $img_row == 0 ? $img_row : ($img_row+$add_factor); $to = ($from + 2); + $add_factor = $add_factor + 2; for($photo_iter = $from; $photo_iter <= $to;$photo_iter++) { @@ -526,7 +526,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); echo '
'.$all_pd_images[$photo_iter]['pd_document_title'] .'
'; echo ''; echo ''; - unset($all_pd_images[$photo_iter]); + // unset($all_pd_images[$photo_iter]); } }