SCCVCST ;ALB/TMP - Scheduling Conversion Template Utilities - CST; NOV 25, 1997
;;5.3;Scheduling;**211**;Aug 13, 1993
;
NEW ; -- Add a new 'CST' Template entry
D FULL^VALM1
N DA,DD,DIC,DIE,DR,DIK,DIR,DO,SC,SCADD,SCCV,SCCV0,SCRESULT,X,Y
;
; -- make sure earilest date is set
IF '$G(^SD(404.91,1,"CNV")) D G NEWQ
. W !!,">>> You must set the 'Earlieat Encounter Date' parameter before"
. W !," a template can be added."
. W !!," Please use the 'Display/Edit Parameters' action to set this parameter."
. D PAUSE^SCCVU
;
I $G(SCCVDONE) D DONE^SCCVCST1 G NEWQ
S DIC="^SD(404.98,",DIC("DR")="[SCCV CREATE TEMPLATE]",DIC(0)="LZ",X=$O(^SD(404.98,"A"),-1)+1 D FILE^DICN K DIC,DD,DO I Y<0 S SCRESULT=""
I Y>0 D
. S SCCV=+Y,SCCV0=Y(0)
. K SC
. S SC("STARTDT")=$P(SCCV0,U,3),SC("ENDDT")=$P(SCCV0,U,4)
. D CHKDT^SCCVU1(.SCRESULT,.SC,"CST") ;validate date
. Q:$G(SCRESULT)
. S SC("TYPE")=$P(SCCV0,U,2),SC("TEMPLNO")=SCCV
. D CHKDUP^SCCVU1(.SCRESULT,.SC,"CST")
. Q:$G(SCRESULT)
. W !!,"*** Template #",SCCV," has been added. [Date Range: ",$$FMTE^XLFDT(SC("STARTDT"),"5ZD")," - ",$$FMTE^XLFDT(SC("ENDDT"),"5ZD"),"]",!
. F S DIR(0)="SA^0:Estimate;1:Convert",DIR("A")="Event: ",DIR("B")="Estimate" D ^DIR K DIR Q:X'="" W !,*7,"This is a required field!!"
. I Y'?1N S SCRESULT="^'Event' is required ... Template entry deleted" Q
. K SC S SC(.05)=+Y
. D UPD^SCCVDBU(404.98,SCCV,.SC,.SCRESULT)
. Q:$P($G(SCRESULT),U,2)'=""
. S SCADD=1
I $P(SCRESULT,U,2)'="" D ERR(SCRESULT,SCCV) G:SCRESULT NEWQ
I $G(SCADD) D
.S DIR(0)="YA",DIR("A")="Do you want to schedule this event to run? ",DIR("B")="YES" D ^DIR K DIR
.I Y S SCCVDA=SCCV D REQ^SCCVCST1(0,$G(SCCVSCRN),1)
.D BLD^SCCVDSP("CST")
NEWQ S VALMBCK="R"
Q
;
VIEW ; -- Expand conversion Template
N SCCVX,VALMY,SCCVDA
D SELX^SCCVDSP("CST")
I $G(SCCVDA) D EN^VALM("SCCV CONV EXPAND")
D BLD^SCCVDSP("CST")
S VALMBCK="R"
Q
;
ERR(SCRESULT,SCCV) ; -- Process error
N DA,DIR,DIK,X,Y
W !!,$P(SCRESULT,U,2),!
I SCCV S DIK="^SD(404.98,",DA=SCCV D ^DIK
S DIR(0)="EA",DIR("A")="Press RETURN to continue " S:$P(SCRESULT,U,2)="" DIR("A",1)="You have encountered an error" D ^DIR K DIR
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSCCVCST 2215 printed Dec 13, 2024@02:38:28 Page 2
SCCVCST ;ALB/TMP - Scheduling Conversion Template Utilities - CST; NOV 25, 1997
+1 ;;5.3;Scheduling;**211**;Aug 13, 1993
+2 ;
NEW ; -- Add a new 'CST' Template entry
+1 DO FULL^VALM1
+2 NEW DA,DD,DIC,DIE,DR,DIK,DIR,DO,SC,SCADD,SCCV,SCCV0,SCRESULT,X,Y
+3 ;
+4 ; -- make sure earilest date is set
+5 IF '$GET(^SD(404.91,1,"CNV"))
Begin DoDot:1
+6 WRITE !!,">>> You must set the 'Earlieat Encounter Date' parameter before"
+7 WRITE !," a template can be added."
+8 WRITE !!," Please use the 'Display/Edit Parameters' action to set this parameter."
+9 DO PAUSE^SCCVU
End DoDot:1
GOTO NEWQ
+10 ;
+11 IF $GET(SCCVDONE)
DO DONE^SCCVCST1
GOTO NEWQ
+12 SET DIC="^SD(404.98,"
SET DIC("DR")="[SCCV CREATE TEMPLATE]"
SET DIC(0)="LZ"
SET X=$ORDER(^SD(404.98,"A"),-1)+1
DO FILE^DICN
KILL DIC,DD,DO
IF Y<0
SET SCRESULT=""
+13 IF Y>0
Begin DoDot:1
+14 SET SCCV=+Y
SET SCCV0=Y(0)
+15 KILL SC
+16 SET SC("STARTDT")=$PIECE(SCCV0,U,3)
SET SC("ENDDT")=$PIECE(SCCV0,U,4)
+17 ;validate date
DO CHKDT^SCCVU1(.SCRESULT,.SC,"CST")
+18 if $GET(SCRESULT)
QUIT
+19 SET SC("TYPE")=$PIECE(SCCV0,U,2)
SET SC("TEMPLNO")=SCCV
+20 DO CHKDUP^SCCVU1(.SCRESULT,.SC,"CST")
+21 if $GET(SCRESULT)
QUIT
+22 WRITE !!,"*** Template #",SCCV," has been added. [Date Range: ",$$FMTE^XLFDT(SC("STARTDT"),"5ZD")," - ",$$FMTE^XLFDT(SC("ENDDT"),"5ZD"),"]",!
+23 FOR
SET DIR(0)="SA^0:Estimate;1:Convert"
SET DIR("A")="Event: "
SET DIR("B")="Estimate"
DO ^DIR
KILL DIR
if X'=""
QUIT
WRITE !,*7,"This is a required field!!"
+24 IF Y'?1N
SET SCRESULT="^'Event' is required ... Template entry deleted"
QUIT
+25 KILL SC
SET SC(.05)=+Y
+26 DO UPD^SCCVDBU(404.98,SCCV,.SC,.SCRESULT)
+27 if $PIECE($GET(SCRESULT),U,2)'=""
QUIT
+28 SET SCADD=1
End DoDot:1
+29 IF $PIECE(SCRESULT,U,2)'=""
DO ERR(SCRESULT,SCCV)
if SCRESULT
GOTO NEWQ
+30 IF $GET(SCADD)
Begin DoDot:1
+31 SET DIR(0)="YA"
SET DIR("A")="Do you want to schedule this event to run? "
SET DIR("B")="YES"
DO ^DIR
KILL DIR
+32 IF Y
SET SCCVDA=SCCV
DO REQ^SCCVCST1(0,$GET(SCCVSCRN),1)
+33 DO BLD^SCCVDSP("CST")
End DoDot:1
NEWQ SET VALMBCK="R"
+1 QUIT
+2 ;
VIEW ; -- Expand conversion Template
+1 NEW SCCVX,VALMY,SCCVDA
+2 DO SELX^SCCVDSP("CST")
+3 IF $GET(SCCVDA)
DO EN^VALM("SCCV CONV EXPAND")
+4 DO BLD^SCCVDSP("CST")
+5 SET VALMBCK="R"
+6 QUIT
+7 ;
ERR(SCRESULT,SCCV) ; -- Process error
+1 NEW DA,DIR,DIK,X,Y
+2 WRITE !!,$PIECE(SCRESULT,U,2),!
+3 IF SCCV
SET DIK="^SD(404.98,"
SET DA=SCCV
DO ^DIK
+4 SET DIR(0)="EA"
SET DIR("A")="Press RETURN to continue "
if $PIECE(SCRESULT,U,2)=""
SET DIR("A",1)="You have encountered an error"
DO ^DIR
KILL DIR
+5 QUIT
+6 ;