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

SDECXML1.m

Go to the documentation of this file.
SDECXML1 ;ALB/JCH - SCHEDULING ENHANCEMENTS 3 (cont) ;11/03/14 10:59am
 ;;5.3;Scheduling;**628**;Aug 13, 1993;Build 371
 ;
GRPALLF(SDRPTYP,SDAT,SDFAC,SDIV,SDVGRCL,CLNTAG,DTINC,DTNAM,GRPFLG,SDLCNT,SDEBUG,SDGALL,SDCALL,SDNODE,XMLNODE) ; all groups all divisions
 ; If ResourceGroup=All, get all clins and provs in all groups
 N TMPGRP,SDGRPALL,SDGRCL,GRPCLNAR,SDGRPF,TMPCLN,ALCLCT,ALLCLDIV,APPEST,APPNEW,APPOVR
 S TMPGRP=SDGRP
 N SDGRP,SDCLN,SDGRPAR,SDDVTAG,TOT,TOTA,TOTS,SDPRV,IP,ADJDIFF,ADJDEM,APPDEM,DIVTOT,SDFILT,DATINC
 S SDGRP=TMPGRP,DATINC=$G(DTNAMAR(DTINC))
 ;
 ; Multiple groups found, do All
 I $G(GRPFLG) D OUTPUT^SDECXUTL("</Rg>",12,.SDLCNT,SDEBUG,.CLNTAG,.GRPFLG,.DIVTAG,XMLNODE)
 S SDFILT=$$GRP^SDECXML("All") D SETTMPF^SDECXML(.SDLCNT,SDFILT,13)
 N SDGRP,SDCLN,SDGRPAR,SDDVTAG,TOT,TOTA,TOTS,SDPRV,IP
 S SDGRP=0
 S (TOT,TOTA,TOTS)=""
 S TOT=$G(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC))
 S TOTA=$O(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"APP","LEN",""))
 S TOTS=$G(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"APP","SUP"))
 I (TOT'="")!(TOTA)!(TOTS'="") D
 .I $G(CLNTAG) D OUTPUT^SDECXUTL("</Rs>",15,.SDLCNT,SDEBUG,.CLNTAG,.GRPFLG,.DIVTAG,XMLNODE)
 .S SDFILT=$$CLIN^SDECXML("All",1) D SETTMPF^SDECXML(.SDLCNT,SDFILT,15)
 .;
 .; Appointments - Supply
 .S APPTOT=TOTS
 .D PARSE^SDECXML2(APPTOT,"All","All","SUP")
 .;
 .; Appointments - All divisions Demand, Lengths
 .S APPTOT="",SDLG2="",APPDEM="",APPNEW="",APPEST="",APPOVR="",ACTOT="",ADJDEM="",ADJDIFF=""
 .S APPLEN=0 F  S APPLEN=$O(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"APP","LEN",APPLEN)) Q:'APPLEN  D
 ..S SDLG2="" F  S SDLG2=$O(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"APP","LEN",APPLEN,SDLG2)) Q:SDLG2=""  D
 ...Q:SDLG2="STAT"  S ACTOT=""
 ...S APPTOT=$G(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"APP","LEN",APPLEN,SDLG2))
 ...S APPDEM=APPDEM+$P(APPTOT,"^")
 ..N SDRESCH S SDRESCH="" F  S SDRESCH=$O(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"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,"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","","",ADJDEM)
 .S APPLEN=0 F  S APPLEN=$O(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"APP","LEN",APPLEN)) Q:'APPLEN  D
 ..S SDLG2="" F  S SDLG2=$O(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"APP","LEN",APPLEN,SDLG2)) Q:SDLG2=""  D
 ...Q:SDLG2="STAT"  S ACTOT=""
 ...S APPTOT=$G(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC,"APP","LEN",APPLEN,SDLG2))
 ...S APPOVR=$P(APPTOT,"^",2),APPNEW=$P(APPTOT,"^",3),APPEST=$P(APPTOT,"^",4),ACTOT=APPNEW+APPEST
 ...I ACTOT D PARSE^SDECXML2(ACTOT,"All","All","APPACT",APPLEN,SDLG2)
 ...I '(APPOVR="") D PARSE^SDECXML2(APPOVR,"All","All","APPOVR",APPLEN,SDLG2)
 ...I '(APPNEW="") D PARSE^SDECXML2(APPNEW,"All","All","APPNEW",APPLEN,SDLG2)
 ...I '(APPEST="") D PARSE^SDECXML2(APPEST,"All","All","APPEST",APPLEN,SDLG2)
 .;
 .S APPTOT="",SDLG2="",APPDEM="",APPNEW="",APPEST="",APPOVR="",ACTOT="",ADJDEM="",ADJDIFF=""
 .;
 .; Encounters
 .S TOT=$G(^XTMP(SDNODE,DTNAM,SDRPTYP,SDAT,SDFAC))
 .I TOT'="" D PARSE^SDECXML2(TOT,"All","All")
 .;
 .; Appointments - Provider specific
 .S SDPRV="" F IP=0:1 S SDPRV=$O(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,SDPRV)) Q:SDPRV=""  D
 ..Q:'(SDPRV["^")
 ..D GPALCONT
 ..S DIVTOT=$G(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,SDPRV))
 ..I '(DIVTOT="") D PARSE^SDECXML2(DIVTOT,"All",SDPRV)
 .I $G(CLNTAG) D OUTPUT^SDECXUTL("</Rs>",15,.SDLCNT,SDEBUG,.CLNTAG,.GRPFLG,.DIVTAG,XMLNODE)
 ;
 ; Do all clinics in all divisions
 D ALLCLDIV(SDNODE,DTNAM,SDAT,SDGRP,"All")
 ;
 I $G(CLNTAG) D OUTPUT^SDECXUTL("</Rs>",15,.SDLCNT,SDEBUG,.CLNTAG,.GRPFLG,.DIVTAG,XMLNODE)
 I $G(GRPFLG) D OUTPUT^SDECXUTL("</Rg>",13,.SDLCNT,SDEBUG,.CLNTAG,.GRPFLG,.DIVTAG,XMLNODE)
 ;
 D GETGRPCL^SDECXML3(SDNODE,DATINC,SDRPTYP,SDAT,SDFAC,.GRPCLNAR)  ; Get clinics in each group
 S SDGRPF="" F  S SDGRPF=$O(GRPCLNAR(SDGRPF)) Q:SDGRPF=""  D
 .S ALCLCT=0
 .Q:(SDGRPF=0)
 .I $G(GRPFLG) D OUTPUT^SDECXUTL("</Rg>",13,.SDLCNT,SDEBUG,.CLNTAG,.GRPFLG,.DIVTAG,XMLNODE)
 .S SDFILT=$$GRP^SDECXML(SDGRPF) D SETTMPF^SDECXML(.SDLCNT,SDFILT,13)
 .S TMPCLN="" F  S TMPCLN=$O(GRPCLNAR(SDGRPF,TMPCLN)) Q:TMPCLN=""  D
 ..D GRPALL2(SDGRPF,TMPCLN,XMLNODE)
 ;
 I $G(GRPFLG) D OUTPUT^SDECXUTL("</Rg>",13,.SDLCNT,SDEBUG,.CLNTAG,.GRPFLG,.DIVTAG,XMLNODE)
 ;
 Q
 ;
