Results 1 to 2 of 2

Thread: help w/pagebreak

  1. #1
    Join Date
    May 2014
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default help w/pagebreak

    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


    Code:
    <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>

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •