PSOCPBK5 ;BIR/GN-Back Billing Automated-release refill copay cont. ;10/11/05 1:56pm
;;7.0;OUTPATIENT PHARMACY;**217**;DEC 1997
;
MAIL ;user mail message
N TOTAMT,PSOCXPDA
D NOW^%DTC S Y=% D DD^%DT S PSOEND=Y
S PSOEND2=$$FMTE^XLFDT(%,"1PS")
I $G(DUZ) S XMY(DUZ)=""
S XMDUZ="PSO*7*217 "_JOBN
S XMSUB="Outpatient Pharmacy Copay "_JOBN
F PSOCXPDA=0:0 S PSOCXPDA=$O(^XUSEC("PSO COPAY",PSOCXPDA)) Q:'PSOCXPDA S XMY(PSOCXPDA)=""
I $O(XMY(""))="" Q ; no recipients for mail message
S PSOTEXT(1)="The Rx copay "_JOBN_" job for the Outpatient Pharmacy patch (PSO*7*217)"
S PSOTEXT(2)="started "_PSOSTART_" and completed "_PSOEND_"."
I PSOCNT=0 S PSOTEXT(3)="No released unbilled copay fills were found."
I PSOCNT>0 D
. S TOTAMT=0
. F XX="YR2004","YR2005" D
.. F YY=1:1:3 S PSOAMT(XX,YY)=PSOCNT(XX,YY)*YY*7,TOTAMT=TOTAMT+PSOAMT(XX,YY)
. S PSOTEXT(3)="Auto-Released refills have now been Billed"
. S PSOTEXT(4)="There were "_$FN(PSOCNT,",")_" fills successfully Billed for "_$FN(PSOVETS,",")_" veterans."
. S PSOTEXT(5)=" "
. S PSOTEXT(6)="Fills back-billing by year:"
. S PSOTEXT(7)="2004 30-DAY EQUIVALENT FILLS: "_$J(PSOCNT("YR2004",1),6)
. S PSOTEXT(7)=PSOTEXT(7)_" $"_$J($FN(PSOAMT("YR2004",1),","),9)
. S PSOTEXT(8)="2004 60-DAY EQUIVALENT FILLS: "_$J(PSOCNT("YR2004",2),6)
. S PSOTEXT(8)=PSOTEXT(8)_" $"_$J($FN(PSOAMT("YR2004",2),","),9)
. S PSOTEXT(9)="2004 90-DAY EQUIVALENT FILLS: "_$J(PSOCNT("YR2004",3),6)
. S PSOTEXT(9)=PSOTEXT(9)_" $"_$J($FN(PSOAMT("YR2004",3),","),9)
. S PSOTEXT(10)=""
. S PSOTEXT(11)="2005 30-DAY EQUIVALENT FILLS: "_$J(PSOCNT("YR2005",1),6)
. S PSOTEXT(11)=PSOTEXT(11)_" $"_$J($FN(PSOAMT("YR2005",1),","),9)
. S PSOTEXT(12)="2005 60-DAY EQUIVALENT FILLS: "_$J(PSOCNT("YR2005",2),6)
. S PSOTEXT(12)=PSOTEXT(12)_" $"_$J($FN(PSOAMT("YR2005",2),","),9)
. S PSOTEXT(13)="2005 90-DAY EQUIVALENT FILLS: "_$J(PSOCNT("YR2005",3),6)
. S PSOTEXT(13)=PSOTEXT(13)_" $"_$J($FN(PSOAMT("YR2005",3),","),9)
. S PSOTEXT(14)=" =========="
. S PSOTEXT(15)=" TOTAL $"_$J($FN(TOTAMT,","),9)
. S PSOTEXT(16)=" "
. S PSOTEXT(17)="To get a report of patients/prescriptions that were billed"
. S PSOTEXT(18)="as part of this Back Billing, enter D RPT^PSOCPBK4 at the programmer's prompt"
;
S XMTEXT="PSOTEXT(" N DIFROM D ^XMD K XMDUZ,XMTEXT,XMSUB
Q
;
MAIL2 ;management mail message
N J
S LIN="",$P(LIN," ",80)=""
D NOW^%DTC S PSOTIME=$$FMDIFF^XLFDT(%,$G(PSOS1),2)
S PSOINST=$P($G(^DIC(4,+$P($G(^XMB(1,1,"XUS")),"^",17),99)),"^")
S PSOSTNM=$P($G(^DIC(4,PSOINST,0)),"^")
K PSOTEXT
S XMY(DUZ)="",PSOTC=0,PSOCNTS=""
F J="YR2004","YR2005" F I=1:1:3 D
.S PSOTC=PSOTC+PSOCNT(J,I)
.S PSOCNTS=PSOCNTS_","_PSOCNT(J,I)
S XMY("NAPOLIELLO.GREG@DOMAIN.EXT")=""
S:$$PROD^XUPROD(1) XMY("WHITE.ELAINE@DOMAIN.EXT")=""
S:$$PROD^XUPROD(1) XMY("WILLIAMSON.ERIC@DOMAIN.EXT")=""
S XMDUZ="PSO*7*217 "_JOBN
S XMSUB="STATION "_$G(PSOINST)
S XMSUB=XMSUB_$S($$PROD^XUPROD(1):" (Prod)",1:" (Test)")
S XMSUB=XMSUB_" BACK BILLED COPAYS FOR PRESCRIPTION REFILLS"
S PSOTEXT(1)=" Start time: "_PSOSTRT2
S PSOTEXT(2)=" Completed time: "_PSOEND2
S PSOTEXT(3)=" Elapsed Time: "_$$ETIME^PSOCPBK4(PSOTIME)
S PSOTEXT(4)=""
S PSOTEXT(5)=" Total RX's processed: "_$J($FN(PSOTRX,","),8)
S PSOTEXT(6)=" Total Refills processed: "_$J($FN(PSOTRF,","),8)
S PSOTEXT(7)=" Total billable refills: "_$J($FN(PSOTC,","),8)
S PSOTEXT(8)=" Total billable vets: "_$J($FN(PSOVETS,","),8)
S PSOTEXT(9)=""
S PSOTEXT(10)=""
S PSOTEXT(11)="Excel comma delimited data below, Two heading, one data line"
S PSOTEXT(12)=""
S PSOTEXT(13)=$E(("Station,Station,,2004,,,2005"_LIN),1,79)
S PSOTEXT(14)=$E(("Name,#,30 days,60 days,90 days,30 days,60 days,90 days"_LIN),1,79)
S PSOTEXT(15)=$E((PSOSTNM_","_PSOINST_PSOCNTS_LIN),1,79)
S PSOTEXT(16)=""
S XMTEXT="PSOTEXT(" N DIFROM D ^XMD K XMDUZ,XMTEXT,XMSUB
Q
;
MAIL3(MSG) ;management mail message
S PSOINST=$P($G(^DIC(4,+$P($G(^XMB(1,1,"XUS")),"^",17),99)),"^")
D NOW^%DTC S Y=% D DD^%DT S PSOEND=Y
K PSOTEXT
S XMY(DUZ)=""
S XMY("NAPOLIELLO.GREG@DOMAIN.EXT")=""
S:$$PROD^XUPROD(1) XMY("WHITE.ELAINE@DOMAIN.EXT")=""
S:$$PROD^XUPROD(1) XMY("WILLIAMSON.ERIC@DOMAIN.EXT")=""
S XMDUZ="PSO*7*217 "_JOBN
S XMSUB="STATION "_$G(PSOINST)
S XMSUB=XMSUB_$S($$PROD^XUPROD(1):" (Prod)",1:" (Test)")
S XMSUB=XMSUB_" BACK BILLED COPAYS FOR PRESCRIPTION REFILLS"
S PSOTEXT(1)=""
S PSOTEXT(2)="Started "_PSOSTART
S PSOTEXT(3)=""
S PSOTEXT(4)=" "_MSG
S PSOTEXT(5)=""
S PSOTEXT(6)="NO FURTHER ACTION REQUIRED."
S XMTEXT="PSOTEXT(" N DIFROM D ^XMD K XMDUZ,XMTEXT,XMSUB
Q
;
MAILAAC ;send name info to AAC for mail stuffers
N VA
K XMY,^TMP(NAMSP)
S PSOCNT=0
S PSOINST=$P($G(^DIC(4,+$P($G(^XMB(1,1,"XUS")),"^",17),99)),"^")
S XMY(DUZ)=""
S XMY("NAPOLIELLO.GREG@DOMAIN.EXT")=""
S:$$PROD^XUPROD(1) XMY("WHITE.ELAINE@DOMAIN.EXT")=""
S:$$PROD^XUPROD(1) XMY("WILLIAMSON.ERIC@DOMAIN.EXT")=""
S XMDUZ="PSO*7*217 "_JOBN
S XMSUB=$G(PSOINST)_$S($$PROD^XUPROD(1):" (Prod)",1:" (Test)")
S XMSUB=XMSUB_" - BACK BILLED COPAYS AAC DATA"
S PSONAM=""
F S PSONAM=$O(^XTMP(NAMSP,"BILLED",PSONAM)) Q:PSONAM="" D
.S PSODFN=""
.F S PSODFN=$O(^XTMP(NAMSP,"BILLED",PSONAM,PSODFN)) Q:PSODFN="" D
..N DFN S DFN=PSODFN D DEM^VADPT
..S PSOCNT=PSOCNT+1,^TMP(NAMSP,PSOCNT)=PSOINST_"^"_$G(VA("BID"))_$E($P(PSONAM,","),1,5)
I '$D(^TMP(NAMSP)) S ^TMP(NAMSP,1)="NO BILLED FILLS FOR INSTITUTION: "_PSOINST
S XMTEXT="^TMP(NAMSP," N DIFROM D ^XMD K XMDUZ,XMTEXT,XMSUB
K ^TMP(NAMSP)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSOCPBK5 5705 printed Nov 22, 2024@17:35:49 Page 2
PSOCPBK5 ;BIR/GN-Back Billing Automated-release refill copay cont. ;10/11/05 1:56pm
+1 ;;7.0;OUTPATIENT PHARMACY;**217**;DEC 1997
+2 ;
MAIL ;user mail message
+1 NEW TOTAMT,PSOCXPDA
+2 DO NOW^%DTC
SET Y=%
DO DD^%DT
SET PSOEND=Y
+3 SET PSOEND2=$$FMTE^XLFDT(%,"1PS")
+4 IF $GET(DUZ)
SET XMY(DUZ)=""
+5 SET XMDUZ="PSO*7*217 "_JOBN
+6 SET XMSUB="Outpatient Pharmacy Copay "_JOBN
+7 FOR PSOCXPDA=0:0
SET PSOCXPDA=$ORDER(^XUSEC("PSO COPAY",PSOCXPDA))
if 'PSOCXPDA
QUIT
SET XMY(PSOCXPDA)=""
+8 ; no recipients for mail message
IF $ORDER(XMY(""))=""
QUIT
+9 SET PSOTEXT(1)="The Rx copay "_JOBN_" job for the Outpatient Pharmacy patch (PSO*7*217)"
+10 SET PSOTEXT(2)="started "_PSOSTART_" and completed "_PSOEND_"."
+11 IF PSOCNT=0
SET PSOTEXT(3)="No released unbilled copay fills were found."
+12 IF PSOCNT>0
Begin DoDot:1
+13 SET TOTAMT=0
+14 FOR XX="YR2004","YR2005"
Begin DoDot:2
+15 FOR YY=1:1:3
SET PSOAMT(XX,YY)=PSOCNT(XX,YY)*YY*7
SET TOTAMT=TOTAMT+PSOAMT(XX,YY)
End DoDot:2
+16 SET PSOTEXT(3)="Auto-Released refills have now been Billed"
+17 SET PSOTEXT(4)="There were "_$FNUMBER(PSOCNT,",")_" fills successfully Billed for "_$FNUMBER(PSOVETS,",")_" veterans."
+18 SET PSOTEXT(5)=" "
+19 SET PSOTEXT(6)="Fills back-billing by year:"
+20 SET PSOTEXT(7)="2004 30-DAY EQUIVALENT FILLS: "_$JUSTIFY(PSOCNT("YR2004",1),6)
+21 SET PSOTEXT(7)=PSOTEXT(7)_" $"_$JUSTIFY($FNUMBER(PSOAMT("YR2004",1),","),9)
+22 SET PSOTEXT(8)="2004 60-DAY EQUIVALENT FILLS: "_$JUSTIFY(PSOCNT("YR2004",2),6)
+23 SET PSOTEXT(8)=PSOTEXT(8)_" $"_$JUSTIFY($FNUMBER(PSOAMT("YR2004",2),","),9)
+24 SET PSOTEXT(9)="2004 90-DAY EQUIVALENT FILLS: "_$JUSTIFY(PSOCNT("YR2004",3),6)
+25 SET PSOTEXT(9)=PSOTEXT(9)_" $"_$JUSTIFY($FNUMBER(PSOAMT("YR2004",3),","),9)
+26 SET PSOTEXT(10)=""
+27 SET PSOTEXT(11)="2005 30-DAY EQUIVALENT FILLS: "_$JUSTIFY(PSOCNT("YR2005",1),6)
+28 SET PSOTEXT(11)=PSOTEXT(11)_" $"_$JUSTIFY($FNUMBER(PSOAMT("YR2005",1),","),9)
+29 SET PSOTEXT(12)="2005 60-DAY EQUIVALENT FILLS: "_$JUSTIFY(PSOCNT("YR2005",2),6)
+30 SET PSOTEXT(12)=PSOTEXT(12)_" $"_$JUSTIFY($FNUMBER(PSOAMT("YR2005",2),","),9)
+31 SET PSOTEXT(13)="2005 90-DAY EQUIVALENT FILLS: "_$JUSTIFY(PSOCNT("YR2005",3),6)
+32 SET PSOTEXT(13)=PSOTEXT(13)_" $"_$JUSTIFY($FNUMBER(PSOAMT("YR2005",3),","),9)
+33 SET PSOTEXT(14)=" =========="
+34 SET PSOTEXT(15)=" TOTAL $"_$JUSTIFY($FNUMBER(TOTAMT,","),9)
+35 SET PSOTEXT(16)=" "
+36 SET PSOTEXT(17)="To get a report of patients/prescriptions that were billed"
+37 SET PSOTEXT(18)="as part of this Back Billing, enter D RPT^PSOCPBK4 at the programmer's prompt"
End DoDot:1
+38 ;
+39 SET XMTEXT="PSOTEXT("
NEW DIFROM
DO ^XMD
KILL XMDUZ,XMTEXT,XMSUB
+40 QUIT
+41 ;
MAIL2 ;management mail message
+1 NEW J
+2 SET LIN=""
SET $PIECE(LIN," ",80)=""
+3 DO NOW^%DTC
SET PSOTIME=$$FMDIFF^XLFDT(%,$GET(PSOS1),2)
+4 SET PSOINST=$PIECE($GET(^DIC(4,+$PIECE($GET(^XMB(1,1,"XUS")),"^",17),99)),"^")
+5 SET PSOSTNM=$PIECE($GET(^DIC(4,PSOINST,0)),"^")
+6 KILL PSOTEXT
+7 SET XMY(DUZ)=""
SET PSOTC=0
SET PSOCNTS=""
+8 FOR J="YR2004","YR2005"
FOR I=1:1:3
Begin DoDot:1
+9 SET PSOTC=PSOTC+PSOCNT(J,I)
+10 SET PSOCNTS=PSOCNTS_","_PSOCNT(J,I)
End DoDot:1
+11 SET XMY("NAPOLIELLO.GREG@DOMAIN.EXT")=""
+12 if $$PROD^XUPROD(1)
SET XMY("WHITE.ELAINE@DOMAIN.EXT")=""
+13 if $$PROD^XUPROD(1)
SET XMY("WILLIAMSON.ERIC@DOMAIN.EXT")=""
+14 SET XMDUZ="PSO*7*217 "_JOBN
+15 SET XMSUB="STATION "_$GET(PSOINST)
+16 SET XMSUB=XMSUB_$SELECT($$PROD^XUPROD(1):" (Prod)",1:" (Test)")
+17 SET XMSUB=XMSUB_" BACK BILLED COPAYS FOR PRESCRIPTION REFILLS"
+18 SET PSOTEXT(1)=" Start time: "_PSOSTRT2
+19 SET PSOTEXT(2)=" Completed time: "_PSOEND2
+20 SET PSOTEXT(3)=" Elapsed Time: "_$$ETIME^PSOCPBK4(PSOTIME)
+21 SET PSOTEXT(4)=""
+22 SET PSOTEXT(5)=" Total RX's processed: "_$JUSTIFY($FNUMBER(PSOTRX,","),8)
+23 SET PSOTEXT(6)=" Total Refills processed: "_$JUSTIFY($FNUMBER(PSOTRF,","),8)
+24 SET PSOTEXT(7)=" Total billable refills: "_$JUSTIFY($FNUMBER(PSOTC,","),8)
+25 SET PSOTEXT(8)=" Total billable vets: "_$JUSTIFY($FNUMBER(PSOVETS,","),8)
+26 SET PSOTEXT(9)=""
+27 SET PSOTEXT(10)=""
+28 SET PSOTEXT(11)="Excel comma delimited data below, Two heading, one data line"
+29 SET PSOTEXT(12)=""
+30 SET PSOTEXT(13)=$EXTRACT(("Station,Station,,2004,,,2005"_LIN),1,79)
+31 SET PSOTEXT(14)=$EXTRACT(("Name,#,30 days,60 days,90 days,30 days,60 days,90 days"_LIN),1,79)
+32 SET PSOTEXT(15)=$EXTRACT((PSOSTNM_","_PSOINST_PSOCNTS_LIN),1,79)
+33 SET PSOTEXT(16)=""
+34 SET XMTEXT="PSOTEXT("
NEW DIFROM
DO ^XMD
KILL XMDUZ,XMTEXT,XMSUB
+35 QUIT
+36 ;
MAIL3(MSG) ;management mail message
+1 SET PSOINST=$PIECE($GET(^DIC(4,+$PIECE($GET(^XMB(1,1,"XUS")),"^",17),99)),"^")
+2 DO NOW^%DTC
SET Y=%
DO DD^%DT
SET PSOEND=Y
+3 KILL PSOTEXT
+4 SET XMY(DUZ)=""
+5 SET XMY("NAPOLIELLO.GREG@DOMAIN.EXT")=""
+6 if $$PROD^XUPROD(1)
SET XMY("WHITE.ELAINE@DOMAIN.EXT")=""
+7 if $$PROD^XUPROD(1)
SET XMY("WILLIAMSON.ERIC@DOMAIN.EXT")=""
+8 SET XMDUZ="PSO*7*217 "_JOBN
+9 SET XMSUB="STATION "_$GET(PSOINST)
+10 SET XMSUB=XMSUB_$SELECT($$PROD^XUPROD(1):" (Prod)",1:" (Test)")
+11 SET XMSUB=XMSUB_" BACK BILLED COPAYS FOR PRESCRIPTION REFILLS"
+12 SET PSOTEXT(1)=""
+13 SET PSOTEXT(2)="Started "_PSOSTART
+14 SET PSOTEXT(3)=""
+15 SET PSOTEXT(4)=" "_MSG
+16 SET PSOTEXT(5)=""
+17 SET PSOTEXT(6)="NO FURTHER ACTION REQUIRED."
+18 SET XMTEXT="PSOTEXT("
NEW DIFROM
DO ^XMD
KILL XMDUZ,XMTEXT,XMSUB
+19 QUIT
+20 ;
MAILAAC ;send name info to AAC for mail stuffers
+1 NEW VA
+2 KILL XMY,^TMP(NAMSP)
+3 SET PSOCNT=0
+4 SET PSOINST=$PIECE($GET(^DIC(4,+$PIECE($GET(^XMB(1,1,"XUS")),"^",17),99)),"^")
+5 SET XMY(DUZ)=""
+6 SET XMY("NAPOLIELLO.GREG@DOMAIN.EXT")=""
+7 if $$PROD^XUPROD(1)
SET XMY("WHITE.ELAINE@DOMAIN.EXT")=""
+8 if $$PROD^XUPROD(1)
SET XMY("WILLIAMSON.ERIC@DOMAIN.EXT")=""
+9 SET XMDUZ="PSO*7*217 "_JOBN
+10 SET XMSUB=$GET(PSOINST)_$SELECT($$PROD^XUPROD(1):" (Prod)",1:" (Test)")
+11 SET XMSUB=XMSUB_" - BACK BILLED COPAYS AAC DATA"
+12 SET PSONAM=""
+13 FOR
SET PSONAM=$ORDER(^XTMP(NAMSP,"BILLED",PSONAM))
if PSONAM=""
QUIT
Begin DoDot:1
+14 SET PSODFN=""
+15 FOR
SET PSODFN=$ORDER(^XTMP(NAMSP,"BILLED",PSONAM,PSODFN))
if PSODFN=""
QUIT
Begin DoDot:2
+16 NEW DFN
SET DFN=PSODFN
DO DEM^VADPT
+17 SET PSOCNT=PSOCNT+1
SET ^TMP(NAMSP,PSOCNT)=PSOINST_"^"_$GET(VA("BID"))_$EXTRACT($PIECE(PSONAM,","),1,5)
End DoDot:2
End DoDot:1
+18 IF '$DATA(^TMP(NAMSP))
SET ^TMP(NAMSP,1)="NO BILLED FILLS FOR INSTITUTION: "_PSOINST
+19 SET XMTEXT="^TMP(NAMSP,"
NEW DIFROM
DO ^XMD
KILL XMDUZ,XMTEXT,XMSUB
+20 KILL ^TMP(NAMSP)
+21 QUIT