239 lines
14 KiB
PHP
239 lines
14 KiB
PHP
<?php
|
|
|
|
class Assetsform
|
|
{
|
|
// other asset details
|
|
public static function getOthersAssetsDetails($values){
|
|
$mergeResult=array();
|
|
foreach($values as $key => $fetchVal){
|
|
$storeValue=array();
|
|
if(isset($fetchVal['assets_mode_master']) && ($fetchVal['assets_mode_master'] != '' || $fetchVal['assets_mode_master'] != null))
|
|
{
|
|
$storeValue['assets_mode'] = $fetchVal['assets_mode_master'];
|
|
$storeValue['name_of_the_owner'] = $fetchVal['name_of_the_owner'][0]['id']==0 ? $fetchVal['other_owner'] : $fetchVal['name_of_the_owner'][0]['name'];
|
|
$storeValue['purchase_year'] = $fetchVal['vintage_personal'];
|
|
$storeValue['emi'] = (!strcasecmp($fetchVal['emi'],'yes'));
|
|
// this is for investments type
|
|
if($fetchVal['assets_mode']==7){
|
|
$storeValue['approximate_market_value'] = $fetchVal['details'][0]['amount_of_invest'];
|
|
switch($fetchVal['details'][0]['investments_type_master']) {
|
|
case 1:
|
|
$storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['other_investments_type'].' with '.$fetchVal['details'][0]['in_which_organisation'];
|
|
break;
|
|
case 2:
|
|
$storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['in_which_organisation'];
|
|
break;
|
|
case 3:
|
|
$storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['in_which_organisation'];
|
|
break;
|
|
case 4:
|
|
$storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['in_which_organisation'];
|
|
break;
|
|
case 5:
|
|
$storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['in_which_organisation'];
|
|
break;
|
|
case 6:
|
|
$storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['in_which_organisation'];
|
|
break;
|
|
default:
|
|
$storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['in_which_organisation'];
|
|
|
|
}
|
|
|
|
}
|
|
// this is for life insurance
|
|
else if($fetchVal['assets_mode']==6){
|
|
$storeValue['approximate_market_value'] = $fetchVal['details'][0]['sum_assured'];
|
|
$storeValue['is_sum_assured'] = 1;
|
|
|
|
switch($fetchVal['details'][0]['frequency_mode']) {
|
|
case 1:
|
|
$storeValue['about_assets'] = $fetchVal['details'][0]['other_frequency_mode'].' premium of Rs.'.$fetchVal['details'][0]['premium_paid'].' covering '.$fetchVal['details'][0]['members_coverd'];
|
|
break;
|
|
case 2:
|
|
$storeValue['about_assets'] ='Annualy premium of Rs.'.$fetchVal['details'][0]['premium_paid'].' covering '.$fetchVal['details'][0]['members_coverd'];
|
|
break;
|
|
case 3:
|
|
$storeValue['about_assets'] ='Halfyearly premium of Rs.'.$fetchVal['details'][0]['premium_paid'].' covering '.$fetchVal['details'][0]['members_coverd'];
|
|
break;
|
|
case 4:
|
|
$storeValue['about_assets'] ='Fortnightly premium of Rs.'.$fetchVal['details'][0]['premium_paid'].' covering '.$fetchVal['details'][0]['members_coverd'];
|
|
break;
|
|
case 5:
|
|
$storeValue['about_assets'] ='Daily premium of Rs.'.$fetchVal['details'][0]['premium_paid'].' covering '.$fetchVal['details'][0]['members_coverd'];
|
|
break;
|
|
case 6:
|
|
$storeValue['about_assets'] ='Quarterly premium of Rs.'.$fetchVal['details'][0]['premium_paid'].' covering '.$fetchVal['details'][0]['members_coverd'];
|
|
break;
|
|
case 7:
|
|
$storeValue['about_assets'] ='Monthly premium of Rs.'.$fetchVal['details'][0]['premium_paid'].' covering '.$fetchVal['details'][0]['members_coverd'];
|
|
break;
|
|
default:
|
|
$setFrequencyType = $fetchVal['details'][0]['premium_paid'].' covering '.$fetchVal['details'][0]['members_coverd'];
|
|
}
|
|
|
|
}
|
|
// this is machinaries
|
|
else if($fetchVal['assets_mode']==4){
|
|
$storeValue['approximate_market_value'] = $fetchVal['approximate_market_value'];
|
|
|
|
$storeValue['about_assets'] = $fetchVal['details'][0]['equipment_manufacturing_description'];
|
|
|
|
}
|
|
// this is for vehicle
|
|
else if($fetchVal['assets_mode']==3){
|
|
$storeValue['approximate_market_value'] = $fetchVal['approximate_market_value'];
|
|
|
|
$storeValue['about_assets'] = $fetchVal['details'][0]['vehicle_type_master'].' - '.$fetchVal['details'][0]['manufacturer_model_vehicle'];
|
|
|
|
}
|
|
|
|
// this property
|
|
else if($fetchVal['assets_mode']==2){
|
|
$storeValue['approximate_market_value'] = $fetchVal['approximate_market_value'];
|
|
$storeValue['assets_mode'] .= '<br>('.$fetchVal['details'][0]['property_type_master'].')';
|
|
|
|
$storeValue['about_assets'] = $fetchVal['details'][0]['property_type_master'] . ' property ( '. $fetchVal['details'][0]['describe_of_the_property_asset'] .' ) at '.$fetchVal['details'][0]['address_of_the_property'].' having area of '. $fetchVal['details'][0]['area_covered_by_this_property'];
|
|
|
|
$storeValue['about_assets'] .= $fetchVal['details'][0]['uom_of_the_property'] == 1 ? ' '.$fetchVal['details'][0]['uom_of_the_property'].'.' : ' '.$fetchVal['details'][0]['uom_master'].'.';
|
|
|
|
//$fetchVal['details'][0]['address_of_the_property']? 'Address of Property : ' . $fetchVal['details'][0]['address_of_the_property'].'.' : '';
|
|
|
|
//$storeValue['about_assets'] .= $fetchVal['details'][0]['describe_of_the_property_asset']? '<br> Description of Asset : ' . $fetchVal['details'][0]['describe_of_the_property_asset'].'.' : '';
|
|
|
|
//$storeValue['about_assets'] .= $fetchVal['details'][0]['area_covered_by_this_property']? '<br> Area of Covered : ' . $fetchVal['details'][0]['area_covered_by_this_property'].'.' : '';
|
|
}
|
|
//this is for other
|
|
else if($fetchVal['assets_mode']==1){
|
|
$storeValue['approximate_market_value'] = $fetchVal['details'][0]['any_other_asset_value'];
|
|
$storeValue['about_assets'] = $fetchVal['details'][0]['any_other_assets'].' purchased in '. $fetchVal['purchase_year'];
|
|
}
|
|
|
|
array_push($mergeResult,$storeValue);
|
|
}
|
|
}
|
|
return $mergeResult;
|
|
}
|
|
|
|
// business asset details
|
|
public static function getBusinessAssetsDetails($business_assets){
|
|
|
|
//print_r($business_assets);
|
|
$header_row = '<tr><th>Particulars</th>';
|
|
$first_row = '<tr><td>Asset Type</td>';
|
|
$sec_row = '<tr><td>Asset Description</td>';
|
|
$third_row = '<tr><td>Ownership</td>';
|
|
$fourth_row = '<tr><td>Owned by</td>';
|
|
$fifth_row = '<tr><td>Market Value</td>';
|
|
$sixth_row = '<tr><td>Monthly Rent</td>';
|
|
$seventh_row = '<tr><td>Age of Asset</td>';
|
|
$eighth_row = '<tr><td>Loan (Y/N)</td>';
|
|
$rupee_symbol = "<span style='font-family: DejaVu Sans; sans-serif;font-size:10px'>₹</span>";
|
|
$rental_flag = 0;
|
|
$owned_flag = 0;
|
|
$show_table = 1;
|
|
$overall_empty_flag = 0;
|
|
|
|
foreach($business_assets as $bsk => $fetchVal){
|
|
|
|
$owners_list = null;
|
|
if($fetchVal['business_assets_mode'] == "" || $fetchVal['business_assets_mode'] == null)
|
|
{
|
|
if(count($business_assets) == 1){ $show_table = 0;}
|
|
}
|
|
|
|
if(isset($fetchVal['business_name_of_the_owner']) && (is_array($fetchVal['business_name_of_the_owner'])) && count($fetchVal['business_name_of_the_owner']))
|
|
{
|
|
foreach($fetchVal['business_name_of_the_owner'] as $owner)
|
|
{
|
|
$owners_list.= ($owner['id'] != 0 ? $owner['name'].', ' : $fetchVal['business_name_of_the_other_owner'].', ');
|
|
}
|
|
}
|
|
//print_r($owners_list);
|
|
$owners_list = substr_replace($owners_list, '', strrpos($owners_list, ','),1);
|
|
|
|
$owners_list = $owners_list != "" || $owners_list != null ? $owners_list : 'NA';
|
|
$ownership_type = 'NA';
|
|
|
|
if(!strcasecmp($fetchVal['business_ownership_type'],'owned'))
|
|
{
|
|
$ownership_type = ($fetchVal['business_ownership_type']);
|
|
$owned_flag++;
|
|
}else if(!strcasecmp($fetchVal['business_ownership_type'],'rented'))
|
|
{
|
|
$ownership_type = ($fetchVal['business_ownership_type']);
|
|
$rental_flag++;
|
|
}
|
|
|
|
if($fetchVal['business_assets_mode']==4){
|
|
|
|
$header_row .= '<th>Asset '.($bsk+1).'</th>';
|
|
$first_row .= '<td class="customtd">'.$fetchVal['business_assets_mode_master'].'</td>';
|
|
$sec_row .= '<td class="customtd">'.($fetchVal['business_details'][0]['equipment_manufacturing_description']).' purchased at '.$fetchVal['business_purchase_year'] .'</td>';
|
|
$third_row .= '<td class="customtd">'. ucfirst($ownership_type) .'</td>';
|
|
$fourth_row .= '<td class="customtd">'.$owners_list.'</td>';
|
|
$fifth_row .= '<td class="customtd">'.($fetchVal['business_approximate_market_value'] != "" && $fetchVal['business_approximate_market_value'] != null ? $rupee_symbol.' '.$fetchVal['business_approximate_market_value'] : 'NA').'</td>';
|
|
$sixth_row .= '<td class="customtd">'.(($fetchVal['business_monthly_rented_amt'] != "") ? $fetchVal['business_monthly_rented_amt'] : 'NA').'</td>';
|
|
$seventh_row .= '<td class="customtd">'.($fetchVal['business_vintage'] != "" ? $fetchVal['business_vintage'] : 'NA').'</td>';
|
|
$eighth_row .= '<td class="customtd">'.($fetchVal['business_emi'] != "" ? ucfirst($fetchVal['business_emi']) : 'NA').'</td>';
|
|
|
|
}
|
|
// this is for vehicle
|
|
else if($fetchVal['business_assets_mode']==3){
|
|
$header_row .= '<th>Asset '.($bsk+1).'</th>';
|
|
$first_row .= '<td class="customtd">'.$fetchVal['business_assets_mode_master'].'</td>';
|
|
$sec_row .= '<td class="customtd">'.($fetchVal['business_details'][0]['manufacturer_model_vehicle']).' purchased at '.$fetchVal['business_purchase_year'].'</td>';
|
|
$third_row .= '<td class="customtd">'. ucfirst($ownership_type) .'</td>';
|
|
$fourth_row .= '<td class="customtd">'.$owners_list.'</td>';
|
|
$fifth_row .= '<td class="customtd">'.($fetchVal['business_approximate_market_value'] != "" && $fetchVal['business_approximate_market_value'] != null ? $rupee_symbol.' '.$fetchVal['business_approximate_market_value'] : 'NA').'</td>';
|
|
$sixth_row .= '<td class="customtd">'.(($fetchVal['business_monthly_rented_amt'] != "") ? $fetchVal['business_monthly_rented_amt'] : 'NA').'</td>';
|
|
$seventh_row .= '<td class="customtd">'.($fetchVal['business_vintage'] != "" ? $fetchVal['business_vintage'] : 'NA').'</td>';
|
|
$eighth_row .= '<td class="customtd">'.($fetchVal['business_emi'] != "" ? ucfirst($fetchVal['business_emi']) : 'NA').'</td>';
|
|
}
|
|
|
|
// this property
|
|
else if($fetchVal['business_assets_mode']==2){
|
|
// switch(strtoupper($fetchVal['business_ownership_type'])) {
|
|
|
|
$header_row .= '<th>Asset '.($bsk+1).'</th>';
|
|
$first_row .= '<td class="customtd">'.$fetchVal['business_assets_mode_master'].' at '. $fetchVal['business_details'][0]['address_of_the_property'].'</td>';
|
|
$sec_row .= '<td class="customtd">'.($fetchVal['business_details'][0]['property_type']==1 ? $fetchVal['business_details'][0]['other_property_type']:$fetchVal['business_details'][0]['property_type_master']).'</td>';
|
|
$third_row .= '<td class="customtd">'. ucfirst($ownership_type) .'</td>';
|
|
$fourth_row .= '<td class="customtd">'.$owners_list.'</td>';
|
|
$fifth_row .= '<td class="customtd">'.($fetchVal['business_approximate_market_value'] != "" && $fetchVal['business_approximate_market_value'] != null ? $rupee_symbol.' '.$fetchVal['business_approximate_market_value'] : 'NA').'</td>';
|
|
$sixth_row .= '<td class="customtd">'.(($fetchVal['business_monthly_rented_amt'] != "") ? $fetchVal['business_monthly_rented_amt'] : 'NA').'</td>';
|
|
$seventh_row .= '<td class="customtd">'.($fetchVal['business_vintage'] != "" ? $fetchVal['business_vintage'] : 'NA').'</td>';
|
|
$eighth_row .= '<td class="customtd">'.($fetchVal['business_emi'] != "" ? ucfirst($fetchVal['business_emi']) : 'NA').'</td>';
|
|
}
|
|
//this is for other
|
|
else if($fetchVal['business_assets_mode']==1){
|
|
$header_row .= '<th>Asset '.($bsk+1).'</th>';
|
|
$first_row .= '<td class="customtd">'.$fetchVal['business_assets_mode_master'].'</td>';
|
|
$sec_row .= '<td class="customtd">'.$fetchVal['business_details'][0]['any_other_assets'].'</td>';
|
|
$third_row .= '<td class="customtd">'. ucfirst($ownership_type) .'</td>';
|
|
$fourth_row .= '<td class="customtd">'.$owners_list.'</td>';
|
|
$fifth_row .= '<td class="customtd">'.($fetchVal['business_approximate_market_value'] != "" && $fetchVal['business_approximate_market_value'] != null ? $rupee_symbol.' '.$fetchVal['business_approximate_market_value'] : 'NA').'</td>';
|
|
$sixth_row .= '<td class="customtd">'.(($fetchVal['business_monthly_rented_amt'] != "") ? $fetchVal['business_monthly_rented_amt'] : 'NA').'</td>';
|
|
$seventh_row .= '<td class="customtd">'.($fetchVal['business_vintage'] != "" ? $fetchVal['business_vintage'] : 'NA').'</td>';
|
|
$eighth_row .= '<td class="customtd">'.($fetchVal['business_emi'] != "" ? ucfirst($fetchVal['business_emi']) : 'NA').'</td>';
|
|
}
|
|
}
|
|
|
|
$header_row .= '</tr>';
|
|
$first_row .= '</tr>';
|
|
$sec_row .= '</tr>';
|
|
$third_row .= '</tr>';
|
|
$fourth_row .= '</tr>';
|
|
$fourth_row = $owned_flag != 0 ? $fourth_row : '';
|
|
$fifth_row .= '</tr>';
|
|
$fifth_row = $owned_flag != 0 ? $fifth_row : '';
|
|
$sixth_row .= '</tr>';
|
|
$sixth_row = $owned_flag != 0 ? $sixth_row : '';
|
|
$seventh_row .= '</tr>';
|
|
$eighth_row .= '</tr>';
|
|
$eighth_row = $owned_flag != 0 ? $eighth_row : '';
|
|
|
|
return array('header_row' => $header_row, 'first_row' => $first_row,'sec_row'=> $sec_row,'third_row' =>$third_row,'fourth_row'=>$fourth_row,'fifth_row'=>$fifth_row,'sixth_row'=>$sixth_row,'seventh_row'=>$seventh_row,'eighth_row'=>$eighth_row,'show_table'=> $show_table);
|
|
}
|
|
}
|
|
?>
|