%
function getUserID(cookie)
getUserID = left(cookie, instr(cookie, "|") - 1)
end function
function getUserType(cookie)
getUserType = mid(cookie, instr(cookie, "|") + 1, 10)
end function
function getUserName(ID)
%>
<%
s = "SELECT strUserName From tblUser WHERE UserID = " & ID
set rst = cn.execute(s)
if not rst.eof then
getUserName = rst("strUserName")
else
getUserName = "Unknown"
end if
rst.close
end function
function swapIt(x)
if not len(request.querystring("btnExcel")) > 0 then 'do not apply colours when exporting to excel
if x="#D3D7DF" then
x="#E2E4E8"
else
x="#D3D7DF"
end if
else
x="#FFFFFF"
end if
swapIt = x
end function
function unquote(val)
val = replace(val, Chr(34), "'")
unquote = replace(val, "'", "''")
end function
function cleanstring(val)
val = replace(val, Chr(34), "'")
cleanstring = replace(val, "'", "''")
end function
function viewrs(rsname)
response.write "
"
for i = 0 to rsname.fields.count-1
response.write "| " & rsname(i).name
next
while not rsname.eof
response.write " |
"
for i = 0 to rsname.fields.count-1
if isnumeric(rsname(i)) then
response.write "| " & formatnumber(rsname(i),0)
else
response.write " | " & rsname(i)
end if
next
rsname.movenext
wend
response.write " |
"
rsname.movefirst
end function
function print_r(obj)
for each value in obj
response.write value & " : " & obj(value) & "
"
next
end function
function alert(value)
response.write ""
end function
function js(code)
response.write ""
end function
function apDate(strdate)'returns dd-mm-yyyy must pass through yyyymmdd format
if len(strdate) > 0 then
'response.write(strdate)
'response.end
s = mid(strdate, 7, 2) & "-" & mid(strdate, 5, 2) & "-" & mid(strdate, 1, 4)
's = mid(strdate, 1, 2) & "-ff" & mid(strdate, 7, 2) & "-" & mid(strdate, 3, 4)
apdate = s
else
apdate = replace(date,"/", "")
d = day(date)
m = month(date)
if len(d) = 1 then
d = "0" & d
end if
if len(m) = 1 then
m = "0" & m
end if
'apdate = year(date) &"-"& m&"-" & d
apdate = d & "-"&m&"-"&year(date)
end if
end function
function apDateYMD(strdate)'returns dd-mm-yyyy must pass through yyyymmdd format
if len(strdate) > 0 then
'response.write(strdate)
'response.end
s = mid(strdate, 1, 4) & "-" & mid(strdate, 5, 2) & "-" & mid(strdate, 7, 2)
apDateYMD = s
else
apDateYMD = replace(date,"/", "")
d = day(date)
m = month(date)
if len(d) = 1 then
d = "0" & d
end if
if len(m) = 1 then
m = "0" & m
end if
apDateYMD = year(date) & "-" & m & "-" & d
'apdate = d & "-"&m&"-"&year(date)
end if
end function
function getFirstDay(strDate)
if len(strdate) > 0 then
s = split(strdate,"-")
getFirstDay = s(2) & s(1) & s(0)
else
d = "01"
m = month(date)
if len(m) = 1 then
m = "0" & m
end if
getFirstDay = year(date)& m & d
end if
end function
function dbDate(strdate)
if len(strdate) > 0 then
s = split(strdate,"-")
dbdate = s(2) & s(1) & s(0)
else
d = day(date)
m = month(date)
if len(d) = 1 then
d = "0" & d
end if
if len(m) = 1 then
m = "0" & m
end if
dbdate = year(date)& m & d
'apdate = d & "-"&m&"-"&year(date)
end if
end function
function naChk(num)
if num = "N/A" then
naChk = "0"
else
if len(num) > 0 then
if num = "0" or num = "0.00" then
naChk = "N/A"
else
naChk = num
end if
else
naChk = "N/A"
end if
end if
end function
function naChkB(num)
if num = "N/A" then
naChkB = "0"
else
naChkB = num
end if
end function
function viewarray(arrayn)
response.write ""
response.write "| "
for intx = 0 to ubound(arrayn,2)
response.write " | " & intx
next
arraycnt = 0
for intx = 0 to ubound(arrayn,1)
response.write " |
|---|
"
response.write "| " & arraycnt
for i = 0 to ubound(arrayn,2)
if isnumeric(arrayn(intx,i)) then
response.write " | " & formatnumber(arrayn(intx,i),1)
else
response.write " | " & arrayn(intx,i)
end if
next
arraycnt = arraycnt + 1
next
response.write " |
"
end function
Sub print_rr(a)
Response.Write "Array ("
For Each i In a
i = Trim(i)
If Right(i,2) = "[]" Then
Response.Write "
[" & Left(i,Len(i)-2) & "] => Array ( "
s = Split(a(i),",")
For c=0 To Ubound(s)
Response.Write " [" & c & "]" & " => " & s(c)
Next
Response.Write " )"
Else
Response.Write "
[" & i & "] => " & a(i)
End If
Next
Response.Write " )"
End Sub
%>