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

ABSPOS6D.m

Go to the documentation of this file.
  1. ABSPOS6D ; IHS/FCS/DRS - user screen subrous ;
  1. ;;1.0;PHARMACY POINT OF SALE;**14,18,37,38,40,41,46**;JUN 21, 2001;Build 38
  1. ;----------------------------------------------------------------------
  1. ;IHS/SD/RLT - 8/24/06 - Patch 18
  1. ; Changed code so rejected reversals can be resubmitted.
  1. Q
  1. PRINTALL ; protocol ABSP P1 PRINT ALL ; print all patients' results
  1. N IO I '$$DEVICE G PRINT99
  1. U $P D:IO=$P FULL^VALM1 U IO
  1. D PRINTHDR
  1. N A S A="" F S A=$O(@VALMAR@(A)) Q:'A D PRINTA(A)
  1. G PRINT9
  1. PRINTHDR ; print a header
  1. W VALM("TITLE")," "
  1. N %,%H,%I,X,Y D NOW^%DTC S Y=% X ^DD("DD") W Y,!!
  1. N A S A="" F S A=$O(VALMHDR(A)) Q:A="" W VALMHDR(A),!
  1. W !
  1. Q
  1. PRINTA(A) ; print line A
  1. ; How could you tell whether this is a patient line or a prescription
  1. ; line? And which patient or prescription is represented?
  1. ; Look at @DISPLINE(n)=patname or patname^rxi
  1. ; Look at @VALMIDX@(n,patien), @VALMIDX@(n,patien,rxien)
  1. I '$D(IOM) N IOM S IOM=80
  1. N X D
  1. .I $D(@VALMAR@(A,0)) S X=@VALMAR@(A,0)
  1. .E S X="(? Line "_A_" is missing?)"
  1. .F Q:$E(X,$L(X))'=" " S X=$E(X,1,$L(X)-1)
  1. .N M,N S M=32,N=IOM-M
  1. .W $E(X,1,IOM),! S X=$E(X,IOM+1,$L(X))
  1. .F Q:X="" W ?M-3,"...",$E(X,1,N),! S X=$E(X,N+1,$L(X))
  1. Q
  1. PRINT ; protocol ABSP P1 PRINT PATIENT ; print a patient's results
  1. ; More aptly, it's "print selected lines"
  1. W !,"Enter the line numbers you wish to print. For example,",!
  1. W "enter 3-7 to print lines 3 through 7.",!
  1. N IEN D SELECPAT(.IEN) ; select a patient(s)
  1. I $D(IEN)<10 G PRINT99 ; none selected
  1. N IO I '$$DEVICE G PRINT99
  1. U $P D:IO=$P FULL^VALM1 U IO
  1. D PRINTHDR
  1. N A S A="" F S A=$O(IEN(A)) Q:A="" D PRINTA(A)
  1. PRINT9 ; joined here from PRINTALL,CLAIMLOG
  1. D BYE^ABSPOSU5 ; this does DO ^%ZISC to close IO for you
  1. PRINT99 ; joined here from PRINTALL,CLAIMLOG
  1. D ANY^ABSPOS2A ;PRESSANY^ABSPOSU5()
  1. PRINT999 S VALMBCK="R" ;$S(VALMCC:"",1:"R")
  1. Q
  1. MAKERXI ; IEN(*)=line numbers we want to convert to prescription numbers
  1. ; builds RXI(*)="" or maybe data, ignore whatever you get on right side
  1. S IEN="" F S IEN=$O(IEN(IEN)) Q:IEN="" D MRXI
  1. Q
  1. MRXI S RXI=$P(@DISPLINE@(IEN),U,2)
  1. I RXI S RXI(RXI)="" Q ; a prescription detail line; take just the one
  1. ; else it's a patient line - take all of this patient's prescrip's
  1. N PAT S PAT=$P(@DISPLINE@(IEN),U)
  1. M RXI=@DISP@(PAT) ; merge in all of the patient's prescriptions
  1. Q ; with RXI(*) array set up
  1. CLAIMLOG ; protocol ABSP P1 CLAIM LOG
  1. W !,"Enter the line numbers for which you wish to print claim logs.",!
  1. N IEN D SELECPAT(.IEN) ; select prescription(s) or patients
  1. I $D(IEN)<10 G PRINT99
  1. N IO I '$$DEVICE G PRINT99
  1. U $P D:IO=$P FULL^VALM1 U IO
  1. N RXI D MAKERXI ; IEN(*) -> converted to RXI(*)
  1. ; now RXI(*) is the array of RXI's we want to print logs for
  1. S RXI="" F S RXI=$O(RXI(RXI)) Q:RXI="" D CLAIMLOG^ABSPOS6M(RXI,IO)
  1. ;D BYE^ABSPOSU5
  1. G PRINT9
  1. RECEIPT ; protocol ABSP P1 RECEIPT ; print receipts
  1. W !,"Enter the line numbers for which you wish to print ",$$NAME^ABSPOS6E(3),".",!
  1. N IEN D SELECPAT(.IEN) ; select prescription(s) or patients
  1. I $D(IEN)<10 G PRINT99
  1. N IO I '$$DEVICE G PRINT99
  1. U $P D:IO=$P FULL^VALM1
  1. N RXI D MAKERXI ; IEN(*) -> converted to RXI(*)
  1. D RECEIPTS^ABSPOS6E(.RXI,IO)
  1. D BYE^ABSPOSU5
  1. G PRINT9
  1. REVERSE ; protocol ABSP P1 REVERSE CLAIM ; reverse selected claims
  1. W "Select the line(s) with the paid claim(s) you wish to REVERSE.",!
  1. N IEN D SELECPAT(.IEN) ; select which ones to reverse
  1. N RXI D MAKERXI ; IEN(*) -> converted to RXI(*)
  1. D FULL^VALM1
  1. N REVTOTAL,REVELECT,ERRCOUNT S (REVTOTAL,REVELECT,ERRCOUNT)=0
  1. S RXI="" F S RXI=$O(RXI(RXI)) Q:RXI="" D
  1. . N X S X=$$REVERS59(RXI,0)
  1. . I X D
  1. . . S REVTOTAL=REVTOTAL+1
  1. . . I X>.5 S REVELECT=REVELECT+1
  1. . E D
  1. . . W "Cannot reverse ",RXI,! S ERRCOUNT=ERRCOUNT+1
  1. W REVTOTAL," claim reversal",$S(REVTOTAL'=1:"s",1:"")," in progress.",!
  1. I ERRCOUNT D
  1. . W "Some claim(s) could not be reversed because only paper claims",!
  1. . W "and Payable electronic claims can be reversed.",!
  1. I REVELECT D TASK^ABSPOSQ1 ; task up a packetizer
  1. D ANY^ABSPOS2A ;D PRESSANY^ABSPOSU5()
  1. N NODISPLY S NODISPLY=1 D UPD^ABSPOS6A
  1. S VALMBCK="R"
  1. ;S VALMBCK=""
  1. Q
  1. REVERS59(IEN59,WANTQ2) ;EP - called here from ABSPOSRB too
  1. ; IEN59 as usual; $G(WANT2Q)=TRUE if you want packetizer started
  1. ; Returns 0 if no, no reversal, it's unreversable
  1. ; Returns 0.5 if it's a paper claim that was reversed
  1. ; Returns IEN of reversal claim if electronic claim submitted for
  1. ; reversal.
  1. N OLDSLOT S OLDSLOT=$$GETSLOT^ABSPOSL
  1. D SETSLOT^ABSPOSL(IEN59)
  1. D LOG^ABSPOSL("Reversal - begin")
  1. N RESULT S RESULT=$$CATEG^ABSPOSUC(IEN59)
  1. ;IHS/SD/RLT - 8/24/06 - Patch 18 - begin
  1. ;I RESULT'="PAPER",RESULT'="E PAYABLE",RESULT'="E DUPLICATE" Q:$Q 0 Q
  1. ;IHS/OIT/CASSEVERN/RAN - 02/07/2011 - Patch 41 - Allow "E CAPTURED" to be reversed.
  1. ;I RESULT'="PAPER",RESULT'="E PAYABLE",RESULT'="E DUPLICATE",RESULT'="E REVERSAL REJECTED" Q:$Q 0 Q
  1. I RESULT'="PAPER",RESULT'="E PAYABLE",RESULT'="E DUPLICATE",RESULT'="E REVERSAL REJECTED",RESULT'="E CAPTURED" Q:$Q 0 Q
  1. ;IHS/SD/RLT - 8/24/06 - Patch 18 - end
  1. I RESULT="PAPER REVERSAL"!(RESULT="E REVERSAL ACCEPTED") Q:$Q 0 Q
  1. ; Okay, reversal is permitted
  1. D ; stamp new starting time
  1. . N DIE,DR,DA S DIE=9002313.59,DA=IEN59,DR="15///NOW;7///NOW" D ^DIE
  1. D LOG59A^ABSPOSQB ; and log contents of 9002313.59
  1. D PREVISLY^ABSPOSIZ(IEN59) ; bracket result text with [Previously: ]
  1. I RESULT="PAPER" D Q:$Q 0.5 Q
  1. . D REVERSP(IEN59) ; reverse the paper claim
  1. . D RELSLOT^ABSPOSL,SETSLOT^ABSPOSL(OLDSLOT)
  1. ; Here, reversal of electronic claim:
  1. N CLAIMIEN S CLAIMIEN=$P(^ABSPT(IEN59,0),U,4) ; the claim
  1. N POS S POS=$P(^ABSPT(IEN59,0),U,9) ; and position therein
  1. N REV S REV=$$REVERSE^ABSPECA8(CLAIMIEN,POS) ; construct reversal
  1. D ;S $P(^ABSPT(IEN59,4),U)=REV ; mark claim with reversal
  1. . N DIE,DR,DA S DIE=9002313.59,DA=IEN59,DR="401////"_REV D ^DIE
  1. D LOG^ABSPOSL("Reversal claim `"_REV_" "_$P(^ABSPC(REV,0),U))
  1. N ABSBRXI S ABSBRXI=IEN59 D SETSTAT^ABSPOSU(30) ; waiting to packetize
  1. I $G(WANTQ2) D TASK^ABSPOSQ1
  1. D RELSLOT^ABSPOSL,SETSLOT^ABSPOSL(OLDSLOT)
  1. Q:$Q REV Q
  1. REVERSP(IEN59) ; reverse the given paper claim
  1. N ABSBRXI,OLDSLOT,X,MSG S MSG="Reversed paper claim"
  1. S $P(^ABSPT(IEN59,4),U,3)=1
  1. S ABSBRXI=IEN59
  1. D SETRESU^ABSPOSU(1,MSG)
  1. D LOG59^ABSPOSL(MSG,IEN59)
  1. D SETSTAT^ABSPOSU(99)
  1. Q
  1. RESUBMIT ; protocol ABSP P1 RESUBMIT ; resubmit a claim shown on your screen
  1. W "Select the line(s) with the claim(s) you wish to RESUBMIT.",!
  1. N IEN D SELECPAT(.IEN) ; gives IEN(*)
  1. N RXI D MAKERXI ; IEN(*) -> converted to RXI(*)
  1. D FULL^VALM1
  1. ;
  1. ;OIT/CAS/RCS 081913 Patch 46 If claim is paid ask if ok to resubmit,delete from list if not
  1. N IEN59 S IEN59="" F S IEN59=$O(RXI(IEN59)) Q:IEN59="" D
  1. .N X S X=$$RESULT59^ABSPOSRX(IEN59)
  1. .I X="E PAYABLE" D Q
  1. ..W ! S DIR(0)="Y",DIR("A")="`"_IEN59_" has been paid, do you wish to Resubmit",DIR("B")="NO" D ^DIR K DIR
  1. ..W ! I 'Y K RXI(IEN59)
  1. ;
  1. N REVCOUNT S REVCOUNT=0
  1. N IEN59 S IEN59="" F S IEN59=$O(RXI(IEN59)) Q:IEN59="" D
  1. .N X S X=$$RESULT59^ABSPOSRX(IEN59)
  1. .;IHS/OIT/CASSEVERN/RAN - 02/07/2011 - Patch 41 - Add "E CAPTURED" to types to be reversed.
  1. .;I X="E PAYABLE"!(X="E DUPLICATE")!(X="E REVERSAL REJECTED") D Q
  1. .I X="E PAYABLE"!(X="E DUPLICATE")!(X="E REVERSAL REJECTED")!(X="E CAPTURED") D Q
  1. ..;W "`",IEN59," is Payable; you must REVERSE it first.",!
  1. ..W "`",IEN59," will be REVERSED first, then Resubmitted.",!
  1. ..S $P(^ABSPT(IEN59,1),U,12)=1
  1. ..D REVERS59(IEN59,1)
  1. .I X="PAPER" D Q
  1. ..W "`",IEN59," will be REVERSED first, then Resubmitted.",!
  1. ..S $P(^ABSPT(IEN59,1),U,12)=1
  1. ..D REVERS59(IEN59)
  1. .D RESUB1(IEN59)
  1. .;D PREVISLY^ABSPOSIZ(IEN59)
  1. .W "Resubmitted `",IEN59,! H 1
  1. D TASK^ABSPOSIZ ; task up a "gathering claim info" job
  1. D ANY^ABSPOS2A ;D PRESSANY^ABSPOSU5()
  1. N NODISPLY S NODISPLY=1 D UPD^ABSPOS6A
  1. S VALMBCK="R"
  1. Q
  1. RESUB1(IEN59,MIN) ;EP - from ABSPOSU
  1. ; resubmit one entry in .59 ; caller responsible for
  1. ; starting up D TASK^ABSPOSIZ
  1. ; Also called here from ABSPOSU, for reverse-and-resubmit action
  1. ;Kill pointers of previous submissions and reversals
  1. N DIE,DR,DA S DIE=9002313.59,DA=IEN59
  1. S DR="" N I F I=3,4,401:1:403,301:1:302,801:1:803 D
  1. . S:DR]"" DR=DR_";" S DR=DR_I_"///@"
  1. . S DR=DR_";15///NOW;7///NOW" ; stamp new starting time, too
  1. ;S DR=DR_";6///"_DUZ ;IHS/OIT/CNI/SCR 033010 - update 'Updated By User' for CPR report patch 38
  1. S DR=DR_";6///`"_DUZ ;IHS/OIT/CNI/RAN 091710 - corrected 'Updated By User' input to properly use INTERNAL value patch 40
  1. I '$G(MIN) D ; ABSP*1.0T7*11 this whole block
  1. . F I=10,11,1.05:.01:1.08,1.13,601:1:603,701:1:703 S DR=DR_";"_I_"///@"
  1. . ;IHS/OIT/SCR 11/20/08 delete new 'incentive amount submitted' field also
  1. . ;I '$P($G(^ABSPT(DA,5)),U,6) F I=501:1:505 S DR=DR_";"_I_"///@"
  1. . I '$P($G(^ABSPT(DA,5)),U,6) F I=501,502,503,505,507 S DR=DR_";"_I_"///@"
  1. D ^DIE
  1. D PREVISLY^ABSPOSIZ(IEN59) ; bracket result text with "[Previously: ]"
  1. ; Reset status
  1. N ABSBRXI S ABSBRXI=IEN59 D SETSTAT^ABSPOSU(0)
  1. Q
  1. DEVICE() ;EP - device selection for POS
  1. ; want to provide a convenient default
  1. N DEFAULT S DEFAULT="HOME"
  1. N DEVICE S DEVICE=$$DEVICE^ABSPOSU8(DEFAULT)
  1. I 'DEVICE Q ""
  1. Q DEVICE
  1. CANCEL ; protocol ABSP P1 CANCEL CLAIM
  1. N LINE
  1. W !,"Select prescription to cancel by line number. Hurry!"
  1. D SELECPAT(.LINE)
  1. I $O(LINE(""))="" W !,"None selected for cancellation",! G CAN99
  1. S LINE="" F S LINE=$O(LINE(LINE)) Q:LINE="" D
  1. .N PAT,RXI S PAT=$P(@DISPLINE@(LINE),U),RXI=$P(@DISPLINE@(LINE),U,2)
  1. .I RXI D CANC5^ABSPOS6L Q
  1. .; else patient was selected; cancel all of this patient's claims
  1. .S RXI="" F S RXI=$O(@DISP@(PAT,RXI)) Q:RXI="" D CANC5^ABSPOS6L
  1. W !,"Cancellation requests made." H 1
  1. CAN99 D ANY^ABSPOS2A ;D PRESSANY^ABSPOSU5()
  1. N NODISPLY DO UPD^ABSPOS6A S VALMBCK="R"
  1. Q
  1. DISMISS ; protocol ABSP P1 DISMISS ; dismiss a patient from my screen
  1. ; This is to remove a patient from the display before the usual
  1. ; time window has expired. Do it by:
  1. ; 1. Set @DISMISS nodes to 15 minutes from now, so as to keep
  1. ; the patient and prescription off our screen until then.
  1. ; 2. Zero out the time of last update in @DISP so that the
  1. ; winnowing thinks the entry is too old to keep around.
  1. ; This functionality is provided with the intent to support
  1. ; dismissing an entire patient's record after all processing
  1. ; has been completed. Unusual usage may not have the results
  1. ; you presume it might have.
  1. DIS0 N IEN,TIME,X,%,%I,%H D NOW^%DTC
  1. S TIME=$$TADD^ABSPOSUD(%,^TMP("ABSPOS",$J,"TIME"))
  1. D SELECPAT(.IEN)
  1. S IEN="" F S IEN=$O(IEN(IEN)) Q:IEN="" D
  1. .N PAT,RXI S PAT=@DISPLINE@(IEN),RXI=$P(PAT,U,2),PAT=$P(PAT,U)
  1. .S @DISMISS@(PAT)=TIME
  1. .;I '$D(@DISP@(PAT)) W "DISP=",DISP," and @DISP@(PAT) is undef",! H 2
  1. .I $D(@DISP@(PAT)) S $P(@DISP@(PAT),U,3)=0
  1. .;I W "Now @DISP@(PAT)=",@DISP@(PAT),! H 2
  1. .W PAT," will be dismissed.",! H 1
  1. .I RXI D
  1. ..S @DISMISS@(PAT,RXI)=TIME
  1. ..I $D(@DISP@(PAT,RXI)) S $P(@DISP@(PAT,RXI),U,3)=0
  1. ..;W PAT," ",RXI," will be dismissed.",! H 1
  1. DIS9 ; some other functions branch to here to go back to main screen
  1. N NODISPLY DO UPD^ABSPOS6A S VALMBCK="R"
  1. Q
  1. SELECPAT(RET) ; Select a patient. Returns patient IEN(s) in array
  1. N VALMA,VAMP,VALMI,VALMAT,VALMY
  1. D EN^VALM2(XQORNOD(0),"O") S VALMI=0 ; allow "O"ptionally answer
  1. W !
  1. M RET=VALMY
  1. Q
  1. CLOSECLM ;protocol ABSP P1 CLOSE CLAIM
  1. ;IHS/OIT/SCR 021910 patch 37
  1. N ABSPIEN,X,%,%I,%H,ABSPDFN,ABSPCLSD,IEN,ABSPTIME
  1. D NOW^%DTC
  1. S ABSPTIME=%
  1. W !,"Select the line(s) with the claim(s) you wish to CLOSE",!
  1. D SELECPAT(.IEN) ; select prescription(s) or patients - IEN is expected to be defined
  1. N RXI D MAKERXI ; IEN(*) -> converted to RXI(*)
  1. ; now RXI(*) is the array of RXI's we want to print logs for
  1. S RXI="" F S RXI=$O(RXI(RXI)) Q:RXI="" S ABSPCLSD=$$CLOSECLM^ABSPOS6N(RXI)
  1. D ANY^ABSPOS2A
  1. ;D CLEAN^VALM10
  1. D EN^ABSPOS6A(DUZ,ABSPTIME)
  1. ;S VALMBCK="R"
  1. Q
  1. OPENCLM ;Protocol ABSP P1 RE-OPEN CLAIM
  1. ;IHS/OIT/SCR 021910 patch 37
  1. N ABSPOPEN
  1. D FULL^VALM1
  1. S ABSPOPEN=$$OPENCLM^ABSPOS6N
  1. D ANY^ABSPOS2A
  1. N NODISPLY S NODISPLY=1 D UPD^ABSPOS6A
  1. S VALMBCK="R"
  1. Q