diff --git a/api/application/config/constants.php b/api/application/config/constants.php index fd325dd8..5bb1627a 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -101,7 +101,7 @@ else if(ENVIRONMENT == 'testing') { defined('LENDER_BUCKET_NAME_PREFIX') OR define('LENDER_BUCKET_NAME_PREFIX','len'); defined('PHANTOMJSSCRIPT_LOCATION') OR define('PHANTOMJSSCRIPT_LOCATION','phantomjs_test'); - defined('LOGTOBOT') OR define('LOGTOBOT',1); + defined('LOGTOBOT') OR define('LOGTOBOT',0); } /*********************END of AWS resources Constants*************************************************/ diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 97e65e31..4bf4af4b 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -794,7 +794,7 @@ class PD_Controller extends REST_Controller { - $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' => $exist_pd_details[0]['pd_status'],'Current_status' => $pd_details['pd_status']); + $dataToBot = array('ENV'=>ENVIRONMENT,'Task Name'=>'PD Template Assign','Template ID'=>$pd_details['fk_pd_template_id'] ,'PDID'=> $pd_details['pd_id'],'Method' => 'UpdatePDMaster','Pre-Status' => $exist_pd_details[0]['pd_status'],'Current_status' => $pd_details['pd_status']); MYHTTPCLIENT::sendPOST($dataToBot); } @@ -894,9 +894,15 @@ class PD_Controller extends REST_Controller { { //update Applicant details - $fields = array('additional_pd_id' => $pd_id); - $where_condition_array = array('pd_co_applicant_id'=>$pd_details['pd_co_applicant_id'],'mobile_no' => $pd_details['mobile_no']); - $this->PD_MODEL->updateRecords($fields,PDAPPLICANTSDETAILS,$where_condition_array); + $fields = array('pd_co_applicant_id'=>$pd_details['pd_co_applicant_id'],'mobile_no' => $pd_details['mobile_no']); + $where_condition_array = array('additional_pd_id' => $pd_id); + $this->PD_Model->updateRecords($fields,PDAPPLICANTSDETAILS,$where_condition_array); + + //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); + $logger = MYLOG::logFunction(); $logger->info("TEMPLATE ASSIGN FUNCTIONALTIY CALLED AND TEMPLATED ID - ".$newpd['fk_pd_template_id']." CHOOSED",array('ENV'=>ENVIRONMENT,'Parent-PDID' => $newpd['parent_pd_id'],'Addresss ID'=>$newpd['fk_address_id'] ,'PDID' => $pd_id,'PD Type' => "Addtional PD",'Current_status' => $newpd['pd_status'])); @@ -905,10 +911,7 @@ class PD_Controller extends REST_Controller { MYHTTPCLIENT::sendPOST($dataToBot); - //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']); @@ -958,7 +961,7 @@ class PD_Controller extends REST_Controller { $pdid = $records['pd_id']; $pd_master_detials = $this->PD_Model->getPDMasterDetails($pdid); - $address_count = $this->db->SELECT('count(*) as count')->FROM(PDADDRESS.' as PDADDRESS')->WHERE('PDADDRESS.fk_pd_id',$pd_master_detials[0]['parent_pd_id'])->WHERE('assigned_pd is null')->GET()->result_array(); + $address_count = $this->db->SELECT('count(*) as count')->FROM(PDADDRESS.' as PDADDRESS')->WHERE('PDADDRESS.fk_pd_id',$pd_master_detials[0]['parent_pd_id'])->WHERE('assigned_pd is null')->WHERE('PDADDRESS.isactive',1)->GET()->result_array(); $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; @@ -4690,6 +4693,7 @@ class PD_Controller extends REST_Controller { // PDALERTS::pdnotification(600); // die(); + $records = $this->post('records'); $pdid = $records['pd_id']; $is_regenerate = 0; @@ -4702,7 +4706,7 @@ class PD_Controller extends REST_Controller { $data['applicants_details'] = $this->PD_Model->getApplicantsDetails($pdid); // $data['pd_additional_requirements'] = $this->PD_Model->getPDAdditionalRequirements($pdid); // $data['score_questions_display'] = $this->PD_Model->getScoreableQuestionToDispaly(); - $data['pd_score'] = $this->calculateScore($pdid); + //$data['pd_score'] = $this->calculateScore($pdid); //print_r($data['pd_score']); // die(); //$score_for_chart = $data['pd_score']['score_summary']['overall_score']['final_score'] ? round($data['pd_score']['score_summary']['overall_score']['final_score'],2) : 0; @@ -4745,8 +4749,9 @@ class PD_Controller extends REST_Controller { $data['pd_processed_forms'][$i] = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON,array(),'','company_id','ASC'); } - //print_r(json_decode($data['pd_processed_forms'][20][0]['processed_json'],true)); - //die(); + //print_r(json_decode($data['pd_processed_forms'][14][0]['processed_json'],true)); + //die(); + //echo "*******************************************"; $t = $this->load->view('report_templates/JSONTOREPORT',$data,true); //echo $t; die(); //PDF Gen using DOM PDF diff --git a/api/application/docs/sample.pdf b/api/application/docs/sample.pdf index a44617f2..051010a0 100644 Binary files a/api/application/docs/sample.pdf and b/api/application/docs/sample.pdf differ diff --git a/api/application/helpers/assetsform_helper.php b/api/application/helpers/assetsform_helper.php index a0a01f97..61763186 100644 --- a/api/application/helpers/assetsform_helper.php +++ b/api/application/helpers/assetsform_helper.php @@ -106,19 +106,31 @@ public static function getBusinessAssetsDetails($values){ // echo "helper"; // print_r($fetchVal); $storeValue=array(); - $storeValue['business_assets_mode'] = $fetchVal['business_assets_mode']; - // this is machinaries + if($fetchVal['business_assets_mode'] != ""){ + $storeValue['business_assets_mode'] = $fetchVal['business_assets_mode']; + + if($fetchVal['business_assets_mode']==4){ switch(strtoupper($fetchVal['business_ownership_type'])) { case 'RENTED': - $storeValue['business_name_of_the_owner'] = ''; - $storeValue['about_business_assets'] = $fetchVal['business_details'][0]['equipment_manufacturing_description'].' rented at Rs.'.$fetchVal['business_monthly_rented_amt']; + $storeValue['business_assets_mode_master'] = $fetchVal['business_assets_mode_master']; + $storeValue['ownership'] = 'RENTED'; + $storeValue['business_approximate_market_value'] = 'NA'; + $storeValue['rent_amount'] = $fetchVal['business_monthly_rented_amt']; + + $storeValue['business_name_of_the_owner'] = ''; + $storeValue['about_business_assets'] = $fetchVal['business_details'][0]['equipment_manufacturing_description']; + //.' rented at Rs.'.$fetchVal['business_monthly_rented_amt']; $storeValue['business_approximate_market_value'] = ''; break; case 'OWNED': + $storeValue['ownership'] = 'OWNED'; + $storeValue['rent_amount'] = 'NA'; + $storeValue['business_assets_mode_master'] = $fetchVal['business_assets_mode_master']; $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']; @@ -133,14 +145,22 @@ public static function getBusinessAssetsDetails($values){ else if($fetchVal['business_assets_mode']==3){ switch(strtoupper($fetchVal['business_ownership_type'])) { case 'RENTED': - $storeValue['business_name_of_the_owner'] = ''; - $storeValue['about_business_assets'] = $fetchVal['business_details'][0]['manufacturer_model_vehicle'].' rented at Rs.'.$fetchVal['business_monthly_rented_amt']; - $storeValue['business_approximate_market_value'] = ''; + $storeValue['business_assets_mode_master'] = $fetchVal['business_assets_mode_master']; + $storeValue['ownership'] = 'RENTED'; + $storeValue['business_approximate_market_value'] = 'NA'; + $storeValue['rent_amount'] = $fetchVal['business_monthly_rented_amt']; + $storeValue['about_business_assets'] = $fetchVal['business_details'][0]['manufacturer_model_vehicle']; + //.' rented at Rs.'.$fetchVal['business_monthly_rented_amt']; + break; case 'OWNED': //print_r($fetchVal['business_name_of_the_owner']);die(); + $storeValue['ownership'] = 'OWNED'; + $storeValue['rent_amount'] = 'NA'; + $storeValue['business_assets_mode_master'] = $fetchVal['business_assets_mode_master']; $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]['manufacturer_model_vehicle'].' purchased in '. $fetchVal['business_purchase_year']; + $storeValue['about_business_assets'] = $fetchVal['business_details'][0]['manufacturer_model_vehicle']; + //.' purchased in '. $fetchVal['business_purchase_year']; $storeValue['business_approximate_market_value'] = 'Rs.'.$fetchVal['business_approximate_market_value']; break; default: @@ -154,13 +174,22 @@ public static function getBusinessAssetsDetails($values){ else if($fetchVal['business_assets_mode']==2){ switch(strtoupper($fetchVal['business_ownership_type'])) { case 'RENTED': - $storeValue['business_name_of_the_owner'] = ''; - $storeValue['about_business_assets'] = $fetchVal['business_details'][0]['property_type']==1 ? $fetchVal['business_details'][0]['other_property_type'].' rented at Rs.'. $fetchVal['business_monthly_rented_amt'] : $fetchVal['business_details'][0]['property_type'].' rented at Rs.'. $fetchVal['business_monthly_rented_amt']; - $storeValue['business_approximate_market_value'] = ''; + $storeValue['business_assets_mode_master'] = $fetchVal['business_assets_mode_master']; + $storeValue['ownership'] = 'RENTED'; + $storeValue['business_approximate_market_value'] = 'NA'; + $storeValue['rent_amount'] = $fetchVal['business_monthly_rented_amt']; + $storeValue['about_business_assets'] = $fetchVal['business_details'][0]['property_type']==1 ? $fetchVal['business_details'][0]['other_property_type']:$fetchVal['business_details'][0]['property_type_master']; + //.' rented at Rs.'. $fetchVal['business_monthly_rented_amt'] : $fetchVal['business_details'][0]['property_type'].' rented at Rs.'. $fetchVal['business_monthly_rented_amt']; + break; case 'OWNED': + $storeValue['ownership'] = 'OWNED'; + $storeValue['rent_amount'] = 'NA'; + $storeValue['business_assets_mode_master'] = $fetchVal['business_assets_mode_master']; $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]['property_type']==1 ? $fetchVal['business_details'][0]['other_property_type'].' purchased in '. $fetchVal['business_purchase_year'] : $fetchVal['business_details'][0]['property_type'].' purchased in '. $fetchVal['business_purchase_year']; + + $storeValue['about_business_assets'] = $fetchVal['business_details'][0]['property_type']==1 ? $fetchVal['business_details'][0]['other_property_type']:$fetchVal['business_details'][0]['property_type_master']; + //.' purchased in '. $fetchVal['business_purchase_year'] : $fetchVal['business_details'][0]['property_type'].' purchased in '. $fetchVal['business_purchase_year']; $storeValue['business_approximate_market_value'] = 'Rs.'.$fetchVal['business_approximate_market_value']; break; default: @@ -173,13 +202,22 @@ public static function getBusinessAssetsDetails($values){ else if($fetchVal['business_assets_mode']==1){ switch(strtoupper($fetchVal['business_ownership_type'])) { case 'RENTED': - $storeValue['business_name_of_the_owner'] = ''; - $storeValue['about_business_assets'] = $fetchVal['business_details'][0]['any_other_assets'].' rented at Rs.'. $fetchVal['business_monthly_rented_amt']; - $storeValue['business_approximate_market_value'] = 'Rs.'.$fetchVal['business_details'][0]['any_other_asset_value']; + $storeValue['business_assets_mode_master'] = $fetchVal['business_assets_mode_master']; + $storeValue['ownership'] = 'RENTED'; + $storeValue['business_approximate_market_value'] = 'NA'; + $storeValue['business_name_of_the_owner'] = ''; + $storeValue['rent_amount'] = $fetchVal['business_monthly_rented_amt']; + $storeValue['about_business_assets'] = $fetchVal['business_details'][0]['any_other_assets']; + //.' rented at Rs.'. $fetchVal['business_monthly_rented_amt']; + break; case 'OWNED': + $storeValue['ownership'] = 'OWNED'; + $storeValue['business_assets_mode_master'] = $fetchVal['business_assets_mode_master']; + $storeValue['rent_amount'] = 'NA'; $storeValue['business_name_of_the_owner'] = $fetchVal['business_name_of_the_owner']['id']==0 ? $fetchVal['business_name_of_the_other_owner'] : $fetchVal['business_name_of_the_owner']['name']; - $storeValue['about_business_assets'] = $fetchVal['business_details'][0]['any_other_assets'].' purchased in '. $fetchVal['business_purchase_year'].' at Rs.'.$fetchVal['business_details'][0]['any_other_asset_value']; + $storeValue['about_business_assets'] = $fetchVal['business_details'][0]['any_other_assets']; + //.' purchased in '. $fetchVal['business_purchase_year'].' at Rs.'.$fetchVal['business_details'][0]['any_other_asset_value']; $storeValue['business_approximate_market_value'] = 'Rs.'.$fetchVal['business_approximate_market_value']; break; default: @@ -187,6 +225,7 @@ public static function getBusinessAssetsDetails($values){ $storeValue['about_business_assets'] = ''; $storeValue['business_approximate_market_value'] = ''; } + } } array_push($mergeResult,$storeValue); diff --git a/api/application/helpers/bankingform_helper.php b/api/application/helpers/bankingform_helper.php index 0f8377b8..97f394e4 100644 --- a/api/application/helpers/bankingform_helper.php +++ b/api/application/helpers/bankingform_helper.php @@ -4,19 +4,20 @@ class Bankingform { //get business Banking public static function getBusinessBankingDetails($values){ - if(count($values)>0){ + // print_r($values);die(); + if(count($values)>0){ $values = array_map(function($tag) { $count_vintage = $tag['vintage_year'] >0 ? $tag['vintage_year'] :""; $count_vintage .= ($tag['vintage_year'] == 1) ? " Year" : (($tag['vintage_year'] > 1) ? " Years" : ""); $count_vintage.=' '; - $count_vintage .=$tag['vintage_month'] >0 ? $tag['vintage_month'] : ""; + $count_vintage .=$tag['vintage_month'] >0 ? ' and ' . $tag['vintage_month'] : ""; $count_vintage .=($tag['vintage_month'] == 1) ? " Month" : (($tag['vintage_month'] > 1) ? " Months" : ""); return array( 'account_name' => $tag['applicant_name']['id']==0 ? $tag['other_applicant'] : $tag['applicant_name']['name'], - 'bank_name' => $tag['bank_name'] ==1 ? $tag['other_bank'] : $tag['bank_name'], - 'account_type' => $tag['account_type'], + 'bank_name' => $tag['bank_name'] ==1 ? $tag['other_bank'] : $tag['bank_name_master'], + 'account_type' => $tag['account_type_master'], 'main_business' => $tag['salary'], - 'od_cc_limit' => ($tag['account_type']==3) ? $tag['limit'] : (($tag['account_type']==4) ? $tag['limit'] : ''), + 'od_cc_limit' => ($tag['account_type']==3) ? $tag['limit'] : (($tag['account_type']==4) ? $tag['limit'] : 'NA'), 'vintage' => $count_vintage, ); }, $values); diff --git a/api/application/helpers/businessform_helper.php b/api/application/helpers/businessform_helper.php index 8e395150..56340ef4 100644 --- a/api/application/helpers/businessform_helper.php +++ b/api/application/helpers/businessform_helper.php @@ -8,13 +8,14 @@ public static function getPartnerDetails($values){ foreach($values as $parRow){ $getPartner = array_map(function($tag) { $con_business_run = $tag['current_business_experiance_year'] >0 ? $tag['current_business_experiance_year'] :""; - $con_business_run .= ($tag['current_business_experiance_year'] == 1) ? "Year" : (($tag['current_business_experiance_year'] > 1) ? "Years" : ""); + $con_business_run .= ($tag['current_business_experiance_year'] == 1) ? " Year" : (($tag['current_business_experiance_year'] > 1) ? " Years" : ""); $con_business_run.=' '; - $con_business_run .=$tag['current_business_experiance_month'] >0 ? $tag['current_business_experiance_month'] : ""; - $con_business_run .=($tag['current_business_experiance_month'] == 1) ? "Month" : (($tag['current_business_experiance_month'] > 1) ? "Months" : ""); + $con_business_run .=$tag['current_business_experiance_month'] >0 ? 'and ' . $tag['current_business_experiance_month'] : ""; + $con_business_run .=($tag['current_business_experiance_month'] == 1) ? " Month" : (($tag['current_business_experiance_month'] > 1) ? " Months" : ""); return array( 'name' => array_key_exists('partner_other_name',$tag) ? $tag['partner_other_name'] : $tag['partner_name_master'], 'share_holding' => $tag['shareholding'].'%', + 'started_business' => $tag['started_business'] ? $tag['started_business'] : 'No', 'no_years_business' => $con_business_run, 'total_experience' => $tag['total_business_experiance'], 'previous_experience' => array_key_exists('total_business_previous_experience',$tag) ? $tag['total_business_previous_experience'] : 'NIL', @@ -32,8 +33,9 @@ public static function getFamilyMemberDetails($values){ $getFamilyMembers = array_map(function($tag) { return array( 'name' => $tag['family_member_salutation_master'].' '.$tag['family_member_name'], - 'relation' => $tag['other_family_relationship_id_master'] .' of '.$tag['relation_to_id_master'], - 'designation' => $tag['relationship_with_company_id_master'], + 'individual_relation' => $tag['other_family_relationship_id_master'] .' of ', + 'relation_to' => $tag['relation_to_id_master'], + 'relation_to_company' => substr($tag['relationship_with_company_id_master'],0,-2), 'started_business' => $tag['started_business'], ); @@ -48,6 +50,7 @@ public static function getActivityDetails($values,$type){ foreach($values as $busManuRowkey=>$busManuRow){ $getEachProducts=array(); $getEachProducts['products']=$busManuRow['main_products']; + $getEachProducts['description']=$busManuRow['description']; $getEachProducts['area_of_sale']=$busManuRow['area_of_sale']; // check area of sales @@ -207,6 +210,7 @@ public static function getActivityDetails($values,$type){ foreach($values as $busManuRowkey=>$busManuRow){ $getEachProducts=array(); $getEachProducts['products']=$busManuRow['main_products']; + $getEachProducts['description']=$busManuRow['description']; $getEachProducts['area_of_sale']=$busManuRow['area_of_sale']; // check area of sales @@ -366,6 +370,7 @@ public static function getActivityDetails($values,$type){ foreach($values as $busManuRowkey=>$busManuRow){ $getEachProducts=array(); $getEachProducts['products']=$busManuRow['others_details']; + $getEachProducts['description']=$busManuRow['description']; array_push($getRow,$getEachProducts); } diff --git a/api/application/helpers/financialform_helper.php b/api/application/helpers/financialform_helper.php index 4189a54d..2160279e 100644 --- a/api/application/helpers/financialform_helper.php +++ b/api/application/helpers/financialform_helper.php @@ -51,15 +51,17 @@ public static function getOtherLoanDetails($values){ // business financial details public static function getBusinessFinancialDetails($values){ $values = array_map(function($tag) { - return array( + + return array( 'financial_year' => $tag['financial_year'], - 'financial_annual_sale' => 'Rs.'.$tag['financial_annual_sale'], + 'financial_sales_revenue' => 'Rs.'.$tag['financial_annual_sale'], + 'financial_net_profit_mode' => $tag['finanical_profit_or_loss']==1 ? 1 : 0, 'financial_net_profit' => $tag['finanical_profit_or_loss']==1 ? 'Rs.'.$tag['financial_net_profit'] : '', + 'financial_net_loss' => $tag['finanical_profit_or_loss']!=1 ? 'Rs.'.$tag['financial_net_loss'] : '', 'financial_margin_of_profit' => $tag['finanical_profit_or_loss']==1 ? $tag['financial_margin_of_profit'] : '', - 'financial_net_loss' => $tag['finanical_profit_or_loss']!=1 ? 'Rs.'.$tag['financial_net_loss'] : '', 'financial_margin_of_loss' => $tag['finanical_profit_or_loss']!=1 ? $tag['financial_margin_of_loss'] : '', 'profit_variation' => $tag['financial_variation'], - 'sale_variation' => $tag['financial_profit_to_sale_variation'], + 'sale_variation' => $tag['financial_annualsales_variation'],'financial_profit_to_sale_variation' => $tag['financial_profit_to_sale_variation'] ); }, $values); return $values; @@ -70,26 +72,54 @@ public static function getBusinessCustomerFinancialDetails($values) { if($tag['estimate_profit_or_loss']==1){ return array( 'estimate_profit_or_loss' => $tag['estimate_profit_or_loss'], - 'estimate_sales_average' => 'Rs.'.$tag['estimate_sales_average'], - 'estimate_sales_from_to' => '(Rs.'.$tag['estimate_sales_from'].', Rs.'.$tag['estimate_sales_to'].')', - 'estimate_sales_to' => 'Rs.'.$tag['estimate_sales_to'], + 'estimate_sales_average' => $tag['estimate_sales_average'], + 'estimate_sales_from' => $tag['estimate_sales_from'], + 'estimate_sales_to' => $tag['estimate_sales_to'], 'estimate_net_margin_availablity' => $tag['estimate_net_margin_availablity'], - 'estimate_net_margin' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? 'Rs.'.$tag['estimate_profit_margin'] : 'Rs.'.$tag['estimate_net_profit'], - 'estimate_net_margin_from_to' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? '(Rs.'.$tag['estimate_net_profit_from'].', Rs.'.$tag['estimate_net_profit_to'].')' : '', - 'estimate_net_margin_range' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? $tag['estimate_net_profit_percent'] : $tag['estimate_profit_margin_percent'], - 'estimate_net_margin_range_from_to' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? '' : '( '.$tag['estimate_profit_range_from'].', '.$tag['estimate_profit_range_to'].')', + + //'estimate_net_margin' => strtoupper($tag['estimate_net_margin_availablity'])=='YES' ?$tag['estimate_profit_margin'] : $tag['estimate_net_profit'], + + 'net_profit_loss_sales_per_from' => strtoupper($tag['estimate_net_margin_availablity'])=='YES' ? $tag['estimate_profit_range_from']: $tag['estimate_net_profit_from'], + + 'net_profit_loss_sales_per_to' => strtoupper($tag['estimate_net_margin_availablity'])=='YES' ? $tag['estimate_profit_range_to']: $tag['estimate_net_profit_to'], + + 'net_profit_loss_sales_final_per' => strtoupper($tag['estimate_net_margin_availablity'])=='YES' ? $tag['estimate_profit_margin_percent']:$tag['estimate_profit_margin'], //$tag['estimate_net_profit_percent'], + + 'net_profit_loss_sales_final_rs' => strtoupper($tag['estimate_net_margin_availablity'])=='YES' ? $tag['estimate_profit_margin']: $tag['estimate_profit_margin_percent'],//$tag['estimate_net_profit'], + + + + //'estimate_net_margin_from' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? $tag['estimate_net_profit_from']: '', + + //'estimate_net_margin_to' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? $tag['estimate_net_profit_to']:'', + + //'estimate_net_margin_range' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? $tag['estimate_net_profit_percent'] : $tag['estimate_profit_margin_percent'], + + //'estimate_net_margin_range_from' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? '' : $tag['estimate_profit_range_from'], + + // 'estimate_net_margin_range_to' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? '' : '( '.$tag['estimate_profit_range_from'].', '.$tag['estimate_profit_range_to'].')', ); } else if($tag['estimate_profit_or_loss']==2){ return array( 'estimate_profit_or_loss' => $tag['estimate_profit_or_loss'], 'estimate_sales_average' => 'Rs.'.$tag['estimate_sales_average'], - 'estimate_sales_from_to' => '(Rs.'.$tag['estimate_sales_from'].', Rs.'.$tag['estimate_sales_to'].')', + 'estimate_sales_from' =>$tag['estimate_sales_from'], + 'estimate_sales_to' => $tag['estimate_sales_to'], 'estimate_net_margin_availablity' => $tag['estimate_net_margin_availablity'], - 'estimate_net_margin' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? 'Rs.'.$tag['estimate_net_loss'] : 'Rs.'.$tag['estimate_loss_margin'], - 'estimate_net_margin_from_to' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? '(Rs.'.$tag['estimate_net_loss_from'].', Rs.'.$tag['estimate_net_loss_to'].')' : '', - 'estimate_net_margin_range' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? $tag['estimate_net_loss_percent'] : $tag['estimate_loss_margin_percent'], - 'estimate_net_margin_range_from_to' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? '' : '('.$tag['estimate_loss_range_from'].', '.$tag['estimate_loss_range_to'].')', + + 'net_profit_loss_sales_per_from' => strtoupper($tag['estimate_net_margin_availablity'])=='YES' ? $tag['estimate_loss_range_from']: $tag['estimate_net_profit_from'], + + 'net_profit_loss_sales_per_to' => strtoupper($tag['estimate_net_margin_availablity'])=='YES' ? $tag['estimate_loss_range_to']: $tag['estimate_net_loss_to'], + + 'net_profit_loss_sales_final_per' => strtoupper($tag['estimate_net_margin_availablity'])=='YES' ? $tag['estimate_loss_margin_percent']: $tag['estimate_loss_margin'],//$tag['estimate_net_loss_percent'], + + 'net_profit_loss_sales_final_rs' => strtoupper($tag['estimate_net_margin_availablity'])=='YES' ? $tag['estimate_loss_margin']: $tag['estimate_loss_margin_percent']//$tag['estimate_net_loss'], + + //'estimate_net_margin' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? 'Rs.'.$tag['estimate_net_loss'] : 'Rs.'.$tag['estimate_loss_margin'], + //'estimate_net_margin_from_to' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? '(Rs.'.$tag['estimate_net_loss_from'].', Rs.'.$tag['estimate_net_loss_to'].')' : '', + //'estimate_net_margin_range' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? $tag['estimate_net_loss_percent'] : $tag['estimate_loss_margin_percent'], + //'estimate_net_margin_range_from_to' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? '' : '('.$tag['estimate_loss_range_from'].', '.$tag['estimate_loss_range_to'].')', ); } @@ -109,5 +139,16 @@ public static function getBusinessCustomerHeader($values){ return array(); } } + +public static function getAvailableFacilities($array) +{ + $word_array = array('1' => 'Others', '2' => 'Bank Guarantee', '3' => 'Cash Credit Limit','4' => 'Factoring', '5' => 'Forfaiting', '6' => 'Letter of Credit'); + if(is_array($array)) + { + //$array = array_map(function($arr){ },$array); + } + return $array; +} + } ?> \ No newline at end of file diff --git a/api/application/helpers/getprocessedjson_helper.php b/api/application/helpers/getprocessedjson_helper.php index d29ae92d..731242a8 100644 --- a/api/application/helpers/getprocessedjson_helper.php +++ b/api/application/helpers/getprocessedjson_helper.php @@ -1960,6 +1960,67 @@ class GETPROCESSEDJSON } } + + if(array_key_exists('state',$address)) + { + //print_r($address); + $CI->db->SELECT( $master_tables_field_names['STATE'] ); + $CI->db->FROM(STATE); + $CI->db->WHERE('isactive',1); + $CI->db->WHERE($master_tables_pkid['STATE'] ,$address['state']); + $adress_type_name= $CI->db->GET()->result_array(); + //print_r($CI->db->last_query()); + if(count($adress_type_name)) + { + $raw_json['addresses'][$raw_json_key]['state_master'] = $adress_type_name[0][$master_tables_field_names['STATE']]; + } + } + + if(array_key_exists('city',$address)) + { + //print_r($address); + $CI->db->SELECT( $master_tables_field_names['CITY'] ); + $CI->db->FROM(CITY); + $CI->db->WHERE('isactive',1); + $CI->db->WHERE($master_tables_pkid['CITY'] ,$address['city']); + $city= $CI->db->GET()->result_array(); + //print_r($CI->db->last_query()); + if(count($city)) + { + $raw_json['addresses'][$raw_json_key]['city_master'] = $city[0][$master_tables_field_names['CITY']]; + } + } + + if(array_key_exists('pincode',$address)) + { + //print_r($address); + $CI->db->SELECT( $master_tables_field_names['PINCODE'] ); + $CI->db->FROM(PINCODE); + $CI->db->WHERE('isactive',1); + $CI->db->WHERE($master_tables_pkid['PINCODE'] ,$address['pincode']); + $pincode= $CI->db->GET()->result_array(); + //print_r($CI->db->last_query()); + if(count($pincode)) + { + $raw_json['addresses'][$raw_json_key]['pincode_master'] = $pincode[0][$master_tables_field_names['PINCODE']]; + } + } + + if(array_key_exists('uom',$address)) + { + //print_r($address); + $CI->db->SELECT( $master_tables_field_names['UOM'] ); + $CI->db->FROM(UOM); + $CI->db->WHERE('isactive',1); + $CI->db->WHERE($master_tables_pkid['UOM'] ,$address['uom']); + $uom= $CI->db->GET()->result_array(); + //print_r($CI->db->last_query()); + if(count($uom)) + { + $raw_json['addresses'][$raw_json_key]['uom_master'] = $uom[0][$master_tables_field_names['UOM']]; + } + } + } return ($raw_json); diff --git a/api/application/helpers/myutil_helper.php b/api/application/helpers/myutil_helper.php index 2149bcbc..c389bdc7 100644 --- a/api/application/helpers/myutil_helper.php +++ b/api/application/helpers/myutil_helper.php @@ -15,7 +15,7 @@ class MYUTIL $digits_1 = strlen($no); $i = 0; $str = array(); - $words = array('0' => '', '1' => 'One', '2' => 'Two', + $words = array('0' => 'zero', '1' => 'One', '2' => 'Two', '3' => 'Three', '4' => 'Four', '5' => 'Five', '6' => 'Six', '7' => 'Seven', '8' => 'Eight', '9' => 'Nine', '10' => 'Ten', '11' => 'Eleven', '12' => 'Twelve', @@ -47,12 +47,12 @@ class MYUTIL $points = ($point) ? "." . $words[$point / 10] . " " . $words[$point = $point % 10] : ''; - $res = $result . "Rupees " ; + $res = $result; if($points != "") { $res.=$points . " Paise"; } - return $res; + return $result.' Only'; } @@ -78,18 +78,47 @@ class MYUTIL // die(); if($companyid == $value['company_order_id']) { - $getSentense = $value['company_name']; - $getSentense .=' is a '; - $getSentense .=$value['business_entity_type']==1 ? $value['business_entity_type_other'] : $value['business_entity_type_master']; - $getSentense .=' formed on '; + $data['company_name'] = $value['company_name']; + //$getSentense .=' is a '; + $data['type_of_activity'] = $value['business_entity_type']==1 ? $value['business_entity_type_other'] : $value['business_entity_type_master']; + //$getSentense .=' formed on '; + //echo $data['type_of_activity']; + switch($value['business_entity_type']) + { + case 1: + case 6: + case 9: + $data['partners_title_name'] = "Member Details"; + break; + case 2: + $data['partners_title_name'] = "Director / Shareholder Details"; + break; + case 3: + //echo '3'; + $data['partners_title_name'] = "Proprietor Details"; + break; + case 4: + $data['partners_title_name'] = "Karta Details"; + break; + case 5: + case 7: + $data['partners_title_name'] = "Partner Details"; + break; + case 8: + case 11: + $data['partners_title_name'] = "Director Details"; + break; + + case 10: + $data['partners_title_name'] = "Trustee Details"; + break; + } + $data['year_and_month']= $value['business_years'] . ' Years'; + $data['year_and_month'] .= isset($value['business_month']) ? ' and '.$value['business_month'] . ' Months': ''; - $year_and_month = $value['business_years'] . ' Years'; - $year_and_month .= isset($value['business_month']) ? $value['business_month'] . ' months ago': ' ago'; - $getSentense .=$value['business_date_object'] ? date("d-m-Y", strtotime($value['business_date_object'])) : $year_and_month; + $data['formed_on'] = $value['business_date_object'] ? date("d-m-Y", strtotime($value['business_date_object'])) : null; - - $getSentense .='.'; - return $getSentense; + return $data; //return $value['company_name'].' is a '.$value['business_entity_type']==1 ? $value['business_entity_type_other'] : $value['business_entity_type_master'] .' formed on '.date("d-m-Y", strtotime($value['business_date_object'])); } } diff --git a/api/application/helpers/pdalerts_helper.php b/api/application/helpers/pdalerts_helper.php index 44481c7d..90dc2e9c 100644 --- a/api/application/helpers/pdalerts_helper.php +++ b/api/application/helpers/pdalerts_helper.php @@ -307,7 +307,7 @@ class PDALERTS $logger->error("Mailer Error:" ,array($mail->ErrorInfo)); } else { - $logger->info("Mailer Send:" ,array('mail ID' => $lender_email,'Status' => 'SEND')); + $logger->info("Mailer Send:" ,array('mail_ID' => $lender_email,'Status' => 'SEND')); } } diff --git a/api/application/helpers/stockform_helper.php b/api/application/helpers/stockform_helper.php index 0d8e2d0f..f88cd289 100644 --- a/api/application/helpers/stockform_helper.php +++ b/api/application/helpers/stockform_helper.php @@ -18,7 +18,7 @@ public static function getStockManufacturingDetails($rawMaterial,$goods){ 'name' => $tag['raw_name'], 'quantity' => strtoupper($tag['stock_observed'])=='YES' ? $tag['raw_quantity'] : '', 'uom' => strtoupper($tag['stock_observed'])=='YES' ? $getUom : '', - 'value' => strtoupper($tag['stock_observed'])=='YES' ? 'Rs.'.$tag['raw_value'] : '', + 'value' => strtoupper($tag['stock_observed'])=='YES' ? $tag['raw_value'] : '', ); }, $rawMaterial); @@ -33,7 +33,7 @@ public static function getStockManufacturingDetails($rawMaterial,$goods){ 'name' => $tag['goods_name'], 'quantity' => strtoupper($tag['goods_observed'])=='YES' ? $tag['goods_quantity'] : '', 'uom' => strtoupper($tag['goods_observed'])=='YES' ? $getGUom : '', - 'value' => strtoupper($tag['goods_observed'])=='YES' ? 'Rs.'.$tag['goods_value'] : '', + 'value' => strtoupper($tag['goods_observed'])=='YES' ? $tag['goods_value'] : '', ); }, $goods); @@ -52,7 +52,7 @@ public static function getStockRetailDetails($goods){ 'name' => $tag['traded_goods_name'], 'quantity' => strtoupper($tag['traded_goods_observed'])=='YES' ? $tag['traded_goods_quantity'] : '', 'uom' => strtoupper($tag['traded_goods_observed'])=='YES' ? $getUom : '', - 'value' => strtoupper($tag['traded_goods_observed'])=='YES' ? 'Rs.'.$tag['estimated_traded_goods_value'] : '', + 'value' => strtoupper($tag['traded_goods_observed'])=='YES' ? $tag['estimated_traded_goods_value'] : '', 'is_sufficiant' => (strtoupper($tag['traded_goods_observed'])=='YES') ? $getSufficient : ((strtoupper($tag['traded_goods_observed'])=='NO') ? $getSufficient : ''), ); }, $goods); @@ -71,7 +71,7 @@ public static function getStockWholesaleDetails($goods){ 'name' => $tag['traded_goods_name'], 'quantity' => strtoupper($tag['traded_goods_observed'])=='YES' ? $tag['traded_goods_quantity'] : '', 'uom' => strtoupper($tag['traded_goods_observed'])=='YES' ? $getUom : '', - 'value' => strtoupper($tag['traded_goods_observed'])=='YES' ? 'Rs.'.$tag['estimated_traded_goods_value'] : '', + 'value' => strtoupper($tag['traded_goods_observed'])=='YES' ? $tag['estimated_traded_goods_value'] : '', 'is_sufficiant' => (strtoupper($tag['traded_goods_observed'])=='YES') ? $getSufficient : ((strtoupper($tag['traded_goods_observed'])=='NO') ? $getSufficient : ''), ); }, $goods); diff --git a/api/application/libraries/Pdfgenerator.php b/api/application/libraries/Pdfgenerator.php index e187227d..ae780981 100644 --- a/api/application/libraries/Pdfgenerator.php +++ b/api/application/libraries/Pdfgenerator.php @@ -21,7 +21,7 @@ class Pdfgenerator public function generate($html, $filename='', $stream=TRUE, $paper = 'A4', $orientation = "portrait") { // echo 'stream'.$html.'tttt'; - $dompdf = new Dompdf(array('enable_remote' => true,'DOMPDF_ENABLE_PHP'=>true)); + $dompdf = new Dompdf(array('enable_remote' => true,'DOMPDF_ENABLE_PHP'=>true,'DOMPDF_UNICODE_ENABLED' => true)); $dompdf->load_html($html); $dompdf->set_paper($paper, $orientation); diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index 98e8f677..2df789cf 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -744,7 +744,7 @@ class PD_Model extends SPARQ_Model { */ public function getPDMasterDetails($pdid) { - $this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name, PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name,PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation,DATE_FORMAT(PDTRIGGER.pd_report_generated_date,"%d/%m/%Y") as pd_report_generated_date,PDTRIGGER.pd_date_of_initiation as pd_date_of_initiation_sqlformat, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i %p") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i %p") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,PDTRIGGER.scheduled_on as scheduled_on_for_validation,DATE_FORMAT(PDTRIGGER.scheduled_on,"%dth %b %Y ") as scheduled_date_for_log,DATE_FORMAT(PDTRIGGER.scheduled_on,"%h:%i %p") as scheduled_time_for_log,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.bounce_reason,PDTRIGGER.bounce_reason_others,BOUNCEMASTER.bounce_reason_name,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDAPPLICANTSDETAILS.applicant_name as main_applicant,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDAPPLICANTSDETAILS.applicant_title_name,TITLES.name as title_name,PDTRIGGER.pd_contact_landline,PDTRIGGER.other_pincode,PDTRIGGER.is_otp_done,PDTRIGGER.encrypted_url,PDTRIGGER.is_child,PDTRIGGER.parent_pd_id,PDTRIGGER.fk_primary_address_id,PDTRIGGER.fk_address_id'); + $this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name, PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name,PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation,DATE_FORMAT(PDTRIGGER.pd_report_generated_date,"%d/%m/%Y") as pd_report_generated_date,PDTRIGGER.pd_date_of_initiation as pd_date_of_initiation_sqlformat, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i %p") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i %p") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,PDTRIGGER.scheduled_on as scheduled_on_for_validation,DATE_FORMAT(PDTRIGGER.scheduled_on,"%dth %b %Y ") as scheduled_date_for_log,DATE_FORMAT(PDTRIGGER.scheduled_on,"%h:%i %p") as scheduled_time_for_log,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.bounce_reason,PDTRIGGER.bounce_reason_others,BOUNCEMASTER.bounce_reason_name,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDAPPLICANTSDETAILS.applicant_name as main_applicant,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDAPPLICANTSDETAILS.applicant_title_name,TITLES.name as title_name,PDTRIGGER.pd_contact_landline,PDTRIGGER.other_pincode,PDTRIGGER.is_otp_done,PDTRIGGER.encrypted_url,PDTRIGGER.is_child,PDTRIGGER.parent_pd_id,PDTRIGGER.fk_primary_address_id,PDTRIGGER.fk_address_id,PDTRIGGER.start_location'); $this->db->FROM(PDTRIGGER.' as PDTRIGGER'); $this->db->JOIN(ENTITY.' as ENTITY','PDTRIGGER.fk_lender_id = ENTITY.entity_id ','LEFT'); $this->db->JOIN(ENTITYBILLING.' as ENTITYBILLING','PDTRIGGER.fk_entity_billing_id = ENTITYBILLING.entity_billing_id','LEFT'); diff --git a/api/application/views/report_templates/JSONTOREPORT.php b/api/application/views/report_templates/JSONTOREPORT.php index 48502137..f9c7c467 100644 --- a/api/application/views/report_templates/JSONTOREPORT.php +++ b/api/application/views/report_templates/JSONTOREPORT.php @@ -4,7 +4,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); ?>
- +Location Details :
+PD LOCATION
PD Location Address : '.$pd_address['address'].' ,'.$pd_address['city_master'].' ,'.$pd_address['state_master'].' - '.$pincode;
+ echo '
GPS Coordinates of location where PD Visit was done : '.$pd_master_details[0]['start_location'];
+ ?>
- foreach($address_form['addresses'] as $address_key => $address)
- {
-
-
- $address_key == 0? $paragraph_starting_text = "The applicants were met at their ": $paragraph_starting_text = "The applicants were also met at their ";
-
- $address_type = $address['address_type_others'] != "" ? $address['address_type_others'] : $address['address_type_master'];
-
- $locality_type = $address['locality_others'] != "" ? $address['locality_others'] : $address['locality_master'];
-
-
- echo $paragraph_starting_text.$address_type." at ".$address['address'].". The PD location is situated in an area that can be classified as ".$locality_type.", and the approach was ".$address['pd_location_master'].". The locality was ".$address['comment_locality_master'].".
";
-
-
- }
+
- if( $address_form['address_form_remark'] != "")
+
+
+
+
Location Summary
+PD Officer's Note (About Location Details) :
Business Activity was seen during visit."; } + else{ + echo "Loan Details :
- A loan for Rs ".MYUTIL::customIndianNumberFormat($loan_form['loan_amount'])." (".MYUTIL::numtowords($loan_form['loan_amount']).") has been applied by the applicant for ".$loan_form['end_use_master'][0]."."; - if($loan_form['is_transfer'] == 'yes') - { - echo "There is a balance transfer of Rs. ".MYUTIL::customIndianNumberFormat($loan_form['balance_transfer_amount'])." (".MYUTIL::numtowords($loan_form['balance_transfer_amount']).")from ".$loan_form['lender_master'].",and the balance top up of Rs.".$loan_form['topup_amount']." is to be used for ".$loan_form['end_use_topup_master'].". The applicants are comfortable to pay an EMI of Rs.".MYUTIL::customIndianNumberFormat($loan_form['emi_level'])." per month."; - } - else +LOAN DETAILS:
+ 'Total Loan Amount applied for','details' => "₹".$loan_amount.'('."₹".MYUTIL::numtowords($loan_form['loan_amount']).')'); + + $loan_table_dispaly_rows[] = array('particulars' => 'Loan Tenure expected','details' => $loan_form['loan_tenure'].' Months'); + + $end_use = 'For '; + foreach($loan_form['end_use_master'] as $enduse) { - $own_contribution_string = ""; - if(count($loan_form['source_of_own_contribution_master'])) - { - $own_contribution_string = implode(" , ",$loan_form['source_of_own_contribution_master']); - } - // echo $own_contribution_string; - // echo "#################".strripos($own_contribution_string,','); - if($loan_form['other_source'] != "") - { - $own_contribution_string = substr_replace($own_contribution_string,"and",strripos($own_contribution_string,','),1); - } - echo "The amount of Rs.".MYUTIL::customIndianNumberFormat($loan_form['own_contribution'])." as own contribution from ".$own_contribution_string.". The applicants are comfortable to pay an EMI of Rs.".MYUTIL::customIndianNumberFormat($loan_form['emi_level'])." per month."; + if(strpos(strval($enduse), 'Others') === false) { $end_use.= $enduse.' and ';}else{ $end_use.=$loan_form['end_use_other'].' and'; } } + $end_use = substr_replace($end_use, '', strrpos($end_use, 'and'),strlen($end_use)); + $loan_table_dispaly_rows[] = array('particulars' => 'Loan Purpose','details' => $end_use); - //print_r($loan_form['owners_list_master']); - $owners_list = ""; - if(count($loan_form['owners_list_master'])) + if(strcasecmp($loan_form['is_transfer'],'no')) { - foreach($loan_form['owners_list_master'] as $owner) - { - $owners_list .= $owner." , "; - } - $owners_list = substr($owners_list,0,(strlen($owners_list)-2)); + + $loan_table_dispaly_rows[] = array('particulars' => 'Balance Transfer Amount','details' => "₹".MYUTIL::customIndianNumberFormat($loan_form['balance_transfer_amount']).'('."₹".MYUTIL::numtowords($loan_form['balance_transfer_amount']).')'); + + $loan_table_dispaly_rows[] = array('particulars' => 'Top Up Amount applied for','details' => "₹".MYUTIL::customIndianNumberFormat($loan_form['topup_amount']).'('."₹".MYUTIL::numtowords($loan_form['topup_amount']).')'); + + $loan_table_dispaly_rows[] = array('particulars' => 'Balance Transfer from','details' => $loan_form['lender_master']); + + } + else{ + + $loan_table_dispaly_rows[] = array('particulars' => 'Amount of Own Contribution','details' =>"₹".MYUTIL::customIndianNumberFormat($loan_form['own_contribution']).'('."₹".MYUTIL::numtowords($loan_form['own_contribution']).')' ); + $source_of_own_contribution = null; + + foreach($loan_form['source_of_own_contribution_master'] as $own_source) + { + if(strpos(strval($own_source), 'Others') === false) { $source_of_own_contribution.= $own_source.' and ';}else{ $source_of_own_contribution.=$loan_form['other_source'].' and'; } + } + $source_of_own_contribution = substr_replace($source_of_own_contribution, '', strrpos($source_of_own_contribution, 'and'),strlen($source_of_own_contribution)); + + $loan_table_dispaly_rows[] = array('particulars' => 'Source of Own Contribution','details' => $source_of_own_contribution); } - //echo "#################".strripos($owners_list,','); - $owners_list = count($loan_form['owners_list_master']) > 1 ? substr_replace($owners_list," and ",strripos($owners_list,','),1) : $owners_list ; - echo "The property being mortgaged is a ".$loan_form['property_type_master']." owned by ".$owners_list.", and is ".$loan_form['construction_status_master']." with an estimated market value of Rs ".number_format($loan_form['emv_per_customer'])."(".MYUTIL::numtowords($loan_form['emv_per_customer']).")"; + $loan_table_dispaly_rows[] = array('particulars' => 'EMI Comfortable Paying','details' => $rupee_symbol.MYUTIL::customIndianNumberFormat($loan_form['emi_level']).'('.$rupee_symbol.MYUTIL::numtowords($loan_form['emi_level']).')' ); - if($loan_form['loandetails_remarks'] != "" || $loan_form['loandetails_remarks'] != null) - { - ?> -PD Officer's Note (About Loan Details) :
'Type of Property Being Mortgaged','details' => $loan_form['property_type_master']); + + $owners_list = null;foreach($loan_form['owners_list_master'] as $owner){ $owners_list.=$owner.' and'; } + $owners_list = substr_replace($owners_list, '', strrpos($owners_list, 'and'),strlen($owners_list)); + $loan_table_dispaly_rows[] = array('particulars' => 'Name of the current / proposed owner(s) of the Property being Mortgaged','details' => $owners_list); + + $loan_table_dispaly_rows[] = array('particulars' => 'Status of Construction','details' => $loan_form['construction_status_master']); + + $loan_table_dispaly_rows[] = array('particulars' => 'Estimated Market Value of the property being mortgaged','details' => $rupee_symbol.MYUTIL::customIndianNumberFormat($loan_form['emv_per_customer']).'('.MYUTIL::numtowords($loan_form['emv_per_customer']).')'); + + //print_r($loan_table_dispaly_rows);die(); + ?> +| S.No | Loan Particulars | Loan Particular Details |
|---|---|---|
| '.($row_key + 1)." | ".$row['particulars']." | ".$row['details'] ." |
About Company :
The director details are as under :
+
Company / Firm Name:
+
Business Entity Type:
+
Date of Incorporation:
+
Business Vintage:
+
| No.of Years in Current Business | Total Work Experience | Previous Experience | +Started Business | @@ -561,6 +658,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');+ | @@ -568,16 +666,17 @@ defined('BASEPATH') OR exit('No direct script access allowed'); 0){ ?> | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Name | -Relation | -Designation | -Started Business | +Individual Relationship | +Related to | +Relationship to Company / Firm | +Started Business (Yes / No) |
|---|---|---|---|---|---|---|---|
| - | - | + | + | + |
| Products | -Area of Sale | -Sales Done | -Max Sales Done | +Key Products | +Area of Operations | +Area of Sale / Service | +Area where Max Sale / Service done |
|---|
Brief of the Business / Service Model
+| Product / Service | Process Brief |
|---|---|
The Retail Trading details are as under :
+Type of Business Activity : Retail Trading
| Products | -Area of Sale | -Sales Done | -Max Sales Done | +Key Products | +Area of Operations | +Area of Sale / Service | +Area where Max Sale / Service done |
|---|
Brief of the Business / Service Model
+| Product / Service | Process Brief |
|---|---|
The Service Provider details are as under :
+Type of Business Activity : Service Provider
| Services | -Area of Sale | -Services At | -Max Revenue From | +Area of Operations | +Area of Sale / Service | +Area where Max Sale / Service done |
|---|
Brief of the Business / Service Model
+| Product / Service | Process Brief |
|---|---|
The Wholesale Trading details are as under :
+Type of Business Activity : Wholesale Trading
| Products | -Area of Sale | -Sales Done | -Max Sales Done | +Key Products | +Area of Operations | +Area of Sale / Service | +Area where Max Sale / Service done |
|---|
Brief of the Business / Service Model
+| Product / Service | Process Brief |
|---|---|
| S.No | +Asset Type | +Asset Description | +Ownership | +Monthly Rent | +
|---|---|---|---|---|
| + | + | + | + | + |
Business asset is not available.
+ + + $baRow) { + $profit_loss_symbal = '↑ /↓'; + $baRow = $pd_processed_forms[14][$business_count]; $businessFinancialRow = json_decode($baRow['processed_json'],true); - // statement + //print_r($businessFinancialRow);die(); + // statementdate_per_financial if(strtoupper($businessFinancialRow['is_financial_statements'])=='YES' && count($businessFinancialRow['date_per_financial'])>0){ $bindBusinessFinancial["company_name"] =MYUTIL::findCompanyName($all_company_details,$businessFinancialRow['company_id'],1); - $bindBusinessFinancial["company_name"] .= count($businessFinancialRow['date_per_financial'])>1 ? ' provided with last '.count($businessFinancialRow['date_per_financial']).' years of financial statements and the snapshot is as below :' : ' we were provided with last '.count($businessFinancialRow['date_per_financial']).' year of financial statements and the snapshot is as below :'; + //$bindBusinessFinancial["company_name"] .= count($businessFinancialRow['date_per_financial'])>1 ? ' provided with last '.count($businessFinancialRow['date_per_financial']).' years of financial statements and the snapshot is as below :' : ' we were provided with last '.count($businessFinancialRow['date_per_financial']).' year of financial statements and the snapshot is as below :'; + $bindBusinessFinancial["years_data_provided"] = count($businessFinancialRow['date_per_financial']); $bindBusinessFinancial['statements']=FINANCIALFORM::getBusinessFinancialDetails($businessFinancialRow['date_per_financial']); } else { $bindBusinessFinancial["company_name"] =MYUTIL::findCompanyName($all_company_details,$businessFinancialRow['company_id'],1); - $bindBusinessFinancial["company_name"] .=' not provided the financial statements :'; + //$bindBusinessFinancial["company_name"] .=' not provided the financial statements :'; $bindBusinessFinancial['statements']=array(); } // customer - if(strtoupper($businessFinancialRow['is_financial_customer'])!='YES' && count($businessFinancialRow['estimated_value'])==0){ + if(strtoupper($businessFinancialRow['is_financial_customer'])!='YES' && (!isset($businessFinancialRow['estimated_value']))){ $bindBusinessFinancial["financial_customer"] ="As per customers, the financials are as below :"; $bindBusinessFinancial['customer_statements']=array(); $bindBusinessFinancial['customer_statements_header']=array(); @@ -830,84 +1067,208 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $bindBusinessFinancial['customer_statements']=array(); $bindBusinessFinancial['customer_statements_header']=array(); } + $bindBusinessFinancial['working_capital_receive'] = $businessFinancialRow['receive_the_money_in_days']; + $bindBusinessFinancial['working_capital_pay'] = $businessFinancialRow['pay_the_money_in_days']; + $bindBusinessFinancial['working_capital_unsold_stock'] = $businessFinancialRow['unsold_stock_lies_in_days'] != "" || $businessFinancialRow['unsold_stock_lies_in_days'] != null ? $businessFinancialRow['unsold_stock_lies_in_days'] != "" : 'Data Not Provided'; + $bindBusinessFinancial['is_working_capital_facility'] = $businessFinancialRow['is_there_working_capital_available']; + $bindBusinessFinancial['working_capital_facilites'] = $businessFinancialRow['working_capital_facilities_availed']; + //FINANCIALFORM::getAvailableFacilities($businessFinancialRow[-'"working_capital_facilities_availed']); + array_push($businessFinancialResult,$bindBusinessFinancial); - } + ?> -| Year | -Sales | -Net Profit | -Net Profit to Sales % | -Net Loss | -Net Loss to Sales % | -% Variation in PY Sales | -% Variation in PY Profit | -
|---|---|---|---|---|---|---|---|
| - | - | - | - | - | - | - | - |
Company / Firm Name :" . $iterateFinance['company_name']; ?>
+No of Years of Financial Statements provided :" . $iterateFinance['years_data_provided']; ?>
+Snapshot of Financials as per Books of Account Provided:"; ?>
+ 0){ ?> +| - + | Particulars | "."FY ".$bfRow['financial_year']."";}?> +||
|---|---|---|---|
| - - - | -- - - | -- - - | +|
| Sales / Revenue (Rs) | '.$bfRow['financial_sales_revenue'].'';}?>|||
| Net Profit / (Net Loss) (Rs) | '.$bfRow['financial_net_profit'].'';}else{ echo '('.$bfRow['financial_net_loss'].') | '; } }?>||
| Net Profit or (Net Loss) to Sales % | '.$bfRow['financial_margin_of_profit'].' %';}else { echo '('.$bfRow['financial_margin_of_loss'].' %) | '; } }?>||
| % () in Sales over PY | + = 0 ? ''.$bfRow['sale_variation'].' % | ' : '('.$bfRow['sale_variation'].' %) | '; + }else { echo 'NA | ';}?> +
| % () in Net Profit over PY | + = 0 ? ''.$bfRow['profit_variation'].' % | ' :'('.$bfRow['profit_variation'].') | '; + }else + {echo 'NA | ';} }?>
| % () in Net Profit % over PY | + = 0 ? ''.$bfRow['financial_profit_to_sale_variation'].' % | ' : '('.$bfRow['financial_profit_to_sale_variation'].' %) | '; + }else { echo 'NA | ';}}?>
| Particulars | Range provided | Final Considered | +|
|---|---|---|---|
| From | To | ||
| Sales / Revenue (Rs) | + | ||
| Net Profit or (Net Loss) to Sales % | > | +||
| Net Profit / (Net Loss) (Rs) >>>> | > | +||
| Sales / Revenue (Rs) | + | ||
| Net Profit or (Net Loss) to Sales (Rs) | > | +||
| Net Profit / (Net Loss)% >>>> | > | +||
Working Capital Cycle:
+| S.No | Particulars | Days |
|---|---|---|
| 1 | Debtor Days | |
| 2 | Creditor Days | |
| 3 | Stock Days |
Working Capital Facilities:
+ +| S.No | Facility Type | Facility Details | ".$facility." | "; + }?> + +
|---|
";} ?> +
Financial information is not available.
- + + + + + 0){ + $getEachValues['is_od_cc'] = null; + foreach($businessBankRow['banking_details'] as $bd){ if($bd['account_type']== 4 || $bd['account_type']== 3){ $getEachValues['is_od_cc'] = true; } } + $getEachValues['bankDetails']=BANKINGFORM::getBusinessBankingDetails($businessBankRow['banking_details']); + $bankingResult = array_merge($bankingResult,$getEachValues); + + } + + ?> + + 0){ ?> +Business Banking:
+| Account Name | +Bank Name | +Account Type | +Account Vintage | + +OD/CC Limit(Rs) | + + +
|---|---|---|---|---|
| + | + | + | + + | + + + |
| Product/Service | -Client | -Contact | -Payment | +Sr.No | +Particulars | + Client $i"; + }?> +
|---|---|---|---|---|---|
| - | - | - - - | -- | ||
| - | |||||
| Raw Material/Trading | -Supplier | -Contact | -Payment | +Sr.No | +Particulars | +Details |
|---|---|---|---|---|---|---|
| - | - | - - - | -- | |||
| - | ||||||
Have to make payment of about ". $total_payments_percent_on_credit_for_supplier ." % in advance rest on delivery.
"; + } + + }?> $stRow) { + $stRow = $pd_processed_forms[11][$business_count]; $stockRow = json_decode($stRow['processed_json'],true); + //print_r($stockRow);die(); + $is_stock_sufficient_enough = $stockRow['is_sufficiant_finished_and_traded_goods']; + $is_raw_materials_sufficient_enough = null; $bindStockResult["company_name"]=MYUTIL::findCompanyName($all_company_details,$stockRow['company_id'],1); // this is for stock manufacturing details - if(count($stockRow['manufacturing_details'][0]['manufacturing_raw_materials']) > 0 || count($stockRow['manufacturing_details'][0]['manufacturing_finished_goods']) > 0){ + if(count($stockRow['manufacturing_details'] && (count($stockRow['manufacturing_details'][0]['manufacturing_raw_materials']) > 0 || count($stockRow['manufacturing_details'][0]['manufacturing_finished_goods']) > 0))){ + + $is_raw_materials_sufficient_enough = $stockRow['manufacturing_details'][0]['is_sufficiant_raw']; $bindStockResult["manufacturing"]=Stockform::getStockManufacturingDetails($stockRow['manufacturing_details'][0]['manufacturing_raw_materials'], $stockRow['manufacturing_details'][0]['manufacturing_finished_goods']); + //print_r($bindStockResult["manufacturing"]); } else { $bindStockResult["manufacturing"]=array(); @@ -1175,162 +1662,110 @@ defined('BASEPATH') OR exit('No direct script access allowed'); else { $bindStockResult["wholesale"]=array(); } - count($bindStockResult['wholesale']) || count($bindStockResult['retail']) || count($bindStockResult['manufacturing'])? array_push($stockResult,$bindEachResult) : $stockResult; - } + count($bindStockResult['wholesale']) || count($bindStockResult['retail']) || count($bindStockResult['manufacturing'])? array_push($stockResult,$bindStockResult) : $stockResult; + + //print_r($stockResult);//die(); ?> - +The Manufacturing stock details are as under :
+| Type | -Name | -Qty | -UOM | -Value | -Details | +Sr.No | +Type of Stock | +Stock Item | +Stock Value (Rs) | +Stock Quantity |
|---|---|---|---|---|---|---|---|---|---|---|
| - | - | - | - + | + | + + |
The Retail trading stock details are as under :
-| Name | -Qty | -UOM | -Value | -Details | -||||
|---|---|---|---|---|---|---|---|---|
| + | - | - | - | - | + | + |
The Wholesale trading stock details are as under :
-| Name | -Qty | -UOM | -Value | -Details | -||||
|---|---|---|---|---|---|---|---|---|
| + | - | - | - | - | + | + |
Considering the size of operations, the stock of goods maintained is not sufficient as per the PD Officer’s observations.
"; + } + if(!strcasecmp($is_raw_materials_sufficient_enough,'yes')) + { + echo "Considering the size of operations, the stock of raw materials maintained is sufficient as per the PD Officer’s observations.
"; + }else if(!strcasecmp($is_raw_materials_sufficient_enough,'no')) + { + echo "Considering the size of operations, the stock of raw materials maintained is not sufficient as per the PD Officer’s observations.
"; + } + ?> + - - - $baRow) { - - $businessAssetRow = json_decode($baRow['processed_json'],true); - $bindBusinessAsset["company_name"] ='Assets used for '; - $bindBusinessAsset["company_name"] .=MYUTIL::findCompanyName($all_company_details,$businessAssetRow['company_id'],1); - $bindBusinessAsset["company_name"] .=' Business :'; - if(count($businessAssetRow['business_assets_details'])>0){ - $bindBusinessAsset['details']=ASSETSFORM::getBusinessAssetsDetails($businessAssetRow['business_assets_details']); - } - array_push($businessAssetResult,$bindBusinessAsset); - } - - - ?> -| Asset | -Owned By | -Details | -Market Value | -
|---|---|---|---|
| - | - | - | - |
Business asset is not available.
- - + + $oaRow) { $otherAssetRow = json_decode($oaRow['processed_json'],true); @@ -1372,6 +1807,10 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $iRow) { $otherIcomeRow = json_decode($iRow['processed_json'],true); @@ -1615,7 +2054,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');