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

APSPDSC.m

Go to the documentation of this file.
APSPDSC ; IHS/DSD/ENM - PRINT DISCHARGE SHEET ;29-Jan-2004 08:56;PLS
 ;;7.0;IHS PHARMACY MODIFICATIONS;;09/03/97
 ; Modified - IHS/CIA/PLS - 01/14/04
 D INIT
START D PAT G END:APSPDSC("FLG")
 D ^PSOBUILD
 S APSPDSC("ST")="ACTIVE" D ^PSODSPL
 I $G(PSOSD)']"" S APSPDSC("FLG")=1 G END ;IHS/DSD/ENM 08/14/96
 D ASK G APSPDSC:APSPDSC("FLG")=2
 ;IHS/ITSC/ENM 01/24/03 NEXT 2 LINES COPIED/MOD
 D COPIES I APSPDSC("FLG")=4 D EOJ G APSPDSC  ;IHS/DSD/ENM/POC 08/10/02
 D DEVICE I APSPDSC("FLG")=3 D EOJ G APSPDSC  ;IHS/DSD/ENM/POC 08/10/02
 D ^APSPDSC1
END D EOJ
 Q
 ;-----------------------------------------------
INIT ;
 S APSPDSC("FLG")=0
 S X1=DT,X2=-45 D C^%DTC S PSEED=X-1 K X,X1,X2
 K PSOSD,PSODFN S PSFROM="N",(PSOSD,APSPDSC("FLG"))=0
 S PSOOPT=1
 S APSPAGE=1
 S Y=DT X ^DD("DD") S APSPDSC("DATE")=Y
 I $D(DUZ(2)),$D(^DIC(4,DUZ(2),0)),$P(^(0),U,1)]"" S APSPDSC("FAC")=$P(^(0),U,1)
 Q
PAT ;
 S DIC="^AUPNPAT(",DIC(0)="QEAM" D ^DIC K DIC,DR
 I "^"[X!'$T S APSPDSC("FLG")=1 G PATX
 G PAT:+Y<0
 I '$D(^PS(55,+Y,"P")) W !?20,"NO PHARMACY INFORMATION" G PAT
 S PSODFN=+Y
 S:$D(^DPT(PSODFN,0))#2 APSPDSC("NAME")=$P(^(0),U,1)
PATX ;
 Q
ASK ;
 K X,DIR
 S DIR("A")="CHOOSE FROM ",DIR("?")="^D QUES^APSPDSC",DIR(0)="L^1:"_$G(APSPZDT) D ^DIR K DIR
 I $D(DTOUT)!$D(DUOUT)!$D(DIRUT) S APSPDSC("FLG")=2 G ASKX
 S PSRXS=Y
 I "^"[PSRXS S APSPDSC("FLG")=2 G ASKX
 I PSRXS["-" D QUES,^PSODSPL G ASK ;IHS/DSD/ENM 6.29.95
 I PSRXS'?1N.E!(+PSRXS>PSOSD) D QUES D ^PSODSPL G ASK
 ;IHS/DSD/ENM 6/09/97 $ NEXT REMOVED FM NEXT LINE 'APS3 ADDED
 ;F APS=1:1 S APS1=$P(PSRXS,",",APS) Q:APS1=""  S APS3="" F APS2=1:1:APS1 S APS3=$O(PSOSD(APS3)) Q:APS3=""  I APS2=APS1 W !,APS3 S APSX=$S($D(APSX):APSX_","_$P(+PSOSD(APS3),U,1),1:$P(+PSOSD(APS3),U,1))
 ; Restrict display to ACTIVE scripts
 ; v7.0 PSOBUILD returns array with 2 subscripts (1st=status, 2nd=drug name)
 F APS=1:1 S APS1=$P(PSRXS,",",APS) Q:APS1=""  D
 .S APS3="" F APS2=1:1:APS1 D
 ..S APS3=$O(PSOSD("ACTIVE",APS3)) Q:APS3=""  D
 ...I APS2=APS1 D
 ....W !,APS3 S APSX=$S($D(APSX):APSX_","_$P(+PSOSD("ACTIVE",APS3),U,1),1:$P(+PSOSD("ACTIVE",APS3),U,1))
ASKX ;Exit for ASK subroutine
 K APS,APS1,APS2,APS3
 Q
QUES ;
 W !?5,"Enter the item #(s) or RX #(s) you wish to print seperated by commas or dash."
 W !?5,"For example: 1,2,5 or 1-5 or 123456,33254A,232323B."
 W !?5,"Do not enter the same number twice, duplicates are not allowed."
 Q
DEVICE ;
 S %ZIS="QM"
 S %ZIS("A")="Please enter PATIENT INSTRUCTION SHEET device: " D ^%ZIS
 I POP K POP S APSPDSC("FLG")=3 G DEVICEX
 I $D(IO("Q")),IO=IO(0) W !!,"Sorry, you cannot queue to your screen or to a slave printer.",! K IO("Q") G DEVICE
 G DEVICEX:'$D(IO("Q"))
 K ZTSAVE
 F APSF="APSPAGE","APSX","APSPDSC(""NAME"")","APSPDSC(""DATE"")","APSPDSC(""FAC"")","APSPDSC(""COPIES"")","IOM","PSODFN" S ZTSAVE(APSF)=""
 S ZTRTN="^APSPDSC1",ZTIO=ION
 S ZTDESC="MEDICATION INSTRUCTIONS"
 D ^%ZTLOAD
 S APSPDSC("FLG")=3
DEVICEX ;
 Q
COPIES ;
 S DIR(0)="NO^1:10:0"
 S DIR("B")=1,DIR("A")="Number of copies:"
 D ^DIR
 I $D(DIRUT)!($D(DTOUT)) S APSPDSC("FLG")=4 G COPIESX
 S APSPDSC("COPIES")=$S(+Y>0:+Y,1:1)
COPIESX ;
 K DIR
 Q
EOJ ;EP
 K %ZIS,APS,APS1,APS2,APS3,APSPDSC,APSF,APSPAGE,APSX,DIC,PSOSD,PSODFN,PSEED
 K PSFROM,PSOSD,PSRXS,X,X1,X2,Y,ZTDESC,ZTIO,ZTRTN,ZTSAVE,POP,IO("Q")
 K DRG,DRX0,PS,PSC,PSISD,PSLC,REFRM,RX0,RX2,RX3,ST,ST0,STAR,Z0,Z1,W
 K DIR,DIRUT,DTOUT
 Q