ORWGAPIF ; SLC/STAFF - Graph Fast Data Retrieval ;11/1/06 12:49
;;3.0;ORDER ENTRY/RESULTS REPORTING;**243**;Dec 17, 1997;Build 242
;
FASTDATA(DATA,DFN) ; from ORWGAPI
I '$G(DFN) Q
D FAST(.DATA,DFN,"ALL DATA")
Q
;
FASTITEM(DATA,DFN) ; from ORWGAPI
I '$G(DFN) Q
D FAST(.DATA,DFN,"ALL ITEMS")
Q
;
FASTLABS(DATA,DFN) ; from ORWGAPI
I '$G(DFN) Q
D FAST(.DATA,DFN,"ALL LABS")
Q
;
FAST(DATA,DFN,SOURCE) ;
I '$L($G(^XTMP("ORGRAPH",0))) Q
I '$G(DFN) Q
I '$G(DUZ) Q
N OK,PATUSER
S PATUSER=DFN_U_DUZ
S OK=0
I $L($O(^XTMP("ORGRAPH",SOURCE,PATUSER,""))) S OK=1
D LOG(DFN,DUZ,SOURCE)
I 'OK Q
L +^XTMP("ORGRAPH",SOURCE,PATUSER):3 I '$T Q ; wait 3 sec for merge
S DATA=$NA(^XTMP("ORGRAPH",SOURCE,PATUSER))
L -^XTMP("ORGRAPH",SOURCE,PATUSER)
Q
;
LOG(DFN,USER,SOURCE) ;
N GOLD,GNOW,GSTAMP,PATUSER,LINE,SIZE
S GOLD=$G(^XTMP("ORGDATA","QT",USER_U_DFN))
I 'GOLD Q
S GSTAMP=GOLD_U_USER_U_DFN
S PATUSER=DFN_U_USER
I '$D(^XTMP("ORGDATA","Q",GSTAMP)) Q
S GNOW=$$MNOW^ORWGTASK
S SIZE=0
S LINE=""
F S LINE=$O(^XTMP("ORGRAPH",SOURCE,PATUSER,LINE)) Q:LINE="" D
. S SIZE=$L(^XTMP("ORGRAPH",SOURCE,PATUSER,LINE))+SIZE
I SOURCE="ALL ITEMS" D Q
. S $P(^XTMP("ORGDATA","Q",GSTAMP),U,13)=SIZE
. I $P($G(^XTMP("ORGDATA","Q",GSTAMP)),U,10)<1 D
.. D GSTAMP^ORWGTASK(GSTAMP,GOLD,GNOW,9)
. S $P(^XTMP("ORGDATA","Q",GSTAMP),U,10)=(1+$P($G(^XTMP("ORGDATA","Q",GSTAMP)),U,10))
I SOURCE="ALL LABS" D Q
. S $P(^XTMP("ORGDATA","Q",GSTAMP),U,14)=SIZE
. D GSTAMP^ORWGTASK(GSTAMP,GOLD,GNOW,11)
I SOURCE="ALL DATA" D Q
. S $P(^XTMP("ORGDATA","Q",GSTAMP),U,15)=SIZE
. D GSTAMP^ORWGTASK(GSTAMP,GOLD,GNOW,12)
Q
;
ORWGAPIF ; SLC/STAFF - Graph Fast Data Retrieval ;11/1/06 12:49
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**243**;Dec 17, 1997;Build 242
+2 ;
FASTDATA(DATA,DFN) ; from ORWGAPI
+1 IF '$GET(DFN)
QUIT
+2 DO FAST(.DATA,DFN,"ALL DATA")
+3 QUIT
+4 ;
FASTITEM(DATA,DFN) ; from ORWGAPI
+1 IF '$GET(DFN)
QUIT
+2 DO FAST(.DATA,DFN,"ALL ITEMS")
+3 QUIT
+4 ;
FASTLABS(DATA,DFN) ; from ORWGAPI
+1 IF '$GET(DFN)
QUIT
+2 DO FAST(.DATA,DFN,"ALL LABS")
+3 QUIT
+4 ;
FAST(DATA,DFN,SOURCE) ;
+1 IF '$LENGTH($GET(^XTMP("ORGRAPH",0)))
QUIT
+2 IF '$GET(DFN)
QUIT
+3 IF '$GET(DUZ)
QUIT
+4 NEW OK,PATUSER
+5 SET PATUSER=DFN_U_DUZ
+6 SET OK=0
+7 IF $LENGTH($ORDER(^XTMP("ORGRAPH",SOURCE,PATUSER,"")))
SET OK=1
+8 DO LOG(DFN,DUZ,SOURCE)
+9 IF 'OK
QUIT
+10 ; wait 3 sec for merge
LOCK +^XTMP("ORGRAPH",SOURCE,PATUSER):3
IF '$TEST
QUIT
+11 SET DATA=$NAME(^XTMP("ORGRAPH",SOURCE,PATUSER))
+12 LOCK -^XTMP("ORGRAPH",SOURCE,PATUSER)
+13 QUIT
+14 ;
LOG(DFN,USER,SOURCE) ;
+1 NEW GOLD,GNOW,GSTAMP,PATUSER,LINE,SIZE
+2 SET GOLD=$GET(^XTMP("ORGDATA","QT",USER_U_DFN))
+3 IF 'GOLD
QUIT
+4 SET GSTAMP=GOLD_U_USER_U_DFN
+5 SET PATUSER=DFN_U_USER
+6 IF '$DATA(^XTMP("ORGDATA","Q",GSTAMP))
QUIT
+7 SET GNOW=$$MNOW^ORWGTASK
+8 SET SIZE=0
+9 SET LINE=""
+10 FOR
SET LINE=$ORDER(^XTMP("ORGRAPH",SOURCE,PATUSER,LINE))
IF LINE=""
QUIT
Begin DoDot:1
+11 SET SIZE=$LENGTH(^XTMP("ORGRAPH",SOURCE,PATUSER,LINE))+SIZE
End DoDot:1
+12 IF SOURCE="ALL ITEMS"
Begin DoDot:1
+13 SET $PIECE(^XTMP("ORGDATA","Q",GSTAMP),U,13)=SIZE
+14 IF $PIECE($GET(^XTMP("ORGDATA","Q",GSTAMP)),U,10)<1
Begin DoDot:2
+15 DO GSTAMP^ORWGTASK(GSTAMP,GOLD,GNOW,9)
End DoDot:2
+16 SET $PIECE(^XTMP("ORGDATA","Q",GSTAMP),U,10)=(1+$PIECE($GET(^XTMP("ORGDATA","Q",GSTAMP)),U,10))
End DoDot:1
QUIT
+17 IF SOURCE="ALL LABS"
Begin DoDot:1
+18 SET $PIECE(^XTMP("ORGDATA","Q",GSTAMP),U,14)=SIZE
+19 DO GSTAMP^ORWGTASK(GSTAMP,GOLD,GNOW,11)
End DoDot:1
QUIT
+20 IF SOURCE="ALL DATA"
Begin DoDot:1
+21 SET $PIECE(^XTMP("ORGDATA","Q",GSTAMP),U,15)=SIZE
+22 DO GSTAMP^ORWGTASK(GSTAMP,GOLD,GNOW,12)
End DoDot:1
QUIT
+23 QUIT
+24 ;