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

DGBTR125.m

Go to the documentation of this file.
DGBTR125 ;ALB/RFE - SPECIAL MODE REPORT; 06/22/12
 ;;1.0;Beneficiary Travel;**20**;November 11, 2011;Build 185
 Q
EN ;Entry point
 N %,%Y,DATALINE,DENY,DFN,DGBTDIVN,DGBTEXC,DGBTQ,ENAME,ENDDT,ENTRY,EQUAL,GRAND,I,LINESP,LINEZERO,PAGE,PATNAME,PDT,POP,PROMPT,REPTYPE,SNAME,SQ1,SQ2
 N STARTDT,X,X2,X3,Y,ZTQUEUED
 D CLEAN^DILF
 S X2="2$"
 K DIR
 S DIR("A")="START DATE: ",DIR(0)="DA^2991231:NOW:EX" D ^DIR K DIR
 I ($D(DIRUT))!($D(DIROUT)) D CLEAN^DILF Q
 S STARTDT=Y
 S DIR("A")="END DATE: ",DIR(0)="DA^"_STARTDT_":NOW:EX" D ^DIR K DIR
 I ($D(DIRUT))!($D(DIROUT)) D CLEAN^DILF Q
 S ENDDT=Y
 D
 .I $$GET1^DIQ(43,1,11,"I") D  Q
 ..S DGBTDIVN=$$YESNO^DGBTUTL("Do you wish to run this report for all divisions")
 ..I DGBTDIVN S DGBTDIVN="ALL" Q
 ..I (($D(DIRUT))!($D(DTOUT))!($D(DUOUT))) Q
 ..K DIR S DIR(0)="P^40.8:EMZ" D ^DIR K DIR
 ..I (($D(DIRUT))!($D(DTOUT))!($D(DUOUT))) Q
 ..S DGBTDIVN=+Y
 .S DGBTDIVN=$O(^DG(40.8,0))
 I (($D(DIRUT))!($D(DTOUT))!($D(DUOUT))) D CLEAN^DILF Q
 F  D  Q:DONE
 .S DONE=1
 .K DIR S DIR("A")="START NAME",DIR("B")="AAA",DIR(0)="F^1:30^" D ^DIR K DIR
 .I ($D(DIRUT))!($D(DIROUT)) Q
 .S SNAME=$$UP^XLFSTR(Y)
 .K DIR S DIR("A")="END NAME",DIR("B")="ZZZ",DIR(0)="F^1:30^" D ^DIR K DIR
 .I ($D(DIRUT))!($D(DIROUT)) Q
 .S ENAME=$$UP^XLFSTR(Y)
 .I SNAME]ENAME W !,"START NAME CANNOT FOLLOW END NAME" S DONE=0 Q
 K DONE
 I ($D(DIRUT))!($D(DIROUT)) D CLEAN^DILF Q
 K DIR
 S DIR(0)="S^F:FULL;T:TOTAL",DIR("A")="Which claim type do you want to run?" D ^DIR K DIR
 I (($D(DIRUT))!($D(DTOUT))!($D(DUOUT))) D CLEAN^DILF Q
 S REPTYPE=Y
 D SETPRT,QUIT
 Q
SETPRT ;
 S DGBTEXC=$$SELEXCEL^DGBTUTL
 I DGBTEXC="^" Q
 I 'DGBTEXC N COLWID S COLWID=132 D PRINTMSG^DGBTUTL
 D DEVICE^DGBTUTL("Beneficiary Travel Special Mode Report","MAIN^DGBTR125(DGBTEXC,STARTDT,ENDDT,DGBTDIVN,SNAME,ENAME,REPTYPE)",DGBTEXC,132)
 I $G(DGBTQ) Q
 ;
 I $D(IO("Q")) D:'$D(ZTQUEUED) ^%ZISC Q
 D MAIN(DGBTEXC,STARTDT,ENDDT,DGBTDIVN,SNAME,ENAME,REPTYPE)
 D:'$D(ZTQUEUED) ^%ZISC
 U IO
 Q
