GECSENTR ;WISC/RFJ-stuff data into template map automatically ;08 Nov 93
;;2.0;GCS;;MAR 14, 1995
; the following needs to be defined for automatic stuffing of data:
; GECS("STRING",0) or GECS("STRING",1), etc.=String to be stuffed delimited by ^
; GECSSYS=Batch type name from file 2101.1
; GECS("TTF")=Transaction/Segment name from file 2101.2
; GECS("SITENOASK")=Station number_Suffix (from field 99 in the institution file)
; GECS("AMIS")=month/year of amis in form 2890800
; set the variable GECSAUTO="BATCH" to auto-mark for batch without asking
; set the variable GECSAUTO="SAVE" to save code sheet for edit
;
; check for variables passed
I '$D(GECS("STRING",0)) Q
I '$G(GECS("SITENOASK")) Q
I '$L($G(GECSSYS)) Q
;
N %X,D,D0,DA,DI,DQ,GECSAMIS,GECSDATA,GECSEDIT,GECSI,GECSMAP,GECSNASK,GECSNEXT,GECSPCNT,GECSPIEC,GECSTT,N,P,X,Y
;
; set passed data in temporary variable to prevent killing
S %X="GECS(""STRING"",",%Y="GECSDATA(" D %XY^%RCR
S GECSTT=$G(GECS("TTF"))
S GECSAMIS=$G(GECS("AMIS"))
S GECSNASK=$G(GECS("SITENOASK"))
;
N GECS
;
; get transaction type and input template
S GECSEDIT=$P($G(^GECS(2101.2,+$O(^GECS(2101.2,"B",GECSTT,0)),0)),"^",3) I GECSEDIT="" Q
S GECSEDIT=$E(GECSEDIT,2,$L(GECSEDIT)-1)
S %=$O(^DIE("B",GECSEDIT,0)) I '% Q
D GETMAP^GECSXMAP(%) I '$D(GECSMAP) Q
;
I GECSNASK S GECS("SITENOASK")=GECSNASK
D ^GECSSITE I '$G(GECS("SITE")) Q
D BATTYPE^GECSUSEL(GECSSYS,1) I '$G(GECS("BATDA")) Q
S GECS("TT")=GECSTT,GECS("EDIT")="["_GECSEDIT_"]"
W !,"Transaction Type: ",GECSTT
D NEWCS^GECSEDIT I '$D(GECS("CSDA")) Q
;
W !,"Stuffing data into the following fields:"
; stuff amis
I $G(GECSAMIS) S Y=GECSAMIS D DD^%DT W !,"AMIS MONTH/YEAR: ",Y D
. N DA,DIC,DIE,DR
. S (DIC,DIE)="^GECS(2100,",DA=GECS("CSDA"),DR="9.1///"_GECSAMIS D ^DIE
;
S GECSNEXT=0,GECSPIEC=1,DA=GECS("CSDA")
S GECSI=0 F S GECSI=$O(GECSMAP(GECSI)) Q:'GECSI D
. F GECSPCNT=1:1 S Y=$P(GECSMAP(GECSI),"\",GECSPCNT) Q:Y="" D
. . I $P($G(GECSDATA(GECSNEXT)),"^",GECSPIEC,255)="" S GECSNEXT=GECSNEXT+1,GECSPIEC=1 Q:'$D(GECSDATA(GECSNEXT))
. . S X=$P(GECSDATA(GECSNEXT),"^",GECSPIEC),P=$P(Y,";",3),N=$P(Y,";",2),$P(^GECS(2100,DA,N),"^",P)=X,GECSPIEC=GECSPIEC+1
. . W !,$P(^DD(2100,+$P(Y,"^"),0),"^"),": ",X
I $$MAPDATA^GECSXBLD(DA) D ASKTOBAT^GECSXBL1(DA)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGECSENTR 2382 printed Nov 22, 2024@17:06:17 Page 2
GECSENTR ;WISC/RFJ-stuff data into template map automatically ;08 Nov 93
+1 ;;2.0;GCS;;MAR 14, 1995
+2 ; the following needs to be defined for automatic stuffing of data:
+3 ; GECS("STRING",0) or GECS("STRING",1), etc.=String to be stuffed delimited by ^
+4 ; GECSSYS=Batch type name from file 2101.1
+5 ; GECS("TTF")=Transaction/Segment name from file 2101.2
+6 ; GECS("SITENOASK")=Station number_Suffix (from field 99 in the institution file)
+7 ; GECS("AMIS")=month/year of amis in form 2890800
+8 ; set the variable GECSAUTO="BATCH" to auto-mark for batch without asking
+9 ; set the variable GECSAUTO="SAVE" to save code sheet for edit
+10 ;
+11 ; check for variables passed
+12 IF '$DATA(GECS("STRING",0))
QUIT
+13 IF '$GET(GECS("SITENOASK"))
QUIT
+14 IF '$LENGTH($GET(GECSSYS))
QUIT
+15 ;
+16 NEW %X,D,D0,DA,DI,DQ,GECSAMIS,GECSDATA,GECSEDIT,GECSI,GECSMAP,GECSNASK,GECSNEXT,GECSPCNT,GECSPIEC,GECSTT,N,P,X,Y
+17 ;
+18 ; set passed data in temporary variable to prevent killing
+19 SET %X="GECS(""STRING"","
SET %Y="GECSDATA("
DO %XY^%RCR
+20 SET GECSTT=$GET(GECS("TTF"))
+21 SET GECSAMIS=$GET(GECS("AMIS"))
+22 SET GECSNASK=$GET(GECS("SITENOASK"))
+23 ;
+24 NEW GECS
+25 ;
+26 ; get transaction type and input template
+27 SET GECSEDIT=$PIECE($GET(^GECS(2101.2,+$ORDER(^GECS(2101.2,"B",GECSTT,0)),0)),"^",3)
IF GECSEDIT=""
QUIT
+28 SET GECSEDIT=$EXTRACT(GECSEDIT,2,$LENGTH(GECSEDIT)-1)
+29 SET %=$ORDER(^DIE("B",GECSEDIT,0))
IF '%
QUIT
+30 DO GETMAP^GECSXMAP(%)
IF '$DATA(GECSMAP)
QUIT
+31 ;
+32 IF GECSNASK
SET GECS("SITENOASK")=GECSNASK
+33 DO ^GECSSITE
IF '$GET(GECS("SITE"))
QUIT
+34 DO BATTYPE^GECSUSEL(GECSSYS,1)
IF '$GET(GECS("BATDA"))
QUIT
+35 SET GECS("TT")=GECSTT
SET GECS("EDIT")="["_GECSEDIT_"]"
+36 WRITE !,"Transaction Type: ",GECSTT
+37 DO NEWCS^GECSEDIT
IF '$DATA(GECS("CSDA"))
QUIT
+38 ;
+39 WRITE !,"Stuffing data into the following fields:"
+40 ; stuff amis
+41 IF $GET(GECSAMIS)
SET Y=GECSAMIS
DO DD^%DT
WRITE !,"AMIS MONTH/YEAR: ",Y
Begin DoDot:1
+42 NEW DA,DIC,DIE,DR
+43 SET (DIC,DIE)="^GECS(2100,"
SET DA=GECS("CSDA")
SET DR="9.1///"_GECSAMIS
DO ^DIE
End DoDot:1
+44 ;
+45 SET GECSNEXT=0
SET GECSPIEC=1
SET DA=GECS("CSDA")
+46 SET GECSI=0
FOR
SET GECSI=$ORDER(GECSMAP(GECSI))
if 'GECSI
QUIT
Begin DoDot:1
+47 FOR GECSPCNT=1:1
SET Y=$PIECE(GECSMAP(GECSI),"\",GECSPCNT)
if Y=""
QUIT
Begin DoDot:2
+48 IF $PIECE($GET(GECSDATA(GECSNEXT)),"^",GECSPIEC,255)=""
SET GECSNEXT=GECSNEXT+1
SET GECSPIEC=1
if '$DATA(GECSDATA(GECSNEXT))
QUIT
+49 SET X=$PIECE(GECSDATA(GECSNEXT),"^",GECSPIEC)
SET P=$PIECE(Y,";",3)
SET N=$PIECE(Y,";",2)
SET $PIECE(^GECS(2100,DA,N),"^",P)=X
SET GECSPIEC=GECSPIEC+1
+50 WRITE !,$PIECE(^DD(2100,+$PIECE(Y,"^"),0),"^"),": ",X
End DoDot:2
End DoDot:1
+51 IF $$MAPDATA^GECSXBLD(DA)
DO ASKTOBAT^GECSXBL1(DA)
+52 QUIT