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

ORDVU.m

Go to the documentation of this file.
  1. ORDVU ; slc/dcm - OE/RR Report Extracts ; 08 May 2001 13:32PM
  1. ;;3.0;ORDER ENTRY/RESULTS REPORTING;**109**;Dec 17, 1997
  1. DATEMMM(X) ;convert date from MMM DD, YYYY to MM/DD/YYYY format
  1. ; e.g. convert JUL 04, 1998 to 07/04/1998
  1. ;
  1. Q:$G(X)="" ""
  1. N ORA
  1. D DT^DILF("TS",X,.ORA) ; change date to FM internal format.
  1. K ^TMP("DIERR",$J) ; this global may have been created by DT^DILF
  1. S:$G(ORA)=-1 ORA=""
  1. Q $$DATE(ORA)
  1. DATE(X) ;convert fm date to readable format with 4 digits in year.
  1. N ORX,YY
  1. S ORX=X
  1. S X=$$REGDTM4(X)
  1. Q X
  1. MERG(SOURCE,TARGET,MULT) ;merge and format WP fields
  1. ;Input:
  1. ; SOURCE = source global node
  1. ; TARGET= Target global node
  1. ; MULT = 1 for multiple fields (e.g. for multiple specimens
  1. ; each specimen will be separated by ", "
  1. ;
  1. N ORI,ORSUB
  1. S MULT=+$G(MULT)
  1. I '$D(@SOURCE) Q
  1. S ORSUB=SOURCE
  1. S SOURCE=$E(SOURCE,1,$L(SOURCE)-1)_"," ;replace the closing ")" with ","
  1. F ORI=1:1 S ORSUB=$Q(@ORSUB) Q:$E(ORSUB,1,$L(SOURCE))'=SOURCE D
  1. .I 'MULT S @TARGET@(ORI)=@ORSUB_"<BR>" Q
  1. .I MULT D
  1. ..I ORI'=1 S @TARGET@(ORI)=", "_@ORSUB
  1. ..E S @TARGET@(ORI)=@ORSUB ; before the first multiple do not put
  1. Q
  1. SPMRG(SOURCE,TARGET,ID) ;merge and format WP fields
  1. ;Input:
  1. ; SOURCE = source global node
  1. ; TARGET= Target global node
  1. ; ID = Column # associated with this data
  1. ;
  1. N I,SUB
  1. I '$D(@SOURCE) Q
  1. S SUB=SOURCE
  1. S SOURCE=$E(SOURCE,1,$L(SOURCE)-1)_"," ;replace the closing ")" with ","
  1. F I=1:1 S SUB=$Q(@SUB) Q:$E(SUB,1,$L(SOURCE))'=SOURCE D
  1. . S @TARGET@(I)=$G(ID)_"^"_@SUB Q
  1. Q
  1. REGDT(X) ; Receives X in internal date.time, and returns X in MM/DD/YY format
  1. ; DBIA 10103 call $$FMTE^XLFDT
  1. Q $TR($$FMTE^XLFDT(X,"2DZ"),"@"," ")
  1. REGDT4(X) ; Receives X in internal date.time, and returns X in MM/DD/YYYY format
  1. ; DBIA 10103 call $$FMTE^XLFDT
  1. Q $TR($$FMTE^XLFDT(X,"5DZ"),"@"," ")
  1. REGDTM(X) ;Receives X in internal date.time, and returns X in MM/DD/YY TT:TT
  1. ; DBIA 10103 call $$FMTE^XLFDT
  1. Q $TR($$FMTE^XLFDT(X,"2ZM"),"@"," ")
  1. REGDTM4(X) ;Receives X in internal date.time, and returns X in MM/DD/YYYY TT:TT
  1. ; DBIA 10103 call $$FMTE^XLFDT
  1. Q $TR($$FMTE^XLFDT(X,"5ZM"),"@"," ")
  1. SIDT(X) ; Receives X as internal date/time and returns X in DD MMM YY
  1. N MON,MM
  1. S X=$P(X,".") I 'X S X="" Q
  1. S MON="JAN^FEB^MAR^APR^MAY^JUN^JUL^AUG^SEP^OCT^NOV^DEC"
  1. S MM=$E(X,4,5),MM=$S(MM:$P(MON,U,MM),1:"")
  1. Q $E(X,6,7)_" "_MM_" "_$E(X,2,3)