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

ABMUCPR.m

Go to the documentation of this file.
  1. ABMUCPR ; IHS/SD/SDR - UFMS Cashiering Session Productivity Report ;
  1. ;;2.6;IHS Third Party Billing;**1,11**;NOV 12, 2009;Build 133
  1. ;
  1. ; IHS/SD/SDR - abm*2.6*1 - NO HEAT - Added averages and fixed
  1. ; "^" out of report
  1. ; IHS/SD/SDR - abm*2.6*11 - adde V to list of codes
  1. ;
  1. K ABM,ABMY
  1. S ABM("HD",0)="Cashiering Session Productivity Report"
  1. S ABM("POS")=1
  1. S ABM("SSTAT","A")=""
  1. S $P(ABMDASH,"=",79)="="
  1. ; start new code abm*2.6*1 NOHEAT
  1. W !!!?5,"This report will only look at closed or transmitted/reconciled sessions."
  1. W !?5,"All open/reopened sessions will be ignored."
  1. ;end new code abm*2.6*1
  1. ;
  1. SEL ;
  1. S ABM("NODX")="" D ^ABMURSEL Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)
  1. D ^ABMURHD
  1. S ABMQ("RC")="COMPUTE^ABMUCPR"
  1. S ABMQ("RX")="POUT^ABMDRUTL"
  1. S ABMQ("NS")="ABM"
  1. S ABMQ("RP")="PRINT^ABMUCPR"
  1. D ^ABMDRDBQ
  1. Q ;abm*2.6*11
  1. ;
  1. COMPUTE ;EP - Entry Point for Setting up Data
  1. S ABM("SUBR")="ABM-UCR" K ^TMP("ABM-UCR",$J)
  1. S ABM("PG")=0
  1. LOOP ; loop through sessions
  1. S ABMLOC=$$FINDLOC^ABMUCUTL
  1. K ABMZ ;abm*2.6*1 NO HEAT
  1. S ABM("HD",1)="For Location: "_$P($G(^DIC(4,ABMLOC,0)),U)
  1. I '$D(ABMY("USER")) S ABM("HD",2)="For ALL users"_$S($G(ABMY("POS"))=1:" Including",1:" Excluding")_" POS Claims"
  1. E D
  1. .S ABM("HD",2)="For user(s): "
  1. .S ABMU=0
  1. .F S ABMU=$O(ABMY("USER",ABMU)) Q:+ABMU=0 S ABM("HD",2)=ABM("HD",2)_$S($G(ABMFLG)=1:", ",1:"")_$P($G(^VA(200,ABMU,0)),U),^TMP("ABM-UCR",$J,$P($G(^VA(200,ABMU,0)),U))="",ABMFLG=1
  1. .S ABM("HD",2)=ABM("HD",2)_$S($G(ABMFLG)=1:",",1:"")_$S($G(ABMY("POS"))=1:" Including",1:" Excluding")_" POS CLAIMS"
  1. S ABMU=0
  1. S ABMLOOP=10
  1. F S ABMU=$O(^ABMUCASH(ABMLOC,10,ABMU)) Q:+ABMU=0 D
  1. .I $D(ABMY("USER")) Q:'$D(ABMY("USER",ABMU)) ;select users only
  1. .S ABMUO=$P($G(^VA(200,ABMU,0)),U)
  1. .S ABMFROM=$S($G(ABMY("DT",1)):ABMY("DT",1),1:0) ;from date
  1. .S ABMTO=$S($G(ABMY("DT",2)):ABMY("DT",2)_".999999",1:9999999) ;to date
  1. .F S ABMFROM=$O(^ABMUCASH(ABMLOC,10,ABMU,20,ABMFROM)) Q:+ABMFROM=0!(ABMFROM>ABMTO) D
  1. ..;check session status
  1. ..I "^O^S^"[("^"_$P($G(^ABMUCASH(ABMLOC,10,ABMU,20,ABMFROM,0)),U,4)_"^") Q ;skip open/reopened sessions ;abm*2.6*1 NO HEAT
  1. ..I '$D(ABMY("SSTAT","A"))&'$D(ABMY("SSTAT",$P($G(^ABMUCASH(ABMLOC,10,ABMU,20,ABMFROM,0)),U,4))) Q
  1. ..D DATA
  1. I $G(ABMY("POS"))=1 D
  1. .S ABMLOOP=20
  1. .S ABMU=1,ABMUO="POS CLAIMS"
  1. .S ABMFROM=$S($G(ABMY("DT",1)):ABMY("DT",1),1:0) ;from date
  1. .S ABMTO=$S($G(ABMY("DT",2)):ABMY("DT",2),1:9999999) ;to date
  1. .F S ABMFROM=$O(^ABMUCASH(ABMLOC,20,ABMU,20,ABMFROM)) Q:+ABMFROM=0!(ABMFROM>ABMTO) D
  1. ..;check session status
  1. ..I "^O^S^"[("^"_$P($G(^ABMUCASH(ABMLOC,20,ABMU,20,ABMFROM,0)),U,4)_"^") Q ;skip open/reopened sessions ;abm*2.6*1 NO HEAT
  1. ..I '$D(ABMY("SSTAT","A"))&'$D(ABMY("SSTAT",$P($G(^ABMUCASH(ABMLOC,20,ABMU,20,ABMFROM,0)),U,4))) Q
  1. ..D DATA
  1. Q
  1. ;
  1. DATA ;
  1. S ABMDAYS=+($S($P($G(^ABMUCASH(ABMLOC,ABMLOOP,ABMU,20,ABMFROM,0)),U,3):$P($G(^ABMUCASH(ABMLOC,ABMLOOP,ABMU,20,ABMFROM,0)),U,3),1:DT)-ABMFROM) ;abm*2.6*1 NO HEAT
  1. I ABMDAYS<1 S ABMDAYS=1 ;abm*2.6*1 NO HEAT
  1. S ABMZ(ABMUO,"ABMTDAYS")=+$G(ABMZ(ABMUO,"ABMTDAYS"))+ABMDAYS ;abm*2.6*1 NO HEAT
  1. S ABMZ(ABMUO,"SCNT")=+$G(ABMZ(ABMUO,"SCNT"))+1 ;abm*2.6*1 NO HEAT
  1. ;budget activity
  1. ;S ^TMP("ABM-UCR",$J,ABMUO,ABMFROM)=$P($G(^ABMUCASH(ABMLOC,ABMLOOP,ABMU,20,ABMFROM,0)),U,4) ;abm*2.6*1 NO HEAT
  1. S ^TMP("ABM-UCR",$J,ABMUO,ABMFROM)=$P($G(^ABMUCASH(ABMLOC,ABMLOOP,ABMU,20,ABMFROM,0)),U,4)_"^"_$P($G(^ABMUCASH(ABMLOC,ABMLOOP,ABMU,20,ABMFROM,0)),U,3) ;abm*2.6*1 NO HEAT
  1. S ABMB=0
  1. F S ABMB=$O(^ABMUCASH(ABMLOC,ABMLOOP,ABMU,20,ABMFROM,11,ABMB)) Q:+ABMB=0 D
  1. .;S ABMBA=$P($T(@$G(^ABMUCASH(ABMLOC,ABMLOOP,ABMU,20,ABMFROM,11,ABMB,0))),";;",2) ;abm*2.6*11
  1. .S ABMBA=$P($T(@($G(^ABMUCASH(ABMLOC,ABMLOOP,ABMU,20,ABMFROM,11,ABMB,0)))^ABMUVBCH),";;",2) ;abm*2.6*11
  1. .;
  1. .;approved bills
  1. .S ABMAB=0
  1. .F S ABMAB=$O(^ABMUCASH(ABMLOC,ABMLOOP,ABMU,20,ABMFROM,11,ABMB,2,ABMAB)) Q:+ABMAB=0 D
  1. ..S ^TMP("ABM-UCR",$J,ABMUO,"AB",ABMBA,"CNT")=+$G(^TMP("ABM-UCR",$J,ABMUO,"AB",ABMBA,"CNT"))+1
  1. ..S ^TMP("ABM-UCR",$J,ABMUO,"TOT","AB","CNT")=+$G(^TMP("ABM-UCR",$J,ABMUO,"TOT","AB","CNT"))+1
  1. ..S ABMDUZ=$P($G(^ABMUCASH(ABMLOC,ABMLOOP,ABMU,20,ABMFROM,11,ABMB,2,ABMAB,0)),U,2)
  1. ..S ABMIEN=$P($G(^ABMUCASH(ABMLOC,ABMLOOP,ABMU,20,ABMFROM,11,ABMB,2,ABMAB,0)),U,3)
  1. ..S ^TMP("ABM-UCR",$J,ABMUO,"AB",ABMBA,"AMT")=+$G(^TMP("ABM-UCR",$J,ABMUO,"AB",ABMBA,"AMT"))+$P($G(^ABMDBILL(ABMDUZ,ABMIEN,2)),U)
  1. ..S ^TMP("ABM-UCR",$J,ABMUO,"TOT","AB","AMT")=+$G(^TMP("ABM-UCR",$J,ABMUO,"TOT","AB","AMT"))+$P($G(^ABMDBILL(ABMDUZ,ABMIEN,2)),U)
  1. .Q:ABMLOOP=20 ;don't do cancelled anything for POS user
  1. .;
  1. .;cancelled claims
  1. .S ABMCC=0
  1. .F S ABMCC=$O(^ABMUCASH(ABMLOC,ABMLOOP,ABMU,20,ABMFROM,11,ABMB,1,ABMCC)) Q:+ABMCC=0 D
  1. ..S ^TMP("ABM-UCR",$J,ABMUO,"CC",ABMBA,"CNT")=+$G(^TMP("ABM-UCR",$J,ABMUO,"CC",ABMBA,"CNT"))+1
  1. ..S ^TMP("ABM-UCR",$J,ABMUO,"TOT","CC","CNT")=+$G(^TMP("ABM-UCR",$J,ABMUO,"TOT","CC","CNT"))+1
  1. .;
  1. .;cancelled bills
  1. .S ABMCB=0
  1. .F S ABMCB=$O(^ABMUCASH(ABMLOC,ABMLOOP,ABMU,20,ABMFROM,11,ABMB,3,ABMCB)) Q:+ABMCB=0 D
  1. ..S ^TMP("ABM-UCR",$J,ABMUO,"CB",ABMBA,"CNT")=+$G(^TMP("ABM-UCR",$J,ABMUO,"CB",ABMBA,"CNT"))+1
  1. ..S ^TMP("ABM-UCR",$J,ABMUO,"TOT","CB","CNT")=+$G(^TMP("ABM-UCR",$J,ABMUO,"TOT","CB","CNT"))+1
  1. ..S ABMDUZ=$P($G(^ABMUCASH(ABMLOC,ABMLOOP,ABMU,20,ABMFROM,11,ABMB,3,ABMCB,0)),U,2)
  1. ..S ABMIEN=$P($G(^ABMUCASH(ABMLOC,ABMLOOP,ABMU,20,ABMFROM,11,ABMB,3,ABMCB,0)),U,3)
  1. ..S ^TMP("ABM-UCR",$J,ABMUO,"CB",ABMBA,"AMT")=+$G(^TMP("ABM-UCR",$J,ABMUO,"CB",ABMBA,"AMT"))+$P($G(^ABMDBILL(ABMDUZ,ABMIEN,2)),U)
  1. ..S ^TMP("ABM-UCR",$J,ABMUO,"TOT","CB","AMT")=+$G(^TMP("ABM-UCR",$J,ABMUO,"TOT","CB","AMT"))+$P($G(^ABMDBILL(ABMDUZ,ABMIEN,2)),U)
  1. Q
  1. PRINT ;
  1. D HDB
  1. S ABMUO=""
  1. S ABMO=""
  1. F S ABMUO=$O(^TMP("ABM-UCR",$J,ABMUO)) Q:ABMUO="" D Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)
  1. .I ($G(ABMO)'=""),($G(ABMO)'=ABMUO) W !,ABMDASH
  1. .S ABMO=ABMUO
  1. .W !,"Statistics for ",ABMUO
  1. .F ABMBC="AB","CC","CB" D Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)
  1. ..Q:(ABMUO="POS CLAIMS")&(ABMBC'="AB")
  1. ..W !?5,$S(ABMBC="AB":"BILLED",ABMBC="CC":"CANCELLED CLAIMS",1:"CANCELLED BILLS")
  1. ..;F ABMBA="MEDICARE","MEDICAID","PRIVATE INSURANCE","OTHER" D Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT) ;abm*2.6*11
  1. ..F ABMBA="MEDICARE","MEDICAID","PRIVATE INSURANCE","OTHER","VET" D Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT) ;abm*2.6*11
  1. ...W !?10,ABMBA
  1. ...W ?35,$J(+$G(^TMP("ABM-UCR",$J,ABMUO,ABMBC,ABMBA,"CNT")),6)
  1. ...I ABMBC="AB"!(ABMBC="CB") W ?50,$J($FN(+$G(^TMP("ABM-UCR",$J,ABMUO,ABMBC,ABMBA,"AMT")),",",2),"10R")
  1. ..W !?35,"------"
  1. ..W:ABMBC["B" ?50,"----------"
  1. ..W !?20,"Total "_$S(ABMBC="AB"!(ABMBC="CB"):"Bills",1:"Claims"),?35,$J(+$G(^TMP("ABM-UCR",$J,ABMUO,"TOT",ABMBC,"CNT")),6)
  1. ..W:ABMBC["B" ?50,$J($FN(+$G(^TMP("ABM-UCR",$J,ABMUO,"TOT",ABMBC,"AMT")),",",2),"10R")
  1. ..W !
  1. ..I $Y>(IOSL-5) D HD Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT) W " (cont)"
  1. .;
  1. .;start new code abm*2.6*1 NO HEAT
  1. .S (ABMABAVG,ABMABTOT,ABMCBAVG,ABMCBTOT,ABMCCAVG,ABMSAVG)=0
  1. .D CALC
  1. .W !,"Average approved bills a day: "_$J(ABMABAVG,",",3)_" for $"_$J(ABMABTOT,",",2)
  1. .W !,"Average cancelled BILLS a day: "_$J(ABMCBAVG,",",3)_" for $"_$J(ABMCBTOT,",",2)
  1. .W !,"Average cancelled CLAIMS a day: "_$J(ABMCCAVG,",",3)
  1. .W !,"Average hours/mins session was open: "_ABMSAVG
  1. .;end new code NO HEAT
  1. .;
  1. .W !!,"Cashiering Sessions used:"
  1. .I +$O(^TMP("ABM-UCR",$J,ABMUO,0))=0 W !?5,"NO SESSIONS FOUND"
  1. .S ABMFROM=0
  1. .F S ABMFROM=$O(^TMP("ABM-UCR",$J,ABMUO,ABMFROM)) Q:+ABMFROM=0 D
  1. ..W !?5,ABMFROM
  1. ..;S ABMST=$G(^TMP("ABM-UCR",$J,ABMUO,ABMFROM)) ;abm*2.6*1 NO HEAT
  1. ..W " - "_$P($G(^TMP("ABM-UCR",$J,ABMUO,ABMFROM)),U,2)_" " ;abm*2.6*1 NO HEAT
  1. ..S ABMST=$P($G(^TMP("ABM-UCR",$J,ABMUO,ABMFROM)),U) ;abm*2.6*1 NO HEAT
  1. ..S ABMST=$S(ABMST="O":"OPEN",ABMST="C":"CLOSED",ABMST="R":"RECONCILED",ABMST="S":"RE-OPENED",1:"TRANSMITTED")
  1. ..W ?20,"(",ABMST,")"
  1. Q
  1. HD D PAZ^ABMDRUTL Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)
  1. HDB S ABM("PG")=ABM("PG")+1,ABM("I")="" D WHD^ABMURHD
  1. Q
  1. ;start new code abm*2.6*1 NO HEAT
  1. CALC ;
  1. Q:'$D(ABMZ(ABMUO)) ;user doesn't have any sessions ;abm*2.6*1 NO HEAT
  1. ABILLS S ABMABAVG=+$G(^TMP("ABM-UCR",$J,ABMUO,"TOT","AB","CNT"))/(ABMZ(ABMUO,"ABMTDAYS"))
  1. S ABMABTOT=+$G(^TMP("ABM-UCR",$J,ABMUO,"TOT","AB","AMT"))/+$G(^TMP("ABM-UCR",$J,ABMUO,"TOT","AB","CNT"),1)
  1. CBILLS S ABMCBAVG=+$G(^TMP("ABM-UCR",$J,ABMUO,"TOT","CB","CNT"))/(ABMZ(ABMUO,"ABMTDAYS"))
  1. S ABMCBTOT=+$G(^TMP("ABM-UCR",$J,ABMUO,"TOT","CB","AMT"))/+$G(^TMP("ABM-UCR",$J,ABMUO,"TOT","CB","CNT"),1)
  1. CCLMS S ABMCCAVG=+$G(^TMP("ABM-UCR",$J,ABMUO,"TOT","CC","CNT"))/(ABMZ(ABMUO,"ABMTDAYS"))
  1. S ABMSAVG=$P(ABMZ(ABMUO,"ABMTDAYS"),".")*24 ;convert days to hours
  1. S ABMSAVG=(ABMSAVG+($E($P(ABMZ(ABMUO,"ABMTDAYS"),".",2),1,2)))*60 ;convert hours to minutes
  1. S ABMSAVG=ABMSAVG+$E($P(ABMZ(ABMUO,"ABMTDAYS"),".",2),3,4) ;add remaining minutes
  1. S ABMSAVG=ABMSAVG_"."_$E($P(ABMZ(ABMUO,"ABMTDAYS"),".",2),5,6) ;seconds as decimal
  1. S ABMSAVG=ABMSAVG/(+$G(ABMZ(ABMUO,"SCNT"),1)) ;divide by number of sessions
  1. S ABMSAVG=ABMSAVG/60 ;convert back to hours/mins
  1. Q
  1. ;end new code NO HEAT