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

SDSCPRV.m

Go to the documentation of this file.
SDSCPRV ;ALB/JAM/RBS - ASCD Provider Total Report ; 1/19/07 12:46pm
 ;;5.3;Scheduling;**495,1015**;Aug 13, 1993;Build 21
 ;;MODIFIED FOR NATIONAL RELEASE from a Class III software product
 ;;known as Service Connected Automated Monitoring (SCAM).
 ;
 ;**Program Description**
 ;  This report gives a total of the number of encounters that meet
 ;  the criteria: SC='Yes', auto-verified, and changed
 Q
EN ;  Entry Point
 N DIR,SDSCDVSL,SDSCDVLN,X,Y,ZTQUEUED,POP,ZTRTN,ZTDTH,ZTDESC,ZTSAVE
 ; Get Divisions
 D DIV^SDSCUTL
 D ^DIR
 I $G(DTOUT)!($G(DUOUT)) G EXIT
 S SDSCDVSL=Y,SDSCDVLN=SCLN
 ;  Get start and end date for report
 D GETDATE^SDSCOMP I SDSCTDT="" G EXIT
 K %ZIS,IOP,IOC,ZTIO S %ZIS="MQ" D ^%ZIS G:POP EXIT
 I $D(IO("Q")) D  G EXIT
 . S ZTRTN="BEG^SDSCPRV",ZTDTH=$H,ZTDESC="ASCD Provider Total Report"
 . S ZTSAVE("SDSCBDT")="",ZTSAVE("SDSCEDT")="",ZTSAVE("SDSCDVSL")=""
 . S ZTSAVE("SDSCDVLN")="",ZTSAVE("GROUP")="",ZTSAVE("SDEDT")="",ZTSAVE("SDSCTDT")=""
 . K IO("Q") D ^%ZTLOAD W !,"REQUEST QUEUED"
 ;
