FBFPTR ;WOIFO/SAB-FPPS TRANSMIT REPORT ;9/8/2003
;;3.5;FEE BASIS;**61**;JAN 30, 1995
;
W !,"This option generates a report of transmissions to FPPS for a date range.",!
; ask start date
S DIR(0)="D^::EX",DIR("A")="From Date"
D ^DIR K DIR G:$D(DIRUT) EXIT
S FBDT1=Y
;
; ask end date
S DIR(0)="DA^"_FBDT1_":"_DT_":EX",DIR("A")="To Date: "
D ^DIR K DIR G:$D(DIRUT) EXIT
S FBDT2=Y
;
; ask device
S %ZIS="QM" D ^%ZIS G:POP EXIT
I $D(IO("Q")) D G EXIT
. S ZTRTN="QEN^FBFPTR",ZTDESC="FPPS Transmit Report"
. F FBX="FBDT*" S ZTSAVE(FBX)=""
. D ^%ZTLOAD,HOME^%ZIS K ZTSK
;
QEN ; queued entry
U IO
;
GATHER ; collect and sort data
S FBQUIT=0
; initialize totals array
K FBT
;
; loop thru MESSAGE DATE/TIME x-ref by date and process transmissions
S FBC=0 ; initialize count of records processed
S FBDT=FBDT1
F S FBDT=$O(^FBHL(163.5,"AMD",FBDT)) Q:FBDT=""!($P(FBDT,".")>FBDT2) D Q:FBQUIT
. S FBDA=0 F S FBDA=$O(^FBHL(163.5,"AMD",FBDT,FBDA)) Q:'FBDA D Q:FBQUIT
. . S FBC=FBC+1 ; increment count of records processed
. . ; if tasked then check for stop request
. . I $D(ZTQUEUED),FBC\1000,$$S^%ZTLOAD S ZTSTOP=1,FBQUIT=1 Q
. . ; get data
. . S FBY=$G(^FBHL(163.5,FBDA,0))
. . S FBFILE=$P(FBY,U,2) ; invoice file number
. . I FBFILE="" S FBFILE="U"
. . S FBTTYP=$P(FBY,U,6) ; transaction type
. . I FBTTYP="" S FBTTYP="U"
. . S FBSTA=" "_$P(FBY,U,7) ; station number
. . I FBSTA=" " S FBSTA=" UNK"
. . ; add to transmitted total
. . S $P(FBT(FBSTA,FBFILE,FBTTYP),U)=$P($G(FBT(FBSTA,FBFILE,FBTTYP)),U)+1
. . ; if accepted by interface engine then add to accepted total
. . I $P(FBY,U,8)="A" S $P(FBT(FBSTA,FBFILE,FBTTYP),U,2)=$P($G(FBT(FBSTA,FBFILE,FBTTYP)),U,2)+1
;
PRINT ; report data
S FBPG=0 D NOW^%DTC S Y=% D DD^%DT S FBDTR=Y
K FBDL S FBDL="",$P(FBDL,"-",IOM)=""
;
; build page header text for selection criteria
S FBHDT(1)=" For "_$$FMTE^XLFDT(FBDT1)_" through "_$$FMTE^XLFDT(FBDT2)
;
D HD
;
I 'FBQUIT,'$D(FBT) W !,"No invoices were transmitted during specified period."
;
I 'FBQUIT,$D(FBT) D RSUM
;
I FBQUIT W !!,"REPORT STOPPED AT USER REQUEST"
;
I 'FBQUIT,$E(IOST,1,2)="C-" S DIR(0)="E" D ^DIR K DIR
D ^%ZISC
;
EXIT ;
I $D(ZTQUEUED) S ZTREQ="@"
K FBC,FBDA,FBDL,FBDT,FBDT1,FBDT2,FBDTR,FBFILE,FBHDT,FBPG,FBQUIT
K FBSTA,FBT,FBTTYP,FBX,FBY
K %,DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,I,J,POP,X,Y
Q
;
RSUM ; report summary
N FBCC,FBCL,FBCX
;
W !!,"SUMMARY OF EDI INVOICES TRANSMITTED TO FPPS"
;
; summary header
D HDSUM
;
; init grand total
S FBT="0^0^0" ; confirm^cancel^accepted
;
; loop thru station
S FBSTA="" F S FBSTA=$O(FBT(FBSTA)) Q:FBSTA="" D Q:FBQUIT
. I $Y+9>IOSL D HD Q:FBQUIT D HDSUM
. ; init station totals
. S FBT(FBSTA)="0^0^0" ; confirm^cancel^accepted
. ;
. W !
. ;
. ; loop thru file type
. S FBFILE="" F S FBFILE=$O(FBT(FBSTA,FBFILE)) Q:FBFILE="" D Q:FBQUIT
. . ;
. . ; get counts for each transaction types
. . S FBCC=$P($G(FBT(FBSTA,FBFILE,"C")),U) ; claim
. . S FBCL=$P($G(FBT(FBSTA,FBFILE,"L")),U) ; line
. . S FBCX=$P($G(FBT(FBSTA,FBFILE,"X")),U) ; cancel
. . S FBCA=$P($G(FBT(FBSTA,FBFILE,"C")),U,2)+$P($G(FBT(FBSTA,FBFILE,"L")),U,2)+$P($G(FBT(FBSTA,FBFILE,"X")),U,2) ; accepted
. . ;
. . ; write the line for the file type
. . W !,FBSTA
. . W ?9,$S(FBFILE=3:"Outpatient/Ancillary",FBFILE=5:"Pharmacy",FBFILE=9:"Inpatient",1:"Unknown")
. . W ?31,$J($FN(FBCL+FBCC,","),9)
. . W ?42,$J($FN(FBCX,","),9)
. . W ?53,$J($FN(FBCL+FBCC+FBCX,","),9)
. . W ?64,$J($FN(FBCA,","),14)
. . ;
. . ; add file type counts to station totals
. . S $P(FBT(FBSTA),U)=$P(FBT(FBSTA),U)+FBCL+FBCC
. . S $P(FBT(FBSTA),U,2)=$P(FBT(FBSTA),U,2)+FBCX
. . S $P(FBT(FBSTA),U,3)=$P(FBT(FBSTA),U,3)+FBCA
. ;
. ; write station total
. W !,?31,"---------",?42,"---------",?53,"---------",?64,"--------------"
. W !,FBSTA," Station Totals",?31,$J($FN($P(FBT(FBSTA),U),","),9)
. W ?42,$J($FN($P(FBT(FBSTA),U,2),","),9)
. W ?53,$J($FN($P(FBT(FBSTA),U)+$P(FBT(FBSTA),U,2),","),9)
. W ?64,$J($FN($P(FBT(FBSTA),U,3),","),14)
. ;
. ; add station totals to grand total
. S $P(FBT,U)=$P(FBT,U)+$P(FBT(FBSTA),U)
. S $P(FBT,U,2)=$P(FBT,U,2)+$P(FBT(FBSTA),U,2)
. S $P(FBT,U,3)=$P(FBT,U,3)+$P(FBT(FBSTA),U,3)
;
Q:FBQUIT
;
; write report totals
W !!,?31,"=========",?42,"=========",?53,"=========",?64,"=============="
W !,"Report Totals",?31,$J($FN($P(FBT,U),","),9)
W ?42,$J($FN($P(FBT,U,2),","),9)
W ?53,$J($FN($P(FBT,U)+$P(FBT,U,2),","),9)
W ?64,$J($FN($P(FBT,U,3),","),14)
Q
;
HD ; page header
N FBI
I $D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1,FBQUIT=1 Q
I $E(IOST,1,2)="C-",FBPG S DIR(0)="E" D ^DIR K DIR I 'Y S FBQUIT=1 Q
I $E(IOST,1,2)="C-"!FBPG W @IOF
S FBPG=FBPG+1
W !,"FPPS Transmission Report ",?49,FBDTR,?72,"page ",FBPG
S FBI=0 F S FBI=$O(FBHDT(FBI)) Q:'FBI W !,FBHDT(FBI)
W !,FBDL
Q
;
HDSUM ; report summary header
W !!,?31,"------------- Transmission Counts -------------"
W !,?31,"Payment",?42,"Payment",?64,"Accepted by"
W !,"Station",?9,"Invoice Type",?31,"Confirmed",?42,"Cancelled",?53,"Total",?64,"Interface Eng."
W !,"-------",?9,"------------",?31,"---------",?42,"---------",?53,"---------",?64,"--------------"
Q
;
;FBFPTR
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFBFPTR 5325 printed Dec 13, 2024@01:58:30 Page 2
FBFPTR ;WOIFO/SAB-FPPS TRANSMIT REPORT ;9/8/2003
+1 ;;3.5;FEE BASIS;**61**;JAN 30, 1995
+2 ;
+3 WRITE !,"This option generates a report of transmissions to FPPS for a date range.",!
+4 ; ask start date
+5 SET DIR(0)="D^::EX"
SET DIR("A")="From Date"
+6 DO ^DIR
KILL DIR
if $DATA(DIRUT)
GOTO EXIT
+7 SET FBDT1=Y
+8 ;
+9 ; ask end date
+10 SET DIR(0)="DA^"_FBDT1_":"_DT_":EX"
SET DIR("A")="To Date: "
+11 DO ^DIR
KILL DIR
if $DATA(DIRUT)
GOTO EXIT
+12 SET FBDT2=Y
+13 ;
+14 ; ask device
+15 SET %ZIS="QM"
DO ^%ZIS
if POP
GOTO EXIT
+16 IF $DATA(IO("Q"))
Begin DoDot:1
+17 SET ZTRTN="QEN^FBFPTR"
SET ZTDESC="FPPS Transmit Report"
+18 FOR FBX="FBDT*"
SET ZTSAVE(FBX)=""
+19 DO ^%ZTLOAD
DO HOME^%ZIS
KILL ZTSK
End DoDot:1
GOTO EXIT
+20 ;
QEN ; queued entry
+1 USE IO
+2 ;
GATHER ; collect and sort data
+1 SET FBQUIT=0
+2 ; initialize totals array
+3 KILL FBT
+4 ;
+5 ; loop thru MESSAGE DATE/TIME x-ref by date and process transmissions
+6 ; initialize count of records processed
SET FBC=0
+7 SET FBDT=FBDT1
+8 FOR
SET FBDT=$ORDER(^FBHL(163.5,"AMD",FBDT))
if FBDT=""!($PIECE(FBDT,".")>FBDT2)
QUIT
Begin DoDot:1
+9 SET FBDA=0
FOR
SET FBDA=$ORDER(^FBHL(163.5,"AMD",FBDT,FBDA))
if 'FBDA
QUIT
Begin DoDot:2
+10 ; increment count of records processed
SET FBC=FBC+1
+11 ; if tasked then check for stop request
+12 IF $DATA(ZTQUEUED)
IF FBC\1000
IF $$S^%ZTLOAD
SET ZTSTOP=1
SET FBQUIT=1
QUIT
+13 ; get data
+14 SET FBY=$GET(^FBHL(163.5,FBDA,0))
+15 ; invoice file number
SET FBFILE=$PIECE(FBY,U,2)
+16 IF FBFILE=""
SET FBFILE="U"
+17 ; transaction type
SET FBTTYP=$PIECE(FBY,U,6)
+18 IF FBTTYP=""
SET FBTTYP="U"
+19 ; station number
SET FBSTA=" "_$PIECE(FBY,U,7)
+20 IF FBSTA=" "
SET FBSTA=" UNK"
+21 ; add to transmitted total
+22 SET $PIECE(FBT(FBSTA,FBFILE,FBTTYP),U)=$PIECE($GET(FBT(FBSTA,FBFILE,FBTTYP)),U)+1
+23 ; if accepted by interface engine then add to accepted total
+24 IF $PIECE(FBY,U,8)="A"
SET $PIECE(FBT(FBSTA,FBFILE,FBTTYP),U,2)=$PIECE($GET(FBT(FBSTA,FBFILE,FBTTYP)),U,2)+1
End DoDot:2
if FBQUIT
QUIT
End DoDot:1
if FBQUIT
QUIT
+25 ;
PRINT ; report data
+1 SET FBPG=0
DO NOW^%DTC
SET Y=%
DO DD^%DT
SET FBDTR=Y
+2 KILL FBDL
SET FBDL=""
SET $PIECE(FBDL,"-",IOM)=""
+3 ;
+4 ; build page header text for selection criteria
+5 SET FBHDT(1)=" For "_$$FMTE^XLFDT(FBDT1)_" through "_$$FMTE^XLFDT(FBDT2)
+6 ;
+7 DO HD
+8 ;
+9 IF 'FBQUIT
IF '$DATA(FBT)
WRITE !,"No invoices were transmitted during specified period."
+10 ;
+11 IF 'FBQUIT
IF $DATA(FBT)
DO RSUM
+12 ;
+13 IF FBQUIT
WRITE !!,"REPORT STOPPED AT USER REQUEST"
+14 ;
+15 IF 'FBQUIT
IF $EXTRACT(IOST,1,2)="C-"
SET DIR(0)="E"
DO ^DIR
KILL DIR
+16 DO ^%ZISC
+17 ;
EXIT ;
+1 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+2 KILL FBC,FBDA,FBDL,FBDT,FBDT1,FBDT2,FBDTR,FBFILE,FBHDT,FBPG,FBQUIT
+3 KILL FBSTA,FBT,FBTTYP,FBX,FBY
+4 KILL %,DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,I,J,POP,X,Y
+5 QUIT
+6 ;
RSUM ; report summary
+1 NEW FBCC,FBCL,FBCX
+2 ;
+3 WRITE !!,"SUMMARY OF EDI INVOICES TRANSMITTED TO FPPS"
+4 ;
+5 ; summary header
+6 DO HDSUM
+7 ;
+8 ; init grand total
+9 ; confirm^cancel^accepted
SET FBT="0^0^0"
+10 ;
+11 ; loop thru station
+12 SET FBSTA=""
FOR
SET FBSTA=$ORDER(FBT(FBSTA))
if FBSTA=""
QUIT
Begin DoDot:1
+13 IF $Y+9>IOSL
DO HD
if FBQUIT
QUIT
DO HDSUM
+14 ; init station totals
+15 ; confirm^cancel^accepted
SET FBT(FBSTA)="0^0^0"
+16 ;
+17 WRITE !
+18 ;
+19 ; loop thru file type
+20 SET FBFILE=""
FOR
SET FBFILE=$ORDER(FBT(FBSTA,FBFILE))
if FBFILE=""
QUIT
Begin DoDot:2
+21 ;
+22 ; get counts for each transaction types
+23 ; claim
SET FBCC=$PIECE($GET(FBT(FBSTA,FBFILE,"C")),U)
+24 ; line
SET FBCL=$PIECE($GET(FBT(FBSTA,FBFILE,"L")),U)
+25 ; cancel
SET FBCX=$PIECE($GET(FBT(FBSTA,FBFILE,"X")),U)
+26 ; accepted
SET FBCA=$PIECE($GET(FBT(FBSTA,FBFILE,"C")),U,2)+$PIECE($GET(FBT(FBSTA,FBFILE,"L")),U,2)+$PIECE($GET(FBT(FBSTA,FBFILE,"X")),U,2)
+27 ;
+28 ; write the line for the file type
+29 WRITE !,FBSTA
+30 WRITE ?9,$SELECT(FBFILE=3:"Outpatient/Ancillary",FBFILE=5:"Pharmacy",FBFILE=9:"Inpatient",1:"Unknown")
+31 WRITE ?31,$JUSTIFY($FNUMBER(FBCL+FBCC,","),9)
+32 WRITE ?42,$JUSTIFY($FNUMBER(FBCX,","),9)
+33 WRITE ?53,$JUSTIFY($FNUMBER(FBCL+FBCC+FBCX,","),9)
+34 WRITE ?64,$JUSTIFY($FNUMBER(FBCA,","),14)
+35 ;
+36 ; add file type counts to station totals
+37 SET $PIECE(FBT(FBSTA),U)=$PIECE(FBT(FBSTA),U)+FBCL+FBCC
+38 SET $PIECE(FBT(FBSTA),U,2)=$PIECE(FBT(FBSTA),U,2)+FBCX
+39 SET $PIECE(FBT(FBSTA),U,3)=$PIECE(FBT(FBSTA),U,3)+FBCA
End DoDot:2
if FBQUIT
QUIT
+40 ;
+41 ; write station total
+42 WRITE !,?31,"---------",?42,"---------",?53,"---------",?64,"--------------"
+43 WRITE !,FBSTA," Station Totals",?31,$JUSTIFY($FNUMBER($PIECE(FBT(FBSTA),U),","),9)
+44 WRITE ?42,$JUSTIFY($FNUMBER($PIECE(FBT(FBSTA),U,2),","),9)
+45 WRITE ?53,$JUSTIFY($FNUMBER($PIECE(FBT(FBSTA),U)+$PIECE(FBT(FBSTA),U,2),","),9)
+46 WRITE ?64,$JUSTIFY($FNUMBER($PIECE(FBT(FBSTA),U,3),","),14)
+47 ;
+48 ; add station totals to grand total
+49 SET $PIECE(FBT,U)=$PIECE(FBT,U)+$PIECE(FBT(FBSTA),U)
+50 SET $PIECE(FBT,U,2)=$PIECE(FBT,U,2)+$PIECE(FBT(FBSTA),U,2)
+51 SET $PIECE(FBT,U,3)=$PIECE(FBT,U,3)+$PIECE(FBT(FBSTA),U,3)
End DoDot:1
if FBQUIT
QUIT
+52 ;
+53 if FBQUIT
QUIT
+54 ;
+55 ; write report totals
+56 WRITE !!,?31,"=========",?42,"=========",?53,"=========",?64,"=============="
+57 WRITE !,"Report Totals",?31,$JUSTIFY($FNUMBER($PIECE(FBT,U),","),9)
+58 WRITE ?42,$JUSTIFY($FNUMBER($PIECE(FBT,U,2),","),9)
+59 WRITE ?53,$JUSTIFY($FNUMBER($PIECE(FBT,U)+$PIECE(FBT,U,2),","),9)
+60 WRITE ?64,$JUSTIFY($FNUMBER($PIECE(FBT,U,3),","),14)
+61 QUIT
+62 ;
HD ; page header
+1 NEW FBI
+2 IF $DATA(ZTQUEUED)
IF $$S^%ZTLOAD
SET ZTSTOP=1
SET FBQUIT=1
QUIT
+3 IF $EXTRACT(IOST,1,2)="C-"
IF FBPG
SET DIR(0)="E"
DO ^DIR
KILL DIR
IF 'Y
SET FBQUIT=1
QUIT
+4 IF $EXTRACT(IOST,1,2)="C-"!FBPG
WRITE @IOF
+5 SET FBPG=FBPG+1
+6 WRITE !,"FPPS Transmission Report ",?49,FBDTR,?72,"page ",FBPG
+7 SET FBI=0
FOR
SET FBI=$ORDER(FBHDT(FBI))
if 'FBI
QUIT
WRITE !,FBHDT(FBI)
+8 WRITE !,FBDL
+9 QUIT
+10 ;
HDSUM ; report summary header
+1 WRITE !!,?31,"------------- Transmission Counts -------------"
+2 WRITE !,?31,"Payment",?42,"Payment",?64,"Accepted by"
+3 WRITE !,"Station",?9,"Invoice Type",?31,"Confirmed",?42,"Cancelled",?53,"Total",?64,"Interface Eng."
+4 WRITE !,"-------",?9,"------------",?31,"---------",?42,"---------",?53,"---------",?64,"--------------"
+5 QUIT
+6 ;
+7 ;FBFPTR