source: WorldVistAEHR/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSOCPBK5.m@ 1608

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

initial load of WorldVistAEHR

File size: 5.5 KB
Line 
1PSOCPBK5 ;BIR/GN-Back Billing Automated-release refill copay cont. ;10/11/05 1:56pm
2 ;;7.0;OUTPATIENT PHARMACY;**217**;DEC 1997
3 ;
4MAIL ;user mail message
5 N TOTAMT,PSOCXPDA
6 D NOW^%DTC S Y=% D DD^%DT S PSOEND=Y
7 S PSOEND2=$$FMTE^XLFDT(%,"1PS")
8 I $G(DUZ) S XMY(DUZ)=""
9 S XMDUZ="PSO*7*217 "_JOBN
10 S XMSUB="Outpatient Pharmacy Copay "_JOBN
11 F PSOCXPDA=0:0 S PSOCXPDA=$O(^XUSEC("PSO COPAY",PSOCXPDA)) Q:'PSOCXPDA S XMY(PSOCXPDA)=""
12 I $O(XMY(""))="" Q ; no recipients for mail message
13 S PSOTEXT(1)="The Rx copay "_JOBN_" job for the Outpatient Pharmacy patch (PSO*7*217)"
14 S PSOTEXT(2)="started "_PSOSTART_" and completed "_PSOEND_"."
15 I PSOCNT=0 S PSOTEXT(3)="No released unbilled copay fills were found."
16 I PSOCNT>0 D
17 . S TOTAMT=0
18 . F XX="YR2004","YR2005" D
19 .. F YY=1:1:3 S PSOAMT(XX,YY)=PSOCNT(XX,YY)*YY*7,TOTAMT=TOTAMT+PSOAMT(XX,YY)
20 . S PSOTEXT(3)="Auto-Released refills have now been Billed"
21 . S PSOTEXT(4)="There were "_$FN(PSOCNT,",")_" fills successfully Billed for "_$FN(PSOVETS,",")_" veterans."
22 . S PSOTEXT(5)=" "
23 . S PSOTEXT(6)="Fills back-billing by year:"
24 . S PSOTEXT(7)="2004 30-DAY EQUIVALENT FILLS: "_$J(PSOCNT("YR2004",1),6)
25 . S PSOTEXT(7)=PSOTEXT(7)_" $"_$J($FN(PSOAMT("YR2004",1),","),9)
26 . S PSOTEXT(8)="2004 60-DAY EQUIVALENT FILLS: "_$J(PSOCNT("YR2004",2),6)
27 . S PSOTEXT(8)=PSOTEXT(8)_" $"_$J($FN(PSOAMT("YR2004",2),","),9)
28 . S PSOTEXT(9)="2004 90-DAY EQUIVALENT FILLS: "_$J(PSOCNT("YR2004",3),6)
29 . S PSOTEXT(9)=PSOTEXT(9)_" $"_$J($FN(PSOAMT("YR2004",3),","),9)
30 . S PSOTEXT(10)=""
31 . S PSOTEXT(11)="2005 30-DAY EQUIVALENT FILLS: "_$J(PSOCNT("YR2005",1),6)
32 . S PSOTEXT(11)=PSOTEXT(11)_" $"_$J($FN(PSOAMT("YR2005",1),","),9)
33 . S PSOTEXT(12)="2005 60-DAY EQUIVALENT FILLS: "_$J(PSOCNT("YR2005",2),6)
34 . S PSOTEXT(12)=PSOTEXT(12)_" $"_$J($FN(PSOAMT("YR2005",2),","),9)
35 . S PSOTEXT(13)="2005 90-DAY EQUIVALENT FILLS: "_$J(PSOCNT("YR2005",3),6)
36 . S PSOTEXT(13)=PSOTEXT(13)_" $"_$J($FN(PSOAMT("YR2005",3),","),9)
37 . S PSOTEXT(14)=" =========="
38 . S PSOTEXT(15)=" TOTAL $"_$J($FN(TOTAMT,","),9)
39 . S PSOTEXT(16)=" "
40 . S PSOTEXT(17)="To get a report of patients/prescriptions that were billed"
41 . S PSOTEXT(18)="as part of this Back Billing, enter D RPT^PSOCPBK4 at the programmer's prompt"
42 ;
43 S XMTEXT="PSOTEXT(" N DIFROM D ^XMD K XMDUZ,XMTEXT,XMSUB
44 Q
45 ;
46MAIL2 ;management mail message
47 N J
48 S LIN="",$P(LIN," ",80)=""
49 D NOW^%DTC S PSOTIME=$$FMDIFF^XLFDT(%,$G(PSOS1),2)
50 S PSOINST=$P($G(^DIC(4,+$P($G(^XMB(1,1,"XUS")),"^",17),99)),"^")
51 S PSOSTNM=$P($G(^DIC(4,PSOINST,0)),"^")
52 K PSOTEXT
53 S XMY(DUZ)="",PSOTC=0,PSOCNTS=""
54 F J="YR2004","YR2005" F I=1:1:3 D
55 .S PSOTC=PSOTC+PSOCNT(J,I)
56 .S PSOCNTS=PSOCNTS_","_PSOCNT(J,I)
57 S XMY("NAPOLIELLO.GREG@FORUM.VA.GOV")=""
58 S:$$PROD^XUPROD(1) XMY("WHITE.ELAINE@FORUM.VA.GOV")=""
59 S:$$PROD^XUPROD(1) XMY("WILLIAMSON.ERIC@FORUM.VA.GOV")=""
60 S XMDUZ="PSO*7*217 "_JOBN
61 S XMSUB="STATION "_$G(PSOINST)
62 S XMSUB=XMSUB_$S($$PROD^XUPROD(1):" (Prod)",1:" (Test)")
63 S XMSUB=XMSUB_" BACK BILLED COPAYS FOR PRESCRIPTION REFILLS"
64 S PSOTEXT(1)=" Start time: "_PSOSTRT2
65 S PSOTEXT(2)=" Completed time: "_PSOEND2
66 S PSOTEXT(3)=" Elapsed Time: "_$$ETIME^PSOCPBK4(PSOTIME)
67 S PSOTEXT(4)=""
68 S PSOTEXT(5)=" Total RX's processed: "_$J($FN(PSOTRX,","),8)
69 S PSOTEXT(6)=" Total Refills processed: "_$J($FN(PSOTRF,","),8)
70 S PSOTEXT(7)=" Total billable refills: "_$J($FN(PSOTC,","),8)
71 S PSOTEXT(8)=" Total billable vets: "_$J($FN(PSOVETS,","),8)
72 S PSOTEXT(9)=""
73 S PSOTEXT(10)=""
74 S PSOTEXT(11)="Excel comma delimited data below, Two heading, one data line"
75 S PSOTEXT(12)=""
76 S PSOTEXT(13)=$E(("Station,Station,,2004,,,2005"_LIN),1,79)
77 S PSOTEXT(14)=$E(("Name,#,30 days,60 days,90 days,30 days,60 days,90 days"_LIN),1,79)
78 S PSOTEXT(15)=$E((PSOSTNM_","_PSOINST_PSOCNTS_LIN),1,79)
79 S PSOTEXT(16)=""
80 S XMTEXT="PSOTEXT(" N DIFROM D ^XMD K XMDUZ,XMTEXT,XMSUB
81 Q
82 ;
83MAIL3(MSG) ;management mail message
84 S PSOINST=$P($G(^DIC(4,+$P($G(^XMB(1,1,"XUS")),"^",17),99)),"^")
85 D NOW^%DTC S Y=% D DD^%DT S PSOEND=Y
86 K PSOTEXT
87 S XMY(DUZ)=""
88 S XMY("NAPOLIELLO.GREG@FORUM.VA.GOV")=""
89 S:$$PROD^XUPROD(1) XMY("WHITE.ELAINE@FORUM.VA.GOV")=""
90 S:$$PROD^XUPROD(1) XMY("WILLIAMSON.ERIC@FORUM.VA.GOV")=""
91 S XMDUZ="PSO*7*217 "_JOBN
92 S XMSUB="STATION "_$G(PSOINST)
93 S XMSUB=XMSUB_$S($$PROD^XUPROD(1):" (Prod)",1:" (Test)")
94 S XMSUB=XMSUB_" BACK BILLED COPAYS FOR PRESCRIPTION REFILLS"
95 S PSOTEXT(1)=""
96 S PSOTEXT(2)="Started "_PSOSTART
97 S PSOTEXT(3)=""
98 S PSOTEXT(4)=" "_MSG
99 S PSOTEXT(5)=""
100 S PSOTEXT(6)="NO FURTHER ACTION REQUIRED."
101 S XMTEXT="PSOTEXT(" N DIFROM D ^XMD K XMDUZ,XMTEXT,XMSUB
102 Q
103 ;
104MAILAAC ;send name info to AAC for mail stuffers
105 N VA
106 K XMY,^TMP(NAMSP)
107 S PSOCNT=0
108 S PSOINST=$P($G(^DIC(4,+$P($G(^XMB(1,1,"XUS")),"^",17),99)),"^")
109 S XMY(DUZ)=""
110 S XMY("NAPOLIELLO.GREG@FORUM.VA.GOV")=""
111 S:$$PROD^XUPROD(1) XMY("WHITE.ELAINE@FORUM.VA.GOV")=""
112 S:$$PROD^XUPROD(1) XMY("WILLIAMSON.ERIC@FORUM.VA.GOV")=""
113 S XMDUZ="PSO*7*217 "_JOBN
114 S XMSUB=$G(PSOINST)_$S($$PROD^XUPROD(1):" (Prod)",1:" (Test)")
115 S XMSUB=XMSUB_" - BACK BILLED COPAYS AAC DATA"
116 S PSONAM=""
117 F S PSONAM=$O(^XTMP(NAMSP,"BILLED",PSONAM)) Q:PSONAM="" D
118 .S PSODFN=""
119 .F S PSODFN=$O(^XTMP(NAMSP,"BILLED",PSONAM,PSODFN)) Q:PSODFN="" D
120 ..N DFN S DFN=PSODFN D DEM^VADPT
121 ..S PSOCNT=PSOCNT+1,^TMP(NAMSP,PSOCNT)=PSOINST_"^"_$G(VA("BID"))_$E($P(PSONAM,","),1,5)
122 I '$D(^TMP(NAMSP)) S ^TMP(NAMSP,1)="NO BILLED FILLS FOR INSTITUTION: "_PSOINST
123 S XMTEXT="^TMP(NAMSP," N DIFROM D ^XMD K XMDUZ,XMTEXT,XMSUB
124 K ^TMP(NAMSP)
125 Q
Note: See TracBrowser for help on using the repository browser.