DataDump New Format : ps

This commit is contained in:
VE10-Sanjeev 2022-12-22 13:17:10 +05:30
parent 79bc56edd1
commit 6a9108faeb
4 changed files with 46 additions and 1970 deletions

View File

@ -724,4 +724,4 @@ defined('AGENCYLIST') OR define('AGENCYLIST','t_smc_agency_list');
defined('TEMPLATE_JSON_V2') OR define('TEMPLATE_JSON_V2',"m_template_json_v2");
defined('TEMPLATE_MAP_V2') OR define('TEMPLATE_MAP_V2',"m_template_mapping_v2");
defined('DATADUMPREQUEST') OR define('DATADUMPREQUEST',"t_datadump_request");

View File

@ -368,9 +368,9 @@ $route['googleSheet'] = 'Data_Dump_Controller/googleSheet';
$route['getListPDOfficersForNotification'] = 'PD_Controller/getListPDOfficersForNotification';
$route['sendNotificationToOfficers'] = 'PD_Controller/sendNotificationToOfficers';
$route['saveDatadumpRequest'] = 'Request_DataDump_Controller/saveDatadumpRequest';
$route['getDatadumpRequestList'] = 'Request_DataDump_Controller/getDatadumpRequestList';
$route['getMasterForDataDump'] = 'Request_DataDump_Controller/getMasterForDataDump';
$route['getRequestForDataDump'] = 'Request_DataDump_Controller/getRequestForDataDump';
$route['addgoogleCalenderEvent'] = 'GC_Event_Controller/addGoogleCalenterEvent';//dummy checking purpose
$route['getEventList'] = 'GC_Event_Controller/getGoogleCalenderEventList';//dummy checking purpose
$route['getEvent'] = 'GC_Event_Controller/getEventFromGoogleCalender';//dummy checking purpose

File diff suppressed because it is too large Load Diff

View File

