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

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

revised back to 6/30/08 version

File size: 4.6 KB
Line 
1IBCEXTRP ;ALB/JEH - VIEW/PRINT EDI EXTRACT DATA ; 4/22/03 9:59am
2 ;;2.0;INTEGRATED BILLING;**137,197,211,348,349**;21-MAR-94;Build 46
3 ;;Per VHA Directive 2004-038, this routine should not be modified.
4 ;
5EN ;
6INIT ;
7 W !!,"This option will display the EDI extract data for a bill.",!
8 N IBREC1,IBIEN,IBINC,DIC,X,Y,DIR,IB364IEN,IBVNUM
9 ;
10 N DPTNOFZY S DPTNOFZY=1 ; Suppress PATIENT file fuzzy lookups
11 S DIC="^DGCR(399,",DIC(0)="AEMQ",DIC("S")="I 234[$P(^(0),U,13)" D ^DIC
12 I Y<1 G EXITQ
13 S IBIEN=+Y,IBREC1=$G(^DGCR(399,IBIEN,0))
14 S IB364IEN=$$LAST364^IBCEF4(IBIEN) I +$G(IB364IEN)=0 D G EXITQ
15 . W !,"There is no entry in the EDI Transmit Bill file for this bill number."
16 S IBVNUM=$P($G(^IBA(364,IB364IEN,0)),U,2) I +$G(IBVNUM)=0 D G EXITQ
17 . W !!,"There is no batch # for this bill. It has not been transmitted."
18 S IBVNUM=$P($G(^IBA(364.1,IBVNUM,0)),U)
19 S DIR("A")="INCLUDE FIELDS WITH NO DATA?: ",DIR("B")="NO",DIR(0)="YA" D ^DIR K DIR
20 I $D(DTOUT)!$D(DUOUT) G EXITQ
21 S IBINC=+Y
22DEV ; - Select device
23 N %ZIS,ZTRTN,ZTSAVE,ZTDESC
24 S %ZIS="QM" D ^%ZIS G:POP EXITQ
25 I $D(IO("Q")) D G EXITQ
26 . S ZTRTN="LIST^IBCEXTRP",ZTDESC="Transmitted Bill Extract Data"
27 . S ZTSAVE("IB*")=""
28 . D ^%ZTLOAD
29 . W !!,$S($D(ZTSK):"Your task number "_ZTSK_" has been queued.",1:"Unable to queue this job.")
30 .K ZTSK,IO("Q") D HOME^%ZIS
31 U IO
32 ;
33LIST ; - set up array and print data
34 N IBPG,IBSEQ,IBPC,IBDA,IBREC,IBQUIT,IBILL,IBLINE,IBXDATA,IBERR,IBXERR,Z,Z0,Z1
35 D EXTRACT(IBIEN,IBVNUM,8,1)
36 S (IBPG,IBQUIT,IBSEQ,IBPC,IBDA,IBLINE)=0
37 K ^TMP($J,"IBLINES")
38 ;IB*2.0*211 - rely on form type instead of bill charge type
39 N IBFMTYP S IBFMTYP=$$FT^IBCEF(IBIEN)
40 S IBFMTYP=$S(IBFMTYP=2:"CMS-1500",IBFMTYP=3:"UB-04",1:"OTHER"_"("_IBFMTYP_")")
41 S IBILL=$S($$INPAT^IBCEF(IBIEN,1):"Inpt",1:"Oupt")_"/"_IBFMTYP
42 I $D(^TMP("IBXERR",$J)) D G EXITQ
43 . S IBERR=0 F S IBERR=$O(^TMP("IBXERR",$J,IBERR)) Q:'IBERR W !,$G(^TMP("IBXERR",$J,IBERR))
44 F S IBSEQ=$O(^IBA(364.6,"ASEQ",8,IBSEQ)) Q:'IBSEQ!(IBQUIT) F S IBPC=$O(^IBA(364.6,"ASEQ",8,IBSEQ,1,IBPC)) Q:'IBPC!(IBQUIT) F S IBDA=$O(^IBA(364.6,"ASEQ",8,IBSEQ,1,IBPC,IBDA)) Q:'IBDA!(IBQUIT) S IBREC=$G(^IBA(364.6,IBDA,0)) D Q:IBQUIT
45 . N IBOK,Z,IBMULT
46 . I $P(IBREC,U,11)=1 Q
47 . I IBPC=1 S IBOK=0 D
48 .. S Z=1 F S Z=$O(^TMP("IBXDATA",$J,1,IBSEQ,1,Z)) Q:'Z I $G(^(Z))'="" S IBOK=1 Q
49 .. I 'IBOK S $P(^TMP("IBXDATA",$J,1,IBSEQ,1,1),U)=$P($G(^TMP("IBXDATA",$J,1,IBSEQ,1,1)),U)_" (NO DATA - RECORD NOT SENT)"
50 . S IBMULT=0 F S IBMULT=$O(^TMP("IBXDATA",$J,1,IBSEQ,IBMULT)) Q:'IBMULT D
51 .. I '$G(IBINC),$P($G(^TMP("IBXDATA",$J,1,IBSEQ,IBMULT,IBPC)),U)="" Q
52 .. S ^TMP($J,"IBLINES",IBSEQ,IBMULT,IBPC)=$E($P(IBREC,U,10)_$J("",30),1,30)_": "_$P($G(^TMP("IBXDATA",$J,1,IBSEQ,IBMULT,IBPC)),U)
53 .
54 W:$E(IOST,1,2)["C-" @IOF ; initial form feed for screen print
55 N IBFMTYP S IBFMTYP=$$FT^IBCEF(IBIEN)
56 S IBFMTYP=$S(IBFMTYP=2:"CMS-1500",IBFMTYP=3:"UB-04",1:"OTHER"_"("_IBFMTYP_")")
57 S IBILL=$S($$INPAT^IBCEF(IBIEN,1):"Inpt",1:"Oupt")_"/"_IBFMTYP
58 D HDR
59 S Z=0 F S Z=$O(^TMP($J,"IBLINES",Z)) Q:'Z S Z0=0 F S Z0=$O(^TMP($J,"IBLINES",Z,Z0)) Q:'Z0 S Z1=0 F S Z1=$O(^TMP($J,"IBLINES",Z,Z0,Z1)) Q:'Z1 D G:IBQUIT Q1
60 . D:IBLINE>(IOSL-5) HDR Q:IBQUIT
61 . W !,^TMP($J,"IBLINES",Z,Z0,Z1)
62 . S IBLINE=IBLINE+1
63Q1 K ^TMP($J,"IBLINES")
64 Q
65 ;
66HDR ; - Report header
67 N DIR,Y
68 I IBPG D Q:IBQUIT
69 . I $E(IOST,1,2)["C-" K DIR S DIR(0)="E" D ^DIR K DIR S IBQUIT=('Y) Q:IBQUIT
70 . W @IOF
71 ;
72 S IBPG=IBPG+1
73 W !!,?25,"EDI Transmitted Bill Extract Data",!,"Bill #",?11,"Type",?27,"Patient Name",?52,"SSN",?57,$$FMTE^XLFDT(DT),?71,"Page: "_IBPG
74 W !,$TR($J("",IOM)," ","=")
75 W !,$P(IBREC1,U)_" "_"("_IBILL_")",?27,$P($G(^DPT(+$P(IBREC1,U,2),0)),U),?52,$P($G(^DPT($P(IBREC1,U,2),0)),U,9),!
76 S IBLINE=5
77 Q
78 ;
79ASK ;
80 I $E(IOST,1,2)'["C-" Q
81 N DIR,DIROUT,DIRUT,DTOUT,DUOUT
82 S DIR(0)="E" D ^DIR
83 I ($D(DIRUT))!($D(DUOUT)) S IBQUIT=1
84 Q
85 ;
86EXITQ ; - clean up and exit
87 I $E(IOST,1,2)["C-" K DIR S DIR(0)="E" W ! D ^DIR K DIR
88 K ^TMP("IBXERR",$J),^TMP("IBXDATA",$J),IBXERR
89 D CLEAN^DILF
90 Q
91 ;
92EXTRACT(IBIFN,IBBATCH,IBFORM,IBLOCAL) ; Extracts transmitted form data into global
93 ; ^TMP("IBXDATA",$J). Errors are in ^TMP("IBXERR",$J,err_num)=text.
94 ; IBBATCH = Batch # of bill (if known), otherwise, set to 1. This
95 ; variable must be > 0 to prevent a new batch from being added
96 ; IBFORM = the ien of the form in file 353
97 ; IBLOCAL = 1 if OK to use local form, 0 if not
98 N IBVNUM,IBL
99 D FORMPRE^IBCFP1
100 S IBVNUM=$G(IBBATCH)
101 S IBL=$S('$G(IBLOCAL):IBFORM,1:"") ; No local form ... set = main form
102 ; Get local form associated with parent, if any
103 I IBL="" S IBL=$S($P($G(^IBE(353,+IBFORM,2)),U,8):$P(^(2),U,8),1:IBFORM)
104 D SETUP^IBCE837(1)
105 D ROUT^IBCFP1(IBFORM,1,IBIFN,0,IBL)
106 Q
107 ;
Note: See TracBrowser for help on using the repository browser.