GECSUFM1 ;WISC/RFJ/KLD-fms utilities: rebuild rejects ;13 Oct 98
;;2.0;GCS;**4,8,10,19,27,30,31**;MAR 14, 1995
Q
;
;
REBUILD(STACKDA,SYSTEM,SECCODE,FCPFLAG,DESCRIPT) ; rebuild rejected document
; stackda = ien of stack entry to rebuild
; system = "A" for ar, "I" for ifcap, "E" for eng, "C" for create doc
; seccode = security 1 code (usually '10 ')
; fcpflag = Y if transaction has updated ifcap fcp balance
; use only for tran-code RC, CR, IV, MO, SA, ST
; descript = description of event (null entry will not change orig)
; return gecsfms("ctl"), gecsfms("bat"), gecsfms("doc")
N %,%H,%I,BATNUMB,DATE,DOCUMENT,FY,SEGMENT,STACK,STATION,TRANCLAS,TRANCODE,X,Y
;
K GECSFMS
S STACK=$P($G(^GECS(2100.1,+STACKDA,0)),"^") I STACK="" Q
;
S SYSTEM=$S($E(SYSTEM)="A":"ARS",$E(SYSTEM)="I":"IFC",$E(SYSTEM)="E":"AMM",1:"CFD")
; stack entry in the form IV-460I12345 -460123
; TT-STA###### -STAbat
S TRANCODE=$P(STACK,"-")
S STATION=$E($P(STACK,"-",2),1,3)
S DOCUMENT=$E($P(STACK,"-",2)_" ",1,11)
S BATNUMB=$E($P(STACK,"-",3)_" ",1,6)
S SECCODE=$E(SECCODE_" ",1,4)
D NOW^%DTC S Y=%,DATE=X D DD^%DT
S FY=$S($E(DATE,4,5)<10:$E(DATE,2,3),1:$E(DATE,2,3)+1)
S TRANCLAS="DOC" I TRANCODE="VR" S TRANCLAS="VRQ",TRANCODE=" "
S GECSFMS("CTL")="CTL^"_SYSTEM_"^FMS^"_$E(STATION,1,3)_"^"_TRANCLAS_"^"_TRANCODE_"^"_SECCODE_"^"_$E(BATNUMB,1,6)_"^"_DOCUMENT_"^"_(17+$E(DATE))_$E(DATE,2,7)_"^"_$$FORMTIME($P(Y,"@",2))_"^001^001^001^"_$C(126)
;
; vendor request, re-add ctl to stack and quit
I TRANCLAS="VRQ" D UPDSTACK(STACKDA,GECSFMS("CTL"),"","",DESCRIPT) Q
;
; change segment for specific transaction codes
S SEGMENT=TRANCODE
I TRANCODE="CF"!(TRANCODE="WR")!(TRANCODE="TR") S SEGMENT="CR"
I TRANCODE="DV"!(TRANCODE="ET") S SEGMENT="DD"
I TRANCODE="AO"!(TRANCODE="CO")!(TRANCODE="SO")!(TRANCODE="TG")!(TRANCODE="WO") S SEGMENT="MO"
I TRANCODE="AV"!(TRANCODE="CT")!(TRANCODE="MV")!(TRANCODE="OP")!(TRANCODE="PS")!(TRANCODE="TD") S SEGMENT="PV"
I TRANCODE="AR"!(TRANCODE="RT") S SEGMENT="RC"
I TRANCODE="BV" S SEGMENT="SV"
I TRANCODE="RO"!(TRANCODE="TZ") S SEGMENT="TO"
I TRANCODE="RV"!(TRANCODE="TY") S SEGMENT="TV"
; create bat segment
I BATNUMB'=" " S GECSFMS("BAT")="BAT^"_$C(126)_SEGMENT_"0^"_BATNUMB_"^"_$C(126)
; create doc and <tc>1 segments
I "RC^CR^TR^IV^MO^SA^ST"[SEGMENT S FCPFLAG=$S(FCPFLAG="Y":"Y",1:"N")_"^"
; security code is not on the sa1,st1 code sheets
S SECCODE=SECCODE_"^"
I "SA^ST"[SEGMENT S SECCODE=""
S GECSFMS("DOC")="DOC^"_$C(126)
; do not create <tc>1 document for at transaction code or amm system
I SEGMENT'="AT",SYSTEM'="AMM" S GECSFMS("DOC")=GECSFMS("DOC")_SEGMENT_"1^"_TRANCODE_"^"_DOCUMENT_"^"_SECCODE_FCPFLAG_$C(126)
;
; re-add code sheet to stack file
D UPDSTACK(STACKDA,GECSFMS("CTL"),$G(GECSFMS("BAT")),GECSFMS("DOC"),DESCRIPT)
Q
;
;
UPDSTACK(STACKDA,CONTROL,BATCH,DOCUMENT,DESCRIPT) ; kill existing stack
; entry code sheets and add new ones
; stackda = ien of stack entry
; control = control segment
; batch = batch segment (optional, use "" if not defined)
; document = doc and <tc>1 segments (optional, use "" if not defined)
; descript = 79 character description of event
I '$D(^GECS(2100.1,STACKDA,0)) Q
N DATE,TIME,GDT
;
L +^GECS(2100.1,STACKDA)
S DATE=$P(CONTROL,"^",10),DATE=($E(DATE,1,2)-17)_$E(DATE,3,8)
S TIME=$P(CONTROL,"^",11)
S GDT=DATE_"."_TIME
S DR="2///^S X=GDT",DIE=2100.1,DA=STACKDA D ^DIE
D SETSTAT^GECSSTAA(STACKDA,"")
I $L(DESCRIPT) S ^GECS(2100.1,STACKDA,1)=$E(DESCRIPT,1,79)
K ^GECS(2100.1,STACKDA,10)
; reset code sheet size to 0, checksum and hold date to null
S $P(^GECS(2100.1,STACKDA,11),"^",1,3)="0^^"
D SETCS^GECSSTAA(STACKDA,CONTROL)
I $P(CONTROL,"^",8),BATCH'="" D SETCS^GECSSTAA(STACKDA,BATCH)
I DOCUMENT'="" D SETCS^GECSSTAA(STACKDA,DOCUMENT)
L -^GECS(2100.1,STACKDA)
Q
;
;
FORMTIME(TIME) ; return formatted time for control ctl segment
N H,M,S
S H=$P(TIME,":"),M=$P(TIME,":",2),S=$P(TIME,":",3),H=$E("00",$L(H)+1,2)_H,M=$E("00",$L(M)+1,2)_M,S=$E("00",$L(S)+1,2)_S
Q H_M_S
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGECSUFM1 4188 printed Dec 13, 2024@01:56:34 Page 2
GECSUFM1 ;WISC/RFJ/KLD-fms utilities: rebuild rejects ;13 Oct 98
+1 ;;2.0;GCS;**4,8,10,19,27,30,31**;MAR 14, 1995
+2 QUIT
+3 ;
+4 ;
REBUILD(STACKDA,SYSTEM,SECCODE,FCPFLAG,DESCRIPT) ; rebuild rejected document
+1 ; stackda = ien of stack entry to rebuild
+2 ; system = "A" for ar, "I" for ifcap, "E" for eng, "C" for create doc
+3 ; seccode = security 1 code (usually '10 ')
+4 ; fcpflag = Y if transaction has updated ifcap fcp balance
+5 ; use only for tran-code RC, CR, IV, MO, SA, ST
+6 ; descript = description of event (null entry will not change orig)
+7 ; return gecsfms("ctl"), gecsfms("bat"), gecsfms("doc")
+8 NEW %,%H,%I,BATNUMB,DATE,DOCUMENT,FY,SEGMENT,STACK,STATION,TRANCLAS,TRANCODE,X,Y
+9 ;
+10 KILL GECSFMS
+11 SET STACK=$PIECE($GET(^GECS(2100.1,+STACKDA,0)),"^")
IF STACK=""
QUIT
+12 ;
+13 SET SYSTEM=$SELECT($EXTRACT(SYSTEM)="A":"ARS",$EXTRACT(SYSTEM)="I":"IFC",$EXTRACT(SYSTEM)="E":"AMM",1:"CFD")
+14 ; stack entry in the form IV-460I12345 -460123
+15 ; TT-STA###### -STAbat
+16 SET TRANCODE=$PIECE(STACK,"-")
+17 SET STATION=$EXTRACT($PIECE(STACK,"-",2),1,3)
+18 SET DOCUMENT=$EXTRACT($PIECE(STACK,"-",2)_" ",1,11)
+19 SET BATNUMB=$EXTRACT($PIECE(STACK,"-",3)_" ",1,6)
+20 SET SECCODE=$EXTRACT(SECCODE_" ",1,4)
+21 DO NOW^%DTC
SET Y=%
SET DATE=X
DO DD^%DT
+22 SET FY=$SELECT($EXTRACT(DATE,4,5)<10:$EXTRACT(DATE,2,3),1:$EXTRACT(DATE,2,3)+1)
+23 SET TRANCLAS="DOC"
IF TRANCODE="VR"
SET TRANCLAS="VRQ"
SET TRANCODE=" "
+24 SET GECSFMS("CTL")="CTL^"_SYSTEM_"^FMS^"_$EXTRACT(STATION,1,3)_"^"_TRANCLAS_"^"_TRANCODE_"^"_SECCODE_"^"_$EXTRACT(BATNUMB,1,6)_"^"_DOCUMENT_"^"_(17+$EXTRACT(DATE))_$EXTRACT(DATE,2,7)_"^"_$$FORMTIME($PIECE(Y,"@",2))_"^001^001^001^"_$CHAR(126)
+25 ;
+26 ; vendor request, re-add ctl to stack and quit
+27 IF TRANCLAS="VRQ"
DO UPDSTACK(STACKDA,GECSFMS("CTL"),"","",DESCRIPT)
QUIT
+28 ;
+29 ; change segment for specific transaction codes
+30 SET SEGMENT=TRANCODE
+31 IF TRANCODE="CF"!(TRANCODE="WR")!(TRANCODE="TR")
SET SEGMENT="CR"
+32 IF TRANCODE="DV"!(TRANCODE="ET")
SET SEGMENT="DD"
+33 IF TRANCODE="AO"!(TRANCODE="CO")!(TRANCODE="SO")!(TRANCODE="TG")!(TRANCODE="WO")
SET SEGMENT="MO"
+34 IF TRANCODE="AV"!(TRANCODE="CT")!(TRANCODE="MV")!(TRANCODE="OP")!(TRANCODE="PS")!(TRANCODE="TD")
SET SEGMENT="PV"
+35 IF TRANCODE="AR"!(TRANCODE="RT")
SET SEGMENT="RC"
+36 IF TRANCODE="BV"
SET SEGMENT="SV"
+37 IF TRANCODE="RO"!(TRANCODE="TZ")
SET SEGMENT="TO"
+38 IF TRANCODE="RV"!(TRANCODE="TY")
SET SEGMENT="TV"
+39 ; create bat segment
+40 IF BATNUMB'=" "
SET GECSFMS("BAT")="BAT^"_$CHAR(126)_SEGMENT_"0^"_BATNUMB_"^"_$CHAR(126)
+41 ; create doc and <tc>1 segments
+42 IF "RC^CR^TR^IV^MO^SA^ST"[SEGMENT
SET FCPFLAG=$SELECT(FCPFLAG="Y":"Y",1:"N")_"^"
+43 ; security code is not on the sa1,st1 code sheets
+44 SET SECCODE=SECCODE_"^"
+45 IF "SA^ST"[SEGMENT
SET SECCODE=""
+46 SET GECSFMS("DOC")="DOC^"_$CHAR(126)
+47 ; do not create <tc>1 document for at transaction code or amm system
+48 IF SEGMENT'="AT"
IF SYSTEM'="AMM"
SET GECSFMS("DOC")=GECSFMS("DOC")_SEGMENT_"1^"_TRANCODE_"^"_DOCUMENT_"^"_SECCODE_FCPFLAG_$CHAR(126)
+49 ;
+50 ; re-add code sheet to stack file
+51 DO UPDSTACK(STACKDA,GECSFMS("CTL"),$GET(GECSFMS("BAT")),GECSFMS("DOC"),DESCRIPT)
+52 QUIT
+53 ;
+54 ;
UPDSTACK(STACKDA,CONTROL,BATCH,DOCUMENT,DESCRIPT) ; kill existing stack
+1 ; entry code sheets and add new ones
+2 ; stackda = ien of stack entry
+3 ; control = control segment
+4 ; batch = batch segment (optional, use "" if not defined)
+5 ; document = doc and <tc>1 segments (optional, use "" if not defined)
+6 ; descript = 79 character description of event
+7 IF '$DATA(^GECS(2100.1,STACKDA,0))
QUIT
+8 NEW DATE,TIME,GDT
+9 ;
+10 LOCK +^GECS(2100.1,STACKDA)
+11 SET DATE=$PIECE(CONTROL,"^",10)
SET DATE=($EXTRACT(DATE,1,2)-17)_$EXTRACT(DATE,3,8)
+12 SET TIME=$PIECE(CONTROL,"^",11)
+13 SET GDT=DATE_"."_TIME
+14 SET DR="2///^S X=GDT"
SET DIE=2100.1
SET DA=STACKDA
DO ^DIE
+15 DO SETSTAT^GECSSTAA(STACKDA,"")
+16 IF $LENGTH(DESCRIPT)
SET ^GECS(2100.1,STACKDA,1)=$EXTRACT(DESCRIPT,1,79)
+17 KILL ^GECS(2100.1,STACKDA,10)
+18 ; reset code sheet size to 0, checksum and hold date to null
+19 SET $PIECE(^GECS(2100.1,STACKDA,11),"^",1,3)="0^^"
+20 DO SETCS^GECSSTAA(STACKDA,CONTROL)
+21 IF $PIECE(CONTROL,"^",8)
IF BATCH'=""
DO SETCS^GECSSTAA(STACKDA,BATCH)
+22 IF DOCUMENT'=""
DO SETCS^GECSSTAA(STACKDA,DOCUMENT)
+23 LOCK -^GECS(2100.1,STACKDA)
+24 QUIT
+25 ;
+26 ;
FORMTIME(TIME) ; return formatted time for control ctl segment
+1 NEW H,M,S
+2 SET H=$PIECE(TIME,":")
SET M=$PIECE(TIME,":",2)
SET S=$PIECE(TIME,":",3)
SET H=$EXTRACT("00",$LENGTH(H)+1,2)_H
SET M=$EXTRACT("00",$LENGTH(M)+1,2)_M
SET S=$EXTRACT("00",$LENGTH(S)+1,2)_S
+3 QUIT H_M_S