sparqapi/api/application/helpers/assetsform_helper.php
2019-05-22 12:44:33 +05:30

250 lines
14 KiB
PHP

<?php
class Assetsform
{
// other asset details
public static function getOthersAssetsDetails($values){
$mergeResult=array();
foreach($values as $key => $fetchVal){
$storeValue=array();
$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($values){
$mergeResult=array();
foreach($values as $fetchVal){
// echo "helper";
// print_r($fetchVal);
$storeValue=array();
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_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['business_approximate_market_value'] = 'Rs.'.$fetchVal['business_approximate_market_value'];
break;
default:
$storeValue['business_name_of_the_owner'] = '';
$storeValue['about_business_assets'] = '';
$storeValue['business_approximate_market_value'] = '';
}
}
// this is for vehicle
else if($fetchVal['business_assets_mode']==3){
switch(strtoupper($fetchVal['business_ownership_type'])) {
case 'RENTED':
$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['business_approximate_market_value'] = 'Rs.'.$fetchVal['business_approximate_market_value'];
break;
default:
$storeValue['business_name_of_the_owner'] = '';
$storeValue['about_business_assets'] = '';
$storeValue['business_approximate_market_value'] = '';
}
}
// this property
else if($fetchVal['business_assets_mode']==2){
switch(strtoupper($fetchVal['business_ownership_type'])) {
case 'RENTED':
$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']:$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:
$storeValue['business_name_of_the_owner'] = '';
$storeValue['about_business_assets'] = '';
$storeValue['business_approximate_market_value'] = '';
}
}
//this is for other
else if($fetchVal['business_assets_mode']==1){
switch(strtoupper($fetchVal['business_ownership_type'])) {
case 'RENTED':
$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'][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]['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:
$storeValue['business_name_of_the_owner'] = '';
$storeValue['about_business_assets'] = '';
$storeValue['business_approximate_market_value'] = '';
}
}
}
array_push($mergeResult,$storeValue);
}
return $mergeResult;
}
}
?>