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

AGBENPRD.m

Go to the documentation of this file.
AGBENPRD ;IHS/ASDS/TPF - PRINT BENEFIT PRODUCTIVITY REPORT; MAR 19, 2010
 ;;7.1;PATIENT REGISTRATION;**2,4,7,11**;AUG 25, 2005;Build 1
 ;IHS/OIT/NKD AG*7.1*11 ADDITIONAL OVERALL STATUS ENTRIES
 ;
START ;
 D INIT
ASKBEG ;
 W !
 S %DT("A")="Enter the BEGINNING DATE for this report: "
 S %DT="APE"
 D ^%DT
 Q:X=""!(X[U)
 S AGBEG=Y
ASKEND ;
 W !
 S %DT("A")="Enter the ENDING DATE for this report: "
 S %DT="APE"
 D ^%DT
 G:X=""!(X[U)!(Y<0) ASKBEG
 S AGEND=Y
 I AGBEG>AGEND W !!,*7,"INVALID ENTRY - The END is before the BEGINNING." G ASKBEG
 S AGBEGX=$$FMTE^XLFDT(AGBEG,5)
 S AGENDX=$$FMTE^XLFDT(AGEND,5)
 ;
ASKTYPE ;
 K DIR
 S DIR(0)="SO^1:RECEIVER;2:APPTYPE"
 S DIR("L",1)="Which Type of report do you wish?"
 S DIR("L",2)="1... PERSON RECEIVING APPLICATION"
 S DIR("L")="2... APPLICATION TYPE"
 D ^DIR
 G:'Y!($D(DTOUT))!($D(DIROUT))!($D(DUOUT)) ASKEND
 S AGRPTTYP=Y(0)
 ;
 D DEV Q:POP
 I $D(ZTSK) W !,"Report queued with task # ",$G(ZTSK) K DIR S DIR(0)="E" D ^DIR Q
 U IO
 D QUEUED
 D HOME^%ZIS
 D ^%ZISC
 Q
QUEUED ;
 D PROCESS
 D PRINT
 Q
PROCESS ;
 N IEN,REC
 K ^XTMP("AGBENPRD",$J)
 S AGBEG=AGBEG-.01
 F  S AGBEG=$O(^AUPNAPPS("D",AGBEG)) Q:AGBEG=""!(AGBEG>AGEND)  D
 .S IEN=""
 .F  S IEN=$O(^AUPNAPPS("D",AGBEG,IEN)) Q:IEN=""  D
 ..S REC=""
 ..F  S REC=$O(^AUPNAPPS("D",AGBEG,IEN,REC)) Q:REC=""  D
 ...S AGTYPE=$P($G(^AUPNAPPS(IEN,11,REC,0)),U,2)
 ...I AGTYPE="" S AGTYPE="UNPOPULATED"
 ...E  S AGTYPE=$P($G(^AUPNAPPT(AGTYPE,0)),U)
 ...S PERSREC=$P($G(^AUPNAPPS(IEN,11,REC,0)),U,3)
 ...I PERSREC="" S PERSREC="UNPOPULATED"
 ...E  S PERSREC=$P($G(^VA(200,PERSREC,0)),U)
 ...S OVERSTAT=$P($G(^AUPNAPPS(IEN,11,REC,0)),U,4)
 ...S IENS=REC_","_IEN_","
 ...Q:OVERSTAT=""
 ...I OVERSTAT="" S OVERSTAT="UNPOPULATED"
 ...E  S OVERSTAT=$$GET1^DIQ(9000045.11,IENS,.04,"I","AGDATA","AGERR")
 ...;IHS/OIT/NKD AG*7.1*11 CHANGED SETTING OF TMP GLOBAL TO INCLUDE OFFSET AND ADDED 2 NEW ENTRIES
 ...;S OVERSTAT=$S(OVERSTAT="A":1_U_OVERSTAT,OVERSTAT="D":2_U_OVERSTAT,OVERSTAT="R":3_U_OVERSTAT,OVERSTAT="RE":4_U_OVERSTAT,OVERSTAT="F":5_U_OVERSTAT,OVERSTAT="E":6_U_OVERSTAT,OVERSTAT="P":7_U_OVERSTAT,1:"UNDEFINED")
 ...S OVERSTAT=$S(OVERSTAT="A":17_U_OVERSTAT,OVERSTAT="D":25_U_OVERSTAT,OVERSTAT="R":32_U_OVERSTAT,OVERSTAT="RE":39_U_OVERSTAT,OVERSTAT="F":47_U_OVERSTAT,OVERSTAT="E":54_U_OVERSTAT,OVERSTAT="P":60_U_OVERSTAT,1:OVERSTAT)
 ...S:OVERSTAT'[U OVERSTAT=$S(OVERSTAT="O":68_U_OVERSTAT,OVERSTAT="S":75_U_OVERSTAT,1:"UNDEFINED")
 ...S SUB3=$S(AGRPTTYP="APPTYPE":AGTYPE,1:PERSREC)
 ...S:SUB3="" SUB3="UNPOPULATED"
 ...S ^XTMP("AGBENPRD",$J,SUB3,OVERSTAT)=$G(^XTMP("AGBENPRD",$J,SUB3,OVERSTAT))+1
 ...S ^XTMP("AGBENPRD",$J,"~",OVERSTAT)=$G(^XTMP("AGBENPRD",$J,"~",OVERSTAT))+1
 Q
PRINT ;
 D HDR
 D SUBHDR
 S APPTYPE=""
 N ESC
 ;F  S APPTYPE=$O(^XTMP("AGBENPRD",$J,APPTYPE)) Q:APPTYPE=""!(APPTYPE="~")  D
 ;AG*7.1*7/IHS/SD/AR 02/23/2010
 F  S APPTYPE=$O(^XTMP("AGBENPRD",$J,APPTYPE)) Q:APPTYPE=""!(APPTYPE="~")!$G(ESC)  D
 .W !,$E(APPTYPE,1,15)
 .S OVERSTAT=""
 .F  S OVERSTAT=$O(^XTMP("AGBENPRD",$J,APPTYPE,OVERSTAT)) Q:OVERSTAT=""  D
 ..S STATUS=$P(OVERSTAT,U,2)
 ..;IHS/OIT/NKD AG*7.1*11 CHANGED $S FOR OFFSET TO USE 1ST PIECE IN TMP GLOBAL
 ..;S OFFSET=$S(STATUS="A":18,STATUS="D":28,STATUS="R":37,STATUS="RE":47,STATUS="F":58,STATUS="E":66,STATUS="P":75,1:0)
 ..S OFFSET=+$P(OVERSTAT,U,1)
 ..;I '$D(ZTQUEUED) I ($Y>(IOSL-4)!($Y=(IOSL-4))),(IOST[("C-")) W !! K DIR S DIR(0)="E" D ^DIR D HDR,SUBHDR Q
 ..;AG*7.1*7/IHS/SD/AR 02/23/2010
 ..I '$D(ZTQUEUED) I ($Y>(IOSL-4)!($Y=(IOSL-4))),(IOST[("C-")) W !! K DIR S DIR(0)="E" D ^DIR S ESC=X=U D HDR,SUBHDR Q
 ..I ($Y>(IOSL-4)!($Y=(IOSL-4))),(IOST'[("C-")) D HDR,SUBHDR
 ..W ?OFFSET,$G(^XTMP("AGBENPRD",$J,APPTYPE,OVERSTAT))
 I $G(ESC) K ^XTMP("AGBENPRD",$J) Q
 W !!,AGDASH
 W !,"TOTALS"
 S OVERSTAT=""
 F  S OVERSTAT=$O(^XTMP("AGBENPRD",$J,"~",OVERSTAT)) Q:OVERSTAT=""  D
 .Q:OVERSTAT=0
 .Q:STATUS="UNDEFINED"
 .S STATUS=$P(OVERSTAT,U,2)
 .;IHS/OIT/NKD AG*7.1*11 CHANGED $S FOR OFFSET TO USE 1ST PIECE IN TMP GLOBAL
 .;S OFFSET=$S(STATUS="A":18,STATUS="D":28,STATUS="R":37,STATUS="RE":47,STATUS="F":58,STATUS="E":66,STATUS="P":75,1:0)
 .S OFFSET=+$P(OVERSTAT,U,1)
 .W ?OFFSET,$G(^XTMP("AGBENPRD",$J,"~",OVERSTAT))
 D ^%ZISC
 I '$D(ZTQUEUED) I $Y>IOSL-4,(IOST[("C-")) W !! K DIR S DIR(0)="E" D ^DIR
 K ^XTMP("AGBENPRD",$J)
 Q
INIT ;
 S AGUSER=$P($G(^VA(200,DUZ,0)),U)
 ;S AGLOC=$P($G(^AUTTLOC(DUZ(2),0)),U,2)
 S AGLOC=$P($G(^AUTTLOC(DUZ(2),0)),U)  ;AG*7.1*4 DIDN'T WANT SHORT NAME
 S AGRPTNAM="BENEFIT COORDINATOR PRODUCTIVITY REPORT"
 X ^%ZOSF("UCI") S AGUCI=Y
 D NOW^%DTC
 S Y=% X ^DD("DD")
 S AGRPTDT=Y
 S AGPAGE=0
 S $P(AGDASH,"-",81)=""
 Q
HDR ;
 S AGPAGE=AGPAGE+1
 W @IOF
 W AGUSER,?70,"Page ",AGPAGE
 W !,$$C^XBFUNC(AGLOC)
 W !,$$C^XBFUNC(AGRPTNAM)
 W !,$$C^XBFUNC("UCI: "_AGUCI)
 W !,$$C^XBFUNC("Report Date: "_AGRPTDT)
 S STR="Date range From "_AGBEGX_" to "_AGENDX
 ;W !,$$C^XBFUNC("Date range From "_AGBEGX) W " to ",AGENDX
 W !,$$C^XBFUNC(STR)
 Q
SUBHDR ;
 W !!
 W $S(AGRPTTYP="RECEIVER":"PERSON",1:"APPLICATION")
 ;IHS/OIT/NKD AG*7.1*11 ABBREVIATED COLUMN HEADERS TO FIT ADDITIONAL ENTRIES
 ;W ?36,"RE-",?53,"FOLLOWUP",?63,"ENTERED"
 W !
 W $S(AGRPTTYP="RECEIVER":"RECEIVING",1:"TYPE")
 ;IHS/OIT/NKD AG*7.1*11  ABBREVIATED COLUMN HEADERS TO FIT ADDITIONAL ENTRIES
 ;W ?14,"APPROVED",?24,"DENIED",?33,"SUBMITTED",?43,"REFUSED",?54,"NEEDED",?62,"IN ERROR",?72,"PENDING"
 W ?14,"APPROVED",?23,"DENIED",?30,"RESUB",?36,"REFUSED",?44,"FOLLOWUP",?53,"ERR",?57,"PENDING",?65,"OVERINC",?73,"SCREEN"
 W !,AGDASH
 W !
 Q
DEV ;
 K %ZIS,ZTSK
 S %ZIS="OPQ"
 D ^%ZIS
 Q:POP
 Q:'$D(IO("Q"))
 S ZTRTN="QUEUED^AGBENPRD",ZTDESC=AGRPTNAM
 S ZTSAVE("AG*")=""
 D ^%ZTLOAD
 Q