ENFAXMTM ;WIRMFO/KLD,SAB-VALIDATE/TRANSMIT FAP EQUIPMENT; 6/9/97
;;7.0;ENGINEERING;**25,29,39**;Aug 17, 1993
;This routine should not be modified.
ST Q
;
EQUIP ;Validite/Transmit FA docs by Equipment
; Input
; ENBAT("XMT") - flag; true (1) to transmit after validation
; not returned
Q:$G(ENBAT("XMT"))="" ; required
W !!,"This option ",$S(ENBAT("XMT"):"TRANSMITS",1:"VALIDATES")," FA Documents (code sheets) for specified equipment.",!
EQUIPA ; ask equipment
D GETEQ^ENUTL G:Y<1 EQUIPX
S ENEQ("DA")=+Y
S X=$$CHKFA^ENFAUTL(ENEQ("DA")) I +X D G EQUIPA
. S Y=$P(X,U,2) D DD^%DT S ENFADT("E")=Y
. W !!,"FA document for ENTRY #",ENEQ("DA")," was processed on ",ENFADT("E"),"."
. W !,"No action taken.",!,$C(7)
. K DA,ENFADT,X,Y
; set variables for calls to ENFAVAL or ENFAACQ
S:'ENBAT("XMT") ENFAP("DOC")="FA" ; validate for FA document
S:ENBAT("XMT") ENBAT("SILENT")="" ; ENFAACQ will save problems in ^TMP
K ^TMP($J)
I 'ENBAT("XMT") D ; validate only
. F I=0,2,3,8,9 S ENEQ(I)=$G(^ENG(6914,ENEQ("DA"),I))
. D ^ENFAVAL
I ENBAT("XMT") D ^ENFAACQ ; transmit (includes validation)
; report results
I '$D(^TMP($J)) W !!,"Equipment Entry #: ",ENEQ("DA")," ",$S(ENBAT("XMT"):"was transmitted.",1:"looks OK!")
I $D(^TMP($J)) D LISTP W ! I ENBAT("XMT") W !,"Please correct the Equipment Record before sending a FA Document for this item.",!
G EQUIPA ; ask for another item
EQUIPX ; exit point for EQUIP
K DIC,DIR,DIRUT,DUOUT,ENBAT,ENFAP,I,X,Y
Q
;
CMR ;Validite/Transmit FA docs by CMR
; Input
; ENBAT("XMT") - flag; true (1) to transmit after validation
; not returned
Q:$G(ENBAT("XMT"))="" ; required
W !!,"This option ",$S(ENBAT("XMT"):"TRANSMITS",1:"VALIDATES")," FA Documents (code sheets)"
W !,"for all equipment that belongs to a specified CMR.",!
; ask cmr
S DIC="^ENG(6914.1,",DIC(0)="QEAM" D ^DIC Q:Y<1
S ENBAT("SEL","I")=+Y ; selected cmr
; ask device
W !,"Now select the device to print results on."
S %ZIS="Q" D ^%ZIS G:POP CMRX
I $D(IO("Q")) D G CMRX
. S ZTRTN="CMRQ^ENFAXMTM"
. S ZTDESC=$S(ENBAT("XMT"):"Transmit",1:"Validate")_" FA Doc. by CMR"
. F I="ENBAT(" S ZTSAVE(I)=""
. D ^%ZTLOAD W:$D(ZTSK) !,"Queued! Task #",ZTSK K ZTSK
CMRQ ; queued entry point to process cmr
; Input
; ENBAT("SEL","I") = ien of selected CMR
; ENBAT("XMT") = flag; when true FA Documents will be transmitted
; set variables for calls to ENFAVAL or ENFAACQ
S:'ENBAT("XMT") ENFAP("DOC")="FA" ; validate for FA document
S:ENBAT("XMT") ENBAT("SILENT")="" ; ENFAACQ will save problems in ^TMP
K ^TMP($J)
S (ENT("BAT"),ENT("BAD"),ENT("FAP"),ENT("SENT"))=0
; loop thru equipment on cmr
S ENEQ("DA")=0
F S ENEQ("DA")=$O(^ENG(6914,"AD",ENBAT("SEL","I"),ENEQ("DA"))) Q:'ENEQ("DA") D
. Q:'$P($G(^ENG(6914,ENEQ("DA"),8)),U,2) ; not capitalized
. S ENT("BAT")=ENT("BAT")+1
. I +$$CHKFA^ENFAUTL(ENEQ("DA")) S ENT("FAP")=ENT("FAP")+1 Q ; already
. I 'ENBAT("XMT") D ; validate only
. . F I=0,2,3,8,9 S ENEQ(I)=$G(^ENG(6914,ENEQ("DA"),I))
. . D ^ENFAVAL
. I ENBAT("XMT") D ^ENFAACQ ; transmit (includes validation)
; report results
S ENBAT("TYPE")="CMR"
S ENBAT("SEL","E")=$P($G(^ENG(6914.1,ENBAT("SEL","I"),0)),U) ; cmr name
D RPTB
CMRX ; exit point for CMR
K DIC,ENBAT,ENFA,ENFAP,X,Y
Q
;
STN ;Validite/Transmit FA Docs by Station
; Input
; ENBAT("XMT") - flag; true (1) to transmit after validation
; not returned
Q:$G(ENBAT("XMT"))="" ; required
W !!,"This option ",$S(ENBAT("XMT"):"TRANSMITS",1:"VALIDATES")," FA Documents (code sheets)"
W !,"for all equipment that belongs to a specified Station.",!
; ask station
S DIR(0)="F^3:5",DIR("A")="STATION NUMBER"
S DIR("B")=$$GET1^DIQ(6910,"1,",1)
D ^DIR K DIR G:$D(DIRUT) STNX
S ENBAT("SEL","I")=Y ; selected station
; ask device
W !,"Now select the device to print results on."
S %ZIS="Q" D ^%ZIS G:POP STNX
I $D(IO("Q")) D G STNX
. S ZTRTN="STNQ^ENFAXMTM"
. S ZTDESC=$S(ENBAT("XMT"):"Transmit",1:"Validate")_" FA Doc. by Station"
. F I="ENBAT(" S ZTSAVE(I)=""
. D ^%ZTLOAD W:$D(ZTSK) !,"Queued! Task #",ZTSK K ZTSK
STNQ ; queued entry point to process station
; Input
; ENBAT("SEL","I") = selected Station Number (3-5 characters)
; ENBAT("XMT") = flag; when true FA Documents will be transmitted
; set variables for calls to ENFAVAL or ENFAACQ
S:'ENBAT("XMT") ENFAP("DOC")="FA" ; validate for FA document
S:ENBAT("XMT") ENBAT("SILENT")="" ; ENFAACQ will save problems in ^TMP
K ^TMP($J)
S (ENT("BAT"),ENT("BAD"),ENT("FAP"),ENT("SENT"))=0
; loop thru equipment on station
S ENSND=$$GET1^DIQ(6910,"1,",1) ; default station number
S ENEQ("DA")=0
F S ENEQ("DA")=$O(^ENG(6914,ENEQ("DA"))) Q:'ENEQ("DA") D
. Q:'$P($G(^ENG(6914,ENEQ("DA"),8)),U,2) ; not capitalized
. S ENSN=$P($G(^ENG(6914,ENEQ("DA"),9)),U,5) S:ENSN="" ENSN=ENSND
. Q:ENSN'=ENBAT("SEL","I") ; not station
. Q:$$GET1^DIQ(6914,ENEQ("DA"),19)']"" ; not on a CMR
. ; included in batch
. S ENT("BAT")=ENT("BAT")+1
. I +$$CHKFA^ENFAUTL(ENEQ("DA")) S ENT("FAP")=ENT("FAP")+1 Q ; already
. I 'ENBAT("XMT") D ; validate only
. . F I=0,2,3,8,9 S ENEQ(I)=$G(^ENG(6914,ENEQ("DA"),I))
. . D ^ENFAVAL
. I ENBAT("XMT") D ^ENFAACQ ; transmit (includes validation)
; report results
S ENBAT("TYPE")="STATION"
S ENBAT("SEL","E")=ENBAT("SEL","I")
D RPTB
;
STNX ; exit point for STN
K DIC,ENBAT,ENFA,ENFAP,ENSN,ENSND,X,Y
Q
;
RPTB ; Report of Batch Validate/Transmit FA Documents for Equipment
; Input - required
; ENBAT("TYPE") = type of batch (CMR or STATION)
; ENBA("SEL","E") = value specified (either a CMR or STATION NUMBER)
; ENT("BAT") = count of equipment in batch (meets basic criteria)
; ENT("FAP") = count of batch items already established in FAP
; ENBAT("XMT") = flag (0 or 1), true for transmit options
; Input - optional
; ^TMP($J,"BAD",equip entry #,line number) = validation problem
; Output
; Kills ^TMP($J
U IO
S (END,ENPG)=0 D NOW^%DTC S Y=% D DD^%DT S ENFA("NOW")=Y
D RPTBHD
; count batch items which failed validation
S I=0 F S I=$O(^TMP($J,"BAD",I)) Q:I'>0 S ENT("BAD")=ENT("BAD")+1
S ENT("SENT")=ENT("BAT")-(ENT("FAP")+ENT("BAD"))
; summarize validate/transmit results
W !!,+ENT("BAT")_" records have been processed from ",ENBAT("TYPE")
W ": ",ENBAT("SEL","E")_"."
W !!,ENT("SENT")_" record",$S(ENT("SENT")=1:" ",1:"s ")
W $S('ENBAT("XMT"):"would have been",1:$S(ENT("SENT")=1:"was",1:"were"))_" sent to FAP."
W !,ENT("FAP")_$S('ENBAT("XMT"):" would not have been",1:$S(ENT("FAP")=1:" was not",1:" were not"))_" sent due to already being established in FAP."
W !,ENT("BAD")_$S('ENBAT("XMT"):" would not have been",1:$S(ENT("BAD")=1:" was not",1:" were not"))_" sent due to validation problems."
; detailed validation problems
I ENT("BAD")>0 D
. W !!,"Equipment Records not sent because of validation problems: "
. W !!,"Entry #",?24,"Reason"
. S I=0 F S I=$O(^TMP($J,"BAD",I)) Q:'I D Q:END
. . S II=0 F S II=$O(^TMP($J,"BAD",I,II)) Q:'II D Q:END
. . . I $Y+4>IOSL D RPTBHD Q:END W !!,"Entry #",?24,"Reason"
. . . W !,$J(I,11)," ",^TMP($J,"BAD",I,II)
. . W !
I 'END,$E(IOST,1,2)="C-" S DIR(0)="E" D ^DIR
K ^TMP($J),DIR,DIROUT,DIRUT,DTOUT,DUOUT,I,II,X,Y
K END,ENEQ,ENFA,ENFAP,ENPG,ENT
S:$D(ZTQUEUED) ZTREQ="Q"
D ^%ZISC
Q
RPTBHD ; header for FA batch validate/transmit report
I $E(IOST,1,2)="C-",ENPG S DIR(0)="E" D ^DIR I 'Y S END=1 Q
I $E(IOST,1,2)="C-"!ENPG W @IOF
S ENPG=ENPG+1
W !,"FA DOCUMENT ",$S(ENBAT("XMT"):"TRANSMISSION",1:"VALIDITY CHECK")
W " FOR ",ENBAT("TYPE"),": ",ENBAT("SEL","E")
W ?49,ENFA("NOW"),?72,"page ",ENPG
Q
LISTP ; List Problems with Equipment/Document
; Called from various FAP Document routines
; Input
; ENEQ("DA") - equipment entry #
; ^TMP($J,"BAD",ENEQ("DA")) - number of problems
; ^TMP($J,"BAD",ENEQ("DA"),seqn #) - description of a problem
; ENBAT("XMT") - optional, flag; true when transmitting (for FA only)
; Output
; Problems are listed to the screen
; ^TMP($J is killed
N I
W $C(7),!!,"This record "_$S($G(ENBAT("XMT"))=0:"would not have been",1:"was not")_" sent to FAP!"
W !,"Reason" W:^TMP($J,"BAD",ENEQ("DA"))>1 "s" W ":"
F I=1:1:^TMP($J,"BAD",ENEQ("DA")) W !?2,^TMP($J,"BAD",ENEQ("DA"),I)
K ^TMP($J)
Q
;ENFAXMTM
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HENFAXMTM 8447 printed Dec 13, 2024@01:53:55 Page 2
ENFAXMTM ;WIRMFO/KLD,SAB-VALIDATE/TRANSMIT FAP EQUIPMENT; 6/9/97
+1 ;;7.0;ENGINEERING;**25,29,39**;Aug 17, 1993
+2 ;This routine should not be modified.
ST QUIT
+1 ;
EQUIP ;Validite/Transmit FA docs by Equipment
+1 ; Input
+2 ; ENBAT("XMT") - flag; true (1) to transmit after validation
+3 ; not returned
+4 ; required
if $GET(ENBAT("XMT"))=""
QUIT
+5 WRITE !!,"This option ",$SELECT(ENBAT("XMT"):"TRANSMITS",1:"VALIDATES")," FA Documents (code sheets) for specified equipment.",!
EQUIPA ; ask equipment
+1 DO GETEQ^ENUTL
if Y<1
GOTO EQUIPX
+2 SET ENEQ("DA")=+Y
+3 SET X=$$CHKFA^ENFAUTL(ENEQ("DA"))
IF +X
Begin DoDot:1
+4 SET Y=$PIECE(X,U,2)
DO DD^%DT
SET ENFADT("E")=Y
+5 WRITE !!,"FA document for ENTRY #",ENEQ("DA")," was processed on ",ENFADT("E"),"."
+6 WRITE !,"No action taken.",!,$CHAR(7)
+7 KILL DA,ENFADT,X,Y
End DoDot:1
GOTO EQUIPA
+8 ; set variables for calls to ENFAVAL or ENFAACQ
+9 ; validate for FA document
if 'ENBAT("XMT")
SET ENFAP("DOC")="FA"
+10 ; ENFAACQ will save problems in ^TMP
if ENBAT("XMT")
SET ENBAT("SILENT")=""
+11 KILL ^TMP($JOB)
+12 ; validate only
IF 'ENBAT("XMT")
Begin DoDot:1
+13 FOR I=0,2,3,8,9
SET ENEQ(I)=$GET(^ENG(6914,ENEQ("DA"),I))
+14 DO ^ENFAVAL
End DoDot:1
+15 ; transmit (includes validation)
IF ENBAT("XMT")
DO ^ENFAACQ
+16 ; report results
+17 IF '$DATA(^TMP($JOB))
WRITE !!,"Equipment Entry #: ",ENEQ("DA")," ",$SELECT(ENBAT("XMT"):"was transmitted.",1:"looks OK!")
+18 IF $DATA(^TMP($JOB))
DO LISTP
WRITE !
IF ENBAT("XMT")
WRITE !,"Please correct the Equipment Record before sending a FA Document for this item.",!
+19 ; ask for another item
GOTO EQUIPA
EQUIPX ; exit point for EQUIP
+1 KILL DIC,DIR,DIRUT,DUOUT,ENBAT,ENFAP,I,X,Y
+2 QUIT
+3 ;
CMR ;Validite/Transmit FA docs by CMR
+1 ; Input
+2 ; ENBAT("XMT") - flag; true (1) to transmit after validation
+3 ; not returned
+4 ; required
if $GET(ENBAT("XMT"))=""
QUIT
+5 WRITE !!,"This option ",$SELECT(ENBAT("XMT"):"TRANSMITS",1:"VALIDATES")," FA Documents (code sheets)"
+6 WRITE !,"for all equipment that belongs to a specified CMR.",!
+7 ; ask cmr
+8 SET DIC="^ENG(6914.1,"
SET DIC(0)="QEAM"
DO ^DIC
if Y<1
QUIT
+9 ; selected cmr
SET ENBAT("SEL","I")=+Y
+10 ; ask device
+11 WRITE !,"Now select the device to print results on."
+12 SET %ZIS="Q"
DO ^%ZIS
if POP
GOTO CMRX
+13 IF $DATA(IO("Q"))
Begin DoDot:1
+14 SET ZTRTN="CMRQ^ENFAXMTM"
+15 SET ZTDESC=$SELECT(ENBAT("XMT"):"Transmit",1:"Validate")_" FA Doc. by CMR"
+16 FOR I="ENBAT("
SET ZTSAVE(I)=""
+17 DO ^%ZTLOAD
if $DATA(ZTSK)
WRITE !,"Queued! Task #",ZTSK
KILL ZTSK
End DoDot:1
GOTO CMRX
CMRQ ; queued entry point to process cmr
+1 ; Input
+2 ; ENBAT("SEL","I") = ien of selected CMR
+3 ; ENBAT("XMT") = flag; when true FA Documents will be transmitted
+4 ; set variables for calls to ENFAVAL or ENFAACQ
+5 ; validate for FA document
if 'ENBAT("XMT")
SET ENFAP("DOC")="FA"
+6 ; ENFAACQ will save problems in ^TMP
if ENBAT("XMT")
SET ENBAT("SILENT")=""
+7 KILL ^TMP($JOB)
+8 SET (ENT("BAT"),ENT("BAD"),ENT("FAP"),ENT("SENT"))=0
+9 ; loop thru equipment on cmr
+10 SET ENEQ("DA")=0
+11 FOR
SET ENEQ("DA")=$ORDER(^ENG(6914,"AD",ENBAT("SEL","I"),ENEQ("DA")))
if 'ENEQ("DA")
QUIT
Begin DoDot:1
+12 ; not capitalized
if '$PIECE($GET(^ENG(6914,ENEQ("DA"),8)),U,2)
QUIT
+13 SET ENT("BAT")=ENT("BAT")+1
+14 ; already
IF +$$CHKFA^ENFAUTL(ENEQ("DA"))
SET ENT("FAP")=ENT("FAP")+1
QUIT
+15 ; validate only
IF 'ENBAT("XMT")
Begin DoDot:2
+16 FOR I=0,2,3,8,9
SET ENEQ(I)=$GET(^ENG(6914,ENEQ("DA"),I))
+17 DO ^ENFAVAL
End DoDot:2
+18 ; transmit (includes validation)
IF ENBAT("XMT")
DO ^ENFAACQ
End DoDot:1
+19 ; report results
+20 SET ENBAT("TYPE")="CMR"
+21 ; cmr name
SET ENBAT("SEL","E")=$PIECE($GET(^ENG(6914.1,ENBAT("SEL","I"),0)),U)
+22 DO RPTB
CMRX ; exit point for CMR
+1 KILL DIC,ENBAT,ENFA,ENFAP,X,Y
+2 QUIT
+3 ;
STN ;Validite/Transmit FA Docs by Station
+1 ; Input
+2 ; ENBAT("XMT") - flag; true (1) to transmit after validation
+3 ; not returned
+4 ; required
if $GET(ENBAT("XMT"))=""
QUIT
+5 WRITE !!,"This option ",$SELECT(ENBAT("XMT"):"TRANSMITS",1:"VALIDATES")," FA Documents (code sheets)"
+6 WRITE !,"for all equipment that belongs to a specified Station.",!
+7 ; ask station
+8 SET DIR(0)="F^3:5"
SET DIR("A")="STATION NUMBER"
+9 SET DIR("B")=$$GET1^DIQ(6910,"1,",1)
+10 DO ^DIR
KILL DIR
if $DATA(DIRUT)
GOTO STNX
+11 ; selected station
SET ENBAT("SEL","I")=Y
+12 ; ask device
+13 WRITE !,"Now select the device to print results on."
+14 SET %ZIS="Q"
DO ^%ZIS
if POP
GOTO STNX
+15 IF $DATA(IO("Q"))
Begin DoDot:1
+16 SET ZTRTN="STNQ^ENFAXMTM"
+17 SET ZTDESC=$SELECT(ENBAT("XMT"):"Transmit",1:"Validate")_" FA Doc. by Station"
+18 FOR I="ENBAT("
SET ZTSAVE(I)=""
+19 DO ^%ZTLOAD
if $DATA(ZTSK)
WRITE !,"Queued! Task #",ZTSK
KILL ZTSK
End DoDot:1
GOTO STNX
STNQ ; queued entry point to process station
+1 ; Input
+2 ; ENBAT("SEL","I") = selected Station Number (3-5 characters)
+3 ; ENBAT("XMT") = flag; when true FA Documents will be transmitted
+4 ; set variables for calls to ENFAVAL or ENFAACQ
+5 ; validate for FA document
if 'ENBAT("XMT")
SET ENFAP("DOC")="FA"
+6 ; ENFAACQ will save problems in ^TMP
if ENBAT("XMT")
SET ENBAT("SILENT")=""
+7 KILL ^TMP($JOB)
+8 SET (ENT("BAT"),ENT("BAD"),ENT("FAP"),ENT("SENT"))=0
+9 ; loop thru equipment on station
+10 ; default station number
SET ENSND=$$GET1^DIQ(6910,"1,",1)
+11 SET ENEQ("DA")=0
+12 FOR
SET ENEQ("DA")=$ORDER(^ENG(6914,ENEQ("DA")))
if 'ENEQ("DA")
QUIT
Begin DoDot:1
+13 ; not capitalized
if '$PIECE($GET(^ENG(6914,ENEQ("DA"),8)),U,2)
QUIT
+14 SET ENSN=$PIECE($GET(^ENG(6914,ENEQ("DA"),9)),U,5)
if ENSN=""
SET ENSN=ENSND
+15 ; not station
if ENSN'=ENBAT("SEL","I")
QUIT
+16 ; not on a CMR
if $$GET1^DIQ(6914,ENEQ("DA"),19)']""
QUIT
+17 ; included in batch
+18 SET ENT("BAT")=ENT("BAT")+1
+19 ; already
IF +$$CHKFA^ENFAUTL(ENEQ("DA"))
SET ENT("FAP")=ENT("FAP")+1
QUIT
+20 ; validate only
IF 'ENBAT("XMT")
Begin DoDot:2
+21 FOR I=0,2,3,8,9
SET ENEQ(I)=$GET(^ENG(6914,ENEQ("DA"),I))
+22 DO ^ENFAVAL
End DoDot:2
+23 ; transmit (includes validation)
IF ENBAT("XMT")
DO ^ENFAACQ
End DoDot:1
+24 ; report results
+25 SET ENBAT("TYPE")="STATION"
+26 SET ENBAT("SEL","E")=ENBAT("SEL","I")
+27 DO RPTB
+28 ;
STNX ; exit point for STN
+1 KILL DIC,ENBAT,ENFA,ENFAP,ENSN,ENSND,X,Y
+2 QUIT
+3 ;
RPTB ; Report of Batch Validate/Transmit FA Documents for Equipment
+1 ; Input - required
+2 ; ENBAT("TYPE") = type of batch (CMR or STATION)
+3 ; ENBA("SEL","E") = value specified (either a CMR or STATION NUMBER)
+4 ; ENT("BAT") = count of equipment in batch (meets basic criteria)
+5 ; ENT("FAP") = count of batch items already established in FAP
+6 ; ENBAT("XMT") = flag (0 or 1), true for transmit options
+7 ; Input - optional
+8 ; ^TMP($J,"BAD",equip entry #,line number) = validation problem
+9 ; Output
+10 ; Kills ^TMP($J
+11 USE IO
+12 SET (END,ENPG)=0
DO NOW^%DTC
SET Y=%
DO DD^%DT
SET ENFA("NOW")=Y
+13 DO RPTBHD
+14 ; count batch items which failed validation
+15 SET I=0
FOR
SET I=$ORDER(^TMP($JOB,"BAD",I))
if I'>0
QUIT
SET ENT("BAD")=ENT("BAD")+1
+16 SET ENT("SENT")=ENT("BAT")-(ENT("FAP")+ENT("BAD"))
+17 ; summarize validate/transmit results
+18 WRITE !!,+ENT("BAT")_" records have been processed from ",ENBAT("TYPE")
+19 WRITE ": ",ENBAT("SEL","E")_"."
+20 WRITE !!,ENT("SENT")_" record",$SELECT(ENT("SENT")=1:" ",1:"s ")
+21 WRITE $SELECT('ENBAT("XMT"):"would have been",1:$SELECT(ENT("SENT")=1:"was",1:"were"))_" sent to FAP."
+22 WRITE !,ENT("FAP")_$SELECT('ENBAT("XMT"):" would not have been",1:$SELECT(ENT("FAP")=1:" was not",1:" were not"))_" sent due to already being established in FAP."
+23 WRITE !,ENT("BAD")_$SELECT('ENBAT("XMT"):" would not have been",1:$SELECT(ENT("BAD")=1:" was not",1:" were not"))_" sent due to validation problems."
+24 ; detailed validation problems
+25 IF ENT("BAD")>0
Begin DoDot:1
+26 WRITE !!,"Equipment Records not sent because of validation problems: "
+27 WRITE !!,"Entry #",?24,"Reason"
+28 SET I=0
FOR
SET I=$ORDER(^TMP($JOB,"BAD",I))
if 'I
QUIT
Begin DoDot:2
+29 SET II=0
FOR
SET II=$ORDER(^TMP($JOB,"BAD",I,II))
if 'II
QUIT
Begin DoDot:3
+30 IF $Y+4>IOSL
DO RPTBHD
if END
QUIT
WRITE !!,"Entry #",?24,"Reason"
+31 WRITE !,$JUSTIFY(I,11)," ",^TMP($JOB,"BAD",I,II)
End DoDot:3
if END
QUIT
+32 WRITE !
End DoDot:2
if END
QUIT
End DoDot:1
+33 IF 'END
IF $EXTRACT(IOST,1,2)="C-"
SET DIR(0)="E"
DO ^DIR
+34 KILL ^TMP($JOB),DIR,DIROUT,DIRUT,DTOUT,DUOUT,I,II,X,Y
+35 KILL END,ENEQ,ENFA,ENFAP,ENPG,ENT
+36 if $DATA(ZTQUEUED)
SET ZTREQ="Q"
+37 DO ^%ZISC
+38 QUIT
RPTBHD ; header for FA batch validate/transmit report
+1 IF $EXTRACT(IOST,1,2)="C-"
IF ENPG
SET DIR(0)="E"
DO ^DIR
IF 'Y
SET END=1
QUIT
+2 IF $EXTRACT(IOST,1,2)="C-"!ENPG
WRITE @IOF
+3 SET ENPG=ENPG+1
+4 WRITE !,"FA DOCUMENT ",$SELECT(ENBAT("XMT"):"TRANSMISSION",1:"VALIDITY CHECK")
+5 WRITE " FOR ",ENBAT("TYPE"),": ",ENBAT("SEL","E")
+6 WRITE ?49,ENFA("NOW"),?72,"page ",ENPG
+7 QUIT
LISTP ; List Problems with Equipment/Document
+1 ; Called from various FAP Document routines
+2 ; Input
+3 ; ENEQ("DA") - equipment entry #
+4 ; ^TMP($J,"BAD",ENEQ("DA")) - number of problems
+5 ; ^TMP($J,"BAD",ENEQ("DA"),seqn #) - description of a problem
+6 ; ENBAT("XMT") - optional, flag; true when transmitting (for FA only)
+7 ; Output
+8 ; Problems are listed to the screen
+9 ; ^TMP($J is killed
+10 NEW I
+11 WRITE $CHAR(7),!!,"This record "_$SELECT($GET(ENBAT("XMT"))=0:"would not have been",1:"was not")_" sent to FAP!"
+12 WRITE !,"Reason"
if ^TMP($JOB,"BAD",ENEQ("DA"))>1
WRITE "s"
WRITE ":"
+13 FOR I=1:1:^TMP($JOB,"BAD",ENEQ("DA"))
WRITE !?2,^TMP($JOB,"BAD",ENEQ("DA"),I)
+14 KILL ^TMP($JOB)
+15 QUIT
+16 ;ENFAXMTM