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

AMHLETPS.m

Go to the documentation of this file.
AMHLETPS ; IHS/CMI/LAB - SHARE TP ;
 ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
 ;
 ;
EXIT ;
 Q
EP ;EP
 D FULL^VALM1
 I '$D(^AMHSITE(DUZ(2),13,"B",DUZ)) W !,"You do not have access to share TP's" Q
 ;share
 K DIR S DIR(0)="N^1:"_AMHRCNT_":0",DIR("A")="Select BH Treatment Plan" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 I $D(DIRUT) W !,"No treatment plan selected." Q
 S AMHTPN=+Y I 'AMHTPN K AMHTP,VALMY,XQORNOD W !,"No treatment plan selected." Q
 S AMHTP=$O(AMHPTP("IDX",AMHTPN,0)) I 'AMHTP K AMHTPDEL,AMHTP D PAUSE^AMHLETP1,EXIT Q
 S AMHTP=AMHPTP("IDX",AMHTPN,AMHTP) I 'AMHTP K AMHTP D PAUSE^AMHLETP1,EXIT Q
 I '$D(^AMHPTXP(AMHTP,0)) W !,"Not a valid TREATMENT PLAN." K AMHTPDEL,AMHTP D PAUSE^AMHLETP1,EXIT Q
 S DFN=$P(^AMHPTXP(AMHTP,0),U,2)
 D REGULAR
 Q
REGULAR ;EP
 S DIR(0)="Y",DIR("A")="Do you want to share this TREATMENT PLAN with other providers",DIR("B")="N" KILL DA D ^DIR KILL DIR
 I $D(DIRUT) Q
 I 'Y Q
 K XMY D GETLIST
 I '$D(XMY) G REGULAR
 W !!,"Message will be sent to:" S X=0 F  S X=$O(XMY(X)) Q:X'=+X  W ?28,$P(^VA(200,X,0),U),!
 S DIR(0)="Y",DIR("A")="Ready to send mail message",DIR("B")="Y" KILL DA D ^DIR KILL DIR
 I $D(DIRUT) K XMY,XMTEXT,XMDUZ,XMZ,XMSUB,AMHEFT Q
 I 'Y K XMY,XMTEXT,XMDUZ,XMZ,XMSUB G REGULAR
 D MAILMSG
 Q
GETLIST ;
 K XMY
GETLIST1 ;
 K DIC,DR,DD,D0,DO S DIC="^VA(200,",DIC(0)="AEMQ",DIC("A")="Send to: " D ^DIC
 I Y=-1 Q
 S XMY(+Y)=""
 G GETLIST1
 ;
MAILMSG ;
 S AMHBROW=1,AMHPREV="B"
 K ^TMP("AMHLETPS",$J)
 D GUIR^XBLM("PRINT^AMHLETPP","^TMP(""AMHLETPS"",$J,")
 S (C,X)=0 F  S X=$O(^TMP("AMHLETPS",$J,X)) Q:X'=+X  S C=C+1
 S C=C+1,^TMP("AMHLETPS",$J,C)="THIS MESSAGE CONTAINS CONFIDENTIAL PATIENT INFORMATION.  UNAUTHORIZED"
 S C=C+1,^TMP("AMHLETPS",$J,C)="REPRODUCTION OF THIS FORM MAY VIOLATE PRIVACY ACT STATUTES AND BE"
 S C=C+1,^TMP("AMHLETPS",$J,C)="PUNISHABLE BY LAW."
 S C=C+1,^TMP("AMHLETPS",$J,C)="*********** PLEASE DELETE IMMEDIATELY AFTER REVIEW. ***********"
 S XMSUB="Patient Treatment Plan in Behavioral Health - CONFIDENTIAL"
 S XMDUZ=$P(^VA(200,DUZ,0),U)
 D XMZ^XMA2
 S AMHXMZ=XMZ
 S XMDUZ=$P(^VA(200,DUZ,0),U)
 S XMTEXT="^TMP(""AMHLETPS"",$J,"
 W !,"Sending Mailman message to distribution list"
 D ENL^XMD
 S XMZ=AMHXMZ
 S DA=XMZ,DIE=3.9,DR="1.95///Y;1.96///Y" D ^DIE K DIE,DR,DA
 D ENT1^XMD
 KILL ^TMP("AMHLETPS",$J)
 ;set multiple imn record file
 ;kill vars
 K XMZ,DA,DIE,DR,XMDUZ,AMHXMZ,AMHEFT,XMSUB,AMHX,XMY,AMHBROW,AMHPREV
 W !,"Message Sent  "
 D PAUSE^AMHLETP1
 Q
 ;