From 23b08dbc42db8dd76ad2890de2282fd4775fca5c Mon Sep 17 00:00:00 2001 From: Velz2020 Date: Sun, 4 Aug 2019 23:02:18 +0530 Subject: [PATCH] QC MAIL LOG REMOVED AI ISSUE FIXED --- api/application/config/config.php | 4 +- api/application/config/constants.php | 1 + api/application/config/routes.php | 1 + api/application/controllers/PD_Controller.php | 94 +++++++++++++------ .../helpers/assessedincome_helper.php | 2 +- .../helpers/authorization_helper.php | 2 +- .../helpers/external_dir_check_helper.php | 2 +- api/application/helpers/pdalerts_helper.php | 2 +- .../helpers/push_notification_helper.php | 3 +- .../views/report_templates/JSONTOREPORT.php | 14 ++- 10 files changed, 88 insertions(+), 37 deletions(-) diff --git a/api/application/config/config.php b/api/application/config/config.php index 7be1deb4..26e1b6ed 100644 --- a/api/application/config/config.php +++ b/api/application/config/config.php @@ -223,7 +223,7 @@ $config['allow_get_array'] = TRUE; | your log files will fill up very fast. | */ -$config['log_threshold'] = 1; +$config['log_threshold'] = array(1,2); /* |-------------------------------------------------------------------------- @@ -235,6 +235,8 @@ $config['log_threshold'] = 1; | */ $config['external_data_path'] = $_SERVER['DOCUMENT_ROOT'].'/ssa_external_data/'.ENVIRONMENT; +$config['full_server_name'] = (substr_count($_SERVER['HTTP_HOST'],'localhost') == 1 ? 'http://localhost':$_SERVER['HTTP_HOST']); + $config['log_path'] = $config['external_data_path'].'/ci_logs/'; /* diff --git a/api/application/config/constants.php b/api/application/config/constants.php index f1f26fc8..2ea4372e 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -88,6 +88,7 @@ defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest auto //defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(getPDReportHTML/:any)'); // no errors defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'getPDOfficerCurrentLocation'); // no errors defined('ROUTE_LOGIN_X') OR define('ROUTE_LOGIN_X', '(getPDReportHTML/:any/:any)'); // no errors +defined('ROUTE_LOGIN_Y') OR define('ROUTE_LOGIN_Y', '(getPDReportPDFpreview/:any/:any)'); // no errors //defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN','getFullPDDetails'); // no errors /*********************AWS resources Constants*************************************************/ diff --git a/api/application/config/routes.php b/api/application/config/routes.php index 25dd5608..ff9c6d03 100644 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -204,6 +204,7 @@ $route['getPDCompleteDetails'] = 'PD_Controller/getPDCompleteDetails'; $route['getStateCityNamesAndPincode'] = 'PD_Controller/getStateCityNamesAndPincode'; $route['saveHTMLReport'] = 'PD_Controller/saveHTMLReport'; $route['(getPDReportHTML/:any/:any)'] = 'PD_Controller/getPDReportHTML'; +$route['(getPDReportPDFpreview/:any/:any)'] = 'PD_Controller/getPDReportPDFpreview'; $route['convertBase64'] = 'PD_Controller/convertImgUrlToBase64'; $route['updateNotificationToken'] = 'PD_Controller/updateNotificationToken'; $route['getPDScore'] = 'PD_Controller/getPDScoreForDisplay'; diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 7b3ebcce..932f165f 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -3306,10 +3306,11 @@ class PD_Controller extends REST_Controller { public function saveAssessedIncomeMonthwiseItems_post()//SALESITEMMONTHWISECHILD { $records = $this->post('records'); + $count = 0; foreach($records as $key => $record) { - + //$record['sales_type'] $child_data = array(); if(array_key_exists('child',$record)) { @@ -3319,6 +3320,7 @@ class PD_Controller extends REST_Controller { $id = ""; if($record['sim_id'] != null || $record['sim_id'] != "" ) { + die(); $where_condition_array = array('sim_id'=>$record['sim_id']); $id = $this->PD_Model->updateRecords($record,SALESITEMMONTHWISE,$where_condition_array); if($id != "" || $id != null) @@ -3333,7 +3335,7 @@ class PD_Controller extends REST_Controller { } else { - if($child['sales_date'] != null || $child['sales_date'] != "") + if(($child['frequency_value'] != null || $child['frequency_value'] != "") || ($child['sales_date'] != null || $child['sales_date'] != "")) { $child['fk_sim_id'] = $record['sim_id']; $child_id = $this->PD_Model->saveRecords($child,SALESITEMMONTHWISECHILD); @@ -3345,9 +3347,6 @@ class PD_Controller extends REST_Controller { } else { - //print_r($child_data);die(); - - $id = $this->PD_Model->saveRecords($record,SALESITEMMONTHWISE); if($id != "" || $id != null) @@ -3356,7 +3355,7 @@ class PD_Controller extends REST_Controller { foreach($child_data as $ckey => $child) { - if($child['sales_date'] != null || $child['sales_date'] != "") + if(($child['frequency_value'] != null || $child['frequency_value'] != "") || ($child['sales_date'] != null || $child['sales_date'] != "")) { //echo 'true'; $child['fk_sim_id'] = $id; @@ -3822,16 +3821,18 @@ class PD_Controller extends REST_Controller { //print_r($sales_monthwise);die(); foreach($sales_monthwise as $sale) { - //print_r($sale); - $annual_multuplier = 12 / $sale['no_of_months']; - if($sale['sales_type'] == 1) - { - $total_sales_monthwise = $total_sales_monthwise + ($sale['total'] * $annual_multuplier); - } - else if($sale['sales_type'] == 2) - { - $total_sales_monthwise = $total_sales_monthwise + $sale['total']; - } + + + $annual_multuplier = 12 / ( $sale['no_of_months'] ? $sale['no_of_months'] : 1); + + if($sale['sales_type'] == 1) + { + $total_sales_monthwise = $total_sales_monthwise + ($sale['total'] * $annual_multuplier); + } + else if($sale['sales_type'] == 2) + { + $total_sales_monthwise = $total_sales_monthwise + $sale['total']; + } } //calculation part @@ -3841,14 +3842,15 @@ class PD_Controller extends REST_Controller { $temp_purchases = $overall_purchase_total; $temp_grossprofit = $total_sales_monthwise - $temp_purchases; $temp_netprofit = $temp_grossprofit - $overall_business_expenses_total; - $temp_netmargin = ($temp_netprofit/$total_sales_monthwise) * 100; + $temp_netmargin = ($temp_netprofit/ ($total_sales_monthwise?$total_sales_monthwise:1) ) * 100; } else { $temp_grossprofit = $temp_netprofit ;//+ $overall_business_expenses_total; $temp_purchases = $total_sales_monthwise - $temp_grossprofit; $temp_netprofit = $temp_grossprofit - $overall_business_expenses_total; - $temp_netmargin = ($temp_netprofit/$total_sales_monthwise) * 100; + //echo $temp_netprofit.'-'.$total_sales_monthwise;die(); + $temp_netmargin = ($temp_netprofit/ ($total_sales_monthwise?$total_sales_monthwise:1) ) * 100; } $overall_summary_report['sales_calculated_by_monthwise']['sales_revenue'] = round($total_sales_monthwise); @@ -5178,10 +5180,10 @@ class PD_Controller extends REST_Controller { // MYLOG::logFunction(null,$pdid)->info($pd_string,array('data' => 'Test LOg info')); // MYLOG::logFunction()->warning($pd_string,array('data' => 'Test LOg warn')); // MYLOG::logFunction()->error($pd_string,array('data' => 'Test LOg error')); - // $this->load->helper('push_notification'); - // PUSH_NOTIFICATION::notifyWeb('fbm57p_E5xc:APA91bENk6ZH7J2kj03liCy0FzrtsYUgVjvoYnPBi4bu4UtGjqixn0Z_cUDHjCHeBWNcXlVozoo_uUKr8gwufcOQMfdRK19_sWN9jA5U1hRuwJTpIQKows6wYSHFH7kI4EnnUaj0FtK_','EST','test mesg from server',1); - //PDALERTS::pdnotification($pdid); - //die(); + // $this->load->helper('push_notification'); + // PUSH_NOTIFICATION::notifyWeb('eT3F2YlSOsU:APA91bEoK7w-_yaoWK8NUYsYwL1gAfIShm70K5t8IrHjiZAw-oNKOOL09bfgfthBoA4EFoVot17Y9ZOhWxO-B3oKVoQdYxUq6JsAdrOwmPTO-9-mJ61zBcifg34EiiUmdnrAQDt7E90t','Test Msg from test api',array()); + // PDALERTS::pdnotification($pdid); + // die(); //$this->demo(5); // $this->demo(0); @@ -7021,12 +7023,15 @@ class PD_Controller extends REST_Controller { { $pdid = $this->uri->segment(3); $random_string = $this->uri->segment(2); + $this->getLatestPDReportHTMLFile($pdid,$random_string); - //date_default_timezone_set("Asia/Kolkata"); - //echo date('Y-m-d h:i:s');die(); + } + + function getLatestPDReportHTMLFile($pdid,$random_string,$return_type = false) + { if(($pdid != null || $pdid != "")) //&& (strlen($pdid) == 16) &&(is_string($pdid))) { - $pd_data = $this->PD_Model->selectCustomRecords(array('pd_id','pd_report_html_filename'),array('random_string' => $random_string,'pd_id' => $pdid),PDTRIGGER); + $pd_data = $this->PD_Model->selectCustomRecords(array('pd_id','pd_report_html_filename'),array('random_string' => $random_string,'pd_id' => $pdid),PDTRIGGER); if(count($pd_data)) { @@ -7040,7 +7045,7 @@ class PD_Controller extends REST_Controller { } file_put_contents($temp_file_path,$report_data); $view_name = 'pd_reports/'. $pd_data[0]['pd_id'] .'/temp.html'; - $this->load->view($view_name); + return $this->load->view($view_name,array(),$return_type); } @@ -7054,6 +7059,41 @@ class PD_Controller extends REST_Controller { echo "

Not Found

"; } } + + public function getPDReportPDFpreview_post() + { + + + //echo json_encode(array('link'=>'https://demo.pdgenie.com/ssa_external_data/testing/pd_reports/1135/sample.pdf'));die(); + + $pdid = $this->uri->segment(3); + log_message('DEBUG',"getPDReportPDFpreview_post called ");//die(); + $random_string = $this->uri->segment(2); + EXTERNAL_DIR_CHECK::checkExternalDirectory($pdid); + $records = $this->post('myData'); + $report_data = ''; + if($records) + { + $report_data = $records; + + } + else + { + $report_data = $this->getLatestPDReportHTMLFile($pdid,$random_string,true); + + } + + $pdf_doc = $this->pdfgenerator->generate($report_data, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait"); + //End of PDF Gen using DOM PDF + $output_file2 = $this->external_path ."/pd_reports/" . $pdid . "/sample.pdf"; + $link = 'https://'. $this->config->item('full_server_name').'/ssa_external_data/'. ENVIRONMENT.'/pd_reports/'. $pdid . "/sample.pdf"; + file_put_contents($output_file2, $pdf_doc); + //header("Access-Control-Allow-Methods: GET, OPTIONS"); + header('Access-Control-Allow-Origin: *'); + header("Access-Control-Allow-Methods: GET, POST, OPTIONS"); + echo json_encode(array('link'=>$link)); + + } @@ -7746,7 +7786,7 @@ class PD_Controller extends REST_Controller { if( $total_stock_observed != 0 && !(count($pd_images[11])))//&& !count($pd_images[11][0])) ) { - $incomplete_details[] = 'Stock Section - Images not sufficient. Available Images';// - '.(count($pd_images[11]) ? count($pd_images[11]) : 0); + $incomplete_details[] = 'Stock Section - Images not sufficient';//. Available Images';// - '.(count($pd_images[11]) ? count($pd_images[11]) : 0); } //} } diff --git a/api/application/helpers/assessedincome_helper.php b/api/application/helpers/assessedincome_helper.php index 762b5b55..fecd3684 100644 --- a/api/application/helpers/assessedincome_helper.php +++ b/api/application/helpers/assessedincome_helper.php @@ -21,7 +21,7 @@ class AssessedIncome $net_profit_loss_row = ' f. Net Profit / Loss(c-e) '; $house_hold_expense_row = ' g. Household Expenses '; $disposable_income_row = ' h. Disposable Income'; - $net_margin_row = ' h. Net Margin % '; + $net_margin_row = ' i. Net Margin % '; $considered_sales_revenue_row = ' a) Considered Sales / Revenue ( Average) '; $considered_net_profit_row = ' b) Considered Net Profit ( Average)'; $considered_net_margint_row = ' c) Considered Net Margin % ((b/a) * 100 )'; diff --git a/api/application/helpers/authorization_helper.php b/api/application/helpers/authorization_helper.php index 81073f9d..d9640b15 100644 --- a/api/application/helpers/authorization_helper.php +++ b/api/application/helpers/authorization_helper.php @@ -69,7 +69,7 @@ class AUTHORIZATION // print_r($role_permission_array); // die(); - if( $routingName == ROUTE_LOGIN_X) + if( $routingName == ROUTE_LOGIN_X || $routingName == ROUTE_LOGIN_Y) { return true; } diff --git a/api/application/helpers/external_dir_check_helper.php b/api/application/helpers/external_dir_check_helper.php index b4b05937..c5a0199c 100644 --- a/api/application/helpers/external_dir_check_helper.php +++ b/api/application/helpers/external_dir_check_helper.php @@ -35,7 +35,7 @@ class EXTERNAL_DIR_CHECK $pd_folder = $array[3].'/'.$pd_id; if(!file_exists($pd_folder)) { - mkdir($pd_folder,0761); + mkdir($pd_folder,0777); } } diff --git a/api/application/helpers/pdalerts_helper.php b/api/application/helpers/pdalerts_helper.php index 008f70d2..871848ff 100644 --- a/api/application/helpers/pdalerts_helper.php +++ b/api/application/helpers/pdalerts_helper.php @@ -389,7 +389,7 @@ class PDALERTS $mail->IsSMTP(); // Telling the class to use SMTP $mail->SMTPAuth = true; - $mail->SMTPDebug = 1; + $mail->SMTPDebug = 0; $mail->SMTPSecure = "ssl"; $mail->Host = 'bh-in-16.webhostbox.net'; // SMTP server $mail->Username = "noreply@ssa.sineedge.com"; // "The account" diff --git a/api/application/helpers/push_notification_helper.php b/api/application/helpers/push_notification_helper.php index 75285369..dd0d700a 100644 --- a/api/application/helpers/push_notification_helper.php +++ b/api/application/helpers/push_notification_helper.php @@ -80,7 +80,8 @@ class PUSH_NOTIFICATION $result = curl_exec($ch ); curl_close( $ch ); $CI =&get_instance(); - //print_r($result); + // print_r($result); + // die(); MYLOG::logFunction(null,$additional_data['pd_id'])->info("PUSH NOTIFICATION ",array('firebase_result' => $result,'additional_data' => $additional_data,'token_type' => ($type == 1? 'WEB' : 'MOB'),'token' => $token)); } } diff --git a/api/application/views/report_templates/JSONTOREPORT.php b/api/application/views/report_templates/JSONTOREPORT.php index ef4c4511..956afdce 100644 --- a/api/application/views/report_templates/JSONTOREPORT.php +++ b/api/application/views/report_templates/JSONTOREPORT.php @@ -508,7 +508,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); { echo '

