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

PSO7P731.m

Go to the documentation of this file.
  1. PSO7P731 ;DAL/JCH - Post Install routine for patch PSO*7*731 ;08/24/2023
  1. ;;7.0;OUTPATIENT PHARMACY;**731**;DEC 1997;Build 18
  1. ;
  1. ; Reference to ^VA(200,IEN,"PS" in ICR #10060
  1. Q
  1. ;
  1. POST ; Post Install queued entry point
  1. D QUE
  1. Q
  1. ;
  1. START ; Begin post-install processing
  1. ; Remove orphaned DEAs
  1. N PSOXNODE
  1. S PSOXNODE="PSO*7.0*731 POST INSTALL"
  1. D ORPHANDEA
  1. D TMPMSG(PSOXNODE)
  1. Q
  1. ;
  1. ORPHANDEA ; Clean up orphaned DEA# field (53.2) in NEW PERSON file (#200)
  1. N DEA532,DEA5321,PRIEN,PSOFDA,PSOPRGDT,PSOXHDR,PSODTM
  1. S PSODTM=$$NOW^XLFDT()
  1. S PSOXHDR=$$FMADD^XLFDT($$DT^XLFDT(),90)_"^"_$$DT^XLFDT()_"^Delete orphan DEA numbers from DEA# field (#53.2) in NEW PERSON file (#200)"
  1. S ^XTMP(PSOXNODE,0)=$G(PSOXHDR)
  1. ;
  1. ; Remove Orphan DEA# field (#53.2) values when no NEW DEA #'s multiple (#53.21) values exist for Provider
  1. ; Find all DEA number in DEA# field (#53.2)
  1. S DEA532="" F S DEA532=$O(^VA(200,"PS1",DEA532)) Q:DEA532="" D
  1. . ; Find providers associated with DEA# - quit if no NEW DEA #'s were ever filed for the provider
  1. . S PRIEN=0 F S PRIEN=$O(^VA(200,"PS1",DEA532,PRIEN)) Q:'PRIEN D
  1. . . Q:'$D(^VA(200,PRIEN,"PS4",0))!$O(^VA(200,PRIEN,"PS4",0))
  1. . . K PSOFDA,PSOERR
  1. . . S PSOFDA(200,PRIEN_",",53.2)="@"
  1. . . D FILE^DIE("","PSOFDA","PSOERR")
  1. . . S ^XTMP(PSOXNODE,"DEA",$G(DEA532),"DELETED",+$G(PRIEN))=PSODTM
  1. . . S PSOERR=$G(PSOERR("DIERR",1,"TEXT",1)) I $L(PSOERR) S ^XTMP(PSOXNODE,"DEA",$G(DEA532),"ERROR",+$G(PRIEN))=""
  1. . . Q
  1. . Q
  1. Q
  1. ;
  1. TMPMSG(PSOXNODE) ; Send MailMan LOG REPORT
  1. Q:$G(PSOXNODE)=""
  1. N PSODASH,PSOXMAIL,PSODEA,PSOPRIEN,PSOCNT,PSODEAR,PSOPAD,NPIEN,XMDUZ,XMSUB
  1. S $P(PSODASH,"-",80)="",$P(PSOPAD," ",80)=" "
  1. S PSOXMAIL="PSO_ORPHAN_DEA_CLEANUP"
  1. S XMDUZ=.5
  1. ;
  1. S XMSUB="Orphan DEA Cleanup Complete "_$$FMTE^XLFDT(DT,"5DZ"),XMDUZ=.5
  1. K XMY S NPIEN=0 F S NPIEN=$O(^XUSEC("PSDMGR",NPIEN)) Q:'+NPIEN S XMY(NPIEN)=""
  1. ;
  1. S PSOCNT=3 ; Start DEA array starts at 4, first 3 lines for header
  1. S PSODEA="" F S PSODEA=$O(^XTMP(PSOXNODE,"DEA",PSODEA)) Q:PSODEA="" D
  1. . S PSOPRIEN=0 F S PSOPRIEN=$O(^XTMP(PSOXNODE,"DEA",PSODEA,"DELETED",PSOPRIEN)) Q:'PSOPRIEN D
  1. . . ; Pull Date/Time back out, in case run more than once at different times
  1. . . S PSODTM=$G(^XTMP(PSOXNODE,"DEA",PSODEA,"DELETED",PSOPRIEN)) S:'$L(PSODTM) PSODTM="*Missing*"
  1. . . S PSOCNT=PSOCNT+1
  1. . . S PSODEAR(PSOCNT,0)=" Provider IEN:"_PSOPRIEN
  1. . . S PSODEAR(PSOCNT,0)=PSODEAR(PSOCNT,0)_$E(PSOPAD,1,31-$L(PSODEAR(PSOCNT,0)))_" DEA: "_PSODEA_" Removed: "_$P($$FMTE^XLFDT(PSODTM,"2Z"),":",1,2)
  1. S PSOCNT=PSOCNT-3
  1. ;
  1. S ^XTMP(PSOXMAIL,$J,1,0)=" Orphan DEA Cleanup Complete"
  1. S ^XTMP(PSOXMAIL,$J,2,0)=" "_PSOCNT_" orphaned DEA number"_$S(PSOCNT=1:" was ",1:"s were ")_"removed from the NEW PERSON (#200) file"
  1. S ^XTMP(PSOXMAIL,$J,3,0)=""
  1. M ^XTMP(PSOXMAIL,$J)=PSODEAR
  1. ;
  1. S XMY(DUZ)="" N DIFROM S XMTEXT="^XTMP("""_PSOXMAIL_""","_$J_"," D ^XMD K DIFROM
  1. K PSOTEXT,XMTEXT
  1. K ^XTMP(PSOXMAIL,$J)
  1. Q
  1. ;
  1. QUE ; Que post install
  1. N PSOJOB,PSOPATCH,ZTSK,ZTRTN,ZTIO,ZTDTH,ZTDESC,ZTQUEUED,ZTREQ,ZTSAVE
  1. S PSOPATCH="PSO*7.0*731"
  1. S ZTDTH=$$FMTH^XLFDT($$NOW^XLFDT())
  1. S PSOJOB=$J
  1. ;
  1. S ZTRTN="START^PSO7P731",ZTIO=""
  1. S (ZTDESC)="Background job for "_PSOJOB
  1. S ZTSAVE("JOBN")="",ZTSAVE("ZTDTH")="",ZTSAVE("DUZ")=""
  1. D ^%ZTLOAD
  1. D:$D(ZTSK)
  1. . N POSTEXT
  1. . S POSTEXT(1)="A MailMan message will be sent to the installer and"
  1. . S POSTEXT(2)="PSDRPH key holders upon Post Install Completion"
  1. . S POSTEXT(3)="*** Task #"_ZTSK_" Queued! ***"
  1. . D MES^XPDUTL(.POSTEXT)
  1. . S ZTSAVE("ZTSK")=""
  1. ;
  1. Q