lib/department.js
// function to display a table to the users of exisiting department utilized budgets
function to display a table to the users of exisiting department utilized budgets
function to display a table to the users of exisiting department utilized budgets
async function viewUtilizedBudget() {
  let values = [];
  try {
    const sql = "select d.name, sum(r.salary) as UB from employee e join role r on e.role_id = r.id join department d on d.id = r.dept_id group by d.name"
    const results = await db.query(sql);
    results.forEach(res => { 
      values.push([res.name,res.UB]); 
    });
  } catch (err) {
    console.log("error with viewUtiliedBudget",err);
  }
  console.log(" ");
  console.table(['Department','Utilized Budget'],values);
  genDept();
}
async function viewUtilizedBudget ( ) { let values = [ ] ; try { const sql = "select d.name, sum(r.salary) as UB from employee e join role r on e.role_id = r.id join department d on d.id = r.dept_id group by d.name" const results = await db . query ( sql ) ; results . forEach ( res => { values . push ( [ res . name , res . UB ] ) ; } ) ; } catch ( err ) { console . log ( "error with viewUtiliedBudget" , err ) ; } console . log ( " " ) ; console . table ( [ 'Department' , 'Utilized Budget' ] , values ) ; genDept ( ) ; }
function to display a table to the users of exisiting department utilized budgets
function to display a table to the users of exisiting department utilized budgets