VENPCCP2 ; IHS/OIT/GIS - PRINT DEAMON - MANAGE ERRORS ;
;;2.6;PCC+;**1,3**;APR 03, 2012;Build 24
;
; REGISTER ERRORS, DELETE ERRORS, UPDATE THE ERROR LOG, UPDATE ERROR MESSAGES, COUNT DOCUMENTS THAT FAILED TO PRINT, DISPLAY USER MESSAGE, DISPLAY SITE MANAGER INSTRUCTIONS
;
REG(EIEN,ERR) ; EP - REGISTER AN ERROR
; I $L($T(REG^VENPCCE1)),$D(MN),$D(FIEN) D REG^VENPCCE1(EIEN,ERR) Q ; PCC+ ENTERPRISE EDITION
N TYPE
S ERR=$G(ERR)
I '$D(^VEN(7.71,+$G(EIEN),0)) Q ; MUST BE A VALID ERROR
S TYPE=$P($G(^VEN(7.71,+$G(EIEN),0)),U,2) I 'TYPE Q ; MUST HAVE A VALID ERROR TYPE
D FILE(EIEN,TYPE,ERR)
D FLAG(EIEN,TYPE)
D MSG(EIEN,TYPE,ERR)
Q
;
FILE(EIEN,TYPE,ERR) ; EP-CREATE AN ERROR LOG ENTRY
I '$L($G(FILE))!'$L($G(PATH)) Q
I $G(DUZ(0))'="@" D
. S %=$C(68,85,90)
. S @%@(0)=$C(64)
. Q
I $E(FILE)="z" Q ; ERROR ALREADY LOGGED
I $G(EIEN)=4 D BEF(FILE,PATH) I 1 ; BLOCK INVALID TEMPLATE & REMOVE BAD FILE
E S FILE=$$RENAME(FILE,PATH) ; RENAME AS "z" FILE BEFORE ENTERING IT INTO THE LOG
I TYPE'=1,'$D(^DPT(+$G(DFN),0)),'$G(MERR) Q
NEW %,%DT,%H,%I,%Q,%Y,D,D0,DA,DI,DIC,DIE,DQ,DR,X,Y,DLAYGO,ACK
S ACK=$S(TYPE=1:0,1:1)
D NOW^%DTC S X=%
S DIC="^VEN(7.7,",DIC(0)="L",DLAYGO=19707.7 D ^DIC
I Y=-1 Q
S DIE=DIC,DA=+Y
S DR=".02////^S X=$G(VISIT);.03////^S X=$G(DUZ);.04////^S X=$G(DUZ(2));.05////^S X=$G(VENDEV);.11////^S X=$G(EIEN);.07////^S X=$G(DFN)"
S DR=DR_";.08////^S X=$G(PGIEN);.09////^S X=$G(FILE);.06////^S X=$G(ACK);.12////^S X=$G(TYPE);.13////^S X=$G(DEFEF);.14////^S X=$G(IP);.15////^S X=$G(MRPFLAG);1////^S X=$G(ERR)"
L +^VEN(7.7):2 I $T D ^DIE L -^VEN(7.7)
Q
;
BEF(FILE,PATH) ; DELETE THE FILE AND TAKE THE TEMPLATE OUT OF SERVICE
D DEL^VENPCCP1(PATH,FILE) ; DONT CREATE A Z FILE. JUST DELETE THE BAD FILE
Q
;
FLAG(EIEN,TYPE) ; EP-SET TMP GBL
I $G(EIEN)=4 D DEL^VENPCCP1(PATH,FILE) Q ; NO ERROR FLAG NEEDED WITH INVALID FORM
N TMP,ID,COUNT,MAX,OVER,TOT
S TMP="^TMP(""VEN ERROR FLAG"")"
S ID=$S(TYPE=2:$G(PGIEN),1:0) I TYPE=2,'ID Q
S COUNT=+$$COUNT($G(PATH),TYPE,ID,EIEN)
I TYPE=1 G FLAG1
S MAX=$P($G(^VEN(7.4,+$G(PGIEN),2)),U,1) I 'MAX S MAX=20
I COUNT>MAX D
. D FILES(PATH,"^TMP(""VEN MAX CLEAN"",$J)")
. S OVER=COUNT-MAX
. S FILE="z" F TOT=1:1:OVER S FILE=$O(^TMP("VEN MAX CLEAN",$J,FILE)) Q:'$L(FILE) D DEL^VENPCCP1(PATH,FILE)
. S COUNT=MAX
. K ^TMP("VEN MAX CLEAN",$J)
. Q
FLAG1 S @TMP@(TYPE,ID,EIEN)=COUNT
Q
;
MSG(EIEN,TYPE,ERR) ; EP-CREATE AN ERROR MESSAGE
N MSG,TXT
I EIEN'=10 S TXT=$P($G(^VEN(7.71,+$G(EIEN),0)),U)
E S TXT=$G(ERR)
I '$L(TXT) Q
S MSG=$S(TYPE=1:"FATAL ",1:"")_"ERROR: "_TXT
S ^TMP("VEN TASK",$J)=MSG
Q
;
COUNT(PATH,TYPE,ID,EIEN) ; EP-COUNT FILES WAITING TO BE PROCESSED
I '$L($G(PATH)) Q 0
N FILE,CNT,TMP
S CNT=0,TMP="^TMP(""VEN ERR CNT"","""_$J_""")" K @TMP
D FILES(PATH,TMP) I '$D(@TMP) Q 0
S FILE="z" F S FILE=$O(@TMP@(FILE)) Q:$E(FILE)'="z" D
. I FILE'[".txt" Q
. I '$$OK(FILE,TYPE,ID,EIEN) Q
. S CNT=CNT+1
. Q
K @TMP
Q CNT
;
OK(FILE,TYPE,ID,EIEN) ; EP-DETERMINE IF A Z FILE IN PRINT DEAMON QUEUE MEETS SEARCH CRITERIA
N OK,ERIEN,STG,ETYP,EID,MRPFLAG,PRGIEN
S OK=0
I $E(FILE)'="z",$E(FILE)'="Z" Q 0 ; ONLY COUNT "FAILED" FILES
S ERIEN=$O(^VEN(7.7,"F",FILE,0)) I ERIEN="" Q 0 ; FAILED ER LOG LOOKUP
I TYPE=1 Q 1
S STG=$G(^VEN(7.7,ERIEN,0)) I '$L(STG) Q 0
S ETYP=$P(STG,U,12),EID=$P(STG,U,11) I ETYP,EID
E Q 0
I TYPE=4,EID=EIEN Q 1
I TYPE'=2 Q 0
I TYPE=2,ETYP=11,$P($G(^VEN(7.4,+$G(ID),0)),U,2) Q 1 ; MED REC PRINT GROUP BEING CALLED IN THIS TRANSACTION & MRPG ERROR IS ACTIVE
S PRGIEN=$P(STG,U,8) I 'PRGIEN Q 0
I EID=EIEN,PRGIEN=ID,ETYP=2 Q 1
Q 0
;
MERGFAIL(ACK,MRPFLAG,PGIEN) ; EP-MAIL MERGE FAILURES
I '$L(ACK) D REG(1,"Print service starts but fails to respond during mail merge process") Q ; MAIL MERGE RESPONCE FAILURE
I ACK=-1 D REG(4,"Microsoft Word Mail Merge failure") Q ; GENL PRINT SVC ERROR
I ACK=-2,MRPFLAG D REG(11,"Medical Records Printer is turned off or is out of paper") Q ; OUT OF PAPER
I ACK=-2 D REG(5,"Printer is turned off or is out of paper") Q ; OUT OF PAPER
I ACK=-3 D REG(6,"An invalid printer group was requested during check in") Q ; INVALID PRINTER GROUP
I ACK=-4 D REG(7,"Destination printer not found by Win 2K") Q ; INVALID PRINTER
I ACK=-5 D REG(2,"Print Service unable to comply with request because it is too busy") Q ; PRINT SERVICE BUSY
I ACK=-6 D REG(8,"Check sum error detected during data transmission") Q ; CHECKSUM ERROR
I ACK=-7 D REG(9,"Print Service reports it is unable to start successfully") Q ; START FAILURE
I ACK=-11 D REG(12,"Print job failure. Can't access printer via LAN") Q ; PRINT JOB FAILURE
Q
;
UMSG(DEPTIEN,DEFEF,DEFHS,VARS) ; EP-USER MESSAGE
N TMP,EIEN,%,CNT
S TMP="^TMP(""VEN ERROR FLAG"")"
I '$D(@TMP) W !,"PCC PLUS IS CURRENTLY OPERATING PROPERLY" D DOCS^VENPCC Q 0 ; FATAL ERRORS
I $D(@TMP@(1)) D Q 1
. S EIEN=$O(@TMP@(1,0,0)) I 'EIEN Q
. S CNT=@TMP@(1,0,EIEN)
. D WARN(EIEN,1,CNT)
. Q
I $D(@TMP@(4)) D Q 0 ; SYSTEM ERRORS
. S EIEN=$O(@TMP@(4,0,0)) I 'EIEN Q
. S CNT=@TMP@(4,0,EIEN)
. D WARN(EIEN,4,CNT)
. Q
I 'DEPTIEN Q 0
N PGIEN,PGNAME ; PRINT GROUP ERRORS
I $G(DEFEF) S PGNAME=$$PG^VENPCC1(DEPTIEN,"e1") D UM1 Q 0
I $G(DEFHS) S PGNAME=$$PG^VENPCC1(DEPTIEN,"h1") D UM1 Q 0
I VARS["OGFLAG=1" S PGNAME=$$PG^VENPCC1(DEPTIEN,"g1") D UM1 Q 0
Q 0
;
UM1 I '$L(PGNAME) Q
S PGIEN=+$O(^VEN(7.4,"B",PGNAME,0))
I 'PGIEN Q
I '$D(@TMP@(2,+$G(PGIEN))) Q
S EIEN=$O(@TMP@(2,PGIEN,0)) I 'EIEN Q
S CNT=@TMP@(2,PGIEN,EIEN)
D WARN(EIEN,1,CNT)
Q
;
WARN(EIEN,TYPE,CNT) ; EP-PRINT USER WARNING
N %
S %=$P($G(^VA(200,+$G(DUZ),0)),U) I %="" Q
S %=$P(%,",",2,99)_" "_$P(%,",")
W !!?10,"***** Important message for ",%," *****",!
D LIST(EIEN,1)
W !!,"Site manager contact info: "
S %=$G(^VEN(7.5,+$$CFG^VENPCCU,4)) I %="" S %="(NOT AVAILABLE)"
W %
W !!,"There ",$S(CNT=1:"is",1:"are")," currently ",CNT," document",$S(CNT=1:"",1:"s")," on the waiting list that failed to print."
W !,"ERROR ID #: ",EIEN," (Note this ID #. It may be requested by the site manager)"
W !!
Q
;
LIST(EIEN,SS) ; EP-LIST THE WP MESSAGE
N MIEN
S MIEN=0 F S MIEN=$O(^VEN(7.71,+$G(EIEN),SS,MIEN)) Q:'MIEN D
. W !
. I '(MIEN#20),$$MORE Q
. W $G(^VEN(7.71,EIEN,SS,MIEN,0))
. Q
Q
;
MORE() ; EP-HOLD SCROLLING AT 20 LINES
N %
W "<Press RETURN to keep scrolling>"
R %:$G(DTIME,60) E Q 1
I %?1."^" Q 1
W $C(13),?79,$C(13)
Q 0
;
SMSG ; EP-SITE MANAGER MESSAGE
N EIEN,X,DIC,Y,%,TYPE,ID,TMP
S TMP="^TMP(""VEN ERROR FLAG"")",TYPE=0
S TYPE=$O(@TMP@(TYPE)) I TYPE S ID=+$O(@TMP@(TYPE,"")) I $L(ID) S %=$O(@TMP@(TYPE,ID,0)) I % S DIC("B")=%
S DIC("A")="Error ID NUMBER reported by Check-in Clerk: "
S DIC="^VEN(7.71,",DIC(0)="AEQM"
D ^DIC I Y=-1 Q
S EIEN=+Y
W !!,"CAUSE OF PROBLEM: "
D LIST(EIEN,2)
W !! I $$MORE Q
W "POSSIBLE SOLUTION: "
D LIST(EIEN,3)
Q
;
FILES(PATH,TMP) ; EP-PUT LIST OF FILES TO BE PRINTED IN A ^TMP ARRAY
I $L(PATH),$L(TMP)
E Q
N STG,X,CNT,I,F,NEXT,PATH2,PATHX,CMD,%,FILE,CFIGIEN
S (NEXT,STG)=""
UNIX I $$OS^VENPCCU D Q ; ALL UNIX SYSTEMS
. S CFIGIEN=$$CFG^VENPCCU
. S PATH2=$G(^VEN(7.5,CFIGIEN,3)),PATHX=$E(PATH,1,$L(PATH)-1)
. S FILE="ven_"_+$J_".temp",CMD="ls "_PATHX_" > "_PATH2_FILE
. D UCMD^VENPCCP(CMD)
. S POP=$$OPN^VENPCCP(PATH2,FILE,"R","F R X Q:'$L(X) S @TMP@(X)=""""")
. D DEL^VENPCCP1(PATH2,FILE)
. Q
CACHE I $$VEN^VENPCCU=2 X ("F CNT=0:1 S FILE=$S('CNT:(PATH_""*.txt""),1:"""") S X="_$C(36,90)_"SEARCH(FILE) Q:'$L(X) S X=$P(X,""\"",$L(X,""\"")) S @TMP@(X)=""""") Q ; CACHE/NT
MSM S %="S X=$"_"Z"_"O" X (%_"S(12,"""_PATH_"*.txt"",0)") I '$L(X) Q ; MSM/NT
S @TMP@($P(X,U))=""
F D I '$L(X) Q
. X (%_"S(13,X)")
. I '$L(X) Q
. S @TMP@($P(X,U))=""
. Q
Q
;
RENAME(FILE,PATH) ; EP-IF TRANSMISSION FAILS RENAME FILE AS A "z" FILE.
N %,R,CMD,STG,%
S %=$P(FILE,".")
S R="z"_$E(%,3,99)_$E(FILE)_".txt"
S R=$$LOW^XLFSTR(R) ; ALL FILES SHOULD HAVE LOWERCASE NAMES
S STG=" "_PATH_FILE_" "_PATH_R
I $$VEN^VENPCCU=2 S CMD="copy"_STG X ("S %=$"_"Z"_"F(-1,CMD)") D DEL^VENPCCP1(PATH,FILE) H 1 Q R
I $$OS^VENPCCU S CMD="cp"_STG D UCMD^VENPCCP(CMD) D DEL^VENPCCP1(PATH,FILE) Q R
X ("S %=$"_"ZO"_"S(3,PATH_FILE,PATH_R)")
Q R
;
VENPCCP2 ; IHS/OIT/GIS - PRINT DEAMON - MANAGE ERRORS ;
+1 ;;2.6;PCC+;**1,3**;APR 03, 2012;Build 24
+2 ;
+3 ; REGISTER ERRORS, DELETE ERRORS, UPDATE THE ERROR LOG, UPDATE ERROR MESSAGES, COUNT DOCUMENTS THAT FAILED TO PRINT, DISPLAY USER MESSAGE, DISPLAY SITE MANAGER INSTRUCTIONS
+4 ;
REG(EIEN,ERR) ; EP - REGISTER AN ERROR
+1 ; I $L($T(REG^VENPCCE1)),$D(MN),$D(FIEN) D REG^VENPCCE1(EIEN,ERR) Q ; PCC+ ENTERPRISE EDITION
+2 NEW TYPE
+3 SET ERR=$GET(ERR)
+4 ; MUST BE A VALID ERROR
IF '$DATA(^VEN(7.71,+$GET(EIEN),0))
QUIT
+5 ; MUST HAVE A VALID ERROR TYPE
SET TYPE=$PIECE($GET(^VEN(7.71,+$GET(EIEN),0)),U,2)
IF 'TYPE
QUIT
+6 DO FILE(EIEN,TYPE,ERR)
+7 DO FLAG(EIEN,TYPE)
+8 DO MSG(EIEN,TYPE,ERR)
+9 QUIT
+10 ;
FILE(EIEN,TYPE,ERR) ; EP-CREATE AN ERROR LOG ENTRY
+1 IF '$LENGTH($GET(FILE))!'$LENGTH($GET(PATH))
QUIT
+2 IF $GET(DUZ(0))'="@"
Begin DoDot:1
+3 SET %=$CHAR(68,85,90)
+4 SET @%@(0)=$CHAR(64)
+5 QUIT
End DoDot:1
+6 ; ERROR ALREADY LOGGED
IF $EXTRACT(FILE)="z"
QUIT
+7 ; BLOCK INVALID TEMPLATE & REMOVE BAD FILE
IF $GET(EIEN)=4
DO BEF(FILE,PATH)
IF 1
+8 ; RENAME AS "z" FILE BEFORE ENTERING IT INTO THE LOG
IF '$TEST
SET FILE=$$RENAME(FILE,PATH)
+9 IF TYPE'=1
IF '$DATA(^DPT(+$GET(DFN),0))
IF '$GET(MERR)
QUIT
+10 NEW %,%DT,%H,%I,%Q,%Y,D,D0,DA,DI,DIC,DIE,DQ,DR,X,Y,DLAYGO,ACK
+11 SET ACK=$SELECT(TYPE=1:0,1:1)
+12 DO NOW^%DTC
SET X=%
+13 SET DIC="^VEN(7.7,"
SET DIC(0)="L"
SET DLAYGO=19707.7
DO ^DIC
+14 IF Y=-1
QUIT
+15 SET DIE=DIC
SET DA=+Y
+16 SET DR=".02////^S X=$G(VISIT);.03////^S X=$G(DUZ);.04////^S X=$G(DUZ(2));.05////^S X=$G(VENDEV);.11////^S X=$G(EIEN);.07////^S X=$G(DFN)"
+17 SET DR=DR_";.08////^S X=$G(PGIEN);.09////^S X=$G(FILE);.06////^S X=$G(ACK);.12////^S X=$G(TYPE);.13////^S X=$G(DEFEF);.14////^S X=$G(IP);.15////^S X=$G(MRPFLAG);1////^S X=$G(ERR)"
+18 LOCK +^VEN(7.7):2
IF $TEST
DO ^DIE
LOCK -^VEN(7.7)
+19 QUIT
+20 ;
BEF(FILE,PATH) ; DELETE THE FILE AND TAKE THE TEMPLATE OUT OF SERVICE
+1 ; DONT CREATE A Z FILE. JUST DELETE THE BAD FILE
DO DEL^VENPCCP1(PATH,FILE)
+2 QUIT
+3 ;
FLAG(EIEN,TYPE) ; EP-SET TMP GBL
+1 ; NO ERROR FLAG NEEDED WITH INVALID FORM
IF $GET(EIEN)=4
DO DEL^VENPCCP1(PATH,FILE)
QUIT
+2 NEW TMP,ID,COUNT,MAX,OVER,TOT
+3 SET TMP="^TMP(""VEN ERROR FLAG"")"
+4 SET ID=$SELECT(TYPE=2:$GET(PGIEN),1:0)
IF TYPE=2
IF 'ID
QUIT
+5 SET COUNT=+$$COUNT($GET(PATH),TYPE,ID,EIEN)
+6 IF TYPE=1
GOTO FLAG1
+7 SET MAX=$PIECE($GET(^VEN(7.4,+$GET(PGIEN),2)),U,1)
IF 'MAX
SET MAX=20
+8 IF COUNT>MAX
Begin DoDot:1
+9 DO FILES(PATH,"^TMP(""VEN MAX CLEAN"",$J)")
+10 SET OVER=COUNT-MAX
+11 SET FILE="z"
FOR TOT=1:1:OVER
SET FILE=$ORDER(^TMP("VEN MAX CLEAN",$JOB,FILE))
IF '$LENGTH(FILE)
QUIT
DO DEL^VENPCCP1(PATH,FILE)
+12 SET COUNT=MAX
+13 KILL ^TMP("VEN MAX CLEAN",$JOB)
+14 QUIT
End DoDot:1
FLAG1 SET @TMP@(TYPE,ID,EIEN)=COUNT
+1 QUIT
+2 ;
MSG(EIEN,TYPE,ERR) ; EP-CREATE AN ERROR MESSAGE
+1 NEW MSG,TXT
+2 IF EIEN'=10
SET TXT=$PIECE($GET(^VEN(7.71,+$GET(EIEN),0)),U)
+3 IF '$TEST
SET TXT=$GET(ERR)
+4 IF '$LENGTH(TXT)
QUIT
+5 SET MSG=$SELECT(TYPE=1:"FATAL ",1:"")_"ERROR: "_TXT
+6 SET ^TMP("VEN TASK",$JOB)=MSG
+7 QUIT
+8 ;
COUNT(PATH,TYPE,ID,EIEN) ; EP-COUNT FILES WAITING TO BE PROCESSED
+1 IF '$LENGTH($GET(PATH))
QUIT 0
+2 NEW FILE,CNT,TMP
+3 SET CNT=0
SET TMP="^TMP(""VEN ERR CNT"","""_$JOB_""")"
KILL @TMP
+4 DO FILES(PATH,TMP)
IF '$DATA(@TMP)
QUIT 0
+5 SET FILE="z"
FOR
SET FILE=$ORDER(@TMP@(FILE))
IF $EXTRACT(FILE)'="z"
QUIT
Begin DoDot:1
+6 IF FILE'[".txt"
QUIT
+7 IF '$$OK(FILE,TYPE,ID,EIEN)
QUIT
+8 SET CNT=CNT+1
+9 QUIT
End DoDot:1
+10 KILL @TMP
+11 QUIT CNT
+12 ;
OK(FILE,TYPE,ID,EIEN) ; EP-DETERMINE IF A Z FILE IN PRINT DEAMON QUEUE MEETS SEARCH CRITERIA
+1 NEW OK,ERIEN,STG,ETYP,EID,MRPFLAG,PRGIEN
+2 SET OK=0
+3 ; ONLY COUNT "FAILED" FILES
IF $EXTRACT(FILE)'="z"
IF $EXTRACT(FILE)'="Z"
QUIT 0
+4 ; FAILED ER LOG LOOKUP
SET ERIEN=$ORDER(^VEN(7.7,"F",FILE,0))
IF ERIEN=""
QUIT 0
+5 IF TYPE=1
QUIT 1
+6 SET STG=$GET(^VEN(7.7,ERIEN,0))
IF '$LENGTH(STG)
QUIT 0
+7 SET ETYP=$PIECE(STG,U,12)
SET EID=$PIECE(STG,U,11)
IF ETYP
IF EID
+8 IF '$TEST
QUIT 0
+9 IF TYPE=4
IF EID=EIEN
QUIT 1
+10 IF TYPE'=2
QUIT 0
+11 ; MED REC PRINT GROUP BEING CALLED IN THIS TRANSACTION & MRPG ERROR IS ACTIVE
IF TYPE=2
IF ETYP=11
IF $PIECE($GET(^VEN(7.4,+$GET(ID),0)),U,2)
QUIT 1
+12 SET PRGIEN=$PIECE(STG,U,8)
IF 'PRGIEN
QUIT 0
+13 IF EID=EIEN
IF PRGIEN=ID
IF ETYP=2
QUIT 1
+14 QUIT 0
+15 ;
MERGFAIL(ACK,MRPFLAG,PGIEN) ; EP-MAIL MERGE FAILURES
+1 ; MAIL MERGE RESPONCE FAILURE
IF '$LENGTH(ACK)
DO REG(1,"Print service starts but fails to respond during mail merge process")
QUIT
+2 ; GENL PRINT SVC ERROR
IF ACK=-1
DO REG(4,"Microsoft Word Mail Merge failure")
QUIT
+3 ; OUT OF PAPER
IF ACK=-2
IF MRPFLAG
DO REG(11,"Medical Records Printer is turned off or is out of paper")
QUIT
+4 ; OUT OF PAPER
IF ACK=-2
DO REG(5,"Printer is turned off or is out of paper")
QUIT
+5 ; INVALID PRINTER GROUP
IF ACK=-3
DO REG(6,"An invalid printer group was requested during check in")
QUIT
+6 ; INVALID PRINTER
IF ACK=-4
DO REG(7,"Destination printer not found by Win 2K")
QUIT
+7 ; PRINT SERVICE BUSY
IF ACK=-5
DO REG(2,"Print Service unable to comply with request because it is too busy")
QUIT
+8 ; CHECKSUM ERROR
IF ACK=-6
DO REG(8,"Check sum error detected during data transmission")
QUIT
+9 ; START FAILURE
IF ACK=-7
DO REG(9,"Print Service reports it is unable to start successfully")
QUIT
+10 ; PRINT JOB FAILURE
IF ACK=-11
DO REG(12,"Print job failure. Can't access printer via LAN")
QUIT
+11 QUIT
+12 ;
UMSG(DEPTIEN,DEFEF,DEFHS,VARS) ; EP-USER MESSAGE
+1 NEW TMP,EIEN,%,CNT
+2 SET TMP="^TMP(""VEN ERROR FLAG"")"
+3 ; FATAL ERRORS
IF '$DATA(@TMP)
WRITE !,"PCC PLUS IS CURRENTLY OPERATING PROPERLY"
DO DOCS^VENPCC
QUIT 0
+4 IF $DATA(@TMP@(1))
Begin DoDot:1
+5 SET EIEN=$ORDER(@TMP@(1,0,0))
IF 'EIEN
QUIT
+6 SET CNT=@TMP@(1,0,EIEN)
+7 DO WARN(EIEN,1,CNT)
+8 QUIT
End DoDot:1
QUIT 1
+9 ; SYSTEM ERRORS
IF $DATA(@TMP@(4))
Begin DoDot:1
+10 SET EIEN=$ORDER(@TMP@(4,0,0))
IF 'EIEN
QUIT
+11 SET CNT=@TMP@(4,0,EIEN)
+12 DO WARN(EIEN,4,CNT)
+13 QUIT
End DoDot:1
QUIT 0
+14 IF 'DEPTIEN
QUIT 0
+15 ; PRINT GROUP ERRORS
NEW PGIEN,PGNAME
+16 IF $GET(DEFEF)
SET PGNAME=$$PG^VENPCC1(DEPTIEN,"e1")
DO UM1
QUIT 0
+17 IF $GET(DEFHS)
SET PGNAME=$$PG^VENPCC1(DEPTIEN,"h1")
DO UM1
QUIT 0
+18 IF VARS["OGFLAG=1"
SET PGNAME=$$PG^VENPCC1(DEPTIEN,"g1")
DO UM1
QUIT 0
+19 QUIT 0
+20 ;
UM1 IF '$LENGTH(PGNAME)
QUIT
+1 SET PGIEN=+$ORDER(^VEN(7.4,"B",PGNAME,0))
+2 IF 'PGIEN
QUIT
+3 IF '$DATA(@TMP@(2,+$GET(PGIEN)))
QUIT
+4 SET EIEN=$ORDER(@TMP@(2,PGIEN,0))
IF 'EIEN
QUIT
+5 SET CNT=@TMP@(2,PGIEN,EIEN)
+6 DO WARN(EIEN,1,CNT)
+7 QUIT
+8 ;
WARN(EIEN,TYPE,CNT) ; EP-PRINT USER WARNING
+1 NEW %
+2 SET %=$PIECE($GET(^VA(200,+$GET(DUZ),0)),U)
IF %=""
QUIT
+3 SET %=$PIECE(%,",",2,99)_" "_$PIECE(%,",")
+4 WRITE !!?10,"***** Important message for ",%," *****",!
+5 DO LIST(EIEN,1)
+6 WRITE !!,"Site manager contact info: "
+7 SET %=$GET(^VEN(7.5,+$$CFG^VENPCCU,4))
IF %=""
SET %="(NOT AVAILABLE)"
+8 WRITE %
+9 WRITE !!,"There ",$SELECT(CNT=1:"is",1:"are")," currently ",CNT," document",$SELECT(CNT=1:"",1:"s")," on the waiting list that failed to print."
+10 WRITE !,"ERROR ID #: ",EIEN," (Note this ID #. It may be requested by the site manager)"
+11 WRITE !!
+12 QUIT
+13 ;
LIST(EIEN,SS) ; EP-LIST THE WP MESSAGE
+1 NEW MIEN
+2 SET MIEN=0
FOR
SET MIEN=$ORDER(^VEN(7.71,+$GET(EIEN),SS,MIEN))
IF 'MIEN
QUIT
Begin DoDot:1
+3 WRITE !
+4 IF '(MIEN#20)
IF $$MORE
QUIT
+5 WRITE $GET(^VEN(7.71,EIEN,SS,MIEN,0))
+6 QUIT
End DoDot:1
+7 QUIT
+8 ;
MORE() ; EP-HOLD SCROLLING AT 20 LINES
+1 NEW %
+2 WRITE "<Press RETURN to keep scrolling>"
+3 READ %:$GET(DTIME,60)
IF '$TEST
QUIT 1
+4 IF %?1."^"
QUIT 1
+5 WRITE $CHAR(13),?79,$CHAR(13)
+6 QUIT 0
+7 ;
SMSG ; EP-SITE MANAGER MESSAGE
+1 NEW EIEN,X,DIC,Y,%,TYPE,ID,TMP
+2 SET TMP="^TMP(""VEN ERROR FLAG"")"
SET TYPE=0
+3 SET TYPE=$ORDER(@TMP@(TYPE))
IF TYPE
SET ID=+$ORDER(@TMP@(TYPE,""))
IF $LENGTH(ID)
SET %=$ORDER(@TMP@(TYPE,ID,0))
IF %
SET DIC("B")=%
+4 SET DIC("A")="Error ID NUMBER reported by Check-in Clerk: "
+5 SET DIC="^VEN(7.71,"
SET DIC(0)="AEQM"
+6 DO ^DIC
IF Y=-1
QUIT
+7 SET EIEN=+Y
+8 WRITE !!,"CAUSE OF PROBLEM: "
+9 DO LIST(EIEN,2)
+10 WRITE !!
IF $$MORE
QUIT
+11 WRITE "POSSIBLE SOLUTION: "
+12 DO LIST(EIEN,3)
+13 QUIT
+14 ;
FILES(PATH,TMP) ; EP-PUT LIST OF FILES TO BE PRINTED IN A ^TMP ARRAY
+1 IF $LENGTH(PATH)
IF $LENGTH(TMP)
+2 IF '$TEST
QUIT
+3 NEW STG,X,CNT,I,F,NEXT,PATH2,PATHX,CMD,%,FILE,CFIGIEN
+4 SET (NEXT,STG)=""
UNIX ; ALL UNIX SYSTEMS
IF $$OS^VENPCCU
Begin DoDot:1
+1 SET CFIGIEN=$$CFG^VENPCCU
+2 SET PATH2=$GET(^VEN(7.5,CFIGIEN,3))
SET PATHX=$EXTRACT(PATH,1,$LENGTH(PATH)-1)
+3 SET FILE="ven_"_+$JOB_".temp"
SET CMD="ls "_PATHX_" > "_PATH2_FILE
+4 DO UCMD^VENPCCP(CMD)
+5 SET POP=$$OPN^VENPCCP(PATH2,FILE,"R","F R X Q:'$L(X) S @TMP@(X)=""""")
+6 DO DEL^VENPCCP1(PATH2,FILE)
+7 QUIT
End DoDot:1
QUIT
CACHE ; CACHE/NT
IF $$VEN^VENPCCU=2
XECUTE ("F CNT=0:1 S FILE=$S('CNT:(PATH_""*.txt""),1:"""") S X="_$CHAR(36,90)_"SEARCH(FILE) Q:'$L(X) S X=$P(X,""\"",$L(X,""\"")) S @TMP@(X)=""""")
QUIT
MSM ; MSM/NT
SET %="S X=$"_"Z"_"O"
XECUTE (%_"S(12,"""_PATH_"*.txt"",0)")
IF '$LENGTH(X)
QUIT
+1 SET @TMP@($PIECE(X,U))=""
+2 FOR
Begin DoDot:1
+3 XECUTE (%_"S(13,X)")
+4 IF '$LENGTH(X)
QUIT
+5 SET @TMP@($PIECE(X,U))=""
+6 QUIT
End DoDot:1
IF '$LENGTH(X)
QUIT
+7 QUIT
+8 ;
RENAME(FILE,PATH) ; EP-IF TRANSMISSION FAILS RENAME FILE AS A "z" FILE.
+1 NEW %,R,CMD,STG,%
+2 SET %=$PIECE(FILE,".")
+3 SET R="z"_$EXTRACT(%,3,99)_$EXTRACT(FILE)_".txt"
+4 ; ALL FILES SHOULD HAVE LOWERCASE NAMES
SET R=$$LOW^XLFSTR(R)
+5 SET STG=" "_PATH_FILE_" "_PATH_R
+6 IF $$VEN^VENPCCU=2
SET CMD="copy"_STG
XECUTE ("S %=$"_"Z"_"F(-1,CMD)")
DO DEL^VENPCCP1(PATH,FILE)
HANG 1
QUIT R
+7 IF $$OS^VENPCCU
SET CMD="cp"_STG
DO UCMD^VENPCCP(CMD)
DO DEL^VENPCCP1(PATH,FILE)
QUIT R
+8 XECUTE ("S %=$"_"ZO"_"S(3,PATH_FILE,PATH_R)")
+9 QUIT R
+10 ;