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

PSO7P341.m

Go to the documentation of this file.
  1. PSO7P341 ;BAY PINES-CIOFO/TN - Patch 341 Post Install routine;9/9/09 5:06pm ; 10/22/09 10:50am
  1. ;;7.0;OUTPATIENT PHARMACY;**341**;DEC 1997;Build 8
  1. ;
  1. NEW ZTIO,ZTRTN,ZTDESC
  1. S ZTIO="",ZTRTN="START^PSO7P341",ZTDESC="PSO*7*341 post-int process"
  1. D ^%ZTLOAD
  1. W !!,$S($D(ZTSK):"PSO*7*341 post-init has been queued - Task number ")
  1. W ZTSK KILL ZTSK
  1. QUIT
  1. ;
  1. ;--------------------------------------------------------------
  1. START KILL ^TMP("PSO7P341")
  1. ;
  1. S ^TMP("PSO7P341")="0^0"
  1. S IEN=0
  1. ;
  1. START1 I $G(RESTART) S IEN=$P($G(^TMP("PSO7P341")),U)
  1. ;
  1. F S IEN=$O(^PSRX(IEN)) Q:'IEN D
  1. . S REFILL=0,$P(^TMP("PSO7P341"),U)=IEN
  1. . S RX=$P($G(^PSRX(IEN,0)),U) I RX="" Q
  1. . F S REFILL=$O(^PSRX(IEN,1,REFILL)) Q:'REFILL D
  1. . . ;
  1. . . ;Check "EPH" Node
  1. . . I $D(^PSRX(IEN,1,REFILL,"EPH")),'$D(^PSRX(IEN,1,REFILL,0)) D
  1. . . . KILL ^PSRX(IEN,1,REFILL,"EPH")
  1. . . . S $P(^TMP("PSO7P341"),U,2)=$P(^TMP("PSO7P341"),U,2)+1
  1. . . . S ^TMP("PSO7P341",RX,REFILL)=""
  1. ;
  1. D EMAIL:$G(DUZ)
  1. ;
  1. KILL IEN,REFILL,RESTART,^TMP("PSO7P341")
  1. QUIT
  1. ;-------------------------------------------------------------
  1. EMAIL NEW XMSUB,XMTEXT,XMY,XMDUZ,PSOMSG,PSONAME,PSOCNT,PSOCNT1
  1. NEW PSOIEN,PSOFILL S PSOIEN=""
  1. S PSONAME="PSO*7*341 Post-Init"
  1. S PSOMSG(1)=PSONAME_" has completed"
  1. S PSOMSG(2)="Number of invalid EPH nodes killed is "
  1. S PSOMSG(2)=PSOMSG(2)_$P($G(^TMP("PSO7P341")),U,2)
  1. S PSOMSG(3)=" "
  1. S XMSUB=PSONAME
  1. S XMDUZ="OUTPATIENT PHARMACY"
  1. S XMTEXT="PSOMSG("
  1. S XMY(DUZ)=""
  1. S PSOCNT=0,PSOCNT1=4
  1. F S PSOIEN=$O(^TMP("PSO7P341",PSOIEN)) Q:PSOIEN="" D
  1. . S PSOFILL=""
  1. . F S PSOFILL=$O(^TMP("PSO7P341",PSOIEN,PSOFILL)) Q:PSOFILL="" D
  1. . . S PSOCNT1=PSOCNT1+1,PSOCNT=PSOCNT+1
  1. . . S PSOMSG(PSOCNT1)=$E(100000+PSOCNT,2,99)
  1. . . S PSOMSG(PSOCNT1)=PSOMSG(PSOCNT1)_" RX:"_PSOIEN_" "
  1. . . S PSOMSG(PSOCNT1)=PSOMSG(PSOCNT1)_"INVALID FILL#:"_PSOFILL
  1. D ^XMD
  1. Q
  1. ;-------------------------------------------------------------
  1. RESTART NEW ZTSAVE,ZTIO,ZTRTN,ZTDESC
  1. S ZTSAVE("RESTART")=1
  1. S ZTIO="",ZTRTN="START1^PSO7P341",ZTDESC="PSO*7*341 Post-init"
  1. D ^%ZTLOAD
  1. W !!,$S($D(ZTSK):"PSO*7*341 post-init (RESTARTED) - Task number ")
  1. W ZTSK KILL ZTSK
  1. Q
  1. ;
  1. TEST ;Create entries and stop compile to test restart
  1. ;Call routine at RESTART^PSO7P341 to restart
  1. ;This subroutine is for testing only
  1. ;
  1. NEW STOP,IEN,REFILL,RX
  1. KILL ^TMP("PSO7P341")
  1. S ^TMP("PSO7P341")="0^0"
  1. S IEN=0
  1. F S IEN=$O(^PSRX(IEN)) Q:'IEN Q:$G(STOP) D
  1. . S REFILL=0,$P(^TMP("PSO7P341"),U)=IEN
  1. . S RX=$P($G(^PSRX(IEN,0)),U) I RX="" Q
  1. . F S REFILL=$O(^PSRX(IEN,1,REFILL)) Q:'REFILL D
  1. . . S $P(^TMP("PSO7P341"),U,2)=$P(^TMP("PSO7P341"),U,2)+1
  1. . . S ^TMP("PSO7P341",RX,REFILL)=""
  1. . . I $P($G(^TMP("PSO7P341")),U,2)>12 S STOP=1
  1. I $G(STOP) D
  1. . W !,"Test compile completed."
  1. . W !,"Type D RESTART^PSO7P341 to test restart",!
  1. QUIT