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

ATSTEMP.m

Go to the documentation of this file.
ATSTEMP ; IHS/CMI/LAB - MANAGE SEARCH TEMPLATES ;
 ;;2.0;IHS PCC SUITE;**2**;MAY 14, 2009
 ;
 D INIT,CALLDIK,CHECK,MAIL:$D(ATSENDML)
 D EOJ
 Q
 ;
INIT ;
 S U="^",ATSCREEN=""
 I '$D(DT) S %DT="",X="T" D ^%DT S DT=Y
 K ^UTILITY("ATSMANAGE")
 Q
 ;
CALLDIK ;DELETE SEARCH TEMPLATES NOT INDICATED AS SAVE IN SEARCH TEMPLATE FILE
 S ATSDA=0 F L=0:0 S ATSDA=$O(^ATSMNG(ATSDA)) Q:'ATSDA  D
 .I $P(^DIBT(ATSDA,0),U,1)="RPMS DEMO PATIENT NAMES" Q
 .I $P($G(^BGPSITE(DUZ(2),0)),U,12)=ATSDA Q
 .S:$P(^ATSMNG(ATSDA,0),U,2)'="Y"&('$D(^ATSMGR(ATSDA))) ATSDIBT="" S DA=ATSDA,DIK="^ATSMNG(" D ^DIK I $D(ATSDIBT) S DA=ATSDA,DIK="^DIBT(" D ^DIK K DIK,DA,ATSDIBT
 Q
 ;
CHECK ;FIND SEARCH TEMPLATES>30 DAYS OLD
 ;S ATSX=0 F L=0:0 S ATSX=$O(^DIBT(ATSX)) Q:ATSX'=+ATSX  I $D(^DIBT(ATSX,1))!$D(^DIBT(ATSX,"DIS")),$P(^DIBT(ATSX,0),U,2)+30<DT,'$D(^ATSMGR(ATSX)) D SETUP
 S ATSX=0 F L=0:0 S ATSX=$O(^DIBT(ATSX)) Q:ATSX'=+ATSX  D
 .Q:$P(^DIBT(ATSX,0),U,2)=""  ;no date
 .S ATSND=$$FMADD^XLFDT($P(^DIBT(ATSX,0),U,2),365)
 .I $D(^DIBT(ATSX,1))!$D(^DIBT(ATSX,"DIS")),ATSND<DT,'$D(^ATSMGR(ATSX)) D SETUP ;WHAT IF 0 NODE NOT DEFINED-DONT BLOW UP BY ADDING THE $G IHS/OKCAO/POC 1/17/00
 Q
 ;
SETUP ;UTILITY NODES FOR CREATING BULLETIN
 S (ATSCNT,ATSNODE)=0 F L=0:0 S ATSNODE=$O(^DIBT(ATSX,1,ATSNODE)) Q:'ATSNODE  S ATSCNT=ATSCNT+1 I $D(ATSNTSK) W:'(ATSCNT#50) "."
 Q:'$D(^DIBT(ATSX,0))  ;QUIT IF NO ZERO NODE IHS/OKCAO/POC 1/17/00
 Q:$P(^DIBT(ATSX,0),U,1)="RPMS DEMO PATIENT NAMES"
 I $P($G(^BGPSITE(DUZ(2),0)),U,12)=ATSX Q
 S ATSNODE=^DIBT(ATSX,0)
 S ATSDUZ=$P(ATSNODE,U,5) G:'ATSDUZ!(ATSDUZ="@")!('$O(^VA(200,ATSDUZ))) A
 S ATSNAME=$P(ATSNODE,U)
 S ATSFILEN=$P(ATSNODE,U,4) S ATSFILE=$S('ATSFILEN:"FILE NAME UNKNOWN",1:$P(^DIC(ATSFILEN,0),U)) S:'ATSFILEN ATSFILEN="FILE NUMBER UNKNOWN"
 S Y=$P(ATSNODE,U,2) X:Y]"" ^DD("DD") S ATSDATE=$S(Y]"":Y,1:"NO DATE INDICATED")
 S ^UTILITY("ATSMANAGE",$J,ATSDUZ,ATSNAME,ATSFILE,ATSFILEN,ATSDATE,ATSCNT)=""
 S ATSENDML="" ;NOW KNOW THERE IS MAIL TO SEND
 D SEARCH
A Q
 ;
 S X="`"_ATSX,DIC(0)="FML",DIC="^ATSMNG(",DLAYGO=9002220,DIADD=1,DIC("DR")=".03///"_ATSDUZ D ^DIC K DIC,DLAYGO,DIADD
 Q
 ;
MAIL ;SEND MAIL MESSAGES TO USERS RE:TEMPLATES
 S XMDUZ=.5,XMTEXT="ATSMAIL("
 S XMSUB="*** NOTICE OF SEARCH TEMPLATE(S) DELETION ***"
 S ATSMAIL(1,0)="THE FOLLOWING SEARCH TEMPLATE(S) WILL BE DELETED IN 60 DAYS UNLESS YOU INDICATE",ATSMAIL(2,0)="OTHERWISE WITHIN THE SAVE SEARCH TEMPLATE OPTION EITHER ON THE SEARCH TEMPLATE"
 S ATSMAIL(3,0)="SYSTEM MENU OR ON ANOTHER MENU YOU HAVE ACCESS TO.  CONTACT YOUR SITE MANAGER",ATSMAIL(4,0)="IF YOU HAVE ANY QUESTIONS.",ATSMAIL(5,0)=" "
 S (ATSDUZ,ATSNAME)=0
 F L=0:0 S ATSDUZ=$O(^UTILITY("ATSMANAGE",$J,ATSDUZ)) Q:'ATSDUZ  S ATSUB=5 D MAILVAR,SENDMSG
 Q
 ;
MAILVAR ;SET UP VARIABLES FOR MAIL MESSAGE
 F L=0:0 S ATSNAME=$O(^UTILITY("ATSMANAGE",$J,ATSDUZ,ATSNAME)) Q:ATSNAME=""  S ATSFILE=$O(^(ATSNAME,"")),ATSFILEN=$O(^(ATSFILE,"")),ATSDATE=$O(^(ATSFILEN,"")),ATSCNT=$O(^(ATSDATE,"")) D CONTLOOP
 Q
 ;
CONTLOOP ;SET UP MORE VARIABLES FOR MAIL MESSAGE
 S ATSUB=ATSUB+1,ATSMAIL(ATSUB,0)="TEMPLATE NAME: "_ATSNAME
 S ATSUB=ATSUB+1,ATSMAIL(ATSUB,0)="FILE NAME: "_ATSFILE_"     FILE NUMBER: "_ATSFILEN
 S ATSUB=ATSUB+1,ATSMAIL(ATSUB,0)="DATE TEMPLATE CREATED: "_ATSDATE
 S ATSUB=ATSUB+1,ATSMAIL(ATSUB,0)="NUMBER OF SEARCH TEMPLATE ENTRIES: "_ATSCNT
 S ATSUB=ATSUB+1,ATSMAIL(ATSUB,0)=" "
 Q
 ;
SENDMSG ;SENDS MESSAGE TO USER
 S XMY(ATSDUZ)=""
 D ^XMD
 K ATSMAIL
 Q
 ;
EOJ ;
 K ATSX,ATSCREEN,ATSDA,ATSDUZ,ATSNAME,ATSFILE,ATSCNT,ATSNODE,ATSDIBT,ATSDATE,ATSENDML,ATSFILN,ATSUB,ATSMAIL,^UTILITY("ATSMANAGE")
 Q
 ;