class Currency
{
function __construct()
{
//do nothing for now
}
// http://www.phpbuilder.com/board/showthread.php?t=10350901
function get_bd_money_format($amount)
{
$output_string = '';
$fraction = '';
$tokens = explode('.', $amount);
$number = $tokens[0];
if(count($tokens) > 1)
{
$fraction = (double)('0.' . $tokens[1]);
$fraction = $fraction * 100;
$fraction = round($fraction, 0);
$fraction = '.' . $fraction;
}
$number = $number . '';
$spl=str_split($number);
$lpcount=count($spl);
$rem=$lpcount-3;
//echo "rem".$rem."
";
//even one
if($lpcount%2==0)
{
for($i=0;$i<=$lpcount-1;$i++)
{
if($i%2!=0 && $i!=0 && $i!=$lpcount-1)
{
$output_string .= ",";
}
$output_string .= $spl[$i];
}
}
//odd one
if($lpcount%2!=0)
{
for($i=0;$i<=$lpcount-1;$i++)
{
if($i%2==0 && $i!=0 && $i!=$lpcount-1)
{
$output_string .= ",";
}
$output_string .= $spl[$i];
}
}
return $output_string . $fraction;
}
// http://efreedom.com/Question/1-3181945/Convert-Money-Text-PHP
function translate_to_words($number)
{
/*****
* A recursive function to turn digits into words
* Numbers must be integers from -999,999,999,999 to 999,999,999,999 inclussive.
*
* (C) 2010 Peter Ajtai
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* See the GNU General Public License:
Number must be an integer between -" . number_format($max_size, 0, ".", ",") . " and " . number_format($max_size, 0, ".", ",") . " exclussive.";
}
return $string;
}
function get_bd_amount_in_text($amount)
{
$output_string = '';
$tokens = explode('.', $amount);
$current_amount = $tokens[0];
$fraction = '';
if(count($tokens) > 1)
{
$fraction = (double)('0.' . $tokens[1]);
$fraction = $fraction * 100;
$fraction = round($fraction, 0);
$fraction = (int)$fraction;
if($fraction!=0) {
$fraction = $this->translate_to_words($fraction) . ' paisa';
$fraction = ' Rupees & ' . $fraction;
} else {
$fraction = ' Rupees ';
}
}
$crore = 0;
if($current_amount >= pow(10,7))
{
$crore = (int)floor($current_amount / pow(10,7));
$output_string .= $this->translate_to_words($crore) . ' crore ';
$current_amount = $current_amount - $crore * pow(10,7);
}
$lakh = 0;
if($current_amount >= pow(10,5))
{
$lakh = (int)floor($current_amount / pow(10,5));
$output_string .= $this->translate_to_words($lakh) . ' lakh ';
$current_amount = $current_amount - $lakh * pow(10,5);
}
$current_amount = (int)$current_amount;
$output_string .= $this->translate_to_words($current_amount);
$output_string = $output_string . $fraction . ' only';
$output_string = ucwords($output_string);
return $output_string;
}
}
?>
global $mySession;
$myControllerName = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
$myActionName = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
if(empty($myControllerName)) { $myControllerName='index';}
if(empty($myActionName)) { $myActionName='index';}
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
?>