<?php
$pgMod = "leave_deduction";

    if(isset($_POST['save_details'])){

        $db->delete("leave_deduction", "where school_id='".$_SESSION["admin"]["school_id"]."'  ");
        $saveAry = array(
                "deduction_enable"  =>  $_POST['deduction_enable'],
                "school_id"         =>  $_SESSION["admin"]["school_id"],
                "added_by"          =>  $_SESSION["admin"]["uid"],
			);

        $flg  = $db->insertAry("leave_deduction",   $saveAry);

        if(!is_null($flg))
 		{
 			$_SESSION['msg']='update Successfully';
 			redirect(URL_ADMIN_HOME.getQueryString(array("src"=>"Payroll", "page_id"=>$pgMod)));
 		}

    }
?>

	<form method="post" action="" name="myForm">
		<div class="row-fluid">
            <div class="span12">
            	<div class="top-bar">
					<h3><i class="icon-cog"></i>Staff List</h3>
                    <div>
						<button type="submit" name="save_details" class="btn btn-primary"> Save Details</button>
					</div>
				</div>
		<div class="well no-padding">
        	<div class="controls controls-row">

		<?php
		$data = $db->getRow("select * from leave_deduction where school_id='".$_SESSION["admin"]["school_id"]."' ");
			?>
			<table class="table">
    		    <thead>
    		        <tr>
    		            <td>Choose Type</td>
    		            <td>Action</td>
    		        </tr>
                </thead>
                <tbody id="myTable">
    			    <tr>
    			        <td>Leave Deduction</td>
    			        <td>
    			            <input type="radio" name="deduction_enable" value="1" <?php if($data['deduction_enable']=="1")echo "checked"; ?> required /> Enabled
    			            <input type="radio" name="deduction_enable" value="0" <?php if($data['deduction_enable']=="0")echo "checked"; ?> required /> Disabled
    			        </td>
    			    </tr>
    			</tbody>
			</table>
        </div></div></div></div></form>



