<?php
if(isset($_POST['Save']))
{
	$check=DB_query("select * from hr_form_10 where  leaving_service_month='".$_REQUEST['month']."'",$db);
	$num1=DB_num_rows($check);
	if($num1<=0)
	{
$insert="insert into hr_form_10 set factory_name='".$_REQUEST['factory_name']."',factory_address='".$_REQUEST['address']."'
         ,clark='".$_REQUEST['clark']."',hc='".$_REQUEST['h_c']."',aao='".$_REQUEST['aa_o']."',date='".FormatDateForSQL($_REQUEST['date'])."'
          ,sr_no='".$_REQUEST['sr_no']."',member_name='".$_REQUEST['member_name1']."', compensation_price='".$_REQUEST['compensation_price']."'
          ,leaving_service_month='".$_REQUEST['month']."'"; 
		  $query=DB_query($insert,$db);
	     $Lastreq_id=DB_Last_Insert_ID($db,'hr_form_10',$ErrMsg);
		if($Lastreq_id!='')
		{
		$qty=$_REQUEST['account'];
		$countdata=count($qty);
		for($i=0;$i<$countdata;$i++)
		{
		if($_REQUEST['account'][$i]!='')
		{		
		$insert2="insert into hr_form10_details set parentid='".$Lastreq_id."',account_no='".$_REQUEST['account'][$i]."',member_name='".$_REQUEST['member_name'][$i]."'
		         ,father_name='".$_REQUEST['father_name'][$i]."',date_leaving_service='".FormatDateForSQL($_REQUEST['date_of_leaving'][$i])."',reason='".$_REQUEST['reasons_of_leaving'][$i]."'
		         ,remarks='".$_REQUEST['remarks'][$i]."',sr_no='".$_REQUEST['sr_no'][$i]."'";	
		$query1=DB_query($insert2,$db);		 
		}
		}
		}
		}
		}
   

?>
 
<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%"><tr>
  <td><div align="left">Form No. 10</div></td> <td  align="center" width="55%"><h2>Return of Members Leaving Services 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="3"><h4>The Employees' Provident Fund Scheme, 1952 [Paragraph 36(2)(b)]</h4></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 width="175" border="0" align="left" cellpadding="0" cellspacing="0" class="border" valign="top">
      <tr>
        <td align="left" class="text-box">
        <input type="text" size="10"  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" align="center">
      <tr class="text-heading">
      	       <th align="center"  width="5%">Sr.No.</th>
        <th align="center" >Account No.</th>
        <th align="center" >Name if the Member <br />
          (in Block Letters)</th>
        <th align="center" >Father's Name<br />
          or Husband's Name<br />
          in Case of Married Women</th>
        <th align="center" >Date of <br />
          Leaving Services</th>
        <th align="center" >Reasons for Leaving Service</th>
        <th align="center" >Remarks</th>
      </tr>
      <tbody id="dataTable"> 
      	<?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="10" name="account[<?php echo $i; ?>]"  id="account_<?php echo $i; ?>"  /></td>
        <td align="center" valign="top"><input type="text" size="10" name="member_name[<?php echo $i; ?>]" id="member_name_<?php echo $i; ?>"   /></td>
        <td align="center" valign="top"><input type="text" size="10" name="father_name[<?php echo $i; ?>]"  id="father_name_<?php echo $i; ?>"   /></td>
        <td align="center" valign="top"><input type="text" size="10" name="date_of_leaving[<?php echo $i; ?>]"    id="date_of_leaving_<?php echo $i; ?>"   class="datepicker" /></td>
        <td align="center" valign="top"><input type="text" size="10" name="reasons_of_leaving[<?php echo $i; ?>]" id="reasons_of_leaving_<?php echo $i; ?>"  /></td>
        <td align="center" valign="top"><input type="text" size="10" name="remarks[<?php echo $i; ?>]" id="remarks_<?php echo $i; ?>"   /></td>
        </tr>  <?php $k++; } ?> 
      </tbody>      
    </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><table   border="0" cellspacing="0" cellpadding="0">
      <tr class="text-box">
        <td class="text-box">Clerk &nbsp; <input type="text" size="10" style="width:90px;" name="clark" id="clark" ></td>
        <td class="text-box">H.C.&nbsp; <input type="text" size="10" style="width:90px;" name="h_c" id="h_c" ></td>
        <td class="text-box">A.A.O. &nbsp; <input type="text" size="10" style="width:90px;" name="aa_o" id="aa_o" ></td>
        <td class="text-box">Dated</td>
        <td class="text-box"><input type="text" size="10" style="width:90px;" name="date" id="date" class="datepicker">
       </td>
        
      </tr>
    </table></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><table   border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="text-box"><strong>Please state whether the member is</strong></td>
        <td >&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="bold-text" style="border-right:1px solid #000;">
          <ul class="abc">
            <li>retiring according to 69(1) of the Scheme</li>
            <li>leaving India for permanent settlement abroad</li>
            <li>retrenched</li>
            <li>ordinarily dismissed/dismissed, </li>
            <li>discharged</li>
            <li>resign from or leaving service </li>
            <li>taking up employment elsewhere (the name and address of the new employer should be stated).</li>
            <li>dead</li>
            </ul>
          </td>
        <td align="left" valign="top" style="border-right:1px solid #000;"><table width="390" border="0" align="left" cellpadding="0" cellspacing="0">
          <tr>
            <td align="left" valign="top" class="text-box"><strong>Note : </strong>in case of discharge from service, the following certificate should be filied.</td>
            </tr>
          <tr>
            <td height="15">&nbsp;</td>
            </tr>
          <tr>
            <td align="left" valign="top" class="text-box">Certified that the member mentioned at S. No. 
              <input style="width:60px" type="text" name="sr_no" id="sr_no" /></td>
            </tr>
          <tr>
            <td height="15">&nbsp;</td>
            </tr>
          <tr>
            <td class="text-box">Shri 
              <input style="width:220px" type="text" name="member_name1" id="member_name1" />
              was paid/unpaid</td>
            </tr>
          <tr>
            <td height="15">&nbsp;</td>
            </tr>
          <tr>
            <td class="text-box">retrenchment compensation of Rs. 
              <input style="width:120px" type="text" name="compensation_price" id="compensation_price" />
              Under the Industrial Disputes Act, 1947.</td>
            </tr>
          <tr>
            <td width="379">&nbsp;</td>
            </tr>
          </table></td>
        <td align="right" valign="top"><table width="241" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="right" valign="middle" class="text-box">Signature of the Employer or Other Authorised Officer/ Stamp of the Factory/ Establishment</td>
            </tr>
          <tr>
            <td>&nbsp;</td>
            </tr>
          <tr>
            <td>&nbsp;</td>
            </tr>
          <tr>
            <td>&nbsp;</td>
            </tr>
          <tr>
            <td>&nbsp;</td>
            </tr>
          <tr>
            <td>&nbsp;</td>
            </tr>
          <tr>
            <td>&nbsp;</td>
            </tr>
          <tr>
            <td width="241" align="right" class="text-box">Signature of the Employer</td>
            </tr>
          </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><p align="center"><input type="submit" name="Save"  value="Save"/></p></td>
  </tr>
</table></form>
 <script language="JavaScript">
function abc()
{
	var k=document.getElementById('dataTable').rows.length;
	document.getElementById('row').value=k;
}	
	
</script>