GRPALL2(SDGRPF,CLN,XMLNODE) ; All Groups Continued
 N SDAGTYP S DIV=""
 S SDAGTYP="GRF",ALLCLDIV=2
 I '$G(ALCLCT) D ALLCLIN^SDECXML5(.SDLCNT,SDRPTYP,SDAT,SDFAC,DIV,SDGRPF,DTINC,.CLNTAG,ALLCLDIV,SDCALL,SDNODE,.GRPFLG,SDEBUG,XMLNODE) D
 .I $G(CLNTAG) D OUTPUT^SDECXUTL("</Rs>",15,.SDLCNT,SDEBUG,.CLNTAG,.GRPFLG,.DIVTAG,XMLNODE)
 D ONECLIN^SDECXML4(.SDLCNT,SDRPTYP,SDAT,SDFAC,"All",SDGRPF,CLN,DTINC,"",SDEBUG,.CLNTAG,.GRPFLG,SDNODE,XMLNODE) ; Single Clinic
 S ALCLCT=$G(ALCLCT)+1
 S PRV="" F  S PRV=$O(^XTMP(SDNODE,"PROVIDER",DATINC,SDRPTYP,SDAT,"GRP",SDGRPF,"CLIN",CLN,PRV)) Q:PRV=""  D
 .Q:'(PRV["^")
 .Q:'$D(^XTMP(SDNODE,"PROVIDER",DATINC,SDRPTYP,SDAT,"GRP",SDGRPF,"CLIN",CLN,PRV))
 .D PROVIDER^SDECXML2(.SDLCNT,SDRPTYP,SDAT,SDFAC,"All",SDGRPF,CLN,PRV,DATINC,.CLNTAG,.GRPFLG,SDCALL,$G(DTNAM),SDGALL,SDNODE)
 I $G(CLNTAG) D OUTPUT^SDECXUTL("</Rs>",15,.SDLCNT,SDEBUG,.CLNTAG,.GRPFLG,.DIVTAG,XMLNODE)
 Q
 ;
