diff --git a/api/application/config/api_user_auth_config.php b/api/application/config/api_user_auth_config.php index 8533d945..3320852d 100644 --- a/api/application/config/api_user_auth_config.php +++ b/api/application/config/api_user_auth_config.php @@ -37,7 +37,7 @@ $config['api_user_auth_info'] = array( '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), -'schdulePD' => array(2,3,4,5,21,10,22), +'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), 'savePDFormDetails' => array(3,4,5,6,7,10,21,22), diff --git a/api/application/config/routes.php b/api/application/config/routes.php index 60864943..291781a4 100644 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -227,6 +227,10 @@ $route['putSalCheck'] = 'PD_Controller/putSalCheck'; $route['sendCusLinkViaSMS'] = 'PD_Controller/sendCusLinkViaSMS'; $route['saveCusVideo'] = 'PD_Controller/saveCusVideo'; $route['getVideoURL'] = 'PD_Controller/getVideoURL'; +$route['getListOfvendors'] = 'PD_Controller/getListOfvendors'; +$route['(getListVendorPDOfficers/:num)'] = 'PD_Controller/getListVendorPDOfficers'; +$route['duplicatePD'] = 'PD_Controller/duplicatePD'; +$route['saveApplicantImgFromVendorForm'] = 'PD_Controller/saveApplicantImgFromVendorForm'; // $route['getPDFormDetailsJSON'] = 'PD_Controller/getPDFormDetailsJSON'; $route['smartyTestFunction'] = 'PD_Controller/smartyTestFunction'; diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 8ba04b76..5dbf984e 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -121,6 +121,76 @@ class PD_Controller extends REST_Controller { } } + + + /***********************Get get List Of Vendor Details for allocation************************/ + + public function getListOfvendors_get() + { + $fields = array('entity_id','full_name','short_name'); + $where_condition_array = array('isactive' => 1,'fk_entity_type_id' => 3); + $result_data = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,ENTITY); + if(count($result_data)) + { + + // foreach($result_data as $key => $value) + // { + // $fields = array('*'); + // $where_condition_array = array('isactive' => 1,'fk_entity_id' => $value['entity_id']); + // $result_data[$key]['billing_address'] = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,ENTITYBILLING); + + // $fields = array('entity_lender_branch_id', 'branch_name'); + // $where_condition_array = array('fk_entity_id' => $value['entity_id'],'isactive'=>1); + // $result_data[$key]['branches'] = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,ENTITYLENDERBRANCH); + + // } + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $result_data; + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + $this->response($data,REST_Controller::HTTP_OK); + + } + } + + + + /***********************Get get List Of Vendor Details for allocation************************/ + + public function getListVendorPDOfficers_get() + { + $fk_entity_id = $this->uri->segment(2);//die(); + + $columns = array('USERPROFILE.userid','concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as officer_name','USERPROFILE.email','USERPROFILE.mobile_no','USERPROFILEROLES.user_role'); + $table = USERPROFILE.' as USERPROFILE'; + $joins = array(array('table' => USERPROFILEROLES. ' as USERPROFILEROLES', + 'condition' =>'USERPROFILE.userid = USERPROFILEROLES.fk_userid AND USERPROFILEROLES.isactive = 1 AND USERPROFILEROLES.user_role = 22', + 'jointype' => 'INNER')); + $where_condition_array = array('USERPROFILE.fk_entity_id' => $fk_entity_id); + $vendor_officer_details = $this->PD_Model->getJoinRecords($columns,$table,$joins,$where_condition_array); + + if(count($vendor_officer_details)) + { + + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $vendor_officer_details; + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + $data['msg'] = 'No Officers Found...!'; + $this->response($data,REST_Controller::HTTP_OK); + + } + } /********************Get get List Of Products and SubProducts Name Details for PD Trigger Page*********/ @@ -1892,10 +1962,12 @@ public function assignPDTempalate($data) $this->checkEmptyQueryParams($_GET); $page = 0;$limit = 1000;$sort = 'DESC';$pdofficerid = "";$datetype = "";$fdate ="";$tdate =""; $lenderid = "";$status="";$lender_details = array(); + $pdagencyid = ""; if($this->get('page')) { $page = $this->get('page'); } if($this->get('limit')){ $limit = $this->get('limit'); } if($this->get('sort')) { $sort = $this->get('sort'); } if($this->get('pdofficerid')) { $pdofficerid = $this->get('pdofficerid'); } + if($this->get('pdagencyid')) { $pdagencyid = $this->get('pdagencyid'); } if($this->get('lenderid')) { $lenderid = $this->get('lenderid'); @@ -1907,7 +1979,7 @@ public function assignPDTempalate($data) if($this->get('fdate')) { $fdate = $this->get('fdate'); } if($this->get('tdate')) { $tdate = $this->get('tdate'); } if($this->get('status')) { $status = $this->get('status'); } - $result_data = $this->PD_Model->listLessPDDetails($page,$limit,$sort,$pdofficerid,$datetype,$fdate,$tdate,$lenderid,$status,$lender_details); + $result_data = $this->PD_Model->listLessPDDetails($page,$limit,$sort,$pdofficerid,$datetype,$fdate,$tdate,$lenderid,$status,$lender_details,$pdagencyid); if($result_data['data_status'] == true) { @@ -2008,7 +2080,8 @@ public function assignPDTempalate($data) $pd_officer_name = isset($records['pd_officer']) ? $records['pd_officer'] : null ; $pd_officer_id = isset($records['pd_officer_id']) ? $records['pd_officer_id'] : null ; $include_archive = $records['is_include_archived']; - $result_data = $this->PD_Model->PDListwithGlobalFilters($pd_type,$pd_status,$pd_from_date,$pd_to_date,$pd_city,$pd_products,$pd_lender,$pd_applicant_name,$pd_applicant_lender_ref,$pd_officer_name,$include_archive,$pd_officer_id); + $pd_agency_id = $records['pd_agency_id']; + $result_data = $this->PD_Model->PDListwithGlobalFilters($pd_type,$pd_status,$pd_from_date,$pd_to_date,$pd_city,$pd_products,$pd_lender,$pd_applicant_name,$pd_applicant_lender_ref,$pd_officer_name,$include_archive,$pd_officer_id,$pd_agency_id); if(count($result_data)) { @@ -5885,7 +5958,8 @@ public function getPDFormDetailsJSON_post() public function codeigniterViewTest_post() { - //print_r($this->aws_s3->createNewBucket('xmldatatest007'));die(); + //print_r($this->aws_s3->getAllObjectsInaBucket('test-lender1','pd114'));die(); + //print_r($this->aws_s3->copyS3Object('test-lender1','test-lender1','pd114','pd114-copy'));die(); //satellite_image::getSatelliteImage(1704);die(); //echo $this->assignPDTempalate(1325);die(); //$this->getSatelliteImage(342);die();//velmurugan.s@venbainfotech.com @@ -7206,6 +7280,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() $count = 0; $result = array(); $pks = array(); + $uri = null; $pd_details = $this->PD_Model->getPDMasterDetails($pd_id); //print_r($data);die(); EXTERNAL_DIR_CHECK::checkExternalDirectory($pd_id); @@ -7285,6 +7360,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() $record_data['company_id'] = $company_id ? $company_id : null; $id = $this->PD_Model->saveRecords($record_data,PDDOCUMENTS); if($id != null || $id != "") { $count++; $pks[] = $id;} + $uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,$time = '+15 minutes'); } } @@ -7295,6 +7371,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() $result['status'] = true; $result['count'] = $count; $result['pks'] = $pks; + $result['records'] = $uri; $result['msg'] = "All Images Saved Successfully"; } else @@ -9455,6 +9532,227 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() } + + + //make duplicate of a exist pd + public function duplicatePD_post() + { + $pdid = $this->post('pd_id'); + $lender_applicant_id = $this->post('lender_applicant_id'); + $fk_createdby = $this->post('fk_createdby'); + $new_pd_id = null; + + // Get All PD Masters Details + $pd_master_details = $this->PD_Model->selectCustomRecords(array('*'),array('pd_id' => $pdid),PDTRIGGER); + + if(count($pd_master_details)) + { + $pd_master_details = $pd_master_details[0]; + + unset($pd_master_details['pd_id']); + unset($pd_master_details['pd_sno']); + unset($pd_master_details['createdon']); + unset($pd_master_details['updatedon']); + unset($pd_master_details['fk_updatedby']); + + + $pd_master_details['lender_applicant_id'] = $lender_applicant_id; + $pd_master_details['pd_date_of_initiation'] = date('Y-m-d H-i-s'); + $pd_master_details['pd_status'] = 'TRIGGERED'; + + $pd_master_details['pd_status'] = $fk_createdby; + + $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-~$_'; + $charactersLength = strlen($characters); + $randomString = '!'; + for ($i = 0; $i < 16; $i++) + { + $randomString .= $characters[rand(0, $charactersLength - 1)]; + } + $pd_master_details['random_string'] = $randomString; + $url = OFFICER_TRACKING_URL.$randomString; + $pd_master_details['encrypted_url'] = $url; + //print_r($pd_master_details); + + //$new_pd_id = $this->PD_Model->saveRecords($pd_master_details,PDTRIGGER); + } + + + + + // Get All Applicant's Details + $applicants_details = $this->PD_Model->selectCustomRecords(array('applicant_name', 'applicant_type', 'mobile_no','relation', 'company_name', 'applicant_title_name'),array('fk_pd_id' => $pdid),PDAPPLICANTSDETAILS); + + //print_r($applicants_details); + if(!$new_pd_id && count($applicants_details)) + { + foreach ($applicants_details as $key => $value) + { + $value['fk_pd_id'] = $new_pd_id; + $this->PD_Model->saveRecords($value,PDAPPLICANTSDETAILS); + //print_r($value); + } + } + + + // Get All PD Related Documents + $pd_documnets = $this->PD_Model->selectCustomRecords(array('fk_pd_id','fk_form_id', 'co_applicant_id', 'img_type', 'pd_document_title', 'pd_document_name','company_id', 'is_show_report', 'rental_count_id','location', 'isactive'),array('isactive' => 1,'fk_pd_type' => $pdid),PDDOCUMENTS); + if(!$new_pd_id && count($applicants_details)) + { + foreach ($pd_documnets as $key => $value) + { + $value['fk_pd_id'] = $new_pd_id; + $this->PD_Model->saveRecords($value,PDDOCUMENTS); + //print_r($value); + } + } + + + //Get All PD Address + $pd_address = $this->PD_Model->selectCustomRecords(array('addressline1', 'fk_city', 'fk_state', 'pincode', 'isactive', 'is_visited','other_pincode', 'is_primary'),array('isactive' => 1,'fk_pd_id' => $pdid),PDADDRESS); + if(!$new_pd_id && count($pd_address)) + { + foreach ($pd_address as $key => $value) + { + $value['fk_pd_id'] = $new_pd_id; + $this->PD_Model->saveRecords($value,PDADDRESS); + //print_r($value); + } + } + + //Get Addtional Requirements details + $pd_additional_requirements = $this->PD_Model->selectCustomRecords(array('add_requirement','isactive'),array('isactive' => 1,'fk_pd_id' =>$pdid),PDADDTIONALREQUIREMENTS); + if(!$new_pd_id && count($pd_additional_requirements)) + { + foreach ($pd_additional_requirements as $key => $value) + { + $value['fk_pd_id'] = $new_pd_id; + $this->PD_Model->saveRecords($value,PDADDTIONALREQUIREMENTS); + //print_r($value); + } + } + + + //Get Docs to be collected array + $docs_to_be_collected = $this->PD_Model->selectCustomRecords(array('doc_name'),array('isactive' => 1,'fk_pd_id' =>$pdid),PDDOCSTOBECOLLECTED); + if(!$new_pd_id && count($docs_to_be_collected)) + { + foreach ($docs_to_be_collected as $key => $value) + { + $value['fk_pd_id'] = $new_pd_id; + $this->PD_Model->saveRecords($value,PDDOCSTOBECOLLECTED); + //print_r($value); + } + } + + + //Get all JSON + $json_data = $this->PD_Model->getAllJSONFormData($pdid); + if(!$new_pd_id && count($json_data)) + { + foreach ($json_data as $key => $value) + { + $value['fk_pd_id'] = $new_pd_id; + $this->PD_Model->saveRecords($value,PDFORMDETAILSJSON); + //print_r($value); + } + } + + + + + // $logger = MYLOG::logFunction(null,$pd_id); + // $logger->info("NEW PD Trigged : ".$pd_id,array('ENV'=>ENVIRONMENT,'DATA' => $pd_details)); + // PDALERTS::pdnotification($pd_id); + + + + } + + + public function saveApplicantImgFromVendorForm_post() + { + //print_r($this->post()); + $pd_id = $this->post('fk_pd_id'); + $uri = null; + EXTERNAL_DIR_CHECK::checkExternalDirectory($pd_id); + + + + + $temp_base64_string = $this->post('is_person_met_pic') !== null ? $this->post('is_person_met_pic') : $this->post('is_person_met_id_proof'); + $title = $this->post('is_person_met_pic') !== null ? trim($this->post('applicant_name')) : (trim($this->post('applicant_name')).'-id_proof'); + + //$external_path = $this->config->item('external_data_path'); + $co_applicant_id = $this->post('pd_co_applicant_id'); + $img_type = $this->post('is_person_met_pic') !== null ? 1 : 2; + $output_file = $this->external_path."/pd_reports/". $pd_id ."/temp_base64_image.jpeg"; + //echo $img_type;die(); + + //Generate Random File Name + $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; + $charactersLength = strlen($characters); + $randomString = ''; + for ($i = 0; $i < 5; $i++) { + $randomString .= $characters[rand(0, $charactersLength - 1)]; + } + $temp_file_name = $randomString.date('Y-m-d-H-i-s').'.jpeg'; + + log_message('ERROR','###PDIMAGE writing started'.$pd_id.' - '.'13'); + $ifp = fopen( $output_file, 'wb' ); + $temp_data = explode( ',', $temp_base64_string ); + fwrite( $ifp, base64_decode( $temp_data[ 1 ] ) ); + fclose( $ifp ); + log_message('ERROR','###PDIMAGE writing done'.$pd_id.' - '.'13'); + + + $pd_master_details = $this->PD_Model->getPDMasterDetails($pd_id); + $bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id']; + $key = 'pd'.$pd_id.'/'.$temp_file_name; + $bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$output_file); + // die(); + $s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data); + + if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200) + { + log_message('ERROR','###PDIMAGE stored in S3'.$pd_id.' - '.'13'); + $record_data = array('fk_pd_id' => $pd_id,'pd_document_title'=>$title,'fk_form_id'=>13,'co_applicant_id' => $co_applicant_id,'img_type' => $img_type); + + + //de activate older one + $this->PD_Model->updateRecords(array('isactive' => 0),PDDOCUMENTS,$record_data); + + + $record_data['pd_document_name'] = $temp_file_name; + $id = $this->PD_Model->saveRecords($record_data,PDDOCUMENTS); + $uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,$time = '+15 minutes'); + if($id) + { + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $id; + $data['uri'] = $uri; + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NOT_FOUND; + $data['msg'] = 'Something Went Wrong! Try Later'; + $this->response($data,REST_Controller::HTTP_OK); + } + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NOT_FOUND; + $data['msg'] = 'Something Went Wrong! Try Later'; + $this->response($data,REST_Controller::HTTP_OK); + } + + + } + } diff --git a/api/application/controllers/Sales_PD_Controller.php b/api/application/controllers/Sales_PD_Controller.php index 635f8641..32d90a20 100644 --- a/api/application/controllers/Sales_PD_Controller.php +++ b/api/application/controllers/Sales_PD_Controller.php @@ -258,7 +258,7 @@ class Sales_PD_Controller extends REST_Controller { { $lender_id = $this->uri->segment(2); $user_id = $this->uri->segment(3); - $columns = array('SALES_PD_DATA.sales_pd_id','SALES_PD_DATA.sales_pd_sno','SALES_PD_DATA.applicant_name','concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as officer_name','SALES_PD_DATA.applicant_id','SALES_PD_DATA.lender_id','SALES_PD_DATA.product_id','SALES_PD_DATA.is_pdf','SALES_PD_DATA.is_edited','ENTITY.short_name','PRODUCT.abbr','SALES_PD_DATA.createdon','SALES_PD_DATA.status','SALES_PD_DATA.sales_pd_type','SALES_PD_DATA.rand_string' + $columns = array('SALES_PD_DATA.sales_pd_id','SALES_PD_DATA.sales_pd_sno','SALES_PD_DATA.applicant_name','concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as officer_name','SALES_PD_DATA.applicant_id','SALES_PD_DATA.lender_id','SALES_PD_DATA.product_id','SALES_PD_DATA.is_pdf','SALES_PD_DATA.is_edited','ENTITY.short_name','PRODUCT.abbr','SALES_PD_DATA.createdon','SALES_PD_DATA.status','SALES_PD_DATA.sales_pd_type','SALES_PD_DATA.rand_string','SALES_PD_DATA.isactive' // ,"DATE_FORMAT(SALES_PD_DATA.createdon,'%Y-%m-%d') as modify","DATE_ADD(CURDATE(),INTERVAL '-10' DAY) as currd", // "(CURDATE()) as daye10" ); @@ -275,10 +275,10 @@ class Sales_PD_Controller extends REST_Controller { 'jointype' => 'LEFT') ); - $where_condition_array = array(); + $where_condition_array['SALES_PD_DATA.isactive'] = 1; if(is_numeric($lender_id)) { - $where_condition_array = array('SALES_PD_DATA.lender_id' => $lender_id); + $where_condition_array['SALES_PD_DATA.lender_id'] = $lender_id; } // FILTERING THE LAST 10 DAYS RECORDS @@ -291,10 +291,12 @@ class Sales_PD_Controller extends REST_Controller { if($user_id && is_numeric($user_id)) { - $where_condition_array = array('SALES_PD_DATA.createdby' => $user_id); + $where_condition_array['SALES_PD_DATA.createdby'] = $user_id; } $order_by = 'SALES_PD_DATA.sales_pd_id'; $sales_pd_data = $this->Sales_PD_Model->getJoinRecords($columns,$table,$joins,$where_condition_array,$order_by,'DESC'); + + //print_r($this->db->last_query());die(); if(count($sales_pd_data)) { $data['dataStatus'] = true; @@ -503,15 +505,7 @@ class Sales_PD_Controller extends REST_Controller { $is_entry_done = null; $id = null; //print_r($records);die(); - /************ASSIGN Random URL******************/ - $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-'; - $charactersLength = strlen($characters); - $randomString = ''; - for ($i = 0; $i < 16; $i++) - { - $randomString .= $characters[rand(0, $charactersLength - 1)]; - } - $records['rand_string'] = $randomString; + log_message('ERROR','####SALESPD SAVE CALLED'); @@ -526,7 +520,15 @@ class Sales_PD_Controller extends REST_Controller { { - + /************ASSIGN Random URL******************/ + $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-'; + $charactersLength = strlen($characters); + $randomString = ''; + for ($i = 0; $i < 16; $i++) + { + $randomString .= $characters[rand(0, $charactersLength - 1)]; + } + $records['rand_string'] = $randomString; log_message('ERROR','####INSERT NEW SALESPD'); $salepd_serial_no = count($lender_short_name)? $lender_short_name[0]['short_name']:'UNKNOWN'; $salepd_serial_no .= count($product_short_name)? '-'.$product_short_name[0]['abbr']:'-UNKNOWN'; @@ -643,6 +645,7 @@ class Sales_PD_Controller extends REST_Controller { $data['dataStatus'] = true; $data['records'] = $id; $data['status'] = REST_Controller::HTTP_OK; + if(isset($records['rand_string'])){ $data['rand_string'] = $records['rand_string']; } $this->response($data,REST_Controller::HTTP_OK); } else @@ -979,13 +982,13 @@ public function filterSalesPDList_post() { public function getSalesPDImgDataCusLink_post() { - $sales_pd_id = $this->post('sales_pd_id'); + $rand_string = $this->post('rand_string'); - $sales_pd_master_data = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('sales_pd_id' => $sales_pd_id),SALES_PD_DATA); + $sales_pd_master_data = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('rand_string' => $rand_string),SALES_PD_DATA); - $sales_pd_img_data = $this->Sales_PD_Model->selectCustomRecords(array('doc_id', 'fk_sales_pd_id','img','img_name','isactive'),array('fk_sales_pd_id' => $sales_pd_id,'isactive' => 1,'img_name!=' => 'satellite'),SALEPD_DOCS); + $sales_pd_img_data = $this->Sales_PD_Model->selectCustomRecords(array('doc_id', 'fk_sales_pd_id','img','img_name','isactive'),array('fk_sales_pd_id' => $sales_pd_master_data[0]['sales_pd_id'],'isactive' => 1,'img_name!=' => 'satellite'),SALEPD_DOCS); - //print_r($sales_pd_img_data); + //print_r($sales_pd_img_data);die(); //sales tele pd img structure array $imgs = array('selfie_with_person_met' => array('is_multiple' => 0,'img_name' => 'Selfie of the person contacted'),'name_board_seen' => array('is_multiple' => 1,'img_name' => 'Business Name Board'),'stock_image' => array('is_multiple' => 1,'img_name' => 'Stock Images'),'workplace_interior_image' => array('is_multiple' => 1,'img_name' => 'Work Place Interior')); @@ -995,34 +998,69 @@ public function filterSalesPDList_post() { foreach ($imgs as $key => $value) { + //echo "FISRT LOOP****$key"; foreach ($sales_pd_img_data as $sales_pd_img_data_key => $sales_pd_img_data_value) { + //echo "SEC LOOP****"; if($key == $sales_pd_img_data_value['img_name']) { if($value['is_multiple']) { if(!array_key_exists($key,$img_data)) { - $img_data[$key] = array('img_key' => $key,'img_name' => $value['img_name'],'img_data' => [array('img_url' => $sales_pd_img_data_value['img'])],'is_multiple' => 1,'section_heading' => $value['img_name']); + $img_data[$key] = array('img_key' => $key,'img_name' => $value['img_name'],'img_data' => [array('img_url' => $sales_pd_img_data_value['img'] ? $sales_pd_img_data_value['img'] : '')],'is_multiple' => 1,'section_heading' => $value['img_name']); } else { - $img_data[$key]['img_data'][] = array('img_url' => $sales_pd_img_data_value['img']); + $img_data[$key]['img_data'][] = array('img_url' => $sales_pd_img_data_value['img'] ? $sales_pd_img_data_value['img'] : ''); } } else { - $img_data[$key] = array('img_key' => $key,'img_name' => $value['img_name'],'img_url' => $sales_pd_img_data_value['img'],'is_multiple' => 0,'section_heading' => $value['img_name']);//$sales_pd_img_data_value['img'] + $img_data[$key] = array('img_key' => $key,'img_name' => $value['img_name'],'img_url' => $sales_pd_img_data_value['img'] ? $sales_pd_img_data_value['img'] : '','is_multiple' => 0,'section_heading' => $value['img_name']);//$sales_pd_img_data_value['img'] } unset($sales_pd_img_data[$sales_pd_img_data_key]); + //break; } - else - { - $img_data[$key] = array('img_key' => $key,'img_name' => $value['img_name'],'img_url' => $value['is_multiple'] == 0 ? '' : array(),'is_multiple' => $value['is_multiple'],'section_heading' => $value['img_name']); - } + // else + // { + + // if(!$value['is_multiple']) + // { + + // $img_data[$key] = array('img_key' => $key,'img_name' => $value['img_name'],'img_url' => $value['is_multiple'] == 0 ? '' : array(),'is_multiple' => $value['is_multiple'],'section_heading' => $value['img_name']); + // } + // else + // { + // if(!array_key_exists($key,$img_data)) + // { + // $img_data[$key] = array('img_key' => $key,'img_name' => $value['img_name'],'img_data' => [array('img_url' => $sales_pd_img_data_value['img'] ? 'Y' : 'N')],'is_multiple' => 1,'section_heading' => $value['img_name']); + // } + // else + // { + // $img_data[$key]['img_data'][] = array('img_url' => $sales_pd_img_data_value['img'] ? 'yes' : 'No'); + // } + // } + + // } } + + //IF current img key is not exist in existing img arry + + if(!array_key_exists($key,$img_data)) + { + + if(!$value['is_multiple']) + { + $img_data[$key] = array('img_key' => $key,'img_name' => $value['img_name'],'img_url' => '','is_multiple' => $value['is_multiple'],'section_heading' => $value['img_name']); + } + else + { + $img_data[$key] = array('img_key' => $key,'img_name' => $value['img_name'],'img_data' => array(),'is_multiple' => $value['is_multiple'],'section_heading' => $value['img_name']); + } + } } $img_data = array_values($img_data); @@ -1047,7 +1085,7 @@ public function filterSalesPDList_post() { //print_r($img_data); $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; - $data['records'] = array('img_data' => $img_data,'is_cus_link_disabled' => $sales_pd_master_data[0]['is_cus_link_disabled']); + $data['records'] = array('sales_pd_id' => $sales_pd_master_data[0]['sales_pd_id'],'img_data' => $img_data,'is_cus_link_disabled' => $sales_pd_master_data[0]['is_cus_link_disabled']); $this->response($data,REST_Controller::HTTP_OK); } diff --git a/api/application/libraries/AWS_S3.php b/api/application/libraries/AWS_S3.php index c01a43ba..c0cf8b8e 100644 --- a/api/application/libraries/AWS_S3.php +++ b/api/application/libraries/AWS_S3.php @@ -137,9 +137,9 @@ class AWS_S3 // echo "Keys retrieved!" ; // //print_r($objects); - // foreach ($objects as $object) { - // print_r($object) ; - // } + foreach ($objects as $object) { + print_r($object) ; + } } catch (S3Exception $e) { echo $e->getMessage() . PHP_EOL; } @@ -212,6 +212,20 @@ return $result; 'Bucket' => $BUCKETNAME]); //////print_r($result); } + + public function copyS3Object($targetBucket,$sourceBucket,$sourceKeyname,$tagetKeyname) + { + + //echo $sourceBucket.'/'.$sourceKeyname; + // Copy an object. + $res = $this->S3->copyObject([ + 'Bucket' => $targetBucket, + 'Key' => $tagetKeyname.'.png', + 'CopySource' => $sourceBucket.'/'.$sourceKeyname.'/v4MLA2019-01-12-18:01:21.png' + ]); + + print($res); + } } ?> \ No newline at end of file diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index 58bcca64..398962ea 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -11,10 +11,10 @@ class PD_Model extends SPARQ_Model { } - public function listLessPDDetails($page,$limit,$sort,$pdofficerid,$datetype,$fdate,$tdate,$lenderid,$status,$lender_details)// $page represents mysql offset + public function listLessPDDetails($page,$limit,$sort,$pdofficerid,$datetype,$fdate,$tdate,$lenderid,$status,$lender_details,$pdagencyid)// $page represents mysql offset { - //echo $status;die(); - $this->db->SELECT('PDTRIGGER.pd_id,PDTRIGGER.imgc_fin_institute,PDTRIGGER.pd_sno,PDTRIGGER.fk_lender_id,PDTRIGGER.sub_entity_id,SUBENTITY.short_name as sub_entity_short_name,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name, PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PRODUCTS.prod_catagory,PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i:%s") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i:%s") as master_updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDTRIGGER.other_pincode,PDAPPLICANTSDETAILS.applicant_name,PDTRIGGER.is_otp_done,PDTRIGGER.is_child,PDTRIGGER.parent_pd_id,PDTRIGGER.fk_primary_address_id,PDTRIGGER.fk_address_id,PDTRIGGER.encrypted_url,PDTRIGGER.random_string,PDTRIGGER.pd_qc_note,ENTITY.is_sms_enabled,ENTITY.is_mail_enabled,ENTITY.is_app_notify_enabled,PDTRIGGER.is_notify_enabled,(SELECT DATE_FORMAT(createdon,"%d/%m/%Y") FROM h_common_masters where PDTRIGGER.pd_id = primary_key AND field_name = "pd_status" order by log_id DESC limit 1) as updatedon,ENTITYFININSTITUTION.institute_name as fin_institute_name,PDTRIGGER.is_video_merged'); + //echo $pd_agency_id;die(); + $this->db->SELECT('PDTRIGGER.pd_id,PDTRIGGER.imgc_fin_institute,PDTRIGGER.pd_sno,PDTRIGGER.fk_lender_id,PDTRIGGER.sub_entity_id,SUBENTITY.short_name as sub_entity_short_name,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name, PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PRODUCTS.prod_catagory,PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i:%s") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i:%s") as master_updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDTRIGGER.other_pincode,PDAPPLICANTSDETAILS.applicant_name,PDTRIGGER.is_otp_done,PDTRIGGER.is_child,PDTRIGGER.parent_pd_id,PDTRIGGER.fk_primary_address_id,PDTRIGGER.fk_address_id,PDTRIGGER.encrypted_url,PDTRIGGER.random_string,PDTRIGGER.pd_qc_note,ENTITY.is_sms_enabled,ENTITY.is_mail_enabled,ENTITY.is_app_notify_enabled,PDTRIGGER.is_notify_enabled,(SELECT DATE_FORMAT(createdon,"%d/%m/%Y") FROM h_common_masters where PDTRIGGER.pd_id = primary_key AND field_name = "pd_status" order by log_id DESC limit 1) as updatedon,ENTITYFININSTITUTION.institute_name as fin_institute_name,PDTRIGGER.is_video_merged,PDTRIGGER.vendor_status'); $this->db->FROM(PDTRIGGER.' as PDTRIGGER'); $this->db->JOIN(ENTITY.' as ENTITY','PDTRIGGER.fk_lender_id = ENTITY.entity_id','LEFT'); $this->db->JOIN(ENTITY.' as SUBENTITY','PDTRIGGER.sub_entity_id = SUBENTITY.entity_id','LEFT'); @@ -90,6 +90,10 @@ class PD_Model extends SPARQ_Model { } + if($pdagencyid != "" || $pdagencyid != null) + { + $this->db->WHERE('PDTRIGGER.pd_agency_id',$pdagencyid); + } if($status != "" || $status != null) { $this->db->WHERE('PDTRIGGER.pd_status',strtoupper($status)); @@ -128,7 +132,7 @@ class PD_Model extends SPARQ_Model { // ----END OF FILTERING THE LAST 10 DAYS RECORDS--- $this->db->ORDER_BY('PDTRIGGER.pd_id',$sort); - $this->db->LIMIT($limit,$page); + //$this->db->LIMIT($limit,$page); $result_array = $this->db->GET()->result_array(); //print_r($this->db->last_query());die(); if(count($result_array) != 0) @@ -171,11 +175,11 @@ class PD_Model extends SPARQ_Model { //PD List with Common Filters - public function PDListwithGlobalFilters($pd_type,$pd_status,$pd_from_date,$pd_to_date,$pd_city,$pd_products,$pd_lender,$pd_applicant_name,$pd_applicant_lender_ref,$pd_officer_name,$include_archive,$pd_officer_id) + public function PDListwithGlobalFilters($pd_type,$pd_status,$pd_from_date,$pd_to_date,$pd_city,$pd_products,$pd_lender,$pd_applicant_name,$pd_applicant_lender_ref,$pd_officer_name,$include_archive,$pd_officer_id,$pd_agency_id) { $limit = 1000; - $this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.pd_sno,PDTRIGGER.fk_lender_id,PDTRIGGER.sub_entity_id,SUBENTITY.short_name as sub_entity_short_name,PDTRIGGER.imgc_fin_institute,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,ENTITY.is_score_card_enabled,ENTITY.is_otp_enabled, PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name,PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation,PDTRIGGER.pd_date_of_initiation as pd_date_of_initiation_sqlformat, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PRODUCTS.prod_catagory, PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %h:%i:%s %p") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i %p") as master_updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.lender_sales_person,concat(LENDERSALESPERSON.first_name," ",LENDERSALESPERSON.last_name) as lender_sales_person_name,LENDERSALESPERSON.mobile_no as lender_sales_contact_mobileno,LENDERSALESPERSON.email as lender_sales_person_email,PDTRIGGER.lender_credit_person,concat(LENDERCREDITPERSON.first_name," ",LENDERCREDITPERSON.last_name) as lender_credit_person_name,LENDERCREDITPERSON.mobile_no as lender_credit_person_contact_mobileno,LENDERCREDITPERSON.email as lender_credit_person_email,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,PDTRIGGER.scheduled_on as scheduled_on_for_validation,DATE_FORMAT(PDTRIGGER.scheduled_on,"%dth %b %Y ") as scheduled_date_for_log,DATE_FORMAT(PDTRIGGER.scheduled_on,"%h:%i %p") as scheduled_time_for_log,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.bounce_reason,PDTRIGGER.bounce_reason_others,BOUNCEMASTER.bounce_reason_name,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDAPPLICANTSDETAILS.applicant_name,PDAPPLICANTSDETAILS.applicant_name as main_applicant,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDAPPLICANTSDETAILS.applicant_title_name,TITLES.name as title_name,PDTRIGGER.pd_contact_landline,PDTRIGGER.other_pincode,PDTRIGGER.is_otp_done,OTPREJECTION.rejection_reason,PDTRIGGER.otp_reject_other_reason,PDTRIGGER.encrypted_url,PDTRIGGER.is_child,PDTRIGGER.parent_pd_id,PDTRIGGER.fk_primary_address_id,PDTRIGGER.fk_address_id,PDTRIGGER.start_location,PDTRIGGER.satellite_image_base64_blob,DATE_FORMAT(PDTRIGGER.pd_report_generated_date,"%d/%m/%Y %h:%i:%s %p") as pd_report_generated_date,DATE_FORMAT(PDTRIGGER.pd_visit_date,"%d/%m/%Y %h:%i:%s %p") as pd_visit_date,PDTRIGGER.random_string,PDTRIGGER.pd_report_html_filename,PDTRIGGER.is_qc_edited,PDTRIGGER.is_zip_created,PDTRIGGER.pd_qc_note,PDTRIGGER.is_notify_enabled,(SELECT DATE_FORMAT(createdon,, "%d/%m/%Y") FROM h_common_masters where PDTRIGGER.pd_id = primary_key AND field_name = "pd_status" order by log_id DESC limit 1) as updatedon,ENTITYFININSTITUTION.institute_name as fin_institute_name'); + $this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.pd_sno,PDTRIGGER.fk_lender_id,PDTRIGGER.sub_entity_id,SUBENTITY.short_name as sub_entity_short_name,PDTRIGGER.imgc_fin_institute,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,ENTITY.is_score_card_enabled,ENTITY.is_otp_enabled, PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name,PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation,PDTRIGGER.pd_date_of_initiation as pd_date_of_initiation_sqlformat, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PRODUCTS.prod_catagory, PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %h:%i:%s %p") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i %p") as master_updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.lender_sales_person,concat(LENDERSALESPERSON.first_name," ",LENDERSALESPERSON.last_name) as lender_sales_person_name,LENDERSALESPERSON.mobile_no as lender_sales_contact_mobileno,LENDERSALESPERSON.email as lender_sales_person_email,PDTRIGGER.lender_credit_person,concat(LENDERCREDITPERSON.first_name," ",LENDERCREDITPERSON.last_name) as lender_credit_person_name,LENDERCREDITPERSON.mobile_no as lender_credit_person_contact_mobileno,LENDERCREDITPERSON.email as lender_credit_person_email,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,PDTRIGGER.scheduled_on as scheduled_on_for_validation,DATE_FORMAT(PDTRIGGER.scheduled_on,"%dth %b %Y ") as scheduled_date_for_log,DATE_FORMAT(PDTRIGGER.scheduled_on,"%h:%i %p") as scheduled_time_for_log,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.bounce_reason,PDTRIGGER.bounce_reason_others,BOUNCEMASTER.bounce_reason_name,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDAPPLICANTSDETAILS.applicant_name,PDAPPLICANTSDETAILS.applicant_name as main_applicant,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDAPPLICANTSDETAILS.applicant_title_name,TITLES.name as title_name,PDTRIGGER.pd_contact_landline,PDTRIGGER.other_pincode,PDTRIGGER.is_otp_done,OTPREJECTION.rejection_reason,PDTRIGGER.otp_reject_other_reason,PDTRIGGER.encrypted_url,PDTRIGGER.is_child,PDTRIGGER.parent_pd_id,PDTRIGGER.fk_primary_address_id,PDTRIGGER.fk_address_id,PDTRIGGER.start_location,PDTRIGGER.satellite_image_base64_blob,DATE_FORMAT(PDTRIGGER.pd_report_generated_date,"%d/%m/%Y %h:%i:%s %p") as pd_report_generated_date,DATE_FORMAT(PDTRIGGER.pd_visit_date,"%d/%m/%Y %h:%i:%s %p") as pd_visit_date,PDTRIGGER.random_string,PDTRIGGER.pd_report_html_filename,PDTRIGGER.is_qc_edited,PDTRIGGER.is_zip_created,PDTRIGGER.pd_qc_note,PDTRIGGER.is_notify_enabled,(SELECT DATE_FORMAT(createdon,, "%d/%m/%Y") FROM h_common_masters where PDTRIGGER.pd_id = primary_key AND field_name = "pd_status" order by log_id DESC limit 1) as updatedon,ENTITYFININSTITUTION.institute_name as fin_institute_name,PDTRIGGER.vendor_status'); $this->db->FROM(PDTRIGGER.' as PDTRIGGER'); $this->db->JOIN(ENTITY.' as ENTITY','PDTRIGGER.fk_lender_id = ENTITY.entity_id ','LEFT'); $this->db->JOIN(ENTITY.' as SUBENTITY','PDTRIGGER.sub_entity_id = SUBENTITY.entity_id ','LEFT'); @@ -255,6 +259,10 @@ class PD_Model extends SPARQ_Model { { $this->db->LIKE('concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name)',$pd_officer_name); } + if($pd_agency_id != "" || $pd_agency_id != null ) + { + $this->db->LIKE('PDTRIGGER.pd_agency_id',$pd_agency_id); + } if($pd_officer_id != "" || $pd_officer_id != null ) { $this->db->LIKE('PDTRIGGER.fk_pd_allocated_to',"$pd_officer_id"); @@ -885,7 +893,7 @@ class PD_Model extends SPARQ_Model { */ public function getPDMasterDetails($pdid,$random_string = null) { - $this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.pd_sno,PDTRIGGER.fk_lender_id,PDTRIGGER.sub_entity_id,SUBENTITY.short_name as sub_entity_short_name,PDTRIGGER.imgc_fin_institute,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,ENTITY.is_score_card_enabled,ENTITY.is_otp_enabled, PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name,PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation,PDTRIGGER.pd_date_of_initiation as pd_date_of_initiation_sqlformat, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PRODUCTS.prod_catagory,PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %h:%i:%s %p") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i %p") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.lender_sales_person,concat(LENDERSALESPERSON.first_name," ",LENDERSALESPERSON.last_name) as lender_sales_person_name,LENDERSALESPERSON.mobile_no as lender_sales_contact_mobileno,LENDERSALESPERSON.email as lender_sales_person_email,PDTRIGGER.lender_credit_person,concat(LENDERCREDITPERSON.first_name," ",LENDERCREDITPERSON.last_name) as lender_credit_person_name,LENDERCREDITPERSON.mobile_no as lender_credit_person_contact_mobileno,LENDERCREDITPERSON.email as lender_credit_person_email,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,PDTRIGGER.scheduled_on as scheduled_on_for_validation,DATE_FORMAT(PDTRIGGER.scheduled_on,"%dth %b %Y ") as scheduled_date_for_log,DATE_FORMAT(PDTRIGGER.scheduled_on,"%h:%i %p") as scheduled_time_for_log,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.bounce_reason,PDTRIGGER.bounce_reason_others,BOUNCEMASTER.bounce_reason_name,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDAPPLICANTSDETAILS.applicant_name as main_applicant,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDAPPLICANTSDETAILS.applicant_title_name,TITLES.name as title_name,PDTRIGGER.pd_contact_landline,PDTRIGGER.other_pincode,PDTRIGGER.is_otp_done,OTPREJECTION.rejection_reason,PDTRIGGER.otp_reject_other_reason,PDTRIGGER.encrypted_url,PDTRIGGER.is_child,PDTRIGGER.parent_pd_id,PDTRIGGER.fk_primary_address_id,PDTRIGGER.fk_address_id,PDTRIGGER.start_location,PDTRIGGER.satellite_image_base64_blob,DATE_FORMAT(PDTRIGGER.pd_report_generated_date,"%d/%m/%Y %h:%i:%s %p") as pd_report_generated_date,DATE_FORMAT(PDTRIGGER.pd_visit_date,"%d/%m/%Y %h:%i:%s %p") as pd_visit_date,PDTRIGGER.random_string,PDTRIGGER.pd_report_html_filename,PDTRIGGER.is_qc_edited,PDTRIGGER.is_zip_created,PDTRIGGER.pd_qc_note,ENTITY.is_sms_enabled,ENTITY.is_mail_enabled,ENTITY.is_app_notify_enabled,PDTRIGGER.is_notify_enabled,ENTITYFININSTITUTION.institute_name as fin_institute_name,PDTRIGGER.is_img_pdf_created,PDTRIGGER.is_video_merged'); + $this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.pd_sno,PDTRIGGER.fk_lender_id,PDTRIGGER.sub_entity_id,SUBENTITY.short_name as sub_entity_short_name,PDTRIGGER.imgc_fin_institute,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,ENTITY.is_score_card_enabled,ENTITY.is_otp_enabled, PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name,PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation,PDTRIGGER.pd_date_of_initiation as pd_date_of_initiation_sqlformat, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PRODUCTS.prod_catagory,PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %h:%i:%s %p") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i %p") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.lender_sales_person,concat(LENDERSALESPERSON.first_name," ",LENDERSALESPERSON.last_name) as lender_sales_person_name,LENDERSALESPERSON.mobile_no as lender_sales_contact_mobileno,LENDERSALESPERSON.email as lender_sales_person_email,PDTRIGGER.lender_credit_person,concat(LENDERCREDITPERSON.first_name," ",LENDERCREDITPERSON.last_name) as lender_credit_person_name,LENDERCREDITPERSON.mobile_no as lender_credit_person_contact_mobileno,LENDERCREDITPERSON.email as lender_credit_person_email,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,PDTRIGGER.scheduled_on as scheduled_on_for_validation,DATE_FORMAT(PDTRIGGER.scheduled_on,"%dth %b %Y ") as scheduled_date_for_log,DATE_FORMAT(PDTRIGGER.scheduled_on,"%h:%i %p") as scheduled_time_for_log,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.bounce_reason,PDTRIGGER.bounce_reason_others,BOUNCEMASTER.bounce_reason_name,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDAPPLICANTSDETAILS.applicant_name as main_applicant,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDAPPLICANTSDETAILS.applicant_title_name,TITLES.name as title_name,PDTRIGGER.pd_contact_landline,PDTRIGGER.other_pincode,PDTRIGGER.is_otp_done,OTPREJECTION.rejection_reason,PDTRIGGER.otp_reject_other_reason,PDTRIGGER.encrypted_url,PDTRIGGER.is_child,PDTRIGGER.parent_pd_id,PDTRIGGER.fk_primary_address_id,PDTRIGGER.fk_address_id,PDTRIGGER.start_location,PDTRIGGER.satellite_image_base64_blob,DATE_FORMAT(PDTRIGGER.pd_report_generated_date,"%d/%m/%Y %h:%i:%s %p") as pd_report_generated_date,DATE_FORMAT(PDTRIGGER.pd_visit_date,"%d/%m/%Y %h:%i:%s %p") as pd_visit_date,PDTRIGGER.random_string,PDTRIGGER.pd_report_html_filename,PDTRIGGER.is_qc_edited,PDTRIGGER.is_zip_created,PDTRIGGER.pd_qc_note,ENTITY.is_sms_enabled,ENTITY.is_mail_enabled,ENTITY.is_app_notify_enabled,PDTRIGGER.is_notify_enabled,ENTITYFININSTITUTION.institute_name as fin_institute_name,PDTRIGGER.is_img_pdf_created,PDTRIGGER.is_video_merged,PDTRIGGER.vendor_status'); $this->db->FROM(PDTRIGGER.' as PDTRIGGER'); $this->db->JOIN(ENTITY.' as ENTITY','PDTRIGGER.fk_lender_id = ENTITY.entity_id ','LEFT'); $this->db->JOIN(ENTITY.' as SUBENTITY','PDTRIGGER.sub_entity_id = SUBENTITY.entity_id ','LEFT'); @@ -2005,5 +2013,13 @@ class PD_Model extends SPARQ_Model { return array(); } } + + + + function getAllJSONFormData($pdid) + { + return $data = $this->db->select('fk_form_id, company_id, json, processed_json,rental_count_id')->from(PDFORMDETAILSJSON)->where('fk_pd_id',$pdid)->where('isactive',1)->get()->result_array(); + } + } \ No newline at end of file diff --git a/api/application/models/Sales_PD_Model.php b/api/application/models/Sales_PD_Model.php index 58dc6eca..7557e4f4 100644 --- a/api/application/models/Sales_PD_Model.php +++ b/api/application/models/Sales_PD_Model.php @@ -44,6 +44,7 @@ class Sales_PD_Model extends SPARQ_Model { if(!empty($sales_pd_officer_id)) { $this->db->WHERE('SALES_PD_DATA.createdby',$sales_pd_officer_id); } + $this->db->WHERE('SALES_PD_DATA.isactive',1); $this->db->order_by('SALES_PD_DATA.sales_pd_id','desc'); $this->db->limit(1000,0); $result = $this->db->get()->result_array();