source: FOIAVistA/trunk/r/FEE_BASIS-FB/FBPAY3.m@ 1288

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

initial load of FOIAVistA 6/30/08 version

File size: 6.2 KB
Line 
1FBPAY3 ;AISC/GRR,TET-PHARMACY PAYMENT HISTORY, SORT/PRINT ;21/NOV/2006
2 ;;3.5;FEE BASIS;**12,32,69,101**;JAN 30, 1995;Build 2
3 ;;Per VHA Directive 2004-038, this routine should not be modified.
4EN ;entry point
5 I FBSORT S FBPNAME=FBNAME,FBPID=FBID,(DFN,J)=FBIEN,FBDOB=$$FMTE^XLFDT($P($G(^DPT(DFN,0)),U,3)) D SORT
6 I 'FBSORT S FBVNAME=$E(FBNAME,1,23),FBVID=FBID,FBVI=FBIEN,FBVCHAIN=$P($G(^FBAAV(FBVI,0)),U,10),FBDA1=0 D
7 .F S FBDA1=$O(^FBAA(162.1,"AN",FBVI,FBDA1)) Q:'FBDA1 S J=0 F S J=$O(^FBAA(162.1,FBDA1,"RX","C",J)) Q:'J S DFN=J D VET,SORT
8FBAAC ;check if anything in an xref, fbaac global (file 162)
9 I '$D(^TMP($J,"FB",FBPI)),$D(^FBAAC("AN",FBPI)) D:'FBSORT AN^FBPAY67
10KILL ;kill variables set in sort
11 K A1,A2,FBAC,FBAP,FBBATCH,FBDA1,FBDRUG,FBFD,FBFD1,FBINVN,FBLOC,FBPAT,FBPD,FBPV,FBQTY,FBREIM,FBRX,FBSTR,FBSUSP,FBVEN,FBVI,I,J,K,L,N,V,Y
12 K FBADJLA,FBADJLR,FBFPPSC,FBFPPSL,TAMT,FBRRMKL
13 K:FBSORT FBVNAME,FBVID,FBVCHAIN K:'FBSORT FBPNAME,FBPID,FBDOB
14 D KILL^FBPAY2
15 Q
16SORT ;
17 S I=FBBEG F S I=$O(^FBAA(162.1,"AD",J,I)) Q:I'>0!(I>FBEND) S K=0 F S K=$O(^FBAA(162.1,"AD",J,I,K)) Q:K'>0 S L=0 F S L=$O(^FBAA(162.1,"AD",J,I,K,L)) Q:L'>0 D SET
18 Q
19 ;
20SET ;
21 N FBX
22 S Y(0)=$G(^FBAA(162.1,+K,"RX",+L,0)) I Y(0)']""!($P(Y(0),U,9)=1) Q
23 I $G(^FBAA(162.1,+K,"RX",+L,"FBREJ"))]"" Q ;Eliminates Rejected Payments
24 I 'FBSORT Q:FBVI'=$P($G(^FBAA(162.1,+K,0)),"^",4)
25 S Y(2)=$G(^FBAA(162.1,+K,0))
26 S Y(1)=$G(^FBAA(162.1,+K,"RX",+L,2))
27 S FBFPPSC=$P($G(^FBAA(162.1,+K,0)),U,13) ;FPPS claim ID
28 S FBFPPSL=$P($G(^FBAA(162.1,+K,"RX",+L,3)),U) ;FPPS line item
29 S FBX=$$ADJLRA^FBRXFA(+L_","_+K_",")
30 S FBADJLR=$P(FBX,U) ;adjustment code
31 S FBADJLA=$P(FBX,U,2) ;adjustment amount
32 S TAMT=$FN($P(Y(0),"^",7),"",2) ;suspend amount
33 S FBRRMKL=$$RRL^FBRXFR(+L_","_+K_",") ;remitt remarks
34 ; if user wants just mill bill or just non-mill bill then check payment
35 ; and skip if associated with an mill bill claim
36 I "^M^N^"[(U_$G(FB1725R)_U) S FB1725=$S($P(Y(1),U,6)["FB583":+$P($G(^FB583(+$P(Y(1),U,6),0)),U,28),1:0) I $S(FB1725R="M"&'FB1725:1,FB1725R="N"&FB1725:1,1:0) Q
37 S FBINVN=$P(Y(2),U) D VEN:FBSORT,VET:'FBSORT
38 S FBRX=$P(Y(0),U,1),FBDRUG=$P(Y(0),U,2),FBFD=$P(Y(0),U,3),FBAC=$P(Y(0),U,4),FBAP=$P(Y(0),U,16),FBSUSP=$P(Y(0),U,8),FBPD=$P(Y(0),U,19),FBBATCH=$P(Y(0),U,17),FBBATCH=$P($G(^FBAA(161.7,+FBBATCH,0)),U)
39 I FBSUSP]"" S FBSUSP=$P($G(^FBAA(161.27,+FBSUSP,0)),U)
40 S FBREIM=$S($P(Y(0),U,20)="R":"*",1:""),FBSTR=$P(Y(0),U,12),FBQTY=$P(Y(0),U,13),A1=$J(FBAC,6,2),A2=$J(FBAP,6,2),FBPV=""
41 S FBPD=$$DATX^FBAAUTL(FBPD),FBFD=$$DATX^FBAAUTL(FBFD)
42 S FBPV=$S($P(Y(1),U,3)="V":"#",1:""),FBFD1=$S(FBPV="":" ",1:FBPV)_$S(FBREIM="":" ",1:FBREIM)_FBFD,FBRX="Rx: "_FBRX
43 S FBVEN=FBVNAME_";"_FBVID,FBPAT=FBPNAME_";"_DFN
44 D FBCKP^FBAACCB1(K,L)
45 S ^TMP($J,"FB",FBPI,FBVEN,FBPAT,I,L)=FBFD1_U_FBRX_U_FBDRUG_U_FBSTR_U_FBQTY_U_A1_U_A2_U_FBSUSP_U_FBINVN_U_FBBATCH_U_FBPD_U_FBDOB_U_FBVCHAIN_U_TAMT
46 S ^TMP($J,"FB",FBPI,FBVEN,FBPAT,I,L,"FBADJ")=FBADJLR_U_FBADJLA_U_FBRRMKL_U_FBFPPSC_U_FBFPPSL
47 S ^TMP($J,"FB",FBPI,FBVEN,FBPAT,I,L,"FBCK")="^"_FBCK_"^"_FBCKDT_"^"_FBCANDT_"^"_FBCANR_"^"_FBCAN_"^"_FBDIS_"^"_FBCKINT D PMTCLN^FBAACCB2
48 S ^TMP($J,"FB",FBPI,FBVEN)=FBVCHAIN,^TMP($J,"FB",FBPI,FBVEN,FBPAT)=FBDOB
49 I FBSORT S FBIN(5)=$P(Y(1),U,6) I FBIN(5)]"",$D(^TMP($J,"FB",FBPI,FBVEN,FBPAT,I,L)) D ANC^FBPAY67(I,L)
50 I 'FBSORT D OTH^FBPAY67
51 Q
52VET ;set variables for veteran - 'FBSORT
53 S FBPID=$$SSN^FBAAUTL(DFN),N=$G(^DPT(+DFN,0)),FBPNAME=$P(N,U),FBDOB=$$FMTE^XLFDT($P(N,U,3))
54 Q
55VEN ;set variables for vendor - FBSORT
56 S V=$G(^FBAAV(+$P(Y(2),U,4),0)),FBVNAME=$E($P(V,U),1,23),FBVID=$P(V,U,2),FBVCHAIN=$P(V,U,10)
57 Q
58PRINT ;write output
59 S FBOUT=0 D:FBCRT&(FBPG) CR Q:FBOUT
60 D HDR
61 S FBVI="" F S FBVI=$O(^TMP($J,"FB",FBPI,FBVI)) Q:FBVI']""!(FBOUT) D:FBSORT SH Q:FBOUT S FBPT="" D Q:FBOUT
62 .F S FBPT=$O(^TMP($J,"FB",FBPI,FBVI,FBPT)) Q:FBPT']""!(FBOUT) D:'FBSORT SH Q:FBOUT S FBDT=0 F S FBDT=$O(^TMP($J,"FB",FBPI,FBVI,FBPT,FBDT)) Q:'FBDT!(FBOUT) S L=0 F S L=$O(^TMP($J,"FB",FBPI,FBVI,FBPT,FBDT,L)) Q:'L!(FBOUT) D Q:FBOUT
63 ..I ($Y+8)>IOSL D PAGE Q:FBOUT
64 ..S FBDATA=^TMP($J,"FB",FBPI,FBVI,FBPT,FBDT,L),FBCKIN=$G(^TMP($J,"FB",FBPI,FBVI,FBPT,FBDT,L,"FBCK")) D EFBCK^FBPAY21(FBCKIN)
65 ..S FBADJ=^TMP($J,"FB",FBPI,FBVI,FBPT,FBDT,L,"FBADJ")
66 ..; S FBLOC="0^2^15^45^63^4^12^20^24^35^53"
67 ..W !,$P(FBDATA,U),?64,$P(FBDATA,U,11),!
68 ..W ?2,$P(FBDATA,U,2),?15,$P(FBDATA,U,3),?45,$P(FBDATA,U,4),?63,$P(FBDATA,U,5)
69 ..;F I=2:1:$L(FBLOC,"^") W ?$P(FBLOC,U,I),$P(FBDATA,U,I) W:$P(FBLOC,U,I)=63 !
70 ..W !?4,$P(FBDATA,U,6),?12,$P(FBDATA,U,7)
71 ..W ?20 I $P(FBADJ,U,1)]"" W $P(FBADJ,U,1),?30,$J($P(FBADJ,U,2),14)
72 ..I $P(FBADJ,U,1)="" W $P(FBDATA,U,8),?30,$J($P(FBDATA,U,14),14)
73 ..W ?47,$P(FBDATA,U,9),?58,$P(FBDATA,U,10),?66,$P(FBADJ,U,3)
74 ..I $P(FBADJ,U,4)]"" W !?5,"FPPS Claim ID: ",$P(FBADJ,U,4)," FPPS Line Item: ",$P(FBADJ,U,5)
75 ..S A2=$$EXTRL^FBMRASVR($P(FBDATA,"^",7)) D PMNT^FBAACCB2 K A2
76 ..I +$O(^TMP($J,"FB",FBPI,FBVI,FBPT,FBDT,L,"A",0)) D PANC^FBPAY671(L) Q:FBOUT W !,FBDASH1
77 ..W !
78EXIT ;kill and quit
79 Q
80HDR ;main header
81 I FBPG>0!FBCRT W @IOF
82 S FBPG=FBPG+1
83 W !?25,$S($G(FBSORT):"VETERAN",1:"VENDOR")," PAYMENT HISTORY"
84 I $G(FB1725R)]"",FB1725R'="A" W " ",$S(FB1725R="M":"for 38 U.S.C. 1725 Claims",1:"excluding 38 U.S.C. 1725 Claims")
85 W !?24,$E(FBDASH,1,24),?71,"Page: ",FBPG,!
86 W:FBSORT "Patient: ",FBPNAME,?41,"Pat. ID: ",FBPID,?62,"DOB: ",FBDOB W:'FBSORT "Vendor: ",FBVNAME,?41,"Vendor ID: ",FBVID,?65,"Chain #: ",FBVCHAIN
87 W !?(IOM-(13+$L(FBPROG(+FBPI)))/2),"FEE PROGRAM: ",FBPROG(+FBPI)
88 ;W ?71,"Page: ",FBPG
89 W !?3,"('*' Reimb. to Patient '+' Cancel. Activity '#' Voided Payment)"
90 W !?4,"Fill Date",?64,"Date Certified"
91 W !,?15,"Drug Name",?44,"Strength",?60,"Quantity"
92 W !?2,"Claimed",?12,"Paid",?20,"Adj Code",?33,"Adj Amounts",?47,"Invoice #",?58,"Batch #",?66,"Remit Remarks",!,FBDASH
93 Q
94SH ;subheader - vendor if fbsort; patient if 'fbsort, prints when name changes
95 I ($Y+10)>IOSL D:FBCRT CR Q:FBOUT D HDR
96 I FBSORT W !!,"Vendor:",$P(FBVI,";"),?41,"Vendor ID: ",$P(FBVI,";",2),?65,"Chain #: ",$P($G(^TMP($J,"FB",FBPI,FBVI)),U)
97 I 'FBSORT W !!,"Patient: ",$P(FBPT,";"),?41,"Pat. ID: ",$$SSNL4^FBAAUTL($$SSN^FBAAUTL($P(FBPT,";",2))),?62,"DOB: ",$P($G(^TMP($J,"FB",FBPI,FBVI,FBPT)),U)
98 Q
99CR ;read for display
100 S DIR(0)="E" W ! D ^DIR K DIR S:$D(DUOUT)!($D(DTOUT)) FBOUT=1
101 Q
102PAGE ;new page
103 I FBCRT D CR Q:FBOUT
104 D HDR,SH
105 Q
Note: See TracBrowser for help on using the repository browser.