source: WorldVistAEHR/trunk/r/QUASAR-ACKQ/ACKQCDD2.m@ 1450

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

initial load of WorldVistAEHR

File size: 6.7 KB
Line 
1ACKQCDD2 ;AUG/JLTP BIR/PTD HCIOFO/AG-Generate A&SP Service CDR for Division - CONTINUED ; [05/15/96 9:30 ]
2 ;;3.0;QUASAR;;Feb 11, 2000
3 ;Per VHA Directive 10-93-142, this routine SHOULD NOT be modified.
4INDCAT(ACKCDR) ;Enter hours for CDR account.
5 N DIR,Y,CDR,X
6INDCAT2 K DIRUT,DUOUT,DTOUT,DIR S X=ACKCDR
7 S DIR(0)="N^0:"_ACKRTH,CDR=$P(^ACK(509850,X,0),U)_" "_$P(^(0),U,2)
8 S DIR("A")="Enter Hours for "_CDR
9 S DIR("??")="^W !!,""Enter the number of hours that you wish to charge to CDR"",!,""account "",CDR,""."""
10 D ^DIR
11 I Y?1"^"1.E W !,"Jumping not allowed.",! G INDCAT2
12 Q:$D(DIRUT)
13 S ^TMP("ACKQCDD",$J,"ACKH",+CDR)=Y,ACKRTH=ACKRTH-Y
14 Q
15PASS ;Enter hours for pass-through account.
16 N DIC,DIR,X,Y,CDR
17PASS2 S DIC="^ACK(509850,",DIC("A")="Select Pass-Through Account: "
18 S DIC("S")="I $P(^(0),U,3)=""P""",DIC(0)="AEMQZ"
19 D ^DIC K DIC
20 I X?1"^"1.E W !,"Jumping not allowed.",! G PASS2
21 I Y<0 S DIRUT=1 Q
22 S CDR=+$P(Y,U,2),CDR(0)=$P(Y(0),U,2)
23PASS3 I $D(^TMP("ACKQCDD",$J,"ACKH",CDR)) S DIR("B")=^TMP("ACKQCDD",$J,"ACKH",CDR)
24 S DIR(0)="N^0:"_ACKRTH,DIR("A")="Enter Hours for "_CDR(0)
25 S DIR("??")="^W !!,""Enter the number of hours to charge to "",CDR(0)"
26 D ^DIR
27 I Y?1"^"1.E W !,"Jumping not allowed.",! G PASS3
28 Q:$D(DIRUT)
29 S ^TMP("ACKQCDD",$J,"ACKH",CDR)=Y S:$D(DIR("B")) ACKRTH=ACKRTH+DIR("B") S ACKRTH=ACKRTH-Y
30 Q
31DISREM ;DISTRIBUTE REMAINING HOURS
32 N I,X
33 S I=0 F S I=$O(ACKTCH(I)) Q:'I D
34 .S X=(ACKTCH(I)/ACKTCH)*ACKRTH,ACKTCH(I)=ACKTCH(I)+X
35 Q
36PERCENT ;CONVERT ALL VALUES TO %
37 N I,X
38 S ACKTP=0
39 S I=0 F S I=$O(^TMP("ACKQCDD",$J,"ACKH",I)) Q:'I D
40 . S X=^TMP("ACKQCDD",$J,"ACKH",I)/ACKTPH*100
41 . S ^TMP("ACKQCDD",$J,"ACKH",I)=X,ACKTP=ACKTP+X
42 S I=0 F S I=$O(ACKTCH(I)) Q:'I D
43 . S ^TMP("ACKQCDD",$J,"ACKH",I)=ACKTCH(I)/ACKTPH*100
44 . S ACKTP=ACKTP+^TMP("ACKQCDD",$J,"ACKH",I)
45 K ACKTCH
46 Q
47 ;
48CLINH ;Calculate number of clinic hours & student training
49 ; (.12) by CDR series. See README at end.
50 ; requires ACKSD - start of date range
51 ; ACKED - end of date range
52 ; ACKDIV - selected division
53 N ACKCDR,ACKD,I,ACKV,ACKMINS
54 K ACKTCH,ACKTSH S (ACKTCH,ACKTSH)=0
55 ;Loop through selected date range and get total minutes and total
56 ; student minutes
57 F ACKD=(ACKSD-.1):0 S ACKD=$O(^ACK(509850.6,"B",ACKD)) Q:'ACKD!(ACKD>(ACKED+.9)) D
58 .S ACKV=0 F S ACKV=$O(^ACK(509850.6,"B",ACKD,ACKV)) Q:'ACKV D
59 .. ; check division
60 .. S ACKVDIV=$$GET1^DIQ(509850.6,ACKV_",",60,"I")
61 .. I ACKVDIV'=ACKDIV Q
62 ..;Get TIME SPENT and CDR#. Student present? YES, increment ACKTSH array; else increment ACKTCH array.
63 ..S ACKMINS=+$P(^ACK(509850.6,ACKV,0),U,7)
64 ..S ACK2=^ACK(509850.6,ACKV,2)
65 ..S ACKCDR=+$P(ACK2,U,2),ACKCDRN=+$P($G(^ACK(509850,ACKCDR,0)),U,1)
66 ..I $P(ACK2,U,4) D ;student present
67 ...S ACKTSH=ACKTSH+ACKMINS
68 ...S ACKTSH($E(ACKCDRN,1,2))=$G(ACKTSH($E(ACKCDRN,1,2)))+ACKMINS
69 ..I '$P(ACK2,U,4) D ;student not present
70 ...S ACKTCH=ACKTCH+ACKMINS
71 ...S ACKTCH(ACKCDRN)=$G(ACKTCH(ACKCDRN))+ACKMINS
72 ;
73 ;Convert minutes to hours - total time (less student)
74 S ACKTCH=ACKTCH/60
75 S ACKCDRN=0 F S ACKCDRN=$O(ACKTCH(ACKCDRN)) Q:'ACKCDRN D
76 . S ACKTCH(ACKCDRN)=ACKTCH(ACKCDRN)/60
77 ;Convert minutes to hours - student time, and move into ^TMP
78 S ACKTSH=ACKTSH/60
79 S ACKCDRN=0 F S ACKCDRN=$O(ACKTSH(ACKCDRN)) Q:'ACKCDRN D
80 . S ACKTSH(ACKCDRN)=ACKTSH(ACKCDRN)/60
81 . I (ACKCDRN<21)!(ACKCDRN>27) D
82 .. S ^TMP("ACKQCDD",$J,"ACKH",ACKCDRN_"00.12")=+ACKTSH(ACKCDRN)
83 . I ACKCDRN'<21,ACKCDRN'>27 D
84 .. S ^TMP("ACKQCDD",$J,"ACKH",2800.12)=+ACKTSH(ACKCDRN)
85 Q
86 ;
87TPH ;Ask for Total Paid Hours.
88 N DIR,X,Y
89TPH2 K DTOUT,DUOUT,DIRUT,DIR
90 S DIR(0)="N^1:9999",DIR("A")="Enter Total Paid Hours"
91 S DIR("?")="Enter a number between 1 and 9999."
92 S DIR("??")="^D TPH^ACKQCDD1"
93 W ! D ^DIR
94 I Y?1"^"1.E W !,"Jumping not allowed.",! G TPH2
95 S ACKTPH=+Y
96 Q
97INDEX ;Build ^TMP arrays in category and CDR# order.
98 N I,CAT,CDR
99 S I=0 F S I=$O(^ACK(509850,I)) Q:'I D
100 . S CDR=^ACK(509850,I,0),CAT=$P(CDR,U,4)
101 . S ^TMP("ACKQCDD",$J,"ACKCAT",CAT,+CDR)=$P(CDR,U,1,2)
102 . S:ACKSAV ^TMP("ACKQCDD",$J,"ACKNDX",+CDR)=$P(CDR,U)
103 Q
104SAVE ;
105 N IFN,M
106 S IFN=+$$SITE^VASITE_$E(ACKMO,1,5)
107 ;
108 ; if there is data for the selected month/division then ask to delete
109 I $O(^ACK(509850.7,IFN,5,ACKDIV,4,0)) D Q:$D(DIRUT)
110 .K DIR,X,Y S DIR(0)="Y",DIR("A")="Delete existing CDR data and regenerate the CDR for "_ACKXRNG,DIR("B")="NO"
111 .S DIR("?")="Enter YES to delete and regenerate the CDR, otherwise enter NO.",DIR("??")="^D REGEN^ACKQHLP1"
112 .W ! D ^DIR K DIR S:Y=0 DIRUT=1 Q:$D(DIRUT)
113 .D KILLOLD ;remove old data for this month and division
114 ;
115 ; now (re)create the file
116 L +^ACK(509850.7,IFN)
117 ; check the headers exist
118 I '$D(^ACK(509850.7,IFN,0)) D CRE8HDR
119 I '$D(^ACK(509850.7,IFN,5,ACKDIV,0)) D CRE8DIV
120 ;
121 ; file the CDR total paid hours
122 S DIE="^ACK(509850.7,"_IFN_",5,",DA=ACKDIV,DA(1)=IFN,DR="5.05////"_ACKTPH D ^DIE K DIE,DA,DR
123 ;
124 ; update CDR percentages
125 S CDR=0 F S CDR=$O(^TMP("ACKQCDD",$J,"ACKH",CDR)) Q:'CDR I ^TMP("ACKQCDD",$J,"ACKH",CDR) D
126 .S DIC="^ACK(509850.7,"_IFN_",5,"_ACKDIV_",4,",DIC(0)="L"
127 .S DLAYGO=509850.75,X=$P(^TMP("ACKQCDD",$J,"ACKNDX",CDR),U),DINUM=+X
128 .S DIC("P")=$P(^DD(509850.75,5.8,0),U,2),DA(2)=IFN,DA(1)=ACKDIV
129 .K DD,DO D FILE^DICN K DA
130 .S DIE="^ACK(509850.7,"_IFN_",5,"_ACKDIV_",4,"
131 .S DA=+CDR,DA(1)=ACKDIV,DA(2)=IFN
132 .S DR="54.02////"_$J(^TMP("ACKQCDD",$J,"ACKH",+CDR),0,9)
133 .D ^DIE
134 ;
135 ; end
136 L -^ACK(509850.7,IFN)
137 Q
138KILLOLD ;kill existing CDR data for the selected month and division
139 S DIK="^ACK(509850.7,"_IFN_",5,"_ACKDIV_",4,",DA(2)=IFN,DA(1)=ACKDIV
140 ; loop for each CDR and kill
141 S SUB=0
142 F S SUB=$O(^ACK(509850.7,IFN,5,ACKDIV,4,SUB)) Q:'SUB S DA=SUB D ^DIK
143 ; remove the CDR total paid hours field
144 S DIE="^ACK(509850.7,"_IFN_",5,",DA=ACKDIV,DA(1)=IFN
145 S DR="5.02///"_"@" D ^DIE K DIE,DA,DR
146 ; if there is no workload for the division for the month then empty the file completely
147 I '$O(^ACK(509850.7,IFN,5,ACKDIV,1,0)) D
148 . S DIK="^ACK(509850.7,"_IFN_",5,",DA=ACKDIV,DA(1)=IFN D ^DIK
149 ; end
150 Q
151CRE8HDR ; create a header record for the month
152 N DIC,DINUM,CDR,DD,DO
153 S DIC="^ACK(509850.7,",DIC(0)="L",DLAYGO=509850.7
154 S ACKLAYGO="",X=ACKMO,DINUM=IFN D FILE^DICN
155 Q
156CRE8DIV ; create a header record for the division
157 N DIC,DINUM,CDR,DD,DO
158 S DIC="^ACK(509850.7,"_IFN_",5,",DIC(0)="L",DLAYGO=509850.75
159 S DIC("P")=$P(^DD(509850.7,5,0),U,2)
160 S ACKLAYGO="",X=ACKDIV,DINUM=ACKDIV,DA=ACKDIV,DA(1)=IFN D FILE^DICN
161 Q
162README ;Instructional Support (.12) Calculation:
163 ;As per Dr. Kyle Dennis 5/13/96. First 2 digits of CDR#
164 ;identify most CDR categories. 11-Medical, 12-Surgical,
165 ;13-Psych, 14-NH, 15-Dom Care, 16-Inter. Care, 17-Psych Rehab.
166 ;The CDR to be credited is: First 2 digits_"00.12"
167 ;CDR range 2110 through 2780 is Outpatient Care 2800.12.
168 ;If site uses 5100 HBHC, site must add 5100.12 to CDR file.
169 ;If site uses 8024 DOD SHARE, site must add 8000.12 to CDR file.
170 ;Ignore CATEGORY 11 and 12 from CDR file (#509850).
Note: See TracBrowser for help on using the repository browser.