
PK 
<?php
include "includes/dbconnect.php";
include "includes/functions.php";
//$sqlu="SELECT * FROM signature WHERE user_id='$_SESSION[user_id]'";
$sqlu="SELECT * FROM signature WHERE user_id='1'";
$resultu=mysql_query($sqlu) or die('error in fetch');
$rowu=mysql_fetch_array($resultu);
?><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.<?
//echo $_SESSION['city'];
//if($_SESSION['city']=="ludhiana")
$city="ludhiana";
if($city=="ludhiana")
{
echo "LDH";
}
else if($_SESSION['city']=="amritser")
{
echo "ASR";
}
//$sqlu="SELECT * FROM signature WHERE user_id='$_SESSION[user_id]'";
$sqlu="SELECT * FROM signature WHERE user_id='1'";
$resultu=mysql_query($sqlu) or die('error in fetch');
$rowu=mysql_fetch_array($resultu);
?>/<?php echo"$_POST[invoiceid]";?>/<? echo $rowu['year'];?></strong></td>
<td align="right"><strong>Invoice Date. <?php echo"$_POST[dat]"; ?></strong></td></tr>
<tr>
<td colspan="2"><br>
<?php
if($_POST['ajtname']=='0')
{
$sql="SELECT headname,headaddress,headphone FROM head WHERE headid='$_POST[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 ajid='$_POST[ajtname]'";
$resulto=mysql_query($sqlo) or die('error in fetch');
while($rowo=mysql_fetch_array($resulto))
{
echo "<strong>{$rowo['ajcomp']}</strong><br>{$rowo['ajaddress']}";
}
}
?>
</td>
</tr>
<tr ><td colspan="2" align="center" class="printo"><strong style="float:left;">Certificate no.<?
//echo $_SESSION['city'];
//if($_SESSION['city']=="ludhiana")
$city="ludhiana";
if($city=="ludhiana")
{
echo "LDH";
}
else if($_SESSION['city']=="amritser")
{
echo "ASR";
}
?>/<?php echo"$_POST[certno]";?>/<? echo $rowu['year'];?></strong><strong>Particulars</strong></td>
<td align="center" class="printo"><strong>Amount</strong></td>
</tr>
<tr><td class="printo"> <?php if(isset($_POST['particular'])){echo $_POST['particular'];} ?><br />
<br><strong> Container No.</strong><br> <?php if(isset($_POST['vessel']) && $_POST['vessel']!=""){ echo $_POST['vessel']; } else{ echo $_POST['nameship']; };?><br><br> as per your<?php echo $_POST['invoice']; ?> </td>
<td width="20%" align="left" valign="top" bordercolor="#000000" class="printo"><br>
<br><strong> Destination Port.</strong><br> <?php echo"$_POST[declentry]";?><br><br></td>
<td width="26%" align="right" class="printo">
<br>Rs. <?php echo"$_POST[amount]";?>/-<br><br></td></tr>
<tr><td colspan="3" class="printo"><?php
if($_POST['ajtname']!='0')
{
$clntid = $_POST['clntid'];
$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']}";
}
}
?>
<tr><td align="right" colspan="2" class="printo">Discount:<i>(<?php if($_POST['discount']=='0'){echo"n/a";} else {echo $_POST['discount'] ."%";} ?>)</i></td>
<td align="right" class="printo">
<?php if($_POST['discount']!='0'){
$fdiscount=$_POST['amount']*$_POST['discount']/100;
echo"Rs. $fdiscount /-";
}
else {
echo "n/a";
}?></td></tr>
<tr><td colspan="2" align="right" class="printo">ServiceTax :<i>(<?php if($_POST['stax']=='yes'){echo $_POST['srtax'] ."%";} else {echo "n/a";}?>)</i></td>
<td colspan="2" align="right" class="printo">
<?php if($_POST['stax']=='yes'){
$fgrandtotal=$_POST['amount']-$fdiscount;
$staxnet=$fgrandtotal*$_POST['srtax']/100;
echo"Rs. $staxnet /-";
}
else {
$staxnet=0;
echo "n/a";
}?></td></tr>
</td></tr>
<?php
$fgrandtotal=$_POST['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($_POST['stax']=='yes'){
$srtax= $_POST['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. AAIFP 5255A </br> SERVICE TAX NO: AAIFP 5255AST001 <br>
E. & O E.</td></tr>
<tr><td width="50%"></td><td align="right" width="50%">for PEST CONTROL & FUMIGATION COMPANY</td></tr>
<tr><td width="50%"></td><td align="right" width="50%"><br><br>Authorised Signatory</td></tr></table>
</body>
<html>


PK 99