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

AGRPTPRV.m

Go to the documentation of this file.
AGRPTPRV ; IHS/ASDS/EFG - PRIVATE INSURANCE REPORT ;  
 ;;7.1;PATIENT REGISTRATION;**2**;JAN 31, 2007
 ;IHS/SD/TPF 4/12/2006 AG*7.1*2 ITEM 11 PAGE 11
 ;W !!,"SELECT A RANGE OF NAMES FOR WHICH YOU WOULD LIKE TO PRINT PRIVATE INSURANCE.",!,"ENTER THE BEGINNING AND ENDING NAMES AS THEY ARE REQUESTED."
 ;CC W !!,"START WITH WHAT PATIENT NAME? " D PTLK^AG
 ;G:'$D(DFN) END1 S AGBEG=$P(^DPT(DFN,0),U)
 ;D W !!,"END WITH WHAT PATIENT NAME? " D PTLK^AG
 ;G:'$D(DFN) END1 S AGEND=$P(^DPT(DFN,0),U) I AGBEG]AGEND W !!,*7,"THE ENDING NAME PRECEDES THE BEGINNING NAME." G CC
 ;BEGIN NEW CODE IHS/SD/TPF 4/12/2006 AG*7.1*2 ITEM 11 PAGE 11
PTS ;
 S $P(AG("="),"=",81)=""
 S $P(AG("-"),"-",81)=""
 S DIR(0)="S^B:ALL BENEFICIARIES;A:ACTIVE PATIENTS ONLY;D:DECEASED AND INACTIVE PATIENTS ONLY"
 S DIR("A")="SELECT DESIRED ACCOUNTS"
 D ^DIR K DIR
 S AGPTS=Y
 Q:$D(DTOUT)!(Y="^")!(Y="/.,")!(Y="^^")
 ;END NEW CODE IHS/SD/TPF 4/12/2006 AG*7.1*2 ITEM 11 PAGE 11
 S AGIO=IO,AG("HAT")=""
DEV S %ZIS="OPQ" D ^%ZIS I POP S IOP=ION D ^%ZIS Q
 G:'$D(IO("Q")) START K IO("Q") I $D(IO("S"))!($E(IOST)'="P") W *7,!,"Please queue to system printers." D ^%ZISC G DEV
 X ^%ZOSF("UCI") S ZTRTN="START^AGRPTPRV",ZTUCI=Y,ZTIO="",ZTDESC="PRIVATE INS. from "_AGBEG_" to "_AGEND_".",AGQIO=IO F G="AGBEG","AGEND","AGQIO" S ZTSAVE(G)=""
 D ^%ZTLOAD G:'$D(ZTSK) DEV K AG,AGBEG,AGEND,AGIO,AGQIO,G,ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTSK,ZTUCI D ^%ZISC
 Q
START ;EP - From TaskMan.
 ;K ^TMP($J) F I=0:0 S I=$O(^AUPNPRVT("B",I)) Q:+I'=I  Q:$G(^DPT(I,0))=""  I AGBEG']$P(^DPT(I,0),U),$P(^(0),U)']AGEND,$O(^AUPNPRVT(I,11,0)) S ^TMP($J,$P(^DPT(I,0),U),I)=""
 ;BEGIN NEW CODE IHS/SD/TPF 4/12/2006 AG*7.1*2 ITEM 11 PAGE 11
 S (DFN,AGTOT)=0 K ^TMP($J)
 F  S DFN=$O(^AUPNPRVT(DFN)) Q:+DFN<1  D
 .S AGFLAG=0
 .;if there is an HRN for this person and data in VA PATIENT
 .I $D(^AUPNPAT(DFN,41,DUZ(2))),$D(^DPT(DFN,0)) D
 ..I AGPTS="A" D   ;active people only
 ...I $P($G(^AUPNPAT(DFN,41,DUZ(2),0)),U,3)="",$P($G(^DPT(DFN,.35)),U)="" S AGFLAG=1
 ..I AGPTS="D" D   ;deceased/inactive only
 ...I $P($G(^AUPNPAT(DFN,41,DUZ(2),0)),U,3)'=""!($P($G(^DPT(DFN,.35)),U)'="") S AGFLAG=1
 ..I AGPTS="B" S AGFLAG=1
 ..I AGFLAG S ^TMP($J,$P(^DPT(DFN,0),U),DFN)="",AGTOT=AGTOT+1
 ;END NEW CODE  IHS/SD/TPF 4/12/2006 AG*7.1*2 ITEM 11 PAGE 11
 I $D(AGQIO) F AGZ("I")=1:1 S IOP=AGQIO D ^%ZIS Q:'POP  H 30
 S (AGPGPG,AGCONT)=0,AGNM=" ",X=$P(^DIC(4,DUZ(2),0),U) D CTR^AG S AG("LOC")=X,AG("USR")=$P(^VA(200,DUZ,0),U),AGBM=IOSL-10 I $D(AGIO),AGIO=IO S AGBM=IOSL-4
 ;X ^%ZOSF("UCI") S X="UCI: "_$P(Y,",") D CTR^AG S AGUCI=X,X="from "_AGBEG_" to "_AGEND D CTR^AG S AGTTL=X U IO D LINES^AG,NOW^AG S X=AGTIME D CTR^AG S AGTIME=X D HDR
 X ^%ZOSF("UCI") S X="UCI: "_$P(Y,",") S AGUCI=X D NOW^AG S AGTIME=Y S AGTTL="" ;IHS/SD/TPF 4/12/2006 AG*7.1*2 ITEM 11 PAGE 11
 F C=0:1 S AGNM=$O(^TMP($J,AGNM)) G:AGNM="" END D NAME G END1:$D(DUOUT)!$D(DFOUT)!$D(DTOUT) I $Y>AGBM D RTRN^AG G END1:$D(DUOUT)!$D(DFOUT)!$D(DTOUT) D HDR
