OOPSWCSE ;WIOFO/LLH-Workers' Comp Sign for Employee ;01/20/01
;;2.0;ASISTS;;Jun 03, 2002
;
EN1(CALLER) ; Entry point for routine
; Input: CALLER = "S" for Safety Officer
; "H" for Employee Health
; "W" for Workers' Comp
;
N DIC,IEN,FORM,PRM1,PRM2,SIGN,VALID,Y
Q:DUZ<1
Q:$G(^VA(200,DUZ,1))=""
S IEN=0
S DIC="^OOPS(2260,"
S DIC("S")="I $$SCR^OOPSWCSE(Y)"_",'$$GET1^DIQ(2260,Y,51,""I"")"
S DIC(0)="AEMNZ",DIC("A")=" Select Case: "
D ^DIC
I (Y<1)!$D(DTOUT)!($D(DUOUT)) Q
S IEN=$P(Y,U)
S FORM=$$GET1^DIQ(2260,IEN,52,"I")
S FORM=$S(FORM=1:"CA1",FORM=2:"CA2",1:"")
I $G(FORM)="" Q
D ^OOPSDIS
S PRM1=$S(CALLER="S":"Safety Officer",CALLER="H":"Employee Health",1:0)
S PRM2=PRM1_" approves the WCP signing for the Employee: "
S SIGN=""
I CALLER="W" G WCPS4E
I $$VALID^OOPSWCSE() D
. W !,PRM2
. S SIGN=$$SIG^OOPSESIG(DUZ,IEN)
. Q:+SIGN=0 ; form not signed
. I CALLER="S" S $P(^OOPS(2260,IEN,"WCSE"),U,1,3)=SIGN
. I CALLER="H" S $P(^OOPS(2260,IEN,"WCSE"),U,4,6)=SIGN
G EXIT
WCPS4E ; allow WCP to sign for employee if all approvals given
N CONT,EHS,SIGN,SOS,VALID,VIEW
S SIGN=0,VALID=0,VIEW=1
S SOS=$$GET1^DIQ(2260,IEN,76,"I")
S EHS=$$GET1^DIQ(2260,IEN,79,"I")
S CONT=$S(DUZ=SOS:"S",DUZ=EHS:"H",1:"")
I (CONT="S")!(CONT="H") D
. W !,"You have approved as "_$S(CONT="S":"Safety Officer",CONT="H":"Emp Health Rep",1:"")
. W " and cannot sign as Employee."
. W !,"Three different individuals must be involved."
. S VIEW=0
I '$G(SOS) S VIEW=0 W !,"Safety Officer has not approved WCP signing for employee."
I '$G(EHS) S VIEW=0 W !,"Employee Health has not approved WCP signing for employee."
I VIEW D
. ; Allow clearing WCP signature, employee may be able to sign
. I $$GET1^DIQ(2260,IEN,119,"I") D CLRES^OOPSUTL1(IEN,"E",FORM)
. W ! D VALIDATE^OOPSUTL4(IEN,FORM,"E",.VALID)
. I 'VALID Q
. S SIGN=$$SIG^OOPSESIG(DUZ,IEN)
. Q:+SIGN=0
. D EMP^OOPSVAL1
EXIT ;
K DTOUT,DUOUT,SUP ; left over from OOPSDIS
Q
VALID() ; make sure same person is not signing for both safety and EH and if
; signed from menu option being called not needed again - so quit
N CONT,EHAPP,ERR,SOAPP,VALID
S VALID=1,ERR=0
S SOAPP=$P($G(^OOPS(2260,IEN,"WCSE")),U)
S EHAPP=$P($G(^OOPS(2260,IEN,"WCSE")),U,4)
S CONT=$S(DUZ=SOAPP:"S",DUZ=EHAPP:"H",1:"")
I CALLER="S" D
. I CONT="S" S ERR=1
. I $G(EHAPP)=DUZ S ERR=2
. I $G(SOAPP)&($G(CONT)="") S ERR=3
I CALLER="H" D
. I CONT="H" S ERR=1
. I $G(SOAPP)=DUZ S ERR=2
. I $G(EHAPP)&($G(CONT)="") S ERR=3
I ERR=1 D
. W !,"You have signed as "_PRM1_" if you continue, your ES will be removed"
. N DIR,FLD,Y
. W !
. S DIR("A")="Continue",DIR(0)="SBM^Y:Yes;N:No"
. D ^DIR
. I Y="Y" D
.. S FLD=$S(CALLER="S":"1,3",CALLER="H":"4,6",1:"")
.. F I=$P(FLD,","):1:$P(FLD,",",2) S $P(^OOPS(2260,IEN,"WCSE"),U,I)=""
. I Y'="Y" S VALID=0
I ERR=2 D
. W !,"You have already signed as "
. W $S(CALLER="S":"Employee Health",CALLER="H":"Safety Officer",1:0)
. W ".",!,"Both signatures cannot be made by the same person."
. S VALID=0
I ERR=3 D
. W !,PRM1_" has already signed, re-signing is not required."
. S VALID=0
Q VALID
SCR(IEN) ; Screen to allow access to claims that have not been
; signed by the Employee
; Input: IEN = Internal record number of claim
N VIEW,EES,ESTAT,FORM,FLD
S VIEW=1
S FORM=$$GET1^DIQ(2260,IEN,52,"I")
I '$$ISEMP^OOPSUTL4(IEN) S VIEW=0 ; not emp, can't sign
S ESTAT=$$EDSTA^OOPSUTL1(IEN,"E") ; employee signed?
I CALLER'="W",$P(ESTAT,U,FORM) S VIEW=0 ; employee signed
I CALLER="W" D ; from WC menu
. S FLD=$S(FORM=1:119,FORM=2:221,1:"")
. I 'FLD S VIEW=0 Q
. S EES=$$GET1^DIQ(2260,IEN,FLD,"I")
. I 'EES Q ; not signed by emp
. I EES'=DUZ S VIEW=0 Q ; signer = user
. I $P($$EDSTA^OOPSUTL1(IEN,"S"),U,FORM) S VIEW=0 ; Super Signed
Q VIEW
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HOOPSWCSE 4094 printed Dec 13, 2024@01:39:55 Page 2
OOPSWCSE ;WIOFO/LLH-Workers' Comp Sign for Employee ;01/20/01
+1 ;;2.0;ASISTS;;Jun 03, 2002
+2 ;
EN1(CALLER) ; Entry point for routine
+1 ; Input: CALLER = "S" for Safety Officer
+2 ; "H" for Employee Health
+3 ; "W" for Workers' Comp
+4 ;
+5 NEW DIC,IEN,FORM,PRM1,PRM2,SIGN,VALID,Y
+6 if DUZ<1
QUIT
+7 if $GET(^VA(200,DUZ,1))=""
QUIT
+8 SET IEN=0
+9 SET DIC="^OOPS(2260,"
+10 SET DIC("S")="I $$SCR^OOPSWCSE(Y)"_",'$$GET1^DIQ(2260,Y,51,""I"")"
+11 SET DIC(0)="AEMNZ"
SET DIC("A")=" Select Case: "
+12 DO ^DIC
+13 IF (Y<1)!$DATA(DTOUT)!($DATA(DUOUT))
QUIT
+14 SET IEN=$PIECE(Y,U)
+15 SET FORM=$$GET1^DIQ(2260,IEN,52,"I")
+16 SET FORM=$SELECT(FORM=1:"CA1",FORM=2:"CA2",1:"")
+17 IF $GET(FORM)=""
QUIT
+18 DO ^OOPSDIS
+19 SET PRM1=$SELECT(CALLER="S":"Safety Officer",CALLER="H":"Employee Health",1:0)
+20 SET PRM2=PRM1_" approves the WCP signing for the Employee: "
+21 SET SIGN=""
+22 IF CALLER="W"
GOTO WCPS4E
+23 IF $$VALID^OOPSWCSE()
Begin DoDot:1
+24 WRITE !,PRM2
+25 SET SIGN=$$SIG^OOPSESIG(DUZ,IEN)
+26 ; form not signed
if +SIGN=0
QUIT
+27 IF CALLER="S"
SET $PIECE(^OOPS(2260,IEN,"WCSE"),U,1,3)=SIGN
+28 IF CALLER="H"
SET $PIECE(^OOPS(2260,IEN,"WCSE"),U,4,6)=SIGN
End DoDot:1
+29 GOTO EXIT
WCPS4E ; allow WCP to sign for employee if all approvals given
+1 NEW CONT,EHS,SIGN,SOS,VALID,VIEW
+2 SET SIGN=0
SET VALID=0
SET VIEW=1
+3 SET SOS=$$GET1^DIQ(2260,IEN,76,"I")
+4 SET EHS=$$GET1^DIQ(2260,IEN,79,"I")
+5 SET CONT=$SELECT(DUZ=SOS:"S",DUZ=EHS:"H",1:"")
+6 IF (CONT="S")!(CONT="H")
Begin DoDot:1
+7 WRITE !,"You have approved as "_$SELECT(CONT="S":"Safety Officer",CONT="H":"Emp Health Rep",1:"")
+8 WRITE " and cannot sign as Employee."
+9 WRITE !,"Three different individuals must be involved."
+10 SET VIEW=0
End DoDot:1
+11 IF '$GET(SOS)
SET VIEW=0
WRITE !,"Safety Officer has not approved WCP signing for employee."
+12 IF '$GET(EHS)
SET VIEW=0
WRITE !,"Employee Health has not approved WCP signing for employee."
+13 IF VIEW
Begin DoDot:1
+14 ; Allow clearing WCP signature, employee may be able to sign
+15 IF $$GET1^DIQ(2260,IEN,119,"I")
DO CLRES^OOPSUTL1(IEN,"E",FORM)
+16 WRITE !
DO VALIDATE^OOPSUTL4(IEN,FORM,"E",.VALID)
+17 IF 'VALID
QUIT
+18 SET SIGN=$$SIG^OOPSESIG(DUZ,IEN)
+19 if +SIGN=0
QUIT
+20 DO EMP^OOPSVAL1
End DoDot:1
EXIT ;
+1 ; left over from OOPSDIS
KILL DTOUT,DUOUT,SUP
+2 QUIT
VALID() ; make sure same person is not signing for both safety and EH and if
+1 ; signed from menu option being called not needed again - so quit
+2 NEW CONT,EHAPP,ERR,SOAPP,VALID
+3 SET VALID=1
SET ERR=0
+4 SET SOAPP=$PIECE($GET(^OOPS(2260,IEN,"WCSE")),U)
+5 SET EHAPP=$PIECE($GET(^OOPS(2260,IEN,"WCSE")),U,4)
+6 SET CONT=$SELECT(DUZ=SOAPP:"S",DUZ=EHAPP:"H",1:"")
+7 IF CALLER="S"
Begin DoDot:1
+8 IF CONT="S"
SET ERR=1
+9 IF $GET(EHAPP)=DUZ
SET ERR=2
+10 IF $GET(SOAPP)&($GET(CONT)="")
SET ERR=3
End DoDot:1
+11 IF CALLER="H"
Begin DoDot:1
+12 IF CONT="H"
SET ERR=1
+13 IF $GET(SOAPP)=DUZ
SET ERR=2
+14 IF $GET(EHAPP)&($GET(CONT)="")
SET ERR=3
End DoDot:1
+15 IF ERR=1
Begin DoDot:1
+16 WRITE !,"You have signed as "_PRM1_" if you continue, your ES will be removed"
+17 NEW DIR,FLD,Y
+18 WRITE !
+19 SET DIR("A")="Continue"
SET DIR(0)="SBM^Y:Yes;N:No"
+20 DO ^DIR
+21 IF Y="Y"
Begin DoDot:2
+22 SET FLD=$SELECT(CALLER="S":"1,3",CALLER="H":"4,6",1:"")
+23 FOR I=$PIECE(FLD,","):1:$PIECE(FLD,",",2)
SET $PIECE(^OOPS(2260,IEN,"WCSE"),U,I)=""
End DoDot:2
+24 IF Y'="Y"
SET VALID=0
End DoDot:1
+25 IF ERR=2
Begin DoDot:1
+26 WRITE !,"You have already signed as "
+27 WRITE $SELECT(CALLER="S":"Employee Health",CALLER="H":"Safety Officer",1:0)
+28 WRITE ".",!,"Both signatures cannot be made by the same person."
+29 SET VALID=0
End DoDot:1
+30 IF ERR=3
Begin DoDot:1
+31 WRITE !,PRM1_" has already signed, re-signing is not required."
+32 SET VALID=0
End DoDot:1
+33 QUIT VALID
SCR(IEN) ; Screen to allow access to claims that have not been
+1 ; signed by the Employee
+2 ; Input: IEN = Internal record number of claim
+3 NEW VIEW,EES,ESTAT,FORM,FLD
+4 SET VIEW=1
+5 SET FORM=$$GET1^DIQ(2260,IEN,52,"I")
+6 ; not emp, can't sign
IF '$$ISEMP^OOPSUTL4(IEN)
SET VIEW=0
+7 ; employee signed?
SET ESTAT=$$EDSTA^OOPSUTL1(IEN,"E")
+8 ; employee signed
IF CALLER'="W"
IF $PIECE(ESTAT,U,FORM)
SET VIEW=0
+9 ; from WC menu
IF CALLER="W"
Begin DoDot:1
+10 SET FLD=$SELECT(FORM=1:119,FORM=2:221,1:"")
+11 IF 'FLD
SET VIEW=0
QUIT
+12 SET EES=$$GET1^DIQ(2260,IEN,FLD,"I")
+13 ; not signed by emp
IF 'EES
QUIT
+14 ; signer = user
IF EES'=DUZ
SET VIEW=0
QUIT
+15 ; Super Signed
IF $PIECE($$EDSTA^OOPSUTL1(IEN,"S"),U,FORM)
SET VIEW=0
End DoDot:1
+16 QUIT VIEW