Index: FOIAVistA/tag/r/CLINICAL_REMINDERS-PXRM/PXRMTEXT.m
===================================================================
--- FOIAVistA/trunk/r/CLINICAL_REMINDERS-PXRM/PXRMTEXT.m	(revision 631)
+++ FOIAVistA/tag/r/CLINICAL_REMINDERS-PXRM/PXRMTEXT.m	(revision 636)
@@ -1,6 +1,6 @@
-PXRMTEXT ; SLC/PKR - Text formatting utility routines. ;07/19/2007
- ;;2.0;CLINICAL REMINDERS;**6**;Feb 04, 2005;Build 123
+PXRMTEXT ; SLC/PKR - Text formatting utility routines. ;11/03/2004
+ ;;2.0;CLINICAL REMINDERS;;Feb 04, 2005
  ;
- ;============================================
+ ;================================================================
 NEWLINE ;Put TEXT on a new line to the output, make sure it does not end
  ;with a " ".
@@ -14,5 +14,5 @@
  Q
  ;
- ;============================================
+ ;================================================================
 BLANK ;Add a blank line (line containing just " ") to the output.
  S NOUT=NOUT+1,TEXTOUT(NOUT)=" "
@@ -20,5 +20,5 @@
  Q
  ;
- ;============================================
+ ;================================================================
 CHECKLEN(WORD) ;Check to see if adding the next word makes the line too long.
  ;If it does add it to the output and start a new line.
@@ -34,83 +34,5 @@
  Q
  ;
