source: WorldVistAEHR/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBTOSA.m@ 776

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

initial load of WorldVistAEHR

File size: 3.6 KB
Line 
1IBTOSA ;ALB/AAS - CLAIMS TRACKING SCHEDULED ADMISSION REPORT ; 27-OCT-93
2 ;;2.0;INTEGRATED BILLING;**62,124**;21-MAR-94
3 ;
4% I '$D(DT) D DT^DICRW
5 W !!,"Scheduled Admissions Report"
6 ;
7DATE ; -- select date
8 W !! D DATE^IBOUTL
9 I IBBDT=""!(IBEDT="") G END
10 ;
11DEV ; -- select device, run option
12 W !!,"You will need a 132 column printer for this report!",!
13 S %ZIS="QM" D ^%ZIS G:POP END
14 I $D(IO("Q")) S ZTRTN="DQ^IBTOSA",ZTSAVE("IB*")="",ZTDESC="IB - scheduled Admissions Report" D ^%ZTLOAD K IO("Q"),ZTSK D HOME^%ZIS G END
15 ;
16 U IO
17 S X=132 X ^%ZOSF("RM")
18DQ D PRINT G END
19 Q
20 ;
21END ; -- Clean up
22 K ^TMP($J) W !
23 I $D(ZTQUEUED) S ZTREQ="@" Q
24 D ^%ZISC
25 K I,J,X,Y,DFN,%ZIS,VA,IBTRN,IBTRND,IBPAG,IBHDT,IBDT,IBBDT,IBEDT,IBQUIT
26 Q
27 ;
28PRINT ; -- print one billing report from ct
29 S IBPAG=0,IBHDT=$$HTE^XLFDT($H,1),IBQUIT=0
30 S IBTSBDT=IBBDT-.1,IBTSEDT=IBEDT+.9 D EN^IBTRKR2
31 K ^TMP($J)
32 ;
33 D FIX
34 S IBDT=IBBDT-.1
35 F S IBDT=$O(^IBT(356,"D",IBDT)) Q:'IBDT!(IBDT>(IBEDT+.24))!(IBQUIT) S IBTRN=0 F S IBTRN=$O(^IBT(356,"D",IBDT,IBTRN)) Q:'IBTRN!(IBQUIT) D
36 .S IBTRND=$G(^IBT(356,IBTRN,0))
37 .Q:'$P(IBTRND,"^",20) ; inactive
38 .Q:+IBDT<IBBDT
39 .I $P($G(^IBE(356.6,+$P(IBTRND,"^",18),0)),"^",3)=1,$P(IBTRND,"^",7)=1,$$SCH(IBTRN) D
40 .. I $$INSURED^IBCNS1($P(IBTRND,"^",2),IBDT)!$$BUFFER^IBCNBU1($P(IBTRND,"^",2)) D SET
41 ;
42PR D HDR
43 I '$D(^TMP($J,"IBSCH")) W !!,"No Scheduled Admission found in date range",! Q
44 S IBNAM="",IBCNT=0
45 F S IBNAM=$O(^TMP($J,"IBSCH",IBNAM)) Q:IBNAM=""!(IBQUIT) S IBDT=0 F S IBDT=$O(^TMP($J,"IBSCH",IBNAM,IBDT)) Q:'IBDT!(IBQUIT) S IBTRN=0 F S IBTRN=$O(^TMP($J,"IBSCH",IBNAM,IBDT,IBTRN)) Q:'IBTRN!(IBQUIT) S IBTRND=^(IBTRN) D ONE
46 ;
47 Q:IBQUIT
48 W !!,"------------------"
49 W !,"TOTAL = ",IBCNT
50 I $D(ZTQUEUED) G END
51 Q
52 ;
53ONE ; -- Print one patients data
54 Q:IBQUIT
55 I IOSL<($Y+5) D HDR Q:IBQUIT
56 S IBCNT=IBCNT+1
57 S DFN=$P(IBTRND,"^",2) D PID^VADPT
58 W !,$E(IBNAM,1,27),?30,VA("PID"),?45,$$DAT1^IBOUTL($P(IBTRND,"^",6),"2P")
59 W ?66,$S('$P(IBTRND,"^",19):"YES",1:$E("NO - "_$P($G(^IBE(356.8,+$P(IBTRND,"^",19),0)),"^"),1,27))
60 W ?100,$E($P($G(^DPT(DFN,.1)),"^"),1,12),?115,$E($$EXPAND^IBTRE(356,.07,$P(IBTRND,"^",7)),1,11)
61 I +$$BUFFER^IBCNBU1(DFN) W ?129,"YES"
62 Q
63 ;
64HDR ; -- Print header for billing report
65 Q:IBQUIT
66 I $E(IOST,1,2)="C-",IBPAG D PAUSE^VALM1 I $D(DIRUT) S IBQUIT=1 Q
67 I $E(IOST,1,2)="C-"!(IBPAG) W @IOF
68 S IBPAG=IBPAG+1
69 W !,"Scheduled Admissions with Insurance",?(IOM-33),"Page ",IBPAG," ",IBHDT
70 W !,"For Period beginning on ",$$DAT1^IBOUTL(IBBDT)," to ",$$DAT1^IBOUTL(IBEDT)
71 W !,"Patient",?30,"Pt. ID",?45,"Adm. Date",?66,"Billable",?100,"Ward",?115,"Type",?126,"Buffer"
72 W !,$TR($J(" ",IOM)," ","-")
73 I $D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1,IBQUIT=1 W !!,"....task stop* ed at user request" Q
74 Q
75 ;
76SET ; -- set tmp array
77 I $D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1,IBQUIT=1 D HDR W !!,"....task stop* ed at user request" Q
78 S ^TMP($J,"IBSCH",$P(^DPT(+$P(IBTRND,"^",2),0),"^"),IBDT,IBTRN)=IBTRND
79 Q
80 ;
81SCH(IBTRN) ; -- is patient either admitted or still scheduled
82 ;
83 N IBX,IBTRND S IBX=1
84 S IBTRND=$G(^IBT(356,+IBTRN,0))
85 I '$P(IBTRND,"^",32) G SCHQ
86 I $P(IBTRND,"^",5) G SCHQ
87 S X=$G(^DGS(41.1,+$P(IBTRND,"^",32),0)) I X=""!($P(X,"^",13)) D S IBX=0
88 .N DA,DR,DIC,DIE
89 .S DIE="^IBT(356,",DR=".2////0;.32///@",DA=IBTRN
90 .D ^DIE
91SCHQ Q IBX
92 ;
93FIX ; -- find bad episode dates and fix
94 S IBDT=DT
95 F S IBDT=$O(^IBT(356,"D",IBDT)) Q:'IBDT S IBTRN=0 F S IBTRN=$O(^IBT(356,"D",IBDT,IBTRN)) Q:'IBTRN D F1(IBTRN)
96 Q
97 ;
98F1(IBTRN) ; fix EPISODE DATE
99 N IBDT,DA,DR,DIC,DIE
100 Q:'$G(IBTRN)
101 Q:$G(^IBT(356,+IBTRN,0))=""
102 S IBDT=$P(^IBT(356,+IBTRN,0),"^",6)
103 I +IBDT'=IBDT,$E(IBDT,$L(IBDT))=0 S IBDT=+IBDT,DA=IBTRN,DR=".06////"_IBDT,DIE="^IBT(356," D ^DIE
104 Q
Note: See TracBrowser for help on using the repository browser.