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

RMPR210P.m

Go to the documentation of this file.
RMPR210P ;RGB/MNTVBB - Resetting script expiration dates > year 2023 ; Nov 29, 2021@12:06
 ;;3.0;Prosthetics;**210**;Nov 29, 2021;Build 18
 ;;Per VA Directive 6402, this routine should not be modified.
 ;
 ;RMPR*3.0*210 Searches/lists for any prescription dates greater than
 ;             year 2023 and resets expiration date to active date.
 ;
 ; Reference to $$PROD^XUPROD in ICR #4440
 ; Reference to ^XUSEC( in ICR #10076
 ; Reference to ^DPT( in ICR #10035
 ; Reference to ^XMD in ICR #10070
 ; Reference to ^XPDUTL in ICR #10141
 ;
 Q
EN ;ENTRY POINT
 D MES^XPDUTL("Reset per the search of Home Oxygen expiration dates >2023")
 D MES^XPDUTL("that were set to future date to prolong script.")
 N RMPRYR,RMPRYRX,RMPRIEN,RMPRSCRP,RMPRREC,RMPRSCDT,RMPRT1,RMPRT2,RMPRDT,RMPRSP,RMPRNM
 N RMPRSITE,RMPRPROD,RMPRI,RMPRDT1,RMPRDT2,RMPRPRT,RMPRMES,RMPRNM
 S U="^",RMPRYR=323,(RMPRIEN,RMPRT1,RMPRT2)=0,$P(RMPRSP," ",40)="",RMPRPRT=1
 K ^TMP("RMPR210P",$J)
 S ^XTMP("RMPR210P",0)=$$FMADD^XLFDT(DT,90)_"^"_DT
HOLOOP F  S RMPRIEN=$O(^RMPR(665,RMPRIEN)) Q:'RMPRIEN  D
 . I $P($G(^DPT(RMPRIEN,.35)),U) Q
 . I '$D(^RMPR(665,RMPRIEN,"RMPOA")) Q
 . ;I $P($G(^RMPR(665,RMPRIEN,"RMPOA")),U,3) Q   ;inactivation date check not checked
 . S RMPRSCRP=0 F  S RMPRSCRP=$O(^RMPR(665,RMPRIEN,"RMPOB",RMPRSCRP)) Q:'RMPRSCRP  D
 . . S RMPRREC=^RMPR(665,RMPRIEN,"RMPOB",RMPRSCRP,0) Q:'RMPRREC
 . . S RMPRSCDT=$P(RMPRREC,U,3),RMPRYRX=$E(RMPRSCDT,1,3)
 . . I RMPRYRX'>RMPRYR Q
 . . S RMPRDT1=$$FMTE^XLFDT($P(RMPRREC,U),"5Z"),RMPRDT2=$$FMTE^XLFDT($P(RMPRREC,U,3),"5Z")
 . . I $E(RMPRREC,1,3)>316 S ^TMP("RMPR210P",$J,"S",RMPRIEN,RMPRSCRP)=RMPRREC_"^^"_RMPRDT1_" / "_RMPRDT2,RMPRT2=RMPRT2+1 Q
 . . S ^TMP("RMPR210P",$J,"C",RMPRIEN,RMPRSCRP)=RMPRREC_"^^"_RMPRDT1_" / "_RMPRDT2_U_RMPRDT1_" / "_RMPRDT1,RMPRT1=RMPRT1+1
 . . S ^TMP("RMPR210P",$J,9,RMPRIEN,"RMPOB",RMPRSCRP,0)=RMPRREC
 . . S RMPRDT=$P(RMPRREC,U),RMPRDT=$$FMTE^XLFDT(RMPRDT)
 . . S DA=RMPRSCRP,DA(1)=RMPRIEN,DIE="^RMPR(665,"_RMPRIEN_",""RMPOB"",",DR="2///^S X=RMPRDT" D ^DIE
 S ^TMP("RMPR210P",$J,"T",0)=RMPRT1_U_RMPRT2
QX ;REPORT
 N RMPRSP,RMPRPROD,RMPRSITE,RMPRIEN,RMPRSCRP,RMPRREC
 K DA,DR,DIE
 S $P(RMPRSP," ",40)=""
 S RMPRPROD=$$PROD^XUPROD(),RMPRSITE=$P($G(^RMPR(669.9,1,0)),U,1,2)
 D BMES^XPDUTL("RESET EXPIRATION DATE >2023")
 S RMPRMES="FOR "_$S(RMPRPROD=1:"PRODUCTION",1:"TEST")_" SITE: "_$P(RMPRSITE,U,2)_" - "_$P(RMPRSITE,U)_" ON "_$J($$FMTE^XLFDT(DT,"5Z"),10)
 D BMES^XPDUTL(RMPRMES)
 S RMPRMES="VETERAN NAME                  Before/After SCRIPT DATES (ACTIVE/EXPIRATION)"
 D BMES^XPDUTL(RMPRMES)
 S RMPRMES="============                 =============================================" D MES^XPDUTL(RMPRMES)
 S RMPRIEN=0
 F  S RMPRIEN=$O(^TMP("RMPR210P",$J,"C",RMPRIEN)),RMPRSCRP=0 Q:'RMPRIEN  D
 . D MES^XPDUTL(" ") S RMPRNM=$E($P(^DPT(RMPRIEN,0),U),1,25)
 . F  S RMPRSCRP=$O(^TMP("RMPR210P",$J,"C",RMPRIEN,RMPRSCRP)) Q:'RMPRSCRP  D
 . . S RMPRREC=^TMP("RMPR210P",$J,"C",RMPRIEN,RMPRSCRP)
 . . S RMPRMES=$$LJSF(RMPRNM,28)_$P(RMPRREC,U,5)_" TO "_$P(RMPRREC,U,6) D MES^XPDUTL(RMPRMES)
 S RMPRMES="*** TOTAL:  "_$P(^TMP("RMPR210P",$J,"T",0),U) D BMES^XPDUTL(RMPRMES)
 D BMES^XPDUTL("")
 S RMPRMES="PATIENTS NEEDED TO BE EDITED MANUALLY:" D MES^XPDUTL(RMPRMES) S RMPRIEN=0
 S RMPRMES="VETERAN NAME                 Before SCRIPT DATES (ACTIVE/EXPIRATION)" D BMES^XPDUTL(RMPRMES)
 S RMPRMES="============                 =============================================" D MES^XPDUTL(RMPRMES)
 F  S RMPRIEN=$O(^TMP("RMPR210P",$J,"S",RMPRIEN)),RMPRSCRP=0 Q:'RMPRIEN  D
 . D MES^XPDUTL("") S RMPRNM=$E($P(^DPT(RMPRIEN,0),U),1,25)
 . F  S RMPRSCRP=$O(^TMP("RMPR210P",$J,"S",RMPRIEN,RMPRSCRP)) Q:'RMPRSCRP  D
 . . S RMPRREC=^TMP("RMPR210P",$J,"S",RMPRIEN,RMPRSCRP)
 . . S RMPRMES=$$LJSF(RMPRNM,28)_$P(RMPRREC,U,5) D MES^XPDUTL(RMPRMES)
 D MES^XPDUTL("")
 S RMPRMES="TOTAL:  "_$P(^TMP("RMPR210P",$J,"T",0),U,2) D MES^XPDUTL(RMPRMES)
 D:$G(RMPRPRT)=1 MSG
 M ^XTMP("RMPR210P","C")=^TMP("RMPR210P",$J,"C") ;Set XTMP array for backup
 M ^XTMP("RMPR210P","S")=^TMP("RMPR210P",$J,"S") ;Set XTMP array for backup
 K ^TMP("RMPR210P",$J)
 Q
EXIT ;
MSG N XMY,XMDUZ,XMSUB,XMTEXT,BMSG,RMPRIEN,RCCTR,RCIEN,DIFROM,RMPRMKY,RMPRSKY
 S XMDUZ=.5
 S XMSUB="****  RESET HO SCRIPT EXPIRATION DATES >2023    ***"
 S BMSG(1)="The following Home Oxygen script expiration dates after 2023 are listed and"
 S BMSG(2)="reset to the linked activity date."
 S BMSG(3)=""
 S BMSG(4)=$S(RMPRPROD=1:"PRODUCTION",1:"TEST")_" Site: "_$P(RMPRSITE,U,2)_" - "_$P(RMPRSITE,U)
 S BMSG(5)=" "
 S BMSG(6)="RESET >2023 EXPIRATION DATES TO BE SAME AS ACTIVITY DATE"
 S BMSG(7)=" "
 S BMSG(8)="VETERAN NAME                Before/After SCRIPT DATES (ACTIVE/EXPIRATION)"
 S BMSG(9)="============                ============================================="
 M ^TMP("RMPR210P",$J,5)=BMSG
 S RMPRIEN=0,RCCTR=9
 F  S RMPRIEN=$O(^TMP("RMPR210P",$J,"C",RMPRIEN)),RMPRSCRP=0 Q:'RMPRIEN  D
 . S:RCCTR>9 RCCTR=RCCTR+1,^TMP("RMPR210P",$J,5,RCCTR)=""
 . F  S RMPRSCRP=$O(^TMP("RMPR210P",$J,"C",RMPRIEN,RMPRSCRP)) Q:'RMPRSCRP  D
 . . S RMPRREC=^TMP("RMPR210P",$J,"C",RMPRIEN,RMPRSCRP),RMPRNM=$E($P(^DPT(RMPRIEN,0),U),1,25)
 . . S RCCTR=RCCTR+1,^TMP("RMPR210P",$J,5,RCCTR)=RMPRNM_$E(RMPRSP,1,28-$L(RMPRNM))_$P(RMPRREC,U,5)_" TO "_$P(RMPRREC,U,6)
 S RCCTR=RCCTR+1,^TMP("RMPR210P",$J,5,RCCTR)=""
 S RCCTR=RCCTR+1,^TMP("RMPR210P",$J,5,RCCTR)="TOTAL:  "_$P(^TMP("RMPR210P",$J,"T",0),U)
 F RMPRI=1:1:4 S RCCTR=RCCTR+1,^TMP("RMPR210P",$J,5,RCCTR)=""
 S RCCTR=RCCTR+1,^TMP("RMPR210P",$J,5,RCCTR)="PATIENTS NEED TO BE EDITED MANUALLY:"
 S RCCTR=RCCTR+1,^TMP("RMPR210P",$J,5,RCCTR)=""
 S RCCTR=RCCTR+1,^TMP("RMPR210P",$J,5,RCCTR)="VETERAN NAME                  Before SCRIPT DATES (ACTIVE/EXPIRATION)"
 S RCCTR=RCCTR+1,^TMP("RMPR210P",$J,5,RCCTR)="============                  ======================================="
 S RCCTR=RCCTR+1,^TMP("RMPR210P",$J,5,RCCTR)=""
 F  S RMPRIEN=$O(^TMP("RMPR210P",$J,"S",RMPRIEN)),RMPRSCRP=0 Q:'RMPRIEN  D
 . F  S RMPRSCRP=$O(^TMP("RMPR210P",$J,"S",RMPRIEN,RMPRSCRP)) Q:'RMPRSCRP  D
 . . S RMPRREC=^TMP("RMPR210P",$J,"S",RMPRIEN,RMPRSCRP),RMPRNM=$E($P(^DPT(RMPRIEN,0),U),1,25)
 . . S RCCTR=RCCTR+1,^TMP("RMPR210P",$J,5,RCCTR)=RMPRNM_$E(RMPRSP,1,30-$L(RMPRNM))_"     "_$P(RMPRREC,U,5)
 F RMPRI=1,2 S RCCTR=RCCTR+1,^TMP("RMPR210P",$J,5,RCCTR)=""
 S RCCTR=RCCTR+1,^TMP("RMPR210P",$J,5,RCCTR)="TOTAL:  "_$P(^TMP("RMPR210P",$J,"T",0),U,2)
 S XMTEXT="^TMP(""RMPR210P"""_","_$J_",5,"
 S XMY(DUZ)="" ;Send mailman message to installer
 S RMPRSKY=0 F  S RMPRSKY=$O(^XUSEC("RMPRSUPERVISOR",RMPRSKY)) Q:'RMPRSKY  S XMY(RMPRSKY)="" ;Send mailman message to holders of RMPRSUPERVISOR security key
 S RMPRMKY=0 F  S RMPRMKY=$O(^XUSEC("RMPRMANAGER",RMPRMKY)) Q:'RMPRMKY  S XMY(RMPRMKY)="" ;Send mailman message to holders of RMPRMANAGER security key
MSG1 D ^XMD
 Q
 ;
LJSF(X,Y) ;x left justified, y space filled
 S X=X_$E(RMPRSP,1,30-$L(X))
 Q X
 ;