@ -72,61 +72,8 @@ class Data_Dump_Model extends SPARQ_Model {
}
}
function getRequestForDataDump($arr){
$pdid = isset($arr['pd_id'])?$arr['pd_id']:[];
$fromd = isset($arr['from_date'])?$arr['from_date']:null;
$tod= isset($arr['to_date'])?$arr['to_date']:null;
$type = isset($arr['pd_type_id'])?$arr['pd_type_id']:null;
$prod = isset($arr['product_id'])?$arr['product_id']:null;
$cseg = isset($arr['customer_segment_id'])?$arr['customer_segment_id']:null;
### 2 tables t_pd_form_details_json and t_pd_triggered
$this->db->select('PDFORMDETAILSJSON.pd_form_detail_json_id, PDFORMDETAILSJSON.fk_pd_id, PDFORMDETAILSJSON.fk_form_id, PDFORMDETAILSJSON.isactive, PDFORMDETAILSJSON.json, DATE_FORMAT(PDFORMDETAILSJSON.createdon,"%d/%m/%Y %H:%i:%s") as createdon, PDFORMDETAILSJSON.processed_json, PDFORMDETAILSJSON.updatedon,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %H:%i:%s") as completed_on,PDTRIGGER.fk_product_id, PDTRIGGER.fk_customer_segment,PDTRIGGER.fk_pd_type,PDTRIGGER.pd_status,PDTRIGGER.createdon');
$this->db->from(PDFORMDETAILSJSON.' as PDFORMDETAILSJSON');
$this->db->join(PDTRIGGER.' as PDTRIGGER','PDTRIGGER.pd_id = PDFORMDETAILSJSON.fk_pd_id ','LEFT');
if(!empty($pdid))
{
$this->db->where_in('PDFORMDETAILSJSON.fk_pd_id',$pdid);
}
if(($fromd != "" || $fromd != null) && ($tod != "" || $tod != null)) {
$this->db->where('PDTRIGGER.completed_on BETWEEN '. "'$fromd'". ' AND '. "'$tod'" );
}
else if($fromd != "" && $fromd != null) {
$this->db->where("DATE_FORMAT(PDTRIGGER.completed_on,'%Y-%m-%d')",$fromd);
}
else if($tod != "" && $tod != null) {
$this->db->where("DATE_FORMAT(PDTRIGGER.completed_on,'%Y-%m-%d')",$tod);
}
if($prod != ""){
$this->db->where('PDTRIGGER.fk_product_id',$prod);
}
if($type != ""){
$this->db->where('PDTRIGGER.fk_pd_type',$type);
}
if($cseg != ""){
$this->db->where('PDTRIGGER.fk_customer_segment',$cseg);
}
$this->db->WHERE('PDFORMDETAILSJSON.isactive',1);
$this->db->order_by('PDFORMDETAILSJSON.pd_form_detail_json_id','desc');
// $this->db->limit(5);
$result = $this->db->get()->result_array();
// echo count($result);print_r($result);print_r($this->db->last_query());die();
return $result;
}
public function filtermasterfordatadumprequest(){
$result['pdtype'] = $this->db->select('PDTYPE.pd_type_id,PDTYPE.type_name')->from(PDTYPE.' as PDTYPE')->WHERE('PDTYPE.isactive',1)->GET()->result_array();
$result['product'] = $this->db->select('PRODUCTS.product_id,PRODUCTS.name,PRODUCTS.abbr')->from(PRODUCTS.' as PRODUCTS')->WHERE('PRODUCTS.isactive',1)->GET()->result_array();
$result['customersegment'] = $this->db->select('CUSTOMERSEGMENT.customer_segment_id,CUSTOMERSEGMENT.name,CUSTOMERSEGMENT.abbr')->from(CUSTOMERSEGMENT.' as CUSTOMERSEGMENT')->WHERE('CUSTOMERSEGMENT.isactive',1)->GET()->result_array();
$result['city'] = $this->db->select('CITY.city_id, CITY.name')->from(CITY.' as CITY')->WHERE('CITY.isactive',1)->GET()->result_array();
$result['lender'] = $this->db->select(' ENTITY.entity_id, ENTITY.full_name, ENTITY.short_name')->from(ENTITY.' as ENTITY')->WHERE(' ENTITY.isactive',1)->GET()->result_array();
// $result['pdid'] = $this->db->select('PDTRIGGER.pd_sno,PDTRIGGER.pd_id,PDTRIGGER.pd_status')->from(PDTRIGGER.' as PDTRIGGER')->WHERE('PDTRIGGER.pd_status !=',"TRUNCATED")->GET()->result_array();
// $result['totalpd'] = count($result['pdid']);
// $result['overallpdcount'] = count($result['pdid']);
return $result;
}
### G-sheet Queries Starts Here
public function getId($flag,$keyword){
// echo "flag".$flag;
if($flag == 1){ $value = trim($keyword); $value = strtolower($value);
$select = "entity_id";$table = "m_entity";$where = "short_name";}
if($flag == 2){ $value = rtrim($keyword," ");$value = ltrim($value," "); $value = strtolower($value);
@ -172,67 +119,21 @@ class Data_Dump_Model extends SPARQ_Model {
}
// public function GsheetData($GSdata){
// }
### G-sheet Queries Ends Here
public function PDList($pd_type,$pd_status,$pd_from_date,$pd_to_date,$pd_city,$pd_products,$pd_lender,$pd_customer_segment)
{
### CSV-XLsheet Queries Starts Here
public function getDataDumpRequestList(){
$this->db->SELECT('DATADUMPREQUEST.request_id,DATADUMPREQUEST.fk_lender_id,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,DATADUMPREQUEST.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr,DATADUMPREQUEST.fk_pd_type_id,PDTYPE.type_name as pd_type_name,DATADUMPREQUEST.fk_customer_segment_id,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr,DATADUMPREQUEST.fk_city_id,CITY.name as city_name,DATE_FORMAT(DATADUMPREQUEST.from_date, "%d/%m/%Y") as from_date,DATE_FORMAT(DATADUMPREQUEST.to_date, "%d/%m/%Y") as to_date,DATADUMPREQUEST.status,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,DATADUMPREQUEST.fk_createdby ,DATE_FORMAT(DATADUMPREQUEST.createdon, "%d/%m/%Y") as createdon');
$this->db->FROM(DATADUMPREQUEST.' as DATADUMPREQUEST');
$this->db->JOIN(ENTITY.' as ENTITY','DATADUMPREQUEST.fk_lender_id = ENTITY.entity_id ','LEFT');
$this->db->JOIN(PRODUCTS.' as PRODUCTS','DATADUMPREQUEST.fk_product_id = PRODUCTS.product_id','LEFT');
$this->db->JOIN(PDTYPE.' as PDTYPE','DATADUMPREQUEST.fk_pd_type_id = PDTYPE.pd_type_id','LEFT');
$this->db->JOIN(CUSTOMERSEGMENT.' as CUSTOMERSEGMENT','DATADUMPREQUEST.fk_customer_segment_id = CUSTOMERSEGMENT.customer_segment_id','LEFT');
$this->db->JOIN(CITY.' as CITY','DATADUMPREQUEST.fk_city_id = CITY.city_id','LEFT');
$this->db->JOIN(USERPROFILE.' as USERPROFILE','DATADUMPREQUEST.fk_createdby = USERPROFILE.userid','LEFT');
$result_array = $this->db->GET()->result_array();
return $result_array;
// PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %h:%i:%s %p") as createdon, PDTRIGGER.fk_createdby, PDTRIGGER.fk_updatedby,PDTRIGGER.fk_pd_allocation_type, PDTRIGGER.fk_pd_allocated_to,PDTRIGGER.executive_id,PDTRIGGER.central_pd_officer_id,PDTRIGGER.fk_pd_template_id, 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, 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_credit_person,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.bounce_reason,PDTRIGGER.bounce_reason_others,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDTRIGGER.pd_branch_id,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDTRIGGER.pd_contact_landline,PDTRIGGER.other_pincode,PDTRIGGER.is_otp_done,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.random_string
$this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.pd_sno,PDTRIGGER.pd_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');
$this->db->JOIN(PRODUCTS.' as PRODUCTS','PDTRIGGER.fk_product_id = PRODUCTS.product_id','LEFT');
$this->db->JOIN(SUBPRODUCTS.' as SUBPRODUCTS','PDTRIGGER.fk_subproduct_id = SUBPRODUCTS.subproduct_id','LEFT');
$this->db->JOIN(PDTYPE.' as PDTYPE','PDTRIGGER.fk_pd_type = PDTYPE.pd_type_id','LEFT');
$this->db->JOIN(CUSTOMERSEGMENT.' as CUSTOMERSEGMENT','PDTRIGGER.fk_customer_segment = CUSTOMERSEGMENT.customer_segment_id','LEFT');
$this->db->JOIN(ENTITY.' as AGENCY','PDTRIGGER.pd_agency_id = AGENCY.entity_id','LEFT');
$this->db->JOIN(STATE.' as STATE','PDTRIGGER.fk_state = STATE.state_id ','LEFT');
$this->db->JOIN(CITY.' as CITY','PDTRIGGER.fk_city = CITY.city_id','LEFT');
$this->db->JOIN(PINCODE.' as PINCODE','PDTRIGGER.pincode = PINCODE.pincode_id','LEFT');
$this->db->WHERE('PDTRIGGER.pd_status =',COMPLETED);
if(!empty($pd_type))
{
$this->db->WHERE_IN('PDTRIGGER.fk_pd_type',$pd_type);
}
// if(!empty($pd_status)){
// $this->db->WHERE_IN('PDTRIGGER.pd_status',$pd_status);
// }
if(($pd_from_date != "" || $pd_from_date != null) && ($pd_to_date != "" || $pd_to_date != null))
{
$this->db->where('PDTRIGGER.completed_on BETWEEN ' ."'$pd_from_date'". ' AND ' ."'$pd_to_date'");
}
if(!empty($pd_city))
{
$this->db->WHERE_IN('PDTRIGGER.fk_city',$pd_city);
}
if(!empty($pd_products))
{
$this->db->WHERE_IN('PDTRIGGER.fk_product_id',$pd_products);
}
if(!empty($pd_lender))
{
$this->db->WHERE_IN('PDTRIGGER.fk_lender_id',$pd_lender);
}
else
{
$this->db->WHERE('PDTRIGGER.fk_lender_id != ',(ENVIRONMENT == 'production' ? 7 : 35));
}
if(!empty($pd_customer_segment))
{
$this->db->WHERE('PDTRIGGER.fk_customer_segment',$pd_customer_segment);
}
$this->db->ORDER_BY('PDTRIGGER.pd_id','DESC');
$result_array = $this->db->GET()->result_array();
// print_r($this->db->last_query());die();
return $result_array;
}
### CSV-XLsheet Queries Ends Here
}