| 1 | PSOPOST6 ;BIR/RTR-Update comples orders to CPRS ;03/29/02
 | 
|---|
| 2 |  ;;7.0;OUTPATIENT PHARMACY;**101**;DEC 1997
 | 
|---|
| 3 |  ;External reference to XPD(9.7 supported by DBIA 2197
 | 
|---|
| 4 |  ;
 | 
|---|
| 5 |  K ZTDTH
 | 
|---|
| 6 |  N PSOBACKZ S PSOBACKZ=0
 | 
|---|
| 7 |  I $D(ZTQUEUED) S ZTDTH=$H,PSOBACKZ=1
 | 
|---|
| 8 |  I $G(ZTDTH)="" D
 | 
|---|
| 9 |  .W !!,"This background job will find all Outpatient Pharmacy orders that have complex",!,"Dosing instructions, and will send an update to CPRS for the orders. This will"
 | 
|---|
| 10 |  .W !,"fix the problem of some Sigs being truncated when displayed in CPRS. A mail",!,"message will be generated to this patch installer upon completion.",!
 | 
|---|
| 11 |  W ! S ZTRTN="START^PSOPOST6",ZTIO="",ZTDESC="Patch PSO*7*101 background job" D ^%ZTLOAD I '$D(ZTSK) D  S XPDABORT=2
 | 
|---|
| 12 |  .W !!,"The status of this install will remain 'Start of Install'. Please reinstall",!,"this patch and queue the background job at that time.",!
 | 
|---|
| 13 |  .I '$G(PSOBACKZ) K DIR S DIR(0)="E",DIR("A")="Press Return to Continue" D ^DIR K DIR
 | 
|---|
| 14 |  Q
 | 
|---|
| 15 | START ;
 | 
|---|
| 16 |  N Y,PSOTMSTA,PSOTMSTB,PSOCOMCT,PSOTEXTO,PSOCOMIN,PSOCOMDT,PSOPXIN,PSOCXT,PSOCXZ
 | 
|---|
| 17 |  D NOW^%DTC S Y=% D DD^%DT S PSOTMSTA=$G(Y)
 | 
|---|
| 18 |  S (PSOCOMCT,PSOCOMIN)=0
 | 
|---|
| 19 |  S PSOCOMDT=$O(^XPD(9.7,"B","PSO*7.0*46","")) I PSOCOMDT S PSOCOMIN=$E($P($G(^XPD(9.7,PSOCOMDT,1)),"^"),1,7)
 | 
|---|
| 20 |  I '$G(PSOCOMIN) S PSOCOMIN=3010429
 | 
|---|
| 21 |  ;go back 30 days from POE install, in case of back issue dates
 | 
|---|
| 22 |  S X1=PSOCOMIN,X2=-31 D C^%DTC S PSOCOMIN=X
 | 
|---|
| 23 |  F  S PSOCOMIN=$O(^PSRX("AC",PSOCOMIN)) Q:PSOCOMIN=""  S PSOPXIN="" F  S PSOPXIN=$O(^PSRX("AC",PSOCOMIN,PSOPXIN)) Q:PSOPXIN=""  I $O(^PSRX(PSOPXIN,6,1)) D
 | 
|---|
| 24 |  .I '$P($G(^PSRX(PSOPXIN,"OR1")),"^",2) Q
 | 
|---|
| 25 |  .S PSOCXT=0,PSOCXZ=""
 | 
|---|
| 26 |  .F  S PSOCXZ=$O(^PSRX(PSOPXIN,6,PSOCXZ)) Q:PSOCXZ=""!(PSOCXT>1)  I $G(^PSRX(PSOPXIN,6,PSOCXZ,0))'="" S PSOCXT=PSOCXT+1
 | 
|---|
| 27 |  .S PSOROPCH="PATCH"
 | 
|---|
| 28 |  .I PSOCXT>1 S PSOCOMCT=PSOCOMCT+1 D EN^PSOHLSN1(PSOPXIN,"RO")
 | 
|---|
| 29 | MAIL ;Send mail message
 | 
|---|
| 30 |  K PSOROPCH
 | 
|---|
| 31 |  D NOW^%DTC S Y=% D DD^%DT S PSOTMSTB=$G(Y)
 | 
|---|
| 32 |  S XMDUZ="PATCH PSO*7*101 INSTALLATION",XMSUB="OUTPATIENT COMPLEX ORDERS SEARCH",XMY(DUZ)=""
 | 
|---|
| 33 |  K PSOTEXTO
 | 
|---|
| 34 |  S PSOTEXTO(1)="The background job for patch PSO*7*101 is complete.",PSOTEXTO(2)="It started on "_$G(PSOTMSTA),PSOTEXTO(3)="It finished on "_$G(PSOTMSTB),PSOTEXTO(4)=" ",PSOTEXTO(5)="The total number of orders updated was "_$G(PSOCOMCT)_"."
 | 
|---|
| 35 |  S XMTEXT="PSOTEXTO(" N DIFROM D ^XMD
 | 
|---|
| 36 |  K XMDUZ,XMSUB,XMTEXT
 | 
|---|
| 37 |  S:$D(ZTQUEUED) ZTREQ="@"
 | 
|---|
| 38 |  Q
 | 
|---|