LA7SCE ;VA/DALOI/JMC - Shipping Configuration Utility ;JUL 06, 2010 3:14 PM
;;5.2;AUTOMATED LAB INSTRUMENTS;**27,46,61,64,1027**;NOV 01, 1997
Q
;
SCFE ; Edit file #62.9, Shipping Configuration.
;
N DA,DIE,DIC,DIR,DLAYGO,DIRUT,DR,DTOUT,DIROUT,X,Y
N LA7CHECK,LA7COPY,LA7NVAF,LA7SCFG,LA7SCFR,LA7TYPE,LA7VAF,LA7X,LR62,LRSS
;
S DIC="^LAHM(62.9,",DIC(0)="AELMQZ",DIC("A")="Select SHIPPING CONFIGURATION: "
S DIC("DR")=".02;.03",DLAYGO=62.9
D ^DIC
K DA,DIC,DIE,DR
I Y<1 Q
;
S LA7SCFG=+Y,LA7SCFG(0)=Y(0)
;
L +^LAHM(62.9,LA7SCFG):5
I '$T D Q
. D EN^DDIOL("Unable to obtain lock on entry "_$P(LA7SCFG(0),"^"),"","!?3")
;
S DIR(0)="SO^1:Collecting facility;2:Host facility",DIR("A")="Are you editing this entry as the"
S DIR("?",1)="Is this entry used by the Collecting facility to ship specimens,"
S DIR("?",2)="or by the Host facility to accept a shipment."
S DIR("?")="This determines which fields are edited in the file."
D ^DIR
I $D(DIRUT) D UNL629 Q
S LA7TYPE=+Y
;
; Determine if other facility is non-VA.
; When acting as collecting facility is host non-VA
; When acting as host is collecting facility non-VA
S LA7VAF="",LA7NVAF=0
I $P(LA7SCFG(0),"^",2),$P(LA7SCFG(0),"^",3) D
. S LA7X=$S(LA7TYPE=1:$P(LA7SCFG(0),"^",3),1:$P(LA7SCFG(0),"^",2))
. S LA7VAF=$$GET1^DIQ(4,LA7X_",","AGENCY CODE","I")
. S LA7NVAF=$$NVAF^LA7VHLU2(LA7X)
I LA7VAF="" D Q
. N LA7MSG
. S LA7MSG="Unable to proceed - institution "
. S LA7MSG=LA7MSG_$$GET1^DIQ(4,$S(LA7TYPE=1:$P(LA7SCFG(0),"^",3),1:$P(LA7SCFG(0),"^",2))_",",.01)
. S LA7MSG=LA7MSG_" missing AGENCY CODE field in INSITUTION file (#4)"
. D EN^DDIOL(LA7MSG,"","!!?3")
. D UNL629
;
; If acting as host ask if user wants to copy test config from another entry.
I LA7TYPE=2 D
. N DIC,Y
. S LA7COPY=$$ASKCOPY
. I LA7COPY<1 Q
. S LA7CHECK=$$CHECK(LA7SCFG)
. I LA7CHECK<1 S LA7COPY=LA7CHECK Q
. I LA7COPY<1 Q
. I LA7COPY=1 D Q
. . S DIC="^LAHM(62.9,",DIC(0)="AEMQZ",DIC("A")="Select SHIPPING CONFIGURATION to COPY FROM: ",DIC("S")="I Y'=LA7SCFG"
. . D ^DIC K DIC("S")
. . I Y<1 Q
. . S LA7SCFR=+Y,LA7SCFR(0)=Y(0)
. . D CLRSCT(.LA7SCFG)
. . D COPYSC(.LA7SCFR,.LA7SCFG)
. I LA7COPY=2 D Q
. . D CLRSCT(.LA7SCFG)
. . D COPY60(.LA7SCFG)
I LA7TYPE=2,LA7COPY<0 D UNL629 Q
K DA,DIE,DIC,DIR,DLAYGO,DIRUT,DR,DTOUT,DIROUT,X,Y
;
; Set up DR string when acting as collecting facility
I LA7TYPE=1 D
. S DR=".01;.02;.06;.03;.031;"
. I LA7NVAF>1 S DR=DR_".11;.12;.14;.15;"
. I LA7NVAF=1 S DR=DR_".14////1;.15////1;"
. S DR=DR_".04;.07;.08;.09;.1;.13;60"
. S DR(2,62.9001)=".01;.02;.025;.03;.04;.05;.06;.07"
;
; Set up DR string when acting as host facility
I LA7TYPE=2 D
. S DR=".01;.02;.06;.03;.031;"
. I LA7NVAF>1 S DR=DR_".11;.14;.15;"
. I LA7NVAF=1 S DR=DR_".14////0;.15////1;"
. S DR=DR_".04;.05;60"
. S DR(2,62.9001)=".01;S LRSS=$P(^LAB(60,X,0),U,4);.04;.09;S LR62=X I LRSS'=""MI"" S Y=""@2"";I LR62,$P(^LAB(62,LR62,0),U,2)'="""" S Y=""@2"";.03;5.7;@2"
;
; Determine if non-VA test codes/specimen fields should be asked
I LA7VAF'="V" D
. S DR(2,62.9001)=DR(2,62.9001)_";I $P(^LAHM(62.9,LA7SCFG,0),U,15)'=1 S Y=""@9"";5.1;5.2;5.5"
. I LA7TYPE=1,LA7NVAF=1 S DR(2,62.9001)=DR(2,62.9001)_"////99LST"
. S DR(2,62.9001)=DR(2,62.9001)_";@9"
. I LA7TYPE=1 D
. . S DR(2,62.9001)=DR(2,62.9001)_";I $P(^LAHM(62.9,LA7SCFG,0),U,16)'=1 S Y=""@10"";5.3;5.4;5.6"
. . I LA7NVAF=1 S DR(2,62.9001)=DR(2,62.9001)_"////99LRP;5.7;5.8;5.9////99LRS"
. . S DR(2,62.9001)=DR(2,62.9001)_";@10"
. I LA7TYPE=2 D
. . S DR(2,62.9001)=DR(2,62.9001)_";I $P(^LAHM(62.9,LA7SCFG,0),U,16)'=1 S Y=""@10"";5.3;5.4;5.6"
. . I LA7NVAF=1 S DR(2,62.9001)=DR(2,62.9001)_"////99LRP"
. . S DR(2,62.9001)=DR(2,62.9001)_";@10"
;
I LA7TYPE=1 D
. N J,K
. S DR(2,62.9001)=DR(2,62.9001)_";"
. S X="1.1;I 'X S Y=1.2;1.15;1.16;1.2;I 'X S Y=2.1;1.25;1.26;2.1;I '+X S Y=2.3;2.15;2.16;2.3;I '+X S Y=2.2;2.35;2.36;2.2;I '+X S Y=""@12"";2.25;2.26;@12"
. I ($L(DR(2,62.9001))+$L(X))<246 S DR(2,62.9001)=DR(2,62.9001)_X Q
. S K=$L(X,";")
. F J=1:1:K D
. . I ($L(DR(2,62.9001))+$L($P(X,";")))>244 S J=K Q
. . S DR(2,62.9001)=DR(2,62.9001)_$P(X,";")_";",X=$P(X,";",2,K)
. I X'="" S DR(2,62.9001,1)=X
;
S DA=LA7SCFG,DIE="^LAHM(62.9,"
D ^DIE,UNL629
Q
;
;
; Unlock entry in 62.9
UNL629 L -^LAHM(62.9,LA7SCFG)
;
Q
;
;
SCTE ; Edit file #62.91, Shipping Container.
N DA,DIE,DIC,DLAYGO,DR,X,Y
S DIC="^LAHM(62.91,",DIC(0)="AELMQZ",DIC("A")="Select SHIPPING CONTAINER: ",DLAYGO=62.91
D ^DIC
I Y<1 Q
S DA=+Y,DIE=DIC,DR=".01;.02"
D ^DIE
Q
;
;
SCME ; Edit file #62.92, Shipping Method.
N DA,DIE,DIC,DLAYGO,DR,X,Y
S DIC="^LAHM(62.92,",DIC(0)="AELMQZ",DIC("A")="Select SHIPPING METHOD: ",DLAYGO=62.92
D ^DIC
I Y<1 Q
S DA=+Y,DIE=DIC,DR=".01;.02"
D ^DIE
Q
;
;
SCDE ; Edit file #62.93, Shipping Condition.
N DA,DIE,DIC,DLAYGO,DR,X,Y
S DIC="^LAHM(62.93,",DIC(0)="AELMQZ",DIC("A")="Select SHIPPING CONDITION: ",DLAYGO=62.93
D ^DIC
I Y<1 Q
S DA=+Y,DIE=DIC,DR=".01;.02"
D ^DIE
Q
;
;
ASKCOPY() ; Ask if user want to copy tests from file #60 or another configuration in file #62.9 LAB SHIPPING CONFIGURATION
; Returns LA7COPY = -1 user quit/aborted
; = 0 do not copy
; = 1 use file #60
; = 2 use another entry in #62.49
N DIR,DIRUT,DTOUT,DUOUT,X,Y
S DIR(0)="SMO^0:Do NOT copy;1:Another Shipping Configuration;2:Test Catalog - LABORATORY TEST File #60"
S DIR("A")="Copy a test profile from",DIR("B")="Do NOT copy"
S DIR("?",1)="If you want to duplicate a shipping configuration using another configuration"
S DIR("?",2)="or build from the tests marked as catalog tests in the LABORATORY TEST file."
S DIR("?")="Select the appropiate option."
D ^DIR
I $D(DIRUT) S Y=-1
Q Y
;
;
CHECK(LA7SCFG) ; Check if test exists for configuration and warn if overwriting
; Call with LA7SCFG = shiping configuration ien
; Returns -1 = user aborted/timeout
; 0 = no - don't overwrite
; 1 = yes - overwrite
I '$O(^LAHM(62.9,LA7SCFG,60,0)) Q 1
N DIR,DIRUT,DTOUT,DUOUT,X,Y
S DIR(0)="SBO^0:NO;1:YES"
S DIR("A",1)="Tests already exist for this configuration!",DIR("A")="Are you sure",DIR("B")="NO"
D ^DIR
I $D(DIRUT) S Y=-1
Q Y
;
;
COPYSC(LA7FR,LA7TO) ; Copy one shipping configuration to another
; Call with LA7FR = shipping configuration to copy FROM.
; LA7TO = shipping configuration ien to copy TO.
N LA760,LA762,LA6205,LA7X
W !!,"Copying tests from configuration: ",$P(LA7FR(0),"^")," to ",$P(LA7TO(0),"^"),!
S LA7X=0
F S LA7X=$O(^LAHM(62.9,LA7FR,60,LA7X)) Q:'LA7X D
. S LA760=$P($G(^LAHM(62.9,LA7FR,60,LA7X,0)),"^") ; file #60 laboratory test ien.
. S LA76205=$P($G(^LAHM(62.9,LA7FR,60,LA7X,0)),"^",4) ; file #62.05, urgency ien.
. S LA762=$P($G(^LAHM(62.9,LA7FR,60,LA7X,0)),"^",9) ; file #62, collection sample ien.
. I LA760 D FDA629(LA7TO,LA760,LA762,LA76205)
Q
;
;
COPY60(LA7SCFG) ; Copy catalog tests from file #60 to shipping configuration.
; Call with LA7SCFG = shipping configuration ien to add tests to from file #60
N LA760,LA762,LA7X
W !!,"Copying tests from file #60 LABORATORY TEST to ",$P(LA7SCFG(0),"^"),!
S LA760=0 ; file #60 pointer
I '$D(^LAHM(62.9,LA7SCFG,60,0)) S ^LAHM(62.9,LA7SCFG,60,0)="^62.9001P^0^0" ; set subfile zeroth node
F S LA760=$O(^LAB(60,LA760)) Q:'LA760 D
. I '$P($G(^LAB(60,LA760,64)),"^",3) Q ; Not a catalog item
. S LA7X=0
. F S LA7X=$O(^LAB(60,LA760,3,LA7X)) Q:'LA7X D
. . S LA762=+$G(^LAB(60,LA760,3,LA7X,0)) ; file #62 pointer (collection sample)
. . I LA762 D FDA629(LA7SCFG,LA760,LA762,"")
Q
;
;
FDA629(LA7SCFG,LA760,LA762,LA76205) ; Add entry to TEST/PROFILE multiple
; Call with LA7SCFG = file #62.9, shipping configuration ien
; LA760 = file #60, lab test ien
; LA762 = file #62, collection sample ien
; LA76205 = file #62.05 , urgency ien
N FDA,LA7DIE,LA7629
S LA7629(1)=LA7SCFG
S FDA(629,62.9001,"+2,"_+LA7SCFG_",",.01)=LA760
I LA76205 S FDA(629,62.9001,"+2,"_+LA7SCFG_",",.04)=LA76205
I LA762 S FDA(629,62.9001,"+2,"_+LA7SCFG_",",.09)=LA762
W:$X>(IOM-2) ! W "#"
D UPDATE^DIE("","FDA(629)","LA7629","LA7DIE(629)") ; Add test to shipping configuration.
Q
;
;
CLRSCT(LA7SCFG) ; Clear shipping configuration tests.
; Call with LA7SCFG = file #62.9, shipping configuration ien
N DA,DIK,LA7X
W !!,"Clearing existing tests from configuration: ",$P(LA7SCFG(0),"^"),!
S DA(1)=+LA7SCFG,DIK="^LAHM(62.9,"_DA(1)_",60,"
S LA7X=0
F S LA7X=$O(^LAHM(62.9,LA7SCFG,60,LA7X)) Q:'LA7X D
. W:$X>(IOM-2) ! W "*"
. S DA=LA7X D ^DIK
Q
LA7SCE ;VA/DALOI/JMC - Shipping Configuration Utility ;JUL 06, 2010 3:14 PM
+1 ;;5.2;AUTOMATED LAB INSTRUMENTS;**27,46,61,64,1027**;NOV 01, 1997
+2 QUIT
+3 ;
SCFE ; Edit file #62.9, Shipping Configuration.
+1 ;
+2 NEW DA,DIE,DIC,DIR,DLAYGO,DIRUT,DR,DTOUT,DIROUT,X,Y
+3 NEW LA7CHECK,LA7COPY,LA7NVAF,LA7SCFG,LA7SCFR,LA7TYPE,LA7VAF,LA7X,LR62,LRSS
+4 ;
+5 SET DIC="^LAHM(62.9,"
SET DIC(0)="AELMQZ"
SET DIC("A")="Select SHIPPING CONFIGURATION: "
+6 SET DIC("DR")=".02;.03"
SET DLAYGO=62.9
+7 DO ^DIC
+8 KILL DA,DIC,DIE,DR
+9 IF Y<1
QUIT
+10 ;
+11 SET LA7SCFG=+Y
SET LA7SCFG(0)=Y(0)
+12 ;
+13 LOCK +^LAHM(62.9,LA7SCFG):5
+14 IF '$TEST
Begin DoDot:1
+15 DO EN^DDIOL("Unable to obtain lock on entry "_$PIECE(LA7SCFG(0),"^"),"","!?3")
End DoDot:1
QUIT
+16 ;
+17 SET DIR(0)="SO^1:Collecting facility;2:Host facility"
SET DIR("A")="Are you editing this entry as the"
+18 SET DIR("?",1)="Is this entry used by the Collecting facility to ship specimens,"
+19 SET DIR("?",2)="or by the Host facility to accept a shipment."
+20 SET DIR("?")="This determines which fields are edited in the file."
+21 DO ^DIR
+22 IF $DATA(DIRUT)
DO UNL629
QUIT
+23 SET LA7TYPE=+Y
+24 ;
+25 ; Determine if other facility is non-VA.
+26 ; When acting as collecting facility is host non-VA
+27 ; When acting as host is collecting facility non-VA
+28 SET LA7VAF=""
SET LA7NVAF=0
+29 IF $PIECE(LA7SCFG(0),"^",2)
IF $PIECE(LA7SCFG(0),"^",3)
Begin DoDot:1
+30 SET LA7X=$SELECT(LA7TYPE=1:$PIECE(LA7SCFG(0),"^",3),1:$PIECE(LA7SCFG(0),"^",2))
+31 SET LA7VAF=$$GET1^DIQ(4,LA7X_",","AGENCY CODE","I")
+32 SET LA7NVAF=$$NVAF^LA7VHLU2(LA7X)
End DoDot:1
+33 IF LA7VAF=""
Begin DoDot:1
+34 NEW LA7MSG
+35 SET LA7MSG="Unable to proceed - institution "
+36 SET LA7MSG=LA7MSG_$$GET1^DIQ(4,$SELECT(LA7TYPE=1:$PIECE(LA7SCFG(0),"^",3),1:$PIECE(LA7SCFG(0),"^",2))_",",.01)
+37 SET LA7MSG=LA7MSG_" missing AGENCY CODE field in INSITUTION file (#4)"
+38 DO EN^DDIOL(LA7MSG,"","!!?3")
+39 DO UNL629
End DoDot:1
QUIT
+40 ;
+41 ; If acting as host ask if user wants to copy test config from another entry.
+42 IF LA7TYPE=2
Begin DoDot:1
+43 NEW DIC,Y
+44 SET LA7COPY=$$ASKCOPY
+45 IF LA7COPY<1
QUIT
+46 SET LA7CHECK=$$CHECK(LA7SCFG)
+47 IF LA7CHECK<1
SET LA7COPY=LA7CHECK
QUIT
+48 IF LA7COPY<1
QUIT
+49 IF LA7COPY=1
Begin DoDot:2
+50 SET DIC="^LAHM(62.9,"
SET DIC(0)="AEMQZ"
SET DIC("A")="Select SHIPPING CONFIGURATION to COPY FROM: "
SET DIC("S")="I Y'=LA7SCFG"
+51 DO ^DIC
KILL DIC("S")
+52 IF Y<1
QUIT
+53 SET LA7SCFR=+Y
SET LA7SCFR(0)=Y(0)
+54 DO CLRSCT(.LA7SCFG)
+55 DO COPYSC(.LA7SCFR,.LA7SCFG)
End DoDot:2
QUIT
+56 IF LA7COPY=2
Begin DoDot:2
+57 DO CLRSCT(.LA7SCFG)
+58 DO COPY60(.LA7SCFG)
End DoDot:2
QUIT
End DoDot:1
+59 IF LA7TYPE=2
IF LA7COPY<0
DO UNL629
QUIT
+60 KILL DA,DIE,DIC,DIR,DLAYGO,DIRUT,DR,DTOUT,DIROUT,X,Y
+61 ;
+62 ; Set up DR string when acting as collecting facility
+63 IF LA7TYPE=1
Begin DoDot:1
+64 SET DR=".01;.02;.06;.03;.031;"
+65 IF LA7NVAF>1
SET DR=DR_".11;.12;.14;.15;"
+66 IF LA7NVAF=1
SET DR=DR_".14////1;.15////1;"
+67 SET DR=DR_".04;.07;.08;.09;.1;.13;60"
+68 SET DR(2,62.9001)=".01;.02;.025;.03;.04;.05;.06;.07"
End DoDot:1
+69 ;
+70 ; Set up DR string when acting as host facility
+71 IF LA7TYPE=2
Begin DoDot:1
+72 SET DR=".01;.02;.06;.03;.031;"
+73 IF LA7NVAF>1
SET DR=DR_".11;.14;.15;"
+74 IF LA7NVAF=1
SET DR=DR_".14////0;.15////1;"
+75 SET DR=DR_".04;.05;60"
+76 SET DR(2,62.9001)=".01;S LRSS=$P(^LAB(60,X,0),U,4);.04;.09;S LR62=X I LRSS'=""MI"" S Y=""@2"";I LR62,$P(^LAB(62,LR62,0),U,2)'="""" S Y=""@2"";.03;5.7;@2"
End DoDot:1
+77 ;
+78 ; Determine if non-VA test codes/specimen fields should be asked
+79 IF LA7VAF'="V"
Begin DoDot:1
+80 SET DR(2,62.9001)=DR(2,62.9001)_";I $P(^LAHM(62.9,LA7SCFG,0),U,15)'=1 S Y=""@9"";5.1;5.2;5.5"
+81 IF LA7TYPE=1
IF LA7NVAF=1
SET DR(2,62.9001)=DR(2,62.9001)_"////99LST"
+82 SET DR(2,62.9001)=DR(2,62.9001)_";@9"
+83 IF LA7TYPE=1
Begin DoDot:2
+84 SET DR(2,62.9001)=DR(2,62.9001)_";I $P(^LAHM(62.9,LA7SCFG,0),U,16)'=1 S Y=""@10"";5.3;5.4;5.6"
+85 IF LA7NVAF=1
SET DR(2,62.9001)=DR(2,62.9001)_"////99LRP;5.7;5.8;5.9////99LRS"
+86 SET DR(2,62.9001)=DR(2,62.9001)_";@10"
End DoDot:2
+87 IF LA7TYPE=2
Begin DoDot:2
+88 SET DR(2,62.9001)=DR(2,62.9001)_";I $P(^LAHM(62.9,LA7SCFG,0),U,16)'=1 S Y=""@10"";5.3;5.4;5.6"
+89 IF LA7NVAF=1
SET DR(2,62.9001)=DR(2,62.9001)_"////99LRP"
+90 SET DR(2,62.9001)=DR(2,62.9001)_";@10"
End DoDot:2
End DoDot:1
+91 ;
+92 IF LA7TYPE=1
Begin DoDot:1
+93 NEW J,K
+94 SET DR(2,62.9001)=DR(2,62.9001)_";"
+95 SET X="1.1;I 'X S Y=1.2;1.15;1.16;1.2;I 'X S Y=2.1;1.25;1.26;2.1;I '+X S Y=2.3;2.15;2.16;2.3;I '+X S Y=2.2;2.35;2.36;2.2;I '+X S Y=""@12"";2.25;2.26;@12"
+96 IF ($LENGTH(DR(2,62.9001))+$LENGTH(X))<246
SET DR(2,62.9001)=DR(2,62.9001)_X
QUIT
+97 SET K=$LENGTH(X,";")
+98 FOR J=1:1:K
Begin DoDot:2
+99 IF ($LENGTH(DR(2,62.9001))+$LENGTH($PIECE(X,";")))>244
SET J=K
QUIT
+100 SET DR(2,62.9001)=DR(2,62.9001)_$PIECE(X,";")_";"
SET X=$PIECE(X,";",2,K)
End DoDot:2
+101 IF X'=""
SET DR(2,62.9001,1)=X
End DoDot:1
+102 ;
+103 SET DA=LA7SCFG
SET DIE="^LAHM(62.9,"
+104 DO ^DIE
DO UNL629
+105 QUIT
+106 ;
+107 ;
+108 ; Unlock entry in 62.9
UNL629 LOCK -^LAHM(62.9,LA7SCFG)
+1 ;
+2 QUIT
+3 ;
+4 ;
SCTE ; Edit file #62.91, Shipping Container.
+1 NEW DA,DIE,DIC,DLAYGO,DR,X,Y
+2 SET DIC="^LAHM(62.91,"
SET DIC(0)="AELMQZ"
SET DIC("A")="Select SHIPPING CONTAINER: "
SET DLAYGO=62.91
+3 DO ^DIC
+4 IF Y<1
QUIT
+5 SET DA=+Y
SET DIE=DIC
SET DR=".01;.02"
+6 DO ^DIE
+7 QUIT
+8 ;
+9 ;
SCME ; Edit file #62.92, Shipping Method.
+1 NEW DA,DIE,DIC,DLAYGO,DR,X,Y
+2 SET DIC="^LAHM(62.92,"
SET DIC(0)="AELMQZ"
SET DIC("A")="Select SHIPPING METHOD: "
SET DLAYGO=62.92
+3 DO ^DIC
+4 IF Y<1
QUIT
+5 SET DA=+Y
SET DIE=DIC
SET DR=".01;.02"
+6 DO ^DIE
+7 QUIT
+8 ;
+9 ;
SCDE ; Edit file #62.93, Shipping Condition.
+1 NEW DA,DIE,DIC,DLAYGO,DR,X,Y
+2 SET DIC="^LAHM(62.93,"
SET DIC(0)="AELMQZ"
SET DIC("A")="Select SHIPPING CONDITION: "
SET DLAYGO=62.93
+3 DO ^DIC
+4 IF Y<1
QUIT
+5 SET DA=+Y
SET DIE=DIC
SET DR=".01;.02"
+6 DO ^DIE
+7 QUIT
+8 ;
+9 ;
ASKCOPY() ; Ask if user want to copy tests from file #60 or another configuration in file #62.9 LAB SHIPPING CONFIGURATION
+1 ; Returns LA7COPY = -1 user quit/aborted
+2 ; = 0 do not copy
+3 ; = 1 use file #60
+4 ; = 2 use another entry in #62.49
+5 NEW DIR,DIRUT,DTOUT,DUOUT,X,Y
+6 SET DIR(0)="SMO^0:Do NOT copy;1:Another Shipping Configuration;2:Test Catalog - LABORATORY TEST File #60"
+7 SET DIR("A")="Copy a test profile from"
SET DIR("B")="Do NOT copy"
+8 SET DIR("?",1)="If you want to duplicate a shipping configuration using another configuration"
+9 SET DIR("?",2)="or build from the tests marked as catalog tests in the LABORATORY TEST file."
+10 SET DIR("?")="Select the appropiate option."
+11 DO ^DIR
+12 IF $DATA(DIRUT)
SET Y=-1
+13 QUIT Y
+14 ;
+15 ;
CHECK(LA7SCFG) ; Check if test exists for configuration and warn if overwriting
+1 ; Call with LA7SCFG = shiping configuration ien
+2 ; Returns -1 = user aborted/timeout
+3 ; 0 = no - don't overwrite
+4 ; 1 = yes - overwrite
+5 IF '$ORDER(^LAHM(62.9,LA7SCFG,60,0))
QUIT 1
+6 NEW DIR,DIRUT,DTOUT,DUOUT,X,Y
+7 SET DIR(0)="SBO^0:NO;1:YES"
+8 SET DIR("A",1)="Tests already exist for this configuration!"
SET DIR("A")="Are you sure"
SET DIR("B")="NO"
+9 DO ^DIR
+10 IF $DATA(DIRUT)
SET Y=-1
+11 QUIT Y
+12 ;
+13 ;
COPYSC(LA7FR,LA7TO) ; Copy one shipping configuration to another
+1 ; Call with LA7FR = shipping configuration to copy FROM.
+2 ; LA7TO = shipping configuration ien to copy TO.
+3 NEW LA760,LA762,LA6205,LA7X
+4 WRITE !!,"Copying tests from configuration: ",$PIECE(LA7FR(0),"^")," to ",$PIECE(LA7TO(0),"^"),!
+5 SET LA7X=0
+6 FOR
SET LA7X=$ORDER(^LAHM(62.9,LA7FR,60,LA7X))
IF 'LA7X
QUIT
Begin DoDot:1
+7 ; file #60 laboratory test ien.
SET LA760=$PIECE($GET(^LAHM(62.9,LA7FR,60,LA7X,0)),"^")
+8 ; file #62.05, urgency ien.
SET LA76205=$PIECE($GET(^LAHM(62.9,LA7FR,60,LA7X,0)),"^",4)
+9 ; file #62, collection sample ien.
SET LA762=$PIECE($GET(^LAHM(62.9,LA7FR,60,LA7X,0)),"^",9)
+10 IF LA760
DO FDA629(LA7TO,LA760,LA762,LA76205)
End DoDot:1
+11 QUIT
+12 ;
+13 ;
COPY60(LA7SCFG) ; Copy catalog tests from file #60 to shipping configuration.
+1 ; Call with LA7SCFG = shipping configuration ien to add tests to from file #60
+2 NEW LA760,LA762,LA7X
+3 WRITE !!,"Copying tests from file #60 LABORATORY TEST to ",$PIECE(LA7SCFG(0),"^"),!
+4 ; file #60 pointer
SET LA760=0
+5 ; set subfile zeroth node
IF '$DATA(^LAHM(62.9,LA7SCFG,60,0))
SET ^LAHM(62.9,LA7SCFG,60,0)="^62.9001P^0^0"
+6 FOR
SET LA760=$ORDER(^LAB(60,LA760))
IF 'LA760
QUIT
Begin DoDot:1
+7 ; Not a catalog item
IF '$PIECE($GET(^LAB(60,LA760,64)),"^",3)
QUIT
+8 SET LA7X=0
+9 FOR
SET LA7X=$ORDER(^LAB(60,LA760,3,LA7X))
IF 'LA7X
QUIT
Begin DoDot:2
+10 ; file #62 pointer (collection sample)
SET LA762=+$GET(^LAB(60,LA760,3,LA7X,0))
+11 IF LA762
DO FDA629(LA7SCFG,LA760,LA762,"")
End DoDot:2
End DoDot:1
+12 QUIT
+13 ;
+14 ;
FDA629(LA7SCFG,LA760,LA762,LA76205) ; Add entry to TEST/PROFILE multiple
+1 ; Call with LA7SCFG = file #62.9, shipping configuration ien
+2 ; LA760 = file #60, lab test ien
+3 ; LA762 = file #62, collection sample ien
+4 ; LA76205 = file #62.05 , urgency ien
+5 NEW FDA,LA7DIE,LA7629
+6 SET LA7629(1)=LA7SCFG
+7 SET FDA(629,62.9001,"+2,"_+LA7SCFG_",",.01)=LA760
+8 IF LA76205
SET FDA(629,62.9001,"+2,"_+LA7SCFG_",",.04)=LA76205
+9 IF LA762
SET FDA(629,62.9001,"+2,"_+LA7SCFG_",",.09)=LA762
+10 IF $X>(IOM-2)
WRITE !
WRITE "#"
+11 ; Add test to shipping configuration.
DO UPDATE^DIE("","FDA(629)","LA7629","LA7DIE(629)")
+12 QUIT
+13 ;
+14 ;
CLRSCT(LA7SCFG) ; Clear shipping configuration tests.
+1 ; Call with LA7SCFG = file #62.9, shipping configuration ien
+2 NEW DA,DIK,LA7X
+3 WRITE !!,"Clearing existing tests from configuration: ",$PIECE(LA7SCFG(0),"^"),!
+4 SET DA(1)=+LA7SCFG
SET DIK="^LAHM(62.9,"_DA(1)_",60,"
+5 SET LA7X=0
+6 FOR
SET LA7X=$ORDER(^LAHM(62.9,LA7SCFG,60,LA7X))
IF 'LA7X
QUIT
Begin DoDot:1
+7 IF $X>(IOM-2)
WRITE !
WRITE "*"
+8 SET DA=LA7X
DO ^DIK
End DoDot:1
+9 QUIT