ABMREQUE ; IHS/SD/SDR - Requeue bills in UFMS session ;
;;2.6;IHS 3P BILLING SYSTEM;**4,11**;NOV 12, 2009;Build 133
CR8SESS ;EP - create new session in file
;location
K DIC,DIE,X,Y,DA
S DIC="^ABMUCASH("
S DIC(0)="AMNEQ"
D ^DIC
I Y<0 Q
S ABMLOC=+Y
;
;user
K DIC,DIE,X,Y,DA
S DA(1)=ABMLOC
S DIC="^ABMUCASH(DA(1),10,"
S DIC(0)="AEQMN"
S DIC("P")=$P(^DD(9002274.45,".02",0),U,2)
D ^DIC
I Y<0 Q
S ABMUSER=+Y
;
K ABMO,ABMR,ABM,ABMTOT
S ABMFD=0
S ABMSDT=0
F S ABMSDT=$O(^ABMUCASH(ABMLOC,10,ABMUSER,20,ABMSDT)) Q:+ABMSDT=0 D Q:ABMFD'=0
.I $P($G(^ABMUCASH(ABMLOC,10,ABMUSER,20,ABMSDT,0)),U,4)="T" Q ;skip transmitted sessions
.S ABMST=$P($G(^ABMUCASH(ABMLOC,10,ABMUSER,20,ABMSDT,0)),U,4)
.S ABMST=$S(ABMST="C":"CLOSED",ABMST="O":"OPEN",1:"")
.S ABMO(ABMSDT)=ABMST
;
I $D(ABMO) D Q:$D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
.W !!!,"SESSIONS FOUND FOR USER "_$P($G(^VA(200,ABMUSER,0)),U)_":"
.S ABMCNT=1
.S ABMSDT=0
.S ABMDIR=""
.F S ABMSDT=$O(ABMO(ABMSDT)) Q:'ABMSDT D
..S ABMR(ABMCNT)=ABMSDT
..S:(ABMDIR'="") ABMDIR=ABMDIR_";"_ABMCNT_":"_ABMSDT_" ("_$G(ABMO(ABMSDT))_")"
..S:(ABMDIR="") ABMDIR=ABMCNT_":"_ABMSDT_" ("_$G(ABMO(ABMSDT))_")"
..S ABMCNT=+$G(ABMCNT)+1
.K DIR,DIE,DIC,X,Y,DA
.S DIR(0)="SO^"_ABMDIR_";"_(ABMCNT)_":NEW SESSION"
.S DIR("A")="Select session to use"
.D ^DIR K DIR
.Q:$D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)
.I Y(0)="NEW SESSION" K ABMO Q
.W !!!,"Using session "_$G(ABMR(Y))
.S ABMSDT=$G(ABMR(Y))
;
;sign in date
I '$D(ABMO) D
.K DIC,DIE,X,Y,DA
.S DA(2)=ABMLOC
.S DA(1)=ABMUSER
.S DIC="^ABMUCASH("_DA(2)_",10,"_DA(1)_",20,"
.S X="NOW"
.S DIC(0)="LMO"
.S DIC("P")=$P(^DD(9002274.4502,".02",0),U,2)
.S DIC("DR")=".03///NOW;.04////C"
.D ^DIC
.S ABMSDT=+Y
.W !!!,"Created session "_ABMSDT
;
ADDBENTR ;EP - Add claim/bill to session log
S ABMTRIBL=$P($G(^ABMDPARM(DUZ(2),1,4)),U,14)
;
S ABMFLG=0
F D Q:ABMFLG=1
.W !!
.W !,"Use 1-3 character code for insurer type",!
.K DIC,DIE,X,Y,DA
.S DA(3)=ABMLOC
.S DA(2)=ABMUSER
.S DA(1)=ABMSDT
.S DIC="^ABMUCASH("_DA(3)_",10,"_DA(2)_",20,"_DA(1)_",11,"
.S DIC(0)="AEQLM" ;insurer type
.D ^DIC
.I +Y<0 S ABMFLG=1 Q
.S ABMBA=+Y
.S ABMBAOUT=$P(Y,U,2)
.;S ABMBAOUT=$P($T(@ABMBAOUT^ABMUCASH),";;",2)
.S ABMFLG1=0
.F D Q:ABMFLG1=1
..K DIC,DIE,X,Y,DA
..S DA(4)=ABMLOC
..S DA(3)=ABMUSER
..S DA(2)=ABMSDT
..S DA(1)=ABMBA
..S DIC="^ABMUCASH("_DA(4)_",10,"_DA(3)_",20,"_DA(2)_",11,"_DA(1)_",2,"
..S DIC("P")=$P(^DD(9002274.4510211,2,0),U,2)
..S DIC(0)="LMAEQ"
..D ^DIC
..I +Y<0 S ABMFLG1=1 Q
..S DIE=DIC
..S DA=+Y
..S DR=".01//;.02//;.03//"
..D ^DIE
..S ABM(ABMBAOUT,"CNT")=+$G(ABM(ABMBAOUT,"CNT"))+1
..S ABM(ABMBAOUT,"AMT")=+$G(ABM(ABMBAOUT,"AMT"))+$P($G(^ABMDBILL($P($G(^ABMUCASH(DA(4),10,DA(3),20,DA(2),11,DA(1),2,DA,0)),U,2),$P($G(^ABMUCASH(DA(4),10,DA(3),20,DA(2),11,DA(1),2,DA,0)),U,3),2)),U)
..S ABMTOT("CNT")=+$G(ABMTOT("CNT"))+1
..S ABMTOT("AMT")=+$G(ABMTOT("AMT"))++$P($G(^ABMDBILL($P($G(^ABMUCASH(DA(4),10,DA(3),20,DA(2),11,DA(1),2,DA,0)),U,2),$P($G(^ABMUCASH(DA(4),10,DA(3),20,DA(2),11,DA(1),2,DA,0)),U,3),2)),U)
W !!?3,"Budget Activity",?20,"Count",?30,"Amount"
S ABMBAOUT=""
F S ABMBAOUT=$O(ABM(ABMBAOUT)) Q:ABMBAOUT="" D
.W !?3,ABMBAOUT,?20,$G(ABM(ABMBAOUT,"CNT")),?26,$J($FN(ABM(ABMBAOUT,"AMT"),",",2),10)
W !?20,"=====",?26,"=========="
W !,?20,ABMTOT("CNT"),?26,$J($FN(ABMTOT("AMT"),",",2),10)
Q
ABMREQUE ; IHS/SD/SDR - Requeue bills in UFMS session ;
+1 ;;2.6;IHS 3P BILLING SYSTEM;**4,11**;NOV 12, 2009;Build 133
CR8SESS ;EP - create new session in file
+1 ;location
+2 KILL DIC,DIE,X,Y,DA
+3 SET DIC="^ABMUCASH("
+4 SET DIC(0)="AMNEQ"
+5 DO ^DIC
+6 IF Y<0
QUIT
+7 SET ABMLOC=+Y
+8 ;
+9 ;user
+10 KILL DIC,DIE,X,Y,DA
+11 SET DA(1)=ABMLOC
+12 SET DIC="^ABMUCASH(DA(1),10,"
+13 SET DIC(0)="AEQMN"
+14 SET DIC("P")=$PIECE(^DD(9002274.45,".02",0),U,2)
+15 DO ^DIC
+16 IF Y<0
QUIT
+17 SET ABMUSER=+Y
+18 ;
+19 KILL ABMO,ABMR,ABM,ABMTOT
+20 SET ABMFD=0
+21 SET ABMSDT=0
+22 FOR
SET ABMSDT=$ORDER(^ABMUCASH(ABMLOC,10,ABMUSER,20,ABMSDT))
IF +ABMSDT=0
QUIT
Begin DoDot:1
+23 ;skip transmitted sessions
IF $PIECE($GET(^ABMUCASH(ABMLOC,10,ABMUSER,20,ABMSDT,0)),U,4)="T"
QUIT
+24 SET ABMST=$PIECE($GET(^ABMUCASH(ABMLOC,10,ABMUSER,20,ABMSDT,0)),U,4)
+25 SET ABMST=$SELECT(ABMST="C":"CLOSED",ABMST="O":"OPEN",1:"")
+26 SET ABMO(ABMSDT)=ABMST
End DoDot:1
IF ABMFD'=0
QUIT
+27 ;
+28 IF $DATA(ABMO)
Begin DoDot:1
+29 WRITE !!!,"SESSIONS FOUND FOR USER "_$PIECE($GET(^VA(200,ABMUSER,0)),U)_":"
+30 SET ABMCNT=1
+31 SET ABMSDT=0
+32 SET ABMDIR=""
+33 FOR
SET ABMSDT=$ORDER(ABMO(ABMSDT))
IF 'ABMSDT
QUIT
Begin DoDot:2
+34 SET ABMR(ABMCNT)=ABMSDT
+35 IF (ABMDIR'="")
SET ABMDIR=ABMDIR_";"_ABMCNT_":"_ABMSDT_" ("_$GET(ABMO(ABMSDT))_")"
+36 IF (ABMDIR="")
SET ABMDIR=ABMCNT_":"_ABMSDT_" ("_$GET(ABMO(ABMSDT))_")"
+37 SET ABMCNT=+$GET(ABMCNT)+1
End DoDot:2
+38 KILL DIR,DIE,DIC,X,Y,DA
+39 SET DIR(0)="SO^"_ABMDIR_";"_(ABMCNT)_":NEW SESSION"
+40 SET DIR("A")="Select session to use"
+41 DO ^DIR
KILL DIR
+42 IF $DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)
QUIT
+43 IF Y(0)="NEW SESSION"
KILL ABMO
QUIT
+44 WRITE !!!,"Using session "_$GET(ABMR(Y))
+45 SET ABMSDT=$GET(ABMR(Y))
End DoDot:1
IF $DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)
QUIT
+46 ;
+47 ;sign in date
+48 IF '$DATA(ABMO)
Begin DoDot:1
+49 KILL DIC,DIE,X,Y,DA
+50 SET DA(2)=ABMLOC
+51 SET DA(1)=ABMUSER
+52 SET DIC="^ABMUCASH("_DA(2)_",10,"_DA(1)_",20,"
+53 SET X="NOW"
+54 SET DIC(0)="LMO"
+55 SET DIC("P")=$PIECE(^DD(9002274.4502,".02",0),U,2)
+56 SET DIC("DR")=".03///NOW;.04////C"
+57 DO ^DIC
+58 SET ABMSDT=+Y
+59 WRITE !!!,"Created session "_ABMSDT
End DoDot:1
+60 ;
ADDBENTR ;EP - Add claim/bill to session log
+1 SET ABMTRIBL=$PIECE($GET(^ABMDPARM(DUZ(2),1,4)),U,14)
+2 ;
+3 SET ABMFLG=0
+4 FOR
Begin DoDot:1
+5 WRITE !!
+6 WRITE !,"Use 1-3 character code for insurer type",!
+7 KILL DIC,DIE,X,Y,DA
+8 SET DA(3)=ABMLOC
+9 SET DA(2)=ABMUSER
+10 SET DA(1)=ABMSDT
+11 SET DIC="^ABMUCASH("_DA(3)_",10,"_DA(2)_",20,"_DA(1)_",11,"
+12 ;insurer type
SET DIC(0)="AEQLM"
+13 DO ^DIC
+14 IF +Y<0
SET ABMFLG=1
QUIT
+15 SET ABMBA=+Y
+16 SET ABMBAOUT=$PIECE(Y,U,2)
+17 ;S ABMBAOUT=$P($T(@ABMBAOUT^ABMUCASH),";;",2)
+18 SET ABMFLG1=0
+19 FOR
Begin DoDot:2
+20 KILL DIC,DIE,X,Y,DA
+21 SET DA(4)=ABMLOC
+22 SET DA(3)=ABMUSER
+23 SET DA(2)=ABMSDT
+24 SET DA(1)=ABMBA
+25 SET DIC="^ABMUCASH("_DA(4)_",10,"_DA(3)_",20,"_DA(2)_",11,"_DA(1)_",2,"
+26 SET DIC("P")=$PIECE(^DD(9002274.4510211,2,0),U,2)
+27 SET DIC(0)="LMAEQ"
+28 DO ^DIC
+29 IF +Y<0
SET ABMFLG1=1
QUIT
+30 SET DIE=DIC
+31 SET DA=+Y
+32 SET DR=".01//;.02//;.03//"
+33 DO ^DIE
+34 SET ABM(ABMBAOUT,"CNT")=+$GET(ABM(ABMBAOUT,"CNT"))+1
+35 SET ABM(ABMBAOUT,"AMT")=+$GET(ABM(ABMBAOUT,"AMT"))+$PIECE($GET(^ABMDBILL($PIECE($GET(^ABMUCASH(DA(4),10,DA(3),20,DA(2),11,DA(1),2,DA,0)),U,2),$PIECE($GET(^ABMUCASH(DA(4),10,DA(3),20,DA(2),11,DA(1),2,DA,0)),U,3),2)),U)
+36 SET ABMTOT("CNT")=+$GET(ABMTOT("CNT"))+1
+37 SET ABMTOT("AMT")=+$GET(ABMTOT("AMT"))++$PIECE($GET(^ABMDBILL($PIECE($GET(^ABMUCASH(DA(4),10,DA(3),20,DA(2),11,DA(1),2,DA,0)),U,2),$PIECE($GET(^ABMUCASH(DA(4),10,DA(3),20,DA(2),11,DA(1),2,DA,0)),U,3),2)),U)
End DoDot:2
IF ABMFLG1=1
QUIT
End DoDot:1
IF ABMFLG=1
QUIT
+38 WRITE !!?3,"Budget Activity",?20,"Count",?30,"Amount"
+39 SET ABMBAOUT=""
+40 FOR
SET ABMBAOUT=$ORDER(ABM(ABMBAOUT))
IF ABMBAOUT=""
QUIT
Begin DoDot:1
+41 WRITE !?3,ABMBAOUT,?20,$GET(ABM(ABMBAOUT,"CNT")),?26,$JUSTIFY($FNUMBER(ABM(ABMBAOUT,"AMT"),",",2),10)
End DoDot:1
+42 WRITE !?20,"=====",?26,"=========="
+43 WRITE !,?20,ABMTOT("CNT"),?26,$JUSTIFY($FNUMBER(ABMTOT("AMT"),",",2),10)
+44 QUIT