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

BARDMU.m

Go to the documentation of this file.
BARDMU ;IHS/OIT/FCJ - DEBT MANAGEMENT UTILITY ROUTINE ; 26 May 2011  8:33 AM
 ;;1.8;IHS ACCOUNTS RECEIVABLE;**22,23,24**;OCT 26, 2005;Build 69
 ;New routine 5-12-2011 for Debt Letter Management
 ;IHS/SD/POT JAN  2013 ADDED SORTING PARAMETER, PRT BILL DATE (TO SITE PARAMETERS) - BAR*1.8*.23
 ;IHS/SD/POT FEB  2013 CHANGED PTR TO INSURER TYPE - BAR*1.8*.23
 ;IHS/SD/POT JUL 2013 HEAT118656 BELCOURT: SKIP UNDEF ENTRY IN ^BARBL - BAR*1.8*.24
 ;IHS/SD/POT HEAT152452 2/10/2014 CHK IF PAR/SAT FILE CORECTLY SET UP  - BAR*1.8*.24
PAR ;EP;SET LETTER PARAMETERS
 S BARPIEN="",BARPNM=""
 S BARPIEN=$P($G(^BAR(90052.05,DUZ(2),DUZ(2),0)),U,3) ;- BAR*1.8*.24
 I BARPIEN="" D  Q
 . W !!!,$P(^DIC(4,DUZ(2),0),U)," IS NOT REGIONALLY SETUP"
 . W !,"CONTACT YOUR A/R MANAGER",*7
 . S BARQ=1
 . D EOP
 ;END OF NEW CODE
 S BARPNM=$P(^AUTTLOC(BARPIEN,0),U,2)
 S BARPAR=^BAR(90052.06,BARPIEN,DUZ(2),17)
 S BARPAR1=^BAR(90052.06,BARPIEN,DUZ(2),18)  ;bar*1.8*22 SDR
 S (BARPSDI,Y)=$P(BARPAR,U)
 I Y D DD^%DT S BARPSDX=Y
 S BARPWO=$P(BARPAR,U,2),BARPNPI=$$VAL^XBDIQ1(90052.06,DUZ(2),1703)
 S BARPDOB=$$VALI^XBDIQ1(90052.06,DUZ(2),1704)="Y"
 S BARPBDT=$$VALI^XBDIQ1(90052.06,DUZ(2),1901)="Y" ;BILL DATE ;- BAR*1.8*.23
 S BARPSRT=$$VALI^XBDIQ1(90052.06,DUZ(2),1902) ;SORT BY <NIL>,P(OLICY HOLDER), I(INSURANCE NAME)
 ;CYCLE LETTER AND PERIOD
 S C=1
 F I=1:2:8 S BARPCL(C)=$$VAL^XBDIQ1(90052.06,DUZ(2),1704+I),C=C+1
 S C=1
 F I=1:2:8 S BARPCD(C)=$$VAL^XBDIQ1(90052.06,DUZ(2),1705+I),C=C+1
 ;LAST RUN DATE FOR BILL SEARCH
 S BARDRDT=$P($G(^BAR(90052.06,BARPIEN,DUZ(2),18)),U,7)
 S BARPMX=$P($G(^BAR(90052.06,BARPIEN,DUZ(2),18)),U,8)
 Q
 ;
INS ;EP;BAR DL SITE PARAM ACCOUNT OPTION
 ;ADD INSURER TYPES TO BE TESTED TO PRINT LETTERS
 D PAR
 S BARQ=0,BARCT=0
 I $D(^BAR(90052.06,BARPIEN,DUZ(2),19)) S BARB=0 F  S BARB=$O(^BAR(90052.06,BARPIEN,DUZ(2),19,BARB)) Q:BARB'?1N.N  D
 .S BARB1=$P(^BAR(90052.06,BARPIEN,DUZ(2),19,BARB,0),U)
 .S BARI(BARB1)=$P(^BAR(90053.03,BARB1,0),U,2),BARCT=BARCT+1
 ;
 I '$D(^BAR(90052.06,BARPIEN,DUZ(2),19,0)) S ^(0)="^90052.0603P^^0"
 S DIE="^BAR(90052.06,"_BARPIEN_",",DA=DUZ(2),DR=1900
 W ! D ^DIE
 I $D(^BAR(90052.06,BARPIEN,DUZ(2),19)) S BARB=0 F  S BARB=$O(^BAR(90052.06,BARPIEN,DUZ(2),19,BARB)) Q:BARB'?1N.N  D
 .I $D(BARI($P(^BAR(90052.06,BARPIEN,DUZ(2),19,BARB,0),U))) K BARI($P(^BAR(90052.06,BARPIEN,DUZ(2),19,BARB,0),U)) S BARCT=BARCT-1
 I BARCT>0 D DEL
 K BARQ,BARI,DIE,DR,DA
 ;
ACC ;ACCOUNT SELECTION
 ;ADD ACCOUNTS TO BE TESTED TO PRINT LETTERS
 S BARQ=0
 S (DIE,DIC)="^BARAC("_DUZ(2)_",",DIC(0)="AEQZ",DR=7
 F  D  Q:BARQ
 .W ! D ^DIC
 .I $D(Y),+Y<0 S BARQ=1 Q
 .I $D(Y),+Y>0 S DA=+Y D ^DIE S $P(^BAR(90052.06,BARPIEN,DUZ(2),18,0),U,7)=0 I %="NO" S BARI(DA)=DA
 D:$D(BARI) DELA
 K BARQ,DIE,DIC,DA,DR
 Q
 ;
