Log in

View Full Version : help w/pagebreak



12Strings
05-20-2014, 04:38 PM
Hi, I'm trying to print this doc with heading at top of each printed page,
page# at bottom of each page, thousands "," at "totdue" and without the
filename on each page. any help? Thanks



<html><head>
<style>
@page { size 8.5in 11in; margin: 2cm }
div.page { page-break-after: always }
</style>
</head><body><center>
<div class="page">
<?php
error_reporting(0);
mysql_connect('localhost','root','xxxxx');
mysql_select_db('homedb') or die("Unable to select database");
$query=" SELECT * FROM oocust WHERE payrec = 'R' AND pd = 'N' ORDER BY datepaid ASC";
$result=mysql_query($query);
$num=mysql_numrows($result);

echo date('m/d/y');
echo "<font size=+1><b><center> Accounts Receivable Report</font></center></b></b><br />";
?>
<table cellspacing=0 cellpadding=2 border=1>
<thead>
<tr>
<th colspan=4></th>
<th bgcolor="#ccffff">date</th>
<th bgcolor="#ccffff">days</th>
<th bgcolor="#ccffff">amt</th>
<tr>
<th bgcolor="#ccffff">recur?</th>
<th bgcolor="#ccffff">acct#</th>
<th bgcolor="#ccffff">creditor</th>
<th bgcolor="#ccffff">purpose</th>
<th bgcolor="#ccffff">due</th>
<th bgcolor="#ccffff">late</th>
<th bgcolor="#ccffff">due</th>
</tr>
<?php
while($row = mysql_fetch_array($result))
{
$totdue += $row['amtdue'];
echo '
<tr>
<td>', $row['status'], '</td>
<td>', $row['acctno'], '</td>
<td>', $row['bname'], '</td>
<td>', $row['purpose'], '</td>
<td>', $row['duedate'], '</td>
<td align=right class="currency">', ($late > 120 ? 'pastdue' : $row['dayslate']), '</td>

<td align=right class="currency">$'.number_format($row['amtdue'],2).'</td> // ****perfect****

</tr>';
}
echo '
<tr>
<th bgcolor="#ccffff" scope="row" colspan="6">Grand Total:</th>
// <td bgcolor="#FFD4D4" class="currency">$', number_format($totdue, 2, '.', ''), '</td>

<td align=right class="currency">$'. number_format('$totdue',2).'</td> // no thousands "," ***

</tr>
</table>';
echo "Page 1";
?>
</div>
<div class="page">
<?php
echo "Page 2";

mysql_close();
?>
</body></html>

jscheuer1
05-21-2014, 02:15 AM
Headings and footers of pages printed in web browsers are at the sole discretion of (when available) user settings in that browser which affect that. When settings are not available, defaults apply. Neither Server side (PHP) nor client side (javascript) code can change them. Formatting of totals on the pages themselves (appearing in the body of the page) can be achieved via PHP, javascript, and/or css.