AGALPHA ; IHS/ASDS/EFG - ALPHA LISTING OF REGISTERED PATIENTS ;
;;7.1;PATIENT REGISTRATION;**4,5**;AUG 25,2005
S AGIO=IO,AG("HAT")=""
DEV S %ZIS="OPQ" D ^%ZIS I POP S IOP=ION D ^%ZIS Q
G:'$D(IO("Q")) L1 K IO("Q") I $D(IO("S"))!($E(IOST)'="P") W *7,!,"Please queue to system printers." D ^%ZISC G DEV
X ^%ZOSF("UCI") S ZTRTN="L1^AGALPHA",ZTUCI=Y,ZTDESC="ALPHA LIST OF REGISTERED PATIENTS for "_$P(^AUTTLOC(DUZ(2),0),U,2)_"."
D ^%ZTLOAD G:'$D(ZTSK) DEV K AGIO,ZTRTN,ZTUCI,ZTDESC,ZTSK D ^%ZISC
Q
L1 ;EP - From TaskMan.
S (AGPGPG,AGNAME,T)=0,AG("USR")=$P(^VA(200,DUZ,0),U),X=$P(^DIC(4,DUZ(2),0),U) D CTR^AG S AG("LOC")=X X ^%ZOSF("UCI") S X="UCI: "_$P(Y,",",1) D CTR^AG S AGUCI=X,AGBM=IOSL-10 I $D(AGIO),AGIO=IO S AGBM=IOSL-4
D NOW^AG S X="as of "_AGTIME D CTR^AG S AGTIME=X U IO D HDR
L2 S AGNAME=$O(^DPT("B",AGNAME)) G END:AGNAME="" S DFN=0
L3 S DFN=$O(^DPT("B",AGNAME,DFN)) G L2:DFN="",L3:'$D(^AUPNPAT(DFN,41,DUZ(2),0))!'$D(^DPT(DFN)),L3:$P(^DPT(DFN,0),U)'=AGNAME,L3:$P(^DPT(DFN,0),U,19)>0 ;skip merged patient
W $P(^DPT(DFN,0),U)," " S AG=$S($P(^AUPNPAT(DFN,41,DUZ(2),0),U,3)]"":"*",1:"") D DEAD^AGMAN S AG=AG_$S($D(AG("DEAD")):"D",1:"") W:AG]"" "(",AG,")"
W ?44,$J($P(^AUPNPAT(DFN,41,DUZ(2),0),U,2),6)
;K ^UTILITY("DIQ1",$J) S DIC=2,DR=.09,DA=DFN D EN^DIQ1 W:$D(^(DR)) ?53,^(DR) S DR=.03 D EN^DIQ1 W:$D(^(DR)) ?67,$J(^(DR),10)
;K ^UTILITY("DIQ1",$J) S DIC=9000001,DR=1107.3,DA=DFN D EN^DIQ1 W:$D(^(DR)) ?53,^(DR) S DR=.03 D EN^DIQ1 W:$D(^(DR)) ?67,$J(^(DR),10) ;IHS/SD/TPF AG*7.1*4
K ^UTILITY("DIQ1",$J) S DIC=9000001,DR=1107.3,DA=DFN D EN^DIQ1 W:$D(^(DR)) ?53,^(DR) S DIC=2,DR=.03 D EN^DIQ1 W:$D(^(DR)) ?67,$J(^(DR),10) ;IHS/SD/TPF AG*7.1*5
W ! S T=T+1 I $Y>AGBM D RTRN^AG G:$D(DUOUT)!$D(DTOUT)!$D(DFOUT) K D HDR
G L3
END W !!,"Total Patients: ",T K AG("HAT") D RTRN^AG W $$S^AGVDF("IOF")
K D ^%ZISC K AG,AGIO,AGTIME,AGBM,DA,DFN,DIC,DR,G,AGUCI,AG("LOC"),AGNAME,AGPGPG,T,AG("USR"),X,Y D:$D(ZTQUEUED) KILL^%ZTLOAD
Q
HDR S AGPGPG=AGPGPG+1 W $$S^AGVDF("IOF"),!!,AG("USR"),?71,"Page",$J(AGPGPG,4),!,AG("LOC"),!?19,"REGISTERED PATIENTS - ALPHABETICAL LISTING",!,AGUCI,!?23,"('*' = INACTIVE), ('D' = DECEASED)"
W !!,AGTIME,!!!?18,"Name",?45,"IHS #",?57,"SSN",?71,"DOB",!,"----------------------------------------",?44,"------",?53,"-----------",?67,"------------",!
Q
AGALPHA ; IHS/ASDS/EFG - ALPHA LISTING OF REGISTERED PATIENTS ;
+1 ;;7.1;PATIENT REGISTRATION;**4,5**;AUG 25,2005
+2 SET AGIO=IO
SET AG("HAT")=""
DEV SET %ZIS="OPQ"
DO ^%ZIS
IF POP
SET IOP=ION
DO ^%ZIS
QUIT
+1 IF '$DATA(IO("Q"))
GOTO L1
KILL IO("Q")
IF $DATA(IO("S"))!($EXTRACT(IOST)'="P")
WRITE *7,!,"Please queue to system printers."
DO ^%ZISC
GOTO DEV
+2 XECUTE ^%ZOSF("UCI")
SET ZTRTN="L1^AGALPHA"
SET ZTUCI=Y
SET ZTDESC="ALPHA LIST OF REGISTERED PATIENTS for "_$PIECE(^AUTTLOC(DUZ(2),0),U,2)_"."
+3 DO ^%ZTLOAD
IF '$DATA(ZTSK)
GOTO DEV
KILL AGIO,ZTRTN,ZTUCI,ZTDESC,ZTSK
DO ^%ZISC
+4 QUIT
L1 ;EP - From TaskMan.
+1 SET (AGPGPG,AGNAME,T)=0
SET AG("USR")=$PIECE(^VA(200,DUZ,0),U)
SET X=$PIECE(^DIC(4,DUZ(2),0),U)
DO CTR^AG
SET AG("LOC")=X
XECUTE ^%ZOSF("UCI")
SET X="UCI: "_$PIECE(Y,",",1)
DO CTR^AG
SET AGUCI=X
SET AGBM=IOSL-10
IF $DATA(AGIO)
IF AGIO=IO
SET AGBM=IOSL-4
+2 DO NOW^AG
SET X="as of "_AGTIME
DO CTR^AG
SET AGTIME=X
USE IO
DO HDR
L2 SET AGNAME=$ORDER(^DPT("B",AGNAME))
IF AGNAME=""
GOTO END
SET DFN=0
L3 ;skip merged patient
SET DFN=$ORDER(^DPT("B",AGNAME,DFN))
IF DFN=""
GOTO L2
IF '$DATA(^AUPNPAT(DFN,41,DUZ(2),0))!'$DATA(^DPT(DFN))
GOTO L3
IF $PIECE(^DPT(DFN,0),U)'=AGNAME
GOTO L3
IF $PIECE(^DPT(DFN,0),U,19)>0
GOTO L3
+1 WRITE $PIECE(^DPT(DFN,0),U)," "
SET AG=$SELECT($PIECE(^AUPNPAT(DFN,41,DUZ(2),0),U,3)]"":"*",1:"")
DO DEAD^AGMAN
SET AG=AG_$SELECT($DATA(AG("DEAD")):"D",1:"")
IF AG]""
WRITE "(",AG,")"
+2 WRITE ?44,$JUSTIFY($PIECE(^AUPNPAT(DFN,41,DUZ(2),0),U,2),6)
+3 ;K ^UTILITY("DIQ1",$J) S DIC=2,DR=.09,DA=DFN D EN^DIQ1 W:$D(^(DR)) ?53,^(DR) S DR=.03 D EN^DIQ1 W:$D(^(DR)) ?67,$J(^(DR),10)
+4 ;K ^UTILITY("DIQ1",$J) S DIC=9000001,DR=1107.3,DA=DFN D EN^DIQ1 W:$D(^(DR)) ?53,^(DR) S DR=.03 D EN^DIQ1 W:$D(^(DR)) ?67,$J(^(DR),10) ;IHS/SD/TPF AG*7.1*4
+5 ;IHS/SD/TPF AG*7.1*5
KILL ^UTILITY("DIQ1",$JOB)
SET DIC=9000001
SET DR=1107.3
SET DA=DFN
DO EN^DIQ1
IF $DATA(^(DR))
WRITE ?53,^(DR)
SET DIC=2
SET DR=.03
DO EN^DIQ1
IF $DATA(^(DR))
WRITE ?67,$JUSTIFY(^(DR),10)
+6 WRITE !
SET T=T+1
IF $Y>AGBM
DO RTRN^AG
IF $DATA(DUOUT)!$DATA(DTOUT)!$DATA(DFOUT)
GOTO K
DO HDR
+7 GOTO L3
END WRITE !!,"Total Patients: ",T
KILL AG("HAT")
DO RTRN^AG
WRITE $$S^AGVDF("IOF")
K DO ^%ZISC
KILL AG,AGIO,AGTIME,AGBM,DA,DFN,DIC,DR,G,AGUCI,AG("LOC"),AGNAME,AGPGPG,T,AG("USR"),X,Y
IF $DATA(ZTQUEUED)
DO KILL^%ZTLOAD
+1 QUIT
HDR SET AGPGPG=AGPGPG+1
WRITE $$S^AGVDF("IOF"),!!,AG("USR"),?71,"Page",$JUSTIFY(AGPGPG,4),!,AG("LOC"),!?19,"REGISTERED PATIENTS - ALPHABETICAL LISTING",!,AGUCI,!?23,"('*' = INACTIVE), ('D' = DECEASED)"
+1 WRITE !!,AGTIME,!!!?18,"Name",?45,"IHS #",?57,"SSN",?71,"DOB",!,"----------------------------------------",?44,"------",?53,"-----------",?67,"------------",!
+2 QUIT