<?php
$modid=$_REQUEST['modid'];
$frmid=$_REQUEST['frmid'];
$rurl="&modid=".$modid."&frmid=".$frmid;
if($_REQUEST['action']=='delete' and $_REQUEST['Id']!='')
{
$del1=DB_query("delete from material_slip_against_job_card where id='".$_REQUEST['Id']."'",$db);
$del1=DB_query("delete from material_job_item where material_slip_id='".$_REQUEST['Id']."'",$db);
$del1=DB_query("delete from material_ink_details where material_slip_id='".$_REQUEST['Id']."'",$db);
$s->pageLocation('index.php?route=material_job_cardlist&modid='.$_REQUEST['modid'].'&frmid='.$_REQUEST['frmid'].$rurl);
}
?>

<h2 align="center">View Material Job Card List</h2>
<a href="index.php?route=material_job_card&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>">Add Material Requirement Slip</a>
<br><br>
<table width="100%" border="0" cellpadding="2" cellspacing="2">
<tr>
<th>Job Card No</th>
<th>Job Card Date </th>
<th>Sop No</th>
<th>Item Name</th>
<th>Order Qty</th>
<th>Ups</th>
<th>View</th>
<th>Edit</th>
<th>Delete</th>
</tr>
<?php
$sql=DB_query("Select * from material_slip_against_job_card",$db);	
$i=0;
$num=DB_num_rows($sql);
if($num>0)
{
while($myrow=DB_fetch_array($sql))
{
	
	$jobcard=$s->getField('job_route_card','id',$myrow['job_card_id'],'job_card_no');
?>
<tr bgcolor="#FFFFFF">
<td><?php echo $jobcard; ?></td>
<td><?php echo $myrow['job_card_data'];?></td>
<td><?php echo $myrow['sop_no']; ?></td>
<td><?php echo $myrow['item_name'];?></td>
<td><?php echo $myrow['order_qty'];?></td>
<td><?php echo $myrow['no_ups'];?></td>
<td><div align="center"><a href="index.php?route=view_material_job_card&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>&action=edit&Id=<?php echo $myrow['id'];?>">View</a></div></td>
<td><div align="center"><a href="index.php?route=edit_material_job_card&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>&action=edit&Id=<?php echo $myrow['id'];?>">Edit</a></div></td>
<td><div align="center"><a href="index.php?route=material_job_cardlist&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>&action=delete&Id=<?php echo $myrow['id'];?>" onclick="return confirm('Are you sure you want to delete?')">Delete</a></div></td>
</tr>
<?php $i++;}}
else { ?>
	<tr bgcolor="#FFFFFF">
<td colspan="12">No Records Find</td>
</tr>
<?php }   ?>
	
</table>
