List and filter sales api api Officerid fixes : ps
This commit is contained in:
parent
482445a5ae
commit
e0aa0ac24b
@ -561,11 +561,13 @@ class Sales_PD_Controller extends REST_Controller {
|
|||||||
$redirect_email = base64_decode($this->uri->segment(5)); # becoz email can't able to send in url. so encoded
|
$redirect_email = base64_decode($this->uri->segment(5)); # becoz email can't able to send in url. so encoded
|
||||||
// echo base64_decode($redirect_email);
|
// echo base64_decode($redirect_email);
|
||||||
|
|
||||||
$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.status','SALES_PD_DATA.sales_pd_type','SALES_PD_DATA.rand_string','SALES_PD_DATA.isactive','SALES_PD_DATA.city_id','CITY.name as city_name',
|
$columns = array('SALES_PD_DATA.sales_pd_id','SALES_PD_DATA.sales_pd_sno','SALES_PD_DATA.applicant_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.status','SALES_PD_DATA.sales_pd_type','SALES_PD_DATA.rand_string','SALES_PD_DATA.isactive','SALES_PD_DATA.city_id','CITY.name as city_name',
|
||||||
'(CASE WHEN SALES_PD_DATA.status = "STARTED" THEN SALES_PD_DATA.createdon WHEN SALES_PD_DATA.status = "COMPLETED" THEN SALES_PD_DATA.completed_date ELSE NULL END) AS createdon'
|
'(CASE WHEN SALES_PD_DATA.status = "STARTED" THEN SALES_PD_DATA.createdon WHEN SALES_PD_DATA.status = "COMPLETED" THEN SALES_PD_DATA.completed_date ELSE NULL END) AS createdon'
|
||||||
// ,"DATE_FORMAT(SALES_PD_DATA.createdon,'%Y-%m-%d') as modify","DATE_ADD(CURDATE(),INTERVAL '-10' DAY) as currd",
|
// ,"DATE_FORMAT(SALES_PD_DATA.createdon,'%Y-%m-%d') as modify","DATE_ADD(CURDATE(),INTERVAL '-10' DAY) as currd",
|
||||||
// "(CURDATE()) as daye10"
|
// "(CURDATE()) as daye10"
|
||||||
);
|
);
|
||||||
|
if($user_id && is_numeric($user_id)){array_push($columns, 'concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as officer_name');}
|
||||||
|
else if($user_id && is_string($user_id)){array_push($columns, 'SALES_PD_DATA.redirect_email as officer_name');}
|
||||||
$table = SALES_PD_DATA.' as SALES_PD_DATA';
|
$table = SALES_PD_DATA.' as SALES_PD_DATA';
|
||||||
$joins = array(
|
$joins = array(
|
||||||
array('table' => ENTITY. ' as ENTITY',
|
array('table' => ENTITY. ' as ENTITY',
|
||||||
@ -577,10 +579,13 @@ class Sales_PD_Controller extends REST_Controller {
|
|||||||
array('table' => CITY. ' as CITY',
|
array('table' => CITY. ' as CITY',
|
||||||
'condition' =>'SALES_PD_DATA.city_id = CITY.city_id',
|
'condition' =>'SALES_PD_DATA.city_id = CITY.city_id',
|
||||||
'jointype' => 'LEFT'),
|
'jointype' => 'LEFT'),
|
||||||
array('table' => USERPROFILE. ' as USERPROFILE',
|
|
||||||
'condition' =>'SALES_PD_DATA.createdby = USERPROFILE.userid',
|
|
||||||
'jointype' => 'LEFT')
|
|
||||||
);
|
);
|
||||||
|
if($user_id && is_numeric($user_id)){
|
||||||
|
$user_join = array('table' => USERPROFILE. ' as USERPROFILE',
|
||||||
|
'condition' =>'SALES_PD_DATA.createdby = USERPROFILE.userid',
|
||||||
|
'jointype' => 'LEFT');
|
||||||
|
array_push($joins, $user_join);
|
||||||
|
}
|
||||||
|
|
||||||
$or_where = array();
|
$or_where = array();
|
||||||
$where_condition_array['SALES_PD_DATA.isactive'] = 1;
|
$where_condition_array['SALES_PD_DATA.isactive'] = 1;
|
||||||
@ -1848,6 +1853,7 @@ public function filterSalesPDList_post() {
|
|||||||
$createdby = null;
|
$createdby = null;
|
||||||
$salepdid = null;
|
$salepdid = null;
|
||||||
$current_date = date("d/m/Y H:i:s");
|
$current_date = date("d/m/Y H:i:s");
|
||||||
|
|
||||||
// $reponse_arr = json_decode(,true);
|
// $reponse_arr = json_decode(,true);
|
||||||
// print_r(APPPATH."controller/newSalesPD.json");die();
|
// print_r(APPPATH."controller/newSalesPD.json");die();
|
||||||
$lenderid = (ENVIRONMENT == 'production' ? 7 : 35);
|
$lenderid = (ENVIRONMENT == 'production' ? 7 : 35);
|
||||||
@ -1922,7 +1928,7 @@ public function filterSalesPDList_post() {
|
|||||||
/*************Inserting Here ******************/
|
/*************Inserting Here ******************/
|
||||||
$records = array("sales_pd_sno" => $salepd_serial_no, "rand_string" => $randomString, "lender_id" => $lenderid, "product_id" => $product_id, "sales_pd_type" => $sales_pd_type, "applicant_id" => $applicantid, "applicant_name" => $applicantname, "isactive" => 1);
|
$records = array("sales_pd_sno" => $salepd_serial_no, "rand_string" => $randomString, "lender_id" => $lenderid, "product_id" => $product_id, "sales_pd_type" => $sales_pd_type, "applicant_id" => $applicantid, "applicant_name" => $applicantname, "isactive" => 1);
|
||||||
if($user_id != null){ $records["createdby"] = $createdby; }
|
if($user_id != null){ $records["createdby"] = $createdby; }
|
||||||
else{ $records["redirect_email"] = $usersemailid; }
|
else{ $records["redirect_email"] = $usersemailid; $user_id = base64_encode($usersemailid);}
|
||||||
|
|
||||||
$id = $this->Sales_PD_Model->saveRecords($records, SALES_PD_DATA);
|
$id = $this->Sales_PD_Model->saveRecords($records, SALES_PD_DATA);
|
||||||
$salepdid = $id;
|
$salepdid = $id;
|
||||||
@ -2051,10 +2057,8 @@ public function filterSalesPDList_post() {
|
|||||||
log_message('ERROR', '## 8) Redirect B4 '.$auth_user_id."#".$auth_password."#".$user_id."#".$role_id."#".$current_date."#".$usersemailid."#".$salepdid);
|
log_message('ERROR', '## 8) Redirect B4 '.$auth_user_id."#".$auth_password."#".$user_id."#".$role_id."#".$current_date."#".$usersemailid."#".$salepdid);
|
||||||
// MwiseSales@yahoo.com#sine1234#293#19#06/07/2023 16:02:57#mwisesales1@sine.com#904
|
// MwiseSales@yahoo.com#sine1234#293#19#06/07/2023 16:02:57#mwisesales1@sine.com#904
|
||||||
// https://demo.pdgenie.com/salespdpwa/#/auto?token=TXdpc2VTYWxlc0B5YWhvby5jb20jc2luZTEyMzQjMjkzIzE5IzA2LzA3LzIwMjMgMTY6MDI6NTcjbXdpc2VzYWxlczFAc2luZS5jb20jOTA0
|
// https://demo.pdgenie.com/salespdpwa/#/auto?token=TXdpc2VTYWxlc0B5YWhvby5jb20jc2luZTEyMzQjMjkzIzE5IzA2LzA3LzIwMjMgMTY6MDI6NTcjbXdpc2VzYWxlczFAc2luZS5jb20jOTA0
|
||||||
echo $redirect_uri;
|
|
||||||
die();
|
|
||||||
log_message('ERROR', '## 9) Redirect Aftr `' . $redirect_uri . '`');
|
log_message('ERROR', '## 9) Redirect Aftr `' . $redirect_uri . '`');
|
||||||
// header("Location: " . $redirect_uri);
|
header("Location: " . $redirect_uri);
|
||||||
// $this->response($data,REST_Controller::HTTP_OK);
|
// $this->response($data,REST_Controller::HTTP_OK);
|
||||||
//if($data['dataStatus']){ header("Location: https://sidharthindustries.com/SIA/"); }
|
//if($data['dataStatus']){ header("Location: https://sidharthindustries.com/SIA/"); }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,13 +21,17 @@ class Sales_PD_Model extends SPARQ_Model {
|
|||||||
if (in_array($checkThisRole,$ignorerole)) $sales_pd_officer_id = "";
|
if (in_array($checkThisRole,$ignorerole)) $sales_pd_officer_id = "";
|
||||||
}
|
}
|
||||||
// SALES_PD_DATA.sales_pd_sno, SALES_PD_DATA.sales_pd_id, 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,PRODUCTS.abbr,DATE_FORMAT(SALES_PD_DATA.createdon, "%d/%m/%Y") as pd_createdon,SALES_PD_DATA.status
|
// SALES_PD_DATA.sales_pd_sno, SALES_PD_DATA.sales_pd_id, 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,PRODUCTS.abbr,DATE_FORMAT(SALES_PD_DATA.createdon, "%d/%m/%Y") as pd_createdon,SALES_PD_DATA.status
|
||||||
$this->db->SELECT(' SALES_PD_DATA.sales_pd_sno, SALES_PD_DATA.sales_pd_id, 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,PRODUCTS.abbr,
|
$this->db->SELECT(' SALES_PD_DATA.sales_pd_sno, SALES_PD_DATA.sales_pd_id, SALES_PD_DATA.applicant_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,PRODUCTS.abbr,
|
||||||
(CASE WHEN SALES_PD_DATA.status = "STARTED" THEN SALES_PD_DATA.createdon WHEN SALES_PD_DATA.status = "COMPLETED" THEN SALES_PD_DATA.completed_date ELSE NULL END) AS createdon,
|
(CASE WHEN SALES_PD_DATA.status = "STARTED" THEN SALES_PD_DATA.createdon WHEN SALES_PD_DATA.status = "COMPLETED" THEN SALES_PD_DATA.completed_date ELSE NULL END) AS createdon,
|
||||||
DATE_FORMAT(SALES_PD_DATA.createdon, "%Y-%m-%d") as pd_createdon, SALES_PD_DATA.status,SALES_PD_DATA.sales_pd_type,SALES_PD_DATA.rand_string');
|
DATE_FORMAT(SALES_PD_DATA.createdon, "%Y-%m-%d") as pd_createdon, SALES_PD_DATA.status,SALES_PD_DATA.sales_pd_type,SALES_PD_DATA.rand_string');
|
||||||
|
if($sales_pd_officer_id && is_numeric($sales_pd_officer_id)){ $this->db->select('concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as officer_name'); }
|
||||||
|
if($sales_pd_officer_id && is_string($sales_pd_officer_id)){ $this->db->select('SALES_PD_DATA.redirect_email as officer_name'); }
|
||||||
|
|
||||||
$this->db->from(SALES_PD_DATA.' as SALES_PD_DATA');
|
$this->db->from(SALES_PD_DATA.' as SALES_PD_DATA');
|
||||||
$this->db->join(ENTITY.' as ENTITY','ENTITY.entity_id = SALES_PD_DATA.lender_id','INNER');
|
$this->db->join(ENTITY.' as ENTITY','ENTITY.entity_id = SALES_PD_DATA.lender_id','INNER');
|
||||||
$this->db->join(PRODUCTS.' as PRODUCTS', 'PRODUCTS.product_id = SALES_PD_DATA.product_id','INNER');
|
$this->db->join(PRODUCTS.' as PRODUCTS', 'PRODUCTS.product_id = SALES_PD_DATA.product_id','INNER');
|
||||||
$this->db->join(USERPROFILE.' as USERPROFILE', 'USERPROFILE.userid = SALES_PD_DATA.createdby','INNER');
|
if($sales_pd_officer_id && is_numeric($sales_pd_officer_id)){
|
||||||
|
$this->db->join(USERPROFILE.' as USERPROFILE', 'USERPROFILE.userid = SALES_PD_DATA.createdby','INNER');}
|
||||||
if(!empty($pd_status)){
|
if(!empty($pd_status)){
|
||||||
$this->db->where_in('SALES_PD_DATA.status',$pd_status);
|
$this->db->where_in('SALES_PD_DATA.status',$pd_status);
|
||||||
}else{
|
}else{
|
||||||
@ -89,8 +93,16 @@ class Sales_PD_Model extends SPARQ_Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($sales_pd_officer_id)) {
|
if(!empty($sales_pd_officer_id)) {
|
||||||
|
//$this->db->WHERE('SALES_PD_DATA.createdby',$sales_pd_officer_id);
|
||||||
|
if($sales_pd_officer_id && is_numeric($sales_pd_officer_id))
|
||||||
|
{
|
||||||
$this->db->WHERE('SALES_PD_DATA.createdby',$sales_pd_officer_id);
|
$this->db->WHERE('SALES_PD_DATA.createdby',$sales_pd_officer_id);
|
||||||
}
|
}
|
||||||
|
else if($sales_pd_officer_id && is_string($sales_pd_officer_id)){
|
||||||
|
# here $user_id is numeric means createdby else redirect_email.becoz sales auto-login
|
||||||
|
$this->db->WHERE('SALES_PD_DATA.redirect_email',base64_decode($sales_pd_officer_id));
|
||||||
|
}
|
||||||
|
}
|
||||||
if(!empty($sales_pd_type) && count($sales_pd_type)) {
|
if(!empty($sales_pd_type) && count($sales_pd_type)) {
|
||||||
$this->db->WHERE_IN('SALES_PD_DATA.sales_pd_type',$sales_pd_type);
|
$this->db->WHERE_IN('SALES_PD_DATA.sales_pd_type',$sales_pd_type);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user