MAIN(DGBTEXC,STARTDT,ENDDT,DGBTDIVN,SNAME,ENAME,REPTYPE) ;
 K ^TMP("DGBTR125",$J)
 D GETRECS
 I '$D(^TMP("DGBTR125",$J)) W !,"No records found" D QUIT Q
 D PRINT
 Q
GETRECS ;
 I REPTYPE="F" F I="CLAIMS","MILE","BASE RATE","MILEAGE FEE","NSNL","WAIT TIME","EXTRA CREW","SPECIAL EQUIPMENT","INVOICE AMT" S GRAND(I)=0
 I REPTYPE="T" F I="PAID","DENIED","CLAIMS","NSNL","PAID AMT" S GRAND(I)=0
 S ENTRY=$O(^DGBT(392,"D",STARTDT),-1)
 F  S ENTRY=$O(^DGBT(392,"D",ENTRY)) Q:ENTRY=""  Q:ENTRY>ENDDT  D
 .S I=""
 .F  S I=$O(^DGBT(392,"D",ENTRY,I)) Q:I=""  D GETLINE
 Q
GETLINE ; 
 S LINEZERO=$G(^DGBT(392,I,0))
 I '$$DIV Q
 S DATALINE=""
 I $$GET1^DIQ(392,I,56,"I")'="S" Q
 S DFN=$P(LINEZERO,U,2) Q:DFN=""
 S PATNAME=$$GET1^DIQ(2,DFN,.01)
 I '$$NMRNG^DGBTUTL(PATNAME,SNAME,ENAME,1) Q
 S LINESP=$G(^DGBT(392,I,"SP"))
 S DATALINE=""
 I REPTYPE="F" D GLFULL
 I REPTYPE="T" D GLTOTAL
 I DATALINE'="" S ^TMP("DGBTR125",$J,SQ1,SQ2)=DATALINE
 Q
DIV() ;
 I DGBTDIVN="ALL" Q 1
 Q $P(LINEZERO,U,11)=DGBTDIVN
GLFULL ; Special mode full
 S SQ1=ENTRY
 S SQ2=$O(^TMP("DGBTR125",$J,SQ1,""),-1)+1
 S GRAND("CLAIMS")=GRAND("CLAIMS")+1
 S $P(DATALINE,U)=PATNAME
 S $P(DATALINE,U,2)=$$FMTE^XLFDT($P($P(LINEZERO,U),".")) ; Claim date/time
 S $P(DATALINE,U,3)=$$GET1^DIQ(392.42,$P(LINESP,U),.01) ; Mode of transportation
 S $P(DATALINE,U,4)=$P(LINESP,U,2) ; Invoice #
 S $P(DATALINE,U,5)=$$FMTE^XLFDT($P(LINESP,U,3)) ; Invoice date
 S $P(DATALINE,U,6)=$$GET1^DIQ(392,I,67,"I") ; One way/round trip
 S $P(DATALINE,U,7)=$P(LINESP,U,12) ; Miles
 S GRAND("MILE")=GRAND("MILE")+$P(LINESP,U,12)
 S $P(DATALINE,U,8)=$$DLRAMT($P(LINESP,U,5)) ; Base rate fee
 S GRAND("BASE RATE")=GRAND("BASE RATE")+$P(LINESP,U,5)
 S $P(DATALINE,U,9)=$$DLRAMT($P(LINESP,U,6)) ; Mileage fee
 S GRAND("MILEAGE FEE")=GRAND("MILEAGE FEE")+$P(LINESP,U,6)
 S $P(DATALINE,U,10)=$$DLRAMT($P(LINESP,U,7)) ; No show/no load fee
 S GRAND("NSNL")=GRAND("NSNL")+$P(LINESP,U,7)
 S $P(DATALINE,U,11)=$$DLRAMT($P(LINESP,U,8)) ; Wait time fee
 S GRAND("WAIT TIME")=GRAND("WAIT TIME")+$P(LINESP,U,8)
 S $P(DATALINE,U,12)=$$DLRAMT($P(LINESP,U,9)) ; Extra crew fee
 S GRAND("EXTRA CREW")=GRAND("EXTRA CREW")+$P(LINESP,U,9)
 S $P(DATALINE,U,13)=$$DLRAMT($P(LINESP,U,10)) ; Special equipment fee
 S GRAND("SPECIAL EQUIPMENT")=GRAND("SPECIAL EQUIPMENT")+$P(LINESP,U,10)
 S $P(DATALINE,U,14)=$$DLRAMT($P(LINESP,U,4)) ; Total invoice amount
 S GRAND("INVOICE AMT")=GRAND("INVOICE AMT")+$P(LINESP,U,4)
 S $P(DATALINE,U,15)=$$GET1^DIQ(40.8,$P(LINEZERO,U,11),.01) ; Division
 S $P(DATALINE,U,16)=$$GET1^DIQ(440,$P(LINESP,U,14),.01) ; Vendor
 S $P(DATALINE,U,17)=$S($$GET1^DIQ(392,I,45.2,"I"):"D",1:"")
 Q
