<?php
/**********************************************************************
***********************************************************************/
function view_task_group_header($task_group_id)
{

		$sql = "SELECT tg.*,
                        tn.value_name type_name,
                        boqg.code boq_group_code,
                        boqg.description boq_group_description 
                FROM ".TB_PREF."project_task_groups tg 
                        JOIN ".TB_PREF."list_values tn ON 
                                tg.type_id = tn.id 
                        LEFT JOIN ".TB_PREF."project_boq_item_groups boqg ON 
                                tg.boq_group_id = boqg.id 
                        
                WHERE tg.id = ".db_escape($task_group_id);

	$result = db_query($sql,"Could not view_task_group_header");
    
    return db_fetch($result);
}


function view_est_boq_item_header($boq_item_id)
{

		$sql = "SELECT i.*,
                        tn.value_name type_name,
                        boqg.code boq_group_code,
                        boqg.description boq_group_description,
                        tx.name tax_group_name 
                FROM ".TB_PREF."est_project_boq_items i  
                        JOIN ".TB_PREF."list_values tn ON 
                                i.type_id = tn.id 
                        LEFT JOIN ".TB_PREF."tax_groups tx ON 
                                i.tax_group_id = tx.id 
                        LEFT JOIN ".TB_PREF."est_project_boq_item_groups boqg ON 
                                i.group_id = boqg.id 
                        
                WHERE i.id = ".db_escape($boq_item_id);

	$result = db_query($sql,"Could not view_est_boq_item_header");
    
    return db_fetch($result);
}


function view_est_boq_item_components($boq_item_id)
{

    $sql = "SELECT ec.*,
                    dtn.value_name detail_type_name,
                    dtn.value_code 
            FROM ".TB_PREF."list_values dtn  
                LEFT JOIN ".TB_PREF."est_project_boq_item_components ec 
                    ON ec.detail_type_code = dtn.value_code 
                    AND ec.boq_item_id = ".db_escape($boq_item_id)."                                 
            WHERE dtn.list_code = 'PROJECT_TASK_DETAIL_TYPES' 
            ORDER BY dtn.value_name "; 

	return db_query($sql,"Could not view_est_boq_item_components");
        
}

?>














