source: WorldVistAEHR/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSOPOS13.m@ 1704

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

initial load of WorldVistAEHR

File size: 5.1 KB
RevLine 
[613]1PSOPOS13 ;BIR/VRN - Post install routine ;2/29/04
2 ;;7.0;OUTPATIENT PHARMACY;**167**;DEC 1997
3 ;External reference to ^DPT supported by DBIA 10035
4 ;
5 ; POST-INSTALL ROUTINE TO RESET "CMP" XREF TO CORRECT DIVISION FILE 52.5
6 ;
7ENV ;
8 ;Verify CMOP Transmissions are shut down
9 K TSK,TSKNAM
10 F TSKNAM="PSXR SCHEDULED CS TRANS","PSXR SCHEDULED NON-CS TRANS" K TSK D I $G(TSK(1)) Q
11 . D OPTSTAT^XUTMOPT(TSKNAM,.TSK)
12 . Q
13 I $G(TSK(1)) D Q
14 . W !!,"Cannot install the patch while the following Tasks are scheduled:"
15 . W !,"1. PSXR SCHEDULED CS TRANS"
16 . W !,"2. PSXR SCHEDULED NON-CS TRANS"
17 . W !!,"Install Aborted!"
18 . S XPDABORT=2
19 . Q
20 ;Ask queue date and time
21 Q:'$G(XPDENV)
22 W ! K %DT D NOW^%DTC S %DT="RAEX",%DT(0)=%,%DT("A")="Queue the Post-Install to run at what Date@Time: "
23 D ^%DT K %DT I $D(DTOUT)!(Y<0) W !!,"Cannot install the patch without queuing the post-install, install aborted!",! S XPDABORT=2 Q
24 S @XPDGREF@("PSOQ13")=Y
25 Q
26 ;
27EN ;
28 S ZTDTH=@XPDGREF@("PSOQ13")
29 S ZTRTN="START^PSOPOS13",ZTDESC="Background job for to search for invalid division XREF in file 52.5",ZTIO=""
30 D ^%ZTLOAD K ZTDTH,ZTRTN,ZTIO,ZTDESC
31 I $D(ZTSK)&('$D(ZTQUEUED)) D BMES^XPDUTL("Task "_ZTSK_" Queued!")
32 Q
33 ;
34START ;
35 K ^XTMP("PSOPOS13",$J)
36 L +^XTMP("PSOPOS13"):0 I '$T S:$D(ZTQUEUED) ZTREQ="@" Q
37 I '$G(DT) S DT=$$DT^XLFDT
38 I '$D(^XTMP("PSOPOS13")) S X1=DT,X2=+90 D C^%DTC S ^XTMP("PSOPOS13",0)=$G(X)_"^"_DT
39 S X1=DT,X2=-180 D C^%DTC S PSODT2=X
40 D NOW^%DTC S ^XTMP("PSOPOS13","PSOTIMEX","START")=%
41 D BMES^XPDUTL("Re-indexing ""CMP"" XREFs... Sending Mailman message upon completion.")
42SRCH ; SEARCH THROUGH "CMP" XREF
43 N PSODIV,PSOC7
44 S PSOSTA="" F S PSOSTA=$O(^PS(52.5,"CMP",PSOSTA)) Q:PSOSTA="" D
45 .S PSODEA="" F S PSODEA=$O(^PS(52.5,"CMP",PSOSTA,PSODEA)) Q:PSODEA="" D
46 ..S PSODV=0 F S PSODV=$O(^PS(52.5,"CMP",PSOSTA,PSODEA,PSODV)) Q:'PSODV D
47 ...S PSODT=(PSODT2-.001) F S PSODT=$O(^PS(52.5,"CMP",PSOSTA,PSODEA,PSODV,PSODT)) Q:'PSODT D
48 ....S PSODFN="" F S PSODFN=$O(^PS(52.5,"CMP",PSOSTA,PSODEA,PSODV,PSODT,PSODFN)) Q:PSODFN="" D
49 .....S PSOIEN="" F S PSOIEN=$O(^PS(52.5,"CMP",PSOSTA,PSODEA,PSODV,PSODT,PSODFN,PSOIEN)) Q:PSOIEN="" D
50 ......I '$G(^PS(52.5,PSOIEN,0)) K ^PS(52.5,"CMP",PSOSTA,PSODEA,PSODV,PSODT,PSODFN,PSOIEN) Q
51 ......Q:PSODV=$P(^PS(52.5,PSOIEN,0),"^",6)
52 ......S ^XTMP("PSOPOS13",$J,PSODFN,PSODT,PSODV,PSOIEN)=PSOSTA_"^"_PSODT
53 ......K ^PS(52.5,"CMP",PSOSTA,PSODEA,PSODV,PSODT,PSODFN,PSOIEN)
54 ......S PSOC7=$P(^PS(52.5,PSOIEN,0),"^",7)
55 ......I PSOC7'="" D SCMPX^PSOCMOP(PSOIEN,PSOC7)
56 L -^XTMP("PSOPOS13")
57 D GETLIST
58MAIL ;
59 N CNT,TEXT,XMTEXT
60 D NOW^%DTC S PSOTIMEB=%
61 S Y=$G(^XTMP("PSOPOS13","PSOTIMEX","START")) D DD^%DT S PSOTIMEA=Y
62 S Y=$G(PSOTIMEB) D DD^%DT S PSOTIMEB=Y
63 S XMDUZ="Patch PSO*7*167",XMY(DUZ)="",XMSUB="PRESCRIPTION SUSPENSE File (#52.5) reset ""CMP"" Xref"
64 K SP
65 S $P(SP," ",71)="",LINE=0
66 D SETLN("Patch PSO*7*167 File (#52.5) ""CMP"" Xref clean-up is complete.")
67 D SETLN(" ")
68 D SETLN("It started on "_$G(PSOTIMEA)_".")
69 D SETLN("It ended on "_$G(PSOTIMEB)_".")
70 D SETLN(" ")
71 D SETLN("""CMP"" CROSS-REFERENCES THAT WERE REINDEXED")
72 S HDR="RX #",$E(HDR,18)="PATIENT NAME",$E(HDR,46)="CMOP STATUS",$E(HDR,59)="SUSPENSE DATE"
73 D SETLN(HDR)
74 D SETLN(" ")
75 S CNT=0
76 S NAM="" F S NAM=$O(^TMP($J,"PSOPOS14",NAM)) Q:NAM="" D
77 .S DFN="" F S DFN=$O(^TMP($J,"PSOPOS14",NAM,DFN)) Q:DFN="" D
78 ..D PID^VADPT
79 ..S PSOCQ=""
80 ..F S PSOCQ=$O(^TMP($J,"PSOPOS14",NAM,DFN,PSOCQ)) Q:PSOCQ="" D
81 ...S (PSORX,PSOPOS14,PSOSTAT,PSOSDT)=""
82 ...F S PSORX=$O(^TMP($J,"PSOPOS14",NAM,DFN,PSOCQ,PSORX)) Q:PSORX="" D
83 ....S PSOPOS14=^TMP($J,"PSOPOS14",NAM,DFN,PSOCQ,PSORX)
84 ....S PSOSTAT=$P(PSOPOS14,"^",1)
85 ....S Y=$P(PSOPOS14,"^",2) D DD^%DT
86 ....S PSOSDT=Y
87 ....S TEXT=""
88 ....S $E(TEXT,1,17)=$E(PSORX_SP,1,12)
89 ....S $E(TEXT,18,45)=$E($P($G(^DPT(DFN,0)),"^",1)_SP,1,20)
90 ....S $E(TEXT,46,58)=$E(PSOSTAT_SP,1,11)
91 ....S $E(TEXT,59,70)=$E(PSOSDT_SP,1,20)
92 ....D SETLN(TEXT) S CNT=CNT+1
93 ;
94 I CNT=0 D SETLN("No invalid Division Cross References")
95 D SETLN(" ")
96 D SETLN("** END OF LIST **")
97 ;
98 S XMTEXT="^XTMP(""PSOPOS15"",$J,""M""," N DIFROM D ^XMD
99 K PSOTIMEA,PSOTIMEB,XMDUZ,XMSUB,XMTEXT,PSODT2,PSOJOB,^TMP($J,"PSOPOS14"),^XTMP("PSOPOS15",$J,"M")
100 K PSOPOS14,PSOSTAT,PSOSDT,CNT,DFN,MSG,NAM,PSODT,PSOSQ,PSOSQ1,PSOTXT
101 S:$D(ZTQUEUED) ZTREQ="@"
102 Q
103 ;
104SETLN(TXT) ; Sets a line in the XTMP global for the Mailman Message
105 S LINE=$G(LINE)+1
106 S ^XTMP("PSOPOS15",$J,"M",LINE)=TXT
107 Q
108 ;
109GETLIST ;
110 K ^TMP($J,"PSOPOS14")
111 S PSOJOB="" F S PSOJOB=$O(^XTMP("PSOPOS13",PSOJOB)) Q:PSOJOB="" D
112 .S PSOSQ="" F S PSOSQ=$O(^XTMP("PSOPOS13",PSOJOB,PSOSQ)) Q:PSOSQ="" D
113 ..S NAM=$P($G(^DPT(PSOSQ,0)),"^",1) I NAM="" S NAM="UNKNOWN"
114 ..S PSOSQ1="" F S PSOSQ1=$O(^XTMP("PSOPOS13",PSOJOB,PSOSQ,PSOSQ1)) Q:PSOSQ1="" D
115 ...S PSODIV1="" F S PSODIV1=$O(^XTMP("PSOPOS13",PSOJOB,PSOSQ,PSOSQ1,PSODIV1)) Q:PSODIV1="" D
116 ....S PSORX="" F S PSORX=$O(^XTMP("PSOPOS13",PSOJOB,PSOSQ,PSOSQ1,PSODIV1,PSORX)) Q:PSORX="" D
117 .....Q:'$D(^PS(52.5,PSORX,0))
118 .....S PSORX1=$P(^PS(52.5,PSORX,0),"^",1)
119 .....I PSORX1'="" S PSORXP=$P($G(^PSRX(PSORX1,0)),"^",1)
120 .....I PSORXP'="" S ^TMP($J,"PSOPOS14",NAM,PSOSQ,"CMP",PSORXP)=^XTMP("PSOPOS13",PSOJOB,PSOSQ,PSOSQ1,PSODIV1,PSORX)
121 Q
122 ;
Note: See TracBrowser for help on using the repository browser.