WATER MARK

This commit is contained in:
Velz2020 2021-02-01 00:31:11 +05:30
parent f8fd727a68
commit f2d7f61fec
11 changed files with 2028 additions and 24 deletions

View File

@ -36,7 +36,7 @@ $config['api_user_auth_info'] = array(
//'updatePDMaster' => array(1,2,3,10,11,12,13,1,15,16,17,18,19,20),
'updatePDDocs' => array(1,2,3,10,11,12,13,1,15,16,17,18,19,20),
'updatePDApplicants' => array(1,2,3,10,11,12,13,1,15,16,17,18,19,20),
'allocatePD' => array(2,3,4,5,10,21,22,25,26),
'allocatePD' => array(2,3,4,5,10,21,22,25,26,20),
'schdulePD' => array(2,3,4,5,21,10,22,21),
'generatePDReport' => array(3,6,7,10),
'savePDPhotos' => array(3,4,5,6,7,10,21,22),

View File

@ -24,3 +24,10 @@ $hook['pre_controller'][] = array(
'filename' => 'ExceptionHook.php',
'filepath' => 'hooks'
);
$hook['post_system'][] = array(
'class' => 'waterMarkHook',
'function' => 'initializeWaterMarkProcess',
'filename' => 'waterMarkHook.php',
'filepath' => 'hooks'
);

View File

@ -238,6 +238,7 @@ $route['saveApplicantImgFromVendorForm'] = 'PD_Controller/saveApplicantImgFromVe
$route['loadCreditPDTemplate'] = 'PD_Controller/loadCreditPDTemplate';
$route['saveRoomInfo'] = 'PD_Controller/saveRoomInfo';
$route['updateTwlioVideoStatus'] = 'PD_Controller/updateTwlioVideoStatus';
$route['checkAfterResponse'] = 'PD_Controller/checkAfterResponse';
// $route['getPDFormDetailsJSON'] = 'PD_Controller/getPDFormDetailsJSON';
$route['smartyTestFunction'] = 'PD_Controller/smartyTestFunction';

View File

@ -5085,8 +5085,9 @@ public function getPDFormDetailsJSON_post()
$records = $this->post('records');
$pdid = $records['pd_id'];
$random_string = $records['random_string'];
$regenerate = isset($records['regenerate']) ? $records['regenerate'] : 0;
$this->load->helper('photo_zip_creator');
$res_data = (new photo_zip_creator)->covertImgs2ZIP($pdid,$random_string);
$res_data = (new photo_zip_creator)->covertImgs2ZIP($pdid,$random_string,array(),$regenerate);
$response_data['dataStatus'] = true;
$response_data['status'] = REST_Controller::HTTP_OK;
@ -5105,7 +5106,9 @@ public function getPDFormDetailsJSON_post()
$pdid = $records['pd_id'];
$random_string = $records['random_string'];
$res_data = (new photo_pdf_converter)->covertImgs2PDF($pdid,$random_string);
$regenerate = isset($records['regenerate']) ? $records['regenerate'] : 0;
$res_data = (new photo_pdf_converter)->covertImgs2PDF($pdid,$random_string,array(),$regenerate);
$response_data['dataStatus'] = true;
@ -7359,7 +7362,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
$data['records'] = $res['count'];
$data['uri'] = $res['records'];
$data['msg'] = $res['msg'];
$this->response($data,REST_Controller::HTTP_OK);
$this->response($data,REST_Controller::HTTP_OK,true);
}
else
{
@ -7406,6 +7409,10 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
EXTERNAL_DIR_CHECK::checkExternalDirectory($pd_id);
foreach($data as $iter => $doc)
{
//make location for water mark helper function
$this->location_for_watermark = $doc['link'];
$temp_base64_string = $doc['image'];
$title = $doc['Name'];
$is_show_report = isset($doc['is_show_report']) ? $doc['is_show_report'] : null;
@ -7418,7 +7425,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
$co_applicant_id = isset($doc['co_applicant_id']) ? $doc['co_applicant_id'] : null;
$img_type = isset($doc['img_type']) ? $doc['img_type'] : null;
$output_file = $this->external_path."/pd_reports/". $pd_id ."/temp_base64_image.jpeg";
$this->temp_path_for_watermark = $output_file;
//Generate Random File Name
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
@ -7476,6 +7483,9 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
$sourcefile = $tempdoc;
$bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$sourcefile);
//this line make this bucket data values in obj level so can access in helpers and hook files
$this->bucket_data_for_watermark = $bucket_data;
$s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
@ -7486,6 +7496,8 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
$id = $this->PD_Model->saveRecords($record_data,PDDOCUMENTS);
if($id != null || $id != "") { $count++; $pks[] = $id;}
$uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,$time = '+1 week');
$this->img_url_for_watermark = $uri;
//print_r($uri);
}
@ -10975,6 +10987,17 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
$this->response($data,REST_Controller::HTTP_OK);
}
}
public function checkAfterResponse_post()
{
$this->myvariable = 10;
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
$data['msg'] = 'No Data File Found!';
$this->response($data,REST_Controller::HTTP_OK,true);
// echo 'Hi';
}

