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

ABSPOSCE.m

Go to the documentation of this file.
  1. ABSPOSCE ; IHS/FCS/DRS - New entry in 9002313.02 ; [ 12/20/2002 11:24 AM ]
  1. ;;1.0;PHARMACY POINT OF SALE;**3,5,42**;JUN 21, 2001;Build 38
  1. ;----------------------------------------------------------------------
  1. ;----------------------------------------------------------------------
  1. ;Creates an Electronic Claim Submission record
  1. ;
  1. ;Parameters: START - START Medication Number
  1. ; END - END Medication Number
  1. ; TOTAL - TOTAL Medications in Claim
  1. ; the ABSP(*) array pointed to by START, END
  1. ;
  1. ;----------------------------------------------------------------------
  1. ; NEWCLAIM^ABSPOSCE called from ABSPOSCA from ABSPOSQG from ABSPOSQ2
  1. ;
  1. ;IHS/SD/lwj 08/01/02 NCPDP 5.1 changes
  1. ; This routine is responsible for creating a new entry in the
  1. ; claims file, and for calling the routines that then populate
  1. ; that new entry.
  1. ;
  1. ; For 5.1 we needed to adjust this routine just a little. In 3.2
  1. ; there were only 4 segments to a claim, in 5.1 there are 14, so
  1. ; as we loop through the calling of ABSPOSCF to populate the claim
  1. ; file we will verify which version of claim we are working with
  1. ; and adjust the calling appropriately. Worthy of noting is that
  1. ; the "header" portion of the claim in 5.1 is comprised of 3
  1. ; segments - 100 (Header), 110 (Insurance) and 120 (Patient). The
  1. ; "detail" or "rx" portion of the claim will hold the remaining
  1. ; 11 segments.
  1. ;
  1. ; I also had to create a new ABSP field (i.e. "Transaction Count")
  1. ; to track the number of transactions per claim.
  1. ;
  1. ;
  1. ;IHS/SD/lwj 12/20/02 NCPDP fix
  1. ; Field 308 changed definition in NCPDP 5.1 - it was a header field in
  1. ; 3.x claims - in 5.1 it migrated to a detail level. Because we are
  1. ; supporting 3.x and 5.1 claims,this duel personality caused the claims
  1. ; to be created erroneously on 3.2 claims when two claims were created
  1. ; back to back. To fix this ABSP(9002313.0201) needs to be reset to
  1. ; blanks prior to the claim header being created.
  1. ;
  1. Q
  1. ;
  1. NEWCLAIM(START,END,TOTAL) ;EP
  1. ;Manage local variables
  1. N CLAIMID,DIC,DLAYGO,X,Y,COUNT,INDEX,DIK,DA,NODE0,ROU S ROU=$T(+0)
  1. ;
  1. ;Create new record in Claim Submission File (9002313.02)
  1. L L +^TMP("ABSPOSCE"):300 I '$T G L:$$IMPOSS^ABSPOSUE("L","RTI","Single-threaded routine",,,$T(+0))
  1. S CLAIMID=$$CLAIMID^ABSPECX1(ABSP("NCPDP","IEN"),"P")
  1. I CLAIMID="" S ERROR=8001 D L -^TMP($T(+0)) Q
  1. .D LOG(ROU_" - $$CLAIMID^ABSBPECX1() failed")
  1. ;U $P W "Creating CLAIMID ",CLAIMID,"...",!
  1. S DLAYGO=9002313.02,DIC="^ABSPC(",DIC(0)="LXZ",X=CLAIMID
  1. D ^DIC S Y=+Y
  1. L -^TMP("ABSPOSCE")
  1. I Y<1 D S ERROR=8002 Q
  1. .D LOG(ROU_" - Failed to create an entry in file 9002313.02")
  1. ;
  1. S ABSP(9002313.02)=Y
  1. D LOG(ROU_" - Created claim ID "_CLAIMID_" (IEN "_ABSP(9002313.02)_")")
  1. ;
  1. S NODE0=$G(^ABSPC(ABSP(9002313.02),0))
  1. S $P(NODE0,U,2)=ABSP("Insurer","IEN")
  1. ;S $P(NODE0,U,3)=BItemIEN
  1. S $P(NODE0,U,4)=2 ; TRANSMIT FLAG - use 2 instead of 1 because
  1. ; ANMC is running POS and Traditional batch file together and we
  1. ; want to be entirely sure of no conflicts
  1. S $P(NODE0,U,6)=$$NOWFM^ABSPOSU1()
  1. S ^ABSPC(ABSP(9002313.02),0)=NODE0
  1. S $P(^ABSPC(ABSP(9002313.02),1),U)=ABSP("Patient","Name")
  1. ;
  1. S:ABSP("NCPDP","Version")[3 ABSP("Transaction Code")=TOTAL
  1. ;
  1. ; IHS/SD/lwj 8/5/02 NCPDP 5.1 - the value of field 103 changed
  1. ; from being either the number of transactions for billing, or
  1. ; an 11 for reversal, to a B1 for billing or a B2 for reversal
  1. ; 5.1 also requires that we send the number of transactions in
  1. ; the claim. So...for reversals we will set this to 1, and for
  1. ; all others, we can still use TOTAL
  1. ;
  1. S ABSP("Transaction Count")=TOTAL
  1. I TOTAL=11 S ABSP("Transaction Count")=1 ;only 1 rev at a time
  1. ;
  1. ; IHS/SD/lwj 8/1/02 begin the 5.1 changes for the "header" section
  1. ; If the claim type is 3.2 we will call ABSPOSCF with nodes 10
  1. ; and 20 - if it is 5.1, we will call with 100,110 and 120.
  1. ;
  1. ; first remark out old code
  1. ;Execute claim header (required) code
  1. ;D XLOOP^ABSPOSCF(ABSP("NCPDP","IEN"),10)
  1. ;
  1. ;Execute claim header (optional) code
  1. ;D XLOOP^ABSPOSCF(ABSP("NCPDP","IEN"),20)
  1. ;
  1. ;IHS/SD/lwj 12/20/02 NCPDP fix - clear ABSP(9002313.0201)
  1. S ABSP(9002313.0201)="" ;IHS/SD/lwj 12/20/02
  1. ;
  1. ; Now for the new code
  1. D
  1. . N SEG,SEGBEG,SEGEND
  1. . I ABSP("NCPDP","Version")[3 S SEGBEG=10,SEGEND=20
  1. . I ABSP("NCPDP","Version")[5 S SEGBEG=100,SEGEND=120
  1. . ;IHS/OIT/CASSEVERN/RAN - 02/09/2011 - Patch 42 For D.0 development START
  1. . ;Don't do this if we've run the conversion....no longer use NCPDP formats
  1. . I $G(^ABSP(9002313.99,1,"ABSPICNV"))=1 Q
  1. . F SEG=SEGBEG:10:SEGEND D
  1. .. D XLOOP^ABSPOSCF(ABSP("NCPDP","IEN"),SEG)
  1. ;IHS/OIT/CASSEVERN/RAN - 02/09/2011 - Patch 42 For D.0 development
  1. I $G(^ABSP(9002313.99,1,"ABSPICNV"))=1 D
  1. . I ABSP("NCPDP","Version")["D" D
  1. . . I TOTAL=11 D
  1. . . . D EN^ABSPDB2("CLAIMHD") ;Replaces steps above
  1. . . ELSE D EN^ABSPDB1("CLAIMHD")
  1. . I ABSP("NCPDP","Version")["5" D
  1. . . I TOTAL=11 D
  1. . . . D EN^ABSP5B2("CLAIMHD") ;Replaces steps above
  1. . . ELSE D EN^ABSP5B1("CLAIMHD")
  1. ;IHS/OIT/CASSEVERN/RAN - 02/09/2011 - Patch 42 For D.0 development STOP
  1. ;Create multiple zero node
  1. S ^ABSPC(ABSP(9002313.02),400,0)="^9002313.0201PA^^"
  1. ;
  1. S COUNT=0
  1. F INDEX=START:1:END D
  1. .;Create prescription record
  1. .S COUNT=COUNT+1
  1. .S NODE0=""
  1. .S $P(NODE0,U,1)=INDEX
  1. .S $P(NODE0,U,2)=$G(ABSP("RX",INDEX,"VCPT IEN"))
  1. .S $P(NODE0,U,3)=INDEX
  1. .S $P(NODE0,U,4)=$G(ABSP("RX",INDEX,"Drug Name"))
  1. .S ^ABSPC(ABSP(9002313.02),400,INDEX,0)=NODE0
  1. .S $P(^ABSPC(ABSP(9002313.02),400,INDEX,400),U,1)=$$DTF1^ABSPECFM($G(ABSP("RX","Date Filled")))
  1. .S ABSP(9002313.0201)=INDEX ;07/28/96.
  1. .;
  1. .; IHS/SD/lwj 8/1/02 begin changes for NCPDP 5.1 - subroutine called
  1. .; to lessen the looping here
  1. .; First we will remark out the old code
  1. .; Execute claim information (required) code
  1. .; D XLOOP^ABSPOSCF(ABSP("NCPDP","IEN"),30,INDEX)
  1. .;
  1. .; Execute claim information (optional) code
  1. .; D XLOOP^ABSPOSCF(ABSP("NCPDP","IEN"),40,INDEX)
  1. .;
  1. .; Now let's call the subroutine to process
  1. .;IHS/OIT/CASSEVERN/RAN - 02/09/2011 - Patch 42 For D.0 development - START
  1. . ;D PROCRX
  1. .I $G(^ABSP(9002313.99,1,"ABSPICNV"))'=1 D
  1. . . D PROCRX
  1. .ELSE D
  1. . . I ABSP("NCPDP","Version")["D" D
  1. . . . I TOTAL=11 D
  1. . . . . D EN^ABSPDB2("CLAIMRST",INDEX)
  1. . . . ELSE D EN^ABSPDB1("CLAIMRST",INDEX)
  1. . . I ABSP("NCPDP","Version")["5" D
  1. . . . I TOTAL=11 D
  1. . . . . D EN^ABSP5B2("CLAIMRST",INDEX)
  1. . . . ELSE D EN^ABSP5B1("CLAIMRST",INDEX)
  1. .;IHS/OIT/CASSEVERN/RAN - 02/09/2011 - Patch 42 For D.0 development - END
  1. .; IHS/SD/lwj end changes for 5.1 rx detail
  1. .S ^ABSPC(ABSP(9002313.02),400,"B",INDEX,INDEX)=""
  1. .S ^ABSPC(ABSP(9002313.02),400,"AC",INDEX,INDEX)=""
  1. .S NODE0=$G(^ABSPC(ABSP(9002313.02),400,0))
  1. .S $P(NODE0,U,4)=COUNT
  1. .S $P(NODE0,U,3)=$O(^ABSPC(ABSP(9002313.02),400,"A"),-1)
  1. .S ^ABSPC(ABSP(9002313.02),400,0)=NODE0
  1. ;
  1. ;Cross-Reference Claim Submission Record
  1. S DIK="^ABSPC("
  1. S DA=ABSP(9002313.02)
  1. D IX1^DIK
  1. Q
  1. LOG(X) ; write the message to all of the log files for the IEN59's
  1. ; being bundled into this 9002313.02 claim (usually, up to 4 presc's)
  1. N IEN59,I
  1. F I=START:1:END D
  1. . S IEN59=ABSP("RX",I,"IEN59")
  1. . D LOG59^ABSPOSQ(X,IEN59)
  1. Q
  1. ;
  1. PROCRX ;IHS/SD/lwj 8/1/02 This routine contains the calls to
  1. ; ABSPOSCF needed to actually get the values, and store them
  1. ; in the claim file. It was created as a result of the major
  1. ; segment changes that took place in NCPDP 5.1. For 3.2 claims
  1. ; we will still only call ABSPOSCF with nodes 30 and 40, but for
  1. ; 5.1 claims, we will call the routine with nodes 130, 140, 150,
  1. ; 160, 170, 180, 190, 200, 210, 220, 230. These nodes are defined
  1. ; in the ABSPF(9002313.92 file.
  1. ;
  1. N SEG,SEGBEG,SEGEND
  1. I ABSP("NCPDP","Version")[3 S SEGBEG=30,SEGEND=40
  1. I ABSP("NCPDP","Version")[5 S SEGBEG=130,SEGEND=230
  1. F SEG=SEGBEG:10:SEGEND D
  1. . D XLOOP^ABSPOSCF(ABSP("NCPDP","IEN"),SEG,INDEX)
  1. ;
  1. Q