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

BARDMRQ.m

Go to the documentation of this file.
BARDMRQ ;IHS/OIT/FCJ - DEBT MANAGEMENT-QUE LETTER REPORT
 ;;1.8;IHS ACCOUNTS RECEIVABLE;**22,23,24**;OCT 26, 2005;Build 69
 ;New routine 5-12-2011 for Debt Letter Management
 ;
 ;This report will provide letters ready to be printed by cycle, Insurer and detail
 ;IHS/SD/POT SEP 2012 ADDED PAUSE AFTER MESSAGE- BAR*1.8*.23
 ;IHS/SD/POT MAY 2013 CORRECTED SELD (1-0) & ALLOWED LOOP TO SELECT DETAILS - BAR*1.8*.24
 ;IHS/SD/POT HEAT152452 2/10/2014 CHK IF PAR/SAT FILE CORECTLY SET UP  - BAR*1.8*.24
ST ;
 ;
 D PAR^BARDMU
 Q:$G(BARQ)  ;P.OTT HEAT152452 2/10/2014 - BAR*1.8*.24
 N BARXYZ ;P.OTT
 K ^TMP("BARDM",$J)  ;
 S BMCQ=0,BARRPT="Q",BARSEQ=0
 D SELC G:$D(DIRUT) XIT
 D SELI G:$D(DIRUT) XIT
 D:'$D(BARDCI) SELA G:$D(DIRUT) XIT
 D CALC^BARDMRU
 G:$G(BARQ) XIT
 ;D PRINT
 ;Q:(BMCQ=1)&(BARCY'="A")
 ;I 'BARSEQ W !!,"**NO DATA TO PRINT **" H 3 G XIT ;P.OTT
 ;S BARXYZ=BARSEQ ;KEEP MAX VALUE
 ;F  S BARSEQ=BARXYZ D SELD Q:(BMCQ=1)
TRT ;<--------------
 S BARSEQ=0
 D PRINT
 Q:(BMCQ=1)&(BARCY'="A")
 I 'BARSEQ W !!,"**NO DATA TO PRINT **" H 3 G XIT ;- BAR*1.8*.23
 D SELD
 I Y<1 G XIT
 G TRT ;-----> ;BAR*1.8*.23
XIT ;
 K ^TMP("BARDM",$J)
 K DIR
 K BARL
 Q
 ;
SELC ;SELECT CYCLE
 S DIR(0)="S^1:CYCLE 1;2:CYCLE 2;3:CYCLE 3;4:CYCLE 4;A:ALL"
 S DIR("A")="Select Cycle to View"
 S DIR("B")="All",DIR("L")=""
 S DIR("?")="Enter 1, 2, 3, 4 or A to view or all cycles"
 S DIR("?",1)="   1 - CYCLE 1"
 S DIR("?",2)="   2 - CYCLE 2"
 S DIR("?",3)="   3 - CYCLE 3"
 S DIR("?",4)="   4 - CYCLE 4"
 D ^DIR
 Q:$D(DIRUT)
 S BARCY=Y,BARCYN=Y(0)
 K DIR Q
 ;
SELI ;SELECT INSURANCE TYPE
 S DIC="^BAR(90052.06,"_DUZ(2)_","_DUZ(2)_",19,"
 S DIC(0)="AEQZ",DIC("A")="View by Insurer Type: "
 D ^DIC
 Q:$D(DUOUT)
 S:$G(Y(0)) BARDCI=$$GET1^DIQ(90053.03,Y(0),".01","E")  ;
 I $G(BARDCI)["NON-BEN" S BARDCI="PATIENT"  ;non-bens are listed under PATIENT in ^TMP("BARDM",$J) global  ;
 K DIC,DA
 Q
 ;
SELA ;SELECT ACCOUNT
 S DIC="^BARAC("_DUZ(2)_","
 S DIC(0)="AEQZ",DIC("A")="View by Account: "
 S DIC("S")="I $P(^(0),U,7)=""Y"""
 D ^DIC
 Q:$D(DUOUT)
 I $G(Y(0)) S BARDAC=$P(Y,U),BARDCA=$$VAL^XBDIQ1(90050.02,BARDAC,.01)
 K DIC,DA
 Q
SELD ;SELECT DETAIL
 S BMCQ=0
 S DIR(0)="Y"
 S DIR("A")="Show Detail"
 S DIR("B")="N"
 W ! D ^DIR
 I Y=0 S BMCQ=1 Q
 K DIR
 S DIR(0)="NO^1:"_BARSEQ
 S DIR("A")="What sequence number"
 D ^DIR
 I Y<1 S BMCQ=1 Q
 I Y>0 S BARSEQ=Y D
 .D RRDT^BARDMU
 .S BARDL=$P(^TMP("BARDM",$J,BARSEQ),U),BARDIT=$P(^(BARSEQ),U,2),BARDI=$P(^(BARSEQ),U,3)  ;
 .D HDR2,DET
 K DIR
 Q
PRINT ;
 D HDR
 I BARCY="A" F BARDL="CYCLE 1","CYCLE 2","CYCLE 3","CYCLE 4" Q:$G(BARDLQ)  D TOT  ;
 E  S BARDL=BARCYN D TOT  ;
 Q
HDR ;
 W @IOF
 W !,"SEQ",?6,"CYCLE",?13,"INS TYPE/INS-ACCOUNT",?55,"# OF BILLS",?69,"AMOUNT",!
 F I=1:1:80 W "-"
 Q
HDR2 ;
 S BARPG=BARPG+1  ;
 W @IOF,!,BARRDT,?23,"LETTERS IN THE QUEUE READY TO PRINT",?70,"PAGE: ",BARPG  ;
 W !!,"A/R PARENT LOCATION: ",BARPSAT(DUZ(2),.01)
 W ?65,BARDL  ;
 W !,"A/R ACCOUNT: ",BARDI,?62,"PERIOD: ",BARPCD($P(BARDL," ",2))," Days"  ;
 W ! F I=1:1:80 W "="
 W !,?40,"SERVICE",?49,"BILLED",?60,"BILLED"
 W !,?2,"HRN",?8,"BILL #",?16,"PATIENT",?40,"DATE",?49,"DATE",?60,"AMOUNT",?72,"BALANCE"
 W ! F I=1:1:80 W "-"
 Q
TOT ;PRINT TOTALS
 I $P($G(^TMP("BARDM",$J,BARDL)),U)=0 W !!,BARDL," Does not contain any queued Letters" D  S BMCQ=1 Q  ; P.OTT PAUSE
 . K DIR S (X,Y)=""
 . S DIR(0)="E"
 . S DIR("A")="Enter RETURN to Continue"
 . D ^DIR
 . K DIR
 . QUIT
 S BARDIT=0  F  S BARDIT=$O(^TMP("BARDM",$J,BARDL,BARDIT)) Q:BARDIT=""  D  Q:$G(BARDLQ)  ;
 .S BARDI=0 F  S BARDI=$O(^TMP("BARDM",$J,BARDL,BARDIT,BARDI)) Q:BARDI=""  D  Q:$G(BARDLQ)  ;
 ..I $D(BARDCA) Q:BARDI'=BARDCA
 ..I $D(BARDCI) Q:BARDIT'=BARDCI
 ..S BARSEQ=BARSEQ+1,BARDITI=BARDIT_"/"_BARDI
 ..W !,BARSEQ,?5,BARDL,?13,$E(BARDITI,1,42),?55,$J($P(^TMP("BARDM",$J,BARDL,BARDIT,BARDI),U),7)  ;
 ..S X=$P(^TMP("BARDM",$J,BARDL,BARDIT,BARDI),U,3) D COMMA^%DTC W ?66,$J(X,12)  ;
 ..S ^TMP("BARDM",$J,BARSEQ)=BARDL_U_BARDIT_U_BARDI_U_$E(L,7)  ;
 ..I $Y>(IOSL-6) W ! D RTRN^BARDMU Q:$G(BARDLQ)  D HDR
 Q
DET ;DETAIL
 S BARDLQ=""
 S BARBIL=0  F  S BARBIL=$O(^TMP("BARDM",$J,BARDL,BARDIT,BARDI,BARBIL)) Q:BARBIL=""  D  Q:$G(BARDLQ)
 .S DFN=$P(^TMP("BARDM",$J,BARDL,BARDIT,BARDI,BARBIL),U),BARHRN=$P(^AUPNPAT(DFN,41,DUZ(2),0),U,2),BARPAT=$P(^DPT(DFN,0),U)
 .S BARDT=$P(^TMP("BARDM",$J,BARDL,BARDIT,BARDI,BARBIL),U,2)
 .S BARSDT=$E(BARDT,4,5)_"/"_$E(BARDT,6,7)_"/"_$E(BARDT,2,3)
 .S BARDT=$P(^TMP("BARDM",$J,BARDL,BARDIT,BARDI,BARBIL),U,3)
 .S BARBDT=$E(BARDT,4,5)_"/"_$E(BARDT,6,7)_"/"_$E(BARDT,2,3)
 .W !,BARHRN,?7,BARBIL,?16,$E(BARPAT,1,24),?40,BARSDT,?49,BARBDT
 .S X=$P(^TMP("BARDM",$J,BARDL,BARDIT,BARDI,BARBIL),U,4) W ?58,$J(X,10,2) ;D COMMA^%DTC W 
 .S X=$P(^TMP("BARDM",$J,BARDL,BARDIT,BARDI,BARBIL),U,5) W ?70,$J(X,10,2) ;D COMMA^%DTC W ?60,X
 .I $Y>(IOSL-6) W ! D RTRN^BARDMU Q:$G(BARDLQ)  D HDR2
 Q:$G(BARDLQ)
 W !,?58,"----------",?70,"----------"
 S TMP=^TMP("BARDM",$J,BARDL,BARDIT,BARDI)
 W !,"TOTAL",?38,$P(TMP,U),"  Bill(s)"
 S X=$P(TMP,U,2) W ?58,$J(X,10,2)
 S X=$P(TMP,U,3) W ?70,$J(X,10,2)
 W ! D RTRN^BARDMU Q:$G(BARDLQ)
 Q