AGTXST ; IHS/ASDS/EFG - UTILITY HANDLER FOR UPDATING TRANSMISSIONS FILE ;
;;7.1;PATIENT REGISTRATION;;AUG 25,2005
;
;Modified per Patrick Cox of OKCAO. Allows adding a multiple date
;for the first time.
Q
AGR1 ;EP - find date to begin agpatch scan
;LOOK FOR LAST ENTRY IN THE TRANS FILE THAT'S COMPLETE
;AND RETURN THE DA IN AGLIEN
;agtxsite is used and should already be set to $O(^AUTTSITE(0))
D INIT
LOOP S (AGLIEN,AGIEN)=0 F S AGIEN=$O(^AGTXST(AGTXSITE,1,AGIEN)) Q:AGIEN'>0 S AGLIEN=AGIEN
I AGLIEN,$P(^AGTXST(AGTXSITE,1,AGLIEN,0),U,10)="Y" G END ;---> found last completed run
I AGLIEN S DA=AGLIEN,DIK="^AGTXST(AGTXSITE,1,",DA(1)=AGTXSITE D ^DIK G LOOP ;kill incomplete runs and rescan
END ;EP -
I AGLIEN S $P(^AGTXST(AGTXSITE,1,0),U,3)=AGLIEN ;update 3rd piece to the last file entry
K AGIEN
Q
SET ;EP - set transmission data/status into file
D INIT
K DIC,DR,DA S DIC="^AGTXST("_AGTXSITE_",1,",DIC(0)="MQL",DA(1)=AGTXSITE,X=DT D ^DIC
K DR S DA(1)=AGTXSITE,DA=+Y,DIE=DIC,DR="1///"_AGFDATE_";2///"_AGLDATE_";4///"_AG("TOT")_";9///N"
F %=11:1:18 S DR=DR_";"_%_"///"_$G(AG("TOT",%-10))
S DR=DR_";21///"_AG("T")_";22///"_$G(AGIN06)_";23///"_$G(AGIN01)_";24///"_$$NOW^XLFDT
D ^DIE
Q
COM ;EP - set tape OK and othr completion data into transmission file
D INIT
K DIC,DR,DA S DIC="^AGTXST("_AGTXSITE_",1,",DIC(0)="MQL",DA(1)=AGTXSITE,X=DT D ^DIC
K DR S DA(1)=AGTXSITE,DA=+Y,DIE=DIC,DR="9///Y" D ^DIE
Q
INIT ;EP -
S AGTXSITE=$S($G(AGTXSITE):AGTXSITE,1:DUZ(2))
S DIC="^AGTXST(",DIC(0)="QML",X="`"_AGTXSITE D ^DIC
Q:Y'>0
S:'$D(^AGTXST(AGTXSITE,1,0)) $P(^AGTXST(AGTXSITE,1,0),"^",2)=$P(^DD(9009063,1,0),"^",2)
Q
AGTXST ; IHS/ASDS/EFG - UTILITY HANDLER FOR UPDATING TRANSMISSIONS FILE ;
+1 ;;7.1;PATIENT REGISTRATION;;AUG 25,2005
+2 ;
+3 ;Modified per Patrick Cox of OKCAO. Allows adding a multiple date
+4 ;for the first time.
+5 QUIT
AGR1 ;EP - find date to begin agpatch scan
+1 ;LOOK FOR LAST ENTRY IN THE TRANS FILE THAT'S COMPLETE
+2 ;AND RETURN THE DA IN AGLIEN
+3 ;agtxsite is used and should already be set to $O(^AUTTSITE(0))
+4 DO INIT
LOOP SET (AGLIEN,AGIEN)=0
FOR
SET AGIEN=$ORDER(^AGTXST(AGTXSITE,1,AGIEN))
IF AGIEN'>0
QUIT
SET AGLIEN=AGIEN
+1 ;---> found last completed run
IF AGLIEN
IF $PIECE(^AGTXST(AGTXSITE,1,AGLIEN,0),U,10)="Y"
GOTO END
+2 ;kill incomplete runs and rescan
IF AGLIEN
SET DA=AGLIEN
SET DIK="^AGTXST(AGTXSITE,1,"
SET DA(1)=AGTXSITE
DO ^DIK
GOTO LOOP
END ;EP -
+1 ;update 3rd piece to the last file entry
IF AGLIEN
SET $PIECE(^AGTXST(AGTXSITE,1,0),U,3)=AGLIEN
+2 KILL AGIEN
+3 QUIT
SET ;EP - set transmission data/status into file
+1 DO INIT
+2 KILL DIC,DR,DA
SET DIC="^AGTXST("_AGTXSITE_",1,"
SET DIC(0)="MQL"
SET DA(1)=AGTXSITE
SET X=DT
DO ^DIC
+3 KILL DR
SET DA(1)=AGTXSITE
SET DA=+Y
SET DIE=DIC
SET DR="1///"_AGFDATE_";2///"_AGLDATE_";4///"_AG("TOT")_";9///N"
+4 FOR %=11:1:18
SET DR=DR_";"_%_"///"_$GET(AG("TOT",%-10))
+5 SET DR=DR_";21///"_AG("T")_";22///"_$GET(AGIN06)_";23///"_$GET(AGIN01)_";24///"_$$NOW^XLFDT
+6 DO ^DIE
+7 QUIT
COM ;EP - set tape OK and othr completion data into transmission file
+1 DO INIT
+2 KILL DIC,DR,DA
SET DIC="^AGTXST("_AGTXSITE_",1,"
SET DIC(0)="MQL"
SET DA(1)=AGTXSITE
SET X=DT
DO ^DIC
+3 KILL DR
SET DA(1)=AGTXSITE
SET DA=+Y
SET DIE=DIC
SET DR="9///Y"
DO ^DIE
+4 QUIT
INIT ;EP -
+1 SET AGTXSITE=$SELECT($GET(AGTXSITE):AGTXSITE,1:DUZ(2))
+2 SET DIC="^AGTXST("
SET DIC(0)="QML"
SET X="`"_AGTXSITE
DO ^DIC
+3 IF Y'>0
QUIT
+4 IF '$DATA(^AGTXST(AGTXSITE,1,0))
SET $PIECE(^AGTXST(AGTXSITE,1,0),"^",2)=$PIECE(^DD(9009063,1,0),"^",2)
+5 QUIT