Disclaimer: The information contained in this report (a) is provided for the benefit of Clix Capital Services Private Limited (hereinafter referred to as Clix) only, and is not for the benefit of any other parties; (b) has been compiled by Sineedge Consulting Private Limited (Hereinafter referred as SCPL) in accordance with the instructions given, by Clix; (c) has been obtained during the visit done at premises as instructed by Clix. Some of the information in this report, by the very nature of it, might have been obtained through informal sources. SCPL wishes to mention that all due care has been exercised by SCPL in collecting information and putting together this report. However, given the nature of some of these verifications, SCPL cannot be held liable for any financial or other loss to Clix on account of any errors or omissions in the report. SCPL does not guarantee absolute accuracy of information contained herein. SCPL does not take any responsibility for any action(s) that the client may take based on the contents of this report.

'; - echo '

Registered / Corporate Office: SineEdge Consulting Private Limited. A-211, Pioneer Urban Square, Golf Course Extension Road, Sector 62, Gurgaon, Haryana - 122002

'; + echo '

Registered / Corporate Office: SineEdge Consulting Private Limited. A-211, Pioneer Urban Square, Golf Course Extension Road, Sector 62, Gurgaon, Haryana - 122002

'; } @@ -742,7 +742,12 @@ defined('BASEPATH') OR exit('No direct script access allowed'); { $business_entity_type_master = array(1 => 'Others', 2 => 'Public Ltd Company', 3 => 'Sole proprietorship', 4 => 'HUF (Hindu Undivided Family)', 5 => 'Partnership',6 => 'Cooperative',7 => 'Limited Liability Partnership(LLP)',8 => 'OPC (One Person Company)',9 => 'Society',10 => 'Trust',11 => 'Private Limited Company'); foreach ($general_form['companies'] as $comp_key => $ind_company) { + if($ind_company['is_company_applicant'] != null) + { + echo ''. $ind_company['company_name'] .''. $ind_company['business_years']. (isset($ind_company['business_month']) ? ' . ' . $ind_company['business_month']: null) .''. ( $ind_company['business_entity_type'] == 1 ? $ind_company['business_entity_type_other'] : $business_entity_type_master[ $ind_company['business_entity_type'] ] ).' Not Applicable '; + } + } } ?> @@ -2228,6 +2233,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $bbRow = $pd_processed_forms[21][$business_count] ; $businessBankRow = json_decode($bbRow['processed_json'],true); $business_banking_common_remarks = $businessBankRow['banking_form_remark']; + //print_r($businessBankRow);die(); if(isset($businessBankRow['bank_info_available']) && $businessBankRow['bank_info_available'] == 1) { $is_business_banking_available = 1; @@ -2372,7 +2378,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $client_fourth_row .= $main_raw_material['person_stdcode'] && $main_raw_material['person_landline'] ? ''. $main_raw_material['person_stdcode'].' '.$main_raw_material['person_landline'].'' : ''.'Not Provided'.''; - $client_fifth_row .= $main_raw_material['manufacturing_payment_type_master'] ? ''. $main_raw_material['manufacturing_payment_type_master'] .'' : 'NA'; + $client_fifth_row .= isset($main_raw_material['manufacturing_payment_type_master']) && $main_raw_material['manufacturing_payment_type_master'] ? ''. $main_raw_material['manufacturing_payment_type_master'] .'' : 'NA'; $client_sixth_row .= $main_raw_material['manufacturing_payment_mode'] ? ''. $main_raw_material['manufacturing_payment_mode'] .'' : 'NA';; @@ -3525,7 +3531,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $ind_banking_common_remarks = $individualBankRow['banking_form_remark']; if(isset($individualBankRow['bank_info_available']) && $individualBankRow['bank_info_available'] == 1) { - + $is_personal_banking_available = 1; if(count($individualBankRow['banking_details'])>0){ $getIndividualEachValues=BANKINGFORM::getIndividualBankingDetails($individualBankRow['banking_details']); $bankingResult = array_merge($bankingResult,$getIndividualEachValues); @@ -3797,7 +3803,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); } ?> -

Neighbourhood / Reference Check

+

Neighbourhood / Reference Check