DEL ;DELETE ENTRIES FROM BILL FILE IF LETTERS HAVE NOT BEEN PRINTED
 W !,"Deleting entries from Bill file if letters do not exist for deleted Insurer type."
 S BARB=0 F  S BARB=$O(^BARDM(DUZ(2),"S","Q","CYCLE 1",BARB)) Q:BARB'?1N.N  D
 . S BARBIEN=$P(^BARDM(DUZ(2),BARB,0),U)
 . I '$D(^BARBL(DUZ(2),BARBIEN,0)) D  Q  ;HEAT118656 BELCOURT P.OTT
 .. I $P($G(^VA(200,DUZ,0)),U,4)'="@" Q
 .. W !,"MISSING DATA IN ^BARBL(",DUZ(2),",",BARBIEN
 .. Q
 .S BARDAC=$P(^BARBL(DUZ(2),BARBIEN,0),U,3)
 .D INSTYP
 .S BARB1=0 F  S BARB1=$O(BARI(BARB1)) Q:BARB1'?1N.N  I BARI(BARB1)=BARDITY S DIK="^BARDM("_DUZ(2)_",",DA=BARB D ^DIK  ;bar*1.8*22 SDR
 .K DIK
 Q
 ;
DELA ;DELETE ACCOUNTS
 W !,"Deleting entries from Bill file if letters do not exist for deleted Account."
 S BARB=0 F  S BARB=$O(^BARDM(DUZ(2),"S","Q","CYCLE 1",BARB)) Q:BARB'?1N.N  D
 .S BARBIEN=$P(^BARDM(DUZ(2),BARB,0),U)
 . I '$D(^BARBL(DUZ(2),BARBIEN,0)) D  Q  ;HEAT118656 BELCOURT P.OTT - BAR*1.8*.24
 .. I $P($G(^VA(200,DUZ,0)),U,4)'="@" Q
 .. W !,"MISSING DATA IN ^BARBL(",DUZ(2),",",BARBIEN
 .. Q
 . S BARDAC=$P(^BARBL(DUZ(2),BARBIEN,0),U,3) I BARDAC=168 W !,BARB
 . I $D(BARI(BARDAC)) S DIK="^BARDM("_DUZ(2)_",",DA=BARB D ^DIK
 . K DIK
 Q
 ;
INSTYP ;EP
 ;$$GET1^DIQ(9999999.18,BARIIEN,.211,"I")=21
 ;$$GET1^DIQ(9999999.18,BARIIEN,.211,"E")="VETERANS ADMINISTRATION"
 ;$$GET1^DIQ(9999999.18,BARIIEN,.211)="VETERANS ADMINISTRATION"
 S BARDACI=0 ;ACCT .01 VAR POINTER
 S BARDACG=0  ;ACCT .01 VAR GLB
 S BARDITY=""
 S BARDACI=$P($P(^BARAC(DUZ(2),BARDAC,0),U),";")
 S BARDACG=$P($P(^BARAC(DUZ(2),BARDAC,0),U),";",2)
 S BARDITY=$$GET1^DIQ(90050.02,BARDAC,"1.08","E")  ;bar*1.8*22 SDR (=>MEDICARE FI)
 I BARDACG="AUTNINS(" S BARDIT=$$VAL^XBDIQ1(9999999.18,BARDACI,.211) Q  ;(=>MEDICARE FI)
 S BARDIT=$S(BARDACG="VA(":"NEW PERSON",BARDACG="AUPNPAT(":"PATIENT","AUTTVNDR(":"VENDOR",1:"OTHER")
 Q
 ;
ZIS ;EP;
 W ! S DIR(0)="S^P:PRINT Output;B:BROWSE Output on Screen",DIR("A")="Do you wish to",DIR("B")="P" K DA D ^DIR K DIR
 I $D(DIRUT) S BARQUIT="" Q
 S BAROPT=Y
 Q
RRDT ;EP;REPORT RUN DATE
 D BARPSAT^BARUTL0
 S Y=DT
 D DD^%DT S BARRDT=Y
 S BARPG=0  ;bar*1.8*22 SDR
 Q
RTRN ;EP - ask usr to press RET
 S BARDLQ=0
 I IOST["C-",'$D(IO("S")) W ! S Y=$$DIR^XBDIR("E","Press RETURN To Continue ^ to Cancel...","","","",1) X ^%ZOSF("TRMRD") I Y=0!(Y=27)!(X=U) S BARDLQ=1
 Q
SEL ;EP;SELECT BILL
 S (BARQ,BARREQ)=0
 S (DIE,DIC)="^BARDM("_DUZ(2)_","
 S DIC("A")="Enter the Debt Management Bill: "
 S DIC(0)="AEQ"
 D ^DIC
 I +Y<1 S BARQ=1 Q
 S BARDM=+Y
 Q
EOP ;EP
 Q:$G(IOT)'["TRM"
 Q:$E($G(IOST))'="C"
 Q:$D(IO("S"))
 Q:$D(ZTQUEUED)
 K DIR
 S DIR(0)="E"
 S DIR("A")="Enter RETURN to continue"
 D ^DIR
 K DIR
 Q