source: BMXNET_RPMS_dotNET_UTILITIES-BMX/trunk/m/BMXADE2.m@ 1089

Last change on this file since 1089 was 1087, checked in by Sam Habiel, 14 years ago

BMX updated to v2.3. No actual routine changes from 2.21

File size: 3.3 KB
RevLine 
[645]1BMXADE2 ; IHS/OIT/HMW - BMXNet ADO.NET PROVIDER ;
[1087]2 ;;2.3;BMX;;Jan 25, 2011
[645]3 ;
4 ;
5 ;Dental Excel report demo
6 ;
7BMXADE(BMXGBL,BMXBEG,BMXEND) ;EP
8 ;Returns recordset containing services and minutes by reporting facility, Provider, and ADA Code
9 ;
10 N BMXBEGDT,BMXENDDT,BMXTMP,BMXDT,BMXRD,BMXIEN,BMXNOD,BMXCOM,BMXFAC,BMXSU,BMXCOMP,BMXSUP,BMXFACP,BMXSVC,BMXMIN,BMXLVL,BMXFEE
11 S U="^",BMXRD=$C(30)
12 K ^BMXTEMP($J),^BMXTMP($J)
13 S BMXGBL="^BMXTEMP("_$J_")"
14 S ^BMXTEMP($J,0)="T00030FACILITY^T00030PROVIDER^T00030ADA_CODE^T00030LEVEL^I00030SERVICES^I00030MINUTES^I00030FEE"_BMXRD
15 S X=BMXBEG,%DT="P" D ^%DT S BMXBEGDT=Y
16 S X=BMXEND,%DT="P" D ^%DT S BMXENDDT=Y
17 I BMXENDDT<BMXBEGDT S BMXTMP=BMXENDDT,BMXENDDT=BMXBEGDT,BMXBEGDT=BMXTMP
18 S BMXBEGDT=$P(BMXBEGDT,".")
19 S BMXENDDT=$P(BMXENDDT,"."),$P(BMXENDDT,".",2)=99999
20 ;
21 ;$O Thru ADEPCD("AC" DATE X-REF
22 ;Temp global is (FAC,PROV,CODE)=SVCS^MINS
23 ;
24 S BMXDT=BMXBEGDT F S BMXDT=$O(^ADEPCD("AC",BMXDT)) Q:'+BMXDT Q:BMXDT>BMXENDDT D
25 . S BMXIEN=0 F S BMXIEN=$O(^ADEPCD("AC",BMXDT,BMXIEN)) Q:'+BMXIEN D
26 . . Q:'$D(^ADEPCD(BMXIEN,0))
27 . . S BMXNOD=^ADEPCD(BMXIEN,0)
28 . . S BMXFACP=+$P(BMXNOD,U,3)
29 . . S BMXPRVP=+$P(BMXNOD,U,4)
30 . . S BMXCODP=0 F S BMXCODP=$O(^ADEPCD(BMXIEN,"ADA","B",BMXCODP)) Q:'+BMXCODP D
31 . . . D CALCMIN(BMXCODP,.BMXMIN)
32 . . . D CALCFEE(BMXCODP,.BMXFEE)
33 . . . S BMXCODPS=0,BMXSVC=0 F S BMXCODPS=$O(^ADEPCD(BMXIEN,"ADA","B",BMXCODP,BMXCODPS)) Q:'+BMXCODPS D
34 . . . . S BMXSVC=BMXSVC+1
35 . . . S:'$D(^BMXTMP($J,BMXFACP,BMXPRVP,BMXCODP)) ^BMXTMP($J,BMXFACP,BMXPRVP,BMXCODP)="0^0"
36 . . . S $P(^BMXTMP($J,BMXFACP,BMXPRVP,BMXCODP),U)=$P(^(BMXCODP),U)+BMXSVC
37 . . . S $P(^BMXTMP($J,BMXFACP,BMXPRVP,BMXCODP),U,2)=$P(^(BMXCODP),U,2)+(BMXSVC*BMXMIN)
38 . . . S $P(^BMXTMP($J,BMXFACP,BMXPRVP,BMXCODP),U,3)=$P(^(BMXCODP),U,3)+(BMXSVC*BMXFEE)
39 . . . Q
40 . . Q
41 . Q
42 ;
43 ;Traverse ^BMXTMP and fill in ^BMXTEMP
44 S BMXI=0
45 S BMXFACP=-1 F S BMXFACP=$O(^BMXTMP($J,BMXFACP)) Q:BMXFACP="" D
46 . I BMXFACP=0 S BMXFAC="UNKNOWN"
47 . E S BMXFAC=$P($G(^DIC(4,BMXFACP,0)),U) S:BMXFAC="" BMXFAC="UNKNOWN"
48 . S BMXPRVP=-1 F S BMXPRVP=$O(^BMXTMP($J,BMXFACP,BMXPRVP)) Q:BMXPRVP="" D
49 . . S BMXPRV=$P($G(^DIC(16,BMXPRVP,0)),U) S:BMXPRV="" BMXPRV="UNKNOWN"
50 . . S BMXCODP=-1 F S BMXCODP=$O(^BMXTMP($J,BMXFACP,BMXPRVP,BMXCODP)) Q:'+BMXCODP D
51 . . . D CODLVL(BMXCODP,.BMXCOD,.BMXLVL)
52 . . . S BMXI=BMXI+1
53 . . . S BMXSVC=$P(^BMXTMP($J,BMXFACP,BMXPRVP,BMXCODP),U)
54 . . . S BMXMIN=$P(^BMXTMP($J,BMXFACP,BMXPRVP,BMXCODP),U,2)
55 . . . S BMXFEE=$P(^BMXTMP($J,BMXFACP,BMXPRVP,BMXCODP),U,3)
56 . . . S ^BMXTEMP($J,BMXI)=BMXFAC_U_BMXPRV_U_BMXCOD_U_BMXLVL_U_BMXSVC_U_BMXMIN_U_BMXFEE_BMXRD
57 . . . Q
58 . . Q
59 . Q
60 S BMXI=BMXI+1
61 S ^BMXTEMP($J,BMXI)=$C(31)
62 Q
63 ;
64CALCMIN(BMXCODP,BMXMIN) ;
65 ;Returns Minutes for code BMXCOD
66 N BMXANOD
67 S BMXMIN=0
68 Q:'$D(^AUTTADA(BMXCODP,0))
69 S BMXANOD=^AUTTADA(BMXCODP,0)
70 ;S BMXLVL=$P(BMXANOD,U,5)
71 S BMXMIN=$P(BMXANOD,U,4)
72 Q
73 ;
74CALCFEE(BMXCODP,BMXFEE) ;
75 ;Returns FEE for code BMXCOD. Only works for ANMC local fee field
76 N BMXANOD
77 S BMXFEE=0
78 Q:'$D(^AUTTADA(BMXCODP,0))
79 S BMXANOD=^AUTTADA(BMXCODP,0)
80 S BMXFEE=+$P(BMXANOD,U,12)
81 Q
82 ;
83CODLVL(BMXCODP,BMXCOD,BMXLVL) ;
84 ;Returns Name and Level of code at ADACODP
85 N BMXANOD
86 S BMXCOD="",BMXLVL=""
87 Q:'$D(^AUTTADA(BMXCODP,0))
88 S BMXANOD=^AUTTADA(BMXCODP,0)
89 S BMXCOD=$P(BMXANOD,U)
90 S BMXLVL=$P(BMXANOD,U,5)
Note: See TracBrowser for help on using the repository browser.