Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ABSPOSRZ

ABSPOSRZ.m

Go to the documentation of this file.
ABSPOSRZ  ;IHS/OIT/SCR - REJECTION REPORT BY REJECTION REASON
 ;;1.0;PHARMACY POINT OF SALE;**29,30,34,35,39,40,41,44,46**;JUN 21, 2001;Build 38
 ;IHS/OIT/CNI/RAN - Rewritten for patch 40 to run WITHOUT Report Master
 ;OIT/CAS/RCS - Fix report to look at only latest claim data not earlier claims, patch 44
 ;IHS/OIT/RCS - Fix program error when Reject code is not in table, patch 46
 ;IHS/OIT/RCS - Change ABSPCLMS variable to scratch file to fix STORE errors, patch 46
EN ; EP
 N ABSPQUIT,ABSPDONE,ABSPSTRT,ABSPEND,ABSPLCNT,ABSPREJ,ABSPRJ
 I $D(ZTQPARAM) D START
 S ABSPDONE=0
 S ABSPQUIT=0
 F  Q:ABSPDONE=1  D
 .S ABSPSTRT=$$BDT^ABSPOSRU()
 .I ABSPSTRT=-1 D
 ..S ABSPQUIT=1
 ..S ABSPDONE=1
 .Q:ABSPQUIT
 .S ABSPEND=$$EDT^ABSPOSRU()
 .I ABSPEND=-1 D
 ..S ABSPQUIT=1
 ..S ABSPDONE=1
 ..Q
 .Q:ABSPQUIT
 .I ABSPSTRT<0 S ABSPDONE=1 Q
 .I ABSPEND<0 S ABSPDONE=1 Q
 .S X2=ABSPSTRT,X1=ABSPEND D ^%DTC
 .I X<0 D EN^DDIOL("Ending Date is BEFORE Beginning Date Please enter new dates","","!!,*7")
 .I X>=0 S ABSPDONE=1
 .Q
 Q:ABSPQUIT
 S ABSPQUIT=$$CLNC^ABSPOSRU()
 Q:ABSPQUIT=-1
 S ABSPQUIT=$$INS^ABSPOSUU()
 Q:ABSPQUIT=-1
 S ABSPQUIT=$$CODE^ABSPOSUU() ;IHS/OIT/SCR 092109 patch 34 - screen by selected reject code
 Q:ABSPQUIT=-1
 S ABSPQUIT=$$RTYPE()
 Q
RTYPE()  ; SELECT IF YOU WANT SUMMARY, OR DETAILED
 N DIR,STARTIME,STOPTIME
 S DIR(0)="S^S:SUMMARY;D:DETAILED"
 S DIR("B")="D"
 S DIR("A")="Please select S for Summary or D for Detailed"
 D ^DIR
 I $D(DIRUT) Q -1
 S ABSPRTYP=X ; SET REPORT TYPE
 D DEVSEL^ABSPOSRU
 D ^XBCLS
 S STARTIME=$H
 D FIND
 S STOPTIME=$H
 S ^TMP("ABSPOSRZ-RUNLOG",$J,STARTIME)=ABSPSTRT_"^"_$P(ABSPEND,".")_"^"_($P(STOPTIME,",",2)-$P(STARTIME,",",2))
 D NEXT
 Q 1
