<?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 GIN</title>
        <style type="text/css">
            <!--
            .companyname {
                color: #000000;
                font-weight: bold;
                font-size: 25px;
            }

            .com_address {
                color: #000000;
                font-weight: bold;
                font-size: 19px;
            }

            .heading {
                color: #000000;
                font-weight: bold;
                font-size: 20px;
            }

            body {
                color: #000000;
                font-size: 18px;
            }


            -->
        </style>
    </head>
<body style="font-family: Arial, Helvetica, sans-serif;"><center>
            <?php
            require_once("connectioni.php");



            $sql_para = "select * from invpara where flag='".$_SESSION['company']."'";  
            $result_para = mysqli_query($GLOBALS['dbinv'], $sql_para);
            $row_para = mysqli_fetch_array($result_para);
            ?>

            <table width="760" border="0">
                <tr>
                    <td colspan="5" align="center"><span class="companyname"><?php echo $row_para["COMPANY"]; ?></span></td>
                </tr>
                <tr>
                    <td colspan="5" align="center"><span class="com_address"><?php echo $row_para["ADD1"]; ?>,<?php echo $row_para["ADD2"]; ?></span></td>
                </tr>
                <?php
                //echo $_GET["invno"];

                $sql = "SELECT * from viewstran where REFNO= '" . $_GET["invno"] . "'and LEDINDI='GINR' ";
                $result = mysqli_query($GLOBALS['dbinv'], $sql);
                
                $sql = "SELECT * from s_ginmas where tmp_no= '" . $_GET["tmp_no"] . "'";
                $result1 = mysqli_query($GLOBALS['dbinv'], $sql);                
                $row1 = mysqli_fetch_array($result1);
                ?>
                <tr>
                    <td colspan="2">&nbsp;</td>
                    <td width="193" align="center">    </td>
                    <td colspan="2" align="center"></td>
                </tr>
                <tr>
                    <th colspan="4" scope="col" class="heading"  ><u><b>STOCK TRANFER</b></u></th>
                </tr>
                <tr>
                    <td width="114">ST No</td>
                    <td width="641"><?php echo $row1['REF_NO']; ?></td>
                    <td>Date</td>
                    <td><?php echo $row1["SDATE"]; ?></td>
                </tr>
                <tr>
                    <td width="114">To Department</td>
                    <td width="641"><?php echo $row1["DEP_T_NAME"]; ?></td>
                     
                </tr>
                <tr>
                     <td width="193"></td>
                    <td width="240"></td>
                    <td width="193"></td>
                    <td width="240"></td>
                </tr>
				 
                <tr>
                    <td colspan="4">
					<?php
				$ResponseXML ="<table  width='1000' border='1' cellpadding='2' cellspacing='0'>
					<tr>
						<th width='100'>From Department</th>
						<th width='60'>Item Code</th>
						<th width='400'>Description</th>
						<th width='50'>Quantity</th> 
					</tr>";
    $totqty=0;
    $i = 1;
    $sql = "Select * from view_tmp_gin where tmp_no='" . $_GET['tmp_no'] . "'";
    $result = mysqli_query($GLOBALS['dbinv'],$sql);
    while ($row = mysqli_fetch_array($result)) {

        $ResponseXML .= "<tr>                              
                         <td align='left'>" . $row['DESCRIPTION'] . "</td>
                         <td align='center'>" . $row['str_code'] . "</td>
                         <td align='left'>" . $row['str_description'] . "</td>
                         <td align='center'>" . number_format($row['cur_qty'], 0, ".", ",") . "</td> 
                         </tr>";
        $totqty=$totqty+$row['cur_qty'];
        $i = $i + 1;
		
    }
	
		 
                $ResponseXML .= "   </table>"; 
				
				echo $ResponseXML;
				?>  
                
				</td>
				
                </tr>
                <tr>
                    <td colspan="4">
                        <tr>
                            <td colspan="1"></td>
                            
                            <td colspan="1"></td>
            				<td colspan="1" align=right><b>Total Qty</b></td>
                            <td colspan="1" align=center><b>&nbsp;&nbsp;&nbsp;<?php echo  $totqty ; ?></b></td>
                        </tr>
                    </td>
                </tr>
                
                
                
                 
                
      </table>        
      <table width="760" border="0">           
                
                <tr>
                    <td>&nbsp;</td>
                    
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                     
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
          
                    <td align="center">__________________________&nbsp;&nbsp;&nbsp;</td>
                               
                      <td align="center">__________________________&nbsp;&nbsp;&nbsp;</td>
                             
                    
                    <td align="center">__________________________&nbsp;&nbsp;&nbsp;</td>
                </tr>
                <tr>
                   
                    <td align="center">Prepared By</td>  
                   
                    <td align="center">Authorised By</td>  
                    
                    <td align="center">Received By</td>
                </tr>
            </table>
    </body>
</html>
