190 lines
5.4 KiB
PHP
190 lines
5.4 KiB
PHP
<?php
|
|
|
|
class MYUTIL
|
|
{
|
|
|
|
|
|
|
|
|
|
public static function numtowords($number)
|
|
{
|
|
|
|
$no = round($number);
|
|
$point = ($number - $no) == 0 ? '' : round($number - $no, 2) * 100;
|
|
$hundred = null;
|
|
$digits_1 = strlen($no);
|
|
$i = 0;
|
|
$str = array();
|
|
$words = array('0' => '', '1' => 'One', '2' => 'Two',
|
|
'3' => 'Three', '4' => 'Four', '5' => 'Five', '6' => 'Six',
|
|
'7' => 'Seven', '8' => 'Eight', '9' => 'Nine',
|
|
'10' => 'Ten', '11' => 'Eleven', '12' => 'Twelve',
|
|
'13' => 'Thirteen', '14' => 'Fourteen',
|
|
'15' => 'Fifteen', '16' => 'Sixteen', '17' => 'Seventeen',
|
|
'18' => 'Eighteen', '19' =>'Nineteen', '20' => 'Twenty',
|
|
'30' => 'Thirty', '40' => 'Forty', '50' => 'Fifty',
|
|
'60' => 'Sixty', '70' => 'Seventy',
|
|
'80' => 'Eighty', '90' => 'Ninety');
|
|
$digits = array('', 'Hundred', 'Thousand', 'Lakh', 'Crore');
|
|
while ($i < $digits_1) {
|
|
$divider = ($i == 2) ? 10 : 100;
|
|
$number = floor($no % $divider);
|
|
$no = floor($no / $divider);
|
|
$i += ($divider == 10) ? 1 : 2;
|
|
if ($number) {
|
|
$plural = (($counter = count($str)) && $number > 9) ? 's' : null;
|
|
$hundred = ($counter == 1 && $str[0]) ? ' and ' : null;
|
|
$str [] = ($number < 21) ? $words[$number] .
|
|
" " . $digits[$counter] . $plural . " " . $hundred
|
|
:
|
|
$words[floor($number / 10) * 10]
|
|
. " " . $words[$number % 10] . " "
|
|
. $digits[$counter] . $plural . " " . $hundred;
|
|
} else $str[] = null;
|
|
}
|
|
$str = array_reverse($str);
|
|
$result = implode('', $str);
|
|
$points = ($point) ?
|
|
"." . $words[$point / 10] . " " .
|
|
$words[$point = $point % 10] : '';
|
|
$res = $result;
|
|
if($points != "")
|
|
{
|
|
$res.=$points . "";
|
|
}
|
|
return $result;
|
|
|
|
}
|
|
|
|
public static function findCompanyName($array,$companyid,$type)
|
|
{
|
|
if($array != null && $type==1)
|
|
{
|
|
foreach($array as $key => $value)
|
|
{
|
|
|
|
if($companyid == $value['company_order_id'])
|
|
{
|
|
return $value['company_name'];
|
|
}
|
|
}
|
|
}
|
|
if($array != null && $type==2)
|
|
{
|
|
foreach($array as $key => $value)
|
|
{
|
|
//print_r($value);die();
|
|
// echo date("d-m-Y", strtotime($value['business_date_object']) );
|
|
// die();
|
|
if($companyid == $value['company_order_id'])
|
|
{
|
|
$data['company_name'] = $value['company_name'];
|
|
//$getSentense .=' is a ';
|
|
$data['type_of_activity'] = $value['business_entity_type']==1 ? $value['business_entity_type_other'] : $value['business_entity_type_master'];
|
|
//$getSentense .=' formed on ';
|
|
//echo $data['type_of_activity'];
|
|
$CI=& get_instance();
|
|
$CI->load->model('PD_Model');
|
|
$business_entity_type = $CI->PD_Model->selectCustomRecords(array('*'),array('isactive' => 1),BUSINESSENTITYTYPE);
|
|
foreach($business_entity_type as $bn_key => $bn_value)
|
|
{
|
|
if($value['business_entity_type'] == $bn_value['business_entity_type_id'])
|
|
{
|
|
$data['partners_title_name'] = $bn_value['section_label'];
|
|
break;
|
|
}
|
|
}
|
|
// switch($value['business_entity_type'])
|
|
// {
|
|
// case 1:
|
|
// case 6:
|
|
// case 9:
|
|
// $data['partners_title_name'] = "Member Details";
|
|
// break;
|
|
// case 2:
|
|
// $data['partners_title_name'] = "Director / Shareholder Details";
|
|
// break;
|
|
// case 3:
|
|
// //echo '3';
|
|
// $data['partners_title_name'] = "Proprietor Details";
|
|
// break;
|
|
// case 4:
|
|
// $data['partners_title_name'] = "Karta Details";
|
|
// break;
|
|
// case 5:
|
|
// case 7:
|
|
// $data['partners_title_name'] = "Partner Details";
|
|
// break;
|
|
// case 8:
|
|
// case 11:
|
|
// $data['partners_title_name'] = "Director Details";
|
|
// break;
|
|
|
|
// case 10:
|
|
// $data['partners_title_name'] = "Trustee Details";
|
|
// break;
|
|
// }
|
|
$data['year_and_month']= $value['business_years'] . ' Year(s)';
|
|
$data['year_and_month'] .= isset($value['business_month']) && $value['business_month'] != "" ? ' and '.$value['business_month'] . ' Month(s)': '';
|
|
|
|
$data['formed_on'] = $value['business_date_object'] ? date("d-m-Y", strtotime($value['business_date_object'])) : null;
|
|
|
|
return $data;
|
|
//return $value['company_name'].' is a '.$value['business_entity_type']==1 ? $value['business_entity_type_other'] : $value['business_entity_type_master'] .' formed on '.date("d-m-Y", strtotime($value['business_date_object']));
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return 'Company Not Found';
|
|
}
|
|
}
|
|
|
|
public static function applicantTitleName($applicant_array,$id)
|
|
{
|
|
$t = null;
|
|
foreach($applicant_array as $applicant)
|
|
{
|
|
if($applicant['pd_co_applicant_id'] == $id)
|
|
{
|
|
$t = $applicant['title_name'];
|
|
}
|
|
}
|
|
|
|
return $t;
|
|
}
|
|
|
|
public static function findQuestionByKey($array,$qkey)
|
|
{
|
|
foreach($array as $key => $value)
|
|
{
|
|
//echo $value['key'].'--'.$qkey;
|
|
|
|
if(!strcmp(trim($value['key']),trim($qkey)))
|
|
{
|
|
// echo "\n";
|
|
// echo 'IF'.$value['key'].'--'.$qkey;
|
|
return $value['question'];
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
public static function customIndianNumberFormat($value)
|
|
{
|
|
$indian_num_format = numfmt_create( 'en_IN', NumberFormatter::DECIMAL );
|
|
//echo numfmt_format_currency($indian_num_format,$value, "INR");
|
|
//return numfmt_format_currency($indian_num_format,$value,"INR");
|
|
return numfmt_format($indian_num_format,$value);
|
|
}
|
|
|
|
public static function applicantNameCamelCaseConvertion($name)
|
|
{
|
|
$name = explode(' ',$name);
|
|
$final_name = null;
|
|
foreach($name as $n){ $final_name.= ' '.ucfirst(strtolower($n)); }
|
|
return $final_name;
|
|
}
|
|
}
|
|
|
|
?>
|