source: FOIAVistA/tag/r/SCHEDULING-SD-SC/SCDXSUP1.m@ 812

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

initial load of FOIAVistA 6/30/08 version

File size: 3.3 KB
Line 
1SCDXSUP1 ;RENO/KEITH ALB/SCK - Supervisory Options for Ambulatory Care Reporting; 2/26/97
2 ;;5.3;Scheduling;**104,127,132**;Aug 13,1993
3 Q
4 ;
5APPTY ; Edit Appointment type for Add/Edit
6 N DIC,DTOUT,DUTOUT,SCDFN,SCI,SCG,SCOUT,SCDT,DIR,DIRUT
7 ;
8 S SCBD=$$ASKDT("Beginning") G:SCBD<0 APPQ
9APP1 S SCED=$$ASKDT("Ending") G:SCED<0 APPQ
10 I SCED<SCBD D G APP1
11 . W !!,"Ending date cannot be earlier than the beginning date!"
12 ;
13ASK S DIC="^DPT(",DIC(0)="AEMQ"
14 D ^DIC K DIC
15 G:$D(DTOUT)!$D(DUOUT) APPQ
16 G:Y'>0 EXIT
17 S SCDFN=+Y
18 ;
19 I '$D(^SCE("C",SCDFN)) D G ASK
20 . W !!,"This patient has no outpatient encounters on file!",!!
21 ;
22 K ^TMP("SCEA",$J)
23 S (SCI,SCG,SCOUT)=0
24 ;
25 D WAIT^DICD
26 W !
27 S SCDT=SCED+.999999
28 F S SCDT=$O(^SCE("ADFN",SCDFN,SCDT),-1) Q:'SCDT!(SCOUT)!(SCDT<SCBD) D
29 . S SCI=SCI+1
30 . S SCDT=$P(SCDT,".") ; -- reset to stop processing date
31 . S ^TMP("SCEA",$J,1,SCI)=SCDT
32 . W !,SCI,?5,$$FMTE^XLFDT(SCDT,"1P")
33 . I SCI#5=0 D GET(SCI)
34 ;
35 I SCI'>0 D G ASK
36 . W !!,"No encounters on file for this patient during this date range.",!
37 ;
38 I SCI#5'=0 D GET(SCI)
39 D:SCG SCED
40 G ASK
41APPQ ;
42 K DIE,DR,DTOUT,DUOUT
43 Q
44 ;
45EXIT ;
46 Q
47 ;
48GET(SCN) ; Select appointment from list
49 N DIR,DIRUT,DUOUT,DTOUT
50 K DIR
51 W !
52 S DIR(0)="NO^1:"_SCN,DIR("A")="Select number, or ENTER to continue"
53 S DIR("?",1)="Select entry to edit appointment type for from the list above"
54 S DIR("?")="Press ENTER to continue."
55 D ^DIR K DIR
56 I $D(DUOUT)!($D(DTOUT)) S SCOUT=1 Q
57 I $D(DIRUT) Q
58 I Y S SCG=Y,SCOUT=1
59 Q
60 ;
61SCED ; Select stop code
62 N DIC,DIR,DIE,DR,SCK,DA,SCY,SCLINE,SUCCESS,SCDT,SCDATE,SCE,SCE0,SDLOG
63 ;
64 S SCDATE=^TMP("SCEA",$J,1,SCG)
65 ;
66 S SCDT=SCDATE
67 F S SCDT=$O(^SCE("ADFN",SCDFN,SCDT)) Q:'SCDT!($P(SCDT,".")'=SCDATE) D
68 . S SCE=0
69 . F S SCE=$O(^SCE("ADFN",SCDFN,SCDT,SCE)) Q:'SCE D
70 . . S SCE0=$G(^SCE(SCE,0))
71 . . I $P($G(^SC(+$P(SCE0,U,4),"OOS")),U),$G(^SCE(SCE,"CG")) D SET
72 ;
73 I '$D(SCK) D Q
74 . W !!,"No occasion-of-service add/edits for this patient/date.",!
75 ;
76 I $D(SCK) D
77 . W !!,"Appt. DT",?24,"Location",?60,"Appt. Type"
78 . S SCLINE="",$P(SCLINE,"-",(IOM-1))="" W !,SCLINE
79 ;
80 S SCE=0
81 F S SCE=$O(SCK(SCE)) Q:'SCE D W !!
82 . S Y=$P(SCK(SCE),U) X ^DD("DD")
83 . W !,Y,?24,$E($P(SCK(SCE),U,2),1,30),?60,$E($P(SCK(SCE),U,3),1,18)
84 ;
85 K DIC
86 S DIC="^SD(409.1,",DIC(0)="AEMQ"
87 S DIC("A")="Select new appointment type for these encounters: "
88 S DIC("B")="COMPUTER GENERATED"
89 D ^DIC K DIC
90 Q:$D(DTOUT)!$D(DUOUT)
91 Q:Y<1
92 S SCY=$P(Y,U)
93 ;
94 K DIR
95 S DIR(0)="Y",DIR("A")="OK to change to "_$P(Y,U,2),DIR("B")="YES"
96 D ^DIR K DIR
97 Q:$D(DTOUT)!$D(DUOUT)
98 Q:'Y
99 ;
100 K DIE,DR
101 S DA=0
102 F S DA=$O(SCK(DA)) Q:'DA D
103 . K SUCCESS
104 . L +^SCE(DA):5 S SUCCESS=$S(($T):1,1:0)
105 . I SUCCESS D
106 .. S DIE="^SCE(",DR=".1////^S X=SCY"
107 .. D ^DIE K DIE
108 .. D LOGDATA^SDAPIAP(DA,.SDLOG)
109 . E D
110 .. W !,"Outpatient Encounter entry: "_DA_" for "_$P($G(^DPT(SCDFN,0)),U)_" is in use, cannot edit."
111 . L -^SCE(DA)
112 ;
113 W !,"Done."
114 Q
115 ;
116SET ;
117 N SCDT,SCCL,SCTY
118 ;
119 S SCDT=+SCE0
120 S SCCL=$P(^SC($P(SCE0,U,4),0),U)
121 S SCTY=$P($G(^SD(409.1,+$P(SCE0,U,10),0)),U)
122 S:SCDT SCK(SCE)=SCDT_U_SCCL_U_SCTY
123 Q
124 ;
125ASKDT(TXT) ; Enter beginning date for searching outpatient encounter file
126 S DIR(0)="DA^2961001:NOW:EXP",DIR("A")="Enter "_TXT_" date for search: "
127 S DIR("?")="^D HELP^%DTC"
128 S DIR("B")=$$FMTE^XLFDT($$DT^XLFDT())
129 D ^DIR K DIR
130 S:$D(DIRUT) Y=-1
131 K DIRUT
132 Q Y
Note: See TracBrowser for help on using the repository browser.