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

FBMON.m

Go to the documentation of this file.
FBMON ;DSS/LJF - VISTA FEE 5010 UPGRADE ;4/4/2011
 ;;3.5;FEE BASIS;**122**;JAN 30, 1995;Build 8
 ;;Per VHA Directive 10-93-142, this routine should not be modified.
 Q
 ;
INIT() ; Standard data items
 ; N FBFENFLD,FBFPARIX,FBFPROOT,FBFSTFLD,FBFINTER  ; set by $$INIT
 I $E($G(IOST),1,2)="C-" S FBFINTER=1  ; interactive flag
 S FBFSTFLD=36,FBFENFLD=37,FBFPROOT=161.4,FBFPARIX=$O(^FBAA(FBFPROOT,0))_"," I 'FBFPARIX Q 0  ; FBFPARIX EG: "1234,"
 Q 1
 ;
EN ; OPTION "FB FPPS MONITOR" entry point
 N FBFSTAT
 S ZTSK=+$G(ZTSK)
 I 'ZTSK D FOREGRND Q
 ; background process
 S FBFSTAT=$$FACTIVE(.FBFSTAT)
 I FBFSTAT("STATE")'="STALLED 2+ HOURS",FBFSTAT("STATE")'="STALLED 50+ HOURS" Q
 D REPORTIT(.FBFSTAT) K ^XTMP("FBFHLX")
 Q
 ;
FOREGRND ;
 N FBFSTAT
 S FBFSTAT=$$FACTIVE(.FBFSTAT)
 I FBFSTAT("STATE")="INACTIVE" D INFORM(2,FBFSTAT("START"),FBFSTAT("END"),FBFSTAT("STATE"),,,,,,FBFSTAT) Q
 I FBFSTAT("STATE")="ACTIVE" D INFORM(3,FBFSTAT("START"),FBFSTAT("END"),FBFSTAT("STATE"),FBFSTAT("UPDATE"),FBFSTAT("IEN"),,,,FBFSTAT) Q
 I FBFSTAT("STATE")="STALLED 50+ HOURS" D INFORM(4,FBFSTAT("START"),FBFSTAT("END"),FBFSTAT("STATE"),,,,,,FBFSTAT) Q
 I FBFSTAT("STATE")="STALLED 2+ HOURS" D INFORM(3,FBFSTAT("START"),FBFSTAT("END"),FBFSTAT("STATE"),FBFSTAT("UPDATE"),FBFSTAT("IEN"),,,,FBFSTAT) Q
 D INFORM(,FBFSTAT("START"),FBFSTAT("END"),FBFSTAT("STATE"),FBFSTAT("UPDATE"),FBFSTAT("IEN"),,,,FBFSTAT)
 Q
 ;
FACTIVE(FBFRET) ; Return active/inactive flag
 N FBFDIFF,FBFXDA
 S FBFRET="0^INACTIVE",FBFRET("STATE")="INACTIVE",(FBFRET("START"),FBFRET("UPDATE"),FBFRET("END"),FBFRET("IEN"))=""
 I '$$INIT Q
 D GETS^DIQ(FBFPROOT,FBFPARIX,FBFSTFLD_";"_FBFENFLD,"I","FBFXDA")
 S FBFRET("START")=FBFXDA(FBFPROOT,FBFPARIX,FBFSTFLD,"I"),FBFRET("END")=FBFXDA(FBFPROOT,FBFPARIX,FBFENFLD,"I")
 ; S^XTMP("FBFHLX","IEN")=$H_U_IEN_"^XMIT^"
 S FBFRET("UPDATE")=$G(^XTMP("FBFHLX","IEN")),FBFRET("IEN")=$P(FBFRET("UPDATE"),U,2),FBFRET("UPDATE")=$P(FBFRET("UPDATE"),U)
 I FBFRET("UPDATE") S FBFRET("UPDATE")=$$HTFM^XLFDT(FBFRET("UPDATE"))
 I $$FMDIFF^XLFDT($$NOW^XLFDT,+FBFRET("START"),2)>180000 S FBFRET("STATE")="STALLED 50+ HOURS",FBFRET="0^STALLED 50+ HOURS"  Q FBFRET  ; 50 hours okay to start
 ;
 I FBFRET("END")'<FBFRET("START") Q FBFRET
 I 'FBFRET("UPDATE"),FBFRET("END")'<FBFRET("START") Q FBFRET  ; no active FB FPPS TRANSMIT
 ;
 I FBFRET("UPDATE"),$$FMDIFF^XLFDT($$NOW^XLFDT,+FBFRET("UPDATE"),2)\3600 S FBFRET("STATE")="STALLED 2+ HOURS",FBFRET="1^STALLED"  Q FBFRET
 S FBFRET="1^ACTIVE",FBFRET("STATE")="ACTIVE"
 Q FBFRET
 ;
