source: WorldVistAEHR/trunk/r/DRUG_ACCOUNTABILITY-PSA/PSALFA.m@ 1042

Last change on this file since 1042 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.1 KB
Line 
1PSALFA ;BIR/LTL-Automated DRUG/ITEM MASTER file Link by FSN ;7/23/97
2 ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**15**; 10/24/97
3 ;This routine automatically loops by FSN.
4 ;References to $$DESCR^PRCPUX1 are covered by IA #259
5 ;References to ^PSDRUG( are covered by IA #2095
6 ;References to ^PRC( are covered by IA #214
7 ;References to ^PSDRUG("AB" are covered by IA #2095
8 ;
9 D DT^DICRW
10START ;sets up edit loop
11 N D0,D1,DA,DIC,DIE,DLAYGO,DR,DTOUT,DUOUT,DIR,DIRUT,PSAD,PSADD,PSAF,PSAFSN,PSAIT,PSALN,PSAOUT,PSARPDT,PSAPG,X,Y
12QUES 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
13 .S DIR(0)="Y",DIR("A")="Would you like to run the report now",DIR("B")="Yes" D ^DIR K DIR D:Y ^PSALFS
14 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
15DEV ;asks device and queueing info
16 W !,"I'll list each DRUG/ITEM MASTER file entry as they're linked.",!
17 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
18 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
19LOOP S (PSAD,PSAPG,PSAOUT)=0,Y=DT D DD^%DT S PSARPDT=Y,Y=1 D HEADER
20 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
21FORM .S PSAFSN=$P(^PSDRUG(PSAD,0),U,6) W !,PSAFSN D
22 ..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
23USED ...I $O(^PSDRUG("AB",PSAIT,"")) S PSADD=$O(^PSDRUG("AB",PSAIT,"")) W !,"**"_$P(^PSDRUG(PSADD,0),U)_" is already linked to Item #"_PSAIT_"**"
24INAC ...I $E($G(^PRC(441,PSAIT,3)),1)=1 W !,"Sorry, Item #"_PSAIT_" is INACTIVE, can't link.",! S PSADD=""
25QUIT W:$E(IOST)'="C" @IOF
26 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
27 D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@" K IO("Q") Q
28LINK S DIE=50,DA=PSAD,DR="441///^S X=PSAIT" D ^DIE W "Linked to Item #"_PSAIT Q
29HEADER ;prints header info
30 I $E(IOST,1,2)'="P-",PSAPG S DIR(0)="E" D ^DIR K DIR I 'Y S PSAOUT=1 Q
31 I $$S^%ZTLOAD W !!,"Task #",$G(ZTSK),", ",$G(ZTDESC)," was stopped by ",$P($G(^VA(200,+$G(DUZ),0)),U),"." S PSAOUT=1 Q
32 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"
33 Q
34READY ;Extended help for 'Have you run the Report Potential FSN Matches option?'
35 W !?5,"Enter YES to begin linking every drug that has been matched.",!?5,"Enter NO to exit the option."
36 Q
37RUN ;Extended help to 'Have you run the Report Potential FSN Matches option?'
38 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."
39 Q
Note: See TracBrowser for help on using the repository browser.