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

PXRMHIST.m

Go to the documentation of this file.
  1. PXRMHIST ; SLC/PKR - Routines for dealing with edit histories. ;12/23/2004
  1. ;;2.0;CLINICAL REMINDERS;;Feb 04, 2005
  1. ;
  1. ;=====================================================
  1. DISP(RIEN,MAX) ;Display edit history in reverse date order, newest to oldest.
  1. N CNT,EDATA,EIEN,ETIME,IC,NIN,NOUT,RNAME
  1. N TEXTIN,TEXTOUT,UIEN,USER
  1. ;Last N lines
  1. S CNT=0,EIEN=":"
  1. S RNAME=$P(^PXD(811.9,RIEN,0),U,1)
  1. W !!,"Edit History for reminder "_RNAME_":"
  1. F S EIEN=$O(^PXD(811.9,RIEN,110,EIEN),-1) Q:'EIEN Q:CNT=MAX D
  1. .;Edit date and edit by fields
  1. . S EDATA=$G(^PXD(811.9,RIEN,110,EIEN,0)) Q:EDATA=""
  1. . S ETIME=$P(EDATA,U),UIEN=$P(EDATA,U,2) Q:'UIEN
  1. . S USER=$$GET1^DIQ(200,UIEN,.01),CNT=CNT+1
  1. . W !!,?2,"Edit date: ",$$FMTE^XLFDT(ETIME,"1")
  1. . W ?38,"Edit by: ",USER
  1. . S (IC,NIN)=0
  1. . F S IC=$O(^PXD(811.9,RIEN,110,EIEN,1,IC)) Q:'IC D
  1. .. S NIN=NIN+1
  1. .. S TEXTIN(NIN)=$G(^PXD(811.9,RIEN,110,EIEN,1,IC,0))
  1. . D FORMAT^PXRMTEXT(18,75,NIN,.TEXTIN,.NOUT,.TEXTOUT)
  1. . I NOUT>0 D
  1. .. W !,?2,"Edit Comments:",?1,$P(TEXTOUT(1)," ",17,99)
  1. .. F IC=2:1:NOUT W !,TEXTOUT(IC)
  1. Q
  1. ;
  1. ;=====================================================
  1. MAX() ;Return the maximum number of occurrences to display.
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,MAX,X,Y
  1. S DIR(0)="N^2:99"
  1. S DIR("A")="Maximum number of occurrences to display "
  1. ;Get the edit history count to use as a default value.
  1. S MAX=$G(^PXRM(800,1,"EDIT HISTORY COUNT")) I MAX="" S MAX=2
  1. S DIR("B")=MAX
  1. D ^DIR
  1. I $D(DIROUT)!$D(DIRUT) Q 0
  1. I $D(DTOUT)!$D(DUOUT) Q 0
  1. Q +Y
  1. ;
  1. ;=====================================================
  1. REM ;Select reminder definition for displaying the history.
  1. N IEN,IENN,MAX,PXRMROOT
  1. S IENN=0
  1. S PXRMROOT="^PXD(811.9,"
  1. S MAX=$$MAX
  1. I MAX=0 Q
  1. F Q:IENN=-1 D
  1. . W !
  1. . S IENN=$$SELECT^PXRMINQ(PXRMROOT,"Select Reminder Definition: ","")
  1. . I IENN=-1 Q
  1. . S IEN=$P(IENN,U,1)
  1. . D DISP(IEN,MAX)
  1. Q
  1. ;=====================================================
  1. RMEH ;Remove edit history. This is for items sent directly via KIDS that
  1. ;do not go through Exchange. Reminder computed findings are a good
  1. ;example.
  1. I DUZ(0)'="@" Q
  1. N CLASS,DIR,DIROUT,DIRUT,DTOUT,DUOUT,EH,ENTRY,IEN
  1. N FIELD,FILENUM,GLOBAL,NAME,X,Y
  1. W !,"Remove edit history from national reminder files.",!
  1. S DIR(0)="NAOU^0::15"
  1. S DIR("A")="Enter the file number: "
  1. D ^DIR
  1. I $D(DIROUT)!$D(DIRUT) Q
  1. I (Y="")!($D(DTOUT))!($D(DUOUT)) Q
  1. S FILENUM=+Y
  1. S FIELD=$$GET1^DID(FILENUM,110,"","LABEL")
  1. I FIELD'="EDIT HISTORY" D Q
  1. . W !,"This is no Edit History in this file!"
  1. S NAME=$$GET1^DID(FILENUM,"","","NAME")
  1. W !,"Looking for edit histories in file ",NAME
  1. S GLOBAL=$$GET1^DID(FILENUM,"","","GLOBAL NAME")
  1. S ENTRY=GLOBAL_"IEN)"
  1. S IEN=0
  1. F S IEN=+$O(@ENTRY) Q:(IEN=0)!($G(DUOUT)) D
  1. . S CLASS=GLOBAL_"IEN,100)"
  1. . S CLASS=$P(@CLASS,U,1)
  1. . I CLASS'="N" Q
  1. . S NAME=GLOBAL_"IEN,0)"
  1. . S NAME=$P(@NAME,U,1)
  1. . K DIR
  1. . S DIR(0)="YA"
  1. . S DIR("A")="Delete Edit History from entry "_NAME_"? "
  1. . S DIR("B")="N"
  1. . D ^DIR
  1. . I $D(DIROUT)!$D(DIRUT) Q
  1. . I (Y="")!($D(DTOUT))!($D(DUOUT)) Q
  1. . I 'Y Q
  1. . S EH=GLOBAL_"IEN,110)"
  1. . K @EH
  1. . S EH=GLOBAL_"IEN,110,0)"
  1. . S @EH="^811.9001D^^0"
  1. Q
  1. ;