REPORTIT(FBFARG1) ;
 ;  ;FBFARG1 
 N XMSUB,XMDUZ,XMY,MTEXT,XMTEXT,FBMG,FBMG1
 S FBFARG1="FEE5010",FBFARG1("START")=$G(FBFARG1("START")),FBFARG1("END")=$G(FBFARG1("END"))
 S FBFARG1("UPDATE")=$G(FBFARG1("UPDATE")),FBFARG1("IEN")=$G(FBFARG1("IEN")),FBFARG1("STATE")=$G(FBFARG1("STATE"))
 K ^TMP($J,FBFARG1)
 S ^TMP($J,FBFARG1,1)="            ** FB FPPS MONITOR **"
 S ^TMP($J,FBFARG1,2)=""
 S ^TMP($J,FBFARG1,3)="      Current date: "_$$FMTE^XLFDT($$NOW^XLFDT)
 S ^TMP($J,FBFARG1,4)=""
 S ^TMP($J,FBFARG1,5)="  The FB FPPS TRANSMIT option has not run."
 S ^TMP($J,FBFARG1,6)="  Last started:          "_$$FMTE^XLFDT(FBFARG1("START"))
 S ^TMP($J,FBFARG1,7)="  Last completed:        "_$$FMTE^XLFDT(FBFARG1("END"))
 S ^TMP($J,FBFARG1,8)="  Last update:           "_$$FMTE^XLFDT(FBFARG1("UPDATE"))
 S ^TMP($J,FBFARG1,9)="  Last record processed: "_FBFARG1("IEN")
 S ^TMP($J,FBFARG1,10)="  The current status is: "_FBFARG1("STATE")
 S ^TMP($J,FBFARG1,11)=""
 S ^TMP($J,FBFARG1,12)="  Please check the FB FPPS TRANSMIT option for scheduling issues or errors."
 ;
 S XMSUB="FEE BASIS FPPS Transmit Issue"
 S XMDUZ=.5
 S XMY("G.FEE")=""
 S XMTEXT="^TMP($J,"""_FBFARG1_""","
 D ^XMD
 K ^TMP($J,FBFARG1)
 ;
 S ^TMP($J,FBFARG1,1)="Site: "_$TR($P($$SITE^VASITE,U,1,2),U," ")
 S ^TMP($J,FBFARG1,2)=""
 S ^TMP($J,FBFARG1,3)="Current date: "_$$FMTE^XLFDT($$NOW^XLFDT)
 S ^TMP($J,FBFARG1,4)="The FB FPPS TRANSMIT option has not run."
 S ^TMP($J,FBFARG1,5)="The last completed transmission was on "_$$FMTE^XLFDT(FBFARG1("END"))
 S ^TMP($J,FBFARG1,6)=""
 S ^TMP($J,FBFARG1,7)="Local site recipients of this message are:"
 D FIND^DIC(3.8,,"@;.01","BOX","FEE",1,"B",,,"FBMG")
 I $G(FBMG("DILIST","2",1)) D GETS^DIQ(3.8,FBMG("DILIST","2",1),"2*","IN","FBMG1") S XMDUZ=0 F  S XMDUZ=$O(FBMG1("3.81",XMDUZ)) Q:XMDUZ=""  D
 . S XMSUB=$$GET1^DIQ(200,+FBMG1("3.81",XMDUZ,".01","I"),.01)
 . I XMSUB]"" S ^TMP($J,FBFARG1,"7."_+FBMG1("3.81",XMDUZ,".01","I"))=XMSUB
 S ^TMP($J,FBFARG1,8)=""
 S ^TMP($J,FBFARG1,9)=""
 S ^TMP($J,FBFARG1,10)="Please contact the local site for scheduling issues or errors with this option."
 ;
 S XMSUB="FPPS Transmit Issue "_$P($$SITE^VASITE,U,2)
 S XMDUZ=.5
 S XMY("Fee.EDI_Issues@domain.ext")=""
 S XMTEXT="^TMP($J,"""_FBFARG1_""","
 D ^XMD
 Q
 ;
 ;  FBFARG1 .eqs. message to display FBFARG2...FBFARGn .eqs. arguments for particular display
INFORM(FBFARG1,FBFARG2,FBFARG3,FBFARG4,FBFARG5,FBFARG6,FBFARG7,FBFARG8,FBFARG9,FBFARG10) ;
 N DIR,DIRUT,X,Y
 S FBFARG1=$G(FBFARG1),FBFARG2=$G(FBFARG2),FBFARG3=$G(FBFARG3),FBFARG4=$G(FBFARG4),FBFARG5=$G(FBFARG5)
 S FBFARG6=$G(FBFARG6),FBFARG7=$G(FBFARG7),FBFARG8=$G(FBFARG8),FBFARG9=$G(FBFARG9),FBFARG10=$G(FBFARG10)
 S DIR("A")="Press return to continue"
 S DIR(0)="FO"
 S DIR("A",.1)=""
 S DIR("A",.11)="          -------------------------------------------------"
 S DIR("A",.12)=""
 S DIR("A",.2)="                    ** FB FPPS MONITOR **"
 S DIR("A",.3)=""
 S DIR("A",.4)="           The current time is: "_$$FMTE^XLFDT($$NOW^XLFDT)
 S DIR("A",.5)=""
 S DIR("A",.6)=""
 S DIR("A",.7)=" 'FB FPPS TRANSMIT' started: "_$$FMTE^XLFDT(FBFARG2)
 S DIR("A",.8)=" 'FB FPPS TRANSMIT' ended: "_$$FMTE^XLFDT(FBFARG3)
 S DIR("A",.9)=""
 S DIR("A",1)=" The current status is: "_$S(FBFARG4="INACTIVE":"COMPLETED SUCCESSFULLY, NOT CURRENTLY RUNNING",FBFARG4="ACTIVE":"RUNNING",1:FBFARG4)
 S DIR("A",2)=""
 D ^DIR K DIR
 Q
 ;
SETH(X) ; Fileman date input, returns $H value
 N %H
 D H^XLFDT
 Q %H