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

BPSOSCA.m

Go to the documentation of this file.
  1. BPSOSCA ;BHAM ISC/FCS/DRS - Create BPS Claims entries ;06/01/2004
  1. ;;1.0;E CLAIMS MGMT ENGINE;**1,5,10**;JUN 2004;Build 27
  1. ;;Per VHA Directive 2004-038, this routine should not be modified.
  1. ;
  1. Q
  1. ; Create BPS Claims entries for TRANLIST(*) claims.
  1. ; Called from PACKET^BPSOSQG
  1. ;
  1. ; Input:
  1. ; TRANLIST(IEN59) - Array of pointers to 9002313.59
  1. ; A list of transactions for the same visit/patient/etc.
  1. ; to be bundled into one or more 9002313.02 claims
  1. ;
  1. ; Outputs:
  1. ; CLAIMIEN(CLAIMIEN)="", pointers to the ^BPSC(CLAIMIEN,
  1. ; claim records created.
  1. ; ERROR
  1. ;
  1. ; BPSOSCA calls:
  1. ; BPSOSCB to build BPS(*) array
  1. ; (and BPSOSCB calls BPSOSCC and BPSOSCD)
  1. ; BPSOSCE to build the ^BPSC( entry
  1. ;
  1. EN(CLAIMIEN) ;EP - from BPSOSQG
  1. I $D(TRANLIST)<10 D Q "306^No TRANLIST defined"
  1. . N RETVAL S RETVAL=$$IMPOSS^BPSOSUE("P","TI","Bad TRANLIST",,,$T(+0))
  1. . D LOG2LIST^BPSOSL($T(+0)_"-No TRANLIST passed into BPSOSCA")
  1. ;
  1. ; Manage local variables
  1. N BPS,START,END,TOTAL,NCLAIMS,CLAIMN,ERROR
  1. S ERROR=$$BPS^BPSOSCB()
  1. I ERROR D LOG2LIST^BPSOSL($T(+0)_"-$$BPS^BPSOSCB(.BPS) returned "_ERROR)
  1. I $G(BPS("RX",0))="" S:'ERROR ERROR="301^BPS(""RX"" not created" Q ERROR
  1. I $G(BPS("NCPDP","# Meds/Claim"))="" Q "302^Number of Meds not returned"
  1. ;
  1. ; Calculate number of claim records to be generated for Billing Item
  1. S NCLAIMS=((BPS("RX",0)-1)\BPS("NCPDP","# Meds/Claim"))+1
  1. I NCLAIMS=0 Q "303^Number of claims is zero"
  1. ;
  1. ;Generate claim submission records
  1. F CLAIMN=1:1:NCLAIMS D Q:$G(ERROR)
  1. . S START=((CLAIMN-1)*BPS("NCPDP","# Meds/Claim"))+1
  1. . S END=START+BPS("NCPDP","# Meds/Claim")-1
  1. . S:END>BPS("RX",0) END=BPS("RX",0)
  1. . S TOTAL=END-START+1
  1. . S ERROR=$$NEWCLAIM^BPSOSCE(START,END,TOTAL)
  1. . I ERROR]"" Q
  1. . S CLAIMIEN=BPS(9002313.02)
  1. . S CLAIMIEN(CLAIMIEN)=""
  1. . ; Mark each of the .59s with the claim number and position within
  1. . F I=START:1:END D
  1. .. ;
  1. .. ; IEN59 handling 06/23/2000. The ELSE should never happen again.
  1. .. ; and the $G() can probably be gotten rid of, safely.
  1. .. N IEN59 S IEN59=$G(BPS("RX",I,"IEN59"))
  1. .. I IEN59 D
  1. ... N DIE,DA,DR S DIE=9002313.59
  1. ... ;
  1. ... ; Field #3-CLAIM, #14-POSITION
  1. ... ; POSITION: Not the relative position within the packet,
  1. ... ; but the index in BPS("RX",n,.... This is the position in which
  1. ... ; it will be stored in ^BPSC(ien,400,POSITION
  1. ... ; and likewise for 9002313.03 when the response comes in.
  1. ... S DA=IEN59,DR=3_"////"_CLAIMIEN_";14////"_I N I D ^DIE
  1. .. E D
  1. ... S $P(^BPST(BPS("RX",I,"RX IEN"),0),"^",4)=CLAIMIEN
  1. ... S ^BPST("AE",CLAIMIEN,BPS("RX",I,"RX IEN"))=""
  1. ... S $P(^BPST(BPS("RX",I,"RX IEN"),0),"^",9)=I
  1. Q ERROR