source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORDVU.m@ 1535

Last change on this file since 1535 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 2.3 KB
Line 
1ORDVU ; slc/dcm - OE/RR Report Extracts ; 08 May 2001 13:32PM
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**109**;Dec 17, 1997
3DATEMMM(X) ;convert date from MMM DD, YYYY to MM/DD/YYYY format
4 ; e.g. convert JUL 04, 1998 to 07/04/1998
5 ;
6 Q:$G(X)="" ""
7 N ORA
8 D DT^DILF("TS",X,.ORA) ; change date to FM internal format.
9 K ^TMP("DIERR",$J) ; this global may have been created by DT^DILF
10 S:$G(ORA)=-1 ORA=""
11 Q $$DATE(ORA)
12DATE(X) ;convert fm date to readable format with 4 digits in year.
13 N ORX,YY
14 S ORX=X
15 S X=$$REGDTM4(X)
16 Q X
17MERG(SOURCE,TARGET,MULT) ;merge and format WP fields
18 ;Input:
19 ; SOURCE = source global node
20 ; TARGET= Target global node
21 ; MULT = 1 for multiple fields (e.g. for multiple specimens
22 ; each specimen will be separated by ", "
23 ;
24 N ORI,ORSUB
25 S MULT=+$G(MULT)
26 I '$D(@SOURCE) Q
27 S ORSUB=SOURCE
28 S SOURCE=$E(SOURCE,1,$L(SOURCE)-1)_"," ;replace the closing ")" with ","
29 F ORI=1:1 S ORSUB=$Q(@ORSUB) Q:$E(ORSUB,1,$L(SOURCE))'=SOURCE D
30 .I 'MULT S @TARGET@(ORI)=@ORSUB_"<BR>" Q
31 .I MULT D
32 ..I ORI'=1 S @TARGET@(ORI)=", "_@ORSUB
33 ..E S @TARGET@(ORI)=@ORSUB ; before the first multiple do not put
34 Q
35SPMRG(SOURCE,TARGET,ID) ;merge and format WP fields
36 ;Input:
37 ; SOURCE = source global node
38 ; TARGET= Target global node
39 ; ID = Column # associated with this data
40 ;
41 N I,SUB
42 I '$D(@SOURCE) Q
43 S SUB=SOURCE
44 S SOURCE=$E(SOURCE,1,$L(SOURCE)-1)_"," ;replace the closing ")" with ","
45 F I=1:1 S SUB=$Q(@SUB) Q:$E(SUB,1,$L(SOURCE))'=SOURCE D
46 . S @TARGET@(I)=$G(ID)_"^"_@SUB Q
47 Q
48REGDT(X) ; Receives X in internal date.time, and returns X in MM/DD/YY format
49 ; DBIA 10103 call $$FMTE^XLFDT
50 Q $TR($$FMTE^XLFDT(X,"2DZ"),"@"," ")
51REGDT4(X) ; Receives X in internal date.time, and returns X in MM/DD/YYYY format
52 ; DBIA 10103 call $$FMTE^XLFDT
53 Q $TR($$FMTE^XLFDT(X,"5DZ"),"@"," ")
54REGDTM(X) ;Receives X in internal date.time, and returns X in MM/DD/YY TT:TT
55 ; DBIA 10103 call $$FMTE^XLFDT
56 Q $TR($$FMTE^XLFDT(X,"2ZM"),"@"," ")
57REGDTM4(X) ;Receives X in internal date.time, and returns X in MM/DD/YYYY TT:TT
58 ; DBIA 10103 call $$FMTE^XLFDT
59 Q $TR($$FMTE^XLFDT(X,"5ZM"),"@"," ")
60SIDT(X) ; Receives X as internal date/time and returns X in DD MMM YY
61 N MON,MM
62 S X=$P(X,".") I 'X S X="" Q
63 S MON="JAN^FEB^MAR^APR^MAY^JUN^JUL^AUG^SEP^OCT^NOV^DEC"
64 S MM=$E(X,4,5),MM=$S(MM:$P(MON,U,MM),1:"")
65 Q $E(X,6,7)_" "_MM_" "_$E(X,2,3)
Note: See TracBrowser for help on using the repository browser.