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

PSO427PS.m

Go to the documentation of this file.
  1. PSO427PS ;ALB/DMB - Post-install for PSO*7*427 ;10/21/2014
  1. ;;7.0;OUTPATIENT PHARMACY;**427**;DEC 1997;Build 21
  1. ;
  1. Q
  1. ;
  1. EN ; Entry Point for post-install
  1. D BMES^XPDUTL(" Starting post-install for PSO*7*427")
  1. ;
  1. ; Removed Cached protocol menus
  1. D PROT("PSO REJECT DISPLAY HIDDEN MENU")
  1. D PROT("PSO REJECTS HIDDEN ACTIONS #1")
  1. ;
  1. ; Update Insurance Pointer in REJECT INFO subfile
  1. D INSJOB
  1. ;
  1. ; Completion message
  1. D BMES^XPDUTL(" Finished post-install for PSO*7*427")
  1. Q
  1. ;
  1. PROT(MENU) ;
  1. ; Remove cached hidden menu
  1. N PSOIEN,XQORM
  1. S PSOIEN=$O(^ORD(101,"B",MENU,0))
  1. S XQORM=PSOIEN_";ORD(101,"
  1. I $D(^XUTL("XQORM",XQORM)) D
  1. . D MES^XPDUTL(" Removing cached menu for "_$P(^ORD(101,PSOIEN,0),U))
  1. . K ^XUTL("XQORM",XQORM)
  1. Q
  1. ;
  1. INSJOB ;
  1. ; Job the process to update the Reject file
  1. D BMES^XPDUTL(" Queuing background job to update the Reject mult of the Prescription file")
  1. D MES^XPDUTL(" A Mailman message will be sent when it finishes")
  1. ;
  1. ; Setup required variables
  1. S ZTRTN="INS^PSO427PS",ZTIO="",ZTDTH=$H
  1. S ZTDESC="Background job to update the Prescription file via PSO*7*427"
  1. ;
  1. ; Task the job
  1. D ^%ZTLOAD
  1. ;
  1. ; Check if task was created
  1. I $D(ZTSK) D MES^XPDUTL(" Task #"_ZTSK_" queued")
  1. I '$D(ZTSK) D MES^XPDUTL(" Task not queued. Please create a support ticket.")
  1. Q
  1. ;
  1. INS ;
  1. ; Entry Point to populate the insurance company pointer in the REJECT INFO subfile
  1. N CNT,DAT,RX,RN,RSPIEN,INS,IEN57,INSNM
  1. N DIE,DA,DR,DTOUT,DUOUT,DIROUT,DIRUT
  1. S CNT=0
  1. ; Loop through index
  1. S DAT=0 F S DAT=$O(^PSRX("REJDAT",DAT)) Q:'DAT D
  1. . S RX="" F S RX=$O(^PSRX("REJDAT",DAT,RX)) Q:'RX D
  1. .. S RN="" F S RN=$O(^PSRX("REJDAT",DAT,RX,RN)) Q:'RN D
  1. ... ;If already populated, quit
  1. ... I $P($G(^PSRX(RX,"REJ",RN,2)),"^",9) Q
  1. ... ; Get Response pointer
  1. ... S RSPIEN=$P($G(^PSRX(RX,"REJ",RN,0)),"^",11)
  1. ... ; If the Response pointer exists, get Log of Transaction record and Insurance Pointer from that file
  1. ... S (IEN57,INS)=""
  1. ... I RSPIEN D
  1. .... S IEN57=$O(^BPSTL("AF",RSPIEN,""))
  1. .... I IEN57 S INS=$$GET1^DIQ(9002313.57902,"1,"_IEN57_",",902.33,"I")
  1. .... I INS,'$D(^DIC(36,INS,0)) S INS=""
  1. ... ; If missing from the Transaction, try to match on the insurance name
  1. ... ; There can only be one insurance company with the same name
  1. ... I INS="" D
  1. .... S INSNM=$P($G(^PSRX(RX,"REJ",RN,2)),"^",4)
  1. .... I INSNM]"" S INS=$O(^DIC(36,"B",INSNM,""))
  1. .... I INS,$O(^DIC(36,"B",INSNM,INS)) S INS=""
  1. ... ; Quit if there is no insurance
  1. ... I INS="" Q
  1. ... ; Set insurance company into the field
  1. ... S DIE="^PSRX("_RX_",""REJ"",",DA(1)=RX,DA=RN,DR=33_"////"_INS
  1. ... D ^DIE
  1. ... K DA,DR,DIE
  1. ... S CNT=CNT+1
  1. ;
  1. ; Send email with result
  1. D MAIL(CNT)
  1. Q
  1. ;
  1. MAIL(SUCCNT) ;
  1. N CNT,MSG,XMY,XMDUZ,DIFROM,XMSUB,XMTEXT
  1. S XMY(DUZ)=""
  1. S XMSUB="PSO*7.0*427 Post install is complete",XMDUZ="Patch PSO*7.0*427"
  1. S XMTEXT="MSG("
  1. S CNT=1,MSG(CNT)=""
  1. S CNT=CNT+1,MSG(CNT)="Patch PSO*7.0*427 post install routine has completed."
  1. S CNT=CNT+1,MSG(CNT)=""
  1. S CNT=CNT+1,MSG(CNT)="Updated "_SUCCNT_" records in the PRESCRIPTION file."
  1. S CNT=CNT+1,MSG(CNT)=""
  1. S CNT=CNT+1,MSG(CNT)="For more information about this post install, review the patch description."
  1. D ^XMD
  1. Q