<?php session_name('CAKEPHP'); session_start();	
$PageSecurity = 1;
$tabindex=0;
include('includes/DefinePaymentClass.php');

include('includes/SQL_CommonFunctions.inc');
include('CRM/functions.php');
$s=new db_query();

if(isset($_REQUEST['save']))
{
    DB_query("delete from perf_range_master",$db);
    
 for($i=0;$i<count($_REQUEST['performance']);$i++)
    {
        if($_REQUEST['performance'][$i]!='')
        {
DB_query("insert into perf_range_master (rangefrom,rangeto,perf_caption,color_code,created_by,created_date,companyid) value('".$_REQUEST['from'][$i]."','".$_REQUEST['to'][$i]."','".$_REQUEST['performance'][$i]."','".$_REQUEST['colorcode'][$i]."','".$_SESSION['UserID']."','".date('Y-m-d')."','".$_SESSION['ACGCompanyId']."') ",$db); 
        }
    }
     $s->pageLocation("index.php?route=TaskMgt/perf_range_index".$rurl);  
}
?>

<link rel="stylesheet" href="css/new_mxerp.css">
<style>
#showdata {
	display: block;
	background: url(Default.png) no-repeat;
	top: 0px;
	left: 0px;
	width: 300px;
	min-height: 60px;
	z-index:0;
}
#back {
	display: none;
	top: 0px;
	left: 0px;
	width: 300px;
	min-height: 60px;
	z-index:0;
}
.tab_div{font-size:12px;}
</style>
<div class="body_contain">
<div class="tab_div">
<h1>Performance Range Master</h1>
<form method="post" action="">
    <table width="40%" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <th style="text-align:center;">Range From</th>
            <th style="text-align:center;">Range To</th>
            <th style="text-align:center;">Performance</th>
           <th style="text-align:center;">Color</th>
        </tr>
        <?php for($i=0;$i<5;$i++){ ?>
        <tr>
            <td><input type="text" onkeypress="return isNumberKey(event)" style="width:100%;" name="from[<?php echo $i; ?>]"></td>
            <td><input type="text" onkeypress="return isNumberKey(event)" style="width:100%;" name="to[<?php echo $i; ?>]"></td>
            <td><input type="text" maxlength="20" th onkeypress="return onlyAlphabets(event,this)" style="width:100%;" name="performance[<?php echo $i; ?>]"></td>
           <td><input type="text" class="color" style="width:100%;" name="colorcode[<?php echo $i; ?>]"></td>
        </tr>
        <?php } ?>
        <tr>
            <td colspan="6" style="text-align: center"><button name="save" value="save" type="submit">Save</button></td>
        </tr>
    </table> 
    
</form>
   </div>
    <SCRIPT language=Javascript>
       <!--
       function isNumberKey(evt)
       {
          var charCode = (evt.which) ? evt.which : event.keyCode;
          if (charCode != 46 && charCode > 31 
            && (charCode < 48 || charCode > 57))
             return false;

          return true;
       }
       //-->
       
       function onlyAlphabets(str,ref)
{
    var aid=ref.id;
    // alert(str);
        if (window.event) {
        var charCode = window.event.keyCode;
    }
    else if (e) {
        var charCode = e.which;
    }
    else { return true; }
    if ((charCode > 64 && charCode < 91) || (charCode > 96 && charCode < 123) || (charCode =32))
        {
         $('#'+aid).keyup(function() {
    $(this).val($(this).val().toUpperCase());
});        return true;
        }
    else
        return false;

     

}
</script>
    </SCRIPT>
