source: FOIAVistA/tag/r/SCHEDULING-SD-SC/SDROUT.m@ 1233

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

initial load of FOIAVistA 6/30/08 version

File size: 3.9 KB
Line 
1SDROUT ;BSN/GRR - ROUTING SLIPS ; 26 APR 84 11:26 am
2 ;;5.3;Scheduling;**3,39,377**;Aug 13, 1993
3 N VAUTC,SDPLSRT,SDMATCH
4 S (SDIQ,SDX,DIV,SDREP,SDSTART)="" D DIV^SDUTL I $T D ROUT^SDDIV G:Y<0 END
5R1 S %=2 W !,"DO YOU WANT ROUTING SHEET FOR A SINGLE PATIENT" D YN^DICN I '% D QQ G R1
6 G:%<0 END S SDSP=$S(%=2:"N",1:"Y") G:SDSP["Y" SIN1^SDROUT1
7R2 R !,"WANT (A)LL ROUTING SHEETS OR (O)NLY ADD-ONS: ONLY ADD-ONS// ",X:DTIME G:X["^"!('$T) END I X="" S X="O" W X
8 S Z="^ALL ROUTING SHEETS^ONLY ADD-ONS" D IN^DGHELP I %=-1 W !?12,"CHOOSE FROM:",!?12,"O - To only see add-ons",!?9,"or A - To see all routing sheets" G R2
9 S SDX=$S(X="O":"ADD-ONS",1:"ALL")
10R22 S ORDER=0,DIR(0)="S^T:TERMINAL DIGIT;N:NAME;C:CLINIC;P:PHYSICAL LOCATION",DIR("B")="T",DIR("A")="PRINT IN",DIR("?")="^D HELP^SDROUT" D ^DIR
11 G:Y<0!$D(DTOUT)!$D(DIROUT)!$D(DIRUT) R2
12 S X=Y K DIR,DTOUT,DIROUT,DIRUT
13R4 S ORDER=$S(X="T":1,X="N":"",X="P":3,1:2)
14 ;
15RPL I ORDER=3 D
16 .S DIR("?")="Enter Physical Location to sort by. Must be an exact match"
17 .S DIR("??")="Enter Physical Location to sort by. Must be an exact matchas this is a Free Text field."
18 .S DIR(0)="F^1:25",DIR("A")="ENTER PHYSICAL LOCATION TO SORT BY"
19 .S DIR("B")="ALL" D ^DIR
20 I ORDER=3,Y<0!$D(DTOUT)!$D(DIROUT)!$D(DIRUT) Q
21 I ORDER=3 S SDPLSRT=X
22 I ORDER=3,$$PLVAL'=1 W !,"Not an exact match!" G RPL
23 I ORDER=3 K DIR,DTOUT,DIROUT,DIRUT
24 ;
25 D:'$D(DT) DT^SDUTL S %DT="AEXF",%DT("A")="PRINT ROUTING SLIPS FOR WHAT DATE: " D ^%DT K %DT("A") G:Y<1 END S SDATE=Y
26A5 S %=2 W !,"IS THIS A REPRINT OF A PREVIOUS RUN" D YN^DICN I '% D QQ G A5
27 Q:%<0 I '(%-1) S POP=0 D REP^SDROUT1 Q:POP
28 I ORDER=2,SDREP="" G END:'$$CLINIC(DIV,.VAUTC)
29 I ORDER=3,SDREP="" G END:'$$CLINIC(DIV,.VAUTC)
30 S VAR="DIV^VAUTC^VAUTC(^SDX^ORDER^SDATE^SDIQ^SDREP^SDSTART^SDLOC^SDPLSRT"
31 S DGPGM="START^SDROUT"
32 D ZIS^DGUTQ G:POP END^SDROUT1
33 G START
34START K ^UTILITY($J) U IO
35 S Y=SDATE D DTS^SDUTL S APDATE=Y,Y=DT D DTS^SDUTL S PRDATE=Y
36 F SC=0:0 S SC=$O(^SC(SC)) Q:SC<1 D CHECK I $T S GDATE=SDATE F K=0:0 S GDATE=$O(^SC(SC,"S",GDATE)) Q:GDATE<1!(GDATE>(SDATE+1)) I $D(^SC(SC,"S",GDATE,1)) F L=0:0 S L=$O(^SC(SC,"S",GDATE,1,L)) Q:L<1 I $D(^(L,0)),$P(^(0),U,9)'="C" D GOT^SDROUT0
37 G GO^SDROUT0
38CHECK I $P(^SC(SC,0),"^",3)="C",$S(DIV="":1,$P(^SC(SC,0),"^",15)=DIV:1,1:0),$S('$D(^SC(SC,"I")):1,+^("I")=0:1,+^("I")>SDATE:1,+$P(^("I"),"^",2)'>SDATE&(+$P(^("I"),"^",2)):1,1:0)
39 I $T,$S(ORDER'=2:1,SDREP:1,VAUTC=1:1,1:$D(VAUTC(SC)))
40 Q
41QQ W !,"RESPOND YES OR NO" Q
42END K VAUTC,ALL,DIV,ORD,ORDER,RMSEL,SDIQ,SDREP,SDSP,SDSTART,SDX,X,Y,C,V,I,SDEF,%I Q
43 ;
44CLINIC(SDIV,VAUTC) ;
45 N DIV,SDX,ORDER,SDATE,SDIQ,SDREP,SDSTART,VAUTD
46 I 'SDIV S VAUTD=1
47 I SDIV S VAUTD=0,VAUTD(SDIV)=$P($G(^DG(40.8,SDIV,0)),U)
48 Q $$CLINIC1()
49 ;
50CLINIC1() ; -- get clinic data
51 ; input: VAUTD := divisions selected
52 ; output: VAUTC := clinic selected (VAUTC=1 for all)
53 ; return: was selection made [ 1|yes 0|no]
54 ;
55 W !!,$$LINE^SDAMO("Clinic Selection")
56 ;
57 ; -- select clinics
58 ; -- call generic clinic screen, correct division
59 ;
60 S DIC("S")="I $$CLINIC2^SDROUT(Y),$S(VAUTD:1,$D(VAUTD(+$P(^SC(Y,0),U,15))):1,'+$P(^(0),U,15)&$D(VAUTD(+$O(^DG(40.8,0)))):1,1:0)"
61 S DIC="^SC(",VAUTSTR="clinic",VAUTVB="VAUTC",VAUTNI=2
62 D FIRST^VAUTOMA
63 ;
64 I Y<0 K VAUTC
65CLINICQ Q $D(VAUTC)>0
66 ;
67CLINIC2(SDCL) ; -- generic screen for hos. loc. entries
68 ; input: SDCL := ifn of HOSPITAL LOCATION file
69 ; returned := [ 0 | do not use entry ; 1 | use entry ]
70 ;
71 ; -- must be a clinic
72 N X S X=$G(^SC(SDCL,0))
73 Q $P(X,"^",3)="C"
74 ;
75PLVAL() ; Physical Location Validation.
76 N SDCLIN,SDPLOC
77 S SDMATCH=0
78 I SDPLSRT="ALL" S SDMATCH=1 Q SDMATCH
79 S SDCLIN="" F S SDCLIN=$O(^SC(SDCLIN)) Q:SDCLIN=""!(SDMATCH=1) D
80 .S SDPLOC=$P($G(^SC(SDCLIN,0)),"^",11)
81 .I SDPLOC=SDPLSRT S SDMATCH=1
82 Q SDMATCH
83HELP W !?12,"CHOOSE FROM:",!?12,"T - To see routing slips sorted in terminal digit order",!?12,"N - To see routing slips sorted in alphabetical order by name",!?12,"C - To see routing slips printed by clinic " D
84 .W !,?12,"or P - To see routing slip printed by physical location"
Note: See TracBrowser for help on using the repository browser.