The message is the answer to your question. Your code contains an ENDDEFINE statement, but that statement has to have a matching DEFINE CLASS statement. In other words, ENDDEFINE is only valid as part of a class definition.
This has got nothing to do with compilation. It just happens that the error was thrown up during a compile.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
new to all this, got shoved in this position till I find help. Can I just delete the enddefine? I know I have to end it with something....I can show you the the program I have written if needed.
Use
Select r
Use
Select Vflart
Use
Select pv1
Use
Select pv2
Use
Select v
Use
Select Defaults
Use
Select luttech
Use
Select lutref
Use
Select lutread
Use
Select LUTOWNA
Use
Select lutown
Use
Select LUTTESTSTEN
Use
Select LUTTEST
Use
Select custpaperless
Use
Select lutsite
Use
Select MSH
If that is really the only code, then you can indeed delete the ENDDEFINE. But are you sure you have posted the code correctly? The reason I ask is that the code you have posted does nothing useful, and will in any case generate another error (because the variable MyString is not defined).
Given that this is all new to you, it might be better if you consult the original programmer, or alternatively spend some time learning the fundamentals of VFP, rather than trying to deal with each error as it arises without understanding the theory behind it.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
Just to clarify, when I said it doesn't do anything useful, I really meant that it is a lot of code for something that can be done in a single line. All those USE and SELECT statements could be replaced with a single CLOSE DATABASE ALL.
But that would still leave an error in the RETURN MyString.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
Well, then post more code, or make it available on google drive or one drive.
The error could also be a too early enddefine in a previous line.
First of all, since there is an ENDDEFINE that should have a matching DEFINE somewhere up. Maybe the whole long prg is just one large class definition, maybe you have several classes defined in the file. Maybe someone already edited this code earlier and put in some enddefine, where he actually meant to put in an endproc, thus rendering the end of class definition much too early, rest of code can compile fine in that case until the final unexpected enddefine hits.
One nature of end delimiters is, that some of them are optional: endproc(edure) and endfunc(tion). The start of a procedure or function definition automatically closes the previous (Just like a HTML paragraph tag <p> closes the previous <p> without making a </p> necessary, when the previous HTML section was a paragraph, too. It's of course bad style and HTML validation sites will mark this as error, but ry that in your favorite HTML editor and browser).
Most end delimiters are not optional. Endif and enddefine for example are necessary. And finally, a stray extra enddefine will not work and cause that compile error.
So look back up and count pairs of define/enddefine and procedure/endproc and whether there is an enddefine somewhere in the middle of a class definition not followed by a next DEFINE. That hints on a place actually an endproc should be. And line 1117 could become correct again. It usually is normal a class definition prg ends in enddefine, so the error is likely to be found somewhere up.
Bye, Olaf.
Last thought: Either the code never compiled without error, or someone fiddled with it lately. There's a big chance you get a correcter version from an earlier backup. Some extra code may be missed from that, but the structure of begin/end delimiters should be okay in that backup.
Just by the way, even though a series of SELECTS and USE closing workareas could mean all tables should be closed, it could also mean some workareas are left open, even if it's just one essential, so I wouldn't touch that. There are better ways to cope with such a situation you want to close all except some alias names always open, but it'll be hard to retrofit those better strategies. For example using multiple private sessions is hard, when an OLEPUBLIC class for a DLL is based on the session class, as proposed by the VFP help. So keep your fingers off of that simplification. It may work at first and not become an obvious problem straight away. Then later you correlate an error with a recent change having nothing to do with the missing alias.
*!* Define Class ARTERIAL_L As Session OlePublic
*!* Procedure SEARCHFORPATIENT()
*!* On Error Do errHandler With ;
*!* ERROR( ), Message( ), Message(1), Program( ), Lineno( )
Public MessageOK,m.cReadDrWithComma,mvreportstatus
MessageOK=.T.
CLOSE TABLES ALL
Set NullDisplay To Str(0)
Set Multilocks On
*!* Cursortoxml( "Defaults", "Defaults.XML", 1, 512, 0, "1" )
Xmltocursor("Defaults.XML","Defaults",512)
Select Defaults
If Used ("Pat")
Select Pat
Else
Use Alltrim(Defaults.Dir)+'DATA\Pat' In 0 Shared
Endif
Select Pat
CursorSetProp("Buffering",3)
If Used ("lutsite")
Select lutsite
Else
Use Alltrim(Defaults.Dir)+'DATA\lutsite' In 0 Shared
Endif
If Used ("v")
Select v
Else
Use Alltrim(Defaults.Dir)+'DATA\v' In 0 Shared
Endif
Select v
CursorSetProp("Buffering",3)
If Used ("r")
Select r
Else
Use Alltrim(Defaults.Dir)+'DATA\r' In 0 Shared
Endif
Select r
CursorSetProp("Buffering",3)
If Used ("vflart")
Select vflart
Else
Use Alltrim(Defaults.Dir)+'DATA\vflart' In 0 Shared
Endif
If Used ("LUTTEST")
Select LUTTEST
Else
Use Alltrim(Defaults.Dir)+'DATA\LUTTEST' In 0 Shared
Endif
If Used ("LUTTESTSTEN")
Select LUTTESTSTEN
Else
Use Alltrim(Defaults.Dir)+'DATA\LUTTESTSTEN' In 0 Shared
Endif
If Used ("LUTOWNA")
Select LUTOWNA
Else
Use Alltrim(Defaults.Dir)+'DATA\LUTOWNA' In 0 Shared
Endif
If Used ("luttech")
Select luttech
Else
Use Alltrim(Defaults.Dir)+'DATA\luttech 'In 0 Shared
Endif
If Used ("lutread")
Select lutread
Else
Use Alltrim(Defaults.Dir)+'DATA\lutread 'In 0 Shared
Endif
If Used ("lutref")
Select lutref
Else
Use Alltrim(Defaults.Dir)+'DATA\lutref 'In 0 Shared
Endif
If Used ("lutown")
Select lutown
Else
Use Alltrim(Defaults.Dir)+'DATA\lutown'In 0 Shared
Endif
If Used ("custpaperless")
Select custpaperless
Else
Use Alltrim(Defaults.Dir)+'DATA\custpaperless' In 0 Shared
Endif
If Used ("pv1")
Select pv1
Else
Use Alltrim(Defaults.Dir)+'DATA\pv1' In 0 Shared
Endif
If Used ("pv2")
Select pv2
Else
Use Alltrim(Defaults.Dir)+'DATA\pv2' In 0 Shared
Endif
Select v
Set Order To Tag Xpipattag Of Alltrim(Defaults.Dir)+'DATA\pat.cdx' In Pat
Set Relation To v.xfipattag Into Pat Additive
Set Order To Tag xpivtag Of Alltrim(Defaults.Dir)+'DATA\r.cdx' In r
Set Relation To xpivtag Into r Additive
Set Order To Tag xpivtag Of Alltrim(Defaults.Dir)+'data\pv1.cdx' In pv1
Set Relation To xpivtag Into pv1 Additive
Set Order To Tag xpivtag Of Alltrim(Defaults.Dir)+'data\pv2.cdx' In pv2
Set Relation To xpivtag Into pv2 Additive
Set Order To Tag xpivtag Of Alltrim(Defaults.Dir)+'DATA\vflart.cdx' In vflart
Set Relation To xpivtag Into vflart Additive
Set Order To Tag Xtest Of Alltrim(Defaults.Dir)+'DATA\luttest.cdx' In LUTTEST
Set Relation To Xtest Into LUTTEST Additive
Set Order To Tag Xtech Of Alltrim(Defaults.Dir)+'DATA\luttech.cdx' In luttech
Set Relation To Xtech Into luttech Additive
Set Order To Tag xread Of Alltrim(Defaults.Dir)+'DATA\lutread.cdx' In lutread
Set Relation To v.xread Into lutread Additive
Set Order To Tag Xref Of Alltrim(Defaults.Dir)+'DATA\lutref.cdx' In lutref
Set Relation To Xref Into lutref Additive
Set Order To Tag Xsite Of Alltrim(Defaults.Dir)+'DATA\lutsite.cdx' In lutsite
Set Relation To Xsite Into lutsite Additive
Select LUTTEST
Set Order To Tag Xsten Of Alltrim(Defaults.Dir)+'DATA\lutteststen.cdx' In LUTTESTSTEN
Set Relation To LUTTEST.Xsten Into LUTTESTSTEN
Select v
*Added code to tighten search
Locate For v.xpivtag==Defaults.studyid And v.xfipattag == Defaults.Patientid And v.Xtest == Defaults.Xtest
If Found()
If Used ("msh")
Select MSH
Else
Use Data\MSH In 0 Shared
Endif
Select MSH
Calculate Max (Id)To maxID
Append Blank
Replace Id With maxID+1
Replace MSH.Segment With "MSH"
Replace MSH.f1 With "|"
mvEncoding = Alltrim(Defaults.hl7_enc_cs)+Alltrim(Defaults.hl7_enc_rs)+Alltrim(Defaults.hl7_enc_ec)+Alltrim(Defaults.hl7_enc_ss)
Replace MSH.f2 With mvEncoding
Replace MSH.F3 With Alltrim(Defaults.HL7_sapp)
Replace MSH.f4 With Alltrim(Defaults.hl7_sfac)
Replace MSH.f5 With Alltrim(Defaults.hl7_rapp)
Replace MSH.f6 With Alltrim(Defaults.hl7_rfac)
Replace MSH.f9 With Alltrim(Defaults.hl7_mess)+"^" +Alltrim(Defaults.hl7_eve)
m.yr=Alltrim(Str( Year(Date( ))))
m.mo=Alltrim(Padl(Month(Date( )),2,"0"))
m.day=Alltrim(Padl(Day(Date( )),2,"0"))
m.hour=Alltrim(Padl(Hour(Datetime()),2,"0"))
m.min=Alltrim(Padl(Minute(Datetime()),2,"0"))
m.now= (m.yr+m.mo+m.day+m.hour+m.min)
Replace f7 With m.now
Replace f10 With Alltrim(Str(Pat.Xpipattag))+"-"+Alltrim(Str(Defaults.studyid))
Replace f11 With Alltrim(Defaults.hl7_pid)
Replace f12 With Alltrim(Defaults.hl7_ver)
****Added ver 10.5 include additional fields for HL7
Public abc,mvPatientAge
If Not Empty(Pat.dBirth)
*** Reject negative bithdate
If Empty (v.ddate)
mvPatientAge = Floor((Date()-Pat.dBirth)/365.25)
Else
mvPatientAge = Floor((v.ddate-Pat.dBirth)/365.25)
Endif
If mvPatientAge = -1
mvPatientAge= 0
Endif
mvPatientAge=Alltrim(Str(mvPatientAge))
*** check for pediaictric age month
If Between(Val(mvPatientAge), 0, 1)
If Empty (v.ddate)
mvPatientAge = Floor((Date()-Pat.dBirth)/30.43)
Else
mvPatientAge = Floor((v.ddate-Pat.dBirth)/30.43)
Endif
mvPatientAge=Alltrim(Str(mvPatientAge)+"M")
Endif
*** check for pediaictric age week
If Val(mvPatientAge)=0
If Empty (v.ddate)
mvPatientAge = Floor((Date()-Pat.dBirth)/7)
Else
mvPatientAge = Floor((v.ddate-Pat.dBirth)/7)
Endif
mvPatientAge=Alltrim(Str(mvPatientAge)+"W")
Endif
*** check for pediaictric age day
If Val(mvPatientAge)=0
If Empty (v.ddate)
mvPatientAge = Floor((Date()-Pat.dBirth))
Else
mvPatientAge = Floor((v.ddate-Pat.dBirth))
Endif
mvPatientAge=mvPatientAge +1 &&& to keep patient from being 0 days old
mvPatientAge=Alltrim(Str(mvPatientAge)+"D")
Endif
Else
mvPatientAge=""
Endif
Public mvadmit
Select LUTTEST
abc=''
For i = 1 To 12
mva='v.lt'+Alltrim(Str(i))
If &mva=.T.
mvb='Luttest.Clabt'+Alltrim(Str(i))
If i=1
abc=&mvb
Else
abc=abc+&mvb+","
Endif
If Substr(abc,Lenc(abc))=","
abc=Substr(abc,1,Lenc(abc)-1)
Endif
Endif
Endfor
mvadmit=''
If v.napp=1
mvadmit="Inpatient"
Endif
If v.napp=2
mvadmit="Outpatient"
Endif
If v.napp=3
mvadmit=""
Endif
***Populate the PID Table
If Used ("pid")
Select pid
Else
Use Data\pid In 0
Endif
***Put name in proper format then populate field 5 in PID Table
Select Pat
m.nFirstBlank =At(" ", Pat.xrcname,1)
m.nSecondBlank =At(" ", Pat.xrcname,2)
m.Last=Substr(Pat.xrcname, 1 ,m.nFirstBlank)
m.First=Substr(Pat.xrcname, m.nFirstBlank, m.nSecondBlank- m.nFirstBlank)
m.middle=Substr(Pat.xrcname, m.nSecondBlank)
If Empty(Pat.cextpatid)=.F.
Replace F3 With Pat.cextpatid
Else
Replace F3 With m.num
Endif
Replace f2 With Alltrim(Pat.Xrcssn)
If Empty(Pat.hl7_name)
Replace pid.f5 With Alltrim(m.Last)+"^"+Alltrim(m.First)+"^"+Alltrim(m.middle)
Else
&&Changed name here for proper parsing now store the name in pat table exactly the way i receive it.
Replace pid.f5 With Alltrim(Pat.hl7_name)
Endif
m.yr=Alltrim(Str( Year(Pat.dBirth)))
m.mo=Alltrim(Padl(Month(Pat.dBirth),2,"0"))
m.day=Alltrim(Padl(Day(Pat.dBirth),2,"0"))
*!* m.hour=Alltrim(Padl(Hour(v.ddatetime),2,"0"))
*!* m.min=Alltrim(Padl(Minute(v.ddatetime),2,"0"))
m.constantdobdateandtime= (m.yr+m.mo+m.day)
*!* +m.hour+m.min)
*!* ?m.constantdobdateandtime
Replace f7 With (m.constantdobdateandtime)
Replace pid.f8 With Pat.cmf
*!* REPLACE HL7_new WITH .F.
Replace Id With maxID+1
&& added for common orders Account #
Replace pid.f20 With Alltrim(v.cAccession)
Do Case
Case v.napp=1
Replace pv1c.f2 With 'I'
Case v.napp=2
Replace pv1c.f2 With 'O'
Otherwise
Replace pv1c.f2 With ''
Endcase
mvreadName=''
mvreadName=Alltrim(lutread.corgin_id)+"^"
For i = 1 To Alines(namearray,Alltrim(lutread.Name)," ")
mvreadName=mvreadName+namearray(i)+"^"
Endfor
*!* mvreadName=mvreadName+Alltrim(lutread.Degree)
Replace pv1c.f7 With Alltrim(mvreadName)
mvrefName=''
mvrefName=Alltrim(lutref.corgin_id)+"^"
For q = 1 To Alines(namearray,Alltrim(lutref.Name)," ")
mvrefName=mvrefName+namearray(q)+"^"
Endfor
*!* mvrefName=mvrefName+Alltrim(lutref.Degree)
Replace pv1c.f8 With Alltrim(mvrefName)
********************
**** ORC **********
*******************
If Used ("ORC")
Select ORC
Else
Use Data\ORC In 0
Endif
Select ORC
Append Blank
Select ORC
Replace Segment With "ORC"
*added code to check to see if message has been sent before if changed send C=Changed.
If v.lrepcomp=.T.
If Empty(v.drepalt)
Replace f25 With "F"
Endif
Else
Replace f25 With Defaults.result_sta
Endif
&&Added code for Order ID for Common order DR.Kings site.
Replace ORC.F3 With Alltrim(v.cORC_3)
Replace ORC.f4 With Alltrim(v.cOBR_2)
********************
**** OBR **********
*******************
If Used ("OBR")
Select OBR
Else
Use Data\OBR In 0
Endif
Select OBR
Append Blank
Select OBR
Replace Segment With "OBR"
m.num=Alltrim(Str(v.xpivtag))
Replace f4 With m.num + "^" + Alltrim(V.Cprocedure)
Replace f5 With m.num + "^" + Alltrim(Defaults.obr_filler)
*OBR7 needs the original Study date and never changes.
m.yr=Alltrim(Str( Year(v.ddatetime)))
m.mo=Alltrim(Padl(Month(v.ddatetime),2,"0"))
m.day=Alltrim(Padl(Day(v.ddatetime),2,"0"))
m.hour=Alltrim(Padl(Hour(v.ddatetime),2,"0"))
m.min=Alltrim(Padl(Minute(v.ddatetime),2,"0"))
m.constantstudydateandtime= (m.yr+m.mo+m.day+m.hour+m.min)
Replace f7 With (m.constantstudydateandtime)
Replace f8 With (m.constantstudydateandtime)
Endif
*!* Else
*!* Replace f25 With Defaults.result_sta
*!* Endif
&&Added code for Order ID for Common order
Replace OBR.f2 With '1'
Replace OBR.F3 With Alltrim(v.cORC_3)
*!* Replace OBR.f4 With Alltrim(v.cOBR_2)
Replace OBR.F3 With Alltrim(v.cOBR_2)
&&Referring Doc Added Dupage
mvHL7Ref=''
For i = 1 To Alines(refArray,Alltrim(lutref.Name)," ")
If i >1
mvHL7Ref=mvHL7Ref+"^"+refArray(i)
Else
mvHL7Ref=mvHL7Ref+refArray(i)
Endif
Endfor
Replace OBR.f17 With Alltrim(lutref.corgin_id)+"^"+mvHL7Ref
*!* Replace OBR.f5 With Alltrim(v.cobr_4)
&&Added code for Meditech they require obr.20
Replace OBR.f21 With Alltrim(lutown.cobr20)
&&Changed code here for Guthrie the needed site in OBR21
*!* Replace OBR.F22 With Alltrim(lutsite.site)
&&Bassett
Select OBR
Replace OBR.f32 With Alltrim(lutread.corgin_id)+"^"+Alltrim(lutread.Name)+"^"+m.now
*!* && Basset change 3/13/2012
*!* Replace OBR.f12 With v.cobr_11
*!* Replace OBR.f33 With ALLTRIM(lutread.Name)
&&&&Added code to parse HL7 correct format
&&&&Added code to parse HL7 correct format
m.nCharactersInLine=75-10
***********************Cleveland Clinic Formatted***********************************************************
If v.xind =0;
OR v.xind =1;
AND Isblank(v.xind)=.T.
Else
For mycount=1 To 46
indication="LUTTEST.I"+Alltrim(Str(mycount))
ind=Alines(indArray,&indication,"-")
If mycount= v.xind
mvindication=indArray(1)
Do addobx
If ind>1
Replace OBX.F22 With indArray(2)
Else
Replace OBX.F22 With ''
Endif
Endif
Endfor
Endif
*!* For gncount= 1 To 3
*!* Do addobx
*!* Endfor
Do addobx
Replace f5 With Padc(Alltrim(lutown.Inst),m.nCharactersInLine-10," ")
*!* Do addobx
Do addobx
Replace f5 With Padc(Alltrim(lutown.Address1)+" "+Alltrim(lutown.City)+" "+Alltrim(lutown.State)+" ";
+Alltrim(lutown.zip),m.nCharactersInLine-10," ")
*!* For gncount= 1 To 3
*!* Do addobx
*!* Endfor
Do addobx
Replace f5 With Padc(Alltrim(lutown.Title),m.nCharactersInLine-10," ")
Do addobx
If Isblank(Pat.cextpatid)
mvMRN=Alltrim(Pat.Xrcssn)
Else
mvMRN=Alltrim(Pat.cextpatid)
Endif
Do addobx
Replace f5 With"NAME: "+Alltrim(Pat.xrcname)+" ";
+Alltrim(Defaults.PID_2)+" "+mvMRN
* +"CLINIC NO.: "+Alltrim(Pat.Xrcssn)
Do addobx
Do addobx
Replace f5 With "TEST: "+Alltrim(v.cprocedure)
*!* Do addobx
Select Vflart
If Isblank(Vflart.mTech)=.F.
Do addobx
Do addobx
Replace OBX.f5 With "TECH NOTES:"
Select Vflart
Do addobx
Replace OBX.f5 With Alltrim(Vflart.mTech)
Endif
*!* Select r
*!* Locate For xpivtag = r.xpivtag
Select r
If Isblank(r.mhmemo)=.F.
Do addobx
Do addobx
Replace OBX.f5 With Upper("History NOTES:")
Select r
Set Memowidth To 75
For gncount = 1 To Memlines(r.mhmemo)
Do addobx
Replace OBX.f5 With Mline(r.mhmemo,gncount)
Endfor
Endif
*!* Do addobx
If v.xind =0;
OR v.xind =1;
AND Isblank(v.xind)=.T.
Else
For mycount=1 To 46
indication="LUTTEST.I"+Alltrim(Str(mycount))
If mycount= v.xind
Do addobx
Replace OBX.f5 With "PRIMARY INDICATION: "+ &indication
Do addobx
Endif
Endfor
Endif
*!* *!* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
*!* &&&&&&&&&&&&&&&&&&&Clincal Observations&&&&&&&&&&&&&
Do addobx
Replace OBX.f5 With "CLINICAL OBSERVATIONS:"
Select r
Scan For r.xpivtag = v.xpivtag &&&&Pull out all the risk Factors and clinical observations
Select LUTTEST
Scan For Xtest = r.Xtest
For clincalcount=17 To 46
myclin="r.h"+Alltrim(Str(clincalcount))+""
myhis="LUTTEST.h"+Alltrim(Str(clincalcount))+""
If Isblank(&myclin)=.F.
Do addobx
Replace OBX.f5 With Space(10) +&myhis +": "+&myclin
Endif
Endfor
Endscan
Endscan
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&& RISK FACTORS &&&&&&&&&&&&&
Select r
Scan For r.xpivtag = v.xpivtag &&&&Pull out all the risk Factors and clinical observations
Select LUTTEST
Scan For Xtest = r.Xtest
For clincalcount=1 To 16
myclin="r.h"+Alltrim(Str(clincalcount))+""
myhis="LUTOWNA.r"+Alltrim(Str(clincalcount))+""
If Isblank(&myclin)=.F.
Do addobx
Replace OBX.f5 With "RISK FACTORS:"
Exit
Endif
Endfor
Endscan
Endscan
Select r
Scan For r.xpivtag = v.xpivtag &&&&Pull out all the risk Factors and clinical observations
Select LUTTEST
Scan For Xtest = r.Xtest
For clincalcount=1 To 16
myclin="r.h"+Alltrim(Str(clincalcount))+""
myhis="LUTOWNA.r"+Alltrim(Str(clincalcount))+""
If Isblank(&myclin)=.F.
Do addobx
Replace OBX.f5 With Space(10) +&myhis +": "+&myclin
Endif
Endfor
Endscan
Endscan
*!* Quality of care
Select v
If Isblank(v.Qmemo)=.F.
Do addobx
Replace OBX.f5 With "QUALITY OF CARE:"
Select vfext
Do addobx
Replace OBX.f5 With Alltrim(v.Qmemo)
Endif
*!* *!* Tech Notes
*!* Select vfext
*!* If Isblank(vfext.Qmemo)=.F.
*!* Do addobx
*!* Replace OBX.f5 With "TECH NOTES:"
*!* Select vfext
*!* Replace OBX.f5 With Alltrim(vfext.mTech)
*!* Endif
*!* IMPRESSIONS
Select Vflart
If Isblank(Vflart.mimpress)=.F.
Do addobx
Replace OBX.f5 With "IMPRESSIONS:"
Do addobx
Replace OBX.f5 With Alltrim(Vflart.mimpress)
Endif
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Select OBX
Do addobx
Select OBX
Do addobx
Select OBX
Public mvReadSignature
If Not Empty(lutread.Name)
mvLastLength=At(" ",lutread.Name)
mvReadSignature=Alltrim(Substr(lutread.Name,mvLastLength))+" "+Alltrim(Substr(lutread.Name,1,mvLastLength))+" "+Alltrim(lutread.Degree)
Else
mvReadSignature=""
Endif
If v.lrepcomp=.T.
Replace OBX.f5 With "Signed electronically by " + mvReadSignature
Do addobx
Select OBX
m.hour=Alltrim(Str(Hour(v.drepcomp)))
If m.hour='13' Or m.hour='14' Or m.hour='15' Or m.hour='16' Or m.hour='17' Or m.hour='18' Or m.hour='19' Or m.hour='20' Or m.hour='21' Or m.hour='22' Or m.hour='23' Or m.hour='24'
Do Case
Case m.hour='13'
m.hour='01'
Case m.hour='14'
m.hour='02'
Case m.hour='15'
m.hour='03'
Case m.hour='16'
m.hour='04'
Case m.hour='17'
m.hour='05'
Case m.hour='18'
m.hour='06'
Case m.hour='19'
m.hour='07'
Case m.hour='20'
m.hour='08'
Case m.hour='21'
m.hour='09'
Case m.hour='22'
m.hour='10'
Case m.hour='23'
m.hour='11'
Case m.hour='24'
m.hour='12'
Endcase
If Minute(v.drepcomp)<10
m.minutes="0"+Alltrim(Str(Minute(v.drepcomp)))
Else
m.minutes=Alltrim(Str(Minute(v.drepcomp)))
Endif
If Substr(m.hour,1,1)="0"
Replace OBX.f5 With "at "+Substr(m.hour,2)+":"+m.minutes+" PM on " +Cdow(v.drepcomp)+", "+Cmonth(v.drepcomp)+" "+Alltrim(Str(Day(v.drepcomp)))+", "+Alltrim(Str(Year(v.drepcomp)))
Else
Replace OBX.f5 With "at "+m.hour+":"+m.minutes+" PM on " +Cdow(v.drepcomp)+", "+Cmonth(v.drepcomp)+" "+Alltrim(Str(Day(v.drepcomp)))+", "+Alltrim(Str(Year(v.drepcomp)))
Endif
Else
If Minute(v.drepcomp)<10
m.minutes="0"+Alltrim(Str(Minute(v.drepcomp)))
Else
m.minutes=Alltrim(Str(Minute(v.drepcomp)))
Endif
If Substr(m.hour,1,1)="0"
Replace OBX.f5 With "at "+Substr(m.hour,2)+":"+m.minutes+" AM on " +Cdow(v.drepcomp)+", "+Cmonth(v.drepcomp)+" "+Alltrim(Str(Day(v.drepcomp)))+", "+Alltrim(Str(Year(v.drepcomp)))
Else
Replace OBX.f5 With "at "+m.hour+":"+m.minutes+" AM on " +Cdow(v.drepcomp)+", "+Cmonth(v.drepcomp)+" "+Alltrim(Str(Day(v.drepcomp)))+", "+Alltrim(Str(Year(v.drepcomp)))
Endif
Endif
Else
Replace OBX.f5 With "READ BY: "+mvReadSignature
Endif
If Empty(v.drepalt)=.F.
Do addobx
Select v
m.hour=Alltrim(Str(Hour(v.drepalt)))
If m.hour='13' Or m.hour='14' Or m.hour='15' Or m.hour='16' Or m.hour='17' Or m.hour='18' Or m.hour='19' Or m.hour='20' Or m.hour='21' Or m.hour='22' Or m.hour='23' Or m.hour='24'
Do Case
Case m.hour='13'
m.hour='01'
Case m.hour='14'
m.hour='02'
Case m.hour='15'
m.hour='03'
Case m.hour='16'
m.hour='04'
Case m.hour='17'
m.hour='05'
Case m.hour='18'
m.hour='06'
Case m.hour='19'
m.hour='07'
Case m.hour='20'
m.hour='08'
Case m.hour='21'
m.hour='09'
Case m.hour='22'
m.hour='10'
Case m.hour='23'
m.hour='11'
Case m.hour='24'
m.hour='12'
Endcase
If Minute(v.drepalt)<10
m.minutes="0"+Alltrim(Str(Minute(v.drepalt)))
Else
m.minutes=Alltrim(Str(Minute(v.drepalt)))
Endif
If Substr(m.hour,1,1)="0"
Replace OBX.f5 With "Altered at "+Substr(m.hour,2)+":"+m.minutes+" PM on " +Cdow(v.drepalt)+", "+Cmonth(v.drepalt)+" "+Alltrim(Str(Day(v.drepalt)))+", "+Alltrim(Str(Year(v.drepalt)))
Else
Replace OBX.f5 With "Altered at "+m.hour+":"+m.minutes+" PM on " +Cdow(v.drepalt)+", "+Cmonth(v.drepalt)+" "+Alltrim(Str(Day(v.drepalt)))+", "+Alltrim(Str(Year(v.drepalt)))
Endif
Else
If Minute(v.drepalt)<10
m.minutes="0"+Alltrim(Str(Minute(v.drepalt)))
Else
m.minutes=Alltrim(Str(Minute(v.drepalt)))
Endif
If Substr(m.hour,1,1)="0"
Replace OBX.f5 With "Altered at "+Substr(m.hour,2)+":"+m.minutes+" AM on " +Cdow(v.drepalt)+", "+Cmonth(v.drepalt)+" "+Alltrim(Str(Day(v.drepalt)))+", "+Alltrim(Str(Year(v.drepalt)))
Else
Replace OBX.f5 With "Altered at "+m.hour+":"+m.minutes+" AM on " +Cdow(v.drepalt)+", "+Cmonth(v.drepalt)+" "+Alltrim(Str(Day(v.drepalt)))+", "+Alltrim(Str(Year(v.drepalt)))
Endif
Endif
Endif
Endif
************** Embedded Digital Reports *************************************
Select OBX
Scan
Replace OBX.F3 With Alltrim(v.cobr_4)
If Alltrim(OBX.f2)=="RP"
Else
Replace OBX.f2 With Alltrim(Defaults.obx_value)
Endif
Replace F3 With Alltrim(Defaults.obx_id)
Replace OBX.f4 With Alltrim(Defaults.obx_obs_su)
Replace Segment With "OBX"
Replace F16 With Alltrim(lutread.corgin_id)+"^"+Alltrim(lutread.Name)+"^"+m.now
Endscan
If custpaperless.Lrep_path=.T.
Select OBX
Append Blank
Replace F3 With Alltrim(Defaults.obx_id)
Replace f4 With Alltrim(Defaults.obx_obs_su)
Replace Segment With "OBX"
Do Case
Case custpaperless.LPathunc=.T.
Replace f2 With "RP"
x=Alltrim(v.cDigreport)
Replace OBX.f5 With x
Case custpaperless.led=.T.
*Kalida Health
*For the PDF - OBX:5 OBX with "ED" in OBX:2 set up as follows: This should be a coded Base64 PDF.
*copy what you have in OBX:5 to OBX:5.5
* add OBX:5.1 should be blank
* OBX:5.2 = "IMAGE"
* OBX:5.3 = "PDF"
* OBX:5.4 = "BASE64"
Replace f2 With "ED"
x=Strconv(Filetostr(Alltrim(v.cDigreport)),13)
Replace OBX.f5 With "" + "^IMAGE" + "^PDF" + "^BASE64^" + x
Case custpaperless.Lpathurl=.T.
Replace f2 With "RP"
x=Alltrim(custpaperless.cprefix)+Alltrim(v.cDigreport)
Replace OBX.f5 With x
Endcase
Endif
********************************************************************************************
Select OBX
GOTO TOP
Scan
If Alltrim(OBX.f2)=="ED"
Else
Replace OBX.f2 With ""
Endif
Endscan
********************************************************************************************
*!* One more correction. For OBX:3 please use order alias and description that is OBR:4.
*!* In the last message you should have seen this "VASL0012^Venous Lower Unilateral" in OBR:4.
Select OBX
GOTO TOP
Scan
If Alltrim(OBX.f2)=="ED"
ELSE
Replace OBX.f3 With Alltrim(V.Cobr_4)
*!* Replace OBX.f3 With m.num + "^" + Alltrim(V.Cprocedure)
Endif
ENDSCAN
********************************************************************************************
Select MSH
Replace HL_Message With ;
ALLTRIM(Segment)+Alltrim(f1)+Alltrim(f2)+"|"+Alltrim(F3)+"|"+Alltrim(f4)+"|"+;
ALLTRIM(f5)+"|"+Alltrim(f6)+"|"+Alltrim(f7)+"|"+Alltrim(f8)+"|"+Alltrim(f9)+"|"+Alltrim(f10)+;
"|"+Alltrim(f11)+"|"+Alltrim(f12)+"|"+Alltrim(f13)
If MessageOK=.F.
Mystring="Failed"
Else
Mystring=MSH.HL_Message
Endif
Select v
Replace d7SendAck With Datetime()
Replace v.LhL7sent With .T.
Select v
Set Multilocks On
CursorSetProp("Buffering",3)
If Not Tableupdate(1,.F.,"v")
Tablerevert(.T.,'v')
*!* mvSuccessful = "Unsuccessful"
Else
Select v
=Tableupdate(.T.)
Endif
Set Relation To
Select Pat
Use
Select r
Use
Select Vflart
Use
Select pv1
Use
Select pv2
Use
Select v
Use
Select Defaults
Use
Select luttech
Use
Select lutref
Use
Select lutread
Use
Select LUTOWNA
Use
Select lutown
Use
Select LUTTESTSTEN
Use
Select LUTTEST
Use
Select custpaperless
Use
Select lutsite
Use
Select MSH
Return Mystring
Endproc
*!* Enddefine
Procedure errHandler
Parameter merror, Mess, mess1, mprog, mlineno
MessageOK=.F.
mvAck= 'Error number: ' + Ltrim(Str(merror))+Chr(13)+;
'Error message: ' + Mess +Chr(13)+;
'Line of code with error: ' + mess1 +Chr(13)+;
'Line number of error: ' + Ltrim(Str(mlineno))+Chr(13)+;
'Program with error: ' + mprog
*If Ack is good add to log and delete file otherwise resend
*****************************************************************************************************************
Set Safety Off
Mystring="Failed"
If File('log.txt')
Else
Strtofile("",'log.txt',0)
Endif
mvHourNow=Hour(Datetime())
Alltrim(Str(Hour(Datetime())))
If mvHourNow>12
For gnhour = 13 To 24
If mvHourNow==gnhour
mvTime=Alltrim(Str(gnhour-12))
mvAMPM='PM'
Endif
Endfor
Else
mvTime=Alltrim(Str(Hour(Datetime())))
mvAMPM='AM'
Endif
mvMinute=Alltrim(Str(Minute(Datetime())))
If Lenc(mvMinute)=1
mvMinute="0"+mvMinute
Endif
The answer is in line 1:
*!* Define Class ARTERIAL_L As Session OlePublic
As you comment out the class definition you destroy the whole purpose of the code to be a DLL, a DLL only publishes OLEPublic classes and since you remove that, there is nothing left this DLL would do.
And besides that commenting out that DEFINE also makes the ENDDEFINE useless.
But to use it that way without the class definition with the single SEARCHFORPATIENT() method, it has to be compiled as EXE and run.
There needs to be a Defaults.XML file to run it, too, maybe some more, I didn't read it all.
So what do we learn from this? Code has many forms of brackets, not only paranthesis like (), [], or {}, but also if..endif and define...endddefine.
If you remove one bracket, the other also has to be removed. Here it makes a bit sense, as a class with only one method has only one way to use it: Create an instance of it and call this one method. Then you can also simply run the code straight forward. But that won't work as DLL, that will work compiling this as EXE (with dependent files in the same directory, of course).
If this is intended to be a DLL used in any other non VFP software, the only reason I can see for the code having been as it was is, your developer switched the code from Olepublic class to straight away callable prg code, when he wanted to test changes without needing to do a CREATEOBJECT + SEARCHFORPATIENT call and instead be able to click te run button. The situation it was in would rather need to be fixed by including some of the commented lines again.
He also seemed to have used comments for switch in the CURSORTOXML line to sometimes update the Defaults.XML after having edited the Defaults cursor created from XMLTOCURSOR. It's a bag of dirty hacks. I still haven't looked at the whole code, but that doesn't look well planned and structured, just by knowing it is mainly one procedure. At least there is error handling. The only other function/procedure defined - addobx, does nothing but an append blank in obx, that's quite lost to be done as a separate procedure.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.