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

SDECXML4.m

Go to the documentation of this file.
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