DGGECSA ;ALB/RMO - Auto Generate Code Sheets for MAS AMIS(s) ; 13 AUG 90 8:52 am
;;5.3;Registration;**1015**;Aug 13, 1993;Build 21
;==============================================================
;Entry Points:
; ASK -Prompt user to generate AMIS code sheets
; QUE -Queue generation of AMIS code sheet to default printer
;==============================================================
ASK ;Prompt user to generate AMIS code sheets
; Input -- None Required
; Output -- %=1 user entered 'YES'
; %=2 user entered 'NO'
; %<0 user timeout or entered an '^'
S %=0,DGCODPRT=$S($D(^DG(43,1,0)):$P(^(0),"^",25),1:"") G Q:DGCODPRT=""
W !!,"Do you wish to generate code sheets if segments are balanced" S %=2 D YN^DICN G Q:%<0 I '% W !!?3,"Enter 'YES' to generate code sheets, or 'NO' not to." G ASK
I %=1 W !!?3,"NOTE: AMIS Code Sheets will be queued to print on ",DGCODPRT,"."
Q K DGCODPRT Q
;
QUE ;Queue generation of AMIS code sheet to default MAS code sheet printer
; Input -- DGSEG Segment Number ie, 334
; DGDIV Medical Ctr Div File (#40.8) IFN ie, 1
; DGMYR Month/Year in internal date format ie, 2900200
; Output -- Task is Queued to Generate a Code Sheet
S ZTRTN="START^DGGECSA",ZTDTH=$H,ZTSAVE("DGTTF")=DGSEG,ZTSAVE("DGDIV")=DGDIV,ZTSAVE("DGMYR")=DGMYR
S ZTDESC="GENERATE AMIS CODE SHEET"
S ZTIO=$S($D(^DG(43,1,0)):$P(^(0),"^",25),1:"") D ^%ZTLOAD:ZTIO'=""
K ZTSK,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTDESC
Q
;
START ;Auto generation of AMIS code sheet
U IO Q:'$D(DGTTF)!('$D(DGDIV))!('$D(DGMYR))
S SDABORT=0,DGSTR="",DGSTA=$S('$D(^DG(40.8,+DGDIV,0)):0,$P(^(0),"^",2)'="":$P(^(0),"^",2),$D(^DIC(4,+$P(^(0),"^",7),99)):$P(^(99),"^",1),1:0)
I DGTTF'>399 D BLD^DGGECS,GEN^DGGECS:'SDABORT
I DGTTF>399 F I=401:1:420 S DGAMS(I)=""
I DGTTF>399 D START^DGGECS
K DGSTA,DGSTR,DGTTF,SDABORT,I,DGAMS
Q
DGGECSA ;ALB/RMO - Auto Generate Code Sheets for MAS AMIS(s) ; 13 AUG 90 8:52 am
+1 ;;5.3;Registration;**1015**;Aug 13, 1993;Build 21
+2 ;==============================================================
+3 ;Entry Points:
+4 ; ASK -Prompt user to generate AMIS code sheets
+5 ; QUE -Queue generation of AMIS code sheet to default printer
+6 ;==============================================================
ASK ;Prompt user to generate AMIS code sheets
+1 ; Input -- None Required
+2 ; Output -- %=1 user entered 'YES'
+3 ; %=2 user entered 'NO'
+4 ; %<0 user timeout or entered an '^'
+5 SET %=0
SET DGCODPRT=$SELECT($DATA(^DG(43,1,0)):$PIECE(^(0),"^",25),1:"")
IF DGCODPRT=""
GOTO Q
+6 WRITE !!,"Do you wish to generate code sheets if segments are balanced"
SET %=2
DO YN^DICN
IF %<0
GOTO Q
IF '%
WRITE !!?3,"Enter 'YES' to generate code sheets, or 'NO' not to."
GOTO ASK
+7 IF %=1
WRITE !!?3,"NOTE: AMIS Code Sheets will be queued to print on ",DGCODPRT,"."
Q KILL DGCODPRT
QUIT
+1 ;
QUE ;Queue generation of AMIS code sheet to default MAS code sheet printer
+1 ; Input -- DGSEG Segment Number ie, 334
+2 ; DGDIV Medical Ctr Div File (#40.8) IFN ie, 1
+3 ; DGMYR Month/Year in internal date format ie, 2900200
+4 ; Output -- Task is Queued to Generate a Code Sheet
+5 SET ZTRTN="START^DGGECSA"
SET ZTDTH=$HOROLOG
SET ZTSAVE("DGTTF")=DGSEG
SET ZTSAVE("DGDIV")=DGDIV
SET ZTSAVE("DGMYR")=DGMYR
+6 SET ZTDESC="GENERATE AMIS CODE SHEET"
+7 SET ZTIO=$SELECT($DATA(^DG(43,1,0)):$PIECE(^(0),"^",25),1:"")
IF ZTIO'=""
DO ^%ZTLOAD
+8 KILL ZTSK,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTDESC
+9 QUIT
+10 ;
START ;Auto generation of AMIS code sheet
+1 USE IO
IF '$DATA(DGTTF)!('$DATA(DGDIV))!('$DATA(DGMYR))
QUIT
+2 SET SDABORT=0
SET DGSTR=""
SET DGSTA=$SELECT('$DATA(^DG(40.8,+DGDIV,0)):0,$PIECE(^(0),"^",2)'="":$PIECE(^(0),"^",2),$DATA(^DIC(4,+$PIECE(^(0),"^",7),99)):$PIECE(^(99),"^",1),1:0)
+3 IF DGTTF'>399
DO BLD^DGGECS
IF 'SDABORT
DO GEN^DGGECS
+4 IF DGTTF>399
FOR I=401:1:420
SET DGAMS(I)=""
+5 IF DGTTF>399
DO START^DGGECS
+6 KILL DGSTA,DGSTR,DGTTF,SDABORT,I,DGAMS
+7 QUIT