BARDYSV9 ; 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
;
ROWTOCOL(VISITIEN,BARREC) ;Scans global created by Days report and creates appropriate number of column headers
;Piece 1 = Column Name
;Piece 2 = Data element
;Piece 3 = format code: N=Number, S=String, D=Date
;Piece 4 = StyleID
S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DET","COL",VISITIEN,1)="VISIT IEN"_U_$P(BARREC,U,1)_U_"N"
S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DET","COL",VISITIEN,2)="MONTH YEAR"_U_$P(BARREC,U,2)_U_"D"_U_"s63"
S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DET","COL",VISITIEN,3)="VISIT LOC"_U_$P(BARREC,U,3)_U_"S"
S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DET","COL",VISITIEN,4)="VISIT ADMIT DATE"_U_$P(BARREC,U,4)_U_"D"_U_"s62"
S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DET","COL",VISITIEN,5)="DATE CREATED PCC"_U_$P(BARREC,U,5)_U_"D"_U_"s62"
S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DET","COL",VISITIEN,6)="CREATED NUM DAYS"_U_$P(BARREC,U,6)_U_"N"
S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DET","COL",VISITIEN,7)="DATE REVIEWED"_U_$P(BARREC,U,7)_U_"D"_U_"s62"
S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DET","COL",VISITIEN,8)="REVIEWED NUM DAYS"_U_$P(BARREC,U,8)_U_"N"
S BARBILLS=$P(BARREC,U,9),I=""
F I=1:1:$L(BARBILLS,"~") D
.S BARBILL=$P(BARBILLS,"~",I)
.S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+9)="BILL NUM "_I_U_$P(BARBILL,";",1)_U_"S"
.S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+10)="APPROVAL DATE "_I_U_$P(BARBILL,";",2)_U_"D"_U_"s62"
.S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+11)="APPROVAL NUM DAYS "_I_U_$P(BARBILL,";",3)_U_"N"
.S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+12)="EXPORT DATE "_I_U_$P(BARBILL,";",4)_U_"D"_U_"s62"
.S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+13)="EXPORT NUM DAYS "_I_U_$P(BARBILL,";",5)_U_"N"
.S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+14)="FINALIZED BATCH DATE "_I_U_$P(BARBILL,";",6)_U_"D"_U_"s62"
.S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+15)="FINALIZED NUM DAYS "_I_U_$P(BARBILL,";",7)_U_"N"
.S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+16)="FIRST TRANS DATE "_I_U_$P(BARBILL,";",8)_U_"D"_U_"s62"
.S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+17)="FIRST TRANS NUM DAYS "_I_U_$P(BARBILL,";",9)_U_"N"
.S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+18)="LAST TRANS DATE "_I_U_$P(BARBILL,";",10)_U_"D"_U_"s62"
.S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+19)="LAST TRANS NUM DAYS "_I_U_$P(BARBILL,";",11)_U_"N"
.S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+20)="PROVIDER "_I_U_$P(BARBILL,";",12)_U_"S"
.S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+21)="BILLED AMOUNT "_I_U_$P(BARBILL,";",13)_U_"N"
Q
PRTXML ;Walks through data and outputs data elements
S GLOBAL="",VISITIEN=0,PIECE=2,C=","
D XCELHDR
D XCELCHDR
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 XCELROW(GLOBAL,VISITIEN,2,3,4)
D XCELFTR
Q
XCELHDR ;Excel XML Header
W "<?xml version="_""""_"1.0"_""""_"encoding="_""""_"utf-8"_""""_" ?>",!
W "<?mso-application progid="_""""_"Excel.Sheet"_""""_" ?>",!
W "<Workbook xmlns="_""""_"urn:schemas-microsoft-com:office:spreadsheet"_"""",!
W " xmlns:o="_""""_"urn:schemas-microsoft-com:office:office"_"""",!
W " xmlns:x="_""""_"urn:schemas-microsoft-com:office:excel"_"""",!
W " xmlns:rs="_""""_"urn:schemas-microsoft-com:rowset"_""""_" xmlns:z="_""""_"#RowsetSchema"_"""",!
W " xmlns:ss="_""""_"urn:schemas-microsoft-com:office:spreadsheet"_"""",!
W " xmlns:html="_""""_"http://www.w3.org/TR/REC-html40"_""""_">",!
W " <DocumentProperties xmlns="_""""_"urn:schemas-microsoft-com:office:office"_""""_">",!
W " <Author>"_$P(^VA(200,DUZ,0),U,1)_"</Author>",!
W " <LastAuthor>"_$P(^VA(200,DUZ,0),U,1)_"</LastAuthor>",!
D NOW^%DTC
W " <Created>"_$$XDT^BARDUTL(%)_"</Created>",!
W " <Version>15.00</Version>",!
W "</DocumentProperties>",!
W "<OfficeDocumentSettings xmlns="_""""_"urn:schemas-microsoft-com:office:office"_""""_">",!
W " <AllowPNG/>",!
W "</OfficeDocumentSettings>",!
W "<Styles>",! ;Identifies Style types being utilized in document
W " <Style ss:ID="_""""_"Default"_""""_" ss:Name="_""""_"Normal"_""""_">",!
W " <Alignment ss:Vertical="_""""_"Bottom"_""""_"/>",!
W " <Borders/>",!
W " <Font ss:FontName="_""""_"Calibri"_""""_" x:Family="_""""_"Swiss"_""""_" ss:Size="_""""_"11"_""""_" ss:Color="_""""_"#000000"_""""_"/>",!
W " <Interior/>",!
W " <NumberFormat/>",!
W " <Protection/>",!
W " </Style>",!
W " <Style ss:ID="_""""_"s62"_""""_">",!
W " <NumberFormat ss:Format="_""""_"Short Date"_""""_"/>",!
W " </Style>",!
W " <Style ss:ID="_""""_"s63"_""""_">",!
W " <NumberFormat ss:Format="_""""_"mmm\-y"_""""_"/>",!
W " </Style>",!
W " <Style ss:ID="_""""_"s64"_""""_">",!
W " <NumberFormat ss:Format="_""""_"m/d/yy\ h:mm;@"_""""_"/>",!
W " </Style>",!
W " <Style ss:ID="_""""_"s66"_""""_">",!
W " <Alignment ss:Horizontal="_""""_"Center"_""""_" ss:Vertical="_""""_"Bottom"_""""_"/>",!
W " </Style>",!
W "</Styles>",!
W "<Worksheet ss:Name="_""""_"DAYS Report Data"_""""_">",!
W " <Table x:FullColumns="_""""_"1"_""""_" x:FullRows="_""""_"1"_""""_" ss:DefaultRowHeight="_""""_"15"_""""_">",!
W " <Column ss:Width="_""""_"46.5"_""""_"/>",! ;May need to make dynamic, static for now
W " <Column ss:Width="_""""_"66.75"_""""_"/>",!
W " <Column ss:Width="_""""_"66"_""""_"/>",!
W " <Column ss:Width="_""""_"88.5"_""""_"/>",!
W " <Column ss:Width="_""""_"94.5"_""""_"/>",!
W " <Column ss:Width="_""""_"99.75"_""""_"/>",!
W " <Column ss:Width="_""""_"80.25"_""""_"/>",!
W " <Column ss:Width="_""""_"106.5"_""""_"/>",!
W " <Column ss:Width="_""""_"56.25"_""""_"/>",!
W " <Column ss:Width="_""""_"90.75"_""""_"/>",!
W " <Column ss:Width="_""""_"117"_""""_"/>",!
W " <Column ss:Width="_""""_"75.75"_""""_"/>",!
W " <Column ss:Width="_""""_"102"_""""_"/>",!
W " <Column ss:Width="_""""_"121.5"_""""_"/>",!
W " <Column ss:Width="_""""_"114"_""""_"/>",!
W " <Column ss:Width="_""""_"98.25"_""""_"/>",!
W " <Column ss:Width="_""""_"124.5"_""""_"/>",!
W " <Column ss:Width="_""""_"95.25"_""""_"/>",!
W " <Column ss:Width="_""""_"121.5"_""""_"/>",!
W " <Column ss:Width="_""""_"143.25"_""""_"/>",!
W " <Column ss:Width="_""""_"88.5"_""""_"/>",!
W " <Column ss:Width="_""""_"56.25"_""""_"/>",!
W " <Column ss:Width="_""""_"90.75"_""""_"/>",!
W " <Column ss:Width="_""""_"117"_""""_"/>",!
W " <Column ss:Width="_""""_"75.75"_""""_"/>",!
W " <Column ss:Width="_""""_"102"_""""_"/>",!
W " <Column ss:Width="_""""_"121.5"_""""_"/>",!
W " <Column ss:Width="_""""_"114"_""""_"/>",!
W " <Column ss:Width="_""""_"98.25"_""""_"/>",!
W " <Column ss:Width="_""""_"124.5"_""""_"/>",!
W " <Column ss:Width="_""""_"95.25"_""""_"/>",!
W " <Column ss:Width="_""""_"121.5"_""""_"/>",!
W " <Column ss:Width="_""""_"114.75"_""""_"/>",!
W " <Column ss:Width="_""""_"88.5"_""""_"/>",!
Q
XCELFTR ;Excel XML footer
W " </Table>",!
W " <WorksheetOptions xmlns="_""""_"urn:schemas-microsoft-com:office:excel"_""""_">",!
W " <Unsynced/>",!
W " <Selected/>",!
W " <FreezePanes/>",!
W " <FrozenNoSplit/>",!
W " <SplitHorizontal>8</SplitHorizontal>",!
W " <TopRowBottomPane>8</TopRowBottomPane>",!
W " <SplitVertical>1</SplitVertical>",!
W " <LeftColumnRightPane>1</LeftColumnRightPane>",!
W " <ActivePane>0</ActivePane>",!
W " <Panes>",!
W " <Pane>",!
W " <Number>3</Number>",!
W " </Pane>",!
W " <Pane>",!
W " <Number>1</Number>",!
W " </Pane>",!
W " <Pane>",!
W " <Number>2</Number>",!
W " </Pane>",!
W " <Pane>",!
W " <Number>0</Number>",!
W " </Pane>",!
W " </Panes>",!
W " <ProtectObjects>False</ProtectObjects>",!
W " <ProtectScenarios>False</ProtectScenarios>",!
W " </WorksheetOptions>",!
W " </Worksheet>",!
W "</Workbook>",!
Q
XCELCHDR ;Generate Column Headers
K COLHDR
D XCELBANR
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)
W "<Row ss:AutoFitHeight="_""""_"0"_""""_">",!
S I="",J=0
F S I=$O(COLHDR(I)) Q:I="" D
.S J=J+1
.W "<Cell ss:Index="_""""_J_""""_"><Data ss:Type="_""""_"String"_""""_">"
.W COLHDR(I)
.W "</Data></Cell>",!
W "</Row>",!
Q
;
XCELROW(GLOBAL,ROW,PIECE,FORMAT,STYLE) ;Generate Excel XML 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") - PASS BY REFERENCE
;Example ROW - 149550
;Example PIECE - 2
;Example FORMAT - 3
;Example Style - 4
S BARCOL=0
W "<Row ss:AutoFitHeight="_""""_"0"_""""_">",!
S J=""
F S J=$O(@GLOBAL@(ROW,J)) Q:J="" D
.S BARCOL=BARCOL+1
.I $P(@GLOBAL@(ROW,J),U,PIECE)=0!($P(@GLOBAL@(ROW,J),U,PIECE)="") Q
.W "<Cell ss:Index="_""""_BARCOL_""""
.I $P(@GLOBAL@(ROW,J),U,STYLE)'="" W " ss:StyleID="_""""_$P(@GLOBAL@(ROW,J),U,STYLE)_""""
.W "><Data ss:Type="
.W $S($P(@GLOBAL@(ROW,J),U,FORMAT)="N":""""_"Number"_"""",$P(@GLOBAL@(ROW,J),U,FORMAT)="D":""""_"DateTime"_"""",1:""""_"String"_"""")_">"
.W $P(@GLOBAL@(ROW,J),U,PIECE)
.W "</Data></Cell>",!
W "</Row>",!
Q
XCELBANR ; 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 STYLE66($P(Y,":",1,2))
D STYLE66("WARNING: Confidential Patient Information, Privacy Act Applies")
K BAR("LINE")
S $P(BAR("LINE"),"=",70)=""
D STYLE66(BAR("LINE"))
D STYLE66(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")))]"" STYLE66(BAR("HD",BAR("TMPLVL")))
D STYLE66(BAR("LINE"))
K BAR("LINE")
Q
STYLE66(X) ;Method to format/output merged cells
W "<Row ss:AutoFitHeight="_""""_"0"_""""_">"
W " <Cell ss:MergeAcross="_""""_"10"_""""_" ss:StyleID="_""""_"s66"_""""_"><Data ss:Type="_""""_"String"_""""_">"
W X
W "</Data></Cell>",!
W "</Row>",!
Q
BARDYSV9 ; 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 ;
ROWTOCOL(VISITIEN,BARREC) ;Scans global created by Days report and creates appropriate number of column headers
+1 ;Piece 1 = Column Name
+2 ;Piece 2 = Data element
+3 ;Piece 3 = format code: N=Number, S=String, D=Date
+4 ;Piece 4 = StyleID
+5 SET ^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",VISITIEN,1)="VISIT IEN"_U_$PIECE(BARREC,U,1)_U_"N"
+6 SET ^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",VISITIEN,2)="MONTH YEAR"_U_$PIECE(BARREC,U,2)_U_"D"_U_"s63"
+7 SET ^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",VISITIEN,3)="VISIT LOC"_U_$PIECE(BARREC,U,3)_U_"S"
+8 SET ^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",VISITIEN,4)="VISIT ADMIT DATE"_U_$PIECE(BARREC,U,4)_U_"D"_U_"s62"
+9 SET ^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",VISITIEN,5)="DATE CREATED PCC"_U_$PIECE(BARREC,U,5)_U_"D"_U_"s62"
+10 SET ^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",VISITIEN,6)="CREATED NUM DAYS"_U_$PIECE(BARREC,U,6)_U_"N"
+11 SET ^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",VISITIEN,7)="DATE REVIEWED"_U_$PIECE(BARREC,U,7)_U_"D"_U_"s62"
+12 SET ^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",VISITIEN,8)="REVIEWED NUM DAYS"_U_$PIECE(BARREC,U,8)_U_"N"
+13 SET BARBILLS=$PIECE(BARREC,U,9)
SET I=""
+14 FOR I=1:1:$LENGTH(BARBILLS,"~")
Begin DoDot:1
+15 SET BARBILL=$PIECE(BARBILLS,"~",I)
+16 SET ^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+9)="BILL NUM "_I_U_$PIECE(BARBILL,";",1)_U_"S"
+17 SET ^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+10)="APPROVAL DATE "_I_U_$PIECE(BARBILL,";",2)_U_"D"_U_"s62"
+18 SET ^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+11)="APPROVAL NUM DAYS "_I_U_$PIECE(BARBILL,";",3)_U_"N"
+19 SET ^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+12)="EXPORT DATE "_I_U_$PIECE(BARBILL,";",4)_U_"D"_U_"s62"
+20 SET ^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+13)="EXPORT NUM DAYS "_I_U_$PIECE(BARBILL,";",5)_U_"N"
+21 SET ^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+14)="FINALIZED BATCH DATE "_I_U_$PIECE(BARBILL,";",6)_U_"D"_U_"s62"
+22 SET ^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+15)="FINALIZED NUM DAYS "_I_U_$PIECE(BARBILL,";",7)_U_"N"
+23 SET ^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+16)="FIRST TRANS DATE "_I_U_$PIECE(BARBILL,";",8)_U_"D"_U_"s62"
+24 SET ^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+17)="FIRST TRANS NUM DAYS "_I_U_$PIECE(BARBILL,";",9)_U_"N"
+25 SET ^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+18)="LAST TRANS DATE "_I_U_$PIECE(BARBILL,";",10)_U_"D"_U_"s62"
+26 SET ^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+19)="LAST TRANS NUM DAYS "_I_U_$PIECE(BARBILL,";",11)_U_"N"
+27 SET ^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+20)="PROVIDER "_I_U_$PIECE(BARBILL,";",12)_U_"S"
+28 SET ^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",VISITIEN,100*I+21)="BILLED AMOUNT "_I_U_$PIECE(BARBILL,";",13)_U_"N"
End DoDot:1
+29 QUIT
PRTXML ;Walks through data and outputs data elements
+1 SET GLOBAL=""
SET VISITIEN=0
SET PIECE=2
SET C=","
+2 DO XCELHDR
+3 DO XCELCHDR
+4 FOR
SET VISITIEN=$ORDER(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DET","COL",VISITIEN))
IF +VISITIEN=0
QUIT
Begin DoDot:1
+5 SET GLOBAL="^XTMP("_""""_"BARDYSVS"_""""_C_$JOB_C_""""_"DAYS TO COL VISIT"_""""_C_""""_"DET"_""""_C_""""_"COL"_""""_")"
+6 DO XCELROW(GLOBAL,VISITIEN,2,3,4)
End DoDot:1
+7 DO XCELFTR
+8 QUIT
XCELHDR ;Excel XML Header
+1 WRITE "<?xml version="_""""_"1.0"_""""_"encoding="_""""_"utf-8"_""""_" ?>",!
+2 WRITE "<?mso-application progid="_""""_"Excel.Sheet"_""""_" ?>",!
+3 WRITE "<Workbook xmlns="_""""_"urn:schemas-microsoft-com:office:spreadsheet"_"""",!
+4 WRITE " xmlns:o="_""""_"urn:schemas-microsoft-com:office:office"_"""",!
+5 WRITE " xmlns:x="_""""_"urn:schemas-microsoft-com:office:excel"_"""",!
+6 WRITE " xmlns:rs="_""""_"urn:schemas-microsoft-com:rowset"_""""_" xmlns:z="_""""_"#RowsetSchema"_"""",!
+7 WRITE " xmlns:ss="_""""_"urn:schemas-microsoft-com:office:spreadsheet"_"""",!
+8 WRITE " xmlns:html="_""""_"http://www.w3.org/TR/REC-html40"_""""_">",!
+9 WRITE " <DocumentProperties xmlns="_""""_"urn:schemas-microsoft-com:office:office"_""""_">",!
+10 WRITE " <Author>"_$PIECE(^VA(200,DUZ,0),U,1)_"</Author>",!
+11 WRITE " <LastAuthor>"_$PIECE(^VA(200,DUZ,0),U,1)_"</LastAuthor>",!
+12 DO NOW^%DTC
+13 WRITE " <Created>"_$$XDT^BARDUTL(%)_"</Created>",!
+14 WRITE " <Version>15.00</Version>",!
+15 WRITE "</DocumentProperties>",!
+16 WRITE "<OfficeDocumentSettings xmlns="_""""_"urn:schemas-microsoft-com:office:office"_""""_">",!
+17 WRITE " <AllowPNG/>",!
+18 WRITE "</OfficeDocumentSettings>",!
+19 ;Identifies Style types being utilized in document
WRITE "<Styles>",!
+20 WRITE " <Style ss:ID="_""""_"Default"_""""_" ss:Name="_""""_"Normal"_""""_">",!
+21 WRITE " <Alignment ss:Vertical="_""""_"Bottom"_""""_"/>",!
+22 WRITE " <Borders/>",!
+23 WRITE " <Font ss:FontName="_""""_"Calibri"_""""_" x:Family="_""""_"Swiss"_""""_" ss:Size="_""""_"11"_""""_" ss:Color="_""""_"#000000"_""""_"/>",!
+24 WRITE " <Interior/>",!
+25 WRITE " <NumberFormat/>",!
+26 WRITE " <Protection/>",!
+27 WRITE " </Style>",!
+28 WRITE " <Style ss:ID="_""""_"s62"_""""_">",!
+29 WRITE " <NumberFormat ss:Format="_""""_"Short Date"_""""_"/>",!
+30 WRITE " </Style>",!
+31 WRITE " <Style ss:ID="_""""_"s63"_""""_">",!
+32 WRITE " <NumberFormat ss:Format="_""""_"mmm\-y"_""""_"/>",!
+33 WRITE " </Style>",!
+34 WRITE " <Style ss:ID="_""""_"s64"_""""_">",!
+35 WRITE " <NumberFormat ss:Format="_""""_"m/d/yy\ h:mm;@"_""""_"/>",!
+36 WRITE " </Style>",!
+37 WRITE " <Style ss:ID="_""""_"s66"_""""_">",!
+38 WRITE " <Alignment ss:Horizontal="_""""_"Center"_""""_" ss:Vertical="_""""_"Bottom"_""""_"/>",!
+39 WRITE " </Style>",!
+40 WRITE "</Styles>",!
+41 WRITE "<Worksheet ss:Name="_""""_"DAYS Report Data"_""""_">",!
+42 WRITE " <Table x:FullColumns="_""""_"1"_""""_" x:FullRows="_""""_"1"_""""_" ss:DefaultRowHeight="_""""_"15"_""""_">",!
+43 ;May need to make dynamic, static for now
WRITE " <Column ss:Width="_""""_"46.5"_""""_"/>",!
+44 WRITE " <Column ss:Width="_""""_"66.75"_""""_"/>",!
+45 WRITE " <Column ss:Width="_""""_"66"_""""_"/>",!
+46 WRITE " <Column ss:Width="_""""_"88.5"_""""_"/>",!
+47 WRITE " <Column ss:Width="_""""_"94.5"_""""_"/>",!
+48 WRITE " <Column ss:Width="_""""_"99.75"_""""_"/>",!
+49 WRITE " <Column ss:Width="_""""_"80.25"_""""_"/>",!
+50 WRITE " <Column ss:Width="_""""_"106.5"_""""_"/>",!
+51 WRITE " <Column ss:Width="_""""_"56.25"_""""_"/>",!
+52 WRITE " <Column ss:Width="_""""_"90.75"_""""_"/>",!
+53 WRITE " <Column ss:Width="_""""_"117"_""""_"/>",!
+54 WRITE " <Column ss:Width="_""""_"75.75"_""""_"/>",!
+55 WRITE " <Column ss:Width="_""""_"102"_""""_"/>",!
+56 WRITE " <Column ss:Width="_""""_"121.5"_""""_"/>",!
+57 WRITE " <Column ss:Width="_""""_"114"_""""_"/>",!
+58 WRITE " <Column ss:Width="_""""_"98.25"_""""_"/>",!
+59 WRITE " <Column ss:Width="_""""_"124.5"_""""_"/>",!
+60 WRITE " <Column ss:Width="_""""_"95.25"_""""_"/>",!
+61 WRITE " <Column ss:Width="_""""_"121.5"_""""_"/>",!
+62 WRITE " <Column ss:Width="_""""_"143.25"_""""_"/>",!
+63 WRITE " <Column ss:Width="_""""_"88.5"_""""_"/>",!
+64 WRITE " <Column ss:Width="_""""_"56.25"_""""_"/>",!
+65 WRITE " <Column ss:Width="_""""_"90.75"_""""_"/>",!
+66 WRITE " <Column ss:Width="_""""_"117"_""""_"/>",!
+67 WRITE " <Column ss:Width="_""""_"75.75"_""""_"/>",!
+68 WRITE " <Column ss:Width="_""""_"102"_""""_"/>",!
+69 WRITE " <Column ss:Width="_""""_"121.5"_""""_"/>",!
+70 WRITE " <Column ss:Width="_""""_"114"_""""_"/>",!
+71 WRITE " <Column ss:Width="_""""_"98.25"_""""_"/>",!
+72 WRITE " <Column ss:Width="_""""_"124.5"_""""_"/>",!
+73 WRITE " <Column ss:Width="_""""_"95.25"_""""_"/>",!
+74 WRITE " <Column ss:Width="_""""_"121.5"_""""_"/>",!
+75 WRITE " <Column ss:Width="_""""_"114.75"_""""_"/>",!
+76 WRITE " <Column ss:Width="_""""_"88.5"_""""_"/>",!
+77 QUIT
XCELFTR ;Excel XML footer
+1 WRITE " </Table>",!
+2 WRITE " <WorksheetOptions xmlns="_""""_"urn:schemas-microsoft-com:office:excel"_""""_">",!
+3 WRITE " <Unsynced/>",!
+4 WRITE " <Selected/>",!
+5 WRITE " <FreezePanes/>",!
+6 WRITE " <FrozenNoSplit/>",!
+7 WRITE " <SplitHorizontal>8</SplitHorizontal>",!
+8 WRITE " <TopRowBottomPane>8</TopRowBottomPane>",!
+9 WRITE " <SplitVertical>1</SplitVertical>",!
+10 WRITE " <LeftColumnRightPane>1</LeftColumnRightPane>",!
+11 WRITE " <ActivePane>0</ActivePane>",!
+12 WRITE " <Panes>",!
+13 WRITE " <Pane>",!
+14 WRITE " <Number>3</Number>",!
+15 WRITE " </Pane>",!
+16 WRITE " <Pane>",!
+17 WRITE " <Number>1</Number>",!
+18 WRITE " </Pane>",!
+19 WRITE " <Pane>",!
+20 WRITE " <Number>2</Number>",!
+21 WRITE " </Pane>",!
+22 WRITE " <Pane>",!
+23 WRITE " <Number>0</Number>",!
+24 WRITE " </Pane>",!
+25 WRITE " </Panes>",!
+26 WRITE " <ProtectObjects>False</ProtectObjects>",!
+27 WRITE " <ProtectScenarios>False</ProtectScenarios>",!
+28 WRITE " </WorksheetOptions>",!
+29 WRITE " </Worksheet>",!
+30 WRITE "</Workbook>",!
+31 QUIT
XCELCHDR ;Generate Column Headers
+1 KILL COLHDR
+2 DO XCELBANR
+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 WRITE "<Row ss:AutoFitHeight="_""""_"0"_""""_">",!
+8 SET I=""
SET J=0
+9 FOR
SET I=$ORDER(COLHDR(I))
IF I=""
QUIT
Begin DoDot:1
+10 SET J=J+1
+11 WRITE "<Cell ss:Index="_""""_J_""""_"><Data ss:Type="_""""_"String"_""""_">"
+12 WRITE COLHDR(I)
+13 WRITE "</Data></Cell>",!
End DoDot:1
+14 WRITE "</Row>",!
+15 QUIT
+16 ;
XCELROW(GLOBAL,ROW,PIECE,FORMAT,STYLE) ;Generate Excel XML 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") - PASS BY REFERENCE
+3 ;Example ROW - 149550
+4 ;Example PIECE - 2
+5 ;Example FORMAT - 3
+6 ;Example Style - 4
+7 SET BARCOL=0
+8 WRITE "<Row ss:AutoFitHeight="_""""_"0"_""""_">",!
+9 SET J=""
+10 FOR
SET J=$ORDER(@GLOBAL@(ROW,J))
IF J=""
QUIT
Begin DoDot:1
+11 SET BARCOL=BARCOL+1
+12 IF $PIECE(@GLOBAL@(ROW,J),U,PIECE)=0!($PIECE(@GLOBAL@(ROW,J),U,PIECE)="")
QUIT
+13 WRITE "<Cell ss:Index="_""""_BARCOL_""""
+14 IF $PIECE(@GLOBAL@(ROW,J),U,STYLE)'=""
WRITE " ss:StyleID="_""""_$PIECE(@GLOBAL@(ROW,J),U,STYLE)_""""
+15 WRITE "><Data ss:Type="
+16 WRITE $SELECT($PIECE(@GLOBAL@(ROW,J),U,FORMAT)="N":""""_"Number"_"""",$PIECE(@GLOBAL@(ROW,J),U,FORMAT)="D":""""_"DateTime"_"""",1:""""_"String"_"""")_">"
+17 WRITE $PIECE(@GLOBAL@(ROW,J),U,PIECE)
+18 WRITE "</Data></Cell>",!
End DoDot:1
+19 WRITE "</Row>",!
+20 QUIT
XCELBANR ; 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 STYLE66($PIECE(Y,":",1,2))
+10 DO STYLE66("WARNING: Confidential Patient Information, Privacy Act Applies")
+11 KILL BAR("LINE")
+12 SET $PIECE(BAR("LINE"),"=",70)=""
+13 DO STYLE66(BAR("LINE"))
+14 DO STYLE66(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 STYLE66(BAR("HD",BAR("TMPLVL")))
+17 DO STYLE66(BAR("LINE"))
+18 KILL BAR("LINE")
+19 QUIT
STYLE66(X) ;Method to format/output merged cells
+1 WRITE "<Row ss:AutoFitHeight="_""""_"0"_""""_">"
+2 WRITE " <Cell ss:MergeAcross="_""""_"10"_""""_" ss:StyleID="_""""_"s66"_""""_"><Data ss:Type="_""""_"String"_""""_">"
+3 WRITE X
+4 WRITE "</Data></Cell>",!
+5 WRITE "</Row>",!
+6 QUIT