From dd4da8056b9d047be29aaf90ad0bc971d252a832 Mon Sep 17 00:00:00 2001 From: Velz2020 Date: Sat, 16 Nov 2019 17:05:11 +0530 Subject: [PATCH] SALES PD IMG IND --- api/application/config/constants.php | 1 + api/application/config/routes.php | 1 + api/application/controllers/PD_Controller.php | 4 +- .../controllers/Sales_PD_Controller.php | 26 ++++++- .../report_templates/JSONTOREPORT_CLIX.php | 2 +- .../report_templates/JSONTOREPORT_DI_AI.php | 19 +++-- .../JSONTOREPORT_DI_AI_ADDON.php | 2 +- .../report_templates/JSONTOREPORT_RI.php | 2 +- .../views/sale_pd_templates/SMC.php | 72 ++++++++++--------- 9 files changed, 82 insertions(+), 47 deletions(-) diff --git a/api/application/config/constants.php b/api/application/config/constants.php index 0ad4d91f..d1075250 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -607,6 +607,7 @@ defined('D_BUSINESS_PARTNERS') OR define('D_BUSINESS_PARTNERS','d_business_partn defined('SALESPDTEMPLATE') OR define('SALESPDTEMPLATE','m_sales_pd_template'); defined('SALES_PD_DATA') OR define('SALES_PD_DATA','t_sales_pd_data'); +defined('SALEPD_DOCS') OR define('SALEPD_DOCS','t_salepd_docs'); diff --git a/api/application/config/routes.php b/api/application/config/routes.php index e7912294..32c26764 100644 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -258,4 +258,5 @@ $route['saveSalesPD'] = 'Sales_PD_Controller/saveSalesPD'; $route['(downloadSalesPDReport/:any)'] = 'Sales_PD_Controller/getSalesPDReport'; $route['listSalesPD/(:any)'] = 'Sales_PD_Controller/listSalesPD'; $route['listSalesPD/(:any)/(:any)'] = 'Sales_PD_Controller/listSalesPD'; +$route['saveSalesPDImage'] = 'Sales_PD_Controller/saveSalesPDImage'; diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index b0ed73b4..273f2c23 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -5952,8 +5952,8 @@ public function getPDFormDetailsJSON_post() file_put_contents(APPPATH.'/views/js/phantomchart.js',$exact_script,LOCK_EX); $str = 'phantomjs '.APPPATH.'/views/js/phantomchart.js'; - exec($str,$ou); - exec('phantom.exit();'); + // exec($str,$ou); + // exec('phantom.exit();'); //print_r($ou); diff --git a/api/application/controllers/Sales_PD_Controller.php b/api/application/controllers/Sales_PD_Controller.php index 7a64bc88..dc7ecc84 100644 --- a/api/application/controllers/Sales_PD_Controller.php +++ b/api/application/controllers/Sales_PD_Controller.php @@ -160,7 +160,8 @@ class Sales_PD_Controller extends REST_Controller { { $view_data['section'.$section['section_id'] ] = $this->processSalesPDJSON($section); } - + + $view_data['section9'] = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('fk_sales_pd_id' => $sales_pd_id),SALEPD_DOCS); //print_r($view_data);die(); //$view_name = $sales_pd_data[0]['short_name'].'_'.$sales_pd_data[0]['abbr']; $view_name = $sales_pd_data[0]['short_name']; @@ -177,7 +178,7 @@ class Sales_PD_Controller extends REST_Controller { if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200) { - // $this->Sales_PD_Model->updateRecords(array('is_pdf' => 1, 'is_edited' => 0),SALES_PD_DATA,array('sales_pd_id' => $sales_pd_id)); + $this->Sales_PD_Model->updateRecords(array('is_pdf' => 1, 'is_edited' => 0),SALES_PD_DATA,array('sales_pd_id' => $sales_pd_id)); $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'30 minutes'); $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; @@ -337,6 +338,27 @@ class Sales_PD_Controller extends REST_Controller { } } + + public function saveSalesPDImage_post() + { + $records = $this->post('records'); + + $id = $this->Sales_PD_Model->saveRecords($records,SALEPD_DOCS); + if($id) + { + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $id; + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + $data['msg'] = 'Something went wrong! Try Later'; + $this->response($data,REST_Controller::HTTP_OK); + } + } } diff --git a/api/application/views/report_templates/JSONTOREPORT_CLIX.php b/api/application/views/report_templates/JSONTOREPORT_CLIX.php index ecdf9959..8415087f 100644 --- a/api/application/views/report_templates/JSONTOREPORT_CLIX.php +++ b/api/application/views/report_templates/JSONTOREPORT_CLIX.php @@ -1175,7 +1175,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $loan_amount = MYUTIL::customIndianNumberFormat( $loan_form['loan_amount']); - echo 'During the PD visit, '.$main_applicant_name.', provided the following information about loan applied for:'; + echo 'During the PD visit, person met provide the following information about loan applied for:'; $is_current_product_bl = $pd_master_details[0]['product_abbr'] == "BL" ? true: false; $is_current_product_lab = $pd_master_details[0]['product_abbr'] == "LAP" ? true: false; diff --git a/api/application/views/report_templates/JSONTOREPORT_DI_AI.php b/api/application/views/report_templates/JSONTOREPORT_DI_AI.php index 7682373b..7fa6f79e 100644 --- a/api/application/views/report_templates/JSONTOREPORT_DI_AI.php +++ b/api/application/views/report_templates/JSONTOREPORT_DI_AI.php @@ -696,7 +696,8 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $individual) { @@ -721,21 +722,25 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $company_relationship_data = null; //print_r($general_form['company_with_relationships']); - foreach($general_form['company_with_relationships'] as $company_with_relationship) + foreach($general_form['company_with_relationships'] as $crk => $company_with_relationship) { //print_r($company_with_relationship); - if($individual['pd_co_applicant_id'] == $company_with_relationship['applicant_name']) + + if($individual['pd_co_applicant_id'] == $company_with_relationship['applicant_name'] && $company_with_relationship['company_name'] != '') { //FInd Company Name from JSON //echo "ONCE"; - $company_relationship_data = ($company_with_relationship['company_relationship_master'] .' '.$company_with_relationship['company_name']); + //echo '### '.$crk.'-ICID'.$individual['pd_co_applicant_id'].'--'.$company_with_relationship['applicant_name'].'-'.$company_with_relationship['company_name']; + $company_relationship_data .= ($company_with_relationship['company_relationship_master'] .' '.$company_with_relationship['company_name']); $company_relationship_data.='
and

'; + //echo $company_relationship_data; } } - + //echo $company_relationship_data; + // die(); $personal_relationship_data = null; foreach($general_form['persons_with_relationships'] as $persons_with_relationship) { @@ -788,6 +793,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); '.$general_form['general_remark'].'

'; + } ?> @@ -798,6 +804,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); '; @@ -1188,7 +1195,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); //print_r($loan_form);die(); $loan_amount = MYUTIL::customIndianNumberFormat($loan_form['loan_amount']); - echo 'During the PD visit, '.$main_applicant_name.', provided the following information about loan applied for:'; + echo 'During the PD visit, person met provide the following information about loan applied for:'; $is_current_product_bl = $pd_master_details[0]['product_abbr'] == "BL" ? true: false; $is_current_product_lab = $pd_master_details[0]['product_abbr'] == "LAP" ? true: false; diff --git a/api/application/views/report_templates/JSONTOREPORT_DI_AI_ADDON.php b/api/application/views/report_templates/JSONTOREPORT_DI_AI_ADDON.php index 83012f3d..79d8aaeb 100644 --- a/api/application/views/report_templates/JSONTOREPORT_DI_AI_ADDON.php +++ b/api/application/views/report_templates/JSONTOREPORT_DI_AI_ADDON.php @@ -1458,7 +1458,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); //print_r($loan_form);die(); $loan_amount = MYUTIL::customIndianNumberFormat($loan_form['loan_amount']); - echo 'During the PD visit, '.$main_applicant_name.', provided the following information about loan applied for:'; + echo 'During the PD visit, person met provide the following information about loan applied for:'; $is_current_product_bl = $pd_master_details[0]['product_abbr'] == "BL" ? true: false; $is_current_product_lab = $pd_master_details[0]['product_abbr'] == "LAP" ? true: false; diff --git a/api/application/views/report_templates/JSONTOREPORT_RI.php b/api/application/views/report_templates/JSONTOREPORT_RI.php index 4fe925af..2751af08 100644 --- a/api/application/views/report_templates/JSONTOREPORT_RI.php +++ b/api/application/views/report_templates/JSONTOREPORT_RI.php @@ -959,7 +959,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); //print_r($loan_form);die(); $loan_amount = MYUTIL::customIndianNumberFormat($loan_form['loan_amount']); - echo 'During the PD visit, '.$main_applicant_name.', provided the following information about loan applied for:'; + echo 'During the PD visit, person met provide the following information about loan applied for:'; $is_current_product_bl = $pd_master_details[0]['product_abbr'] == "BL" ? true: false; $is_current_product_lab = $pd_master_details[0]['product_abbr'] == "LAP" ? true: false; diff --git a/api/application/views/sale_pd_templates/SMC.php b/api/application/views/sale_pd_templates/SMC.php index f6d3e103..ce85b08a 100644 --- a/api/application/views/sale_pd_templates/SMC.php +++ b/api/application/views/sale_pd_templates/SMC.php @@ -3,7 +3,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $uparrow = ''; $downarrow = ''; - $dash = '-'; + $dash = ' '; ?> @@ -80,7 +80,10 @@ defined('BASEPATH') OR exit('No direct script access allowed'); color: white;page-break-inside: inline; } + /* #########End of Score Card Table Styles######### */ + +.tdcenteralign{ text-align: center; } @@ -230,7 +233,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); { if(is_numeric($fy_key)) { - echo ''.($fy_value['sales_revenue'] ).''; + echo ''.($fy_value['sales_revenue'] ).''; } } ?> @@ -243,7 +246,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); { if(is_numeric($fy_key)) { - echo ''.($fy_value['net_profit'] ).''; + echo ''.($fy_value['net_profit'] ).''; } } ?> @@ -257,7 +260,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); { if(is_numeric($fy_key)) { - echo ''.round((($fy_value['net_profit'] / $fy_value['sales_revenue'] ) * 100 ),2).''; + echo ''.round((($fy_value['net_profit'] / $fy_value['sales_revenue'] ) * 100 ),2).''; } } ?> @@ -275,7 +278,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); if($fy_key == 0) { - echo 'NA'; + echo 'NA'; } else { @@ -283,7 +286,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $sales_over_py = round( ((($fy_value['sales_revenue'] - $pre_year_sales) / $pre_year_sales ) * 100),2); - echo ''. ((($sales_over_py == 0 ) ? $dash :( $sales_over_py > 0 ? $uparrow : $downarrow))).' ( ' . $sales_over_py. ' )'; + echo ''. ((($sales_over_py == 0 ) ? $dash :( $sales_over_py > 0 ? $uparrow : $downarrow))).'' . abs($sales_over_py). ' '; } $pre_year_sales = $fy_value['sales_revenue']; @@ -302,12 +305,12 @@ defined('BASEPATH') OR exit('No direct script access allowed'); { if($fy_key == 0) { - echo 'NA'; + echo 'NA'; } else { $net_profit_over_py = round( ((($fy_value['net_profit'] - $pre_year_net_profit) / $pre_year_net_profit ) * 100),2); - echo ''. ((($net_profit_over_py == 0 ) ? $dash :( $net_profit_over_py > 0 ? $uparrow : $downarrow))).' ( ' . $net_profit_over_py. ' )'; + echo ''. ((($net_profit_over_py == 0 ) ? $dash :( $net_profit_over_py > 0 ? $uparrow : $downarrow))).' ' . abs($net_profit_over_py). ' '; } $pre_year_net_profit = $fy_value['net_profit']; @@ -326,14 +329,14 @@ defined('BASEPATH') OR exit('No direct script access allowed'); { if($fy_key == 0) { - echo 'NA'; + echo 'NA'; } else { $year_net_pro_loss_per_over_py = round( ((( (($fy_value['net_profit'] / $fy_value['sales_revenue'] ) * 100 ) - $pre_year_net_pro_loss_per) / $pre_year_net_pro_loss_per ) * 100),2); - echo ''. ((($year_net_pro_loss_per_over_py == 0 ) ? $dash :( $year_net_pro_loss_per_over_py > 0 ? $uparrow : $downarrow))).' ( ' . $year_net_pro_loss_per_over_py. ' )'; + echo ''. ((($year_net_pro_loss_per_over_py == 0 ) ? $dash :( $year_net_pro_loss_per_over_py > 0 ? $uparrow : $downarrow))).' ' . abs($year_net_pro_loss_per_over_py). ' '; // echo ''. (($year_net_pro_loss_per_over_py > 0 )? '' : '').' ( ' . $year_net_pro_loss_per_over_py. ' )'; //(($fy_value['net_profit'] / $fy_value['sales_revenue'] ) * 100 ) } @@ -450,27 +453,27 @@ if(isset($section6)) $img_value) - { - if(!is_array($img_value)) - { - array_push($photos, array('name' => $img_key, 'img' => $img_value)) ; - } - else - { - foreach ($img_value as $key => $value) - { - if($value) - { - array_push($photos, array('name' => $img_key, 'img' => $value)) ; - } - } - } - } - } + // $photos = array(); + // if(isset($section9) && count($section9)) + // { + // foreach ($section9 as $img_key => $img_value) + // { + // if(!is_array($img_value)) + // { + // array_push($photos, array('name' => $img_key, 'img' => $img_value)) ; + // } + // else + // { + // foreach ($img_value as $key => $value) + // { + // if($value) + // { + // array_push($photos, array('name' => $img_key, 'img' => $value)) ; + // } + // } + // } + // } + // } //print_r($photos);die(); ?> @@ -479,15 +482,16 @@ if(isset($section6)) 'Selfie with person met','approach_to_pd_location' => 'Approach to pd location','name_board_seen' => 'Name board seen', 'stock_image' => 'Stock image','workplace_interior_image' => 'Workplace interior image'); - if(count($photos)) + //if(count($photos)) + if(count($section9)) { echo '
Photograph`s

'; - foreach ($photos as $p_key => $p_value) + foreach ($section9 as $p_key => $p_value) { if(!($iter % 3)) { echo ''; } - echo ''; + echo ''; if(!($iter % 3) && $iter != 0) { echo ''; } $iter++;

'.$photo_names [ $p_value['name'] ].'

'.$photo_names [ $p_value['img_name'] ].'