<?php 
$PageSecurity = 2;
$title = _('Material Issue Slip');
$_SESSION['modid']=$_REQUEST['modid'];
$_SESSION['frmid']=$_REQUEST['frmid'];
$frmpermission= $px->GetFileAccess($_SESSION['modid'],$_SESSION['frmid'],$_SESSION['ACGRoleId']);
$_SESSION['frmAdd']=$frmpermission[0];
$_SESSION['frmEdit']=$frmpermission[1];
$_SESSION['frmDelete']=$frmpermission[2];
$_SESSION['frmView']=$frmpermission[3];					  
 
?>	

<style>
#slidingDiv {
    display: none;
  height:auto;
  background-color: #D9D6DA;
  padding:20px;
}
</style>
<script type="text/javascript">
function showSlidingDiv(){
$("#slidingDiv").animate({"height": "toggle"}, { duration: 700 });
}
</script>
<link rel="stylesheet" href="css/new_mxerp.css">

<div class="body_contain">
<div class="tab_div">
 <h1><?php echo $s->GetFieldValue("modules_form","id='".$_REQUEST['frmid']."' and moduleid='".$_REQUEST['modid']."'","frm_name"); ?> Details</h1>

<div align="left"><a href="#" onClick="showSlidingDiv(); return false;"><input type="button" class="search" value="Show Search" style="width:140px;cursor:pointer;"/></a>
<?php if($_SESSION['frmAdd']=='1') {?>
<a href="index.php?route=prepix_new&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>&NewIssue=yes" class="search" style="text-decoration:none;"><input type="button" class="search" value="Add New " style="width:140px;cursor:pointer;"/></a>
<?php }?>

</div>
<div id="slidingDiv" class="centre" >
<form  action="" method="post">
<table width="100%" border="1" cellspacing="1" cellpadding="2" align="center">
  <tr class="row1">
  <td class="tabledata1" ><strong>Modules</strong></td>
   <td class="tabledata1">
  <select name="module" class="whitestatus" style="width:150px;" id="module" >
          <option value="0">Select</option>
           <?php 
           $query=DB_query("select * from modules where status='Y'",$db);
                     while($row=DB_fetch_array($query))
                     {
                     $p1='';
                     if($_REQUEST['module']==$row['id'])
                        $p1="selected";
                      
             ?>
          <option value="<?php echo $row['id']; ?>" <?php echo $p1; ?>><?php echo $row['modulename']; ?></option>
          <?php } ?>
          </select>
   </td>
  
  <td class="tabledata1"  style="text-align:center;" ><input name="Search" type="submit" value="Search" class="search" /></td>
  </tr>
  </table>
</form>
</div>
 <br>
 <br>

<table width="100%" border="0" cellpadding="3" cellspacing="0"  align="center">
    <tr>
    <td class="tabledata"><strong>Sr.No.</strong></td>
    <td class="tabledata"><strong>Modules </strong></td>
    <td class="tabledata"><strong>Forms</strong></td>
    <td class="tabledata"><strong>Prifix Code</strong></td>
		<td class="tabledata"><strong>EDIT</strong></td>
	 
  </tr>
  <?php   	 
  if(isset($_POST['Search']))
  {
   $module_id="module_id='".$_REQUEST['module']."'"; 
  }  
  else
  {
   $module_id="1=1"; 
  }
  $SQL = "SELECT * FROM prefix_tbl where $module_id   order by module_id DESC"; 
  $sql=DB_query($SQL,$db); 
  $i=1;
  if(DB_num_rows($sql)>0)
  {
  while($myrow=DB_fetch_array($sql))
  {   
  ?>
  <tr bgcolor="#FFFFFF">
    <td><?php echo $i;?></td>
    <td><?php echo $s->getField('modules','id',$myrow['module_id'],'modulename'); ?></td>
    <td><?php echo $s->getField('modules_form','id',$myrow['prefix_name'],'frm_name'); ?></td>
    <td><?php echo $myrow['prefix_code']; ?></td>    
	<td><a href="index.php?route=prepix_new_edit&id=<?php echo $myrow['prefix_id']; ?>&modid=<?php echo $_REQUEST['modid']; ?>&frmid=<?php echo $_REQUEST['frmid']; ?>" ><img src="images/icon-edit.png" height="15" width="15"></a>	</td>
	
  </tr>
  <?php $i++;} }
  else
  {?>
  <tr>
  <td colspan="12"><h3 align="center"><strong>No Record Found</strong></h3></td>
  </tr>
  <?php 	
  }
  ?>
</table>
</div>
</div>