<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Print Invoice</title>
        <style type="text/css">
            <!--
            .style2 {
                font-family: Arial, Helvetica, sans-serif;
                font-size: 14px;
            }
            .style4 {
                font-size: 14px;
                font-weight: bold;
            }
            .style5 {
                font-size: 18px;
                font-weight: bold;
            }
            .style6 {
                font-size: 24px;
                font-weight: bold;
            }
            .style7 {font-size: 24px}

            .style8 {
                font-size: 18px;
                font-weight: bold;
            }

            .style10 {
                font-size: 18px;
                font-weight: bold;
            }
            -->

        </style>
    </head>




    <body>

        <?php
        include './connection_sql.php';

        $sql2 = "SELECT * FROM invpara LIMIT 1;";

        foreach ($conn->query($sql2) as $row3) {
    
            $sql1 = "SELECT * FROM dag_transfer where REFNO= '" . $_GET["Transfer_No"] . "'";

            foreach ($conn->query($sql1) as $row2) {

                echo '
                        <center>
                        <table width = "1000" border = "0">
                        <tr>
                        <td height = "50" colspan = "3"><span class = "style6">' . $row3['COMPANY'] . '</span><br />
                        <span class = "style8"> </span>
                        </td>
                        <td colspan = "4" align = "center"><table width = "500" border = "0">
                        <tr>
                        <td width = "402"><span class = "style8">' . $row3['ADD1'] . ', ' . $row3['ADD2'] . ', ' . $row3['ADD3'] . '</span></td>
                        </tr>
                        <tr>
                        <td><span class = "style8">' . $row3['TELE'] . '</span></td>
                        </tr>
                        </table></td>
                        </tr>
                        <tr>
                        <td height = "44" colspan = "3" align = "right"><span class = "style6"><u>TRANSFER - INVOICE</u></span></td>
                        <td width = "55" height = "44" align = "center">&nbsp;
                        </td>
                <!--        <td width = "171" align = "left">Sales Ex : Office</td> 
                        <td width = "80" align = "right">Entered By: </td>
                        <td width = "186">gayal</td>
                        </tr> -->
                        <tr>
                        <td height = "110" colspan = "3" valign = "top"><table border = "1" bordercolor = "#000000" cellpadding = "0" cellspacing = "0"><tr><td width = "428"><table width = "500" border = "0" >
                        <tr>
                        <td width = "91"><span class = "style4">Suppler</span></td>
                        <td width = "8"><strong>:</strong></td>
                        <td width = "443"><span class = "style5">' . $row2['SUP_NAME'] . '</span></td>
                        </tr>
                        <tr>
                        <td width = "91"><span class = "style4">Suppler Code</span></td>
                        <td width = "8"><strong>:</strong></td>
                        <td width = "443"><span class = "style5">' . $row2['SUP_CODE'] . '</span></td>
                        </tr>
                        <tr>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td></td>
                        </tr>
                        <tr>
                        <td height = "21">&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td></td>
                        </tr>
                        <tr>
                        <td height = "21">&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td></td>
                        </tr>
                        </table></td></tr></table></td>
                        <td colspan = "4" valign = "top"><table border = "1" bordercolor = "#000000" cellpadding = "0" cellspacing = "0"><tr><td><table width = "500" border = "0">
                        <tr>
                        <td width = "108"><span class = "style4">INV. NO</span></td>
                        <td width = "9">:</td>    
                        <td width = "146"><span class = "style8">' . $row2['REFNO'] . '</span></td>
                 <!--           <td width = "82"><span class = "style4">P. O. NO.</span></td>
                        <td width = "12">:</td>
                        <td width = "201"></td>     -->
                        </tr>
                        <tr>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        </tr>
                        <tr>
                        <td height = "21"><span class = "style4">INV. DATE</span></td>
                        <td>:</td>
                        <td><span class = "style8">' . $row2['SDATE'] . '</span></td>
   <!--                     <td><span class = "style4">VEH. NO.</span></td>
                        <td>:</td>
                        <td></td>    -->
                        </tr>


                        </table></td></tr></table>
                        <span class = "style2"> </span></td>
                        </tr>
                        </table>
                        <table width = "1000" height = "21" border = "0" cellspacing = "0">
                        <!--<tr bgcolor = "#999999">
                        <td width = "130" height = "23"><span class = "style1">STK No</span></td>
                        <td width = "295"><span class = "style1">Description</span></td>
                        <td width = "158"><span class = "style1">Rate</span></td>
                        <td width = "135"><span class = "style1">Quantity</span></td>
                        <td width = "152"><span class = "style1">Sub Total</span></td>
                        </tr> -->
                        <tr>
                        
                        <td width = "100" align = "left"><table border = "1" width = "100" cellspacing = "0"><tr><td><span class = "style4"><u>ITEM NO.</u></span></td></tr></table></td>
                        <td width = "500" align = "left"><table border = "1" width = "500" cellspacing = "0"><tr><td><span class = "style4"><u>DESCRIPTION</u></span></td></tr></table></td>
                        <td width = "160" align = "right"><table border = "1" width = "160" cellspacing = "0"><tr><td align = "right"><span class = "style4"><u>Serial</u></span></td></tr></table></td>
                        <td width = "160" align = "right"><table border = "1" width = "160" cellspacing = "0"><tr><td align = "right"><span class = "style4"><u>Amount</u></span></td></tr></table></td>
                        </tr> ';


                    $sqlrow = "SELECT * FROM dag_transfer_item where REFNO= '" . $_GET["Transfer_No"] . "'";

                    $tot = 0;
                    
                    foreach ($conn->query($sqlrow) as $row5) {
                       
                        
                        
                        $tot = $tot + $row5['RATE'];
                    echo '
                        <tr>
                        <td><span width = 100 class = "style10">' . $row5['STK_NO'] . '</span></td>
                        <td><span width = 500 class = "style10">' . $row5['DESCRIPT'] . '</span></td>
                            
                        <td align = "right" width = 150><span class = "style10">' . $row5['serial_no'] . '</span></td>
                        <td align = "right" width = 150><span class = "style10">' . $row5['RATE'] . '</span></td>
                        
                      
                       </span></td><td align = "right"><span class = "style"></span></td>
                        </tr>
                 ';

                }


                    echo '


                    
                        <tr><td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td></tr><tr><td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td></tr><tr><td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        
                        </td></tr><tr><td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td></tr>

                        </table>
                        <table width = "1000" border = "0">


                        <tr>
                        <td colspan = "4">
                        </td>
                        <td width = "105"></td>
                        <td width = "51">&nbsp;
                        </td>
                        <td width = "144" align = "right"></td>
                        <td width = "288" align = "right">&nbsp;
                        </td>
                        </tr>
                        <tr>
                        <td colspan = "4">
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td align = "right">&nbsp;
                        </td>
                        <td align = "right">&nbsp;
                        </td>
                        </tr>
                        <tr>
                        <td width = "80">&nbsp;
                        </td>
                        <td colspan = "3"><span class = "style6">CP</span></td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>
                        </td>
                        <td align = "right"><table width = "250" border = "0">
                        <tr>
                        <td width = "175" align = "right"></td>
                        <td width = "66">&nbsp;
                        </td>
                        </tr>
                        </table>
                        </td>
                        </tr>
                        <tr>
                        <td>__________</td>
                        <td width = "98">&nbsp;
                        </td>
                        <td width = "96">____________</td>
                        <td width = "104">&nbsp;
                        </td>
                        <td>____________</td>
                        <td></td>
                        <td align = "right">&nbsp;
                        </td>
                        <td align = "right"><b>
                        <span class = "style7"> </span></b>
                        <table width = "250" border = "0">
                        <tr>
                        <td width = "175" align = "right"><b><span class = "style7">
                        ' . $tot . '</span></b></td>
                        <td width = "62">&nbsp;
                        </td>
                        </tr>
                        </table>
                        </td>
                        </tr>
                        <tr>
                        <td>Checked By</td>
                        <td>&nbsp;
                        </td>
                        <td>Suppler</td>
                        <td>&nbsp;
                        </td>
                        <td>Deliverd By</td>
                        <td></td>
                        <td align = "right">Printed By:ADMIN </td>
                        <td align = "right"></td>
                        </tr>
                        <tr>
                        <td colspan = "4">Credit Period : 65 Days</td>
                        <td>&nbsp;
                        </td>
                        <td></td>
                        <td align = "right">&nbsp;
                        </td>
                        <td align = "right">&nbsp;
                        </td>
                        </tr>
                        </table>

                        </body>
                        </html>
                        ';
                }
            }
            ?>
        </body>
</html>