<link rel="stylesheet" href="css/new_mxerp.css">
<div class="body_contain">
<div class="tab_div">
  <div class="acg-top-pad10">
<div id="inshow">
<link rel="stylesheet" href="../css/jquery.ui.all.css">
<link rel="stylesheet" href="../css/jquery.ui.theme.css">

<script src="../js/jquery-1.5.1.js"></script>
<script src="../ui/jquery.ui.datepicker.js"></script>
<script src="../ui/jquery.ui.timepicker.css"></script>
<script src="../ui/jquery.ui.core.js"></script>
<script src="../ui/jquery.ui.timepicker.js"></script>
<script type="text/javascript">
//var jj=$.noConflict();
// jj(function() {
  
//jj(".datepicker").datepicker({ dateFormat: 'dd/mm/yy' ,changeMonth: true,
  //  changeYear: true,
 //   yearRange: '-80:+20'});
//});
//jj('.timepicker').timepicker();


</script>
<script src="js/function.js" type="text/javascript"></script>
<script src="js/jquery.carouFredSel-5.5.0-packed.js" type="text/javascript"></script>
<script src="js/functions.js" type="text/javascript"></script>
<script type="text/javascript" src="js/form.min.js"></script> 
<?php 
if(isset($_POST['premium_submit'])){
    
          $noofdepends=count($_REQUEST['policy_no']);
            for($dep=0;$dep<$noofdepends;$dep++)
            {
                $data_dep['emp_id']      =$_REQUEST['emp_id'];
                $data_dep['policy_no']      =$_REQUEST['policy_no'][$dep];
                $data_dep['premium_amt']      =$_REQUEST['premium_amt'][$dep]; 
                $data_dep['payment_term']      =$_REQUEST['payment_term'][$dep];
                $data_dep['due_date']      =FormatDateForSQL($_REQUEST['due_date'][$dep]);
                $data_dep['paid_on']      =FormatDateForSQL($_REQUEST['paid_on'][$dep]); 
                $data_dep['modified_by']            =$_REQUEST['created_by'];
                $data_dep['modified_date']          =date("Y-m-d H:i:s");
                $cond_premimum_id="id='".$_REQUEST['prcal'][$dep]."'";
                $s->RecordEdit('hr_premium_calculation', $data_dep,$cond_premimum_id);
            }

    

 $s->pageLocation("index.php?route=HRModule/Master/premium_calculation_add_index".$rurl);
}
  
//session_start();
//error_reporting(0);
//include("connection.php");
$emp_id  =  $s->GetFieldValue("www_users","id='".$_SESSION['UserID']."' ","empid");
 $result =  DB_query("select * from empmaster where id = '".$emp_id."' ",$db);
 $data1 = DB_fetch_array($result);
 extract($data1);
?>

  <h1>Premium Calculation</h1>
 <form method="post" id="premium_form_edit">
           <div class="cat">    
             <input type="hidden" name="emp_id" value="<?php echo $id; ?>">   
             <input type="hidden" name="created_by" value="<?php echo $_SESSION['UserID']; ?>">          
                  <table width="100%" border="0" cellspacing="0" cellpadding="3">
                      <tr class="row1">
                        <td width="13%" rowspan="2"><strong>Emp ID</strong></td>
                        <td width="35%" rowspan="2"><input type="text" value="<?php echo $emp_code; ?>" /></td>
                        <td width="13%"><strong>Name</strong></td>
                        <td><input type="text"  value="<?php echo $emp_name; ?>" /></td>
                      </tr>
                      <tr class="row1">
                        <td><strong>Mobile Number</strong></td>
                        <td><input type="text" value="<?php echo $s->getFieldValue("employee_address","emp_id='".$id."' ","per_mobile"); ?>" /></td>
                      </tr>                 
                  </table>
                </div>
                <div class="cat">
                  <table width="100%" border="1" cellspacing="0" cellpadding="3" style="border:#808080 1px solid;">
                      <tr>
                        <th width="4%" style="text-align:center;"><strong>S. No.</strong></th>
                        <th width="25%" style="text-align:center;"><strong>Policy Number</strong></th>
                        <th width="20%" style="text-align:center;"><strong>Premium Amount</strong></th>
                        <th width="15%" style="text-align:center;"><strong>Payment Term</strong></th>
                        <th width="15%" style="text-align:center;"><strong>Due Date</strong></th>
                        <th style="text-align:center;"><strong>Paid on</strong></th>
                      </tr>
                      <?php
                        $sql_prcal="SELECT * FROM hr_premium_calculation WHERE emp_id='".$_REQUEST['emp_id']."' and fin_year='".$_REQUEST['finyear']."'";
                        $query_prcal=DB_query($sql_prcal,$db);
                        $pr=0;
                        while($prcal_row=DB_fetch_assoc($query_prcal)){
                       ?>
                      <tr>
                        <td align="center"><strong><?php echo $pr+1; ?>
                        <input type="hidden" name="prcal[]" value="<?php echo $prcal_row['id']; ?>" />
                        </strong></td>
                        <td><input type="text" name="policy_no[]" value="<?php echo $prcal_row['policy_no']; ?>" /></td>
                        <td><input type="text" name="premium_amt[]" value="<?php echo $prcal_row['premium_amt']; ?>" /></td>
                        <td><input type="text" name="payment_term[]" value="<?php echo $prcal_row['payment_term']; ?>" /></td>
                        <td><input type="text" name="due_date[]" value="<?php echo ConvertSQLDate($prcal_row['due_date']); ?>" /></td>
                        <td><input type="text" name="paid_on[]" value="<?php echo ConvertSQLDate($prcal_row['paid_on']); ?>" /></td>
                      </tr>
                      <?php $pr++; } ?>
                      <tr>
                        <td style="text-align:center" colspan="6"><input type="submit" name="premium_submit" onclick="pre_cal_final_edit();" value="Update" class="search" /></td>
                      </tr>
                  </table>
                </div>
          </form>
  </div>
</div>

</div>
</div>
 