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

PSALFA.m

Go to the documentation of this file.
  1. 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
  1. ;This routine automatically loops by FSN.
  1. ;References to $$DESCR^PRCPUX1 are covered by IA #259
  1. ;References to ^PSDRUG( are covered by IA #2095
  1. ;References to ^PRC( are covered by IA #214
  1. ;References to ^PSDRUG("AB" are covered by IA #2095
  1. ;
  1. D DT^DICRW
  1. START ;sets up edit loop
  1. N D0,D1,DA,DIC,DIE,DLAYGO,DR,DTOUT,DUOUT,DIR,DIRUT,PSAD,PSADD,PSAF,PSAFSN,PSAIT,PSALN,PSAOUT,PSARPDT,PSAPG,X,Y
  1. 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
  1. .S DIR(0)="Y",DIR("A")="Would you like to run the report now",DIR("B")="Yes" D ^DIR K DIR D:Y ^PSALFS
  1. 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
  1. DEV ;asks device and queueing info
  1. W !,"I'll list each DRUG/ITEM MASTER file entry as they're linked.",!
  1. 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
  1. 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
  1. LOOP S (PSAD,PSAPG,PSAOUT)=0,Y=DT D DD^%DT S PSARPDT=Y,Y=1 D HEADER
  1. 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
  1. FORM .S PSAFSN=$P(^PSDRUG(PSAD,0),U,6) W !,PSAFSN D
  1. ..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
  1. USED ...I $O(^PSDRUG("AB",PSAIT,"")) S PSADD=$O(^PSDRUG("AB",PSAIT,"")) W !,"**"_$P(^PSDRUG(PSADD,0),U)_" is already linked to Item #"_PSAIT_"**"
  1. INAC ...I $E($G(^PRC(441,PSAIT,3)),1)=1 W !,"Sorry, Item #"_PSAIT_" is INACTIVE, can't link.",! S PSADD=""
  1. QUIT W:$E(IOST)'="C" @IOF
  1. 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
  1. D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@" K IO("Q") Q
  1. I $E(IOST,1,2)'="P-",PSAPG S DIR(0)="E" D ^DIR K DIR I 'Y S PSAOUT=1 Q
  1. I $$S^%ZTLOAD W !!,"Task #",$G(ZTSK),", ",$G(ZTDESC)," was stopped by ",$P($G(^VA(200,+$G(DUZ),0)),U),"." S PSAOUT=1 Q
  1. 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"
  1. Q
  1. READY ;Extended help for 'Have you run the Report Potential FSN Matches option?'
  1. W !?5,"Enter YES to begin linking every drug that has been matched.",!?5,"Enter NO to exit the option."
  1. Q
  1. RUN ;Extended help to 'Have you run the Report Potential FSN Matches option?'
  1. 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."
  1. Q