<?php
/**********************************************************************
***********************************************************************/

function insert_module_settings($payroll_id, $nopay_reference_value_id,
                                    $saturday_work_time_id)
{
        $created_by = $_SESSION['wa_current_user']->user;
        $created_on = date('Y-m-d H:i:s');
        
        
	$sql = "INSERT INTO ".TB_PREF."payroll_settings(
                        payroll_id, nopay_reference_value_id,
                        saturday_work_time_id,
                        created_by, created_on) 
                VALUES ("
                        .db_escape($payroll_id).", ".db_escape($nopay_reference_value_id). ", "
                        .db_escape($saturday_work_time_id). ", "
                        .db_escape($created_by).", ".db_escape($created_on).")";

	db_query($sql,"Payroll settings could not be added");
}

function update_module_parameter($module, $parameter, $value)
{
    
        $sql = "UPDATE ".TB_PREF."module_settings 
                SET 
                    value=".db_escape($value)." 
		WHERE module=".db_escape($module)." AND 
                    parameter = ".db_escape($parameter);
        
	db_query($sql,"Module parameter could not be updated");
}

function get_module_parameter_value($module, $parameter)
{
    $sql = "SELECT value FROM ".TB_PREF."module_settings 
            WHERE module =".db_escape($module)." AND 
                    parameter = ".db_escape($parameter);
                    
    $result =  db_query($sql, "Module parameter value could not be retrieved");
    return db_result_value($result, 'value');
}


?>