111 lines
4.7 KiB
Mathematica
111 lines
4.7 KiB
Mathematica
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
|
|
;
|
|
REMARK ; remark a code sheet for batching
|
|
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
|