TIUEDS2 ; ;02/28/13
S X=DG(DQ),DIC=DIE
I $P($$DOCTYPE^TIULF(+DA),U)="DOC",$L($P(^TIU(8925,+DA,0),U)),(+$P(^(0),U,2)>0) S ^TIU(8925,"AA",$P(^(0),U,2),+$P(^(0),U),(9999999-$P(+$G(^AUPNVSIT(X,0)),".")),DA)=""
S X=DG(DQ),DIC=DIE
I $P($$DOCTYPE^TIULF(+DA),U)="DOC",$L($P(^TIU(8925,+DA,0),U)),(+$P(^(0),U,2)>0) S ^TIU(8925,"AE",+$P(^TIU(8925,+DA,0),U,2),(9999999-$P(+$G(^AUPNVSIT(+X,0)),".")),+^TIU(8925,+DA,0),+DA)=""
S X=DG(DQ),DIC=DIE
I $P($$DOCTYPE^TIULF(+DA),U)="DOC",+$P($G(^TIU(8925,+DA,0)),U),+$P($G(^(0)),U,2) S ^TIU(8925,"AV",+$P(^TIU(8925,+DA,0),U,2),+$P(^TIU(8925,+DA,0),U),+X,+DA)=""
S X=DG(DQ),DIC=DIE
;D:$D(^AUPNVSIT(+X)) ADD^AUPNVSIT
S X=DG(DQ),DIC=DIE
I +$P($G(^TIU(8925,+DA,0)),U),+$P($G(^TIU(8925,+DA,13)),U),+$P($G(^TIU(8925,+DA,0)),U,5) S ^TIU(8925,"AVSIT",+X,+$P(^TIU(8925,+DA,0),U),+$P(^TIU(8925,+DA,0),U,5),(9999999-$P(^TIU(8925,+DA,13),U)),DA)=""
S X=DG(DQ),DIC=DIE
S ^TIU(8925,"V",$E(X,1,30),DA)=""
S X=DG(DQ),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^TIU(8925,D0,150)):^(150),1:"") S X=$P(Y(1),U,1),X=X S DIU=X K Y X ^DD(8925,.03,1,7,1.1) X ^DD(8925,.03,1,7,1.4)
S X=DG(DQ),DIC=DIE
D SAPTLD^TIUDD0(.03,X)
S X=DG(DQ),DIC=DIE
D AIHS11A^BTIUXREF
TIUEDS2 ; ;02/28/13
+1 SET X=DG(DQ)
SET DIC=DIE
+2 IF $PIECE($$DOCTYPE^TIULF(+DA),U)="DOC"
IF $LENGTH($PIECE(^TIU(8925,+DA,0),U))
IF (+$PIECE(^(0),U,2)>0)
SET ^TIU(8925,"AA",$PIECE(^(0),U,2),+$PIECE(^(0),U),(9999999-$PIECE(+$GET(^AUPNVSIT(X,0)),".")),DA)=""
+3 SET X=DG(DQ)
SET DIC=DIE
+4 IF $PIECE($$DOCTYPE^TIULF(+DA),U)="DOC"
IF $LENGTH($PIECE(^TIU(8925,+DA,0),U))
IF (+$PIECE(^(0),U,2)>0)
SET ^TIU(8925,"AE",+$PIECE(^TIU(8925,+DA,0),U,2),(9999999-$PIECE(+$GET(^AUPNVSIT(+X,0)),".")),+^TIU(8925,+DA,0),+DA)=""
+5 SET X=DG(DQ)
SET DIC=DIE
+6 IF $PIECE($$DOCTYPE^TIULF(+DA),U)="DOC"
IF +$PIECE($GET(^TIU(8925,+DA,0)),U)
IF +$PIECE($GET(^(0)),U,2)
SET ^TIU(8925,"AV",+$PIECE(^TIU(8925,+DA,0),U,2),+$PIECE(^TIU(8925,+DA,0),U),+X,+DA)=""
+7 SET X=DG(DQ)
SET DIC=DIE
+8 ;D:$D(^AUPNVSIT(+X)) ADD^AUPNVSIT
+9 SET X=DG(DQ)
SET DIC=DIE
+10 IF +$PIECE($GET(^TIU(8925,+DA,0)),U)
IF +$PIECE($GET(^TIU(8925,+DA,13)),U)
IF +$PIECE($GET(^TIU(8925,+DA,0)),U,5)
SET ^TIU(8925,"AVSIT",+X,+$PIECE(^TIU(8925,+DA,0),U),+$PIECE(^TIU(8925,+DA,0),U,5),(9999999-$PIECE(^TIU(8925,+DA,13),U)),DA)=""
+11 SET X=DG(DQ)
SET DIC=DIE
+12 SET ^TIU(8925,"V",$EXTRACT(X,1,30),DA)=""
+13 SET X=DG(DQ)
SET DIC=DIE
+14 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(1)=$SELECT($DATA(^TIU(8925,D0,150)):^(150),1:"")
SET X=$PIECE(Y(1),U,1)
SET X=X
SET DIU=X
KILL Y
XECUTE ^DD(8925,.03,1,7,1.1)
XECUTE ^DD(8925,.03,1,7,1.4)
+15 SET X=DG(DQ)
SET DIC=DIE
+16 DO SAPTLD^TIUDD0(.03,X)
+17 SET X=DG(DQ)
SET DIC=DIE
+18 DO AIHS11A^BTIUXREF