source: WorldVistAEHR/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSOCPIB5.m@ 841

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

initial load of WorldVistAEHR

File size: 3.1 KB
Line 
1PSOCPIB5 ;BIR/EJW-Report of back-billed fills with insurance information ;06/24/03
2 ;;7.0;OUTPATIENT PHARMACY;**142**;DEC 1997
3 ;External reference to $$STATUS^IBARX supported by DBIA 125
4 ;External reference to $$PTCOV^IBCNSU3 supported by DBIA 4115
5RPT ;
6 W !!,"This report shows the patient name, prescription fill, and insurance"
7 W !,"information for fills that were billed as part of patch PSO*7*123 clean-up."
8 W !!,"You may queue the report to print, if you wish.",!
9 ;
10DVC K %ZIS,POP,IOP S %ZIS="QM" D ^%ZIS I $G(POP) W !!,"Nothing queued to print.",! G DONE
11QUEUE I $D(IO("Q")) S ZTRTN="START^PSOCPIB5",ZTDESC="Billed copay insurance report" D ^%ZTLOAD K %ZSI W !,"Report queued to print.",! G DONE
12START ;
13 N PSOFIRST
14 U IO
15 S PSOOUT=0,PSODV=$S($E(IOST)="C":"C",1:"P")
16 S PSOPGCT=0,PSOPGLN=IOSL-7,PSOPGCT=1
17 D TITLE
18 S PSOJ=0
19 S BILLDT=$P($G(^XTMP("PSOCPIB3",0)),"^",2)
20 F S PSOJ=$O(^XTMP("PSOCPIB3",PSOJ)) Q:PSOJ="" S PSONAM="" F S PSONAM=$O(^XTMP("PSOCPIB3",PSOJ,"BILLED",PSONAM)) Q:PSONAM="" S PSODFN="" F S PSODFN=$O(^XTMP("PSOCPIB3",PSOJ,"BILLED",PSONAM,PSODFN)) Q:PSODFN="" D
21 .S PSOFIRST=1
22 .W !
23 .S RXP="" F S RXP=$O(^XTMP("PSOCPIB3",PSOJ,"BILLED",PSONAM,PSODFN,RXP)) Q:RXP="" S PSOFILL="" F S PSOFILL=$O(^XTMP("PSOCPIB3",PSOJ,"BILLED",PSONAM,PSODFN,RXP,PSOFILL)) Q:PSOFILL="" D
24 ..N XX
25 ..S XX=$G(^XTMP("PSOCPIB3",PSOJ,"BILLED",PSONAM,PSODFN,RXP,PSOFILL)) D
26 ...I PSOFIRST D FULL Q:$G(PSOOUT) W !,PSONAM D PRTSSN S PSOFIRST=0
27 ...D FULL Q:$G(PSOOUT) W !,?4,RXP," (",PSOFILL,")" D
28 ....S Y=XX I Y>0 X ^DD("DD")
29 ....W ?25," ",Y
30 ....S PSORXP=$O(^PSRX("B",RXP,"")) I PSORXP="" Q
31 ....S PSOBILL=$S('PSOFILL:$P($G(^PSRX(PSORXP,"IB")),"^",2),1:$P($G(^PSRX(PSORXP,1,PSOFILL,"IB")),"^"))
32 ....I 'PSOBILL W ?43,"** NO BILL NUMBER FOR THIS FILL **" Q
33 ....S PSOIBST=$$STATUS^IBARX(PSOBILL) I PSOIBST=2 W "** COPAY CHARGE CANCELLED **" Q
34 ....W ?46,$S($$PTCOV^IBCNSU3(PSODFN,XX,"PHARMACY"):"YES",1:" NO"),?68,$S($$PTCOV^IBCNSU3(PSODFN,XX,"PHARMACY"):"YES",1:" NO")
35 G END
36 ;
37FULL ;
38 I ($Y+7)>IOSL&('$G(PSOOUT)) D TITLE
39 Q
40 ;
41TITLE ;
42 I $G(PSODV)="C",$G(PSOPGCT)'=1 W ! K DIR S DIR(0)="E" D ^DIR K DIR I 'Y S PSOOUT=1 Q
43 ;
44 W @IOF D
45 . W !,"Patch PSO*7*142 -COPAYS BILLED BY PSO*7*123 WITH RX INSURANCE INFORMATION"
46 S Y=DT X ^DD("DD") W !,"Date printed: ",Y,?70,"Page: ",PSOPGCT,!
47 F MJT=1:1:79 W "="
48 W !,"PATIENT NAME (SSN) DIV",?44,"RX INSURANCE",?66,"RX INSURANCE"
49 W !,?4,"RX# (FILL)",?25,"RELEASE DATE",?43,"ON RELEASE DATE",?65,"ON BILLED DATE"
50 W !,"------------------------",?25,"------------",?43,"---------------",?65,"--------------"
51 S PSOPGCT=PSOPGCT+1
52 Q
53END ;
54 I '$G(PSOOUT),$G(PSODV)="C" W !!,"** End of Report **" K DIR S DIR(0)="E",DIR("A")="Press Return to continue" D ^DIR K DIR
55 I $G(PSODV)="C" W !
56 E W @IOF
57DONE ;
58 K MJT,PSOPGCT,PSOPGLN,Y,DIR,X,IOP,POP,IO("Q"),DIRUT,DUOUT,DTOUT,PSORXP,PSOIBST,PSOFILL,PSOOUT,PSOBILL,PSODIV,PSODFN,BILLDT,PSOJ,PSONAM,RXP,PSODV,VA
59 D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
60 Q
61 ;
62PRTSSN ;
63 N DFN
64 S DFN=PSODFN D PID^VADPT
65 S PSORXP=$O(^PSRX("B",RXP,"")) I PSORXP="" Q
66 S PSODIV=$P($G(^PSRX(PSORXP,2)),"^",9) S:PSODIV'="" PSODIV=$P($G(^PS(59,PSODIV,0)),"^",1)
67 W " ("_$G(VA("BID"))_")"_" "_PSODIV
68 Q
69 ;
Note: See TracBrowser for help on using the repository browser.