Exemple #1
0
 function no_to_words($no)
 {
     $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' => 'fouteen', '15' => 'fifteen', '16' => 'sixteen', '17' => 'seventeen', '18' => 'eighteen', '19' => 'nineteen', '20' => 'twenty', '30' => 'thirty', '40' => 'fourty', '50' => 'fifty', '60' => 'sixty', '70' => 'seventy', '80' => 'eighty', '90' => 'ninty', '100' => 'hundred &', '1000' => 'thousand', '100000' => 'lakh', '10000000' => 'crore');
     if ($no == 0) {
         return ' ';
     } else {
         $novalue = '';
         $highno = $no;
         $remainno = 0;
         $value = 100;
         $value1 = 1000;
         while ($no >= 100) {
             if ($value <= $no && $no < $value1) {
                 $novalue = $words["{$value}"];
                 $highno = (int) ($no / $value);
                 $remainno = $no % $value;
                 break;
             }
             $value = $value1;
             $value1 = $value * 100;
         }
         if (array_key_exists("{$highno}", $words)) {
             return $words["{$highno}"] . " " . $novalue . " " . no_to_words($remainno);
         } else {
             $unit = $highno % 10;
             $ten = (int) ($highno / 10) * 10;
             return $words["{$ten}"] . " " . $words["{$unit}"] . " " . $novalue . " " . no_to_words($remainno);
         }
     }
 }
             </tr>
             <tr>
             	<td class="print_text" style="padding-bottom:5px;">PACKING & FORWARDING</td>
                 <td style="padding-bottom:5px;"><b>:</b></td>
                 <td align="right" style="padding-bottom:5px;"><span class="print_text">&nbsp;</span></td>
             </tr>
             <tr>
             	<td class="print_text" style="border-top:#000000 solid 1px;border-bottom:#000000 solid 1px;" height="21"><b>NET AMOUNT</b></td>
                 <td style="border-top:#000000 solid 1px;border-bottom:#000000 solid 1px;" height="21"><b>:</b></td>
                 <td align="right" style="border-top:#000000 solid 1px;border-bottom:#000000 solid 1px;" height="21"><span class="print_text"><b><? $net_amt = ($total_amount+round($total_amount*0.02));echo $net_amt;?>&nbsp;</b></span></td>
             </tr>      
         </table>        
     </td>
 </tr>
 <tr>
 	<td colspan="2" class="print_text" style="border-bottom:#000000 solid 1px;"><?=no_to_words($net_amt)?>&nbsp;Only</td>            
 </tr>
 <tr>
 	<td class="print_text" valign="top">Delivery At :<br/>
     	<span><?=$buyeraddress?></span><br/>
         <span><?=$buyercountry?></span>
     </td>
     <td style="padding-top:40px;" align="center"><span class="print_text"><b>For MAHIMA PURESPUN</b></span><br/>
     											 <span class="print_text">(A Unit of Mahima Fibres Pvt. Ltd.)</span><br/>
                                                  						
     </td>
 </tr>
 <tr>
 	<td class="print_text" style="padding-top:35px;">
     	<span>Prepared By</span>
         <span style="padding-left:150px;">Checked By</span>
function no_to_words($no)
{
    global $words;
    if ($no == 0) {
        return ' ';
    } else {
        $novalue = '';
        $highno = $no;
        $remainno = 0;
        $value = 100;
        $value1 = 1000;
        while ($no >= 100) {
            if ($value <= $no && $no < $value1) {
                if (isset($words["{$value}"])) {
                    $novalue = $words["{$value}"];
                }
                $highno = (int) ($no / $value);
                $remainno = $no % $value;
                break;
            }
            $value = $value1;
            $value1 = $value * 100;
        }
        if (array_key_exists("{$highno}", $words)) {
            return $words["{$highno}"] . " " . $novalue . " " . no_to_words($remainno);
        } else {
            $unit = $highno % 10;
            $ten = (int) ($highno / 10) * 10;
            return $words["{$ten}"] . " " . $words["{$unit}"] . " " . $novalue . " " . no_to_words($remainno);
        }
    }
}