BYIMD ;IHS/CMI/THL - IMMUNIZATION DATA EXCHANGE;
;;2.0;BYIM IMMUNIZATION DATA EXCHANGE;**3,4,5,6,7,8**;JUL 11, 2017;Build 310
;
;UTILITY TO CONTROL 'D' CROSS REFERENCE FOR DATA EXPORT
;
Q
EN ;EP;TO SET DATE AND SET 'D' XREF FOR ALL IMMUNIZATIONS PRIOR TO DATE
;SO IMM'S WON'T BE EXPORTED
;
K DIR
S DIR(0)="DO"
S DIR("A")="Enter a reference date"
W @IOF
W !!?5,"Enter a reference date."
W !!?5,"ALL immunizations given prior to the date selected will be"
W !?5,"flagged as 'exported' so they will not be exported again"
W !?5,"in the daily batch immunization exports."
W !
D ^DIR
K DIR
Q:'Y
S DATE=Y
K DIR
S DIR(0)="YO"
S DIR("A")="Are you sure you want to proceed"
S DIR("B")="NO"
S Y=DATE
X ^DD("DD")
W !!?5,"ALL immunizations given prior to: ",Y
W !?5,"will now be flagged as 'exported'"
W !
D ^DIR
K DIR
Q:'Y
N DA,X0,P,V,VD,J
S DA=0
F S DA=$O(^AUPNVIMM(DA)) Q:'DA S X0=$G(^(DA,0)) D
.Q:$D(^BYIMEXP("D",DA))
.S V=$P(X0,U,3)
.Q:'V
.S P=$P(X0,U,2)
.Q:'P
.S VD=+$G(^AUPNVSIT(V,0))
.Q:'VD
.Q:VD>DATE
.;L ^BYIMEXP(0):1
.F J=3,4 S X=$P(^BYIMEXP(0),U,J),X=X+1,$P(^BYIMEXP(0),U,J)=X
.;L -^BYIMEXP(0)
.;L ^BYIMEXP(X,0):1
.S ^BYIMEXP(X,0)=P_U_DATE_U_DA_U_"E^MARKED AS EXPORTED WITHOUT EXPORT"
.;L -^BYIMEXP(X,0)
.S ^BYIMEXP("D",DA,X)="MARKED AS EXPORTED WITHOUT EXPORT"
.W:'$D(ZTQUEUED) "."
Q
;-----
EN1 ;EP;TO SELECT DATES TO CLEAR 'D' XREFS FOR IMMUNIZATIONS DURING
;A DATE ;RANGE
;
K DIR
S DIR(0)="DO"
S DIR("A")="Enter a beginning date to resend all immunizations"
W @IOF
W !!?5,"Enter a reference date."
W !!?5,"ALL immunizations given from the date selected will"
W !?5,"have the 'exported' flag removed so they will be exported"
W !?5,"again in the daily batch immunization exports."
W !
D ^DIR
K DIR
Q:'Y
S DATE=Y
K DIR
S DIR(0)="YO"
S DIR("A")="Are you sure you want to proceed"
S DIR("B")="NO"
S Y=DATE
X ^DD("DD")
W !!?5,"ALL immunizations given on: ",Y," and after"
W !?5,"will have the 'exported' flag removed"
W !
D ^DIR
K DIR
Q:'Y
N DA,VDA,X0,P,V,VD,J
S VD=DATE-.0001
F S VD=$O(^AUPNVSIT("B",VD)) Q:'VD D
.S VDA=0
.F S VDA=$O(^AUPNVSIT("B",VD,VDA)) Q:'VDA D EN11
Q
;-----
EN11 ;CHECK VISIT RELATED IMM'S
S DA=0
F S DA=$O(^AUPNVIMM("AD",VDA,DA)) Q:'DA D:$D(^BYIMEXP("D",DA))
.K ^BYIMEXP("D",DA)
.W:'$D(ZTQUEUED) "."
Q
;-----
BYIMD ;IHS/CMI/THL - IMMUNIZATION DATA EXCHANGE;
+1 ;;2.0;BYIM IMMUNIZATION DATA EXCHANGE;**3,4,5,6,7,8**;JUL 11, 2017;Build 310
+2 ;
+3 ;UTILITY TO CONTROL 'D' CROSS REFERENCE FOR DATA EXPORT
+4 ;
+5 QUIT
EN ;EP;TO SET DATE AND SET 'D' XREF FOR ALL IMMUNIZATIONS PRIOR TO DATE
+1 ;SO IMM'S WON'T BE EXPORTED
+2 ;
+3 KILL DIR
+4 SET DIR(0)="DO"
+5 SET DIR("A")="Enter a reference date"
+6 WRITE @IOF
+7 WRITE !!?5,"Enter a reference date."
+8 WRITE !!?5,"ALL immunizations given prior to the date selected will be"
+9 WRITE !?5,"flagged as 'exported' so they will not be exported again"
+10 WRITE !?5,"in the daily batch immunization exports."
+11 WRITE !
+12 DO ^DIR
+13 KILL DIR
+14 IF 'Y
QUIT
+15 SET DATE=Y
+16 KILL DIR
+17 SET DIR(0)="YO"
+18 SET DIR("A")="Are you sure you want to proceed"
+19 SET DIR("B")="NO"
+20 SET Y=DATE
+21 XECUTE ^DD("DD")
+22 WRITE !!?5,"ALL immunizations given prior to: ",Y
+23 WRITE !?5,"will now be flagged as 'exported'"
+24 WRITE !
+25 DO ^DIR
+26 KILL DIR
+27 IF 'Y
QUIT
+28 NEW DA,X0,P,V,VD,J
+29 SET DA=0
+30 FOR
SET DA=$ORDER(^AUPNVIMM(DA))
IF 'DA
QUIT
SET X0=$GET(^(DA,0))
Begin DoDot:1
+31 IF $DATA(^BYIMEXP("D",DA))
QUIT
+32 SET V=$PIECE(X0,U,3)
+33 IF 'V
QUIT
+34 SET P=$PIECE(X0,U,2)
+35 IF 'P
QUIT
+36 SET VD=+$GET(^AUPNVSIT(V,0))
+37 IF 'VD
QUIT
+38 IF VD>DATE
QUIT
+39 ;L ^BYIMEXP(0):1
+40 FOR J=3,4
SET X=$PIECE(^BYIMEXP(0),U,J)
SET X=X+1
SET $PIECE(^BYIMEXP(0),U,J)=X
+41 ;L -^BYIMEXP(0)
+42 ;L ^BYIMEXP(X,0):1
+43 SET ^BYIMEXP(X,0)=P_U_DATE_U_DA_U_"E^MARKED AS EXPORTED WITHOUT EXPORT"
+44 ;L -^BYIMEXP(X,0)
+45 SET ^BYIMEXP("D",DA,X)="MARKED AS EXPORTED WITHOUT EXPORT"
+46 IF '$DATA(ZTQUEUED)
WRITE "."
End DoDot:1
+47 QUIT
+48 ;-----
EN1 ;EP;TO SELECT DATES TO CLEAR 'D' XREFS FOR IMMUNIZATIONS DURING
+1 ;A DATE ;RANGE
+2 ;
+3 KILL DIR
+4 SET DIR(0)="DO"
+5 SET DIR("A")="Enter a beginning date to resend all immunizations"
+6 WRITE @IOF
+7 WRITE !!?5,"Enter a reference date."
+8 WRITE !!?5,"ALL immunizations given from the date selected will"
+9 WRITE !?5,"have the 'exported' flag removed so they will be exported"
+10 WRITE !?5,"again in the daily batch immunization exports."
+11 WRITE !
+12 DO ^DIR
+13 KILL DIR
+14 IF 'Y
QUIT
+15 SET DATE=Y
+16 KILL DIR
+17 SET DIR(0)="YO"
+18 SET DIR("A")="Are you sure you want to proceed"
+19 SET DIR("B")="NO"
+20 SET Y=DATE
+21 XECUTE ^DD("DD")
+22 WRITE !!?5,"ALL immunizations given on: ",Y," and after"
+23 WRITE !?5,"will have the 'exported' flag removed"
+24 WRITE !
+25 DO ^DIR
+26 KILL DIR
+27 IF 'Y
QUIT
+28 NEW DA,VDA,X0,P,V,VD,J
+29 SET VD=DATE-.0001
+30 FOR
SET VD=$ORDER(^AUPNVSIT("B",VD))
IF 'VD
QUIT
Begin DoDot:1
+31 SET VDA=0
+32 FOR
SET VDA=$ORDER(^AUPNVSIT("B",VD,VDA))
IF 'VDA
QUIT
DO EN11
End DoDot:1
+33 QUIT
+34 ;-----
EN11 ;CHECK VISIT RELATED IMM'S
+1 SET DA=0
+2 FOR
SET DA=$ORDER(^AUPNVIMM("AD",VDA,DA))
IF 'DA
QUIT
IF $DATA(^BYIMEXP("D",DA))
Begin DoDot:1
+3 KILL ^BYIMEXP("D",DA)
+4 IF '$DATA(ZTQUEUED)
WRITE "."
End DoDot:1
+5 QUIT
+6 ;-----