69 lines
3.4 KiB
PHP
69 lines
3.4 KiB
PHP
<?php
|
|
|
|
class vendor_form
|
|
{
|
|
|
|
public static function getVendorGeneralSectionContent($vendor_gen_section)
|
|
{
|
|
$CI =&get_instance();
|
|
$CI->load->model('PD_Model');
|
|
$return_data = 'DEFULT TEXT';
|
|
|
|
if($vendor_gen_section['person_met_entered'])
|
|
{
|
|
$return_data = $vendor_gen_section['person_met_entered']." ".$vendor_gen_section['designation_entered'] ." met at the visited address during FI.";
|
|
}
|
|
else
|
|
{
|
|
foreach ($vendor_gen_section['individuals'] as $ind_key => $ind_value)
|
|
{
|
|
if($ind_value['is_person_met'])
|
|
{
|
|
$return_data = "Applicant ".$ind_value['applicant_name']." was met at the visited address during FI.";
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
return $return_data;
|
|
}
|
|
|
|
public static function getVendoraddressSectionContent($vendor_add_section)
|
|
{
|
|
$CI =&get_instance();
|
|
$CI->load->model('PD_Model');
|
|
$return_data = array();//fi_initiated_address
|
|
|
|
$initiated_address = vendor_form::getAddress($CI,$vendor_add_section,1);
|
|
$actual_address = $vendor_add_section['is_pd_done_on_initiated_address'] ? array() : vendor_form::getAddress($CI,$vendor_add_section,2);
|
|
|
|
$address_type_name = $vendor_add_section['address_type_others'] ? $vendor_add_section['address_type_others'] : $CI->PD_Model->selectCustomRecords(array('address_type'),array('address_type_id' => $vendor_add_section['address_type']),ADDRESSTYPE);
|
|
|
|
$address_locality = $vendor_add_section['locality_others'] ? $vendor_add_section['locality_others'] : $CI->PD_Model->selectCustomRecords(array('locality_name'),array('locality_id' => $vendor_add_section['locality']),LOCALITY);
|
|
|
|
$uom = $vendor_add_section['uom_others'] ? $vendor_add_section['uom_others'] : $CI->PD_Model->selectCustomRecords(array('name'),array('uom_id' => $vendor_add_section['uom']),UOM);
|
|
|
|
$pd_location_approach = $CI->PD_Model->selectCustomRecords(array('description'),array('pd_location_approach_id' => $vendor_add_section['pd_location']),PDLOCATIONAPPROACH);
|
|
|
|
$comment_locality = $CI->PD_Model->selectCustomRecords(array('rating'),array('comments_on_locality_id' => $vendor_add_section['comment_locality']),COMMENTSONLOCALITY);
|
|
|
|
return array('initiated_address' => $initiated_address,'actual_address' => $actual_address,'address_type' => $address_type_name[0]['address_type'],'address_locality' => $address_locality[0]['locality_name'],'uom' => $uom[0]['name'],'pd_location_approach' => $pd_location_approach[0]['description'],'comment_locality' => $comment_locality[0]['rating']);
|
|
}
|
|
|
|
static function getAddress($CI,$vendor_add_section,$addres_type = 1)//1 = visited address, 2 = alternative address
|
|
{
|
|
$CI->load->model('PD_Model');
|
|
|
|
$state_id = $addres_type == 1 ? $vendor_add_section['state'] : $vendor_add_section['alternative_addresses'][0]['alternative_state'];
|
|
$city_id = $addres_type == 1 ? $vendor_add_section['city'] : $vendor_add_section['alternative_addresses'][0]['alternative_city'];
|
|
$pincode_id = $addres_type == 1 ? $vendor_add_section['pincode'] : $vendor_add_section['alternative_addresses'][0]['alternative_pincode'];
|
|
|
|
$state_name = $CI->PD_Model->selectCustomRecords(array('name'),array('state_id' => $state_id),STATE);
|
|
$city_name = $CI->PD_Model->selectCustomRecords(array('name'),array('city_id' => $city_id),CITY);
|
|
$pincode = $CI->PD_Model->selectCustomRecords(array('pincode'),array('pincode_id' => $pincode_id),PINCODE);
|
|
|
|
return array('state_name' => $state_name[0]['name'],'city_name' => $city_name[0]['name'],'pincode' => $pincode[0]['pincode']);
|
|
|
|
}
|
|
}
|
|
?>
|