GECSMUT1 ;WISC/RFJ-maintenance utilities (batching) ;01 Nov 93
;;2.0;GCS;**2,6**;MAR 14, 1995
;edited by IRMFO-SF/RJH 12-95
Q
;
MARKBAT(DA) ; mark code sheet da for batching
; return 1 for marked, 0 for unmarked
N %,%DT,D0,DI,DIC,DIE,DQ,DR,X,Y
S %=$G(^GECS(2100,DA,0)) I %="" Q 0
W !!?5,"** CODE SHEET NUMBER: ",$P(%,"^")," **"
S DR=".15///@;.8///@;.1///Y;.95////"_DUZ_";"
I $G(GECSAUTO)="BATCH" S DR=DR_".6///TODAY;.9///3;"
E S DR=DR_".6//TODAY;.9//3;"
S (DIC,DIE)="^GECS(2100," W ! D ^DIE
; ^ entered, retain in file
I $D(Y) D RETAIN^GECSUSTA(DA) S %=$$STATUS^GECSUSTA(DA) Q 0
I $G(GECSAUTO)="BATCH" W !,"CODE SHEET AUTOMATICALLY MARKED FOR BATCHING !" Q 1
S %=$$STATUS^GECSUSTA(DA)
Q 1
;
ASKREBAT() ; ask to rebatch
; return 1 for yes, 0 for no
S XP="DO YOU WANT TO MARK FOR REBATCHING",XH="'YES' to mark for rebatching.",XH(1)="'NO' or '^' to abort."
I $$YN^GECSUTIL(2)'=1 Q 0
Q 1
;
N %,GECS,GECSBATC,GECSDA,GECSSTAT,GECSBTYP
D ^GECSSITE Q:'$D(GECS("SITE"))
D BATNOFMS^GECSUSEL Q:'$G(GECS("BATDA"))
S GECSBTYP=GECS("BATCH")
F S GECSDA=$$CODESHET^GECSUSEL(GECSBTYP) Q:'GECSDA D
. D VARIABLE^GECSUTIL(GECSDA)
. I $G(GECS("SYSID"))="FMS" W !,"*** FMS DOCUMENTS DO NOT HAVE TO BE BATCHED ***" Q
. I $G(GECS("CSDA")) D Q
. . W ! S GECSSTAT=$$STATUS^GECSUSTA(GECS("CSDA")) W !
. . S GECSBATC=$P($G(^GECS(2100,GECS("CSDA"),"TRANS")),"^",9)
. . I GECSBATC="" W !,"YOU CAN ONLY SELECT CODE SHEETS WHICH HAVE BEEN MARKED FOR BATCHING." Q
. . I $$ASKREBAT S %=$$MARKBAT(GECS("CSDA")) D KILLBATC(GECSBATC) Q
. D ERROR^GECSUTIL(GECSDA)
Q
;
REVIEW ; review code sheets waiting to be batched
N %,GECS,GECSDA,GECSSTAT,GECSBTYP
D ^GECSSITE Q:'$D(GECS("SITE"))
W ! D BATTYPE^GECSUSEL($G(GECSSYS),$S($L($G(GECSSYS)):1,1:0)) Q:'$G(GECS("BATDA"))
S GECSBTYP=GECS("BATCH")
F S GECSDA=$$CODESHET^GECSUSEL(GECSBTYP) Q:'GECSDA D
. D VARIABLE^GECSUTIL(GECSDA)
. I $G(GECS("CSDA")) D Q
. . W ! S GECSSTAT=$$STATUS^GECSUSTA(GECS("CSDA")) W !
. . I GECS("SYSID")'="FMS",$P($G(^GECS(2100,GECS("CSDA"),"TRANS")),"^")'="Y" W !,"YOU CAN ONLY SELECT CODE SHEETS WHICH HAVE BEEN MARKED FOR BATCHING." Q
. . I GECS("SYSID")="FMS",$P($G(^GECS(2100,GECS("CSDA"),"TRANS")),"^",3)'="" W !,"YOU CAN ONLY SELECT FMS DOCUMENTS WHICH HAVE NOT BEEN TRANSMITTED." Q
. . I '$$MAPDATA^GECSXBLD(GECS("CSDA")) Q
. . D ASKTOBAT^GECSXBL1(GECS("CSDA"))
. D ERROR^GECSUTIL(GECSDA)
Q
;
DELETE ; delete selected code sheets
N %,GECS,GECSDA,GECSSTAT,GECSBTYP
D ^GECSSITE Q:'$D(GECS("SITE"))
W ! D BATTYPE^GECSUSEL($G(GECSSYS),$S($L($G(GECSSYS)):1,1:0)) Q:'$G(GECS("BATDA"))
S GECSBTYP=GECS("BATCH")
F S GECSDA=$$CODESHET^GECSUSEL(GECSBTYP) Q:'GECSDA D
. D VARIABLE^GECSUTIL(GECSDA)
. W ! S GECSSTAT=$$STATUS^GECSUSTA(GECSDA) W !
. D DELASK^GECSUTIL(GECSDA)
Q
;
EDITBAT ; edit code sheet batch
N %,GECS,GECSBATC,GECSDA,GECSDICS,GECSSTAT,GECSBTYP
D ^GECSSITE Q:'$G(GECS("SITE"))
D BATNOFMS^GECSUSEL Q:'$G(GECS("BATDA"))
S GECSBTYP=GECS("BATCH")
F S GECSDA=$$CODESHET^GECSUSEL(GECSBTYP) Q:'GECSDA D
. D VARIABLE^GECSUTIL(GECSDA)
. I $G(GECS("CSDA")) D Q
. . W ! S GECSSTAT=$$STATUS^GECSUSTA(GECS("CSDA")) W !
. . I '$D(^GECS(2100,GECS("CSDA"),"TRANS")) W !,"CODE SHEET MUST BE READY FOR BATCHING BEFORE THE BATCH NUMBER CAN BE EDIT.",!,"USE THE 'Code Sheet Edit' OPTION." Q
. . I $P($G(^GECS(2100,GECS("CSDA"),"TRANS")),"^",9)'="" D Q:%=0
. . . S XP="Do you want to DELETE this batch number",XH="Enter 'YES' to DELETE batch number, 'NO' ro select a NEW batch number,",XH(1)="or '^' to exit."
. . . S %=$$YN^GECSUTIL(2) I %'=1 Q
. . . S GECSBATC=$P(^GECS(2100,GECS("CSDA"),"TRANS"),"^",9)
. . . S %=$$MARKBAT(GECS("CSDA"))
. . . D KILLBATC(GECSBATC)
. . . S %=0
. . S GECSDICS="I $P(^(0),U,6)=GECS(""BATDA""),$P(^(0),U,4)="""""
. . S GECSBATC=$$BATCHSEL^GECSUSEL(GECSDICS) I 'GECSBATC Q
. . S GECSBATC=$P($G(^GECS(2101.3,GECSBATC,0)),"^") I GECSBATC="" Q
. . S XP="READY TO CHANGE THE BATCH NUMBER",XH="Enter 'YES' to change the batch number, 'NO' or '^' to exit."
. . I $$YN^GECSUTIL(1)'=1 Q
. . D SETBATCH(GECS("CSDA"),GECSBATC)
. D ERROR^GECSUTIL(GECSDA)
Q
;
SETBATCH(DA,GECSBATC) ; set code sheet da to gecsbatc batch
N DIC,DIE,DR,X,Y
S (DIC,DIE)="^GECS(2100,",DR=".1///@;.15///Y;.8////"_GECSBATC_";.9//3;"
D ^DIE I $D(Y) W !,"UNABLE TO SET BATCH NUMBER ",GECSBATC Q
W !,"CODE SHEET READY FOR TRANSMISSION IN BATCH ",GECSBATC
Q
;
KILLBATC(GECSBATC) ; check if any code sheets are in batch, if no delete it
I '$L(GECSBATC) Q
I $D(^GECS(2100,"AB",GECSBATC)) Q
N DA
S DA=+$O(^GECS(2101.3,"B",GECSBATC,0)) I 'DA Q
W !!,"NO CODE SHEETS INCLUDED IN BATCH ",GECSBATC,".",!,"DELETING BATCH ",GECSBATC
D KILLBATC^GECSPUR1(DA)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGECSMUT1 4971 printed Dec 13, 2024@01:56:12 Page 2
GECSMUT1 ;WISC/RFJ-maintenance utilities (batching) ;01 Nov 93
+1 ;;2.0;GCS;**2,6**;MAR 14, 1995
+2 ;edited by IRMFO-SF/RJH 12-95
+3 QUIT
+4 ;
MARKBAT(DA) ; mark code sheet da for batching
+1 ; return 1 for marked, 0 for unmarked
+2 NEW %,%DT,D0,DI,DIC,DIE,DQ,DR,X,Y
+3 SET %=$GET(^GECS(2100,DA,0))
IF %=""
QUIT 0
+4 WRITE !!?5,"** CODE SHEET NUMBER: ",$PIECE(%,"^")," **"
+5 SET DR=".15///@;.8///@;.1///Y;.95////"_DUZ_";"
+6 IF $GET(GECSAUTO)="BATCH"
SET DR=DR_".6///TODAY;.9///3;"
+7 IF '$TEST
SET DR=DR_".6//TODAY;.9//3;"
+8 SET (DIC,DIE)="^GECS(2100,"
WRITE !
DO ^DIE
+9 ; ^ entered, retain in file
+10 IF $DATA(Y)
DO RETAIN^GECSUSTA(DA)
SET %=$$STATUS^GECSUSTA(DA)
QUIT 0
+11 IF $GET(GECSAUTO)="BATCH"
WRITE !,"CODE SHEET AUTOMATICALLY MARKED FOR BATCHING !"
QUIT 1
+12 SET %=$$STATUS^GECSUSTA(DA)
+13 QUIT 1
+14 ;
ASKREBAT() ; ask to rebatch
+1 ; return 1 for yes, 0 for no
+2 SET XP="DO YOU WANT TO MARK FOR REBATCHING"
SET XH="'YES' to mark for rebatching."
SET XH(1)="'NO' or '^' to abort."
+3 IF $$YN^GECSUTIL(2)'=1
QUIT 0
+4 QUIT 1
+5 ;
+1 NEW %,GECS,GECSBATC,GECSDA,GECSSTAT,GECSBTYP
+2 DO ^GECSSITE
if '$DATA(GECS("SITE"))
QUIT
+3 DO BATNOFMS^GECSUSEL
if '$GET(GECS("BATDA"))
QUIT
+4 SET GECSBTYP=GECS("BATCH")
+5 FOR
SET GECSDA=$$CODESHET^GECSUSEL(GECSBTYP)
if 'GECSDA
QUIT
Begin DoDot:1
+6 DO VARIABLE^GECSUTIL(GECSDA)
+7 IF $GET(GECS("SYSID"))="FMS"
WRITE !,"*** FMS DOCUMENTS DO NOT HAVE TO BE BATCHED ***"
QUIT
+8 IF $GET(GECS("CSDA"))
Begin DoDot:2
+9 WRITE !
SET GECSSTAT=$$STATUS^GECSUSTA(GECS("CSDA"))
WRITE !
+10 SET GECSBATC=$PIECE($GET(^GECS(2100,GECS("CSDA"),"TRANS")),"^",9)
+11 IF GECSBATC=""
WRITE !,"YOU CAN ONLY SELECT CODE SHEETS WHICH HAVE BEEN MARKED FOR BATCHING."
QUIT
+12 IF $$ASKREBAT
SET %=$$MARKBAT(GECS("CSDA"))
DO KILLBATC(GECSBATC)
QUIT
End DoDot:2
QUIT
+13 DO ERROR^GECSUTIL(GECSDA)
End DoDot:1
+14 QUIT
+15 ;
REVIEW ; review code sheets waiting to be batched
+1 NEW %,GECS,GECSDA,GECSSTAT,GECSBTYP
+2 DO ^GECSSITE
if '$DATA(GECS("SITE"))
QUIT
+3 WRITE !
DO BATTYPE^GECSUSEL($GET(GECSSYS),$SELECT($LENGTH($GET(GECSSYS)):1,1:0))
if '$GET(GECS("BATDA"))
QUIT
+4 SET GECSBTYP=GECS("BATCH")
+5 FOR
SET GECSDA=$$CODESHET^GECSUSEL(GECSBTYP)
if 'GECSDA
QUIT
Begin DoDot:1
+6 DO VARIABLE^GECSUTIL(GECSDA)
+7 IF $GET(GECS("CSDA"))
Begin DoDot:2
+8 WRITE !
SET GECSSTAT=$$STATUS^GECSUSTA(GECS("CSDA"))
WRITE !
+9 IF GECS("SYSID")'="FMS"
IF $PIECE($GET(^GECS(2100,GECS("CSDA"),"TRANS")),"^")'="Y"
WRITE !,"YOU CAN ONLY SELECT CODE SHEETS WHICH HAVE BEEN MARKED FOR BATCHING."
QUIT
+10 IF GECS("SYSID")="FMS"
IF $PIECE($GET(^GECS(2100,GECS("CSDA"),"TRANS")),"^",3)'=""
WRITE !,"YOU CAN ONLY SELECT FMS DOCUMENTS WHICH HAVE NOT BEEN TRANSMITTED."
QUIT
+11 IF '$$MAPDATA^GECSXBLD(GECS("CSDA"))
QUIT
+12 DO ASKTOBAT^GECSXBL1(GECS("CSDA"))
End DoDot:2
QUIT
+13 DO ERROR^GECSUTIL(GECSDA)
End DoDot:1
+14 QUIT
+15 ;
DELETE ; delete selected code sheets
+1 NEW %,GECS,GECSDA,GECSSTAT,GECSBTYP
+2 DO ^GECSSITE
if '$DATA(GECS("SITE"))
QUIT
+3 WRITE !
DO BATTYPE^GECSUSEL($GET(GECSSYS),$SELECT($LENGTH($GET(GECSSYS)):1,1:0))
if '$GET(GECS("BATDA"))
QUIT
+4 SET GECSBTYP=GECS("BATCH")
+5 FOR
SET GECSDA=$$CODESHET^GECSUSEL(GECSBTYP)
if 'GECSDA
QUIT
Begin DoDot:1
+6 DO VARIABLE^GECSUTIL(GECSDA)
+7 WRITE !
SET GECSSTAT=$$STATUS^GECSUSTA(GECSDA)
WRITE !
+8 DO DELASK^GECSUTIL(GECSDA)
End DoDot:1
+9 QUIT
+10 ;
EDITBAT ; edit code sheet batch
+1 NEW %,GECS,GECSBATC,GECSDA,GECSDICS,GECSSTAT,GECSBTYP
+2 DO ^GECSSITE
if '$GET(GECS("SITE"))
QUIT
+3 DO BATNOFMS^GECSUSEL
if '$GET(GECS("BATDA"))
QUIT
+4 SET GECSBTYP=GECS("BATCH")
+5 FOR
SET GECSDA=$$CODESHET^GECSUSEL(GECSBTYP)
if 'GECSDA
QUIT
Begin DoDot:1
+6 DO VARIABLE^GECSUTIL(GECSDA)
+7 IF $GET(GECS("CSDA"))
Begin DoDot:2
+8 WRITE !
SET GECSSTAT=$$STATUS^GECSUSTA(GECS("CSDA"))
WRITE !
+9 IF '$DATA(^GECS(2100,GECS("CSDA"),"TRANS"))
WRITE !,"CODE SHEET MUST BE READY FOR BATCHING BEFORE THE BATCH NUMBER CAN BE EDIT.",!,"USE THE 'Code Sheet Edit' OPTION."
QUIT
+10 IF $PIECE($GET(^GECS(2100,GECS("CSDA"),"TRANS")),"^",9)'=""
Begin DoDot:3
+11 SET XP="Do you want to DELETE this batch number"
SET XH="Enter 'YES' to DELETE batch number, 'NO' ro select a NEW batch number,"
SET XH(1)="or '^' to exit."
+12 SET %=$$YN^GECSUTIL(2)
IF %'=1
QUIT
+13 SET GECSBATC=$PIECE(^GECS(2100,GECS("CSDA"),"TRANS"),"^",9)
+14 SET %=$$MARKBAT(GECS("CSDA"))
+15 DO KILLBATC(GECSBATC)
+16 SET %=0
End DoDot:3
if %=0
QUIT
+17 SET GECSDICS="I $P(^(0),U,6)=GECS(""BATDA""),$P(^(0),U,4)="""""
+18 SET GECSBATC=$$BATCHSEL^GECSUSEL(GECSDICS)
IF 'GECSBATC
QUIT
+19 SET GECSBATC=$PIECE($GET(^GECS(2101.3,GECSBATC,0)),"^")
IF GECSBATC=""
QUIT
+20 SET XP="READY TO CHANGE THE BATCH NUMBER"
SET XH="Enter 'YES' to change the batch number, 'NO' or '^' to exit."
+21 IF $$YN^GECSUTIL(1)'=1
QUIT
+22 DO SETBATCH(GECS("CSDA"),GECSBATC)
End DoDot:2
QUIT
+23 DO ERROR^GECSUTIL(GECSDA)
End DoDot:1
+24 QUIT
+25 ;
SETBATCH(DA,GECSBATC) ; set code sheet da to gecsbatc batch
+1 NEW DIC,DIE,DR,X,Y
+2 SET (DIC,DIE)="^GECS(2100,"
SET DR=".1///@;.15///Y;.8////"_GECSBATC_";.9//3;"
+3 DO ^DIE
IF $DATA(Y)
WRITE !,"UNABLE TO SET BATCH NUMBER ",GECSBATC
QUIT
+4 WRITE !,"CODE SHEET READY FOR TRANSMISSION IN BATCH ",GECSBATC
+5 QUIT
+6 ;
KILLBATC(GECSBATC) ; check if any code sheets are in batch, if no delete it
+1 IF '$LENGTH(GECSBATC)
QUIT
+2 IF $DATA(^GECS(2100,"AB",GECSBATC))
QUIT
+3 NEW DA
+4 SET DA=+$ORDER(^GECS(2101.3,"B",GECSBATC,0))
IF 'DA
QUIT
+5 WRITE !!,"NO CODE SHEETS INCLUDED IN BATCH ",GECSBATC,".",!,"DELETING BATCH ",GECSBATC
+6 DO KILLBATC^GECSPUR1(DA)
+7 QUIT