source: FOIAVistA/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBOHLD1.m@ 1318

Last change on this file since 1318 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 3.8 KB
Line 
1IBOHLD1 ;ALB/CJM - REPORT OF CHARGES ON HOLD W/INS INFO ;MARCH 3 1992
2 ;;2.0;INTEGRATED BILLING;**70,95,133,356,347**;21-MAR-94;Build 24
3 ;;Per VHA Directive 2004-038, this routine should not be modified.
4 ;
5 ; modified HELD CHARGES REPORT - includes INS info
6 ;
7MAIN ;
8 N IBQUIT,IBII,DIRUT,DUOUT,DTOUT,ZTIO,Y S IBQUIT=0
9 S DIR(0)="Y",DIR("A")="Include Insurance information on this report",DIR("B")="NO"
10 S DIR("?",1)=" Enter: 'Y' - to include patient insurance information on this report"
11 S DIR("?",2)=" 'N' - to exclude patient insurance information on this report"
12 S DIR("?",3)=" '^' - to exit this option"
13 D ^DIR K DIR G:$D(DIRUT) EXIT S IBII=+Y
14 ;
15QUEUED ; entry point if queued
16 ;***
17 K ^TMP($J)
18 D:'$G(IBQUIT) DEVICE D:'$G(IBQUIT) CHRGS,REPORT^IBOHLD2
19 D EXIT
20 ;***
21 Q
22EXIT ;
23 K ^TMP($J)
24 K IBRDT,IBRF,IBRX,IBRXN
25 I $D(ZTQUEUED) S ZTREQ="@" Q
26 D ^%ZISC
27 Q
28DEVICE ;
29 I $D(ZTQUEUED) Q
30 W !!,*7,"*** Margin width of this output is 132 ***"
31 W !,"*** This output should be queued ***"
32 S %ZIS="QM" D ^%ZIS I POP S IBQUIT=1 Q
33 I $D(IO("Q")) D Q
34 . S ZTRTN="QUEUED^IBOHLD1"
35 . S ZTIO=ION_";"_IOST_";"_IOM_";"_IOSL
36 . S ZTDESC="HELD CHARGES RPT W/INS"
37 . S ZTSAVE("IB*")=""
38 . D ^%ZTLOAD
39 . W !,$S($D(ZTSK):"REQUEST QUEUED TASK="_ZTSK,1:"REQUEST CANCELLED")
40 . D HOME^%ZIS K ZTSK S IBQUIT=1
41 U IO
42 Q
43 ; indexes records that should be included in report
44 ;
45CHRGS ; charges on hold
46 N IBN,DFN,IBNAME,IBND
47 S DFN=0 F S DFN=$O(^IB("AH",DFN)) Q:'DFN D PAT S IBN=0 F S IBN=$O(^IB("AH",DFN,IBN)) Q:'IBN D
48 .S IBND=$G(^IB(IBN,0)) Q:'IBND
49 .S ^TMP($J,"HOLD",IBNAME,DFN,IBN)=""
50 .D BILLS
51 Q
52PAT ; patient name
53 N VAERR,VADM D DEM^VADPT I VAERR K VADM
54 S IBNAME=$G(VADM(1)) S:IBNAME="" IBNAME=" "
55 Q
56BILLS ; find bills for charges on hold
57 N IBFR,IBT,IBATYPE,IBTO
58 S IBATYPE=$S($P($G(^IBE(350.1,+$P(IBND,"^",3),0)),"^")["OPT":"O",$P($G(^IBE(350.1,+IBND,"^",3,0)),"^")["PSO":"RX",1:"I")
59 S IBFR=$P(IBND,"^",14),IBTO=$P(IBND,"^",15)
60 I IBATYPE="I" D INP
61 I IBATYPE="O" D OTP
62 E D RX
63 Q
64INP ; inpatient bills
65 N IBEV,IBBILL,IBT,X,X1,X2,IBEND,IBOK
66 S IBEV=$P(IBND,"^",16) Q:'IBEV ; parent event
67 S IBEV=($P($G(^IB(IBEV,0)),"^",17)\1) Q:'IBEV ; date of parent event
68 S X1=IBEV,X2=1 D C^%DTC S IBEND=X
69 S IBT=(IBEV-.0001) F S IBT=$O(^DGCR(399,"D",IBT)) Q:'IBT!(IBT'<IBEND) S IBBILL=0 F S IBBILL=$O(^DGCR(399,"D",IBT,IBBILL)) Q:IBBILL="" D
70 .D INPTCK
71 .I IBOK S ^TMP($J,"HOLD",IBNAME,DFN,IBN,IBBILL)=""
72 Q
73 ;
74INPTCK ; does bill belong to charge? returns IBOK=0 if no
75 N IBBILL0,IBBILLU
76 S IBBILL0=$G(^DGCR(399,IBBILL,0)),IBBILLU=$G(^("U"))
77 S IBOK=1
78CK1 ; for same patient?
79 I DFN=$P(IBBILL0,"^",2)
80 S IBOK=$T
81 Q:'IBOK
82CK2 ; same type- inp or opt?
83 N B S B=$S(+$P(IBBILL0,"^",5)<3:"I",1:"O")
84 I B=IBATYPE
85 S IBOK=$T
86 Q:'IBOK
87CK3 ; overlap in date range?
88 N F,T
89 S F=+IBBILLU,T=$P(IBBILLU,"^",2)
90 I (IBTO<F)!(IBFR>T)
91 S IBOK='$T
92 Q:'IBOK
93CK4 ; insurance bill?
94 I $P(IBBILL0,"^",11)="i"
95 S IBOK=$T
96 Q
97OTP ; outpatient bills
98 N X,IBV,IBBILL,IBOK,IBBILL0
99 S IBV=(IBFR\1)-.0001 F S IBV=$O(^DGCR(399,"AOPV",DFN,IBV)) Q:'IBV!(IBV>IBTO) S IBBILL=0 D
100 .F S IBBILL=$O(^DGCR(399,"AOPV",DFN,IBV,IBBILL)) Q:('IBBILL) D
101 ..Q:$D(^TMP($J,"HOLD",IBNAME,DFN,IBN,IBBILL))
102 ..S IBBILL0=$G(^DGCR(399,IBBILL,0)) D CK4 Q:'IBOK
103 ..S ^TMP($J,"HOLD",IBNAME,DFN,IBN,IBBILL)=""
104 Q
105RX ; rx refill bills
106 S (IBRX,IBRXN,IBRF,IBRDT)=0 N IENS
107 I $P(IBND,"^",4)'["52:" Q
108 ;
109 S IBRXN=$P($P(IBND,"^",4),":",2),IBRX=$P($P(IBND,"^",8),"-"),IBRF=$P($P(IBND,"^",4),":",3)
110 ;
111 I +IBRF>0 S IBRDT=$$SUBFILE^IBRXUTL(+IBRXN,IBRF,52,.01)
112 I +IBRF=0 S IBRDT=$$FILE^IBRXUTL(+IBRXN,22)
113 ;
114 Q:(IBRX="")!('IBRDT)
115 N X,IBBILL,IBBILL0,IBFILL,IBFILL0,IBOK S IBBILL=0
116 S IBFILL=0 F S IBFILL=$O(^IBA(362.4,"B",IBRX,IBFILL)) Q:IBFILL="" D
117 .S IBFILL0=$G(^IBA(362.4,IBFILL,0)) I $P(IBFILL0,"^",3)'=IBRDT Q
118 .S IBBILL=+$P(IBFILL0,"^",2) I 'IBBILL Q
119 .S IBBILL0=$G(^DGCR(399,IBBILL,0)) D CK4 I 'IBOK Q
120 .S ^TMP($J,"HOLD",IBNAME,DFN,IBN,IBBILL)=""
121 Q
Note: See TracBrowser for help on using the repository browser.