BEG ;  Begin report
 N P,L,SDABRT,CT,SDSCDIV,SDSCDNM,THDR,SDI
 S (P,L,SDABRT,CT)=0
 S SDSCDIV=$S(SDSCDVSL'[SDSCDVLN:SDSCDVSL,1:"")
 I SDSCDIV="" S SDSCDNM="ALL" D FND G EXT
 I SDSCDIV'="" D
 . S THDR=""
 . F SDI=1:1:$L(SDSCDVSL,",") S SDSCDIV=$P(SDSCDVSL,",",SDI) Q:SDSCDIV=""  D  Q:$G(SDABRT)=1
 .. S SDSCDNM=$P(^DG(40.8,SDSCDIV,0),"^",1),THDR=THDR_SDSCDNM_",",CT=CT+1 D FND
 G EXT
 ;
FND ;
 N SDPROV,SDOEDT,SDPRNM,SDOE,SDSCDATA,TOTAL,TYP,LEV1,COL,AMT,SCVAL
 K ^TMP("SDSCPRV",$J)
 S SDPROV=0
 F  S SDPROV=$O(^SDSC(409.48,"AF",SDPROV)) Q:'SDPROV  D
 . S SDOEDT=SDSCTDT,SDPRNM=$$UP^XLFSTR($$NAME^XUSER(SDPROV,"F"))
 . F  S SDOEDT=$O(^SDSC(409.48,"AF",SDPROV,SDOEDT)) Q:SDOEDT\1>SDEDT!(SDOEDT="")  D
 .. S SDOE=""
 .. F  S SDOE=$O(^SDSC(409.48,"AF",SDPROV,SDOEDT,SDOE)) Q:'SDOE  D
 ... I SDSCDIV'="" Q:$P(^SDSC(409.48,SDOE,0),U,12)'=SDSCDIV
 ... S SDSCDATA=^SDSC(409.48,SDOE,0)
 ... I +$P(SDSCDATA,U,9),+$P(SDSCDATA,U,6) D STORE("VBA") Q
 ... I $P(SDSCDATA,U,5)="C" S SCVAL=$$SCHNG^SDSCUTL(SDOE) D:SCVAL'=""  Q
 ....I '+SCVAL D STORE("NO CHANGE") Q
 ....I $P(SCVAL,"^",2) D STORE("SCNSC") Q
 ....D STORE("NSCSC")
 ... D STORE("NEW")
 ;
PRT ; Print
 K TOTAL
 S SDHDR="Provider Summary Data Report"
 D HDR G EXT:$G(SDABRT)=1
 F TYP="VBA","SCNSC","NSCSC","NO CHANGE","NEW" S TOTAL(TYP)=0
 S LEV1=""
 F  S LEV1=$O(^TMP("SDSCPRV",$J,LEV1)) Q:LEV1=""  D  Q:$G(SDABRT)=1
 . I L+4>IOSL D HDR Q:$G(SDABRT)=1
 . W !,LEV1 S L=L+1
 . S COL=20 F TYP="VBA","SCNSC","NSCSC","NO CHANGE","NEW" S COL=COL+10 D
 .. S AMT=+$G(^TMP("SDSCPRV",$J,LEV1,TYP)),SBTOT(LEV1,TYP)=$G(SBTOT(LEV1,TYP))+AMT,TOTAL(TYP)=$G(TOTAL(TYP))+AMT
 .. W ?COL,$J(AMT,7)
 I $G(SDABRT)=1 Q
 S COL=20,L=L+1 W ! I L+4>IOSL D HDR Q:$G(SDABRT)=1
 F TYP="VBA","SCNSC","NSCSC","NO CHANGE","NEW" S COL=COL+10 D
 . W ?COL,"-------"
 S COL=20,L=L+1 W !,"TOTAL"
 F TYP="VBA","SCNSC","NSCSC","NO CHANGE","NEW" S COL=COL+10 D
 . W ?COL,$J($G(TOTAL(TYP)),7)
 Q
 ;
EXT ;
 I CT>1,$G(SDABRT)'=1 D PRTT
 D RPTEND^SDSCRPT1
 ;
EXIT ;
 K SDNWPV,SDSCBDT,SDSCEDT,EDIV,GROUP,SDSCTDT,SDEDT,I,Y,^TMP("SDSCPRV",$J)
 K SDHDR,SCLN,DTOUT,DUOUT,SBTOT,TOTAL
 Q
STORE(VAL) ; Total up and Store
 S ^TMP("SDSCPRV",$J,SDPRNM,VAL)=$G(^TMP("SDSCPRV",$J,SDPRNM,VAL))+1
 S ^TMP("SDSCPRV",$J,SDPRNM,VAL,SDOE)=""
 K VAL
 Q
HDR ;  Header
 U IO D STDHDR^SDSCRPT2 Q:$G(SDABRT)=1
 S SDNWPV=1
 W SDHDR,?67,"PAGE: ",P
 W !,?5,"For Encounters Dated ",$$FMTE^XLFDT(SDSCTDT,2)," THRU ",$$FMTE^XLFDT(SDEDT,2)_"  By Division: "_SDSCDNM
 W !?31," VBA OK",?40,"SC to NSC",?51,"NSC to SC",?62,"SC KEPT",?74,"NEW",!
 F I=1:1:79 W "-"
 Q
 ;
HDR1 ;
 N HHDR,HHDR1,HHDR2,HHDR3,HHDR4,I
 U IO D STDHDR^SDSCRPT2 Q:$G(SDABRT)=1
 I $E(THDR,$L(THDR))="," S THDR=$E(THDR,1,$L(THDR)-1)
 W SDHDR,?67,"PAGE: ",P
 S HHDR1="For Encounters Dated "_$$FMTE^XLFDT(SDSCTDT,2)_" THRU "_$$FMTE^XLFDT(SDEDT,2)_" TOTAL for "
 S HHDR2=THDR
 I $L(HHDR1)+$L(HHDR2)>IOM D
 . S HHDR3=$P(HHDR2,",",1),HHDR4=$P(HHDR2,",",2,99)
 . S HHDR=HHDR1_HHDR3
 . I HHDR4'="" S HHDR=HHDR_","
 I $L(HHDR1)+$L(HHDR2)'>IOM D
 . S HHDR=HHDR1_HHDR2
 W !,HHDR
 I $G(HHDR4)'="" W !,?5,HHDR4
 W !?31," VBA OK",?40,"SC to NSC",?51,"NSC to SC",?62,"SC KEPT",?74,"NEW",!
 F I=1:1:79 W "-"
 Q
 ;
PRTT ;
 D HDR1 Q:$G(SDABRT)=1
 F TYP="VBA","SCNSC","NSCSC","NO CHANGE","NEW" S TOTAL(TYP)=0
 S LEV1=""
 F  S LEV1=$O(SBTOT(LEV1)) Q:LEV1=""  D
 . I L+4>IOSL D HDR1 Q:$G(SDABRT)=1
 . W !,LEV1 S L=L+1
 . S COL=20 F TYP="VBA","SCNSC","NSCSC","NO CHANGE","NEW" S COL=COL+10 D
 .. S AMT=SBTOT(LEV1,TYP),TOTAL(TYP)=$G(TOTAL(TYP))+AMT
 .. W ?COL,$J(AMT,7)
 S COL=20,L=L+1 W ! I L+4>IOSL D HDR1 Q:$G(SDABRT)=1
 F TYP="VBA","SCNSC","NSCSC","NO CHANGE","NEW" S COL=COL+10 D
 . W ?COL,"-------"
 S COL=20,L=L+1 W !,"TOTAL"
 F TYP="VBA","SCNSC","NSCSC","NO CHANGE","NEW" S COL=COL+10 D
 . W ?COL,$J($G(TOTAL(TYP)),7)
 Q