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

AGCHART.m

Go to the documentation of this file.
AGCHART ; IHS/ASDS/EFG - LIST OF REGISTERED PATIENTS BY CHART NUMBER ;  
 ;;7.1;PATIENT REGISTRATION;**4,5**;AUG 25,2005
C W !!,"START WITH WHAT CHART NUMBER? Print All Charts// " D READ^AG G K:$D(DTOUT)!$D(DUOUT)!$D(DFOUT),QUES:$D(DQOUT) I $D(DLOUT) S AGBEG=0,AGEND=999999999 G E
 G QUES:+Y<1 S AGBEG=+Y
D W !!,"END WITH WHAT CHART NUMBER? Last One// " D READ^AG G K:$D(DTOUT)!$D(DFOUT),C:$D(DUOUT),QUES:$D(DQOUT) I $D(DLOUT) S AGEND=999999999 G E
 I +Y<AGBEG W !!,*7,"THE ENDING NUMBER IS LESS THAN THE BEGINNING NUMBER." G C
 S AGEND=+Y
E 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^AGCHART",ZTUCI=Y,ZTDESC="PATIENTS BY CHART NUMBER at "_$P(^AUTTLOC(DUZ(2),0),U,2)_"." F G="AGBEG","AGEND" S ZTSAVE(G)=""
 D ^%ZTLOAD G:'$D(ZTSK) DEV K AG,AGBEG,AGEND,AGIO,G,ZTDESC,ZTRTN,ZTSK,ZTUCI D ^%ZISC
 Q
L1 ;EP - From TaskMan.
 S (AGPGPG,AGTOT)=0,AGCH=AGBEG-1,AG("LOC")=$P(^DIC(4,DUZ(2),0),U),AG("USR")=$P(^VA(200,DUZ,0),U),AG("USRLOC")=AG("USR")_$J("",40-($L(AG("LOC"))\2)-$L(AG("USR")))_AG("LOC") K AG("LOC"),AG("USR")
 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
 U IO D NOW^AG S X="as of "_AGTIME D CTR^AG S AGTIME=X,X="Chart numbers from "_AGBEG_" to "_AGEND D CTR^AG S AGHDG=X D HDR
L2 S AGCH=$O(^AUPNPAT("D",AGCH)) G END:AGCH=""!(AGCH>AGEND) S DFN=0
L3 S DFN=$O(^AUPNPAT("D",AGCH,DFN)) G L2:DFN="" S AGFAC=0
L4 S AGFAC=$O(^AUPNPAT("D",AGCH,DFN,AGFAC)) G L3:AGFAC="",L4:AGFAC'=DUZ(2)
 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 AGTOT=AGTOT+1 I $Y>AGBM D RTRN^AG G:$D(DUOUT)!$D(DTOUT)!$D(DFOUT) K D HDR
 G L4
END W !!,"Total Patients on this List: ",AGTOT K AG("HAT") D RTRN^AG W $$S^AGVDF("IOF")
K D ^%ZISC K AG,AGBEG,AGEND,AGIO,AGTIME,AGTOT,AGBM,AGCH,DA,DFN,DIC,DLOUT,DR,DUOUT,AGFAC,AGHDG,AGPGPG,AGUCI,AGUSRLOC,X,Y D:$D(ZTQUEUED) KILL^%ZTLOAD
 Q
HDR S AGPGPG=AGPGPG+1 W $$S^AGVDF("IOF"),!!,AG("USRLOC"),?72,"page ",AGPGPG,!?19,"REGISTERED PATIENTS - CHART NUMBER LISTING",!,AGUCI,!?24,"('*' = INACTIVE, 'D' = DECEASED)",!,AGHDG,!,AGTIME,!!
 W !!?18,"Name",?45,"IHS #",?57,"SSN",?71,"DOB",!,"----------------------------------------",?44,"------",?53,"-----------",?67,"------------",!
 Q
QUES W !!,"YOU MAY PRINT THIS REPORT FOR A LIMITED RANGE OF CHART NUMBERS, IF YOU WISH.",!,"SIMPLY ENTER A STARTING NUMBER AND PRESS RETURN. YOU WILL THEN BE ASKED FOR",!,"THE ENDING NUMBER."
 G C