<?php 
if($_REQUEST['save'])
{
	$data['industry_type']=$_REQUEST['industry_type'];
	$data['CompanyId']=$_SESSION['ACGCompanyId'];
	
	if($_REQUEST['action']=='Edit')
	{
	$cond="id='".$_REQUEST['id']."'";
	$s->RecordEdit('industry_type',$data,$cond);	
	}
	else
	{
	$s->RecordInsert('industry_type',$data);
	}
	$s->pageLocation("index.php?route=DealerDistrbutions/Setup/industry_type".$rurl);
}


if($_REQUEST['action']=='delete')
{
	$condition="id='".$_REQUEST['id']."'";
	$s->DeleteRecord('industry_type',  $condition);
	$s->pageLocation("index.php?route=DealerDistrbutions/Setup/industry_type".$rurl);
}


if($_REQUEST['action']=='Edit')
{
	$condition="id='".$_REQUEST['id']."'";
	$rec=$s->DisplayRecord('industry_type',  $condition);
	$Getrec=DB_fetch_array($rec);
	extract($Getrec);
}
?>
<link rel="stylesheet" href="css/new_mxerp.css">
<div class="body_contain">
<div class="tab_div">
<h1>Industy Type</h1>
<form method="post">
<table width="50%" border="0" cellspacing="0" cellpadding="3" align="center">
<tr class="row1">
	<td class="tabledata1">Industry Type</td>
	<td><input type="text" name="industry_type" value="<?php echo $industry_type; ?>" id="industry_type" style="width:150px;"></td>
</tr>
<tr class="row1">
	<td colspan="2" style="text-align:center;"><input type="submit" name="save" value="Save" class="search"></td>
</tr>
</table>
</form>


<table width="100%" border="1" cellspacing="0" cellpadding="3" align="center">
<tr class="row1">
	<td class="tabledata">Sr. No.</td>
	<td class="tabledata">Industry Type</td>
	<td class="tabledata">Edit</td>
	
</tr>
<?php $i=1; $SQL=DB_query("SELECT * FROM industry_type where CompanyId='".$_SESSION['ACGCompanyId']."'",$db);


while($GetRec=DB_fetch_array($SQL)) 
{
$complaint=$s->GetTotalRecordsTalbes('clientmaster',"industry_type='".$GetRec['id']."'");
		
		if($complaint<=0)
		{
		$status=0;
		}
		else
		{
		$status=1;
		}



?>
<tr class="row1">
	<td><?php echo $i; ?></td>
	<td><?php echo $GetRec['industry_type']; ?></td>
	<td><a href="index.php?route=DealerDistrbutions/Setup/industry_type&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>&id=<?php echo $GetRec['id'];?>&action=Edit"><img src="images/icon-edit.png"  width="10" height="10"/></a>
<?php if($status==0) { ?>	
	<a href="index.php?route=DealerDistrbutions/Setup/industry_type&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>&id=<?php echo $GetRec['id'];?>&action=delete" onclick="return confirm('This Industry Type will be deleted. Are you sure?')"><img src="images/delete.Gif"  width="10" height="10"/></a>
<?php  } else { ?>	
<img src="images/delete.Gif"  width="10" height="10" onclick="abc()"/>
<?php } ?>	
	</td>
</tr>
<?php $i++;} ?>
</table>

</div>
</div>
<script>
function abc()
{
window.alert("Industry Type Used You Can Not Delete");
}
</script>