source: WorldVistAEHR/trunk/r/FEE_BASIS-FB/FBAAPPH.m@ 711

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

initial load of WorldVistAEHR

File size: 3.7 KB
Line 
1FBAAPPH ;AISC/GRR-PHARMACY HISTORY LIST FOR PATIENT ;7/17/2003
2 ;;3.5;FEE BASIS;**12,61**;JAN 30, 1995
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 D DT^DICRW S FBAAOUT=0
5RD K FBAANQ W !! S FBAAOUT=0,DIC="^FBAAA(",DIC(0)="AEQM" D ^DIC G Q:X=""!(X="^"),RD:Y<0 S DFN=+Y
6 I '$D(^FBAA(162.1,"AD",DFN)) W !!,*7,"No payments for this patient!" G RD
7 S VAR="DFN",VAL=DFN,PGM="LIST^FBAAPPH" D ZIS^FBAAUTL G:FBPOP Q S:IO=IO(0) FBAANQ=1
8LIST ; list prescriptions for patient (DFN)
9 N FBADJLA,FBADJLR,FBFPPSC,FBFPPSL,FBRRMKL,FBSUSPA,FBX
10 S Q="" S $P(Q,"=",80)="="
11 S FSW=1 U IO I $E(IOST,1,2)="C-" W @IOF
12 S (FBAAOUT,J,K,L)=0
13 I '$O(^FBAA(162.1,"AD",DFN,0)) W !,"Patient has no Pharmacy payment history.",! Q
14 F S J=$O(^FBAA(162.1,"AD",DFN,J)) Q:J'>0!(FBAAOUT) F S K=$O(^FBAA(162.1,"AD",DFN,J,K)) Q:K'>0!(FBAAOUT) F S L=$O(^FBAA(162.1,"AD",DFN,J,K,L)) Q:L'>0!(FBAAOUT) D GOT Q:FBAAOUT
15 I FBAAOUT,$E(IOST,1,2)="C-" W @IOF
16 G:$D(FBAANQ) RD
17Q K DIC,DOB,J,K,L,DFN,FBAANQ,FBRX,FBFD,FBAC,FBAP,A1,A2,FBPV,FBSUSP,FBSTR,FBQTY,FBAAOUT,FSW,FID,CHN,FBBATCH,FBDRUG,FBINVN,FBPD,FBREIM,N,NAME,Q,FBSSN,VAL,VAR,VID,PGM,VNAM,X,Y,I,FBSAR,FBI
18 W:$E(IOST,1,2)'="C-" @IOF D CLOSE^FBAAUTL Q
19 ;
20GOT S FBSSN=$$SSN^FBAAUTL(DFN),N=$G(^DPT(+DFN,0)),NAME=$P(N,"^"),DOB=$P(N,"^",3),DOB=$S(DOB]"":$$FMTE^XLFDT(DOB),1:"")
21 Q:'$D(^FBAA(162.1,K,0))&('$D(^FBAA(162.1,K,"RX",L,0)))
22 S Y(0)=$G(^FBAA(162.1,K,"RX",L,0))
23 S Y(2)=$G(^FBAA(162.1,+K,0))
24 I $D(^FBAA(162.1,K,"RX",L,2)) S Y(1)=^(2)
25 S FBFPPSL=$P($G(^FBAA(162.1,K,"RX",L,3)),U)
26 S FBX=$$ADJLRA^FBRXFA(L_","_K_",")
27 S FBADJLR=$P(FBX,U)
28 S FBADJLA=$P(FBX,U,2)
29 S FBRRMKL=$$RRL^FBRXFR(L_","_K_",")
30 S FBINVN=$P(Y(2),"^"),VID=$P(Y(2),"^",4),CHN=$G(^FBAAV(+VID,0)),VNAM=$P(CHN,"^"),FID=$P(CHN,"^",2),CHN=$P(CHN,"^",10)
31 S FBFPPSC=$P(Y(2),U,13)
32 S FBRX=$P(Y(0),"^",1),FBDRUG=$P(Y(0),"^",2),FBFD=$P(Y(0),"^",3),FBAC=$P(Y(0),"^",4),FBAP=$P(Y(0),"^",16),FBSUSP=$P(Y(0),"^",8),FBPD=$P(Y(0),"^",19),FBBATCH=$P(Y(0),"^",17),FBBATCH=$P($G(^FBAA(161.7,+FBBATCH,0)),"^")
33 S FBSUSPA=$FN($P(Y(0),U,7),"",2)
34 I FBSUSP=4,FBADJLR="" S FBI=0 F S FBI=$O(^FBAA(162.1,K,"RX",L,1,FBI)) Q:'FBI S FBSAR(FBI)=^(FBI,0)
35 I FBSUSP]"" S FBSUSP=$P($G(^FBAA(161.27,+FBSUSP,0)),"^")
36 S FBREIM=$S($P(Y(0),"^",20)="R":"*",1:""),FBSTR=$P(Y(0),"^",12),FBQTY=$P(Y(0),"^",13),A1=FBAC+.00001,A2=FBAP+.00001,A1=$P(A1,".",1)_"."_$E($P(A1,".",2),1,2),A2=$P(A2,".",1)_"."_$E($P(A2,".",2),1,2),FBPV=""
37 I $D(Y(1)) S FBPV=$S($P(Y(1),"^",3)="V":"#",1:"")
38 D FBCKP^FBAACCB1(K,L)
39WRT I FSW S FSW=0 D HED
40 I $E(IOST,1,2)="C-",$Y+7>IOSL S DIR(0)="E" D ^DIR K DIR S:'Y FBAAOUT=1 Q:FBAAOUT W @IOF D HED
41 I $Y+6>IOSL W @IOF D HED
42 W !!,VNAM,?48,FID,?60,CHN
43 W !,FBREIM,FBPV,?3,$E(FBFD,4,5),"/",$E(FBFD,6,7),"/",$E(FBFD,2,3),?64,$S(FBPD="":"",1:$E(FBPD,4,5)_"/"_$E(FBPD,6,7)_"/"_$E(FBPD,2,3))
44 W !," Rx: "_FBRX,?15,FBDRUG,?45,FBSTR,?63,FBQTY
45 W !,?4,$J(A1,6),?13,$J(A2,6)
46 ; write adjustment reasons, if null then write suspend code
47 W ?22,$S(FBADJLR]"":FBADJLR,1:FBSUSP)
48 ; write adjustment amounts, if null then write amount suspended
49 W ?32,$S(FBADJLA]"":FBADJLA,1:FBSUSPA)
50 W ?47,FBINVN,?58,FBBATCH,?67,FBRRMKL
51 I FBFPPSC]"" W !,?5,"FPPS Claim ID: ",FBFPPSC," FPPS Line Item: ",FBFPPSL
52 I $D(FBSAR) W !?5,"Suspension Description: " S FBI=0 F S FBI=$O(FBSAR(FBI)) Q:'FBI W " ",FBSAR(FBI)
53 D PMNT^FBAACCB2
54 K FBSAR Q
55HED W:$E(IOST,1,2)'="C-" !?25,"PHARMACY PAYMENT HISTORY",!?24,$E(Q,1,26)
56 W !,"Patient: ",NAME,?41,"Pt ID: ",FBSSN,?60,"DOB: ",DOB
57 W !,"('*' Reimbursement to Patient '+' Cancellation Activity) '#' Voided Payment)"
58 W !,"Vendor Name",?48,"ID #",?60,"Chain #"
59 W !,?3,"Fill Date",?64,"Date Certified"
60 W !,?15,"Drug Name",?43,"Strength",?61,"Quantity"
61 W !,?3,"Claimed",?15,"Paid",?22,"Adj Code",?32,"Adj Amount",?47,"Invoice #",?58,"Batch #",?67,"Remit Remark"
62 W !,Q
63 Q
Note: See TracBrowser for help on using the repository browser.