AGPATCNT ; IHS/ASDS/EFG - COUNT TOTAL PATIENTS REGISTERED AT SELECTED FACILITY ;
;;7.1;PATIENT REGISTRATION;;AUG 25,2005
K AG("SCREEN") G B:$D(AG("FAC"))
K DIC S DIC="^AUTTLOC(",DIC(0)="QAZEM",AG("SCREEN")="" D ^DIC Q:+Y<1 S AG("FAC")=+Y,AG("LOC")=$P(^DIC(4,AG("FAC"),0),U)
S IOP=ION D ^%ZIS,WAIT^DICD S DX=$X,DY=$Y
B Q:'$D(AG("FAC")) S (DFN,AGTOT)=0
F AG=0:0 S DFN=$O(^AUPNPAT(DFN)) Q:+DFN<1 I $D(^AUPNPAT(DFN,41,AG("FAC"))) S AGTOT=AGTOT+1 I $D(AG("SCREEN")) X XY W AGTOT
S AG("TOTPAT")=AGTOT I $D(AG("SCREEN")) W !!,"Total patients registered at ",AG("LOC"),": ",AG("TOTPAT")
K AG("FAC"),DFN,DIC,DX,DY,AG("LOC"),AG("SCREEN"),AGTOT,X,XY,Y
Q
AGPATCNT ; IHS/ASDS/EFG - COUNT TOTAL PATIENTS REGISTERED AT SELECTED FACILITY ;
+1 ;;7.1;PATIENT REGISTRATION;;AUG 25,2005
+2 KILL AG("SCREEN")
IF $DATA(AG("FAC"))
GOTO B
+3 KILL DIC
SET DIC="^AUTTLOC("
SET DIC(0)="QAZEM"
SET AG("SCREEN")=""
DO ^DIC
IF +Y<1
QUIT
SET AG("FAC")=+Y
SET AG("LOC")=$PIECE(^DIC(4,AG("FAC"),0),U)
+4 SET IOP=ION
DO ^%ZIS
DO WAIT^DICD
SET DX=$X
SET DY=$Y
B IF '$DATA(AG("FAC"))
QUIT
SET (DFN,AGTOT)=0
+1 FOR AG=0:0
SET DFN=$ORDER(^AUPNPAT(DFN))
IF +DFN<1
QUIT
IF $DATA(^AUPNPAT(DFN,41,AG("FAC")))
SET AGTOT=AGTOT+1
IF $DATA(AG("SCREEN"))
XECUTE XY
WRITE AGTOT
+2 SET AG("TOTPAT")=AGTOT
IF $DATA(AG("SCREEN"))
WRITE !!,"Total patients registered at ",AG("LOC"),": ",AG("TOTPAT")
+3 KILL AG("FAC"),DFN,DIC,DX,DY,AG("LOC"),AG("SCREEN"),AGTOT,X,XY,Y
+4 QUIT