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'); ?> - + @@ -115,6 +118,8 @@ defined('BASEPATH') OR exit('No direct script access allowed'); ₹"; ?>







"; @@ -123,7 +128,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); echo "

PERSONAL DISCUSSION REPORT

"; echo "
for the case of
"; - echo "

".$pd_master_details[0]['title_name'].' '.$pd_master_details[0]['main_applicant']."

"; + echo "

".$main_applicant_name."

"; echo ""; echo "



"; ?> @@ -158,6 +163,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'].".

"; - - - } + Satellite Image of location of Where PD was Done - if( $address_form['address_form_remark'] != "") + Approch to PD Location + + Name Board +

Location Summary

+
The ".$address_type." is located in ".$locality." and the estimated area of the office is ".$estimated_area." ."; + echo "

The PD location was ". $pd_address['pd_location_master'].", and the locality in which the ".$address_type ." is situated is ".$pd_address['comment_locality_master'] .", as per the general observations made during the visit by PD officer."; + echo "

The PD officer also made the following observations:" ; + echo "
"; + + if($address_form['address_form_remark']) + { + echo $address_form['address_form_remark'];} + echo "
"; + //die(); ?> @@ -377,66 +415,98 @@ defined('BASEPATH') OR exit('No direct script access allowed'); -
-

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(); + ?> +

