APCPRCH ; IHS/TUCSON/LAB - PCC Operational Summary AUGUST 14, 1992 ; [ 04/07/99 9:55 AM ]
;;2.0;IHS PCC DATA EXTRACTION SYSTEM;**1**;APR 03, 1998
;IHS/CMI/LAB - XTMP
;
START ;
W:$D(IOF) @IOF
W !,"********** PCC DATA TRANSMISSION REPORT **********",!
W !!,"This report will list all visits that generated a Community Health Activity",!,"record to be sent to the CHA system.",!!
LOG ;
S APCPRCH("LOG")=""
K DIC S DIC="^APCPLOG(",DIC(0)="AEQM" D ^DIC I Y<0 G XIT
S APCPRCH("LOG")=+Y
I '$D(^APCPLOG(APCPRCH("LOG"),21)) W !!,"Visit data has already been purged!!" G LOG
S X=^APCPLOG(APCPRCH("LOG"),0),APCPRCH("RUN BEGIN")=$P(X,U),APCPRCH("RUN END")=$P(X,U,2),APCPRCH("COUNT")=$P(X,U,6),APCPRCH("ORIG TX DATE")=$P($P(X,U,3),".")
S Y=APCPRCH("RUN BEGIN") X ^DD("DD") S APCPRCH("PRINT BEGIN")=Y
S Y=APCPRCH("RUN END") X ^DD("DD") S APCPRCH("PRINT END")=Y
S APCPRCH("VISITS")=$P(^APCPLOG(APCPRCH("LOG"),21,0),U,4)
W !!,"Log entry ",APCPRCH("LOG"),", was for date range ",APCPRCH("PRINT BEGIN")," through",!,APCPRCH("PRINT END")," and generated ",APCPRCH("COUNT")," transactions from ",APCPRCH("VISITS")," visits."
ZIS ;
W !!
S Y=DT D DD^%DT S APCPRCH("DTP")=Y
S XBRC="PROCESS^APCPRCH",XBRP="^APCPRCH1",XBRX="XIT^APCPRCH",XBNS="APCP"
D ^XBDBQUE
D XIT
Q
PROCESS ; Entry point for Taskman
S APCPJOB=$J,APCPBTH=$H
K ^XTMP("APCPRCH",APCPJOB,APCPBTH)
S ^XTMP("APCPRCH",0)=$$FMADD^XLFDT(DT,14)_"^"_DT_"^"_"PCC DATA TX CHA RPT"
S APCPRCH("BT")=$H
S APCDOVRR=1
V ;
S APCPRCH("V")=0 F S APCPRCH("V")=$O(^APCPLOG(APCPRCH("LOG"),21,APCPRCH("V"))) Q:APCPRCH("V")'=+APCPRCH("V")!($D(APCPRCH("QUIT"))) D PROC
Q
PROC ;
Q:'$P(^APCPLOG(APCPRCH("LOG"),21,APCPRCH("V"),0),U,6) ;quit if cha tx not generated
Q:'$D(^AUPNVSIT(APCPRCH("V"))) ;quit if no visit record
S ^("TOTAL")=$S($D(^XTMP("APCPRCH",APCPJOB,APCPBTH,"GEN","TOTAL")):(+^("TOTAL")+1),1:1)
S ^XTMP("APCPRCH",APCPJOB,APCPBTH,"VISITS",APCPRCH("V"))=""
Q
XIT ;
K DA,DIE,DIC,ZTSK,DIR
K APCPRCH,APCPS,APCDOVRR,APCPJOB,APCPBTH
Q
APCPRCH ; IHS/TUCSON/LAB - PCC Operational Summary AUGUST 14, 1992 ; [ 04/07/99 9:55 AM ]
+1 ;;2.0;IHS PCC DATA EXTRACTION SYSTEM;**1**;APR 03, 1998
+2 ;IHS/CMI/LAB - XTMP
+3 ;
START ;
+1 IF $DATA(IOF)
WRITE @IOF
+2 WRITE !,"********** PCC DATA TRANSMISSION REPORT **********",!
+3 WRITE !!,"This report will list all visits that generated a Community Health Activity",!,"record to be sent to the CHA system.",!!
LOG ;
+1 SET APCPRCH("LOG")=""
+2 KILL DIC
SET DIC="^APCPLOG("
SET DIC(0)="AEQM"
DO ^DIC
IF Y<0
GOTO XIT
+3 SET APCPRCH("LOG")=+Y
+4 IF '$DATA(^APCPLOG(APCPRCH("LOG"),21))
WRITE !!,"Visit data has already been purged!!"
GOTO LOG
+5 SET X=^APCPLOG(APCPRCH("LOG"),0)
SET APCPRCH("RUN BEGIN")=$PIECE(X,U)
SET APCPRCH("RUN END")=$PIECE(X,U,2)
SET APCPRCH("COUNT")=$PIECE(X,U,6)
SET APCPRCH("ORIG TX DATE")=$PIECE($PIECE(X,U,3),".")
+6 SET Y=APCPRCH("RUN BEGIN")
XECUTE ^DD("DD")
SET APCPRCH("PRINT BEGIN")=Y
+7 SET Y=APCPRCH("RUN END")
XECUTE ^DD("DD")
SET APCPRCH("PRINT END")=Y
+8 SET APCPRCH("VISITS")=$PIECE(^APCPLOG(APCPRCH("LOG"),21,0),U,4)
+9 WRITE !!,"Log entry ",APCPRCH("LOG"),", was for date range ",APCPRCH("PRINT BEGIN")," through",!,APCPRCH("PRINT END")," and generated ",APCPRCH("COUNT")," transactions from ",APCPRCH("VISITS")," visits."
ZIS ;
+1 WRITE !!
+2 SET Y=DT
DO DD^%DT
SET APCPRCH("DTP")=Y
+3 SET XBRC="PROCESS^APCPRCH"
SET XBRP="^APCPRCH1"
SET XBRX="XIT^APCPRCH"
SET XBNS="APCP"
+4 DO ^XBDBQUE
+5 DO XIT
+6 QUIT
PROCESS ; Entry point for Taskman
+1 SET APCPJOB=$JOB
SET APCPBTH=$HOROLOG
+2 KILL ^XTMP("APCPRCH",APCPJOB,APCPBTH)
+3 SET ^XTMP("APCPRCH",0)=$$FMADD^XLFDT(DT,14)_"^"_DT_"^"_"PCC DATA TX CHA RPT"
+4 SET APCPRCH("BT")=$HOROLOG
+5 SET APCDOVRR=1
V ;
+1 SET APCPRCH("V")=0
FOR
SET APCPRCH("V")=$ORDER(^APCPLOG(APCPRCH("LOG"),21,APCPRCH("V")))
IF APCPRCH("V")'=+APCPRCH("V")!($DATA(APCPRCH("QUIT")))
QUIT
DO PROC
+2 QUIT
PROC ;
+1 ;quit if cha tx not generated
IF '$PIECE(^APCPLOG(APCPRCH("LOG"),21,APCPRCH("V"),0),U,6)
QUIT
+2 ;quit if no visit record
IF '$DATA(^AUPNVSIT(APCPRCH("V")))
QUIT
+3 SET ^("TOTAL")=$SELECT($DATA(^XTMP("APCPRCH",APCPJOB,APCPBTH,"GEN","TOTAL")):(+^("TOTAL")+1),1:1)
+4 SET ^XTMP("APCPRCH",APCPJOB,APCPBTH,"VISITS",APCPRCH("V"))=""
+5 QUIT
XIT ;
+1 KILL DA,DIE,DIC,ZTSK,DIR
+2 KILL APCPRCH,APCPS,APCDOVRR,APCPJOB,APCPBTH
+3 QUIT