DG53372M ;ALB/PDJ DG*5.3*372 Elig Code Cleanup Mailman Msg ; 03/30/01
;;5.3;Registration;**372,1015**;Aug 13, 1993;Build 21
;
; A mail message will be sent to the user when the edit process
; is complete.
;
;
MAIL ; Send a mailman msg to user with results
N DIFROM,%
N DATA,DATA1,FILE,FLD,IENX,NODE,TEXT,I,X,XMDUZ,XMSUB,XMTEXT,XMY,Y,STA,IEN
N XTERR,XTPAT,XTENC,NAME
N ELIGCD,SIEN,PIEN
S XTERR="DG*5.3*372-SRCERR"
S XTPAT="DG*5.3*372-PATREC"
S XTENC="DG*5.3*372-ENCREC"
K ^TMP("DG53372",$J)
S XMSUB="ELIGIBILITY CODE Cleanup"
S XMDUZ="DG Edit Package",XMY(DUZ)="",XMY(.5)=""
S XMTEXT="^TMP(""DG53372"",$J,"
D NOW^%DTC S Y=% D DD^%DT
S ^TMP("DG53372",$J,1)="ELIGIBILITY CODE Cleanup"
S ^TMP("DG53372",$J,2)=" "
S NODE=2
;
; Send no Cleanup needed message and quit
;
I CLNOK D Q
. S NODE=NODE+1
. S ^TMP("DG53372",$J,NODE)=" Your Site uses standard eligibility codes for NSC and"
. S NODE=NODE+1
. S ^TMP("DG53372",$J,NODE)=" SC LESS THAN 50% veterans, therefore no cleanup is needed. "
. S NODE=NODE+1
. S ^TMP("DG53372",$J,NODE)=" "
. S NODE=5
. D MAIL1
;
; Add text related to each Eligibility code
;
F IEN=3,5 D
. S NODE=NODE+1
. S ^TMP("DG53372",$J,NODE)=" "
. ;
. ; Standard code message
. ;
. I NSTD(IEN)=0 D Q
. . S NODE=NODE+1
. . S ^TMP("DG53372",$J,NODE)=" Your site uses the standard Eligibility Code "_IEN_" for "_$S(IEN=3:"SC LESS THAN 50%.",1:"NSC.")
. . S NODE=NODE+1
. . S ^TMP("DG53372",$J,NODE)=" No report or cleanup is needed related to this code."
. ;
. ; Auto-corrected message
. ;
. I NSTD(IEN)=1 D Q
. . S NODE=NODE+1
. . S ^TMP("DG53372",$J,NODE)=" Your Site is using ELIGIBILITY CODE "_STDCDS(IEN)_" for "_$S(IEN=3:"SC LESS THAN 50%.",1:"NSC.")
. . S NODE=NODE+1
. . S ^TMP("DG53372",$J,NODE)=" Please review the list of records below that have been auto-corrected."
. ;
. ; Manual update message
. ;
. S NODE=NODE+1
. S ^TMP("DG53372",$J,NODE)=" Your Site is currently using ELIGIBILITY CODE "_IEN_" for "_$P(^DIC(8,IEN,0),"^",1)_"."
. S NODE=NODE+1
. S ^TMP("DG53372",$J,NODE)=" This is non-standard, as this code should be used for "_$S(IEN=3:"SC LESS THAN 50%.",1:"NSC.")
. S NODE=NODE+1
. S ^TMP("DG53372",$J,NODE)=" Please review the list of records below and update manually as needed."
;
S NODE=NODE+1
S ^TMP("DG53372",$J,NODE)=" "
S NODE=NODE+1
S ^TMP("DG53372",$J,NODE)=$$REPEAT^XLFSTR("=",75)
;
PRTRECS ; Print List of records
S NODE=NODE+1
S ^TMP("DG53372",$J,NODE)=" "
S TEXT=" Total Patient Records: "
S TEXT=$$BLDSTR($J(+$G(^XTMP(XTPAT,1)),8,0),TEXT,30,8)
S NODE=NODE+1
S ^TMP("DG53372",$J,NODE)=TEXT
S TEXT=" Total Secondary Elig: "
S TEXT=$$BLDSTR($J(+$G(^XTMP(XTPAT,1,1)),8,0),TEXT,30,8)
S NODE=NODE+1
S ^TMP("DG53372",$J,NODE)=TEXT
S NODE=NODE+1
S ^TMP("DG53372",$J,NODE)=" "
;
S TEXT=" "
S TEXT=$$BLDSTR("Elig",TEXT,7,4)
S TEXT=$$BLDSTR("Pat IEN",TEXT,12,7)
S TEXT=$$BLDSTR("SIEN",TEXT,23,4)
S TEXT=$$BLDSTR("Name",TEXT,28,4)
S TEXT=$$BLDSTR("SubEligCD",TEXT,50,9)
S NODE=NODE+1
S ^TMP("DG53372",$J,NODE)=TEXT
S (ELIGCD,PIEN,SIEN)=""
F S ELIGCD=$O(^XTMP(XTPAT,ELIGCD)) Q:ELIGCD="" D
. F S PIEN=$O(^XTMP(XTPAT,ELIGCD,PIEN)) Q:PIEN="" D
. . F S SIEN=$O(^XTMP(XTPAT,ELIGCD,PIEN,SIEN)) Q:SIEN="" D
. . . D BLDPAT
S NODE=NODE+1
S ^TMP("DG53372",$J,NODE)=$$REPEAT^XLFSTR("=",75)
;
PRTENC ; Print Encounter Records
S NODE=NODE+1
S ^TMP("DG53372",$J,NODE)=" "
S TEXT=" Total Patient Encounter Records: "
S TEXT=$$BLDSTR($J(+$G(^XTMP(XTENC,1)),8,0),TEXT,40,8)
S NODE=NODE+1
S ^TMP("DG53372",$J,NODE)=TEXT
S NODE=NODE+1
S ^TMP("DG53372",$J,NODE)=" "
;
S TEXT=" "
S TEXT=$$BLDSTR("Elig",TEXT,1,4)
S TEXT=$$BLDSTR("Pat IEN",TEXT,6,7)
S TEXT=$$BLDSTR("SIEN",TEXT,15,4)
S TEXT=$$BLDSTR("Name",TEXT,28,4)
S TEXT=$$BLDSTR("Enc DT",TEXT,54,6)
S NODE=NODE+1
S ^TMP("DG53372",$J,NODE)=TEXT
S (ELIGCD,PIEN,SIEN)=""
F S ELIGCD=$O(^XTMP(XTENC,ELIGCD)) Q:ELIGCD="" D
. F S PIEN=$O(^XTMP(XTENC,ELIGCD,PIEN)) Q:PIEN="" D
. . F S SIEN=$O(^XTMP(XTENC,ELIGCD,PIEN,SIEN)) Q:SIEN="" D
. . . D BLDENC
S NODE=NODE+1
S ^TMP("DG53372",$J,NODE)=$$REPEAT^XLFSTR("=",75)
;
FILERRS ; Print Filing errors
;
S NODE=NODE+1
S ^TMP("DG53372",$J,NODE)=" "
S TEXT=" Total Filing Errors: "
S TEXT=$$BLDSTR($J(+$G(^XTMP(XTERR,1)),8,0),TEXT,30,8)
S NODE=NODE+1
S ^TMP("DG53372",$J,NODE)=TEXT
S NODE=NODE+1
S ^TMP("DG53372",$J,NODE)=" "
;
I +$G(^XTMP(XTERR,1)) D
. S TEXT="File #"
. S TEXT=$$BLDSTR("Elig",TEXT,8,4)
. S TEXT=$$BLDSTR("PatIEN",TEXT,13,6)
. S TEXT=$$BLDSTR("SIEN",TEXT,23,4)
. S TEXT=$$BLDSTR("Name",TEXT,30,4)
. S TEXT=$$BLDSTR("Dt/EligCD",TEXT,50,9)
. S TEXT=$$BLDSTR("Error Message",TEXT,71,13)
. S NODE=NODE+1
. S ^TMP("DG53372",$J,NODE)=TEXT
;
S (FILE,ELIGCD,PIEN,SIEN)=""
F S FILE=$O(^XTMP(XTERR,FILE)) Q:FILE="" D
. F S ELIGCD=$O(^XTMP(XTERR,FILE,ELIGCD)) Q:ELIGCD="" D
. . F S PIEN=$O(^XTMP(XTERR,FILE,ELIGCD,PIEN)) Q:PIEN="" D
. . . F S SIEN=$O(^XTMP(XTERR,FILE,ELIGCD,PIEN,SIEN)) Q:SIEN="" D
. . . . D BLDERR
;
MAIL1 ; Send message
S NODE=NODE+1
S ^TMP("DG53372",$J,NODE)=" "
S NODE=NODE+1
S ^TMP("DG53372",$J,NODE)=" ******** END OF MESSAGE ********"
;
D ^XMD
K ^TMP("DG53372",$J)
Q
;
BLDERR ; Format error line for printing
N DATA,NAME,DTECD,ERRTXT
S DATA=^XTMP(XTERR,FILE,ELIGCD,PIEN,SIEN)
S NAME=$P(DATA,"^",1),DTECD=$P(DATA,"^",2),ERRTXT=$P(DATA,"^",3)
S TEXT=FILE
S TEXT=$$BLDSTR(ELIGCD,TEXT,10,$L(ELIGCD))
S TEXT=$$BLDSTR(PIEN,TEXT,12,$L(PIEN))
I SIEN S TEXT=$$BLDSTR(SIEN,TEXT,24,$L(SIEN))
S TEXT=$$BLDSTR($E(NAME,1,20),TEXT,30,20)
I $L(DTECD)>5 S Y=DTECD D DD^%DT S DTECD=Y
S TEXT=$$BLDSTR(DTECD,TEXT,50,$L(DTECD))
S TEXT=$$BLDSTR(ERRTXT,TEXT,71,20)
S NODE=NODE+1
S ^TMP("DG53372",$J,NODE)=TEXT
Q
;
BLDPAT ; Format Patient line for printing
N DATA,NAME,DTECD,ERRTXT,SELIGCD
S DATA=^XTMP(XTPAT,ELIGCD,PIEN,SIEN)
S NAME=$P(DATA,"^",1),SELIGCD=$P(DATA,"^",2)
S TEXT=" "
S TEXT=$$BLDSTR(ELIGCD,TEXT,9,$L(ELIGCD))
S TEXT=$$BLDSTR(PIEN,TEXT,12,$L(PIEN))
I SIEN S TEXT=$$BLDSTR(SIEN,TEXT,24,$L(SIEN))
S TEXT=$$BLDSTR($E(NAME,1,20),TEXT,28,20)
S TEXT=$$BLDSTR(SELIGCD,TEXT,54,$L(SELIGCD))
S NODE=NODE+1
S ^TMP("DG53372",$J,NODE)=TEXT
Q
;
BLDENC ; Format Patient Encounter line for printing
N DATA,NAME,ENCDT,ERRTXT,Y
S DATA=^XTMP(XTENC,ELIGCD,PIEN,SIEN)
S NAME=$P(DATA,"^",1),ENCDT=$P(DATA,"^",2)
S TEXT=" "
S TEXT=$$BLDSTR(ELIGCD,TEXT,2,$L(ELIGCD))
S TEXT=$$BLDSTR(PIEN,TEXT,6,$L(PIEN))
I SIEN S TEXT=$$BLDSTR(SIEN,TEXT,15,$L(SIEN))
S TEXT=$$BLDSTR($E(NAME,1,20),TEXT,28,20)
S Y=ENCDT D DD^%DT
S TEXT=$$BLDSTR(Y,TEXT,54,$L(Y))
S NODE=NODE+1
S ^TMP("DG53372",$J,NODE)=TEXT
Q
;
BLDSTR(NSTR,STR,COL,NSL) ; build a string
; Input:
; NSTR = a string to be added to STR
; STR = an existing string to which NSTR will be added
; COL = column location at which NSTR will be added to STR
; NSL = length of new string
; Output:
; returns STR with NSTR appended at the specified COL
;
Q $E(STR_$J("",COL-1),1,COL-1)_$E(NSTR_$J("",NSL),1,NSL)_$E(STR,COL+NSL,999)
DG53372M ;ALB/PDJ DG*5.3*372 Elig Code Cleanup Mailman Msg ; 03/30/01
+1 ;;5.3;Registration;**372,1015**;Aug 13, 1993;Build 21
+2 ;
+3 ; A mail message will be sent to the user when the edit process
+4 ; is complete.
+5 ;
+6 ;
MAIL ; Send a mailman msg to user with results
+1 NEW DIFROM,%
+2 NEW DATA,DATA1,FILE,FLD,IENX,NODE,TEXT,I,X,XMDUZ,XMSUB,XMTEXT,XMY,Y,STA,IEN
+3 NEW XTERR,XTPAT,XTENC,NAME
+4 NEW ELIGCD,SIEN,PIEN
+5 SET XTERR="DG*5.3*372-SRCERR"
+6 SET XTPAT="DG*5.3*372-PATREC"
+7 SET XTENC="DG*5.3*372-ENCREC"
+8 KILL ^TMP("DG53372",$JOB)
+9 SET XMSUB="ELIGIBILITY CODE Cleanup"
+10 SET XMDUZ="DG Edit Package"
SET XMY(DUZ)=""
SET XMY(.5)=""
+11 SET XMTEXT="^TMP(""DG53372"",$J,"
+12 DO NOW^%DTC
SET Y=%
DO DD^%DT
+13 SET ^TMP("DG53372",$JOB,1)="ELIGIBILITY CODE Cleanup"
+14 SET ^TMP("DG53372",$JOB,2)=" "
+15 SET NODE=2
+16 ;
+17 ; Send no Cleanup needed message and quit
+18 ;
+19 IF CLNOK
Begin DoDot:1
+20 SET NODE=NODE+1
+21 SET ^TMP("DG53372",$JOB,NODE)=" Your Site uses standard eligibility codes for NSC and"
+22 SET NODE=NODE+1
+23 SET ^TMP("DG53372",$JOB,NODE)=" SC LESS THAN 50% veterans, therefore no cleanup is needed. "
+24 SET NODE=NODE+1
+25 SET ^TMP("DG53372",$JOB,NODE)=" "
+26 SET NODE=5
+27 DO MAIL1
End DoDot:1
QUIT
+28 ;
+29 ; Add text related to each Eligibility code
+30 ;
+31 FOR IEN=3,5
Begin DoDot:1
+32 SET NODE=NODE+1
+33 SET ^TMP("DG53372",$JOB,NODE)=" "
+34 ;
+35 ; Standard code message
+36 ;
+37 IF NSTD(IEN)=0
Begin DoDot:2
+38 SET NODE=NODE+1
+39 SET ^TMP("DG53372",$JOB,NODE)=" Your site uses the standard Eligibility Code "_IEN_" for "_$SELECT(IEN=3:"SC LESS THAN 50%.",1:"NSC.")
+40 SET NODE=NODE+1
+41 SET ^TMP("DG53372",$JOB,NODE)=" No report or cleanup is needed related to this code."
End DoDot:2
QUIT
+42 ;
+43 ; Auto-corrected message
+44 ;
+45 IF NSTD(IEN)=1
Begin DoDot:2
+46 SET NODE=NODE+1
+47 SET ^TMP("DG53372",$JOB,NODE)=" Your Site is using ELIGIBILITY CODE "_STDCDS(IEN)_" for "_$SELECT(IEN=3:"SC LESS THAN 50%.",1:"NSC.")
+48 SET NODE=NODE+1
+49 SET ^TMP("DG53372",$JOB,NODE)=" Please review the list of records below that have been auto-corrected."
End DoDot:2
QUIT
+50 ;
+51 ; Manual update message
+52 ;
+53 SET NODE=NODE+1
+54 SET ^TMP("DG53372",$JOB,NODE)=" Your Site is currently using ELIGIBILITY CODE "_IEN_" for "_$PIECE(^DIC(8,IEN,0),"^",1)_"."
+55 SET NODE=NODE+1
+56 SET ^TMP("DG53372",$JOB,NODE)=" This is non-standard, as this code should be used for "_$SELECT(IEN=3:"SC LESS THAN 50%.",1:"NSC.")
+57 SET NODE=NODE+1
+58 SET ^TMP("DG53372",$JOB,NODE)=" Please review the list of records below and update manually as needed."
End DoDot:1
+59 ;
+60 SET NODE=NODE+1
+61 SET ^TMP("DG53372",$JOB,NODE)=" "
+62 SET NODE=NODE+1
+63 SET ^TMP("DG53372",$JOB,NODE)=$$REPEAT^XLFSTR("=",75)
+64 ;
PRTRECS ; Print List of records
+1 SET NODE=NODE+1
+2 SET ^TMP("DG53372",$JOB,NODE)=" "
+3 SET TEXT=" Total Patient Records: "
+4 SET TEXT=$$BLDSTR($JUSTIFY(+$GET(^XTMP(XTPAT,1)),8,0),TEXT,30,8)
+5 SET NODE=NODE+1
+6 SET ^TMP("DG53372",$JOB,NODE)=TEXT
+7 SET TEXT=" Total Secondary Elig: "
+8 SET TEXT=$$BLDSTR($JUSTIFY(+$GET(^XTMP(XTPAT,1,1)),8,0),TEXT,30,8)
+9 SET NODE=NODE+1
+10 SET ^TMP("DG53372",$JOB,NODE)=TEXT
+11 SET NODE=NODE+1
+12 SET ^TMP("DG53372",$JOB,NODE)=" "
+13 ;
+14 SET TEXT=" "
+15 SET TEXT=$$BLDSTR("Elig",TEXT,7,4)
+16 SET TEXT=$$BLDSTR("Pat IEN",TEXT,12,7)
+17 SET TEXT=$$BLDSTR("SIEN",TEXT,23,4)
+18 SET TEXT=$$BLDSTR("Name",TEXT,28,4)
+19 SET TEXT=$$BLDSTR("SubEligCD",TEXT,50,9)
+20 SET NODE=NODE+1
+21 SET ^TMP("DG53372",$JOB,NODE)=TEXT
+22 SET (ELIGCD,PIEN,SIEN)=""
+23 FOR
SET ELIGCD=$ORDER(^XTMP(XTPAT,ELIGCD))
IF ELIGCD=""
QUIT
Begin DoDot:1
+24 FOR
SET PIEN=$ORDER(^XTMP(XTPAT,ELIGCD,PIEN))
IF PIEN=""
QUIT
Begin DoDot:2
+25 FOR
SET SIEN=$ORDER(^XTMP(XTPAT,ELIGCD,PIEN,SIEN))
IF SIEN=""
QUIT
Begin DoDot:3
+26 DO BLDPAT
End DoDot:3
End DoDot:2
End DoDot:1
+27 SET NODE=NODE+1
+28 SET ^TMP("DG53372",$JOB,NODE)=$$REPEAT^XLFSTR("=",75)
+29 ;
PRTENC ; Print Encounter Records
+1 SET NODE=NODE+1
+2 SET ^TMP("DG53372",$JOB,NODE)=" "
+3 SET TEXT=" Total Patient Encounter Records: "
+4 SET TEXT=$$BLDSTR($JUSTIFY(+$GET(^XTMP(XTENC,1)),8,0),TEXT,40,8)
+5 SET NODE=NODE+1
+6 SET ^TMP("DG53372",$JOB,NODE)=TEXT
+7 SET NODE=NODE+1
+8 SET ^TMP("DG53372",$JOB,NODE)=" "
+9 ;
+10 SET TEXT=" "
+11 SET TEXT=$$BLDSTR("Elig",TEXT,1,4)
+12 SET TEXT=$$BLDSTR("Pat IEN",TEXT,6,7)
+13 SET TEXT=$$BLDSTR("SIEN",TEXT,15,4)
+14 SET TEXT=$$BLDSTR("Name",TEXT,28,4)
+15 SET TEXT=$$BLDSTR("Enc DT",TEXT,54,6)
+16 SET NODE=NODE+1
+17 SET ^TMP("DG53372",$JOB,NODE)=TEXT
+18 SET (ELIGCD,PIEN,SIEN)=""
+19 FOR
SET ELIGCD=$ORDER(^XTMP(XTENC,ELIGCD))
IF ELIGCD=""
QUIT
Begin DoDot:1
+20 FOR
SET PIEN=$ORDER(^XTMP(XTENC,ELIGCD,PIEN))
IF PIEN=""
QUIT
Begin DoDot:2
+21 FOR
SET SIEN=$ORDER(^XTMP(XTENC,ELIGCD,PIEN,SIEN))
IF SIEN=""
QUIT
Begin DoDot:3
+22 DO BLDENC
End DoDot:3
End DoDot:2
End DoDot:1
+23 SET NODE=NODE+1
+24 SET ^TMP("DG53372",$JOB,NODE)=$$REPEAT^XLFSTR("=",75)
+25 ;
FILERRS ; Print Filing errors
+1 ;
+2 SET NODE=NODE+1
+3 SET ^TMP("DG53372",$JOB,NODE)=" "
+4 SET TEXT=" Total Filing Errors: "
+5 SET TEXT=$$BLDSTR($JUSTIFY(+$GET(^XTMP(XTERR,1)),8,0),TEXT,30,8)
+6 SET NODE=NODE+1
+7 SET ^TMP("DG53372",$JOB,NODE)=TEXT
+8 SET NODE=NODE+1
+9 SET ^TMP("DG53372",$JOB,NODE)=" "
+10 ;
+11 IF +$GET(^XTMP(XTERR,1))
Begin DoDot:1
+12 SET TEXT="File #"
+13 SET TEXT=$$BLDSTR("Elig",TEXT,8,4)
+14 SET TEXT=$$BLDSTR("PatIEN",TEXT,13,6)
+15 SET TEXT=$$BLDSTR("SIEN",TEXT,23,4)
+16 SET TEXT=$$BLDSTR("Name",TEXT,30,4)
+17 SET TEXT=$$BLDSTR("Dt/EligCD",TEXT,50,9)
+18 SET TEXT=$$BLDSTR("Error Message",TEXT,71,13)
+19 SET NODE=NODE+1
+20 SET ^TMP("DG53372",$JOB,NODE)=TEXT
End DoDot:1
+21 ;
+22 SET (FILE,ELIGCD,PIEN,SIEN)=""
+23 FOR
SET FILE=$ORDER(^XTMP(XTERR,FILE))
IF FILE=""
QUIT
Begin DoDot:1
+24 FOR
SET ELIGCD=$ORDER(^XTMP(XTERR,FILE,ELIGCD))
IF ELIGCD=""
QUIT
Begin DoDot:2
+25 FOR
SET PIEN=$ORDER(^XTMP(XTERR,FILE,ELIGCD,PIEN))
IF PIEN=""
QUIT
Begin DoDot:3
+26 FOR
SET SIEN=$ORDER(^XTMP(XTERR,FILE,ELIGCD,PIEN,SIEN))
IF SIEN=""
QUIT
Begin DoDot:4
+27 DO BLDERR
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+28 ;
MAIL1 ; Send message
+1 SET NODE=NODE+1
+2 SET ^TMP("DG53372",$JOB,NODE)=" "
+3 SET NODE=NODE+1
+4 SET ^TMP("DG53372",$JOB,NODE)=" ******** END OF MESSAGE ********"
+5 ;
+6 DO ^XMD
+7 KILL ^TMP("DG53372",$JOB)
+8 QUIT
+9 ;
BLDERR ; Format error line for printing
+1 NEW DATA,NAME,DTECD,ERRTXT
+2 SET DATA=^XTMP(XTERR,FILE,ELIGCD,PIEN,SIEN)
+3 SET NAME=$PIECE(DATA,"^",1)
SET DTECD=$PIECE(DATA,"^",2)
SET ERRTXT=$PIECE(DATA,"^",3)
+4 SET TEXT=FILE
+5 SET TEXT=$$BLDSTR(ELIGCD,TEXT,10,$LENGTH(ELIGCD))
+6 SET TEXT=$$BLDSTR(PIEN,TEXT,12,$LENGTH(PIEN))
+7 IF SIEN
SET TEXT=$$BLDSTR(SIEN,TEXT,24,$LENGTH(SIEN))
+8 SET TEXT=$$BLDSTR($EXTRACT(NAME,1,20),TEXT,30,20)
+9 IF $LENGTH(DTECD)>5
SET Y=DTECD
DO DD^%DT
SET DTECD=Y
+10 SET TEXT=$$BLDSTR(DTECD,TEXT,50,$LENGTH(DTECD))
+11 SET TEXT=$$BLDSTR(ERRTXT,TEXT,71,20)
+12 SET NODE=NODE+1
+13 SET ^TMP("DG53372",$JOB,NODE)=TEXT
+14 QUIT
+15 ;
BLDPAT ; Format Patient line for printing
+1 NEW DATA,NAME,DTECD,ERRTXT,SELIGCD
+2 SET DATA=^XTMP(XTPAT,ELIGCD,PIEN,SIEN)
+3 SET NAME=$PIECE(DATA,"^",1)
SET SELIGCD=$PIECE(DATA,"^",2)
+4 SET TEXT=" "
+5 SET TEXT=$$BLDSTR(ELIGCD,TEXT,9,$LENGTH(ELIGCD))
+6 SET TEXT=$$BLDSTR(PIEN,TEXT,12,$LENGTH(PIEN))
+7 IF SIEN
SET TEXT=$$BLDSTR(SIEN,TEXT,24,$LENGTH(SIEN))
+8 SET TEXT=$$BLDSTR($EXTRACT(NAME,1,20),TEXT,28,20)
+9 SET TEXT=$$BLDSTR(SELIGCD,TEXT,54,$LENGTH(SELIGCD))
+10 SET NODE=NODE+1
+11 SET ^TMP("DG53372",$JOB,NODE)=TEXT
+12 QUIT
+13 ;
BLDENC ; Format Patient Encounter line for printing
+1 NEW DATA,NAME,ENCDT,ERRTXT,Y
+2 SET DATA=^XTMP(XTENC,ELIGCD,PIEN,SIEN)
+3 SET NAME=$PIECE(DATA,"^",1)
SET ENCDT=$PIECE(DATA,"^",2)
+4 SET TEXT=" "
+5 SET TEXT=$$BLDSTR(ELIGCD,TEXT,2,$LENGTH(ELIGCD))
+6 SET TEXT=$$BLDSTR(PIEN,TEXT,6,$LENGTH(PIEN))
+7 IF SIEN
SET TEXT=$$BLDSTR(SIEN,TEXT,15,$LENGTH(SIEN))
+8 SET TEXT=$$BLDSTR($EXTRACT(NAME,1,20),TEXT,28,20)
+9 SET Y=ENCDT
DO DD^%DT
+10 SET TEXT=$$BLDSTR(Y,TEXT,54,$LENGTH(Y))
+11 SET NODE=NODE+1
+12 SET ^TMP("DG53372",$JOB,NODE)=TEXT
+13 QUIT
+14 ;
BLDSTR(NSTR,STR,COL,NSL) ; build a string
+1 ; Input:
+2 ; NSTR = a string to be added to STR
+3 ; STR = an existing string to which NSTR will be added
+4 ; COL = column location at which NSTR will be added to STR
+5 ; NSL = length of new string
+6 ; Output:
+7 ; returns STR with NSTR appended at the specified COL
+8 ;
+9 QUIT $EXTRACT(STR_$JUSTIFY("",COL-1),1,COL-1)_$EXTRACT(NSTR_$JUSTIFY("",NSL),1,NSL)_$EXTRACT(STR,COL+NSL,999)