Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2009
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Report pagination

    i need help please having a problem to put a page break in my report I have a long very long one page report I need to break in pages and is not each row a report is a table with fields so I would said page break with in beweent tables.

    here is my code I will apreaciate is some give a clue or help me to untangle this
    thanks

    PHP Code:
    <?php

    if ($f_FromDate != "") {
        
    $AndFromDate " and t.SERVE_DATE>='$f_FromDate' ";
    }

    if (
    $f_ToDate != "") {
        
    $AndToDate " and t.SERVE_DATE<='$f_ToDate' ";
    }


    if (!
    $f_print) {
    include (
    "admin_common_header.php");

    echo 
    "<center><font color=blue size=+2>Admin!Report(AM Class)</font></center><hr>";
    echo 
    "
    <form action=admin_report_amclass.php method=post>
    <input type=hidden name=f_Admin value=$f_Admin>
    <table>
    <tr>
    <td>From Date:</td>
    <td><input type=text name=f_FromDate size=10 value=$f_FromDate ></td>
    <td>To Date:</td>
    <td><input type=text name=f_ToDate size=10 value=$f_ToDate ></td>
    <td> <input type=submit name=Submit value='   Report   ' class=buttonstyle></td>
    </tr>
    <tr>
    <td colspan=5 width=400> <input type=checkbox name=f_print value=1><b>Print Friendly</b> --- Please check it if you are going to edit it in word. After the report is generated, select the entire report then copy and paste in word. The print-friendly report displays on the fly, wait for it is completely loaded before copy it to word.</td>
    </tr>
    </form></table><br>
    After you click the \"Report\" button, it will take a few minutes to generate the report. Please be patient.<hr>
    "
    ;

    }


    if ((
    $f_FromDate != "") || ($f_ToDate != "")) {

        
    $Q1 ibase_query ("select distinct(SERVE_DATE) from TRANS t inner join  STUDENT s on t.STUD_NO=s.STUD_NO where t.GENE=0 and t.ORDERED=1 $AndFromDate $AndToDate order by SERVE_DATE");
        while (
    $R1 ibase_fetch_row ($Q1)) {
            
            if (
    $R1[0]<>"") echo "<font size=+1 color=blue><center><b>Lunch Date: " date2d($R1[0]) . "</b></center></font><br>";
        
            
    $Q2 ibase_query ("select distinct(AM_ROOM) from STUDENT");
            while (
    $R2 ibase_fetch_row ($Q2)) {
                
    $buf "";                // table buffer
                
    $bufcount 0;
                
    //$Q3 = ibase_query ("select t.STUD_NO, LAST_NAME , FIRST_NAME, GRADE  from TRANS t inner join  STUDENT s on t.STUD_NO=s.STUD_NO where GENE=0 and ORDERED=1 and s.AM_ROOM='$R2[0]' and t.SERVE_DATE='$R1[0]' $AndFromDate $AndToDate group by t.STUD_NO, LAST_NAME, FIRST_NAME, GRADE order by SERVE_DATE, LAST_NAME, FIRST_NAME");
                
    $Q3 ibase_query ("select t.STUD_NO, s.LAST_NAME , s.FIRST_NAME, s.GRADE  from TRANS t inner join  STUDENT s on t.STUD_NO=s.STUD_NO where t.GENE=0 and t.ORDERED=1 and s.AM_ROOM='$R2[0]' and t.SERVE_DATE='$R1[0]' $AndFromDate $AndToDate group by t.STUD_NO, s.LAST_NAME, s.FIRST_NAME, s.GRADE order by t.SERVE_DATE, s.LAST_NAME, s.FIRST_NAME");

                
    $buf .= "<center><table border=1 cellspacing=0 cellpadding=5>
                       <tr><td colspan=3><b>AM Room: <font color=red>$R2[0]</font> --  Lunch Date: <font color=red>" 
    date2d($R1[0]) . "</font></td></tr>
                       <tr>
                        <td class=rowheader>Last Name</td>
                        <td class=rowheader>First Name</td>
                        <td class=rowheader>Order</td>

                       </tr>
    "
    ;

                while (
    $R3 ibase_fetch_row ($Q3)) {
                  echo 
    "test fetch Q3<br>";
                    if (
    $RowClass == "rowodd") {
                        
    $RowClass "roweven";
                    } else {
                        
    $RowClass "rowodd";
                    }
                    
    $buf .= "<td class=$RowClass width=100>$R3[1]</td>";
                    
    $buf .= "<td class=$RowClass width=100>$R3[2]</td>";    
                    
    $buf .= "<td class=$RowClass width=400>";
                    
    $Q4 ibase_query ("select DESCRIPTION, sum(QUANTITY) from TRANS where STUD_NO=$R3[0] and GENE=0 AND ORDERED=1 and SERVE_DATE='$R1[0]' group by DESCRIPTION order by DESCRIPTION");
                    while (
    $R4 ibase_fetch_row ($Q4)) {
                        
    $buf .= "<font color=blue>" sprintf("%1.d"$R4[1]) . "</font> <font color=red><b>X</b></font> $R4[0]<br>";
                    }
                    
    ibase_free_result ($Q4);

                    
    $buf .= "</td>";
                    
    $buf .= "</tr>";
                    
    $bufcount += 1;
                }

                
    ibase_free_result ($Q3);
                
    $buf .= "<tr><td class=rowheader colspan=3>Total</td></tr>";
                
    $Q3 =  ibase_query ("select t.DESCRIPTION, sum(t.QUANTITY) from TRANS t inner join STUDENT s on t.STUD_NO=s.STUD_NO where s.AM_ROOM='$R2[0]' and t.GENE=0 AND t.ORDERED=1 and t.SERVE_DATE='$R1[0]' group by DESCRIPTION order by DESCRIPTION");
                
    $buf .= "<tr><td colspan=3>";
                while (
    $R3 ibase_fetch_row ($Q3)) {
                    
    $buf .= "<font color=blue>" sprintf("%1.d"$R3[1]) . "</font> <font color=red><b>X</b></font> $R3[0]<br>";
                }
                
    $buf .= "</td></tr>";
                
    $buf .= "</table><br></center>";
                if (
    $bufcount) {
                    echo 
    $buf;
                }
                
    ibase_free_result ($Q3);
            }
            
    ibase_free_result ($Q2);
            echo (
    "<hr>");
        }
        
    ibase_free_result ($Q1);
        
    ibase_commit ();

    }

    if (!
    $f_print) {
    include (
    "admin_common_trailer.php");
    }
    ?>

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Did you take a look at google yet? search +php +pagination

  • #3
    New Coder
    Join Date
    Aug 2009
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I did and got it working with rows but not with tables.


  •  

    Posting Permissions

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