+ + + + $row) + { + echo '"; } ?> + +
S.No Loan Particulars Loan Particular Details
'.($row_key + 1)." ".$row['particulars']." ".$row['details'] ."
+
".$loan_form['loandetails_remarks']; + ?> - + 0) { + for($business_count = 0;$business_count < $total_no_of_business; $business_count++) + { + + + ?>
$bRow) { + $bRow = $pd_processed_forms[13][$business_count]; $businessRow = json_decode($bRow['processed_json'],true); $companyList = MYUTIL::findCompanyName($all_company_details,$businessRow['company_id'],2); //$companyList .=' The director details are as under :'; - $bindEachResult["company_name"]=$companyList; + $bindEachResult["company_details"]=$companyList; // this is for partner details if(array_key_exists('partners',$businessRow)){ $bindEachResult["partner"]=Businessform::getPartnerDetails($businessRow['partners']); @@ -503,8 +573,25 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $bindEachResult['business_peak_details']='The Business has no major changes in sales across season.'; } // this is for no of employess details - $bindEachResult['company_empployees']='As per person met there are '.$businessRow['employees_permanent'].' permanent and '.$businessRow['employees_temporary'].' temporary employees with company.'; - $bindEachResult['officer_visit_company_empployees']='The PD Officer could notice approximately '.$businessRow['officer_total'] .' employees during the visit.'; + if(isset($businessRow['employees_permanent']) && $businessRow['employees_permanent'] <= 0) { + $bindEachResult['company_empployees']='As per person met there are no permanent'; + } + else{ + $bindEachResult['company_empployees']='As per person met there are '.$businessRow['employees_permanent'].' permanent '; + } + if(isset($businessRow['employees_temporary']) && $businessRow['employees_temporary'] > 0) + { + $bindEachResult['company_empployees'].= 'and '.$businessRow['employees_temporary'].' temporary employee(s) with company.'; + }else{ + $bindEachResult['company_empployees'].= ' and no temporary employess found'; + } + if(isset($businessRow['officer_total']) && $businessRow['officer_total'] > 0) + { + $bindEachResult['officer_visit_company_empployees']='At the time of PD visit, approximately '.$businessRow['officer_total'] .' employee(s) during the visit at the business premises.'; + } + else{ + $bindEachResult['officer_visit_company_empployees']='At the time of PD visit, PD officer could not able to see any of employees at the business premises.'; + } //this is documents visited $getDocuments=array(); if(array_key_exists('shop_eat_act_cert',$businessRow) && strtoupper($businessRow['shop_eat_act_cert'])=='YES'){ @@ -532,15 +619,24 @@ defined('BASEPATH') OR exit('No direct script access allowed'); } $bindEachResult['visit_documents']=$getDocuments; array_push($businessResult,$bindEachResult); - } + + + //print_r($businessResult); ?> -

Business Details

+

BUSINESS INFORMATION:

$fetchRow){ ?> -

About Company :

-

The director details are as under :

+

+
Company / Firm Name:
+
Business Entity Type:
+
Date of Incorporation:
+
Business Vintage: +

+ + +

@@ -550,6 +646,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); + @@ -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){ ?>
-

Besides the above, the below family members are also involved in the business :

+

Other Family Members involved in business :

No.of Years in Current Business Total Work Experience Previous ExperienceStarted Business
- - - + + + + @@ -585,8 +684,9 @@ defined('BASEPATH') OR exit('No direct script access allowed'); ?> - - + + + @@ -595,21 +695,23 @@ defined('BASEPATH') OR exit('No direct script access allowed'); - + - 0){ ?> + 0){ ?>
-

The Manufacturing details are as under :

+

Type of Business Activity : Manufacturing

NameRelationDesignationStarted BusinessIndividual RelationshipRelated toRelationship to Company / FirmStarted Business (Yes / No)
- - - - + + + + @@ -629,6 +731,21 @@ defined('BASEPATH') OR exit('No direct script access allowed');
ProductsArea of SaleSales DoneMax Sales DoneKey ProductsArea of OperationsArea of Sale / ServiceArea where Max Sale / Service done
+ +
+

Brief of the Business / Service Model

+ + + + + + + + + + +
Product / Service Process Brief
+ @@ -637,16 +754,16 @@ defined('BASEPATH') OR exit('No direct script access allowed'); 0){ ?>
-

The Retail Trading details are as under :

+

Type of Business Activity : Retail Trading

- - - - + + + + @@ -666,6 +783,20 @@ defined('BASEPATH') OR exit('No direct script access allowed');
ProductsArea of SaleSales DoneMax Sales DoneKey ProductsArea of OperationsArea of Sale / ServiceArea where Max Sale / Service done
+ +
+

Brief of the Business / Service Model

+ + + + + + + + + + +
Product / Service Process Brief
@@ -674,16 +805,16 @@ defined('BASEPATH') OR exit('No direct script access allowed'); 0){ ?>
-

The Service Provider details are as under :

+

Type of Business Activity : Service Provider

- - - + + + @@ -703,6 +834,21 @@ defined('BASEPATH') OR exit('No direct script access allowed');
ServicesArea of SaleServices AtMax Revenue FromArea of OperationsArea of Sale / ServiceArea where Max Sale / Service done
+ + +
+

Brief of the Business / Service Model

+ + + + + + + + + + +
Product / Service Process Brief
@@ -711,16 +857,16 @@ defined('BASEPATH') OR exit('No direct script access allowed'); 0){ ?>
-

The Wholesale Trading details are as under :

+

Type of Business Activity : Wholesale Trading

- - - - + + + + @@ -740,6 +886,21 @@ defined('BASEPATH') OR exit('No direct script access allowed');
ProductsArea of SaleSales DoneMax Sales DoneKey ProductsArea of OperationsArea of Sale / ServiceArea where Max Sale / Service done
+ + +
+

Brief of the Business / Service Model

+ + + + + + + + + + +
Product / Service Process Brief
@@ -767,9 +928,18 @@ defined('BASEPATH') OR exit('No direct script access allowed'); - + + + + + + + + - +

@@ -791,31 +961,98 @@ defined('BASEPATH') OR exit('No direct script access allowed'); - + + + + + 0){ + $bindBusinessAsset['details']=ASSETSFORM::getBusinessAssetsDetails($businessAssetRow['business_assets_details']); + } + array_push($businessAssetResult,$bindBusinessAsset); + + + //print_r($businessAssetResult); + ?> + + 0){ ?> +

Assets used in Buisness

+ +

+ + + + + + + + + + + + $baRow){ + if(isset($baRow['business_assets_mode_master'])) + { + $rent_amount = isset($baRow['rent_amount']) ? $rupee_symbol.MYUTIL::customIndianNumberFormat((double)$baRow['rent_amount']): '0.00'; + ?> + + + + + + + + + +
S.NoAsset TypeAsset DescriptionOwnershipMonthly 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); - } + ?> -

Financial Information

