source: WorldVistAEHR/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSOSULB1.m@ 1046

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

initial load of WorldVistAEHR

File size: 4.4 KB
RevLine 
[613]1PSOSULB1 ;BHAM ISC/RTR,SAB-Print suspended labels cont. ; 10/10/96
2 ;;7.0;OUTPATIENT PHARMACY;**10,200,264**;DEC 1997;Build 19
3DEV D:'$D(PSOPAR) ^PSOLSET G:'$D(PSOPAR) DEV S PSOION=ION
4 N X S X="PSXRSUS" X ^%ZOSF("TEST") G:($T)&($G(PSXSYS))&($D(^XUSEC("PSXCMOPMGR",DUZ)))&($D(^XUSEC("PSX XMIT",DUZ))) ^PSXRSUS
5DEV1 I '$P(PSOPAR,"^",8) G START
6 N PSOPROP,PFIO W $C(7),!!,"PROFILES MUST BE SENT TO PRINTER !!",! K IOP,%ZIS,IO("Q"),POP S %ZIS="MNQ",%ZIS("A")="Select PROFILE Device: " D ^%ZIS K %ZIS("A") G:POP EXIT^PSOSULBL G:$E(IOST)["C"!(PSOION=ION) DEV S PSOPROP=ION D ^%ZISC
7START I $G(PSOCUTDT)']"" S X1=DT,X2=-120 D C^%DTC S PSODTCUT=X,PSOPRPAS=$P(PSOPAR,"^",7)
8ASK K ^TMP($J),PSOSU,PSOSUSPR S PFIOQ=0,PDUZ=DUZ W !
9 S %DT="AEX",%DT("A")="Print labels through date: ",%DT("B")="TODAY" D ^%DT K %DT D:Y<0 MESS G:Y<0 EXIT^PSOSULBL S PRTDT=Y
10 I '$O(^PS(52.5,"C",0))!($O(^(0))>PRTDT) W $C(7),!!,"NOTHING THRU DATE TO PRINT" G ASK
11 W ! K DIR S DIR("A")="Sort by Patient Name, ID#, or DEA Special Handling",DIR(0)="SB^P:PATIENT NAME;I:IDENTIFICATION NUMBER;D:DEA SPECIAL HANDLING"
12 S DIR("?")="Enter 'P' to sort the labels alphabetically by name, enter 'I' to sort by identification number, enter 'D' to sort by DEA Special Handling."
13 S DIR("?",1)="Sorting by DEA Special Handling will print the labels in three groups. The",DIR("?",2)="first will contain labels with drugs marked with an A or C in the DEA Special"
14 S DIR("?",3)="Handling field, indicating NARCOTICS AND ALCOHOLICS, and CONTROLLED SUBSTANCES-",DIR("?",4)="NON NARCOTIC. The second group will contain ones marked with an S, indicating"
15 S DIR("?",5)="SUPPLY, and all others will print in the third group.",DIR("?",6)=""
16 D ^DIR K DIR D:$D(DIRUT) MESS G:$D(DIRUT) EXIT^PSOSULBL S PSRT=$S(Y="D":"D",Y="P":1,1:0)
17 I Y="D" W ! K DIR S DIR(0)="SB^P:PATIENT NAME;I:IDENTIFICATION NUMBER",DIR("A")="Within DEA Special Handling, sort by Patient Name or ID#" D ^DIR K DIR D:$D(DIRUT) MESS G:$D(DIRUT) EXIT^PSOSULBL S PSRTONE=Y
18 S X1=PRTDT,X2=$P(PSOPAR,"^",27) D C^%DTC S XDATE=X K IOP,POP,IO("Q"),ZTSK
19PRLBL W ! S %ZIS("A")="Printer 'LABEL' Device: ",%ZIS("B")="",%ZIS="MQN" D ^%ZIS S PSLION=ION I POP S IOP=PSOION D ^%ZIS D MESS G EXIT^PSOSULBL
20 I $E(IOST)'["P" D MESSL G PRLBL
21 N PSOIOS S PSOIOS=IOS D DEVBAR^PSOBMST
22 S PSOBARS=PSOBAR1]""&(PSOBAR0]"")&$P(PSOPAR,"^",19)
23 K PSOION D ^%ZISC I $D(IO("Q")) K IO("Q")
24QUE K %DT,PSOTIME,PSOOUT D NOW^%DTC S %DT="REAX",%DT(0)=%,%DT("B")="NOW",%DT("A")="Queue to run at what time: " D ^%DT K %DT I $D(DTOUT)!(Y<0) D MESS G EXIT^PSOSULBL
25 S (PSOSUSPR,PSODBQ)=1,PSOTIME=Y
26 S ZTRTN="BEG^PSOSULBL",ZTDESC="PRINT LABELS FROM SUSPENSE",ZTIO=PSLION,ZTDTH=PSOTIME
27 F G="PSOPAR","PSOSYS","PSOSUSPR","PSODBQ","PSRT","PSRTONE","PSOPROP","PSLION","PFIO","PSOBARS","PSODTCUT","PSOPRPAS","PRTDT","PDUZ","PSOBAR0","PSOBAR1","PSOSITE","XDATE","PSOTIME" S:$D(@G) ZTSAVE(G)=""
28 D ^%ZTLOAD W !!,"PRINT FROM SUSPENSE JOB QUEUED!",! D ^%ZISC G EXIT^PSOSULBL
29 ;G:PSRT'="D" BEG^PSOSULBL
30MESS W $C(7),!!?3,"NOTHING QUEUED TO PRINT!",! Q
31MESSL W $C(7),!?3,"LABELS MUST BE SENT TO A PRINTER!",! Q
32BAIMAIL ;Send mail message
33 S:'$G(PDUZ) PDUZ=+$G(DUZ)
34 K ^TMP("PSOM",$J)
35 N SEQ,XMY,XMDUZ,XMSUB,XMTEXT,SEQ,NAME,PSSN,RX,FILL,FIRST
36 S SEQ=1
37 S XMY(PDUZ)=""
38 S XMY("G.PSO EXTERNAL DISPENSE ALERTS")=""
39 S XMDUZ="OUTPATIENT PHARMACY PACKAGE"
40 S XMSUB="BAD ADDRESS SUSPENSE NOT PRINTED"
41 I $G(PSOSITE) S XMSUB=$$GET1^DIQ(59,PSOSITE,.06)_" "_XMSUB
42 S ^TMP("PSOM",$J,SEQ)="The following prescriptions with a routing of mail were not printed/sent to",SEQ=SEQ+1
43 S ^TMP("PSOM",$J,SEQ)="external interface due to the BAD ADDRESS INDICATOR being set and no active",SEQ=SEQ+1
44 S ^TMP("PSOM",$J,SEQ)="temporary address, or the patient has an active MAIL status of DO NOT MAIL, or",SEQ=SEQ+1
45 S ^TMP("PSOM",$J,SEQ)="the patient has a foreign address:",SEQ=SEQ+1
46 S NAME="" F S NAME=$O(^TMP("PSOSM",$J,NAME)) Q:NAME="" D
47 .S PSSN="" F S PSSN=$O(^TMP("PSOSM",$J,NAME,PSSN)) Q:PSSN="" D
48 ..S ^TMP("PSOM",$J,SEQ)="",SEQ=SEQ+1
49 ..S ^TMP("PSOM",$J,SEQ)=NAME_" "_PSSN,FIRST=1
50 ..S RX=0 F S RX=$O(^TMP("PSOSM",$J,NAME,PSSN,RX)) Q:'RX S FILL="" F S FILL=$O(^TMP("PSOSM",$J,NAME,PSSN,RX,FILL)) Q:FILL="" D
51 ...I FIRST D S FIRST=0
52 ....S ^TMP("PSOM",$J,SEQ)=^TMP("PSOM",$J,SEQ)_" ("_$G(^TMP("PSOSM",$J,NAME,PSSN,RX,FILL))_")"
53 ....S SEQ=SEQ+1
54 ...S ^TMP("PSOM",$J,SEQ)=" "_$P(^PSRX(RX,0),"^")_" ("_FILL_") "_$P($G(^PSDRUG($P(^PSRX(RX,0),"^",6),0)),"^"),SEQ=SEQ+1
55 S ^TMP("PSOM",$J,SEQ+1)=""
56 S XMTEXT="^TMP(""PSOM"",$J," N DIFROM D ^XMD K XMSUB,XMTEXT,XMY,XMDUZ
57 Q
58 ;
Note: See TracBrowser for help on using the repository browser.