source: WorldVistAEHR/trunk/r/SOCIAL_WORK-SOW-SWBH-SWFG/SOWKRF.m@ 1800

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

initial load of WorldVistAEHR

File size: 3.6 KB
Line 
1SOWKRF ;B'HAM ISC/SAB-Routine to print Referral report ; 02 Mar 94 / 9:50 AM [ 02/27/97 9:38 AM ]
2 ;;3.0; Social Work ;**17,25,31,35,48,53**;27 Apr 93
3 S:$G(SOWKAB)'="ALL" SOWKFD="" G:SOWKFD]"" ENQ
4BEG W ! S %DT="AEXP",%DT("A")="ALL CASES STARTING FROM: " D ^%DT G:"^"[X CLOS G:Y'>0 BEG S SOWKFD=Y
5EN S %DT("A")="ALL CASES ENDING: " D ^%DT G:"^"[X CLOS G:Y'>0 EN S SOWKFB=Y
6 F L=0:0 W !,"Do you want Complete Service" S %=2 D YN^DICN Q:% I %Y["?" D YN^SOWKHELP
7 I %=1 S SWA=1,SWB=0 G ACM
8 F L=0:0 W !,"Do you want report by Supervisor " S %=2 D YN^DICN Q:% I %Y["?" D YN^SOWKHELP
9 I %=1 S SWB=1,SWA=0
10 G:%=2 SWW G:%=-1 CLOS S DIC="^VA(200,",DIC(0)="AEQ",DIC("A")="Enter Supervisor's last name: ",D="B",DIC("S")="I $D(^VA(200,""ASWC"",+Y))"
11 D IX^DIC G:"^"[X CLOS S SWZ=+Y K DIC,D G:Y'>0 CLOS G AMD
12SWW S DIC("S")="I $D(^VA(200,+Y,654)),$P(^VA(200,+Y,654),""^"")",DIC="^VA(200,",DIC(0)="AEQ",DIC("A")="Enter Social Worker's last name: "
13 D ^DIC G:"^"[X CLOS S SWZ=+Y K DIC G:Y'>0 CLOS S (SWA,SWB)=0 G ACB
14 ;CALCULATES TOTAL
15ACM D DEV I $D(ZTSK)!($D(OUT))!(POP) K ZTSK G CLOS
16ENQ Q:"^"[X
17EN1 D CLE G:SWB ENQ1 G:'SWA&'SWB ENQ2
18 F I=0:0 S I=$O(^SOWK(650,I)) Q:'I S H=^SOWK(650,I,0) F C=0:0 S C=$O(^SOWK(650,I,1,C)) Q:'C I $P(H,"^",18)'<SOWKFD,$P(H,"^",18)'>SOWKFB S W=$P(^SOWK(650,I,1,C,0),"^") D RES
19CA ;PRINT TOTALS
20 S:US PT=(US/US)*100 S:NU NPT=(NU/NU)*100
21 F O=0:0 S O=$O(^SOWK(653,O)) Q:'O S:US TP(O)=(US(O)/US)*100 S:NU NA(O)=(NU(O)/NU)*100
22 U IO W:$Y @IOF W $S(SWA:"COMPLETE SERVICE",SWB:"SUPERVISOR: "_$P(^VA(200,SWZ,0),"^"),1:"SOCIAL WORKER: "_$P(^VA(200,SWZ,0),"^"))
23 W !,$E(SOWKFD,4,5)_"/"_$E(SOWKFD,6,7)_"/"_$E(SOWKFD,2,3)_" TO "_$E(SOWKFB,4,5)_"/"_$E(SOWKFB,6,7)_"/"_$E(SOWKFB,2,3),?30,"RESOURCES/REFERRALS",!!,?43,"UNABLE",!,?45,"TO"
24 W !?25,"USED",?34,"PERCENT",?43,"ACCESS",?52,"PERCENT"
25 F I=0:0 S I=$O(^SOWK(653,I)) Q:'I!($G(OUT1)=1) D CHK Q:$G(OUT1)=1 W !,$E($P(^SOWK(653,I,0),"^"),1,24),?25,$J(US(I),3,0),?36,$J(TP(I),3,0),?43,$J(NU(I),3,0),?54,$J(NA(I),3,0)
26 G:$G(OUT1)=1 CLOS
27 W !,"TOTALS",?25,$J(US,3,0),?36,$J(PT,3,0),?43,$J(NU,3,0),?54,$J(NPT,3,0),!
28CLOS I $E(IOST)["C",('$G(OUT1)) R !,"Press <RETURN> to continue: ",SWXX:DTIME K SWXX W @IOF
29 I $G(SOWKAB)'="ALL" W:$E(IOST)'["C" @IOF D ^%ZISC K SOWKAB
30 K US,IOP,%,%Y,L,OUT1,SW,NU,H,NPT,PT,O,C,D,DIC,Y,NA,TP,POP,%DT,G,I,W D:$D(ZTSK) KILL^%ZTLOAD
31 Q
32AMD D DEV I $D(ZTSK)!($D(OUT))!(POP) K ZTSK G CLOS
33ENQ1 D CLE
34 F I=0:0 S I=$O(^SOWK(650,I)) Q:'I D RF
35 G CA
36ACB D DEV I $D(ZTSK)!($D(OUT))!(POP) K ZTSK G CLOS
37ENQ2 D CLE
38 F I=0:0 S I=$O(^SOWK(650,I)) Q:'I S H=^SOWK(650,I,0) F C=0:0 S C=$O(^SOWK(650,I,1,C)) Q:'C I $P(H,"^",3)=SWZ,$P(H,"^",18)'<SOWKFD,$P(H,"^",18)'>SOWKFB S W=$P(^SOWK(650,I,1,C,0),"^") D RES
39 G CA
40 Q
41DEV ;
42 S OUT1=0
43 K ZTSK,OUT,%ZIS,IOP S SOWKION=ION,%ZIS="QM",%ZIS("B")="" D ^%ZIS K %ZIS I POP S IOP=SOWKION D ^%ZIS K IOP,SOWKION S POP=1 Q
44 K SOWKION
45 I $D(IO("Q")) S ZTRTN=$S(SWA:"EN1^SOWKRF",SWB:"ENQ1^SOWKRF",'SWA&'SWB:"ENQ2^SOWKRF",1:"EN1^SOWKRF") F G="SWZ","SOWKAB","SOWKFD","SOWKFB","SWA","SWB","X","OUT1" S:$D(@G) ZTSAVE(G)=""
46 I K IO("Q") D ^%ZTLOAD I '$D(ZTSK) S OUT=1 K G,SWZ,SOWKFD,SOWKFB,SWA,SWB,X Q
47 I $D(ZTSK) K G,SWZ,SOWKFD,SOWKFB,SWA,SWB,X W !,"Task Queued to Print !!",!
48 Q
49CLE S (PT,NPT,US,NU)=0
50 F I=0:0 S I=$O(^SOWK(653,I)) Q:'I S (NA(I),TP(I),US(I),NU(I))=0
51 Q
52RF S H=^SOWK(650,I,0),SW=$P(H,"^",3) F C=0:0 S C=$O(^SOWK(650,I,1,C)) Q:'C I $P(H,"^",18)'<SOWKFD,$P(H,"^",18)'>SOWKFB,$P(^VA(200,SW,654),"^",2)=SWZ S W=$P(^SOWK(650,I,1,C,0),"^") D RES
53 Q
54RES I $P(^SOWK(650,I,1,C,0),"^",3) S US(W)=US(W)+1,US=US+1 Q
55 S NU(W)=NU(W)+1,NU=NU+1
56 Q
57CHK ;checks for the end of page
58 Q:($Y+5)'>IOSL
59 N SWXX
60 I $E(IOST)["C" R !,"Press <RETURN> to continue: ",SWXX:DTIME I SWXX["^" S OUT1=1
61 W @IOF Q
Note: See TracBrowser for help on using the repository browser.