ABSPOSR4 ; IHS/FCS/DRS - back billing ;
;;1.0;PHARMACY POINT OF SALE;;JUN 21, 2001
;
; Back billing - similar to ABSPOSR3
; and in fact, it uses ABSPOSR3 subroutines to do much of its work.
; It depends very much on the ABSPOSR3 flag to DO NOT RESUMBIT.
; (We want to backbill, not rebill!)
;
; Might be programmer mode only, though an option could certainly
; point here.
Q ;
BACKBILL ;EP -
N RANGE,X
S X=$$DTR^ABSPOSU1("Backbill starting at date@time: ","Backbill thru what date@time: ",,,"T")
Q:'X
N BEGINDT,ENDDT S BEGINDT=$P(X,U),ENDDT=$P(X,U,2)
I $P(ENDDT,".",2)="" S $P(ENDDT,".",2)=24 ; assume entire day
D INIT^ABSPOSL(DT+.6,1)
D LOG("Back billing with range "_BEGINDT_"-"_ENDDT)
D LOG(" (from "_$$CVTDATE(BEGINDT)_" thru "_$$CVTDATE(ENDDT)_")")
N THELIST S THELIST=$$THELIST D KILLLIST
;
I 1'=$$YESNO^ABSPOSU3("Backbill for "_$$CVTDATE(BEGINDT)_" thru "_$$CVTDATE(ENDDT)_"; are you sure","N",0) D Q
. W !,"Okay, nothing is done.",!
;
W !!,"Processing...",! H 1
;
; Gather list of prescriptions that need to be back billed.
;
D LOG("Building the list of prescriptions to back bill for...")
D WORKLIST^ABSPOSR3(BEGINDT,ENDDT,THELIST)
N COUNT S COUNT=$$DUMPLIST(THELIST)
W !!,"Count of transactions in the work list: ",COUNT,!!
I 'COUNT G EXIT
H 3
;
; We now have @THELIST@(time,type,rxi,rxr)
; time = date/time of pharmacy activity
; type = 1 for claim, 2 for returned to stock
; rxi,rxr points to prescription, refill
;
; And now bill them all
;
D LOG("Submitting all the claims...")
I 0 D
. D LOG("Short-circuit - not just yet") D
. D DUMPLIST
E D
. D PROCESS^ABSPOSR3(THELIST)
;
W !,"Done! There may still be processing going on in the background.",!
W "The usual Point of Sale programs can be used to examine",!
W "any ongoing progress on these claims.",!
W "The usual Point of Sale reports can be run; you should wait",!
W "until all the background processing of the back billing has finished.",!
W !
W "Also note that before trying to run reports, you should",!
W "run URM (on the CLA reports menu) for the date range.",!
H 5
EXIT D LOG("Complete.")
D RELSLOT^ABSPOSL
Q
;
LOGFILE D LOGFILE1^ABSPOSR1(.6) Q
DUMPLIST(X) ; $G(X)=0 to count and return total
; X=1 to dump contents to log file
N TIME,TYPE,RXI,RXR,COUNT S COUNT=0
D LOG("Contents of THELIST:")
S TIME="" F S TIME=$O(@THELIST@(TIME)) Q:TIME="" D
. S TYPE="" F S TYPE=$O(@THELIST@(TIME,TYPE)) Q:TYPE="" D
. . S RXI="" F S RXI=$O(@THELIST@(TIME,TYPE,RXI)) Q:RXI="" D
. . . S RXR="" F S RXR=$O(@THELIST@(TIME,TYPE,RXI,RXR)) Q:RXR="" D
. . . . D LOG(TIME_" "_TYPE_" "_RXI_" "_RXR)
. . . . S COUNT=COUNT+1
Q:$Q COUNT Q
LOG(X) D LOG^ABSPOSL(X) Q
; Keep THELIST and KILLLIST in agreement!
THELIST() Q "^ABSPECP("""_$T(+0)_""","_$J_","_BEGINDT_")"
KILLLIST K ^ABSPECP($T(+0),$J,BEGINDT) Q ; safer than K @
CVTDATE(Y) X ^DD("DD") Q Y
ABSPOSR4 ; IHS/FCS/DRS - back billing ;
+1 ;;1.0;PHARMACY POINT OF SALE;;JUN 21, 2001
+2 ;
+3 ; Back billing - similar to ABSPOSR3
+4 ; and in fact, it uses ABSPOSR3 subroutines to do much of its work.
+5 ; It depends very much on the ABSPOSR3 flag to DO NOT RESUMBIT.
+6 ; (We want to backbill, not rebill!)
+7 ;
+8 ; Might be programmer mode only, though an option could certainly
+9 ; point here.
+10 ;
QUIT
BACKBILL ;EP -
+1 NEW RANGE,X
+2 SET X=$$DTR^ABSPOSU1("Backbill starting at date@time: ","Backbill thru what date@time: ",,,"T")
+3 IF 'X
QUIT
+4 NEW BEGINDT,ENDDT
SET BEGINDT=$PIECE(X,U)
SET ENDDT=$PIECE(X,U,2)
+5 ; assume entire day
IF $PIECE(ENDDT,".",2)=""
SET $PIECE(ENDDT,".",2)=24
+6 DO INIT^ABSPOSL(DT+.6,1)
+7 DO LOG("Back billing with range "_BEGINDT_"-"_ENDDT)
+8 DO LOG(" (from "_$$CVTDATE(BEGINDT)_" thru "_$$CVTDATE(ENDDT)_")")
+9 NEW THELIST
SET THELIST=$$THELIST
DO KILLLIST
+10 ;
+11 IF 1'=$$YESNO^ABSPOSU3("Backbill for "_$$CVTDATE(BEGINDT)_" thru "_$$CVTDATE(ENDDT)_"; are you sure","N",0)
Begin DoDot:1
+12 WRITE !,"Okay, nothing is done.",!
End DoDot:1
QUIT
+13 ;
+14 WRITE !!,"Processing...",!
HANG 1
+15 ;
+16 ; Gather list of prescriptions that need to be back billed.
+17 ;
+18 DO LOG("Building the list of prescriptions to back bill for...")
+19 DO WORKLIST^ABSPOSR3(BEGINDT,ENDDT,THELIST)
+20 NEW COUNT
SET COUNT=$$DUMPLIST(THELIST)
+21 WRITE !!,"Count of transactions in the work list: ",COUNT,!!
+22 IF 'COUNT
GOTO EXIT
+23 HANG 3
+24 ;
+25 ; We now have @THELIST@(time,type,rxi,rxr)
+26 ; time = date/time of pharmacy activity
+27 ; type = 1 for claim, 2 for returned to stock
+28 ; rxi,rxr points to prescription, refill
+29 ;
+30 ; And now bill them all
+31 ;
+32 DO LOG("Submitting all the claims...")
+33 IF 0
Begin DoDot:1
+34 DO LOG("Short-circuit - not just yet")
Begin DoDot:2
End DoDot:2
+35 DO DUMPLIST
End DoDot:1
+36 IF '$TEST
Begin DoDot:1
+37 DO PROCESS^ABSPOSR3(THELIST)
End DoDot:1
+38 ;
+39 WRITE !,"Done! There may still be processing going on in the background.",!
+40 WRITE "The usual Point of Sale programs can be used to examine",!
+41 WRITE "any ongoing progress on these claims.",!
+42 WRITE "The usual Point of Sale reports can be run; you should wait",!
+43 WRITE "until all the background processing of the back billing has finished.",!
+44 WRITE !
+45 WRITE "Also note that before trying to run reports, you should",!
+46 WRITE "run URM (on the CLA reports menu) for the date range.",!
+47 HANG 5
EXIT DO LOG("Complete.")
+1 DO RELSLOT^ABSPOSL
+2 QUIT
+3 ;
LOGFILE DO LOGFILE1^ABSPOSR1(.6)
QUIT
DUMPLIST(X) ; $G(X)=0 to count and return total
+1 ; X=1 to dump contents to log file
+2 NEW TIME,TYPE,RXI,RXR,COUNT
SET COUNT=0
+3 DO LOG("Contents of THELIST:")
+4 SET TIME=""
FOR
SET TIME=$ORDER(@THELIST@(TIME))
IF TIME=""
QUIT
Begin DoDot:1
+5 SET TYPE=""
FOR
SET TYPE=$ORDER(@THELIST@(TIME,TYPE))
IF TYPE=""
QUIT
Begin DoDot:2
+6 SET RXI=""
FOR
SET RXI=$ORDER(@THELIST@(TIME,TYPE,RXI))
IF RXI=""
QUIT
Begin DoDot:3
+7 SET RXR=""
FOR
SET RXR=$ORDER(@THELIST@(TIME,TYPE,RXI,RXR))
IF RXR=""
QUIT
Begin DoDot:4
+8 DO LOG(TIME_" "_TYPE_" "_RXI_" "_RXR)
+9 SET COUNT=COUNT+1
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+10 IF $QUIT
QUIT COUNT
QUIT
LOG(X) DO LOG^ABSPOSL(X)
QUIT
+1 ; Keep THELIST and KILLLIST in agreement!
THELIST() QUIT "^ABSPECP("""_$TEXT(+0)_""","_$JOB_","_BEGINDT_")"
KILLLIST ; safer than K @
KILL ^ABSPECP($TEXT(+0),$JOB,BEGINDT)
QUIT
CVTDATE(Y) XECUTE ^DD("DD")
QUIT Y