BQIMUFCH ;VNGT/HS/ALA-Hospital Hover Help ; 06 May 2011 8:17 AM
;;2.3;ICARE MANAGEMENT SYSTEM;**3,4**;Apr 18, 2012;Build 66
;
;
EN(DATA,REPORT,TMFRAME,PERIOD) ; EP -- BQI MU GET FACILITY HOVER
NEW UID,II,HDR,C1,C2,C3,C4,NAME,HEAD,HX,PEC,SORT,QFL,PCT,CT,DDATA
S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
S DATA=$NA(^TMP("BQIMUFCPH",UID))
K @DATA
S II=0
NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIMUFCH D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
S TMFRAME=$G(TMFRAME,90),REPORT=$G(REPORT,"")
S HDR="T00050HIDE_FACILITY^T00020HIDE_ID^T00050OBJECTIVE^T00010MEAS_SET^T00005CURR_DEN^T00005CURR_NUM^T00005CURR_MET^T00010STAGE_1_GOAL^"
S HDR=HDR_"T00005PREV_DEN^T00005PREV_NUM^T00005PREV_MET^T00030HIDE_CURR_PERIOD^T00030HIDE_PREV_PERIOD"
S @DATA@(II)=HDR_$C(30)
D GTM^BQIMUTIM
S FAC=$$HME^BQIGPUTL() D RTE(FAC)
;
DONE ;
S II=II+1,@DATA@(II)=$C(31)
Q
;
ERR ;
D ^%ZTER
NEW Y,ERRDTM
S Y=$$NOW^XLFDT() X ^DD("DD") S ERRDTM=Y
S BMXSEC="Recording that an error occurred at "_ERRDTM
I $D(II),$D(DATA) S II=II+1,@DATA@(II)=$C(31)
Q
;
RTE(FAC) ; EP
NEW DATE,MN,MDATA,PRVR,CFROM,CTHRU,PFROM,PTHRU,IDN,CDEN,CNUM,CEXC,PDEN
NEW PNUM,PEXC,CURR,PREV,PDATA,CDATA,BQZZ,ST1G,MSET,ID,FACIL,PGLOB
;S FACIL=FAC_$C(28)_$P(^DIC(4,FAC,0),U,1)
S FACIL=$P(^DIC(4,FAC,0),U,1)
S PGLOB=$$PRFPGL^BQIMUTAB(REPORT)
;
S PN=0
F S PN=$O(@PGLOB@(PN)) Q:'PN D
. S ID=$P(@PGLOB@(PN,0),U,1) I $P(@PGLOB@(PN,0),U,2)'="H" Q
. I $P(@PGLOB@(PN,0),U,6)="A" Q
. S BQZZ(ID,"C")="NDA",BQZZ(ID,"P")="NDA"
;
S CRDT=""
F S CRDT=$O(BQCDAR(CRDT)) Q:CRDT="" D
. S CQN=$O(^BQIFAC(FAC,40,"B",CRDT,""))
. D CPAGG
;
S PRDT=""
F S PRDT=$O(BQPDAR(PRDT)) Q:PRDT="" D
. S PQN=$O(^BQIFAC(FAC,40,"B",PRDT,""))
. D PPAGG
;
S ID=""
F S ID=$O(BQZZ(ID)) Q:ID="" D
. S IMN=$O(@PGLOB@("B",ID,"")) I IMN="" Q
. S ST1G=$G(@PGLOB@(IMN,13,1,0)),OBJ=$P(@PGLOB@(IMN,0),U,5)
. S MSET=$$GET1^DIQ(9001300.02,IMN_",",.03,"E")
. S CDEN=$P($G(BQZZ(ID,"C")),U,1)
. S CNUM=$P($G(BQZZ(ID,"C")),U,2)
. S CEXC=$P($G(BQZZ(ID,"C")),U,3)
. ;
. S PDEN=$P($G(BQZZ(ID,"P")),U,1)
. S PNUM=$P($G(BQZZ(ID,"P")),U,2)
. S PEXC=$P($G(BQZZ(ID,"P")),U,3)
. ;
. I +CDEN=0,+CNUM=0 S CURR=""
. I +PDEN=0,+PNUM=0 S PREV=""
. I +CDEN'=0,+CNUM=0 S CURR=""
. I +PDEN'=0,+PNUM=0 S PREV=""
. I +CDEN'=0,+CNUM'=0 S CURR=""
. I +PDEN'=0,+PNUM'=0 S PREV=""
. I CURR="" S CURR="N/A"
. I PREV="" S PREV="N/A"
. I CEXC'="" S CURR=CEXC
. I PEXC'="" S PREV=PEXC
. S:CNUM="" CNUM=0 S:PNUM="" PNUM=0 S:CDEN="" CDEN=0 S:PDEN="" PDEN=0
. S II=II+1,@DATA@(II)=FACIL_U_ID_U_OBJ_U_MSET_U_CDEN_U_CNUM_U_CURR_U_ST1G_U_PDEN_U_PNUM_U_PREV_U_CPER_U_PPER_$C(30)
K BQZZ
Q
;
CQ(DATA,TMFRAME,PERIOD) ; EP -- BQI MU GET FAC CQ HOVER
NEW UID,II,HDR,C1,C2,C3,C4,NAME,HEAD,HX,PEC,SORT,QFL,PCT,CT,DDATA
S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
S DATA=$NA(^TMP("BQIMUFCQH",UID))
K @DATA
S II=0
NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIMUFCH D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
S TMFRAME=$G(TMFRAME,90)
S HDR="T00050HIDE_FACILITY^T00020HIDE_ID^T00050OBJECTIVE^T00010MEAS_SET^T00005CURR_DEN^T00005CURR_NUM^T00005CURR_MET^T00010STAGE_1_GOAL^"
S HDR=HDR_"T00005PREV_DEN^T00005PREV_NUM^T00005PREV_MET^T00030HIDE_CURR_PERIOD^T00030HIDE_PREV_PERIOD"
S @DATA@(II)=HDR_$C(30)
;
D GTM^BQIMUTIM
;
S FAC=$$HME^BQIGPUTL() D RET(FAC)
S II=II+1,@DATA@(II)=$C(31)
Q
;
RET(FAC) ; EP
NEW DATE,MN,MDATA,PRVR,CFROM,CTHRU,PFROM,PTHRU,IDN,CDEN,CNUM,CEXC,PDEN
NEW PNUM,PEXC,CURR,PREV,PDATA,CDATA,BQZZ,ST1G,MSET,ID,FACIL
;S FACIL=FAC_$C(28)_$P(^DIC(4,FAC,0),U,1)
S FACIL=$P(^DIC(4,FAC,0),U,1)
;
S X=0 F S X=$O(^BGPMUIND(90595.11,"AMS","H",X)) Q:X'=+X S BGPIND(X)=""
S I="" F S I=$O(BGPIND(I)) Q:I="" D
. S BN="" F S BN=$O(^BGPMUIND(90596.11,"B",I,BN)) Q:BN="" D
.. S ID=$P(^BGPMUIND(90596.11,BN,0),U,4),BQZZ(ID,"C")="NDA",BQZZ(ID,"P")="NDA"
;
S CRDT=""
F S CRDT=$O(BQCDAR(CRDT)) Q:CRDT="" D
. S CQN=$O(^BQIFAC(FAC,50,"B",CRDT,""))
. D CAGG
;
S PRDT=""
F S PRDT=$O(BQPDAR(PRDT)) Q:PRDT="" D
. S PQN=$O(^BQIFAC(FAC,50,"B",PRDT,""))
. D PAGG
;
S ID=""
F S ID=$O(BQZZ(ID)) Q:ID="" D
. S IMN=$O(^BGPMUIND(90596.11,"C",ID,"")) I IMN="" Q
. S ST1G="",OBJ=$P($G(^BGPMUIND(90596.11,IMN,17)),U,3)
. S MSN=$P(^BGPMUIND(90596.11,IMN,0),U,1)
. I $P(^BGPMUIND(90595.11,MSN,0),U,4)'="H" Q
. S MSET="HOSPITAL"
. ;
. S CDEN=$P($G(BQZZ(ID,"C")),U,1)
. S CNUM=$P($G(BQZZ(ID,"C")),U,2)
. S CEXC=$P($G(BQZZ(ID,"C")),U,3)
. ;
. S PDEN=$P($G(BQZZ(ID,"P")),U,1)
. S PNUM=$P($G(BQZZ(ID,"P")),U,2)
. S PEXC=$P($G(BQZZ(ID,"P")),U,3)
. ;
. I ID[".ED." D
.. S CURR=""
.. I CDEN'="" S CURR=""
.. S PREV=""
.. I PDEN'="" S PREV=""
. I ID'[".ED." D
.. I +CDEN=0,+CNUM=0 S CURR=""
.. I +CDEN'=0,+CNUM=0 S CURR=""
.. I +CDEN'=0,+CNUM'=0,(CDEN-CEXC)=0 S CURR=""
.. I +CDEN'=0,+CNUM'=0,(CDEN-CEXC)'=0 S CURR=""
.. S:CNUM="" CNUM=0 S:CDEN="" CDEN=0
.. I +PDEN=0,+PNUM=0 S PREV=""
.. I +PDEN'=0,+PNUM=0 S PREV=""
.. I +PDEN'=0,+PNUM'=0,(PDEN-PEXC)=0 S PREV=""
.. I +PDEN'=0,+PNUM'=0,(PDEN-PEXC)'=0 S PREV=""
. S II=II+1,@DATA@(II)=FACIL_U_ID_U_OBJ_U_MSET_U_CDEN_U_CNUM_U_CURR_U_ST1G_U_PDEN_U_PNUM_U_PREV_U_CPER_U_PPER_$C(30)
K BQZZ
Q
;
CAGG ; Aggregate
;
I CQN="" Q
S IDN=0
F S IDN=$O(^BQIFAC(FAC,50,CQN,1,IDN)) Q:'IDN D
. S (CDEN,CNUM,CEXC,CURR)=""
. S CDATA=^BQIFAC(FAC,50,CQN,1,IDN,0)
. S CDEN=$P(CDATA,U,2),CNUM=$P(CDATA,U,3),CEXC=$P(CDATA,U,4)
. S ID=$P(CDATA,U,1)
. S $P(BQZZ(ID,"C"),U,1)=$P($G(BQZZ(ID,"C")),U,1)+CDEN
. S $P(BQZZ(ID,"C"),U,2)=$P($G(BQZZ(ID,"C")),U,2)+CNUM
. S $P(BQZZ(ID,"C"),U,3)=$P($G(BQZZ(ID,"C")),U,3)+CEXC
Q
;
PAGG ; Aggregate
I PQN="" Q
S IDN=0
F S IDN=$O(^BQIFAC(FAC,50,PQN,1,IDN)) Q:'IDN D
. S (PDEN,PNUM,PEXC,PREV)=""
. S PDATA=^BQIFAC(FAC,50,PQN,1,IDN,0)
. S PDEN=$P(PDATA,U,2),PNUM=$P(PDATA,U,3),PEXC=$P(PDATA,U,4)
. S ID=$P(PDATA,U,1)
. ;
. I +PNUM=0 S PREV=0
. I +PDEN'=0,+PNUM'=0 S PREV=$J((PNUM/PDEN)*100,3,0),PREV=$$TRIM^BQIUL1(PREV," ")
. I PDEN="",PNUM="",PEXC'="" S PREV="Excluded"
. I PDEN="",PNUM="",PEXC="" S PREV=""
. S $P(BQZZ(ID,"P"),U,1)=$P($G(BQZZ(ID,"P")),U,1)+PDEN
. S $P(BQZZ(ID,"P"),U,2)=$P($G(BQZZ(ID,"P")),U,2)+PNUM
. S $P(BQZZ(ID,"P"),U,3)=$P($G(BQZZ(ID,"P")),U,3)+PEXC
Q
;
CPAGG ; Aggregate performance
I CQN="" Q
S IDN=0
F S IDN=$O(^BQIFAC(FAC,40,CQN,1,IDN)) Q:'IDN D
. S (CDEN,CNUM,CEXC,CURR)=""
. S CDATA=^BQIFAC(FAC,40,CQN,1,IDN,0)
. S CDEN=$P(CDATA,U,2),CNUM=$P(CDATA,U,3)
. S CEXC=$G(^BQIFAC(FAC,40,CQN,1,IDN,1))
. S ID=$P(CDATA,U,1)
. S $P(BQZZ(ID,"C"),U,1)=$P($G(BQZZ(ID,"C")),U,1)+CDEN
. S $P(BQZZ(ID,"C"),U,2)=$P($G(BQZZ(ID,"C")),U,2)+CNUM
. S $P(BQZZ(ID,"C"),U,3)=CEXC
Q
;
PPAGG ;
I PQN="" Q
S IDN=0
F S IDN=$O(^BQIFAC(FAC,40,PQN,1,IDN)) Q:'IDN D
. S (PDEN,PNUM,PEXC,PREV)=""
. S PDATA=^BQIFAC(FAC,40,PQN,1,IDN,0)
. S PDEN=$P(PDATA,U,2),PNUM=$P(PDATA,U,3)
. S PEXC=$G(^BQIFAC(FAC,40,PQN,1,IDN,1))
. S ID=$P(PDATA,U,1)
. ;
. I +PNUM=0 S PREV=0
. I +PDEN'=0,+PNUM'=0 S PREV=$J((PNUM/PDEN)*100,3,0),PREV=$$TRIM^BQIUL1(PREV," ")
. I PDEN="",PNUM="",PEXC'="" S PREV="Excluded"
. I PDEN="",PNUM="",PEXC="" S PREV=""
. S $P(BQZZ(ID,"P"),U,1)=$P($G(BQZZ(ID,"P")),U,1)+PDEN
. S $P(BQZZ(ID,"P"),U,2)=$P($G(BQZZ(ID,"P")),U,2)+PNUM
. S $P(BQZZ(ID,"P"),U,3)=PEXC
Q
BQIMUFCH ;VNGT/HS/ALA-Hospital Hover Help ; 06 May 2011 8:17 AM
+1 ;;2.3;ICARE MANAGEMENT SYSTEM;**3,4**;Apr 18, 2012;Build 66
+2 ;
+3 ;
EN(DATA,REPORT,TMFRAME,PERIOD) ; EP -- BQI MU GET FACILITY HOVER
+1 NEW UID,II,HDR,C1,C2,C3,C4,NAME,HEAD,HX,PEC,SORT,QFL,PCT,CT,DDATA
+2 SET UID=$SELECT($GET(ZTSK):"Z"_ZTSK,1:$JOB)
+3 SET DATA=$NAME(^TMP("BQIMUFCPH",UID))
+4 KILL @DATA
+5 SET II=0
+6 ; SAC 2006 2.2.3.3.2
NEW $ESTACK,$ETRAP
SET $ETRAP="D ERR^BQIMUFCH D UNWIND^%ZTER"
+7 SET TMFRAME=$GET(TMFRAME,90)
SET REPORT=$GET(REPORT,"")
+8 SET HDR="T00050HIDE_FACILITY^T00020HIDE_ID^T00050OBJECTIVE^T00010MEAS_SET^T00005CURR_DEN^T00005CURR_NUM^T00005CURR_MET^T00010STAGE_1_GOAL^"
+9 SET HDR=HDR_"T00005PREV_DEN^T00005PREV_NUM^T00005PREV_MET^T00030HIDE_CURR_PERIOD^T00030HIDE_PREV_PERIOD"
+10 SET @DATA@(II)=HDR_$CHAR(30)
+11 DO GTM^BQIMUTIM
+12 SET FAC=$$HME^BQIGPUTL()
DO RTE(FAC)
+13 ;
DONE ;
+1 SET II=II+1
SET @DATA@(II)=$CHAR(31)
+2 QUIT
+3 ;
ERR ;
+1 DO ^%ZTER
+2 NEW Y,ERRDTM
+3 SET Y=$$NOW^XLFDT()
XECUTE ^DD("DD")
SET ERRDTM=Y
+4 SET BMXSEC="Recording that an error occurred at "_ERRDTM
+5 IF $DATA(II)
IF $DATA(DATA)
SET II=II+1
SET @DATA@(II)=$CHAR(31)
+6 QUIT
+7 ;
RTE(FAC) ; EP
+1 NEW DATE,MN,MDATA,PRVR,CFROM,CTHRU,PFROM,PTHRU,IDN,CDEN,CNUM,CEXC,PDEN
+2 NEW PNUM,PEXC,CURR,PREV,PDATA,CDATA,BQZZ,ST1G,MSET,ID,FACIL,PGLOB
+3 ;S FACIL=FAC_$C(28)_$P(^DIC(4,FAC,0),U,1)
+4 SET FACIL=$PIECE(^DIC(4,FAC,0),U,1)
+5 SET PGLOB=$$PRFPGL^BQIMUTAB(REPORT)
+6 ;
+7 SET PN=0
+8 FOR
SET PN=$ORDER(@PGLOB@(PN))
IF 'PN
QUIT
Begin DoDot:1
+9 SET ID=$PIECE(@PGLOB@(PN,0),U,1)
IF $PIECE(@PGLOB@(PN,0),U,2)'="H"
QUIT
+10 IF $PIECE(@PGLOB@(PN,0),U,6)="A"
QUIT
+11 SET BQZZ(ID,"C")="NDA"
SET BQZZ(ID,"P")="NDA"
End DoDot:1
+12 ;
+13 SET CRDT=""
+14 FOR
SET CRDT=$ORDER(BQCDAR(CRDT))
IF CRDT=""
QUIT
Begin DoDot:1
+15 SET CQN=$ORDER(^BQIFAC(FAC,40,"B",CRDT,""))
+16 DO CPAGG
End DoDot:1
+17 ;
+18 SET PRDT=""
+19 FOR
SET PRDT=$ORDER(BQPDAR(PRDT))
IF PRDT=""
QUIT
Begin DoDot:1
+20 SET PQN=$ORDER(^BQIFAC(FAC,40,"B",PRDT,""))
+21 DO PPAGG
End DoDot:1
+22 ;
+23 SET ID=""
+24 FOR
SET ID=$ORDER(BQZZ(ID))
IF ID=""
QUIT
Begin DoDot:1
+25 SET IMN=$ORDER(@PGLOB@("B",ID,""))
IF IMN=""
QUIT
+26 SET ST1G=$GET(@PGLOB@(IMN,13,1,0))
SET OBJ=$PIECE(@PGLOB@(IMN,0),U,5)
+27 SET MSET=$$GET1^DIQ(9001300.02,IMN_",",.03,"E")
+28 SET CDEN=$PIECE($GET(BQZZ(ID,"C")),U,1)
+29 SET CNUM=$PIECE($GET(BQZZ(ID,"C")),U,2)
+30 SET CEXC=$PIECE($GET(BQZZ(ID,"C")),U,3)
+31 ;
+32 SET PDEN=$PIECE($GET(BQZZ(ID,"P")),U,1)
+33 SET PNUM=$PIECE($GET(BQZZ(ID,"P")),U,2)
+34 SET PEXC=$PIECE($GET(BQZZ(ID,"P")),U,3)
+35 ;
+36 IF +CDEN=0
IF +CNUM=0
SET CURR=""
+37 IF +PDEN=0
IF +PNUM=0
SET PREV=""
+38 IF +CDEN'=0
IF +CNUM=0
SET CURR=""
+39 IF +PDEN'=0
IF +PNUM=0
SET PREV=""
+40 IF +CDEN'=0
IF +CNUM'=0
SET CURR=""
+41 IF +PDEN'=0
IF +PNUM'=0
SET PREV=""
+42 IF CURR=""
SET CURR="N/A"
+43 IF PREV=""
SET PREV="N/A"
+44 IF CEXC'=""
SET CURR=CEXC
+45 IF PEXC'=""
SET PREV=PEXC
+46 IF CNUM=""
SET CNUM=0
IF PNUM=""
SET PNUM=0
IF CDEN=""
SET CDEN=0
IF PDEN=""
SET PDEN=0
+47 SET II=II+1
SET @DATA@(II)=FACIL_U_ID_U_OBJ_U_MSET_U_CDEN_U_CNUM_U_CURR_U_ST1G_U_PDEN_U_PNUM_U_PREV_U_CPER_U_PPER_$CHAR(30)
End DoDot:1
+48 KILL BQZZ
+49 QUIT
+50 ;
CQ(DATA,TMFRAME,PERIOD) ; EP -- BQI MU GET FAC CQ HOVER
+1 NEW UID,II,HDR,C1,C2,C3,C4,NAME,HEAD,HX,PEC,SORT,QFL,PCT,CT,DDATA
+2 SET UID=$SELECT($GET(ZTSK):"Z"_ZTSK,1:$JOB)
+3 SET DATA=$NAME(^TMP("BQIMUFCQH",UID))
+4 KILL @DATA
+5 SET II=0
+6 ; SAC 2006 2.2.3.3.2
NEW $ESTACK,$ETRAP
SET $ETRAP="D ERR^BQIMUFCH D UNWIND^%ZTER"
+7 SET TMFRAME=$GET(TMFRAME,90)
+8 SET HDR="T00050HIDE_FACILITY^T00020HIDE_ID^T00050OBJECTIVE^T00010MEAS_SET^T00005CURR_DEN^T00005CURR_NUM^T00005CURR_MET^T00010STAGE_1_GOAL^"
+9 SET HDR=HDR_"T00005PREV_DEN^T00005PREV_NUM^T00005PREV_MET^T00030HIDE_CURR_PERIOD^T00030HIDE_PREV_PERIOD"
+10 SET @DATA@(II)=HDR_$CHAR(30)
+11 ;
+12 DO GTM^BQIMUTIM
+13 ;
+14 SET FAC=$$HME^BQIGPUTL()
DO RET(FAC)
+15 SET II=II+1
SET @DATA@(II)=$CHAR(31)
+16 QUIT
+17 ;
RET(FAC) ; EP
+1 NEW DATE,MN,MDATA,PRVR,CFROM,CTHRU,PFROM,PTHRU,IDN,CDEN,CNUM,CEXC,PDEN
+2 NEW PNUM,PEXC,CURR,PREV,PDATA,CDATA,BQZZ,ST1G,MSET,ID,FACIL
+3 ;S FACIL=FAC_$C(28)_$P(^DIC(4,FAC,0),U,1)
+4 SET FACIL=$PIECE(^DIC(4,FAC,0),U,1)
+5 ;
+6 SET X=0
FOR
SET X=$ORDER(^BGPMUIND(90595.11,"AMS","H",X))
IF X'=+X
QUIT
SET BGPIND(X)=""
+7 SET I=""
FOR
SET I=$ORDER(BGPIND(I))
IF I=""
QUIT
Begin DoDot:1
+8 SET BN=""
FOR
SET BN=$ORDER(^BGPMUIND(90596.11,"B",I,BN))
IF BN=""
QUIT
Begin DoDot:2
+9 SET ID=$PIECE(^BGPMUIND(90596.11,BN,0),U,4)
SET BQZZ(ID,"C")="NDA"
SET BQZZ(ID,"P")="NDA"
End DoDot:2
End DoDot:1
+10 ;
+11 SET CRDT=""
+12 FOR
SET CRDT=$ORDER(BQCDAR(CRDT))
IF CRDT=""
QUIT
Begin DoDot:1
+13 SET CQN=$ORDER(^BQIFAC(FAC,50,"B",CRDT,""))
+14 DO CAGG
End DoDot:1
+15 ;
+16 SET PRDT=""
+17 FOR
SET PRDT=$ORDER(BQPDAR(PRDT))
IF PRDT=""
QUIT
Begin DoDot:1
+18 SET PQN=$ORDER(^BQIFAC(FAC,50,"B",PRDT,""))
+19 DO PAGG
End DoDot:1
+20 ;
+21 SET ID=""
+22 FOR
SET ID=$ORDER(BQZZ(ID))
IF ID=""
QUIT
Begin DoDot:1
+23 SET IMN=$ORDER(^BGPMUIND(90596.11,"C",ID,""))
IF IMN=""
QUIT
+24 SET ST1G=""
SET OBJ=$PIECE($GET(^BGPMUIND(90596.11,IMN,17)),U,3)
+25 SET MSN=$PIECE(^BGPMUIND(90596.11,IMN,0),U,1)
+26 IF $PIECE(^BGPMUIND(90595.11,MSN,0),U,4)'="H"
QUIT
+27 SET MSET="HOSPITAL"
+28 ;
+29 SET CDEN=$PIECE($GET(BQZZ(ID,"C")),U,1)
+30 SET CNUM=$PIECE($GET(BQZZ(ID,"C")),U,2)
+31 SET CEXC=$PIECE($GET(BQZZ(ID,"C")),U,3)
+32 ;
+33 SET PDEN=$PIECE($GET(BQZZ(ID,"P")),U,1)
+34 SET PNUM=$PIECE($GET(BQZZ(ID,"P")),U,2)
+35 SET PEXC=$PIECE($GET(BQZZ(ID,"P")),U,3)
+36 ;
+37 IF ID[".ED."
Begin DoDot:2
+38 SET CURR=""
+39 IF CDEN'=""
SET CURR=""
+40 SET PREV=""
+41 IF PDEN'=""
SET PREV=""
End DoDot:2
+42 IF ID'[".ED."
Begin DoDot:2
+43 IF +CDEN=0
IF +CNUM=0
SET CURR=""
+44 IF +CDEN'=0
IF +CNUM=0
SET CURR=""
+45 IF +CDEN'=0
IF +CNUM'=0
IF (CDEN-CEXC)=0
SET CURR=""
+46 IF +CDEN'=0
IF +CNUM'=0
IF (CDEN-CEXC)'=0
SET CURR=""
+47 IF CNUM=""
SET CNUM=0
IF CDEN=""
SET CDEN=0
+48 IF +PDEN=0
IF +PNUM=0
SET PREV=""
+49 IF +PDEN'=0
IF +PNUM=0
SET PREV=""
+50 IF +PDEN'=0
IF +PNUM'=0
IF (PDEN-PEXC)=0
SET PREV=""
+51 IF +PDEN'=0
IF +PNUM'=0
IF (PDEN-PEXC)'=0
SET PREV=""
End DoDot:2
+52 SET II=II+1
SET @DATA@(II)=FACIL_U_ID_U_OBJ_U_MSET_U_CDEN_U_CNUM_U_CURR_U_ST1G_U_PDEN_U_PNUM_U_PREV_U_CPER_U_PPER_$CHAR(30)
End DoDot:1
+53 KILL BQZZ
+54 QUIT
+55 ;
CAGG ; Aggregate
+1 ;
+2 IF CQN=""
QUIT
+3 SET IDN=0
+4 FOR
SET IDN=$ORDER(^BQIFAC(FAC,50,CQN,1,IDN))
IF 'IDN
QUIT
Begin DoDot:1
+5 SET (CDEN,CNUM,CEXC,CURR)=""
+6 SET CDATA=^BQIFAC(FAC,50,CQN,1,IDN,0)
+7 SET CDEN=$PIECE(CDATA,U,2)
SET CNUM=$PIECE(CDATA,U,3)
SET CEXC=$PIECE(CDATA,U,4)
+8 SET ID=$PIECE(CDATA,U,1)
+9 SET $PIECE(BQZZ(ID,"C"),U,1)=$PIECE($GET(BQZZ(ID,"C")),U,1)+CDEN
+10 SET $PIECE(BQZZ(ID,"C"),U,2)=$PIECE($GET(BQZZ(ID,"C")),U,2)+CNUM
+11 SET $PIECE(BQZZ(ID,"C"),U,3)=$PIECE($GET(BQZZ(ID,"C")),U,3)+CEXC
End DoDot:1
+12 QUIT
+13 ;
PAGG ; Aggregate
+1 IF PQN=""
QUIT
+2 SET IDN=0
+3 FOR
SET IDN=$ORDER(^BQIFAC(FAC,50,PQN,1,IDN))
IF 'IDN
QUIT
Begin DoDot:1
+4 SET (PDEN,PNUM,PEXC,PREV)=""
+5 SET PDATA=^BQIFAC(FAC,50,PQN,1,IDN,0)
+6 SET PDEN=$PIECE(PDATA,U,2)
SET PNUM=$PIECE(PDATA,U,3)
SET PEXC=$PIECE(PDATA,U,4)
+7 SET ID=$PIECE(PDATA,U,1)
+8 ;
+9 IF +PNUM=0
SET PREV=0
+10 IF +PDEN'=0
IF +PNUM'=0
SET PREV=$JUSTIFY((PNUM/PDEN)*100,3,0)
SET PREV=$$TRIM^BQIUL1(PREV," ")
+11 IF PDEN=""
IF PNUM=""
IF PEXC'=""
SET PREV="Excluded"
+12 IF PDEN=""
IF PNUM=""
IF PEXC=""
SET PREV=""
+13 SET $PIECE(BQZZ(ID,"P"),U,1)=$PIECE($GET(BQZZ(ID,"P")),U,1)+PDEN
+14 SET $PIECE(BQZZ(ID,"P"),U,2)=$PIECE($GET(BQZZ(ID,"P")),U,2)+PNUM
+15 SET $PIECE(BQZZ(ID,"P"),U,3)=$PIECE($GET(BQZZ(ID,"P")),U,3)+PEXC
End DoDot:1
+16 QUIT
+17 ;
CPAGG ; Aggregate performance
+1 IF CQN=""
QUIT
+2 SET IDN=0
+3 FOR
SET IDN=$ORDER(^BQIFAC(FAC,40,CQN,1,IDN))
IF 'IDN
QUIT
Begin DoDot:1
+4 SET (CDEN,CNUM,CEXC,CURR)=""
+5 SET CDATA=^BQIFAC(FAC,40,CQN,1,IDN,0)
+6 SET CDEN=$PIECE(CDATA,U,2)
SET CNUM=$PIECE(CDATA,U,3)
+7 SET CEXC=$GET(^BQIFAC(FAC,40,CQN,1,IDN,1))
+8 SET ID=$PIECE(CDATA,U,1)
+9 SET $PIECE(BQZZ(ID,"C"),U,1)=$PIECE($GET(BQZZ(ID,"C")),U,1)+CDEN
+10 SET $PIECE(BQZZ(ID,"C"),U,2)=$PIECE($GET(BQZZ(ID,"C")),U,2)+CNUM
+11 SET $PIECE(BQZZ(ID,"C"),U,3)=CEXC
End DoDot:1
+12 QUIT
+13 ;
PPAGG ;
+1 IF PQN=""
QUIT
+2 SET IDN=0
+3 FOR
SET IDN=$ORDER(^BQIFAC(FAC,40,PQN,1,IDN))
IF 'IDN
QUIT
Begin DoDot:1
+4 SET (PDEN,PNUM,PEXC,PREV)=""
+5 SET PDATA=^BQIFAC(FAC,40,PQN,1,IDN,0)
+6 SET PDEN=$PIECE(PDATA,U,2)
SET PNUM=$PIECE(PDATA,U,3)
+7 SET PEXC=$GET(^BQIFAC(FAC,40,PQN,1,IDN,1))
+8 SET ID=$PIECE(PDATA,U,1)
+9 ;
+10 IF +PNUM=0
SET PREV=0
+11 IF +PDEN'=0
IF +PNUM'=0
SET PREV=$JUSTIFY((PNUM/PDEN)*100,3,0)
SET PREV=$$TRIM^BQIUL1(PREV," ")
+12 IF PDEN=""
IF PNUM=""
IF PEXC'=""
SET PREV="Excluded"
+13 IF PDEN=""
IF PNUM=""
IF PEXC=""
SET PREV=""
+14 SET $PIECE(BQZZ(ID,"P"),U,1)=$PIECE($GET(BQZZ(ID,"P")),U,1)+PDEN
+15 SET $PIECE(BQZZ(ID,"P"),U,2)=$PIECE($GET(BQZZ(ID,"P")),U,2)+PNUM
+16 SET $PIECE(BQZZ(ID,"P"),U,3)=PEXC
End DoDot:1
+17 QUIT