89 lines
5.7 KiB
PHP
89 lines
5.7 KiB
PHP
<?php
|
|
|
|
class Rentalform
|
|
{
|
|
|
|
public static function getRentalText($rental_data){
|
|
|
|
//print_r($rental_data);die();
|
|
$address_property = $rental_data['address_property'];
|
|
$address_property = str_replace("\n",' ',$address_property);
|
|
$address_property .= ' ,'.$rental_data['city_master'].' ,'.$rental_data['state_master'].' - '.$rental_data['pincode_master'].'.';
|
|
$address_property = $rental_data['validate_visited_address'] ? $address_property : str_replace("\n",'',$rental_data['other_visited_address']);
|
|
|
|
$type_of_property = $rental_data['nature_property']['id'] == 1 ? $rental_data['other_nature_property']: $rental_data['nature_property']['name'];
|
|
$unit_type = $rental_data['unit_type']['id'] == 1 ? $rental_data['other_unit_type'] : $rental_data['unit_type']['name'];
|
|
$no_of_floors = $rental_data['unit_type']['id'] == 6 ? $rental_data['no_floor'] : $rental_data['no_units'];
|
|
$area_coverd = $rental_data['unit_type']['id'] == 6 ? $rental_data['multistoried_total_area'] : '';
|
|
$area_uom = $rental_data['unit_type']['id'] == 6 ? $rental_data['multistoried_uom']['name'] : '';
|
|
$property_owners_name = null;
|
|
foreach($rental_data['property_owner'] as $owner){
|
|
|
|
if($owner['id'] != 0)
|
|
{
|
|
$property_owners_name .= $owner['name'].' ,';
|
|
}
|
|
else
|
|
{
|
|
$property_owners_name .= $rental_data['property_owner_other'].' , ';
|
|
}
|
|
}
|
|
|
|
$property_owners_name = substr_replace($property_owners_name,' ',strrpos($property_owners_name,','),1);
|
|
$property_owners_name = substr_replace($property_owners_name,' and ',strrpos($property_owners_name,','),1);
|
|
|
|
$property_showing_persons_name = null;
|
|
foreach($rental_data['person_met'] as $person_met){
|
|
|
|
if($person_met['id'] != 0)
|
|
{
|
|
$property_showing_persons_name .= $person_met['name'].' ,';
|
|
}
|
|
else
|
|
{
|
|
$property_showing_persons_name .= $rental_data['other_person_met'].' , ';
|
|
}
|
|
}
|
|
|
|
$property_showing_persons_name = substr_replace($property_showing_persons_name,' ',strrpos($property_showing_persons_name,','),1);
|
|
$property_showing_persons_name = substr_replace($property_showing_persons_name,' and ',strrpos($property_showing_persons_name,','),1);
|
|
$property_document_proof_visted = $rental_data['property_ownership_proof_documents'] == 1 ? 'Yes': 'No';
|
|
$type_of_document_visited = (substr_count($rental_data['sighted_documents']['name'], 'Others')) ? $rental_data['other_sighted_documents'] : $rental_data['sighted_documents']['name'];
|
|
|
|
$property_remark = $rental_data['rental_remark'];
|
|
$third_check_details = array();
|
|
$third_check_details['done_third_party_check'] = $rental_data['done_third_party_check'];// ? 'Yes' : 'No';
|
|
$third_check_details['done_third_party_check'] = $rental_data['done_third_party_check'];// ? 'Yes' : 'No';
|
|
$third_check_details['why_third_party_check_not_done'] = isset($rental_data['why_third_party_check_not_done']) && !$rental_data['done_third_party_check'] ? $rental_data['why_third_party_check_not_done'] : '';
|
|
$third_check_details['whom_third_party_check_done'] = isset($rental_data['whom_third_party_check_done']) ? $rental_data['whom_third_party_check_done'] : '';
|
|
$third_check_details['description_third_party_check_done'] = isset($rental_data['description_third_party_check_done']) ? $rental_data['description_third_party_check_done'] : '';
|
|
$third_check_details['rental_rates_third_party_check_done'] = isset($rental_data['rental_rates_third_party_check_done']) ? $rental_data['rental_rates_third_party_check_done'] : '';
|
|
|
|
|
|
$unit_wise_details = array();
|
|
foreach ($rental_data['property_unit_details'] as $u_key => $unit) {
|
|
|
|
$temp = array();
|
|
//if($unit['tenant_lessees_options'] == 1) { $temp['lesse_name'] = $unit['name_tenant_lessees'];} else { $temp['lesse_name'] = 'Not Available' ; }
|
|
$temp['agreement_tenant_lessees_name'] = isset($unit['agreement_tenant_lessees_name']) ? $unit['agreement_tenant_lessees_name']: 'Not Provided <br>('. $unit['name_tenant_lessees_reason'] .')';
|
|
$temp['agreement_monthly_rent_amount'] = isset($unit['agreement_monthly_rent_amount']) ? $unit['agreement_monthly_rent_amount'] : $unit['monthly_rent_amount'];
|
|
$temp['agreement_security_deposit_amount'] = isset($unit['agreement_security_deposit_amount']) ? $unit['agreement_security_deposit_amount']: $unit['securtity_deposit_amount'];
|
|
$temp['property_cover_area'] = $unit['property_cover_area'] .' '. $unit['unit_measurement']['name'];
|
|
$temp['payment_mode'] = $unit['payment_mode']['name'].'<br> (';
|
|
$temp['payment_mode'] .= isset($unit['amount_received_bank']) ? 'from bank: ' . $unit['amount_received_bank'] : '';
|
|
$temp['payment_mode'] .= isset($unit['amount_received_cash']) ? ' from cash: ' .$unit['amount_received_cash'] : '';
|
|
$temp['payment_mode'] .= ')';
|
|
$temp['rent_agreement_executed'] = $unit['is_rent_agreement_executed'] == 1 ? 'Yes' : 'No' ;
|
|
|
|
|
|
|
|
|
|
$temp['leease_period'] = isset($unit['agreement_date']) ? 'lease start from '. date_format(date_create_from_format("Y-m-d",explode('T',$unit['agreement_date'])[0]) ,'M-Y') .' to '.date_format(date_create_from_format("d/m/Y",$unit['agreement_expiring_date']),'M-Y') : 'NA';
|
|
array_push($unit_wise_details,$temp);
|
|
|
|
}
|
|
//print_r($unit_wise_details);
|
|
return array('address_property' => $address_property,'type_of_property' => $type_of_property,'property_owners_name' => $property_owners_name,'property_showing_persons_name' => $property_showing_persons_name,'property_document_proof_visted' => $property_document_proof_visted,'type_of_document_visited' => $type_of_document_visited,'no_of_floors' => $no_of_floors, 'area_coverd' => $area_coverd,'area_uom' => $area_uom,'unit_details' => $unit_wise_details,'property_remark' => $property_remark,'third_check_details' => $third_check_details,'unit_type' => $unit_type);
|
|
}
|
|
}
|
|
?>
|