SALES PD MUL IMGS RETRIVE AND REPORT

This commit is contained in:
Velz2020 2019-12-21 16:12:21 +05:30
parent 074b2e350e
commit 1b4bece74e
2 changed files with 146 additions and 35 deletions

View File

@ -340,7 +340,10 @@ class Sales_PD_Controller extends REST_Controller {
} }
$temp_array[ $question['question_key'] ] = substr_replace($temp_array[ $question['question_key'] ],'', strrpos($temp_array[ $question['question_key'] ],','),1); if(substr_count($temp_array[ $question['question_key'] ], ','))
{
$temp_array[ $question['question_key'] ] = substr_replace($temp_array[ $question['question_key'] ],'', strrpos($temp_array[ $question['question_key'] ],','),1);
}
if(substr_count($temp_array[ $question['question_key'] ], ',')) if(substr_count($temp_array[ $question['question_key'] ], ','))
{ {
@ -488,10 +491,22 @@ class Sales_PD_Controller extends REST_Controller {
if(isset($records['status']) && $records['status'] == 'COMPLETED') if(isset($records['status']) && $records['status'] == 'COMPLETED')
{ {
$drafted_sections = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('status' => 0,'sales_pd_id' => $records['sales_pd_id'],'isactive' => 1),SALESPD_SECTION_DATA); $drafted_sections = $this->Sales_PD_Model->selectCustomRecords(array('section_id'),array('status' => 0,'sales_pd_id' => $records['sales_pd_id'],'isactive' => 1),SALESPD_SECTION_DATA);
//print_r($drafted_sections);die(); //print_r($drafted_sections);
if(count($drafted_sections)) if(count($drafted_sections))
{ {
//merge section name
$section_names = array('General Section','Fund Requirement','stakeholders','Brief of business','Financial','Property Details','Officer Details','Final Remraks','Photography');
$drafted_sections = array_map(function($single) use ($section_names)
{
return array('section_id' => $single['section_id'],'sectin_name' => $section_names [ $single['section_id'] ]);
},
$drafted_sections);
//print_r($drafted_sections);die();
unset($records['status']); unset($records['status']);
$data['dataStatus'] = true; $data['dataStatus'] = true;
$data['records'] = $drafted_sections; $data['records'] = $drafted_sections;
@ -680,46 +695,142 @@ class Sales_PD_Controller extends REST_Controller {
} }
else else
{ {
$image_order = array('selfie_with_person_met','approach_to_pd_location','name_board_seen','stock_image','workplace_interior_image');
$images = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('fk_sales_pd_id' => $records['sales_pd_id'],'img_name !=' => 'satellite','isactive' => 1),SALEPD_DOCS); $images = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('fk_sales_pd_id' => $records['sales_pd_id'],'img_name !=' => 'satellite','isactive' => 1),SALEPD_DOCS);
//print_r($images);die(); //print_r($images);die();
$photo_names = array('selfie_with_person_met' => 'Selfie with person met','approach_to_pd_location' => 'Approach to pd location','name_board_seen' => 'Name board seen', 'stock_image' => 'Stock image','workplace_interior_image' => 'Workplace interior image','satellite1' => 'satellite'); $photo_names = array('selfie_with_person_met' => 'Selfie with person met','approach_to_pd_location' => 'Approach to pd location','name_board_seen' => 'Name board seen', 'stock_image' => 'Stock image','workplace_interior_image' => 'Workplace interior image');
if(count($images))
{
$questions = array(); $questions = array();
$questions_group = array(); $questions_group = array();
foreach ($images as $key => $value) foreach ($photo_names as $photo_key => $photo_value)
{ {
if(count($images))
$question['is_repeatable'] = "";
$question['group_title'] = null;
$question['answer_value'] = $value['img'];
//$question['answer_value'] = "IMG";
$question['question'] = $photo_names [ $value['img_name'] ];
$question['question_key'] = $value['img_name'];
$question['type'] = 6;
$question['validations'] = [];
$question['raw_validations'] = [];
$question['api_properties'] = null;
$question['answers'] = null;
$question['onchange_properties'] = null;
if($value['img_name'] == 'selfie_with_person_met')
{ {
$questions[] = $question; // foreach ($images as $key => $value)
// {
//check current photo is exist in images array
//print_r($photo_key);
$is_exist = false;
$exist_data = array();
//$question = [];
foreach ($images as $key => $value)
{
if($photo_key == $value['img_name'])
{
$is_exist = true;
$exist_data[] = array('img_name' => $value['img_name'],'img' => $value['img']);
// unset($images[$key]);
// break;
}
}
// echo $is_exist;
// echo '<br>';
if($is_exist)
{
// echo "YESPART";
// echo '<br>';
foreach ($exist_data as $exist_data_key => $exist_data_value)
{
$question['is_repeatable'] = "";
$question['group_title'] = null;
$question['answer_value'] = $value['img'];
//$question['answer_value'] = "IMG";
$question['question'] = $photo_names [ $exist_data_value['img_name'] ];
$question['question_key'] = $exist_data_value['img_name'];
$question['type'] = 6;
$question['validations'] = [];
$question['raw_validations'] = [];
$question['api_properties'] = null;
$question['answers'] = null;
$question['onchange_properties'] = null;
if($exist_data_value['img_name'] == 'selfie_with_person_met')
{
$questions[] = $question;
}
else
{
$questions[ $photo_names [ $exist_data_value['img_name'] ] ] ['is_repeatable'] = 1;
$questions[ $photo_names [ $exist_data_value['img_name'] ] ] ['group_title'] = $photo_names [ $exist_data_value['img_name'] ];
$questions[ $photo_names [ $exist_data_value['img_name'] ] ] ['group_type'] = 6;
$questions[ $photo_names [ $exist_data_value['img_name'] ] ] ['questions_group'][0]['questions'][] = $question;
}
}
$exist_data = array();
}
else
{
// echo "NOPART";
// echo '<br>';
// print_r($questions);
$question['is_repeatable'] = "";
$question['group_title'] = null;
$question['answer_value'] = '';
//$question['answer_value'] = "IMG";
$question['question'] = $photo_value;
$question['question_key'] =$photo_key;
$question['type'] = 6;
$question['validations'] = [];
$question['raw_validations'] = [];
$question['api_properties'] = null;
$question['answers'] = null;
$question['onchange_properties'] = null;
if($photo_key == 'selfie_with_person_met')
{
//echo 'SELFIE';
$questions[] = $question;
}
else
{
$questions[ $photo_names [ $value['img_name'] ] ] ['is_repeatable'] = 1;
$questions[ $photo_names [ $value['img_name'] ] ] ['group_title'] = $photo_value;
$questions[ $photo_names [ $value['img_name'] ] ] ['group_type'] = 6;
$questions[ $photo_names [ $value['img_name'] ] ] ['questions_group'][0]['questions'][] = $question;
}
//break;
// print_r($questions);
// die();
}
//}
} }
else else
{ {
$questions[ $photo_names [ $value['img_name'] ] ] ['is_repeatable'] = 1; $question['is_repeatable'] = "";
$questions[ $photo_names [ $value['img_name'] ] ] ['group_title'] = $photo_names [ $value['img_name'] ]; $question['group_title'] = null;
$questions[ $photo_names [ $value['img_name'] ] ] ['group_type'] = 6; $question['answer_value'] = '';
$questions[ $photo_names [ $value['img_name'] ] ] ['questions_group'][]['questions'][] = $question; //$question['answer_value'] = "IMG";
$question['question'] = $photo_value;
$question['question_key'] =$photo_key;
$question['type'] = 6;
$question['validations'] = [];
$question['raw_validations'] = [];
$question['api_properties'] = null;
$question['answers'] = null;
$question['onchange_properties'] = null;
if($value['img_name'] == 'selfie_with_person_met')
{
$questions[] = [];
}
else
{
$questions[ $photo_names [ $value['img_name'] ] ] ['is_repeatable'] = 1;
$questions[ $photo_names [ $value['img_name'] ] ] ['group_title'] = $photo_value;
$questions[ $photo_names [ $value['img_name'] ] ] ['group_type'] = 6;
$questions[ $photo_names [ $value['img_name'] ] ] ['questions_group'][0]['questions'][] = [];
}
} }
} }
$temp['questions'] = array_values($questions); $temp['questions'] = array_values($questions);
print_r($questions);die();
$temp['section_id'] = 9; $temp['section_id'] = 9;
$temp['section_name'] = 'Photography'; $temp['section_name'] = 'Photography';
@ -734,7 +845,7 @@ class Sales_PD_Controller extends REST_Controller {
$temp2['section_id'] = $records['section_id']; $temp2['section_id'] = $records['section_id'];
$temp2['status'] = '1'; $temp2['status'] = '1';
$section_data[] = $temp2; $section_data[] = $temp2;
}
} }
if($section_data) if($section_data)

View File

@ -117,7 +117,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
<td class = "tdcenteralign" colspan="7"> <?php echo $section1['application_id']?> </td> <td class = "tdcenteralign" colspan="7"> <?php echo $section1['application_id']?> </td>
</tr> </tr>
<tr> <tr>
<tr>
<td colspan="3"> Main Applicat Name</td> <td colspan="3"> Main Applicat Name</td>
<td class = "tdcenteralign" colspan="7"> <?php echo $section1['main_loan_applicant']?> </td> <td class = "tdcenteralign" colspan="7"> <?php echo $section1['main_loan_applicant']?> </td>
</tr> </tr>
@ -187,7 +187,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
'<td class="tdcenteralign" colspan="1">'.$section3_value['share_holding'].'%</td>'. '<td class="tdcenteralign" colspan="1">'.$section3_value['share_holding'].'%</td>'.
'<td class="tdcenteralign" colspan="1">'.$section3_value['vintage_in_current_biz'].'</td>'. '<td class="tdcenteralign" colspan="1">'.$section3_value['vintage_in_current_biz'].'</td>'.
'<td class="tdcenteralign" colspan="1">'.$section3_value['total_work_exp'].'</td>'. '<td class="tdcenteralign" colspan="1">'.$section3_value['total_work_exp'].'</td>'.
'<td class="tdcenteralign" colspan="3">'.($section3_value['previous_experience_details'] ? $section3_value['previous_experience_details'] : 'NA' ).'</td>'. '<td class="tdcenteralign" colspan="3">'.( isset ($section3_value['previous_experience_details']) && $section3_value['previous_experience_details'] ? $section3_value['previous_experience_details'] : 'NA' ).'</td>'.
'<td class="tdcenteralign" colspan="2" style="text-align: center">'.$section3_value['started_biz'].'</td>'. '<td class="tdcenteralign" colspan="2" style="text-align: center">'.$section3_value['started_biz'].'</td>'.
'</tr>'; '</tr>';
} }
@ -384,7 +384,7 @@ if(isset($section6))
</tr> </tr>
<?php foreach($section6 as $property_key => $property_value) { <?php foreach($section6 as $property_key => $property_value) {
echo '<br><br><tr><th colspan="10"> Property '.($property_key + 1).'</th></tr>'; echo '<tr><th colspan="10"> Property '.($property_key + 1).'</th></tr>';
//echo 'Property '. ($property_key + 1).'<br>'; //echo 'Property '. ($property_key + 1).'<br>';
?> ?>
<tr> <tr>
@ -477,10 +477,10 @@ if(isset($section6))
for($i = $from ; $i <= $to; $i++) for($i = $from ; $i <= $to; $i++)
{ {
// if(isset($section9[$i])) if(isset($section9[$i]))
// { {
echo '<td style="text-align:center;border:1px solid;"> <img src="'.$section9[$i]['img'].'" height = "200" width="200" alt="'.$section9[$i]['img_name'].'"/><br>'.$photo_names [ $section9[$i]['img_name'] ].'</td>'; echo '<td style="text-align:center;border:1px solid;"> <img src="'.$section9[$i]['img'].'" height = "200" width="200" alt="'.$section9[$i]['img_name'].'"/><br>'.$photo_names [ $section9[$i]['img_name'] ].'</td>';
//} }
//unset($p_key); //unset($p_key);
} }