<?php

include_once'db/connect_db.php';

if (isset($_POST['view'])) {
     $a =$_POST['ty'];
     $stid=$_POST['pq'];
    
       
          
           
           echo' <div class="row">';
           
             echo'<div class="col-md-4">';
               
                  //echo'  <div class="input-group date">';
                    
                        echo'<h4>Report Type :'.$a.'</h4>';
                   
                   // echo'</div>';
                
             echo'</div>';
                 
                
                
               
                
                        
            echo'</div>';
           
                 

           
           
           
           
           
               echo'<div style="overflow-x:auto;">';
                   echo'<table class="table table-bordered table-striped" id="myProduct">';
                        echo'<thead>';
                            echo'<tr>';
                                     echo'<th width="2%" align="left" style="border-bottom:1px solid #999999">Tr,Id</th>';
                                     echo'<th width="3%" align="left" style="border-bottom:1px solid #999999">Tr.Date</th>';
                                     echo'<th width="12%" align="left" style="border-bottom:1px solid #999999">Itm.Name</th>';
                                     echo'<th width="8%"align="left" style="border-bottom:1px solid #999999">Transfer From</th>';
                                      echo'<th width="8%"align="left" style="border-bottom:1px solid #999999">Transfer To</th>';
                                       echo'<th width="3%"align="left" style="border-bottom:1px solid #999999">Qty</th>';
                                     //echo'<th width="4%" align="left" style="border-bottom:1px solid #999999">Value</th>';
                                    // echo'<th width="4%" align="left" style="border-bottom:1px solid #999999">Status</th>';
                                    // echo'<th width="4%" align="right">Update By</th>';
                             echo'</tr>';

                           echo'</thead>';
                        
                           echo'<tbody>';
                        
                          //  $no = 1;
                                          
                                                           
                           $selectst2 = $pdo->prepare("SELECT transfer.trid, transfer.entrydate, item.itmname, site.sname AS s1, s.sname AS s2, transfer.qty, transfer.usrid, transfer.loc1, transfer.loc2, transfer.itmid
                                                        FROM transfer
                                                        INNER JOIN site ON transfer.loc1 = site.sid
                                                        INNER JOIN item ON item.srl = transfer.itmid
                                                        INNER JOIN site s ON transfer.loc2 = s.sid
                                                        WHERE transfer.status = 'Pending'");
                                 
                              $selectst2->execute();
                                 
                                                  
                            while($rowst2 = $selectst2->fetch(PDO::FETCH_ASSOC)){     
                                
                                                          
                                
                          
                            echo'<tr>';
                               //  echo'<td style="width:10px;">'.$no++.'</td>';
                                 
                                 
                                   echo'<td>'.$rowst2['trid'].'</td>';
                                   echo'<td>'.$rowst2['entrydate'].'</td>';
                                   echo'<td>'.$rowst2['itmname'].'</td>';
                                   echo'<td>'.$rowst2['s1'].'</td>';
                                   echo'<td>'.$rowst2['s2'].'</td>';
                                   echo'<td>'.$rowst2['qty'].'</td>';
                                  // echo '<td>'.$rowst2['pname'].'</td>';
                                  // echo '<td>'. number_format($rowst2['qty']).'</td>';
                                  
                                 // echo '<td align="right">'.$rowst2['usrname'].'</td>';
                                 
                              
                               
                            echo'</tr>';
                                                         
                        
                       //echo'<tr>';
			//<th colspan="4" style="border-top:1px solid #999999"> Total: </th>
			//<th colspan="1" style="border-top:1px solid #999999"> 
			
			
			//</th>
				//<th colspan="1" style="border-top:1px solid #999999">
		
		//400
				//</th>
		//</tr>    
                            }
                    
               echo'</tbody>';
       echo'</table>';
                    
     echo'<hr></hr>';
 echo'</div>';  
            
               // <!-- /.Report1***************************************************************************************** -->
                
    
    
    
    
     
    
    
    
    
                
        
 } elseif(isset($_POST['prid123']) && !empty($_POST['prid123'])) {

	 
     
 } elseif(isset($_POST['itrid']) && !empty($_POST['itrid'])) {  
     
    
     
     
    
}
