1 | SDSCRP1 ;ALB/JAM/RBS - Unbilled Amt Report for ASCD ; 3/6/07 10:45am
|
---|
2 | ;;5.3;Scheduling;**495**;Aug 13, 1993;Build 50
|
---|
3 | ;;MODIFIED FOR NATIONAL RELEASE from a Class III software product
|
---|
4 | ;;known as Service Connected Automated Monitoring (SCAM).
|
---|
5 | ;
|
---|
6 | ;**Program Description**
|
---|
7 | ; This report shall be used by billing clerks and the MCCR
|
---|
8 | ; Coordinator or other Billing Supervisor
|
---|
9 | Q
|
---|
10 | START ;SC Unbilled Amount Report
|
---|
11 | N SDOPT,SCOPT,SDSCCR,SDSCTAT,SDTYPE,SDSUPER,DIR,DIRUT,Y
|
---|
12 | W !,"Service Connected Unbilled Amount Report"
|
---|
13 | S DIR(0)="SO^R:Regular;S:Supervisor",DIR("B")="R",SDSUPER=0
|
---|
14 | S DIR("A")="Which option do you want to run?"
|
---|
15 | D ^DIR I $D(DIRUT) Q
|
---|
16 | I Y="S" D I 'SDSUPER Q
|
---|
17 | .;Determine type of user
|
---|
18 | .D TYPE^SDSCUTL
|
---|
19 | .I $G(SDTYPE)'="S" D EN^DDIOL("You do not have privileges to run this report.") Q
|
---|
20 | .S SDSUPER=1
|
---|
21 | D SCSEL I $G(SDABRT) K SDABRT Q
|
---|
22 | D RPT
|
---|
23 | Q
|
---|
24 | ;
|
---|
25 | SCSEL ;Service connection selection
|
---|
26 | N DIR,DIRUT,X,Y
|
---|
27 | W !!,"Encounter to Report"
|
---|
28 | S DIR(0)="SO^S:SC to NSC;N:NSC to SC"
|
---|
29 | S DIR("B")="S",DIR("A")="Which option do you want to run?"
|
---|
30 | D ^DIR I $D(DIRUT) S SDABRT=1 Q
|
---|
31 | S SCOPT=$S(Y="S":2,1:1)
|
---|
32 | Q
|
---|
33 | RPT ; Build the report
|
---|
34 | N DIR,SDSCDVSL,SDSCDVLN,SDRUN,SDSCTDT,ZTIO,ZTSAVE,%ZIS,ZTDESC,ZTRTN
|
---|
35 | ; Get Divisions
|
---|
36 | D DIV^SDSCUTL
|
---|
37 | D ^DIR
|
---|
38 | I $G(DTOUT)!($G(DUOUT)) G END
|
---|
39 | S SDSCDVSL=Y,SDSCDVLN=SCLN
|
---|
40 | K X,Y
|
---|
41 | ;
|
---|
42 | S SDRUN=$$HTE^XLFDT($H,1)
|
---|
43 | ; Get start and end date for report.
|
---|
44 | D GETDATE^SDSCOMP I SDSCTDT="" G END
|
---|
45 | ;
|
---|
46 | W !!,"You will need a 132 column printer for this report!",!
|
---|
47 | S ZTDESC="BILLED/UNBILLED AMOUNT REPORT",ZTRTN="BEG^SDSCRP1"
|
---|
48 | S %ZIS="QM" D ^%ZIS G END:POP
|
---|
49 | I '$D(IO("Q")) K ZTDESC G @ZTRTN
|
---|
50 | S ZTIO=ION,ZTSAVE("*")=""
|
---|
51 | D ^%ZTLOAD
|
---|
52 | G END
|
---|
53 | ;
|
---|
54 | BEG ; Begin report
|
---|
55 | N P,L,SDABRT,CT,SDSCDIV,SDSCDNM,AI,THDR,CT,DITOT,DPTOT
|
---|
56 | S (P,L,SDABRT,CT)=0
|
---|
57 | S SDSCDIV=$S(SDSCDVSL'[SDSCDVLN:SDSCDVSL,1:"")
|
---|
58 | I SDSCDIV="" S SDSCDNM="ALL" D PRT G EXT
|
---|
59 | I SDSCDIV'="" D
|
---|
60 | . S THDR=""
|
---|
61 | . F AI=1:1:$L(SDSCDVSL,",") S SDSCDIV=$P(SDSCDVSL,",",AI) Q:SDSCDIV="" D Q:$G(SDABRT)=1
|
---|
62 | .. S SDSCDNM=$P(^DG(40.8,SDSCDIV,0),"^",1),THDR=THDR_SDSCDNM_",",CT=CT+1
|
---|
63 | .. S DITOT(SDSCDNM)=0,DPTOT(SDSCDNM)=0
|
---|
64 | .. D PRT
|
---|
65 | G EXT
|
---|
66 | ;
|
---|
67 | PRT ; Print
|
---|
68 | N SDOEDT,ITOTAL,PTOTAL,SDOE,DFN,VADM,SDIBAMT,SSN,SDINST,SDPROF,SCVAL
|
---|
69 | U IO D HDR I $G(SDABRT)=1 Q
|
---|
70 | S SDOEDT=SDSCTDT,ITOTAL=0,PTOTAL=0
|
---|
71 | F S SDOEDT=$O(^SDSC(409.48,"C","C",SDOEDT)) Q:SDOEDT=""!(SDOEDT\1>SDEDT) D Q:$G(SDABRT)=1
|
---|
72 | . S SDOE=""
|
---|
73 | . F S SDOE=$O(^SDSC(409.48,"C","C",SDOEDT,SDOE)) Q:SDOE="" D Q:$G(SDABRT)=1
|
---|
74 | .. I SDSCDIV'="" Q:$P(^SDSC(409.48,SDOE,0),U,12)'=SDSCDIV
|
---|
75 | .. ;if encounter was not changed quit
|
---|
76 | .. S SCVAL=$$SCHNG^SDSCUTL(SDOE) I '+SCVAL Q
|
---|
77 | .. I '$S(($P(SCVAL,U,3))&(SCOPT=1):1,($P(SCVAL,U,2))&(SCOPT=2):1,1:0) Q
|
---|
78 | .. ;Call Billing API
|
---|
79 | .. S SDIBAMT=$$TPCHG^IBRSUTL(SDOE) I SDIBAMT="" Q
|
---|
80 | .. S SDPROF=$P(SDIBAMT,U,2),SDINST=$P(SDIBAMT,U)
|
---|
81 | .. I SDPROF=0,SDINST=0 Q
|
---|
82 | .. S SDBILL=$$TPBILL^IBRSUTL(SDOE),SDBILL=$TR(SDBILL,"^","/")
|
---|
83 | .. S ITOTAL=ITOTAL+SDINST,PTOTAL=PTOTAL+SDPROF
|
---|
84 | .. I SDSCDNM'="" S DITOT(SDSCDNM)=$G(DITOT(SDSCDNM))+SDINST,DPTOT(SDSCDNM)=$G(DPTOT(SDSCDNM))+SDPROF
|
---|
85 | .. I L+4>IOSL D HDR Q:$G(SDABRT)=1
|
---|
86 | .. S DFN=$$GET1^DIQ(409.48,SDOE_",",.11,"I") I DFN="" Q
|
---|
87 | .. D DEM^VADPT
|
---|
88 | .. W !,$E(VADM(1),1,20)
|
---|
89 | .. S SSN=$P(VADM(2),U)
|
---|
90 | .. S SSN=$E(SSN,1,3)_"-"_$E(SSN,4,5)_"-"_$E(SSN,6,10)
|
---|
91 | .. W ?22,SSN
|
---|
92 | .. W ?35,$E($$FMTE^XLFDT(SDOEDT,"5Z"),1,16),?55,SDOE
|
---|
93 | .. W !,?5,$E($$GET1^DIQ(409.68,SDOE_",",.04,"E"),1,20)
|
---|
94 | .. W ?27,$E($$GET1^DIQ(409.48,SDOE_",",.08,"E"),1,20)
|
---|
95 | .. S SDLEDT=$$GET1^DIQ(409.48,SDOE_",",.02,"I")
|
---|
96 | .. W ?49,$E($$FMTE^XLFDT(SDLEDT,"5Z"),1,16)
|
---|
97 | .. W ?65,$J(SDINST,0,2)
|
---|
98 | .. W ?75,$J(SDPROF,0,2)
|
---|
99 | .. W ?85,$E(SDBILL,1,$L(SDBILL)-1)
|
---|
100 | .. ;
|
---|
101 | .. I SDSUPER D PER W ?110,$E(SDNAME,1,$L(SDNAME)-1)
|
---|
102 | .. S L=L+2
|
---|
103 | I $G(SDABRT)=1 Q
|
---|
104 | ;
|
---|
105 | I L+3>IOSL D HDR I $G(SDABRT)=1 Q
|
---|
106 | W !,$TR($J(" ",IOM)," ","-")
|
---|
107 | W !,"TOTAL:",?65,$J(ITOTAL,0,2),?75,$J(PTOTAL,0,2)
|
---|
108 | S L=L+2
|
---|
109 | Q
|
---|
110 | ;
|
---|
111 | PER ; Last 2 Persons who edited record
|
---|
112 | N SDI,SDLI
|
---|
113 | S SDLI="A",SDNAME=""
|
---|
114 | F SDI=1:1:2 S SDLI=$O(^SDSC(409.48,SDOE,1,SDLI),-1) Q:'SDLI D
|
---|
115 | . S APER=$$GET1^DIQ(409.481,SDLI_","_SDOE_",",.03,"E")
|
---|
116 | . S SDNAME=SDNAME_APER_"/"
|
---|
117 | . Q
|
---|
118 | Q
|
---|
119 | ;
|
---|
120 | HDR ; Header
|
---|
121 | ; Do not ask 'RETURN' before first page on CRT.
|
---|
122 | I $E(IOST,1,2)="C-",P N DIR S DIR(0)="E" D ^DIR I 'Y S SDABRT=1 Q
|
---|
123 | ; Do not print a form feed before first page on printer. Top of form is set at end of previous report.
|
---|
124 | I $E(IOST,1,2)="C-"!P W @IOF
|
---|
125 | S P=P+1,L=5
|
---|
126 | W "ASCD "_$S(SCOPT=2:"Unbilled (SC to NSC)",1:"Billable (NSC to SC)")_" Amounts Report by Division "_SDSCDNM_" ",?90,"Run Date: ",SDRUN,?124,"Page ",$J(P,3)
|
---|
127 | W !,"*** Report reflects ONLY reviewed encounters ***"
|
---|
128 | W !!,"Name",?22,"SSN",?35,"Enc Date/Time",?55,"Encounter No."
|
---|
129 | W !,?5,"Clinic",?27,"Prim Prov",?49,"Date Edited",?65,"Instit $",?75,"Profess $",?85,"Bill Nos."
|
---|
130 | I SDSUPER W ?110,"Editors"
|
---|
131 | W !,$TR($J(" ",IOM)," ","-"),!
|
---|
132 | Q
|
---|
133 | ;
|
---|
134 | EXT ;
|
---|
135 | I CT>1,$G(SDABRT)'=1 D
|
---|
136 | . I $E(IOST,1,2)="C-",P N DIR S DIR(0)="E" D ^DIR I 'Y S SDABRT=1 Q
|
---|
137 | . ; Do not print a form feed before first page on printer. Top of form is set at end of previous report.
|
---|
138 | . I $E(IOST,1,2)="C-"!P W @IOF
|
---|
139 | . I $E(THDR,$L(THDR))="," S THDR=$E(THDR,1,$L(THDR)-1)
|
---|
140 | . W $S(SCOPT=2:"Unbilled (SC to NSC)",1:"Billable (NSC to SC)")_" Amounts Report",?90,"Run Date: ",SDRUN,?124,"Page ",$J(P,3)
|
---|
141 | . W !,"*** Report reflects ONLY reviewed encounters ***"
|
---|
142 | . W !!,"By Division(s) "_THDR
|
---|
143 | . W !,?65,"Instit $",?75,"Profess $"
|
---|
144 | . W !,$TR($J(" ",IOM)," ","-"),!
|
---|
145 | . S DIV="" F S DIV=$O(DITOT(DIV)) Q:DIV="" D
|
---|
146 | .. W !,?20,DIV,?65,$J(DITOT(DIV),0,2),?75,$J(DPTOT(DIV),0,2)
|
---|
147 | .. S TOTAI=TOTAI+DITOT(DIV),TOTAP=TOTAP+DPTOT(DIV)
|
---|
148 | .. Q
|
---|
149 | . W !,$TR($J(" ",IOM)," ","-"),!
|
---|
150 | . W !,?20,"TOTAL",?65,$J(TOTAI,0,2),?75,$J(TOTAP,0,2)
|
---|
151 | . Q
|
---|
152 | D RPTEND^SDSCRPT1
|
---|
153 | ;
|
---|
154 | END ; Exit tag
|
---|
155 | K SDBILL,SDLI,SDNAME,APER,SDSUPER,DIV,POP,P,L,SDABRT,DFN,TOTAI,TOTAP
|
---|
156 | K SDLEDT,SDRUN,SDEDT,SDOE,SDOEDT,SDSCTDT,SDSCBDT,SDSCEDT
|
---|
157 | K DIR,DIRUT,DUOUT,DTOUT,DIROUT,X,Y,SCLN D KVA^VADPT
|
---|
158 | Q
|
---|