+ 0){ ?> - -

- 0){ ?> - - - - - - - - - - - - - - - Financial Information + - - - - - - - - - - - - -
YearSalesNet ProfitNet Profit to Sales %Net LossNet Loss to Sales %% Variation in PY Sales% Variation in PY Profit
- - -

- 0){ ?> +

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){ ?> + - - - + "."FY ".$bfRow['financial_year']."";}?> + - - - - - + '.$bfRow['financial_sales_revenue'].'';}?> + + '.$bfRow['financial_net_profit'].'';}else{ echo ''; } }?> + + '.$bfRow['financial_margin_of_profit'].' %';}else { echo ''; } }?> + + + = 0 ? '' : ''; + }else { echo '';}?> + - + + + = 0 ? '' :''; + }else + {echo '';} }?> + + + = 0 ? '' : ''; + }else { echo '';}}?>
Particulars
-
-
-
-
-
-
-
-
-
Sales / Revenue (Rs)
Net Profit / (Net Loss) (Rs) ('.$bfRow['financial_net_loss'].')
Net Profit or (Net Loss) to Sales % ('.$bfRow['financial_margin_of_loss'].' %)
% () in Sales over PY'.$bfRow['sale_variation'].' %('.$bfRow['sale_variation'].' %)NA
% () in Net Profit over PY'.$bfRow['profit_variation'].' %('.$bfRow['profit_variation'].')NA
% () in Net Profit % over PY'.$bfRow['financial_profit_to_sale_variation'].' %('.$bfRow['financial_profit_to_sale_variation'].' %)NA
- + + +

+ 0){ + //print_r($iterateFinance['customer_statements']);die(); + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
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."
+ The Loan Applicants have not availed any Working Capital Facilities from any financial institution

";} ?> +

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 NameBank NameAccount TypeAccount VintageOD/CC Limit(Rs)
+ + + + + + @@ -916,132 +1277,204 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $clientResult=array(); // this is for manufacturing - foreach($pd_processed_forms[2] as $rowKey=> $cRow) { - $clientRow = json_decode($cRow['processed_json'],true); + //global $client_first_row; + $client_first_row = ''; + $client_second_row = ''; + $client_third_row = ''; + $client_fourth_row = ''; + $client_fifth_row = ''; + $client_sixth_row = ''; + $client_seventh_row = ''; + $to_no_of_clients = 0; + $done_on_credit = 0; + $name_of_the_company = ''; + $cRow = $pd_processed_forms[2][$business_count]; + $clientRow = json_decode($cRow['processed_json'],true); + + $name_of_the_company = MYUTIL::findCompanyName($all_company_details,$clientRow['company_id'],1); + // $bindEachResult["company_name"]=MYUTIL::findCompanyName($all_company_details,$clientRow['company_id'],1); + // $getmanufacturing = array(); + // $getTrading=array(); + // $getService=array(); + //$getTotalPaymentsPercentonCredit=array(); + $client_first_row = '1Product / Service '; + $client_second_row = '2Contact Person '; + $client_third_row = '3Mobile Number '; + $client_fourth_row = '4Landline No'; + $client_fifth_row = '5Payment Terms'; + $client_sixth_row = '6Payment Mode'; + $client_seventh_row = '7No of Days Credit'; - $bindEachResult["company_name"]=MYUTIL::findCompanyName($all_company_details,$clientRow['company_id'],1); - $getmanufacturing = array(); - $getTrading=array(); - $getService=array(); - $getTotalPaymentsPercentonCredit=array(); + + // this is for manufacturing if(array_key_exists('manufacturing_details',$clientRow)){ + + $done_on_credit += $clientRow['manufacturing_details'][0]['main_raw_materials_total_payments_percent_on_credit']; + foreach($clientRow['manufacturing_details'] as $manuRow){ + if(isset($manuRow['main_raw_materials'])){ - $getmanufacturing = array_map(function($tag) { - return array( - 'product' => $tag['manufacturing_product_name'], - 'client_name' => $tag['manufacturing_client_name'], - 'person_title_name' => array_key_exists('person_title_name_master',$tag) ? $tag['person_title_name_master'] : '', - 'person_designation' => ($tag['person_designation']==1) ? $tag['other_person_designation'] : ($tag['person_designation']>1 ? $tag['person_designation_master']: ''), - 'contact_person_name' => $tag['manufacturing_contact_person_name'], - 'contact_person_mobile_number' => $tag['manufacturing_contact_person_mobile_number'], - 'payment_type_master' => array_key_exists('manufacturing_payment_type_master',$tag) ? $tag['manufacturing_payment_type_master'] : '', - - ); - }, $manuRow['main_raw_materials']); - array_push($getTotalPaymentsPercentonCredit,$manuRow['main_raw_materials_total_payments_percent_on_credit']); + + $to_no_of_clients += count($manuRow['main_raw_materials']); + + foreach($manuRow['main_raw_materials'] as $main_raw_material_key => $main_raw_material) + { + //print_r($main_raw_material); + $client_first_row .= ''.$main_raw_material['manufacturing_product_name'].''; + + $client_second_row .= $main_raw_material['person_title_name_master'] ? '' . $main_raw_material['person_title_name_master']: '' . ''; + $client_second_row .= $main_raw_material['manufacturing_contact_person_name'] ; + + $client_second_row .= isset($main_raw_material['person_designation']) && $main_raw_material['person_designation']== 1 ? ' '.$main_raw_material['other_person_designation'] : ' ';// + + $client_second_row .= isset($main_raw_material['person_designation_master']) ? $main_raw_material['person_designation_master'] : '' ; + + $client_second_row .= ' '.$main_raw_material['manufacturing_client_name'].''; + + $client_third_row .= ''. $main_raw_material['manufacturing_contact_person_mobile_number'] .''; + + $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_sixth_row .= $main_raw_material['manufacturing_payment_mode'] ? ''. $main_raw_material['manufacturing_payment_mode'] .'' : 'NA';; + + $client_seventh_row .= $main_raw_material['manufacturing_credit_days_from'] && $main_raw_material['manufacturing_credit_days_to'] ? ''. $main_raw_material['manufacturing_credit_days_from'].' to '. $main_raw_material['manufacturing_credit_days_to'].' days'.'' :' NIL ' ; + + } } } } + + // this is for trading if(array_key_exists('trade_details',$clientRow)){ + $done_on_credit += $clientRow['trade_details'][0]['trading_products_total_payments_percent_on_credit']; foreach($clientRow['trade_details'] as $tradeRow){ if(isset($tradeRow['trading_products'])){ - $getTrading = array_map(function($tag) { - return array( - 'product' => $tag['trade_product_name'], - 'client_name' => $tag['trade_client_name'], - 'person_title_name' => array_key_exists('person_title_name_master',$tag) ? $tag['person_title_name_master'] : '', - 'person_designation' => ($tag['person_designation']==1) ? $tag['other_person_designation'] : ($tag['person_designation']>1 ? $tag['person_designation_master']: ''), - 'contact_person_name' => $tag['trade_product_contact_person_name'], - 'contact_person_mobile_number' => $tag['trade_product_contact_person_mobile_number'], - 'payment_type_master' => array_key_exists('trade_product_payment_type_master',$tag) ? $tag['trade_product_payment_type_master'] :'', - - ); - }, $tradeRow['trading_products']); - array_push($getTotalPaymentsPercentonCredit,$tradeRow['trading_products_total_payments_percent_on_credit']); - + $to_no_of_clients += count($tradeRow['trading_products']); + + foreach($tradeRow['trading_products'] as $trading_product_key => $trading_product) + { + + $client_first_row .= ''.$trading_product['trade_product_name'].''; + + $client_second_row .= $trading_product['person_title_name_master'] ? '' . $trading_product['person_title_name_master']: '' . ''; + $client_second_row .= $trading_product['trade_product_contact_person_name'] ; + + $client_second_row .= isset($trading_product['person_designation']) && $trading_product['person_designation']== 1 ? ' '.$trading_product['other_person_designation'] : ' ';// + + $client_second_row .= isset($trading_product['person_designation_master']) ? $trading_product['person_designation_master'] : '' ; + + $client_second_row .= ' '.$trading_product['trade_client_name'].''; + + $client_third_row .= ''. $trading_product['trade_product_contact_person_mobile_number'] .''; + + $client_fourth_row .= $trading_product['person_stdcode'] && $trading_product['person_landline'] ? ''. $trading_product['person_stdcode'].' '.$trading_product['person_landline'].'' : ''.'Not Provided'.''; + + $client_fifth_row .= $trading_product['trade_product_payment_type_master'] ? ''. $trading_product['trade_product_payment_type_master'] .'' : 'NA'; + + $client_sixth_row .= $trading_product['trade_product_payment_mode'] ? ''. $trading_product['trade_product_payment_mode'] .'' : 'NA';; + + $client_seventh_row .= $trading_product['trade_product_credit_days_from'] && $trading_product['trade_product_credit_days_to']? ''. $trading_product['trade_product_credit_days_from'].' to '. $trading_product['trade_product_credit_days_to'].' days'.'' :' NIL ' ; + + } + + } } } //this is for service if(array_key_exists('service_provider_details',$clientRow)){ + + $done_on_credit += $clientRow['service_provider_details'][0]['service_products_total_payments_percent_on_credit']; + foreach($clientRow['service_provider_details'] as $serviceRow){ if(isset($serviceRow['service_products'])){ - $getService = array_map(function($tag) { - return array( - 'product' => $tag['service_provider_product_name'], - 'client_name' => $tag['service_provider_client_name'], - 'person_title_name' => array_key_exists('person_title_name_master',$tag) ? $tag['person_title_name_master'] : '', - 'person_designation' => ($tag['person_designation']==1) ? $tag['other_person_designation'] : ($tag['person_designation']>1 ? $tag['person_designation_master']: ''), - 'contact_person_name' => $tag['service_provider_product_contact_person_name'], - 'contact_person_mobile_number' => $tag['service_provider_product_contact_person_mobile_number'], - 'payment_type_master' => array_key_exists('service_provider_product_payment_type_master',$tag) ? $tag['service_provider_product_payment_type_master'] :'', - - ); - }, $serviceRow['service_products']); - array_push($getTotalPaymentsPercentonCredit,$serviceRow['service_products_total_payments_percent_on_credit']); + $to_no_of_clients += count($serviceRow['service_products']); + foreach($serviceRow['service_products'] as $service_product_key => $service_product) + { + + $client_first_row .= ''.$service_product['service_provider_product_name'].''; + + $client_second_row .= $service_product['person_title_name_master'] ? '' . $service_product['person_title_name_master']: '' . ''; + $client_second_row .= $service_product['service_provider_product_contact_person_name'] ; + + $client_second_row .= isset($service_product['person_designation']) && $service_product['person_designation']== 1 ? ' '.$service_product['other_person_designation'] : ' ';// + + $client_second_row .= isset($service_product['person_designation_master']) ? $service_product['person_designation_master'] : '' ; + + $client_second_row .= ' '.$service_product['service_provider_client_name'].''; + + $client_third_row .= ''. $service_product['service_provider_product_contact_person_mobile_number'] .''; + + $client_fourth_row .= $service_product['person_stdcode'] && $service_product['person_landline'] ? ''. $service_product['person_stdcode'].' '.$service_product['person_landline'].'' : ''.'Not Provided'.''; + + $client_fifth_row .= $service_product['service_provider_product_payment_type_master'] ? ''. $service_product['service_provider_product_payment_type_master'] .'' : 'NA'; + + $client_sixth_row .= $service_product['service_provider_product_payment_mode'] ? ''. $service_product['service_provider_product_payment_mode'] .'' : 'NA'; + + $client_seventh_row .= $service_product['service_provider_product_credit_days_from'] && $service_product['service_provider_product_credit_days_to']? ''. $service_product['service_provider_product_credit_days_from'].' to '. $service_product['service_provider_product_credit_days_to'].' days'.'' :' NIL ' ; + + } } } } - $bindEachResult["details"]=array_merge($getmanufacturing,$getTrading,$getService); - $bindEachResult['total_payments_percent_on_credit'] = $getTotalPaymentsPercentonCredit; - array_push($clientResult,$bindEachResult); - } + + + $client_first_row .= ''; + $client_second_row .= ''; + $client_third_row .= ''; + $client_fourth_row .= ''; + $client_fifth_row .= ''; + $client_sixth_row .= ''; + $client_seventh_row .= ''; ?> -

Client Details

+ 0 ) + { + echo "

Client Details

"; + ?> - + - - - - + + + Client $i"; + }?> + - - - - - - - - + + + + + + + - - - - - - - +
Product/ServiceClientContactPaymentSr.NoParticulars
-
-
-
- + Out of total sales done by ".$name_of_the_company .", ".$done_on_credit."% is done on credit.

