Example #1
0
            }
            $newCompleted = $completed + $chaHour;
            $newProgress = sprintf("%.2f", $newCompleted / $total);
            $data_project['progress'] = $newCompleted;
            $this->db->update('task_project', $data_project, 'id=' . $this->msg_task['project_id']);
        }
    }
}
if (isset($_POST['id'])) {
    $db = new DB();
    $id = $_POST['id'];
    $updateData = new Progress($db, $id);
    if ($_POST['field'] == 'used_hour') {
        $updateData->updateTaskProgress($_POST['field'], $_POST['value']);
        $updateData->updateTotalUsedHour($_POST['value']);
        $updateData->updateTotalProgress();
    }
    if ($_POST['field'] == 'hour') {
        $updateData->updateTaskProgress($_POST['field'], $_POST['value']);
        $updateData->updateTotalHour($_POST['value']);
        $updateData->updateTotalProgress();
    }
    if ($_POST['field'] == 'progress') {
        $updateData->updateTaskStatus($_POST['field'], $_POST['value']);
        $updateData->tasksToUpdateProjectStatus();
        //$updateData -> countProgress($_POST['value']);
    }
    $data[$_POST['field']] = $_POST['value'];
    $flag = $db->update('task_task', $data, 'id=' . $_POST['id']);
    if ($flag) {
        echo 0;