IBCOPV1 ;ALB/LDB - CPT LISTING IN MCCR ;30 APR 90
;;Version 2.0 ; INTEGRATED BILLING ;; 21-MAR-94
;
;MAP TO DGCROPV1
;
PRT ;
N IBQUIT,IBNUM,IBDATE,Z1 S IBQUIT=0
;D:$D(DIR) HLP
D HDR1,HDR F I=0:0 S I=$O(^UTILITY($J,"OPV","AP",I)) Q:'I S IBNUM=I-1 W ! D SCR Q:IBQUIT S IBNUM=I W ?1,I_")",?5 S (Y,I1)=+^UTILITY($J,"OPV","AP",I) D DT^DIQ S IBDATE=Y K Y D VT Q:IBQUIT
;W:DGCNT>30 !!,"THERE ARE MORE THAN TEN VISITS DURING THE PERIOD THAT THIS STATEMENT COVERS."
F C=$Y:1:(IOSL-6) W !
D:'IBQUIT PICK
G Q2
;Q:$D(DIR)
PICK K Y S DIR("A")="Select visits to include in this bill (1-"_IBNUM_"): "
OK S DIR(0)="LAO^1:"_IBNUM_"^K:X[""."" X" D ^DIR
I $D(DTOUT)!$D(DUOUT) S IBQUIT=1 Q
Q:X=""
I $P($$OPV1^IBCU41(IBIFN,1,($L(Y,",")-1)),U,2)'="" G OK
;I (DGCNT1+($L(Y,",")-1))>30 W !,"Maximum of 30 visits allowed per bill!",!,"The visits already on the bill along with those selected total more than 30." G OK
;I $D(^DIC(36,+^DGCR(399,IBIFN,"M"),0)),$P(^(0),"^",8),+$P(Y,",",2)>0!(DGCNT1&(+$E(Y)>0)) W !,*7,"THIS INSURANCE COMPANY WILL ONLY ACCEPT ONE VISIT PER BILL.",! G OK
OK1 I +Y W !,"YOU HAVE SELECTED VISIT(S) NUMBERED- ",$E(Y,1,$L(Y)-1),!,"IS THIS CORRECT" S %=1 D YN^DICN I %=-1 S IBOUT=1 G Q2
I +Y,'% W !,"Enter 'Y'es to include these visits.",!,"Enter 'N'o to reselect." G OK1
I +Y,%=2 G OK
G:'Y Q1
S IBVT=Y
F I=1:1 S:$P(IBVT,",",I) DGAP=$P(IBVT,",",I) Q:$P(IBVT,",",I)']"" D VFILE
D Q2 Q
VFILE S (DINUM,X)=+^UTILITY($J,"OPV","AP",DGAP)
VFILE1 S DA(1)=IBIFN,DIC(0)="L",DIC="^DGCR(399,"_DA(1)_",""OP"","
S:'$D(^DGCR(399,DA(1),"OP",0)) ^(0)="^399.043DA^"
I $D(^DGCR(399,DA(1),"OP",DINUM)) G VFILEQ
I '$$OPV1^IBCU41(IBIFN,1)!('$$OPV2^IBCU41(DINUM,IBIFN,1)) D S DGNOADD=1 G VFILEQ
. W !,?10,"Can't add OP Visit Date of ",$$DAT2^IBOUTL(X)
S Y=$$DUPCHK^IBCU41(DINUM,IBIFN,1)
;I $P(^DGCR(399,IBIFN,0),"^",19)'=2,$O(^DGCR(399,DA(1),"OP",0)),$D(^DGCR(399,"ASC2",DA(1))) W !?4,"Only 1 visit date allowed on bills with Amb. Surg. Codes!" S DGNOADD=1 G VFILEQ
W !?4,"Adding OP Visit Date of ",$$DAT2^IBOUTL(X)
K DD,DO D FILE^DICN L ^DGCR(399,IBIFN):1
VFILEQ Q
Q2 S IBQUIT=1 K DIR,DIRUT G Q
Q1 S:$D(DUOUT)!$D(DTOUT) IBOUT=1 K DIR,DIRUT
Q K DA,DGBIL,DGCNT,DGCNT2,DGCOD,DGCT1,IBCD,DGCPT,DGCPT1,IBOPV,IBCOPV1,IBOPV2,IBOPV3,IBOPV4,DGCNT1,DGCNT2,DGDT,DGDT,DGDT1,DGFIL,DGMT,DGMT1,DGNO,DGNOD,DGTYP,DGTYPE,DIC,DIE,DINUM,DR,L,V,X,Y,IBCHG1,IBCHG2,IBRVCE,IBVDT
K DGTE,I9,DGLP,DGCPT0,DGCPT2,DGCPT3,I7,P,IBVT,DGAP,Z,I4,DGASC,DGCPTS,DGBIL1,DGDIV,DGDAT,DGNOADD,IBFT Q
;
HDR1 W @IOF,?25,"<<<OUTPATIENT VISITS>>>",!! S X="",$P(X,"=",80)="" W X Q
HDR W !,"NO.",?6,"VISIT DATE",?19,"ELIG/MT",?28,"CPT",?33,"CHARGE",?40,"BILL# - TYPE",?60,"STOP CODE"
W !,"===",?6,"==========",?19,"=======",?28,"===",?33,"======",?40,"============",?60,"========="
Q
VT S I2="" F Z1=1:1 S I2=$O(^UTILITY($J,"OPV",I1,I2)) Q:I2=""!IBQUIT S I3="" F I4=1:1 S I3=$O(^UTILITY($J,"OPV",I1,I2,I3)) Q:I3="" S IBOPV3=^UTILITY($J,"OPV",I1,I2,I3) D VT1 Q:IBQUIT
Q
VT1 D SCR Q:IBQUIT I (Z1>1)!(I4>1) W:$X>1 ! W ?5,$G(IBDATE)
W ?19,$P(IBOPV3,"^") W:$P(IBOPV3,"^",2)]"" "/"_$P(IBOPV3,"^",2) W:$P(IBOPV3,"^",3)]"" ?29,"Y" D CHG
I (Z1=1)&(I4=1) F P=4:2 Q:$P(^UTILITY($J,"OPV","AP",I),"^",P)="" W:P>4 ! W ?40,$J($P(^UTILITY($J,"OPV","AP",I),"^",P),7),"-",$P(^UTILITY($J,"OPV","AP",I),"^",P+1)
Q:$P(^UTILITY($J,"OPV",I1,I2,I3),"^",6)']"" W ?60,$E($P(^UTILITY($J,"OPV",I1,I2,I3),"^",6),1,20)
Q
SCR Q:IBQUIT I $E(IOST,1,2)["C-",$Y+6>IOSL F Y=$Y:1:IOSL-5 W !
I W !,"Press return to continue, ""^"" to exit display, or " D PICK I 'IBQUIT W @IOF D HDR1,HDR W !
Q
HLP ;W !!,"Enter a number between 1 and ",DGCNT," or a list or range separated with commas",!,"or dashes, e.g., 1,3,5 or 2-4,8"
;W !,"The number(s) must correspond to a visit." R H:5 K H
Q
CHG W:(Z1=1)&(I4=1) ?31,$J($P(^UTILITY($J,"OPV","AP",I),"^",2),8) Q
NOVT I 'DGCNT D HDR1 W !!,"NO OUTPATIENT VISITS FOUND DURING THE PERIOD COVERED BY THIS STATEMENT" D Q Q
IBCOPV1 ;ALB/LDB - CPT LISTING IN MCCR ;30 APR 90
+1 ;;Version 2.0 ; INTEGRATED BILLING ;; 21-MAR-94
+2 ;
+3 ;MAP TO DGCROPV1
+4 ;
PRT ;
+1 NEW IBQUIT,IBNUM,IBDATE,Z1
SET IBQUIT=0
+2 ;D:$D(DIR) HLP
+3 DO HDR1
DO HDR
FOR I=0:0
SET I=$ORDER(^UTILITY($JOB,"OPV","AP",I))
IF 'I
QUIT
SET IBNUM=I-1
WRITE !
DO SCR
IF IBQUIT
QUIT
SET IBNUM=I
WRITE ?1,I_")",?5
SET (Y,I1)=+^UTILITY($JOB,"OPV","AP",I)
DO DT^DIQ
SET IBDATE=Y
KILL Y
DO VT
IF IBQUIT
QUIT
+4 ;W:DGCNT>30 !!,"THERE ARE MORE THAN TEN VISITS DURING THE PERIOD THAT THIS STATEMENT COVERS."
+5 FOR C=$Y:1:(IOSL-6)
WRITE !
+6 IF 'IBQUIT
DO PICK
+7 GOTO Q2
+8 ;Q:$D(DIR)
PICK KILL Y
SET DIR("A")="Select visits to include in this bill (1-"_IBNUM_"): "
OK SET DIR(0)="LAO^1:"_IBNUM_"^K:X[""."" X"
DO ^DIR
+1 IF $DATA(DTOUT)!$DATA(DUOUT)
SET IBQUIT=1
QUIT
+2 IF X=""
QUIT
+3 IF $PIECE($$OPV1^IBCU41(IBIFN,1,($LENGTH(Y,",")-1)),U,2)'=""
GOTO OK
+4 ;I (DGCNT1+($L(Y,",")-1))>30 W !,"Maximum of 30 visits allowed per bill!",!,"The visits already on the bill along with those selected total more than 30." G OK
+5 ;I $D(^DIC(36,+^DGCR(399,IBIFN,"M"),0)),$P(^(0),"^",8),+$P(Y,",",2)>0!(DGCNT1&(+$E(Y)>0)) W !,*7,"THIS INSURANCE COMPANY WILL ONLY ACCEPT ONE VISIT PER BILL.",! G OK
OK1 IF +Y
WRITE !,"YOU HAVE SELECTED VISIT(S) NUMBERED- ",$EXTRACT(Y,1,$LENGTH(Y)-1),!,"IS THIS CORRECT"
SET %=1
DO YN^DICN
IF %=-1
SET IBOUT=1
GOTO Q2
+1 IF +Y
IF '%
WRITE !,"Enter 'Y'es to include these visits.",!,"Enter 'N'o to reselect."
GOTO OK1
+2 IF +Y
IF %=2
GOTO OK
+3 IF 'Y
GOTO Q1
+4 SET IBVT=Y
+5 FOR I=1:1
IF $PIECE(IBVT,",",I)
SET DGAP=$PIECE(IBVT,",",I)
IF $PIECE(IBVT,",",I)']""
QUIT
DO VFILE
+6 DO Q2
QUIT
VFILE SET (DINUM,X)=+^UTILITY($JOB,"OPV","AP",DGAP)
VFILE1 SET DA(1)=IBIFN
SET DIC(0)="L"
SET DIC="^DGCR(399,"_DA(1)_",""OP"","
+1 IF '$DATA(^DGCR(399,DA(1),"OP",0))
SET ^(0)="^399.043DA^"
+2 IF $DATA(^DGCR(399,DA(1),"OP",DINUM))
GOTO VFILEQ
+3 IF '$$OPV1^IBCU41(IBIFN,1)!('$$OPV2^IBCU41(DINUM,IBIFN,1))
Begin DoDot:1
+4 WRITE !,?10,"Can't add OP Visit Date of ",$$DAT2^IBOUTL(X)
End DoDot:1
SET DGNOADD=1
GOTO VFILEQ
+5 SET Y=$$DUPCHK^IBCU41(DINUM,IBIFN,1)
+6 ;I $P(^DGCR(399,IBIFN,0),"^",19)'=2,$O(^DGCR(399,DA(1),"OP",0)),$D(^DGCR(399,"ASC2",DA(1))) W !?4,"Only 1 visit date allowed on bills with Amb. Surg. Codes!" S DGNOADD=1 G VFILEQ
+7 WRITE !?4,"Adding OP Visit Date of ",$$DAT2^IBOUTL(X)
+8 KILL DD,DO
DO FILE^DICN
LOCK ^DGCR(399,IBIFN):1
VFILEQ QUIT
Q2 SET IBQUIT=1
KILL DIR,DIRUT
GOTO Q
Q1 IF $DATA(DUOUT)!$DATA(DTOUT)
SET IBOUT=1
KILL DIR,DIRUT
Q KILL DA,DGBIL,DGCNT,DGCNT2,DGCOD,DGCT1,IBCD,DGCPT,DGCPT1,IBOPV,IBCOPV1,IBOPV2,IBOPV3,IBOPV4,DGCNT1,DGCNT2,DGDT,DGDT,DGDT1,DGFIL,DGMT,DGMT1,DGNO,DGNOD,DGTYP,DGTYPE,DIC,DIE,DINUM,DR,L,V,X,Y,IBCHG1,IBCHG2,IBRVCE,IBVDT
+1 KILL DGTE,I9,DGLP,DGCPT0,DGCPT2,DGCPT3,I7,P,IBVT,DGAP,Z,I4,DGASC,DGCPTS,DGBIL1,DGDIV,DGDAT,DGNOADD,IBFT
QUIT
+2 ;
HDR1 WRITE @IOF,?25,"<<<OUTPATIENT VISITS>>>",!!
SET X=""
SET $PIECE(X,"=",80)=""
WRITE X
QUIT
HDR WRITE !,"NO.",?6,"VISIT DATE",?19,"ELIG/MT",?28,"CPT",?33,"CHARGE",?40,"BILL# - TYPE",?60,"STOP CODE"
+1 WRITE !,"===",?6,"==========",?19,"=======",?28,"===",?33,"======",?40,"============",?60,"========="
+2 QUIT
VT SET I2=""
FOR Z1=1:1
SET I2=$ORDER(^UTILITY($JOB,"OPV",I1,I2))
IF I2=""!IBQUIT
QUIT
SET I3=""
FOR I4=1:1
SET I3=$ORDER(^UTILITY($JOB,"OPV",I1,I2,I3))
IF I3=""
QUIT
SET IBOPV3=^UTILITY($JOB,"OPV",I1,I2,I3)
DO VT1
IF IBQUIT
QUIT
+1 QUIT
VT1 DO SCR
IF IBQUIT
QUIT
IF (Z1>1)!(I4>1)
IF $X>1
WRITE !
WRITE ?5,$GET(IBDATE)
+1 WRITE ?19,$PIECE(IBOPV3,"^")
IF $PIECE(IBOPV3,"^",2)]""
WRITE "/"_$PIECE(IBOPV3,"^",2)
IF $PIECE(IBOPV3,"^",3)]""
WRITE ?29,"Y"
DO CHG
+2 IF (Z1=1)&(I4=1)
FOR P=4:2
IF $PIECE(^UTILITY($JOB,"OPV","AP",I),"^",P)=""
QUIT
IF P>4
WRITE !
WRITE ?40,$JUSTIFY($PIECE(^UTILITY($JOB,"OPV","AP",I),"^",P),7),"-",$PIECE(^UTILITY($JOB,"OPV","AP",I),"^",P+1)
+3 IF $PIECE(^UTILITY($JOB,"OPV",I1,I2,I3),"^",6)']""
QUIT
WRITE ?60,$EXTRACT($PIECE(^UTILITY($JOB,"OPV",I1,I2,I3),"^",6),1,20)
+4 QUIT
SCR IF IBQUIT
QUIT
IF $EXTRACT(IOST,1,2)["C-"
IF $Y+6>IOSL
FOR Y=$Y:1:IOSL-5
WRITE !
+1 IF $TEST
WRITE !,"Press return to continue, ""^"" to exit display, or "
DO PICK
IF 'IBQUIT
WRITE @IOF
DO HDR1
DO HDR
WRITE !
+2 QUIT
HLP ;W !!,"Enter a number between 1 and ",DGCNT," or a list or range separated with commas",!,"or dashes, e.g., 1,3,5 or 2-4,8"
+1 ;W !,"The number(s) must correspond to a visit." R H:5 K H
+2 QUIT
CHG IF (Z1=1)&(I4=1)
WRITE ?31,$JUSTIFY($PIECE(^UTILITY($JOB,"OPV","AP",I),"^",2),8)
QUIT
NOVT IF 'DGCNT
DO HDR1
WRITE !!,"NO OUTPATIENT VISITS FOUND DURING THE PERIOD COVERED BY THIS STATEMENT"
DO Q
QUIT