OOPSGUI2 ;WIOFO/CVW-RPC routines ;9/19/01
;;2.0;ASISTS;**2,4,8**;Jun 03, 2002
;
GET(RESULTS,INPUT) ; Get Case data from 2260 or 2264
;NOTE: changed in patch 5 to set the file to retrieve data from
; based on the form sent in.
; Input: INPUT - IEN^FORM where IEN = ASISTS IEN and
; FORM = Either "CA1","CA2","CA7","2162", or "DUAL"
; Output: RESULTS - Array of data from the file, each element in the
; is based on the field number in the file.
N NODE,PIECE,FNUM,IEN,VAR,FORM,FLDCNT,INVFLDS,FILE
;Define fields that should never be returned
S INVFLDS="^19^20^21^22^23^24^25^122^224^"
S IEN=+$G(INPUT),FORM=$P($G(INPUT),U,2),FLDCNT=0
I '$G(IEN) Q
S FILE=2260 I $G(FORM)="CA7" S FILE=2264,INVFLDS=""
I '$D(^OOPS(FILE,$G(IEN),0)) D Q
. S (RESULTS,RESULTS(1))="-1^IEN:"_IEN_" not found in the file"
I "CA1^CA2^CA7^2162^DUAL"'[FORM!(FORM="") D Q
. S (RESULTS,RESULTS(1))="-2^FORM:"_FORM_" not valid, must be CA1, CA2, CA7, DUAL or 2162"
S NODE="" F S NODE=$O(^DD(FILE,"GL",NODE)) Q:NODE="" D
.S PIECE=0 F S PIECE=$O(^DD(FILE,"GL",NODE,PIECE)) Q:PIECE="" D
..S FNUM=0 F S FNUM=$O(^DD(FILE,"GL",NODE,PIECE,FNUM)) Q:FNUM="" D
...I INVFLDS[("^"_FNUM_"^") Q
...I ($E(NODE,1,$L(FORM))'=FORM),(NODE'=0),(NODE'="CA"),(NODE'["WC"),(NODE'["DUAL") Q
...;patch 5 if form = DUAL, only get DUAL nodes (there are 2) data
...I FORM["DUAL",($E(NODE,1,4)="DUAL") D
....S RESULTS(FNUM)=$$GET1^DIQ(FILE,IEN,FNUM)
...I FORM'="DUAL",($E(NODE,1,4)'="DUAL") D
....S RESULTS(FNUM)=$$GET1^DIQ(FILE,IEN,FNUM)
....I FILE=2260 D
.....I FNUM=13 S RESULTS(FNUM)=RESULTS(FNUM)_" = "_$$GET1^DIQ(2260,IEN,FNUM_":99")
.....I FNUM=53!(FNUM=53.1) S RESULTS(FNUM)=RESULTS(FNUM)_"^"_$$GET1^DIQ(2260,IEN,FNUM,"I")
.....I FNUM=76!(FNUM=79) S RESULTS(FNUM)=$$GET1^DIQ(2260,IEN,FNUM,"I")
...S FLDCNT=FLDCNT+1
Q
WITR(RESULTS,IEN) ;Return entries from the witness multiple
; Input: IEN - The ASISTS IEN used to pull info from file 2260.
; Output: RESULTS - array with Witness data and associated comment
;
N SUBN,COUNT,STATE,WDT
S (SUBN,COUNT)=0,(STATE,WDT)=""
F S SUBN=$O(^OOPS(2260,IEN,"CA1W",SUBN)) Q:'SUBN D
. S RESULTS(COUNT)=$G(^OOPS(2260,IEN,"CA1W",SUBN,0))
. S STATE=$$EXTERNAL^DILFD(2260.0125,3,"",$P(RESULTS(COUNT),U,4))
. S WDT=$$EXTERNAL^DILFD(2260.0125,5,"",$P(RESULTS(COUNT),U,6))
. S $P(RESULTS(COUNT),U,4)=STATE,$P(RESULTS(COUNT),U,6)=WDT
. S $P(RESULTS(COUNT),U,7)=SUBN
. S COUNT=COUNT+1
. S RESULTS(COUNT)=$G(^OOPS(2260,IEN,"CA1W",SUBN,1))
. S COUNT=COUNT+1
Q
DEFMD(RESULTS,IEN) ;
;Send in the Case IEN, return an array of
;(0)="1^Valid Results" or "0^No Valid Results"
;(1)=PROVIDER NAME
;(2)=PROVIDER ADDRESS
;(3)=PROVIDER CITY
;(4)=PROVIDER STATE
;(5)=PROVIDER ZIP CODE
;(6)=PROVIDER TITLE
N STA,PSTA,PIEN
S (STA,PSTA,PIEN)=""
S RESULTS(0)="0^No Valid Results"
Q:+IEN'>0
S STA=$P($G(^OOPS(2260,IEN,"2162A")),U,9)
Q:+STA'>0
S PIEN=$O(^OOPS(2262,1,1,"B",STA,PIEN))
Q:+PIEN'>0
I $P($G(^OOPS(2262,1,1,PIEN,0)),U,2)'="" D
.S RESULTS(0)="1^Valid Results"
.S RESULTS(1)=$P($G(^OOPS(2262,1,1,PIEN,0)),U,2)
.S RESULTS(2)=$P($G(^OOPS(2262,1,1,PIEN,0)),U,3)
.S RESULTS(3)=$P($G(^OOPS(2262,1,1,PIEN,0)),U,4)
.S PSTA=$$FIND1^DIC(2262.03,",1,","Q",STA)
.I PSTA S PSTA=PSTA_",1," S RESULTS(4)=$$GET1^DIQ(2262.03,PSTA,"4:.01")
.S RESULTS(5)=$P($G(^OOPS(2262,1,1,PIEN,0)),U,6)
.S RESULTS(6)=$P($G(^OOPS(2262,1,1,PIEN,0)),U,7)
.S RESULTS(6)=$$EXTERNAL^DILFD(2262.03,6,"",RESULTS(6))
Q
REPLWP(RESULTS,INPUT,DATA) ;
;Replace Word Processing Fields
; Input: INPUT - The file, field and IEN of record to WP field to
; be changed in the format FILE^FIELD^IEN
; Input DATA - List or pointer for data that is to replace the
; existing WP data.
; Output: RESULTS - array with results or messages.
; Retrieve file and field information.
N FILE,FIELD,IEN,ROOT,NODE,LINE,CNT,NEWTXT
S FILE=$P($G(INPUT),U),FIELD=$P($G(INPUT),U,2),IEN=$P($G(INPUT),U,3)
S ROOT=$$ROOT^DILFD(FILE,0,"GL")
S NODE=$$GET1^DID(FILE,FIELD,"","GLOBAL SUBSCRIPT LOCATION")
S NODE=$P(NODE,";",1)
; Kill the existing WP data/node
K @(ROOT_"IEN,NODE)")
; Insert the new data
S (LINE,CNT)=0
K NEWTXT
F D Q:+LINE'>0
.S LINE=$O(DATA(LINE)) Q:+LINE'>0 S CNT=LINE
.S NEWTXT=$G(DATA(LINE))
.S @(ROOT_"IEN,NODE,LINE,0)")=NEWTXT
S @(ROOT_"IEN,NODE,0)")="^^"_CNT_"^"_CNT_"^"_DT_"^^"
Q
DTVALID(RESULTS,IDT,PDT,FLAG) ;Compare Date(s)/Time(s)
; Input IDT - This is the base date/time in external form
; PDT - This is the compare date/time in external form
; FLAG - -2 means PDT must be < IDT (The DAY only)
; FLAG - -1 means PDT must be < IDT (The DAY&TIME)
; FLAG - 1 means PDT must be > IDT (The DAY&TIME)
; FLAG - 2 means PDT must be > IDT (The DAY only)
;Output RESULTS - "VALID DATE" for valid, "DATE ERROR" for invalid
S FLAG=+$G(FLAG)
I FLAG="" S RESULTS(0)="FLAG ERROR" Q
I IDT="" S RESULTS(0)="DATE ERROR" Q
I PDT="" S RESULTS(0)="DATE ERROR" Q
S IDT=$$DTI^OOPSGUI2(IDT)
S PDT=$$DTI^OOPSGUI2(PDT)
I FLAG=-2 D
.S IDT=$P(IDT,"."),PDT=$P(PDT,".")
.I (PDT<IDT)!(PDT=IDT) S RESULTS(0)="VALID DATE" Q
.I PDT>IDT S RESULTS(0)="DATE ERROR" Q
I FLAG=-1 D
.I PDT<IDT S RESULTS(0)="VALID DATE" Q
.I (PDT>IDT)!(PDT=IDT) S RESULTS(0)="DATE ERROR" Q
I FLAG=0 D
.I PDT=IDT S RESULTS(0)="VALID DATE" Q
.I (PDT<IDT)!(PDT>IDT) S RESULTS(0)="DATE ERROR" Q
I FLAG=1 D
.I PDT>IDT S RESULTS(0)="VALID DATE" Q
.I (PDT<IDT)!(PDT=IDT) S RESULTS(0)="DATE ERROR" Q
I FLAG=2 D
.S IDT=$P(IDT,"."),PDT=$P(PDT,".")
.I (PDT>IDT)!(PDT=IDT) S RESULTS(0)="VALID DATE" Q
.I PDT<IDT S RESULTS(0)="DATE ERROR" Q
Q
DTI(X) ;Convert and External date to an internal one
N Y,%DT
S %DT="T" D ^%DT
Q Y
SETFIELD(RESULTS,INPUT,VALUE) ;Set a single field in file 2260
;Input - INPUT Contains the IEN of the record and the field number to
; be modified in the format IEN^FIELD
; VALUE This required parm is the external value to be used.
;Output - RESULTS - status message of the file/set.
N DA,DIE,DR,IEN,FLDNUM
S DR=""
S RESULTS(0)="UPDATE FAILED"
S IEN=$P($G(INPUT),U)
I '$G(IEN) Q
S FLDNUM=$P($G(INPUT),U,2)
I '$D(^OOPS(2260,IEN,0))!(FLDNUM="") Q
S DIE="^OOPS(2260,",DA=IEN
S DR(1,2260,1)=FLDNUM_"///^S X=VALUE"
D ^DIE
I $G(Y)="" D
. S RESULTS(0)="UPDATE COMPLETE"
. ; if setting field 71, need to send bulletin
. I FLDNUM=71,($$GET1^DIQ(2260,IEN,71,"I")'="Y") D WCPBOR^OOPSMBUL(IEN)
. ; 01/02/04 Patch 4 llh - if case closed, sent bulletin
. I FLDNUM=51,(VALUE="Closed") D CLSCASE^OOPSMBUL(IEN)
Q
ADDWITN(RESULTS,IEN,INFO,COMMENT) ;Add Witness info for IEN in 2260
; Input - IEN - IEN of case that needs witness info created.
; INFO - Name, Street, City, State, Zip, Date of Witness in
; format, NAME^STREET^CITY^STATE^ZIP
; COMMENT - Witness Comment Text
; Output - RESULTS Text indicating status of insert
N DR,DIE,DA,DIC,DD,DO,DLAYGO,INPUT,NAME,STREET,CITY,STATE,ZIP,WITDATE
S RESULTS(0)="WITNESS CREATION FAILED"
I '$G(IEN) Q
I '$D(^OOPS(2260,IEN,0)) Q
S DA(1)=IEN
S DLAYGO=2260,DIC="^OOPS(2260,"_DA(1)_",""CA1W"","
S DIC(0)="L"
S X=$P(INFO,U)
D FILE^DICN
S DA=+Y
S DIE="^OOPS(2260,"_DA(1)_",""CA1W"",",DR=""
I DA=-1 Q
S NAME=$P($G(INFO),U)
S STREET=$P($G(INFO),U,2)
S CITY=$P($G(INFO),U,3)
S STATE=$P($G(INFO),U,4)
S ZIP=$P($G(INFO),U,5)
S WITDATE=$P($G(INFO),U,6)
S DR(1,2260.0125,1)=".01///^S X=NAME"
S DR(1,2260.0125,2)="1///^S X=STREET"
S DR(1,2260.0125,3)="2///^S X=CITY"
S DR(1,2260.0125,4)="3///^S X=STATE"
S DR(1,2260.0125,5)="4///^S X=ZIP"
S DR(1,2260.0125,6)="5///^S X=WITDATE"
D ^DIE
S DR="6///^S X=COMMENT"
D ^DIE
S RESULTS(0)="WITNESS CREATION SUCCESSFUL"
Q
DELWITN(RESULTS,INPUT) ;Deletes the Witness information for a claim
; Input - INPUT, this is the IEN for the case and the witness number
; format IEN^witness number for the selected witness
; Output - RESULTS - String indicating the status of the delete
N DA,DIK,IEN,WITNO
S RESULTS(0)="DELETION FAILED"
I INPUT="" Q
S IEN=$P($G(INPUT),U)
I '$G(IEN) Q
S WITNO=$P($G(INPUT),U,2)
I '$G(WITNO) Q
I '$D(^OOPS(2260,IEN,"CA1W",WITNO,0)) Q
S DA(1)=IEN
S DA=WITNO
S DIK="^OOPS(2260,"_DA(1)_",""CA1W"","
D ^DIK
I $G(Y)'="" D Q
.S RESULTS(0)="SUCCESSFULLY DELETED"
Q
EDTWITN(RESULTS,INPUT,INFO,COMMENT) ;Update Witness Info for 2260 rec
; Input:INPUT - IEN and Witness Number in format IEN^WIT
; INFO - Name, Street, City, State, Zip, Date of Witness in
; format, NAME^STREET^CITY^STATE^ZIP
; COMMENT - Text of Witness comment
; Output:RESULTS - String listing result of update.
N DA,DIE,DR,NAME,STREET,CITY,STATE,ZIP,WITDATE,IEN,WITNO
S RESULTS(0)="EDIT FAILED"
S IEN=$P($G(INPUT),U)
S WITNO=$P($G(INPUT),U,2)
I '$D(^OOPS(2260,IEN,"CA1W",WITNO,0)) Q
S DA(1)=IEN,DR=""
S DA=WITNO
S DIE="^OOPS(2260,"_DA(1)_",""CA1W"","
S NAME=$P($G(INFO),U)
S STREET=$P($G(INFO),U,2)
S CITY=$P($G(INFO),U,3)
S STATE=$P($G(INFO),U,4)
S ZIP=$P($G(INFO),U,5)
S WITDATE=$P($G(INFO),U,6)
S DR(1,2260.0125,1)=".01///^S X=NAME"
S DR(1,2260.0125,2)="1///^S X=STREET"
S DR(1,2260.0125,3)="2///^S X=CITY"
S DR(1,2260.0125,4)="3///^S X=STATE"
S DR(1,2260.0125,5)="4///^S X=ZIP"
S DR(1,2260.0125,6)="5///^S X=WITDATE"
D ^DIE
S DR="6///^S X=COMMENT"
D ^DIE
S RESULTS(0)="EDIT SUCCESSFULL"
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HOOPSGUI2 9636 printed Oct 16, 2024@17:39:52 Page 2
OOPSGUI2 ;WIOFO/CVW-RPC routines ;9/19/01
+1 ;;2.0;ASISTS;**2,4,8**;Jun 03, 2002
+2 ;
GET(RESULTS,INPUT) ; Get Case data from 2260 or 2264
+1 ;NOTE: changed in patch 5 to set the file to retrieve data from
+2 ; based on the form sent in.
+3 ; Input: INPUT - IEN^FORM where IEN = ASISTS IEN and
+4 ; FORM = Either "CA1","CA2","CA7","2162", or "DUAL"
+5 ; Output: RESULTS - Array of data from the file, each element in the
+6 ; is based on the field number in the file.
+7 NEW NODE,PIECE,FNUM,IEN,VAR,FORM,FLDCNT,INVFLDS,FILE
+8 ;Define fields that should never be returned
+9 SET INVFLDS="^19^20^21^22^23^24^25^122^224^"
+10 SET IEN=+$GET(INPUT)
SET FORM=$PIECE($GET(INPUT),U,2)
SET FLDCNT=0
+11 IF '$GET(IEN)
QUIT
+12 SET FILE=2260
IF $GET(FORM)="CA7"
SET FILE=2264
SET INVFLDS=""
+13 IF '$DATA(^OOPS(FILE,$GET(IEN),0))
Begin DoDot:1
+14 SET (RESULTS,RESULTS(1))="-1^IEN:"_IEN_" not found in the file"
End DoDot:1
QUIT
+15 IF "CA1^CA2^CA7^2162^DUAL"'[FORM!(FORM="")
Begin DoDot:1
+16 SET (RESULTS,RESULTS(1))="-2^FORM:"_FORM_" not valid, must be CA1, CA2, CA7, DUAL or 2162"
End DoDot:1
QUIT
+17 SET NODE=""
FOR
SET NODE=$ORDER(^DD(FILE,"GL",NODE))
if NODE=""
QUIT
Begin DoDot:1
+18 SET PIECE=0
FOR
SET PIECE=$ORDER(^DD(FILE,"GL",NODE,PIECE))
if PIECE=""
QUIT
Begin DoDot:2
+19 SET FNUM=0
FOR
SET FNUM=$ORDER(^DD(FILE,"GL",NODE,PIECE,FNUM))
if FNUM=""
QUIT
Begin DoDot:3
+20 IF INVFLDS[("^"_FNUM_"^")
QUIT
+21 IF ($EXTRACT(NODE,1,$LENGTH(FORM))'=FORM)
IF (NODE'=0)
IF (NODE'="CA")
IF (NODE'["WC")
IF (NODE'["DUAL")
QUIT
+22 ;patch 5 if form = DUAL, only get DUAL nodes (there are 2) data
+23 IF FORM["DUAL"
IF ($EXTRACT(NODE,1,4)="DUAL")
Begin DoDot:4
+24 SET RESULTS(FNUM)=$$GET1^DIQ(FILE,IEN,FNUM)
End DoDot:4
+25 IF FORM'="DUAL"
IF ($EXTRACT(NODE,1,4)'="DUAL")
Begin DoDot:4
+26 SET RESULTS(FNUM)=$$GET1^DIQ(FILE,IEN,FNUM)
+27 IF FILE=2260
Begin DoDot:5
+28 IF FNUM=13
SET RESULTS(FNUM)=RESULTS(FNUM)_" = "_$$GET1^DIQ(2260,IEN,FNUM_":99")
+29 IF FNUM=53!(FNUM=53.1)
SET RESULTS(FNUM)=RESULTS(FNUM)_"^"_$$GET1^DIQ(2260,IEN,FNUM,"I")
+30 IF FNUM=76!(FNUM=79)
SET RESULTS(FNUM)=$$GET1^DIQ(2260,IEN,FNUM,"I")
End DoDot:5
End DoDot:4
+31 SET FLDCNT=FLDCNT+1
End DoDot:3
End DoDot:2
End DoDot:1
+32 QUIT
WITR(RESULTS,IEN) ;Return entries from the witness multiple
+1 ; Input: IEN - The ASISTS IEN used to pull info from file 2260.
+2 ; Output: RESULTS - array with Witness data and associated comment
+3 ;
+4 NEW SUBN,COUNT,STATE,WDT
+5 SET (SUBN,COUNT)=0
SET (STATE,WDT)=""
+6 FOR
SET SUBN=$ORDER(^OOPS(2260,IEN,"CA1W",SUBN))
if 'SUBN
QUIT
Begin DoDot:1
+7 SET RESULTS(COUNT)=$GET(^OOPS(2260,IEN,"CA1W",SUBN,0))
+8 SET STATE=$$EXTERNAL^DILFD(2260.0125,3,"",$PIECE(RESULTS(COUNT),U,4))
+9 SET WDT=$$EXTERNAL^DILFD(2260.0125,5,"",$PIECE(RESULTS(COUNT),U,6))
+10 SET $PIECE(RESULTS(COUNT),U,4)=STATE
SET $PIECE(RESULTS(COUNT),U,6)=WDT
+11 SET $PIECE(RESULTS(COUNT),U,7)=SUBN
+12 SET COUNT=COUNT+1
+13 SET RESULTS(COUNT)=$GET(^OOPS(2260,IEN,"CA1W",SUBN,1))
+14 SET COUNT=COUNT+1
End DoDot:1
+15 QUIT
DEFMD(RESULTS,IEN) ;
+1 ;Send in the Case IEN, return an array of
+2 ;(0)="1^Valid Results" or "0^No Valid Results"
+3 ;(1)=PROVIDER NAME
+4 ;(2)=PROVIDER ADDRESS
+5 ;(3)=PROVIDER CITY
+6 ;(4)=PROVIDER STATE
+7 ;(5)=PROVIDER ZIP CODE
+8 ;(6)=PROVIDER TITLE
+9 NEW STA,PSTA,PIEN
+10 SET (STA,PSTA,PIEN)=""
+11 SET RESULTS(0)="0^No Valid Results"
+12 if +IEN'>0
QUIT
+13 SET STA=$PIECE($GET(^OOPS(2260,IEN,"2162A")),U,9)
+14 if +STA'>0
QUIT
+15 SET PIEN=$ORDER(^OOPS(2262,1,1,"B",STA,PIEN))
+16 if +PIEN'>0
QUIT
+17 IF $PIECE($GET(^OOPS(2262,1,1,PIEN,0)),U,2)'=""
Begin DoDot:1
+18 SET RESULTS(0)="1^Valid Results"
+19 SET RESULTS(1)=$PIECE($GET(^OOPS(2262,1,1,PIEN,0)),U,2)
+20 SET RESULTS(2)=$PIECE($GET(^OOPS(2262,1,1,PIEN,0)),U,3)
+21 SET RESULTS(3)=$PIECE($GET(^OOPS(2262,1,1,PIEN,0)),U,4)
+22 SET PSTA=$$FIND1^DIC(2262.03,",1,","Q",STA)
+23 IF PSTA
SET PSTA=PSTA_",1,"
SET RESULTS(4)=$$GET1^DIQ(2262.03,PSTA,"4:.01")
+24 SET RESULTS(5)=$PIECE($GET(^OOPS(2262,1,1,PIEN,0)),U,6)
+25 SET RESULTS(6)=$PIECE($GET(^OOPS(2262,1,1,PIEN,0)),U,7)
+26 SET RESULTS(6)=$$EXTERNAL^DILFD(2262.03,6,"",RESULTS(6))
End DoDot:1
+27 QUIT
REPLWP(RESULTS,INPUT,DATA) ;
+1 ;Replace Word Processing Fields
+2 ; Input: INPUT - The file, field and IEN of record to WP field to
+3 ; be changed in the format FILE^FIELD^IEN
+4 ; Input DATA - List or pointer for data that is to replace the
+5 ; existing WP data.
+6 ; Output: RESULTS - array with results or messages.
+7 ; Retrieve file and field information.
+8 NEW FILE,FIELD,IEN,ROOT,NODE,LINE,CNT,NEWTXT
+9 SET FILE=$PIECE($GET(INPUT),U)
SET FIELD=$PIECE($GET(INPUT),U,2)
SET IEN=$PIECE($GET(INPUT),U,3)
+10 SET ROOT=$$ROOT^DILFD(FILE,0,"GL")
+11 SET NODE=$$GET1^DID(FILE,FIELD,"","GLOBAL SUBSCRIPT LOCATION")
+12 SET NODE=$PIECE(NODE,";",1)
+13 ; Kill the existing WP data/node
+14 KILL @(ROOT_"IEN,NODE)")
+15 ; Insert the new data
+16 SET (LINE,CNT)=0
+17 KILL NEWTXT
+18 FOR
Begin DoDot:1
+19 SET LINE=$ORDER(DATA(LINE))
if +LINE'>0
QUIT
SET CNT=LINE
+20 SET NEWTXT=$GET(DATA(LINE))
+21 SET @(ROOT_"IEN,NODE,LINE,0)")=NEWTXT
End DoDot:1
if +LINE'>0
QUIT
+22 SET @(ROOT_"IEN,NODE,0)")="^^"_CNT_"^"_CNT_"^"_DT_"^^"
+23 QUIT
DTVALID(RESULTS,IDT,PDT,FLAG) ;Compare Date(s)/Time(s)
+1 ; Input IDT - This is the base date/time in external form
+2 ; PDT - This is the compare date/time in external form
+3 ; FLAG - -2 means PDT must be < IDT (The DAY only)
+4 ; FLAG - -1 means PDT must be < IDT (The DAY&TIME)
+5 ; FLAG - 1 means PDT must be > IDT (The DAY&TIME)
+6 ; FLAG - 2 means PDT must be > IDT (The DAY only)
+7 ;Output RESULTS - "VALID DATE" for valid, "DATE ERROR" for invalid
+8 SET FLAG=+$GET(FLAG)
+9 IF FLAG=""
SET RESULTS(0)="FLAG ERROR"
QUIT
+10 IF IDT=""
SET RESULTS(0)="DATE ERROR"
QUIT
+11 IF PDT=""
SET RESULTS(0)="DATE ERROR"
QUIT
+12 SET IDT=$$DTI^OOPSGUI2(IDT)
+13 SET PDT=$$DTI^OOPSGUI2(PDT)
+14 IF FLAG=-2
Begin DoDot:1
+15 SET IDT=$PIECE(IDT,".")
SET PDT=$PIECE(PDT,".")
+16 IF (PDT<IDT)!(PDT=IDT)
SET RESULTS(0)="VALID DATE"
QUIT
+17 IF PDT>IDT
SET RESULTS(0)="DATE ERROR"
QUIT
End DoDot:1
+18 IF FLAG=-1
Begin DoDot:1
+19 IF PDT<IDT
SET RESULTS(0)="VALID DATE"
QUIT
+20 IF (PDT>IDT)!(PDT=IDT)
SET RESULTS(0)="DATE ERROR"
QUIT
End DoDot:1
+21 IF FLAG=0
Begin DoDot:1
+22 IF PDT=IDT
SET RESULTS(0)="VALID DATE"
QUIT
+23 IF (PDT<IDT)!(PDT>IDT)
SET RESULTS(0)="DATE ERROR"
QUIT
End DoDot:1
+24 IF FLAG=1
Begin DoDot:1
+25 IF PDT>IDT
SET RESULTS(0)="VALID DATE"
QUIT
+26 IF (PDT<IDT)!(PDT=IDT)
SET RESULTS(0)="DATE ERROR"
QUIT
End DoDot:1
+27 IF FLAG=2
Begin DoDot:1
+28 SET IDT=$PIECE(IDT,".")
SET PDT=$PIECE(PDT,".")
+29 IF (PDT>IDT)!(PDT=IDT)
SET RESULTS(0)="VALID DATE"
QUIT
+30 IF PDT<IDT
SET RESULTS(0)="DATE ERROR"
QUIT
End DoDot:1
+31 QUIT
DTI(X) ;Convert and External date to an internal one
+1 NEW Y,%DT
+2 SET %DT="T"
DO ^%DT
+3 QUIT Y
SETFIELD(RESULTS,INPUT,VALUE) ;Set a single field in file 2260
+1 ;Input - INPUT Contains the IEN of the record and the field number to
+2 ; be modified in the format IEN^FIELD
+3 ; VALUE This required parm is the external value to be used.
+4 ;Output - RESULTS - status message of the file/set.
+5 NEW DA,DIE,DR,IEN,FLDNUM
+6 SET DR=""
+7 SET RESULTS(0)="UPDATE FAILED"
+8 SET IEN=$PIECE($GET(INPUT),U)
+9 IF '$GET(IEN)
QUIT
+10 SET FLDNUM=$PIECE($GET(INPUT),U,2)
+11 IF '$DATA(^OOPS(2260,IEN,0))!(FLDNUM="")
QUIT
+12 SET DIE="^OOPS(2260,"
SET DA=IEN
+13 SET DR(1,2260,1)=FLDNUM_"///^S X=VALUE"
+14 DO ^DIE
+15 IF $GET(Y)=""
Begin DoDot:1
+16 SET RESULTS(0)="UPDATE COMPLETE"
+17 ; if setting field 71, need to send bulletin
+18 IF FLDNUM=71
IF ($$GET1^DIQ(2260,IEN,71,"I")'="Y")
DO WCPBOR^OOPSMBUL(IEN)
+19 ; 01/02/04 Patch 4 llh - if case closed, sent bulletin
+20 IF FLDNUM=51
IF (VALUE="Closed")
DO CLSCASE^OOPSMBUL(IEN)
End DoDot:1
+21 QUIT
ADDWITN(RESULTS,IEN,INFO,COMMENT) ;Add Witness info for IEN in 2260
+1 ; Input - IEN - IEN of case that needs witness info created.
+2 ; INFO - Name, Street, City, State, Zip, Date of Witness in
+3 ; format, NAME^STREET^CITY^STATE^ZIP
+4 ; COMMENT - Witness Comment Text
+5 ; Output - RESULTS Text indicating status of insert
+6 NEW DR,DIE,DA,DIC,DD,DO,DLAYGO,INPUT,NAME,STREET,CITY,STATE,ZIP,WITDATE
+7 SET RESULTS(0)="WITNESS CREATION FAILED"
+8 IF '$GET(IEN)
QUIT
+9 IF '$DATA(^OOPS(2260,IEN,0))
QUIT
+10 SET DA(1)=IEN
+11 SET DLAYGO=2260
SET DIC="^OOPS(2260,"_DA(1)_",""CA1W"","
+12 SET DIC(0)="L"
+13 SET X=$PIECE(INFO,U)
+14 DO FILE^DICN
+15 SET DA=+Y
+16 SET DIE="^OOPS(2260,"_DA(1)_",""CA1W"","
SET DR=""
+17 IF DA=-1
QUIT
+18 SET NAME=$PIECE($GET(INFO),U)
+19 SET STREET=$PIECE($GET(INFO),U,2)
+20 SET CITY=$PIECE($GET(INFO),U,3)
+21 SET STATE=$PIECE($GET(INFO),U,4)
+22 SET ZIP=$PIECE($GET(INFO),U,5)
+23 SET WITDATE=$PIECE($GET(INFO),U,6)
+24 SET DR(1,2260.0125,1)=".01///^S X=NAME"
+25 SET DR(1,2260.0125,2)="1///^S X=STREET"
+26 SET DR(1,2260.0125,3)="2///^S X=CITY"
+27 SET DR(1,2260.0125,4)="3///^S X=STATE"
+28 SET DR(1,2260.0125,5)="4///^S X=ZIP"
+29 SET DR(1,2260.0125,6)="5///^S X=WITDATE"
+30 DO ^DIE
+31 SET DR="6///^S X=COMMENT"
+32 DO ^DIE
+33 SET RESULTS(0)="WITNESS CREATION SUCCESSFUL"
+34 QUIT
DELWITN(RESULTS,INPUT) ;Deletes the Witness information for a claim
+1 ; Input - INPUT, this is the IEN for the case and the witness number
+2 ; format IEN^witness number for the selected witness
+3 ; Output - RESULTS - String indicating the status of the delete
+4 NEW DA,DIK,IEN,WITNO
+5 SET RESULTS(0)="DELETION FAILED"
+6 IF INPUT=""
QUIT
+7 SET IEN=$PIECE($GET(INPUT),U)
+8 IF '$GET(IEN)
QUIT
+9 SET WITNO=$PIECE($GET(INPUT),U,2)
+10 IF '$GET(WITNO)
QUIT
+11 IF '$DATA(^OOPS(2260,IEN,"CA1W",WITNO,0))
QUIT
+12 SET DA(1)=IEN
+13 SET DA=WITNO
+14 SET DIK="^OOPS(2260,"_DA(1)_",""CA1W"","
+15 DO ^DIK
+16 IF $GET(Y)'=""
Begin DoDot:1
+17 SET RESULTS(0)="SUCCESSFULLY DELETED"
End DoDot:1
QUIT
+18 QUIT
EDTWITN(RESULTS,INPUT,INFO,COMMENT) ;Update Witness Info for 2260 rec
+1 ; Input:INPUT - IEN and Witness Number in format IEN^WIT
+2 ; INFO - Name, Street, City, State, Zip, Date of Witness in
+3 ; format, NAME^STREET^CITY^STATE^ZIP
+4 ; COMMENT - Text of Witness comment
+5 ; Output:RESULTS - String listing result of update.
+6 NEW DA,DIE,DR,NAME,STREET,CITY,STATE,ZIP,WITDATE,IEN,WITNO
+7 SET RESULTS(0)="EDIT FAILED"
+8 SET IEN=$PIECE($GET(INPUT),U)
+9 SET WITNO=$PIECE($GET(INPUT),U,2)
+10 IF '$DATA(^OOPS(2260,IEN,"CA1W",WITNO,0))
QUIT
+11 SET DA(1)=IEN
SET DR=""
+12 SET DA=WITNO
+13 SET DIE="^OOPS(2260,"_DA(1)_",""CA1W"","
+14 SET NAME=$PIECE($GET(INFO),U)
+15 SET STREET=$PIECE($GET(INFO),U,2)
+16 SET CITY=$PIECE($GET(INFO),U,3)
+17 SET STATE=$PIECE($GET(INFO),U,4)
+18 SET ZIP=$PIECE($GET(INFO),U,5)
+19 SET WITDATE=$PIECE($GET(INFO),U,6)
+20 SET DR(1,2260.0125,1)=".01///^S X=NAME"
+21 SET DR(1,2260.0125,2)="1///^S X=STREET"
+22 SET DR(1,2260.0125,3)="2///^S X=CITY"
+23 SET DR(1,2260.0125,4)="3///^S X=STATE"
+24 SET DR(1,2260.0125,5)="4///^S X=ZIP"
+25 SET DR(1,2260.0125,6)="5///^S X=WITDATE"
+26 DO ^DIE
+27 SET DR="6///^S X=COMMENT"
+28 DO ^DIE
+29 SET RESULTS(0)="EDIT SUCCESSFULL"
+30 QUIT