FIND ; FIND REJECTIONS BY RELEASE DATE "B" CROSS REFERENCE
 N ABSPDONE,ABSPRDT,ABSPCARD,ABSPGRP,ABSPCLMI,ABSPRCNT,ABSPRNUM,ABSPTRTM,ABSPRSMI,ABSPPRMI ;,ABSPCLMS
 N ABSPTLTP,ABSPRESC,DO,ABSPIDTS,ABSPIDTE,ABSPIRMI,ABSPIRME
 N ABSPCODE,ABSPQUIT ;IHS/OIT/SCR 082109 patch 34
 K ^TMP($J,"ABSPCLMS") ;OIT/CAS/RCS 081213 Patch 46
 S ABSPRDT=ABSPSTRT
 S ABSPEND=ABSPEND_".99999999"
 S ABSPDONE=0
 F  S ABSPRDT=$O(^PSRX("AL",ABSPRDT)) Q:(ABSPRDT="")!(ABSPDONE)!(+ABSPRDT=0)  D
 .I ABSPRDT>ABSPEND S ABSPDONE=1 Q
 .S ^TMP("ABSPOSRZ",$J,$P(ABSPRDT,"."))=""
 .S ABSPPRMI=""
 .F  S ABSPPRMI=$O(^PSRX("AL",ABSPRDT,ABSPPRMI)) Q:ABSPPRMI=""  D
 ..S ABSPIRME=ABSPPRMI
 ..S ABSPIRMI=ABSPPRMI_".99999999"
 ..F  S ABSPIRMI=$O(^ABSPTL("B",ABSPIRMI),-1) Q:(ABSPIRMI<ABSPIRME)!(ABSPIRMI="")  D
 ...S ABSPTRNS=""
 ...F  S ABSPTRNS=$O(^ABSPTL("B",ABSPIRMI,ABSPTRNS),-1) Q:ABSPTRNS=""  D  Q  ;OIT/CAS/RCS 06202012 Patch 44 - Quit after the oldest/first claim is looked at, HEAT # 71102
 ....N ABSPTL
 ....M ABSPTL(ABSPTRNS)=^ABSPTL(ABSPTRNS)
 ....;DONT REPORT CLOSED CLAIMS
 ....I +$P($G(ABSPTL(ABSPTRNS,9)),"^") S ^TMP($J,"ABSPCLMS",$P(ABSPIRMI,"."))="" Q  ;OIT/CAS/RCS - Patch 46, S ABSPCLMS($P(ABSPIRMI,"."))="" Q
 ....S ABSPTLTP=ABSPTL(ABSPTRNS,0)
 ....S ABSPRSMI=$P(ABSPTLTP,U,5) ;Response reference
 ....S ABSPCLMI=$P(ABSPTLTP,U,4) ;Claim Reference
 ....Q:(ABSPRSMI="")!(ABSPCLMI="")
 ....S DO=$P(ABSPTLTP,U,9)  ;Position on claim(and response)
 ....I '$D(^ABSPR(ABSPRSMI,1000,DO)) S DO=$$GETDO^ABSPOSUU(ABSPRSMI,$P(ABSPIRMI,"."))
 ....Q:DO=""
 ....;IHS/OIT/CASSEVERN/RAN 03/02/2011 patch 41 If there is a corrupted response just skip it rather than err out
 ....Q:'$D(^ABSPR(ABSPRSMI,1000,DO,500))
 ....I $P(^ABSPR(ABSPRSMI,1000,DO,500),U)'="R" S ^TMP($J,"ABSPCLMS",$P(ABSPIRMI,"."))="" ;OIT/CAS/RCS - Patch 46, S ABSPCLMS($P(ABSPIRMI,"."))="" ;We only care about rejects in this report
 ....Q:$D(^TMP($J,"ABSPCLMS",$P(ABSPIRMI,".")))  ;OIT/CAS/RCS - Patch 46, Q:$D(ABSPCLMS($P(ABSPIRMI,".")))
 ....S ABSPTINS=$P(ABSPTL(ABSPTRNS,1),U,6)
 ....S ABSPPHM1=""
 ....I ABSPINS'="ALL" Q:ABSPTINS'=ABSPINS  ;NOT SELECTED INSURER
 ....I (ABSPPPHM'="ALL")&&($P(ABSPTL(ABSPTRNS,1),U,7)'=ABSPPPHM) Q  ;NOT SELECTED PHARMACY
 ....S ABSPPHM1=ABSPPPHM
 ....I ABSPPPHM="ALL" S ABSPPHM1=$P(ABSPTL(ABSPTRNS,1),U,7) ;SET PHARMACY
 ....I ABSPPHM1="" Q
 ....;IHS/OIT/SCR 082109 START changes patch 34
 ....I '$D(^ABSPR(ABSPRSMI,1000,DO,511)) S (ABSPRNUM,ABSPREA)="UKN" ;Added to skip junk data in PMAA test area
 ....E  D  ;IHS/OIT/RCS 080913 patch 46 If Reject code missing, create unkown Reject description
 .....S ABSPRNUM=$P(^ABSPR(ABSPRSMI,1000,DO,511,1,0),U)
 .....I '$D(^ABSPF(9002313.93,"B",ABSPRNUM)) S ABSPREA="Reject Code description not entered,See NCPDP Rejects" Q  ;IHS/OIT/RCS PATCH 46
 .....S ABSPREA=$P(^ABSPF(9002313.93,$O(^ABSPF(9002313.93,"B",ABSPRNUM,"")),0),U,2)
 ....I (ABSPREJ'="ALL")&&(ABSPREJX'=ABSPRNUM) S ABSPQUIT=1 Q
 ....S ABSPGRP=""
 ....S ABSPCARD=""
 ....S ABSPCARD=$P($G(^ABSPC(ABSPCLMI,300)),U,2) ;TRANSACTION:CLAIM:Cardholder ID Number
 ....S ABSPCARD=$E(ABSPCARD,3,$L(ABSPCARD)) ;STRIP THE 2 CHARACTER QUALIFIER
 ....S ABSPGRP=$P($G(^ABSPC(ABSPCLMI,300)),U,1) ;TRANSACTION:CLAIM:Group Number
 ....S ABSPGRP=$E(ABSPGRP,3,$L(ABSPGRP)) ;STRIP THE 2 CHARACTER QUALIFIER
 ....S ABSPRCNT=$P($G(ABSPREAS(ABSPRNUM,ABSPPHM1)),U)+1
 ....S ^TMP($J,"ABSPCLMS",$P(ABSPIRMI,"."))="" ;OIT/CAS/RCS - Patch 46, S ABSPCLMS($P(ABSPIRMI,"."))=""
 ....S ABSPREAS(ABSPRNUM,ABSPPHM1)=ABSPRCNT_U_ABSPRNUM_":"_ABSPREA
 ....S ^TMP("ABSPOSRZ",$J,$P(ABSPRDT,"."),ABSPPHM1,ABSPTINS,ABSPRNUM,ABSPIRMI)=ABSPREA_U_$P(ABSPTL(ABSPTRNS,5),U,5)_U_$P(ABSPTL(ABSPTRNS,0),U,6)_U_$P(ABSPTL(ABSPTRNS,1),U,6)_U_ABSPCARD_U_ABSPGRP_U_ABSPCLMI
 Q
