Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ABSPOSR4

ABSPOSR4.m

Go to the documentation of this file.
  1. ABSPOSR4 ; IHS/FCS/DRS - back billing ;
  1. ;;1.0;PHARMACY POINT OF SALE;;JUN 21, 2001
  1. ;
  1. ; Back billing - similar to ABSPOSR3
  1. ; and in fact, it uses ABSPOSR3 subroutines to do much of its work.
  1. ; It depends very much on the ABSPOSR3 flag to DO NOT RESUMBIT.
  1. ; (We want to backbill, not rebill!)
  1. ;
  1. ; Might be programmer mode only, though an option could certainly
  1. ; point here.
  1. Q ;
  1. BACKBILL ;EP -
  1. N RANGE,X
  1. S X=$$DTR^ABSPOSU1("Backbill starting at date@time: ","Backbill thru what date@time: ",,,"T")
  1. Q:'X
  1. N BEGINDT,ENDDT S BEGINDT=$P(X,U),ENDDT=$P(X,U,2)
  1. I $P(ENDDT,".",2)="" S $P(ENDDT,".",2)=24 ; assume entire day
  1. D INIT^ABSPOSL(DT+.6,1)
  1. D LOG("Back billing with range "_BEGINDT_"-"_ENDDT)
  1. D LOG(" (from "_$$CVTDATE(BEGINDT)_" thru "_$$CVTDATE(ENDDT)_")")
  1. N THELIST S THELIST=$$THELIST D KILLLIST
  1. ;
  1. I 1'=$$YESNO^ABSPOSU3("Backbill for "_$$CVTDATE(BEGINDT)_" thru "_$$CVTDATE(ENDDT)_"; are you sure","N",0) D Q
  1. . W !,"Okay, nothing is done.",!
  1. ;
  1. W !!,"Processing...",! H 1
  1. ;
  1. ; Gather list of prescriptions that need to be back billed.
  1. ;
  1. D LOG("Building the list of prescriptions to back bill for...")
  1. D WORKLIST^ABSPOSR3(BEGINDT,ENDDT,THELIST)
  1. N COUNT S COUNT=$$DUMPLIST(THELIST)
  1. W !!,"Count of transactions in the work list: ",COUNT,!!
  1. I 'COUNT G EXIT
  1. H 3
  1. ;
  1. ; We now have @THELIST@(time,type,rxi,rxr)
  1. ; time = date/time of pharmacy activity
  1. ; type = 1 for claim, 2 for returned to stock
  1. ; rxi,rxr points to prescription, refill
  1. ;
  1. ; And now bill them all
  1. ;
  1. D LOG("Submitting all the claims...")
  1. I 0 D
  1. . D LOG("Short-circuit - not just yet") D
  1. . D DUMPLIST
  1. E D
  1. . D PROCESS^ABSPOSR3(THELIST)
  1. ;
  1. W !,"Done! There may still be processing going on in the background.",!
  1. W "The usual Point of Sale programs can be used to examine",!
  1. W "any ongoing progress on these claims.",!
  1. W "The usual Point of Sale reports can be run; you should wait",!
  1. W "until all the background processing of the back billing has finished.",!
  1. W !
  1. W "Also note that before trying to run reports, you should",!
  1. W "run URM (on the CLA reports menu) for the date range.",!
  1. H 5
  1. EXIT D LOG("Complete.")
  1. D RELSLOT^ABSPOSL
  1. Q
  1. ;
  1. LOGFILE D LOGFILE1^ABSPOSR1(.6) Q
  1. DUMPLIST(X) ; $G(X)=0 to count and return total
  1. ; X=1 to dump contents to log file
  1. N TIME,TYPE,RXI,RXR,COUNT S COUNT=0
  1. D LOG("Contents of THELIST:")
  1. S TIME="" F S TIME=$O(@THELIST@(TIME)) Q:TIME="" D
  1. . S TYPE="" F S TYPE=$O(@THELIST@(TIME,TYPE)) Q:TYPE="" D
  1. . . S RXI="" F S RXI=$O(@THELIST@(TIME,TYPE,RXI)) Q:RXI="" D
  1. . . . S RXR="" F S RXR=$O(@THELIST@(TIME,TYPE,RXI,RXR)) Q:RXR="" D
  1. . . . . D LOG(TIME_" "_TYPE_" "_RXI_" "_RXR)
  1. . . . . S COUNT=COUNT+1
  1. Q:$Q COUNT Q
  1. LOG(X) D LOG^ABSPOSL(X) Q
  1. ; Keep THELIST and KILLLIST in agreement!
  1. THELIST() Q "^ABSPECP("""_$T(+0)_""","_$J_","_BEGINDT_")"
  1. KILLLIST K ^ABSPECP($T(+0),$J,BEGINDT) Q ; safer than K @
  1. CVTDATE(Y) X ^DD("DD") Q Y