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

DGPPRP4.m

Go to the documentation of this file.
DGPPRP4 ;LIB/MKN - PRESUMPTIVE PSYCHOSIS GENDER REPORT ;08/15/2019
 ;;5.3;Registration;**977**August 02, 2019;;Build 177
 ;
 ;IA's
 ; 10004 Sup ^DIQ:   $$GET1, GETS
 ; 10026 Sup ^DIR
 ; 10063 Sup ^%ZTLOAD
 ; 10086 Sup ^%ZIS:  HOME
 ; 10089 Sup ^%ZISC
 ; 10103 Sup ^XLFDT: $$FMTE, $$FMADD
 ;
 Q
 ;
EN ;entry point from Menu Option: PRESUMPTIVE PSYCHOSIS GENDER REPORT
 N DFN,DGCAT,DGDIV,DGDT,DGDTDEF,DGDTF,DGDTT,DGHDRDT,DGI,DGSEX,DGSTD,DGTEMP,DGY,IEN3312,POP,X,ZTDESC,ZTRTN,ZTSAVE,ZTSK,%ZIS
SELDATES ;
 S DGDTDEF=$$GETDEFD^DGPPRP1() I DGDTDEF="" W !!,"There is no record of patch DG*5.3*977 being installed!",!! Q
 S DGDT=$$DTFRMTO^DGPPRP1("Select dates") Q:+DGDT=0
 S DGDTF=$P(DGDT,U,2),DGDTT=$P(DGDT,U,3)
 S DGTEMP=$NA(^TMP("DGPPRP4",$J)) K @DGTEMP S (@DGTEMP@("F"),@DGTEMP@("M"))=0
 ; Allow queueing
 K IOP,IO("Q") S %ZIS="MQ",%ZIS("B")="",POP=0 D ^%ZIS
 Q:POP
 I $D(IO("Q")) D  Q   ;Queued report settings
 .S ZTDESC="Presumptive Psychosis Gender Report",ZTRTN="DQ^DGPPRP4"
 .S ZTSAVE("DGRTYP")="",ZTSAVE("DGDTFRMT")="",ZTSAVE("DGDTFRM")="",ZTSAVE("ZTREQ")="@",ZTSAVE("DGDTTO")=""
 .D ^%ZTLOAD,HOME^%ZIS
 .I $G(ZTSK) W !!,"Report compilation has started with task# ",ZTSK,".",! S DIR(0)="E" D ^DIR K DIR
DQ ;
 S DGDT=$$FMADD^XLFDT(DGDTF,-1)_".2399"
 F  S DGDT=$O(^DGPP(33.1,"AC",DGDT)) Q:'DGDT!(DGDT>DGDTT)  D
 . S DGCAT="" F  S DGCAT=$O(^DGPP(33.1,"AC",DGDT,DGCAT)) Q:DGCAT=""  D
 .. S IEN3312=0 F  S IEN3312=$O(^DGPP(33.1,"AC",DGDT,DGCAT,IEN3312)) Q:'IEN3312  D
 ... S DFN=$P(^DGPP(33.1,IEN3312,0),U),DGSEX=$$GET1^DIQ(2,DFN_",",.02,"I")
 ... S @DGTEMP@(0)=$G(@DGTEMP@(0))+1,@DGTEMP@(DGSEX)=$G(@DGTEMP@(DGSEX))+1
 D PRINT,OUT
 I $E(IOST,1,2)="C-" R !!?8,"End of the Report...Press Enter to Continue",X:DTIME W @IOF
 Q
 ;
PRINT    ;Print out results
 N DGCAT,DGCATL,DGDASH,DGN,DGTOT,DGX,Y
 S DGDASH="",$P(DGDASH,"-",81)=""
 S DGX=$P(^DD(2,.5601,0),U,3)
 S DGHDRDT="Date Range : "_$$FMTE^XLFDT(DGDTF)_" - "_$$FMTE^XLFDT(DGDTT)
 W @IOF S DGX="Presumptive Psychosis Gender Report" W $J(" ",80-$L(DGX)\2),DGX
 W !,$J(" ",80-$L(DGHDRDT)\2),DGHDRDT,! S DGX="Date Report Printed: " S Y=DT X ^DD("DD") S DGX=DGX_Y W $J(" ",80-$L(DGX)\2),DGX
 W !!,DGDASH
 S (DGSEX,DGTOT)=0 F  S DGSEX=$O(@DGTEMP@(DGSEX)) Q:DGSEX=""  D
 . S DGN=+$G(@DGTEMP@(DGSEX)) S DGTOT(DGSEX)=DGN,DGTOT=$G(DGTOT)+DGN
 . W !,"TOTAL "_$S(DGSEX="F":"FEMALES",1:"MALES")_" REGISTERED UNDER PRESUMPTIVE PSYCHOSIS AUTHORITY",?66,": ",$J($FN(+DGN,","),7)
 W !,DGDASH,!!,"TOTAL PATIENTS REGISTERED UNDER PRESUMPTIVE PSYCHOSIS AUTHORITY",?66,": ",$J($FN(DGTOT,","),7),!
 W !,DGDASH,!!,"PERCENTAGE OF FEMALE",?21,": ",$S($G(DGTOT("F")):$J($FN($G(DGTOT("F"))*100/DGTOT,",",2),7),1:$J(0,7)),"%"
 W !,"PERCENTAGE OF MALE",?21,": ",$S($G(DGTOT("M")):$J($FN($G(DGTOT("M"))*100/DGTOT,",",2),7),1:$J(0,7)),"%"
 Q
 ;
SET      ;
 N DFNS,DGOUT
 S DFNS=DFN_"," D GETS^DIQ(2,DFNS,".01;.0905",,"DGPAT")
 S @DGTEMP@(DGDIV,DGCAT,DGDT,DFN,DGI)=$G(DGOUT(2,DFNS,.01))_U_$G(DGOUT(2,DFNS,.0905))_U_DGSTD
 Q
 ;
OUT      ; KILL RETURN ARRAY QUIT
 D ^%ZISC
 K @DGTEMP
 Q