GPALCONT ; Continue GRPALL
 N APPLEN,SDLG,SDLG2,APPDEM,APPTOT,SDLG2,ACTOT,ADJDEM,ADJDIFF,SDRESCH
 ;
 ; Appointments - All divisions Demand, Lengths
 S APPLEN="",APPDEM="",APPTOT="",SDLG2="",ACTOT="",ADJDEM="",ADJDIFF=""
 S APPLEN=0 F  S APPLEN=$O(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,SDPRV,"APP","LEN",APPLEN)) Q:'APPLEN  D
 .S SDLG2="" F  S SDLG2=$O(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,SDPRV,"APP","LEN",APPLEN,SDLG2)) Q:SDLG2=""  D
 ..Q:SDLG2="STAT"  S ACTOT=""
 ..S APPTOT=$G(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,SDPRV,"APP","LEN",APPLEN,SDLG2))
 ..Q:APPTOT=""
 ..S APPDEM=APPDEM+$P(APPTOT,"^")
 .S SDRESCH="" F  S SDRESCH=$O(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,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,SDPRV,"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",SDPRV,"DEM",APPLEN,SDLG2,ADJDEM)
 S APPLEN=0 F  S APPLEN=$O(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,SDPRV,"APP","LEN",APPLEN)) Q:'APPLEN  D
 .S SDLG2="" F  S SDLG2=$O(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,SDPRV,"APP","LEN",APPLEN,SDLG2)) Q:SDLG2=""  D
 ..S ACTOT=""
 ..S APPTOT=$G(^XTMP(SDNODE,"PROVIDER",DTNAM,SDRPTYP,SDAT,"FAC",SDFAC,SDPRV,"APP","LEN",APPLEN,SDLG2))
 ..Q:APPTOT=""
 ..S APPOVR=$P(APPTOT,"^",2),APPNEW=$P(APPTOT,"^",3),APPEST=$P(APPTOT,"^",4),ACTOT=APPNEW+APPEST
 ..D PARSE^SDECXML2(ACTOT,"All",SDPRV,"APPACT",APPLEN,SDLG2)
 ..I '(APPOVR="") D PARSE^SDECXML2(APPOVR,"All",SDPRV,"APPOVR",APPLEN,SDLG2)
 ..I '(APPNEW="") D PARSE^SDECXML2(APPNEW,"All",SDPRV,"APPNEW",APPLEN,SDLG2)
 ..I '(APPEST="") D PARSE^SDECXML2(APPEST,"All",SDPRV,"APPEST",APPLEN,SDLG2)
 Q
 ;
ALLCLDIV(SDNODE,DATINC,SDAT,GRP,SDIV,ALLCLDIV) ; Get all totals for one group all divisions
 N DIVCLNAR,SDAGTYP,CLN,ALCLCT,PRV,DIV,CLGRPCNT S ALCLCT=0,DIV="",CLGRPCNT=0
 N SDGRP,SDIV,GRP
 S SDIV="All",SDAGTYP="GRF"
 I $G(SDAGTYP) S DIV=$O(^XTMP(SDNODE,DATINC,SDRPTYP,SDAT,SDFAC,DIV),-1)
 S ALLCLDIV=+$G(ALLCLDIV)
 S ALCLCT=0
 F  S DIV=$O(^XTMP(SDNODE,DATINC,SDRPTYP,SDAT,SDFAC,DIV)) Q:'DIV  D
 .K DIVCLNAR
 .D GETDIVCL^SDECXML3(SDNODE,DATINC,SDRPTYP,SDAT,SDFAC,DIV,.DIVCLNAR)
 .S CLN="" F  S CLN=$O(DIVCLNAR(DIV,CLN)) Q:CLN=""  D
 ..Q:CLN="APP"
 ..S CLGRPCNT=$G(CLGRPCNT)+1
 ..D SDGRP^SDECXUTL($P(CLN,"^",2),.SDGRP) S GRP=SDGRP
 ..D ONECLIN^SDECXML4(.SDLCNT,SDRPTYP,SDAT,SDFAC,DIV,SDGRP,CLN,DTINC,ALLCLDIV,SDEBUG,.CLNTAG,.GRPFLG,SDNODE,XMLNODE) ; Single Clinic
 ..S ALCLCT=$G(ALCLCT)+1
 ..S PRV="" F  S PRV=$O(^XTMP(SDNODE,DATINC,SDRPTYP,SDAT,SDFAC,DIV,GRP,CLN,PRV)) Q:PRV=""  D
 ...Q:'(PRV["^")
 ...D PROVIDER^SDECXML2(.SDLCNT,SDRPTYP,SDAT,SDFAC,"All","All",CLN,PRV,$E(DATINC),.CLNTAG,.GRPFLG,SDCALL,$G(DTNAM),SDGALL,SDNODE)
 Q