<?php
if(isset($_POST['save']))
{           
		extract($_REQUEST['sub_activity_group']);
		if($s->RecordInsert('sub_activity_group',$_REQUEST['sub_activity_group']))
		{
		
		}
		unset($_REQUEST['sub_activity_group']);	
				//print_r($_REQUEST); exit;
		$_SESSION['success_msg']="Saved Successfully";	
		echo "<script>location.href='index.php?route=SubContractors/Masters/activity_group_defination_index&modid=".$_REQUEST['modid']."&frmid=".$_REQUEST['frmid']."'</script>";
}
$sql=DB_query("select Max(display_order) from sub_activity_group",$db);
$check=DB_fetch_array($sql);
if($check['Max(display_order)']==null)
{
$num=1;	
}
else {
	$num=$check['Max(display_order)']+1;
}
if($_REQUEST['action']=='edit' and $_REQUEST['opn']!='')
{
$recEdit=DB_fetch_array($s->GetRecordById('sub_activity_group','id='.$_REQUEST['opn']));
extract($recEdit);		
}
if(isset($_REQUEST['update']))
{
	 $s->RecordEdit('sub_activity_group',$_REQUEST['sub_activity_group'],"id=".$_REQUEST['opn']);
		$_SESSION['success_msg']="Update Successfully";
		echo "<script>location.href='index.php?route=SubContractors/Masters/activity_group_defination_index&modid=".$_REQUEST['modid']."&frmid=".$_REQUEST['frmid']."'</script>";
}
?>
<style>
.label{
background-color: #B7B7B7;
    color: #000000;
    font-size: 10.5px;
    font-weight: bold !important;
    padding: 5px 10px;
    text-align: left;
}
</style>
<link rel="stylesheet" href="css/new_mxerp.css">
<div class="body_contain">
<div class="tab_div">
<h1>Activity Group</h1>
<div style="text-align:left;">
<?php if($_REQUEST['action']=='save') {?><input type="submit" class="search" value="<?php if($_REQUEST['action']=='edit') echo 'update'; else echo 'save'; ?>" name="Save"; ?>"><?php }?><?php if($_REQUEST['action']=='save') {?><input type="reset" class="search" name="cancel" value="Reset" /><?php }?><a href="index.php?route=PMS/Maintenance/activity_group_defination_index&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>"><input type="button" name="back" value="Cancel" class="search" /></a>	
</div>
<div align="center">
<form action="" method="post">
<table width="70%" border="0" cellspacing="2" cellpadding="2" align="center" class="inborder" style="background:#dce6f2;"><tr><td>
<table width="100%" border="0" cellspacing="2" cellpadding="2">
  <tr>
  <td width="39%" class="label"><strong>Activity Group  </strong></td>
    <td width="61%"><font color="#FF0000" size="3"> * </font><input type="text" name="sub_activity_group[group_name]" id="group_name" value="<?php echo $group_name;?>" size="30" /></td>
  </tr>
  <tr>
   <td width="39%" class="label"><strong>Activity Group code</strong></td>
    <td width="61%"><font color="#FF0000" size="3"> * </font><input type="text" name="sub_activity_group[group_code]" id="group_code" value="<?php echo $group_code;?>" size="30" /></td>
  </tr>
  <tr>
   <td width="39%" class="label"><strong>Display Order  </strong></td>
    <td width="61%"><font color="#FF0000" size="3"> * </font><input type="text" name="sub_activity_group[display_order]" id="display_order" value="<?php if($_REQUEST['action']=='edit') echo $display_order; else echo $num;?>" size="30"  readonly/></td>
  </tr>
  <tr>
   <td width="39%" class="label"><strong>Status  </strong></td>
    <td width="61%"><font color="#FF0000" size="3"> * </font><input type="radio" name="sub_activity_group[status]" id="status"  size="30"  value="Active" <?php if($status=='Active'){ ?> checked="checked" <?php }?>/>Active
    <input type="radio" name="sub_activity_group[status]" id="status"  size="30"  value="InActive" <?php if($status=='InActive'){ ?> checked="checked" <?php }?>/>InActive</td>
  </tr>
  
  
	
  <tr><td>&nbsp;</td></tr>
  <tr><td>&nbsp;</td>
    <td align="center"></td>
  </tr>
</table>
</td></tr></table>
</form>
</div>