source: WorldVistAEHR/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBCNRPM2.m@ 823

Last change on this file since 823 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.1 KB
Line 
1IBCNRPM2 ;BHAM ISC/CMW - Match Multiple Group Plans to a Pharmacy Plan ;10-MAR-2004
2 ;;2.0;INTEGRATED BILLING;**251,276**;21-MAR-94
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;; ;
5EN(IBCNRP,IBCNRI,IBCNRGP) ; -- main entry point for IBCNR PAYERSHEET MATCH (LIST TEMPLATE)
6 D EN^VALM("IBCNR GROUP PLAN MATCH")
7 Q
8 ;
9HDR ; -- header code
10 NEW IBCNR0,IBCNRID,IBCNRNM,IBCNR10,IBCNRPBM,IBCNRBIN,IBCNRPCN,IBLEAD
11 NEW IBCNR3,IBCNRIN,NST,LST,X
12 ; get pharmacy plan data
13 S IBCNR0=$G(^IBCNR(366.03,+IBCNRP,0))
14 S IBCNRID=$P(IBCNR0,"^",1) ;id
15 S IBCNRNM=$P(IBCNR0,"^",2) ;name
16 S IBCNR10=$G(^IBCNR(366.03,+IBCNRP,10))
17 S IBCNRPBM=$P(IBCNR10,"^",1) ;pbm
18 S IBCNRBIN=$P(IBCNR10,"^",2) ;bin
19 S IBCNRPCN=$P(IBCNR10,"^",3) ;pcn
20 S IBCNR3=$G(^IBCNR(366.03,+IBCNRP,3,1,0)) ; appl
21 S NST=$S($P(IBCNR3,"^",2)=0:"Inactive ",1:"Active ")
22 S LST=$S($P(IBCNR3,"^",3)=0:"Inactive ",1:"Active ")
23 ; get insurance company name
24 S IBCNRIN=$P($G(^DIC(36,IBCNRI,0)),U)
25 ; row 1
26 S IBLEAD="FOR PHARMACY PLAN: "
27 S X=IBCNRNM_" - "_IBCNRID
28 S VALMHDR(1)=$$SETSTR^VALM1(X,IBLEAD,$L(IBLEAD)+1,80)
29 ; row 2
30 S IBLEAD="BIN: "_IBCNRBIN
31 S X=" PCN: "_IBCNRPCN_" STATUS: National "_NST_"/Local "_LST
32 S VALMHDR(2)=$$SETSTR^VALM1(X,IBLEAD,$L(IBLEAD)+1,80)
33 ; row 3
34 ;S X="STATUS: National "_NST_"/"
35 ;S VALMHDR(3)=$$SETSTR^VALM1("Local "_LST,X,$L(X)+1,80)
36 ; row 4
37 S X="FOR INSURANCE COMPANY: "
38 S VALMHDR(4)=$$SETSTR^VALM1(IBCNRIN,X,$L(X)+1,80)
39 ;
40 Q
41 ;
42INIT ; -- init variables and list array
43 ;
44 I '$D(^TMP("IBCNR",$J,"GP")) D Q
45 . S VALMCNT=0
46 . W !,*7,"Warning: No Active Group Plans with Pharmacy Coverage Found."
47 ;
48 N GPIEN,IBGP0,IBCPOLD,X,IBCPD6,IBCNRPP,IBCOV,IBCRVD,LIM
49 N IBGNA,IBGNM,IBCNA,IBCNM,IBDAT
50 K ^TMP("IBCNR",$J,"PM")
51 S VALMCNT=0,VALMBG=1,(IBCNA,IBCNM)=""
52 S (IBIND,IBMULT,IBW)=1
53 F S IBCNA=$O(^TMP("IBCNR",$J,"GP",IBCNA)) Q:IBCNA="" D
54 . F S IBCNM=$O(^TMP("IBCNR",$J,"GP",IBCNA,IBCNM)) Q:IBCNM="" D
55 .. ;get pharm plan id
56 .. S GPIEN=$O(^TMP("IBCNR",$J,"GP",IBCNA,IBCNM,"")),IBDAT=^TMP("IBCNR",$J,"GP",IBCNA,IBCNM,GPIEN)
57 .. ;set up list
58 .. S VALMCNT=VALMCNT+1
59 .. S X=$$SETFLD^VALM1(VALMCNT,"","NUMBER")
60 .. ;
61 .. ;group name
62 .. S X=$$SETFLD^VALM1(IBCNA,X,"GNAME")
63 .. ;
64 .. ;group number
65 .. S X=$$SETFLD^VALM1(IBCNM,X,"GNUM")
66 .. ;
67 .. ;group plan type
68 .. S X=$$SETFLD^VALM1($$EXPAND^IBTRE(355.3,.09,$P(IBDAT,"^",2)),X,"GTYP")
69 .. ;
70 .. ;pharmacy plan
71 .. S IBCNRPP=$P($G(IBDAT),U)
72 .. I IBCNRPP'="" S IBCNRPP=$$GET1^DIQ(366.03,IBCNRPP_",",.02,"E")
73 .. S X=$$SETFLD^VALM1(IBCNRPP,X,"PHRM")
74 .. ;
75 .. ; set up tmp for SEL
76 .. S ^TMP("IBCNR",$J,"PM",VALMCNT,0)=X
77 .. S ^TMP("IBCNR",$J,"PM","IDX",VALMCNT,VALMCNT)=GPIEN
78 ;
79 Q
80 ;
81HELP ; -- help code
82 S X="?" D DISP^XQORM1 W !!
83 Q
84 ;
85EXIT ; -- exit code
86 K ^TMP("IBCNR",$J,"PM"),VALMBCK,VALMY
87 K IBIND,IBMULT,IBW,IBX
88 D CLEAN^VALM10,CLEAR^VALM1
89 Q
90 ;
91EXPND ; -- expand code
92 Q
93 ;
94SEL ; Select Plan
95 ;
96 D S1
97 ;
98 I 'IBX Q ; no group selected
99 ;
100 N DA,DIC,DIE,DR,D,IBSEL
101 S IBX=0
102 F S IBX=$O(VALMY(IBX)) Q:IBX="" D
103 . S IBSEL=+$G(^TMP("IBCNR",$J,"PM","IDX",IBX,IBX))
104 . S DA=IBSEL,DIC="^IBA(355.3,",DIE=DIC,DR="6.01////^S X="_IBCNRP
105 . D ^DIE
106 D GIPF^IBCNRPM1
107 D INIT
108 ;
109 S IBX=0 F S IBX=$O(VALMY(IBX)) Q:'IBX D
110 . S ^TMP($J,"IBSEL",+$G(^TMP("IBCNR",$J,"PM","IDX",IBX,IBX)))=""
111 ;
112 Q
113 ;
114DEL ; remove a plan from a group
115 D S1
116 ;
117 I 'IBX Q ; no group selected
118 ;
119 NEW DA,DIC,DIE,DR,IBSEL
120 S IBX=0
121 F S IBX=$O(VALMY(IBX)) Q:IBX="" D
122 . S IBSEL=+$G(^TMP("IBCNR",$J,"PM","IDX",IBX,IBX))
123 . S DA=IBSEL,DIC="^IBA(355.3,",DIE=DIC,DR="6.01///@"
124 . D ^DIE
125 D GIPF^IBCNRPM1
126 D INIT
127 ;
128 S IBX=0 F S IBX=$O(VALMY(IBX)) Q:'IBX S ^TMP($J,"IBDEL",+$G(^TMP("IBCNR",$J,"PM","IDX",IBX,IBX)))=""
129 ;
130 Q
131 ;
132S1 N DIR,DIRUT,DUOUT,DTOUT,DIROUT,IBOK,IBQUIT,Y,X
133 D EN^VALM2($G(XQORNOD(0))),FULL^VALM1
134 S IBX=$O(VALMY(0)),VALMBCK="R"
135 ;
136 I 'IBX W !!,"No group selected!" D PAUSE^VALM1 Q
137 I 'IBMULT D G SPQ
138 . D OK^IBCNSM3
139 . I IBQUIT S VALMBCK="Q" Q
140 . I IBOK S IBSEL=+$G(^TMP("IBCNR",$J,"PM","IDX",IBX)),VALMBCK="Q"
141 ;
142 ;S IBSEL=+$G(^TMP("IBCNR",$J,"PM","IDX",IBX))
143 ;Q
144 ;
145SPQ ;
146 S DIR(0)="SB^Y:YES;N:NO",DIR("B")="NO",DIR("A")="OK to Continue? "
147 D ^DIR K DIR
148 I $G(Y)="^" S IBX="" Q
149 I $G(Y(0))="NO" S IBX=""
150 Q
Note: See TracBrowser for help on using the repository browser.