NEXT ;WHAT TO DO NEXT
 N ABSPSTOP,ABSPOUT
 S (ABSPSTOP,ABSPOUT)=0
 I $O(^TMP("ABSPOSRZ",$J,""))="" D
 .D PRHDR
 .W !!," NO REJECTIONS FOUND FOR THE SELECTED DATE(S)"
 .D ZEND
 .S ABSPSTOP=1
 .Q
 Q:ABSPSTOP
 D SUM
 D PRNTSUM
 I ABSPOUT D ZEND  Q
 I ABSPRTYP["D" D PRNTDTL
 D ZEND
 Q
PRHDR ;PRINT HEADER
 N ABSPFEDT,ABSPFBDT,Y
 U IO W:$D(ABSPSUM) @IOF
 S Y=ABSPSTRT
 D DD^%DT
 S ABSPFBDT=Y
 S Y=$P(ABSPEND,".")
 D DD^%DT
 S ABSPFEDT=Y
 W @IOF
 W !,?19,"Pharmacy Point of Sale Rejection Report"
 W !,?22,"Claims sorted by Rejection Reason"
 W !?22,"From "_ABSPFBDT_" TO "_ABSPFEDT
 W !?30,"***SUMMARY REPORT***",!
 Q
SUM ;PRINT SUMMARY PAGE AND TOTAL AMT PER EACH THAT WAS REJECTED
 N ABSPPCNT,ABSPTMP
 S ABSPSRDT=""
 F  S ABSPSRDT=$O(^TMP("ABSPOSRZ",$J,ABSPSRDT)) Q:ABSPSRDT=""  D
 .M ABSPTMP(ABSPSRDT)=^TMP("ABSPOSRZ",$J,ABSPSRDT)
 .S ABSPSPHM=""
 .F  S ABSPSPHM=$O(ABSPTMP(ABSPSRDT,ABSPSPHM)) Q:ABSPSPHM=""  D
 ..S ABSPSTIN=""
 ..F  S ABSPSTIN=$O(ABSPTMP(ABSPSRDT,ABSPSPHM,ABSPSTIN)) Q:ABSPSTIN=""  D
 ...S ABSPSRNM=""
 ...F  S ABSPSRNM=$O(ABSPTMP(ABSPSRDT,ABSPSPHM,ABSPSTIN,ABSPSRNM)) Q:ABSPSRNM=""  D
 ....S ABSPSTTL=0,ABSPSRMI="",ABSPSTL1=0
 ....F  S ABSPSRMI=$O(ABSPTMP(ABSPSRDT,ABSPSPHM,ABSPSTIN,ABSPSRNM,ABSPSRMI)) Q:ABSPSRMI=""  D
 .....S ABSPSREA=$P(ABSPTMP(ABSPSRDT,ABSPSPHM,ABSPSTIN,ABSPSRNM,ABSPSRMI),U,1)
 .....S ABSPPCNT=$P($G(ABSPREAS(""_ABSPSRNM_"",ABSPSPHM)),U)
 .....S ABSPSTTL=ABSPSTTL+$P(ABSPTMP(ABSPSRDT,ABSPSPHM,ABSPSTIN,ABSPSRNM,ABSPSRMI),U,2)
 ....S ABSPSTL1=ABSPSTTL+$P($G(ABSPSUM(ABSPSPHM,ABSPSRNM)),U,2)
 ....S ABSPSUM(ABSPSPHM,ABSPSRNM)=ABSPSRNM_":"_ABSPSREA_U_ABSPSTL1_U_ABSPSTIN_U_ABSPPCNT
 .K ABSPTMP
 Q
PRNTSUM ;PRINT THE SUMMARY REPORT
 N ABSPGCNT,ABSPPCNT,ABSPSTOP,ABSPTMP
 S ABSPSTOP=0
 S ABSPPPHM=""
 S ABSPRTOT=0
 S ABSPPCNT=0
 S ABSPGTOT=0
 S ABSPGCNT=0
 S ABSPBTOT=0
 S ABSPSTOP=0
 S ABSPQUIT=0
 S ABSPOUT=0
 D PRHDR
 F  S ABSPPPHM=$O(ABSPSUM(ABSPPPHM)) Q:(ABSPPPHM="")!(ABSPSTOP)  D
 .I ABSPOUT S ABSPSTOP=1 Q
 .I ABSPPPHM=0 S ABSPPPHM=1
 .S ABSPPHMN=$P(^ABSP(9002313.56,ABSPPPHM,0),U,1)
 .;IHS/OIT/CNI/RAN 04272010 patch 39 - When printing to screen use paging.
 .S ABSPOUT=$$WRITE^ABSPOSUU("!!,""PHARMACY: "",ABSPPHMN")
 .Q:ABSPOUT
 .S ABSPPRNM=""
 .S ABSPRTOT=0
 .S ABSPPCNT=0  ;IHS/OIT/SCR 110309 this is pharmacy count
 .;IHS/OIT/CNI/RAN 05042010 patch 39 - When printing to screen use paging.
 .S ABSPOUT=$$WRITE^ABSPOSUU("!?2,""REJECTION CODE: "",?58,""  TOTALED: "",?68,""  RX COUNT: """)
 .Q:ABSPOUT
 .F  S ABSPPRNM=$O(ABSPSUM(ABSPPPHM,ABSPPRNM)) Q:(ABSPPRNM="")!(ABSPSTOP)  D
 ..I ABSPOUT S ABSPSTOP=1 Q
 ..S ABSPDRTR=$P(ABSPSUM(ABSPPPHM,ABSPPRNM),U,1)
 ..I ABSPDRTR'="" D
 ...;IHS/OIT/CNI/RAN 04272010 patch 39 - When printing to screen, use paging.
 ...S ABSPOUT=$$WRITE^ABSPOSUU("!?0,$P(ABSPSUM(ABSPPPHM,ABSPPRNM),U,1),?60,$J($FN($P(ABSPSUM(ABSPPPHM,ABSPPRNM),U,2),"","",2),7),?72,$P(ABSPSUM(ABSPPPHM,ABSPPRNM),U,4)")
 ...Q:ABSPOUT
 ...S ABSPRTOT=ABSPRTOT+$P(ABSPSUM(ABSPPPHM,ABSPPRNM),U,2)
 ...S ABSPPCNT=ABSPPCNT+$P(ABSPSUM(ABSPPPHM,ABSPPRNM),U,4)
 ..Q:ABSPOUT
 .Q:ABSPSTOP
 .Q:ABSPOUT
 .S ABSPGTOT=ABSPGTOT+ABSPRTOT
 .S ABSPGCNT=ABSPGCNT+ABSPPCNT
 .;IHS/OIT/CNI/RAN 04272010 patch 39 - When printing to screen use paging
 .W:$Y<3 ! S ABSPOUT=$$WRITE^ABSPOSUU("!!,""TOTAL FOR PHARMACY: $"",$FN(ABSPRTOT,"","",2)")
 .Q:ABSPOUT
 .W:$Y<3 ! S ABSPOUT=$$WRITE^ABSPOSUU("!,""# RX REJECTED FOR PHARMACY: "",ABSPPCNT")
 .Q:ABSPOUT
 Q:ABSPSTOP
 Q:ABSPOUT
 ;IHS/OIT/CNI/RAN 04272010 patch 39 - When printing to screen, use paging
 W:$Y<3 ! S ABSPOUT=$$WRITE^ABSPOSUU("!!,""GRAND TOTAL: $"",$FN(ABSPGTOT,"","",2)")
 Q:ABSPOUT
 W:$Y<3 ! S ABSPOUT=$$WRITE^ABSPOSUU("!,""# RX REJECTED: "",ABSPGCNT")
 ;W:$Y<3 ! W !!,"P - Preventable, N - Non-recoverable, B - Both"
 Q
PRNTDHD ;PRINT DETAIL HEADER
 I ABSPRTYP'["D" D ZEND Q
 ;IHS/OIT/CNI/RAN 04272010 patch 39 - When printing to screen, use paging
 S ABSPOUT=$$WRITE^ABSPOSUU("!!,?21,""********** Detailed Report **********"",!")
 Q:ABSPOUT
 S ABSPOUT=$$WRITE^ABSPOSUU("!,""CHT #"",?14,""NAME"",?32,""RX #/FILL # COBPayer"",?52,""INSURER"",?69,""AMT BILLED""")
 Q:ABSPOUT
 ;IHS/OIT/CNI/RAN 04282010 patch 39 - Add NDC # and Drug name
 S ABSPOUT=$$WRITE^ABSPOSUU("!,?3,""CARD HOLDER ID #"",?27,""GROUP #"",?40,""NDC #"",?60,""DRUG NAME""")
 Q
PRNTDTL  ;PRINT DETAILED REPORT
 N ABSPCARD,ABSPFRDT,ABSPGRP,ABSPSTOP,ABSPNDC,ABSPDRNM,ABSPQUIT,ABSPOUT,NDCDRG,ABSPCLMI,Y,ABSPTMP
 S ABSPPRDT=""
 S ABSPPPHM=""
 S ABSPPRNM=""
 ;IHS/OIT/CNI/RAN 04282010 patch 39 - Add NDC # and Drug name on next two lines and New line above
 S ABSPNDC=""
 S ABSPDRNM=""
 S ABSPRTOT=0
 S ABSPGTOT=0
 S ABSPRDTL=0
 S ABSPSTOP=0
 S ABSPQUIT=0
 S ABSPOUT=0
 F  S ABSPPRDT=$O(^TMP("ABSPOSRZ",$J,ABSPPRDT)) Q:(ABSPPRDT="")!(ABSPQUIT)!(ABSPOUT)  D
 .N ABSPTMP
 .M ABSPTMP(ABSPPRDT)=^TMP("ABSPOSRZ",$J,ABSPPRDT)
 .S ABSPPPHM=""
 .S Y=ABSPPRDT
 .D DD^%DT
 .S ABSPFRDT=Y   ; FORMATTED RELEASE DATE
 .S ABSPRDTL=0
 .F  S ABSPPPHM=$O(ABSPTMP(ABSPPRDT,ABSPPPHM)) Q:(ABSPPPHM="")!(ABSPOUT)  D
 ..S ABSPPINS=""
 ..S ABSPPHMN=$P(^ABSP(9002313.56,ABSPPPHM,0),U,1)
 ..D PRNTDHD
 ..Q:ABSPOUT
 ..;IHS/OIT/CNI/RAN 04272010 patch 39 - When printing to screen, use paging
 ..S ABSPOUT=$$WRITE^ABSPOSUU("!!,?5,""PHARMACY: "",ABSPPHMN,""   RELEASED DATE: "",ABSPFRDT")
 ..Q:ABSPOUT
 ..S ABSPBTOT=0
 ..F  S ABSPPINS=$O(ABSPTMP(ABSPPRDT,ABSPPPHM,ABSPPINS)) Q:(ABSPPINS="")!(ABSPOUT)  D
 ...S ABSPPRNM=""
 ...F  S ABSPPRNM=$O(ABSPTMP(ABSPPRDT,ABSPPPHM,ABSPPINS,ABSPPRNM)) Q:(ABSPPRNM="")!(ABSPOUT)  D
 ....S ABSPPRMI=""
 ....S ABSPRJCD=$P($G(ABSPREAS(""_ABSPPRNM_"",ABSPPPHM)),U,2)
 ....;IHS/OIT/CNI/RAN 04272010 patch 39 - When printing to screen, use paging
 ....S ABSPOUT=$$WRITE^ABSPOSUU("!!,?15,""REJECTION CODE: "",$E(ABSPRJCD,1,48)")
 ....Q:ABSPOUT
 ....F  S ABSPPRMI=$O(ABSPTMP(ABSPPRDT,ABSPPPHM,ABSPPINS,ABSPPRNM,ABSPPRMI)) Q:(ABSPPRMI="")!(ABSPOUT)  D
 .....S (ABSPPCHT,ABSPPDIV,ABSPOPS)=""
 .....S ABSPPTYP="P"
 .....I $E($P(ABSPPRMI,".",2))=2 S ABSPPTYP="S"
 .....I $E($P(ABSPPRMI,".",2))=3 S ABSPPTYP="T"
 .....S ABSPPAT=$P(ABSPTMP(ABSPPRDT,ABSPPPHM,ABSPPINS,ABSPPRNM,ABSPPRMI),U,3)
 .....S ABSPCARD=$P(ABSPTMP(ABSPPRDT,ABSPPPHM,ABSPPINS,ABSPPRNM,ABSPPRMI),U,5)
 .....S ABSPGRP=$P(ABSPTMP(ABSPPRDT,ABSPPPHM,ABSPPINS,ABSPPRNM,ABSPPRMI),U,6)
 .....S ABSPPATN=$E($P(^DPT(ABSPPAT,0),U,1),1,20)
 .....S ABSPOPS=$P($G(^ABSP(9002313.56,ABSPPPHM,"OPSITE",1,0)),U,1)  ;OUTPATIENT SITE MIGHT NOT BE DEFINED
 .....S:ABSPOPS'="" ABSPPDIV=$P($G(^PS(59,ABSPOPS,0)),U,6)  ;NO OUTPATIENT SITE MEANS NO DIVISION
 .....S:ABSPPDIV'="" ABSPPCHT=$P($G(^AUPNPAT(ABSPPAT,41,ABSPPDIV,0)),U,2)  ;NO DIVISION MEANS NO CHART #
 .....S ABSPPTP=$P(ABSPTMP(ABSPPRDT,ABSPPPHM,ABSPPINS,ABSPPRNM,ABSPPRMI),U,2)  ; PRICE
 .....S ABSPINSN=$E($P($G(^AUTNINS(ABSPPINS,0)),U,1),1,22)   ; INSURER NAME
 .....S ABSPCLMI=$P(ABSPTMP(ABSPPRDT,ABSPPPHM,ABSPPINS,ABSPPRNM,ABSPPRMI),U,7)
 .....S ABSPPRX=$P(ABSPPRMI,".")  ;INTERNAL RX #
 .....S ABSPPRXR=$P($P(^ABSPC(ABSPCLMI,400,$P(^ABSPC(ABSPCLMI,400,0),U,3),400),U,3),"D3",2)  ;Refill Number
 .....;IHS/OIT/CNI/RAN 04282010 patch 39 - Add NDC # and Drug name BEGIN
 .....S NDCDRG=$$GTNDCDRG^ABSPOSUU(ABSPCLMI,ABSPPRX)
 .....S ABSPNDC=$P(NDCDRG,U,1)
 .....S ABSPDRNM=$P(NDCDRG,U,2)
 .....;IHS/OIT/CNI/RAN 04272010 patch 39 - When printing to screen, use paging
 .....S ABSPOUT=$$WRITE^ABSPOSUU("!,ABSPPCHT,?9,ABSPPATN,?31,ABSPPRX_""/""_+ABSPPRXR_ABSPPTYP,?45,ABSPINSN,?70,""$""_$J(ABSPPTP,6,2)")
 .....Q:ABSPOUT
 .....;IHS/OIT/CNI/RAN 04282010 patch 39 - Add NDC # and Drug name
 .....S ABSPOUT=$$WRITE^ABSPOSUU("!,?3,ABSPCARD,?27,ABSPGRP,?40,ABSPNDC,?60,ABSPDRNM")
 .....Q:ABSPOUT
 .....;IHS/OIT/CNI/RAN 04272010 patch 39 - When printing to screen, use paging.
 .....S ABSBPRTT=ABSPRTOT+ABSPPTP
 .....S ABSPBTOT=ABSPPTP+ABSPBTOT
 .....S ABSPRDTL=ABSPRDTL+ABSPPTP
 ...Q:ABSPOUT
 ..Q:ABSPOUT
 ..;IHS/OIT/CNI/RAN 04272010 patch 39 - When printing to screen, use paging
 ..S ABSPOUT=$$WRITE^ABSPOSUU("!!,""TOTAL FOR "",ABSPPHMN,"": $"",$J($FN(ABSPBTOT,"","",2),6),!")
 .Q:ABSPOUT
 .;IHS/OIT/CNI/RAN 04272010 patch 39 - When printing to screen, use paging
 .S ABSPOUT=$$WRITE^ABSPOSUU("!!,""TOTAL FOR RELEASED DATE "",ABSPFRDT,"": $"",$J($FN(ABSPRDTL,"","",2),6)")
 .Q:ABSPOUT
 .S ABSPGTOT=ABSPGTOT+ABSPRDTL
 Q:ABSPSTOP
 Q:ABSPOUT
 ;IHS/OIT/CNI/RAN 04272010 patch 39 - When printing to screen, use paging
 I $D(ABSPRTYP) S ABSPOUT=$$WRITE^ABSPOSUU("!!,""TOTAL AMOUNT REJECTED: $"",$J($FN(ABSPGTOT,"","",2),6),!!")
 Q
ZEND ;END AND KILL VARIABLES
 D ^%ZISC
 K ^TMP("ABSPOSRZ",$J),^TMP($J,"ABSPCLMS"),ABSPTMP,ABSPSUM,ABSBPRTT,ABSPBTOT,ABSPGTOT,ABSPRTOT,ABSPINS,ABSPPTP,ABSPPAT,ABSPPCHT,ABSPINSN,ABSPPRX,ABSPPRMI,ABSPPRXR,ABSPPDIV,ABSPOPS,ABSPPATN,ABSPPPHM,ABSPPRDT
 K ABSPREAS,ABSPRMI,ABSPSRDT,ABSPSTTL,ABSPSRMI,ABSPSPHM,ABSPSRNM,RNUM,ABSPSTIN,ABSPFBDT,ABSPFEDT,ABSPBDT,ABSPEDT,ABSPTINS,ABSPTRNS,ABSPJ,ABSPRTYP,ABSPDRT,ABSPDRTR,ABSPRJCD
 K ABSPPHM1,ABSPPHMN,ABSPPINS,ABSPPRNM,ABSPRCD,ABSPRDTL,ABSPREA,ABSPSREA,ABSPSTL1,ABSPSTRT
 Q
START  ;
 N X,Y,ABSPJ,ABSPRJC,ABSPPAT,ABSPPIEN
 I $D(ZTQPARAM) D
 .I $P(ZTQPARAM,";",1)["T-1" S ABSPSTRT=DT-1
 .I $P(ZTQPARAM,";",2)["T-1" S ABSPEND=DT-1
 .S ABSPINS="ALL"
 .S ABSPPPHM="ALL"
 .S ABSPRTYP="D"
 .D FIND
 .D ZEND
 .Q
 Q