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

ABSPOSC2.m

Go to the documentation of this file.
  1. ABSPOSC2 ; IHS/FCS/DRS - certification testing ; [ 06/22/2001 2:14 PM ]
  1. ;;1.0;PHARMACY POINT OF SALE;**42**;JUN 21, 2001;Build 38
  1. ; see remarks in ABSPOSC1 too
  1. Q
  1. ; ^ABSP(9002313.31, has data for test claims
  1. ; Now construct packets
  1. ALL ; Construct packets for all entries in 9002313.31
  1. D IMPOSS^ABSPOSUE("P","TI","Development utility - incomplete",,"ALL",$T(+0))
  1. Q
  1. ;
  1. TEST(ENTRY) ;
  1. W "Testing in ",$T(+0),!
  1. I '$P(^ABSP(9002313.31,ENTRY,0),U,4) D Q
  1. . W "Field .04 in 9002313.31 needs to have pointer to insurer.",!
  1. N DIALOUT S DIALOUT=$$DIALOUT
  1. N X S X=$$PACKET(ENTRY,DIALOUT,2) ; ^TMP($J gets copy of ABSP() data
  1. W "Input: 9002313.31 entry `",ENTRY,!
  1. W "Output: 9002313.02 entry `",X,!
  1. W !,"To send this claim, DO SEND^ABSPOSC2(",ENTRY,")",!
  1. ;M X=^ABSPC(X)
  1. ;ZW X
  1. ;K X M X=^TMP($J,$T(+0)) ZW X
  1. Q
  1. REVERSAL(ENTRY,N) ; construct the reversal packet for this 9002313.31 entry
  1. D LOG^ABSPOSL("Reversal claim `"_REV_" "_$P(^ABSPC(REV,0),U))
  1. ; for the N'th prescription therein - N defaults to 1
  1. ; First construct the original version.
  1. D TEST(ENTRY)
  1. N ORIG S ORIG=$P(^ABSP(9002313.31,ENTRY,0),U,3)
  1. I 'ORIG D Q
  1. . D IMPOSS^ABSPOSUE("DB,P","TRI","Error constructing original claim",,"REVERSAL - 1",$T(+0))
  1. N REVERSAL S REVERSAL=$$REVERSE^ABSPECA8(ORIG,$S($G(N):N,1:1))
  1. W "Reversal: 9002313.02 entry `",REVERSAL,!
  1. I 'REVERSAL D Q ; error during construction of reversal
  1. . D IMPOSS^ABSPOSUE("DB,P","TRI","Error constructing reversal claim",,"REVERSAL - 2",$T(+0))
  1. ; Now construct the data packet
  1. N COUNT,DIALOUT,CLAIMIEN S COUNT=0
  1. S DIALOUT=$$DIALOUT,CLAIMIEN=REVERSAL D PASCII1^ABSPOSQH
  1. ; ORIG is obsolete, orphaned
  1. ; Overwrite the pointer to 9002313.02 with the Reversal packet
  1. N DIE S DIE=9002313.31,DA=ENTRY,DR=".03////"_REVERSAL D ^DIE
  1. ; Now SEND^ABSPOSC2(ENTRY) will send the reversal
  1. Q
  1. DIALOUT() Q $O(^ABSP(9002313.55,"B","RESERVED - DO NOT USE",0))
  1. SEND(ENTRY) ;
  1. N IEN02 S IEN02=$P(^ABSP(9002313.31,ENTRY,0),U,3)
  1. D RUNTEST^ABSPOSC3($$DIALOUT,IEN02)
  1. W "The log file can be viewed by DO LOG^",$T(+0),!
  1. Q
  1. LOG ;EP -
  1. W !,"At the prompt, just type RES to get the RESERVED - DO NOT USE",!
  1. D COMMSLOG^ABSPOSU6
  1. Q
  1. PRINT(IEN31,FLAG) ;
  1. W "IEN31=",IEN31,!
  1. N CLAIM S CLAIM=$P(^ABSP(9002313.31,IEN31,0),U,3)
  1. I 'CLAIM W "No claim for IEN31=",IEN31,! Q
  1. I $G(FLAG)=0 G P12
  1. D PRINT02^ABSPOSAY(CLAIM)
  1. P12 N RESP S RESP=$O(^ABSPR("B",CLAIM,""),-1) ; get the most recent resp.
  1. I 'RESP W "No response for CLAIM=",CLAIM,! Q
  1. D PRINT03^ABSPOSAY(RESP)
  1. Q
  1. PRINTR(IEN31) ;
  1. D PRINT(IEN31,0)
  1. Q
  1. SAVEABSP K ^TMP($J,$T(+0))
  1. N % S %="ABSP"
  1. F S %=$Q(@%) Q:%="" S ^TMP($J,$T(+0),%)=@%
  1. Q
  1. PACKET(ENTRY,DIALOUT,DUMPABSP) ; EP - from ABSPOSC4
  1. N ABSP
  1. D SETABSP(ENTRY) ; construct the ABSP(*) array
  1. I $G(DUMPABSP)[1 D ZWRITE^ABSPOS("ABSP") ;ZW ABSP
  1. I $G(DUMPABSP)[2 D SAVEABSP
  1. N N S N=$P(^ABSP(9002313.31,ENTRY,2,0),U,3)
  1. D NEWCLAIM^ABSPOSCE(1,N,N) ; builds a 9002313.02 record
  1. N CLAIMIEN S CLAIMIEN=$P(^ABSPC(0),U,3)
  1. N COUNT S COUNT=0 ; this variable is used by PASCII1^ABSPOSQH
  1. D PASCII1^ABSPOSQH ; construct the data packet
  1. N DA,DIE,DR S DIE=9002313.31,DA=ENTRY,DR=".03////"_CLAIMIEN D ^DIE
  1. Q CLAIMIEN
  1. SETABSP(ENTRY) ; Construct packet for just one entry in 9002313.31
  1. W "Create 9002313.02 claim for "
  1. W $P(^ABSP(9002313.31,ENTRY,0),U),!
  1. S ABSP("Insurer","IEN")=$P(^ABSP(9002313.31,ENTRY,0),U,4)
  1. S ABSP("Site","Switch Type")=$P(^ABSP(9002313.31,ENTRY,0),U,5)
  1. I ABSP("Site","Switch Type")="" S ABSP("Site","Switch Type")="ENVOY"
  1. S ABSP("NCPDP","IEN")=$P(^ABSPEI(ABSP("Insurer","IEN"),100),U)
  1. ;IHS/OIT/CASSEVERN/RAN - 02/09/2011 - Patch 42 -New code for working without formats - START
  1. I $G(^ABSP(9002313.99,1,"ABSPICNV"))=1 D
  1. . N DO,VERSION
  1. . S DO=ABSP("NCPDP","IEN")_","
  1. . S VERSION=$$GET1^DIQ(9002313.4,DO,100.15) ;NEW PLACE TO STORE NCPDP VERSION
  1. . I $G(VERSION)="D.0" S ABSP("NCPDP","Version")="D0"
  1. . I $G(VERSION)="5.1" S ABSP("NCPDP","Version")="51"
  1. . S ABSP("NCPDP","BIN Number")=$$GET1^DIQ(9002313.4,DO,100.16)
  1. ELSE D
  1. . ;IHS/OIT/CASSEVERN/RAN - 02/09/2011 - Patch 42 -New code for D.0 - END (Below 4 entries moved out one dot level)
  1. . S ABSP("NCPDP","BIN Number")=$P(^ABSPF(9002313.92,ABSP("NCPDP","IEN"),1),U)
  1. . S ABSP("NCPDP","Envoy Plan Number")=$P(^ABSPF(9002313.92,ABSP("NCPDP","IEN"),1),U,4)
  1. . S ABSP("NCPDP","Version")=$P(^ABSPF(9002313.92,ABSP("NCPDP","IEN"),1),U,2)
  1. . S ABSP("Envoy Terminal ID")=$P(^ABSP(9002313.56,1,0),U,6)
  1. N A,N S A=0 ; Loop through claim header fields
  1. F S A=$O(^ABSP(9002313.31,ENTRY,1,A)) Q:'A D
  1. . ; Set the Claim Header fields
  1. . N X S X=^ABSP(9002313.31,ENTRY,1,A,0)
  1. . N FIELD S FIELD=$P(^ABSPF(9002313.91,$P(X,U),0),U)
  1. . D SETABSP1(FIELD,$P(X,U,2))
  1. S N=0 ; Loop through prescription fields
  1. F S N=$O(^ABSP(9002313.31,ENTRY,2,N)) Q:'N D
  1. . N A S A=0
  1. . F S A=$O(^ABSP(9002313.31,ENTRY,2,N,1,A)) Q:'A D
  1. . . S X=^ABSP(9002313.31,ENTRY,2,N,1,A,0)
  1. . . N FIELD S FIELD=$P(^ABSPF(9002313.91,$P(X,U),0),U)
  1. . . D SETABSP1(FIELD,$P(X,U,2),N)
  1. . ; Construct a few other fields that weren't already set
  1. . I '$D(ABSP("Site","Dispensing Fee")) S ABSP("Site","Dispensing Fee")=4.5
  1. . ; Need this IEN59 for logging some stuff.
  1. . ; call it 9999991.00001, 9999992.00001, etc.
  1. . S ABSP("RX",N,"IEN59")=$$MYIEN59(N)
  1. . D INIT^ABSPOSL(ABSP("RX",N,"IEN59"))
  1. ; Construct a few other fields that weren't already set.
  1. S ABSP("Patient","Name")=$G(ABSP("Patient","Last Name"))_","_$G(ABSP("Patient","First Name"))
  1. Q
  1. PRINTLOG(N) ; print the log file for test claim number N
  1. D PRINTLOG^ABSPOSL($$MYIEN59(N)) Q
  1. MYIEN59(N) ; a fake number
  1. Q "999999"_N_".00001"
  1. SETABSP1(FIELD,VALUE,N) ; store values in Claim Header's ABSP(*)
  1. N OK S OK=0
  1. N I F I=1:1 Q:$T(TABLE+I)=" ;*" D Q:OK
  1. . N X S X=$T(TABLE+I)
  1. . I $P(X,";",2)'=FIELD Q
  1. . S @("ABSP("_$P(X,";",3)_")=VALUE")
  1. . S OK=1
  1. I 'OK W !,"Failed to find field ",FIELD," in TABLE^",$T(+0),!
  1. Q
  1. TABLE ;
  1. ;101;"NCPDP","Envoy Plan Number"
  1. ;102;"NCPDP","Version"
  1. ;103;"Transaction Code"
  1. ;104;"Envoy Terminal ID"
  1. ;201;"Site","Pharmacy #"
  1. ;301;"Insurer","Group #"
  1. ;302;"Insurer","Policy #"
  1. ;303;"Insurer","Person Code"
  1. ;304;"Patient","DOB"
  1. ;305;"Patient","Sex"
  1. ;306;"Insurer","Relationship"
  1. ;308;"Patient","Other Coverage Code"
  1. ;307;"Customer Location"
  1. ;309;"Eligibility Clarification Code"
  1. ;310;"Patient","First Name"
  1. ;311;"Patient","Last Name"
  1. ;312;"Cardholder","First Name"
  1. ;313;"Cardholder","Last Name"
  1. ;322;"Patient","Street Address"
  1. ;323;"Patient","City"
  1. ;324;"Patient","State"
  1. ;325;"Patient","Zip"
  1. ;401;"RX","Date Filled"
  1. ;402;"RX",N,"RX Number"
  1. ;403;"RX",N,"Refill #"
  1. ;404;"RX",N,"Quantity"
  1. ;405;"RX",N,"Days Supply"
  1. ;406;"RX",N,"Compound Code"
  1. ;407;"RX",N,"NDC"
  1. ;408;"RX",N,"DAW"
  1. ;409;"RX",N,"Ingredient Cost"
  1. ;410;"RX",N,"Sales Tax"
  1. ;411;"RX",N,"Prescriber ID"
  1. ;412;"RX",N,"Dispensing Fee"
  1. ;414;"RX",N,"Date Written"
  1. ;415;"RX",N,"# Refills"
  1. ;416;"RX",N,"Preauth #"
  1. ;418;"RX",N,"Level of Service"
  1. ;419;"RX",N,"Origin Code"
  1. ;420;"RX",N,"Clarification"
  1. ;421;"RX",N,"Primary Prescriber"
  1. ;422;"RX",N,"Clinic ID"
  1. ;423;"RX",N,"Basis of Cost Determination"
  1. ;424;"RX",N,"Diagnosis Code"
  1. ;426;"RX",N,"Usual & Customary"
  1. ;429;"RX",N,"Unit Dose Indicator"
  1. ;430;"RX",N,"Gross Amount Due"
  1. ;431;"RX",N,"Other Payor Amount"
  1. ;433;"RX",N,"Patient Paid Amount"
  1. ;438;"RX",N,"Incentive Amount"
  1. ;439;"RX",N,"DUR Conflict Code"
  1. ;440;"RX",N,"DUR Intervention Code"
  1. ;441;"RX",N,"DUR Outcome Code"
  1. ;442;"RX",N,"Metric Decimal Quantity"
  1. ;443;"RX",N,"Primary Payor Denial Date"
  1. ;*