- PSALNA ;BIR/LTL-Automated DRUG/ITEM MASTER file Link by NDC ;7/23/97
- ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**15**; 10/24/97
- ;
- ;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,DIR,DIRUT,DTOUT,DUOUT,PSAD,PSADD,PSAIT,PSALN,PSAOUT,PSAPG,PSARPDT,X,Y
- QUES S DIR(0)="Y",DIR("A")="Have you run the Report Potential NDC Matches option",DIR("??")="^D RUN^PSALNA",PSAOUT=1 D ^DIR K DIR G:$D(DIRUT) QUIT D:Y<1 G:PSAOUT QUIT
- .S DIR(0)="Y",DIR("A")="Would you like to run the report now",DIR("B")="YES",DIR("??")="^D NOW^PSALNA" D ^DIR K DIR S:$G(DIRUT) PSAOUT=1 I Y D ^PSALND S PSAOUT=0
- W ! S DIR(0)="Y",DIR("A",1)="Are you ready to link ALL of the drugs",DIR("A")="that have matches in the ITEM MASTER file",DIR("B")="N",DIR("??")="^D READY^PSALNA"
- D ^DIR K DIR G:'Y!($G(DIRUT)) 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^PSALNA",ZTDESC="Linking DRUG/ITEM FILE by NDC" 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 K PSADD S PSAD=$O(^PSDRUG(PSAD)) G:'PSAD QUIT D:$Y+4>IOSL HEADER G:PSAOUT QUIT W:'(PSAD#100) "." I $P($G(^PSDRUG(PSAD,2)),U,4)]"" S PSAD(1)=$P($G(^(2)),U,4) D:'$D(^PSDRUG(PSAD,"I"))
- .S PSAIT=$$ITEM^PSAUTL(PSAD(1)) Q:'PSAIT I $D(^PRC(441,+PSAIT,0)) D Q:$D(PSADD) W !,$E($P(^PSDRUG(PSAD,0),U),1,39),?40,$E($P(^PRC(441,PSAIT,0),U,2),1,39),!
- NOT ..S:$O(^PSDRUG("AB",PSAIT,"")) PSADD="" I $D(^PRC(441,PSAIT,3)),$P(^(3),U)=1 S PSADD=""
- OK .I '$D(PSADD) S DIE=50,DA=PSAD,DR="441///^S X=PSAIT" D ^DIE W "Linked to Item #"_PSAIT
- QUIT I $E(IOST)'="C" W @IOF
- I $E(IOST,1,2)="C-",'PSAOUT W !! S DIR(0)="EA",DIR("A")="END OF REPORT! Press <RET> to return to the menu." D ^DIR
- D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@" K IO("Q") 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 NDC",?55,PSARPDT,?70,"PAGE: "_PSAPG,!,PSALN,!,"DRUG file",?40,"ITEM MASTER file"
- Q
- NOW ;Extended help to 'Would you like to run the report now?'
- W !?5,"Enter YES if you want to print the report now.",!!?5,"Enter NO if you do not want to run the report now.",!?5,"You will not exit the option."
- Q
- READY ;Extended help to 'Are you ready to link ALL of the drugs that have matches in the ITEM MASTER file?'
- 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 NDC Matches option?'
- W !?5,"Enter YES if you have run the Report Potential NDC 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
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSALNA 3314 printed Jan 18, 2025@02:50:42 Page 2
- PSALNA ;BIR/LTL-Automated DRUG/ITEM MASTER file Link by NDC ;7/23/97
- +1 ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**15**; 10/24/97
- +2 ;
- +3 ;References to ^PSDRUG( are covered by IA #2095
- +4 ;References to ^PRC( are covered by IA #214
- +5 ;References to ^PSDRUG("AB" are covered by IA #2095
- +6 ;
- +7 DO DT^DICRW
- START ;sets up edit loop
- +1 NEW D0,D1,DA,DIC,DIE,DLAYGO,DR,DIR,DIRUT,DTOUT,DUOUT,PSAD,PSADD,PSAIT,PSALN,PSAOUT,PSAPG,PSARPDT,X,Y
- QUES SET DIR(0)="Y"
- SET DIR("A")="Have you run the Report Potential NDC Matches option"
- SET DIR("??")="^D RUN^PSALNA"
- SET PSAOUT=1
- DO ^DIR
- KILL DIR
- if $DATA(DIRUT)
- GOTO QUIT
- if Y<1
- Begin DoDot:1
- +1 SET DIR(0)="Y"
- SET DIR("A")="Would you like to run the report now"
- SET DIR("B")="YES"
- SET DIR("??")="^D NOW^PSALNA"
- DO ^DIR
- KILL DIR
- if $GET(DIRUT)
- SET PSAOUT=1
- IF Y
- DO ^PSALND
- SET PSAOUT=0
- End DoDot:1
- if PSAOUT
- GOTO QUIT
- +2 WRITE !
- SET DIR(0)="Y"
- SET DIR("A",1)="Are you ready to link ALL of the drugs"
- SET DIR("A")="that have matches in the ITEM MASTER file"
- SET DIR("B")="N"
- SET DIR("??")="^D READY^PSALNA"
- +3 DO ^DIR
- KILL DIR
- if 'Y!($GET(DIRUT))
- 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^PSALNA"
- SET ZTDESC="Linking DRUG/ITEM FILE by NDC"
- 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
- KILL PSADD
- SET PSAD=$ORDER(^PSDRUG(PSAD))
- if 'PSAD
- GOTO QUIT
- if $Y+4>IOSL
- DO HEADER
- if PSAOUT
- GOTO QUIT
- if '(PSAD#100)
- WRITE "."
- IF $PIECE($GET(^PSDRUG(PSAD,2)),U,4)]""
- SET PSAD(1)=$PIECE($GET(^(2)),U,4)
- if '$DATA(^PSDRUG(PSAD,"I"))
- Begin DoDot:1
- +2 SET PSAIT=$$ITEM^PSAUTL(PSAD(1))
- if 'PSAIT
- QUIT
- IF $DATA(^PRC(441,+PSAIT,0))
- Begin DoDot:2
- NOT if $ORDER(^PSDRUG("AB",PSAIT,""))
- SET PSADD=""
- IF $DATA(^PRC(441,PSAIT,3))
- IF $PIECE(^(3),U)=1
- SET PSADD=""
- End DoDot:2
- if $DATA(PSADD)
- QUIT
- WRITE !,$EXTRACT($PIECE(^PSDRUG(PSAD,0),U),1,39),?40,$EXTRACT($PIECE(^PRC(441,PSAIT,0),U,2),1,39),!
- OK IF '$DATA(PSADD)
- SET DIE=50
- SET DA=PSAD
- SET DR="441///^S X=PSAIT"
- DO ^DIE
- WRITE "Linked to Item #"_PSAIT
- End DoDot:1
- QUIT IF $EXTRACT(IOST)'="C"
- WRITE @IOF
- +1 IF $EXTRACT(IOST,1,2)="C-"
- IF 'PSAOUT
- WRITE !!
- SET DIR(0)="EA"
- 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
- +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 NDC",?55,PSARPDT,?70,"PAGE: "_PSAPG,!,PSALN,!,"DRUG file",?40,"ITEM MASTER file"
- +4 QUIT
- NOW ;Extended help to 'Would you like to run the report now?'
- +1 WRITE !?5,"Enter YES if you want to print the report now.",!!?5,"Enter NO if you do not want to run the report now.",!?5,"You will not exit the option."
- +2 QUIT
- READY ;Extended help to 'Are you ready to link ALL of the drugs that have matches in the ITEM MASTER file?'
- +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 NDC Matches option?'
- +1 WRITE !?5,"Enter YES if you have run the Report Potential NDC 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