BKMIMRP1 ;PRXM/HC/BWF - BKMV UTILITY PROGRAM; [ 1/19/2005 7:16 PM ]
;;2.2;HIV MANAGEMENT SYSTEM;;Apr 01, 2015;Build 40
Q
;
AGE(DFN) ;EP - PATIENT AGE
; Extrinsic Age function
; Input = DFN - IEN of patient
N DOB,DATE,AGE,TDATE
S DOB=$$GET1^DIQ(2,DFN_",",.03,"I","","")
;PRXM/HC/DLS 9/21/2005 Added TDATE variable for configuring age
; based on today (if still living) or DOD (Date of Death), if applicable.
S TDATE=$$GET1^DIQ(2,DFN,".351","I")
I 'TDATE S TDATE=DT
S DATE=$E(TDATE,1,3)
S AGE=DATE-$E(DOB,1,3)
S:$E(TDATE,4,7)<$E(DOB,4,7) AGE=AGE-1
I AGE<3 D
.S DAYS=$$FMDIFF^XLFDT(TDATE,DOB,1)
.I DAYS<7 S AGE=DAYS_"d" Q
.I DAYS<30 S AGE=DAYS\7_"w" Q
.S AGE=DAYS\30_"m"
Q AGE
;
HDR(HEADER,PAGE) ; EP - Print page number and center data.
; Input - HEADER: Header text (required)
;- PAGE (optional)
; This will print a page number on the header line.
; This utility will look at the screen width chosen by the user, and
; center the data on the screen.
; Note: you must first call ^%ZIS to get the parameters.
I '$D(PAGE) S PAGE=""
S LEN=$L(HEADER)
S CENTER=LEN/2,CLINE=IOM/2
S START=$P(CLINE-CENTER,".",1)
I (PAGE'="") W ?START,HEADER,?68,"Page: ",PAGE,! Q
I PAGE="" W ?START,HEADER,!
Q
;
HDR3 ; EP - Print a dashed line.
; This utility will write a screen-width wide line of dashes (stored in IOM).
; Note: you must first call ^%ZIS to get the parameters.
W ?1 F I=1:1:(IOM-2) W "-"
W !?1
Q
BKMIMRP1 ;PRXM/HC/BWF - BKMV UTILITY PROGRAM; [ 1/19/2005 7:16 PM ]
+1 ;;2.2;HIV MANAGEMENT SYSTEM;;Apr 01, 2015;Build 40
+2 QUIT
+3 ;
AGE(DFN) ;EP - PATIENT AGE
+1 ; Extrinsic Age function
+2 ; Input = DFN - IEN of patient
+3 NEW DOB,DATE,AGE,TDATE
+4 SET DOB=$$GET1^DIQ(2,DFN_",",.03,"I","","")
+5 ;PRXM/HC/DLS 9/21/2005 Added TDATE variable for configuring age
+6 ; based on today (if still living) or DOD (Date of Death), if applicable.
+7 SET TDATE=$$GET1^DIQ(2,DFN,".351","I")
+8 IF 'TDATE
SET TDATE=DT
+9 SET DATE=$EXTRACT(TDATE,1,3)
+10 SET AGE=DATE-$EXTRACT(DOB,1,3)
+11 IF $EXTRACT(TDATE,4,7)<$EXTRACT(DOB,4,7)
SET AGE=AGE-1
+12 IF AGE<3
Begin DoDot:1
+13 SET DAYS=$$FMDIFF^XLFDT(TDATE,DOB,1)
+14 IF DAYS<7
SET AGE=DAYS_"d"
QUIT
+15 IF DAYS<30
SET AGE=DAYS\7_"w"
QUIT
+16 SET AGE=DAYS\30_"m"
End DoDot:1
+17 QUIT AGE
+18 ;
HDR(HEADER,PAGE) ; EP - Print page number and center data.
+1 ; Input - HEADER: Header text (required)
+2 ;- PAGE (optional)
+3 ; This will print a page number on the header line.
+4 ; This utility will look at the screen width chosen by the user, and
+5 ; center the data on the screen.
+6 ; Note: you must first call ^%ZIS to get the parameters.
+7 IF '$DATA(PAGE)
SET PAGE=""
+8 SET LEN=$LENGTH(HEADER)
+9 SET CENTER=LEN/2
SET CLINE=IOM/2
+10 SET START=$PIECE(CLINE-CENTER,".",1)
+11 IF (PAGE'="")
WRITE ?START,HEADER,?68,"Page: ",PAGE,!
QUIT
+12 IF PAGE=""
WRITE ?START,HEADER,!
+13 QUIT
+14 ;
HDR3 ; EP - Print a dashed line.
+1 ; This utility will write a screen-width wide line of dashes (stored in IOM).
+2 ; Note: you must first call ^%ZIS to get the parameters.
+3 WRITE ?1
FOR I=1:1:(IOM-2)
WRITE "-"
+4 WRITE !?1
+5 QUIT