SDECXML4 ;ALB/JCH - SCHEDULING ENHANCEMENTS 3 (cont) ;11/03/14 10:59am
;;5.3;Scheduling;**628**;Aug 13, 1993;Build 371
;
ONECLIN(SDLCNT,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLIN,DTINC,ALLCLDIV,SDEBUG,CLNTAG,GRPFLG,SDNODE,XMLNODE) ; Single Clinic
N SDCLINOK,APPTOT,APPDEM,ADJDIFF,ADJDEM,ACTOT,SDACTAP,APPLEN,SDCLINOK,ADJDIFF,ADJDEM,APPDEM
N APPEST,APPNEW,APPOVR,CLTOT,SDDATA,SDFILT,SDRESCH
S SDCLINOK="",APPTOT=""
N SDGRP
D SDGRP^SDECXUTL($P(SDCLIN,"^",2),.SDGRP)
;
I $G(ALLCLDIV) D
.I $G(GRPFLG) D OUTPUT^SDECXUTL("</Rg>",13,.SDLCNT,SDEBUG,.CLNTAG,.GRPFLG,.DIVTAG,XMLNODE)
.S SDFILT=$$GRP^SDECXML(SDGRP) D SETTMPF^SDECXML(.SDLCNT,SDFILT,13)
;
I $G(CLNTAG) D OUTPUT^SDECXUTL("</Rs>",15,.SDLCNT,SDEBUG,.CLNTAG,.GRPFLG,.DIVTAG,XMLNODE)
S SDFILT=$$CLIN^SDECXML(SDCLIN,1) D SETTMPF^SDECXML(.SDLCNT,SDFILT,15)
;
; Supply
I $G(SDIV) S APPTOT=+$G(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLIN,"APP","SUP"))
I 'SDIV S APPTOT=+$G(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"CLIN",SDGRP,SDCLIN,"APP","SUP"))
S SDDATA=$$PROV^SDECXML("All")_" "_$$RCASUP^SDECXML($P(APPTOT,"^"))
D SETREC^SDECXML(.SDLCNT,SDDATA,15)
;
; Appointments - overbooks, new, established, demand
I $G(SDIV) D
.S APPTOT="",APPLEN="",SDACTAP="",APPDEM="",ACTOT="",SDSTP="",ADJDEM="",ADJDIFF=""
.I SDGRP=0 N TMPGRP S TMPGRP=$O(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP))
.S APPLEN="" F S APPLEN=$O(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLIN,"APP","LEN",APPLEN)) Q:APPLEN="" D
..S SDSTP="" F S SDSTP=$O(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLIN,"APP","LEN",APPLEN,SDSTP)) Q:SDSTP="" D
...S ACTOT=""
...S APPTOT=$G(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLIN,"APP","LEN",APPLEN,SDSTP))
...Q:(APPTOT="")
...S APPDEM=APPDEM+$P(APPTOT,"^")
..S SDRESCH="" F S SDRESCH=$O(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLIN,"APP","LEN",APPLEN,"STAT",SDRESCH)) Q:SDRESCH="" D
...Q:'($P(SDRESCH,";")="NSR"!($P(SDRESCH,";")="CPR")!($P(SDRESCH,";")="CCR"))
...S ADJDIFF=ADJDIFF+(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLIN,"APP","LEN",APPLEN,"STAT",SDRESCH)*APPLEN)
.I ADJDIFF&APPDEM S ADJDEM=APPDEM-ADJDIFF
.S ADJDEM=$S($G(ADJDEM):ADJDEM,1:APPDEM)
.D PARSE^SDECXML2(APPDEM,"All","All","DEM",APPLEN,SDSTP,ADJDEM)
.; Appointments - overbooks, new, established, demand
.S APPTOT="",APPLEN="",SDACTAP="",APPDEM="",ACTOT=""
.S APPLEN="" F S APPLEN=$O(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLIN,"APP","LEN",APPLEN)) Q:APPLEN="" D
..S SDSTP="" F S SDSTP=$O(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLIN,"APP","LEN",APPLEN,SDSTP)) Q:SDSTP="" D
...S ACTOT=""
...S APPTOT=$G(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLIN,"APP","LEN",APPLEN,SDSTP))
...Q:(APPTOT="")
...S APPOVR=$P(APPTOT,"^",2),APPNEW=$P(APPTOT,"^",3),APPEST=$P(APPTOT,"^",4),ACTOT=APPNEW+APPEST
...D PARSE^SDECXML2(ACTOT,"All","All","APPACT",APPLEN,SDSTP)
...I APPOVR S SDDATA=$$PROV^SDECXML("All")_" "_$$OVRAP^SDECXML2(APPOVR,APPLEN,SDSTP) D SETREC^SDECXML(.SDLCNT,SDDATA,15)
...I APPNEW S SDDATA=$$PROV^SDECXML("All")_" "_$$NEWAP^SDECXML2(APPNEW,APPLEN,SDSTP) D SETREC^SDECXML(.SDLCNT,SDDATA,15)
...I APPEST S SDDATA=$$PROV^SDECXML("All")_" "_$$ESTAP^SDECXML2(APPEST,APPLEN,SDSTP) D SETREC^SDECXML(.SDLCNT,SDDATA,15)
;
;
I 'SDIV D
.S APPTOT="",APPLEN="",SDACTAP="",APPDEM="",ACTOT="",SDSTP="",ADJDEM="",ADJDIFF=""
.S APPLEN="" F S APPLEN=$O(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"FAC",SDGRP,SDCLIN,"APP","LEN",APPLEN)) Q:APPLEN="" D
..S SDSTP="" F S SDSTP=$O(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"FAC",SDGRP,SDCLIN,"APP","LEN",APPLEN,SDSTP)) Q:SDSTP="" D
...S ACTOT=""
...S APPTOT=$G(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"FAC",SDGRP,SDCLIN,"APP","LEN",APPLEN,SDSTP))
...Q:(APPTOT="")
...S APPDEM=APPDEM+$P(APPTOT,"^")
..S SDRESCH="" F S SDRESCH=$O(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"FAC",SDGRP,SDCLIN,"APP","LEN",APPLEN,"STAT",SDRESCH)) Q:SDRESCH="" D
...Q:'($P(SDRESCH,";")="NSR"!($P(SDRESCH,";")="CPR")!($P(SDRESCH,";")="CCR"))
...S ADJDIFF=ADJDIFF+(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"FAC",SDGRP,SDCLIN,"APP","LEN",APPLEN,"STAT",SDRESCH)*APPLEN)
.I ADJDIFF&APPDEM S ADJDEM=APPDEM-ADJDIFF
.S ADJDEM=$S($G(ADJDEM):ADJDEM,1:APPDEM)
.D PARSE^SDECXML2(APPDEM,"All","All","DEM",APPLEN,SDSTP,ADJDEM)
.; Appointments - overbooks, new, established, demand
.S APPTOT="",APPLEN="",SDACTAP="",APPDEM="",ACTOT=""
.S APPLEN="" F S APPLEN=$O(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"FAC",SDGRP,SDCLIN,"APP","LEN",APPLEN)) Q:APPLEN="" D
..S SDSTP="" F S SDSTP=$O(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"FAC",SDGRP,SDCLIN,"APP","LEN",APPLEN,SDSTP)) Q:SDSTP="" D
...S ACTOT=""
...S APPTOT=$G(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"FAC",SDGRP,SDCLIN,"APP","LEN",APPLEN,SDSTP))
...Q:(APPTOT="")
...S APPOVR=$P(APPTOT,"^",2),APPNEW=$P(APPTOT,"^",3),APPEST=$P(APPTOT,"^",4),ACTOT=APPNEW+APPEST
...D PARSE^SDECXML2(ACTOT,"All","All","APPACT",APPLEN,SDSTP)
...I APPOVR S SDDATA=$$PROV^SDECXML("All")_" "_$$OVRAP^SDECXML2(APPOVR,APPLEN,SDSTP) D SETREC^SDECXML(.SDLCNT,SDDATA,15)
...I APPNEW S SDDATA=$$PROV^SDECXML("All")_" "_$$NEWAP^SDECXML2(APPNEW,APPLEN,SDSTP) D SETREC^SDECXML(.SDLCNT,SDDATA,15)
...I APPEST S SDDATA=$$PROV^SDECXML("All")_" "_$$ESTAP^SDECXML2(APPEST,APPLEN,SDSTP) D SETREC^SDECXML(.SDLCNT,SDDATA,15)
;
; Encounters
I $G(SDIV) S CLTOT=$G(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLIN))
I 'SDIV S CLTOT=$G(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"FAC",SDGRP,SDCLIN))
I (CLTOT]"") D
.N SDI F SDI=1:1:4 D
..S SDDATA=$$PROV^SDECXML("All")_" "_$S(SDI=1:$$ENC^SDECXML($P(CLTOT,"^",SDI)),SDI=2:$$NEW^SDECXML($P(CLTOT,"^",SDI)),SDI=3:$$EST^SDECXML($P(CLTOT,"^",SDI)),SDI=4:$$TEL^SDECXML($P(CLTOT,"^",SDI)),1:"")
..Q:($TR(SDDATA,"^","")="")
..D SETREC^SDECXML(.SDLCNT,SDDATA,15)
.;
Q
;
PRALALAL(SDLCNT,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLN,SDPRV,DTINC,DTNAM) ; provider - all division, all groups, by clinic
; Provider - all divisions, all groups (facility level, for report type)
N APPTOT,APPLEN,SDACTAP,APPDEM,ACTOT,SDSTP,ADJDIFF,ADJDEM,PRTOT,SDDATA,SDFILT,SDRESCH
I SDIV="All",SDGRP="All" D
.S APPTOT="",APPLEN="",SDACTAP="",APPDEM="",ACTOT="",SDSTP="",ADJDIFF="",ADJDEM=""
.F S APPLEN=$O(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,"CLIN",SDCLN,"PROV",SDPRV,"APP","LEN",APPLEN)) Q:'APPLEN D
..S SDSTP="" F S SDSTP=$O(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,"CLIN",SDCLN,"PROV",SDPRV,"APP","LEN",APPLEN,SDSTP)) Q:SDSTP="" D
...Q:SDSTP="STAT" S ACTOT=""
...S APPTOT=$G(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,"CLIN",SDCLN,"PROV",SDPRV,"APP","LEN",APPLEN,SDSTP))
...S APPDEM=APPDEM+APPTOT
..S SDRESCH="" F S SDRESCH=$O(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,"CLIN",SDCLN,"PROV",SDPRV,"APP","LEN",APPLEN,"STAT",SDRESCH)) Q:SDRESCH="" D
...Q:'($P(SDRESCH,";")="NSR"!($P(SDRESCH,";")="CPR")!($P(SDRESCH,";")="CCR"))
...S ADJDIFF=ADJDIFF+(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,"CLIN",SDCLN,"PROV",SDPRV,"APP","LEN",APPLEN,"STAT",SDRESCH)*APPLEN)
.S ADJDEM=APPDEM I ADJDIFF&APPDEM S ADJDEM=APPDEM-ADJDIFF
.S ADJDEM=$S($G(ADJDIFF):ADJDEM,1:APPDEM)
.D PARSE^SDECXML2(APPDEM,SDCLN,SDPRV,"DEM",APPLEN,SDSTP,ADJDEM)
.;
.; Appointments - lengths
.S APPTOT="",APPLEN="",SDACTAP="",APPDEM="",ACTOT=""
.F S APPLEN=$O(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,"CLIN",SDCLN,"PROV",SDPRV,"APP","LEN",APPLEN)) Q:'APPLEN D
..S SDSTP="" F S SDSTP=$O(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,"CLIN",SDCLN,"PROV",SDPRV,"APP","LEN",APPLEN,SDSTP)) Q:SDSTP="" D
...Q:SDSTP="STAT" S ACTOT=""
...S APPTOT=$G(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,"CLIN",SDCLN,"PROV",SDPRV,"APP","LEN",APPLEN,SDSTP))
...I '$G(GRPFLG) S SDFILT=$$GRP^SDECXML(SDGRP) D SETTMPF^SDECXML(.SDLCNT,SDFILT,13)
...S APPOVR=$P(APPTOT,"^",2),APPNEW=$P(APPTOT,"^",3),APPEST=$P(APPTOT,"^",4),ACTOT=APPNEW+APPEST
...I ACTOT D PARSE^SDECXML2(ACTOT,SDCLN,SDPRV,"APPACT",APPLEN,SDSTP)
...I APPOVR S SDDATA=$$PROV^SDECXML(SDPRV)_" "_$$OVRAP^SDECXML2(APPOVR,APPLEN,SDSTP) D SETREC^SDECXML(.SDLCNT,SDDATA,15)
...I APPNEW S SDDATA=$$PROV^SDECXML(SDPRV)_" "_$$NEWAP^SDECXML2(APPNEW,APPLEN,SDSTP) D SETREC^SDECXML(.SDLCNT,SDDATA,15)
...I APPEST S SDDATA=$$PROV^SDECXML(SDPRV)_" "_$$ESTAP^SDECXML2(APPEST,APPLEN,SDSTP) D SETREC^SDECXML(.SDLCNT,SDDATA,15)
.;
.S PRTOT=$G(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,"CLIN",SDCLN,"PROV",SDPRV))
.Q:'PRTOT
.N SDI F SDI=1:1:4 D
..S SDDATA=$$PROV^SDECXML(SDPRV)_" "_$S(SDI=1:$$ENC^SDECXML($P(PRTOT,"^",SDI)),SDI=2:$$NEW^SDECXML($P(PRTOT,"^",SDI)),SDI=3:$$EST^SDECXML($P(PRTOT,"^",SDI)),SDI=4:$$TEL^SDECXML($P(PRTOT,"^",SDI)),1:"")
..Q:($TR(SDDATA,"^","")="")
..I '$G(GRPFLG) S SDFILT=$$GRP^SDECXML(SDGRP) D SETTMPF^SDECXML(.SDLCNT,SDFILT,13)
..D SETREC^SDECXML(.SDLCNT,SDDATA,15)
Q
;
PRALAL(SDLCNT,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLN,SDPRV,DTINC,DTNAM) ; providers - all groups in one division, specific clinic
; Provider - one division, all groups (division level, for report type)
N APPTOT,APPLEN,SDACTAP,APPDEM,ACTOT,SDSTP,ADJDIFF,ADJDEM,PRTOT
I SDIV,$P(SDCLN,"^",2),SDGRP="All" D
.S APPTOT="",APPLEN="",SDACTAP="",APPDEM="",ACTOT="",SDSTP="",ADJDIFF="",ADJDEM="",ADJDEM=""
.F S APPLEN=$O(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"DIV",SDIV,"CLIN",SDCLN,SDPRV,"APP","LEN",APPLEN)) Q:'APPLEN D
..S SDSTP="" F S SDSTP=$O(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"DIV",SDIV,"CLIN",SDCLN,SDPRV,"APP","LEN",APPLEN,SDSTP)) Q:SDSTP="" D
...Q:SDSTP="STAT" S ACTOT=""
...S APPTOT=$G(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"DIV",SDIV,"CLIN",SDCLN,SDPRV,"APP","LEN",APPLEN,SDSTP))
...S APPDEM=APPDEM+APPTOT
..S SDRESCH="" F S SDRESCH=$O(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"DIV",SDIV,"CLIN",SDCLN,SDPRV,"APP","LEN",APPLEN,"STAT",SDRESCH)) Q:SDRESCH="" D
...Q:'($P(SDRESCH,";")="NSR"!($P(SDRESCH,";")="CPR")!($P(SDRESCH,";")="CCR"))
...S ADJDIFF=ADJDIFF+(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"DIV",SDIV,"CLIN",SDCLN,SDPRV,"APP","LEN",APPLEN,"STAT",SDRESCH)*APPLEN)
.S ADJDEM=APPDEM I ADJDIFF&APPDEM S ADJDEM=APPDEM-ADJDIFF
.S ADJDEM=$S($G(ADJDIFF):ADJDEM,1:APPDEM)
.D PARSE^SDECXML2(APPDEM,SDCLN,SDPRV,"DEM",APPLEN,SDSTP,ADJDEM)
.;
.; Appointments - lengths
.S APPTOT="",APPLEN="",SDACTAP="",APPDEM="",ACTOT=""
.F S APPLEN=$O(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"DIV",SDIV,"CLIN",SDCLN,SDPRV,"APP","LEN",APPLEN)) Q:'APPLEN D
..S SDSTP="" F S SDSTP=$O(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"DIV",SDIV,"CLIN",SDCLN,SDPRV,"APP","LEN",APPLEN,SDSTP)) Q:SDSTP="" D
...Q:SDSTP="STAT" S ACTOT=""
...S APPTOT=$G(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"DIV",SDIV,"CLIN",SDCLN,SDPRV,"APP","LEN",APPLEN,SDSTP))
...I '$G(GRPFLG) S SDFILT=$$GRP^SDECXML(SDGRP) D SETTMPF^SDECXML(.SDLCNT,SDFILT,13)
...S APPOVR=$P(APPTOT,"^",2),APPNEW=$P(APPTOT,"^",3),APPEST=$P(APPTOT,"^",4),ACTOT=APPNEW+APPEST
...I ACTOT D PARSE^SDECXML2(ACTOT,SDCLN,SDPRV,"APPACT",APPLEN,SDSTP)
...I APPOVR S SDDATA=$$PROV^SDECXML(SDPRV)_" "_$$OVRAP^SDECXML2(APPOVR,APPLEN,SDSTP) D SETREC^SDECXML(.SDLCNT,SDDATA,15)
...I APPNEW S SDDATA=$$PROV^SDECXML(SDPRV)_" "_$$NEWAP^SDECXML2(APPNEW,APPLEN,SDSTP) D SETREC^SDECXML(.SDLCNT,SDDATA,15)
...I APPEST S SDDATA=$$PROV^SDECXML(SDPRV)_" "_$$ESTAP^SDECXML2(APPEST,APPLEN,SDSTP) D SETREC^SDECXML(.SDLCNT,SDDATA,15)
.;
.S PRTOT=$G(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"DIV",SDIV,"CLIN",SDCLN,SDPRV))
.Q:'PRTOT
.N SDI F SDI=1:1:4 D
..S SDDATA=$$PROV^SDECXML(SDPRV)_" "_$S(SDI=1:$$ENC^SDECXML($P(PRTOT,"^",SDI)),SDI=2:$$NEW^SDECXML($P(PRTOT,"^",SDI)),SDI=3:$$EST^SDECXML($P(PRTOT,"^",SDI)),SDI=4:$$TEL^SDECXML($P(PRTOT,"^",SDI)),1:"")
..Q:($TR(SDDATA,"^","")="")
..I '$G(GRPFLG) S SDFILT=$$GRP^SDECXML(SDGRP) D SETTMPF^SDECXML(.SDLCNT,SDFILT,13)
..D SETREC^SDECXML(.SDLCNT,SDDATA,15)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDECXML4 11996 printed Dec 13, 2024@02:53:07 Page 2
SDECXML4 ;ALB/JCH - SCHEDULING ENHANCEMENTS 3 (cont) ;11/03/14 10:59am
+1 ;;5.3;Scheduling;**628**;Aug 13, 1993;Build 371
+2 ;
ONECLIN(SDLCNT,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLIN,DTINC,ALLCLDIV,SDEBUG,CLNTAG,GRPFLG,SDNODE,XMLNODE) ; Single Clinic
+1 NEW SDCLINOK,APPTOT,APPDEM,ADJDIFF,ADJDEM,ACTOT,SDACTAP,APPLEN,SDCLINOK,ADJDIFF,ADJDEM,APPDEM
+2 NEW APPEST,APPNEW,APPOVR,CLTOT,SDDATA,SDFILT,SDRESCH
+3 SET SDCLINOK=""
SET APPTOT=""
+4 NEW SDGRP
+5 DO SDGRP^SDECXUTL($PIECE(SDCLIN,"^",2),.SDGRP)
+6 ;
+7 IF $GET(ALLCLDIV)
Begin DoDot:1
+8 IF $GET(GRPFLG)
DO OUTPUT^SDECXUTL("</Rg>",13,.SDLCNT,SDEBUG,.CLNTAG,.GRPFLG,.DIVTAG,XMLNODE)
+9 SET SDFILT=$$GRP^SDECXML(SDGRP)
DO SETTMPF^SDECXML(.SDLCNT,SDFILT,13)
End DoDot:1
+10 ;
+11 IF $GET(CLNTAG)
DO OUTPUT^SDECXUTL("</Rs>",15,.SDLCNT,SDEBUG,.CLNTAG,.GRPFLG,.DIVTAG,XMLNODE)
+12 SET SDFILT=$$CLIN^SDECXML(SDCLIN,1)
DO SETTMPF^SDECXML(.SDLCNT,SDFILT,15)
+13 ;
+14 ; Supply
+15 IF $GET(SDIV)
SET APPTOT=+$GET(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLIN,"APP","SUP"))
+16 IF 'SDIV
SET APPTOT=+$GET(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"CLIN",SDGRP,SDCLIN,"APP","SUP"))
+17 SET SDDATA=$$PROV^SDECXML("All")_" "_$$RCASUP^SDECXML($PIECE(APPTOT,"^"))
+18 DO SETREC^SDECXML(.SDLCNT,SDDATA,15)
+19 ;
+20 ; Appointments - overbooks, new, established, demand
+21 IF $GET(SDIV)
Begin DoDot:1
+22 SET APPTOT=""
SET APPLEN=""
SET SDACTAP=""
SET APPDEM=""
SET ACTOT=""
SET SDSTP=""
SET ADJDEM=""
SET ADJDIFF=""
+23 IF SDGRP=0
NEW TMPGRP
SET TMPGRP=$ORDER(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP))
+24 SET APPLEN=""
FOR
SET APPLEN=$ORDER(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLIN,"APP","LEN",APPLEN))
if APPLEN=""
QUIT
Begin DoDot:2
+25 SET SDSTP=""
FOR
SET SDSTP=$ORDER(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLIN,"APP","LEN",APPLEN,SDSTP))
if SDSTP=""
QUIT
Begin DoDot:3
+26 SET ACTOT=""
+27 SET APPTOT=$GET(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLIN,"APP","LEN",APPLEN,SDSTP))
+28 if (APPTOT="")
QUIT
+29 SET APPDEM=APPDEM+$PIECE(APPTOT,"^")
End DoDot:3
+30 SET SDRESCH=""
FOR
SET SDRESCH=$ORDER(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLIN,"APP","LEN",APPLEN,"STAT",SDRESCH))
if SDRESCH=""
QUIT
Begin DoDot:3
+31 if '($PIECE(SDRESCH,";")="NSR"!($PIECE(SDRESCH,";")="CPR")!($PIECE(SDRESCH,";")="CCR"))
QUIT
+32 SET ADJDIFF=ADJDIFF+(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLIN,"APP","LEN",APPLEN,"STAT",SDRESCH)*APPLEN)
End DoDot:3
End DoDot:2
+33 IF ADJDIFF&APPDEM
SET ADJDEM=APPDEM-ADJDIFF
+34 SET ADJDEM=$SELECT($GET(ADJDEM):ADJDEM,1:APPDEM)
+35 DO PARSE^SDECXML2(APPDEM,"All","All","DEM",APPLEN,SDSTP,ADJDEM)
+36 ; Appointments - overbooks, new, established, demand
+37 SET APPTOT=""
SET APPLEN=""
SET SDACTAP=""
SET APPDEM=""
SET ACTOT=""
+38 SET APPLEN=""
FOR
SET APPLEN=$ORDER(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLIN,"APP","LEN",APPLEN))
if APPLEN=""
QUIT
Begin DoDot:2
+39 SET SDSTP=""
FOR
SET SDSTP=$ORDER(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLIN,"APP","LEN",APPLEN,SDSTP))
if SDSTP=""
QUIT
Begin DoDot:3
+40 SET ACTOT=""
+41 SET APPTOT=$GET(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLIN,"APP","LEN",APPLEN,SDSTP))
+42 if (APPTOT="")
QUIT
+43 SET APPOVR=$PIECE(APPTOT,"^",2)
SET APPNEW=$PIECE(APPTOT,"^",3)
SET APPEST=$PIECE(APPTOT,"^",4)
SET ACTOT=APPNEW+APPEST
+44 DO PARSE^SDECXML2(ACTOT,"All","All","APPACT",APPLEN,SDSTP)
+45 IF APPOVR
SET SDDATA=$$PROV^SDECXML("All")_" "_$$OVRAP^SDECXML2(APPOVR,APPLEN,SDSTP)
DO SETREC^SDECXML(.SDLCNT,SDDATA,15)
+46 IF APPNEW
SET SDDATA=$$PROV^SDECXML("All")_" "_$$NEWAP^SDECXML2(APPNEW,APPLEN,SDSTP)
DO SETREC^SDECXML(.SDLCNT,SDDATA,15)
+47 IF APPEST
SET SDDATA=$$PROV^SDECXML("All")_" "_$$ESTAP^SDECXML2(APPEST,APPLEN,SDSTP)
DO SETREC^SDECXML(.SDLCNT,SDDATA,15)
End DoDot:3
End DoDot:2
End DoDot:1
+48 ;
+49 ;
+50 IF 'SDIV
Begin DoDot:1
+51 SET APPTOT=""
SET APPLEN=""
SET SDACTAP=""
SET APPDEM=""
SET ACTOT=""
SET SDSTP=""
SET ADJDEM=""
SET ADJDIFF=""
+52 SET APPLEN=""
FOR
SET APPLEN=$ORDER(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"FAC",SDGRP,SDCLIN,"APP","LEN",APPLEN))
if APPLEN=""
QUIT
Begin DoDot:2
+53 SET SDSTP=""
FOR
SET SDSTP=$ORDER(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"FAC",SDGRP,SDCLIN,"APP","LEN",APPLEN,SDSTP))
if SDSTP=""
QUIT
Begin DoDot:3
+54 SET ACTOT=""
+55 SET APPTOT=$GET(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"FAC",SDGRP,SDCLIN,"APP","LEN",APPLEN,SDSTP))
+56 if (APPTOT="")
QUIT
+57 SET APPDEM=APPDEM+$PIECE(APPTOT,"^")
End DoDot:3
+58 SET SDRESCH=""
FOR
SET SDRESCH=$ORDER(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"FAC",SDGRP,SDCLIN,"APP","LEN",APPLEN,"STAT",SDRESCH))
if SDRESCH=""
QUIT
Begin DoDot:3
+59 if '($PIECE(SDRESCH,";")="NSR"!($PIECE(SDRESCH,";")="CPR")!($PIECE(SDRESCH,";")="CCR"))
QUIT
+60 SET ADJDIFF=ADJDIFF+(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"FAC",SDGRP,SDCLIN,"APP","LEN",APPLEN,"STAT",SDRESCH)*APPLEN)
End DoDot:3
End DoDot:2
+61 IF ADJDIFF&APPDEM
SET ADJDEM=APPDEM-ADJDIFF
+62 SET ADJDEM=$SELECT($GET(ADJDEM):ADJDEM,1:APPDEM)
+63 DO PARSE^SDECXML2(APPDEM,"All","All","DEM",APPLEN,SDSTP,ADJDEM)
+64 ; Appointments - overbooks, new, established, demand
+65 SET APPTOT=""
SET APPLEN=""
SET SDACTAP=""
SET APPDEM=""
SET ACTOT=""
+66 SET APPLEN=""
FOR
SET APPLEN=$ORDER(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"FAC",SDGRP,SDCLIN,"APP","LEN",APPLEN))
if APPLEN=""
QUIT
Begin DoDot:2
+67 SET SDSTP=""
FOR
SET SDSTP=$ORDER(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"FAC",SDGRP,SDCLIN,"APP","LEN",APPLEN,SDSTP))
if SDSTP=""
QUIT
Begin DoDot:3
+68 SET ACTOT=""
+69 SET APPTOT=$GET(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"FAC",SDGRP,SDCLIN,"APP","LEN",APPLEN,SDSTP))
+70 if (APPTOT="")
QUIT
+71 SET APPOVR=$PIECE(APPTOT,"^",2)
SET APPNEW=$PIECE(APPTOT,"^",3)
SET APPEST=$PIECE(APPTOT,"^",4)
SET ACTOT=APPNEW+APPEST
+72 DO PARSE^SDECXML2(ACTOT,"All","All","APPACT",APPLEN,SDSTP)
+73 IF APPOVR
SET SDDATA=$$PROV^SDECXML("All")_" "_$$OVRAP^SDECXML2(APPOVR,APPLEN,SDSTP)
DO SETREC^SDECXML(.SDLCNT,SDDATA,15)
+74 IF APPNEW
SET SDDATA=$$PROV^SDECXML("All")_" "_$$NEWAP^SDECXML2(APPNEW,APPLEN,SDSTP)
DO SETREC^SDECXML(.SDLCNT,SDDATA,15)
+75 IF APPEST
SET SDDATA=$$PROV^SDECXML("All")_" "_$$ESTAP^SDECXML2(APPEST,APPLEN,SDSTP)
DO SETREC^SDECXML(.SDLCNT,SDDATA,15)
End DoDot:3
End DoDot:2
End DoDot:1
+76 ;
+77 ; Encounters
+78 IF $GET(SDIV)
SET CLTOT=$GET(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLIN))
+79 IF 'SDIV
SET CLTOT=$GET(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"FAC",SDGRP,SDCLIN))
+80 IF (CLTOT]"")
Begin DoDot:1
+81 NEW SDI
FOR SDI=1:1:4
Begin DoDot:2
+82 SET SDDATA=$$PROV^SDECXML("All")_" "_$SELECT(SDI=1:$$ENC^SDECXML($PIECE(CLTOT,"^",SDI)),SDI=2:$$NEW^SDECXML($PIECE(CLTOT,"^",SDI)),SDI=3:$$EST^SDECXML($PIECE(CLTOT,"^",SDI)),SDI=4:$$TEL^SDECXML($PIECE(CLTOT,"^",SDI)),1:"")
+83 if ($TRANSLATE(SDDATA,"^","")="")
QUIT
+84 DO SETREC^SDECXML(.SDLCNT,SDDATA,15)
End DoDot:2
+85 ;
End DoDot:1
+86 QUIT
+87 ;
PRALALAL(SDLCNT,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLN,SDPRV,DTINC,DTNAM) ; provider - all division, all groups, by clinic
+1 ; Provider - all divisions, all groups (facility level, for report type)
+2 NEW APPTOT,APPLEN,SDACTAP,APPDEM,ACTOT,SDSTP,ADJDIFF,ADJDEM,PRTOT,SDDATA,SDFILT,SDRESCH
+3 IF SDIV="All"
IF SDGRP="All"
Begin DoDot:1
+4 SET APPTOT=""
SET APPLEN=""
SET SDACTAP=""
SET APPDEM=""
SET ACTOT=""
SET SDSTP=""
SET ADJDIFF=""
SET ADJDEM=""
+5 FOR
SET APPLEN=$ORDER(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,"CLIN",SDCLN,"PROV",SDPRV,"APP","LEN",APPLEN))
if 'APPLEN
QUIT
Begin DoDot:2
+6 SET SDSTP=""
FOR
SET SDSTP=$ORDER(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,"CLIN",SDCLN,"PROV",SDPRV,"APP","LEN",APPLEN,SDSTP))
if SDSTP=""
QUIT
Begin DoDot:3
+7 if SDSTP="STAT"
QUIT
SET ACTOT=""
+8 SET APPTOT=$GET(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,"CLIN",SDCLN,"PROV",SDPRV,"APP","LEN",APPLEN,SDSTP))
+9 SET APPDEM=APPDEM+APPTOT
End DoDot:3
+10 SET SDRESCH=""
FOR
SET SDRESCH=$ORDER(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,"CLIN",SDCLN,"PROV",SDPRV,"APP","LEN",APPLEN,"STAT",SDRESCH))
if SDRESCH=""
QUIT
Begin DoDot:3
+11 if '($PIECE(SDRESCH,";")="NSR"!($PIECE(SDRESCH,";")="CPR")!($PIECE(SDRESCH,";")="CCR"))
QUIT
+12 SET ADJDIFF=ADJDIFF+(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,"CLIN",SDCLN,"PROV",SDPRV,"APP","LEN",APPLEN,"STAT",SDRESCH)*APPLEN)
End DoDot:3
End DoDot:2
+13 SET ADJDEM=APPDEM
IF ADJDIFF&APPDEM
SET ADJDEM=APPDEM-ADJDIFF
+14 SET ADJDEM=$SELECT($GET(ADJDIFF):ADJDEM,1:APPDEM)
+15 DO PARSE^SDECXML2(APPDEM,SDCLN,SDPRV,"DEM",APPLEN,SDSTP,ADJDEM)
+16 ;
+17 ; Appointments - lengths
+18 SET APPTOT=""
SET APPLEN=""
SET SDACTAP=""
SET APPDEM=""
SET ACTOT=""
+19 FOR
SET APPLEN=$ORDER(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,"CLIN",SDCLN,"PROV",SDPRV,"APP","LEN",APPLEN))
if 'APPLEN
QUIT
Begin DoDot:2
+20 SET SDSTP=""
FOR
SET SDSTP=$ORDER(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,"CLIN",SDCLN,"PROV",SDPRV,"APP","LEN",APPLEN,SDSTP))
if SDSTP=""
QUIT
Begin DoDot:3
+21 if SDSTP="STAT"
QUIT
SET ACTOT=""
+22 SET APPTOT=$GET(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,"CLIN",SDCLN,"PROV",SDPRV,"APP","LEN",APPLEN,SDSTP))
+23 IF '$GET(GRPFLG)
SET SDFILT=$$GRP^SDECXML(SDGRP)
DO SETTMPF^SDECXML(.SDLCNT,SDFILT,13)
+24 SET APPOVR=$PIECE(APPTOT,"^",2)
SET APPNEW=$PIECE(APPTOT,"^",3)
SET APPEST=$PIECE(APPTOT,"^",4)
SET ACTOT=APPNEW+APPEST
+25 IF ACTOT
DO PARSE^SDECXML2(ACTOT,SDCLN,SDPRV,"APPACT",APPLEN,SDSTP)
+26 IF APPOVR
SET SDDATA=$$PROV^SDECXML(SDPRV)_" "_$$OVRAP^SDECXML2(APPOVR,APPLEN,SDSTP)
DO SETREC^SDECXML(.SDLCNT,SDDATA,15)
+27 IF APPNEW
SET SDDATA=$$PROV^SDECXML(SDPRV)_" "_$$NEWAP^SDECXML2(APPNEW,APPLEN,SDSTP)
DO SETREC^SDECXML(.SDLCNT,SDDATA,15)
+28 IF APPEST
SET SDDATA=$$PROV^SDECXML(SDPRV)_" "_$$ESTAP^SDECXML2(APPEST,APPLEN,SDSTP)
DO SETREC^SDECXML(.SDLCNT,SDDATA,15)
End DoDot:3
End DoDot:2
+29 ;
+30 SET PRTOT=$GET(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,"CLIN",SDCLN,"PROV",SDPRV))
+31 if 'PRTOT
QUIT
+32 NEW SDI
FOR SDI=1:1:4
Begin DoDot:2
+33 SET SDDATA=$$PROV^SDECXML(SDPRV)_" "_$SELECT(SDI=1:$$ENC^SDECXML($PIECE(PRTOT,"^",SDI)),SDI=2:$$NEW^SDECXML($PIECE(PRTOT,"^",SDI)),SDI=3:$$EST^SDECXML($PIECE(PRTOT,"^",SDI)),SDI=4:$$TEL^SDECXML($PIECE(PRTOT,"^",SDI)),1:"")
+34 if ($TRANSLATE(SDDATA,"^","")="")
QUIT
+35 IF '$GET(GRPFLG)
SET SDFILT=$$GRP^SDECXML(SDGRP)
DO SETTMPF^SDECXML(.SDLCNT,SDFILT,13)
+36 DO SETREC^SDECXML(.SDLCNT,SDDATA,15)
End DoDot:2
End DoDot:1
+37 QUIT
+38 ;
PRALAL(SDLCNT,SDRPTYP,SDAT,SDFAC,SDIV,SDGRP,SDCLN,SDPRV,DTINC,DTNAM) ; providers - all groups in one division, specific clinic
+1 ; Provider - one division, all groups (division level, for report type)
+2 NEW APPTOT,APPLEN,SDACTAP,APPDEM,ACTOT,SDSTP,ADJDIFF,ADJDEM,PRTOT
+3 IF SDIV
IF $PIECE(SDCLN,"^",2)
IF SDGRP="All"
Begin DoDot:1
+4 SET APPTOT=""
SET APPLEN=""
SET SDACTAP=""
SET APPDEM=""
SET ACTOT=""
SET SDSTP=""
SET ADJDIFF=""
SET ADJDEM=""
SET ADJDEM=""
+5 FOR
SET APPLEN=$ORDER(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"DIV",SDIV,"CLIN",SDCLN,SDPRV,"APP","LEN",APPLEN))
if 'APPLEN
QUIT
Begin DoDot:2
+6 SET SDSTP=""
FOR
SET SDSTP=$ORDER(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"DIV",SDIV,"CLIN",SDCLN,SDPRV,"APP","LEN",APPLEN,SDSTP))
if SDSTP=""
QUIT
Begin DoDot:3
+7 if SDSTP="STAT"
QUIT
SET ACTOT=""
+8 SET APPTOT=$GET(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"DIV",SDIV,"CLIN",SDCLN,SDPRV,"APP","LEN",APPLEN,SDSTP))
+9 SET APPDEM=APPDEM+APPTOT
End DoDot:3
+10 SET SDRESCH=""
FOR
SET SDRESCH=$ORDER(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"DIV",SDIV,"CLIN",SDCLN,SDPRV,"APP","LEN",APPLEN,"STAT",SDRESCH))
if SDRESCH=""
QUIT
Begin DoDot:3
+11 if '($PIECE(SDRESCH,";")="NSR"!($PIECE(SDRESCH,";")="CPR")!($PIECE(SDRESCH,";")="CCR"))
QUIT
+12 SET ADJDIFF=ADJDIFF+(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"DIV",SDIV,"CLIN",SDCLN,SDPRV,"APP","LEN",APPLEN,"STAT",SDRESCH)*APPLEN)
End DoDot:3
End DoDot:2
+13 SET ADJDEM=APPDEM
IF ADJDIFF&APPDEM
SET ADJDEM=APPDEM-ADJDIFF
+14 SET ADJDEM=$SELECT($GET(ADJDIFF):ADJDEM,1:APPDEM)
+15 DO PARSE^SDECXML2(APPDEM,SDCLN,SDPRV,"DEM",APPLEN,SDSTP,ADJDEM)
+16 ;
+17 ; Appointments - lengths
+18 SET APPTOT=""
SET APPLEN=""
SET SDACTAP=""
SET APPDEM=""
SET ACTOT=""
+19 FOR
SET APPLEN=$ORDER(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"DIV",SDIV,"CLIN",SDCLN,SDPRV,"APP","LEN",APPLEN))
if 'APPLEN
QUIT
Begin DoDot:2
+20 SET SDSTP=""
FOR
SET SDSTP=$ORDER(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"DIV",SDIV,"CLIN",SDCLN,SDPRV,"APP","LEN",APPLEN,SDSTP))
if SDSTP=""
QUIT
Begin DoDot:3
+21 if SDSTP="STAT"
QUIT
SET ACTOT=""
+22 SET APPTOT=$GET(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"DIV",SDIV,"CLIN",SDCLN,SDPRV,"APP","LEN",APPLEN,SDSTP))
+23 IF '$GET(GRPFLG)
SET SDFILT=$$GRP^SDECXML(SDGRP)
DO SETTMPF^SDECXML(.SDLCNT,SDFILT,13)
+24 SET APPOVR=$PIECE(APPTOT,"^",2)
SET APPNEW=$PIECE(APPTOT,"^",3)
SET APPEST=$PIECE(APPTOT,"^",4)
SET ACTOT=APPNEW+APPEST
+25 IF ACTOT
DO PARSE^SDECXML2(ACTOT,SDCLN,SDPRV,"APPACT",APPLEN,SDSTP)
+26 IF APPOVR
SET SDDATA=$$PROV^SDECXML(SDPRV)_" "_$$OVRAP^SDECXML2(APPOVR,APPLEN,SDSTP)
DO SETREC^SDECXML(.SDLCNT,SDDATA,15)
+27 IF APPNEW
SET SDDATA=$$PROV^SDECXML(SDPRV)_" "_$$NEWAP^SDECXML2(APPNEW,APPLEN,SDSTP)
DO SETREC^SDECXML(.SDLCNT,SDDATA,15)
+28 IF APPEST
SET SDDATA=$$PROV^SDECXML(SDPRV)_" "_$$ESTAP^SDECXML2(APPEST,APPLEN,SDSTP)
DO SETREC^SDECXML(.SDLCNT,SDDATA,15)
End DoDot:3
End DoDot:2
+29 ;
+30 SET PRTOT=$GET(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"DIV",SDIV,"CLIN",SDCLN,SDPRV))
+31 if 'PRTOT
QUIT
+32 NEW SDI
FOR SDI=1:1:4
Begin DoDot:2
+33 SET SDDATA=$$PROV^SDECXML(SDPRV)_" "_$SELECT(SDI=1:$$ENC^SDECXML($PIECE(PRTOT,"^",SDI)),SDI=2:$$NEW^SDECXML($PIECE(PRTOT,"^",SDI)),SDI=3:$$EST^SDECXML($PIECE(PRTOT,"^",SDI)),SDI=4:$$TEL^SDECXML($PIECE(PRTOT,"^",SDI)),1:"
")
+34 if ($TRANSLATE(SDDATA,"^","")="")
QUIT
+35 IF '$GET(GRPFLG)
SET SDFILT=$$GRP^SDECXML(SDGRP)
DO SETTMPF^SDECXML(.SDLCNT,SDFILT,13)
+36 DO SETREC^SDECXML(.SDLCNT,SDDATA,15)
End DoDot:2
End DoDot:1
+37 QUIT