<?php
include("class_countrymaster.php");
 
/****************************DELETE THE DATA START HERE*******************************/ 
 
if($_REQUEST['action']=='Delete')
{
	$condition="id='".$_REQUEST['id']."'";
	$s->DeleteRecord('psm_estimation_type',$condition);
}

/****************************DELETE THE DATA  END HERE*******************************/ 
?>
<link href="css/tender_project.css" rel="stylesheet" type="text/css" />
	<script src="js1/jquery-1.7.2.js"></script>
	<script src="js1/jquery.ui.widget.js"></script>
	<script src="js1/jquery.ui.tabs.js"></script>
<script>
	$(function() {
		$( "#tabs" ).tabs();
	});
	</script>
<div class="tender_main_page">
<h1>Monthly Budget Entry</h1>
<!-- Body Content Start -->
<form action="" method="post">
<div id="body_content">
	<!-- TAble 1 Start --><div>
	<p align="center"><a href="index.php?route=PMS/Transcations/detailed_budget_entry&modid=<?php echo $_REQUEST['modid']; ?>&frmid=<?php echo $_REQUEST['frmid']; ?>" class="submit_button" style="text-decoration: none;"  >New Budget Entry</a></p>
	<table width="100%" border="1" cellspacing="0" cellpadding="3">
  <tr>
  	<th style="width:10px; white-space:nowrap">Sr No</th>
    <th>Project</th>
	<th>Block</th>
	<th>PBS Group </th>
	<th>PBSE Name </th>
    <!--<th>Total</th>-->
	<th>Edit</th>
	<th>Delete</th>  
  </tr>
  <?php 
  $i=1;
  $sql=DB_query("select * from monthly_budget_entry",$db);
  $numrow=DB_num_rows($sql);
   if($numrow>0)
  {
  while($row=DB_fetch_array($sql))
  {
  ?>  
  <tr bgcolor="#FFFFFF" onMouseOver="this.style.backgroundColor='#fffeb3'; this.style.color='#00f';" onMouseOut="this.style.backgroundColor='#FFF'; this.style.color='#000000';" >
  	<td><?php echo $i; ?></td>
	<td><?php  echo $s->GetFieldValue('locations',"loccode='".$row['project']."'",'locationname'); ?></td>
	<td><?php  echo $s->GetFieldValue('sub_block_master',"id='".$row['block']."'",'block_name'); ?></td>
	<td><?php  
	$x=explode(',',$row['pbs_work_group']);
	for($j=0;$j<count($x);$j++)
	{
	echo $s->GetFieldValue('psm_psb_project',"id='".$x[$j]."'",'pbse_description').'<br>'; 
	}
	
	?></td>
    <td><?php 
    $data=array(); 
    $rowdata=DB_query("select * from monthly_budg_entry_child where pid='".$row['id']."'",$db);
	while($rowdata1=DB_fetch_array($rowdata))
	{
	$data[]=$rowdata1['pbs_name'];
	}
	$data1=implode(",",$data);
	$x=explode(",",$data1);
	for($j=0;$j<count($x);$j++)
	{
	echo $s->GetFieldValue('psm_psb_project',"id='".$x[$j]."'",'pbse_description').'<br>'; 
	}
	
	?></td>
	<!--<td><?php echo $row['qty']; ?></td>-->
	
	
	<td><a href="index.php?route=PMS/Transcations/detailed_budget_entry_edit&modid=<?php echo $_REQUEST['modid'];?>&amp;frmid=<?php echo $_REQUEST['frmid'];?>&action=Edit&id=<?php echo $row['id']; ?>" style="color:#000000; text-decoration: none;">Edit</a></td>
	
	
    <td><a href="index.php?route=PMS/Transcations/detailed_budget_entry_view&modid=<?php echo $_REQUEST['modid'];?>&amp;frmid=<?php echo $_REQUEST['frmid'];?>&action=Delete&id=<?php echo $row['id']; ?>" style="color:#000000; text-decoration: none;">Delete</a></td>
    </tr>
  <?php $i++; } } else {?>
  	<tt bgcolor="#FFFFFF" onMouseOver="this.style.backgroundColor='#fffeb3'; this.style.color='#00f';" onMouseOut="this.style.backgroundColor='#FFF'; this.style.color='#000000';">
  	<td colspan="3" align="center" bgcolor="#FFFFFF"><?php echo "No Records"; ?></td>	
  	</tt>
  	<?php } ?>
</table>
</div><!-- TAble 1 Close -->
</div><!-- Body Content Close -->
<div style="height:30px;"></div>
<div class="button_nav">
</div>
</form>

