Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: SDECXML

SDECXML.m

Go to the documentation of this file.
  1. SDECXML ;ALB/JCH - SCHEDULING ENHANCEMENTS 3 ;11/03/14 10:59am
  1. ;;5.3;Scheduling;**628**;Aug 13, 1993;Build 371
  1. ;
  1. GETFLT(RESULT,ALL,SDEBUG) ; RPC - Filter Data only
  1. N SDRPTYP,SDDT,I,SDPC,DTAGAB,SDFLTFLG,DTRANGE,SDLCNT,NODATA,SDSTAT
  1. S SDEBUG=$G(SDEBUG),NODATA=0
  1. S SDSTAT=$$ISLOCKED^SDCED()
  1. ; If the background job is running then return NODATA with error text
  1. I +SDSTAT D NODATA^SDECXUTL(.RESULT,$P(SDSTAT,U,2)) Q
  1. I '$D(^XTMP("SDVSE","FLTXML")) D Q:NODATA
  1. .I $D(^XTMP("SDVSE","DT")),SDSTAT=0 D START("MPS","YQMWD","","",1,"","","FLTXML") Q
  1. .D NODATA^SDECXUTL(.RESULT) S NODATA=1
  1. S RESULT=$NAME(^TMP($J,"FLTXML"))
  1. M ^TMP($J,"FLTXML")=^XTMP("SDVSE","FLTXML")
  1. Q
  1. ;
  1. REPORT(RESULT,SDRPTLST,SDBEGRNG,SDENDRNG,SDEBUG) ; RPC - Report Data
  1. N SDRPTYP,SDDT,I,SDPC,DTAGAB,SDUR,SDACTDT1,SDWEEKS,SDLCNT,DATE,SDINTDT,XMLNODE
  1. K ^TMP($J,"SDECXML")
  1. S RESULT=$NAME(^TMP($J,"SDECXML"))
  1. S SDEBUG=$G(SDEBUG),XMLNODE="SDECXML"
  1. S SDACTDT1=$O(^XTMP("SDVSE","DT","")) S:'SDACTDT1 SDACTDT1=$P($$NOW^XLFDT,".")
  1. I $G(SDRPTLST)="" S SDRPTLST="MPS"
  1. S SDBEGRNG=$G(SDBEGRNG),SDENDRNG=$G(SDENDRNG)
  1. I SDBEGRNG,(SDBEGRNG'?7N.E) S SDBEGRNG=$$SDETFM(SDBEGRNG)
  1. I SDENDRNG,(SDENDRNG'?7N.E) S SDENDRNG=$$SDETFM(SDENDRNG)
  1. I ",Y,Q,M,W,D,"[(","_SDBEGRNG_",") D
  1. .S SDUR=$S(SDBEGRNG="Y":"Year",SDBEGRNG="Q":"Quarter",SDBEGRNG="M":"Month",SDBEGRNG="W":"Week",1:"Date")
  1. .I SDUR="Year" D Q
  1. ..S SDBEGRNG=$$FMADD^XLFDT(SDACTDT1,-365),SDENDRNG=SDACTDT1
  1. .I SDUR'="Year" D Q
  1. ..N SDDATE,ACTDT1,ACTDT2
  1. ..S SDBEGRNG=SDENDRNG
  1. ..I SDUR="Week" D
  1. ...D WEEKS^SDCED1(SDENDRNG,.SDWEEKS)
  1. ...S SDBEGRNG=$$GETWEEK^SDCED1(SDBEGRNG,.SDWEEKS)
  1. ..S SDDATE=SDBEGRNG
  1. ..D BEGEND^SDECXUTL(SDDATE,.ACTDT1,.ACTDT2,$E(SDUR),SDDATE)
  1. ..I '($G(ACTDT1)?7N.E) S SDBEGRNG=$$SDETFM(ACTDT1)
  1. ..I '($G(ACTDT2)?7N.E) S SDENDRNG=$$SDETFM(ACTDT2)
  1. I $G(SDUR)="" S SDUR=$$FMDIFF^XLFDT(SDENDRNG,SDBEGRNG) D
  1. .S SDUR=$S(SDUR>93:"Year",SDUR>31:"Quarter",SDUR>7:"Month",SDUR>1:"Week",1:"Date")
  1. ; If this is a Year report request and if Yearly report already exists then return without recompiling XML report data
  1. I SDUR="Year",$D(^XTMP("SDVSE","YRPTXML-"_SDRPTLST)) M ^TMP($J,"SDECXML")=^XTMP("SDVSE","YRPTXML-"_SDRPTLST) Q
  1. S SDDTINC="D"
  1. D START(SDRPTLST,.SDDTINC,SDBEGRNG,SDENDRNG,,SDUR,SDEBUG,XMLNODE)
  1. M ^TMP($J,"SDECXML")=^XTMP("SDVSE",XMLNODE)
  1. K ^XTMP("SDVSE",XMLNODE)
  1. Q
  1. ;
  1. START(SDRPTLST,SDDTINC,SDBEGRNG,SDENDRNG,SDFLTFLG,SDUR,SDEBUG,XMLNODE) ; Begin building report data from ^XTMP("SDVSE","DT"
  1. N DT,SDDT,SDBEGDT,SDENDDT,SDFACNUM,SDFACNAM,SDFILT,SDFAC,DTNAMAR,SDDTCNT,SDRPTCNT,DTRANGE,SDNODE,SDRPTAR
  1. N CLNTAG,DIVTAG,GRPFLG,SDACTDT,DTNAM,SDRPT
  1. I $G(XMLNODE)="" S XMLNODE=$S($G(SDFLTFLG)=1:"FLTXML",1:"SDECXML")
  1. K ^XTMP("SDVSE",XMLNODE)
  1. F SDRPT="M","P","S" S SDRPTAR(SDRPT)=""
  1. S (SDACTDT,DT)=$O(^XTMP("SDVSE","DT","")) Q:'SDACTDT
  1. S SDBEGDT=$S($G(SDBEGRNG):$$SDETFM(SDBEGRNG),1:"")
  1. S SDENDDT=$S($G(SDENDRNG)&$G(SDBEGDT):$$SDETFM(SDENDRNG),1:"")
  1. I '$G(SDFLTFLG),$G(SDBEGDT)&$G(SDENDDT) S DTRANGE=SDBEGDT_"-"_SDENDDT
  1. S SDNODE=$S($G(DTRANGE):$J_",SDCEX",1:"SDCEX")
  1. I $G(DTRANGE) D
  1. .D EN^SDCED1(.SDRPTAR,SDBEGRNG,SDENDRNG,SDNODE)
  1. ;
  1. S SDLCNT=0,SDFACNAM=$$SITE^VASITE,SDFACNUM=+SDFACNAM,SDFACNAM=$P(SDFACNAM,"^",2)
  1. F DTNAM="Year","Quarter","Month","Week","Date" S DTNAMAR($E(DTNAM))=DTNAM
  1. S SDFAC=$$SITE^VASITE
  1. D OUTPUT^SDECXUTL("<?xml version=""1.0"" encoding=""UTF-8""?>",0,.SDLCNT,SDEBUG,.CLNTAG,.GRPFLG,.DIVTAG,XMLNODE) ; Generic Set/Output
  1. S SDFILT=$$FAC(SDFAC) D SETFILT(.SDLCNT,SDFILT,2)
  1. F SDRPTCNT=1:1:$L(SDRPTLST) S SDRPT=$E(SDRPTLST,SDRPTCNT) D
  1. .S SDFILT=$$RPT(SDRPT) D SETFILT(.SDLCNT,SDFILT,4)
  1. .F SDDTCNT=1:1:$L(SDDTINC) S SDTINC=$E(SDDTINC,SDDTCNT) D
  1. ..Q:'$D(DTNAMAR(SDTINC)) S SDTINC=$G(DTNAMAR(SDTINC))
  1. ..Q:SDTINC=""
  1. ..D DATINC(.SDLCNT,SDBEGDT,SDENDDT,SDRPT,SDTINC,$G(DTRANGE),SDNODE,SDEBUG,XMLNODE)
  1. .D OUTPUT^SDECXUTL("</ReportType>",4,.SDLCNT,SDEBUG,.CLNTAG,.GRPFLG,.DIVTAG,XMLNODE)
  1. I '$G(SDFLTFLG) D SETSDREC^SDECXUTL(.SDLCNT,$E(SDRPTLST),,XMLNODE)
  1. D OUTPUT^SDECXUTL("</VAFacility>",2,.SDLCNT,SDEBUG,.CLNTAG,.GRPFLG,.DIVTAG,XMLNODE)
  1. I $G(SDNODE)["," K ^XTMP(SDNODE)
  1. Q
  1. ;
  1. DATINC(SDLCNT,SDBEGDT,SDENDDT,SDRPTYP,DATINC,DTRANGE,SDNODE,SDEBUG,XMLNODE) ; Get Year, Quarter, Month, Week, and Date data for Division, Group, Clinic, Provider
  1. N SDPRV,SDCLN,SDDGRP,SDIV,SDFAC,SDII,SDDATE,SDRPT,SDTINC,IC,SDALL,SDDIV
  1. N CLNTAG,GRPFLG,DIVTAG,STRING
  1. I '$G(SDBEGDT) S SDBEGDT=$$FMADD^XLFDT($$NOW^XLFDT,-365)
  1. I '$G(SDENDDT) S SDENDDT=$P($$FMADD^XLFDT($$NOW^XLFDT,1),".")
  1. S SDDATE=$S($G(DTRANGE):"",1:$$FMADD^XLFDT(SDBEGDT,,-1))
  1. I DATINC="Year",'$G(DTRANGE) S SDDATE=$O(^XTMP(SDNODE,DATINC,SDRPTYP,""))
  1. S SDDATE="",SDCALL="",SDGALL=""
  1. I $G(SDFLTFLG),DATINC="Date" S SDDATE=$$FMADD^XLFDT(SDACTDT,,,1)
  1. I $G(SDFLTFLG),DATINC="Week" I $O(^XTMP(SDNODE,DATINC,SDRPTYP,""),-1)>$$FMADD^XLFDT(SDACTDT,6) S SDDATE=$$FMADD^XLFDT(SDACTDT,6)
  1. F SDII=0:1 S SDDATE=$O(^XTMP(SDNODE,DATINC,SDRPTYP,SDDATE),-1) Q:SDDATE=""!($G(DTRANGE)&(SDDATE<SDBEGDT)) D
  1. .I SDII=0 D OUTPUT^SDECXUTL("<DateAggregate DateAgg="""_$S(($G(SDUR)]""):SDUR,1:DATINC)_""">",6,.SDLCNT,SDEBUG,.CLNTAG,.GRPFLG,.DIVTAG,$G(XMLNODE))
  1. .D OUTPUT^SDECXUTL($$DATE(SDDATE,$E(DATINC),SDACTDT,$G(DTRANGE)),8,.SDLCNT,SDEBUG,.CLNTAG,.GRPFLG,.DIVTAG,$G(XMLNODE))
  1. .S SDFAC="" F S SDFAC=$O(^XTMP(SDNODE,DATINC,SDRPTYP,SDDATE,SDFAC)) Q:SDFAC=""!(SDFAC="APP") D
  1. ..Q:$G(SDFLTFLG)
  1. ..Q:$G(XMLNODE)="FLTXML"
  1. ..N SDALLALL,SDVGRCL,SDGALL,SDCALL
  1. ..S SDVGRCL="",SDALL=0,SDGALL=0,SDCALL=0
  1. ..S SDDIV="" F DIVCOUNT=0:1 S SDDIV=$O(^XTMP(SDNODE,DATINC,SDRPTYP,SDDATE,SDFAC,SDDIV)) Q:'SDDIV D
  1. ...;Q:(SDDIV="APP")
  1. ...D DIVISION(.SDLCNT,SDRPTYP,SDDATE,SDFAC,SDDIV,$E(DATINC),DIVCOUNT,XMLNODE)
  1. ...N SDSINGRP S SDSINGRP=0
  1. ...S SDGALL=0
  1. ...S SDDGRP=0 F IG=1:1 S SDDGRP=$O(^XTMP(SDNODE,DATINC,SDRPTYP,SDDATE,SDFAC,SDDIV,SDDGRP)) Q:SDDGRP="" D
  1. ....Q:(SDDGRP="APP")
  1. ....D GROUP(.SDLCNT,SDRPTYP,SDDATE,SDFAC,SDDIV,SDDGRP,$E(DATINC),IG)
  1. ....Q:((SDDGRP=0)&$G(SDSINGRP))
  1. ....S SDGALL=$G(SDGALL)+1
  1. ....S SDCALL=0
  1. ....S SDCLN="" F IC=1:1 S SDCLN=$O(^XTMP(SDNODE,DATINC,SDRPTYP,SDDATE,SDFAC,SDDIV,SDDGRP,SDCLN)) Q:SDCLN="" D
  1. .....Q:(SDCLN="APP")!(SDCLN="STAT")
  1. .....D CLINIC^SDECXML2(.SDLCNT,SDRPTYP,SDDATE,SDFAC,SDDIV,SDDGRP,SDCLN,$E(DATINC),SDNODE,.CLNTAG,SDCALL,.GRPFLG,SDEBUG,XMLNODE)
  1. .....S SDCALL=$G(SDCALL)+1
  1. .....S SDPRV="" F S SDPRV=$O(^XTMP(SDNODE,DATINC,SDRPTYP,SDDATE,SDFAC,SDDIV,SDDGRP,SDCLN,SDPRV)) Q:SDPRV="" D
  1. ......Q:'(SDPRV["^")
  1. ......D PROVIDER^SDECXML2(.SDLCNT,SDRPTYP,SDDATE,SDFAC,SDDIV,SDDGRP,SDCLN,SDPRV,DATINC,.CLNTAG,.GRPFLG,SDCALL,DTNAM,SDGALL,SDNODE)
  1. .....I $G(CLNTAG) D OUTPUT^SDECXUTL("</Rs>",13,.SDLCNT,SDEBUG,.CLNTAG,.GRPFLG,.DIVTAG,$G(XMLNODE))
  1. ....I $G(GRPFLG) D OUTPUT^SDECXUTL("</Rg>",12,.SDLCNT,SDEBUG,.CLNTAG,.GRPFLG,.DIVTAG,$G(XMLNODE))
  1. ...I $G(DIVTAG) D OUTPUT^SDECXUTL("</Division>",10,.SDLCNT,SDEBUG,.CLNTAG,.GRPFLG,.DIVTAG,$G(XMLNODE))
  1. .D OUTPUT^SDECXUTL("</Date>",8,.SDLCNT,SDEBUG,.CLNTAG,.GRPFLG,.DIVTAG,$G(XMLNODE))
  1. Q:'SDII
  1. D OUTPUT^SDECXUTL("</DateAggregate>",6,.SDLCNT,SDEBUG,.CLNTAG,.GRPFLG,.DIVTAG,$G(XMLNODE))
  1. Q
  1. ;
  1. DIVISION(SDLCNT,SDRPTYP,SDAT,SDFAC,SDIV,DTINC,DIVCOUNT,XMLNODE) ; Division
  1. N SDFILT,DTNAM
  1. S DTNAM=$G(DTNAMAR(DTINC))
  1. I '$G(DIVCOUNT) D DIVALL^SDECXML3(.SDLCNT,SDRPTYP,SDAT,SDFAC,SDIV,DTINC,SDEBUG,SDGALL,SDCALL,SDNODE,.CLNTAG,.GRPFLG,.DIVTAG,XMLNODE) ; All divisions -
  1. ;
  1. S SDFILT=$$DIV(SDIV) D SETTMPF(.SDLCNT,SDFILT,11)
  1. Q
  1. ;
  1. GROUP(SDLCNT,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,DTINC,IG) ; Group
  1. N SDFILT,SDDATA,DTNAM,SDFILT,SDGRPRV
  1. Q:$G(SDIV)=""
  1. S DTNAM=$G(DTNAMAR(DTINC))
  1. I '$G(SDGALL) D GRPALL^SDECXML3(SDRPTYP,SDAT,SDFAC,SDIV,"",SDEBUG,SDGALL,SDCALL,SDNODE,.CLNTAG,.GRPFLG,.DIVTAG,XMLNODE)
  1. ;
  1. I SDGRP D
  1. .I $G(GRPFLG) D OUTPUT^SDECXUTL("</Rg>",12,.SDLCNT,SDEBUG,.CLNTAG,.GRPFLG,.DIVTAG,$G(XMLNODE))
  1. .S SDFILT=$$GRP(SDGRP) D SETTMPF(.SDLCNT,SDFILT,15) S GRPFLG=1
  1. Q
  1. ;
  1. RPT(RPT) ; Report Type
  1. S RPT=$S(RPT="S":"Specialty Care",RPT="M":"Mental Health",RPT="P":"Primary Care",1:"")
  1. S STRING="ReportType ReportType="""_RPT_""""
  1. Q STRING
  1. FAC(SDFAC,XTYP) ; Return formatted Facility
  1. N SDFACDAT S SDFACDAT=$$SITE^VASITE()
  1. S STRING="VAFacility Name="""_$$SYMENC^MXMLUTL($P(SDFACDAT,"^",2))_""" ID="""_+SDFACDAT_"""" Q STRING
  1. DIV(DIV,XTYP) ; Return formatted Division
  1. S DIVTAG=1
  1. S STRING="Division Name="""_$$DIVNAME^SDECXUTL(DIV)_"""" Q STRING
  1. GRP(GRP,XTYP) ; Return Clinic Group
  1. N GRPNAM
  1. S GRPNAM=$$GRPNAM(GRP)
  1. I $G(XTYP)="M" S STRING="Rg="""_$S(GRPNAM]"":GRPNAM,1:"")_"""" Q STRING
  1. S STRING="Rg Rg="""_$S(GRPNAM]"":GRPNAM,1:"")_"""" Q STRING
  1. GRPNAM(GRP) ; Get Group Name
  1. N DIC,DR,DA,DIQ S GRPNAM=""
  1. I GRP="All" S GRPNAM=GRP
  1. I ($G(GRPNAM)'="All") D
  1. .S GRPNAM=$P(GRP,"^",2)
  1. .I GRPNAM="" S GRPNAM="UNKNOWN" Q
  1. .S GRPNAM="("_+GRP_") "_GRPNAM
  1. Q $$SYMENC^MXMLUTL(GRPNAM)
  1. CLIN(CLIN,FILT) ; Return formatted Clinic
  1. N CLNAM I CLIN["^" S CLIN=$P(CLIN,"^",2)
  1. S CLNAM=$S($G(CLIN):$P($G(^SC(+CLIN,0)),"^"),1:CLIN),CLNTAG=1
  1. S STRING="" I $G(FILT) S STRING="Rs "
  1. S STRING=STRING_"Rn="""_$$SYMENC^MXMLUTL(CLNAM)_"""" Q STRING
  1. PROV(PROV) ; Return formatted Provider
  1. N PRVNAM S PRVNAM=""
  1. I $P(PROV,"^",2) S PRVNAM=$P(PROV,"^")
  1. I PRVNAM="" S PRVNAM=$S($G(PROV):$P($G(^VA(200,PROV,0)),"^"),1:PROV)
  1. I PRVNAM["^" S PRVNAM=$P(PRVNAM,"^") D
  1. .I PRVNAM=" None" S PRVNAM="N/A"
  1. S STRING="Pr="""_$$SYMENC^MXMLUTL(PRVNAM)_"""" Q STRING
  1. DATE(DATE,DTFMT,SDACTDT,DTRANGE) ; Return formatted Date
  1. N BEGDT,ENDDT,RANGE,RANGEX,DTNAMEX
  1. S STRING="",RANGEX=""
  1. I $G(DTRANGE) S RANGE=$$XDATE^SDECXUTL($P(DTRANGE,"-"))_"-"_$$XDATE^SDECXUTL($P(DTRANGE,"-",2)) D
  1. .;S RANGEX=" DateRange="""_DTRANGE_""""
  1. .S DTNAMEX=" DateName="""_$P(RANGE,"^")_""""
  1. I '$G(DTRANGE) D BEGEND^SDECXUTL(DATE,.BEGDT,.ENDDT,DTFMT,SDACTDT) D
  1. .S RANGEX=" DateRange="""_BEGDT_"-"_ENDDT_""""
  1. .S DTNAMEX=" DateName="""_BEGDT_""""
  1. I DTFMT="Y"!(DTFMT="W") S STRING="<Date ActivityDate="""_$$XDATE^SDECXUTL(SDACTDT)_""" BeginDate="""_BEGDT_""" EndDate="""_ENDDT_""""_DTNAMEX_">"
  1. I DTFMT="Q" D
  1. .S DTNAMEX=" DateName="""_$P(DATE,"-",2)_"-"_$P(DATE,"-")_""""
  1. .S STRING="<Date ActivityDate="""_$$XDATE^SDECXUTL(SDACTDT)_""" BeginDate="""_BEGDT_""" EndDate="""_ENDDT_""""_DTNAMEX_">"
  1. I DTFMT="M" D
  1. .N X,Y,DTNAMEX,%DT S %DT="I" S DTNAMEX=" DateName="""_$$FMTE^XLFDT(DATE)_""""
  1. .S STRING="<Date ActivityDate="""_$$XDATE^SDECXUTL(SDACTDT)_""" BeginDate="""_BEGDT_""" EndDate="""_ENDDT_""""_DTNAMEX_">"
  1. I DTFMT="D" D
  1. .I '$G(DTRANGE) S STRING="<Date ActivityDate="""_$$XDATE^SDECXUTL(SDACTDT)_""" BeginDate="""_BEGDT_""" EndDate="""_ENDDT_""""_DTNAMEX_">" Q
  1. .S STRING="<Date ActivityDate="""_$$XDATE^SDECXUTL(SDACTDT)_""" BeginDate="""_$P(RANGE,"-")_""" EndDate="""_$P(RANGE,"-",2)_""""_DTNAMEX_">"
  1. Q STRING
  1. ENC(ENC,TEL,NEW,EST) ; Return formatted number of encounters
  1. S STRING="Mn=""Encounters"" Vt=""Actual"" Vl="""_ENC_""""
  1. Q STRING
  1. TEL(TEL) ; Return formatted telephone encounters
  1. S STRING="Mn=""Encounters"" Vt=""Telephone Encounters"" Vl="""_TEL_"""" Q STRING
  1. NEW(NEW) ; Return new patients
  1. S STRING="Mn=""Encounters"" Vt=""New Patients"" Vl="""_NEW_"""" Q STRING
  1. EST(EST) ; Return established patients
  1. S STRING="Mn=""Encounters"" Vt=""Established Patients"" Vl="""_EST_"""" Q STRING
  1. RCAOVR(OVR) ; Appointment
  1. S STRING="Mn=""Appointments"" Vt=""Overbooks"" Vl="""_OVR_""""
  1. Q STRING
  1. RCADEM(DEM) ; Demand
  1. S DEM=DEM/60
  1. S STRING="Mn=""Total Demand"" Vt=""Actual"" Vl="""_$FN(DEM,",",2)_""""
  1. Q STRING
  1. RCADEMA(DEM) ; Demand
  1. S DEM=DEM/60
  1. S STRING="Mn=""Adjusted Demand"" Vt=""Actual"" Vl="""_$FN(DEM,",",2)_""""
  1. Q STRING
  1. RCASUP(SUP) ; Supply
  1. S STRING="Mn=""Total Supply"" Vt=""Actual"" Vl="""_$FN(SUP,",",2)_""""
  1. Q STRING
  1. SETTMPF(SDLCNT,SDFILT,INDENTF,SDMEAS) ; Set/Write filter
  1. D SETFILT(.SDLCNT,SDFILT,$G(INDENTF))
  1. Q
  1. ;
  1. SETFILT(SDLCNT,SDFILT,INDENT) ; Set ^XTMP or Write
  1. Q:SDFILT="" S SDLCNT=SDLCNT+1
  1. I $G(XMLNODE)="" S XMLNODE=$S($G(SDFLTFLG):"FLTXML",1:"SDECXML")
  1. I $G(INDENT) N PAD S $P(PAD," ",INDENT)=""
  1. I $G(SDEBUG) U IO W !,$G(PAD)_"<"_SDFILT_">"
  1. S ^XTMP("SDVSE",XMLNODE,SDLCNT)="<"_SDFILT_">"
  1. I $E(SDFILT,1,5)="Rg Rg" S GRPFLG=1
  1. I $E(SDFILT,1,8)="Division" S DIVTAG=1
  1. I $E(SDFILT,1,5)="Rs Rn" S CLNTAG=1
  1. Q
  1. ;
  1. SETREC(SDLCNT,SDDATA,INDENT) ; Set/Write Record
  1. ;I SDDATA["Pr=""N/A""" Q
  1. N TMPREC,NEWDATA,TMPDATA
  1. I SDDATA["'" S SDDATA=$$PARSE(SDDATA,"'","'")
  1. S SDLCNT=$G(SDLCNT)+1
  1. S TMPREC="<Rc "_SDDATA_"/>"
  1. I $G(SDEBUG) U IO W !,?($G(INDENT)+1),TMPREC
  1. S ^XTMP("SDVSE",XMLNODE,SDLCNT)=TMPREC
  1. Q
  1. ;
  1. ; Pull out data and aggregate it
  1. PARSE(STRING,CHAR,SUBS) ; Aggregate pieces of node
  1. N NEWDATA,TMPDATA S NEWDATA="",TMPDATA=""
  1. I STRING[CHAR F I=1:1:$L(STRING,"'") D
  1. .S TMPDATA=$P(STRING,"'",I) S NEWDATA=NEWDATA_TMPDATA_$S(I=$L(STRING,CHAR):"",1:SUBS)
  1. Q NEWDATA
  1. ;
  1. SDETFM(DATE) ; Convert external date to FM
  1. N X,Y,DATNAM
  1. S SDINTDT=""
  1. I ($G(DATE)?7N)!($G(DATE)?7N1"."1.N) Q DATE
  1. S X=DATE D ^%DT I Y>0 S SDINTDT=+Y
  1. Q $S($G(SDINTDT):SDINTDT,1:DATE)