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

ADECD46.m

Go to the documentation of this file.
ADECD46 ; IHS/SET/HMW - ADA CODE TABLE UPDATE (CDT4) ;  
 ;;6.0;ADE;**14**;MAR 25, 1999
 S U="^"
 ;
ADA ;
 ;
 N ADEFILE,ADEWPFLD,ADEIENST,ADECNT,ADEDONE,ADEMOD,ADERN,ADEDONE,ADERTN
 N ADERLN,ADEID,ADECODE,ADEDESC,ADEUSE,ADETXT,ADELEV,ADESYN,ADEMNE,ADENOP
 N ADEMIN,ADEICD9,ADEFDA,ADEEMSG
 S ADEFILE=9999999.31,ADEWPFLD=1101,ADEIENST="?+1,",ADECNT=0,ADEDONE=0,ADEMOD=0
 ;Copy ^AUTTADA to ^ADEOCD46 to backup ADA Codes before the update
 I '$D(^ADEOCD46) S %X="^AUTTADA(",%Y="^ADEOCD46(" D %XY^%RCR K %X,%Y
 S DIK="^AUTTADA(" D IXALL^DIK K DIK
 ;Update ADA codes
 F ADERN=1,2 D ADA1(ADERN) Q:ADEDONE
 D ADAUPD
 Q
 ;
ADA1(ADERN) ;
 S ADERTN="ADECD47"_ADERN
 F ADERLN=4:1 S X=$T(+ADERLN^@ADERTN) Q:X=""  D  Q:ADEDONE
 .S X=$P(X,";",3,$L(X,";")) Q:X=""
 .S ADEID=$P(X,U) I ADEID="***END***" S ADEDONE=1 Q
 .I ADEID="CODE" D:ADECNT ADAUPD S ADECODE=$P(X,U,2),ADEDESC=$P(X,U,3),ADECNT=ADECNT+1,ADEUSE=0,ADETXT=0,(ADELEV,ADEMIN,ADEICD9,ADESYN,ADEMNE,ADENOP)=""
 .I ADEID="SVC" D  Q
 . . S ADELEV=$P(X,U,2),ADEMIN=$P(X,U,3),ADEICD9=$P(X,U,4)
 . . Q:ADEICD9=""
 . . S ADEICD9=+$O(^ICD9("AB",ADEICD9,0))
 . . S:'+ADEICD9 ADEICD9=""
 . . Q
 .I ADEID="SYN" S ADESYN=$P(X,U,2) Q
 .I ADEID="MNE" S ADEMNE=$P(X,U,2) Q
 .I ADEID="NOP" S ADENOP=$P(X,U,2) Q
 .I ADEID="USE" S ADEUSE=1 Q
 .I ADEUSE S ADETXT=ADETXT+1,ADETEXT(ADETXT)=X Q
 I X="",ADERLN=4,$T(+ADERLN^@ADERTN)="" S ADEDONE=1
 Q
 ;
ADAUPD ;
 S ADEMOD=0,ADEIENST="?+1,"
 I $D(^AUTTADA("B",ADECODE)) S ADEIENST=+$O(^AUTTADA("B",ADECODE,0))_",",ADEMOD=1
 S ADEFDA(ADEFILE,ADEIENST,.01)=ADECODE,ADEFDA(ADEFILE,ADEIENST,.02)=ADEDESC
 S:ADEICD9'="" ADEFDA(ADEFILE,ADEIENST,.03)=ADEICD9
 S:ADEMIN'="" ADEFDA(ADEFILE,ADEIENST,.04)=ADEMIN
 S:ADELEV'="" ADEFDA(ADEFILE,ADEIENST,.05)=ADELEV
 S:ADESYN'="" ADEFDA(ADEFILE,ADEIENST,.06)=ADESYN
 S:ADENOP'="" ADEFDA(ADEFILE,ADEIENST,.09)=ADENOP
 S:ADEMNE'="" ADEFDA(ADEFILE,ADEIENST,8801)=ADEMNE
 S ADEFDA(ADEFILE,ADEIENST,.08)="@" ;Inactivation date
 D UPDATE
 Q
 ;
UPDATE ;
 I ADEMOD=0 D
 . D UPDATE^DIE(,"ADEFDA","ADEIEN","ADEEMSG")
 . K ADEFDA,ADEEMSG
 I ADEMOD=1 D
 . D FILE^DIE(,"ADEFDA","ADEEMSG")
 . S ADEIEN(1)=+ADEIENST
 . K ADEFDA,ADEEMSG
 I ADETXT,ADETXT>1!(ADETEXT(1)'="") D WP^DIE(ADEFILE,ADEIEN(1)_",",ADEWPFLD,,"ADETEXT","ADEEMSG")
 K ADETEXT,ADEEMSG,ADEIEN
 Q
KILL ;
 K ADEADA,ADECNT,ADECODE,ADEDESC,ADEDONE,ADEFDA,ADEFILE,ADEICD9,ADEID,ADEIENST,ADELEV,ADEMIN,ADEMNE,ADEMOD,ADERLN,ADERN,ADERTN,ADESYN,ADETDT,ADETEXT,ADETXT,ADEUSE,ADEWPFLD,ADENOP,DA,DIC,DIE,DR,X
 Q