OOPSDOL ;WIOFO/CAH-ASISTS TRANSMISSION OF CA1/CA2 TO DOL ;3/15/00
;;2.0;ASISTS;;Jun 03, 2002
;
N ARR,FIELD,FL,MSG,VAL,XMZ
S MAN=1
;Check for security keys
I '$D(^XUSEC("OOPS DOL XMIT DATA",DUZ)) D G EXIT
.S DIR(0)="FO" W !
.S DIR("A")="You do not have the required Security Key."
.S DIR("A")=DIR("A")_" Press Enter to continue"
.D ^DIR K DIR
;Assure the Queue (Q-AST) has been defined
S VAL="Q-AST.DOMAIN.EXT",FIELD=.01,FL="X"
D FIND^DIC(4.2,"",FIELD,FL,VAL,"","","","","ARR")
I '$D(ARR("DILIST",1)) D G EXIT
.S DIR(0)="FO" W !
.S DIR("A")="Domain not found in the DOMAIN File,"
.S DIR("A")=DIR("A")_" No Transmission. Press Enter to continue"
.D ^DIR K DIR
S DIR(0)="D"
S DIR("A")="Re-transmit cases for what date "
S DIR("?",1)="Enter the date of original transmission for cases "
S DIR("?")="that need to be resent"
D ^DIR K DIR G:$D(DIRUT) EXIT I Y S RDATE=Y
S DIR(0)="Y",DIR("B")="Y",DIR("A")="Do you want to Queue Transmission"
S DIR("?",1)="Enter 'Y' if you want the CA1/CA2 data placed in mail"
S DIR("?")="message as part of a tasked job."
D ^DIR K DIR G:$D(DIRUT) EXIT I Y D G EXIT
.S ZTRTN="EN^OOPSDOL",ZTIO=""
.S ZTDESC="TRANSMIT DOL CA1/CA2 DATA"
.D ^%ZTLOAD
S DIR(0)="Y"
S DIR("A")="Transmission NOT queued, OK to continue"
D ^DIR K DIR I 'Y G EXIT
S MSG("DIHELP",1)="Processing" W !
D MSG^DIALOG("WH","","","","MSG")
EN ;Routine Entry
S WOK=1
N CNT,ERR,ERROR,FAIL,OPMG,OPQ
K VMSG,INV ; used for data validation of records
S CTR=1 ; counter for Mail message array
S (START,END,FAIL)=""
; Assure the Queue (Q-AST) has been defined
S VAL="Q-AST.DOMAIN.EXT",FIELD=.01,FL="X"
D FIND^DIC(4.2,"",FIELD,FL,VAL,"","","","","ARR")
I '$D(ARR("DILIST",1)) D G EXIT
. S ERROR(1)="The Queue Q-AST.DOMAIN.EXT has not been created. Please contact your IRM "
. S ERROR(2)="Dept. to have Patch XM*999*136 installed; once installed complete manual "
. S ERROR(3)="transmission of DOL Data."
. D ERROR2
; Make sure Mail Group Exists
S OPMG=$$FIND1^DIC(3.8,"","X","OOPS WC MESSAGE")
I 'OPMG D G EXIT
. S ERROR(1)="The Mail Group OOPS WC MESSAGE is missing."
. S ERROR(2)="Add the Group so that ASISTS data can be transmitted "
. S ERROR(3)="to the AAC. Then contact Worker Compensation office "
. S ERROR(4)="to complete manual Transmission of DOL Data."
. D ERROR
; Get list of members
D LIST^DIC(3.81,","_OPMG_",","","",1,"","","","","","OPQ")
I '$P(OPQ("DILIST",0),U) D G EXIT
. S ERROR(1)="There are no members of the OOPS WC MESSAGE "
. S ERROR(1)=ERROR(1)_"Mail Group."
. S ERROR(2)="Enter at least one member to the group. This person "
. S ERROR(3)="will receive messages concerning the transmission of "
. S ERROR(4)="ASISTS DOL data to and from the AAC. After adding member"
. S ERROR(5)="contact Worker Compensation office to complete manual transmission of DOL data."
. D ERROR
GETREC ; Loop thru ^OOP(2260 "AW" or "AWC" XRef to get records to transmit
; AW=Schedule Transmission
; AWC=Manual Transmission
N OOPDA,SMSG,STA,XMDUZ,XMTEXT,XMSUB,XMY,MDATA,VALID
N Y,%,%H,%I
K ^TMP($J,"C"),^TMP($J,"D")
S (CNT,OOPDA)=0
D NOW^%DTC S DATE=%,Y=DATE X ^DD("DD")
S MTIME=$P(Y,"@",2),DATE=$$DC^OOPSUTL3(%)
I $D(MAN) S INDEX="^OOPS(2260,""AWC"",OPI)",INDEX2="^OOPS(2260,""AWC"",OPI,OOPDA)"
E S INDEX="^OOPS(2260,""AW"",OPI)",INDEX2="^OOPS(2260,""AW"",OPI,OOPDA)"
S OPI=0 F S OPI=$O(@INDEX) Q:'OPI D
.S OOPDA=0 F S OOPDA=$O(@INDEX2) Q:'OOPDA D
.. I $D(MAN),OPI'=RDATE Q
.. I '$G(MAN),($$GET1^DIQ(2260,OOPDA,66)'="") D Q
... K ^OOPS(2260,"AW",OPI,OOPDA)
.. I '$$VERIFY^OOPSUTL6(OOPDA) Q ; verify data not chged
.. S VALID=$$VAL^OOPSUTL5(OOPDA)
.. ; Get Station #, use w/Mail Grp by Station for messages, if there
.. S STA=$$GET1^DIQ(4,$P(^OOPS(2260,OOPDA,"2162A"),U,9),99,"E")
.. ; Valid Case
.. I $G(VALID)'="" S CNT=CNT+1,^TMP($J,"C",OOPDA)="",SMSG(STA,OOPDA)="" Q
.. ; Invalid Case
.. S T="" F S T=$O(NULL(T)) Q:'T S ^TMP($J,"D",STA,OOPDA,T)=$G(NULL(T))
S ^TMP($J,"C")=CNT
NOCASES ; No Cases to Send - Send Mail Message with only DOL segment
I $D(MAN),CNT=0 D G EXIT
.S DIR(0)="FO"
.S DIR("A")="No cases to transmit for requested date"
.D ^DIR K DIR
I CNT=0 D G EXIT
. S XMDUZ="ASISTS Report on Daily Transmission to the AAC"
. S GRP="OOPS WC MESSAGE"
. S XMY("G."_GRP)=""
. ; If no one in mail group (this should not occur), send to user
. I $D(XMY)<9 S XMY(DUZ)=""
. S XMSUB="ASISTS no claims to process"
. S XMTEXT="MSG("
. S MSG(1)="There were no claims ready for transmission"
. S MSG(2)="to the Austin Automation Center when the."
. S MSG(3)="scheduled task last ran."
. D ^XMD
. K MSG
. Q
PROCESS ;
D CREATE G:FAIL EXIT
; START - First case number in MM, End - Last Case # in MM
S OOPDA="",START="",END="",OPAST=""
F S OPAST=OOPDA,OOPDA=$O(^TMP($J,"C",OOPDA)) Q:OOPDA="" D
. D ^OOPSDOLX
. ; if first send, Set DATE TRANSMITTED TO WCMIS in ^OOPS(2260
. I $$GET1^DIQ(2260,OOPDA,66)="" D
.. K DR S DIE="^OOPS(2260,",(IEN,DA)=OOPDA,DR="66///TODAY"
.. D ^DIE K DR,DA,DIE
. I $$GET1^DIQ(2260,OOPDA,199,"I")="Y" D WCP^OOPSMBUL(OOPDA,"E")
; If any records left to send and no FAILure
I ($G(XMZ)'<1)&('FAIL) D
. I END="" S END=$P($P(^OOPS(2260,OPAST,0),U),"-",2)
. D SEND
EXIT ; Quit the program
D BADREC ; Send Mail if any Bad Records
D SENTMSG ; Send message to OOPS WCP with sent claims
I $G(FAIL) D
.S ERROR(1)="Mail Message was not created. Contact Worker Compensation office "
.S ERROR(2)="to complete the transmission of ASISTS DOL data."
.D ERROR2
K CTR,DATE,ERR,ERROR,GRP,INV,OPL,MSIZE,MTIME,XMSUB,XMTEXT,XMY,MSG,MAN
K ^TMP($J),%DT,CATY,D,DO,DATA,DI,DIC,DISYS,DIW,DIWI,DAS,DIWT,DN,DQ
K END,FL174,FLD,HOUR,I,INDEX,INDEX2,MAX,MIN,OOPSAR,OPAST,OPI,OSHA
K OSHASC,P,RPOL,START,T,WOK,X,XMDUN,XMY,XMZ,Y,Z,RDATE,IEN,OPHM,CONV
K COPDT,DIWTC,DIWX,OTIME,REL,SIEN
Q
CREATE ; Create Mailman Message
N OPDATA,SN
S MSIZE=0
I $G(XMZ)'<1 D SEND
S OPL=0
S XMSUB="ASISTS DOL DATA"
S XMDUZ=DUZ
D XMZ^XMA2 I XMZ<1 S FAIL=1 Q
S SN=$$GET1^DIQ(4,$P($G(^XMB(1,1,"XUS")),U,17),99)
S SN=$E("0000000",$L(SN)+1,7)_SN
S OPDATA="0DOL^ASISTS^"_SN_U_DATE
S OPDATA=OPDATA_U_U_"001"_U_"|"
S OPL=OPL+1,^XMB(3.9,XMZ,2,OPL,0)=OPDATA
Q
SEND ; Send Mailman Message
N NUMCASE
S ^XMB(3.9,XMZ,2,0)="^3.92A^"_OPL_U_OPL_U_DT
; Set # of Cases in this Mail Message
S NUMCASE=$S(START'="":START_"-"_END,1:0)
S $P(^XMB(3.9,XMZ,2,1,0),U,5)=NUMCASE
; Indicate last line of message
S OPL=OPL+1,^XMB(3.9,XMZ,2,OPL,0)="NNNN"_$C(13)_$C(10)
S XMY(DUZ)="" ; also send here, in case of error.
S XMY("XXX@Q-AST.DOMAIN.EXT")=""
S XMCHAN=1 D ENT1^XMD K XMCHAN
K XMZ
Q
BADREC ; If any records with missing data, send mail message
S OOPDA=0,OPI=0,STA=""
F S STA=$O(^TMP($J,"D",STA)) Q:STA="" K MSG S CTR=1 D
. F S OOPDA=$O(^TMP($J,"D",STA,OOPDA)) Q:OOPDA="" D
.. S MSG(CTR)="Case: "_$$GET1^DIQ(2260,OOPDA,.01)_" has missing required data or word processing fields that are",CTR=CTR+1
.. S MSG(CTR)="larger than DOL requirements. Please edit the case(s); and once completed,",CTR=CTR+1
.. S MSG(CTR)="the cases will be transmitted with the next scheduled transmission. ",CTR=CTR+1
.. F S OPI=$O(^TMP($J,"D",STA,OOPDA,OPI)) Q:OPI="" D
... S MSG(CTR)=" >"_$G(^TMP($J,"D",STA,OOPDA,OPI)),CTR=CTR+1
.. S MSG(CTR)=$C(10),CTR=CTR+1
. I $D(MSG) D
.. S XMSUB="ASISTS Record(s) not transmitted for Station "_STA
.. S GRP="OOPS WCP"
.. I $$FIND1^DIC(3.8,"","AMX",GRP_" - "_STA) S GRP=GRP_" - "_STA
.. S XMY("G."_GRP)=""
.. S XMTEXT="MSG("
.. D ^XMD
Q
SENTMSG ; Send message to OOPS WCP mail group with claims sent to AAC
N CNT,MSG,STA,STR,OOPDA
S (STA,OOPDA)=""
F S STA=$O(SMSG(STA)) Q:STA="" K MSG S CNT=1 D
. S MSG(CNT)="The following claims have been transmitted to the AAC:"
. S CNT=CNT+1
. F S OOPDA=$O(SMSG(STA,OOPDA)) Q:OOPDA="" D
.. S STR=^OOPS(2260,OOPDA,0)
.. S MSG(CNT)="> "_$P(STR,U)_" "_$P(STR,U,2),CNT=CNT+1
. S XMSUB="ASISTS Record(s) transmitted to AAC for Station "_STA
. S GRP="OOPS WCP"
. I $$FIND1^DIC(3.8,"","AMX",GRP_" - "_STA) S GRP=GRP_" - "_STA
. S XMY("G."_GRP)=""
. S XMTEXT="MSG("
. D ^XMD
Q
ERROR ; Create appropriate Error message and Send message
S XMDUZ="ASISTS Package"
; If no one in mail group (this should not occur), send to user
I $D(XMY)<9 S XMY(DUZ)=""
S XMSUB="ASISTS DOL Error Notification Message"
S XMTEXT="ERROR("
D ^XMD
I '$D(ZTQUEUED) D
. S MSG("DIHELP",1)="An Error Occurred during Processing, check"
. S MSG("DIHELP",2)="Mailman Message for details."
. D MSG^DIALOG("WH","","","","MSG")
K ERROR
Q
ERROR2 ; Create appropriate Error message and Send message
S XMDUZ="ASISTS Package"
S GRP="OOPS WC MESSAGE"
D GRP^OOPSMBUL
; If no one in mail group (this should not occur), send to user
I $D(XMY)<9 S XMY(DUZ)=""
S XMSUB="ASISTS DOL Error Notification Message"
S XMTEXT="ERROR("
D ^XMD
I '$D(ZTQUEUED) D
. S MSG("DIHELP",1)="An Error Occurred during Processing, check"
. S MSG("DIHELP",2)="Mailman Message for details."
. D MSG^DIALOG("WH","","","","MSG")
K ERROR
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HOOPSDOL 9327 printed Oct 16, 2024@17:39:38 Page 2
OOPSDOL ;WIOFO/CAH-ASISTS TRANSMISSION OF CA1/CA2 TO DOL ;3/15/00
+1 ;;2.0;ASISTS;;Jun 03, 2002
+2 ;
+3 NEW ARR,FIELD,FL,MSG,VAL,XMZ
+4 SET MAN=1
+5 ;Check for security keys
+6 IF '$DATA(^XUSEC("OOPS DOL XMIT DATA",DUZ))
Begin DoDot:1
+7 SET DIR(0)="FO"
WRITE !
+8 SET DIR("A")="You do not have the required Security Key."
+9 SET DIR("A")=DIR("A")_" Press Enter to continue"
+10 DO ^DIR
KILL DIR
End DoDot:1
GOTO EXIT
+11 ;Assure the Queue (Q-AST) has been defined
+12 SET VAL="Q-AST.DOMAIN.EXT"
SET FIELD=.01
SET FL="X"
+13 DO FIND^DIC(4.2,"",FIELD,FL,VAL,"","","","","ARR")
+14 IF '$DATA(ARR("DILIST",1))
Begin DoDot:1
+15 SET DIR(0)="FO"
WRITE !
+16 SET DIR("A")="Domain not found in the DOMAIN File,"
+17 SET DIR("A")=DIR("A")_" No Transmission. Press Enter to continue"
+18 DO ^DIR
KILL DIR
End DoDot:1
GOTO EXIT
+19 SET DIR(0)="D"
+20 SET DIR("A")="Re-transmit cases for what date "
+21 SET DIR("?",1)="Enter the date of original transmission for cases "
+22 SET DIR("?")="that need to be resent"
+23 DO ^DIR
KILL DIR
if $DATA(DIRUT)
GOTO EXIT
IF Y
SET RDATE=Y
+24 SET DIR(0)="Y"
SET DIR("B")="Y"
SET DIR("A")="Do you want to Queue Transmission"
+25 SET DIR("?",1)="Enter 'Y' if you want the CA1/CA2 data placed in mail"
+26 SET DIR("?")="message as part of a tasked job."
+27 DO ^DIR
KILL DIR
if $DATA(DIRUT)
GOTO EXIT
IF Y
Begin DoDot:1
+28 SET ZTRTN="EN^OOPSDOL"
SET ZTIO=""
+29 SET ZTDESC="TRANSMIT DOL CA1/CA2 DATA"
+30 DO ^%ZTLOAD
End DoDot:1
GOTO EXIT
+31 SET DIR(0)="Y"
+32 SET DIR("A")="Transmission NOT queued, OK to continue"
+33 DO ^DIR
KILL DIR
IF 'Y
GOTO EXIT
+34 SET MSG("DIHELP",1)="Processing"
WRITE !
+35 DO MSG^DIALOG("WH","","","","MSG")
EN ;Routine Entry
+1 SET WOK=1
+2 NEW CNT,ERR,ERROR,FAIL,OPMG,OPQ
+3 ; used for data validation of records
KILL VMSG,INV
+4 ; counter for Mail message array
SET CTR=1
+5 SET (START,END,FAIL)=""
+6 ; Assure the Queue (Q-AST) has been defined
+7 SET VAL="Q-AST.DOMAIN.EXT"
SET FIELD=.01
SET FL="X"
+8 DO FIND^DIC(4.2,"",FIELD,FL,VAL,"","","","","ARR")
+9 IF '$DATA(ARR("DILIST",1))
Begin DoDot:1
+10 SET ERROR(1)="The Queue Q-AST.DOMAIN.EXT has not been created. Please contact your IRM "
+11 SET ERROR(2)="Dept. to have Patch XM*999*136 installed; once installed complete manual "
+12 SET ERROR(3)="transmission of DOL Data."
+13 DO ERROR2
End DoDot:1
GOTO EXIT
+14 ; Make sure Mail Group Exists
+15 SET OPMG=$$FIND1^DIC(3.8,"","X","OOPS WC MESSAGE")
+16 IF 'OPMG
Begin DoDot:1
+17 SET ERROR(1)="The Mail Group OOPS WC MESSAGE is missing."
+18 SET ERROR(2)="Add the Group so that ASISTS data can be transmitted "
+19 SET ERROR(3)="to the AAC. Then contact Worker Compensation office "
+20 SET ERROR(4)="to complete manual Transmission of DOL Data."
+21 DO ERROR
End DoDot:1
GOTO EXIT
+22 ; Get list of members
+23 DO LIST^DIC(3.81,","_OPMG_",","","",1,"","","","","","OPQ")
+24 IF '$PIECE(OPQ("DILIST",0),U)
Begin DoDot:1
+25 SET ERROR(1)="There are no members of the OOPS WC MESSAGE "
+26 SET ERROR(1)=ERROR(1)_"Mail Group."
+27 SET ERROR(2)="Enter at least one member to the group. This person "
+28 SET ERROR(3)="will receive messages concerning the transmission of "
+29 SET ERROR(4)="ASISTS DOL data to and from the AAC. After adding member"
+30 SET ERROR(5)="contact Worker Compensation office to complete manual transmission of DOL data."
+31 DO ERROR
End DoDot:1
GOTO EXIT
GETREC ; Loop thru ^OOP(2260 "AW" or "AWC" XRef to get records to transmit
+1 ; AW=Schedule Transmission
+2 ; AWC=Manual Transmission
+3 NEW OOPDA,SMSG,STA,XMDUZ,XMTEXT,XMSUB,XMY,MDATA,VALID
+4 NEW Y,%,%H,%I
+5 KILL ^TMP($JOB,"C"),^TMP($JOB,"D")
+6 SET (CNT,OOPDA)=0
+7 DO NOW^%DTC
SET DATE=%
SET Y=DATE
XECUTE ^DD("DD")
+8 SET MTIME=$PIECE(Y,"@",2)
SET DATE=$$DC^OOPSUTL3(%)
+9 IF $DATA(MAN)
SET INDEX="^OOPS(2260,""AWC"",OPI)"
SET INDEX2="^OOPS(2260,""AWC"",OPI,OOPDA)"
+10 IF '$TEST
SET INDEX="^OOPS(2260,""AW"",OPI)"
SET INDEX2="^OOPS(2260,""AW"",OPI,OOPDA)"
+11 SET OPI=0
FOR
SET OPI=$ORDER(@INDEX)
if 'OPI
QUIT
Begin DoDot:1
+12 SET OOPDA=0
FOR
SET OOPDA=$ORDER(@INDEX2)
if 'OOPDA
QUIT
Begin DoDot:2
+13 IF $DATA(MAN)
IF OPI'=RDATE
QUIT
+14 IF '$GET(MAN)
IF ($$GET1^DIQ(2260,OOPDA,66)'="")
Begin DoDot:3
+15 KILL ^OOPS(2260,"AW",OPI,OOPDA)
End DoDot:3
QUIT
+16 ; verify data not chged
IF '$$VERIFY^OOPSUTL6(OOPDA)
QUIT
+17 SET VALID=$$VAL^OOPSUTL5(OOPDA)
+18 ; Get Station #, use w/Mail Grp by Station for messages, if there
+19 SET STA=$$GET1^DIQ(4,$PIECE(^OOPS(2260,OOPDA,"2162A"),U,9),99,"E")
+20 ; Valid Case
+21 IF $GET(VALID)'=""
SET CNT=CNT+1
SET ^TMP($JOB,"C",OOPDA)=""
SET SMSG(STA,OOPDA)=""
QUIT
+22 ; Invalid Case
+23 SET T=""
FOR
SET T=$ORDER(NULL(T))
if 'T
QUIT
SET ^TMP($JOB,"D",STA,OOPDA,T)=$GET(NULL(T))
End DoDot:2
End DoDot:1
+24 SET ^TMP($JOB,"C")=CNT
NOCASES ; No Cases to Send - Send Mail Message with only DOL segment
+1 IF $DATA(MAN)
IF CNT=0
Begin DoDot:1
+2 SET DIR(0)="FO"
+3 SET DIR("A")="No cases to transmit for requested date"
+4 DO ^DIR
KILL DIR
End DoDot:1
GOTO EXIT
+5 IF CNT=0
Begin DoDot:1
+6 SET XMDUZ="ASISTS Report on Daily Transmission to the AAC"
+7 SET GRP="OOPS WC MESSAGE"
+8 SET XMY("G."_GRP)=""
+9 ; If no one in mail group (this should not occur), send to user
+10 IF $DATA(XMY)<9
SET XMY(DUZ)=""
+11 SET XMSUB="ASISTS no claims to process"
+12 SET XMTEXT="MSG("
+13 SET MSG(1)="There were no claims ready for transmission"
+14 SET MSG(2)="to the Austin Automation Center when the."
+15 SET MSG(3)="scheduled task last ran."
+16 DO ^XMD
+17 KILL MSG
+18 QUIT
End DoDot:1
GOTO EXIT
PROCESS ;
+1 DO CREATE
if FAIL
GOTO EXIT
+2 ; START - First case number in MM, End - Last Case # in MM
+3 SET OOPDA=""
SET START=""
SET END=""
SET OPAST=""
+4 FOR
SET OPAST=OOPDA
SET OOPDA=$ORDER(^TMP($JOB,"C",OOPDA))
if OOPDA=""
QUIT
Begin DoDot:1
+5 DO ^OOPSDOLX
+6 ; if first send, Set DATE TRANSMITTED TO WCMIS in ^OOPS(2260
+7 IF $$GET1^DIQ(2260,OOPDA,66)=""
Begin DoDot:2
+8 KILL DR
SET DIE="^OOPS(2260,"
SET (IEN,DA)=OOPDA
SET DR="66///TODAY"
+9 DO ^DIE
KILL DR,DA,DIE
End DoDot:2
+10 IF $$GET1^DIQ(2260,OOPDA,199,"I")="Y"
DO WCP^OOPSMBUL(OOPDA,"E")
End DoDot:1
+11 ; If any records left to send and no FAILure
+12 IF ($GET(XMZ)'<1)&('FAIL)
Begin DoDot:1
+13 IF END=""
SET END=$PIECE($PIECE(^OOPS(2260,OPAST,0),U),"-",2)
+14 DO SEND
End DoDot:1
EXIT ; Quit the program
+1 ; Send Mail if any Bad Records
DO BADREC
+2 ; Send message to OOPS WCP with sent claims
DO SENTMSG
+3 IF $GET(FAIL)
Begin DoDot:1
+4 SET ERROR(1)="Mail Message was not created. Contact Worker Compensation office "
+5 SET ERROR(2)="to complete the transmission of ASISTS DOL data."
+6 DO ERROR2
End DoDot:1
+7 KILL CTR,DATE,ERR,ERROR,GRP,INV,OPL,MSIZE,MTIME,XMSUB,XMTEXT,XMY,MSG,MAN
+8 KILL ^TMP($JOB),%DT,CATY,D,DO,DATA,DI,DIC,DISYS,DIW,DIWI,DAS,DIWT,DN,DQ
+9 KILL END,FL174,FLD,HOUR,I,INDEX,INDEX2,MAX,MIN,OOPSAR,OPAST,OPI,OSHA
+10 KILL OSHASC,P,RPOL,START,T,WOK,X,XMDUN,XMY,XMZ,Y,Z,RDATE,IEN,OPHM,CONV
+11 KILL COPDT,DIWTC,DIWX,OTIME,REL,SIEN
+12 QUIT
CREATE ; Create Mailman Message
+1 NEW OPDATA,SN
+2 SET MSIZE=0
+3 IF $GET(XMZ)'<1
DO SEND
+4 SET OPL=0
+5 SET XMSUB="ASISTS DOL DATA"
+6 SET XMDUZ=DUZ
+7 DO XMZ^XMA2
IF XMZ<1
SET FAIL=1
QUIT
+8 SET SN=$$GET1^DIQ(4,$PIECE($GET(^XMB(1,1,"XUS")),U,17),99)
+9 SET SN=$EXTRACT("0000000",$LENGTH(SN)+1,7)_SN
+10 SET OPDATA="0DOL^ASISTS^"_SN_U_DATE
+11 SET OPDATA=OPDATA_U_U_"001"_U_"|"
+12 SET OPL=OPL+1
SET ^XMB(3.9,XMZ,2,OPL,0)=OPDATA
+13 QUIT
SEND ; Send Mailman Message
+1 NEW NUMCASE
+2 SET ^XMB(3.9,XMZ,2,0)="^3.92A^"_OPL_U_OPL_U_DT
+3 ; Set # of Cases in this Mail Message
+4 SET NUMCASE=$SELECT(START'="":START_"-"_END,1:0)
+5 SET $PIECE(^XMB(3.9,XMZ,2,1,0),U,5)=NUMCASE
+6 ; Indicate last line of message
+7 SET OPL=OPL+1
SET ^XMB(3.9,XMZ,2,OPL,0)="NNNN"_$CHAR(13)_$CHAR(10)
+8 ; also send here, in case of error.
SET XMY(DUZ)=""
+9 SET XMY("XXX@Q-AST.DOMAIN.EXT")=""
+10 SET XMCHAN=1
DO ENT1^XMD
KILL XMCHAN
+11 KILL XMZ
+12 QUIT
BADREC ; If any records with missing data, send mail message
+1 SET OOPDA=0
SET OPI=0
SET STA=""
+2 FOR
SET STA=$ORDER(^TMP($JOB,"D",STA))
if STA=""
QUIT
KILL MSG
SET CTR=1
Begin DoDot:1
+3 FOR
SET OOPDA=$ORDER(^TMP($JOB,"D",STA,OOPDA))
if OOPDA=""
QUIT
Begin DoDot:2
+4 SET MSG(CTR)="Case: "_$$GET1^DIQ(2260,OOPDA,.01)_" has missing required data or word processing fields that are"
SET CTR=CTR+1
+5 SET MSG(CTR)="larger than DOL requirements. Please edit the case(s); and once completed,"
SET CTR=CTR+1
+6 SET MSG(CTR)="the cases will be transmitted with the next scheduled transmission. "
SET CTR=CTR+1
+7 FOR
SET OPI=$ORDER(^TMP($JOB,"D",STA,OOPDA,OPI))
if OPI=""
QUIT
Begin DoDot:3
+8 SET MSG(CTR)=" >"_$GET(^TMP($JOB,"D",STA,OOPDA,OPI))
SET CTR=CTR+1
End DoDot:3
+9 SET MSG(CTR)=$CHAR(10)
SET CTR=CTR+1
End DoDot:2
+10 IF $DATA(MSG)
Begin DoDot:2
+11 SET XMSUB="ASISTS Record(s) not transmitted for Station "_STA
+12 SET GRP="OOPS WCP"
+13 IF $$FIND1^DIC(3.8,"","AMX",GRP_" - "_STA)
SET GRP=GRP_" - "_STA
+14 SET XMY("G."_GRP)=""
+15 SET XMTEXT="MSG("
+16 DO ^XMD
End DoDot:2
End DoDot:1
+17 QUIT
SENTMSG ; Send message to OOPS WCP mail group with claims sent to AAC
+1 NEW CNT,MSG,STA,STR,OOPDA
+2 SET (STA,OOPDA)=""
+3 FOR
SET STA=$ORDER(SMSG(STA))
if STA=""
QUIT
KILL MSG
SET CNT=1
Begin DoDot:1
+4 SET MSG(CNT)="The following claims have been transmitted to the AAC:"
+5 SET CNT=CNT+1
+6 FOR
SET OOPDA=$ORDER(SMSG(STA,OOPDA))
if OOPDA=""
QUIT
Begin DoDot:2
+7 SET STR=^OOPS(2260,OOPDA,0)
+8 SET MSG(CNT)="> "_$PIECE(STR,U)_" "_$PIECE(STR,U,2)
SET CNT=CNT+1
End DoDot:2
+9 SET XMSUB="ASISTS Record(s) transmitted to AAC for Station "_STA
+10 SET GRP="OOPS WCP"
+11 IF $$FIND1^DIC(3.8,"","AMX",GRP_" - "_STA)
SET GRP=GRP_" - "_STA
+12 SET XMY("G."_GRP)=""
+13 SET XMTEXT="MSG("
+14 DO ^XMD
End DoDot:1
+15 QUIT
ERROR ; Create appropriate Error message and Send message
+1 SET XMDUZ="ASISTS Package"
+2 ; If no one in mail group (this should not occur), send to user
+3 IF $DATA(XMY)<9
SET XMY(DUZ)=""
+4 SET XMSUB="ASISTS DOL Error Notification Message"
+5 SET XMTEXT="ERROR("
+6 DO ^XMD
+7 IF '$DATA(ZTQUEUED)
Begin DoDot:1
+8 SET MSG("DIHELP",1)="An Error Occurred during Processing, check"
+9 SET MSG("DIHELP",2)="Mailman Message for details."
+10 DO MSG^DIALOG("WH","","","","MSG")
End DoDot:1
+11 KILL ERROR
+12 QUIT
ERROR2 ; Create appropriate Error message and Send message
+1 SET XMDUZ="ASISTS Package"
+2 SET GRP="OOPS WC MESSAGE"
+3 DO GRP^OOPSMBUL
+4 ; If no one in mail group (this should not occur), send to user
+5 IF $DATA(XMY)<9
SET XMY(DUZ)=""
+6 SET XMSUB="ASISTS DOL Error Notification Message"
+7 SET XMTEXT="ERROR("
+8 DO ^XMD
+9 IF '$DATA(ZTQUEUED)
Begin DoDot:1
+10 SET MSG("DIHELP",1)="An Error Occurred during Processing, check"
+11 SET MSG("DIHELP",2)="Mailman Message for details."
+12 DO MSG^DIALOG("WH","","","","MSG")
End DoDot:1
+13 KILL ERROR
+14 QUIT