AZXRVP3 ;PAO/IHS/JHL;VISITS BY PROVIDERS[ 08/31/93 11:22 AM ]
;Version 1;VISITS BY PROVIDERS;;****;DATE OF RELEASE HERE
;JOHN H. LYNCH
;
;THIS ROUTINE WILL PRODUCE THE ACTUAL REPORT OUTPUT.
;THIS OUTPUT WAS CREATED USING THE CRITERIA INPUT
;FROM THE USER IN AZXRVP1, AZXRVP1B, AZXRVP1C, AZXRVP1D,
;AND AZXRVP2.
;THE ROUTINES THAT CALL AZXRVP3
;AZXRVP2, Report Input Routine
;THE ROUTINES THAT AZXRVP3 CALLS:
;NONE
;Variable List
;PG= Current page count.
;LN= Current line count.
;AZXRNAME= Current name subscript to print.
;AZXRCOVS= Current coverage type to print.
;AZXRDATE= Current date to print.
;AZXRENT= Current DFN to print.
;J,K= Counter variables.
MAIN ;AZXRVP3 PROGRAM CONTROL
S PG=0 ;INIT PAGE COUNT
D HEADING1,HEADING2,HEADING3 ;DO INITIAL HEADINGS
I $O(^AZXRTMP1("AAAAAA"))="" W !,"No data found for given criteria." D KILL K ^AZXRTMP1(0,0) Q ;NO DATA, UNLOCK TEMP GLOBAL
;AND QUIT
D DOPRINT ;DO PRINT LOOP
D:$D(^AZXRTMP1(1))!$D(^AZXRTMP1(2))!$D(^AZXRTMP1(3))!$D(^AZXRTMP1(4)) ERRPRINT
;DO ERROR PRINT?
K ^AZXRTMP1(0,0) ;UNLOCK TEMP GLOBAL
D KILL ;KILL OFF ALL LOCAL VARIABLES
Q
HEADING1 ;MAIN REPORT HEADING
W # ;DO A FORMFEED
S PG=PG+1 ;INCR PG COUNT
W "_______________________________________________________________________________________________",!!
W "Visits by Providers",?31,"-CONFIDENTIAL-",?59,"From: ",^AZXRTMP1(0,"FDT",1),?79,"To: ",^AZXRTMP1(0,"TDT",1),!
W "for ",?4,^AZXRTMP1(0,"FAC",1),?79,"Pg: ",PG,!
W "_______________________________________________________________________________________________",!!
S LN=6 ;RESET LN COUNT
Q
HEADING2 ;REPORT CRITERIA HEADING
W ?30,"-SEARCH CRITERIA-",!
W "Primary Providers:",?59,"Affiliations:",!!
F J=1:1:10 W:$D(^AZXRTMP1(0,"PROV",J)) ?5,^AZXRTMP1(0,"PROV",J) W:$D(^AZXRTMP1(0,"AFF",J)) ?65,^AZXRTMP1(0,"AFF",J) W !
W !,"Clinic Stops:",?59,"Coverage Types:",!!
F J=1:1:5 W:$D(^AZXRTMP1(0,"CLNC",J)) ?5,^AZXRTMP1(0,"CLNC",J) W:$D(^AZXRTMP1(0,"COV",J)) ?65,^AZXRTMP1(0,"COV",J) W !
W "_______________________________________________________________________________________________",!!
S LN=LN+23 ;INCR LN COUNT FOR LABELS
Q
HEADING3 ;REPORT LABEL HEADING
W "Patient Name",?31,"HRN",?50,"Date",?65,"Clinic Stop",!
W "Primary Provider",?65,"Affiliation",!
W "Coverage Types",!
W "_______________________________________________________________________________________________",!!
S LN=LN+5 ;INCR LN COUNT
Q
HEADING4 ;ERROR REPORT HEADING
W # ;FORM FEED
S PG=PG+1 ;INCR PAGE COUNT
W "_______________________________________________________________________________________________",!!
W "Visits by Providers",?31,"-ERROR REPORT-",?59,"From: ",^AZXRTMP1(0,"FDT",1),?79,"To: ",^AZXRTMP1(0,"TDT",1),!
W "for ",?4,^AZXRTMP1(0,"FAC",1),?79,"Pg: ",PG,!
W "_______________________________________________________________________________________________",!!
S LN=6 ;RESET LINE COUNT
Q
DOPRINT ;DO PRINT LOOP
S AZXRNAME="AAAAAA" ;START POINT
F S AZXRNAME=$O(^AZXRTMP1(AZXRNAME)) Q:AZXRNAME="" S AZXRDATE=0 F S AZXRDATE=$O(^AZXRTMP1(AZXRNAME,AZXRDATE)) Q:AZXRDATE="" S AZXRENT=0 F S AZXRENT=$O(^AZXRTMP1(AZXRNAME,AZXRDATE,AZXRENT)) Q:AZXRENT="" D PRNTDATA
Q
PRNTDATA ;PRINT DATA FOR EACH ENTRY
I LN+8>IOSL D HEADING1 ;NEED PAGE BREAK
W AZXRNAME,?31,$P(^AZXRTMP1(AZXRNAME,AZXRDATE,AZXRENT),U,1)
;PAT. & HRN
W ?50,AZXRDATE,?65,$P(^AZXRTMP1(AZXRNAME,AZXRDATE,AZXRENT),U,2),!
;DATE & CLINIC STOP
W $P(^AZXRTMP1(AZXRNAME,AZXRDATE,AZXRENT),U,3)
;PRIMARY PROVIDER
W ?65,$P(^AZXRTMP1(AZXRNAME,AZXRDATE,AZXRENT),U,4),!
;AFFILIATION
S LN=LN+2 ;INCR LINE COUNT
F J=5:1:10 S AZXRCOVS=$P(^AZXRTMP1(AZXRNAME,AZXRDATE,AZXRENT),U,J) Q:AZXRCOVS="" W AZXRCOVS,! S LN=LN+1
W ! S LN=LN+1 ;SKIP LINE
Q
ERRPRINT ;PRINT OUT ALL ERRORS
D HEADING4 ;DO ERROR RPT HEADING
I $D(^AZXRTMP1(1)) D
.W "Error 1 -No data found for these visits,",!
.W " -Please call Phoenix Area Office:",!!
.S LN=LN+3 ;INCR LINE COUNT
.S J=0,K=9
.F S J=$O(^AZXRTMP1(1,"ERROR1",J)) Q:J="" D:LN+3>IOSL HEADING4 W ?K,^AZXRTMP1(1,"ERROR1",J) S K=K+41 I K>50 W ! S K=9,LN=LN+1
.W !! S LN=LN+2
I $D(^AZXRTMP1(2)) D
.W "Error 2 -The following patients need to be registered at ",^AZXRTMP1(0,"FAC",1),":",!!
.S LN=LN+2 ;INCR LINE COUNT
.S J=0,K=9
.F S J=$O(^AZXRTMP1(2,"ERROR2",J)) Q:J="" D:LN+3>IOSL HEADING4 W ?K,$P(^DPT(^AZXRTMP1(2,"ERROR2",J),0),U,1) S K=K+41 I K>50 W ! S K=9,LN=LN+1
.W !! S LN=LN+2
I $D(^AZXRTMP1(3)) D
.W "Error 3 -Use Patient Registration to add a state for Medicaid for these patients:",!!
.S LN=LN+2 ;INCR LINE COUNT
.S J=0,K=9
.F S J=$O(^AZXRTMP1(3,"ERROR3",J)) Q:J="" D:LN+3>IOSL HEADING4 W ?K,$P(^DPT(^AZXRTMP1(3,"ERROR3",J),0),U,1) S K=K+41 I K>50 W ! S K=9,LN=LN+1
.W !! S LN=LN+2
I $D(^AZXRTMP1(4)) D
.W "Error 4 -No dependent entries found for these visits,",!
.W " -Please call Phoenix Area Office:",!!
.S LN=LN+3 ;INCR LINE COUNT
.S J=0,K=9
.F S J=$O(^AZXRTMP1(4,"ERROR4",J)) Q:J="" D:LN+3>IOSL HEADING4 W ?K,$P(^AZXRTMP1(4,"ERROR4",J),U,1) S K=K+8 I K>86 W ! S K=9,LN=LN+1
Q
KILL ;KILL LOCAL VARIABLES AND EXIT ROUTINE AZXRVP3
K PG,LN,AZXRNAME,AZXRCOVS,AZXRDATE,AZXRENT,J,K
Q
AZXRVP3 ;PAO/IHS/JHL;VISITS BY PROVIDERS[ 08/31/93 11:22 AM ]
+1 ;Version 1;VISITS BY PROVIDERS;;****;DATE OF RELEASE HERE
+2 ;JOHN H. LYNCH
+3 ;
+4 ;THIS ROUTINE WILL PRODUCE THE ACTUAL REPORT OUTPUT.
+5 ;THIS OUTPUT WAS CREATED USING THE CRITERIA INPUT
+6 ;FROM THE USER IN AZXRVP1, AZXRVP1B, AZXRVP1C, AZXRVP1D,
+7 ;AND AZXRVP2.
+8 +9 ;THE ROUTINES THAT CALL AZXRVP3
+10 ;AZXRVP2, Report Input Routine
+11 +12 ;THE ROUTINES THAT AZXRVP3 CALLS:
+13 ;NONE
+14 +15 ;Variable List
+16 ;PG= Current page count.
+17 ;LN= Current line count.
+18 ;AZXRNAME= Current name subscript to print.
+19 ;AZXRCOVS= Current coverage type to print.
+20 ;AZXRDATE= Current date to print.
+21 ;AZXRENT= Current DFN to print.
+22 ;J,K= Counter variables.
+23 +24 MAIN ;AZXRVP3 PROGRAM CONTROL
+1 ;INIT PAGE COUNT
SET PG=0
+2 ;DO INITIAL HEADINGS
DO HEADING1
DO HEADING2
DO HEADING3
+3 ;NO DATA, UNLOCK TEMP GLOBAL
IF $ORDER(^AZXRTMP1("AAAAAA"))=""
WRITE !,"No data found for given criteria."
DO KILL
KILL ^AZXRTMP1(0,0)
QUIT
+4 ;AND QUIT
+5 ;DO PRINT LOOP
DO DOPRINT
+6 IF $DATA(^AZXRTMP1(1))!$DATA(^AZXRTMP1(2))!$DATA(^AZXRTMP1(3))!$DATA(^AZXRTMP1(4))
DO ERRPRINT
+7 ;DO ERROR PRINT?
+8 ;UNLOCK TEMP GLOBAL
KILL ^AZXRTMP1(0,0)
+9 ;KILL OFF ALL LOCAL VARIABLES
DO KILL
+10 QUIT
+11 HEADING1 ;MAIN REPORT HEADING
+1 ;DO A FORMFEED
WRITE #
+2 ;INCR PG COUNT
SET PG=PG+1
+3 WRITE "_______________________________________________________________________________________________",!!
+4 WRITE "Visits by Providers",?31,"-CONFIDENTIAL-",?59,"From: ",^AZXRTMP1(0,"FDT",1),?79,"To: ",^AZXRTMP1(0,"TDT",1),!
+5 WRITE "for ",?4,^AZXRTMP1(0,"FAC",1),?79,"Pg: ",PG,!
+6 WRITE "_______________________________________________________________________________________________",!!
+7 ;RESET LN COUNT
SET LN=6
+8 QUIT
+9 HEADING2 ;REPORT CRITERIA HEADING
+1 WRITE ?30,"-SEARCH CRITERIA-",!
+2 WRITE "Primary Providers:",?59,"Affiliations:",!!
+3 FOR J=1:1:10
IF $DATA(^AZXRTMP1(0,"PROV",J))
WRITE ?5,^AZXRTMP1(0,"PROV",J)
IF $DATA(^AZXRTMP1(0,"AFF",J))
WRITE ?65,^AZXRTMP1(0,"AFF",J)
WRITE !
+4 WRITE !,"Clinic Stops:",?59,"Coverage Types:",!!
+5 FOR J=1:1:5
IF $DATA(^AZXRTMP1(0,"CLNC",J))
WRITE ?5,^AZXRTMP1(0,"CLNC",J)
IF $DATA(^AZXRTMP1(0,"COV",J))
WRITE ?65,^AZXRTMP1(0,"COV",J)
WRITE !
+6 WRITE "_______________________________________________________________________________________________",!!
+7 ;INCR LN COUNT FOR LABELS
SET LN=LN+23
+8 QUIT
+9 HEADING3 ;REPORT LABEL HEADING
+1 WRITE "Patient Name",?31,"HRN",?50,"Date",?65,"Clinic Stop",!
+2 WRITE "Primary Provider",?65,"Affiliation",!
+3 WRITE "Coverage Types",!
+4 WRITE "_______________________________________________________________________________________________",!!
+5 ;INCR LN COUNT
SET LN=LN+5
+6 QUIT
+7 HEADING4 ;ERROR REPORT HEADING
+1 ;FORM FEED
WRITE #
+2 ;INCR PAGE COUNT
SET PG=PG+1
+3 WRITE "_______________________________________________________________________________________________",!!
+4 WRITE "Visits by Providers",?31,"-ERROR REPORT-",?59,"From: ",^AZXRTMP1(0,"FDT",1),?79,"To: ",^AZXRTMP1(0,"TDT",1),!
+5 WRITE "for ",?4,^AZXRTMP1(0,"FAC",1),?79,"Pg: ",PG,!
+6 WRITE "_______________________________________________________________________________________________",!!
+7 ;RESET LINE COUNT
SET LN=6
+8 QUIT
+9 DOPRINT ;DO PRINT LOOP
+1 ;START POINT
SET AZXRNAME="AAAAAA"
+2 FOR
SET AZXRNAME=$ORDER(^AZXRTMP1(AZXRNAME))
IF AZXRNAME=""
QUIT
SET AZXRDATE=0
FOR
SET AZXRDATE=$ORDER(^AZXRTMP1(AZXRNAME,AZXRDATE))
IF AZXRDATE=""
QUIT
SET AZXRENT=0
FOR
SET AZXRENT=$ORDER(^AZXRTMP1(AZXRNAME,AZXRDATE,AZXRENT))
IF AZXRENT=""
QUIT
DO PRNTDATA
+3 QUIT
+4 PRNTDATA ;PRINT DATA FOR EACH ENTRY
+1 ;NEED PAGE BREAK
IF LN+8>IOSL
DO HEADING1
+2 WRITE AZXRNAME,?31,$PIECE(^AZXRTMP1(AZXRNAME,AZXRDATE,AZXRENT),U,1)
+3 ;PAT. & HRN
+4 WRITE ?50,AZXRDATE,?65,$PIECE(^AZXRTMP1(AZXRNAME,AZXRDATE,AZXRENT),U,2),!
+5 ;DATE & CLINIC STOP
+6 WRITE $PIECE(^AZXRTMP1(AZXRNAME,AZXRDATE,AZXRENT),U,3)
+7 ;PRIMARY PROVIDER
+8 WRITE ?65,$PIECE(^AZXRTMP1(AZXRNAME,AZXRDATE,AZXRENT),U,4),!
+9 ;AFFILIATION
+10 ;INCR LINE COUNT
SET LN=LN+2
+11 FOR J=5:1:10
SET AZXRCOVS=$PIECE(^AZXRTMP1(AZXRNAME,AZXRDATE,AZXRENT),U,J)
IF AZXRCOVS=""
QUIT
WRITE AZXRCOVS,!
SET LN=LN+1
+12 ;SKIP LINE
WRITE !
SET LN=LN+1
+13 QUIT
+14 ERRPRINT ;PRINT OUT ALL ERRORS
+1 ;DO ERROR RPT HEADING
DO HEADING4
+2 IF $DATA(^AZXRTMP1(1))
Begin DoDot:1
+3 WRITE "Error 1 -No data found for these visits,",!
+4 WRITE " -Please call Phoenix Area Office:",!!
+5 ;INCR LINE COUNT
SET LN=LN+3
+6 SET J=0
SET K=9
+7 FOR
SET J=$ORDER(^AZXRTMP1(1,"ERROR1",J))
IF J=""
QUIT
IF LN+3>IOSL
DO HEADING4
WRITE ?K,^AZXRTMP1(1,"ERROR1",J)
SET K=K+41
IF K>50
WRITE !
SET K=9
SET LN=LN+1
+8 WRITE !!
SET LN=LN+2
End DoDot:1
+9 IF $DATA(^AZXRTMP1(2))
Begin DoDot:1
+10 WRITE "Error 2 -The following patients need to be registered at ",^AZXRTMP1(0,"FAC",1),":",!!
+11 ;INCR LINE COUNT
SET LN=LN+2
+12 SET J=0
SET K=9
+13 FOR
SET J=$ORDER(^AZXRTMP1(2,"ERROR2",J))
IF J=""
QUIT
IF LN+3>IOSL
DO HEADING4
WRITE ?K,$PIECE(^DPT(^AZXRTMP1(2,"ERROR2",J),0),U,1)
SET K=K+41
IF K>50
WRITE !
SET K=9
SET LN=LN+1
+14 WRITE !!
SET LN=LN+2
End DoDot:1
+15 IF $DATA(^AZXRTMP1(3))
Begin DoDot:1
+16 WRITE "Error 3 -Use Patient Registration to add a state for Medicaid for these patients:",!!
+17 ;INCR LINE COUNT
SET LN=LN+2
+18 SET J=0
SET K=9
+19 FOR
SET J=$ORDER(^AZXRTMP1(3,"ERROR3",J))
IF J=""
QUIT
IF LN+3>IOSL
DO HEADING4
WRITE ?K,$PIECE(^DPT(^AZXRTMP1(3,"ERROR3",J),0),U,1)
SET K=K+41
IF K>50
WRITE !
SET K=9
SET LN=LN+1
+20 WRITE !!
SET LN=LN+2
End DoDot:1
+21 IF $DATA(^AZXRTMP1(4))
Begin DoDot:1
+22 WRITE "Error 4 -No dependent entries found for these visits,",!
+23 WRITE " -Please call Phoenix Area Office:",!!
+24 ;INCR LINE COUNT
SET LN=LN+3
+25 SET J=0
SET K=9
+26 FOR
SET J=$ORDER(^AZXRTMP1(4,"ERROR4",J))
IF J=""
QUIT
IF LN+3>IOSL
DO HEADING4
WRITE ?K,$PIECE(^AZXRTMP1(4,"ERROR4",J),U,1)
SET K=K+8
IF K>86
WRITE !
SET K=9
SET LN=LN+1
End DoDot:1
+27 QUIT
+28 KILL ;KILL LOCAL VARIABLES AND EXIT ROUTINE AZXRVP3
+1 KILL PG,LN,AZXRNAME,AZXRCOVS,AZXRDATE,AZXRENT,J,K
+2 QUIT