Index: FOIAVistA/tag/r/CLINICAL_REMINDERS-PXRM/PXRMEXLC.m
===================================================================
--- FOIAVistA/trunk/r/CLINICAL_REMINDERS-PXRM/PXRMEXLC.m	(revision 631)
+++ FOIAVistA/tag/r/CLINICAL_REMINDERS-PXRM/PXRMEXLC.m	(revision 636)
@@ -1,4 +1,4 @@
-PXRMEXLC ; SLC/PKR/PJH - Routines to display repository entry components. ;08/03/2007
- ;;2.0;CLINICAL REMINDERS;**4,6**;Feb 04, 2005;Build 123
+PXRMEXLC ; SLC/PKR/PJH - Routines to display repository entry components. ;06/22/2004
+ ;;2.0;CLINICAL REMINDERS;**4**;Feb 04, 2005;Build 21
  ;======================================================
 BLDLIST(FORCE) ;Build a list of all repository entries.
@@ -7,6 +7,9 @@
  I $D(^TMP("PXRMEXLR",$J,"VALMCNT")) S VALMCNT=^TMP("PXRMEXLR",$J,"VALMCNT")
  E  D
- . D REXL^PXRMLIST("PXRMEXLR")
- . S VALMCNT=^TMP("PXRMEXLR",$J,"VALMCNT")
+ . N IEN,RELIST
+ . D RE^PXRMLIST(.RELIST,.IEN)
+ . M ^TMP("PXRMEXLR",$J)=RELIST
+ . S VALMCNT=RELIST("VALMCNT")
+ . F IND=1:1:VALMCNT S ^TMP("PXRMEXLR",$J,"IDX",IND,IND)=IEN(IND)
  Q
  ;
@@ -76,4 +79,20 @@
  ;
  ;======================================================
+DDISP(IND,NITEMS,FILENUM) ;Setup dialog display list.
+ N JND,NLINE,NSEL,TEMP
+ S (NLINE,NSEL)=0
+ F JND=1:1:NITEMS D
+ . S TEMP=^PXD(811.8,IEN,120,IND,1,JND,0)
+ . S PT01=$P(TEMP,U,1)
+ . S EXISTS=$$EXISTS^PXRMEXIU(FILENUM,PT01,"W")
+ . S NLINE=NLINE+1
+ . S NSEL=NSEL+1
+ . S ^TMP("PXRMEXLD",$J,NLINE,0)=$$FMTDATA(NSEL,PT01,CAT,EXISTS)
+ . S ^TMP("PXRMEXLD",$J,"IDX",NLINE,NSEL)=""
+ .;Store the file number, start and stop line in the repository.
+ . S ^TMP("PXRMEXLD",$J,"SEL",NSEL)=FILENUM_U_$P(TEMP,U,2,3)
+ Q
+ ;
+ ;======================================================
 FMTDATA(NSEL,PT01,CAT,EXISTS) ;Format items for display.
  N NSTI,TEMP
@@ -88,4 +107,50 @@
  ;
  ;======================================================
