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

SDES843P.m

Go to the documentation of this file.
SDES843P ;ALB/MGD,LAB - SD*5.3*843 Post Init Routine ; May 10, 2023
 ;;5.3;SCHEDULING;**843**;AUG 13, 1993;Build 9
 ;;Per VHA Directive 6402, this routine should not be modified
 ;
 Q
 ;
EN ; Update the VS GUI version in #409.98
 D FIND,TASK
 Q
 ;
FIND ;FIND THE IEN FOR "VS GUI NATIONAL"
 N SDECDA,SDECDA1
 D MES^XPDUTL("")
 D MES^XPDUTL("   Updating SDEC SETTINGS file (#409.98)")
 S SDECDA=0,SDECDA=$O(^SDEC(409.98,"B","VS GUI NATIONAL",SDECDA)) G:$G(SDECDA)="" NOFIND
 D VERSION   ;update GUI version number and date
 Q
VERSION ;SET THE NEW VERSION UPDATE IN SDEC SETTING FILE #409.98 TO 1.7.41
 S DA=SDECDA,DIE=409.98,DR="2///1.7.41;3///"_DT D ^DIE  ;update VS GUI NATIONAL
 K DIE,DR,DA
 S SDECDA1=0,SDECDA1=$O(^SDEC(409.98,"B","VS GUI LOCAL",SDECDA1)) Q:$G(SDECDA1)=""    ;get DA for the VS GUI LOCAL
 S DA=SDECDA1,DIE=409.98,DR="2///1.7.41;3///"_DT D ^DIE  ;update VS GUI LOCAL
 K DIE,DR,DA
 Q
 ;
NOFIND ;"VS GUI NATIONAL" NOT FOUND
 D MES^XPDUTL("   VS GUI NATIONAL not found in the SDEC SETTINGS file (#409.98)")
 Q
TASK ;
 D MES^XPDUTL("")
 D MES^XPDUTL("   SD*5.3*843 Post-Install to report Recall Appointments ")
 D MES^XPDUTL("   cancelled using Block and Move since SD*5.3*842 released")
 D MES^XPDUTL("   queued to run in the background. Once it finishes")
 D MES^XPDUTL("   a MailMan message will be sent to the installer.")
 D MES^XPDUTL("")
 N ZTDESC,ZTRTN,ZTIO,ZTSK,X,ZTDTH,ZTSAVE
 S ZTDESC="SD*5.3*843 -  Post Install Report Routine"
 D NOW^%DTC S ZTDTH=X,ZTIO="",ZTRTN="DATAREPORT^SDES843P",ZTSAVE("*")="" D ^%ZTLOAD
 Q
DATAREPORT ;
 N PURGEDT,CNT,TEXTCNT,CANCELTM,APPTIEN,CANCREAS,APPTTYP
 S PURGEDT=$$FMADD^XLFDT(DT,5)
 K ^XTMP("SDES843P")
 S ^XTMP("SDES843P",0)=PURGEDT_"^"_DT_"^843 Post Install Recalls Block and moved"
 S CNT=0
 S TEXTCNT=0
 S CANCELTM=3230503
 F  S CANCELTM=$O(^SDEC(409.84,"AD",CANCELTM)) Q:(CANCELTM="")  D
 . S APPTIEN=""
 . F  S APPTIEN=$O(^SDEC(409.84,"AD",CANCELTM,APPTIEN)) Q:(APPTIEN="")  D
 .. S CANCREAS=$$GET1^DIQ(409.84,APPTIEN_",",.122,"E")
 .. Q:CANCREAS'="BLOCK AND MOVE"
 .. S APPTTYP=$$GET1^DIQ(409.84,APPTIEN_",",.22,"E")
 .. Q:APPTTYP'="RECALL"
 .. D GETINFO(APPTIEN,CANCELTM,.APPTDFN,.PATIENTNAME)
 S ^XTMP("SDES843P",(TEXTCNT+1))="Total = "_CNT
 D MAIL
 Q
 ;
