VistA-WorldVistAEHR/r/NOIS-FSC/FSCRS.m

48 lines
2.0 KiB
Mathematica

FSCRS ;SLC/STAFF-NOIS Report Special ;1/13/98 16:54
;;1.1;NOIS;;Sep 06, 1998
;
SUMMARY ; executed from NOIS FORMAT file
N FORMAT K FORMAT ; CALLNUM,LATLINE,LISTNUM,STYLE,TYPE available for use
S FORMAT(1)="",FORMAT(1,1)="",FORMAT(1,2)=" This is simply a test to show a format for call # "_CALLNUM
I TYPE["VIEW" D VIEW^FSCFORMU(LISTNUM,CALLNUM,.FORMAT,STYLE,.LASTLINE,TYPE) Q
D SETUP^FSCFORMU(LISTNUM,CALLNUM,.FORMAT,STYLE,.LASTLINE,TYPE)
Q
;
STATHIST ;
N CNT,DATETIME,DIFF,FORMAT,LINE,LINECNT,LINECNT1,SEQ,START,STATUS,STOP K FORMAT,SEQ
S FORMAT(1)=""
S (SEQ,LINECNT)=0 F S LINECNT=$O(^FSCD("CALL",CALLNUM,110,LINECNT)) Q:LINECNT<1 S LINE=^(LINECNT,0) D
.S SEQ=SEQ+1
.D INFO(LINE,.STATUS,.DATETIME)
.S SEQ(SEQ)=STATUS_U_DATETIME
.S LINECNT1=$O(^FSCD("CALL",CALLNUM,110,LINECNT)) I LINECNT1'<1 S LINE=$G(^(LINECNT1,0))
.I LINECNT1<1 D
..S SEQ(SEQ)=SEQ(SEQ)_U_$$FMTE^XLFDT($$NOW^XLFDT)
.E D
..D INFO(LINE,.STATUS,.DATETIME)
..S SEQ(SEQ)=SEQ(SEQ)_U_DATETIME
S (CNT,SEQ)=0 F S SEQ=$O(SEQ(SEQ)) Q:SEQ<1 D
.S LINE=SEQ(SEQ),STATUS=$P(LINE,U),START=$P(LINE,U,2),STOP=$P(LINE,U,3)
.S START=$$EXTFM(START),STOP=$$EXTFM(STOP),DIFF=$$FMDIFF^XLFDT(STOP,START,3)
.I '$L(DIFF) S DIFF="00:00:00"
.S CNT=CNT+1,FORMAT(1,CNT)=STATUS_": "_DIFF
I TYPE["VIEW" D VIEW^FSCFORMU(LISTNUM,CALLNUM,.FORMAT,STYLE,.LASTLINE,TYPE) Q
D SETUP^FSCFORMU(LISTNUM,CALLNUM,.FORMAT,STYLE,.LASTLINE,TYPE)
Q
;
INFO(LINE,STATUS,DATETIME) ;
S STATUS=$P(LINE," on ")
I STATUS["Changed from" S STATUS=$P(STATUS," to ",2)
I $E(STATUS,1,2)=" " S STATUS=$E(STATUS,3,99)
S DATETIME=$P(LINE," on ",2),DATETIME=$P(DATETIME," by ")
Q
;
EXTFM(DATETIME) ; $$(external date@time) -> fmdate.time
N DATE,MON,NEW,TIME
S DATE=$P(DATETIME,"@"),TIME=$P(DATETIME,"@",2)
S NEW=$P(DATE," ",3)-1700
S MON=$P(DATE," "),MON=$S(MON="Jan":"01",MON="Feb":"02",MON="Mar":"03",MON="Apr":"04",MON="May":"05",MON="Jun":"06",MON="Jul":"07",MON="Aug":"08",MON="Sep":"09",MON="Oct":"10",MON="Nov":"11",1:"12")
S NEW=NEW_MON_$P($P(DATE," ",2),",")
I $L(TIME) S NEW=NEW_"."_$TR(TIME,":","")
Q NEW