CREATE FUNCTION `qc_pgmurrealscale`($project int) RETURNS float (10,2)
BEGIN
  declare totalEstimate float(10,2) default 0;
  select CAST(sum(estimate) as DECIMAL(10,2)) as estimate from zt_story where project=$project and type='requirement' and deleted='0' and closedReason not in ('subdivided', 'duplicate', 'willnotdo', 'cancel', 'bydesign') into totalEstimate;
  return totalEstimate;
END