SALES PD CHANGES AND PROD ISSUE

This commit is contained in:
Velz2020 2019-12-21 19:51:17 +05:30
parent 1b4bece74e
commit 9cee26105c
4 changed files with 146 additions and 114 deletions

View File

@ -443,8 +443,8 @@ class Sales_PD_Controller extends REST_Controller {
$this->Sales_PD_Model->updateRecords($update_fields,SALES_PD_DATA,array('sales_pd_id' => $records['fk_sales_pd_id']));
//disable previous selfie img
$update_fields = array('isactive' => 0);
$this->Sales_PD_Model->updateRecords($update_fields,SALEPD_DOCS,array('img_name' => 'selfie_with_person_met' ));
$update_fields2 = array('isactive' => 0);
$this->Sales_PD_Model->updateRecords($update_fields2,SALEPD_DOCS,array('img_name' => 'selfie_with_person_met'));
}
$id = $this->Sales_PD_Model->saveRecords($records,SALEPD_DOCS);
@ -740,8 +740,8 @@ class Sales_PD_Controller extends REST_Controller {
$question['is_repeatable'] = "";
$question['group_title'] = null;
$question['answer_value'] = $value['img'];
//$question['answer_value'] = "IMG";
$question['answer_value'] = $exist_data_value['img'];
$question['answer_value'] = "IMG";
$question['question'] = $photo_names [ $exist_data_value['img_name'] ];
$question['question_key'] = $exist_data_value['img_name'];
$question['type'] = 6;
@ -815,16 +815,16 @@ class Sales_PD_Controller extends REST_Controller {
$question['api_properties'] = null;
$question['answers'] = null;
$question['onchange_properties'] = null;
if($value['img_name'] == 'selfie_with_person_met')
if($photo_key == 'selfie_with_person_met')
{
$questions[] = [];
}
else
{
$questions[ $photo_names [ $value['img_name'] ] ] ['is_repeatable'] = 1;
$questions[ $photo_names [ $value['img_name'] ] ] ['group_title'] = $photo_value;
$questions[ $photo_names [ $value['img_name'] ] ] ['group_type'] = 6;
$questions[ $photo_names [ $value['img_name'] ] ] ['questions_group'][0]['questions'][] = [];
$questions[ $photo_key ] ['is_repeatable'] = 1;
$questions[ $photo_key ] ['group_title'] = $photo_value;
$questions[ $photo_key ] ['group_type'] = 6;
$questions[ $photo_key ] ['questions_group'][0]['questions'][] = [];
}
}
}

View File

