PSALFA ;BIR/LTL-Automated DRUG/ITEM MASTER file Link by FSN ;7/23/97
;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**15**; 10/24/97
;This routine automatically loops by FSN.
;References to $$DESCR^PRCPUX1 are covered by IA #259
;References to ^PSDRUG( are covered by IA #2095
;References to ^PRC( are covered by IA #214
;References to ^PSDRUG("AB" are covered by IA #2095
;
D DT^DICRW
START ;sets up edit loop
N D0,D1,DA,DIC,DIE,DLAYGO,DR,DTOUT,DUOUT,DIR,DIRUT,PSAD,PSADD,PSAF,PSAFSN,PSAIT,PSALN,PSAOUT,PSARPDT,PSAPG,X,Y
QUES S DIR(0)="Y",DIR("A")="Have you run the Report Potential FSN Matches option",DIR("??")="^D RUN^PSALFA",PSAOUT=1 D ^DIR K DIR G:$D(DIRUT) QUIT D:'Y
.S DIR(0)="Y",DIR("A")="Would you like to run the report now",DIR("B")="Yes" D ^DIR K DIR D:Y ^PSALFS
S DIR(0)="Y",DIR("A")="Are you ready to link ALL of the drugs that have matches in the ITEM MASTER file",DIR("B")="No" D ^DIR K DIR G:'Y QUIT
DEV ;asks device and queueing info
W !,"I'll list each DRUG/ITEM MASTER file entry as they're linked.",!
K IO("Q") N %ZIS,%ZIS,IOP,POP S %ZIS="Q",%ZIS("A")="Please select DEVICE for output: " D ^%ZIS I POP W !,"NO DEVICE SELECTED OR REPORT PRINTED!" G QUIT
I $D(IO("Q")) N ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTDTH,ZTSK S ZTRTN="LOOP^PSALFA",ZTDESC="Linking DRUG/ITEM FILE by FSN" D ^%ZTLOAD,HOME^%ZIS S PSAOUT=1 G QUIT
LOOP S (PSAD,PSAPG,PSAOUT)=0,Y=DT D DD^%DT S PSARPDT=Y,Y=1 D HEADER
F S PSAD=$O(^PSDRUG(PSAD)) G:'PSAD QUIT D:$Y+4>IOSL HEADER G:PSAOUT QUIT I $P($G(^PSDRUG(PSAD,0)),U,6)]"",'$O(^PSDRUG(PSAD,441,0)),'$D(^PSDRUG(PSAD,"I")) D
FORM .S PSAFSN=$P(^PSDRUG(PSAD,0),U,6) W !,PSAFSN D
..I $O(^PRC(441,"BB",PSAFSN,0)) N PSADD S PSAIT=$O(^PRC(441,"BB",PSAFSN,0)) D W !,$E($P(^PSDRUG(PSAD,0),U),1,39),?40,$E($$DESCR^PRCPUX1(0,PSAIT),1,39),! D:'$D(PSADD) LINK
USED ...I $O(^PSDRUG("AB",PSAIT,"")) S PSADD=$O(^PSDRUG("AB",PSAIT,"")) W !,"**"_$P(^PSDRUG(PSADD,0),U)_" is already linked to Item #"_PSAIT_"**"
INAC ...I $E($G(^PRC(441,PSAIT,3)),1)=1 W !,"Sorry, Item #"_PSAIT_" is INACTIVE, can't link.",! S PSADD=""
QUIT W:$E(IOST)'="C" @IOF
I $E(IOST,1,2)="C-",'PSAOUT W !! S DIR(0)="E",DIR("A")="END OF REPORT! Press <RET> to return to the menu" D ^DIR
D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@" K IO("Q") Q
LINK S DIE=50,DA=PSAD,DR="441///^S X=PSAIT" D ^DIE W "Linked to Item #"_PSAIT Q
I $E(IOST,1,2)'="P-",PSAPG S DIR(0)="E" D ^DIR K DIR I 'Y S PSAOUT=1 Q
I $$S^%ZTLOAD W !!,"Task #",$G(ZTSK),", ",$G(ZTDESC)," was stopped by ",$P($G(^VA(200,+$G(DUZ),0)),U),"." S PSAOUT=1 Q
W:$Y @IOF S $P(PSALN,"-",81)="",PSAPG=PSAPG+1 W !?2,"Linking DRUG/ITEM MASTER file by FSN",?55,PSARPDT,?70,"PAGE: "_PSAPG,!,PSALN,!,"DRUG file",?40,"ITEM MASTER file"
Q
READY ;Extended help for 'Have you run the Report Potential FSN Matches option?'
W !?5,"Enter YES to begin linking every drug that has been matched.",!?5,"Enter NO to exit the option."
Q
RUN ;Extended help to 'Have you run the Report Potential FSN Matches option?'
W !?5,"Enter YES if you have run the Report Potential FSN Matches option",!?5,"and produced a report.",!!?5,"Enter NO if you have not run the option. You will be given the",!?5,"opportunity to run the report now."
Q
PSALFA ;BIR/LTL-Automated DRUG/ITEM MASTER file Link by FSN ;7/23/97
+1 ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**15**; 10/24/97
+2 ;This routine automatically loops by FSN.
+3 ;References to $$DESCR^PRCPUX1 are covered by IA #259
+4 ;References to ^PSDRUG( are covered by IA #2095
+5 ;References to ^PRC( are covered by IA #214
+6 ;References to ^PSDRUG("AB" are covered by IA #2095
+7 ;
+8 DO DT^DICRW
START ;sets up edit loop
+1 NEW D0,D1,DA,DIC,DIE,DLAYGO,DR,DTOUT,DUOUT,DIR,DIRUT,PSAD,PSADD,PSAF,PSAFSN,PSAIT,PSALN,PSAOUT,PSARPDT,PSAPG,X,Y
QUES SET DIR(0)="Y"
SET DIR("A")="Have you run the Report Potential FSN Matches option"
SET DIR("??")="^D RUN^PSALFA"
SET PSAOUT=1
DO ^DIR
KILL DIR
IF $DATA(DIRUT)
GOTO QUIT
IF 'Y
Begin DoDot:1
+1 SET DIR(0)="Y"
SET DIR("A")="Would you like to run the report now"
SET DIR("B")="Yes"
DO ^DIR
KILL DIR
IF Y
DO ^PSALFS
End DoDot:1
+2 SET DIR(0)="Y"
SET DIR("A")="Are you ready to link ALL of the drugs that have matches in the ITEM MASTER file"
SET DIR("B")="No"
DO ^DIR
KILL DIR
IF 'Y
GOTO QUIT
DEV ;asks device and queueing info
+1 WRITE !,"I'll list each DRUG/ITEM MASTER file entry as they're linked.",!
+2 KILL IO("Q")
NEW %ZIS,%ZIS,IOP,POP
SET %ZIS="Q"
SET %ZIS("A")="Please select DEVICE for output: "
DO ^%ZIS
IF POP
WRITE !,"NO DEVICE SELECTED OR REPORT PRINTED!"
GOTO QUIT
+3 IF $DATA(IO("Q"))
NEW ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTDTH,ZTSK
SET ZTRTN="LOOP^PSALFA"
SET ZTDESC="Linking DRUG/ITEM FILE by FSN"
DO ^%ZTLOAD
DO HOME^%ZIS
SET PSAOUT=1
GOTO QUIT
LOOP SET (PSAD,PSAPG,PSAOUT)=0
SET Y=DT
DO DD^%DT
SET PSARPDT=Y
SET Y=1
DO HEADER
+1 FOR
SET PSAD=$ORDER(^PSDRUG(PSAD))
IF 'PSAD
GOTO QUIT
IF $Y+4>IOSL
DO HEADER
IF PSAOUT
GOTO QUIT
IF $PIECE($GET(^PSDRUG(PSAD,0)),U,6)]""
IF '$ORDER(^PSDRUG(PSAD,441,0))
IF '$DATA(^PSDRUG(PSAD,"I"))
Begin DoDot:1
FORM SET PSAFSN=$PIECE(^PSDRUG(PSAD,0),U,6)
WRITE !,PSAFSN
Begin DoDot:2
+1 IF $ORDER(^PRC(441,"BB",PSAFSN,0))
NEW PSADD
SET PSAIT=$ORDER(^PRC(441,"BB",PSAFSN,0))
Begin DoDot:3
USED IF $ORDER(^PSDRUG("AB",PSAIT,""))
SET PSADD=$ORDER(^PSDRUG("AB",PSAIT,""))
WRITE !,"**"_$PIECE(^PSDRUG(PSADD,0),U)_" is already linked to Item #"_PSAIT_"**"
INAC IF $EXTRACT($GET(^PRC(441,PSAIT,3)),1)=1
WRITE !,"Sorry, Item #"_PSAIT_" is INACTIVE, can't link.",!
SET PSADD=""
End DoDot:3
WRITE !,$EXTRACT($PIECE(^PSDRUG(PSAD,0),U),1,39),?40,$EXTRACT($$DESCR^PRCPUX1(0,PSAIT),1,39),!
IF '$DATA(PSADD)
DO LINK
End DoDot:2
End DoDot:1
QUIT IF $EXTRACT(IOST)'="C"
WRITE @IOF
+1 IF $EXTRACT(IOST,1,2)="C-"
IF 'PSAOUT
WRITE !!
SET DIR(0)="E"
SET DIR("A")="END OF REPORT! Press <RET> to return to the menu"
DO ^DIR
+2 DO ^%ZISC
IF $DATA(ZTQUEUED)
SET ZTREQ="@"
KILL IO("Q")
QUIT
LINK SET DIE=50
SET DA=PSAD
SET DR="441///^S X=PSAIT"
DO ^DIE
WRITE "Linked to Item #"_PSAIT
QUIT
+1 IF $EXTRACT(IOST,1,2)'="P-"
IF PSAPG
SET DIR(0)="E"
DO ^DIR
KILL DIR
IF 'Y
SET PSAOUT=1
QUIT
+2 IF $$S^%ZTLOAD
WRITE !!,"Task #",$GET(ZTSK),", ",$GET(ZTDESC)," was stopped by ",$PIECE($GET(^VA(200,+$GET(DUZ),0)),U),"."
SET PSAOUT=1
QUIT
+3 IF $Y
WRITE @IOF
SET $PIECE(PSALN,"-",81)=""
SET PSAPG=PSAPG+1
WRITE !?2,"Linking DRUG/ITEM MASTER file by FSN",?55,PSARPDT,?70,"PAGE: "_PSAPG,!,PSALN,!,"DRUG file",?40,"ITEM MASTER file"
+4 QUIT
READY ;Extended help for 'Have you run the Report Potential FSN Matches option?'
+1 WRITE !?5,"Enter YES to begin linking every drug that has been matched.",!?5,"Enter NO to exit the option."
+2 QUIT
RUN ;Extended help to 'Have you run the Report Potential FSN Matches option?'
+1 WRITE !?5,"Enter YES if you have run the Report Potential FSN Matches option",!?5,"and produced a report.",!!?5,"Enter NO if you have not run the option. You will be given the",!?5,"opportunity to run the report now."
+2 QUIT