BARDYSCL ; IHS/SD/TPF - DAYS IN A/R REPORT MAIN DRIVER ;
;;1.8;IHS ACCOUNTS RECEIVABLE;**16,28**;OCT 26, 2005;Build 92
;IHS/SD/SDR - 1.8*27 - CR8345 HEAT 224215 - Added prompt for comma-delimited file. Added prompt for summary or detail (new).
;IHS/DIT/CPC - 1.8*28 - CR8345 - Changed delimited file format, added spreadsheet XML option
;
Q
START ;
K BARY,BAR
D:'$D(BARUSR) INIT^BARUTL ; Setup basic A/R variables
S BARP("RTN")="BARDYSCL" ; Routine used to get data
S BAR("PRIVACY")=1 ; Privacy act applies
S BAR("LOC")=$$GET1^DIQ(90052.06,DUZ(2),16) ; BILLING or VISIT
I BAR("LOC")="" S BAR("LOC")="VISIT"
S BARMENU="Days in AR" ;This is overwritten in BARRSEL
S BAR("OPT")="DAYS" ;This is overwritten in BARRSEL
S:'$G(XQY0) XQY0="BAR RPT DAYS IN AR^Days in AR^^R^^^^^^^^^^1^1"
SEL ;
K DTOUT,DIRUT,DUOUT
D ^BARRSEL ; Select exclusion parameters
I $D(DTOUT)!$D(DUOUT)!$D(DIRUT) Q
I $D(BARY("RTYP")) S BAR("HD",0)=BARY("RTYP","NM")_" "_BARMENU
E S BAR("HD",0)=BARMENU
S BARY("STCR")=5 ;allow all allowance categories
;start new bar*1.8*28 IHS/SD/SDR HEAT224215
W !
D ^XBFMK
S DIR(0)="S^S:SUMMARY;D:DETAIL"
S DIR("A")="SUMMARY OR DETAIL REPORT"
S DIR("B")="SUMMARY"
D ^DIR
I $D(DTOUT)!$D(DUOUT)!$D(DIRUT) Q
S BARY("SUMORDET")=Y
I BARY("SUMORDET")="D" D
.K DIR
.S DIR(0)="S^D:DELIMITED;X:XML"
.S DIR("A")="Please select DELIMITED file or a spreadsheet XML file"
.S DIR("B")="DELIMITED"
.D ^DIR
.I $D(DTOUT)!$D(DUOUT)!$D(DIRUT) G SEL
.S BARY("CSV")=Y
.I BARY("CSV")="X" K BARY("CSV") S BARY("XML")=1
.W !!,"NOTE: the DETAIL should be written to a HFS host file. ",!
.W:$D(BARY("XML")) "The report is in spreadsheet XML format so please use an xml ",!
.W:$D(BARY("XML")) "suffix on the file name.",!
.W:$D(BARY("XML")) "i.e. 'c:\temp\daysreport.xml'",!!
.D:$D(BARY("XML")) PAZ^BARRUTL
;
I BARY("SUMORDET")="S" D
.D ^XBFMK
.S DIR(0)="Y"
.S DIR("?")=" YES should be written to a host file (HFS) and import into excel"
.S DIR("?",1)=" NO will print to a 132-column printer"
.S DIR("A")="DELIMITED"
.S DIR("B")="NO"
.D ^DIR
.I $D(DTOUT)!$D(DUOUT)!$D(DIRUT) Q
.S BARY("COMMADELIM")=Y
;end new bar*1.8*28 IHS/SD/SDR HEAT224215
D ^BARRHD ; Report header
S BARQ("RC")="COMPUTE^BARDYSCL" ; Compute routine
S BARQ("RP")="PRINT^BARDYSCL"
;I XQY0["Days to Bill by Visit Range of Approved Bills" D
;.S BARQ("RP")="PRINTAPP^BARDYSPR" ; Print routine
;E S BARQ("RP")="PRINTVIS^BARDYSPR"
S BARQ("NS")="BAR" ; Namespace for variables
S BARQ("RX")="POUT^BARRUTL" ; Clean-up routine
;D ^BARDBQUE ; Double queuing
S %ZIS="QM"
D ^%ZIS Q:POP
I $D(IO("Q")) D Q
.S ZTRTN="COMPUTE^BARDYSCL",ZTDESC=XQY0
.S ZTSAVE("BAR*")=""
.D ^%ZTLOAD
.I $D(ZTSK)[0 W !!?5,"Report Cancelled!"
.E W !!?5,"Report queued to run on ",ZTSK," #"
.D HOME^%ZIS
.K IO("Q")
D COMPUTE
Q
PRINT ;
Q
COMPUTE ;
U IO
;search by visit date range
I BARY("DT")="V" D BYVISIT^BARDYSVS(BARY("DT",1),BARY("DT",2)) Q
;SEARCH BY APPROVAL DATE RANGE
I BARY("DT")="A" D BYAPPDT^BARDYSAP(BARY("DT",1),BARY("DT",2)) Q
;SEARCH BY EXPORT NUMBER FIELD .17 DATE RANGE ?
;I BARY("DT")="X" S TOTVSIT=$$EXPRANG(BARY("DT",1),BARY("DT",2)) Q
Q
BARDYSCL ; IHS/SD/TPF - DAYS IN A/R REPORT MAIN DRIVER ;
+1 ;;1.8;IHS ACCOUNTS RECEIVABLE;**16,28**;OCT 26, 2005;Build 92
+2 ;IHS/SD/SDR - 1.8*27 - CR8345 HEAT 224215 - Added prompt for comma-delimited file. Added prompt for summary or detail (new).
+3 ;IHS/DIT/CPC - 1.8*28 - CR8345 - Changed delimited file format, added spreadsheet XML option
+4 ;
+5 QUIT
START ;
+1 KILL BARY,BAR
+2 ; Setup basic A/R variables
IF '$DATA(BARUSR)
DO INIT^BARUTL
+3 ; Routine used to get data
SET BARP("RTN")="BARDYSCL"
+4 ; Privacy act applies
SET BAR("PRIVACY")=1
+5 ; BILLING or VISIT
SET BAR("LOC")=$$GET1^DIQ(90052.06,DUZ(2),16)
+6 IF BAR("LOC")=""
SET BAR("LOC")="VISIT"
+7 ;This is overwritten in BARRSEL
SET BARMENU="Days in AR"
+8 ;This is overwritten in BARRSEL
SET BAR("OPT")="DAYS"
+9 IF '$GET(XQY0)
SET XQY0="BAR RPT DAYS IN AR^Days in AR^^R^^^^^^^^^^1^1"
SEL ;
+1 KILL DTOUT,DIRUT,DUOUT
+2 ; Select exclusion parameters
DO ^BARRSEL
+3 IF $DATA(DTOUT)!$DATA(DUOUT)!$DATA(DIRUT)
QUIT
+4 IF $DATA(BARY("RTYP"))
SET BAR("HD",0)=BARY("RTYP","NM")_" "_BARMENU
+5 IF '$TEST
SET BAR("HD",0)=BARMENU
+6 ;allow all allowance categories
SET BARY("STCR")=5
+7 ;start new bar*1.8*28 IHS/SD/SDR HEAT224215
+8 WRITE !
+9 DO ^XBFMK
+10 SET DIR(0)="S^S:SUMMARY;D:DETAIL"
+11 SET DIR("A")="SUMMARY OR DETAIL REPORT"
+12 SET DIR("B")="SUMMARY"
+13 DO ^DIR
+14 IF $DATA(DTOUT)!$DATA(DUOUT)!$DATA(DIRUT)
QUIT
+15 SET BARY("SUMORDET")=Y
+16 IF BARY("SUMORDET")="D"
Begin DoDot:1
+17 KILL DIR
+18 SET DIR(0)="S^D:DELIMITED;X:XML"
+19 SET DIR("A")="Please select DELIMITED file or a spreadsheet XML file"
+20 SET DIR("B")="DELIMITED"
+21 DO ^DIR
+22 IF $DATA(DTOUT)!$DATA(DUOUT)!$DATA(DIRUT)
GOTO SEL
+23 SET BARY("CSV")=Y
+24 IF BARY("CSV")="X"
KILL BARY("CSV")
SET BARY("XML")=1
+25 WRITE !!,"NOTE: the DETAIL should be written to a HFS host file. ",!
+26 IF $DATA(BARY("XML"))
WRITE "The report is in spreadsheet XML format so please use an xml ",!
+27 IF $DATA(BARY("XML"))
WRITE "suffix on the file name.",!
+28 IF $DATA(BARY("XML"))
WRITE "i.e. 'c:\temp\daysreport.xml'",!!
+29 IF $DATA(BARY("XML"))
DO PAZ^BARRUTL
End DoDot:1
+30 ;
+31 IF BARY("SUMORDET")="S"
Begin DoDot:1
+32 DO ^XBFMK
+33 SET DIR(0)="Y"
+34 SET DIR("?")=" YES should be written to a host file (HFS) and import into excel"
+35 SET DIR("?",1)=" NO will print to a 132-column printer"
+36 SET DIR("A")="DELIMITED"
+37 SET DIR("B")="NO"
+38 DO ^DIR
+39 IF $DATA(DTOUT)!$DATA(DUOUT)!$DATA(DIRUT)
QUIT
+40 SET BARY("COMMADELIM")=Y
End DoDot:1
+41 ;end new bar*1.8*28 IHS/SD/SDR HEAT224215
+42 ; Report header
DO ^BARRHD
+43 ; Compute routine
SET BARQ("RC")="COMPUTE^BARDYSCL"
+44 SET BARQ("RP")="PRINT^BARDYSCL"
+45 ;I XQY0["Days to Bill by Visit Range of Approved Bills" D
+46 ;.S BARQ("RP")="PRINTAPP^BARDYSPR" ; Print routine
+47 ;E S BARQ("RP")="PRINTVIS^BARDYSPR"
+48 ; Namespace for variables
SET BARQ("NS")="BAR"
+49 ; Clean-up routine
SET BARQ("RX")="POUT^BARRUTL"
+50 ;D ^BARDBQUE ; Double queuing
+51 SET %ZIS="QM"
+52 DO ^%ZIS
IF POP
QUIT
+53 IF $DATA(IO("Q"))
Begin DoDot:1
+54 SET ZTRTN="COMPUTE^BARDYSCL"
SET ZTDESC=XQY0
+55 SET ZTSAVE("BAR*")=""
+56 DO ^%ZTLOAD
+57 IF $DATA(ZTSK)[0
WRITE !!?5,"Report Cancelled!"
+58 IF '$TEST
WRITE !!?5,"Report queued to run on ",ZTSK," #"
+59 DO HOME^%ZIS
+60 KILL IO("Q")
End DoDot:1
QUIT
+61 DO COMPUTE
+62 QUIT
PRINT ;
+1 QUIT
COMPUTE ;
+1 USE IO
+2 ;search by visit date range
+3 IF BARY("DT")="V"
DO BYVISIT^BARDYSVS(BARY("DT",1),BARY("DT",2))
QUIT
+4 ;SEARCH BY APPROVAL DATE RANGE
+5 IF BARY("DT")="A"
DO BYAPPDT^BARDYSAP(BARY("DT",1),BARY("DT",2))
QUIT
+6 ;SEARCH BY EXPORT NUMBER FIELD .17 DATE RANGE ?
+7 ;I BARY("DT")="X" S TOTVSIT=$$EXPRANG(BARY("DT",1),BARY("DT",2)) Q
+8 QUIT