diff --git a/api/application/config/customconfig_one.php b/api/application/config/customconfig_one.php index 25eba20e..7ee2c04e 100644 --- a/api/application/config/customconfig_one.php +++ b/api/application/config/customconfig_one.php @@ -63,9 +63,9 @@ $config['cognito_resource_secret'] = 'j5OmxmlruI3elbQH7d7sznR3u6hcfhCsehUJS/bV'; else if(ENVIRONMENT == 'prod') { -$config['sine_egde_pool_id'] = 'ap-south-1_Ru6WdtCsV'; -$config['lender_pool_id'] = 'ap-south-1_CTZdSjxsy'; -$config['vendor_pool_id'] = 'ap-south-1_Ll0jEqWs2'; +$config['sine_egde_pool_id'] = 'ap-south-1_MlTee1O5V'; +$config['lender_pool_id'] = 'ap-south-1_Kg227UJOD'; +$config['vendor_pool_id'] = 'ap-south-1_7Xvnpr2At'; $config['authorization_key'] = 'letsitanddiscuss'; @@ -104,11 +104,6 @@ fMWk1RDfkIkxyPz3ExA609+0eUYZI4W3vvgpKhtU8Sk7zw3+nFQ3bLaLji8QgFS7 62HLgCmQDfWQnJsyWZ+XAedTpH+1mvquQrgfODWUOp+J0QiLyxQ2Sl+6nrTzrTST LQIDAQAB -----END PUBLIC KEY-----'; - - - - - } diff --git a/api/application/config/database.php b/api/application/config/database.php index bb460f9e..16eef4eb 100644 --- a/api/application/config/database.php +++ b/api/application/config/database.php @@ -113,8 +113,11 @@ $db['dev'] = array( $db['test'] = array( 'dsn' => '', 'hostname' => 'sine-edge-dev.cya6cheplup2.ap-south-1.rds.amazonaws.com', - 'username' => 'sparqdev_mas001', + //'hostname' => 'localhost', + 'username' => 'sparqdev_mas001', + //'username' => 'root', 'password' => 'sparqvenba', + // 'password' => '', 'database' => 'sine_edge_test', 'dbdriver' => 'mysqli', 'dbprefix' => '', @@ -132,3 +135,25 @@ $db['test'] = array( 'save_queries' => TRUE ); +$db['prod'] = array( + 'dsn' => '', + 'hostname' => 'sineedge-prod.c5vaalihixyr.ap-south-1.rds.amazonaws.com', + 'username' => 'dbadmin', + 'password' => 'DBadmiin12345', + 'database' => 'sineedgeprod', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => (ENVIRONMENT !== 'production'), + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); + diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index cd966179..4dbfafa6 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -5028,8 +5028,6 @@ class PD_Controller extends REST_Controller { public function codeigniterViewTest_post() { - - $records = $this->post('records'); $pdid = $records['pd_id']; @@ -6079,6 +6077,7 @@ class PD_Controller extends REST_Controller { { $records = $this->post('records'); + $company_id = isset($records['company_id']) && $records['company_id']? $records['company_id'] : null; $rental_count_id = isset($records['rental_count_id']) && $records['rental_count_id'] ? $records['rental_count_id'] : null; //$location = isset($records['link']) ? $records['link'] : null; @@ -6132,8 +6131,7 @@ class PD_Controller extends REST_Controller { $result = array(); $pd_details = $this->PD_Model->getPDMasterDetails($pd_id); //print_r($data);die(); - //log_message('error','MANUAL'); - //log_message('error',$data); + foreach($data as $iter => $doc) { $temp_base64_string = $doc['image']; @@ -6320,15 +6318,29 @@ class PD_Controller extends REST_Controller { #####Address Form Questions######## $address_form = (json_decode($form_data[5][0]['processed_json'],true)); - print_r($address_form);die(); + //print_r($address_form);die(); + + if($address_form['is_pd_done_on_initiated_address'] == 1) + { + + // 4 - QNO(1.2) - Comment on locality $score_questions['general']['comment_locality'] = $address_form['addresses'][0]['comment_locality_master']; // 5 - QNO(1.3) - pd location approach $score_questions['general']['pd_location_approach'] = $address_form['addresses'][0]['pd_location_master']; - + } + else //get it from alternative address + { + + // 4 - QNO(1.2) - Comment on locality + $score_questions['general']['comment_locality'] = $address_form['alternative_addresses'][0]['comment_locality_master']; + // 5 - QNO(1.3) - pd location approach + $score_questions['general']['pd_location_approach'] = $address_form['alternative_addresses'][0]['pd_location_master']; + + } #####ENd Of Address Form Questions######## - + //print_r($score_questions['general']);die(); #####Final Remarks Form Questions######## $final_remarks_form = (json_decode($form_data[20][0]['processed_json'],true)); @@ -6860,9 +6872,9 @@ class PD_Controller extends REST_Controller { } - if(!$person_met_is_applicant_count){ $incomplete_details[] = 'General Form - Person met is not an applicant'; } - if(!$person_met_selfie_count){ $incomplete_details[] = 'General Form - Person met selfie image with PD officer'; } - if(!$person_met_id_proof_count){ $incomplete_details[] = 'General Form - Person met ID proof image'; } + if(!$person_met_is_applicant_count){ $incomplete_details[] = 'General Section - Person met is not an applicant'; } + if(!$person_met_selfie_count){ $incomplete_details[] = 'General Section - Person met selfie image with PD officer not captured'; } + if(!$person_met_id_proof_count){ $incomplete_details[] = 'General Section - Person met ID proof image not captured'; } #####End of General Form Questions######## @@ -6870,56 +6882,70 @@ class PD_Controller extends REST_Controller { if(count($pd_images[5])) { $approach_image_count = 0; - $name_board_image_count = 0; + foreach ($pd_images[5] as $key => $value) { if(substr_count(strtolower($value['pd_document_title']),strtolower('Approach to PD Location'))) { $approach_image_count++; } - if(substr_count(strtolower($value['pd_document_title']),strtolower('Name board Seen'))) - { - $name_board_image_count++; - } + } - if(!$approach_image_count){ $incomplete_details[] = 'Address Form - Approach to PD location Image'; } - if(!$name_board_image_count){ $incomplete_details[] = 'Address Form - Business Name Board Image'; } + if(!$approach_image_count){ $incomplete_details[] = 'Address Section - Approach to PD location Image not captured'; } + } else { - $incomplete_details[] = 'Address Form - Approach to PD location Image'; - $incomplete_details[] = 'Address Form - Business Name Board Image'; + $incomplete_details[] = 'Address Section - Approach to PD location Image not captured'; + } #####Business Form Questions######## $business_form = (json_decode($form_data[13][0]['processed_json'],true)); - + //print_r(!isset($business_form['factory_cert']));die(); $is_manufacturing_selected = 0; foreach ($business_form['select_business_activity_type'] as $key => $value) { if($value['type_of_activity_id'] == 2){ $is_manufacturing_selected = 1; } } // 13 - QNO(2.4) - all business certificate $certificate_count = 0; + $name_board_image_count = 0; + if(count($pd_images[13])) + { + foreach ($pd_images[13] as $key => $value) { + if(substr_count(strtolower($value['pd_document_title']),strtolower('Name board Seen'))) + { + $name_board_image_count++; + } + } + } + if(!$name_board_image_count){ $incomplete_details[] = 'Busienss Section - Business Name Board Image not captured'; } + - (isset($business_form['shop_eat_act_cert']) && strtoupper($business_form['shop_eat_act_cert'])=='YES' && ($business_form['shop_eat_act_cert_pic'] != "")) ? $certificate_count : $certificate_count++; + (isset($business_form['shop_eat_act_cert']) && strtoupper($business_form['shop_eat_act_cert'])=='YES' && ($business_form['shop_eat_act_cert_pic'] != "")) ? $certificate_count : (strtoupper($business_form['shop_eat_act_cert']) =='NO' || strtoupper($business_form['shop_eat_act_cert']) =='NOT APPLICABLE' ? $certificate_count : $certificate_count++); - (isset($business_form['gst_Regn_cert']) && strtoupper($business_form['gst_Regn_cert'])=='YES' && ($business_form['gst_Regn_cert_pic'] != "")) ? $certificate_count : $certificate_count++; + + + (isset($business_form['gst_Regn_cert']) && strtoupper($business_form['gst_Regn_cert'])=='YES' && ($business_form['gst_Regn_cert_pic'] != "")) ? $certificate_count : (strtoupper($business_form['gst_Regn_cert']) =='NO' || strtoupper($business_form['gst_Regn_cert']) =='NOT APPLICABLE' ? $certificate_count : $certificate_count++); - (isset($business_form['pf_regn']) && strtoupper($business_form['pf_regn'])=='YES' && ($business_form['pf_regn_pic'] != "")) ? $certificate_count : $certificate_count++; + (isset($business_form['pf_regn']) && strtoupper($business_form['pf_regn'])=='YES' && ($business_form['pf_regn_pic'] != "")) ? $certificate_count : (strtoupper($business_form['pf_regn_pic']) =='NO' || strtoupper($business_form['pf_regn_pic']) =='NOT APPLICABLE' ? $certificate_count : $certificate_count++); - (isset($business_form['esic_regn']) && strtoupper($business_form['esic_regn'])=='YES' && ($business_form['esic_regn_pic'] != "")) ? $certificate_count : $certificate_count++; + (isset($business_form['esic_regn']) && strtoupper($business_form['esic_regn'])=='YES' && ($business_form['esic_regn_pic'] != "")) ? $certificate_count : (strtoupper($business_form['esic_regn']) =='NO' || strtoupper($business_form['esic_regn']) =='NOT APPLICABLE' ? $certificate_count : $certificate_count++); + - (isset($business_form['export_import_cert']) && strtoupper($business_form['export_import_cert'])=='YES' && ($business_form['export_import_cert_pic'] != "")) ? $certificate_count : $certificate_count++; - (isset($business_form['factory_cert']) && strtoupper($business_form['factory_cert'])=='YES' && ($business_form['factory_cert_pic'] != "")) ? $certificate_count : $certificate_count++; + (isset($business_form['export_import_cert']) && strtoupper($business_form['export_import_cert'])=='YES' && ($business_form['export_import_cert_pic'] != "")) ? $certificate_count : (strtoupper($business_form['export_import_cert']) =='NO' || strtoupper($business_form['export_import_cert']) =='NOT APPLICABLE' ? $certificate_count : $certificate_count++); - (isset($business_form['practice_cert']) && strtoupper($business_form['practice_cert'])=='YES' && ($business_form['practice_cert_pic'] != "")) ? $certificate_count : $certificate_count++; + (isset($business_form['factory_cert'])) ? ((strtoupper($business_form['factory_cert'])=='YES' && ($business_form['factory_cert_pic'] != "") ) ? $certificate_count : (strtoupper($business_form['factory_cert'])=='NO' || strtoupper($business_form['factory_cert'])=='NOT APPLICABLE') ? $certificate_count : $certificate_count++) : $certificate_count;//((($business_form['factory_cert'] != "")) && strtoupper($business_form['factory_cert']) =='NO' || strtoupper($business_form['factory_cert']) =='NOT APPLICABLE' ? $certificate_count : $certificate_count++); - if($certificate_count){ $incomplete_details[] = 'Business Form - Images for Document Sighted Not Sufficient'; } - //echo $certificate_count; + (isset($business_form['practice_cert'])) ? ((strtoupper($business_form['practice_cert'])=='YES' && ($business_form['practice_cert_pic'] != "") ) ? $certificate_count : (strtoupper($business_form['factory_cert'])=='NO' || strtoupper($business_form['practice_cert'])=='NOT APPLICABLE') ? $certificate_count : $certificate_count++) : $certificate_count; + + //(isset($business_form['practice_cert']) && strtoupper($business_form['practice_cert'])=='YES' && ($business_form['practice_cert_pic'] != "")) ? $certificate_count : ( (isset($business_form['practice_cert'])) && strtoupper($business_form['practice_cert']) =='NO' || strtoupper($business_form['practice_cert']) =='NOT APPLICABLE' ? $certificate_count : $certificate_count++); + if($certificate_count){ $incomplete_details[] = 'Business Section - Images for Document Sighted Not Sufficient'; } + #####End of Business Form Questions######## @@ -6935,7 +6961,7 @@ class PD_Controller extends REST_Controller { { if($value['business_assets_mode'] == 4 && !($businees_assest_images_count)) { - $incomplete_details[] = 'Business Assets Form - Machinery Image'; + $incomplete_details[] = 'Business Assets Section - Machinery Image'; } } @@ -6983,16 +7009,16 @@ class PD_Controller extends REST_Controller { } - if($cureent_supplier_images_count < 2){ $incomplete_details[] = 'Supplier Form - '.$supplier_name.' - Image Not Sufficient';} + if($cureent_supplier_images_count < 2){ $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Image Not Sufficient';} } else { - $incomplete_details[] = 'Supplier Form - '.$supplier_name.' - Image Not Sufficient'; + $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Image Not Sufficient'; } } else { - $incomplete_details[] = 'Supplier Form - Supplier (Raw Material '.($key+1).') Details not sufficient'; + $incomplete_details[] = 'Supplier Section - Supplier (Raw Material '.($key+1).') Details not sufficient'; } } @@ -7019,7 +7045,7 @@ class PD_Controller extends REST_Controller { $cureent_supplier_images_count = 0 ; //Images name check - $supplier_name = $trading_value['trade_supplier_name'].' - Trading Product'.($manu_key+1); + $supplier_name = $trading_value['trade_supplier_name'].' - Trading Product'.($trading_key+1); if(count($supplier_images)) { foreach ($supplier_images as $key => $value) @@ -7029,16 +7055,16 @@ class PD_Controller extends REST_Controller { $cureent_supplier_images_count++; } } - if($cureent_supplier_images_count < 2){ $incomplete_details[] = 'Supplier Form - '.$supplier_name.' - Image Not Sufficient';} + if($cureent_supplier_images_count < 2){ $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Image Not Sufficient';} } else { - $incomplete_details[] = 'Supplier Form - '.$supplier_name.' - Image Not Sufficient'; + $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Image Not Sufficient'; } } else { - $incomplete_details[] = 'Supplier Form - Supplier (Trading Product'.($key+1).') Details not sufficient'; + $incomplete_details[] = 'Supplier Section - Supplier (Trading Product'.($key+1).') Details not sufficient'; } } @@ -7052,7 +7078,7 @@ class PD_Controller extends REST_Controller { } - if(!$supplier_count){ $incomplete_details[] = 'Supplier Form - supplier informations not Sufficient'; } + if(!$supplier_count){ $incomplete_details[] = 'Supplier Section - supplier informations not Sufficient'; } } //echo $score_questions['business']['minimum_supplier_info'];die(); @@ -7061,6 +7087,7 @@ class PD_Controller extends REST_Controller { #####client Form Questions######## $client_form = isset($form_data[2][0]['processed_json'])?(json_decode($form_data[2][0]['processed_json'],true)):array(); + //print_r($client_form);die(); $client_images = isset($pd_images[2]) ? $pd_images[2] : array(); $client_count = 0; if(count($client_form)) @@ -7091,17 +7118,17 @@ class PD_Controller extends REST_Controller { $current_client_images_count++; } } - if($current_client_images_count < 2){ $incomplete_details[] = 'Client Form - '.$client_name.' - Image Not Sufficient';} + if($current_client_images_count < 2){ $incomplete_details[] = 'Client Section - '.$client_name.' - Image Not Sufficient';} } else { - $incomplete_details[] = 'Client Form - '.$client_name .'- Image Not Sufficient'; + $incomplete_details[] = 'Client Section - '.$client_name .'- Image Not Sufficient'; } } else { - $incomplete_details[] = 'Client Form - Client (Manufacturing Product'.($key+1).') Details not sufficient'; + $incomplete_details[] = 'Client Section - Client (Manufacturing Product'.($key+1).') Details not sufficient'; } } } @@ -7115,13 +7142,14 @@ class PD_Controller extends REST_Controller { foreach ($client_form['trade_details'][0]['trading_products'] as $key => $value) { - if($value['trade_product_name'] != "" && (isset($value['trade_supplier_name']) && $value['trade_supplier_name'] != "") && $value['trade_product_contact_person_name'] != "" && ($value['trade_product_contact_person_mobile_number'] != "" || $value['person_landline'] != "")) + //print_r($value);die(); + if($value['trade_product_name'] != "" && (isset($value['trade_client_name'])) && $value['trade_client_name'] != "" && $value['trade_product_contact_person_name'] != "" && ($value['trade_product_contact_person_mobile_number'] != "" || $value['person_landline'] != "")) { $client_count++; $current_client_images_count = 0 ; //Images name check - $client_name = $value['trade_supplier_name'].' - Trading Product '.($key+1); + $client_name = $value['trade_client_name'].' - Trading Product '.($key+1); if(count($client_images)) { @@ -7132,16 +7160,16 @@ class PD_Controller extends REST_Controller { $current_client_images_count++; } } - if($current_client_images_count < 2){ $incomplete_details[] = 'Client Form - '.$client_name.' - Image Not Sufficient';} + if($current_client_images_count < 2){ $incomplete_details[] = 'Client Section - '.$client_name.' - Image Not Sufficient';} } else { - $incomplete_details[] = 'Client Form - '.$client_name .'- Image Not Sufficient'; + $incomplete_details[] = 'Client Section - '.$client_name .'- Image Not Sufficient'; } } else { - $incomplete_details[] = 'Client Form - Client (Trading Product'.($key+1).') Details not sufficient'; + $incomplete_details[] = 'Client Section - Client (Trading Product'.($key+1).') Details not sufficient'; } } @@ -7172,17 +7200,17 @@ class PD_Controller extends REST_Controller { $current_client_images_count++; } } - if($current_client_images_count < 2){ $incomplete_details[] = 'Client Form - '.$client_name.' - Image Not Sufficient';} + if($current_client_images_count < 2){ $incomplete_details[] = 'Client Section - '.$client_name.' - Image Not Sufficient';} } else { - $incomplete_details[] ='Client Form - ' .$client_name .'- Image Not Sufficient'; + $incomplete_details[] ='Client Section - ' .$client_name .'- Image Not Sufficient'; } } else { - $incomplete_details[] = 'Client Form - Client (Service Provider'.($key+1).') Details not sufficient'; + $incomplete_details[] = 'Client Section - Client (Service Provider'.($key+1).') Details not sufficient'; } } @@ -7259,7 +7287,7 @@ class PD_Controller extends REST_Controller { //echo $total_stock_observed;die(); if( $total_stock_observed != 0 && !(isset($pd_images[11]) ))//&& !count($pd_images[11][0])) ) { - $incomplete_details[] = 'Stock Form - Images not sufficient'; + $incomplete_details[] = 'Stock Section - Images not sufficient'; } //} } @@ -7270,10 +7298,32 @@ class PD_Controller extends REST_Controller { $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; $data['records'] = $incomplete_details; - $data['msg'] = count($incomplete_details) ? 'PD forms are incomplete' : 'All forms were answered'; + $data['msg'] = count($incomplete_details) ? 'PD Details are incomplete' : 'All forms were answered'; $this->response($data,REST_Controller::HTTP_OK); + } + + public function convertImgUrlToBase64_post() + { + $img_url = $this->post('img_url'); + $b64image = base64_encode(file_get_contents($img_url)); + if($b64image) + { + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $b64image; + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; + $data['msg'] = 'Something Went Wrong / Can`t convet given URL; + $this->response($data,REST_Controller::HTTP_OK); + } + + } } \ No newline at end of file diff --git a/api/application/docs/sample.pdf b/api/application/docs/sample.pdf index 275db0a2..c025545b 100644 Binary files a/api/application/docs/sample.pdf and b/api/application/docs/sample.pdf differ diff --git a/api/application/helpers/getprocessedjson_helper.php b/api/application/helpers/getprocessedjson_helper.php index 79cb7ed3..f2d9430c 100644 --- a/api/application/helpers/getprocessedjson_helper.php +++ b/api/application/helpers/getprocessedjson_helper.php @@ -1971,13 +1971,16 @@ class GETPROCESSEDJSON $master_tables_field_names = $CI->config->item('master_tables_field_names'); $master_tables_pkid = $CI->config->item('master_tables_pkid'); + $fields = array('question', 'key', 'ismaster', 'master_name'); + $where_condition_array = array('fk_form_id' => $formid,'isactive' => 1); + $master_keys = $CI->PD_Model->selectCustomRecords($fields,$where_condition_array,QUESTIONKEYMAPPING); + + //print_r($raw_json); foreach($raw_json['addresses'] as $raw_json_key => $address) { - // GET KEYS FROM MASTER TABLE FOR SUPPLIER FORM - $fields = array('question', 'key', 'ismaster', 'master_name'); - $where_condition_array = array('fk_form_id' => $formid,'isactive' => 1); - $master_keys = $CI->PD_Model->selectCustomRecords($fields,$where_condition_array,QUESTIONKEYMAPPING); + + if(array_key_exists('address_type',$address)) { @@ -2117,6 +2120,156 @@ class GETPROCESSEDJSON } } + } + + if(isset($raw_json['is_pd_done_on_initiated_address']) && ($raw_json['is_pd_done_on_initiated_address'] == "") ) + { + foreach($raw_json['alternative_addresses'] as $raw_json_key => $address) + { + // GET KEYS FROM MASTER TABLE FOR SUPPLIER FORM + // $fields = array('question', 'key', 'ismaster', 'master_name'); + // $where_condition_array = array('fk_form_id' => $formid,'isactive' => 1); + // $master_keys = $CI->PD_Model->selectCustomRecords($fields,$where_condition_array,QUESTIONKEYMAPPING); + + if(array_key_exists('address_type',$address)) + { + $CI->db->SELECT( $master_tables_field_names['ADDRESSTYPE'] ); + $CI->db->FROM(ADDRESSTYPE); + $CI->db->WHERE('isactive',1); + $CI->db->WHERE($master_tables_pkid['ADDRESSTYPE'] ,$address['address_type']); + $adress_type_name= $CI->db->GET()->result_array(); + //print_r($CI->db->last_query()); + if(count($adress_type_name)) + { + $raw_json['alternative_addresses'][$raw_json_key]['address_type_master'] = $adress_type_name[0][$master_tables_field_names['ADDRESSTYPE']]; + } + } + + + if(array_key_exists('locality',$address)) + { + $CI->db->SELECT( $master_tables_field_names['LOCALITY'] ); + $CI->db->FROM(LOCALITY); + $CI->db->WHERE('isactive',1); + $CI->db->WHERE($master_tables_pkid['LOCALITY'] ,$address['locality']); + $locality_name= $CI->db->GET()->result_array(); + //print_r($CI->db->last_query()); + if(count($locality_name)) + { + $raw_json['alternative_addresses'][$raw_json_key]['locality_master'] = $locality_name[0][$master_tables_field_names['LOCALITY']]; + } + } + + + if(array_key_exists('pd_location',$address)) + { + $CI->db->SELECT( $master_tables_field_names['PDLOCATIONAPPROACH'] ); + $CI->db->FROM(PDLOCATIONAPPROACH); + $CI->db->WHERE('isactive',1); + $CI->db->WHERE($master_tables_pkid['PDLOCATIONAPPROACH'] ,$address['pd_location']); + $pd_location_approach= $CI->db->GET()->result_array(); + //print_r($CI->db->last_query()); + if(count($pd_location_approach)) + { + $raw_json['alternative_addresses'][$raw_json_key]['pd_location_master'] = $pd_location_approach[0][$master_tables_field_names['PDLOCATIONAPPROACH']]; + } + } + + + if(array_key_exists('comment_locality',$address)) + { + $CI->db->SELECT( $master_tables_field_names['COMMENTSONLOCALITY'] ); + $CI->db->FROM(COMMENTSONLOCALITY); + $CI->db->WHERE('isactive',1); + $CI->db->WHERE($master_tables_pkid['COMMENTSONLOCALITY'] ,$address['comment_locality']); + $comments_on_locality= $CI->db->GET()->result_array(); + //print_r($CI->db->last_query()); + if(count($comments_on_locality)) + { + $raw_json['alternative_addresses'][$raw_json_key]['comment_locality_master'] = $comments_on_locality[0][$master_tables_field_names['COMMENTSONLOCALITY']]; + } + } + + if(array_key_exists('additional_address_units',$address)) + { + + foreach($address['additional_address_units'] as $additional_address_unit_key => $additional_address_unit) + { + $CI->db->SELECT( $master_tables_field_names['ADDRESSTYPE'] ); + $CI->db->FROM(ADDRESSTYPE); + $CI->db->WHERE('isactive',1); + $CI->db->WHERE($master_tables_pkid['ADDRESSTYPE'] ,$additional_address_unit['premises_type']); + $premises_type= $CI->db->GET()->result_array(); + //print_r($CI->db->last_query()); + if(count($premises_type)) + { + $raw_json['alternative_addresses'][$raw_json_key]['additional_address_units'][$additional_address_unit_key]['premises_type_master'] = $premises_type[0][$master_tables_field_names['ADDRESSTYPE']]; + } + } + } + + + if(array_key_exists('alternative_state',$address)) + { + //print_r($address); + $CI->db->SELECT( $master_tables_field_names['STATE'] ); + $CI->db->FROM(STATE); + $CI->db->WHERE('isactive',1); + $CI->db->WHERE($master_tables_pkid['STATE'] ,$address['alternative_state']); + $adress_type_name= $CI->db->GET()->result_array(); + //print_r($CI->db->last_query()); + if(count($adress_type_name)) + { + $raw_json['alternative_addresses'][$raw_json_key]['state_master'] = $adress_type_name[0][$master_tables_field_names['STATE']]; + } + } + + if(array_key_exists('alternative_city',$address)) + { + //print_r($address); + $CI->db->SELECT( $master_tables_field_names['CITY'] ); + $CI->db->FROM(CITY); + $CI->db->WHERE('isactive',1); + $CI->db->WHERE($master_tables_pkid['CITY'] ,$address['alternative_city']); + $city= $CI->db->GET()->result_array(); + //print_r($CI->db->last_query()); + if(count($city)) + { + $raw_json['alternative_addresses'][$raw_json_key]['city_master'] = $city[0][$master_tables_field_names['CITY']]; + } + } + + if(array_key_exists('alternative_pincode',$address)) + { + //print_r($address); + $CI->db->SELECT( $master_tables_field_names['PINCODE'] ); + $CI->db->FROM(PINCODE); + $CI->db->WHERE('isactive',1); + $CI->db->WHERE($master_tables_pkid['PINCODE'] ,$address['alternative_pincode']); + $pincode= $CI->db->GET()->result_array(); + //print_r($CI->db->last_query()); + if(count($pincode)) + { + $raw_json['alternative_addresses'][$raw_json_key]['pincode_master'] = $pincode[0][$master_tables_field_names['PINCODE']]; + } + } + + if(array_key_exists('uom',$address)) + { + //print_r($address); + $CI->db->SELECT( $master_tables_field_names['UOM'] ); + $CI->db->FROM(UOM); + $CI->db->WHERE('isactive',1); + $CI->db->WHERE($master_tables_pkid['UOM'] ,$address['uom']); + $uom= $CI->db->GET()->result_array(); + //print_r($CI->db->last_query()); + if(count($uom)) + { + $raw_json['alternative_addresses'][$raw_json_key]['uom_master'] = $uom[0][$master_tables_field_names['UOM']]; + } + } + + } } return ($raw_json); diff --git a/api/application/views/report_templates/JSONTOREPORT.php b/api/application/views/report_templates/JSONTOREPORT.php index f5e2869a..24861bf9 100644 --- a/api/application/views/report_templates/JSONTOREPORT.php +++ b/api/application/views/report_templates/JSONTOREPORT.php @@ -885,7 +885,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $business_assets_details = json_decode($pd_processed_forms[22][0]['processed_json'],true); $address_images = $pd_images[5]; - print_r($address_images);die(); + //print_r($address_images);die(); $pd_location_approach_img_url = ''; $pd_location_approach_img_location = ''; $pd_location_approach_img_date = ''; @@ -893,7 +893,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); foreach ($address_images as $address_image_key => $address_image_value) { if($address_image_value['is_show_report'] == 1) { - $pd_location_approach_img_url = $address_image_value['doc_url']; + $pd_location_approach_img_url = isset($address_image_value['doc_url']) ? $address_image_value['doc_url']: 'https://www.bigblue.co.za/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/n/o/not-captured.jpg'; $pd_location_approach_img_location = $address_image_value['location']; $pd_location_approach_img_date = date('Y/m/d h:s:i A',$address_image_value['createdon']); break; @@ -905,21 +905,43 @@ defined('BASEPATH') OR exit('No direct script access allowed');

PD LOCATION

PD Location Address : '.$pd_address['address'].', '.$pd_address['city_master'].', '.$pd_address['state_master'].' - '.$pincode.'.'; + $pd_alternative_address = array(); + $pincode = isset($pd_address['pincode_others']) && ($pd_address['pincode_others'] != "" || $pd_address['pincode_others'] != null) ? $pd_address['pincode_others'] : $pd_address['pincode_master']; + $is_change_address = 0; + if(isset($address_form['is_pd_done_on_initiated_address']) && (!$address_form['is_pd_done_on_initiated_address'])) + { + $is_change_address = 1; + $pd_alternative_address = $address_form['alternative_addresses'][0]; + + $alter_native_pincode = isset($pd_alternative_address['pincode_others']) && ($pd_alternative_address['pincode_others'] != "" || $pd_alternative_address['pincode_others'] != null) ? $pd_alternative_address['alternate_pincode_others'] : $pd_alternative_address['pincode_master']; + + echo 'Address at which PD was initiated: '.$pd_address['address'].', '.$pd_address['city_master'].', '.$pd_address['state_master'].' - '.$pincode.'.'; + + echo '
Address at which PD Visit actually done: '.$pd_alternative_address['alternative_address'].', '.$pd_alternative_address['city_master'].', '.$pd_alternative_address['state_master'].' - '.$alter_native_pincode.'.'; + + echo '
Reasaon for change in PD address:'.$pd_alternative_address['reason_for_alternative_address']; + + } + else + { + + echo 'PD Location Address : '.$pd_address['address'].', '.$pd_address['city_master'].', '.$pd_address['state_master'].' - '.$pincode.'.'; + } + echo '

GPS Coordinates of location where PD Visit was done : '.$pd_master_details[0]['start_location']; echo '

'; ?> - alt="Satellite Image of location of Where PD was Done" style="width:100%;height:300px;border-color:#0191ed" />


+ alt=" Satellite Image of location of Where PD was Done" style="width:100%;height:300px;border-color:#0191ed" />


@@ -929,10 +951,11 @@ defined('BASEPATH') OR exit('No direct script access allowed');

Location Summary

'.$address_form['address_form_remark'].'Address Form - Address Form Remarks ';} echo "

"; echo "
"; + //die(); // ?>
PD Location Approach Name Board of Business
- https://www.bigblue.co.za/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/n/o/not-captured.jpg + Name Board