Exemplo n.º 1
0
<table width="100%" border="0" cellpadding=0 cellspacing=0
	class="mainTable">
	<tr>
		<td class=separatorCell>&nbsp;</td>
	</tr>
</table>

<table width="100%" border="0" cellpadding=0 cellspacing=0
	class="mainTable">
	<tr>
		<td class="nobr">Товарная накладная имеет приложение на</td>
		<td style="width: 40%" class="underlined">&nbsp;</td>
		<td class="nobr">и содержит</td>
		<td style="width: 40%" class=underlined><b><?php 
echo KSFunctions::number2string($total_count, 1);
?>
</b></td>
		<td class="nobr">порядковых номеров записей</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td class="reportSmallFont cellComment">прописью</td>
		<td>&nbsp;</td>
	</tr>
</table>

<table width="100%" border="0" cellpadding=0 cellspacing=0
	class="mainTable">
Exemplo n.º 2
0
 public static function stringView($amount)
 {
     //разделить сумма на разряды: единицы, тысячи, миллионы, миллиарды (больше миллиардов не проверять :) )
     $n = round($amount, 2);
     $billions = floor($n / 1000000000);
     $millions = floor(($n - $billions * 1000000000) / 1000000);
     $grands = floor(($n - $billions * 1000000000 - $millions * 1000000) / 1000);
     $roubles = floor($n - $billions * 1000000000 - $millions * 1000000 - $grands * 1000);
     //$n % 1000;
     //копейки
     $kop = round($n * 100 - round(floor($n) * 100));
     //var_dump(array($n,$billions,$millions,$grands,$roubles,$kop));
     if ($kop < 10) {
         $kop = "0" . (string) $kop;
     }
     $s = "";
     if ($billions > 0) {
         $t = "ов";
         $temp = $billions % 10;
         if (floor($billions % 100 / 10) != 1) {
             if ($temp == 1) {
                 $t = "";
             } else {
                 if ($temp >= 2 && $temp <= 4) {
                     $t = "а";
                 }
             }
         }
         $s .= KSFunctions::number2string($billions, 1) . " миллиард{$t} ";
     }
     if ($millions > 0) {
         $t = "ов";
         $temp = $millions % 10;
         if (floor($millions % 100 / 10) != 1) {
             if ($temp == 1) {
                 $t = "";
             } else {
                 if ($temp >= 2 && $temp <= 4) {
                     $t = "а";
                 }
             }
         }
         $s .= KSFunctions::number2string($millions, 1) . " миллион{$t} ";
     }
     if ($grands > 0) {
         $t = "";
         $temp = $grands % 10;
         if (floor($grands % 100 / 10) != 1) {
             if ($temp == 1) {
                 $t = "а";
             } else {
                 if ($temp >= 2 && $temp <= 4) {
                     $t = "и";
                 }
             }
         }
         $s .= KSFunctions::number2string($grands, 0) . " тысяч{$t} ";
     }
     if ($roubles > 0) {
         $rub = "ей";
         $temp = $roubles % 10;
         if (floor($roubles % 100 / 10) != 1) {
             if ($temp == 1) {
                 $rub = "ь";
             } else {
                 if ($temp >= 2 && $temp <= 4) {
                     $rub = "я";
                 }
             }
         }
         $s .= KSFunctions::number2string($roubles, 1) . " рубл{$rub} ";
     }
     $kp = "ек";
     $temp = $kop % 10;
     if (floor($kop % 100 / 10) != 1) {
         if ($temp == 1) {
             $kp = "йка";
         } else {
             if ($temp >= 2 && $temp <= 4) {
                 $kp = "йки";
             }
         }
     }
     $s .= "{$kop} копе{$kp}";
     /*
     //теперь сделать первую букву заглавной
     if ($roubles>0 || $grands>0 || $millions>0 || $billions>0)
     {
     $cnt=0; while(substr($s, $cnt, 1)==" ") $cnt++;
     $s = substr($s, $cnt, 1);
     $s[$cnt] = chr( ord($s[$cnt])- 32 );
     }
     */
     return $s;
 }