PSGWADE1 ;BHAM ISC/PTD,CML-Enter AMIS Data for All Drugs in All AOUs - CONTINUED ; 23 Mar 93 / 10:29 AM
;;2.3; Automatic Replenishment/Ward Stock ;;4 JAN 94
DONE I (PSGWFLG=1)&(PSGWRET=0) W !!!,"All drugs in all AOUs contain AMIS data.",!,"If you need to edit data for a selected drug,",!,"use the AMIS Data Enter/Edit (Single Drug) option.",!!!
I W "If you wish to view the data stored in the drug file for",!,"AR/WS AMIS statistics, use the Data for AMIS Stats - Print option.",!!!
END K ^TMP("PSGW",$J),^TMP("PSGWDN",$J),K,PSGWFLG,PSGWRET,PSGWAOU,PSGWITM,PSGWDR,PSGWTY,PSGWNM,PSGWCT,PSGWCN,PSGW2,PSGWDT,PSGWPC,%,%I,%H,DA Q
;
;LOOP THROUGH UTILITY GLOBAL BY TYPE, DRUG NAME & DRUG #. CHECK FOR AMIS INFO IN DRUG FILE.
LOOP S PSGWTY=""
L1 S PSGWTY=$O(^TMP("PSGW",$J,PSGWTY)),PSGWNM="" G:'PSGWTY DONE W:(PSGWTY'=9999)&($D(^PSI(58.16,PSGWTY,0))) !!?5,"TYPE: ",$P(^PSI(58.16,PSGWTY,0),"^") W:PSGWTY=9999 !!?5,"** UNCLASSIFIED BY TYPE:"
L2 S PSGWNM=$O(^TMP("PSGW",$J,PSGWTY,PSGWNM)),PSGWDR="" G:PSGWNM="" L1 I (PSGWTY=9999)&($D(^TMP("PSGWDN",$J,PSGWNM))) G L2
L3 S PSGWDR=$O(^TMP("PSGW",$J,PSGWTY,PSGWNM,PSGWDR)) G:'PSGWDR L2
CHK S PSGW2=1 I $D(^PSDRUG(PSGWDR,"PSG")) G:($P(^PSDRUG(PSGWDR,"PSG"),"^",2)'="")&($P(^PSDRUG(PSGWDR,"PSG"),"^",3)'="") L3
I $P(^PSDRUG(PSGWDR,0),"^")'="" W !!,"==> "_$P(^(0),"^")
E W !!,"The name for drug number ",PSGWDR," is missing from your drug file.",!,"Please notify your package coordinator!"
I '$D(^PSDRUG(PSGWDR,"PSG")) D ASKCAT G:PSGWCT="^" END G:('$T)&(PSGWCT="") END S:PSGWCT="" PSGWRET=1 G:PSGWCT="" L3 D ASKCON G:PSGWCN="^" END G:('$T)&(PSGWCN="") END S:PSGWCN="" PSGWRET=1 G:PSGWCN="" L3 D SETNOD S PSGWFLG=0 G L3
I $D(^PSDRUG(PSGWDR,"PSG"))&($P(^PSDRUG(PSGWDR,"PSG"),"^",2)="") D ASKCAT G:PSGWCT="^" END G:('$T)&(PSGWCT="") END S:PSGWCT="" PSGWRET=1 G:PSGWCT="" L3 S PSGWFLG=0,PSGWPC=2,PSGW2=0 D SETPC
I $D(^PSDRUG(PSGWDR,"PSG"))&($P(^PSDRUG(PSGWDR,"PSG"),"^",3)="") W:PSGW2=1 !,"AMIS Category: ",$P(^PSDRUG(PSGWDR,"PSG"),"^",2) D ASKCON G:PSGWCN="^" END G:('$T)&(PSGWCN="") END S:PSGWCN="" PSGWRET=1 G:PSGWCN="" L3 S PSGWFLG=0,PSGWPC=3 D SETPC
G L3
;
ASKCAT R !,"Enter AMIS Category: ",PSGWCT:DTIME S:'$T PSGWCT="^" Q:"^"[PSGWCT
I "?"[$E(PSGWCT)!(PSGWCT<0)!(PSGWCT>3)!(PSGWCT'?1N) D HELP G ASKCAT
Q
;
ASKCON R !,"Enter AMIS Conversion Number: ",PSGWCN:DTIME S:'$T PSGWCN="^" Q:"^"[PSGWCN
I "?"[$E(PSGWCN)!(PSGWCN'?1.4N)!(PSGWCN<1)!(PSGWCN>9999) W *7,!!,"Enter a whole number between 1 and 9999.",!,"This number reflects the number of doses/units",!,"contained in a single quantity dispensed.",!! G ASKCON
Q
;
SETNOD S ^PSDRUG(PSGWDR,"PSG")="^"_PSGWCT_"^"_PSGWCN Q
;
SETPC I PSGWPC=2 S $P(^PSDRUG(PSGWDR,"PSG"),"^",2)=PSGWCT
I PSGWPC=3 S $P(^PSDRUG(PSGWDR,"PSG"),"^",3)=PSGWCN
Q
HELP W *7,!!,"Enter the category that this drug is to be classified as for AMIS:",!?5,"==> ""0"" for field 03 or 04",!?5,"==> ""1"" for field 06 or 07",!?5,"==> ""2"" for field 17",!?5,"==> ""3"" for field 22",!! Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSGWADE1 2989 printed Dec 13, 2024@01:38:41 Page 2
PSGWADE1 ;BHAM ISC/PTD,CML-Enter AMIS Data for All Drugs in All AOUs - CONTINUED ; 23 Mar 93 / 10:29 AM
+1 ;;2.3; Automatic Replenishment/Ward Stock ;;4 JAN 94
DONE IF (PSGWFLG=1)&(PSGWRET=0)
WRITE !!!,"All drugs in all AOUs contain AMIS data.",!,"If you need to edit data for a selected drug,",!,"use the AMIS Data Enter/Edit (Single Drug) option.",!!!
+1 IF $TEST
WRITE "If you wish to view the data stored in the drug file for",!,"AR/WS AMIS statistics, use the Data for AMIS Stats - Print option.",!!!
END KILL ^TMP("PSGW",$JOB),^TMP("PSGWDN",$JOB),K,PSGWFLG,PSGWRET,PSGWAOU,PSGWITM,PSGWDR,PSGWTY,PSGWNM,PSGWCT,PSGWCN,PSGW2,PSGWDT,PSGWPC,%,%I,%H,DA
QUIT
+1 ;
+2 ;LOOP THROUGH UTILITY GLOBAL BY TYPE, DRUG NAME & DRUG #. CHECK FOR AMIS INFO IN DRUG FILE.
LOOP SET PSGWTY=""
L1 SET PSGWTY=$ORDER(^TMP("PSGW",$JOB,PSGWTY))
SET PSGWNM=""
if 'PSGWTY
GOTO DONE
if (PSGWTY'=9999)&($DATA(^PSI(58.16,PSGWTY,0)))
WRITE !!?5,"TYPE: ",$PIECE(^PSI(58.16,PSGWTY,0),"^")
if PSGWTY=9999
WRITE !!?5,"** UNCLASSIFIED BY TYPE:"
L2 SET PSGWNM=$ORDER(^TMP("PSGW",$JOB,PSGWTY,PSGWNM))
SET PSGWDR=""
if PSGWNM=""
GOTO L1
IF (PSGWTY=9999)&($DATA(^TMP("PSGWDN",$JOB,PSGWNM)))
GOTO L2
L3 SET PSGWDR=$ORDER(^TMP("PSGW",$JOB,PSGWTY,PSGWNM,PSGWDR))
if 'PSGWDR
GOTO L2
CHK SET PSGW2=1
IF $DATA(^PSDRUG(PSGWDR,"PSG"))
if ($PIECE(^PSDRUG(PSGWDR,"PSG"),"^",2)'="")&($PIECE(^PSDRUG(PSGWDR,"PSG"),"^",3)'="")
GOTO L3
+1 IF $PIECE(^PSDRUG(PSGWDR,0),"^")'=""
WRITE !!,"==> "_$PIECE(^(0),"^")
+2 IF '$TEST
WRITE !!,"The name for drug number ",PSGWDR," is missing from your drug file.",!,"Please notify your package coordinator!"
+3 IF '$DATA(^PSDRUG(PSGWDR,"PSG"))
DO ASKCAT
if PSGWCT="^"
GOTO END
if ('$TEST)&(PSGWCT="")
GOTO END
if PSGWCT=""
SET PSGWRET=1
if PSGWCT=""
GOTO L3
DO ASKCON
if PSGWCN="^"
GOTO END
if ('$TEST)&(PSGWCN="")
GOTO END
if PSGWCN=""
SET PSGWRET=1
if PSGWCN=""
GOTO L3
DO SETNOD
SET PSGWFLG=0
GOTO L3
+4 IF $DATA(^PSDRUG(PSGWDR,"PSG"))&($PIECE(^PSDRUG(PSGWDR,"PSG"),"^",2)="")
DO ASKCAT
if PSGWCT="^"
GOTO END
if ('$TEST)&(PSGWCT="")
GOTO END
if PSGWCT=""
SET PSGWRET=1
if PSGWCT=""
GOTO L3
SET PSGWFLG=0
SET PSGWPC=2
SET PSGW2=0
DO SETPC
+5 IF $DATA(^PSDRUG(PSGWDR,"PSG"))&($PIECE(^PSDRUG(PSGWDR,"PSG"),"^",3)="")
if PSGW2=1
WRITE !,"AMIS Category: ",$PIECE(^PSDRUG(PSGWDR,"PSG"),"^",2)
DO ASKCON
if PSGWCN="^"
GOTO END
if ('$TEST)&(PSGWCN="")
GOTO END
if PSGWCN=""
SET PSGWRET=1
if PSGWCN=""
GOTO L3
SET PSGWFLG=0
SET PSGWPC=3
DO SETPC
+6 GOTO L3
+7 ;
ASKCAT READ !,"Enter AMIS Category: ",PSGWCT:DTIME
if '$TEST
SET PSGWCT="^"
if "^"[PSGWCT
QUIT
+1 IF "?"[$EXTRACT(PSGWCT)!(PSGWCT<0)!(PSGWCT>3)!(PSGWCT'?1N)
DO HELP
GOTO ASKCAT
+2 QUIT
+3 ;
ASKCON READ !,"Enter AMIS Conversion Number: ",PSGWCN:DTIME
if '$TEST
SET PSGWCN="^"
if "^"[PSGWCN
QUIT
+1 IF "?"[$EXTRACT(PSGWCN)!(PSGWCN'?1.4N)!(PSGWCN<1)!(PSGWCN>9999)
WRITE *7,!!,"Enter a whole number between 1 and 9999.",!,"This number reflects the number of doses/units",!,"contained in a single quantity dispensed.",!!
GOTO ASKCON
+2 QUIT
+3 ;
SETNOD SET ^PSDRUG(PSGWDR,"PSG")="^"_PSGWCT_"^"_PSGWCN
QUIT
+1 ;
SETPC IF PSGWPC=2
SET $PIECE(^PSDRUG(PSGWDR,"PSG"),"^",2)=PSGWCT
+1 IF PSGWPC=3
SET $PIECE(^PSDRUG(PSGWDR,"PSG"),"^",3)=PSGWCN
+2 QUIT
HELP WRITE *7,!!,"Enter the category that this drug is to be classified as for AMIS:",!?5,"==> ""0"" for field 03 or 04",!?5,"==> ""1"" for field 06 or 07",!?5,"==> ""2"" for field 17",!?5,"==> ""3"" for field 22",!!
QUIT