- ;============================================
-COLFMT(FMTSTR,TEXTSTR,PC,NL,OUTPUT) ;Columnar text formatter.
- ;FMTSTR - format string; ^ separated string for each column in the
- ;output. 35R2 defines a right justified column 35 characters wide
- ;with 2 blank spaces following. Columns can be centered (C) left
- ;justified (L) or right justified (R).
- ;TEXTSTR - string to be formated
- ;PC - the pad character
- ;NL - number of lines of output
- ;OUTPUT - array containing output lines.
- N COLOUT,ENTRY,FMT,JND,JUS,IND,LEN,NCOL,NLO,NROW,SP,TEMP,TEXT,WIDTH,WPSP
- S NCOL=$L(FMTSTR,U),NROW=1
- F IND=1:1:NCOL D
- . S FMT=$P(FMTSTR,U,IND)
- . S JUS(IND)=$S(FMT["C":"C",FMT["L":"L",FMT["R":"R",1:"C")
- . S WIDTH(IND)=$P(FMT,JUS(IND),1)
- . S SP(IND)=$P(FMT,JUS(IND),2)
- . S WPSP(IND)=WIDTH(IND)+SP(IND)
- F IND=1:1:NCOL D
- . S ENTRY=$S(JUS(IND)="C":"CJ",JUS(IND)="L":"LJ",JUS(IND)="R":"RJ")
- . S TEMP=$P(TEXTSTR,U,IND)
- . S LEN=$L(TEMP)
- . I LEN'>WIDTH(IND) D
- .. S TEMP=$$@ENTRY^XLFSTR(TEMP,WIDTH(IND),PC)
- .. S COLOUT(1,IND)=TEMP_$$LJ^XLFSTR("",SP(IND)," ")
- . I LEN>WIDTH(IND) D
- .. D FORMATS(1,WIDTH(IND),TEMP,.NLO,.TEXTOUT)
- .. F JND=1:1:NLO D
- ... S TEMP=$$@ENTRY^XLFSTR(TEXTOUT(JND),WIDTH(IND),PC)
- ... S COLOUT(JND,IND)=TEMP_$$LJ^XLFSTR("",SP(IND)," ")
- .. I NLO>NROW S NROW=NLO
- F IND=1:1:NROW D
- . S TEXT=""
- . F JND=1:1:NCOL D
- .. I $D(COLOUT(IND,JND)) S TEXT=TEXT_COLOUT(IND,JND)
- .. E  S TEXT=TEXT_$$LJ^XLFSTR("",(WPSP(JND))," ")
- . S OUTPUT(IND)=TEXT
- S NL=NROW
- Q
- ;
- ;============================================
-COLFMTA(FMTSTR,INPUT,PC,NL,OUTPUT) ;Columnar text formatter.
- ;Array version of COLFMT. Input array is ^TMP($J,INPUT,M) and
- ;output is ^TMP(OUTPUT,$J,N,0).
- N COLOUT,ENTRY,FMT,JND,JUS,IND,LEN,NCOL,NLO,NROW,NUM
- N SP,TEMP,TEXT,WIDTH,WPSP
- S NCOL=$L(FMTSTR,U)
- F IND=1:1:NCOL D
- . S FMT=$P(FMTSTR,U,IND)
- . S JUS(IND)=$S(FMT["C":"C",FMT["L":"L",FMT["R":"R",1:"C")
- . S WIDTH(IND)=$P(FMT,JUS(IND),1)
- . S SP(IND)=$P(FMT,JUS(IND),2)
- . S WPSP(IND)=WIDTH(IND)+SP(IND)
- S NL=0,NUM=""
- F  S NUM=$O(^TMP($J,INPUT,NUM)) Q:NUM=""  D
- . K COLOUT
- . S NROW=1
- . F IND=1:1:NCOL D
- .. S ENTRY=$S(JUS(IND)="C":"CJ",JUS(IND)="L":"LJ",JUS(IND)="R":"RJ")
- .. S TEMP=$P(^TMP($J,INPUT,NUM),U,IND)
- .. S LEN=$L(TEMP)
- .. I LEN'>WIDTH(IND) D
- ... S TEMP=$$@ENTRY^XLFSTR(TEMP,WIDTH(IND),PC)
- ... S COLOUT(1,IND)=TEMP_$$LJ^XLFSTR("",SP(IND)," ")
- .. I LEN>WIDTH(IND) D
- ... D FORMATS(1,WIDTH(IND),TEMP,.NLO,.TEXTOUT)
- ... F JND=1:1:NLO D
- .... S TEMP=$$@ENTRY^XLFSTR(TEXTOUT(JND),WIDTH(IND),PC)
- .... S COLOUT(JND,IND)=TEMP_$$LJ^XLFSTR("",SP(IND)," ")
- ... I NLO>NROW S NROW=NLO
- . F IND=1:1:NROW D
- .. S TEXT=""
- .. F JND=1:1:NCOL D
- ... I $D(COLOUT(IND,JND)) S TEXT=TEXT_COLOUT(IND,JND)
- ... E  S TEXT=TEXT_$$LJ^XLFSTR("",(WPSP(JND))," ")
- .. S NL=NL+1,^TMP(OUTPUT,$J,NL,0)=TEXT
- Q
- ;
- ;============================================
+ ;================================================================
 FORMAT(LM,RM,NIN,TEXTIN,NOUT,TEXTOUT) ;Format the text in TEXTIN so it has
  ;a left margin of LM and a right margin of RM. The formatted text
@@ -163,5 +85,5 @@
  Q
  ;
- ;============================================
+ ;================================================================
 FORMATS(LM,RM,TEXTLINE,NOUT,TEXTOUT) ;Take a single line of input text
  ;and format it.
@@ -171,31 +93,2 @@
  Q
  ;
- ;============================================
-LMFMTSTR(VALMDDF,JSTR) ;The List Manager variable VALMDDF contains the
- ;list template caption column formatting information. It contains
- ;the starting column and the width if the form
- ;VALMDDF(COLUMN NAME)=COLUMN NAME^COLUMN^WIDTH^CAPTION^VIDEO^SCROLL
- ;LOCK. JUSSTR, which is optional,is the justification for each column;
- ;(L=left, C=center, R=right) the default is center. Use this information
- ;to build the format string for the column formatter COLFMT.
- N CN,COL,FMTSTR,IND,JC,JUSSTR,PLCOL,SCOL,SP,TEMP,WIDTH
- ;Sort by columns
- S IND=""
- F  S IND=$O(VALMDDF(IND)) Q:IND=""  D
- . S TEMP=VALMDDF(IND)
- . S COL($P(TEMP,U,2))=$P(TEMP,U,3)
- S JUSSTR=$G(JSTR)
- S (CN,PLCOL,SCOL,SP)=0
- S FMTSTR=""
- S SCOL=0
- F  S SCOL=$O(COL(SCOL)) Q:SCOL=""  D
- . S CN=CN+1
- . S WIDTH=COL(SCOL)
- . I CN=1 S PLCOL=WIDTH
- . E  S SP=SCOL-PLCOL-1,FMTSTR=FMTSTR_SP_U,PLCOL=SCOL+WIDTH-1
- . S JC=$E(JUSSTR,CN)
- . I JC="" S JC="C"
- . S TEMP=WIDTH_JC
- . S FMTSTR=FMTSTR_TEMP
- Q FMTSTR
- ;
