source: FOIAVistA/trunk/r/ACCOUNTS_RECEIVABLE-PRCA-PRY-RC/PRCAPCL.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: 4.8 KB
Line 
1PRCAPCL ;WASH-ISC@ALTOONA,PA/NYB-Print Bill Status Report ;8/19/94 10:21 AM
2V ;;4.5;Accounts Receivable;**72,63,143,154**;Mar 20, 1995
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 N BAL,BN,CAT,DEAD,DEBT,DIR,DIROUT,DUOUT,DP,DP2,IOP,N430
5 N PAGE,POP,PRCAE,PRCATOT,PRCATOT2,PRCAT,PRCAT2,PRCY,RCDOJ,TDT,STT
6 S (PAGE,PRCAT,PRCAT2,PRCATOT,PRCATOT2)=0
7 D NOW^%DTC S Y=% X ^DD("DD") S TDT=Y
8 I $G(STAT)="ALL" S STT=0 F S STT=($O(^PRCA(430.3,"AC",STT))) Q:STT="" D
9 .I STT<100!(STT=107) Q
10 .S STAT($O(^PRCA(430.3,"AC",STT,0)))=""
11 .Q
12 S STAT=0 F S STAT=$O(STAT(STAT)) Q:STAT=""!($D(DIROUT))!($D(DUOUT)) D
13 .N NDE
14 .D HDR
15 .F PRCAE=0:0 S PRCAE=$O(^PRCA(430,"AC",STAT,PRCAE)),X="" Q:'PRCAE!($D(DIROUT)!($D(DUOUT))) I $P($G(^PRCA(430,PRCAE,100)),"^",2)[$G(SER),$S($G(SER):+$G(^PRCA(430,PRCAE,100)),1:1) D Q:$D(DIROUT)!($D(DUOUT)) D PRNTL
16 ..I $Y+4>IOSL D TOP,HDR
17 ..Q
18 .I $Y+4>IOSL D TOP,HDR Q:$D(DIROUT)!($D(DUOUT))
19 .S DP1=$S(+DAT>0:+DAT,1:0)
20 .S DP2=$S(+$P($G(DAT),"^",2)=0:"",1:+$P($G(DAT),"^",2))
21 .S DP=0 F S DP=$O(^TMP($J,"PRCAE",DP)) Q:'DP!($D(DIROUT)!($D(DUOUT))) D
22 ..S BN="" F S BN=$O(^TMP($J,"PRCAE",DP,BN)) Q:BN=""!($D(DIROUT)!($D(DUOUT))) D
23 ...S NDE=^TMP($J,"PRCAE",DP,BN)
24 ...S Y=DP X ^DD("DD") S DP2=Y K Y
25 ...S RCDOJ=$$REFST^RCRCUTL(+$O(^PRCA(430,"B",BN,0)))
26 ...W $G(DP2),?15,$S(RCDOJ&$G(BN):$G(BN)_"r",1:$G(BN)),?30,$P(NDE,U,2),?45,$P(NDE,U,3)
27 ...W ?65,$J($P(NDE,U,4),9,2),!
28 ...S PRCATOT2=PRCATOT2+$P(NDE,U,4),PRCAT2=PRCAT2+1
29 ...S PRCATOT=PRCATOT+$P(NDE,U,4),PRCAT=PRCAT+1
30 ...I $Y+4>IOSL D TOP,HDR Q:$D(DIROUT)!($D(DUOUT))
31 ...K ^TMP($J,"PRCAE",DP,BN)
32 ...Q
33 ..Q
34 .I X'="^" W !!!,"SUBTOTAL: ",$J(PRCATOT2,10,2),!,"SUBCOUNT: ",$J(PRCAT2,10),?30 Q:$D(DIROUT)!($D(DUOUT))
35 .S (PRCATOT2,PRCAT2)=0
36 .Q:$D(DIROUT)!($D(DUOUT))
37 .I $O(STAT(STAT))="" Q
38 .I $O(STAT(STAT))'="" W !! D TOP
39 .Q
40 I X'="^" W !!!,"TOTAL: ",$J(PRCATOT,10,2),!,"COUNT: ",$J(PRCAT,10),!," MEAN: ",$J($S('PRCAT:0,1:PRCATOT/PRCAT),10,2),?30,"* -indicates that patient is deceased",!,?30,"r -indicates that bill is referred"
41 W:$E(IOST)="P" @IOF Q
42TOP ;
43 I $E(IOST)="C" S X="" S DIR(0)="E" D ^DIR Q:$D(DIROUT)!($D(DUOUT))
44Q2 Q
45PRNTL ;
46 N BAL,DEAD,DEBT
47 S X=$S($D(^PRCA(430,PRCAE,0)):^(0),1:"") G:X="" PQ
48 S BN=$P($G(X),U),DP=$P($G(X),U,14),PRCY=$P($G(X),U,2) G:BN="" PQ
49 S BEG=+DAT-1,END=+$P(DAT,U,2)
50 I BEG,DP'>BEG Q
51 I END,DP>END Q
52 S (CAT,PRCY)=$S(PRCY="":PRCY,$D(^PRCA(430.2,PRCY,0))#2:$P(^(0),U),1:PRCY)
53 S PRCY=$S($D(^RCD(340,+$P(X,U,9),0)):$P(^(0),U),1:"")
54 I PRCY["DPT" S DFN=+PRCY D DEM^VADPT S:+VADM(6) DEAD="*" D KVAR^VADPT K VA,VADM
55 I PRCY]"" S (DEBT,PRCY)=$S($D(@("^"_$P(PRCY,";",2)_+PRCY_",0)")):^(0),1:"")
56 S PRCY=$S($D(^PRCA(430,PRCAE,7)):^(7),1:"")
57 I 'PRCY,(STAT=$O(^PRCA(430.3,"AC",104,0))!((STAT=20)&($G(^PRCA(430,PRCAE,100)))))
58 S (BAL,PRCY)=$P(PRCY,U)+$P(PRCY,U,2)+$P(PRCY,U,3)+$P(PRCY,U,4)+$P(PRCY,U,5)
59 I DP'="" S ^TMP($J,"PRCAE",DP,BN)=U_$E(CAT,1,13)_U_$G(DEAD)_$E($P($G(DEBT),U),1,15)_U_$G(BAL)_U_$G(PRCATOT2)_U_$G(PRCAT2)
60 I $G(SER),(STAT=31!(STAT=32)) S Y=$G(^PRCA(430,PRCAE,3)) D
61 .W:$P(Y,U)]"" !,"Date: ",$E($P(Y,U),4,5),"/",$E($P(Y,U),6,7),"/",$E($P(Y,U),2,3)
62 .W:$P(Y,U,2)]"" " By: ",$P($G(^VA(200,+$P(Y,U,2),0)),U)
63 .W:$P(Y,U,6)]"" " Reason: ",$P(Y,U,6)
64 .Q
65 I $E(IOST)="",$Y+4>IOSL D TOP
66PQ Q
67HDR ;
68 I $E(IOST)="C"!PAGE W @IOF
69 S PAGE=PAGE+1
70 W !,"BILL STATUS LISTING REPORT"
71 W ?40,$G(TDT),?72,$G(PAGE)
72 W !,"Sort Criteria for Date Last Updated Range: "_SC1_" to "_SC2
73 W !,"Date Last",!," Updated",?15,"Bill no.",?30,"Category"
74 W ?50,"Debtor",?68,"Balance",!
75 S X="",$P(X,"-",IOM-1)="" W X,!
76 W !,?5,"Status: ",$P($S($D(^PRCA(430.3,STAT,0)):^(0),1:""),U),!!
77 Q
78DT I Y X ^DD("DD") S DP2=Y
79 Q
80STAT(SER) W ! ;Bill Status Listing
81 N BEG,DAT,END,SC1,SC2,STAT,STT
82 K ^TMP($J)
83 S DAT=$$DATE^RCEVUTL1("")
84 Q:$G(DAT)=-1
85 S BEG=+DAT,END=+$P(DAT,U,2)
86 S SC1=$S(BEG=0:"First",1:BEG-1) I +$G(SC1) S Y=SC1+1 X ^DD("DD") S SC1=Y
87 S SC2=$S(END=0:"Last",1:END) I +$G(SC2) S Y=SC2 X ^DD("DD") S SC2=Y
88 D ST
89 Q:STAT="^"
90 D TSK,Q1
91 Q
92ST N DIC,X,Y
93 S DIC="^PRCA(430.3,",DIC(0)="QEMZ"
94 S DIC("S")="I $P(^(0),""^"",3)>100,($P(^(0),""^"",3)'=107)"
95 S Y=0 W !,"STATUS: "_$S('$O(STAT("")):"ALL// ",1:"")
96 R X:DTIME I '$T!(X="^") S STAT="^" Q
97 I ((X="")!(X="ALL")),'$O(STAT("")) S (STAT,X)="ALL" Q
98 I X="" Q
99 D ^DIC S STAT=+Y,SER=$G(SER)
100 I X["?" W !!,"Enter 'ALL' for all status types.",! G ST
101 I STAT'="ALL",(+STAT>0) S STAT(+STAT)="" G ST
102 G:+STAT<0 ST
103 Q
104TSK ;
105 N POP,ZTSK
106 W *7,!,"Report should be QUEUED it could take some time to run!"
107 S POP=0,%ZIS="MQ" D ^%ZIS G:POP Q1
108 I '$D(IO("Q")) U IO D PRCAPCL U IO(0) G Q1
109 S ZTRTN="^PRCAPCL"
110 S (ZTSAVE("BEG"),ZTSAVE("DAT"),ZTSAVE("END"),ZTSAVE("SER"))=""
111 S (ZTSAVE("STAT"),ZTSAVE("STAT("),ZTSAVE("SC1"),ZTSAVE("SC2"))=""
112 S ZTDESC="Bill Status Listing" D ^%ZTLOAD
113Q1 D ^%ZISC Q
Note: See TracBrowser for help on using the repository browser.