BARDYSVA ; IHS/DIT/CPC - DAYS TO COLLECTION detail print ; 04/26/2018
;;1.8;IHS ACCOUNTS RECEIVABLE;**28**;OCT 26,2005;Build 92
;IHS/DIT/CPC - 1.8*28 - HEAT224215 - New routine to print Spreadsheet XML detail report
;
Q
;
PRTCSV ;Walks through data and outputs data elements
S GLOBAL="",VISITIEN=0,PIECE=2,C=","
D CSVCHDR
F S VISITIEN=$O(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DET","COL",VISITIEN)) Q:+VISITIEN=0 D
.S GLOBAL="^XTMP("_""""_"BARDYSVS"_""""_C_$J_C_""""_"DAYS TO COL VISIT"_""""_C_""""_"DET"_""""_C_""""_"COL"_""""_")"
.D CSVROW(GLOBAL,VISITIEN,2)
Q
CSVCHDR ;Generate Column Headers
K COLHDR
D CSVBANNR
S I=""
F S I=$O(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DET","COL",I)) Q:I="" D
.S J=""
.F S J=$O(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DET","COL",I,J)) Q:J="" S COLHDR(J)=$P(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DET","COL",I,J),U,1)
S I="",J=0
F S I=$O(COLHDR(I)) Q:I="" D
.S J=J+1
.W """"_COLHDR(I)_"""",U
W !
Q
;
CSVROW(GLOBAL,ROW,PIECE) ;Generate Excel Delimited Row
;Example data - ^XTMP("BARDYSVS",4252,"DAYS TO COL VISIT","DET","COL",1495550,120) = "PROVIDER 1^DYER,ROBIN MARGARET^D^s65"
;Example GLOBAL - ^XTMP("BARDYSVS",4252,"DAYS TO COL VISIT","DET","COL")
;Example ROW - 149550
;Example PIECE - 2
S BARCOL=0
S J=""
F S J=$O(@GLOBAL@(ROW,J)) Q:J="" D
.W $P(@GLOBAL@(ROW,J),U,PIECE)_U
W !
Q
CSVBANNR ; PRINTS THE REPORT BANNER
S BAR("PG")=""
S BAR("HD",0)=""
S BAR("LOC")=""
S BAR("OPT")="BAR RPT DAYS IN AR"
D HD^BARRHD
D NOW^%DTC
S Y=%
X ^DD("DD")
D WRAP($P(Y,":",1,2))
D WRAP("WARNING: Confidential Patient Information, Privacy Act Applies")
K BAR("LINE")
S $P(BAR("LINE"),"=",70)=""
D WRAP(BAR("LINE"))
D WRAP(BAR("HD",0))
S BAR("TMPLVL")=0
F S BAR("TMPLVL")=$O(BAR("HD",BAR("TMPLVL"))) Q:'BAR("TMPLVL")&(BAR("TMPLVL")'=0) D:$G(BAR("HD",BAR("TMPLVL")))]"" WRAP(BAR("HD",BAR("TMPLVL")))
D WRAP(BAR("LINE"))
K BAR("LINE")
Q
WRAP(X) ;Method
W """"_X_"""",!
Q
BARDYSVA ; IHS/DIT/CPC - DAYS TO COLLECTION detail print ; 04/26/2018
+1 ;;1.8;IHS ACCOUNTS RECEIVABLE;**28**;OCT 26,2005;Build 92
+2 ;IHS/DIT/CPC - 1.8*28 - HEAT224215 - New routine to print Spreadsheet XML detail report
+3 ;
+4 QUIT
+5 ;
PRTCSV ;Walks through data and outputs data elements
+1 SET GLOBAL=""
SET VISITIEN=0
SET PIECE=2
SET C=","
+2 DO CSVCHDR
+3 FOR
SET VISITIEN=$ORDER(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",VISITIEN))
IF +VISITIEN=0
QUIT
Begin DoDot:1
+4 SET GLOBAL="^XTMP("_""""_"BARDYSVS"_""""_C_$JOB_C_""""_"DAYS TO COL VISIT"_""""_C_""""_"DET"_""""_C_""""_"COL"_""""_")"
+5 DO CSVROW(GLOBAL,VISITIEN,2)
End DoDot:1
+6 QUIT
CSVCHDR ;Generate Column Headers
+1 KILL COLHDR
+2 DO CSVBANNR
+3 SET I=""
+4 FOR
SET I=$ORDER(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",I))
IF I=""
QUIT
Begin DoDot:1
+5 SET J=""
+6 FOR
SET J=$ORDER(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",I,J))
IF J=""
QUIT
SET COLHDR(J)=$PIECE(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",I,J),U,1)
End DoDot:1
+7 SET I=""
SET J=0
+8 FOR
SET I=$ORDER(COLHDR(I))
IF I=""
QUIT
Begin DoDot:1
+9 SET J=J+1
+10 WRITE """"_COLHDR(I)_"""",U
End DoDot:1
+11 WRITE !
+12 QUIT
+13 ;
CSVROW(GLOBAL,ROW,PIECE) ;Generate Excel Delimited Row
+1 ;Example data - ^XTMP("BARDYSVS",4252,"DAYS TO COL VISIT","DET","COL",1495550,120) = "PROVIDER 1^DYER,ROBIN MARGARET^D^s65"
+2 ;Example GLOBAL - ^XTMP("BARDYSVS",4252,"DAYS TO COL VISIT","DET","COL")
+3 ;Example ROW - 149550
+4 ;Example PIECE - 2
+5 SET BARCOL=0
+6 SET J=""
+7 FOR
SET J=$ORDER(@GLOBAL@(ROW,J))
IF J=""
QUIT
Begin DoDot:1
+8 WRITE $PIECE(@GLOBAL@(ROW,J),U,PIECE)_U
End DoDot:1
+9 WRITE !
+10 QUIT
CSVBANNR ; PRINTS THE REPORT BANNER
+1 SET BAR("PG")=""
+2 SET BAR("HD",0)=""
+3 SET BAR("LOC")=""
+4 SET BAR("OPT")="BAR RPT DAYS IN AR"
+5 DO HD^BARRHD
+6 DO NOW^%DTC
+7 SET Y=%
+8 XECUTE ^DD("DD")
+9 DO WRAP($PIECE(Y,":",1,2))
+10 DO WRAP("WARNING: Confidential Patient Information, Privacy Act Applies")
+11 KILL BAR("LINE")
+12 SET $PIECE(BAR("LINE"),"=",70)=""
+13 DO WRAP(BAR("LINE"))
+14 DO WRAP(BAR("HD",0))
+15 SET BAR("TMPLVL")=0
+16 FOR
SET BAR("TMPLVL")=$ORDER(BAR("HD",BAR("TMPLVL")))
IF 'BAR("TMPLVL")&(BAR("TMPLVL")'=0)
QUIT
IF $GET(BAR("HD",BAR("TMPLVL")))]""
DO WRAP(BAR("HD",BAR("TMPLVL")))
+17 DO WRAP(BAR("LINE"))
+18 KILL BAR("LINE")
+19 QUIT
WRAP(X) ;Method
+1 WRITE """"_X_"""",!
+2 QUIT