Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: OOPSDOL

OOPSDOL.m

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