
PK 
<?php
session_start();
require_once 'common/common.php';
require_once 'common/secure.php';
include "head.php";
?>
<head>
<style type="text/css">
.printo {
border:solid
}
</style>
</head>
<br><br>
<body onLoad="window.print(); window.close();">
<table width="95%">
<tr>
<td height="45" colspan="3" align="center">
<center> <h3>INVOICE </h3></center></td></tr>
<td align="left" colspan="2"><strong>Invoice no.LDH/<?php echo"$certno";?>/08-09</strong></td>
<td align="right"><strong><?php echo"$dat"; ?></strong></td></tr>
<tr>
<td colspan="2"><br>
<?php
include("connexion.php");
if($ajtname=='0')
{
$sql="SELECT headname,headaddress,headphone FROM head WHERE headid='$clntid'";
$result=mysql_query($sql) or die('error in fetch');
while($row=mysql_fetch_array($result))
{
echo "<strong>M/S {$row['headname']}</strong><br>{$row['headaddress']}";
}
}
else
{
$sqlo="SELECT ajname,ajcomp,ajaddress FROM ajent WHERE ajcomp='$ajtname'";
$resulto=mysql_query($sqlo) or die('error in fetch');
while($rowo=mysql_fetch_array($resulto))
{
echo "<strong>M/S {$rowo['ajcomp']}</strong><br>{$rowo['ajaddress']}";
}
}
?>
</td>
</tr>
<tr ><td colspan="2" align="center" class="printo"><strong>Particulars</strong></td>
<td align="center" class="printo"><strong>Amount</strong></td>
</tr>
<tr><td class="printo"> <?php echo"$particular"; ?><br />
<br><strong> Container No.</strong><br> <?php echo"$vessel";?><br><br> as per your <?php echo"$invoice";?> </td>
<td width="20%" align="left" valign="top" bordercolor="#000000" class="printo"><br>
<br><strong> Destination Port.</strong><br> <?php echo"$destinat";?><br><br></td>
<td width="26%" align="right" class="printo">
<br>Rs. <?php echo"$amount";?>/-<br><br></td></tr>
<tr><td colspan="3" class="printo"><?php
if($ajtname!='0')
{
$sql="SELECT headname,headaddress,headphone FROM head WHERE headid='$clntid'";
$result=mysql_query($sql) or die('error in fetch');
while($row=mysql_fetch_array($result))
{
echo " A/C {$row['headname']}";
}
}
?></td></tr>
<tr><td align="right" colspan="2" class="printo">Discount:<i>(<?php if($discount=='0'){echo"n/a";} else {echo "$discount %";} ?>)</i></td>
<td align="right" class="printo">
<?php if($discount!='0'){
$fdiscount=$amount*$discount/100;
echo"Rs. $fdiscount /-";
}
else {
echo "n/a";
}?></td></tr>
<tr><td colspan="2" align="right" class="printo">ServiceTax :<i>(<?php if($stax=='yes'){echo"$srtax %";} else {echo "n/a";}?>)</i></td>
<td colspan="2" align="right" class="printo">
<?php if($stax=='yes'){
$fgrandtotal=$amount-$fdiscount;
$staxnet=$fgrandtotal*$srtax/100;
echo"Rs. $staxnet /-";
}
else {
$staxnet=0;
echo "n/a";
}?></td></tr>
</td></tr>
<?php
$fgrandtotal=$amount-$fdiscount;
$finalone=$fgrandtotal+$staxnet;
$finalone=number_format($finalone, 0);
$patterns[0] = "/,/";
$replacements[0] = "";
$finalone= preg_replace($patterns, $replacements, $finalone);
?>
<tr>
<?php
function num2text($num)
{
if(!ctype_digit((string)$num))
{
user_error("num2text(): supplied arg is not an integer value.",
E_USER_WARNING);
return FALSE;
}
if($num < 1)
{
user_error("num2text(): supplied arg must be a positive integer.",
E_USER_WARNING);
return FALSE;
}
$words = array(
'digits' => array(
1 => 'one','two','three','four','five','six','seven','eight','nine',
'ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen',
'seventeen','eighteen','nineteen'
),
'tens' => array(
20 => 'twenty', 30 => 'thirty', 40 => 'forty', 50 => 'fifty',
60 => 'sixty', 70 => 'seventy', 80 => 'eighty', 90 => 'ninety'
)
);
switch(TRUE)
{
case ($num < 20):
$text = $words['digits'][$num];
break;
case ($num < 100):
$tens = floor($num/10) * 10;
$digits = $num % 10;
$text = $words['tens'][$tens];
if($digits)
{
$text .= '-'.$words['digits'][$digits];
}
break;
case ($num < 1000):
$hundreds = floor($num/100);
$text = $words['digits'][$hundreds].' hundred ';
$remainder = $num % 100;
if($remainder)
{
$text .= num2text($remainder);
}
break;
case ($num < 1000000):
$thousands = floor($num/1000);
$remainder = $num % 1000;
$text = num2text($thousands).' thousand ';
if($remainder)
{
$text .= num2text($remainder);
}
break;
case ($num < 1000000000):
$millions = floor($num/1000000);
$remainder = $num % 1000000;
$text = num2text($millions).' million ';
if($remainder)
{
$text .= num2text($remainder);
}
break;
default:
user_error("num2text(): value entered is > 999,999,999",
E_USER_WARNING);
return FALSE;
}
return(trim($text));
}
// TEST:
$test = array($finalone);
foreach($test as $num)
{
$result = num2text($num);
if($result === FALSE) { $result = 'FALSE'; }
echo "<td align=left colspan=2 class=printo><b> Rupees $result Only/-</b>\n</td>";
}
?>
<td align="right" class="printo">Rs. <?php echo"<strong>$finalone</strong>";?>/-
</td></tr>
<?php if($stax=='yes'){
$srtax="$srtax";
}
else {
$srtax=0;
}?>
</table><br />
<table width="95%"><tr><td colspan="2">All Payments to be made A/c Payee cheque /D.D only</td></tr>
<tr>
<td colspan="2">PAN NO. AAIFP5255A Subject to Amritsar jurisdiction<br>
E. & O E.</td></tr>
<tr><td width="50%"></td><td align="right" width="50%">for UNIVERSAL FUMIGATION SERVICES</td></tr>
<tr><td width="50%"></td><td align="right" width="50%"><br><br>Authorised Signatory</td></tr></table>
</body>


PK 99