+HISTLIST(LIST,VALMCNT) ;Build a list of install histories in
+ ;^TMP("PXRMEXIH",$J).
+ N DATE,DC,ENTRY,IHIND,IND,INDONE,NLINE,NSEL,RIEN,SOURCE,TEMP,USER
+ K ^TMP("PXRMEXIH",$J)
+ S (NLINE,NSEL)=0
+ S IND=""
+ F  S IND=$O(LIST(IND)) Q:IND=""  D
+ . S RIEN=^TMP("PXRMEXLR",$J,"IDX",IND,IND)
+ . I $D(^PXD(811.8,RIEN,130)) S INDONE=1
+ . E  S INDONE=0
+ . S TEMP=^PXD(811.8,RIEN,0)
+ . S ENTRY=$P(TEMP,U,1)
+ . S SOURCE=$P(TEMP,U,2)
+ . S DATE=$P(TEMP,U,3)
+ . S NLINE=NLINE+1
+ . I INDONE S NSEL=NSEL+1
+ . S ^TMP("PXRMEXIH",$J,NLINE,0)=$$FRE^PXRMLIST(" ",ENTRY,SOURCE,DATE)
+ . I INDONE S ^TMP("PXRMEXIH",$J,"IDX",NLINE,NSEL)=""
+ . S NLINE=NLINE+1
+ . S ^TMP("PXRMEXIH",$J,NLINE,0)="     Installation Date       Installed By"
+ . I INDONE S ^TMP("PXRMEXIH",$J,"IDX",NLINE,NSEL)=""
+ . S NLINE=NLINE+1
+ . S ^TMP("PXRMEXIH",$J,NLINE,0)="     -----------------       ------------"
+ . I INDONE S ^TMP("PXRMEXIH",$J,"IDX",NLINE,NSEL)=""
+ . I 'INDONE D  Q
+ .. S NLINE=NLINE+1
+ .. S ^TMP("PXRMEXIH",$J,NLINE,0)="      none"
+ .. S NLINE=NLINE+1
+ .. S ^TMP("PXRMEXIH",$J,NLINE,0)=" "
+ . S DATE="",DC=0
+ . F  S DATE=$O(^PXD(811.8,RIEN,130,"B",DATE)) Q:DATE=""  D
+ .. S NLINE=NLINE+1
+ .. S DC=DC+1
+ .. I DC>1 S NSEL=NSEL+1
+ .. S IHIND=$O(^PXD(811.8,RIEN,130,"B",DATE,""))
+ .. S TEMP=^PXD(811.8,RIEN,130,IHIND,0)
+ .. S ^TMP("PXRMEXIH",$J,NLINE,0)=$$RJ^XLFSTR(NSEL,4," ")_" "_$$FMTE^XLFDT($P(TEMP,U,1),"5Z")_"   "_$P(TEMP,U,2)
+ .. S ^TMP("PXRMEXIH",$J,"IDX",NLINE,NSEL)=""
+ .. S ^TMP("PXRMEXIH",$J,"SEL",NSEL)=RIEN_U_IHIND
+ . S NLINE=NLINE+1
+ . S ^TMP("PXRMEXIH",$J,NLINE,0)=" "
+ . S ^TMP("PXRMEXIH",$J,"IDX",NLINE,NSEL)=""
+ S VALMCNT=NLINE
+ Q
+ ;
+ ;======================================================
 INSCHR(NUM,CHR) ;Return a string of NUM characters (CHR).
  N IND,TEMP
@@ -96,10 +161,32 @@
  ;
  ;======================================================
-ORDER(STRING,ORDER) ;Rebuild string in ascending or descending order.
- N ARRAY,ITEM,CNT
- F CNT=1:1 S ITEM=$P(STRING,",",CNT) Q:'ITEM  S ARRAY(ITEM)=""
- K STRING
- F CNT=1:1 S ITEM=$O(ARRAY(ITEM),ORDER) Q:'ITEM  D
- .S $P(STRING,",",CNT)=ITEM
+DREPL ;
+ N STR,I
+ K PXRMEXOR
+ S NLINE=NLINE+1,^TMP("PXRMEXLD",$J,NLINE,0)=$J("",79)
+ S STR="" F I=1:1:30 S STR=STR_"-"
+ S NLINE=NLINE+1,^TMP("PXRMEXLD",$J,NLINE,0)=$J(STR_" REPLACEMENT ITEMS "_STR,79)
+DREPL1 ;
+ M ^TMP($J,"PXRMEXREP")=PXRMEXRP
+ K PXRMEXRP
+ ;S ^TMP("PXRMEXLD",$J,"IDX",NLINE,NSEL)="
+ N CNT,DLG,DDATA,DDLG,DEND,DNAM,DREP,DSTRT,IND,JND,LEV,TEMP
+ ;S LEV="" F  S LEV=$O(^TMP($J,"PXRMEXREP",LEV)) Q:LEV=""  D
+ S LEV=0
+ S DLG="" F  S DLG=$O(^TMP($J,"PXRMEXREP",DLG)) Q:DLG=""  D
+ .S DDATA=$G(^TMP("PXRMEXTMP",$J,"DREPL",DLG)) Q:DDATA=""
+ .S DNAM=$P(DDATA,U),DSTRT=$P(DDATA,U,2),DEND=$P(DDATA,U,3) Q:DNAM=""
+ .I $D(PXRMEXOR(DNAM))>0 Q
+ .S PXRMEXOR(DNAM)=""
+ .S IND=$P(DDATA,U,4),JND=$P(DDATA,U,5)
+ .;Check if this component has been replaced
+ .S LEV=LEV+1
+ .S DREP=$G(PXRMNMCH(FILENUM,DNAM)) I DREP=DNAM S DREP=""
+ .;Save line in workfile
+ .S NLINE=NLINE+1,^TMP("PXRMEXLD",$J,NLINE,0)=$J("",79)
+ .S ^TMP("PXRMEXLD",$J,"IDX",NLINE,NSEL)=""
+ .D DLINE^PXRMEXLD(DNAM,LEV,"")
+ .I $D(^TMP("PXRMEXTMP",$J,"DMAP",DNAM)) D DCMP^PXRMEXLD(DNAM,LEV)
+ K ^TMP($J,"PXRMEXREP")
+ I $D(PXRMEXRP)>0 D DREPL1
  Q
- ;
