Index: FOIAVistA/tag/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBCNSP01.m
===================================================================
--- FOIAVistA/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBCNSP01.m	(revision 631)
+++ FOIAVistA/tag/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBCNSP01.m	(revision 636)
@@ -1,5 +1,5 @@
-IBCNSP01 ;ALB/AAS - INSURANCE MANAGEMENT - EXPANDED POLICY  ;05-MAR-1993
- ;;2.0;INTEGRATED BILLING;**43,52,85,251,371,377**;21-MAR-94;Build 23
- ;;Per VHA Directive 2004-038, this routine should not be modified.
+IBCNSP01 ;ALB/AAS - INSURANCE MANAGEMENT - EXPANDED POLICY  ; 05-MAR-1993
+ ;;2.0;INTEGRATED BILLING;**43,52,85,251**;21-MAR-94
+ ;;Per VHA Directive 10-93-142, this routine should not be modified.
  ;
  ;
@@ -9,12 +9,12 @@
 SUBSC ; -- subscriber region
  N OFFSET,START
- S START=24,OFFSET=2
+ S START=19,OFFSET=2
  D SET^IBCNSP(START,OFFSET," Subscriber Information ",IORVON,IORVOFF)
  S Y=$P(IBCDFND,"^",6),C=$P(^DD(2.312,6,0),"^",2) D Y^DIQ
  D SET^IBCNSP(START+1,OFFSET," Whose Insurance: "_Y)
  D SET^IBCNSP(START+2,OFFSET," Subscriber Name: "_$P(IBCDFND,"^",17))
- S Y=$P(IBCDFND4,"^",3),C=$P(^DD(2.312,4.03,0),"^",2) D Y^DIQ
+ S Y=$P(IBCDFND,"^",16),C=$P(^DD(2.312,16,0),"^",2) D Y^DIQ
  D SET^IBCNSP(START+3,OFFSET,"    Relationship: "_Y)
- D SET^IBCNSP(START+4,OFFSET,"      Primary ID: "_$P(IBCDFND,"^",2))
+ D SET^IBCNSP(START+4,OFFSET,"Insurance Number: "_$P(IBCDFND,"^",2))
  S Y=$P(IBCDFND,"^",20),C=$P(^DD(2.312,.2,0),"^",2) D Y^DIQ
  D SET^IBCNSP(START+5,OFFSET,"Coord.  Benefits: "_Y)
@@ -25,7 +25,8 @@
 VER ; -- Entered/Verfied Region
  N OFFSET,START
- S START=$O(^TMP("IBCNSVP",$J,""),-1)+1,OFFSET=2
- S IB1ST("VERIFY")=START
+ S START=41+$G(IBLCNT),OFFSET=2
+ I '$D(@VALMAR@(START-1)) D SET^IBCNSP(START-1,OFFSET,"  ")
  D SET^IBCNSP(START,OFFSET," User Information ",IORVON,IORVOFF)
+ I IBCDFND1="" D SET^IBCNSP(START+1,OFFSET,"No User Information") G VERQ
  D SET^IBCNSP(START+1,OFFSET,"      Entered By: "_$E($P($G(^VA(200,+$P(IBCDFND1,"^",2),0)),"^",1),1,20))
  D SET^IBCNSP(START+2,OFFSET,"      Entered On: "_$$DAT1^IBOUTL(+IBCDFND1))
@@ -34,61 +35,21 @@
  D SET^IBCNSP(START+5,OFFSET," Last Updated By: "_$E($P($G(^VA(200,+$P(IBCDFND1,"^",6),0)),"^",1),1,20))
  D SET^IBCNSP(START+6,OFFSET," Last Updated On: "_$$DAT1^IBOUTL(+$P(IBCDFND1,"^",5)))
- D SET^IBCNSP(START+7,2," ")   ; 2 blank lines to end section
- D SET^IBCNSP(START+8,2," ")
 VERQ Q
