source: WorldVistAEHR/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSOCIDC3.m@ 1742

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

initial load of WorldVistAEHR

File size: 6.3 KB
Line 
1PSOCIDC3 ;BIR/LE - continuation of Copay Correction of erroneous billed copays ;11/08/05 1:56pm
2 ;;7.0;OUTPATIENT PHARMACY;**226**;DEC 1997
3 ;
4RPT ;
5 N JOBN,NAMSP,ZTDESC,ZTRTN
6 S NAMSP=$$NAMSP^PSOCIDC1
7 S JOBN="Copay Corrections"
8 L +^XTMP(NAMSP):0 I '$T D Q
9 .W !,JOBN_" job for PSO*7*226 is still running. Halting..."
10 L -^XTMP(NAMSP)
11 W !!,"This report shows the patient name and prescription information for"
12 W !,"copay field corrections and copays billed erroneously that were cancelled"
13 W !,"by the patch PSO*7*226."
14 ;
15 W !!,"You may queue the report to print, if you wish.",!
16 ;
17DVC K %ZIS,POP,IOP S %ZIS="QM" D ^%ZIS I $G(POP) W !!,"Nothing queued to print.",! G DONE
18QUEUE I $D(IO("Q")) S ZTRTN="START^PSOCIDC3",ZTDESC=JOBN_" copay cancellation report" D ^%ZTLOAD K %ZSI W !,"Report queued to print.",! G DONE
19START ;
20 U IO
21 N BLDT,RXO,NAMSP,PSOFILL,PSODFN,PSONAM,PSOOUT,PSODV,RXP,SSN,PSODIV,PSODV
22 N CANCEL,JOBN,PSOPATID,PSOTOT,PSOTOTC
23 S NAMSP=$$NAMSP^PSOCIDC1
24 S JOBN="Copay Corrections"
25 S PSOOUT=0,PSODV=$S($E(IOST)="C":"C",1:"P")
26 S PSOPGCT=0,PSOPGLN=IOSL-7,PSOPGCT=1
27 S BLDT=$P($G(^XTMP(NAMSP,0,"LAST")),"^",2)
28 I '$D(DT) S DT=$$NOW^XLFDT
29 D TITLE
30 S (PSOTOT,PSOTOTC,PSONAM)=""
31 F S PSONAM=$O(^XTMP(NAMSP,"REL",PSONAM)) Q:PSONAM="" D
32 .S PSODFN=""
33 .F S PSODFN=$O(^XTMP(NAMSP,"REL",PSONAM,PSODFN)) Q:PSODFN="" D
34 ..S RXP=""
35 ..F S RXP=$O(^XTMP(NAMSP,"REL",PSONAM,PSODFN,RXP)) Q:RXP="" D
36 ...S PSOFILL=""
37 ...F S PSOFILL=$O(^XTMP(NAMSP,"REL",PSONAM,PSODFN,RXP,PSOFILL)) Q:PSOFILL="" D
38 ....N XX,RXO,Y,PSONAME
39 ....S XX=$G(^XTMP(NAMSP,"REL",PSONAM,PSODFN,RXP,PSOFILL)) D ;NOTE THIS IS THE RELEASE DATE
40 .....D FULL Q:$G(PSOOUT) S PSONAME=$P($G(^DPT(PSODFN,0)),"^")
41 .....S CANCEL="" I $D(^XTMP(NAMSP,"CANCEL",PSODFN,RXP,PSOFILL)) D CHK S:CANCEL PSOTOTC=PSOTOTC+1
42 .....W !,$S(CANCEL:"*",1:"") W:CANCEL $E(PSONAME,1,14) W:'CANCEL ?1,$E(PSONAME,1,14)
43 .....D PRTSSN
44 .....S RXO=$P($G(^PSRX(RXP,0)),"^")
45 .....W ?41," ",RXO," (",PSOFILL,")"
46 .....S Y=XX I Y>0 X ^DD("DD")
47 .....W ?55," ",Y
48 .....W ?69,$S($$PTCOV^IBCNSU3(PSODFN,XX,"PHARMACY"):"YES",1:" NO")
49 .....W ?75,$S($$PTCOV^IBCNSU3(PSODFN,BLDT,"PHARMACY"):"YES",1:" NO")
50 .....S PSOTOT=PSOTOT+1
51 W !!,"Total number of released prescriptions modified: ",PSOTOT
52 W !,"Total number of Cancelled Copay prescriptions: ",PSOTOTC
53 ;
54 ;UNRELEASED CORRECTED RX'S
55 D TITLE2
56 S (PSOTOT,PSONAM)=""
57 F S PSONAM=$O(^XTMP(NAMSP,"IBQ UPD",PSONAM)) Q:PSONAM="" D
58 .S PSODFN=""
59 .F S PSODFN=$O(^XTMP(NAMSP,"IBQ UPD",PSONAM,PSODFN)) Q:PSODFN="" D
60 ..S RXP=""
61 ..F S RXP=$O(^XTMP(NAMSP,"IBQ UPD",PSONAM,PSODFN,RXP)) Q:RXP="" D
62 ...S PSOFILL=""
63 ...F S PSOFILL=$O(^XTMP(NAMSP,"IBQ UPD",PSONAM,PSODFN,RXP,PSOFILL)) Q:PSOFILL="" D
64 ....N XX,RXO,Y,PSONAME
65 ....S XX=$G(^XTMP(NAMSP,"IBQ UPD",PSONAM,PSODFN,RXP,PSOFILL)) D ;NOTE THIS IS THE FILL DATE
66 .....D FULL Q:$G(PSOOUT) S PSONAME=$P($G(^DPT(PSODFN,0)),"^")
67 .....W !,$E(PSONAME,1,14)
68 .....D PRTSSN
69 .....S RXO=$P($G(^PSRX(RXP,0)),"^")
70 .....W ?41," ",RXO," (",PSOFILL,")"
71 .....S Y=XX I Y>0 X ^DD("DD")
72 .....W ?55," ",Y
73 .....W ?69,$S($$PTCOV^IBCNSU3(PSODFN,XX,"PHARMACY"):"YES",1:" NO")
74 .....W ?75,$S($$PTCOV^IBCNSU3(PSODFN,BLDT,"PHARMACY"):"YES",1:" NO")
75 .....S PSOTOT=PSOTOT+1
76 W !!,"Total number of un-released prescriptions modified: ",PSOTOT
77 G END
78 ;
79FULL ;
80 I ($Y+7)>IOSL&('$G(PSOOUT)) D TITLE
81 Q
82 ;
83CHK ;VERIFY COPAY WAS CANCELLED
84 N IBN,PSOREF,PSOIB,XX S PSOREF=PSOFILL
85 I PSOREF=0 S XX=$G(^PSRX(RXP,"IB")),IBN=$P(XX,"^",2)
86 I PSOREF>0 S XX=$G(^PSRX(RXP,1,PSOREF,"IB")),IBN=$P(XX,"^",1)
87 S XX=$$STATUS^IBARX(IBN)
88 S:$G(XX)=2 CANCEL=1
89 Q
90 ;
91TITLE ;
92 I $G(PSODV)="C",$G(PSOPGCT)'=1 W ! K DIR S DIR(0)="E" D ^DIR K DIR I 'Y S PSOOUT=1 Q
93 ;
94 W @IOF D
95 . W !,"Patch PSO*7*226 -Corrected Released Prescriptions "
96 . W !!,"Note that prescriptions where copay was cancelled are denoted with"
97 . W !,"an asterisk (*) in front of the patient name. Otherwise, only the"
98 . W !,"the IBQ node was updated.",!
99 S Y=DT X ^DD("DD") W !,"Date printed: ",Y,?70,"Page: ",PSOPGCT,!
100 F MJT=1:1:79 W "="
101 W !,?69,"INS ON DTE"
102 W !,"PATIENT NAME (SSN) DIV",?42,"RX# (FILL)",?55,"RELEASE DATE",?69,"REL BILL"
103 W !,"--------------- ------- --------------",?42,"------------"
104 W ?55,"------------",?69,"---- -----"
105 S PSOPGCT=PSOPGCT+1
106 Q
107TITLE2 ;
108 I $G(PSODV)="C",$G(PSOPGCT)'=1 W ! K DIR S DIR(0)="E" D ^DIR K DIR I 'Y S PSOOUT=1 Q
109 ;
110 W @IOF D
111 . W !,"Patch PSO*7*226 -Corrected Unreleased Prescriptions "
112 S Y=DT X ^DD("DD") W !,"Date printed: ",Y,?70,"Page: ",PSOPGCT,!
113 F MJT=1:1:79 W "="
114 W !,?69,"INS ON DTE"
115 W !,"PATIENT NAME (SSN) DIV",?43,"RX# (FILL)",?55,"FILL DATE",?69,"REL BILL"
116 W !,"-------------- ------- ----------------",?42,"------------"
117 W ?55,"------------",?69,"---- -----"
118 S PSOPGCT=PSOPGCT+1
119 Q
120END ;
121 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
122 I $G(PSODV)="C" W !
123 E W @IOF
124DONE ;
125 K MJT,PSOPGCT,PSOPGLN,Y,DIR,X,IOP,POP,IO("Q"),DIRUT,DUOUT,DTOUT
126 D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
127 Q
128 ;
129PRTSSN ;
130 S SSN=$P(^DPT(PSODFN,0),"^",9),SSN=$E(SSN,$L(SSN)-3,$L(SSN))
131 S PSOPATID=$E(PSONAM,1)_SSN
132 S PSODIV=$P($G(^PSRX(RXP,2)),"^",9)
133 S:PSODIV'="" PSODIV=$P($G(^PS(59,PSODIV,0)),"^",1)
134 W ?17,"("_PSOPATID_")"_" "_$E(PSODIV,1,15)
135 Q
136 ;
137ETIME(SECTIME) ;convert seconds to day:hr:min:sec
138 N DAY,HR,MIN,SEC,ETIM
139 S (DAY,HR,MIN,SEC)=""
140 I SECTIME>86400 S DAY=SECTIME\86400,SECTIME=SECTIME#86400
141 I SECTIME>3600 S HR=SECTIME\3600,SECTIME=SECTIME#3600
142 I SECTIME>60 S MIN=SECTIME\60,SECTIME=SECTIME#60
143 S SEC=SECTIME
144 S ETIM=""
145 S:$L(HR)=1 HR=0_HR S:$L(MIN)=1 MIN=0_MIN S:$L(SEC)=1 SEC=0_SEC
146 S:DAY ETIM=DAY_" Day " S:HR ETIM=ETIM_HR_":" S:MIN ETIM=ETIM_MIN
147 S ETIM=ETIM_":"_SEC
148 Q ETIM
149 ;
150MAIL3(MSG) ;management mail message
151 S PSOINST=$P($G(^DIC(4,+$P($G(^XMB(1,1,"XUS")),"^",17),99)),"^")
152 D NOW^%DTC S Y=% D DD^%DT S PSOEND=Y
153 K PSOTEXT
154 S XMY(DUZ)=""
155 S XMY("ELLZEY.LINDA@FORUM.VA.GOV")=""
156 S:$$PROD^XUPROD(1) XMY("ELLZEY.LINDA@FORUM.VA.GOV")=""
157 S XMDUZ="PSO*7*226 "_JOBN
158 S XMSUB="STATION "_$G(PSOINST)
159 S XMSUB=XMSUB_$S($$PROD^XUPROD(1):" (Prod)",1:" (Test)")
160 S XMSUB=XMSUB_" CANCELLED COPAYS FOR ERRONEOUSLY BILLED PRESCRIPTION FILLS"
161 S PSOTEXT(1)=""
162 S PSOTEXT(2)="Started "_PSOSTART
163 S PSOTEXT(3)=""
164 S PSOTEXT(4)=" "_MSG
165 S PSOTEXT(5)=""
166 S PSOTEXT(6)="NO FURTHER ACTION REQUIRED."
167 S XMTEXT="PSOTEXT(" N DIFROM D ^XMD K XMDUZ,XMTEXT,XMSUB
168 Q
169 ;
Note: See TracBrowser for help on using the repository browser.