ABSPOSU7 ; IHS/FCS/DRS - misc. utilities ;
;;1.0;PHARMACY POINT OF SALE;;JUN 21, 2001
Q
; delete antique, hopeless .59s [ 09/14/2000 8:36 AM ]
; How can they possibly get stranded?
; Well, this cleans them up
PURGE(HRS) ;EP - purge all the ones older than HRS hours
W !
I '$D(HRS) D Q:'$G(HRS)
. W "Unstrand all the claims which haven't been updated",!
. N PROMPT S PROMPT="in how many hours? "
. N DEF S DEF=24
. N OPT S OPT=1
. N MIN,MAX S MIN=.05,MAX=99999999 ; .05 hours = 3 minutes
. S HRS=$$NUMERIC^ABSPOSU2(PROMPT,DEF,OPT,MIN,MAX,2) ; 2 = dec. places
. I HRS<MIN K HRS
. W !
W "Stranded claims survey and cleanup; HRS=",HRS," ",$$NOWEXT^ABSPOSU1,!
N COUNT S (COUNT,COUNT("SET TO COMPLETE"))=0
N SECS S SECS=HRS*60*60 ; ABSP*1.0T7*5 ; needed an extra *60
N STAT S STAT=""
F S STAT=$O(^ABSPT("AD",STAT)) Q:STAT="" D
. Q:STAT=99 ; complete
. N IEN59 S IEN59=""
. F S IEN59=$O(^ABSPT("AD",STAT,IEN59)) Q:IEN59="" D
. . S COUNT=COUNT+1
. . I '$D(^ABSPT(IEN59,0)) D Q ; should never happen
. . . W "STAT=",STAT,", IEN59=",IEN59," has no 0 node",!
. . N LAST S LAST=$P(^ABSPT(IEN59,0),U,8)
. . I 'LAST D Q ; should never happen
. . . W "STAT=",STAT,", IEN59=",IEN59," has no LAST UPDATE time",!
. . N AGE,AGEI
. . S AGEI=$$TIMEAGOI^ABSPOSUD(LAST),AGE=$$TIMEAGO^ABSPOSUD(LAST)
. . W IEN59," last update ",LAST," which was ",AGE," ago",!
. . I AGEI>SECS D
. . . W ?10,"setting it to complete..."
. . . D PURGE1(IEN59)
. . . W "done.",!
. . . S COUNT("SET TO COMPLETE")=COUNT("SET TO COMPLETE")+1
. . E D
. . . W ?10,"nothing done to this claim.",!
D ZWRITE^ABSPOS("COUNT")
Q
PURGE1(IEN59) ;
N ABSBRXI S ABSBRXI=IEN59
D SETSTAT^ABSPOSU(99)
D SETRESU^ABSPOSU(-1,"mark incomplete claim as stranded after "_AGE)
Q
PURGEALL D PURGE(0) Q ; should only be done by programmer?
ABSPOSU7 ; IHS/FCS/DRS - misc. utilities ;
+1 ;;1.0;PHARMACY POINT OF SALE;;JUN 21, 2001
+2 QUIT
+3 ; delete antique, hopeless .59s [ 09/14/2000 8:36 AM ]
+4 ; How can they possibly get stranded?
+5 ; Well, this cleans them up
PURGE(HRS) ;EP - purge all the ones older than HRS hours
+1 WRITE !
+2 IF '$DATA(HRS)
Begin DoDot:1
+3 WRITE "Unstrand all the claims which haven't been updated",!
+4 NEW PROMPT
SET PROMPT="in how many hours? "
+5 NEW DEF
SET DEF=24
+6 NEW OPT
SET OPT=1
+7 ; .05 hours = 3 minutes
NEW MIN,MAX
SET MIN=.05
SET MAX=99999999
+8 ; 2 = dec. places
SET HRS=$$NUMERIC^ABSPOSU2(PROMPT,DEF,OPT,MIN,MAX,2)
+9 IF HRS<MIN
KILL HRS
+10 WRITE !
End DoDot:1
IF '$GET(HRS)
QUIT
+11 WRITE "Stranded claims survey and cleanup; HRS=",HRS," ",$$NOWEXT^ABSPOSU1,!
+12 NEW COUNT
SET (COUNT,COUNT("SET TO COMPLETE"))=0
+13 ; ABSP*1.0T7*5 ; needed an extra *60
NEW SECS
SET SECS=HRS*60*60
+14 NEW STAT
SET STAT=""
+15 FOR
SET STAT=$ORDER(^ABSPT("AD",STAT))
IF STAT=""
QUIT
Begin DoDot:1
+16 ; complete
IF STAT=99
QUIT
+17 NEW IEN59
SET IEN59=""
+18 FOR
SET IEN59=$ORDER(^ABSPT("AD",STAT,IEN59))
IF IEN59=""
QUIT
Begin DoDot:2
+19 SET COUNT=COUNT+1
+20 ; should never happen
IF '$DATA(^ABSPT(IEN59,0))
Begin DoDot:3
+21 WRITE "STAT=",STAT,", IEN59=",IEN59," has no 0 node",!
End DoDot:3
QUIT
+22 NEW LAST
SET LAST=$PIECE(^ABSPT(IEN59,0),U,8)
+23 ; should never happen
IF 'LAST
Begin DoDot:3
+24 WRITE "STAT=",STAT,", IEN59=",IEN59," has no LAST UPDATE time",!
End DoDot:3
QUIT
+25 NEW AGE,AGEI
+26 SET AGEI=$$TIMEAGOI^ABSPOSUD(LAST)
SET AGE=$$TIMEAGO^ABSPOSUD(LAST)
+27 WRITE IEN59," last update ",LAST," which was ",AGE," ago",!
+28 IF AGEI>SECS
Begin DoDot:3
+29 WRITE ?10,"setting it to complete..."
+30 DO PURGE1(IEN59)
+31 WRITE "done.",!
+32 SET COUNT("SET TO COMPLETE")=COUNT("SET TO COMPLETE")+1
End DoDot:3
+33 IF '$TEST
Begin DoDot:3
+34 WRITE ?10,"nothing done to this claim.",!
End DoDot:3
End DoDot:2
End DoDot:1
+35 DO ZWRITE^ABSPOS("COUNT")
+36 QUIT
PURGE1(IEN59) ;
+1 NEW ABSBRXI
SET ABSBRXI=IEN59
+2 DO SETSTAT^ABSPOSU(99)
+3 DO SETRESU^ABSPOSU(-1,"mark incomplete claim as stranded after "_AGE)
+4 QUIT
PURGEALL ; should only be done by programmer?
DO PURGE(0)
QUIT