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

BPSNCPD6.m

Go to the documentation of this file.
  1. BPSNCPD6 ;ALB/SS - Pharmacy API part 6 ;10-JAN-08
  1. ;;1.0;E CLAIMS MGMT ENGINE;**7,8,10,11,20**;JUN 2004;Build 27
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. ;All of the entry points in this routine except LOOK77 were
  1. ; created from code that was copied from BPSNCPDP because BPSNCPDP
  1. ; was too big. The variables are newed in BPSNCPDP and returned back
  1. ; to BPSNCPDP
  1. ;== New Claim
  1. NEWCLAIM ;
  1. S BPRETV=$$NEWCLM^BPSNCPD5(.BP77NEW,BRXIEN,BFILL,DOS,BWHERE,BILLNDC,REVREAS,DURREC,BPOVRIEN,BPSCLARF,BPSAUTH,BPSDELAY,BPCOBIND,BPJOBFLG,IEN59,BPACTTYP,DFN,.BPSTART,$G(BPREQIEN),.BPSELIG,$G(BPSRTYPE),$G(BPSPLAN),.BPSPRDAT)
  1. S RESPONSE=+BPRETV
  1. ;to make LOG backward compatible
  1. D LOG^BPSOSL(IEN59,$T(+0)_"-After Submit of Claim. Return Value: "_$S(RESPONSE=0:1,1:0))
  1. S CLMSTAT=$P(BPRETV,U,2)
  1. D DISPL^BPSNCPD4(WFLG,BPRETV,$G(BPSELIG))
  1. I RESPONSE=0 Q
  1. D LOG^BPSOSL(IEN59,$T(+0)_"-"_CLMSTAT)
  1. Q
  1. ;
  1. ;== Reversals for Payable claims
  1. ;(Note: BPSCLOSE parameter of EN^BPSNCPDP can be used in this case)
  1. RVPAID ;
  1. S BPRETV=$$REVERSAL^BPSNCPD5(.BP77NEW,BRXIEN,BFILL,OLDRESP,DOS,BWHERE,$G(BILLNDC),REVREAS,DURREC,BPOVRIEN,BPSCLARF,BPSAUTH,BPSDELAY,IEN59,BPCOBIND,BPJOBFLG,BPACTTYP,.BPSTART,$G(BPREQIEN),.BPSCLOSE,$G(BPSRTYPE),.BPSPRDAT)
  1. S RESPONSE=+BPRETV
  1. ;to make LOG backward compatible
  1. D LOG^BPSOSL(IEN59,$T(+0)_"-After Submit of Reversal. Return Value: "_$S(RESPONSE=0:1,1:0))
  1. S CLMSTAT=$P(BPRETV,U,2)
  1. I BWHERE'="EREV" D DISPL^BPSNCPD4(WFLG,BPRETV,$G(BPSELIG))
  1. I RESPONSE=0 Q
  1. D LOG^BPSOSL(IEN59,$T(+0)_"-"_CLMSTAT)
  1. Q
  1. ;
  1. ;== Reversals+Resubmits for Payable claims
  1. RVRSPAID ;
  1. S BPRETV=$$REVRESUB^BPSNCPD4(.BP77NEW,BRXIEN,BFILL,DOS,BWHERE,BILLNDC,REVREAS,DURREC,BPOVRIEN,BPSCLARF,BPSAUTH,BPSDELAY,BPCOBIND,BPJOBFLG,IEN59,DFN,.BPSTART,$G(BPREQIEN),OLDRESP,.BPSELIG,$G(BPSRTYPE),$G(BPSPLAN),.BPSPRDAT)
  1. S RESPONSE=+BPRETV
  1. ;if "Reversal only not resubmit" - display a message for the user
  1. I RESPONSE=10 D DISPL^BPSNCPD4(WFLG,"10^Claim Will Be Reversed But Will Not Be Resubmitted^D^2",$G(BPSELIG))
  1. ;to make LOG backward compatible
  1. D LOG^BPSOSL(IEN59,$T(+0)_"-After Submit of Reversal. Return Value: "_$S(RESPONSE=0:1,1:0))
  1. D DISPL^BPSNCPD4(WFLG,BPRETV,$G(BPSELIG))
  1. I RESPONSE=10 S CLMSTAT=$P(BPRETV,U,5) Q
  1. S CLMSTAT=$P(BPRETV,U,2)
  1. I RESPONSE=0 Q
  1. D LOG^BPSOSL(IEN59,$T(+0)_"-"_CLMSTAT)
  1. Q
  1. ;
  1. ;== Resubmits for Payable claims - DO NOT resubmit
  1. RSPAID ;
  1. S RESPONSE=1
  1. ; Message varies depending the the previous response
  1. ; Reversal Accepted would not get here so this must be rejected, stranded, or other
  1. I OLDRESP["REVERSAL" S CLMSTAT="Can not resubmit a rejected or stranded reversal"
  1. E S CLMSTAT="Previously billed through ECME: "_OLDRESP
  1. D DISPL^BPSNCPD4(WFLG,RESPONSE_U_CLMSTAT_"^D^2",$G(BPSELIG))
  1. D LOG^BPSOSL(IEN59,$T(+0)_"-"_CLMSTAT)
  1. Q
  1. ;== Reversals for Non-Payable claims - DO NOT reverse
  1. RVNPAID ;
  1. ;if this is return to stock OR delete - close the claim
  1. I ",RS,DE,"[(","_BWHERE_",") D Q
  1. . D CLOSE2^BPSBUTL(BRXIEN,BFILL,BWHERE)
  1. . S RESPONSE=3
  1. . S CLMSTAT="Claim was not payable so it has been closed. No ECME claim created."
  1. . D DISPL^BPSNCPD4(WFLG,RESPONSE_U_CLMSTAT_"^D^2",$G(BPSELIG))
  1. . D LOG^BPSOSL(IEN59,$T(+0)_"-"_CLMSTAT)
  1. S RESPONSE=1
  1. S CLMSTAT="Claim has status "_OLDRESP_". Not reversed."
  1. D DISPL^BPSNCPD4(WFLG,RESPONSE_U_CLMSTAT_"^D^2",$G(BPSELIG))
  1. D LOG^BPSOSL(IEN59,$T(+0)_"-"_CLMSTAT)
  1. Q
  1. ;
  1. ;== Resubmits AND Reversals+Resubmits for Non-Payable claims
  1. ;== Also used for Resubmits without Reversals no matter the claim status (BPS*1*20)
  1. RVRSNPD ;
  1. ; resubmit a claim
  1. S BPRETV=$$REVRESNP^BPSNCPD5(.BP77NEW,BRXIEN,BFILL,DOS,BWHERE,BILLNDC,REVREAS,DURREC,BPOVRIEN,BPSCLARF,BPSAUTH,BPSDELAY,BPCOBIND,BPJOBFLG,IEN59,BPACTTYP,DFN,.BPSTART,$G(BPREQIEN),OLDRESP,.BPSELIG,$G(BPSRTYPE),$G(BPSPLAN),.BPSPRDAT)
  1. S RESPONSE=+BPRETV
  1. ;to make LOG backward compatible
  1. I BWHERE'="ERWV" D LOG^BPSOSL(IEN59,$T(+0)_"-After Submit of Reversal. Return Value: "_$S(RESPONSE=0:1,1:0))
  1. I BWHERE="ERWV" D LOG^BPSOSL(IEN59,$T(+0)_"-After Submit of Claim w/o Reversal. Return Value: "_$S(RESPONSE=0:1,1:0))
  1. S CLMSTAT=$P(BPRETV,U,2)
  1. D DISPL^BPSNCPD4(WFLG,BPRETV,$G(BPSELIG))
  1. I RESPONSE=0 Q
  1. D LOG^BPSOSL(IEN59,$T(+0)_"-"_CLMSTAT)
  1. Q
  1. ;
  1. ; if Back Billing
  1. BB ;
  1. S RESPONSE=1
  1. S CLMSTAT="Previously billed through ECME: "_OLDRESP
  1. D DISPL^BPSNCPD4(WFLG,RESPONSE_U_CLMSTAT_"^D^2",$G(BPSELIG))
  1. D LOG^BPSOSL(IEN59,$T(+0)_"-"_CLMSTAT)
  1. Q
  1. ;
  1. ; if we do not have a status for pre-existing claim AND this is a reversal request - DO NOT reverse
  1. RVNEW ;
  1. S RESPONSE=1
  1. S CLMSTAT="Prescription not previously billed through ECME. Cannot Reverse claim."
  1. D DISPL^BPSNCPD4(WFLG,RESPONSE_U_CLMSTAT_"^D^2",$G(BPSELIG))
  1. D LOG^BPSOSL(IEN59,$T(+0)_"-"_CLMSTAT)
  1. Q
  1. ;
  1. ; This was meant to called by BPSSCR04 to collect requests for the User Screen that don't have BPS TRANSACTION records
  1. ; However, it is currently not called. This is still here in case, it is needed in the future. The call that should
  1. ; be used is D LOOK77^BPSNCPD6(BPBDT,BPEDT,BPTMP1)
  1. LOOK77(BPBEGDT,BPENDDT,BPTMP) ;
  1. N BPLDT77,BP77,BP59,BPRXRF
  1. S BPLDT77=BPBEGDT-0.00001
  1. F S BPLDT77=+$O(^BPS(9002313.77,"E",BPLDT77)) Q:BPLDT77=0!(BPLDT77>BPENDDT) D
  1. . S BP77=0 F S BP77=$O(^BPS(9002313.77,"E",BPLDT77,BP77)) Q:+BP77=0 D
  1. . . S BPRXRF=$P($G(^BPS(9002313.77,BP77,0)),U,1,2)
  1. . . S BP59=$$IEN59^BPSOSRX(+BPRXRF,$P(BPRXRF,U,2)) ;calculate BPS TRANSACTION ien (even if it doesn't exist yet)
  1. . . I $D(@BPTMP@(BP59)) Q ;don't create an entry if the claim is already there
  1. . . S @BPTMP@(BP59)=(BPLDT77\1)_"^77-"
  1. Q
  1. ;