<?php $PageSecurity = 4;
global  $db;
include('includes/session.inc');
include('includes/SQL_CommonFunctions.inc');
include('includes/function_lib.php');
?>
<link href="css/professional/default.css" rel="stylesheet" type="text/css" />
<?php 
if($_REQUEST['submit_tech']!='')
{


	$key = key($_REQUEST['submit_tech']);
	$sql1="Insert into trouble_ticket_creation_assignment set
			ttid='".$_REQUEST['ttid']."', 
			technician_id='".$_REQUEST['tech_id'][$key]."'";
		
	$result1=DB_query($sql1,$db);
?>
<script>
self.close();

</script>
<?php 
}
?>



<h2 align="center">Pending Trouble Tickets</h2>
<form name="form1" action="" method="post">
  <table width="100%" border="0" cellspacing="3" cellpadding="2" align="center">
    <tr>
		<th width="5%"><strong>S.No.</strong></th>
      <th width="18%"><strong>TT No.</strong></th>
      <th width="34%">Party Name</th>
      <th width="21%">Expected Closing Date</th>
	  <th width="20%">Visiting Zone</th>
    </tr>
  </table>
  <?php
 	$sql=DB_query("SELECT * FROM trouble_ticket_creation_assignment where technician_id='".$_REQUEST['techaid']."'",$db); 
	
	?>
  <div style="overflow: scroll; height: 300px" id="sub_id">
    <table width="100%" border="0" cellspacing="3" cellpadding="2" align="center">
      <?php	
	
	$i=0;
	$j = 1;
	if(DB_num_rows($sql)>0)
	{
		while($myrow=DB_fetch_array($sql))
	  	{ 
		$j = $j +$i;	
		 
  ?>
      <tr bgcolor="#CCCCCC">
	  <td width="5%"><?php echo  $j;?></td>
        <td width="19%"><?php echo $TTSQL= $s->GetFieldValue('trouble_ticket_creation', 'id="'.$myrow['ttid'].'"','ticket_number');?></td>
        <td width="35%">
		<?php 
		$ParnoSQL= $s->GetFieldValue('trouble_ticket_creation', 'id="'.$myrow['ttid'].'"','part_name');
		echo $ParnameSQL= $s->GetFieldValue('clientmaster', 'id="'.$ParnoSQL.'"','c_name');
		?>
		</td>
        <td width="19%"><?php echo $closerSQL= $s->GetFieldValue('trouble_ticket_creation', 'id="'.$myrow['ttid'].'"','closer_date');?></td>
		<td width="20%"><?php $clientSQL= $s->GetFieldValue('trouble_ticket_creation', 'id="'.$myrow['ttid'].'"','part_name');?>
		<?php $zoneSQL= $s->GetFieldValue('clientmaster', 'id="'.$clientSQL.'"','Zone');?>
		<?php echo $zonetitleSQL= $s->GetFieldValue('zone_master', 'id="'.$zoneSQL.'"','ZoneTitle');?></td>
      </tr>
      <?php $i++;} }?>
    </table>
  </div>
</form>
<div style="text-align:center"><input type="button" name="back" value="Back" onclick="window.history.back()" class="search" /></div>
