ACHSCR16 ; COMPILED XREF FOR FILE #9002080.02 ; 07/25/18
;
S DA(2)=DA(1) S DA(1)=0 S DA=0
A1 ;
I $D(DISET) K DIKLM S:DIKM1=2 DIKLM=1 S:DIKM1'=2&'$G(DIKPUSH(2)) DIKPUSH(2)=1,DA(2)=DA(1),DA(1)=DA,DA=0 G @DIKM1
A S DA(1)=$O(^ACHSF(DA(2),"D",DA(1))) I DA(1)'>0 S DA(1)=0 G END
1 ;
B S DA=$O(^ACHSF(DA(2),"D",DA(1),"T",DA)) I DA'>0 S DA=0 Q:DIKM1=1 G A
2 ;
S DIKZ(0)=$G(^ACHSF(DA(2),"D",DA(1),"T",DA,0))
S X=$P($G(DIKZ(0)),U,2)
I X'="" S ^ACHSF(DA(2),"TB",+$P(^ACHSF(DA(2),"D",DA(1),"T",DA,0),"^",1),$E(X,1,30),DA(1),DA)=""
S X=$P($G(DIKZ(0)),U,2)
I X'="" S:((X="I")!(X="C"&($P(^ACHSF(DA(2),2),U,6)="Y"))!(X="S"&($P(^ACHSF(DA(2),2),U,7)="Y")))&('$D(^ACHS(7,"P",DA(2),DA(1),DA))) ^ACHSF("PQ",DA(2),$P(^ACHSF(DA(2),"D",DA(1),0),U,4),DA(1),DA)=""
S X=$P($G(DIKZ(0)),U,3)
I X'="" S ^ACHSF("AC",$E(X,1,30),DA(2),DA(1),DA)=""
S X=$P($G(DIKZ(0)),U,10)
I X'="" S ^ACHSF(DA(2),"PDOS",X,DA(1),DA)=""
S X=$P($G(DIKZ(0)),U,13)
I X'="" S ^ACHSF(DA(2),"EOBD",9999999-X,DA(1),DA)=""
S X=$P($G(DIKZ(0)),U,14)
I X'="" S ^ACHSF(DA(2),"D",DA(1),"EB1",$P(^ACHSF(DA(2),"D",DA(1),"T",DA,0),"^",13),X,DA)=""
G:'$D(DIKLM) B Q:$D(DISET)
END G ^ACHSCR17
ACHSCR16 ; COMPILED XREF FOR FILE #9002080.02 ; 07/25/18
+1 ;
+2 SET DA(2)=DA(1)
SET DA(1)=0
SET DA=0
A1 ;
+1 IF $DATA(DISET)
KILL DIKLM
IF DIKM1=2
SET DIKLM=1
IF DIKM1'=2&'$GET(DIKPUSH(2))
SET DIKPUSH(2)=1
SET DA(2)=DA(1)
SET DA(1)=DA
SET DA=0
GOTO @DIKM1
A SET DA(1)=$ORDER(^ACHSF(DA(2),"D",DA(1)))
IF DA(1)'>0
SET DA(1)=0
GOTO END
1 ;
B SET DA=$ORDER(^ACHSF(DA(2),"D",DA(1),"T",DA))
IF DA'>0
SET DA=0
IF DIKM1=1
QUIT
GOTO A
2 ;
+1 SET DIKZ(0)=$GET(^ACHSF(DA(2),"D",DA(1),"T",DA,0))
+2 SET X=$PIECE($GET(DIKZ(0)),U,2)
+3 IF X'=""
SET ^ACHSF(DA(2),"TB",+$PIECE(^ACHSF(DA(2),"D",DA(1),"T",DA,0),"^",1),$EXTRACT(X,1,30),DA(1),DA)=""
+4 SET X=$PIECE($GET(DIKZ(0)),U,2)
+5 IF X'=""
IF ((X="I")!(X="C"&($PIECE(^ACHSF(DA(2),2),U,6)="Y"))!(X="S"&($PIECE(^ACHSF(DA(2),2),U,7)="Y")))&('$DATA(^ACHS(7,"P",DA(2),DA(1),DA)))
SET ^ACHSF("PQ",DA(2),$PIECE(^ACHSF(DA(2),"D",DA(1),0),U,4),DA(1),DA)=""
+6 SET X=$PIECE($GET(DIKZ(0)),U,3)
+7 IF X'=""
SET ^ACHSF("AC",$EXTRACT(X,1,30),DA(2),DA(1),DA)=""
+8 SET X=$PIECE($GET(DIKZ(0)),U,10)
+9 IF X'=""
SET ^ACHSF(DA(2),"PDOS",X,DA(1),DA)=""
+10 SET X=$PIECE($GET(DIKZ(0)),U,13)
+11 IF X'=""
SET ^ACHSF(DA(2),"EOBD",9999999-X,DA(1),DA)=""
+12 SET X=$PIECE($GET(DIKZ(0)),U,14)
+13 IF X'=""
SET ^ACHSF(DA(2),"D",DA(1),"EB1",$PIECE(^ACHSF(DA(2),"D",DA(1),"T",DA,0),"^",13),X,DA)=""
+14 IF '$DATA(DIKLM)
GOTO B
IF $DATA(DISET)
QUIT
END GOTO ^ACHSCR17