ADDTIONAL PD GET AND SAVE

This commit is contained in:
velz 2019-04-01 19:36:10 +05:30
parent bd09defdc5
commit 2d95742b30
9 changed files with 110 additions and 397 deletions

View File

@ -195,6 +195,8 @@ $route['getListOfCities'] = 'PD_Controller/getListOfCities';
$route['savePDPhotos'] = 'PD_Controller/savePDPhotos';
$route['getPDAddress'] = 'PD_Controller/getPDAddress';
$route['updatePDAddress'] = 'PD_Controller/updatePDAddress';
$route['getPDCompleteDetails'] = 'PD_Controller/getPDCompleteDetails';
// $route['savePDFormDetailsJSON'] = 'PD_Controller/savePDFormDetailsJSON';
// $route['getPDFormDetailsJSON'] = 'PD_Controller/getPDFormDetailsJSON';

View File

@ -636,10 +636,11 @@ class PD_Controller extends REST_Controller {
{
$pd_details = $this->post('records');
if(isset($pd_details['pd_id']))
if(isset($pd_details['pd_id']) && $pd_details['pd_id'] != "")
{
if($pd_details['pd_status'] == INITIATED)
if(isset($pd_details['pd_status']) && $pd_details['pd_status'] == INITIATED)
{
unset($pd_details['mobile_no']);
@ -674,7 +675,7 @@ class PD_Controller extends REST_Controller {
/************ASSIGN Random URL******************/
}
if($pd_details['pd_status'] == STARTED)
if(isset($pd_details['pd_status']) && $pd_details['pd_status'] == STARTED)
{
$pd_details['start_location'] = $pd_details['link'];
unset($pd_details['link']);
@ -693,7 +694,7 @@ class PD_Controller extends REST_Controller {
}
if($pd_details['pd_status'] == COMPLETED)
if(isset($pd_details['pd_status']) && $pd_details['pd_status'] == COMPLETED)
{
if(array_key_exists('link',$pd_details))
{
@ -703,35 +704,36 @@ class PD_Controller extends REST_Controller {
}
if($pd_details['pd_status'] == TRIGGERED || $pd_details['pd_status'] == INITIATED)
if(isset($pd_details['pd_status']) && ($pd_details['pd_status'] == TRIGGERED || $pd_details['pd_status'] == INITIATED))
{
/***********************CHOOSE PD TEMPALATE*********************/
$pd_details['fk_pd_template_id'] = $this->assignPDTempalate($pd_details['pd_id']);
if($pd_details['fk_pd_template_id'] != "" || $pd_details['fk_pd_template_id'] != null)
{
$logger = MYLOG::logFunction();
$logger->info("TEMPLATE ASSIGN FUNCTIONALTIY".$pd_details['fk_pd_template_id']." CHOOSED",array('ENV'=>ENVIRONMENT,'PDID' => $pd_details['pd_id'],'Pre-Status' => $res_array[0]['pd_status'],'Current_status' => $pd_details['pd_status']));
//$logger = MYLOG::logFunction();
//$logger->info("TEMPLATE ASSIGN FUNCTIONALTIY".$pd_details['fk_pd_template_id']." CHOOSED",array('ENV'=>ENVIRONMENT,'PDID' => $pd_details['pd_id'],'Pre-Status' => $res_array[0]['pd_status'],'Current_status' => $pd_details['pd_status']));
$dataToBot = array('ENV'=>ENVIRONMENT,'Task Name'=>'PD Template Assign','Template ID'=>$choosed_template_id[0]['fk_template_id'] ,'PDID'=> $pd_details['pd_id'],'Method' => 'UpdatePDMaster','Pre-Status' => $res_array[0]['pd_status'],'Current_status' => $pd_details['pd_status']);
MYHTTPCLIENT::sendPOST($dataToBot);
//$dataToBot = array('ENV'=>ENVIRONMENT,'Task Name'=>'PD Template Assign','Template ID'=>$choosed_template_id[0]['fk_template_id'] ,'PDID'=> $pd_details['pd_id'],'Method' => 'UpdatePDMaster','Pre-Status' => $res_array[0]['pd_status'],'Current_status' => $pd_details['pd_status']);
//MYHTTPCLIENT::sendPOST($dataToBot);
}
}
//Update Address table,if primary address choosed
$primary_address_id = isset($pd_details['fk_primary_address_id'])?$pd_details['fk_primary_address_id']:null;
$pd_details['fk_address_id'] = $primary_address_id;
$where_condition_array = array('pd_id' => $pd_details['pd_id']);
$pd_id_modified = $this->PD_Model->updateRecords($pd_details,PDTRIGGER,$where_condition_array);
//Update Address table,if primary address choosed
$primary_address_id = isset($pd_details['fk_primary_address_id'])?$pd_details['fk_primary_address_id']:null;
if($primary_address_id != null)
{
$pd_details['fk_address_id'] = $primary_address_id;
$where_condition_array = array('pd_address_id' => primary_address_id);
$temp_data = array('is_primary' => 1);
$where_condition_array = array('pd_address_id' => $primary_address_id);
$temp_data = array('is_primary' => 1,'assigned_pd' => $pd_details['pd_id']);
$id = $this->PD_Model->updateRecords($temp_data,PDADDRESS,$where_condition_array);
}
@ -758,7 +760,7 @@ class PD_Controller extends REST_Controller {
(($pd_details['fk_customer_segment'] != "" || $pd_details['fk_customer_segment'] != null)) &&
(($pd_details['fk_address_id'] != "" || $pd_details['fk_address_id'] != null)) &&
(($pd_details['pd_status'] != "" || $pd_details['pd_status'] != null)) &&
(($pd_details['fk_createdby'] != "" || $pd_details['fk_createdby'] != null)) )
(($pd_details['fk_updatedby'] != "" || $pd_details['fk_updatedby'] != null)) )
{
//GET PArent PD Details
$parent_pd_details = $this->PD_Model->getPDMasterDetails($pd_details['parent_pd_id']);
@ -774,7 +776,7 @@ class PD_Controller extends REST_Controller {
$newpd['is_child'] = 1;
$newpd['pd_status'] = $pd_details['pd_status'];
$newpd['fk_createdby'] = $pd_details['fk_createdby'];
$newpd['fk_updatedby'] = $pd_details['fk_updatedby'];
$newpd['fk_customer_segment'] = $pd_details['fk_customer_segment'];
$newpd['fk_address_id'] = $pd_details['fk_address_id'];
$newpd['parent_pd_id'] = $pd_details['parent_pd_id'];
@ -795,6 +797,13 @@ class PD_Controller extends REST_Controller {
$pd_id = $this->PD_Model->saveRecords($newpd,PDTRIGGER);
if($pd_id != "" || $pd_id != null)
{
//update Assiged PD to Address Table
$where_condition_array = array('pd_address_id' => $newpd['fk_address_id']);
$temp_data = array('assigned_pd' => $pd_id);
$id = $this->PD_Model->updateRecords($temp_data,PDADDRESS,$where_condition_array);
//PDALERTS::pdnotification($newpd['pd_id']);
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
@ -833,6 +842,31 @@ class PD_Controller extends REST_Controller {
}
//While PD Completion stage, send lenth of PD address so get complete or addonpd
public function getPDCompleteDetails_post()
{
$records = $this->post('records');
$pdid = $records['pd_id'];
$pd_master_detials = $this->PD_Model->getPDMasterDetails($pdid);
if($pd_master_detials[0]['is_child'] == 0)//primary PD
{
$address_count = $this->db->SELECT('count(*) as count')->FROM(PDADDRESS)->GET()->result_array();
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = array('address_count'=>$address_count);
$this->response($data,REST_Controller::HTTP_OK);
}
else// Addtional PD
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = array('address_count'=>0);
$this->response($data,REST_Controller::HTTP_OK);
}
}
public function assignPDTempalate($data)
{
// Template Re assign Functionality
@ -2041,363 +2075,8 @@ class PD_Controller extends REST_Controller {
}
/********* Get Form Informations @param pd_id and pd_form_id ******/
// public function getPDFormDetails_post()
// {
// $pd_id = $this->post('pd_id');
// $pd_form_id = $this->post('pd_form_id');
// //Get Pd masters etails usng PD ID
// $pd_details = $this->PD_Model->getPDMasterDetails($pd_id);
// $result_array = $this->PD_Model->getPDFormDetails($pd_id,$pd_form_id);
// //print_r($result_array);die();
// //call helper function for get structured key,value pairs
// $final_array = GETPDFORMDETAILS::getPDFormDetailsStructured($result_array,$pd_id,$pd_form_id);
// // *****************************Get Docs from bucket
// // Get Alredy stored Images
// $fields = array('pd_document_title', 'pd_document_name');
// $where_condition_array = array('fk_pd_id' => $pd_id,'fk_form_id' => $pd_form_id);
// $pd_docs = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDDOCUMENTS);
// if(count($pd_docs))
// {
// $bucket_name = LENDER_BUCKET_NAME_PREFIX.$pd_details[0]['fk_lender_id'];
// foreach($pd_docs as $doc_key => $doc)
// {
// if($doc['pd_document_name'] != "" || $doc['pd_document_name'] != null)
// {
// $profilepics3path = 'pd'.$pd_details[0]['pd_id'].'/'.$doc['pd_document_name'];
// $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$profilepics3path,'+30 minutes');
// $pd_docs[$doc_key]['pd_document_name'] = $singed_uri;
// }
// }
// $final_array['base64images'] = $pd_docs;
// }
// // *************************End Get Docs from bucket
// if($result_array)
// {
// $data['dataStatus'] = true;
// $data['status'] = REST_Controller::HTTP_OK;
// $data['records'] = $final_array;
// $this->response($data,REST_Controller::HTTP_OK);
// }
// else
// {
// $data['dataStatus'] = false;
// $data['status'] = REST_Controller::HTTP_NO_CONTENT;
// $data['msg'] = "Details Not Available!";
// $this->response($data,REST_Controller::HTTP_OK);
// }
// }
/********* Save Form Informations @param pd_id and pd_form_id ******/
// public function savePDFormDetails_post()
// {
// $records = $this->post('records');
// //print_r($records);echo '****************************';
// $pd_id = $records['pdid'];
// //print_r($records);die();
// //Get Pd masters etails usng PD ID
// $pd_details = $this->PD_Model->getPDMasterDetails($pd_id);
// $pd_form_id = $records['formid'];
// $fk_createdby = $records['fk_createdby'];
// $i = 0;
// $base64images = array();
// //seperate base64 images from records array
// if(array_key_exists('base64images',$records))
// {
// $base64images = $records['base64images'];
// unset($records['base64images']);
// }
// //If It is General Informatin Form Save New Co Applcants details
// // by Passing records form to another(saveCoApplicantsFromGeneralInfoForm) internl function
// if($records['formid'] == 18)
// {
// $this->saveCoApplicantsFromGeneralInfoForm($records);
// }
// // if($pd_form_id == 6)
// // {
// // if(array_key_exists('family_details',$records))
// // {
// // $records = $records['family_details'];
// // unset($records['family_details']);
// // }
// // }
// if($pd_form_id == 1)// If formis supplier then omit parent level array keys
// {
// if(array_key_exists('manufacturing_details',$records))
// {
// $records['main_raw_materials'] = $records['manufacturing_details'][0]['main_raw_materials'];
// $records['main_raw_materials_total_payments_percent_on_credit'] = $records['manufacturing_details'][0]['main_raw_materials_total_payments_percent_on_credit'];
// unset($records['manufacturing_details']);
// }
// if(array_key_exists('trade_details',$records))
// {
// $records['trading_products'] = $records['trade_details'][0]['trading_products'];
// $records['trading_products_total_payments_percent_on_credit'] = $records['trade_details'][0]['trading_products_total_payments_percent_on_credit'];
// unset($records['trade_details']);
// }
// }
// if($pd_form_id == 2)// If formis client then omit parent level array keys
// {
// if(array_key_exists('manufacturing_details',$records))
// {
// $records['main_raw_materials'] = $records['manufacturing_details'][0]['main_raw_materials'];
// $records['main_raw_materials_total_payments_percent_on_credit'] = $records['manufacturing_details'][0]['main_raw_materials_total_payments_percent_on_credit'];
// unset($records['manufacturing_details']);
// }
// if(array_key_exists('trade_details',$records))
// {
// $records['trading_products'] = $records['trade_details'][0]['trading_products'];
// $records['trading_products_total_payments_percent_on_credit'] = $records['trade_details'][0]['trading_products_total_payments_percent_on_credit'];
// unset($records['trade_details']);
// }
// // if(array_key_exists('service_provider_details',$records))
// // {
// // $records['trading_products'] = $records['trade_details'][0]['trading_products'];
// // $records['trading_products_total_payments_percent_on_credit'] = $records['trade_details'][0]['trading_products_total_payments_percent_on_credit'];
// // unset($records['trade_details']);
// // }
// }
// if($pd_form_id == 11)// If formis supplier then omit parent level array keys
// {
// if(array_key_exists('manufacturing_details',$records))
// {
// $records['manufacturing_raw_materials'] = $records['manufacturing_details'][0]['manufacturing_raw_materials'];
// $records['manufacturing_finished_goods'] = $records['manufacturing_details'][0]['manufacturing_finished_goods'];
// $records['manufacturing_traded_goods'] = $records['manufacturing_details'][0]['manufacturing_traded_goods'];
// // $records['main_raw_materials_total_payments_percent_on_credit'] = $records['manufacturing_details'][0]['main_raw_materials_total_payments_percent_on_credit'];
// unset($records['manufacturing_details']);
// }
// if(array_key_exists('trade_details',$records))
// {
// $records['trading_finished_goods'] = $records['trade_details'][0]['trading_finished_goods'];
// $records['trading_traded_goods'] = $records['trade_details'][0]['trading_traded_goods'];
// // $records['trading_products_total_payments_percent_on_credit'] = $records['trade_details'][0]['trading_products_total_payments_percent_on_credit'];
// unset($records['trade_details']);
// }
// if(array_key_exists('retail_details',$records))
// {
// $records['retail_finished_goods'] = $records['retail_details'][0]['retail_finished_goods'];
// $records['retail_traded_goods'] = $records['retail_details'][0]['retail_traded_goods'];
// // $records['trading_products_total_payments_percent_on_credit'] = $records['trade_details'][0]['trading_products_total_payments_percent_on_credit'];
// unset($records['retail_details']);
// }
// }
// //print_r($records);
// //Deactivate Old rec
// $where_condition_array = array('fk_pd_id' => $pd_id,"fk_form_id"=>$pd_form_id);
// $array = array('isactive'=>0);
// $pd_id_modified = $this->PD_Model->updateRecords($array,PDFORMDETAILS,$where_condition_array);
// foreach($records as $rec_key => $record)
// {
// $i++;
// if($rec_key !='pdid' && $rec_key != 'formid' && $rec_key != 'fk_createdby')
// {
// if(!is_array($record))//check key and value pair is not an array
// {
// if($rec_key == 'selected_person')
// {
// echo "selected_person-".$record;
// }
// $temp_array = array('fk_pd_id'=>$pd_id,'fk_form_id'=>$pd_form_id,'column_name'=>$rec_key,'column_value'=>$record,'fk_createdby'=>$fk_createdby);
// $id = $this->PD_Model->saveRecords($temp_array,PDFORMDETAILS);
// }
// else // array of key value pairs
// {
// $iter=0;
// foreach($record as $mkey => $rec)
// {
// //print_r($rec);
// $iter++;
// if(!is_array($rec))
// {
// foreach($rec as $rkey => $r)
// {
// $temp_array = array('');
// if($r != "" && $r != null)
// {
// $temp_array = array('fk_pd_id'=>$pd_id,'fk_form_id'=>$pd_form_id,'iter_column_name'=>$rec_key,'column_name'=>$rkey,'column_value'=>$r,'fk_createdby'=>$fk_createdby,'iteration'=>$iter);
// $id = $this->PD_Model->saveRecords($temp_array,PDFORMDETAILS);
// }
// }
// }
// else
// {
// foreach($rec as $child_key => $child_data)
// {
// //print_r($child_data);
// // echo "$child_key-\n\n\n";
// if(!is_array($child_data))
// {
// //echo "not array\n\n";
// //print_r($child_data);
// $temp_array = array('fk_pd_id'=>$pd_id,'fk_form_id'=>$pd_form_id,'column_name'=>$child_key,'column_value'=>$child_data,'iter_column_name'=>$rec_key,'fk_createdby'=>$fk_createdby,'iteration'=>$iter);
// //print_r($temp_array);
// $id = $this->PD_Model->saveRecords($temp_array,PDFORMDETAILS);
// }
// else
// {
// // echo "array";
// //print_r($child_data);
// foreach($child_data as $business_key => $business_child)
// {
// //print_r($business_child);
// if(!is_array($business_child))
// {
// //print_r($business_child);
// foreach($business_child as $last_key_s => $last_data)
// {
// // foreach($last_data as $final_key => $final_data)
// // {
// // $temp_array = array('fk_pd_id'=>$pd_id,'fk_form_id'=>$pd_form_id,'column_name'=>$final_key,'column_value'=>$final_data,'iter_column_name'=>$rec_key,'iter_sub_column_name'=>$child_key,'fk_createdby'=>$fk_createdby,'iteration'=>$iter);
// // //print_r($temp_array);
// // $id = $this->PD_Model->saveRecords($temp_array,PDFORMDETAILS);
// // }
// }
// }
// else
// {
// foreach($business_child as $last_key_a => $last_data)
// {
// //print_r($last_data);
// if(!is_array($last_data))
// {
// $temp_array = array('fk_pd_id'=>$pd_id,'fk_form_id'=>$pd_form_id,'column_name'=>$last_key_a,'column_value'=>$last_data,'iter_column_name'=>$rec_key,'iter_sub_column_name'=>$child_key,'fk_createdby'=>$fk_createdby,'iteration'=>$iter);
// $id = $this->PD_Model->saveRecords($temp_array,PDFORMDETAILS);
// }
// else
// {
// //$current_temp_array = array_values($last_data[0]);
// //print_r($last_data);
// foreach($last_data as $l_key => $l_data)
// {
// // foreach($l_data as $k => $v)
// // {
// // $temp_array = array('fk_pd_id'=>$pd_id,'fk_form_id'=>$pd_form_id,'column_name'=>$k,'column_value'=>$v,'iter_column_name'=>$rec_key,'iter_sub_column_name'=>$child_key,'fk_createdby'=>$fk_createdby,'iteration'=>$iter,'column_id' => $last_key_a);
// // $id = $this->PD_Model->saveRecords($temp_array,PDFORMDETAILS);
// // }
// $temp_array = array('fk_pd_id'=>$pd_id,'fk_form_id'=>$pd_form_id,'column_name'=>$l_key,'column_value'=>$l_data,'iter_column_name'=>$rec_key,'iter_sub_column_name'=>$child_key,'fk_createdby'=>$fk_createdby,'iteration'=>$iter,'column_id' => $last_key_a);
// $id = $this->PD_Model->saveRecords($temp_array,PDFORMDETAILS);
// }
// }
// }
// }
// }
// }
// }
// }
// }
// }// end of array of key value pairs
// }
// //}
// //**************** End of handle form details logic***************//
// }
// //*****************************upload base64 images
// if(count($base64images))
// {
// foreach($base64images as $iter => $doc)
// {
// $temp_base64_string = $doc['image'];
// $title = $doc['Name'];
// $output_file = APPPATH."/docs/temp_base64_image.png";
// //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:m:s').'.png';
// $ifp = fopen( $output_file, 'wb' );
// $temp_data = explode( ',', $temp_base64_string );
// fwrite( $ifp, base64_decode( $temp_data[ 1 ] ) );
// fclose( $ifp );
// $tempdoc = $output_file;
// $tempdocname = $temp_file_name;
// $bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_details['fk_lender_id'];
// $key = 'pd'.$pd_id.'/'.$tempdocname ;
// $sourcefile = $tempdoc;
// $bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$sourcefile);
// $s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
// if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
// {
// $record_data = array('fk_pd_id' => $pd_id,'fk_form_id'=>$pd_form_id,'pd_document_title'=>$title,'pd_document_name'=>$tempdocname);
// $this->PD_Model->saveRecords($record_data,PDDOCUMENTS);
// }
// }
// }
// //*******************************upload base64 images
// $data['dataStatus'] = true;
// $data['status'] = REST_Controller::HTTP_OK;
// //$data['records'] = $result_array;
// $this->response($data,REST_Controller::HTTP_OK);
// }
public function savePDFormDetailsJSON_post()
{
$records = $this->post('records');
@ -2407,6 +2086,19 @@ class PD_Controller extends REST_Controller {
$company_id = null;
$processed_json = null;
//print_r($records);die();
$parent_pdid = $records['parent_pdid'];;
$parent_form_index = null;
$parent_forms = array(0,10,7,4,6,8,9,20);// 0 added for dummy
if($pd_id != $parent_pdid)
{
$parent_form_index = array_search($formid,$parent_forms);
$pdid = $parent_form_index != null ? $parent_pd_id : $pdid;
$records['pdid'] = $pdid;
}
if(isset($records['company_id']))
{
$company_id = $records['company_id'];
@ -2532,6 +2224,7 @@ class PD_Controller extends REST_Controller {
unset($records['formid']);
unset($records['fk_createdby']);
unset($records['company_id']);
unset($records['parent_pdid']);
$records = json_encode($records);
if($processed_json != null)
{
@ -2563,12 +2256,17 @@ class PD_Controller extends REST_Controller {
{
$pd_id = $this->post('pd_id');
$pd_form_id = $this->post('pd_form_id');
$company_id = null;
if($this->post('company_id'))
{
$company_id = $this->post('company_id');
}
//print_r();
$parent_pd_id = $this->post('parent_pd_id');// ? $this->post('parent_pd_id') : null;
$company_id = $this->post('company_id') ? $this->post('company_id') : null;
$parent_form_index = null;
$parent_forms = array(0,18,10,7,4,6,8,9,20);// 0 added for dummy
if($pd_id != $parent_pd_id)
{
$parent_form_index = array_search($pd_form_id,$parent_forms);
$pd_id = $parent_form_index != null ? $parent_pd_id : $pd_id;
}
$fields = array('json','processed_json');
$where_condition_array = array('isactive' => 1,'fk_form_id'=>$pd_form_id,'fk_pd_id'=>$pd_id);
if($company_id != null)
@ -3593,7 +3291,7 @@ class PD_Controller extends REST_Controller {
$overall_summary_report['consolidated_report']['consolidated_nerprofit'] = round(array_sum($temp_netmargin_array) / count($temp_netmargin_array));
$overall_summary_report['consolidated_report'][' consolidated_nermagin'] = round((($overall_summary_report['consolidated_report']['consolidated_nerprofit']/$overall_summary_report['consolidated_report']['consolidated_sales_revenue'])*100),2);
$overall_summary_report['consolidated_report']['consolidated_nermagin'] = round((($overall_summary_report['consolidated_report']['consolidated_nerprofit']/$overall_summary_report['consolidated_report']['consolidated_sales_revenue'])*100),2);
return ($overall_summary_report);
@ -4447,8 +4145,8 @@ class PD_Controller extends REST_Controller {
public function codeigniterViewTest_post()
{
// echo MYUTIL::customIndianNumberFormat(4589621);
// die();
echo MYUTIL::customIndianNumberFormat(4589621);
die();
$records = $this->post('records');
$pdid = $records['pd_id'];
$is_regenerate = 0;
@ -4465,12 +4163,14 @@ class PD_Controller extends REST_Controller {
//print_r($data['pd_score']['business']);
$score_for_chart = $data['pd_score']['score_summary']['overall_score']['final_score'] ? round($data['pd_score']['score_summary']['overall_score']['final_score'],2) : 0;
//echo $score_for_chart;
$chart = null;
if($chart)
{
//GET phantom script from DB
$phantom_script = $this->PD_Model->selectCustomRecords(array('*'),array('script_name' => 'phantomjs_local'),SCRIPTS);
$exact_script = $phantom_script[0]['script_content'];
print_r($exact_script);
//print_r($exact_script);
$exact_script = str_replace('{{place_score_here}}',$score_for_chart,$exact_script);
//print_r($exact_script);die();
//GENERATE CHART PART
@ -4491,7 +4191,7 @@ class PD_Controller extends REST_Controller {
// echo $data['base64_pdscore_chart_url'];
//die();
//GENERATE CHART PART
}
//GET ALL PROCESSED JSON
for($i = 1;$i<=25;$i++)
{
@ -4647,10 +4347,10 @@ class PD_Controller extends REST_Controller {
array('form_id' => 22,'form_name' => 'Business Assets'),
array('form_id' => 21,'form_name' => 'Business Banking'),
array('form_id' => 14,'form_name' => 'Financial Information'),
array('form_id' => 16,'form_name' => 'Assessed Income'),
array('form_id' => 1,'form_name' => 'Supplier Details'),
array('form_id' => 2,'form_name' => 'Client Details'),
array('form_id' => 11,'form_name' => 'Stock Details'),
array('form_id' => 16,'form_name' => 'Assessed Income')
);

Binary file not shown.

View File

@ -103,8 +103,10 @@ public static function getOthersAssetsDetails($values){
public static function getBusinessAssetsDetails($values){
$mergeResult=array();
foreach($values as $fetchVal){
echo "helper";
print_r($fetchVal);
$storeValue=array();
$storeValue['business_assets_mode'] = $fetchVal['business_assets_mode_master'];
$storeValue['business_assets_mode'] = $fetchVal['business_assets_mode'];
// this is machinaries
if($fetchVal['business_assets_mode']==4){
switch(strtoupper($fetchVal['business_ownership_type'])) {
@ -115,7 +117,10 @@ public static function getBusinessAssetsDetails($values){
break;
case 'OWNED':
$storeValue['business_name_of_the_owner'] = $fetchVal['business_name_of_the_owner'][0]['id']==0 ? $fetchVal['business_name_of_the_other_owner'] : $fetchVal['business_name_of_the_owner'][0]['name'];
$storeValue['about_business_assets'] = $fetchVal['business_details'][0]['equipment_manufacturing_description'].' purchased in '.$fetchVal['business_purchase_year'];
$storeValue['about_business_assets'] = $fetchVal['business_details'][0]['equipment_manufacturing_description'].' purchased in '.$fetchVal['business_purchase_year'];
$storeValue['business_approximate_market_value'] = 'Rs.'.$fetchVal['business_approximate_market_value'];
break;
default:

View File

@ -289,7 +289,7 @@ class PD_Model extends SPARQ_Model {
public function getPDAddress($pdid)
{
$this->db->SELECT('PDADDRESS.pd_address_id, PDADDRESS.addressline1, PDADDRESS.fk_city, PDADDRESS.fk_state,PDADDRESS.pincode as pincode_id,PINCODE.pincode,PDADDRESS.other_pincode,PDADDRESS.isactive,PDADDRESS.createdon,PDADDRESS.updatedon,PDADDRESS.is_visited,CITY.name as city_name,STATE.name as state_name,PDADDRESS.is_primary');
$this->db->SELECT('PDADDRESS.pd_address_id,PDADDRESS.fk_pd_id,PDADDRESS.assigned_pd, PDADDRESS.addressline1, PDADDRESS.fk_city, PDADDRESS.fk_state,PDADDRESS.pincode as pincode_id,PINCODE.pincode,PDADDRESS.other_pincode,PDADDRESS.isactive,PDADDRESS.createdon,PDADDRESS.updatedon,PDADDRESS.is_visited,CITY.name as city_name,STATE.name as state_name,PDADDRESS.is_primary');
$this->db->FROM(PDADDRESS.' as PDADDRESS');
$this->db->JOIN(STATE.' as STATE','PDADDRESS.fk_state = STATE.state_id','LEFT');
$this->db->JOIN(CITY.' as CITY','PDADDRESS.fk_city = CITY.city_id','LEFT');
@ -302,11 +302,11 @@ class PD_Model extends SPARQ_Model {
{
foreach($result_child_array as $key => $single_address)
{
$result_child_array[$key]['addtional_pd_data'] = array();
if($single_address['is_primary'] != 0)
{
//$result_child_array[$key]['addtional_pd_data'] = array();
// if($single_address['is_primary'] != 0)
// {
$result_child_array[$key]['addtional_pd_data'] = $this->getAddtionalPDInformations($single_address['pd_address_id']);
}
// }
}
return $result_child_array;
}
@ -317,6 +317,8 @@ class PD_Model extends SPARQ_Model {
}
public function getPDCompany($pdid)
{
@ -1286,7 +1288,7 @@ class PD_Model extends SPARQ_Model {
$gross_profit_calculation_type = $this->selectCustomRecords($fields,$where_condition_array,PDASSESSEDINCOMEESTIMATIONOFGROSSPROFITTYPE);
//get sales_calculated_by_itemwise details
$fields = array('sci_id','sales_item','sales_qty','UOM.name as uom_name','fk_uom_id','FREQUENCY.name as frequency_name','rate_per_unit','fk_frequency_id','annual_sale_value','margin_final_value','margin_per','margin_per_uom','uom_other','comments','sales_type');
$fields = array('sci_id','sales_item','sales_qty','UOM.name as uom_name','fk_uom_id','FREQUENCY.name as frequency_name','rate_per_unit','fk_frequency_id','annual_sale_value','margin_final_value','margin_per','margin_per_uom','uom_other','comments','sales_type','other_sales_item');
$table = SALESCALCULATEDBYITEMWISE.' as SALESCALCULATEDBYITEMWISE';
$where_condition_array = array('fk_pd_id'=>$pdid,'SALESCALCULATEDBYITEMWISE.isactive'=>1);
$joins = array(
@ -1299,7 +1301,7 @@ class PD_Model extends SPARQ_Model {
$sales_items_by_months = array();
$this->db->SELECT('sim_id,sales_item,margin_value,margin_per,comments,sales_type');
$this->db->SELECT('sim_id,sales_item,margin_value,margin_per,comments,sales_type,other_sales_item');
$this->db->FROM(SALESITEMMONTHWISE.' as SALESITEMMONTHWISE');
$this->db->WHERE('SALESITEMMONTHWISE.fk_pd_id',$pdid);
$this->db->WHERE('SALESITEMMONTHWISE.isactive',1);

View File

@ -1 +1 @@
var page = require('webpage').create();page.viewportSize = { width: 600, height: 350 };page.clipRect = { top: 0, left: 0, width: 600, height: 350 };var score = 55;var url = 'http://localhost:9999/AWSEC2/sparqapi/api?'+score;var image_url = 'C:/5.6/xampp/htdocs/AWSEC2/sparqapi/api/application/views/report_templates/chart.png' ;page.open(url,function() {setTimeout(function() {page.render(image_url);phantom.exit();}, 500);});
var page = require('webpage').create();page.viewportSize = { width: 600, height: 350 };page.clipRect = { top: 0, left: 0, width: 600, height: 350 };var score = 78;var url = 'http://localhost:9999/AWSEC2/sparqapi/api?'+score;var image_url = 'C:/5.6/xampp/htdocs/AWSEC2/sparqapi/api/application/views/report_templates/chart.png' ;page.open(url,function() {setTimeout(function() {page.render(image_url);phantom.exit();}, 500);});

View File

@ -1239,9 +1239,13 @@ defined('BASEPATH') OR exit('No direct script access allowed');
}
array_push($businessAssetResult,$bindBusinessAsset);
}
?>
<h3>Asset Details</h3>
<?php if(count($businessAssetResult)>0){ ?>
<?php
print_r($businessAssetResult);die();
if(count($businessAssetResult)>0){ ?>
<?php foreach($businessAssetResult as $iterateAsset){ ?>
<p><?php echo $iterateAsset['company_name']; ?></p>
<table class="scorecard_table">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -76,7 +76,7 @@ switch (ENVIRONMENT)
case 'testing':
error_reporting(-1);
ini_set('display_errors', 0);
ini_set('display_errors', 1);
break;
case 'production':
ini_set('display_errors', 0);