task_data.php
/**
 * Add the given report data to the database.
 * 
 * This function will either create a new report with the given values, or--if a report on this
 * task for the given date already exists--update the existing report with the given values.
 * @param unknown $task_id id of task to update
 * @param unknown $ref_date date of the report
 * @param unknown $estimate new estimate of remaining time on the task
 * @param unknown $spent how much time was spent in the previous reporting period
 * 
 * @return value can be interpreted as a boolean indicating whether the update succeeded.
 */
Add the given report data to the database.

This function will either create a new report with the given values, or--if a report on this
task for the given date already exists--update the existing report with the given values.
@param unknown $task_id id of task to update
@param unknown $ref_date date of the report
@param unknown $estimate new estimate of remaining time on the task
@param unknown $spent how much time was spent in the previous reporting period

@return value can be interpreted as a boolean indicating whether the update succeeded.
Add the given report data to the database . This function will either create a new report with the given values or -- if a report on this task for the given date already exists -- update the existing report with the given values . @param unknown $task_id id of task to update @param unknown $ref_date date of the report @param unknown $estimate new estimate of remaining time on the task @param unknown $spent how much time was spent in the previous reporting period @return value can be interpreted as a boolean indicating whether the update succeeded .
function update_report( $task_id, $ref_date, $estimate, $spent)
{
    global $database;
    $task_id = (int)$task_id;
    $estimate = (int)$estimate;
    $spent = (int)$spent;
    $ref_date = "'" . $database->escape( $ref_date). "'";
    $log= new Log( $database);
    $log->estimate($task_id, $estimate, $spent);
    $success = $database->exec(
            "INSERT INTO report(task_id, resource_id, date, burnt, estimate) SELECT $task_id, resource_id, $ref_date, $spent, $estimate FROM task WHERE task_id = $task_id " .
            "ON DUPLICATE KEY UPDATE burnt = VALUES( burnt), estimate = VALUES( estimate), reason='estimate'");
    return $success;
}
function update_report ( $ task_id , $ ref_date , $ estimate , $ spent ) { global $ database ; $ task_id = ( int ) $ task_id ; $ estimate = ( int ) $ estimate ; $ spent = ( int ) $ spent ; $ ref_date = " ' " . $ database -> escape ( $ ref_date ) . " ' " ; $ log = new Log ( $ database ) ; $ log -> estimate ( $ task_id , $ estimate , $ spent ) ; $ success = $ database -> exec ( " INSERT INTO report(task_id, resource_id, date, burnt, estimate) SELECT  $ task_id , resource_id,  $ ref_date ,  $ spent ,  $ estimate  FROM task WHERE task_id =  $ task_id " . " ON DUPLICATE KEY UPDATE burnt = VALUES( burnt), estimate = VALUES( estimate), reason='estimate' " ) ; return $ success ; }
Add the given report data to the database.
Add the given report data to the database .
// insert a new report into the database, but if a report for this task,date,resource already existed, only update the values. 