<?php 
if(isset($_POST['Save']))
{
	$check=DB_query("select * from hr_form5 where  provid_fund_month='".$_REQUEST['month']."'",$db);
	$num1=DB_num_rows($check);
	if($num1<=0)
	{
$insert=DB_query("insert into hr_form5 set factory_name='".$_REQUEST['factory_name']."', factory_address='".$_REQUEST['address']."',date='".FormatDateForSQL($_REQUEST['datet'])."',provid_fund_month='".$_REQUEST['month']."'",$db);	
  $Lastreq_id=DB_Last_Insert_ID($db,'hr_form5',$ErrMsg);
		if($Lastreq_id!='')
		{
		$qty=$_REQUEST['account'];
		$countdata=count($qty);
		for($i=0;$i<$countdata;$i++)
		{
		if($_REQUEST['account'][$i]!='')
		{		
		$insert2="insert into hr_form5_details set parentid='".$Lastreq_id."',account_no='".$_REQUEST['account'][$i]."',member_name='".$_REQUEST['member_name1'][$i]."'
		         ,father_name='".$_REQUEST['father_name'][$i]."',dob='".FormatDateForSQL($_REQUEST['Age'][$i])."',sex='".$_REQUEST['Sex'][$i]."'
		         ,remarks='".$_REQUEST['remarks'][$i]."',eligibility_date='".FormatDateForSQL($_REQUEST['date_of_eligib'][$i])."',total_period='".$_REQUEST['period'][$i]."'";	
		$query1=DB_query($insert2,$db);		 
		}
		}
		}
	}
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Form 5</title>
<style type="text/css">
<!--
 
h1{
		margin:0px;
		padding:0px;
		line-height:25px;
}
h2{
		margin:0px;
		padding:0px;
		font:12px Verdana, Geneva, sans-serif;
		font-weight: bold;
        text-align: center;
        font-size: 18px;
}
h4  {
		margin:0px;
		padding:0px;
		font:15px Verdana, Geneva, sans-serif;
		font-weight: bold;
        text-align: center;
        font-size: 12px;
  }
h5{
		margin:0px;
		padding:0px;
		font:12px Verdana, Geneva, sans-serif;
		font-weight:bold;
		text-align: center;
		 font-size: 10px;
}
.border{
		border:1px solid #cccccc;
		border-bottom:3px solid #666;
}
.text-box{
		font:12px Verdana, Geneva, sans-serif;
		color:#000;
		line-height:20px;
		padding-left:12px;
}
.text-heading{
		font:12px Verdana, Geneva, sans-serif;
		color:#fff;
		line-height:15px;
		padding-left:5px;
		vertical-align:top;
}
.certified{
		font:11px Verdana, Geneva, sans-serif;
		color:#000;
		line-height:20px;
}
ul.abc{
		list-style-type:lower-alpha;
}
.bold-text{
		font:12px Verdana, Geneva, sans-serif;
		color:#000;
		line-height:22px;
}
-->
</style></head>

<body>
	<form action="" method="post">	
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
  <td>
  	<table width="100%"  border="0">
  	<tr>	
  	<td colspan="2"><div align="left">Form No. 5</div></td>
  	<td align="center" width="74%"><h2>Return of Employees Qualifying for Membership of the Employees'</h2></td>
    <td width="13%">&nbsp;</td>
    </tr>
   <tr><td width="10%">&nbsp;</td> <td width="3%">&nbsp;</td> 
   <td align="center" width="74%"><h2>Provident Fund for the Forst Time During the Month of</h2></td>
   	<td align="center">
	
	<select name="month"  style="width:120px;">
 <?php
 $arr=array(1=>"Jan","Feb","Mar","Apr","May","June","July","Aug","Sept","Oct","Nov","Dec");
 foreach ($arr as $key => $value) {
 	$p='';
 	if( $key==$_REQUEST['paymonth'])
	$p='selected';
   ?><option value="<?php echo $key;?>" <?php echo $p;?> ><?php echo $value;?></option>
 <?php } ?></select>   </td>
    </tr>
    <tr>
    <td align="center" colspan="4"><h4>The Employees' Provident Fund Scheme, 1952 [Para 36(2)(a)]</h4></td></tr>
<tr>
    <td align="center" colspan="4"><h4>Employees' Pension Scheme, 1955 [Paragraph 20(4)]</h4></td></tr>
<tr>
    <td align="center" colspan="4"><h5>To be sent to the Commissioner with Form 2 (EPF & FPF)</h5></td></tr>
</table></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><table  border="0" align="left" cellpadding="0" cellspacing="0" class="border">
      <tr>
        <td align="left" class="text-box">
        Name & Address of the<br />
		Factory / Establishment<br />
        with Code No./ DL
        </td>
      </tr>
    </table><table  border="0" align="left" cellpadding="0" cellspacing="0" class="border" valign="top">
      <tr>
        <td align="left" class="text-box">
        <input type="text" size="8"  name="factory_name" /><br>	
       <textarea name="address" rows="1" cols="20"></textarea>
        </td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><table width="100%" border="1" cellspacing="0" cellpadding="2">
      <tr class="text-heading">
        <td align="center" bgcolor="#666666" width="5%">Sr. No.</td>
        <td width="7%" align="center" bgcolor="#666666">Account No.</td>
        <td width="9%" align="center" bgcolor="#666666">Name if the Member <br />
          (in Block Letters)</td>
        <td width="12%" align="center" bgcolor="#666666">Father's Name<br />
          or Husband's Name<br />
          in Case of Married Women</td>
        <td width="10%" align="center" bgcolor="#666666">Age/ Date of Birth<br>
          (DD/MM/YYYY)</td>
        <td width="18%" align="center" bgcolor="#666666">Sex</td>
        <td width="10%" align="center" bgcolor="#666666">Date of Eligibility of Membership</td>
        <td width="23%" align="center" bgcolor="#666666">Total Period of previous Service (Excluding Period of Breaks) as on the date of Joining the Fund</td>
        <td width="6%" align="center" bgcolor="#666666">Remarks</td>
      </tr>
      <?php 
       	      	$k=1;
		for($i=0;$i<10;$i++)
		{
      	?>      	
      <tr>
        <td align="center" valign="top"><?php echo $k; ?></td>
        <td align="center" valign="top"><input type="text" size="8"   name="account[<?php echo $k; ?>]" id="account_<?php echo $k; ?>" /></td>
        <td align="center" valign="top"><input type="text" size="8" name="member_name1[<?php echo $k; ?>]" id="member_name1_<?php echo $k; ?>" /></td>
        <td align="center" valign="top"><input type="text" size="8" name="father_name[<?php echo $k; ?>]" id="father_name_<?php echo $k; ?>" /></td>
        <td align="center" valign="top"><input type="text" size="8" name="Age[<?php echo $k; ?>]" id="Age_<?php echo $k; ?>"  class="datepicker"/></td>
        <td align="center" valign="top">
		<input name="Sex[<?php echo $k; ?>]" type="radio" value="M" />Male
		<input name="Sex[<?php echo $k; ?>]" type="radio" value="F" />Female
		 </td>
        <td align="center" valign="top"><input type="text" size="8" name="date_of_eligib[<?php echo $k; ?>]" id="date_of_eligib_<?php echo $k; ?>" class="datepicker" /></td>
        <td align="center" valign="top"><input type="text" size="25" name="period[<?php echo $k; ?>]" id="period_<?php echo $k; ?>" /></td>
        <td align="center" valign="top"><input type="text" size="8" name="remarks[<?php echo $k; ?>]" id="remarks_<?php echo $k; ?>" /></td>
      </tr><?php $k++; } ?>
     
    </table></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td class="certified">Certified that the casualty has been noted in ledger card of Member</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td align="left" valign="top"><table  border="0" align="left" cellpadding="0" cellspacing="0">
      <tr class="text-box">
        <td class="text-box" >Date :</td>
        <td class="text-box"  ><input type="text" size="8"   name="datet" id="datet" class="datepicker">
          </td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td align="left" valign="top"><table  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td  align="left" valign="top" class="text-box" style="border-right:1px solid #000;"><strong>Note : </strong>
          <br />
          Please funish details of the membership in the remarks column. If employee was a member of employees' Provident Fund and Employees' Family Pension Scheme before Joining Yourself/ Factory, i.e., Account Number and / or the name and particulars of the last employer. </td>
        <td   align="left" valign="top" class="text-box">Signature of the Employer or any other Authorized Official of the Factory/ Establishment<br />
stamp of the Factory / Establishment</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><p align="center"><input type="submit" name="Save"  value="Save"/></p></td>
  </tr>
</table>
</form>
</body>
</html>
<script language="JavaScript">
function check(str)
{
if(document.getElementById("Age_"+str).value=='')
{
document.getElementById("Age_"+str).value="DD/MM/YYYY";	
}	
}	
function check1(str)
{
if(document.getElementById("Age_"+str).value=='DD/MM/YYYY')
{
document.getElementById("Age_"+str).value="";	
}	
}	
	
</script>