Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: FBAAIARB

FBAAIARB.m

Go to the documentation of this file.
  1. FBAAIARB ;ALB/ESG - FEE IPAC Vendor Payment Report (Detail) ;2/4/2014
  1. ;;3.5;FEE BASIS;**123**;JAN 30, 1995;Build 51
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. Q
  1. ;
  1. EN ; main report entry point
  1. ;
  1. N FBIAVEN,FBIABEG,FBIAEND,FBIATYPE,FBIAEXCEL,FBIAADJ,FBIAIGNORE
  1. P1 I '$$VENDSEL(.FBIAVEN) G EX ; vendor
  1. P2 I '$$DATES(.FBIABEG,.FBIAEND) G EX:$$STOP,P1 ; begin and end dates
  1. P3 I '$$TYPESEL(.FBIATYPE) G EX:$$STOP,P2 ; type of invoice
  1. P4 I '$$SUSPADJ(.FBIAADJ) G EX:$$STOP,P3 ; only include suspended/adjusted payments?
  1. P5 I '$$IGNCV(.FBIAIGNORE) G EX:$$STOP,P4 ; ignore cancelled/voided payment lines?
  1. P6 I '$$FORMAT(.FBIAEXCEL) G EX:$$STOP,P5 ; format (standard or CSV)
  1. P7 I '$$DEVICE() G EX:$$STOP,P6 ; device
  1. ;
  1. EX ; main report exit point
  1. Q
  1. ;
  1. STOP() ; Determine if user wants to exit out of the option entirely
  1. ; 1=yes, get out entirely
  1. ; 0=no, just go back to the previous question
  1. ;
  1. N DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
  1. ;
  1. S DIR(0)="Y"
  1. S DIR("A")="Do you want to exit out of this option entirely"
  1. S DIR("B")="YES"
  1. S DIR("?",1)=" Enter YES to immediately exit out of this option."
  1. S DIR("?")=" Enter NO to return to the previous question."
  1. W ! D ^DIR K DIR
  1. I $D(DIRUT) S Y=1
  1. Q Y
  1. ;
  1. VENDSEL(FBIAVEN) ; user selection function for IPAC vendors
  1. ; FBIAVEN is an output array, pass by reference
  1. ; FBIAVEN(vendor ien) = vendor name selected
  1. ; Function value is 1 if at least 1 vendor was selected, 0 otherwise
  1. ;
  1. N DIC,RET,VAUTSTR,VAUTNI,VAUTVB,V,X,Y
  1. K FBIAVEN
  1. S RET=1 ; default to 1 indicating all OK
  1. ;
  1. W @IOF,!,"IPAC Vendor Payment Report"
  1. W !!,"This report will display detail information on paid line items by the"
  1. W !,"invoice type, DoD invoice number, and date of service."
  1. W !
  1. ;
  1. S DIC="^FBAAV("
  1. S DIC("S")="I +$O(^FBAA(161.95,""V"",Y,0))"
  1. S VAUTSTR="IPAC Vendor",VAUTNI=2,VAUTVB="FBIAVEN"
  1. D FIRST^VAUTOMA ; DBIA# 4398
  1. I FBIAVEN S V=0 F S V=$O(^FBAA(161.95,"V",V)) Q:'V S FBIAVEN(V)=$P($G(^FBAAV(V,0)),U,1) ; all IPAC vendors selected
  1. I '$O(FBIAVEN(0)) S RET=0 W $C(7) ; no vendors found/selected
  1. Q RET
  1. ;
  1. DATES(FBIABEG,FBIAEND) ; capture the start date and end date from the user
  1. ; both are output parameters, pass by reference
  1. ; function value is 0/1 indicating if valid dates were selected
  1. ;
  1. N RET,DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
  1. S RET=1
  1. S (FBIABEG,FBIAEND)=""
  1. ;
  1. S DIR(0)="D^:DT:EX"
  1. S DIR("A")="Enter the Start Date"
  1. S DIR("B")=$$FMTE^XLFDT($$FMADD^XLFDT(DT,-30),"5DZ") ; default date is T-30
  1. S DIR("?",1)="The start and end dates for this report refer to the date that the"
  1. S DIR("?",2)="associated batch and payment line items are finalized (certified)"
  1. S DIR("?")="in VistA Fee through the ""Finalize a Batch"" menu option."
  1. W ! D ^DIR K DIR
  1. I $D(DIRUT)!'Y S RET=0 W $C(7) G DATEX
  1. S FBIABEG=Y
  1. ;
  1. S DIR(0)="D^"_FBIABEG_":DT:EX"
  1. S DIR("A")="Enter the End Date"
  1. S DIR("B")=$$FMTE^XLFDT(DT,"5DZ") ; default date is Today
  1. S DIR("?",1)="The start and end dates for this report refer to the date that the"
  1. S DIR("?",2)="associated batch and payment line items are finalized (certified)"
  1. S DIR("?")="in VistA Fee through the ""Finalize a Batch"" menu option."
  1. W ! D ^DIR K DIR
  1. I $D(DIRUT)!'Y S RET=0 W $C(7) G DATEX
  1. S FBIAEND=Y
  1. DATEX ;
  1. Q RET
  1. ;
  1. TYPESEL(FBIATYPE) ; function for user selection of the types of invoices to search
  1. ; FBIATYPE is an output array, pass by reference
  1. ; FBIATYPE(type)="" where type can be OUT,RX,INP,ANC
  1. ; Function value is 1 if at least 1 invoice type was selected, 0 otherwise
  1. ;
  1. N RET,DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT,FD,G
  1. K FBIATYPE
  1. S RET=1 ; default to 1 indicating all OK
  1. ;
  1. F D Q:Y="ALL"!$D(DIRUT)!(Y="")
  1. . S DIR(0)="SO"
  1. . S FD="OUT:"_$$LJ^XLFSTR("Outpatient",27)_$S($D(FBIATYPE("OUT")):"SELECTED",1:"")
  1. . S FD=FD_";RX:"_$$LJ^XLFSTR("Pharmacy",27)_$S($D(FBIATYPE("RX")):"SELECTED",1:"")
  1. . S FD=FD_";INP:"_$$LJ^XLFSTR("Civil Hospital",27)_$S($D(FBIATYPE("INP")):"SELECTED",1:"")
  1. . S FD=FD_";ANC:"_$$LJ^XLFSTR("Civil Hospital Ancillary",27)_$S($D(FBIATYPE("ANC")):"SELECTED",1:"")
  1. . S FD=FD_";ALL:All"
  1. . S $P(DIR(0),U,2)=FD
  1. . ;
  1. . I '$D(FBIATYPE) S DIR("A")="Select an Invoice Type",DIR("B")="ALL"
  1. . E S DIR("A")="Select Another Invoice Type" K DIR("B")
  1. . W ! D ^DIR K DIR
  1. . ;
  1. . I Y="ALL" D Q ; user selected all types, so set them and get out
  1. .. F G="OUT","RX","INP","ANC" S FBIATYPE(G)=""
  1. . ;
  1. . I $D(DIRUT)!(Y="") Q
  1. . I $D(FBIATYPE(Y)) K FBIATYPE(Y) Q ; if already selected, toggle the selection off then quit
  1. . S FBIATYPE(Y)="" ; toggle selection on
  1. . Q
  1. ;
  1. I $D(DUOUT)!$D(DTOUT) S RET=0 ; exit via up-arrow or time-out should get out
  1. I '$D(FBIATYPE) S RET=0 W $C(7)
  1. Q RET
  1. ;
  1. SUSPADJ(FBIAADJ) ; capture only suspended payments?
  1. ; FBIAADJ=0 meaning NO user wants to include all payment lines
  1. ; FBIAADJ=1 meaning YES only include payments where Amount Paid is less than Amount Claimed
  1. ; pass parameter by reference
  1. ;
  1. N RET,DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
  1. S FBIAADJ=0,RET=1
  1. S DIR(0)="Y"
  1. S DIR("A")="Only Include Suspended Payments (not paid in full)"
  1. S DIR("B")="NO"
  1. S DIR("?",1)="Enter NO if you want to include all payment lines regardless of amount"
  1. S DIR("?",2)="claimed, paid, or suspended/adjusted."
  1. S DIR("?",3)=" "
  1. S DIR("?",4)="Enter YES if you only want to include payments that are not paid in full."
  1. S DIR("?",5)="This means that the amount the VA paid is less than the vendor's claimed"
  1. S DIR("?")="amount. The remaining balance has been suspended or adjusted."
  1. W ! D ^DIR K DIR
  1. I $D(DIRUT) S RET=0 W $C(7)
  1. S FBIAADJ=Y
  1. Q RET
  1. ;
  1. FORMAT(FBIAEXCEL) ; capture the report format from the user (normal or CSV output)
  1. ; FBIAEXCEL=0 for normal output
  1. ; FBIAEXCEL=1 for CSV (comma separated values) for Excel output
  1. ; pass parameter by reference
  1. ;
  1. N RET,DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
  1. S FBIAEXCEL=0,RET=1
  1. S DIR(0)="Y"
  1. S DIR("A")="Do you want to capture the output in a CSV format"
  1. S DIR("B")="NO"
  1. S DIR("?",1)="If you want to capture the output from this report in a comma-separated"
  1. S DIR("?",2)="values (CSV) format, then answer YES here. A CSV format is something that"
  1. S DIR("?",3)="could be easily imported into a spreadsheet program like Excel."
  1. S DIR("?",4)=" "
  1. S DIR("?")="If you just want a normal report output, then answer NO here."
  1. W ! D ^DIR K DIR
  1. I $D(DIRUT) S RET=0 W $C(7)
  1. S FBIAEXCEL=Y
  1. Q RET
  1. ;
  1. IGNCV(FBIAIGNORE) ; should we ignore cancelled, voided, or rejected line items?
  1. ; FBIAIGNORE=0 means don't ignore, include everything
  1. ; FBIAIGNORE=1 means yes ignore cancelled/voided/rejected line items
  1. ; pass parameter by reference
  1. ;
  1. N RET,DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
  1. S FBIAIGNORE=1,RET=1
  1. S DIR(0)="Y"
  1. S DIR("A")="Ignore Cancelled or Voided Payments"
  1. S DIR("B")="YES"
  1. S DIR("?",1)="Enter YES if you want to ignore any payment line items that have been"
  1. S DIR("?",2)="cancelled, voided, or rejected so these items will not show up on the report."
  1. S DIR("?",3)=" "
  1. S DIR("?",4)="Enter NO if you would like to include cancelled, voided, or rejected line"
  1. S DIR("?",5)="items so they will show up on the report. For such payment line items, an"
  1. S DIR("?")="indicator will be displayed on the report."
  1. W ! D ^DIR K DIR
  1. I $D(DIRUT) S RET=0 W $C(7)
  1. S FBIAIGNORE=Y
  1. Q RET
  1. ;
  1. DEVICE() ; Device Selection
  1. N ZTRTN,ZTDESC,ZTSAVE,POP,RET,ZTSK,DIR,X,Y
  1. S RET=1
  1. I 'FBIAEXCEL W !!,"This report is 132 characters wide. Please choose an appropriate device.",!
  1. I FBIAEXCEL D
  1. . W !!,"For CSV output, turn logging or capture on now."
  1. . W !,"To avoid undesired wrapping of the data saved to the file,"
  1. . W !,"please enter ""0;256;99999"" at the ""DEVICE:"" prompt.",!
  1. ;
  1. S ZTRTN="COMPILE^FBAAIARC"
  1. S ZTDESC="Fee Basis IPAC Vendor Payment Report"
  1. S ZTSAVE("FBIAVEN(")=""
  1. S ZTSAVE("FBIABEG")=""
  1. S ZTSAVE("FBIAEND")=""
  1. S ZTSAVE("FBIATYPE(")=""
  1. S ZTSAVE("FBIAADJ")=""
  1. S ZTSAVE("FBIAEXCEL")=""
  1. S ZTSAVE("FBIAIGNORE")=""
  1. D EN^XUTMDEVQ(ZTRTN,ZTDESC,.ZTSAVE,"QM",1)
  1. I POP S RET=0
  1. I $G(ZTSK) W !!,"Report compilation has started with task# ",ZTSK,".",! S DIR(0)="E" D ^DIR
  1. Q RET
  1. ;