ORQOCONV1 ; SLC/AGP - Utility report for Order Dialogs cont;Dec 08, 2021@10:44:36
;;3.0;ORDER ENTRY/RESULTS REPORTING;**405**;DEC 17, 1997;Build 211
;
; DBIA 5133: reading ^PXRMD file #801.41
Q
;
REPORT(REPSUB,REPTYPE,ARRAY) ;
N CNT,DISABLE,IDX,IEN,ISCOM,NAME,NL,NODE,NOUT,ONMENU,OUTPUT,ORDIALOG,PROMPT,PROMPTS
N QOIEN,SPINCNT,TCNT,TIDX,TMP,TEXT,TEXTOUT,VALUE,X
K ^TMP($J,"ORQOCONV REPORT OUTPUT")
S CNT=0,SPINCNT=0
I REPTYPE="F" D
.D SPIN^ORQOUTL("Building Report output",.SPINCNT)
.S CNT=CNT+1,^TMP($J,"ORQOCONV REPORT OUTPUT",CNT)=$$LJ^XLFSTR("Name",40)_$$LJ^XLFSTR("Disable",10)_$$LJ^XLFSTR("Attached",10)
.S CNT=CNT+1,^TMP($J,"ORQOCONV REPORT OUTPUT",CNT)=$$REPEAT^XLFSTR("-",79)
.S PROMPT="" F S PROMPT=$O(ARRAY("HASVALUE",PROMPT)) Q:PROMPT="" D
..S PROMPTS(PROMPT)=""
.S PROMPT="" F S PROMPT=$O(ARRAY("NOVALUE",PROMPT)) Q:PROMPT="" D
..S PROMPTS(PROMPT)=""
S QOIEN=0 F S QOIEN=$O(^TMP($J,REPSUB,QOIEN)) Q:QOIEN'>0 D
.I REPTYPE="F" D SPIN^ORQOUTL("Building Report output",.SPINCNT)
.S ONMENU=$S(^TMP($J,REPSUB,QOIEN)=1:"Yes",1:"No")
.S NODE=$G(^ORD(101.41,QOIEN,0))
.S NAME=$P(NODE,U)
.S DISABLE=$S($P(NODE,U,3)'="":"Yes",1:"No")
.I REPTYPE="A" D SHOW^ORQOCONV(QOIEN) W !! Q
.I CNT>2 S CNT=CNT+1,^TMP($J,"ORQOCONV REPORT OUTPUT",CNT)=""
.K ORDIALOG
.D GETQDLG^ORCD(QOIEN)
.S CNT=CNT+1,^TMP($J,"ORQOCONV REPORT OUTPUT",CNT)=$$LJ^XLFSTR(NAME,40)_$$LJ^XLFSTR(DISABLE,10)_$$LJ^XLFSTR("Attached",10)
.S PROMPT="" F S PROMPT=$O(PROMPTS(PROMPT)) Q:PROMPT="" D
..S NODE=$G(ORDIALOG("B",PROMPT))
..S IEN=+$P(NODE,U,2)
..I +$O(ORDIALOG(IEN,"?"),-1)=0 S CNT=CNT+1,^TMP($J,"ORQOCONV REPORT OUTPUT",CNT)=$$RJ^XLFSTR(PROMPT,30) Q
..S TCNT=0
..S IDX=0 F S IDX=$O(ORDIALOG(IEN,IDX)) Q:IDX'>0 D
...K ISCOM,NOUT,TEXT,TEXTOUT,VALUE,X
...S VALUE=$G(ORDIALOG(IEN,IDX))
...S ISCOM=$S(VALUE["^TMP(":1,1:0)
...I ISCOM S TIDX=0 F S TIDX=$O(@VALUE@(TIDX)) Q:TIDX'>0 D
....S TCNT=TCNT+1,TEXT(TCNT)=@VALUE@(TIDX,0)
...I 'ISCOM S TCNT=TCNT+1,TEXT(TCNT)=$$RJ^XLFSTR(PROMPT,30)_$J(" ",5)_VALUE Q
...I $D(TEXT) D Q
....D FORMAT^PXRMTEXT(1,40,.TCNT,.TEXT,.NOUT,.TEXTOUT)
....F X=1:1:NOUT D
.....I X=1 S CNT=CNT+1,^TMP($J,"ORQOCONV REPORT OUTPUT",CNT)=$$RJ^XLFSTR(PROMPT,30)_$J(" ",5)_TEXTOUT(X) Q
.....S CNT=CNT+1,^TMP($J,"ORQOCONV REPORT OUTPUT",CNT)=$J(" ",35)_TEXTOUT(X)
...S CNT=CNT+1,^TMP($J,"ORQOCONV REPORT OUTPUT",CNT)=$$RJ^XLFSTR(PROMPT,30)
S IDX=0 F S IDX=$O(^TMP($J,"ORQOCONV REPORT OUTPUT",IDX)) Q:IDX'>0 D
.W !,^TMP($J,"ORQOCONV REPORT OUTPUT",IDX)
K ^TMP($J,"ORQOCONV REPORT OUTPUT")
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORQOCONV1 2590 printed Dec 13, 2024@02:33:17 Page 2
ORQOCONV1 ; SLC/AGP - Utility report for Order Dialogs cont;Dec 08, 2021@10:44:36
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**405**;DEC 17, 1997;Build 211
+2 ;
+3 ; DBIA 5133: reading ^PXRMD file #801.41
+4 QUIT
+5 ;
REPORT(REPSUB,REPTYPE,ARRAY) ;
+1 NEW CNT,DISABLE,IDX,IEN,ISCOM,NAME,NL,NODE,NOUT,ONMENU,OUTPUT,ORDIALOG,PROMPT,PROMPTS
+2 NEW QOIEN,SPINCNT,TCNT,TIDX,TMP,TEXT,TEXTOUT,VALUE,X
+3 KILL ^TMP($JOB,"ORQOCONV REPORT OUTPUT")
+4 SET CNT=0
SET SPINCNT=0
+5 IF REPTYPE="F"
Begin DoDot:1
+6 DO SPIN^ORQOUTL("Building Report output",.SPINCNT)
+7 SET CNT=CNT+1
SET ^TMP($JOB,"ORQOCONV REPORT OUTPUT",CNT)=$$LJ^XLFSTR("Name",40)_$$LJ^XLFSTR("Disable",10)_$$LJ^XLFSTR("Attached",10)
+8 SET CNT=CNT+1
SET ^TMP($JOB,"ORQOCONV REPORT OUTPUT",CNT)=$$REPEAT^XLFSTR("-",79)
+9 SET PROMPT=""
FOR
SET PROMPT=$ORDER(ARRAY("HASVALUE",PROMPT))
if PROMPT=""
QUIT
Begin DoDot:2
+10 SET PROMPTS(PROMPT)=""
End DoDot:2
+11 SET PROMPT=""
FOR
SET PROMPT=$ORDER(ARRAY("NOVALUE",PROMPT))
if PROMPT=""
QUIT
Begin DoDot:2
+12 SET PROMPTS(PROMPT)=""
End DoDot:2
End DoDot:1
+13 SET QOIEN=0
FOR
SET QOIEN=$ORDER(^TMP($JOB,REPSUB,QOIEN))
if QOIEN'>0
QUIT
Begin DoDot:1
+14 IF REPTYPE="F"
DO SPIN^ORQOUTL("Building Report output",.SPINCNT)
+15 SET ONMENU=$SELECT(^TMP($JOB,REPSUB,QOIEN)=1:"Yes",1:"No")
+16 SET NODE=$GET(^ORD(101.41,QOIEN,0))
+17 SET NAME=$PIECE(NODE,U)
+18 SET DISABLE=$SELECT($PIECE(NODE,U,3)'="":"Yes",1:"No")
+19 IF REPTYPE="A"
DO SHOW^ORQOCONV(QOIEN)
WRITE !!
QUIT
+20 IF CNT>2
SET CNT=CNT+1
SET ^TMP($JOB,"ORQOCONV REPORT OUTPUT",CNT)=""
+21 KILL ORDIALOG
+22 DO GETQDLG^ORCD(QOIEN)
+23 SET CNT=CNT+1
SET ^TMP($JOB,"ORQOCONV REPORT OUTPUT",CNT)=$$LJ^XLFSTR(NAME,40)_$$LJ^XLFSTR(DISABLE,10)_$$LJ^XLFSTR("Attached",10)
+24 SET PROMPT=""
FOR
SET PROMPT=$ORDER(PROMPTS(PROMPT))
if PROMPT=""
QUIT
Begin DoDot:2
+25 SET NODE=$GET(ORDIALOG("B",PROMPT))
+26 SET IEN=+$PIECE(NODE,U,2)
+27 IF +$ORDER(ORDIALOG(IEN,"?"),-1)=0
SET CNT=CNT+1
SET ^TMP($JOB,"ORQOCONV REPORT OUTPUT",CNT)=$$RJ^XLFSTR(PROMPT,30)
QUIT
+28 SET TCNT=0
+29 SET IDX=0
FOR
SET IDX=$ORDER(ORDIALOG(IEN,IDX))
if IDX'>0
QUIT
Begin DoDot:3
+30 KILL ISCOM,NOUT,TEXT,TEXTOUT,VALUE,X
+31 SET VALUE=$GET(ORDIALOG(IEN,IDX))
+32 SET ISCOM=$SELECT(VALUE["^TMP(":1,1:0)
+33 IF ISCOM
SET TIDX=0
FOR
SET TIDX=$ORDER(@VALUE@(TIDX))
if TIDX'>0
QUIT
Begin DoDot:4
+34 SET TCNT=TCNT+1
SET TEXT(TCNT)=@VALUE@(TIDX,0)
End DoDot:4
+35 IF 'ISCOM
SET TCNT=TCNT+1
SET TEXT(TCNT)=$$RJ^XLFSTR(PROMPT,30)_$JUSTIFY(" ",5)_VALUE
QUIT
+36 IF $DATA(TEXT)
Begin DoDot:4
+37 DO FORMAT^PXRMTEXT(1,40,.TCNT,.TEXT,.NOUT,.TEXTOUT)
+38 FOR X=1:1:NOUT
Begin DoDot:5
+39 IF X=1
SET CNT=CNT+1
SET ^TMP($JOB,"ORQOCONV REPORT OUTPUT",CNT)=$$RJ^XLFSTR(PROMPT,30)_$JUSTIFY(" ",5)_TEXTOUT(X)
QUIT
+40 SET CNT=CNT+1
SET ^TMP($JOB,"ORQOCONV REPORT OUTPUT",CNT)=$JUSTIFY(" ",35)_TEXTOUT(X)
End DoDot:5
End DoDot:4
QUIT
+41 SET CNT=CNT+1
SET ^TMP($JOB,"ORQOCONV REPORT OUTPUT",CNT)=$$RJ^XLFSTR(PROMPT,30)
End DoDot:3
End DoDot:2
End DoDot:1
+42 SET IDX=0
FOR
SET IDX=$ORDER(^TMP($JOB,"ORQOCONV REPORT OUTPUT",IDX))
if IDX'>0
QUIT
Begin DoDot:1
+43 WRITE !,^TMP($JOB,"ORQOCONV REPORT OUTPUT",IDX)
End DoDot:1
+44 KILL ^TMP($JOB,"ORQOCONV REPORT OUTPUT")
+45 QUIT