GLTOTAL ; Special mode total
 S SQ1=$P(LINEZERO,U,11)_"^"_$$GET1^DIQ(392.42,$P(LINESP,U),.01)
 S SQ2=0
 S DENY=$$GET1^DIQ(392,I,45.2,"I")
 S DATALINE=$G(^TMP("DGBTR125",$J,SQ1,SQ2))
 S $P(DATALINE,U)=$P(DATALINE,U)+$S(DENY:0,1:1) ;claims paid
 I 'DENY S GRAND("PAID")=GRAND("PAID")+1
 S $P(DATALINE,U,2)=$P(DATALINE,U,2)+$S(DENY:1,1:0) ; Claims denied
 I DENY S GRAND("DENIED")=GRAND("DENIED")+1
 S $P(DATALINE,U,3)=1+$P(DATALINE,U,3) ; Number of claims
 S GRAND("CLAIMS")=GRAND("CLAIMS")+1
 S $P(DATALINE,U,4)=$P(DATALINE,U,4)+$S('DENY:$P(LINESP,U,7),1:0) ; No show/no load
 I 'DENY S GRAND("NSNL")=GRAND("NSNL")+$P(LINESP,U,7)
 S $P(DATALINE,U,5)=$P(DATALINE,U,5)+$S('DENY:$P(LINESP,U,4),1:0) ; Invoice
 I 'DENY S GRAND("PAID AMT")=GRAND("PAID AMT")+$P(LINESP,U,4)
 Q
PRINT ;
 U IO
 S $P(EQUAL,"=",133)="",PAGE=0
 D NOW^%DTC S Y=% D DD^%DT S PDT=Y
 I 'DGBTEXC D
 .I REPTYPE="F" D HDRFUL
 .I REPTYPE="T" D HDRTOT
 I DGBTEXC D
 .I REPTYPE="F" D
 ..W "ENTRY DATE^PATIENT^CLAIM DATE^CC MODE^INV #^INV DT^R/O^MILES^BASE RATE^MILE FEE^NO SHOW NO LOAD^WAIT TIME^EXTRA CREW^SPECIAL EQUIPMENT^INV AMT^"
 ..W "DIVISION^VENDOR^STATUS"
 .I REPTYPE="T" D
 ..W "DIVISION^# PAID^# DENIED ^BY MODE^NSNL^INVOICE PAID^MODE"
 S (PROMPT,SQ1)=""
 F  S SQ1=$O(^TMP("DGBTR125",$J,SQ1)) Q:SQ1=""  D  Q:PROMPT="^"
 .S SQ2=""
 .F  S SQ2=$O(^TMP("DGBTR125",$J,SQ1,SQ2)) Q:SQ2=""  D  Q:PROMPT="^"
 ..S DATALINE=^TMP("DGBTR125",$J,SQ1,SQ2)
 ..I DGBTEXC D PRTXL Q
 ..I ($Y+$S(REPTYPE="F":4,1:2))>IOSL D  Q:PROMPT="^"
 ...I ($E(IOST,1)="C"),(IOSL'[99) R !,"Please press ENTER to continue or '^' to stop ",PROMPT:DTIME Q:PROMPT="^"
 ...I REPTYPE="F" D HDRFUL
 ...I REPTYPE="T" D HDRTOT
 ..I REPTYPE="F" D PRTFUL
 ..I REPTYPE="T" D PRTTOT
 I 'DGBTEXC D
 .I ($Y+4)<IOSL W !!!
 .I REPTYPE="F" D GRANDFUL
 .I REPTYPE="T" D GRANDTOT
 I IOST["C-" S Y=$$PAUSE^DGBTUTL(DGBTEXC)
 I IOST'["C-" W !,"REPORT HAS FINISHED"
 Q
PRTXL ;
 I REPTYPE="F" D
 . W !,$$FMTE^XLFDT($P(SQ1,U)),U,DATALINE
 I REPTYPE="T" D
 .W !,$$GET1^DIQ(40.8,$P(SQ1,U),.01),U F I=1:1:3 W $P(DATALINE,U,I),U
 .W $$DLRAMT($P(DATALINE,U,4)),U,$$DLRAMT($P(DATALINE,U,5)),U,$P(SQ1,U,2)
 Q
PRTFUL ;
 W !,$P(DATALINE,U),?32,$P(DATALINE,U,2),?52,$P(DATALINE,U,3),?84,$P(DATALINE,U,4),?116,$P(DATALINE,U,5)
 W !,?5,$P(DATALINE,U,6),?17,$P(DATALINE,U,7),?27,$P(DATALINE,U,8),?42,$P(DATALINE,U,9),?52,$P(DATALINE,U,10),?63,$P(DATALINE,U,11)
 W ?73,$P(DATALINE,U,12),?83,$P(DATALINE,U,13),?94,$P(DATALINE,U,14),?105,$$FMTE^XLFDT(SQ1)
 W !,?5,$P(DATALINE,U,15),?37,$P(DATALINE,U,16),?75,$P(DATALINE,U,17)
 Q
PRTTOT ;
 W !,$$GET1^DIQ(40.8,$P(SQ1,U),.01),?37,$P(DATALINE,U),?43,$P(DATALINE,U,2),?51,$P(DATALINE,U,3),?59,$$DLRAMT($P(DATALINE,U,4))
 W ?74,$$DLRAMT($P(DATALINE,U,5)),?90,$P(SQ1,U,2)
 Q
HDRFUL ;
 S PAGE=PAGE+1
 W @IOF
 W "BT SPECIAL MODE FULL REPORT      PRINT DATE: ",PDT,?(126-$L(PAGE)),"PAGE ",PAGE
 W !,$$FMTE^XLFDT(STARTDT)," TO ",$$FMTE^XLFDT(ENDDT)
 W !,"FIRST VETERAN NAME: ",SNAME
 W !,"LAST VETERAN NAME: ",ENAME
 W !,"DIVISION: ",$S(DGBTDIVN="ALL":"ALL",1:$$GET1^DIQ(40.8,DGBTDIVN,.01))
 W !,$E(EQUAL,1,128)
 W !,"PATIENT NAME",?32,"CLAIM DATE",?52,"MODE",?84,"INV #",?116,"INVOICE DATE"
 w !?5,"R/O",?17,"MILES",?27,"BASE RATE",?42,"MILEAGE",?52,"NSNL",?63,"WAIT FEE",?73,"EXT CREW",?83,"SPEC EQ",?94,"INV AMT",?105,"ENTRY DATE"
 W !?5,"DIVISION",?37,"VENDOR",?75,"STATUS"
 W !,$E(EQUAL,1,128)
 Q
HDRTOT ;
 S PAGE=PAGE+1
 W @IOF
 W "BT SPECIAL MODE TOTAL REPORT      PRINT DATE: ",PDT,?(126-$L(PAGE)),"PAGE ",PAGE
 W !,$$FMTE^XLFDT(STARTDT)," TO ",$$FMTE^XLFDT(ENDDT)
 W !,"FIRST VETERAN NAME: ",SNAME
 W !,"LAST VETERAN NAME: ",ENAME
 W !,"DIVISION: ",$S(DGBTDIVN="ALL":"ALL",1:$$GET1^DIQ(40.8,DGBTDIVN,.01))
 W !,$E(EQUAL,1,126)
 W !,"DIVISION",?37,"PAID",?43,"DENIED",?51,"CLAIMS",?59,"NSNL",?74,"INV PAID",?90,"MODE"
 W !,$E(EQUAL,1,126)
 Q
GRANDFUL ;
 I ($Y+5)>IOSL D
 .S PAGE=PAGE+1
 .W @IOF
 .W "BT SPECIAL MODE FULL REPORT      PRINT DATE: ",PDT,?(126-$L(PAGE)),"PAGE ",PAGE
 .W !,$$FMTE^XLFDT(STARTDT)," TO ",$$FMTE^XLFDT(ENDDT)
 .W !,"FIRST VETERAN NAME: ",SNAME
 .W !,"LAST VETERAN NAME: ",ENAME
 .W !,"DIVISION: ",$S(DGBTDIVN="ALL":"ALL",1:$$GET1^DIQ(40.8,DGBTDIVN,.01))
 W !,$E(EQUAL,1,128)
 W !,"GRAND TOTALS:",?17,"MILES",?27,"BASE RATE",?42,"MILEAGE",?52,"NSNL",?63,"WAIT FEE",?73,"EXT CREW",?83,"SPEC EQ",?94,"INV AMT",?105,"CLAIMS"
 W !,?17,GRAND("MILE"),?27,$$DLRAMT(GRAND("BASE RATE")),?42,$$DLRAMT(GRAND("MILEAGE FEE")),?52,$$DLRAMT(GRAND("NSNL"))
 W ?63,$$DLRAMT(GRAND("WAIT TIME")),?73,$$DLRAMT(GRAND("EXTRA CREW")),?83,$$DLRAMT(GRAND("SPECIAL EQUIPMENT"))
 W ?94,$$DLRAMT(GRAND("INVOICE AMT")),?105,GRAND("CLAIMS")
 W !,$E(EQUAL,1,128)
 Q
GRANDTOT ;
 I ($Y+5)>IOSL D
 .S PAGE=PAGE+1
 .W @IOF
 .W "BT SPECIAL MODE TOTAL REPORT      PRINT DATE: ",PDT,?(126-$L(PAGE)),"PAGE ",PAGE
 .W !,$$FMTE^XLFDT(STARTDT)," TO ",$$FMTE^XLFDT(ENDDT)
 .W !,"FIRST VETERAN NAME: ",SNAME
 .W !,"LAST VETERAN NAME: ",ENAME
 .W !,"DIVISION: ",$S(DGBTDIVN="ALL":"ALL",1:$$GET1^DIQ(40.8,DGBTDIVN,.01))
 W !,$E(EQUAL,1,126)
 W !,"GRAND TOTALS:",?37,"PAID",?43,"DENIED",?51,"CLAIMS",?59,"NSNL",?74,"INV PAID"
 W !,?37,GRAND("PAID"),?43,GRAND("DENIED"),?51,GRAND("CLAIMS"),?59,$$DLRAMT(GRAND("NSNL")),?74,$$DLRAMT(GRAND("PAID AMT"))
 W !,$E(EQUAL,1,126)
 Q
DLRAMT(X) ;
 D COMMA^%DTC I 'DGBTEXC Q $TR(X," ","")
 Q $TR(X," ,$","")
QUIT ;
 K ^TMP("DGBTR125",$J)
 D CLEAN^DILF
 Q