text: """Luminate staffing"""
  from planning_system.api.sql_shortcuts import pivot
  from planning_system.db.schema.views import _generate_p_string
  
  periods = _generate_p_string(
      "[{p}]", ", ")
  pvt = f"""
  SELECT * FROM
  	(SELECT staff_line_id, period, SUM(ISNULL(value,0)
  									+ISNULL(ni,0)
  									+ISNULL(pension,0)
  									+ISNULL(travel_scheme,0)
  									) total
  	FROM v_calc_staff_period_with_oncost
  	GROUP BY staff_line_id, period
  	) z 
  	PIVOT (SUM(total)
  		FOR period IN ({periods})
  	) n 
  """
  
  
  sql = f"""
  SELECT s.luminate_description as status, v.name, v.title, t.lcc_description as type, indicative_fte as fte,  
  	v.grade, v.current_spine as spine, p.description as pension, 
  	{periods}, 
  	f.set_cat_id, f.acad_year, f.costc, cc.directorate_id 
  FROM ({pvt}) x
  	INNER JOIN input_pay_staff v ON v.staff_line_id = x.staff_line_id 
  	INNER JOIN staff_post_type t ON t.post_type_id = v.post_type_id 
  	INNER JOIN staff_post_status s ON s.post_status_id = v.post_status_id
  	INNER JOIN staff_pension p ON p.pension_id = v.pension_id
  	INNER JOIN f_set f ON f.set_id = v.set_id 
  	INNER JOIN fs_cost_centre cc ON cc.costc = f.costc 
  WHERE s.exclude_from_finance <> 1
  AND f.surpress = 0
  """
  
  
  def definition():
      """Luminate view of staffing"""
      return sql
  