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

DGYVPOST.m

Go to the documentation of this file.
  1. DGYVPOST ;ALB/LD - Patch DG*5.3*64 Post-Init ; 8/8/95
  1. ;;5.3;Registration;**64**;Aug 13, 1993
  1. ;
  1. ;
  1. ;-- Populate FACILITY TREATING SPECIALTY file (#45.7) with effective
  1. ;-- date and active flag from pointed to Effective Date multiple
  1. ;-- entries in the TREATING SPECIALTY file (#42.4).
  1. ;
  1. EN ;-- Entry point
  1. ;
  1. N DGPTQ
  1. D XREFCHK
  1. I $G(DGPTQ) D DONE
  1. I '$G(DGPTQ) D RXREF,POPMUL,ERRPT,INACT^DGYVPST1,DONE
  1. ENQ Q
  1. ;
  1. XREFCHK ;-- Check for "ASPEC" xref in ^DD(45.7
  1. ;
  1. W !!,">>> This post-init will populate the Effective Date multiple of each record",!?4,"in the Facility Treating Specialty file (#45.7).",!!
  1. N I S (DGPTQ,I)=0,I=$O(^DD(45.7,0,"IX","ASPEC",45.7,I))
  1. I '$G(I) S DGPTQ=1
  1. I $G(I) I '$D(^DD(45.7,"IX",I)) S DGPTQ=1
  1. I $G(DGPTQ) W !,"***ERROR: Cross reference ""ASPEC"" in file #45.7 not found.",!?10,"Rerun init DGYVINIT from patch DG*5.3*64 (see patch description",!?10,"for complete instructions).",!
  1. Q
  1. ;
  1. RXREF ;--Reindex Specialty (#1) field "ASPEC" xref in file 45.7
  1. ;
  1. N DIK
  1. S DIK="^DIC(45.7,",DIK(1)="1" D ENALL^DIK
  1. Q
  1. ;
  1. POPMUL ;--Get data from file 42.4 to populate eff date mult in file 45.7
  1. ;
  1. W !!,">>> Post-Init started at: " D NOW^%DTC W $$FTIME^VALM1(%),!
  1. ;
  1. N DGPTERR,DGPTMIEN,DGPTOUT,DGPTSIEN,DIRUT,DTOUT,DUOUT
  1. F DGPTMIEN=0:0 S DGPTMIEN=$O(^DIC(45.7,"ASPEC",DGPTMIEN)) Q:'DGPTMIEN!($G(DGPTOUT)) D
  1. .F DGPTSIEN=0:0 S DGPTSIEN=$O(^DIC(45.7,"ASPEC",DGPTMIEN,DGPTSIEN)) Q:'DGPTSIEN!($G(DGPTOUT)) D
  1. ..N DGPTASK,DGPTEFF,DGPTCTR,DGPTI
  1. ..;--Subentry doesn't exist in file 42.4
  1. ..I '$D(^DIC(42.4,DGPTMIEN,"E",0)) S ^TMP("DGPTERR",$J,DGPTMIEN,DGPTSIEN,1)="" Q
  1. ..;--Get total # of subentries from file 42.4 subfile header node
  1. ..S DGPTCTR=$P($G(^DIC(42.4,DGPTMIEN,"E",0)),U,4) I DGPTCTR'>0 S ^TMP("DGPTERR",$J,DGPTMIEN,DGPTSIEN,2)="" Q
  1. ..F DGPTI=1:1:DGPTCTR Q:$G(DGPTOUT)!($G(DGPTEFF)=0) D POPFAC
  1. POPMULQ Q
  1. ;
  1. POPFAC ;--Populate eff date mult in FTS file #45.7
  1. N DGPTACTF,DGPTEFDT,DGPTNODE,DA,DIC,DIE,DINUM,DR,X,Y
  1. ;--Get effective date and active flag from file 42.4 subentry
  1. S DGPTNODE=$G(^DIC(42.4,DGPTMIEN,"E",DGPTI,0)) I DGPTNODE']"" S ^TMP("DGPTERR",$J,DGPTMIEN,DGPTSIEN,3)="" G POPFACQ
  1. I (DGPTMIEN=70!(DGPTMIEN=71)!(DGPTMIEN=77)),('$G(DGPTASK)) D ASK
  1. I $D(DIRUT)!$D(DUOUT)!$D(DTOUT) S ^TMP("DGPTERR",$J,DGPTMIEN,DGPTSIEN,4)="",DGPTOUT=1 G POPFACQ
  1. I $G(DGPTEFF)=0 S DGPTCTR=1 ;if no to inactivate, add active eff date only
  1. S DGPTEFDT=$P(DGPTNODE,U),DGPTACTF=$P(DGPTNODE,U,2)
  1. ;--Add fields to file 45.7 subentry
  1. S DIC="^DIC(45.7,"_DGPTSIEN_",""E"","
  1. S DIC(0)="L"
  1. S (DA,DINUM)=DGPTI
  1. S X=DGPTEFDT
  1. ;--Extra variables needed since it's a multiple
  1. S DIC("P")=$P(^DD(45.7,100,0),"^",2)
  1. S DA(1)=DGPTSIEN
  1. ;--Create/edit subentry
  1. S DIC("DR")=".02///^S X="_DGPTACTF
  1. K DD,DO D FILE^DICN
  1. I $G(Y)=-1 S ^TMP("DGPTERR",$J,DGPTMIEN,DGPTSIEN,5)=""
  1. I $G(DTOUT)!($G(DUOUT)) S ^TMP("DGPTERR",$J,DGPTMIEN,DGPTSIEN,4)="",DGPTOUT=1 G POPFACQ
  1. ;--Write msg (once) to screen while processing
  1. I $G(Y)>0,($G(DGPTI)<2) W !!,"... Added ",$S('$G(DGPTEFF):"active ",1:"inactive "),"effective date and ",$S('$G(DGPTEFF):"active ",1:"inactive "),"flag to facility",!?4,"treating specialty ",$P($G(^DIC(45.7,DGPTSIEN,0)),U)
  1. ;
  1. POPFACQ Q
  1. ASK ;
  1. W !! S DIR("A")=" Inactivate facility treating specialty"
  1. S DIR("A",1)=" Facility treating specialty, "_$P($G(^DIC(45.7,DGPTSIEN,0)),U)_","
  1. S DIR("A",2)=" is pointing to an inactive treating specialty in the Specialty (#42.4)"
  1. S DIR("A",3)=" file. Answering 'Yes' to this prompt will make the facility treating"
  1. S DIR("A",4)=" specialty inactive also."
  1. S DIR("A",5)=" "
  1. S DIR(0)="Y",DIR("B")="NO" D ^DIR K DIR S (DGPTASK,DGPTEFF)=+Y K Y
  1. W !
  1. ASKQ Q
  1. ;
  1. ERRPT ;--Queue error report for printing or print direct
  1. Q:'$D(^TMP("DGPTERR",$J))
  1. ;
  1. W !!,">>> The following report will list all messages and/or errors which occurred",!?4,"while running this post-init.",!
  1. N POP,ZTDESC,ZTRTN,ZTSAVE,ZTSK
  1. S %ZIS="QMP" D ^%ZIS K %ZIS I POP Q
  1. I '$D(IO("Q")) U IO D PRTERR^DGYVPST1,^%ZISC G ERRPTQ
  1. ; task job
  1. S ZTRTN="PRTERR^DGYVPST1",ZTSAVE("^TMP(""DGPTERR"",$J,")=""
  1. S ZTDESC="Patch DG*5.3*64 Post-Init Error Report"
  1. D ^%ZTLOAD
  1. W !!,$S($D(ZTSK):">>> Job has been queued. The task number is "_ZTSK_".",1:">>> Unable to queue this job.")
  1. ERRPTQ K IO("Q"),^TMP("DGPTERR",$J)
  1. Q
  1. ;
  1. DONE W !!,">>> Post-Init completed at: " D NOW^%DTC W $$FTIME^VALM1(%),!
  1. Q
  1. ;