From f177d066c3819aa08c845f82e4f5afacd6d37773 Mon Sep 17 00:00:00 2001 From: Velz2020 Date: Fri, 10 Jan 2020 12:42:17 +0530 Subject: [PATCH] SALES PD MIS REPORT --- api/application/config/routes.php | 1 + api/application/controllers/PD_Controller.php | 36 ++++++++++- .../controllers/Sales_PD_Controller.php | 64 ++++++++++++++++++- .../report_templates/JSONTOREPORT_SAL.php | 11 +++- 4 files changed, 106 insertions(+), 6 deletions(-) diff --git a/api/application/config/routes.php b/api/application/config/routes.php index 72040b61..46a4f010 100644 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -267,4 +267,5 @@ $route['saveSalesPDImage'] = 'Sales_PD_Controller/saveSalesPDImage'; $route['saveSalesPDsection'] = 'Sales_PD_Controller/saveSalesPDsection'; $route['getSalesPDSectionData'] = 'Sales_PD_Controller/getSalesPDSectionData'; $route['testAPISalesPD'] = 'Sales_PD_Controller/testAPISalesPD'; +$route['salesPDMisReport'] = 'Sales_PD_Controller/salesPDMisReport'; diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 63cd621e..162e0e49 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -2916,6 +2916,40 @@ public function getPDFormDetailsJSON_post() $custom_log_info = '###Get Business IMG AWS urls & attach into JSON Function End - ('. $pd_id.' - '. $pd_form_id.') - ' . date('Y-m-d H:i:s A'); log_message('ERROR',$custom_log_info); } + + if($pd_form_id == 12 ) //Employeement + { + + $custom_log_info = '###Get EMployee IMG AWS urls & attach into JSON Function Called - ('. $pd_id.' - '. $pd_form_id.') - ' . date('Y-m-d H:i:s A'); + log_message('ERROR',$custom_log_info); + + $result_data = $this->PD_Model->getSignedPDDocsURL($pd_id,12,null,null,null,null,'report'); + + foreach($result_data as $b_key => $b_value) + { + if($b_value['pd_document_title'] == 'attendance_seen_pic') + { + $temp_rec['attendance_seen_pic'] = $b_value['doc_url']; + } + if($b_value['pd_document_title'] == 'sal_reg_seen_pic') + { + $temp_rec['sal_reg_seen_pic'] = $b_value['doc_url']; + } + if($b_value['pd_document_title'] == 'name_board_img') + { + $temp_rec['name_board_img'] = $b_value['doc_url']; + } + if($b_value['pd_document_title'] == 'id_card_image') + { + $temp_rec['id_card_image'] = $b_value['doc_url']; + } + + } + //die(); + $rec[0]['json'] = json_encode($temp_rec); + $custom_log_info = '###Get Employeement IMG AWS urls & attach into JSON Function End - ('. $pd_id.' - '. $pd_form_id.') - ' . date('Y-m-d H:i:s A'); + log_message('ERROR',$custom_log_info); + } } @@ -5791,7 +5825,7 @@ public function getPDFormDetailsJSON_post() public function codeigniterViewTest_post() { //print_r($this->aws_s3->createNewBucket('len3'));die(); - //satellite_image::getSatelliteImage(2,2);die(); + //satellite_image::getSatelliteImage(997);die(); //echo $this->assignPDTempalate(1325);die(); //$this->getSatelliteImage(342);die();//velmurugan.s@venbainfotech.com // PDALERTS::sendSalesPDMail($this,2);die(); diff --git a/api/application/controllers/Sales_PD_Controller.php b/api/application/controllers/Sales_PD_Controller.php index 2206600d..0e0a511e 100644 --- a/api/application/controllers/Sales_PD_Controller.php +++ b/api/application/controllers/Sales_PD_Controller.php @@ -256,7 +256,7 @@ class Sales_PD_Controller extends REST_Controller { { $lender_id = $this->uri->segment(2); $user_id = $this->uri->segment(3); - $columns = array('SALES_PD_DATA.sales_pd_id','SALES_PD_DATA.sales_pd_sno','SALES_PD_DATA.applicant_name','concat(USERPROFILE.first_name," ",USERPROFILE.first_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.createdon','SALES_PD_DATA.status'); + $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.createdon','SALES_PD_DATA.status'); $table = SALES_PD_DATA.' as SALES_PD_DATA'; $joins = array( array('table' => ENTITY. ' as ENTITY', @@ -797,7 +797,67 @@ class Sales_PD_Controller extends REST_Controller { public function testAPISalesPD_post() { - //PDALERTS::sendSalesPDMail($this,2);die(); + PDALERTS::sendSalesPDMail($this,14);die(); + } + + public function salesPDMisReport_post() + { + //$lender_id = $this->uri->segment(2); + $officer_name = $this->post('officer_name'); + $from_date = $this->post('from_date'); + $to_date = $this->post('to_date'); + + + $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.createdon','SALES_PD_DATA.status','SALES_PD_DATA.mail_status'); + $table = SALES_PD_DATA.' as SALES_PD_DATA'; + $joins = array( + array('table' => ENTITY. ' as ENTITY', + 'condition' =>'SALES_PD_DATA.lender_id = ENTITY.entity_id', + 'jointype' => 'INNER'), + array('table' => PRODUCTS. ' as PRODUCT', + 'condition' =>'SALES_PD_DATA.product_id = PRODUCT.product_id', + 'jointype' => 'INNER'), + array('table' => USERPROFILE. ' as USERPROFILE', + 'condition' =>'SALES_PD_DATA.createdby = USERPROFILE.userid', + 'jointype' => 'LEFT') + ); + + $where_condition_array = array(); + if($officer_name) + { + //$where_condition_array[] = array('SALES_PD_DATA.officer_name like' => '%'.$officer_name.'%'); + $where_condition_array['SALES_PD_DATA.officer_name like'] = '%'.$officer_name.'%'; + } + if($from_date) + { + + $where_condition_array['date(SALES_PD_DATA.createdon) >='] = $from_date; + } + if($to_date) + { + + $where_condition_array['date(SALES_PD_DATA.createdon) <='] = $to_date; + } + + $order_by = 'SALES_PD_DATA.sales_pd_id'; + $sales_pd_data = $this->Sales_PD_Model->getJoinRecords($columns,$table,$joins,$where_condition_array,$order_by,'DESC'); + //print_r($this->db->last_query()); + if(count($sales_pd_data)) + { + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $sales_pd_data; + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + $data['msg'] = 'No Data Found'; + $this->response($data,REST_Controller::HTTP_OK); + } + + } } diff --git a/api/application/views/report_templates/JSONTOREPORT_SAL.php b/api/application/views/report_templates/JSONTOREPORT_SAL.php index 6ab8acee..6d895e2a 100644 --- a/api/application/views/report_templates/JSONTOREPORT_SAL.php +++ b/api/application/views/report_templates/JSONTOREPORT_SAL.php @@ -860,16 +860,20 @@ defined('BASEPATH') OR exit('No direct script access allowed'); ?> $com_value) { if($com_value['pd_document_title'] == 'satellite') { - $satellite_url = $com_value['doc_url'];break; + $satellite_url = $com_value['doc_url']; + unset($pd_images['common_images'][$com_key]); + break; } } } + ?> @@ -1949,7 +1953,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $tot_rows = ceil(count($pd_images['common_images'])/3); echo '
'; echo '
Photograph`s

'; - + $employment_img_names = array('attendance_seen_pic' => 'Attendance Register Image','sal_reg_seen_pic' => 'Salary Register Image','id_card_image' => 'Employee ID card','name_board_img' => 'Name Board Image'); $add_factor = 0; for($row = 0;$row < $tot_rows; $row++) { @@ -1963,7 +1967,8 @@ defined('BASEPATH') OR exit('No direct script access allowed'); if(isset($pd_images['common_images'][$i]) && ($pd_images['common_images'][$i]['pd_document_title'] != 'satellite')) { - echo ''; + $doc_title = isset($employment_img_names [ $pd_images['common_images'][$i]['pd_document_title'] ]) ? $employment_img_names [ $pd_images['common_images'][$i]['pd_document_title'] ] : $pd_images['common_images'][$i]['pd_document_title']; + echo ''; } //unset($p_key);
'.$pd_images['common_images'][$i]['pd_document_title'].'
'. $pd_images['common_images'][$i]['pd_document_title'] .'
'.$pd_images['common_images'][$i]['pd_document_title'].'
'. $doc_title .'