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

IBY718PO.m

Go to the documentation of this file.
IBY718PO ;EDE/TPF - POST INSTALL ROUTINE FOR IB*2.0*718
 ;;2.0;INTEGRATED BILLING;**718**;;Build 73
 ;;Per VA Directive 6402, this routine should not be modified.
 ;
 Q
 ;
PRETRAN ;EP - PRE-TRANSPORT ROUTINE
 N IBIEN,IBRTN,IBFILENUM,IBFILENM,IBPOSITION
 ;
 S IBFILENUM=399.1  ;MAKE A GENERIC PARAMETER SET
 S IBFILENM=$P($G(^DIC(IBFILENUM,0)),U)
 S IBPOSITION="!?((IOM/2)-($L(A)/2))"
 D EN^DDIOL("Entering PRE-TRANSPORT routine.....","","!!"_IBPOSITION)
 D EN^DDIOL("Pulling data from #"_IBFILENUM_" "_IBFILENM_" .....","",IBPOSITION)
 ;
 S IBRTN=$P($T(+1)," ")
 K ^TMP(IBRTN,$J)
 K @XPDGREF@(XPDNM)     ;XPDGREF = ^XTMP("XPDT",BUILD_IEN,"TEMP")
 ;                       XPDNM   = "IB*2.0*718"
 S IBIEN=0
 F  S IBIEN=$O(^DGCR(IBFILENUM,IBIEN)) Q:'IBIEN  D
 .Q:'$$IENSTOPULL(IBIEN)  ;NOT IN THE LIST TO TRANSPORT
 .D PULL(IBIEN)
 ;
 D EN^DDIOL("PRE-TRANSPORT routine finished.....","",IBPOSITION)
 Q
 ;
PULL(IBIEN) ;EP - SET TRANSPORT TEMP GLOBAL UP WITH ASSIGN. AUTH. OID ENTRIES
 I '$D(^DGCR(IBFILENUM,IBIEN,0)) D  Q
 .D EN^DDIOL("Review TRANSPORT LIST IN IENSTOPULL^"_IBRTN_" Entry not found for "_IBIEN,"",IBPOSITION)
 ;
 M @XPDGREF@(XPDNM,IBFILENUM,IBIEN)=^DGCR(IBFILENUM,IBIEN)
 ;
 Q
 ;