GETINFO(APPTIEN,CANCELTM,APPTDFN,PATIENTNAME) ;
 N CREATEDT,APPTDFN,PATIENTNAME,NEWAPPTIEN,CREATEBYUSER,CREATEDBYNAME,NEWAPPTNOTE
 N CANBYUSER,APPTNOTE
 S CREATEDT=$P(CANCELTM,".")
 S APPTDFN=$$GET1^DIQ(409.84,APPTIEN_",",.05,"I")
 S PATIENTNAME=$$GET1^DIQ(409.84,APPTIEN_",",.05,"E")
 S CANBYUSER=$$GET1^DIQ(409.84,APPTIEN_",",.121,"I")
 D APPT(APPTIEN,APPTDFN,PATIENTNAME,.CNT,.TEXTCNT)
 S NEWAPPTIEN=APPTIEN
 F  S NEWAPPTIEN=$O(^SDEC(409.84,"CPAT",APPTDFN,NEWAPPTIEN)) Q:NEWAPPTIEN=""  D
 . Q:(CREATEDT'=$P($$GET1^DIQ(409.84,NEWAPPTIEN_",",.09,"I"),"."))
 . S CREATEBYUSER=$$GET1^DIQ(409.84,NEWAPPTIEN_",",.08,"I")
 . Q:(CREATEBYUSER'=CANBYUSER)
 . S APPTNOTE=$$GET1^DIQ(409.84,APPTIEN_",",1,"E")
 . S NEWAPPTNOTE=$$GET1^DIQ(409.84,NEWAPPTIEN_",",1,"E")
 . Q:(APPTNOTE'=NEWAPPTNOTE)
 . Q:($$GET1^DIQ(409.84,NEWAPPTIEN_",",.22,"E")'="")
 . S CREATEDBYNAME=$$GET1^DIQ(409.84,NEWAPPTIEN_",",.08,"E")
 . D NEWAPPT(NEWAPPTIEN,CREATEDBYNAME,.TEXTCNT)
 Q
APPT(APPTIEN,APPTDFN,PATIENTNAME,CNT,TEXTCNT) ;
 S CNT=CNT+1
 S TEXTCNT=TEXTCNT+1
 S ^XTMP("SDES843P",TEXTCNT)=" Appointment                   : "_APPTIEN
 S TEXTCNT=TEXTCNT+1
 S ^XTMP("SDES843P",TEXTCNT)=" Appointment Date/Time         : "_$$GET1^DIQ(409.84,APPTIEN_",",.01,"E")
 S TEXTCNT=TEXTCNT+1
 S ^XTMP("SDES843P",TEXTCNT)=" Cancel Date/Time              : "_$$GET1^DIQ(409.84,APPTIEN_",",.12,"E")
 S TEXTCNT=TEXTCNT+1
 S ^XTMP("SDES843P",TEXTCNT)=" Patient on appointment        : "_APPTDFN_"  "_$E(PATIENTNAME,1,1)_$$LAST4SSN^SDESINPUTVALUTL(APPTDFN)
 S TEXTCNT=TEXTCNT+1
 S ^XTMP("SDES843P",TEXTCNT)=""
 Q
 ;
NEWAPPT(NEWAPPTIEN,CREATEDBYNAME,TEXTCNT) ;
 S TEXTCNT=TEXTCNT+1
 S ^XTMP("SDES843P",TEXTCNT)="   New Appointment               : "_NEWAPPTIEN
 S TEXTCNT=TEXTCNT+1
 S ^XTMP("SDES843P",TEXTCNT)="   New Appointment Date/Time     : "_$$GET1^DIQ(409.84,NEWAPPTIEN_",",.01,"E")
 S TEXTCNT=TEXTCNT+1
 S ^XTMP("SDES843P",TEXTCNT)="   New Appointment created by    : "_CREATEDBYNAME
 S TEXTCNT=TEXTCNT+1
 S ^XTMP("SDES843P",TEXTCNT)=""
 Q
 ;
MAIL ;
 ; Appointment vs request data report
 ;
 N STANUM,MESS1,XMTEXT,XMSUB,XMY,XMDUZ,DIFROM
 S STANUM=$$KSP^XUPARAM("INST")_","
 S STANUM=$$GET1^DIQ(4,STANUM,99)
 S MESS1="Station: "_STANUM_" - "
 ;
 ; Send MailMan message
 S XMDUZ=DUZ
 S XMTEXT="^XTMP(""SDES843P"","
 S XMSUB=MESS1_"SD*5.3*843 - Post Install Block and Move Report"
 S XMDUZ=.5,XMY(DUZ)="",XMY(XMDUZ)=""
 S XMY("BARBER.LORI@DOMAIN.EXT")=""
 S XMY("DILL.MATT@DOMAIN.EXT")=""
 S XMY("REESE,DARRYL M@DOMAIN.EXT")=""
 D ^XMD
 K TEXT
 Q