function covert_currency_to_words($varnumber) { $strwords1 = ""; $strwords2 = ""; $strwords3 = ""; $strwords4 = ""; $strwords5 = ""; $strwords6 = ""; $strwords7 = ""; $varnumber = $varnumber; $numberarray = explode('.', $varnumber); //print_r($numberarray); $number = $numberarray[0]; $decimal = $numberarray[1]; if ($number > 9999999) { //echo "Number Not Supported."; } $convertowords = $number; $strlen = strlen($number); if ($strlen <= 2 && $number <= 19) { $strwords1 = singlenumber_convert($convertowords); } if ($strlen == 2 && $number > 19) { $strwords2 = doublenumber_convert($convertowords); } if ($strlen == 3) { $strwords3 = hundredsnumber_convert($convertowords); } if ($strlen == 4) { $strwords4 = thousandsnumber_convert($convertowords); } if ($strlen == 5) { $strwords5 = tenthousandsnumber_convert($convertowords); } if ($strlen == 6) { $strwords6 = lakhsnumber_convert($convertowords); } if ($strlen == 7) { $strwords7 = tenlakhsnumber_convert($convertowords); } if ($decimal <= 19) { $strdecimal1 = singlenumber_convert($decimal); } if ($decimal > 19) { $strdecimal1 = doublenumber_convert($decimal); } if ($strdecimal1 != '') { $strdecimal1 = ' - Paise ' . $strdecimal1; } $convertedstring = $strwords1 . $strwords2 . $strwords3 . $strwords4 . $strwords5 . $strwords6 . $strwords7 . $strdecimal1 . ' Only'; if ($convertedstring != '') { $convertedstring = 'Rupees ' . $convertedstring; } //echo $convertedstring; return $convertedstring; }
function covert_currency_to_words($varnumber) { $query1curr_companyanum = $_SESSION["companyanum"]; $query1curr = "select * from master_company where auto_number = '{$query1curr_companyanum}'"; $exec1curr = mysql_query($query1curr) or die("Error in Query1curr" . mysql_error()); $res1curr = mysql_fetch_array($exec1curr); $res1currencyname = $res1curr["currencyname"]; $res1currencydecimalname = $res1curr["currencydecimalname"]; $res1currencycode = $res1curr["currencycode"]; $strwords1 = ""; $strwords2 = ""; $strwords3 = ""; $strwords4 = ""; $strwords5 = ""; $strwords6 = ""; $strwords7 = ""; $varnumber = $varnumber; $numberarray = explode('.', $varnumber); //print_r($numberarray); $number = $numberarray[0]; $decimal = $numberarray[1]; if ($number > 9999999) { //echo "Number Not Supported."; } $convertowords = $number; $strlen = strlen($number); if ($strlen <= 2 && $number <= 19) { $strwords1 = singlenumber_convert($convertowords); } if ($strlen == 2 && $number > 19) { $strwords2 = doublenumber_convert($convertowords); } if ($strlen == 3) { $strwords3 = hundredsnumber_convert($convertowords); } if ($strlen == 4) { $strwords4 = thousandsnumber_convert($convertowords); } if ($strlen == 5) { $strwords5 = tenthousandsnumber_convert($convertowords); } if ($strlen == 6) { $strwords6 = lakhsnumber_convert($convertowords); } if ($strlen == 7) { $strwords7 = tenlakhsnumber_convert($convertowords); } if ($decimal <= 19) { $strdecimal1 = singlenumber_convert($decimal); } if ($decimal > 19) { $strdecimal1 = doublenumber_convert($decimal); } if ($strdecimal1 != '') { //$strdecimal1 = ' - Paise '.$strdecimal1; $strdecimal1 = ' - ' . $res1currencydecimalname . ' ' . $strdecimal1; } $convertedstring = $strwords1 . $strwords2 . $strwords3 . $strwords4 . $strwords5 . $strwords6 . $strwords7 . $strdecimal1 . ' Only'; //if ($convertedstring != '') $convertedstring = 'Rupees '.$convertedstring; if ($convertedstring != '') { $convertedstring = $res1currencyname . ' ' . $convertedstring; } //echo $convertedstring; return $convertedstring; }