- ;
-ID ; Subscriber and patient primary and secondary ID's and qualifiers
- NEW START,OFFSET,IBL,G,PCE,QUAL,QUAL1
- S G=IBCDFND5
- S (START,IBL)=$O(^TMP("IBCNSVP",$J,""),-1)+1,OFFSET=2
- S IB1ST("ID")=START
- D SET^IBCNSP(START,OFFSET," Insurance Company ID Numbers (use Subscriber Update Action) ",IORVON,IORVOFF)
- S IBL=IBL+1
- D SET^IBCNSP(IBL,OFFSET,"  Subscriber Primary ID: "_$P(IBCDFND,U,2))
- ;
- F PCE=3,5,7 D            ; subscriber secondary IDs
- . I $P(G,U,PCE)="" Q     ; no secondary ID#
- . S QUAL=$P(G,U,PCE-1)   ; internal qualifier code
- . S QUAL1=$S(QUAL="23":"Client#",QUAL="IG":"Ins. Policy#",QUAL="SY":"SSN",1:"Unknown")
- . S IBL=IBL+1
- . D SET^IBCNSP(IBL,OFFSET,"Subscriber Secondary ID: "_$P(G,U,PCE))
- . D SET^IBCNSP(IBL,52,"ID Qual: "_QUAL_" ("_QUAL1_")")
- . Q
- ;
- ; patient=subscriber so skip over patient ID# display
- I +$P(IBCDFND,U,16)=1 G ID1
- ;
- S IBL=IBL+1 D SET^IBCNSP(IBL,2," ")   ; blank line
- S IBL=IBL+1
- D SET^IBCNSP(IBL,OFFSET,"     Patient Primary ID: "_$P(G,U,1))
- ;
- F PCE=9,11,13 D          ; patient secondary IDs
- . I $P(G,U,PCE)="" Q     ; no secondary ID#
- . S QUAL=$P(G,U,PCE-1)   ; internal qualifier code
- . S QUAL1=$S(QUAL="23":"Client#",QUAL="IG":"Ins. Policy#",QUAL="SY":"SSN",1:"Unknown")
- . S IBL=IBL+1
- . D SET^IBCNSP(IBL,OFFSET,"   Patient Secondary ID: "_$P(G,U,PCE))
- . D SET^IBCNSP(IBL,52,"ID Qual: "_QUAL_" ("_QUAL1_")")
- . Q
- ;
-ID1 ; end of section - 2 blank lines
- S IBL=IBL+1 D SET^IBCNSP(IBL,2," ")
- S IBL=IBL+1 D SET^IBCNSP(IBL,2," ")
-IDQ ;
- Q
  ;
 RIDER ; -- Personal policy riders
  N OFFSET,START,IBI,IBL,IBPR,IBPRD
- S START=$O(^TMP("IBCNSVP",$J,""),-1)+1,OFFSET=2,IBL=0
+ S START=53+$G(IBLCNT),OFFSET=2,IBL=0
+ I '$D(@VALMAR@(START-1)) D SET^IBCNSP(START-1,OFFSET,"  ")
  D SET^IBCNSP(START,OFFSET," Personal Riders ",IORVON,IORVOFF)
  S IBI="" F  S IBI=$O(^IBA(355.7,"APP",DFN,IBCDFN,IBI)) Q:'IBI  S IBPR=$O(^(IBI,0)),IBPRD=+$G(^IBA(355.7,IBPR,0)),IBL=IBL+1 D
- . D SET^IBCNSP(START+IBL,OFFSET,"   Rider #"_IBL_": "_$$EXPAND^IBTRE(355.7,.01,IBPRD))
- . Q
- S IBL=IBL+1 D SET^IBCNSP(START+IBL,OFFSET," ")
- S IBL=IBL+1 D SET^IBCNSP(START+IBL,OFFSET," ")
+ .D SET^IBCNSP(START+IBL,OFFSET,"   Rider #"_IBL_": "_$$EXPAND^IBTRE(355.7,.01,IBPRD))
+ S IBLCNT=$G(IBLCNT)+IBL
  Q
  ;
 AI ; -- Add ins. verification entry
  ;    called from ai^ibcnsp1
+ ;N X,Y,I,J,DA,DR,DIC,DIE,DR,DD,DO,VA,VAIN,VAERR,IBQUIT,IBXIFN,IBTRN,DUOUT,IBX,IBQUIT,DTOUT
+ ;Q:'$G(DFN)
+ ;Q:'$G(IBCDFN)  S IBQUIT=0
  ;
  ; -- see if current inpatient