IENSTOPULL(IEN) ;EP - TRANSPORT THESE  ENTRIES
 ;
 I $G(^DGCR(399.1,IEN,2))'="" Q 1
 ;
 I (U_58_U_79_U_80_U_642_U_643_U_639_U_678_U_689_U)[(U_IEN_U) Q 1
 I $$NUMRANGE(IEN,60,62) Q 1
 I $$NUMRANGE(IEN,45,47) Q 1
 I $$NUMRANGE(IEN,74,76) Q 1
 I $$NUMRANGE(IEN,82,84) Q 1
 I $$NUMRANGE(IEN,86,91) Q 1
 I $$NUMRANGE(IEN,94,99) Q 1
 I $$NUMRANGE(IEN,102,104) Q 1
 I $$NUMRANGE(IEN,265,268) Q 1
 I $$NUMRANGE(IEN,587,590) Q 1
 I $$NUMRANGE(IEN,634,638) Q 1
 Q 0
 ;
NUMRANGE(X,LOW,HIGH) ;EP - NUMBER RANGE CHECK
 ;RETURNS 1 IF X LIES WITHIN NUMBER RANGE
 I (X=LOW!(X>LOW)),(X<HIGH!(X=HIGH)) Q 1
 Q 0
 ;
 ;D POST^ZZTPFPRETRANS
POST ;EP - BRING DATA IN FROM PRE-TRANSPORT KIDS GLOBAL
 ;
 N IBIEN,IBRTN,IBGLBROOT,IBFILENUM,IBPOSITION,IBFDA,LOCALIEN,LOCALIENS
 N IBFLAGS,IBFIELD,IBWPROOT,IBWPERROR,IBEMAILIEN,IBMESSAGE,IBNAME01,IBCODE
 ;
 S IBEMAILIEN=11   ;TEST WHETHER WE NEED TO SET THIS TO NUMERIC IN E=SEQUENCE AFTER MSG IN EMAIL API S MSG(9+1)
 S IBPOSITION="!?((IOM/2)-($L(A)/2))"
 D EN^DDIOL("*** Post install started ***",,IBPOSITION)
 S IBMESSAGE($$INC(.IBEMAILIEN))="*** Post install started ***"
 ;
 S IBRTN=$P($T(+1)," ")
 ;
 ;XPDGREF = ^XTMP("XPDI",INSTALL_IEN,"TEMP")
 ;XPDNM   = "IB*2.0*718"
 ;
 S IBFILENUM=$QS($Q(@XPDGREF),5)
 S IBIEN=0
 F  S IBIEN=$O(@XPDGREF@(XPDNM,IBFILENUM,IBIEN)) Q:'IBIEN  D
 .S IBNAME01=$P($G(@XPDGREF@(XPDNM,IBFILENUM,IBIEN,0)),U)  ;NAME
 .S IBCODE=$P($G(@XPDGREF@(XPDNM,IBFILENUM,IBIEN,0)),U,2)  ;CODE
 .;
 .S LOCALIEN=$$FINDLOCALIEN(IBNAME01,IBFILENUM,IBCODE,.IBMESSAGE)  ;FIND THE LOCAL ENTRY IEN WE NEED TO MODIFY
 .Q:'LOCALIEN  ;IF NO DISTINCT IEN FOUND DO NOT TRY AND MODIFY
 .;
 .S LOCALIENS=LOCALIEN_","
 .S IBFDA(IBFILENUM,LOCALIENS,.19)=$P($G(@XPDGREF@(XPDNM,IBFILENUM,IBIEN,0)),U,12)     ;#.19 VALUE CODE AMOUNT
 .S:$G(@XPDGREF@(XPDNM,IBFILENUM,IBIEN,2))'="" IBFDA(IBFILENUM,LOCALIENS,2)=$G(@XPDGREF@(XPDNM,IBFILENUM,IBIEN,2))                ;FIELD #2 VALUE CODE AMOUNT SCREEN
 .;
 .;WORD PROCESSING FIELD MUST BE DONE BY WP^DIE
 .S IBFIELD=1
 .S IBFLAGS=""
 .K IBWPROOT
 .M IBWPROOT=@XPDGREF@(XPDNM,IBFILENUM,IBIEN,1)
 .K IBWPROOT(0)
 .S IBWPROOT="IBWPROOT"
 .;
 .D WP^DIE(IBFILENUM,LOCALIENS,IBFIELD,IBFLAGS,"IBWPROOT","IBWPERROR")        ;^DGCR(399.1,D0,1,D1,0)= (#.01) VALUE CODE HELP TEXT [1W]
 .;
 .I $D(IBWPERROR) D
 ..S IBMESSAGE($$INC(.IBEMAILIEN))="Problem modifying Word Processing routine for "_NAME01_" in file "_IBFILENUM
 .;
 .;NOW LETS DO THE REGULAR FIELDS
 .D MOD(LOCALIEN,IBFILENUM,.IBFDA)
 .K IBFDA
 ;
 D CRRCTSPELL  ;FIX ONE ENTRY WITH INCORRECT SPELLING
 ;
 D EN^DDIOL("Finished modifying Entries to "_$G(IBFILENUM)_" File","",IBPOSITION)
 ;
 D EMAIL(.IBMESSAGE)
 ;
 D EN^DDIOL("*** Post install completed ***","",IBPOSITION)
 ;
 Q
 ;
INC(COUNTER) ;EP - INCREMENT EMAIL COUNTER
 S COUNTER=$G(COUNTER)+1
 Q COUNTER
 ;
FINDLOCALIEN(NAME01,FILENUM,IBCODE,IBMESSAGE)  ;FIND THE LOCAL IEN  WE NEED TO MODIFY
 N RETURN,ERROR,INDEX,LOCALIEN,MATCHIEN
 S INDEX="M"
 D FIND^DIC(FILENUM,"","","",NAME01,INDEX,,,,"RETURN","ERROR")
 ;
 I $D(ERROR) D  Q 0
 .S IBMESSAGE($$INC(.IBEMAILIEN))=""
 .S IBMESSAGE($$INC(.IBEMAILIEN))="Error when searching for  "_NAME01_" in file "_FILENUM_"!"
 .S IBMESSAGE($$INC(.IBEMAILIEN))=""
 ;
 I '$D(RETURN) D  Q 0
 .S IBMESSAGE($$INC(.IBEMAILIEN))=""
 .S IBMESSAGE($$INC(.IBEMAILIEN))="Entry "_NAME01_" in file "_FILENUM_" not found."
 .S IBMESSAGE($$INC(.IBEMAILIEN))=""
 ;
 I $P($G(RETURN("DILIST",0)),U)>1 D
 .S IBMESSAGE($$INC(.IBEMAILIEN))=""
 .S IBMESSAGE($$INC(.IBEMAILIEN))="Duplicate entries found for "_NAME01_" in file "_FILENUM
 .S IBMESSAGE($$INC(.IBEMAILIEN))="Using CODE '"_$G(IBCODE)_"' to determine correct record to update."
 .S IBMESSAGE($$INC(.IBEMAILIEN))=""
 .;CHECK FIELD #.18 VALUE CODE 0^NODE P^11
 .S MATCHIEN=$$MATCHCODE(.RETURN,IBCODE,.IBMESSAGE)
 .S LOCALIEN=$P($G(RETURN("DILIST",2,MATCHIEN)),U)
 ;
 ;AT THIS POINT WE HAVE FOUND ONE ENTRY AND WE CAN MODIFY IT
 S:$G(LOCALIEN)="" LOCALIEN=$P($G(RETURN("DILIST",2,1)),U)
 Q LOCALIEN
 ;
 ;CAN THIS BE MORE EFFICIENT?
MATCHCODE(RETURN,IBCODE,IBMESSAGE) ;EP - RETURN LOCAL IEN MATCHING NAME AND CODE OF INCOMING VALUE CODE ENTRY
 N IEN,MATCH
 S MATCH=0
 S IEN=0
 F  S IEN=$O(RETURN("DILIST","ID",IEN)) Q:'IEN  D  Q:$G(MATCH)
 .I IBCODE=RETURN("DILIST","ID",IEN,.02) S MATCH=IEN
 ;
 I 'MATCH D
 .D EN^DDIOL("No distinct match for Value Code "_$G(IBCODE)_" when duplicate records found!")
 .S IBMESSAGE($$INC(.IBEMAILIEN))=""
 .S IBMESSAGE($$INC(.IBEMAILIEN))="No distinct match for Value Code "_$G(IBCODE)_" when duplicate records found!"
 .S IBMESSAGE($$INC(.IBEMAILIEN))=""
 Q MATCH
 ;
MOD(IEN,FILENUM,FDA) ;UPDATE FILE
 N ERROR
 D FILE^DIE("","FDA","ERROR")
 ;
 I $D(ERROR) D
 .D EN^DDIOL("An attempt to update entry "_IEN_" in file "_FILENUM_" failed!","",IBPOSITION)
 .S IBMESSAGE($$INC(.IBEMAILIEN))=""
 .S IBMESSAGE($$INC(.IBEMAILIEN))="An attempt to update entry "_IEN_" in file "_FILENUM_" failed!"
 .S IBMESSAGE($$INC(.IBEMAILIEN))=""
 ;
 Q
 ;
EMAIL(MESSAGE) ; Send an email message to MCCF Developer Team
 N SITE,SUBJ,MSG,XMTO
 D EN^DDIOL("Sending email notification to MCCF Developers ... ","",IBPOSITION)
 S SITE=$$SITE^VASITE
 S SUBJ="POST install report for Patch "_$G(XPDNM)_"v"_$G(XPDNM("TST"))_" at "_$G(SITE)
 S SUBJ=$TR($E(SUBJ,1,65),U," ")
 S MSG(1)="The following site:"
 S MSG(2)=""
 S MSG(3)="        Name: "_$P(SITE,U,2)
 S MSG(4)="    Station#: "_$P(SITE,U,3)
 S MSG(5)="      Domain: "_$G(^XMB("NETNAME"))
 S MSG(6)="   Date/Time: "_$$FMTE^XLFDT($$NOW^XLFDT,"5ZPM")
 S MSG(7)=""
 S MSG(8)=""
 S MSG(9)="This is a "_$S($$PROD^XUPROD(1):"PRODUCTION",1:"TEST")_" account."
 S MSG(10)=""
 M MSG=MESSAGE
 ;
 S XMTO("Timothy.Frazier1@domain.ext")=""
 S XMTO("William.Jutzi@domain.ext")=""
 S XMTO("John.Smith5@domain.ext")=""
 ;
 D SENDMSG^XMXAPI(DUZ,SUBJ,"MSG",.XMTO)
 ;
 Q
 ;
CRRCTSPELL ;EP - FIX SPELLING OF 'LIFETIIME RESERVE DAYS' IN #399.1
 N X,Y,IEN,DIE,DR,DA,DIC,DIR
 S DIC="^DGCR(399.1,"
 S X="LIFETIIME RESERVE DAYS"
 D ^DIC
 S IBMESSAGE($$INC(.IBEMAILIEN))=""
 I Y<1 S IBMESSAGE($$INC(.IBEMAILIEN))="'LIFETIIME RESERVE DAYS' not found in #399.1! Spelling Correction not needed." Q
 S DA=+Y
 K X
 S DIE=DIC
 S DR=".01////LIFETIME RESERVE DAYS"
 D ^DIE
 S IBMESSAGE($$INC(.IBEMAILIEN))="Spelling corrected for LIFETIIME RESERVE DAYS entry in #399.1"
 S IBMESSAGE($$INC(.IBEMAILIEN))=""
 Q