₹'; $first_row = 'Loan Type'; $second_row = 'Loan Amount'; // $third_row = 'Loan Amount (Rs)'; $fourth_row = 'Availed From'; $fifth_row = 'Borrower'; $sixth_row = 'Instalment Amount'; $seventh_row = 'Instalment Frequency'; $eigth_row = 'Original Tenure (Months)'; $ninth_row = 'Elapsed Tenure (Months)'; $tenth_row = 'Balance Tenure (Months)'; $total_header = 0; foreach($values as $key => $tag) { if(isset($tag['loan_type_master']) && $tag['loan_type_master'] != '') { $total_header++; $total_no_of_valid_data++; $setFrequencyType=''; switch($tag['frequency']) { case 1: $setFrequencyType = ' per '.$tag['other_frequency']; break; case 2: $setFrequencyType = ' per annum'; break; case 3: $setFrequencyType = ' per halfyearly'; break; case 4: $setFrequencyType = ' per fortnightly'; break; case 5: $setFrequencyType = ' per daily'; break; case 6: $setFrequencyType = ' per quarterly'; break; case 7: $setFrequencyType = ' per month'; break; default: $setFrequencyType = ' per'; } $name_of_borrower = ''; foreach ($tag['loan_taken_by'] as $l_key => $l_value) { if($l_value['id'] == 0) { $name_of_borrower .= $tag['others_loan_taken'].' ,'; } else { $name_of_borrower .= $l_value['group_id'] == 1 ? $l_value['name'] . ' , ': APPLICANTNAME_GRABBER::getApplicantsNameById($l_value['id'],$latest_applicants_names).' ,'; } } $name_of_borrower = substr_replace($name_of_borrower, '', -1); // if(strrpos($name_of_borrower,',')) { $name_of_borrower = substr_replace($name_of_borrower,' and ',strrpos($name_of_borrower,','),1); } $name_of_borrower = str_replace(',','and', $name_of_borrower); $first_row .= $tag['loan_type']==1 ? ''.$tag['others_loan_type'].'' : ''.$tag['loan_type_master'] .''; $loan_amt = $tag['loan_amount'] ? $rupee_symbol.' '.MYUTIL::customIndianNumberFormat($tag['loan_amount']) : 'Not Provided'; $second_row .= ''.$loan_amt.''; //$third_row = ''.MYUTIL::customIndianNumberFormat($tag['loan_amount']).''; $fourth_row .= $tag['lender']==1 ? ''.$tag['others_lender'].'' : ''.$tag['lender_master'].''; $fifth_row .= ''.$name_of_borrower.''; $sixth_row .= ''.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($tag['emi']).''; $seventh_row .= $tag['frequency']==1 ? ''.$tag['other_frequency'].'' : ''.$tag['frequency_master'].''; $eigth_row .= $tag['original_tenure'] ? ''.$tag['original_tenure'].'' : ' Not Provided '; $ninth_row .= $tag['elapsed_tenure'] ? ''.$tag['elapsed_tenure'].'' : ' Not Provided '; $bal = is_numeric($tag['original_tenure']) && is_numeric($tag['elapsed_tenure']) ? ($tag['original_tenure'] - $tag['elapsed_tenure']) : 'Not Provided'; $tenth_row .= ''.$bal.''; unset($values[$key]); // echo count($values).' - keyy is - '.$key.'*'; if( $total_header == 5) { break; } } } $overall_data[$i] = array( 'first_row' => $first_row.'','second_row' => $second_row.'','fourth_row' => $fourth_row.'','fifth_row' => $fifth_row.'','sixth_row' => $sixth_row.'','seventh_row' => $seventh_row.'','eigth_row' => $eigth_row.'', 'ninth_row' => $ninth_row.'', 'tenth_row' => $tenth_row.'','total_header' => $total_header); // echo 'TABLE VALIUES - '.count($values); } $overall_data['valid_data'] = $total_no_of_valid_data; return $overall_data; } // business financial details public static function getBusinessFinancialDetails($values){ $values = array_map(function($tag) { return array( 'financial_year' => $tag['financial_year'], 'financial_sales_revenue' => $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 ? $tag['financial_net_profit'] : '', 'financial_net_loss' => $tag['finanical_profit_or_loss']!=1 ? $tag['financial_net_loss'] : '', 'financial_margin_of_profit' => $tag['finanical_profit_or_loss']==1 ? $tag['financial_margin_of_profit'] : '', 'financial_margin_of_loss' => $tag['finanical_profit_or_loss']!=1 ? $tag['financial_margin_of_loss'] : '', 'profit_variation' => $tag['financial_variation'], 'sale_variation' => $tag['financial_annualsales_variation'],'financial_profit_to_sale_variation' => $tag['financial_profit_to_sale_variation'] ); }, $values); return $values; } // get customer financial public static function getBusinessCustomerFinancialDetails($values) { $values = array_map(function($tag) { if($tag['estimate_profit_or_loss']==1){ return array( 'estimate_profit_or_loss' => $tag['estimate_profit_or_loss'], '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'])=='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_net_profit'], //Pre - estimate_profit_margin 'net_profit_loss_sales_final_rs' => strtoupper($tag['estimate_net_margin_availablity'])=='YES' ? $tag['estimate_profit_margin']: $tag['estimate_net_profit_percent'],//pre_ estimate_profit_margin_percent //'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' => $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'], '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'].')', ); } }, $values); return $values; } // not in use public static function getBusinessCustomerHeader($values){ if(count($values)>0 && $values[0]['estimate_profit_or_loss']==1){ return array("Sales","Net Profit","Net Margin %"); } else if(count($values)>0 && $values[0]['estimate_profit_or_loss']==2){ return array("Sales","Net Loss","Net Margin %"); } else { return array(); } } //not in use public static function getAvailableFacilities($arr) { echo "@@@@@@@@@@@@@@"; print_r($arr); die(); $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; } } ?>