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

AMH30P10.m

Go to the documentation of this file.
AMH30P10 ; IHS/CMI/LAB - POST INIT BH ;   [ 01/20/2009  3:15 PM ]
 ;;3.0;IHS BEHAVIORAL HEALTH;**10**;JAN 27, 2003
 ;
ENV ;EP 
 I $G(XPDENV)=1 S (XPDDIQ("XPZ1"),XPDDIQ("XPZ2"))=0
 F X="XPO1","XPZ1","XPZ2","XPI1" S XPDDIQ(X)=0
 I '$$INSTALLD("AMH*3.0*9") D SORRY(2)
 Q
 ;
 ;
PRE ;EP
 S DA=0 F  S DA=$O(^AMHSORT(DA)) Q:DA'=+DA  S DIK="^AMHSORT(" D ^DIK
 S DA=0 F  S DA=$O(^AMHRECD(DA)) Q:DA'=+DA  S DIK="^AMHRECD(" D ^DIK
 S DA=0 F  S DA=$O(^AMHTPCAD(DA)) Q:DA'=+DA  S DIK="^AMHTPCAD(" D ^DIK
 Q
 ;
POST ;EP
 D DELETE^XPDMENU("AMH M DATA ENTRY MENU","AMH DE DUPLICATE VISIT")
 D DELETE^XPDMENU("AMH DE MENU MORE","AMH R UNSIGNED")
 ;delete keys and remove them from any options
 F AMHKEY="AMHBHA","AMHBHDEL","AMHBHG","AMHBHR","AMHBHT","AMHBHV","AMHFSP","AMHHSD" D  D DELKEY
 .S AMHX=0 F  S AMHX=$O(^DIC(19,AMHX)) Q:AMHX'=+AMHX  D
 .Q:$E($P(^DIC(19,AMHX,0),U),1,3)'="AMH"
 .Q:$P(^DIC(19,AMHX,0),U,6)'=AMHKEY
 .S DA=AMHX,DIE="^DIC(19,",DR="3///@" D ^DIE K DA,DR,DIE
 ;send message
 ;
 ;UPDATE NEW CODES
 S AMHX=0 F  S AMHX=$O(^AMHTPCAD(AMHX)) Q:AMHX'=+AMHX  D
 .S AMHC=$P(^AMHTPCAD(AMHX,0),U)
 .S AMHN=$P(^AMHTPCAD(AMHX,0),U,2)
 .S AMHPC=$P(^AMHTPCAD(AMHX,0),U,3)
 .S AMHPCI=$O(^AMHPROBC("B",AMHPC,0))
 .I 'AMHPCI S AMHPCI=$O(^AMHPROBC("B","99.9",0))
 .I $D(^AMHPROB("B",AMHC)) D EDIT Q
 .;ADD NEW PROBLEM
 .S X=AMHC,DIC="^AMHPROB(",DIADD=1,DLAYGO=9002012.2,DIC("DR")=".03////"_AMHPCI_";.05///"_AMHC,DIC(0)="L"
 .K DD,D0,DO
 .D FILE^DICN
 .I Y=-1 D EN^DDIOL("failure adding code "_AMHC) K DIC,DIADD,DR,DA,X,DLAYGO Q
 .S $P(^AMHPROB(+Y,0),U,2)=AMHN
 .S DA=+Y,DIK="^AMHPROB(" D IX^DIK K DA,DIK
 .K DIC,DIADD,DLAYGO
 .Q
 ;deactivate codes
 F AMHX=58,82,84 S DA=$O(^AMHPROBC("B",AMHX,0)) I DA S DIE="^AMHPROBC(",DR=".04///1" D ^DIE K DIE,DA,DR
 F AMHX=58,82,84 S DA=$O(^AMHPROB("B",AMHX,0)) I DA S DIE="^AMHPROB(",DR=".13///1;.14////"_DT D ^DIE K DIE,DA,DR
 ;REINDEX ALM xref
 NEW DIK
 S DIK="^AMHREC(",DIK(1)=".21^ALM" D ENALL^DIK
 Q
 ;
EDIT ;
 S DA=$O(^AMHPROB("B",AMHC,0))
 I 'DA Q
 S DIE="^AMHPROB(",DR=".03////"_AMHPCI_";.05///"_AMHC D ^DIE
 S $P(^AMHPROB(DA,0),U,2)=AMHN
 S DIK="^AMHPROB(" D EN1^DIK K DA,DIK
 K DIE,DA,DR
 Q
DELKEY ;
 S DA=$O(^DIC(19.1,"B",AMHKEY,0))
 I DA S DIK="^DIC(19.1," D ^DIK
 K DIK,DA
 Q
 ;
INSTALLD(AMHSTAL) ;EP - Determine if patch AMHSTAL was installed, where
 ; AMHSTAL is the name of the INSTALL.  E.g "AG*6.0*11".
 ;
 NEW AMHY,DIC,X,Y
 S X=$P(AMHSTAL,"*",1)
 S DIC="^DIC(9.4,",DIC(0)="FM",D="C"
 D IX^DIC
 I Y<1 D IMES Q 0
 S DIC=DIC_+Y_",22,",X=$P(AMHSTAL,"*",2)
 D ^DIC
 I Y<1 D IMES Q 0
 S DIC=DIC_+Y_",""PAH"",",X=$P(AMHSTAL,"*",3)
 D ^DIC
 S AMHY=Y
 D IMES
 Q $S(AMHY<1:0,1:1)
IMES ;
 D MES^XPDUTL($$CJ^XLFSTR("Patch """_AMHSTAL_""" is"_$S(Y<1:" *NOT*",1:"")_" installed.",IOM))
 Q
SORRY(X) ;
 KILL DIFQ
 I X=3 S XPDQUIT=2 Q
 S XPDQUIT=X
 W *7,!,$$CJ^XLFSTR("Sorry....FIX IT!",IOM)
 Q