Sales PD report Regeneration api : ps
This commit is contained in:
parent
e27e0ae180
commit
194e6d1d24
@ -340,4 +340,9 @@ $route['deleteTemplateV2'] = 'Template_Management_Controller/deleteTemplateV2';
|
||||
// $route['updateTemplateFormsV2'] = 'Template_Management_Controller/updateTemplateFormsV2';
|
||||
$route['loadFullTemplateV2'] = 'Template_Management_Controller/loadFullTemplateV2';
|
||||
$route['formWiseJSONTemplateV2'] = 'Template_Management_Controller/formWiseJSONTemplateV2';
|
||||
$route['disableformV2'] = 'Template_Management_Controller/disableformV2';
|
||||
$route['disableformV2'] = 'Template_Management_Controller/disableformV2';
|
||||
$route['PDjson'] = 'PD_Controller/PDjson';
|
||||
|
||||
$route['regenerateSatelliteImg'] = 'Sales_PD_Controller/regenerateSatelliteImg';
|
||||
$route['regenerateSaleReport'] = 'Sales_PD_Controller/regenerateSaleReport';
|
||||
$route['resendSaleReportMail'] = 'Sales_PD_Controller/resendSaleReportMail';
|
||||
|
||||
@ -11399,6 +11399,11 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
||||
$entity_loc = $this->PD_Model->getEntityAddr($lender);
|
||||
$this->response(satellite_image::getdistancematrix($entity_loc,$pd_loc),REST_Controller::HTTP_OK,true);
|
||||
}
|
||||
|
||||
function PDjson_get(){
|
||||
$data = $this->PD_Model->testSection($this->get('id'));
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1257,10 +1257,92 @@ public function filterSalesPDList_post() {
|
||||
// CAMUNDA::completeSalesPDTask(1);
|
||||
//CAMUNDA::startSalesPDInstance(1);
|
||||
}
|
||||
//api for Manually statellite Image Generation.
|
||||
public function regenerateSatelliteImg_post()
|
||||
{
|
||||
|
||||
$input_data = $this->post();
|
||||
if(!isset($input_data['geo_location'])){
|
||||
// fk_sales_pd_id, img, img_name, createdon, isactive, location
|
||||
$where = array('img_name' => "selfie_with_person_met",'fk_sales_pd_id'=>$input_data['sales_pd_id'],'isactive'=>1);
|
||||
$check_docs = $this->Sales_PD_Model->selectCustomRecords(array('location'),$where,SALEPD_DOCS);
|
||||
if(count($check_docs) && $check_docs[0]['location'] != ""){
|
||||
$input_data['geo_location'] = $check_docs[0]['location'];
|
||||
}else{
|
||||
log_message('ERROR','####Manually Called - Satellite IMG Not Generated Bcoz Selfie Image not Available sales pd = '.$input_data['sales_pd_id']);
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||
$data['msg'] = 'Selfie with Person Met Images and Location Not Available. please Try Again';
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
}
|
||||
log_message('ERROR','####Manually Called - Satellite IMG sales pd = '.$input_data['sales_pd_id']);
|
||||
$id = $this->Sales_PD_Model->updateRecords($input_data,SALES_PD_DATA,array('sales_pd_id' => $input_data['sales_pd_id']));
|
||||
satellite_image::getSatelliteImage($input_data['sales_pd_id'],2);
|
||||
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $id;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
|
||||
}
|
||||
//api for Manually Report Generation.
|
||||
public function regenerateSaleReport_get(){
|
||||
$sales_pd_id = $this->get('sales_pd_id');
|
||||
if(!empty($sales_pd_id)){
|
||||
$this->Sales_PD_Model->updateRecords(array('is_pdf' => 0),SALES_PD_DATA,array('sales_pd_id' => $sales_pd_id));
|
||||
log_message('ERROR','####Manually Called - Report Generated sales pd = '.$sales_pd_id);
|
||||
$this->prepareSalesPDReport($sales_pd_id);}
|
||||
else{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
|
||||
$data['msg'] = 'Sales PDID Not Found !';
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
}
|
||||
|
||||
//api for Manually Resend Report With Mail.
|
||||
public function resendmailforSaleReport_get(){
|
||||
$sales_pd_id = $this->get('sales_pd_id');
|
||||
if(!empty($sales_pd_id)){
|
||||
$city = '';
|
||||
$form = $this->Sales_PD_Model->selectCustomRecords(array(),array('isactive' => 1,'sales_pd_id' => $records['sales_pd_id'],'section_id' => 1,'status' => 1),SALESPD_SECTION_DATA);
|
||||
$gen_form = json_decode($form[0]['section_data'],true);
|
||||
if(!empty($gen_form)){
|
||||
foreach ($gen_form['questions'] as $g_key => $g_value)
|
||||
{
|
||||
// if($g_value['question_key'] == 'state')
|
||||
// {
|
||||
// $ids_to_send_mail['state'] = $g_value['answer_value'];
|
||||
// }
|
||||
if($g_value['question_key'] == 'city')
|
||||
{
|
||||
$city = $g_value['answer_value'];
|
||||
}
|
||||
}
|
||||
}//gen_form closed here.
|
||||
PDALERTS::sendSalesPDMail($this,$records['sales_pd_id'],$city);
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['msg'] = ' Sented Successfully!';
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
|
||||
$data['msg'] = 'Sales PDID Not Found !';
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//test purpose
|
||||
public function testSaleSection_get(){
|
||||
$data = $this->Sales_PD_Model->testSaleSection($this->get('id'));
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -2595,8 +2595,8 @@ class PD_Model extends SPARQ_Model {
|
||||
}
|
||||
|
||||
public function testSection($id){
|
||||
$this->db->SELECT('*')->FROM("t_pd_form_details_json")->WHERE('fk_pd_id',$id)->WHERE('isactive',1)
|
||||
->WHERE('fk_form_id',22)->WHERE('company_id',1);
|
||||
$this->db->SELECT('*')->FROM("t_pd_form_details_json")->WHERE('fk_pd_id',$id)->WHERE('isactive',1)->WHERE('fk_form_id',5);
|
||||
// ->WHERE('company_id',1);
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user