- FBAAIAR2 ;ALB/FA - Fee IPAC Vendor DoD Invoice Inquiry Report Print ;1/16/2014
- ;;3.5;FEE BASIS;**123**;JAN 30, 1995;Build 51
- ;;Per VA Directive 6402, this routine should not be modified.
- ;
- ; Scratch global built by FBAAIAR.
- ; Type - 'O'utpatient,'I'npatient,Inpatient 'A'ncillary, 'P'harmacy
- ; XX - Unique identifier to allow for multiple Outpatient/Ancillary payments on the
- ; same invoice. 0 for Inpatient or Pharmacy
- ; ^TMP("FBAAIAR1",$J, Vendor Name,Type,VistA Invoice#) = A1^A2^A3^...^A5 Where:
- ; A1 - Type of Record (Cancelled, Void, Reject, Purge, "", or some combination)
- ; A2 - Date Paid (Fileman format)
- ; A3 - Total amount claimed
- ; A4 - Total amount paid
- ; A5 - Total adjustment amount
- ; ^TMP("FBAAIAR1",$J,Vendor Name) = A1^A2^...^A4 Where:
- ; A1 - Total amount claimed for DoD Invoice Vendor
- ; A2 - Total amount paid for DoD Invoice Vendor
- ; A3 - Total adjustment amount DoD Invoice Vendor
- ; A4 - Total number of invoices for the DoD Invoice Vendor
- ; ^TMP("FBAAIAR1",$J,Vendor Name, Type) = A1^A2^...^A4 Where:
- ; A1 - Total amount claimed for DoD Invoice Vendor by type
- ; A2 - Total amount paid for DoD Invoice Vendor by type
- ; A3 - Total adjustment amount DoD Invoice Vendor by type
- ; A4 - Total number of invoices for the DoD Invoice Vendor by type
- ;
- ;-----------------------------------------------------------------------------
- ; Entry Points
- ; PRINT - DoD Invoice Inquiry Report - PRINT report
- ;-----------------------------------------------------------------------------
- ;
- Q
- ;
- PRINT(FBDODINV,FBFORMAT) ;EP
- ; Entry point for printing the report
- ; Input: FBDODINV - Selected DoD Invoice number
- ; FBFORMAT - 1 - CSV format, 0 otherwise
- ; ZTQUEUE - Defined if report was queued
- ; undefined otherwise
- ; ZSTOP - Defined and 1 if compilation was stopped
- ; 0 or undefined otherwise
- ; ^TMP("FBAAIAR1",$J) - Described in full above
- ; Output: Report is printed
- ; Called From: COMPILE@FBAAIAR1
- ;
- N CRT,DIR,DIROUT,DIRUT,DTOUT,DUOUT,INVDOD,FBIASTOP,IDATA,ITYPE,INVNUM
- N LVNAME,PAGE,SEPLINE,VNAME,X,XX,Y
- S LVNAME="",VNAME=""
- S CRT=$S(IOST["C-":1,1:0) ; 1 - Print to Screen, 0 - Otherwise
- S:FBFORMAT IOSL=999999 ; Long screen length for Excel output
- S PAGE=0,FBIASTOP=0,$P(SEPLINE,"-",81)=""
- I '$D(^TMP("FBAAIAR1",$J)) D Q ; No data was compiled
- . D HDR(FBDODINV,VNAME,CRT,.PAGE,.FBIASTOP)
- . W !!?5,"No data found for this report."
- . I CRT,'$D(ZTQUEUED) D
- . . S DIR(0)="E"
- . . D ^DIR
- ;
- I $G(ZTSTOP) D Q ; Compilation was halted
- . D HDR(FBDODINV,VNAME,CRT,.PAGE,.FBIASTOP)
- . W !!?5,"This report was halted during compilation by TaskManager Request."
- . I CRT,'$D(ZTQUEUED) D
- . . S DIR(0)="E"
- . . D ^DIR
- ;
- ; Gather headers for excel spreadsheet
- D:FBFORMAT HDR(FBDODINV,"",CRT,.PAGE,.FBIASTOP)
- Q:FBIASTOP
- ;
- S VNAME=""
- F D Q:(VNAME="")!(FBIASTOP)
- . S VNAME=$O(^TMP("FBAAIAR1",$J,VNAME))
- . Q:VNAME=""
- . S LVNAME=VNAME
- . ;
- . ; Display header if not in CSV format
- . D:'FBFORMAT HDR(FBDODINV,VNAME,CRT,.PAGE,.FBIASTOP)
- . S ITYPE=""
- . F D Q:(ITYPE="")!(FBIASTOP)
- . . S ITYPE=$O(^TMP("FBAAIAR1",$J,VNAME,ITYPE))
- . . Q:(ITYPE="")!FBIASTOP
- . . S INVNUM=""
- . . F D Q:(INVNUM="")!(FBIASTOP)
- . . . S INVNUM=$O(^TMP("FBAAIAR1",$J,VNAME,ITYPE,INVNUM))
- . . . Q:(INVNUM="")!FBIASTOP
- . . . S XX=""
- . . . F D Q:(XX="")!(FBIASTOP)
- . . . . S XX=$O(^TMP("FBAAIAR1",$J,VNAME,ITYPE,INVNUM,XX))
- . . . . Q:XX=""
- . . . . S IDATA=$G(^TMP("FBAAIAR1",$J,VNAME,ITYPE,INVNUM,XX))
- . . . . ;
- . . . . ; Excel output - Print a CSV format record
- . . . . I FBFORMAT D EXCELN(ITYPE,INVNUM,IDATA) Q
- . . . . ;
- . . . . I $Y+4>IOSL,'FBFORMAT D Q:FBIASTOP ; Page break check
- . . . . . D HDR(FBDODINV,VNAME,CRT,.PAGE,.FBIASTOP)
- . . . . W !,$$LJ^XLFSTR(INVNUM,22) ; VistA Invoice#
- . . . . W ?25,$$RJ^XLFSTR(ITYPE,4) ; Record Type
- . . . . W ?32,$P(IDATA,U,1) ; C/V/R
- . . . . W ?40,$$LJ^XLFSTR($$FMTE^XLFDT($P(IDATA,U,2),"2DZ"),10) ; Paid Date
- . . . . W ?50,$$RJ^XLFSTR("$"_$FN($P(IDATA,U,3),"",0),8) ; Amount Claimed
- . . . . W ?60,$$RJ^XLFSTR("$"_$FN($P(IDATA,U,4),"",0),8) ; Amount Paid
- . . . . W ?70,$$RJ^XLFSTR("$"_$FN($P(IDATA,U,5),"",0),8) ; Adjustment Amount
- . . ;
- . . Q:FBIASTOP
- . . D:'FBFORMAT TYPETOT(FBDODINV,VNAME,FBFORMAT,ITYPE,.PAGE,.FBIASTOP) ; Totals by record type
- . ;
- . Q:FBIASTOP
- . D:'FBFORMAT VTOT(FBDODINV,VNAME,FBFORMAT,.PAGE,.FBIASTOP) ; Totals by DoD Invoice
- Q:FBIASTOP
- ;
- I $Y+1>IOSL,'FBFORMAT D Q:FBIASTOP ; Page break check
- . D HDR(FBDODINV,LVNAME,CRT,.PAGE,.FBIASTOP)
- W !!?5,"*** End of Report ***"
- ;
- I CRT,'$D(ZTQUEUED) D
- . S DIR(0)="E"
- . D ^DIR
- Q
- ;
- VTOT(FBDODINV,VNAME,FBFORMAT,PAGE,FBIASTOP) ; Print the totals by Dod Invoice Vendor
- ; Input: FBDODINV - DoD Invoice report was compiled for
- ; VNAME - Name of the
- ; FBFORMAT - 0 - CSV format (for Excel), 0 otherwise
- ; PAGE - Current page number
- ; FBIASTOP - Stop flag
- ; ^TMP("FBAAIAR1",$J) - Compiled report data
- ; Output: FBIASTOP - 1 - user stopped printing, 0 otherwise
- ; DoD Invoice Type Totals are printed
- ; Called From: PRINT
- N IDATA
- I $Y+5>IOSL,'FBFORMAT D Q:FBIASTOP ; Page break check
- . D HDR(FBDODINV,VNAME,CRT,.PAGE,.FBIASTOP)
- S IDATA=^TMP("FBAAIAR1",$J,VNAME) ; DoD Invoice Type Totals
- W !?1,"$Totals for Vendor: ",VNAME
- W !,"---------",?50,"-------- -------- --------"
- W !,"# ",$$RJ^XLFSTR($P(IDATA,U,4),7) ; Total Number of Invoices
- W ?50,$$RJ^XLFSTR("$"_$FN($P(IDATA,U,1),"",0),8) ; Total Amount Claimed
- W ?60,$$RJ^XLFSTR("$"_$FN($P(IDATA,U,2),"",0),8) ; Total Amount Paid
- W ?70,$$RJ^XLFSTR("$"_$FN($P(IDATA,U,3),"",0),8) ; Total Adjustment Amount
- Q
- ;
- TYPETOT(FBDODINV,VNAME,FBFORMAT,ITYPE,PAGE,FBIASTOP) ; Print the totals by Invoice type
- ; Input: FBDODINV - DoD Invoice report was compiled for
- ; VNAME - Name of the
- ; FBFORMAT - 0 - CSV format (for Excel), 0 otherwise
- ; ITYPE - Invoice Type to print totals for
- ; PAGE - Current page number
- ; IASTOP - Stop flag
- ; ^TMP($J,"FBAAIAR1") - Compiled report data
- ; Output: IASTOP - 1 - user stopped printing, 0 otherwise
- ; Invoice Type Totals are printed
- ; Called From: PRINT
- N ETYPE,IDATA
- I $Y+5>IOSL,'FBFORMAT D Q:FBIASTOP ; Page break check
- . D HDR(FBDODINV,CRT,.PAGE,.FBIASTOP)
- S ETYPE=$S(ITYPE="ANC":"Inpatient Ancillary",ITYPE="INP":"Inpatient",ITYPE="OUT":"Outpatient",1:"Pharmacy")
- S IDATA=^TMP("FBAAIAR1",$J,VNAME,ITYPE) ; Invoice Type Totals
- W !?1,"$Totals for DoD Invoice # by Type: ",ETYPE
- W !?25,"---- ",?50,"-------- -------- --------"
- W !?20,"Tot# ",$$RJ^XLFSTR($P(IDATA,U,4),4) ; Total Number of Invoices by Type
- W ?50,$$RJ^XLFSTR("$"_$FN($P(IDATA,U,1),"",0),8) ; Total Amount Claimed
- W ?60,$$RJ^XLFSTR("$"_$FN($P(IDATA,U,2),"",0),8) ; Total Amount Paid
- W ?70,$$RJ^XLFSTR("$"_$FN($P(IDATA,U,3),"",0),8) ; Total Adjustment Amount
- W !
- Q
- ;
- EXCELN(ITYPE,INVNUM,DATA) ; Output one Excel line
- ; Input: ITYPE - Invoice record type
- ; INVNUM - VistA Invoice number
- ; DATA - Invoice data
- ; Output: One line of invoice data is output in excel format
- ; Called From: PRINT
- N FBZ
- S FBZ=$$CSV("",INVNUM) ; VistA Invoice Number
- S FBZ=$$CSV(FBZ,ITYPE) ; Invoice Record Type
- S FBZ=$$CSV(FBZ,$P(DATA,U,1)) ; C/V/R
- S FBZ=$$CSV(FBZ,$$FMTE^XLFDT($P(DATA,U,2),"2DZ")) ; Date Paid
- S FBZ=$$CSV(FBZ,$FN($P(DATA,U,3),"",0)) ; Amount Claimed
- S FBZ=$$CSV(FBZ,$FN($P(DATA,U,4),"",0)) ; Amount Paid
- S FBZ=$$CSV(FBZ,$FN($P(DATA,U,5),"",0)) ; Adjustment Amount
- W !,FBZ
- Q
- ;
- HDR(FBDODINV,VNAME,CRT,PAGE,IASTOP) ; Print the Report Header
- ; Input: FBDODINV - DoD Invoice Number
- ; VNAME - Name of the Vendor associated with the DoD Invoice
- ; CRT - 1 - Print to screen, 0 otherwise
- ; PAGE - Current page count
- ; IASTOP - Stop flag
- ; ZTQUEUED - Defined if report was queued
- ; undefined otherwise
- ; Output: PAGE - Updated page count
- ; IASTOP - 1 - user stopped printing, 0 otherwise
- ; ZSTOP - Defined and 1 if a task manager stop was received
- ; 0 or undefined otherwise
- ;
- N DIR,DIROUT,DIRUT,DTOUT,DUOUT,VENID,X,Y,Z
- ;
- ; Do an end of page reader call if page# exists and device is the screen
- I PAGE,CRT D Q:FBIASTOP
- . S DIR(0)="E"
- . D ^DIR K DIR
- . S:'Y FBIASTOP=1
- ;
- ; If screen output or page# exists, do a form feed and left margin reset
- I PAGE!CRT D
- . W @IOF,$C(13)
- ;
- S PAGE=PAGE+1 ; Increment Page #
- ;
- ; For Excel CSV format, display the column headers only
- I FBFORMAT D EXCELHD Q
- ;
- ; Display the report headers
- W ?20,"IPAC Vendor DoD Invoice Inquiry Report"
- W !,?1,"For DoD Invoice # ",FBDODINV
- W ?48,$$FMTE^XLFDT($$NOW^XLFDT),?71,"Page: ",PAGE
- W !,?1,"For Vendor: ",VNAME
- ;
- ; Display the column headers
- W !?42,"Date",?52,"Amount",?63,"Amount",?72,"Amount"
- W !,"Invoice #",?25,"Type",?31,"C/V/R",?42,"Paid",?52,"Claimed",?63,"Paid",?72,"Adjusted"
- W !,SEPLINE
- ;
- ; Check for a TaskManager stop request
- I $D(ZTQUEUED),$$S^%ZTLOAD() D Q
- . S (ZTSTOP,FBIASTOP)=1
- . W !!!?5,"*** Report Halted by TaskManager Request ***"
- Q
- ;
- EXCELHD ; Print an Excel CSV header record
- ; (only 1 Excel CSV header should print for the entire report)
- ; Input: None
- ; Output: Header line printed for CSV format (excel)
- ; Called From:
- N FBH
- S FBH=$$CSV("","VistA Invoice#")
- S FBH=$$CSV(FBH,"Type")
- S FBH=$$CSV(FBH,"C/V/R")
- S FBH=$$CSV(FBH,"Date Paid")
- S FBH=$$CSV(FBH,"Amount Claimed")
- S FBH=$$CSV(FBH,"Amount Paid")
- S FBH=$$CSV(FBH,"Adjustment Amount")
- W FBH
- Q
- ;
- CSV(STRING,DATA) ; Build the Excel data string for CSV format
- ; Input: STRING - Current string being built or ""
- ; DATA - New data to be added to the string
- ; Returns: STRING - Updated string with DATA added
- ; Called From: EXCELHD,EXCELN
- S DATA=$C(34)_$TR(DATA,$C(34),$C(39))_$C(34)
- S STRING=$S(STRING="":DATA,1:STRING_","_DATA)
- Q STRING
- ;
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFBAAIAR2 11368 printed Feb 18, 2025@23:22:02 Page 2
- FBAAIAR2 ;ALB/FA - Fee IPAC Vendor DoD Invoice Inquiry Report Print ;1/16/2014
- +1 ;;3.5;FEE BASIS;**123**;JAN 30, 1995;Build 51
- +2 ;;Per VA Directive 6402, this routine should not be modified.
- +3 ;
- +4 ; Scratch global built by FBAAIAR.
- +5 ; Type - 'O'utpatient,'I'npatient,Inpatient 'A'ncillary, 'P'harmacy
- +6 ; XX - Unique identifier to allow for multiple Outpatient/Ancillary payments on the
- +7 ; same invoice. 0 for Inpatient or Pharmacy
- +8 ; ^TMP("FBAAIAR1",$J, Vendor Name,Type,VistA Invoice#) = A1^A2^A3^...^A5 Where:
- +9 ; A1 - Type of Record (Cancelled, Void, Reject, Purge, "", or some combination)
- +10 ; A2 - Date Paid (Fileman format)
- +11 ; A3 - Total amount claimed
- +12 ; A4 - Total amount paid
- +13 ; A5 - Total adjustment amount
- +14 ; ^TMP("FBAAIAR1",$J,Vendor Name) = A1^A2^...^A4 Where:
- +15 ; A1 - Total amount claimed for DoD Invoice Vendor
- +16 ; A2 - Total amount paid for DoD Invoice Vendor
- +17 ; A3 - Total adjustment amount DoD Invoice Vendor
- +18 ; A4 - Total number of invoices for the DoD Invoice Vendor
- +19 ; ^TMP("FBAAIAR1",$J,Vendor Name, Type) = A1^A2^...^A4 Where:
- +20 ; A1 - Total amount claimed for DoD Invoice Vendor by type
- +21 ; A2 - Total amount paid for DoD Invoice Vendor by type
- +22 ; A3 - Total adjustment amount DoD Invoice Vendor by type
- +23 ; A4 - Total number of invoices for the DoD Invoice Vendor by type
- +24 ;
- +25 ;-----------------------------------------------------------------------------
- +26 ; Entry Points
- +27 ; PRINT - DoD Invoice Inquiry Report - PRINT report
- +28 ;-----------------------------------------------------------------------------
- +29 ;
- +30 QUIT
- +31 ;
- PRINT(FBDODINV,FBFORMAT) ;EP
- +1 ; Entry point for printing the report
- +2 ; Input: FBDODINV - Selected DoD Invoice number
- +3 ; FBFORMAT - 1 - CSV format, 0 otherwise
- +4 ; ZTQUEUE - Defined if report was queued
- +5 ; undefined otherwise
- +6 ; ZSTOP - Defined and 1 if compilation was stopped
- +7 ; 0 or undefined otherwise
- +8 ; ^TMP("FBAAIAR1",$J) - Described in full above
- +9 ; Output: Report is printed
- +10 ; Called From: COMPILE@FBAAIAR1
- +11 ;
- +12 NEW CRT,DIR,DIROUT,DIRUT,DTOUT,DUOUT,INVDOD,FBIASTOP,IDATA,ITYPE,INVNUM
- +13 NEW LVNAME,PAGE,SEPLINE,VNAME,X,XX,Y
- +14 SET LVNAME=""
- SET VNAME=""
- +15 ; 1 - Print to Screen, 0 - Otherwise
- SET CRT=$SELECT(IOST["C-":1,1:0)
- +16 ; Long screen length for Excel output
- if FBFORMAT
- SET IOSL=999999
- +17 SET PAGE=0
- SET FBIASTOP=0
- SET $PIECE(SEPLINE,"-",81)=""
- +18 ; No data was compiled
- IF '$DATA(^TMP("FBAAIAR1",$JOB))
- Begin DoDot:1
- +19 DO HDR(FBDODINV,VNAME,CRT,.PAGE,.FBIASTOP)
- +20 WRITE !!?5,"No data found for this report."
- +21 IF CRT
- IF '$DATA(ZTQUEUED)
- Begin DoDot:2
- +22 SET DIR(0)="E"
- +23 DO ^DIR
- End DoDot:2
- End DoDot:1
- QUIT
- +24 ;
- +25 ; Compilation was halted
- IF $GET(ZTSTOP)
- Begin DoDot:1
- +26 DO HDR(FBDODINV,VNAME,CRT,.PAGE,.FBIASTOP)
- +27 WRITE !!?5,"This report was halted during compilation by TaskManager Request."
- +28 IF CRT
- IF '$DATA(ZTQUEUED)
- Begin DoDot:2
- +29 SET DIR(0)="E"
- +30 DO ^DIR
- End DoDot:2
- End DoDot:1
- QUIT
- +31 ;
- +32 ; Gather headers for excel spreadsheet
- +33 if FBFORMAT
- DO HDR(FBDODINV,"",CRT,.PAGE,.FBIASTOP)
- +34 if FBIASTOP
- QUIT
- +35 ;
- +36 SET VNAME=""
- +37 FOR
- Begin DoDot:1
- +38 SET VNAME=$ORDER(^TMP("FBAAIAR1",$JOB,VNAME))
- +39 if VNAME=""
- QUIT
- +40 SET LVNAME=VNAME
- +41 ;
- +42 ; Display header if not in CSV format
- +43 if 'FBFORMAT
- DO HDR(FBDODINV,VNAME,CRT,.PAGE,.FBIASTOP)
- +44 SET ITYPE=""
- +45 FOR
- Begin DoDot:2
- +46 SET ITYPE=$ORDER(^TMP("FBAAIAR1",$JOB,VNAME,ITYPE))
- +47 if (ITYPE="")!FBIASTOP
- QUIT
- +48 SET INVNUM=""
- +49 FOR
- Begin DoDot:3
- +50 SET INVNUM=$ORDER(^TMP("FBAAIAR1",$JOB,VNAME,ITYPE,INVNUM))
- +51 if (INVNUM="")!FBIASTOP
- QUIT
- +52 SET XX=""
- +53 FOR
- Begin DoDot:4
- +54 SET XX=$ORDER(^TMP("FBAAIAR1",$JOB,VNAME,ITYPE,INVNUM,XX))
- +55 if XX=""
- QUIT
- +56 SET IDATA=$GET(^TMP("FBAAIAR1",$JOB,VNAME,ITYPE,INVNUM,XX))
- +57 ;
- +58 ; Excel output - Print a CSV format record
- +59 IF FBFORMAT
- DO EXCELN(ITYPE,INVNUM,IDATA)
- QUIT
- +60 ;
- +61 ; Page break check
- IF $Y+4>IOSL
- IF 'FBFORMAT
- Begin DoDot:5
- +62 DO HDR(FBDODINV,VNAME,CRT,.PAGE,.FBIASTOP)
- End DoDot:5
- if FBIASTOP
- QUIT
- +63 ; VistA Invoice#
- WRITE !,$$LJ^XLFSTR(INVNUM,22)
- +64 ; Record Type
- WRITE ?25,$$RJ^XLFSTR(ITYPE,4)
- +65 ; C/V/R
- WRITE ?32,$PIECE(IDATA,U,1)
- +66 ; Paid Date
- WRITE ?40,$$LJ^XLFSTR($$FMTE^XLFDT($PIECE(IDATA,U,2),"2DZ"),10)
- +67 ; Amount Claimed
- WRITE ?50,$$RJ^XLFSTR("$"_$FNUMBER($PIECE(IDATA,U,3),"",0),8)
- +68 ; Amount Paid
- WRITE ?60,$$RJ^XLFSTR("$"_$FNUMBER($PIECE(IDATA,U,4),"",0),8)
- +69 ; Adjustment Amount
- WRITE ?70,$$RJ^XLFSTR("$"_$FNUMBER($PIECE(IDATA,U,5),"",0),8)
- End DoDot:4
- if (XX="")!(FBIASTOP)
- QUIT
- End DoDot:3
- if (INVNUM="")!(FBIASTOP)
- QUIT
- +70 ;
- +71 if FBIASTOP
- QUIT
- +72 ; Totals by record type
- if 'FBFORMAT
- DO TYPETOT(FBDODINV,VNAME,FBFORMAT,ITYPE,.PAGE,.FBIASTOP)
- End DoDot:2
- if (ITYPE="")!(FBIASTOP)
- QUIT
- +73 ;
- +74 if FBIASTOP
- QUIT
- +75 ; Totals by DoD Invoice
- if 'FBFORMAT
- DO VTOT(FBDODINV,VNAME,FBFORMAT,.PAGE,.FBIASTOP)
- End DoDot:1
- if (VNAME="")!(FBIASTOP)
- QUIT
- +76 if FBIASTOP
- QUIT
- +77 ;
- +78 ; Page break check
- IF $Y+1>IOSL
- IF 'FBFORMAT
- Begin DoDot:1
- +79 DO HDR(FBDODINV,LVNAME,CRT,.PAGE,.FBIASTOP)
- End DoDot:1
- if FBIASTOP
- QUIT
- +80 WRITE !!?5,"*** End of Report ***"
- +81 ;
- +82 IF CRT
- IF '$DATA(ZTQUEUED)
- Begin DoDot:1
- +83 SET DIR(0)="E"
- +84 DO ^DIR
- End DoDot:1
- +85 QUIT
- +86 ;
- VTOT(FBDODINV,VNAME,FBFORMAT,PAGE,FBIASTOP) ; Print the totals by Dod Invoice Vendor
- +1 ; Input: FBDODINV - DoD Invoice report was compiled for
- +2 ; VNAME - Name of the
- +3 ; FBFORMAT - 0 - CSV format (for Excel), 0 otherwise
- +4 ; PAGE - Current page number
- +5 ; FBIASTOP - Stop flag
- +6 ; ^TMP("FBAAIAR1",$J) - Compiled report data
- +7 ; Output: FBIASTOP - 1 - user stopped printing, 0 otherwise
- +8 ; DoD Invoice Type Totals are printed
- +9 ; Called From: PRINT
- +10 NEW IDATA
- +11 ; Page break check
- IF $Y+5>IOSL
- IF 'FBFORMAT
- Begin DoDot:1
- +12 DO HDR(FBDODINV,VNAME,CRT,.PAGE,.FBIASTOP)
- End DoDot:1
- if FBIASTOP
- QUIT
- +13 ; DoD Invoice Type Totals
- SET IDATA=^TMP("FBAAIAR1",$JOB,VNAME)
- +14 WRITE !?1,"$Totals for Vendor: ",VNAME
- +15 WRITE !,"---------",?50,"-------- -------- --------"
- +16 ; Total Number of Invoices
- WRITE !,"# ",$$RJ^XLFSTR($PIECE(IDATA,U,4),7)
- +17 ; Total Amount Claimed
- WRITE ?50,$$RJ^XLFSTR("$"_$FNUMBER($PIECE(IDATA,U,1),"",0),8)
- +18 ; Total Amount Paid
- WRITE ?60,$$RJ^XLFSTR("$"_$FNUMBER($PIECE(IDATA,U,2),"",0),8)
- +19 ; Total Adjustment Amount
- WRITE ?70,$$RJ^XLFSTR("$"_$FNUMBER($PIECE(IDATA,U,3),"",0),8)
- +20 QUIT
- +21 ;
- TYPETOT(FBDODINV,VNAME,FBFORMAT,ITYPE,PAGE,FBIASTOP) ; Print the totals by Invoice type
- +1 ; Input: FBDODINV - DoD Invoice report was compiled for
- +2 ; VNAME - Name of the
- +3 ; FBFORMAT - 0 - CSV format (for Excel), 0 otherwise
- +4 ; ITYPE - Invoice Type to print totals for
- +5 ; PAGE - Current page number
- +6 ; IASTOP - Stop flag
- +7 ; ^TMP($J,"FBAAIAR1") - Compiled report data
- +8 ; Output: IASTOP - 1 - user stopped printing, 0 otherwise
- +9 ; Invoice Type Totals are printed
- +10 ; Called From: PRINT
- +11 NEW ETYPE,IDATA
- +12 ; Page break check
- IF $Y+5>IOSL
- IF 'FBFORMAT
- Begin DoDot:1
- +13 DO HDR(FBDODINV,CRT,.PAGE,.FBIASTOP)
- End DoDot:1
- if FBIASTOP
- QUIT
- +14 SET ETYPE=$SELECT(ITYPE="ANC":"Inpatient Ancillary",ITYPE="INP":"Inpatient",ITYPE="OUT":"Outpatient",1:"Pharmacy")
- +15 ; Invoice Type Totals
- SET IDATA=^TMP("FBAAIAR1",$JOB,VNAME,ITYPE)
- +16 WRITE !?1,"$Totals for DoD Invoice # by Type: ",ETYPE
- +17 WRITE !?25,"---- ",?50,"-------- -------- --------"
- +18 ; Total Number of Invoices by Type
- WRITE !?20,"Tot# ",$$RJ^XLFSTR($PIECE(IDATA,U,4),4)
- +19 ; Total Amount Claimed
- WRITE ?50,$$RJ^XLFSTR("$"_$FNUMBER($PIECE(IDATA,U,1),"",0),8)
- +20 ; Total Amount Paid
- WRITE ?60,$$RJ^XLFSTR("$"_$FNUMBER($PIECE(IDATA,U,2),"",0),8)
- +21 ; Total Adjustment Amount
- WRITE ?70,$$RJ^XLFSTR("$"_$FNUMBER($PIECE(IDATA,U,3),"",0),8)
- +22 WRITE !
- +23 QUIT
- +24 ;
- EXCELN(ITYPE,INVNUM,DATA) ; Output one Excel line
- +1 ; Input: ITYPE - Invoice record type
- +2 ; INVNUM - VistA Invoice number
- +3 ; DATA - Invoice data
- +4 ; Output: One line of invoice data is output in excel format
- +5 ; Called From: PRINT
- +6 NEW FBZ
- +7 ; VistA Invoice Number
- SET FBZ=$$CSV("",INVNUM)
- +8 ; Invoice Record Type
- SET FBZ=$$CSV(FBZ,ITYPE)
- +9 ; C/V/R
- SET FBZ=$$CSV(FBZ,$PIECE(DATA,U,1))
- +10 ; Date Paid
- SET FBZ=$$CSV(FBZ,$$FMTE^XLFDT($PIECE(DATA,U,2),"2DZ"))
- +11 ; Amount Claimed
- SET FBZ=$$CSV(FBZ,$FNUMBER($PIECE(DATA,U,3),"",0))
- +12 ; Amount Paid
- SET FBZ=$$CSV(FBZ,$FNUMBER($PIECE(DATA,U,4),"",0))
- +13 ; Adjustment Amount
- SET FBZ=$$CSV(FBZ,$FNUMBER($PIECE(DATA,U,5),"",0))
- +14 WRITE !,FBZ
- +15 QUIT
- +16 ;
- HDR(FBDODINV,VNAME,CRT,PAGE,IASTOP) ; Print the Report Header
- +1 ; Input: FBDODINV - DoD Invoice Number
- +2 ; VNAME - Name of the Vendor associated with the DoD Invoice
- +3 ; CRT - 1 - Print to screen, 0 otherwise
- +4 ; PAGE - Current page count
- +5 ; IASTOP - Stop flag
- +6 ; ZTQUEUED - Defined if report was queued
- +7 ; undefined otherwise
- +8 ; Output: PAGE - Updated page count
- +9 ; IASTOP - 1 - user stopped printing, 0 otherwise
- +10 ; ZSTOP - Defined and 1 if a task manager stop was received
- +11 ; 0 or undefined otherwise
- +12 ;
- +13 NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT,VENID,X,Y,Z
- +14 ;
- +15 ; Do an end of page reader call if page# exists and device is the screen
- +16 IF PAGE
- IF CRT
- Begin DoDot:1
- +17 SET DIR(0)="E"
- +18 DO ^DIR
- KILL DIR
- +19 if 'Y
- SET FBIASTOP=1
- End DoDot:1
- if FBIASTOP
- QUIT
- +20 ;
- +21 ; If screen output or page# exists, do a form feed and left margin reset
- +22 IF PAGE!CRT
- Begin DoDot:1
- +23 WRITE @IOF,$CHAR(13)
- End DoDot:1
- +24 ;
- +25 ; Increment Page #
- SET PAGE=PAGE+1
- +26 ;
- +27 ; For Excel CSV format, display the column headers only
- +28 IF FBFORMAT
- DO EXCELHD
- QUIT
- +29 ;
- +30 ; Display the report headers
- +31 WRITE ?20,"IPAC Vendor DoD Invoice Inquiry Report"
- +32 WRITE !,?1,"For DoD Invoice # ",FBDODINV
- +33 WRITE ?48,$$FMTE^XLFDT($$NOW^XLFDT),?71,"Page: ",PAGE
- +34 WRITE !,?1,"For Vendor: ",VNAME
- +35 ;
- +36 ; Display the column headers
- +37 WRITE !?42,"Date",?52,"Amount",?63,"Amount",?72,"Amount"
- +38 WRITE !,"Invoice #",?25,"Type",?31,"C/V/R",?42,"Paid",?52,"Claimed",?63,"Paid",?72,"Adjusted"
- +39 WRITE !,SEPLINE
- +40 ;
- +41 ; Check for a TaskManager stop request
- +42 IF $DATA(ZTQUEUED)
- IF $$S^%ZTLOAD()
- Begin DoDot:1
- +43 SET (ZTSTOP,FBIASTOP)=1
- +44 WRITE !!!?5,"*** Report Halted by TaskManager Request ***"
- End DoDot:1
- QUIT
- +45 QUIT
- +46 ;
- EXCELHD ; Print an Excel CSV header record
- +1 ; (only 1 Excel CSV header should print for the entire report)
- +2 ; Input: None
- +3 ; Output: Header line printed for CSV format (excel)
- +4 ; Called From:
- +5 NEW FBH
- +6 SET FBH=$$CSV("","VistA Invoice#")
- +7 SET FBH=$$CSV(FBH,"Type")
- +8 SET FBH=$$CSV(FBH,"C/V/R")
- +9 SET FBH=$$CSV(FBH,"Date Paid")
- +10 SET FBH=$$CSV(FBH,"Amount Claimed")
- +11 SET FBH=$$CSV(FBH,"Amount Paid")
- +12 SET FBH=$$CSV(FBH,"Adjustment Amount")
- +13 WRITE FBH
- +14 QUIT
- +15 ;
- CSV(STRING,DATA) ; Build the Excel data string for CSV format
- +1 ; Input: STRING - Current string being built or ""
- +2 ; DATA - New data to be added to the string
- +3 ; Returns: STRING - Updated string with DATA added
- +4 ; Called From: EXCELHD,EXCELN
- +5 SET DATA=$CHAR(34)_$TRANSLATE(DATA,$CHAR(34),$CHAR(39))_$CHAR(34)
- +6 SET STRING=$SELECT(STRING="":DATA,1:STRING_","_DATA)
- +7 QUIT STRING
- +8 ;