SCCVPOST ;ALB/MJK - Patch SD*5.3*201 Post-Install Routine ; 11/5/97
;;5.3;Scheduling;**211**,Aug 13, 1993
;
EN ; --- main entry point
S U="^"
D BMES^XPDUTL("Post-Install Started...")
;
; -- main driver calls
D RES,LOGDATA
;
D BMES^XPDUTL("Post-Install Finished.")
Q
;
RES ; -- set up resource device
N NAME,SLOTS,DESC
D BMES^XPDUTL(" >>> SCCV RESOURCE device setup...")
S NAME="SCCV RESOURCE"
S SLOTS=1
S DESC="Scheduling Conversion Resource Device"
;
; -- check to see if device already exists
IF $D(^%ZIS(1,"B",NAME)) D G RESQ
. D MES^XPDUTL(" ...Device already exists.")
;
; -- create device
IF $$RES^XUDHSET(NAME,,SLOTS,DESC)>0 D G RESQ
. D MES^XPDUTL(" ...Resource device successfully created.")
;
; -- indicate device creation failed
D MES^XPDUTL(" ...Unable to create resource device!")
RESQ Q
;
LOGDATA ; -- queue job to transfer 'edited by' & 'date entry made' data
N SDUZ,ZTRTN,ZTIO,ZTDESC,ZTDTH,ZTSAVE,ZTSK
;
; -- quit if pre-test
IF '$$OK^SCCVU(0) Q
;
S SDUZ=$G(DUZ)
D BMES^XPDUTL(" >>> Queuing task to transfer log data from Scheduling Visits file")
;
; -- following line in for interactive testing
;D LOGQUE Q
;
; -- has data already been xfer'd
IF $P($G(^SD(404.91,1,"CNV")),U,8) D G LOGDATAQ
. D MES^XPDUTL(" o Data already has been transferred.")
. D MES^XPDUTL(" (No task queued.)")
. D MES^XPDUTL(" >>> Done.")
;
; -- queue task
S ZTIO=""
S ZTRTN="LOGQUE^SCCVPOST"
S ZTDESC="Transferring log data from Scheduling Visits file"
S ZTDTH=$$NOW^XLFDT()
F X="SDUZ" S ZTSAVE(X)=""
D ^%ZTLOAD
D:$D(ZTSK) MES^XPDUTL(" -> Task: #"_ZTSK)
D MES^XPDUTL(" >>> Done.")
LOGDATAQ Q
;
LOGQUE ; -- TaskMan entry point to queue log data transfer
;
N SDATE,SDOE,DR,DA,DIE,SDSTOP,SDTOT,SDBEG,SDEND,SDDR,SDFIN
;
; -- quit if pre-test
IF '$$OK^SCCVU(0) Q
;
S SDTOT=0
S SDBEG=$$NOW^XLFDT()
;
; -- get date ACRP started on target system ; use as loop start date
S SDATE=$P($G(^SD(404.91,1,"AMB")),U,2)
;
; -- get date of last a/e ; use as finish date
S SDFIN=$P($O(^SDV("A"),-1),".")_".24"
;
; -- scan ^SCE records
F S SDATE=$O(^SCE("B",SDATE)) Q:'SDATE!(SDATE>SDFIN) D S SDSTOP=$$S^%ZTLOAD Q:SDSTOP
. S SDOE=0 F S SDOE=$O(^SCE("B",SDATE,SDOE)) Q:'SDOE D
. . S SDDR=$$BUILDR(.SDOE)
. . IF SDDR]"" D
. . . S DIE="^SCE(",DA=SDOE,DR=SDDR D ^DIE
. . . S SDTOT=SDTOT+1
;
S SDEND=$$NOW^XLFDT()
;
; -- send bulletin
D BULL
;
; -- set completion flag
S DA=1,DR="908////"_SDEND,DIE="^SD(404.91," D ^DIE
;
Q
;
BUILDR(SDOE) ; -- build DR string
;
N SDDR
N SDOE0,SDOECNV,SDOEUSER,SDORG,SCEUSR,SCECRE,DFN
N SDT,SDCS,SDCS0,SDVUSR,SDVCRE,SDVOE
S SDDR=""
;
; -- get sce data
S SDOE0=$G(^SCE(SDOE,0))
S SDOECNV=$G(^SCE(SDOE,"CNV"))
S SDOEUSER=$G(^SCE(SDOE,"USER"))
S SDORG=+$P(SDOE0,U,8)
S SCEUSR=+SDOEUSER
S SCECRE=+$P(SDOECNV,U,2)
;
; -- quit if not an add/edit
IF SDORG'=2 G BUILDRQ
;
; -- get sdv data
S DFN=+$P(SDOE0,U,2)
S SDT=$$SDVIEN^SCCVU(DFN,+SDOE0)
S SDCS=$P(SDOE0,U,9)
S SDCS0=$G(^SDV(+SDT,"CS",+SDCS,0))
S SDVUSR=$P(SDCS0,U,2)
S SDVCRE=$P(SDCS0,U,7)
S SDVOE=+$P(SDCS0,U,8)
;
; -- quit if cs node not found
IF SDCS0="" G BUILDRQ
;
; -- quit if ien numbers don't match
IF SDOE'=SDVOE G BUILDRQ
;
; -- compare sce and sdv data and set DR string accordingly
IF 'SCEUSR,SDVUSR S SDDR="101////"_SDVUSR
IF 'SCECRE,SDVCRE S SDDR=SDDR_$S(SDDR]"":";",1:"")_"902////"_SDVCRE
;
BUILDRQ Q SDDR
;
BULL ; -- send message indicating transfer of log data complete or stopped
N SDTEXT,SDCNT,XMSUB,XMN,XMTEXT,XMDUZ,XMY
S SDCNT=0
;
D LINE("")
D LINE(" >>> Task Started: "_$$FMTE^XLFDT(SDBEG))
D LINE(" Finished: "_$$FMTE^XLFDT(SDEND))
D LINE("")
;
; -- build text
IF SDSTOP D
. D LINE(" >>> Task stopped by user. <<<")
ELSE D
. ; -- build text
. D LINE(" >>> Task Completed.")
;
D LINE("")
D LINE(" >>> "_SDTOT_" Records processed.")
;
; -- set xm vars and send message
S XMSUB="Transfer of Scheduling Visits Log Data - Task Information"
S XMN=0
S XMTEXT="SDTEXT("
S XMDUZ=.5
S XMY(SDUZ)=""
D ^XMD
Q
;
LINE(TEXT) ; -- add line of text
S SDCNT=SDCNT+1
S SDTEXT(SDCNT)=TEXT
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSCCVPOST 4353 printed Oct 16, 2024@18:39:37 Page 2
SCCVPOST ;ALB/MJK - Patch SD*5.3*201 Post-Install Routine ; 11/5/97
+1 ;;5.3;Scheduling;**211**,Aug 13, 1993
+2 ;
EN ; --- main entry point
+1 SET U="^"
+2 DO BMES^XPDUTL("Post-Install Started...")
+3 ;
+4 ; -- main driver calls
+5 DO RES
DO LOGDATA
+6 ;
+7 DO BMES^XPDUTL("Post-Install Finished.")
+8 QUIT
+9 ;
RES ; -- set up resource device
+1 NEW NAME,SLOTS,DESC
+2 DO BMES^XPDUTL(" >>> SCCV RESOURCE device setup...")
+3 SET NAME="SCCV RESOURCE"
+4 SET SLOTS=1
+5 SET DESC="Scheduling Conversion Resource Device"
+6 ;
+7 ; -- check to see if device already exists
+8 IF $DATA(^%ZIS(1,"B",NAME))
Begin DoDot:1
+9 DO MES^XPDUTL(" ...Device already exists.")
End DoDot:1
GOTO RESQ
+10 ;
+11 ; -- create device
+12 IF $$RES^XUDHSET(NAME,,SLOTS,DESC)>0
Begin DoDot:1
+13 DO MES^XPDUTL(" ...Resource device successfully created.")
End DoDot:1
GOTO RESQ
+14 ;
+15 ; -- indicate device creation failed
+16 DO MES^XPDUTL(" ...Unable to create resource device!")
RESQ QUIT
+1 ;
LOGDATA ; -- queue job to transfer 'edited by' & 'date entry made' data
+1 NEW SDUZ,ZTRTN,ZTIO,ZTDESC,ZTDTH,ZTSAVE,ZTSK
+2 ;
+3 ; -- quit if pre-test
+4 IF '$$OK^SCCVU(0)
QUIT
+5 ;
+6 SET SDUZ=$GET(DUZ)
+7 DO BMES^XPDUTL(" >>> Queuing task to transfer log data from Scheduling Visits file")
+8 ;
+9 ; -- following line in for interactive testing
+10 ;D LOGQUE Q
+11 ;
+12 ; -- has data already been xfer'd
+13 IF $PIECE($GET(^SD(404.91,1,"CNV")),U,8)
Begin DoDot:1
+14 DO MES^XPDUTL(" o Data already has been transferred.")
+15 DO MES^XPDUTL(" (No task queued.)")
+16 DO MES^XPDUTL(" >>> Done.")
End DoDot:1
GOTO LOGDATAQ
+17 ;
+18 ; -- queue task
+19 SET ZTIO=""
+20 SET ZTRTN="LOGQUE^SCCVPOST"
+21 SET ZTDESC="Transferring log data from Scheduling Visits file"
+22 SET ZTDTH=$$NOW^XLFDT()
+23 FOR X="SDUZ"
SET ZTSAVE(X)=""
+24 DO ^%ZTLOAD
+25 if $DATA(ZTSK)
DO MES^XPDUTL(" -> Task: #"_ZTSK)
+26 DO MES^XPDUTL(" >>> Done.")
LOGDATAQ QUIT
+1 ;
LOGQUE ; -- TaskMan entry point to queue log data transfer
+1 ;
+2 NEW SDATE,SDOE,DR,DA,DIE,SDSTOP,SDTOT,SDBEG,SDEND,SDDR,SDFIN
+3 ;
+4 ; -- quit if pre-test
+5 IF '$$OK^SCCVU(0)
QUIT
+6 ;
+7 SET SDTOT=0
+8 SET SDBEG=$$NOW^XLFDT()
+9 ;
+10 ; -- get date ACRP started on target system ; use as loop start date
+11 SET SDATE=$PIECE($GET(^SD(404.91,1,"AMB")),U,2)
+12 ;
+13 ; -- get date of last a/e ; use as finish date
+14 SET SDFIN=$PIECE($ORDER(^SDV("A"),-1),".")_".24"
+15 ;
+16 ; -- scan ^SCE records
+17 FOR
SET SDATE=$ORDER(^SCE("B",SDATE))
if 'SDATE!(SDATE>SDFIN)
QUIT
Begin DoDot:1
+18 SET SDOE=0
FOR
SET SDOE=$ORDER(^SCE("B",SDATE,SDOE))
if 'SDOE
QUIT
Begin DoDot:2
+19 SET SDDR=$$BUILDR(.SDOE)
+20 IF SDDR]""
Begin DoDot:3
+21 SET DIE="^SCE("
SET DA=SDOE
SET DR=SDDR
DO ^DIE
+22 SET SDTOT=SDTOT+1
End DoDot:3
End DoDot:2
End DoDot:1
SET SDSTOP=$$S^%ZTLOAD
if SDSTOP
QUIT
+23 ;
+24 SET SDEND=$$NOW^XLFDT()
+25 ;
+26 ; -- send bulletin
+27 DO BULL
+28 ;
+29 ; -- set completion flag
+30 SET DA=1
SET DR="908////"_SDEND
SET DIE="^SD(404.91,"
DO ^DIE
+31 ;
+32 QUIT
+33 ;
BUILDR(SDOE) ; -- build DR string
+1 ;
+2 NEW SDDR
+3 NEW SDOE0,SDOECNV,SDOEUSER,SDORG,SCEUSR,SCECRE,DFN
+4 NEW SDT,SDCS,SDCS0,SDVUSR,SDVCRE,SDVOE
+5 SET SDDR=""
+6 ;
+7 ; -- get sce data
+8 SET SDOE0=$GET(^SCE(SDOE,0))
+9 SET SDOECNV=$GET(^SCE(SDOE,"CNV"))
+10 SET SDOEUSER=$GET(^SCE(SDOE,"USER"))
+11 SET SDORG=+$PIECE(SDOE0,U,8)
+12 SET SCEUSR=+SDOEUSER
+13 SET SCECRE=+$PIECE(SDOECNV,U,2)
+14 ;
+15 ; -- quit if not an add/edit
+16 IF SDORG'=2
GOTO BUILDRQ
+17 ;
+18 ; -- get sdv data
+19 SET DFN=+$PIECE(SDOE0,U,2)
+20 SET SDT=$$SDVIEN^SCCVU(DFN,+SDOE0)
+21 SET SDCS=$PIECE(SDOE0,U,9)
+22 SET SDCS0=$GET(^SDV(+SDT,"CS",+SDCS,0))
+23 SET SDVUSR=$PIECE(SDCS0,U,2)
+24 SET SDVCRE=$PIECE(SDCS0,U,7)
+25 SET SDVOE=+$PIECE(SDCS0,U,8)
+26 ;
+27 ; -- quit if cs node not found
+28 IF SDCS0=""
GOTO BUILDRQ
+29 ;
+30 ; -- quit if ien numbers don't match
+31 IF SDOE'=SDVOE
GOTO BUILDRQ
+32 ;
+33 ; -- compare sce and sdv data and set DR string accordingly
+34 IF 'SCEUSR
IF SDVUSR
SET SDDR="101////"_SDVUSR
+35 IF 'SCECRE
IF SDVCRE
SET SDDR=SDDR_$SELECT(SDDR]"":";",1:"")_"902////"_SDVCRE
+36 ;
BUILDRQ QUIT SDDR
+1 ;
BULL ; -- send message indicating transfer of log data complete or stopped
+1 NEW SDTEXT,SDCNT,XMSUB,XMN,XMTEXT,XMDUZ,XMY
+2 SET SDCNT=0
+3 ;
+4 DO LINE("")
+5 DO LINE(" >>> Task Started: "_$$FMTE^XLFDT(SDBEG))
+6 DO LINE(" Finished: "_$$FMTE^XLFDT(SDEND))
+7 DO LINE("")
+8 ;
+9 ; -- build text
+10 IF SDSTOP
Begin DoDot:1
+11 DO LINE(" >>> Task stopped by user. <<<")
End DoDot:1
+12 IF '$TEST
Begin DoDot:1
+13 ; -- build text
+14 DO LINE(" >>> Task Completed.")
End DoDot:1
+15 ;
+16 DO LINE("")
+17 DO LINE(" >>> "_SDTOT_" Records processed.")
+18 ;
+19 ; -- set xm vars and send message
+20 SET XMSUB="Transfer of Scheduling Visits Log Data - Task Information"
+21 SET XMN=0
+22 SET XMTEXT="SDTEXT("
+23 SET XMDUZ=.5
+24 SET XMY(SDUZ)=""
+25 DO ^XMD
+26 QUIT
+27 ;
LINE(TEXT) ; -- add line of text
+1 SET SDCNT=SDCNT+1
+2 SET SDTEXT(SDCNT)=TEXT
+3 QUIT
+4 ;