SCCVEAP ;ALB/RMO,TMP - Appointment Conversion; [ 03/31/95 11:23 AM ]
;;5.3;Scheduling;**211**;Aug 13, 1993
;
EN(SCCVEVT,SCSTDT,SCENDT,SCLOG,SCREQ,SCDFN,SCSTOPF) ;Entry point to loop through all appointments for a specified date range
; Input -- SCCVEVT Conversion event
; 0 = Estimate 1 = Convert 2 = Re-convert
; SCSTDT Start date
; SCENDT End date
; SCLOG Scheduling conversion log IEN
; SCREQ Scheduling conversion request IEN
; SCDFN If restarting, the DFN to start with
; Output -- SCSTOPF Conversion stop flag
;Loop through all patients
I '$G(SCSTOPF) D ALLPAT(SCCVEVT,SCSTDT,SCENDT,SCLOG,SCREQ,+$G(SCDFN),.SCSTOPF)
Q
;
ALLPAT(SCCVEVT,SCSTDT,SCENDT,SCLOG,SCREQ,SCDFN,SCSTOPF) ;Loop through all patients
; Input -- SCCVEVT Conversion event
; SCSTDT Start date
; SCENDT End date
; SCLOG Scheduling conversion log IEN
; SCREQ Scheduling conversion request IEN
; SCDFN If restarting, the DFN to start with
; Output -- SCSTOPF Conversion stop flag
N DFN
S DFN=$S($G(SCDFN):SCDFN-1,1:0)
F S DFN=$O(^DPT(DFN)) Q:'DFN!($G(SCSTOPF)) D PAT(SCCVEVT,DFN,SCSTDT,SCENDT,SCLOG,SCREQ,.SCSTOPF)
Q
;
PAT(SCCVEVT,DFN,SCSTDT,SCENDT,SCLOG,SCREQ,SCSTOPF) ;Loop through a patient's appointments
; Input -- SCCVEVT Conversion event
; DFN Patient IEN
; SCSTDT Start date
; SCENDT End date
; SCLOG Scheduling conversion log IEN
; SCREQ Scheduling conversion request IEN
; Output -- SCSTOPF Conversion stop flag
N SCCLN,SCDTM
IF SCCVEVT D ZERO(DFN)
F SCDTM=SCSTDT:0 S SCDTM=$O(^DPT(DFN,"S",SCDTM)) Q:'SCDTM!($P(SCDTM,".")>SCENDT)!($G(SCSTOPF)) I $D(^(SCDTM,0)) S SCCLN=^(0) I $P(SCCLN,U,2)=""!($P(SCCLN,U,2)="I")!($P(SCCLN,U,2)="NT"),$P($G(^SC(+SCCLN,0)),U,3)="C" D
. S SCCLN=+SCCLN
. D EN^SCCVEAP1(SCCVEVT,DFN,SCDTM,SCCLN,"",SCLOG)
. D STOP^SCCVLOG(SCLOG,SCREQ,.SCSTOPF)
PATQ K SCDA
Q
;
ZERO(DFN) ; -- fix zeroth node if missing
IF '$D(^DPT(DFN,"S",0)),$O(^DPT(DFN,"S",0)) S ^DPT(DFN,"S",0)="^2.98P^^"
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSCCVEAP 2207 printed Oct 16, 2024@18:39:20 Page 2
SCCVEAP ;ALB/RMO,TMP - Appointment Conversion; [ 03/31/95 11:23 AM ]
+1 ;;5.3;Scheduling;**211**;Aug 13, 1993
+2 ;
EN(SCCVEVT,SCSTDT,SCENDT,SCLOG,SCREQ,SCDFN,SCSTOPF) ;Entry point to loop through all appointments for a specified date range
+1 ; Input -- SCCVEVT Conversion event
+2 ; 0 = Estimate 1 = Convert 2 = Re-convert
+3 ; SCSTDT Start date
+4 ; SCENDT End date
+5 ; SCLOG Scheduling conversion log IEN
+6 ; SCREQ Scheduling conversion request IEN
+7 ; SCDFN If restarting, the DFN to start with
+8 ; Output -- SCSTOPF Conversion stop flag
+9 ;Loop through all patients
+10 IF '$GET(SCSTOPF)
DO ALLPAT(SCCVEVT,SCSTDT,SCENDT,SCLOG,SCREQ,+$GET(SCDFN),.SCSTOPF)
+11 QUIT
+12 ;
ALLPAT(SCCVEVT,SCSTDT,SCENDT,SCLOG,SCREQ,SCDFN,SCSTOPF) ;Loop through all patients
+1 ; Input -- SCCVEVT Conversion event
+2 ; SCSTDT Start date
+3 ; SCENDT End date
+4 ; SCLOG Scheduling conversion log IEN
+5 ; SCREQ Scheduling conversion request IEN
+6 ; SCDFN If restarting, the DFN to start with
+7 ; Output -- SCSTOPF Conversion stop flag
+8 NEW DFN
+9 SET DFN=$SELECT($GET(SCDFN):SCDFN-1,1:0)
+10 FOR
SET DFN=$ORDER(^DPT(DFN))
if 'DFN!($GET(SCSTOPF))
QUIT
DO PAT(SCCVEVT,DFN,SCSTDT,SCENDT,SCLOG,SCREQ,.SCSTOPF)
+11 QUIT
+12 ;
PAT(SCCVEVT,DFN,SCSTDT,SCENDT,SCLOG,SCREQ,SCSTOPF) ;Loop through a patient's appointments
+1 ; Input -- SCCVEVT Conversion event
+2 ; DFN Patient IEN
+3 ; SCSTDT Start date
+4 ; SCENDT End date
+5 ; SCLOG Scheduling conversion log IEN
+6 ; SCREQ Scheduling conversion request IEN
+7 ; Output -- SCSTOPF Conversion stop flag
+8 NEW SCCLN,SCDTM
+9 IF SCCVEVT
DO ZERO(DFN)
+10 FOR SCDTM=SCSTDT:0
SET SCDTM=$ORDER(^DPT(DFN,"S",SCDTM))
if 'SCDTM!($PIECE(SCDTM,".")>SCENDT)!($GET(SCSTOPF))
QUIT
IF $DATA(^(SCDTM,0))
SET SCCLN=^(0)
IF $PIECE(SCCLN,U,2)=""!($PIECE(SCCLN,U,2)="I")!($PIECE(SCCLN,U,2)="NT")
IF $PIECE($GET(^SC(+SCCLN,0)),U,3)="C"
Begin DoDot:1
+11 SET SCCLN=+SCCLN
+12 DO EN^SCCVEAP1(SCCVEVT,DFN,SCDTM,SCCLN,"",SCLOG)
+13 DO STOP^SCCVLOG(SCLOG,SCREQ,.SCSTOPF)
End DoDot:1
PATQ KILL SCDA
+1 QUIT
+2 ;
ZERO(DFN) ; -- fix zeroth node if missing
+1 IF '$DATA(^DPT(DFN,"S",0))
IF $ORDER(^DPT(DFN,"S",0))
SET ^DPT(DFN,"S",0)="^2.98P^^"
+2 QUIT
+3 ;