Skip to content

Instantly share code, notes, and snippets.

@stphnwlkr
Created May 6, 2017 21:50
Show Gist options
  • Save stphnwlkr/7ff003a9ca0e0b1b2a14550723969500 to your computer and use it in GitHub Desktop.
Save stphnwlkr/7ff003a9ca0e0b1b2a14550723969500 to your computer and use it in GitHub Desktop.
remote any function getClosedICount() {
var cic = queryExecute("SELECT COUNT(*) as qty
FROM dbo.View_Request WITH (nolock)
Where left(ref_num,1) ='I' AND close_date IS NOT NULL",{},{});
return NumberFormat(cic.qty,',');
}
remote any function getAverageAgeClosedI() {
var ai = queryExecute("SELECT AVG(DATEDIFF(d, CONVERT(VARCHAR(12), DATEADD(s, open_date, '19700101'), 107),
CONVERT(VARCHAR(12), DATEADD(s, close_date, '19700101'), 107))) AS avgAge
FROM dbo.View_REQUEST
WHERE left(ref_num,1) ='I' AND close_date IS NOT NULL",{},{});
iavg = '#ai.avgAge# Days';
return iavg;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment