LA7SM ;DALOI/JMC - Shipping Manifest Options ;5/5/97 14:39
;;5.2;AUTOMATED LAB INSTRUMENTS;**27,46**;Sep 27, 1994
;
CLSHIP ; Close/ship a shipping manifest
D INIT
I LA7QUIT D CLEANUP Q
S LA7SM=$$SELSM^LA7SMU(+LA7SCFG,"1,3")
I LA7SM<0 D Q
. D EN^DDIOL($P(LA7SM,"^",2),"","!?5")
. D CLEANUP
D LOCKSM
I LA7QUIT D Q
. D EN^DDIOL($P(LA7QUIT,"^",2),"","!?5")
. D UNLOCKSM,CLEANUP
S LA7SM(0)=$G(^LAHM(62.8,+LA7SM,0))
N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
I $P(LA7SM(0),"^",3)=1 D
. S DIR(0)="SO^1:Close manifest;2:Ship manifest"
. S DIR("A")="Select action to perform",DIR("B")=1
I $P(LA7SM(0),"^",3)=3 D
. S DIR(0)="YO"
. S DIR("A")="Do you want to ship this manifest",DIR("B")="NO"
D ^DIR
I $D(DIRUT) D UNLOCKSM,CLEANUP Q
S LA7ST=+Y
I $P(LA7SM(0),"^",3)=3,LA7ST S LA7ST=2
I $P(LA7SM(0),"^",3)=1 D SMSUP^LA7SMU(LA7SM,3,"SM04") ; Close manifest
I LA7ST=2 D SHIP^LA7SM1 ; Ask for shipping date/time
I 'LA7QUIT!$D(LA7ERR) S LA7CHK=0 D ASK^LA7SMP(LA7SM) ; Ask if want to print manifest.
D UNLOCKSM,CLEANUP
Q
;
SMET ; Edit a test on a shipping manifest
; Used to add/remove a test.
D INIT
I LA7QUIT D CLEANUP Q
S LA7SM=$$SELSM^LA7SMU(+LA7SCFG,"0,1,3")
I LA7SM<0 D Q
. D EN^DDIOL($P(LA7SM,"^",2),"","!?5")
. D CLEANUP
D LOCKSM
I LA7QUIT D Q
. D EN^DDIOL($P(LA7QUIT,"^",2),"","!?5")
. D UNLOCKSM,CLEANUP
S LA7SM(0)=$G(^LAHM(62.8,LA7SM,0))
S DIR(0)="SO^1:Add test to manifest;2:Remove test from manifest"
S DIR("A")="Select action to perform",DIR("B")=1
D ^DIR
I $D(DIRUT) D CLEANUP Q
S LA7ACTON=+Y
I LA7ACTON=1 F D ADDTEST Q:LA7QUIT
I LA7ACTON=2 F D REMVTST Q:LA7QUIT
I LA7QUIT,$L($P(LA7QUIT,"^",2)) D EN^DDIOL($P(LA7QUIT,"^",2),"","!?5")
E D ASK^LA7SMP(LA7SM)
D CLEANUP
Q
;
;
ADDTEST ; Add individual test to an existing manifest
;
N LA760,LA7AA,LA7AD,LA7AN,LA7BY,LA7DIV,LA7I,LA7UID,LA7X
;
D SEL
I LA7QUIT Q
;
S DIC="^LRO(68,LA7AA,1,LA7AD,1,LA7AN,4,",DIC(0)="AEMQ",DIC("A")="Select TEST to Add: "
S DA=LA7AN,DA(1)=LA7AD,DA(2)=LA7AA
D ^DIC
I Y<1 D Q
. S LA7QUIT=1
. I $D(DUOUT) S $P(LA7QUIT,"^",2)="User aborted"
. I $D(DTOUT) S $P(LA7QUIT,"^",2)="User timeout"
S LA760=+Y
;
; Test's zeroth node.
S LA760(0)=$G(^LRO(68,LA7AA,1,LA7AD,1,LA7AN,4,LA760,0))
;
; Test completed - skip
I $P(LA760(0),"^",5) S LA7QUIT="1^Test already completed" Q
;
; Test urgency
S LA76205=+$P(LA760(0),"^",2)
I LA76205>49 S LA76205=$S(LA76205=50:9,1:LA76205-50)
;
; Don't build controls
I $P($G(^LRO(68,LA7AA,1,LA7AD,1,LA7AN,0)),"^",2)=62.3 S LA7QUIT="1^Cannot select controls" Q
;
S LA7I=0
F S LA7I=$O(^LAHM(62.8,+LA7SM,10,"UID",LA7UID,LA7I)) Q:'LA7I D Q:LA7QUIT
. N X
. S X(0)=$G(^LAHM(62.8,+LA7SM,10,LA7I,0))
. I $P(X(0),"^",2)=LA760,$P(X(0),"^",8)'=0 S LA7QUIT="1^Test already on shipping manifest"
I LA7QUIT Q
;
; Build TMP global with test profile
D SCBLD^LA7SM1(+LA7SCFG)
;
; Accession's division
S LA7DIV=+$P($G(^LRO(68,LA7AA,1,LA7AD,1,LA7AN,.4)),"^")
;
; Check if test eligible for manifest
D SCHK^LA7SM1
I 'LA7FLAG S LA7QUIT="1^Test not selectable for this configuration" Q
D LOCK68^LA7SMB
S LA7I=0
F S LA7I=$O(LA7X(LA7I)) Q:'LA7I D ADD^LA7SMB
D UNLOCK68^LA7SMB
Q
;
;
REMVTST ; Remove a test from manifest - actually flags test as "removed".
N DIR,DIROUT,DIRUT,DTOUT,DUOUT,LA7I,LA7TCNT,LA7Y,LA760,X,Y
D SEL
I LA7QUIT Q
S (LA7I,LA7TCNT)=0
F S LA7I=$O(^LAHM(62.8,+LA7SM,10,"UID",LA7UID,LA7I)) Q:'LA7I D
. S LA7I(0)=$G(^LAHM(62.8,+LA7SM,10,LA7I,0))
. I $P(LA7I(0),"^",8)=0 Q ; Previously "removed".
. I $P(LA7I(0),"^",8),$P(LA7I(0),"^",8)'=1 S LA7QUIT="1^Accession not pending shipment" Q
. S LA7TCNT=LA7TCNT+1,LA760(LA7TCNT)=LA7I_"^"_LA7I(0)
I 'LA7TCNT,'LA7QUIT S LA7QUIT="1^Accession is not on this shipping manifest"
I LA7QUIT Q
S LA7I=0
F S LA7I=$O(LA760(LA7I)) Q:'LA7I D EN^DDIOL(LA7I_" "_$P($G(^LAB(60,+$P(LA760(LA7I),"^",3),0)),"^"),"","!?5")
S DIR(0)="LO^1:"_LA7TCNT,DIR("A")="Select test(s) to remove"
D ^DIR
I $D(DIRUT) S LA7QUIT=1 Q
M LA7YARRY=Y
S LA7Y=""
F S LA7Y=$O(LA7YARRY(LA7Y)) Q:LA7Y="" D
. F LA7I=1:1 Q:'$P(LA7YARRY(LA7Y),",",LA7I) D
. . S LA7X=$P(LA7YARRY(LA7Y),",",LA7I)
. . N FDA,LA7628,LA768,LA7DATA
. . S LA762801=+(LA760(LA7X))_","_+LA7SM_","
. . S FDA(62.8,62.801,LA762801,.08)=0
. . D FILE^DIE("","FDA(62.8)","LA7DIE(2)") ; "Remove" test from shipping manifest
. . ; Update event file
. . S LA7DATA="SM51^"_$$NOW^XLFDT_"^"_$P(LA760(LA7X),"^",3)_"^"_$P(LA7SM,"^",2)
. . D SEUP^LA7SMU(LA7UID,2,LA7DATA)
. . ; Update accession
. . D ACCSUP^LA7SMU(LA7UID,$P(LA760(LA7X),"^",3),"@")
Q
;
;
CANC ; Cancel a shipping manifest
D INIT
I LA7QUIT D CLEANUP Q
S LA7SM=$$SELSM^LA7SMU(+LA7SCFG,"1,3")
I LA7SM<0 D Q
. D EN^DDIOL($P(LA7SM,"^",2),"","!?5")
. D CLEANUP
D LOCKSM
I LA7QUIT D Q
. D EN^DDIOL($P(LA7QUIT,"^",2),"","!?5")
. D UNLOCKSM,CLEANUP
S LA7SM(0)=$G(^LAHM(62.8,LA7SM,0))
N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
S DIR(0)="YO"
S DIR("A")="Do you want to cancel this manifest",DIR("B")="NO"
D ^DIR
I $D(DIRUT) D UNLOCKSM,CLEANUP Q
S LA7ST=+Y
I LA7ST=1 D
. S LA7I=0
. F S LA7I=$O(^LAHM(62.8,+LA7SM,10,LA7I)) Q:'LA7I D
. . S LA7I(0)=$G(^LAHM(62.8,+LA7SM,10,LA7I,0))
. . I $P(LA7I(0),"^",8)=0 Q ; Previously "removed".
. . ; "Remove" test from shipping manifest
. . S LA762801=LA7I_","_+LA7SM_","
. . S FDA(62.8,62.801,LA762801,.08)=0
. . D FILE^DIE("","FDA(62.8)","LA7DIE(2)")
. . ; Update event file
. . S LA7DATA="SM51^"_$$NOW^XLFDT_"^"_$P(LA7I(0),"^",2)_"^"_$P(LA7SM,"^",2)
. . D SEUP^LA7SMU($P(LA7I(0),"^",5),2,LA7DATA)
. . ; Update accession
. . D ACCSUP^LA7SMU($P(LA7I(0),"^",5),$P(LA7I(0),"^",2),"@")
. D SMSUP^LA7SMU(LA7SM,0,"SM00") ; Cancel manifest
D UNLOCKSM,CLEANUP
Q
;
;
SEL ; Select accession
;
N LRAA,LRACC,LRAD,LRAN,X
;
; Select by accession, ^LRWU4 needs variable LRACC.
S LRACC=""
D ^LRWU4
I $D(DUOUT) S LA7QUIT="1^User aborted" Q
I $D(DTOUT) S LA7QUIT="1^User timeout" Q
I (LRAA*LRAD*LRAN)<1 S LA7QUIT="1" Q
;
S LA7AA=LRAA,LA7AD=LRAD,LA7AN=LRAN
;
S LA7UID=$P($G(^LRO(68,LA7AA,1,LA7AD,1,LA7AN,.3)),"^")
I LA7UID="" S LA7QUIT="2^Database error - accession missing UID" Q
;
; Specimen type
S LA76805=0
S X=+$O(^LRO(68,LA7AA,1,LA7AD,1,LA7AN,5,0))
I X S LA76805=+$G(^LRO(68,LA7AA,1,LA7AD,1,LA7AN,5,X,0))
Q
;
;
INIT ; Initialize variables
S DT=$$DT^XLFDT
S LA7QUIT=0
S LA7SCFG=$$SSCFG^LA7SUTL(1) ; Select shipping configuration
I LA7SCFG<1 S LA7QUIT=1 Q
S LA7SCFG(0)=$G(^LAHM(62.9,+LA7SCFG,0))
K ^TMP("LA7ERR",$J)
Q
;
;
LOCKSM ; Lock entry in file 62.8
L +^LAHM(62.8,+LA7SM):1 ; Set lock.
I '$T S LA7QUIT="1^Someone else is editing this shipping manifest"
Q
;
;
UNLOCKSM ; Unlock entry in file 62.8
L -^LAHM(62.8,+LA7SM) ; Release lock.
Q
;
;
CLEANUP ; Cleanup variables
I $D(ZTQUEUED) S ZTREQ="@"
K DA,DIC,DIR,DIRUT,DTOUT,DUOUT,X,Y
K LA7AA,LA7ACTON,LA7AD,LA7AN,LA7EV,LA7FLAG,LA7I,LA7QUIT,LA7SCFG,LA7SDT,LA7SM,LA7ST,LA7UID,LA7X,LA7YARRY
K LA760,LA76205,LA762801,LA76805
K ^TMP("LA7ERR",$J)
Q
LA7SM ;DALOI/JMC - Shipping Manifest Options ;5/5/97 14:39
+1 ;;5.2;AUTOMATED LAB INSTRUMENTS;**27,46**;Sep 27, 1994
+2 ;
CLSHIP ; Close/ship a shipping manifest
+1 DO INIT
+2 IF LA7QUIT
DO CLEANUP
QUIT
+3 SET LA7SM=$$SELSM^LA7SMU(+LA7SCFG,"1,3")
+4 IF LA7SM<0
Begin DoDot:1
+5 DO EN^DDIOL($PIECE(LA7SM,"^",2),"","!?5")
+6 DO CLEANUP
End DoDot:1
QUIT
+7 DO LOCKSM
+8 IF LA7QUIT
Begin DoDot:1
+9 DO EN^DDIOL($PIECE(LA7QUIT,"^",2),"","!?5")
+10 DO UNLOCKSM
DO CLEANUP
End DoDot:1
QUIT
+11 SET LA7SM(0)=$GET(^LAHM(62.8,+LA7SM,0))
+12 NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
+13 IF $PIECE(LA7SM(0),"^",3)=1
Begin DoDot:1
+14 SET DIR(0)="SO^1:Close manifest;2:Ship manifest"
+15 SET DIR("A")="Select action to perform"
SET DIR("B")=1
End DoDot:1
+16 IF $PIECE(LA7SM(0),"^",3)=3
Begin DoDot:1
+17 SET DIR(0)="YO"
+18 SET DIR("A")="Do you want to ship this manifest"
SET DIR("B")="NO"
End DoDot:1
+19 DO ^DIR
+20 IF $DATA(DIRUT)
DO UNLOCKSM
DO CLEANUP
QUIT
+21 SET LA7ST=+Y
+22 IF $PIECE(LA7SM(0),"^",3)=3
IF LA7ST
SET LA7ST=2
+23 ; Close manifest
IF $PIECE(LA7SM(0),"^",3)=1
DO SMSUP^LA7SMU(LA7SM,3,"SM04")
+24 ; Ask for shipping date/time
IF LA7ST=2
DO SHIP^LA7SM1
+25 ; Ask if want to print manifest.
IF 'LA7QUIT!$DATA(LA7ERR)
SET LA7CHK=0
DO ASK^LA7SMP(LA7SM)
+26 DO UNLOCKSM
DO CLEANUP
+27 QUIT
+28 ;
SMET ; Edit a test on a shipping manifest
+1 ; Used to add/remove a test.
+2 DO INIT
+3 IF LA7QUIT
DO CLEANUP
QUIT
+4 SET LA7SM=$$SELSM^LA7SMU(+LA7SCFG,"0,1,3")
+5 IF LA7SM<0
Begin DoDot:1
+6 DO EN^DDIOL($PIECE(LA7SM,"^",2),"","!?5")
+7 DO CLEANUP
End DoDot:1
QUIT
+8 DO LOCKSM
+9 IF LA7QUIT
Begin DoDot:1
+10 DO EN^DDIOL($PIECE(LA7QUIT,"^",2),"","!?5")
+11 DO UNLOCKSM
DO CLEANUP
End DoDot:1
QUIT
+12 SET LA7SM(0)=$GET(^LAHM(62.8,LA7SM,0))
+13 SET DIR(0)="SO^1:Add test to manifest;2:Remove test from manifest"
+14 SET DIR("A")="Select action to perform"
SET DIR("B")=1
+15 DO ^DIR
+16 IF $DATA(DIRUT)
DO CLEANUP
QUIT
+17 SET LA7ACTON=+Y
+18 IF LA7ACTON=1
FOR
DO ADDTEST
IF LA7QUIT
QUIT
+19 IF LA7ACTON=2
FOR
DO REMVTST
IF LA7QUIT
QUIT
+20 IF LA7QUIT
IF $LENGTH($PIECE(LA7QUIT,"^",2))
DO EN^DDIOL($PIECE(LA7QUIT,"^",2),"","!?5")
+21 IF '$TEST
DO ASK^LA7SMP(LA7SM)
+22 DO CLEANUP
+23 QUIT
+24 ;
+25 ;
ADDTEST ; Add individual test to an existing manifest
+1 ;
+2 NEW LA760,LA7AA,LA7AD,LA7AN,LA7BY,LA7DIV,LA7I,LA7UID,LA7X
+3 ;
+4 DO SEL
+5 IF LA7QUIT
QUIT
+6 ;
+7 SET DIC="^LRO(68,LA7AA,1,LA7AD,1,LA7AN,4,"
SET DIC(0)="AEMQ"
SET DIC("A")="Select TEST to Add: "
+8 SET DA=LA7AN
SET DA(1)=LA7AD
SET DA(2)=LA7AA
+9 DO ^DIC
+10 IF Y<1
Begin DoDot:1
+11 SET LA7QUIT=1
+12 IF $DATA(DUOUT)
SET $PIECE(LA7QUIT,"^",2)="User aborted"
+13 IF $DATA(DTOUT)
SET $PIECE(LA7QUIT,"^",2)="User timeout"
End DoDot:1
QUIT
+14 SET LA760=+Y
+15 ;
+16 ; Test's zeroth node.
+17 SET LA760(0)=$GET(^LRO(68,LA7AA,1,LA7AD,1,LA7AN,4,LA760,0))
+18 ;
+19 ; Test completed - skip
+20 IF $PIECE(LA760(0),"^",5)
SET LA7QUIT="1^Test already completed"
QUIT
+21 ;
+22 ; Test urgency
+23 SET LA76205=+$PIECE(LA760(0),"^",2)
+24 IF LA76205>49
SET LA76205=$SELECT(LA76205=50:9,1:LA76205-50)
+25 ;
+26 ; Don't build controls
+27 IF $PIECE($GET(^LRO(68,LA7AA,1,LA7AD,1,LA7AN,0)),"^",2)=62.3
SET LA7QUIT="1^Cannot select controls"
QUIT
+28 ;
+29 SET LA7I=0
+30 FOR
SET LA7I=$ORDER(^LAHM(62.8,+LA7SM,10,"UID",LA7UID,LA7I))
IF 'LA7I
QUIT
Begin DoDot:1
+31 NEW X
+32 SET X(0)=$GET(^LAHM(62.8,+LA7SM,10,LA7I,0))
+33 IF $PIECE(X(0),"^",2)=LA760
IF $PIECE(X(0),"^",8)'=0
SET LA7QUIT="1^Test already on shipping manifest"
End DoDot:1
IF LA7QUIT
QUIT
+34 IF LA7QUIT
QUIT
+35 ;
+36 ; Build TMP global with test profile
+37 DO SCBLD^LA7SM1(+LA7SCFG)
+38 ;
+39 ; Accession's division
+40 SET LA7DIV=+$PIECE($GET(^LRO(68,LA7AA,1,LA7AD,1,LA7AN,.4)),"^")
+41 ;
+42 ; Check if test eligible for manifest
+43 DO SCHK^LA7SM1
+44 IF 'LA7FLAG
SET LA7QUIT="1^Test not selectable for this configuration"
QUIT
+45 DO LOCK68^LA7SMB
+46 SET LA7I=0
+47 FOR
SET LA7I=$ORDER(LA7X(LA7I))
IF 'LA7I
QUIT
DO ADD^LA7SMB
+48 DO UNLOCK68^LA7SMB
+49 QUIT
+50 ;
+51 ;
REMVTST ; Remove a test from manifest - actually flags test as "removed".
+1 NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT,LA7I,LA7TCNT,LA7Y,LA760,X,Y
+2 DO SEL
+3 IF LA7QUIT
QUIT
+4 SET (LA7I,LA7TCNT)=0
+5 FOR
SET LA7I=$ORDER(^LAHM(62.8,+LA7SM,10,"UID",LA7UID,LA7I))
IF 'LA7I
QUIT
Begin DoDot:1
+6 SET LA7I(0)=$GET(^LAHM(62.8,+LA7SM,10,LA7I,0))
+7 ; Previously "removed".
IF $PIECE(LA7I(0),"^",8)=0
QUIT
+8 IF $PIECE(LA7I(0),"^",8)
IF $PIECE(LA7I(0),"^",8)'=1
SET LA7QUIT="1^Accession not pending shipment"
QUIT
+9 SET LA7TCNT=LA7TCNT+1
SET LA760(LA7TCNT)=LA7I_"^"_LA7I(0)
End DoDot:1
+10 IF 'LA7TCNT
IF 'LA7QUIT
SET LA7QUIT="1^Accession is not on this shipping manifest"
+11 IF LA7QUIT
QUIT
+12 SET LA7I=0
+13 FOR
SET LA7I=$ORDER(LA760(LA7I))
IF 'LA7I
QUIT
DO EN^DDIOL(LA7I_" "_$PIECE($GET(^LAB(60,+$PIECE(LA760(LA7I),"^",3),0)),"^"),"","!?5")
+14 SET DIR(0)="LO^1:"_LA7TCNT
SET DIR("A")="Select test(s) to remove"
+15 DO ^DIR
+16 IF $DATA(DIRUT)
SET LA7QUIT=1
QUIT
+17 MERGE LA7YARRY=Y
+18 SET LA7Y=""
+19 FOR
SET LA7Y=$ORDER(LA7YARRY(LA7Y))
IF LA7Y=""
QUIT
Begin DoDot:1
+20 FOR LA7I=1:1
IF '$PIECE(LA7YARRY(LA7Y),",",LA7I)
QUIT
Begin DoDot:2
+21 SET LA7X=$PIECE(LA7YARRY(LA7Y),",",LA7I)
+22 NEW FDA,LA7628,LA768,LA7DATA
+23 SET LA762801=+(LA760(LA7X))_","_+LA7SM_","
+24 SET FDA(62.8,62.801,LA762801,.08)=0
+25 ; "Remove" test from shipping manifest
DO FILE^DIE("","FDA(62.8)","LA7DIE(2)")
+26 ; Update event file
+27 SET LA7DATA="SM51^"_$$NOW^XLFDT_"^"_$P(LA760(LA7X),"^",3)_"^"_$PIECE(LA7SM,"^",2)
+28 DO SEUP^LA7SMU(LA7UID,2,LA7DATA)
+29 ; Update accession
+30 DO ACCSUP^LA7SMU(LA7UID,$PIECE(LA760(LA7X),"^",3),"@")
End DoDot:2
End DoDot:1
+31 QUIT
+32 ;
+33 ;
CANC ; Cancel a shipping manifest
+1 DO INIT
+2 IF LA7QUIT
DO CLEANUP
QUIT
+3 SET LA7SM=$$SELSM^LA7SMU(+LA7SCFG,"1,3")
+4 IF LA7SM<0
Begin DoDot:1
+5 DO EN^DDIOL($PIECE(LA7SM,"^",2),"","!?5")
+6 DO CLEANUP
End DoDot:1
QUIT
+7 DO LOCKSM
+8 IF LA7QUIT
Begin DoDot:1
+9 DO EN^DDIOL($PIECE(LA7QUIT,"^",2),"","!?5")
+10 DO UNLOCKSM
DO CLEANUP
End DoDot:1
QUIT
+11 SET LA7SM(0)=$GET(^LAHM(62.8,LA7SM,0))
+12 NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
+13 SET DIR(0)="YO"
+14 SET DIR("A")="Do you want to cancel this manifest"
SET DIR("B")="NO"
+15 DO ^DIR
+16 IF $DATA(DIRUT)
DO UNLOCKSM
DO CLEANUP
QUIT
+17 SET LA7ST=+Y
+18 IF LA7ST=1
Begin DoDot:1
+19 SET LA7I=0
+20 FOR
SET LA7I=$ORDER(^LAHM(62.8,+LA7SM,10,LA7I))
IF 'LA7I
QUIT
Begin DoDot:2
+21 SET LA7I(0)=$GET(^LAHM(62.8,+LA7SM,10,LA7I,0))
+22 ; Previously "removed".
IF $PIECE(LA7I(0),"^",8)=0
QUIT
+23 ; "Remove" test from shipping manifest
+24 SET LA762801=LA7I_","_+LA7SM_","
+25 SET FDA(62.8,62.801,LA762801,.08)=0
+26 DO FILE^DIE("","FDA(62.8)","LA7DIE(2)")
+27 ; Update event file
+28 SET LA7DATA="SM51^"_$$NOW^XLFDT_"^"_$P(LA7I(0),"^",2)_"^"_$PIECE(LA7SM,"^",2)
+29 DO SEUP^LA7SMU($PIECE(LA7I(0),"^",5),2,LA7DATA)
+30 ; Update accession
+31 DO ACCSUP^LA7SMU($PIECE(LA7I(0),"^",5),$PIECE(LA7I(0),"^",2),"@")
End DoDot:2
+32 ; Cancel manifest
DO SMSUP^LA7SMU(LA7SM,0,"SM00")
End DoDot:1
+33 DO UNLOCKSM
DO CLEANUP
+34 QUIT
+35 ;
+36 ;
SEL ; Select accession
+1 ;
+2 NEW LRAA,LRACC,LRAD,LRAN,X
+3 ;
+4 ; Select by accession, ^LRWU4 needs variable LRACC.
+5 SET LRACC=""
+6 DO ^LRWU4
+7 IF $DATA(DUOUT)
SET LA7QUIT="1^User aborted"
QUIT
+8 IF $DATA(DTOUT)
SET LA7QUIT="1^User timeout"
QUIT
+9 IF (LRAA*LRAD*LRAN)<1
SET LA7QUIT="1"
QUIT
+10 ;
+11 SET LA7AA=LRAA
SET LA7AD=LRAD
SET LA7AN=LRAN
+12 ;
+13 SET LA7UID=$PIECE($GET(^LRO(68,LA7AA,1,LA7AD,1,LA7AN,.3)),"^")
+14 IF LA7UID=""
SET LA7QUIT="2^Database error - accession missing UID"
QUIT
+15 ;
+16 ; Specimen type
+17 SET LA76805=0
+18 SET X=+$ORDER(^LRO(68,LA7AA,1,LA7AD,1,LA7AN,5,0))
+19 IF X
SET LA76805=+$GET(^LRO(68,LA7AA,1,LA7AD,1,LA7AN,5,X,0))
+20 QUIT
+21 ;
+22 ;
INIT ; Initialize variables
+1 SET DT=$$DT^XLFDT
+2 SET LA7QUIT=0
+3 ; Select shipping configuration
SET LA7SCFG=$$SSCFG^LA7SUTL(1)
+4 IF LA7SCFG<1
SET LA7QUIT=1
QUIT
+5 SET LA7SCFG(0)=$GET(^LAHM(62.9,+LA7SCFG,0))
+6 KILL ^TMP("LA7ERR",$JOB)
+7 QUIT
+8 ;
+9 ;
LOCKSM ; Lock entry in file 62.8
+1 ; Set lock.
LOCK +^LAHM(62.8,+LA7SM):1
+2 IF '$TEST
SET LA7QUIT="1^Someone else is editing this shipping manifest"
+3 QUIT
+4 ;
+5 ;
UNLOCKSM ; Unlock entry in file 62.8
+1 ; Release lock.
LOCK -^LAHM(62.8,+LA7SM)
+2 QUIT
+3 ;
+4 ;
CLEANUP ; Cleanup variables
+1 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+2 KILL DA,DIC,DIR,DIRUT,DTOUT,DUOUT,X,Y
+3 KILL LA7AA,LA7ACTON,LA7AD,LA7AN,LA7EV,LA7FLAG,LA7I,LA7QUIT,LA7SCFG,LA7SDT,LA7SM,LA7ST,LA7UID,LA7X,LA7YARRY
+4 KILL LA760,LA76205,LA762801,LA76805
+5 KILL ^TMP("LA7ERR",$JOB)
+6 QUIT