"; }?> + @@ -1049,114 +1482,168 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $row) { - $clientRow = json_decode($row['processed_json'],true); - $bindEachResult = array(); - $bindEachResult["company_name"]=MYUTIL::findCompanyName($all_company_details,$clientRow['company_id'],1); - $getmanufacturing = array(); - $getTrading=array(); - $getTotalPaymentsPercentonCredit=array(); + $supplier_details = $pd_processed_forms[1][$business_count]; + $clientRow = json_decode($supplier_details['processed_json'],true); + + $company_name = MYUTIL::findCompanyName($all_company_details,$clientRow['company_id'],1); + $total_no_of_suppliers = count($clientRow['manufacturing_details']); + $total_payments_percent_on_credit_for_supplier = 0; + + foreach($clientRow['manufacturing_details'] as $manuRow){ + $total_payments_percent_on_credit_for_supplier = $clientRow['manufacturing_details'][0]['main_raw_materials_total_payments_percent_on_credit']; if(isset($manuRow['main_raw_materials'])){ - $getmanufacturing = array_map(function($tag) { - return array( - 'product' => $tag['manufacturing_raw_material_name'], - 'supplier_name' => $tag['manufacturing_supplier_name'], - 'person_title_name' => array_key_exists('person_title_name_master',$tag) ? $tag['person_title_name_master'] : '', - 'person_designation' => ($tag['person_designation']==1) ? $tag['other_person_designation'] : ($tag['person_designation']>1 ? $tag['person_designation_master']: ''), - 'contact_person_name' => $tag['manufacturing_contact_person_name'], - 'contact_person_mobile_number' => $tag['manufacturing_contact_person_mobile_number'], - 'payment_type_master' => $tag['manufacturing_payment_type_master'], - - ); - }, $manuRow['main_raw_materials']); - array_push($getTotalPaymentsPercentonCredit,$manuRow['main_raw_materials_total_payments_percent_on_credit']); + + foreach($manuRow['main_raw_materials'] as $raw){ + + $temp['supplier_first_row'] = '1Item Purchased '.''.$raw['manufacturing_raw_material_name'].''; + + $supplier_second_row = '2Contact Person '; + + $supplier_second_row .= $raw['person_title_name_master'] ? '' . $raw['person_title_name_master']: '' . ''; + $supplier_second_row .= $raw['manufacturing_contact_person_name'] ; + + $supplier_second_row .= isset($raw['person_designation']) && $raw['person_designation']== 1 ? ' '.$raw['other_person_designation'] : ' ';// + + $supplier_second_row .= isset($raw['person_designation_master']) ? $raw['person_designation_master'] : '' ; + + $supplier_second_row .= ' '.$raw['manufacturing_supplier_name'].''; + $temp['supplier_second_row'] = $supplier_second_row.''; + + $temp['supplier_third_row'] = '3Mobile Number '.''. $raw['manufacturing_contact_person_mobile_number'] .''; + + $temp['supplier_fourth_row'] = '4Landline No'; + + $temp['supplier_fourth_row'] .= $raw['person_stdcode'] && $raw['person_landline'] ? ''. $raw['person_stdcode'].' '.$raw['person_landline'].'' : ''.'Not Provided'.''; + + $temp['supplier_fifth_row'] = '5Payment Terms'; + + $temp['supplier_fifth_row'] .= $raw['manufacturing_payment_type_master'] ? ''. $raw['manufacturing_payment_type_master'] .'' : 'NA'; + + $temp['supplier_sixth_row'] = '6Payment Mode'; + + $temp['supplier_sixth_row'] .= $raw['manufacturing_payment_mode'] ? ''. $raw['manufacturing_payment_mode'] .'' : 'NA'; + + $temp['supplier_seventh_row'] = '7No of Days Credit'; + + $temp['supplier_seventh_row'] .= $raw['manufacturing_credit_days_from'] && $raw['manufacturing_credit_days_to'] ? ''. $raw['manufacturing_credit_days_from'].' to '. $raw['manufacturing_credit_days_to'].'' : 'NA'; + array_push($supplierResult,$temp); + + } } } // this is for trading foreach($clientRow['trade_details'] as $tradeRow){ - if(isset($tradeRow['trading_products'])){ - - $getTrading = array_map(function($tag) { - return array( - 'product' => $tag['trade_product_name'], - 'supplier_name' => $tag['trade_supplier_name'], - 'person_title_name' => array_key_exists('person_title_name_master',$tag) ? $tag['person_title_name_master'] : '', - 'person_designation' => ($tag['person_designation']==1) ? $tag['other_person_designation'] : ($tag['person_designation']>1 ? $tag['person_designation_master']: ''), - 'contact_person_name' => $tag['trade_product_contact_person_name'], - 'contact_person_mobile_number' => $tag['trade_product_contact_person_mobile_number'], - 'payment_type_master' => array_key_exists('trade_product_payment_type_master',$tag) ? $tag['trade_product_payment_type_master'] :'', - - ); - }, $tradeRow['trading_products']); - array_push($getTotalPaymentsPercentonCredit,$tradeRow['trading_products_total_payments_percent_on_credit']); - - } + + $total_payments_percent_on_credit_for_supplier = $clientRow['trade_details'][0]['trading_products_total_payments_percent_on_credit']; + + if(isset($tradeRow['trading_products'])){ + + + foreach($tradeRow['trading_products'] as $trade){ + + $temp['supplier_first_row'] = '1Item Purchased '.''.$trade['trade_product_name'].''; + + $supplier_second_row = '2Contact Person '; + + $supplier_second_row .= $trade['person_title_name_master'] ? '' . $trade['person_title_name_master']: '' . ''; + $supplier_second_row .= $trade['trade_product_contact_person_name'] ; + + $supplier_second_row .= isset($trade['person_designation']) && $trade['person_designation']== 1 ? ' '.$trade['other_person_designation'] : ' ';// + + $supplier_second_row .= isset($trade['person_designation_master']) ? $trade['person_designation_master'] : '' ; + + $supplier_second_row .= ' '.$trade['trade_supplier_name'].''; + $temp['supplier_second_row'] = $supplier_second_row.''; + + $temp['supplier_third_row'] = '3Mobile Number '.''. $trade['trade_product_contact_person_mobile_number'] .''; + + $temp['supplier_fourth_row'] = '4Landline No'; + + $temp['supplier_fourth_row'] .= $trade['person_stdcode'] && $trade['person_landline'] ? ''. $trade['person_stdcode'].' '.$trade['person_landline'].'' : ''.'Not Provided'.''; + + $temp['supplier_fifth_row'] = '5Payment Terms'; + + $temp['supplier_fifth_row'] .= $trade['trade_product_payment_type_master'] ? ''. $trade['trade_product_payment_type_master'] .'' : 'NA'; + + $temp['supplier_sixth_row'] = '6Payment Mode'; + + $temp['supplier_sixth_row'] .= $trade['trade_product_payment_mode'] ? ''. $trade['trade_product_payment_mode'] .'' : 'NA'; + + $temp['supplier_seventh_row'] = '7No of Days Credit'; + + $temp['supplier_seventh_row'] .= $trade['trade_product_credit_days_from'] && $trade['trade_product_credit_days_to'] ? ''. $trade['trade_product_credit_days_from'].' to '. $trade['trade_product_credit_days_to'].' days' : 'NA'; + array_push($supplierResult,$temp); + + } + } + } - $bindEachResult["details"]=array_merge($getmanufacturing,$getTrading); - $bindEachResult['total_payments_percent_on_credit'] = $getTotalPaymentsPercentonCredit; - count($bindEachResult['details'])? array_push($supplierResult,$bindEachResult) : $supplierResult; - - } - - if(count($supplierResult)) + + if(count($supplierResult)) { ?>

Supplier Details

$fetchRow){ + echo '
Supplier '.($k+1).':'; ?> - + - - - - + + + - - - - - - - - - - - - - - - +
Raw Material/TradingSupplierContactPaymentSr.NoParticularsDetails
-
-
-
- + + + 0) + { + echo "

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(); ?> - +

Stock Details

0) { ?> -

The Manufacturing stock details are as under :

+ - - - - - - + + + + + - + - - - - + + + + - - -
TypeNameQtyUOMValueDetailsSr.NoType of StockStock ItemStock Value (Rs)Stock Quantity
+ + 0) { ?> -

The Retail trading stock details are as under :

- - - - - - - - - - - + + - - - - + + - - -
NameQtyUOMValueDetails
+ 0) { ?> -

The Wholesale trading stock details are as under :

- - - - - - - - - - - + + - - - - + + +
NameQtyUOMValueDetails
- - + Considering the size of operations, the stock of goods maintained is sufficient as per the PD Officer’s observations.

"; + }else if(!strcasecmp($is_stock_sufficient_enough,'no')){ + echo "

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 Details

- 0){ ?> - -

- - - - - - - - - - - - - - - - - - - -
AssetOwned ByDetailsMarket 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');

Final Remarks Section

- Details Score Card Section