This is what our form uses, triggered by the multi-line edit field DOCUMENT.PATIENT_ADVI being populated and where DOCUMENT.DON_T_ALLOW_REPLY_ is a checkbox that enables us to allow/disallow a reply to the message:
{if DOCUMENT.PATIENT_ADVI<>"" then
bldstrGeneric(DOCUMENT.DON_T_ALLOW_REPLY_)
else
OBSNOW("SecMsgOpt", "")
endif}
{fn bldstrGeneric(blockreply)
{
local vers = "|VERSION=3.0"
local toval = "|TO=" + PATIENT.EMAIL
local ccval = "|CC="
local bccval = "|BCC="
local attach = ""
local pos = MATCH(DOCUMENT.SUMMARY, 1, "#")
local len
local subject
local id
local allowreply
if pos>0 then
if MATCH(DOCUMENT.SUMMARY, pos + 1, " ")>0 then
len = MATCH(DOCUMENT.SUMMARY, pos + 1, " ") - 1 - pos
else
len = SIZE(DOCUMENT.SUMMARY) - pos
endif
subject = "|SUBJECT=Secure Message from MeritCare #" + SUB(DOCUMENT.SUMMARY, pos + 1, len)
id = SUB(DOCUMENT.SUMMARY, pos + 1, len)
else
subject = "|SUBJECT=Secure Message from MeritCare #" + GetTrackingNum()
id = GetTrackingNum()
endif
if blockreply<>"" then
allowreply = "|ALLOWREPLY=false"
else
allowreply = "|ALLOWREPLY=true"
endif
OBSNOW("SecMsgOpt", vers + toval + ccval + bccval + attach + subject + allowreply + "|ALLOWREPLYALL=false|REPLYTOCHART=false|ALLOWFORWARD=false|ALLOWATTACHMENTSONFORWARD=false|ALLOWATTACHMENTSONREPLYH=false|ISHIDESENDADDRESS=true|REPLY=false|ID=" + id + "|")
}
}
{fn GetTrackingNum()
{
local clinicaldate = STR(DOCUMENT.CLINICALDATE)
local slash1
local month
local slash2
local day
local space
local year
local colon1
local hour
local minute
local result
slash1 = MATCH(clinicaldate, 1, '/')
month = SUB(clinicaldate, 1, slash1 - 1)
slash2 = MATCH(clinicaldate, slash1 + 1, '/')
day = SUB(clinicaldate, slash1 + 1, slash2 - slash1 - 1)
space = MATCH(clinicaldate, slash2 + 1, ' ')
year = SUB(clinicaldate, slash2 + 3, space - slash2 - 3)
colon1 = MATCH(clinicaldate, space + 1, ':')
hour = SUB(clinicaldate, space + 1, colon1 - space - 1)
space = MATCH(clinicaldate, colon1 + 1, ' ')
minute = SUB(clinicaldate, colon1 + 1, space - colon1 - 1)
result = EncryptDateTime(month)
result = result + EncryptDateTime(day)
result = result + EncryptDateTime(year)
result = result + EncryptDateTime(hour)
result = result + minute
result = result + "000"
}
}
{fn EncryptDateTime(str1)
{
if VAL(str1)<10 then
return STR(VAL(str1))
else
return NUMTOASCII(VAL(str1) + 55)
endif
}
}
Posted : May 24, 2012 5:06 am