ABSPOSQF ; IHS/FCS/DRS - Insurer asleep - status 31 ;
;;1.0;PHARMACY POINT OF SALE;;JUN 21, 2001
Q
;
; Continuation of ABSPOSQ2
;
STATUS31 ;EP - ABSPOSQ2
; Situation: you have 1 or 2 or maybe 200 claims in status 31,
; because we've determined that the insurer is asleep.
; change at most one claim per insurer to status 30, to let it
; go through and try again. But if the insurer is awake for sure,
; let all of the claims for that insurer go on through.
N STATUS30,IEN59,INSURER S STATUS30=31,IEN59=""
K ^TMP("ABSPOSQF",$J) ; build ^TMP("ABSPOSQF",$J,INSURER,IEN59)=""
Q:'$$LOCK59^ABSPOSQ2
F S IEN59=$$NEXT59^ABSPOSQ2(IEN59) Q:'IEN59 D
. ; if $$NEXT59() returned us an IEN59, then the waiting time
. ; has expired - or better yet, the insurer has awakened
. S INSURER=$P(^ABSPT(IEN59,1),U,6)
. ; If still in wait, but wait expired, just allow one claim thru.
. ; But if wait has been canceled - that is, we had a successful
. ; transmit, meaning the insurer has awakened - then let them all
. ; go through to status 30.
. N X S X=$G(^ABSPEI(INSURER,101))
. N T,PROBER S T=$P(X,U),PROBER=$P(X,U,6)
. ; if somehow the prober became complete, without clearing 101;6
. ; (maybe this happens if cancellation takes place?)
. I PROBER D
. . N X S X=$P($G(^ABSPT(PROBER,0)),U,2)
. . I X=99!(X="") S PROBER=""
. I T,PROBER,PROBER'=IEN59 Q ; only prober can go thru during wait
. I T S $P(^ABSPEI(INSURER,101),U,6)=IEN59 ; you're the prober
. S ^TMP("ABSPOSQF",$J,INSURER,IEN59)=""
D UNLOCK59^ABSPOSQ2
S INSURER="" F S INSURER=$O(^TMP("ABSPOSQF",$J,INSURER)) Q:'INSURER D
. S IEN59="" F S IEN59=$O(^TMP("ABSPOSQF",$J,INSURER,IEN59)) Q:'IEN59 D
. . D SETSTAT^ABSPOSQ2(30) ; reset to status 30
. . K ^ABSPT(IEN59,8) ; clear Listmanager wait info
Q
ABSPOSQF ; IHS/FCS/DRS - Insurer asleep - status 31 ;
+1 ;;1.0;PHARMACY POINT OF SALE;;JUN 21, 2001
+2 QUIT
+3 ;
+4 ; Continuation of ABSPOSQ2
+5 ;
STATUS31 ;EP - ABSPOSQ2
+1 ; Situation: you have 1 or 2 or maybe 200 claims in status 31,
+2 ; because we've determined that the insurer is asleep.
+3 ; change at most one claim per insurer to status 30, to let it
+4 ; go through and try again. But if the insurer is awake for sure,
+5 ; let all of the claims for that insurer go on through.
+6 NEW STATUS30,IEN59,INSURER
SET STATUS30=31
SET IEN59=""
+7 ; build ^TMP("ABSPOSQF",$J,INSURER,IEN59)=""
KILL ^TMP("ABSPOSQF",$JOB)
+8 IF '$$LOCK59^ABSPOSQ2
QUIT
+9 FOR
SET IEN59=$$NEXT59^ABSPOSQ2(IEN59)
IF 'IEN59
QUIT
Begin DoDot:1
+10 ; if $$NEXT59() returned us an IEN59, then the waiting time
+11 ; has expired - or better yet, the insurer has awakened
+12 SET INSURER=$PIECE(^ABSPT(IEN59,1),U,6)
+13 ; If still in wait, but wait expired, just allow one claim thru.
+14 ; But if wait has been canceled - that is, we had a successful
+15 ; transmit, meaning the insurer has awakened - then let them all
+16 ; go through to status 30.
+17 NEW X
SET X=$GET(^ABSPEI(INSURER,101))
+18 NEW T,PROBER
SET T=$PIECE(X,U)
SET PROBER=$PIECE(X,U,6)
+19 ; if somehow the prober became complete, without clearing 101;6
+20 ; (maybe this happens if cancellation takes place?)
+21 IF PROBER
Begin DoDot:2
+22 NEW X
SET X=$PIECE($GET(^ABSPT(PROBER,0)),U,2)
+23 IF X=99!(X="")
SET PROBER=""
End DoDot:2
+24 ; only prober can go thru during wait
IF T
IF PROBER
IF PROBER'=IEN59
QUIT
+25 ; you're the prober
IF T
SET $PIECE(^ABSPEI(INSURER,101),U,6)=IEN59
+26 SET ^TMP("ABSPOSQF",$JOB,INSURER,IEN59)=""
End DoDot:1
+27 DO UNLOCK59^ABSPOSQ2
+28 SET INSURER=""
FOR
SET INSURER=$ORDER(^TMP("ABSPOSQF",$JOB,INSURER))
IF 'INSURER
QUIT
Begin DoDot:1
+29 SET IEN59=""
FOR
SET IEN59=$ORDER(^TMP("ABSPOSQF",$JOB,INSURER,IEN59))
IF 'IEN59
QUIT
Begin DoDot:2
+30 ; reset to status 30
DO SETSTAT^ABSPOSQ2(30)
+31 ; clear Listmanager wait info
KILL ^ABSPT(IEN59,8)
End DoDot:2
End DoDot:1
+32 QUIT