I've managed to fill an HTML table with user queries from PostgreSQL without problem, the thing is that when I make the Query on the PostgreSQL database directly it shows the complete records according to the Query but when I do it in my PHP and fill an HTML with it it doesn't show the first one
For example I have 500 records and I want them in DESC order
It should show:
500
499
498
...
But it shows:
499
498
497
...
So its 'jumping' the first record always, with every query I call
What could it be? Obviously I need all the records.
Here is the code I'm using to run the query($sql1) and $conexion is the connection to my postgresql db:
$rs =odbc_exec($conexion, $sql1);
$nr =odbc_result($rs, 1);
if(!empty($nr)){
print "
<table width='992' border='1' class='Gtable'>
<tr>
<td width='46' bgcolor='#EEEDE8'><strong>Codigo<strong</td>
<td width='46' bgcolor='#EEEDE8'><strong>Matricula</strong></td>
<td width='100' bgcolor='#EEEDE8'><strong>Municipio</strong></td>
<td width='150' bgcolor='#EEEDE8'><strong>Barrio</strong></td>
<td width='80' bgcolor='#EEEDE8'><strong>Concepto</strong></td>
<td width='50' bgcolor='#EEEDE8'><strong>Tipo Susp.</strong></td>
<td width='200' bgcolor='#EEEDE8'><strong>Observacion</strong></td>
<td width='156' bgcolor='#EEEDE8'><strong>Cliente</strong></td>
<td width='151' bgcolor='#EEEDE8'><strong>Direccion</strong></td>
<td width='151' bgcolor='#EEEDE8'><strong>Telefono</strong></td>
<td width='151' bgcolor='#EEEDE8'><strong>F.Grabacion</strong></td>
<td width='151' bgcolor='#EEEDE8'><strong>Planificacion</strong></td>
<td width='151' bgcolor='#EEEDE8'><strong>Inicio</strong></td>
<td width='151' bgcolor='#EEEDE8'><strong>Finalizacion</strong></td>
<td width='151' bgcolor='#EEEDE8'><strong>Efectiva</strong></td>
<td width='151' bgcolor='#EEEDE8'><strong>Descripcion de Cierre</strong></td>
<td width='151' bgcolor='#EEEDE8'><strong>Contratista</strong></td>
<td width='151' bgcolor='#EEEDE8'><strong>Empleado</strong></td>
<td width='151' bgcolor='#EEEDE8'><strong>F.Cierre</strong></td>
<td width='151' bgcolor='#EEEDE8'><strong>Genero</strong></td>
<td width='151' bgcolor='#EEEDE8'><strong>Cerro</strong></td>
</tr>";
while($result =odbc_fetch_array($rs)){
print "<tr>
<td align='left' valign='top'>".$result['cod_otrb']."</td>
<td align='left' valign='top'>".$result['cod_pred']."</td>
<td align='left' valign='top'>".$result['descripcion']."</td>
<td align='left' valign='top'>".$result['brdesc']."</td>
<td align='left' valign='top'>".$result['tqdesc']."</td>
<td align='left' valign='top'>".$result['cod_ttrb']."</td>
<td align='left' valign='top'>".$result['spdesc']."</td>
<td align='left' valign='top'>".$result['prnombre']."</td>
<td align='left' valign='top'>".$result['direccion']."</td>
<td align='left' valign='top'>".$result['telefono']."</td>
<td align='left' valign='top'>".$result['fecha_grab']."</td>
<td align='left' valign='top'>".$result['fecha_pla']."</td>
<td align='left' valign='top'>".$result['fecha_ini_trb']."</td>
<td align='left' valign='top'>".$result['fecha_pre_cierre']."</td>
<td align='left' valign='top'>".$result['efectiva']."</td>
<td align='left' valign='top'>".$result['otdesc']."</td>
<td align='left' valign='top'>".$result['ctnombre']."</td>
<td align='left' valign='top'>".$result['emnombre']."</td>
<td align='left' valign='top'>".$result['fecha_cierre']."</td>
<td align='left' valign='top'>".$result['usr_genera']."</td>
<td align='left' valign='top'>".$result['usr_cierra']."</td>
";
}
print"</table>";
}else{
print "<font color='#CC3333'><strong>No Hay Registros</strong></font>";
}
Your problem (as pointed out by #Sean in the comments) is that this line:
$nr =odbc_result($rs, 1);
is reading the first row from the result set and you are not outputting the data from that row. To work around this I would recommend an if ... do ... while structure:
if ($result = odbc_fetch_array($rs)) {
// output the table headers here
do {
// output the row data
} while ($result = odbc_fetch_array($rs));
}
else {
// no data to output
}
Related
I have this build up HTML table that I want to convert into Excel spreadsheet but it happens to show the amount thousands separator and the 2 decimal as the PHP function number_format specifies. in short like for 100.00 in Excel I am having 100
$OutputExcel = "
<h3 align='center'>$COMPANYNAME</h3>
<table class='tblNemoList' border='0' cellpadding='2' cellspacing='0' width='100%' style='-fs-table-paginate: paginate;'>
<caption align='left'><b>Detailed Horse Charges</b></caption>
<thead>
<tr>
<th align='left'>#</th>
<th align='left'>No</th>
<th align='left'>Horse Name</th>
<th align='left'>Description</th>
<th align='left'>Date</th>
<th align='left'>Amount</th>
</tr>
</thead>
";
$i = 0;
while($row = $xdb->fetch_object($rowHorseCharges))
{
//ini
$i++;
$OutputPDF .= "
<tr >
<td>$i</td>
<td>".$row->No."</td>
<td>".$row->strHorse."</td>
<td>".$row->Description."</td>
<td>".$row->Date."</td>
<td align='right'>".number_format($row->Amount,2,'.',',')."</td>
</tr>
";
$OutputExcel .= "
<tr >
<td align='left' >$i</td>
<td align='left' >".$row->No."</td>
<td align='left' >".$row->strHorse."</td>
<td align='left' >".$row->Description."</td>
<td align='left' >".$row->Date."</td>
<td align='right' >".number_format($row->Amount,2,'.',',')."</td>
</tr>
";
}
$OutputPDF .= "
<tr><td colspan='6' style='border-bottom:1px solid black;'></td></tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td align='right' ><b>Tota: ".number_format($rowTotal->Total,2,'.',',')."</b></td>
</tr>
</table>";
$OutputExcel .= "
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td align='right' ><b>Total: ".number_format($rowTotal->Total,2,'.',',')."</b></td>
</tr>
</table>
";
I am converting it using this
switch($Action){
case "Clear":
break;
case "Export Excel":
include_once("reports/". $_REQUEST[radReport] .".php");
header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=". $strFilename .".xls"); //gets set inside the report.rpt.php
header("Pragma: no-cache");
header("Expires: 0");
echo $OutputExcel;
die;
break;
case "ExportPDF":
include_once("reports/". $_REQUEST[radReport] .".php");
ini_set('display_errors', '0');
header("Content-type: application/pdf");
require_once('includes/mpdf/mpdf.php');
$mpdf = new mPDF('utf-8', $format ,9,'Arial');
$mpdf->setHTMLHeader(getPDFHeader($COMPANYNAME));
$mpdf->setHTMLFooter(getPDFFooter());
if($orientation == 'P'){$mpdf->AddPage($orientation,'', '' ,'','',15,15,20,16,7,9);}else{$mpdf->AddPage($orientation,'', '' ,'','',30,30,30,30,18,12);}
$mpdf->WriteHTML($OutputPDF);
$mpdf->Output($strFilename."pdf", "I");
die;
break;
case "OpenPDF":
default:
$page->Content .= $Output
. js("d('". $_POST[radReport] ."').click(function())");
break;
}
You need to add CSS to your table page. Like so:
<style type='text/css'>
.num2d {
mso-number-format:"0\.00";
}
</style>
and then use that as a class to the <td> like so:
<td class="num2d">34</td>
I didn't make this up myself, but found it here:
http://cosicimiento.blogspot.nl/2008/11/styling-excel-cells-with-mso-number.html
So i am trying to send confirmation of an order via email. To do this i need to attach the body as a variable which is $body
So i have all my html code inside the $body. That part works great and it emails successfully.
However i need to loop out what ever was ordered so the customer knows what they ordered and what they paid for each item.
So here is the SQL query
// GET THE PRODUCTS THAT HAVE BEEN ORDERED
$w="SELECT
nfw_order_new_items.name,
nfw_order_new_items.qty,
nfw_order_new_items.price
FROM
nfw_order_new_items
WHERE
nfw_order_new_items.id_order = '$order_ID'";
$ww= mysql_query("$w") or die("Inv Rows ".mysql_error());
Then the body as an example, has my html in it. The $name, $qty and $price are where i want my loop to create the rows of the table depending on how many in the result. I have tried putting the loop outside body like below, but that doesnt work either. See below:
while(list($name,$qty,$price)= mysql_fetch_row($ww)){
$body = "<table width=\"80%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr style=\"font-size:12px; font-weight:bold; color:#FFF\">
<td width=\"111\" bgcolor=\"#333333\" style=\"padding-left:5px;\">Product Name:</td>
<td width=\"290\" bgcolor=\"#333333\">QTY:</td>
<td width=\"67\" align=\"center\" bgcolor=\"#333333\">Price Each</td>
<td width=\"121\" align=\"right\" bgcolor=\"#333333\" style=\"padding-right:5px; font-size:12px; text-align:right;\">Total Price</td>
</tr>
<tr>
<td style=\"padding-left:5px; font-size:12px;\">$name</td>
<td style=\"padding-left:0px; font-size:12px;\">$qty</td>
<td style=\"padding-left:0px; font-size:12px; text-align:center;\">$price</td>
</tr>
</table>"; }
You dont need to print the table header each time
you can do it like below
$body = "<table width=\"80%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr style=\"font-size:12px; font-weight:bold; color:#FFF\">
<td width=\"111\" bgcolor=\"#333333\" style=\"padding-left:5px;\">Product Name:</td>
<td width=\"290\" bgcolor=\"#333333\">QTY:</td>
<td width=\"67\" align=\"center\" bgcolor=\"#333333\">Price Each</td>
<td width=\"121\" align=\"right\" bgcolor=\"#333333\" style=\"padding-right:5px; font-size:12px; text-align:right;\">Total Price</td>
</tr>";
while(list($name,$qty,$price)= mysql_fetch_row($ww))
{
$body .= "<tr>
<td style=\"padding-left:5px; font-size:12px;\">$name</td>
<td style=\"padding-left:0px; font-size:12px;\">$qty</td>
<td style=\"padding-left:0px; font-size:12px; text-align:center;\">$price</td>
</tr>";
}
$body .= "</table>";
Try this code.
$body = "<table width=\"80%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr style=\"font-size:12px; font-weight:bold; color:#FFF\">
<td width=\"111\" bgcolor=\"#333333\" style=\"padding-left:5px;\">Product Name:</td>
<td width=\"290\" bgcolor=\"#333333\">QTY:</td>
<td width=\"67\" align=\"center\" bgcolor=\"#333333\">Price Each</td>
<td width=\"121\" align=\"right\" bgcolor=\"#333333\" style=\"padding-right:5px; font-size:12px; text-align:right;\">Total Price</td>
</tr>";
while(list($name,$qty,$price)= mysql_fetch_row($ww)){
$body .= "<tr>
<td style=\"padding-left:5px; font-size:12px;\">$name</td>
<td style=\"padding-left:0px; font-size:12px;\">$qty</td>
<td style=\"padding-left:0px; font-size:12px; text-align:center;\">$price</td>
</tr>
"; }
$body.="</table>";
I am trying for send mail using php.Mail body part contain data taken from database with while loop.It shows error.Error is Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) .Error shown in body part.Ie line $fet['date']; in body part.How i slve these issue? Can i send mail with these body contain html and php code?
I am trying for send mail using php.Mail body part contain data taken from database with while loop.It shows error.Error is Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) .Error shown in body part.Ie line $fet['date']; in body part.How i slve these issue? Can i send mail with these body contain html and php code?
My body part of mail is
$messag=echo "<table width='98%' border='0'
cellspacing='1' cellpadding='4' align='center' class='greyBorder' >
<tr class='blueBackground'>
<td width='4%' align='left' bgcolor='#4096AF'><strong>No.</strong></td>
<td width='20%' align='left' bgcolor='#4096AF'><strong>Date</strong></td>
<td width='20%' align='left' bgcolor='#4096AF'><strong>Sale</strong></td>
<td width='20%' align='left' bgcolor='#4096AF'><strong>Payment</strong></td>
</tr>
$si=1;
while($fet=mysql_fetch_array($sql3))
{
$className = ($className == 'evenRow')?'oddRow':'evenRow';
<tr class='$className'>
<td class='txt'> $si;</td>
<td class='txt'>
$fet['date'];
</td>
<td class='txt'>
$fet['total'];
</td>
<td class='txt'> $fet['net_amount'];
</td>
</tr>
$si=$si+1;
}
$className = ($className == evenRow)?oddRow:evenRow;
<tr align='right' class=' print $className'>
<td colspan='9'><table width='100%' border='0' cellspacing='0'cellpadding='0'>
<tr>
<td width='50%' align='center' class='txt'> $pagination </td>
</tr>
</table>
</td>
</tr>
</table>";
Anybody give any solution for thee issue?
You are using wrong syntex all code is coverd from quotes, so php can't parse it.
Try following code:
$message="<table width='98%' border='0'
cellspacing='1' cellpadding='4' align='center' class='greyBorder' >
<tr class='blueBackground'>
<td width='4%' align='left' bgcolor='#4096AF'><strong>No.</strong></td>
<td width='20%' align='left' bgcolor='#4096AF'><strong>Date</strong></td>
<td width='20%' align='left' bgcolor='#4096AF'><strong>Sale</strong></td>
<td width='20%' align='left' bgcolor='#4096AF'><strong>Payment</strong></td>
</tr>";
$si=1;
while($fet=mysql_fetch_array($sql3))
{
$className = ($className == 'evenRow')?'oddRow':'evenRow';
$message .="<tr class='$className'>
<td class='txt'> $si;</td>
<td class='txt'>
".$fet['date']."
</td>
<td class='txt'>
".$fet['total']."
</td>
<td class='txt'> ".$fet['net_amount']."
</td>
</tr>";
$si=$si+1;
}
$className = ($className == evenRow)?oddRow:evenRow;
$message .= "<tr align='right' class='".$className."'>
<td colspan='9'><table width='100%' border='0' cellspacing='0'cellpadding='0'>
<tr>
<td width='50%' align='center' class='txt'> ".$pagination." </td>
</tr>
</table>
</td>
</tr>
</table>";
I am using PHP mail() function to send the email. I have a table in the email with specific styles, but when I receeve the email, it does not show me the images and all style is disturbed.
My code is below:
$recipient = $_POST['Users']['email'];
$name = $_POST['Users']['first_name'];
$username = $_POST['Users']['username'];
$password = $_SESSION['password'];
$referrer_name = $model->referrer = $referrer_data['first_name'];
$referrer_email = $model->referrer = $referrer_data['email'];
// print_r($referrer_name);
// print_r($referrer_email);
$webstore = $this->base_url . "/" . Yii::app()->session['username'];
$headers = 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$subject = "Sign Up- Success";
$message = "<table width='700' border='0' align='center' cellpadding='0' cellspacing='0' class='bordermain'>
<tr>
<td align='center' valign='middle'> </td>
</tr>
<tr>
<td align='center' valign='middle'><table width='666' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td width='666' colspan='2' align='center' valign='top'><table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td width='50%' align='left' valign='middle'><img src='".$this->theme_baseurl."/images/karmora-websiteLogo.png' width='175' height='50' alt=''/></td>
<td width='50%' align='right' valign='middle'><table width='120' border='0' cellpadding='0' cellspacing='0'>
<tr>
<td width='30' align='center' valign='middle'><a href='http://www.facebook.com/' target='_blank'><img src='".$this->theme_baseurl."/images/facebook.jpg' alt='Facebook' width='25' height='25' title='Facebook'/></a></td>
<td width='30' align='center' valign='middle'><a href='http://www.twitter.com/' target='_blank'><img src='".$this->theme_baseurl."/images/twitter.jpg' alt='Twitter' width='25' height='25' title='Twitter'/></a></td>
<td width='30' align='center' valign='middle'><a href='http://www.pinterest.com/' target='_blank'><img src='".$this->theme_baseurl."/images/pintrest.jpg' alt='Pinterest' width='25' height='25' title='Pinterest'/></a></td>
<td width='30' align='center' valign='middle'><a href='http://www.youtube.com/' target='_blank'><img border='0' width='25' height='25' src='".$this->theme_baseurl."/images/youtube.jpg' alt='YouTube'/></a></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan='2' align='left' valign='middle'> </td>
</tr>
</table></td>
</tr>
<tr>
<td colspan='2' align='center' valign='top'><table width='100%' border='0' cellspacing='0' cellpadding='5'>
<tr>
<td align='center' valign='middle' bgcolor='#f9f9f9' style='border:1px solid #CCC;'><table width='99%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td><span class='mainheading'><strong>Congratulations</strong></span></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan='2' align='center' valign='top' bgcolor='#FFFFFF'><table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td height='20' align='center' valign='middle'></td>
</tr>
<tr>
<td align='center' valign='middle' class='bodytext'><table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>
<tr>
<td valign='top' style='border-top:2px solid #FF7D0F'> </td>
</tr>
<tr>
<td align='left' valign='middle' class='bodytext'><p class='headingpink'><strong>Dear '$name'</strong></p>
<p>Congratulations on your decision to become the newest member of <strong>'$referrer_name' </strong>Karmora Community!</p>
<p>Below you will find important information about your new Karmora Webstore. Please print or save this email in a safe location for future reference.</p>
<table width='400' border='0' cellspacing='0' cellpadding='5'>
<tr>
<td width='144'><strong><span class='bodytext'>Karmora URL</span></strong></td>
<td width='256'><strong><span class='bodytext'><a href='#'>'$webstore'</a></span></strong></td>
</tr>
<tr>
<td><strong><span class='bodytext'>User Name</span></strong></td>
<td><strong><span class='bodytext'>'$username'</span></strong></td>
</tr>
<tr>
<td><strong><span class='bodytext'>Password</span></strong></td>
<td><strong><span class='bodytext'>'$password'</span></strong></td>
</tr>
</table>
<p>Now it's time for you to start building your own personal Karmora Community where you can make money off the memberships and purchases of your Community members! Let’s get this party started!</p>
<p class='headingpink'><strong>7 BABY STEPS TO GOOD KARMORA™:</strong></p>
<ol>
<li>Click on your Karmora URL and log in to your back office to customize your Webstore. You will see 'Log In' in the upper right hand corner of your Webstore.</li>
<li>Click on the Profile button and upload your picture while in the profile section. We recommend recent pictures. Your customers will want to know that it is your Webstore!</li>
<li>Go to the Training Section and watch the Instructional Videos. You will find all kinds of information to help you with your Karmora Webstore. </li>
<li>Click on the eWallet button and create your eWallet. Instructions on how to do this are found in the Training Section of your back office.</li>
<li>Use Go Daddy to secure a domain name for your new Webstore and point the new domain to your Karmora Webstore URL above. Instructions on how to do this are found in the Training Section of your back office </li>
<li>Make your first official Karmora purchase.</li>
<li>Start sharing your new Webstore with everyone you speak to so they can begin a Karmora Community of their own. Once you have five active members in your Karmora Community your Webstore is basically FREE!</li>
</ol>
<p>If you have any questions please don’t hesitate to contact <strong>'$referrer_name' </strong>by email at <a href='mailto:$referrer_email'>'$referrer_email'</a> or simply <u><a href='http://karmora.com/liveSupport'>click here</a></u> to chat with a Good Karmora™ Specialist seven days a week from 7am to 7pm Pacific Time. </p>
<p>As always we wish you Good Luck, Good Fortune and Good Karmora™! </p>
<p> </p>
</td>
</tr>
<tr>
<td align='left' valign='middle' style='border-bottom:2px solid #FF7D0F'> </td>
</tr>
</table></td>
</tr>
<tr>
<td align='center' valign='middle' class='bodytext'> </td>
</tr>
</table></td>
</tr>
<tr>
<td width='50%' height='70' align='center' valign='middle' bgcolor='#000000' class='footertextwhite' style='border-top:2px solid #de3277; border-bottom: 2px solid #de3277'><table width='90%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td height='40' align='left' valign='middle'><a href='http://karmora.com/contact' class='a1'>Contact Us<br />
</td>
</tr>
</table></td>
<td width='50%' height='70' align='center' valign='middle' bgcolor='#000000' class='footertextwhite' style='border-top:2px solid #de3277; border-bottom: 2px solid #de3277'><table width='90%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td height='40' align='right' valign='middle'><a href='http://www.karmora.com/liveSupport/'><img src='".$this->theme_baseurl."/images/live_support_icon_03.png' width='110' height='32' /></a><br />
<span class='footertext'>© 2013 Karmora</span></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan='2' align='center' valign='top'> </td>
</tr>
</table></td>
</tr>
</table>";
mail($recipient, $subject, $message,$headers);
You can put your styles inline in your elements
<p style="color:#000">...</p>
And you should use the PHP header
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
The reason you cannot use css other than inline and you are best advised to use table based layouts is that some if not most of the email clients such as outlook for example have VERY VERY old version of the browser embeded in them to show an html email.
So unfortunately all email has to be created like we were back in the days of IE6 or before.
As to your images not showing that is because you have to remember when the email is being read it is not a page on your website, so any images must have a fully defined domain and path like src="http://www.yoursite.net/images/facebook.jpg
I am unable to find any post which has answer to my issue.
I have html file which has a table, need to convert this to a text file without losing the format USING php script, as it has to be printed as is on a dotmatrix printer.
OR if there is any other way of doing this, pl suggest !
The table is a Invoice format, pl see below:
<table width='100' height='300' border='0' cellspacing='0' cellpadding='1'> <tr> <td><img src='spacer.jpg' width='100' height='1'></td> <td><table width='840' border='1' cellspacing='2' cellpadding='0'><tr><td width='660' colspan='2' valign='top'><br><br><br><br><br><br><br><br><br>Customer Name: 3M India Ltd<br>
Address:Plat 48-51 Electronic City<br><br></td><td width='180' valign='top'><br><br><br><br><br><br><br><br><br>
Inv No: 78788<br><br>Date: 20/04/2012 12:28:18<br><br>
</td> </tr> <tr> <td width='292' valign='top'>DC Nos: 500, <br><br></td><td valign='top'> Your Order No.: 322<br>
C.E.Reg No.: <br>
Vehicle No.: KA-01-N-2345<br><td valign='top'> Party:<br>
TIN: 29400127541<br>
CST: 29400127541<br></td> </tr> <tr> <td colspan='2'>Sl No. Description Tariff Code Rate Qty </td> <td>Amount</td> </tr> <tr> <td colspan='3'> <table width='840' height='160' border='0' cellspacing='1' cellpadding='0'> <tr valign='top'> <td width='87'>1</td> <td width='247'>Argon</td> <td width='165'>AR1223</td> <td width='92'>120</td> <td width='67'>1 Nos</td> <td width='182'>120.00</td> </tr> </table> </td> </tr> <tr> <td colspan='2' valign='top'><div align='right'><br>VAT: 5.00 %<br>Demurrage: <br> Freight: <br><br> </div>Rupees Four Hundred & Fourty One Only.</td><td valign='top'><br> 21.00<br> 0.00<br> 300.00<br><br> </td> </tr> <tr> <td colspan='2' valign='top'><div align='right'>Total:<br><br>Rounded Off</div></td> <td valign='top'>441.00<br><br>441.00<br><br></td> </tr></table> </td> </tr></table>
Could you not open the HTML file in something like Microsoft Word and then send it to print?
You could also convert the HTML file to PDF, there's several free ones (Google "html to pdf conversion") as another option to see if it works.