@ -3,98 +3,122 @@
class Financialform
{
//other loan obligations
public static function getOtherLoanDetails($values,$pdid){
public static function getOtherLoanDetails($data,$pdid){
$total_tables = count($data) / 5;
$total_tables = ceil($total_tables);
//print_r(array_values($values));
// die();
$overall_data = array();
$values = array_values($data);
$latest_applicants_names = APPLICANTNAME_GRABBER::getLatestApplicantsName($pdid);
$rupee_symbol = '<span style="font-family: DejaVu Sans; sans-serif;font-size:10px">₹</span>';
$first_row = '<tr><td class="customtd">Loan Type</td>';
$second_row = '<tr><td class="customtd">Loan Amount</td>';
// $third_row = '<tr><td class="customtd">Loan Amount (Rs)</td>';
$fourth_row = '<tr><td class="customtd">Availed From</td>';
$fifth_row = '<tr><td class="customtd">Borrower</td>';
$sixth_row = '<tr><td class="customtd">Instalment Amount</td>';
$seventh_row = '<tr><td class="customtd">Instalment Frequency</td>';
$eigth_row = '<tr><td class="customtd">Original Tenure (Months)</td>';
$ninth_row = '<tr><td class="customtd">Elapsed Tenure (Months)</td>';
$tenth_row = '<tr><td class="customtd">Balance Tenure (Months)</td>';
$total_header = 0;
foreach($values as $key => $tag)
{
if(isset($tag['loan_type_master']) && $tag['loan_type_master'] != '')
{
$total_header++;
$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 ? '<td class="customtd">'.$tag['others_loan_type'].'</td>' : '<td class="customtd">'.$tag['loan_type_master'] .'</td>';
$second_row .= '<td class="customtd">'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($tag['loan_amount']).'</td>';
//$third_row = '<td class="customtd">'.MYUTIL::customIndianNumberFormat($tag['loan_amount']).'</td>';
$fourth_row .= $tag['lender']==1 ? '<td class="customtd">'.$tag['others_lender'].'</td>' : '<td class="customtd">'.$tag['lender_master'].'</td>';
$fifth_row .= '<td class="customtd">'.$name_of_borrower.'</td>';
$sixth_row .= '<td class="customtd">'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($tag['emi']).'</td>';
$seventh_row .= $tag['frequency']==1 ? '<td class="customtd">'.$tag['other_frequency'].'</td>' : '<td class="customtd">'.$tag['frequency_master'].'</td>';
$eigth_row .= $tag['original_tenure'] ? '<td class="customtd">'.$tag['original_tenure'].'</td>' : '<td class="customtd"> Not Provided </td>';
$ninth_row .= $tag['elapsed_tenure'] ? '<td class="customtd">'.$tag['elapsed_tenure'].'</td>' : '<td class="customtd"> Not Provided </td>';
$bal = is_numeric($tag['original_tenure']) && is_numeric($tag['elapsed_tenure']) ? ($tag['original_tenure'] - $tag['elapsed_tenure']) : 'Not Provided';
$tenth_row .= '<td class="customtd">'.$bal.'</td>';
}
}
return array(
'first_row' => $first_row.'</tr>','second_row' => $second_row.'</tr>','fourth_row' => $fourth_row.'</tr>','fifth_row' => $fifth_row.'</tr>','sixth_row' => $sixth_row.'</tr>','seventh_row' => $seventh_row.'</tr>','eigth_row' => $eigth_row.'</tr>', 'ninth_row' => $ninth_row.'</tr>', 'tenth_row' => $tenth_row.'</tr>','total_header' => $total_header
);
//return $values;
for($i = 1;$i<= $total_tables;$i++)
{
$rupee_symbol = '<span style="font-family: DejaVu Sans; sans-serif;font-size:10px">₹</span>';
$first_row = '<tr><td class="customtd">Loan Type</td>';
$second_row = '<tr><td class="customtd">Loan Amount</td>';
// $third_row = '<tr><td class="customtd">Loan Amount (Rs)</td>';
$fourth_row = '<tr><td class="customtd">Availed From</td>';
$fifth_row = '<tr><td class="customtd">Borrower</td>';
$sixth_row = '<tr><td class="customtd">Instalment Amount</td>';
$seventh_row = '<tr><td class="customtd">Instalment Frequency</td>';
$eigth_row = '<tr><td class="customtd">Original Tenure (Months)</td>';
$ninth_row = '<tr><td class="customtd">Elapsed Tenure (Months)</td>';
$tenth_row = '<tr><td class="customtd">Balance Tenure (Months)</td>';
$total_header = 0;
foreach($values as $key => $tag)
{
if(isset($tag['loan_type_master']) && $tag['loan_type_master'] != '')
{
$total_header++;
$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 ? '<td class="customtd">'.$tag['others_loan_type'].'</td>' : '<td class="customtd">'.$tag['loan_type_master'] .'</td>';
$second_row .= '<td class="customtd">'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($tag['loan_amount']).'</td>';
//$third_row = '<td class="customtd">'.MYUTIL::customIndianNumberFormat($tag['loan_amount']).'</td>';
$fourth_row .= $tag['lender']==1 ? '<td class="customtd">'.$tag['others_lender'].'</td>' : '<td class="customtd">'.$tag['lender_master'].'</td>';
$fifth_row .= '<td class="customtd">'.$name_of_borrower.'</td>';
$sixth_row .= '<td class="customtd">'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($tag['emi']).'</td>';
$seventh_row .= $tag['frequency']==1 ? '<td class="customtd">'.$tag['other_frequency'].'</td>' : '<td class="customtd">'.$tag['frequency_master'].'</td>';
$eigth_row .= $tag['original_tenure'] ? '<td class="customtd">'.$tag['original_tenure'].'</td>' : '<td class="customtd"> Not Provided </td>';
$ninth_row .= $tag['elapsed_tenure'] ? '<td class="customtd">'.$tag['elapsed_tenure'].'</td>' : '<td class="customtd"> Not Provided </td>';
$bal = is_numeric($tag['original_tenure']) && is_numeric($tag['elapsed_tenure']) ? ($tag['original_tenure'] - $tag['elapsed_tenure']) : 'Not Provided';
$tenth_row .= '<td class="customtd">'.$bal.'</td>';
unset($values[$key]);
// echo count($values).' - keyy is - '.$key.'*';
if( $total_header == 5)
{
break;
}
}
}
$overall_data[$i] = array(
'first_row' => $first_row.'</tr>','second_row' => $second_row.'</tr>','fourth_row' => $fourth_row.'</tr>','fifth_row' => $fifth_row.'</tr>','sixth_row' => $sixth_row.'</tr>','seventh_row' => $seventh_row.'</tr>','eigth_row' => $eigth_row.'</tr>', 'ninth_row' => $ninth_row.'</tr>', 'tenth_row' => $tenth_row.'</tr>','total_header' => $total_header);
// echo 'TABLE VALIUES - '.count($values);
}
//print_r($overall_data);die();
return $overall_data;
}
// business financial details

View File

@ -4048,32 +4048,40 @@ if($total_no_of_business > 0) {
The table below lists the details of Existing Loan Obligations of the Loan Applicants.
<table class="scorecard_table_resonal_assest">
<thead>
<br><br>
<?php
$pre_loan_no = 0;
foreach($existLoanResult as $table_key => $single_table){
//print_r($single_table);die();
?>
<table class="scorecard_table_resonal_assest" >
<!-- <thead> -->
<tr>
<th>Particulars</th>
<?php for($header = 1;$header <= $existLoanResult['total_header']; $header++ ) {echo "<th>Loan $header</th>";}?>
<?php for($header = 1;$header <= $single_table['total_header']; $header++ )
{ $pre_loan_no++; echo "<th>Loan $pre_loan_no</th>"; } ?>
</tr>
</thead>
<!-- </thead> -->
<tbody>
<?php
echo $existLoanResult['first_row'];
echo $existLoanResult['second_row'];
echo $single_table['first_row'];
echo $single_table['second_row'];
//echo $existLoanResult['third_row'];
echo $existLoanResult['fourth_row'];
echo $existLoanResult['fifth_row'];
echo $existLoanResult['sixth_row'];
echo $existLoanResult['seventh_row'];
echo $existLoanResult['eigth_row'];
echo $existLoanResult['ninth_row'];
echo $existLoanResult['tenth_row'];
echo $single_table['fourth_row'];
echo $single_table['fifth_row'];
echo $single_table['sixth_row'];
echo $single_table['seventh_row'];
echo $single_table['eigth_row'];
echo $single_table['ninth_row'];
echo $single_table['tenth_row'];
?>
</tbody>
</table>
<br>
<?php
//
}
}
else {?>
<p>As per loan applicant he does not have any existing loan obligations.</p>

View File

@ -118,7 +118,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
</tr>
<tr>
<td colspan="3"> Main Applicat Name</td>
<td colspan="3"> Name of Main Loan Applicant</td>
<td class = "tdcenteralign" colspan="7"> <?php echo $section1['main_loan_applicant']?> </td>
</tr>
<tr>