NAME F DFN=0:0 S DFN=$O(^TMP($J,AGNM,DFN)) Q:'DFN  D HDR W !,$P(^DPT(DFN,0),U) S A=0 D PT,FAC Q:$D(DUOUT)!$D(DFOUT)!$D(DTOUT)
 Q
PT S A=$O(^AUPNPRVT(DFN,11,A)) Q:+A'=A  S AGINS=^(A,0) G PT:$P(AGINS,U)="",PT:'$D(^AUTNINS($P(AGINS,U),0)) S AGCO=$P(^(0),U) I $Y>AGBM D RTRN^AG Q:$D(DUOUT)!$D(DFOUT)!$D(DTOUT)  S AGCONT=1 D HDR
 W !?5,AGCO,?36,$P(AGINS,U,2),!?5,$P(AGINS,U,4)
 I $P(AGINS,U,5)]"",$D(^AUTTRLSH($P(AGINS,U,5),0)) W ?36,$E($P(^(0),U),1,12)
 S Y=$P(AGINS,U,6) D DD^%DT W ?53,Y S Y=$P(AGINS,U,7) D DD^%DT W ?67,Y,!
 I $P(AGINS,U,3) W ?5,$P(^AUTTPIC($P(AGINS,U,3),0),U)
 S ^TMP($J,0,AGCO)=$S($D(^TMP($J,0,AGCO)):^(AGCO)+1,1:1)
 G PT
FAC F I=0:0 S I=$O(^AUPNPAT(DFN,41,I)) Q:+I'=I  S R=^(I,0) W !?20,$J($P(R,U,2),6),?30,$P(^DIC(4,$P(R,U),0),U) W:'$O(^AUPNPAT(DFN,41,I)) !,AG("-"),! I $Y>AGBM D RTRN^AG Q:$D(DUOUT)!$D(DFOUT)!$D(DTOUT)  S:$O(^AUPNPAT(DFN,41,I)) AGCONT=1 D HDR
 Q
END D RTRN^AG,HDR W !!,"PATIENTS WITH PRIVATE INSURANCE : ",C,!! S T=0,AGCO="" F I=0:0 S AGCO=$O(^TMP($J,0,AGCO)) Q:AGCO=""  W !?5,AGCO,$E("........................................",1,40-$X-($L(^(AGCO)))),^(AGCO) S T=T+^(AGCO)
 W !?31,"==========",!?35,$J(T,5) K AG("HAT") D RTRN^AG W $$S^AGVDF("IOF")
END1 D ^%ZISC K ^TMP($J),A,AG,AGBEG,AGBM,AGEND,AGIO,AGTIME,C,AGCO,AGCONT,DA,AG("DENT"),DFN,DIC,DLOUT,DR,G,AGL,I,AGINS,AG("LKERR"),AG("LKDATA"),AG("LKPRINT"),AG("LOC"),AGNM,AGPCC,AGPGPG,R,AGTTL,AGUCI,AG("USR"),X,Y D:$D(ZTQUEUED) KILL^%ZTLOAD
 Q
HDR S AGPGPG=AGPGPG+1
 W $$S^AGVDF("IOF"),AG("USR"),?70,"page ",AGPGPG
 W !,AG("LOC"),!?31,"PRIVATE INSURANCE"
 S X=AGUCI D CTR^AG W !,X
 S X=AGTIME D CTR^AG W !,X
 W !!?17,"REPORT CONTAINS "_$S(AGPTS="B":"ALL BENEFICIARIES",AGPTS="A":"ACTIVE PATIENTS ONLY",AGPTS="D":"DECEASED AND INACTIVE PATIENTS ONLY")  ;IHS/SD/TPF 4/12/2006 AG*7.1*2 ITEM 11 PAGE 11
 W !!!?5,"COMPANY",?36,"POLICY NUMBER",!?5,"NAME OF INSURED",?36,"RELATIONSHIP",?53,"FROM",?67,"TO",!?5,"COVERAGE",!?21,"CHART   SITE",!,AG("="),!
 I AGCONT W !,$P(^DPT(DFN,0),U)," (cont.)" S AGCONT=0
 Q