VAQCON8 ;ALB/JRP - MESSAGE CONSTRUCTION;2-SEP-93
;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
DISPLAY(TRANPTR,SEGABB,DSPARR,STARTOFF,DSPSIZE,MESSNUM,ARRAY,OFFSET) ;CONSTRUCT DISPLAY BLOCK
;INPUT : TRANPTR - Pointer to VAQ - TRANSACTION file
; SEGABB - Segment abbreviation for segment
; DSPARR - Location of displayable Extraction Array
; (full global reference)
; STARTOFF - Where information in DSPARR begins (defaults to 0)
; DSPSIZE - Number of lines in DSPARR to move (defaults to all)
; MESSNUM - Message number to place block into
; (if 0, block will be placed in ARRAY)
; ARRAY - Array to store block in (full global reference)
; OFFSET - Where to begin placing information (defaults to 0)
;OUTPUT : N - Number of lines in block
; -1^Error_Text - Error
;NOTES : If MESSNUM=0, then the block will be placed into
; ARRAY(LineNumber)=Line_of_info
; If MESSNUM>0 then the block will be placed into
; ^XMB(3.9,MESSNUM,2,LineNumber,0)=Line_of_info
;
;CHECK INPUT
S TRANPTR=+$G(TRANPTR)
Q:(('TRANPTR)!('$D(^VAT(394.61,TRANPTR)))) "-1^Did not pass a valid pointer to VAQ - TRANSACTION file"
Q:($G(SEGABB)="") "-1^Did not pass segment abbreviation"
Q:($G(DSPARR)="") "-1^Did not pass location of Extraction Array"
S STARTOFF=+$G(STARTOFF)
S DSPSIZE=$G(DSPSIZE)
S MESSNUM=+$G(MESSNUM)
I (('MESSNUM)&($G(ARRAY)="")) Q "-1^Did not pass message number of reference to array"
I (MESSNUM) Q:('$D(^XMB(3.9,MESSNUM))) "-1^Valid message number not passed"
S OFFSET=+$G(OFFSET)
;DECLARE VARIABLES
N TMP,LINE,STOP,NCRYPTON,START,X
S LINE=OFFSET
;DETERMINE IF ENCRYPTION WAS TURNED ON
S NCRYPTON=$$TRANENC^VAQUTL3(TRANPTR,0)
;DETERMINE NUMBER OF LINES IN DISPLAY (IF NOT PASSED)
I (DSPSIZE="") D
.S DSPSIZE=0
.S START=STARTOFF-.999999999
.F S START=$O(@DSPARR@("DISPLAY",START)) Q:(START="") S DSPSIZE=DSPSIZE+1
;LINE 1
S TMP="$DISPLAY"
S:('MESSNUM) @ARRAY@(LINE)=TMP
S:(MESSNUM) X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
S LINE=LINE+1
;LINE 2
S TMP=SEGABB
S:('MESSNUM) @ARRAY@(LINE)=TMP
S:(MESSNUM) X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
S LINE=LINE+1
;LINE 3
S TMP=NCRYPTON_"^"_DSPSIZE
S:('MESSNUM) @ARRAY@(LINE)=TMP
S:(MESSNUM) X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
S LINE=LINE+1
;LINES IN SEGMENT
S STOP=0
I (DSPSIZE) D
.S START=STARTOFF-.999999999
.F S START=$O(@DSPARR@("DISPLAY",START)) Q:((START="")!(STOP>(DSPSIZE-1))) D
..S TMP=$G(@DSPARR@("DISPLAY",START,0))
..S:('MESSNUM) @ARRAY@(LINE)=TMP
..S:(MESSNUM) X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
..S LINE=LINE+1
..S STOP=STOP+1
;ADJUST DISPLAY SIZE IN LINE 3 (IF NEEDED)
I (STOP<DSPSIZE) D
.S TMP=NCRYPTON_"^"_STOP
.S:('MESSNUM) @ARRAY@(OFFSET+2)=TMP
.S:(MESSNUM) X=$$ADDLINE^VAQCON1(TMP,MESSNUM,(OFFSET+2))
;LINE Z
S TMP="$$DISPLAY"
S:('MESSNUM) @ARRAY@(LINE)=TMP
S:(MESSNUM) X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
S LINE=LINE+1
Q (LINE-OFFSET)
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVAQCON8 3067 printed Nov 22, 2024@17:34:53 Page 2
VAQCON8 ;ALB/JRP - MESSAGE CONSTRUCTION;2-SEP-93
+1 ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
DISPLAY(TRANPTR,SEGABB,DSPARR,STARTOFF,DSPSIZE,MESSNUM,ARRAY,OFFSET) ;CONSTRUCT DISPLAY BLOCK
+1 ;INPUT : TRANPTR - Pointer to VAQ - TRANSACTION file
+2 ; SEGABB - Segment abbreviation for segment
+3 ; DSPARR - Location of displayable Extraction Array
+4 ; (full global reference)
+5 ; STARTOFF - Where information in DSPARR begins (defaults to 0)
+6 ; DSPSIZE - Number of lines in DSPARR to move (defaults to all)
+7 ; MESSNUM - Message number to place block into
+8 ; (if 0, block will be placed in ARRAY)
+9 ; ARRAY - Array to store block in (full global reference)
+10 ; OFFSET - Where to begin placing information (defaults to 0)
+11 ;OUTPUT : N - Number of lines in block
+12 ; -1^Error_Text - Error
+13 ;NOTES : If MESSNUM=0, then the block will be placed into
+14 ; ARRAY(LineNumber)=Line_of_info
+15 ; If MESSNUM>0 then the block will be placed into
+16 ; ^XMB(3.9,MESSNUM,2,LineNumber,0)=Line_of_info
+17 ;
+18 ;CHECK INPUT
+19 SET TRANPTR=+$GET(TRANPTR)
+20 if (('TRANPTR)!('$DATA(^VAT(394.61,TRANPTR))))
QUIT "-1^Did not pass a valid pointer to VAQ - TRANSACTION file"
+21 if ($GET(SEGABB)="")
QUIT "-1^Did not pass segment abbreviation"
+22 if ($GET(DSPARR)="")
QUIT "-1^Did not pass location of Extraction Array"
+23 SET STARTOFF=+$GET(STARTOFF)
+24 SET DSPSIZE=$GET(DSPSIZE)
+25 SET MESSNUM=+$GET(MESSNUM)
+26 IF (('MESSNUM)&($GET(ARRAY)=""))
QUIT "-1^Did not pass message number of reference to array"
+27 IF (MESSNUM)
if ('$DATA(^XMB(3.9,MESSNUM)))
QUIT "-1^Valid message number not passed"
+28 SET OFFSET=+$GET(OFFSET)
+29 ;DECLARE VARIABLES
+30 NEW TMP,LINE,STOP,NCRYPTON,START,X
+31 SET LINE=OFFSET
+32 ;DETERMINE IF ENCRYPTION WAS TURNED ON
+33 SET NCRYPTON=$$TRANENC^VAQUTL3(TRANPTR,0)
+34 ;DETERMINE NUMBER OF LINES IN DISPLAY (IF NOT PASSED)
+35 IF (DSPSIZE="")
Begin DoDot:1
+36 SET DSPSIZE=0
+37 SET START=STARTOFF-.999999999
+38 FOR
SET START=$ORDER(@DSPARR@("DISPLAY",START))
if (START="")
QUIT
SET DSPSIZE=DSPSIZE+1
End DoDot:1
+39 ;LINE 1
+40 SET TMP="$DISPLAY"
+41 if ('MESSNUM)
SET @ARRAY@(LINE)=TMP
+42 if (MESSNUM)
SET X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
+43 SET LINE=LINE+1
+44 ;LINE 2
+45 SET TMP=SEGABB
+46 if ('MESSNUM)
SET @ARRAY@(LINE)=TMP
+47 if (MESSNUM)
SET X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
+48 SET LINE=LINE+1
+49 ;LINE 3
+50 SET TMP=NCRYPTON_"^"_DSPSIZE
+51 if ('MESSNUM)
SET @ARRAY@(LINE)=TMP
+52 if (MESSNUM)
SET X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
+53 SET LINE=LINE+1
+54 ;LINES IN SEGMENT
+55 SET STOP=0
+56 IF (DSPSIZE)
Begin DoDot:1
+57 SET START=STARTOFF-.999999999
+58 FOR
SET START=$ORDER(@DSPARR@("DISPLAY",START))
if ((START="")!(STOP>(DSPSIZE-1)))
QUIT
Begin DoDot:2
+59 SET TMP=$GET(@DSPARR@("DISPLAY",START,0))
+60 if ('MESSNUM)
SET @ARRAY@(LINE)=TMP
+61 if (MESSNUM)
SET X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
+62 SET LINE=LINE+1
+63 SET STOP=STOP+1
End DoDot:2
End DoDot:1
+64 ;ADJUST DISPLAY SIZE IN LINE 3 (IF NEEDED)
+65 IF (STOP<DSPSIZE)
Begin DoDot:1
+66 SET TMP=NCRYPTON_"^"_STOP
+67 if ('MESSNUM)
SET @ARRAY@(OFFSET+2)=TMP
+68 if (MESSNUM)
SET X=$$ADDLINE^VAQCON1(TMP,MESSNUM,(OFFSET+2))
End DoDot:1
+69 ;LINE Z
+70 SET TMP="$$DISPLAY"
+71 if ('MESSNUM)
SET @ARRAY@(LINE)=TMP
+72 if (MESSNUM)
SET X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
+73 SET LINE=LINE+1
+74 QUIT (LINE-OFFSET)