VAQCON3 ;ALB/JRP - MESSAGE CONSTRUCTION;12-APR-93
;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
USER(TRANPTR,MESSNUM,ARRAY,OFFSET) ;CONSTRUCT USER BLOCK
;INPUT : TRANPTR - Pointer to VAQ - TRANSACTION file
; 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"
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,USER,FACNAME,LINE,X,USERDUZ
S LINE=OFFSET
;DETERMINE SENDER
S TMP=$$SENDER^VAQCON2(TRANPTR)
Q:(+TMP=-1) "-1^Could not determine sender of message"
S USER=$P(TMP,"^",1)
S USERDUZ=$P(TMP,"^",2)
;DETERMINE FACILITY NAME (IF NOT IN PARAMETER FILE TRY GETTING FROM
; 'STATION NUMBER' FILE)
S FACNAME=""
S TMP=+$O(^VAT(394.81,0))
I (TMP) S X=+$G(^VAT(394.81,TMP,0)) S:(X) FACNAME=$P($G(^DIC(4,X,0)),"^",1)
S:(FACNAME="") FACNAME=$P($$SITE^VASITE,"^",2)
Q:(FACNAME="") "-1^Could not determine facility name"
;LINE 1
S TMP="$USER"
S:('MESSNUM) @ARRAY@(LINE)=TMP
S:(MESSNUM) X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
S LINE=LINE+1
;LINE 2
S TMP=USER
S:('MESSNUM) @ARRAY@(LINE)=TMP
S:(MESSNUM) X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
S LINE=LINE+1
;LINE 3
S TMP=USERDUZ
S:('MESSNUM) @ARRAY@(LINE)=TMP
S:(MESSNUM) X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
S LINE=LINE+1
;LINE 4
S TMP=FACNAME
S:('MESSNUM) @ARRAY@(LINE)=TMP
S:(MESSNUM) X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
S LINE=LINE+1
;LINE 5
S TMP="$$USER"
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[HVAQCON3 2338 printed Dec 13, 2024@02:24:45 Page 2
VAQCON3 ;ALB/JRP - MESSAGE CONSTRUCTION;12-APR-93
+1 ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
USER(TRANPTR,MESSNUM,ARRAY,OFFSET) ;CONSTRUCT USER BLOCK
+1 ;INPUT : TRANPTR - Pointer to VAQ - TRANSACTION file
+2 ; MESSNUM - Message number to place block into
+3 ; (if 0, block will be placed in ARRAY)
+4 ; ARRAY - Array to store block in (full global reference)
+5 ; OFFSET - Where to begin placing information (defaults to 0)
+6 ;OUTPUT : N - Number of lines in block
+7 ; -1^Error_Text - Error
+8 ;NOTES : If MESSNUM=0, then the block will be placed into
+9 ; ARRAY(LineNumber)=Line_of_info
+10 ; If MESSNUM>0 then the block will be placed into
+11 ; ^XMB(3.9,MESSNUM,2,LineNumber,0)=Line_of_info
+12 ;
+13 ;CHECK INPUT
+14 SET TRANPTR=+$GET(TRANPTR)
+15 if (('TRANPTR)!('$DATA(^VAT(394.61,TRANPTR))))
QUIT "-1^Did not pass a valid pointer to VAQ - TRANSACTION file"
+16 SET MESSNUM=+$GET(MESSNUM)
+17 IF (('MESSNUM)&($GET(ARRAY)=""))
QUIT "-1^Did not pass message number of reference to array"
+18 IF (MESSNUM)
if ('$DATA(^XMB(3.9,MESSNUM)))
QUIT "-1^Valid message number not passed"
+19 SET OFFSET=+$GET(OFFSET)
+20 ;DECLARE VARIABLES
+21 NEW TMP,USER,FACNAME,LINE,X,USERDUZ
+22 SET LINE=OFFSET
+23 ;DETERMINE SENDER
+24 SET TMP=$$SENDER^VAQCON2(TRANPTR)
+25 if (+TMP=-1)
QUIT "-1^Could not determine sender of message"
+26 SET USER=$PIECE(TMP,"^",1)
+27 SET USERDUZ=$PIECE(TMP,"^",2)
+28 ;DETERMINE FACILITY NAME (IF NOT IN PARAMETER FILE TRY GETTING FROM
+29 ; 'STATION NUMBER' FILE)
+30 SET FACNAME=""
+31 SET TMP=+$ORDER(^VAT(394.81,0))
+32 IF (TMP)
SET X=+$GET(^VAT(394.81,TMP,0))
if (X)
SET FACNAME=$PIECE($GET(^DIC(4,X,0)),"^",1)
+33 if (FACNAME="")
SET FACNAME=$PIECE($$SITE^VASITE,"^",2)
+34 if (FACNAME="")
QUIT "-1^Could not determine facility name"
+35 ;LINE 1
+36 SET TMP="$USER"
+37 if ('MESSNUM)
SET @ARRAY@(LINE)=TMP
+38 if (MESSNUM)
SET X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
+39 SET LINE=LINE+1
+40 ;LINE 2
+41 SET TMP=USER
+42 if ('MESSNUM)
SET @ARRAY@(LINE)=TMP
+43 if (MESSNUM)
SET X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
+44 SET LINE=LINE+1
+45 ;LINE 3
+46 SET TMP=USERDUZ
+47 if ('MESSNUM)
SET @ARRAY@(LINE)=TMP
+48 if (MESSNUM)
SET X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
+49 SET LINE=LINE+1
+50 ;LINE 4
+51 SET TMP=FACNAME
+52 if ('MESSNUM)
SET @ARRAY@(LINE)=TMP
+53 if (MESSNUM)
SET X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
+54 SET LINE=LINE+1
+55 ;LINE 5
+56 SET TMP="$$USER"
+57 if ('MESSNUM)
SET @ARRAY@(LINE)=TMP
+58 if (MESSNUM)
SET X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
+59 SET LINE=LINE+1
+60 QUIT (LINE-OFFSET)