source: FOIAVistA/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSOCMOPA.m@ 1384

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

initial load of FOIAVistA 6/30/08 version

File size: 3.5 KB
Line 
1PSOCMOPA ;BIR/HTW-Utility for Hold/Can ;[ 12/30/96 10:28 AM ]
2 ;;7.0;OUTPATIENT PHARMACY;**61,76**;DEC 1997
3 ;External Referrence to file # 550.2 granted by DBIA 2231
4 ;Required input: DA - internal entry # - ^PSRX
5 ;Returns:
6 ;CMOP("L")=LAST FILL... if it is orig Rx =0
7 ;CMOP(FILL #)=CMOP status from 52...Trans/0,DISP/1,RETRAN/2,NOT DISP/3
8 ;If suspended CMOP("S")=CMOP suspense status Q,L,X,P,R
9 ;PSOCMOP=STATUS_^_TRAN DATE_^_LAST FILL
10 ;All returned variables can be killed by K CMOP,PSOCMOP
11 ;
12 N X,XN,BATCH,TDT,BIEN
13 K PSOCMOP
14 S (CMOP("L"),X)=0 F S X=$O(^PSRX(DA,1,X)) Q:'X S CMOP("L")=X
15 I $O(^PSRX(DA,4,0)) F X=0:0 S X=$O(^PSRX(DA,4,X)) Q:'X D
16 .S XN=$G(^PSRX(DA,4,X,0)),BATCH=$P($G(XN),"^") Q:$G(BATCH)']""
17 .S BIEN=$O(^PSX(550.2,"B",BATCH,"")) Q:$G(BIEN)']"" S TDT=$P(^PSX(550.2,BIEN,0),"^",6)
18 .S CMOP($P($G(XN),"^",3))=$P($G(XN),"^",4),PSOCMOP=$P($G(XN),"^",4)_"^"_$G(TDT)_"^"_CMOP("L")
19 S X=$O(^PS(52.5,"B",DA,0)) I X]"" S CMOP("S")=$P($G(^PS(52.5,X,0)),"^",7),CMOP("52.5")=X
20 K X,XN,BATCH,TDT,BIEN
21 Q
22UNHOLD N FDT S FDT=PSORX("FILL DATE"),XFROM="UNHOLD" G EN1
23REINS S XFROM="REINSTATE"
24EN1 D SUS1^PSOCMOP I '$G(XFLAG) G KILL
25 D PSOCMOPA
26 I $G(REL)]""!($G(CMOP(CMOP("L")))=0)!($G(CMOP(CMOP("L")))=2) D G KILL
27 .I XFROM="REINSTATE" W !!,RX_" REINSTATED -- ",! Q
28 .I XFROM="UNHOLD" W !!,$P(^PSRX(DA,0),"^")_" Removed from Hold Status",!!
29 I $G(CMOP(CMOP("L")))']"" D S^PSOCMOP G KILL
30 I $G(CMOP(CMOP("L")))=3,(FDT>DT) D S^PSOCMOP G KILL
31KILL D D1^PSOCMOP
32 K CMOP,DIR,X,DIRUT,DUOUT,Y,DTOUT,XFROM
33 Q
34 ;
35QS W !! S DIR("A")="LABEL: QUEUE"_$S($P(PSOPAR,"^",24):"/SUSPEND",1:"")_" or '^' to bypass "
36 S DIR("?",1)="Enter 'Q' to queue labels for printing" S:$P(PSOPAR,"^",24) DIR("?",2)="Enter 'S' to suspend labels for printing at a later date"
37 S DIR(0)="SA^Q:QUEUE"_$S($P(PSOPAR,"^",24):";S:SUSPENSE",1:""),DIR("B")="Q" D ^DIR K DIR
38 I $D(DUOUT)!$D(DIRUT) G KILL
39 I $G(Y)="S" D S^PSOCMOP K CMOP Q
40 I $G(Y)="Q" D D1^PSOCMOP K CMOP I $G(PSOLAP)]"",($G(PSOLAP)'=ION) S PPL=DA,RXLTOP=1 D QLBL^PSORXL Q
41 I $G(Y)="Q" S PPL=DA,RXLTOP=1 D Q1^PSORXL
42 Q
43HLD N PSOFROM S PSOFROM="HOLD"
44EN ; Called from PSORXDL,HLD+4^PSOHLD, PSOCAN
45 ; if in suspense and "loading" no delete
46 Q:'$G(DA) D PSOCMOPA
47 I $G(CMOP("S"))="L" D MSG K CMOP Q
48 I $G(PSOFROM)="DELETE",($G(CMOP(CMOP("L")))=0!($G(CMOP(CMOP("L")))=2)) D MSG
49 K CMOP
50 Q
51MSG W !!,"A CMOP Rx cannot be"_$S($G(PSOFROM)="HOLD":" placed on HOLD",$G(PSOFROM)="CANCEL":" DISCONTINUED",1:" DELETED")
52 W $S($G(PSOFROM)="DELETE":" while in",1:" during")
53 W $S($G(PSOFROM)="DELETE":" transmission status!",1:" transmission! ")_" Try later.",!!
54 S XFLAG=1
55 Q
56CMOP ;
57 I $D(^PSRX(RXN,4)) F PSXZ=0:0 S PSXZ=$O(^PSRX(RXN,4,PSXZ)) Q:'PSXZ D
58 .S PSX($P(^PSRX(RXN,4,PSXZ,0),U,3))=$P(^PSRX(RXN,4,PSXZ,0),U,4)
59 K PSXZ
60 Q
61DUPCAN N DA,PSOFROM S DA=+PSOSD(STA,DNM),PSOFROM="CANCEL" G EN
62 ;Called from ASK+4^PSORENW
63MW(PSODIR) ;
64 K DIR,DIC
65 S DIR(0)="52,11"
66 S DIR("B")=$S($G(PSORX("MAIL/WINDOW"))]"":PSORX("MAIL/WINDOW"),1:"WINDOW")
67 D DIR G:PSODIR("DFLG")!PSODIR("FIELD") MWX
68 I $G(Y(0))']"" S PSODIR("DFLG")=1 G MWX
69 S PSODIR("MAIL/WINDOW")=Y,PSORX("MAIL/WINDOW")=Y(0)
70MW1 G:PSODIR("MAIL/WINDOW")'="W"!('$P($G(PSOPAR),"^",12)) MWX
71 S DIR(0)="52,35O"
72 S:$G(PSORX("METHOD OF PICK-UP"))]"" DIR("B")=PSORX("METHOD OF PICK-UP")
73 D DIR G:PSODIR("DFLG") MWX
74 I X[U W !,"Cannot jump to another field ..",! G MW1
75 S (PSODIR("METHOD OF PICK-UP"),PSORX("METHOD OF PICK-UP"))=Y
76MWX K X,Y
77 Q
78DIR ;
79 S PSODIR("FIELD")=0
80 G:$G(DIR(0))']"" DIRX
81 D ^DIR K DIR,DIE,DIC,DA
82 I $D(DUOUT)!($D(DTOUT))!($D(DIROUT)),$L($G(X))'>1!(Y="") S PSODIR("DFLG")=1 G DIRX
83DIRX K DIRUT,DTOUT,DUOUT,DIROUT,PSOX
84 Q
Note: See TracBrowser for help on using the repository browser.