View File

@ -1481,7 +1481,8 @@ public function filterSalesPDList_post() {
//score card part
$score_card_questions = $this->seperateScorecardQuestions($view_data);
$view_data['pd_score'] = SMCPDSCORE::genericDIPDScoreCalculate($score_card_questions,$view_data['pd_master_details']);
$final_score = $view_data['pd_score']['score_summary']['overall_score']['final_score'];
$final_score = round($view_data['pd_score']['score_summary']['overall_score']['final_score'],1);
// echo $final_score;die();
//GET phantom script from DB
$phantom_script = $this->PD_Model->selectCustomRecords(array('*'),array('script_name' => PHANTOMJSSCRIPT_LOCATION),SCRIPTS);

View File

@ -8,7 +8,7 @@ class photo_pdf_converter
//$CI =&get_instance();
}
public function covertImgs2PDF($pdid,$random_string,$pd_master_details = array())
public function covertImgs2PDF($pdid,$random_string,$pd_master_details = array(),$regenerate = 0)
{
//echo 'this is from daiu';
$CI =&get_instance();
@ -33,7 +33,7 @@ class photo_pdf_converter
$key = 'pd'.$pdid.'/'.$main_applicant_name.'_'.$pdid.'_'.'pd_images.pdf';
//$singed_uri = $CI->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes');
if($pd_master_details[0]['is_img_pdf_created'])
if($pd_master_details[0]['is_img_pdf_created'] && ($regenerate == 0))
{
return $singed_uri = $CI->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+7 days');

View File

@ -8,7 +8,7 @@ class photo_zip_creator
//$CI =&get_instance();
}
public function covertImgs2ZIP($pdid,$random_string,$pd_master_details = array())
public function covertImgs2ZIP($pdid,$random_string,$pd_master_details = array(),$regenerate = 0)
{
//echo 'this is from daiu';
$CI =&get_instance();
@ -33,7 +33,7 @@ class photo_zip_creator
$key = 'pd'.$pdid.'/'.$main_applicant_name.'_'.$pdid.'_'.'pd_images.zip';
//$singed_uri = $CI->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes');
if($pd_master_details[0]['is_zip_created'])
if($pd_master_details[0]['is_zip_created'] && ($regenerate == 0))
{
return $singed_uri = $CI->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes');

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
<?php
class waterMarkHook
{
function initializeWaterMarkProcess()
{
log_message('ERROR','### watermark hook called');
$CI =&get_instance();
if($CI->router->class == 'PD_Controller' && ($CI->router->method == 'checkAfterResponse' || $CI->router->method == 'savePDPhotos'))
{
$CI->load->helper('watermark');
// $sourceFilePath = 'C:\Users\Venba\Pictures\1canvas.png';
watermark::makeWatermark();
}
}
}

View File

@ -1185,7 +1185,8 @@ class PD_Model extends SPARQ_Model {
$pd_master_detials = $this->getPDMasterDetails($pdid,$random_string);
$pd_additional_requirements = $this->getPDAdditionalRequirements($pdid);
$docs_to_be_collected = $this->getDocsToBeCollected($pdid);
$over_all_photocount = $this->PD_Model->selectCustomRecords(array('*'),array('fk_pd_id' => $pdid,'isactive' => 1),PDDOCUMENTS);
//echo count($docs_to_be_collected);die();
$pd_applicants_detials = $this->getApplicantsDetails($pdid);
@ -1208,7 +1209,7 @@ class PD_Model extends SPARQ_Model {
}
$this->db->ORDER_BY('PDFORMS.pd_form_order');
$template_forms = $this->db->GET()->result_array();
//print_r($this->db->last_query());die();
// print_r($template_forms);die();
$level_one_status = 0;
$level_one_total = 0;
$level_two_status = 0;
@ -1241,7 +1242,11 @@ class PD_Model extends SPARQ_Model {
if($value['pd_form_level_order'] == 1){ $level_one_total++;}
else if($value['pd_form_level_order'] == 2){$level_two_total++;}
}
//make photo section always answerable true
if($value['form_id'] == 26)
{
$template_forms[$template_key]['isAnswered'] = true;
}
if($value['pd_form_level_order'] == 1)
{
$template_forms[$template_key]['isAnswerable'] = true;

View File

@ -798,7 +798,7 @@ $business_pd_visited_remark = (isset($pd_section_data[8]['business_pd_visited_re
echo '<br><br><table class="scorecard_table"><tr> <td class = "tdcenteralign" colspan="1">Business Assets Remarks - '.$pd_section_data[8]['common_remarks'].' </td></tr></table>';
}?>
<?php if(true){ ?>
<div id="page_break"></div>
<table class="scorecard_table">
<tbody>
@ -856,7 +856,7 @@ $business_pd_visited_remark = (isset($pd_section_data[8]['business_pd_visited_re
{
if(is_numeric($fy_key))
{
echo '<td colspan="1" class="tdcenteralign">'.$rupee_symbol.' '. MYUTIL::customIndianNumberFormat($fy_value['net_profit']).'</td>';
echo '<td colspan="1" class="tdcenteralign">'.($fy_value['net_profit'] != '' ? $rupee_symbol.' '. MYUTIL::customIndianNumberFormat($fy_value['net_profit']) : '-').'</td>';
}
}
?>
@ -871,7 +871,7 @@ $business_pd_visited_remark = (isset($pd_section_data[8]['business_pd_visited_re
if(is_numeric($fy_key))
{
// echo '<td colspan="1" class="tdcenteralign">'.round((($fy_value['net_profit'] / $fy_value['sales_revenue'] ) * 100 ),2).'%</td>';
echo '<td colspan="1" class="tdcenteralign">'.($fy_value['net_profit_sales_percent']).'</td>';
echo '<td colspan="1" class="tdcenteralign">'.($fy_value['net_profit_sales_percent'] != '' ? $fy_value['net_profit_sales_percent'] : '-').'</td>';
}
}
?>
@ -966,7 +966,7 @@ $business_pd_visited_remark = (isset($pd_section_data[8]['business_pd_visited_re
{
if(is_numeric($fy_key))
{
echo '<td colspan="1" class="tdcenteralign">'.number_format($fy_value['debtor_days_cet'],2,'.','') .'</td>';
echo '<td colspan="1" class="tdcenteralign">'.($fy_value['debtor_days_cet'] != '' ? number_format($fy_value['debtor_days_cet'],2,'.','') : '-') .'</td>';
}
}
?>
@ -979,7 +979,7 @@ $business_pd_visited_remark = (isset($pd_section_data[8]['business_pd_visited_re
{
if(is_numeric($fy_key))
{
echo '<td colspan="1" class="tdcenteralign">'.number_format($fy_value['creditor_days_cet'],2,'.','') .'</td>';
echo '<td colspan="1" class="tdcenteralign">'.($fy_value['creditor_days_cet'] != '' ? number_format($fy_value['creditor_days_cet'],2,'.','') : '-') .'</td>';
}
}
?>
@ -992,7 +992,7 @@ $business_pd_visited_remark = (isset($pd_section_data[8]['business_pd_visited_re
{
if(is_numeric($fy_key))
{
echo '<td colspan="1" class="tdcenteralign">'.number_format($fy_value['inventory_days_cet'],2,'.','') .'</td>';
echo '<td colspan="1" class="tdcenteralign">'.( $fy_value['inventory_days_cet'] != '' ? number_format($fy_value['inventory_days_cet'],2,'.','') : '-') .'</td>';
}
}
?>
@ -1007,7 +1007,7 @@ $business_pd_visited_remark = (isset($pd_section_data[8]['business_pd_visited_re
<table class="scorecard_table">
<tbody>
<?php echo '<tr> <td>Sales / Revenue ('.$rupee_symbol.') </td><td class="tdcenteralign">'.$rupee_symbol.' '. MYUTIL::customIndianNumberFormat($pd_section_data[10]['sales_amount']) .'</td> </tr>'?>
<?php echo '<tr> <td>Net Profit or (Net Loss) to Sales % </td><td class="tdcenteralign">'. $pd_section_data[10]['net_profit_to_sales_percent'] .'</td> </tr>'?>
<?php echo '<tr> <td>Net Profit or (Net Loss) to Sales % </td><td class="tdcenteralign">'. ( $pd_section_data[10]['net_profit_to_sales_percent'] != ''? $pd_section_data[10]['net_profit_to_sales_percent'] : '-').'</td> </tr>'?>
<?php echo '<tr> <td>Net Profit / (Net Loss) ('.$rupee_symbol.') </td><td class="tdcenteralign">'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($pd_section_data[10]['net_profit_rs']) .'</td> </tr>'?>
</tbody>
@ -1035,8 +1035,8 @@ $business_pd_visited_remark = (isset($pd_section_data[8]['business_pd_visited_re
</tbody>
</table>
<div id="page_break"> </div>
<?php } ?>
<div id="page_break"> </div>
<table class="scorecard_table">
<tr><th class="thlargefont">Supplier Details</th></tr>
</table>
@ -1170,11 +1170,13 @@ Business run by the applicant</td><td colspan="4"><?php echo $pd_section_data[1
<br>
<?php if(true){ ?>
<table class="scorecard_table" style="table-layout: fixed">
<tbody>
<tr>
<th class="thlargefont" colspan="8">Business Banking & Personal Banking</th>
</tr>
<?php if(count($pd_section_data[9]['banking_details']) && ($pd_section_data[9]['banking_details'][0]['applicant_name'] != '' && $pd_section_data[9]['banking_details'][0]['bank_name'] != '') ){?>
<tr>
<th colspan="1">Sr. No.</th>
<th colspan="2">Account Holder's Name</th>
@ -1208,9 +1210,14 @@ Business run by the applicant</td><td colspan="4"><?php echo $pd_section_data[1
// echo '<td class="tdcenteralign" colspan="4">'.( ucfirst($pd_section_data[13]['estimated_uom']) ) .'</td></tr>';
// }
}
}
else//if no count
{
echo '<tr><td class="tdcenteralign" colspan="8"> Banking Details Not Available</td>';
}
?>
</tbody></table>
<?php } ?>
<br>
@ -1246,6 +1253,7 @@ Business run by the applicant</td><td colspan="4"><?php echo $pd_section_data[1
<th>Existing Loan Obligations</th>
</tr>
< /table>-->
<?php if(true){ ?>
<div id="page_break"> </div>
<table class="scorecard_table">
@ -1253,6 +1261,7 @@ Business run by the applicant</td><td colspan="4"><?php echo $pd_section_data[1
<tr>
<th colspan="10">Existing Loan Obligations</th>
</tr>
<?php if(count($pd_section_data[15]['existing_loan_details']) && ($pd_section_data[15]['existing_loan_details'][0]['loan_type'] != '' && $pd_section_data[15]['existing_loan_details'][0]['lender_name'] != '' && $pd_section_data[15]['existing_loan_details'][0]['loan_amount'] != '')){?>
<tr>
<th colspan="1">Sr. No.</th>
<th colspan="1">Loan<br>Type</th>
@ -1274,6 +1283,11 @@ Business run by the applicant</td><td colspan="4"><?php echo $pd_section_data[1
echo '<tr><td class="tdcenteralign">'. ($key15 + 1) .'</td><td>'. $value15['loan_type'] .'</td><td>'.$rupee_symbol.MYUTIL::customIndianNumberFormat($value15['loan_amount']).'</td><td>'.$value15['lender_name'].'</td><td>'.$value15['loan_taken_by'].'</td><td class="tdcenteralign">'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($value15['instalment_amount']).'</td><td class="tdcenteralign">'.$value15['instalment_frequency'].'</td><td class="tdcenteralign">'.($value15['original_tenure_months'] != '' ? $value15['original_tenure_months'] : 'NA').'</td><td class="tdcenteralign">'.($value15['current_tenure_months'] != '' ? $value15['current_tenure_months'] : 'NA').'</td><td class="tdcenteralign">'.($value15['elapsed_tenure_months'] != '' ? $value15['elapsed_tenure_months'] : 'NA') .'</td></tr>';
}
}
else// if no count
{
echo '<tr> <td colspan="10" class="tdcenteralign"> Existing Loan Obligations Not Available</td> </tr>';
}
if($pd_section_data[15]['common_remarks'])
{
echo '<tr> <td colspan="2">Remarks</td> <td class="tdcenteralign"colspan="8">'. $pd_section_data[15]['common_remarks'] .'</td> </tr>';
@ -1286,7 +1300,7 @@ Business run by the applicant</td><td colspan="4"><?php echo $pd_section_data[1
</table>
<?php } ?>
<div id="page_break"> </div>
<!-- <table class="scorecard_table">
<tr><th class="thlargefont">Neighbourhood Check Details</th></tr>