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

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

initial load of WorldVistAEHR

File size: 3.7 KB
RevLine 
[613]1IBOCNC2 ;ALB/ARH - CPT USAGE IN CLINICS (PRINT) ;1/23/92
2 ;;2.0;INTEGRATED BILLING;**76,51,152**;21-MAR-94
3 ;
4START ;set up headers and dates then do appropriate print
5 D NOW^%DTC S Y=$E(%,1,12) D DD^%DT S IBCDT=$P(Y,"@",1)_" "_$P(Y,"@",2)
6 S Y=IBBDT X ^DD("DD") S IBBDTE=Y,Y=IBEDT X ^DD("DD") S IBEDTE=Y
7 S IBHDR="CLINIC CPT USAGE FOR "_IBBDTE_" - "_IBEDTE
8 S (IBPGN,IBLN)=0,IBDSH="" F IBI=1:1:IOM S IBDSH=IBDSH_"-"
9 D:IBSRT=0 PRINTC D:IBSRT=1 PRINTP D:IBSRT=2 PRINTD
10 K IBCDT,IBBDTE,IBEDTE,IBPGN,IBLN,IBI,IBDSH,IBHDR,Y
11 Q
12 ;
13PRINTC ;print the report from the temp sort file to the appropriate device, by clinic
14 S IBLBL="W !,?3,""CLINIC"",?36,""AMBULATORY PROCEDURE"",?75,"" COUNT"",!" D HDR
15 S IBCLNN="" F S IBCLNN=$O(^TMP("IBCU",$J,IBCLNN)) Q:IBCLNN=""!(IBQ) D
16 . S IBCLN=$G(^TMP("IBCU",$J,IBCLNN,"N")),IBCP=1,IBCT=0
17 . S IBCPT=0 F S IBCPT=$O(^TMP("IBCU",$J,IBCLNN,IBCPT)) Q:IBCPT'?1N.N!(IBQ) D
18 .. S IBCPTP=$$CPT(IBCPT)
19 .. I (IBLN+1)>IOSL D HDR S IBCP=1
20 .. W !,?3,$S(IBCP:IBCLNN,1:""),?36,IBCPTP,?75,$J(^TMP("IBCU",$J,IBCLNN,IBCPT),6)
21 .. S IBLN=IBLN+1,IBCT=IBCT+1,IBCP=0
22 . I 'IBQ D:(IBLN+2)>IOSL HDR W !,?36,$E(IBDSH,1,35),?76,$E(IBDSH,1,5),!,?36,"TOTAL: ",$J(IBCT,5),?75,$J(^TMP("IBCU",$J,IBCLNN),6),!
23 . S IBLN=IBLN+3
24 D:'IBQ PAUSE
25 K IBCLN,IBCLNN,IBCP,IBCT,IBCPT,IBCPTP,IBLBL,X,Y
26 Q
27 ;
28PRINTP ;print report from temp sort file by procedure
29 S IBLBL="W !,""AMBULATORY PROCEDURE"",?38,"" COUNT"",?46,""#BILLED"",!" D HDR
30 S (IBCT,IBCPT)=0 F S IBCPT=$O(^TMP("IBCU",$J,IBCPT)) Q:IBCPT'?1N.N!(IBQ) D
31 . S IBCPTP=$$CPT(IBCPT)
32 . I (IBLN+1)>IOSL D HDR Q:IBQ
33 . W !,IBCPTP,?38,$J($G(^TMP("IBCU",$J,IBCPT)),6),?46,$J($G(^TMP("IBCU",$J,IBCPT,"B")),6)
34 . S IBLN=IBLN+1,IBCT=IBCT+1
35 I 'IBQ,($D(^TMP("IBCU",$J))#2!$D(^TMP("IBCU",$J,"B"))#2) D:(IBLN+2)>IOSL HDR D
36 . W !,$E(IBDSH,1,34),?39,$E(IBDSH,1,5),?47,$E(IBDSH,1,5),!,"TOTAL: ",$J(IBCT,6),?38,$J(+$G(^TMP("IBCU",$J)),6),?46,$J(+$G(^TMP("IBCU",$J,"B")),6)
37 D:'IBQ PAUSE
38 K IBCPT,IBCPTP,IBCT,IBLBL,X,Y
39 Q
40 ;
41PRINTD ;print report from temp sort file by procedure with extended description
42 S IBLBL="W !,""AMBULATORY PROCEDURE"",?78,"" COUNT"",?86,""#BILLED"",!" D HDR
43 S IBCPT=0 F S IBCPT=$O(^TMP("IBCU",$J,IBCPT)) Q:IBCPT'?1N.N!(IBQ) D
44 . S IBCPTP=$$CPT(IBCPT)
45 . D DESC I (IBLN+1)>IOSL D HDR Q:IBQ
46 . W !!,IBCPTP,?78,$J($G(^TMP("IBCU",$J,IBCPT)),6),?86,$J($G(^TMP("IBCU",$J,IBCPT,"B")),6)
47 . S IBLN=IBLN+2 I $D(IBD) S IBX=0 F S IBX=$O(IBD(IBX)) Q:IBX=""!(IBQ) D
48 .. D:(IBLN+1)>IOSL HDR Q:IBQ W !,?7,IBD(IBX) S IBLN=IBLN+1
49 D:'IBQ PAUSE
50 K IBCPT,IBCPTP,IBLBL,IBD,IBX,X,Y
51 Q
52 ;
53CPT(IBCPT) ; Format the CPT code for output
54 N IBICPT,IBP
55 S IBICPT=$$PRCD^IBCEF1(+IBCPT_";ICPT(",1)
56 S IBP=$J($P(IBICPT,"^",2),5)_" "_$P(IBICPT,"^",3)
57 Q IBP
58 ;
59DESC ;if sort by proc & user wants desc, get procedure description, store in IBD at proper length for printing
60 S IBDESCT=$$CPTD^ICPTCOD(IBCPT,"IBX")
61 Q:$G(IBDESCT)'>0
62 K IBD S IBY=1,IBX=0,IBLNG=68
63 F S IBX=$O(IBX(IBX)) Q:'IBX S IBZ=IBX(IBX) D
64 . F IBJ=1:1 S IBW=$P(IBZ," ",IBJ) Q:IBW="" D
65 .. I $L(IBW)>IBLNG S:$G(IBD(IBY))'="" IBY=IBY+1 S IBD(IBY)=$E(IBW,1,IBLNG-1)_"-",IBY=IBY+1,IBD(IBY)=$E(IBW,IBLNG,999)_" " Q
66 .. I ($L($G(IBD(IBY)))+$L(IBW)+1)'>IBLNG S IBD(IBY)=$G(IBD(IBY))_IBW_" " Q
67 .. S IBY=IBY+1,IBD(IBY)=IBW_" "
68 K IBY,IBX,IBLNG,IBZ,IBJ,IBW,IBDESCT
69 Q
70 ;
71HDR ;print the report header
72 S IBQ=$$STOP^IBOCNC1 Q:IBQ D:IBPGN>0 PAUSE Q:IBQ I IBPGN>0!($E(IOST,1,2)["C-") W @IOF
73 S IBPGN=IBPGN+1,IBLN=5 W IBHDR I IOM<85 W !
74 W ?(IOM-30),IBCDT,?(IOM-8),"PAGE ",IBPGN,!
75 I $D(IBPRC) S IBI="" F S IBI=$O(IBPRC(IBI)) Q:IBI="" W !,IBPRC(IBI) S IBLN=IBLN+1
76 X IBLBL F IBI=1:1:IOM W "-"
77 K IBI
78 Q
79 ;
80PAUSE ;pause at end of screen if being displayed on a terminal
81 Q:$E(IOST,1,2)'["C-"
82 S DIR(0)="E" D ^DIR K DIR I $D(DUOUT)!($D(DIRUT)) S IBQ=1
83 Q
Note: See TracBrowser for help on using the repository browser.