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

BARDYSV8.m

Go to the documentation of this file.
BARDYSV8 ; IHS/SD/TPF - DAYS IN A/R REPORT CALLS ; 
 ;;1.8;IHS ACCOUNTS RECEIVABLE;**28**;OCT 26,2005;Build 92
 ;IHS/SD/POT-1.8*23-FEB 2013 CHANGED PTR TO INSURER TYPE
 ;IHS/SD/POT-1.8*23-APR 2013 RESOLVED NIL VALUES OF INSTYP AND ACTINS
 ;IHS/SD/SDR-1.8*28-Updated p23 documentation
 ;IHS/SD/SDR-1.8*28-Spint from
 ;IHS/SD/SDR-1.8*28-CR8345 HEAT224215 - Added code to look thru DUZ(2)s in 3P Bill file for visit IEN.  Changed couple FM calls to be straight code.
 ;  Lookups were failing due to multiple DUZ(2)s.  Captured detail in "DET" subscript for detail report.  Added code to populate last
 ;  pymt all the time; was only populated if multiple pymts were made.
 Q
FIRLSTPY(BILL3P) ;EP - FIND FIRST-LAST PAYMENT MADE IN TRANS FILE
 ;N RETURN,TRANIEN,BILLAR,FIRST,LAST  ;bar*1.8*28 CR8345 HEAT224215
 ;S BILL3P=BILL3P_" ",FIRST=0,LAST=0  ;bar*1.8*28 CR8345 HEAT224215
 S BILL3P=BILL3P_" "  ;bar*1.8*28 CR8345 HEAT224215
 ;FIND AR BILL IEN CORRESPONDING TO 3P BILL IEN USING ACTUAL BILL NUMBER
 S BILLAR=$O(^BARBL(DUZ(2),"B",BILL3P))
 Q:BILLAR="" DT_U_DT_U_DT
 S BILLARIE=$O(^BARBL(DUZ(2),"B",BILLAR,""))
 S TRANIEN=""
 F  S TRANIEN=$O(^BARTR(DUZ(2),"AC",BILLARIE,TRANIEN)) Q:TRANIEN=""  D
 .;NOW FIND FIRST PYMT TRANS
 .;IF FIELD #101 'TRANS TYPE' = 'PYMT' AND
 .;'CREDIT' FIELD #2 IS NOT NULL THEN GET EARLIEST DATE
 .Q:$$GET1^DIQ(90050.03,TRANIEN_",",101,"I")'=40
 .Q:$$GET1^DIQ(90050.03,TRANIEN_",",2,"I")=""
 .;W !,"CREDIT: ",$$GET1^DIQ(90050.03,TRANIEN_",",2,"I")
 .;Q:'($$GET1^DIQ(90050.03,TRANIEN_",",101,"I")=40)&($$GET1^DIQ(90050.03,TRANIEN_",",2,"I")'="")
 .;
 .S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOTPOST","MONTHYR",MONTHYR)=$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOTPOST","MONTHYR",MONTHYR))+$$GET1^DIQ(90050.03,TRANIEN_",",2,"I")
 .S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOTPOST",SUB1,SUB2,"MONTHYR",MONTHYR)=$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOTPOST",SUB1,SUB2,"MONTHYR",MONTHYR))+$$GET1^DIQ(90050.03,TRANIEN_",",2,"I")
 .S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOT PAY MADE","MONTHYR",MONTHYR)=$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOT PAY MADE","MONTHYR",MONTHYR))+1
 .;
 .I 'FIRST D  Q
 ..;S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOT FIRST PAYMENT MADE","MONTHYR",MONTHYR)=$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOT FIRST PAYMENT MADE","MONTHYR",MONTHYR))+1  ;bar*1.8*28 CR8345 HEAT224215
 ..S FIRST=$$GET1^DIQ(90050.03,TRANIEN_",",.01,"I")
 ..S BATCHIEN=$$GET1^DIQ(90050.03,TRANIEN_",",14,"I")
 ..S BATCHFIN=$$GET1^DIQ(90051.01,BATCHIEN_",",25,"I")  ;GET BATCH FINALIZED DATE
 ..S:BATCHFIN="" BATCHFIN=DT
 ..S LAST=$$GET1^DIQ(90050.03,TRANIEN_",",.01,"I")  ;last pymt wasn't populated if only one bill with one pymt  ;bar*1.8*28 CR8345 HEAT224215
 ..;
 ..;start old bar*1.8*28 CR8345 HEAT224215
 ..;S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DYSTOPAY",SUB1,SUB2,"MONTHYR",MONTHYR)=$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DYSTOPAY",SUB1,SUB2,"MONTHYR",MONTHYR))+$$DAYS(BATCHFIN,VSITADMT)
 ..;S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DYSTOPAY","MONTHYR",MONTHYR)=$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DYSTOPAY","MONTHYR",MONTHYR))+$$DAYS(BATCHFIN,VSITADMT)
 ..;S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DYSTOPAY DATES","MONTHYR",MONTHYR,$S(+BATCHFIN:BATCHFIN,1:"UNDEF"),$S(+VSITADMT:VSITADMT,1:"UNDEF"),TRANIEN,$$DAYS(BATCHFIN,VSITADMT))=""
 ..;end old bar*1.8*28 CR8345 HEAT224215
 .;
 .;IF YOU ALREADY HAVE FIRST PAYMENT KEEP PLACING FOLLOWING PAYMENTS INTO LAST PAYMENT
 .;UNTIL ALL PAYMENTS HAVE BEEN FOUND
 .I FIRST D
 ..;start old bar*1.8*28 CR8345 HEAT224215
 ..;S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DYSTOPAY",SUB1,SUB2,"MONTHYR",MONTHYR)=$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DYSTOPAY",SUB1,SUB2,"MONTHYR",MONTHYR))+$$DAYS(BATCHFIN,VSITADMT)
 ..;S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DYSTOPAY","MONTHYR",MONTHYR)=$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DYSTOPAY","MONTHYR",MONTHYR))+$$DAYS(BATCHFIN,VSITADMT)
 ..;S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DYSTOPAY DATES","MONTHYR",MONTHYR,$S(+BATCHFIN:BATCHFIN,1:"UNDEF"),$S(+VSITADMT:VSITADMT,1:"UNDEF"),TRANIEN,$$DAYS(BATCHFIN,VSITADMT))=""
 ..;S ^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOT LAST PAYMENT MADE","MONTHYR",MONTHYR)=$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOT LAST PAYMENT MADE","MONTHYR",MONTHYR))+1
 ..;end old bar*1.8*28 CR8345 HEAT224215
 ..S LAST=$$GET1^DIQ(90050.03,TRANIEN_",",.01,"I")
 S:$G(FIRST)="" FIRST=DT
 S:$G(LAST)="" LAST=DT
 Q $G(FIRST)_U_$G(LAST)_U_$G(BATCHFIN)
 ;
GETPRV(BILLIEN,PRV) ;EP - IS PROV RENDERING/ATTENDING
 N PRVREC,FOUND,PRVIEN,TARTYP,PRVTYPE
 S (PRVREC,FOUND)=0
 S TARGTYP=U_"A"_U_"R"_U  ;WE WANT ONLY IF PROVIDER IS FOUND OF TYPE RENDERING OR ATTENDING
 S DUZSAVE=DUZ(2)  ;bar*1.8*28 CR8345 HEAT224215
 S DUZ(2)=ABMDUZ(2)  ;bar*1.8*28 CR8345 HEAT224215
 F  S PRVREC=$O(^ABMDBILL(DUZ(2),BILLIEN,41,PRVREC)) Q:'PRVREC  D  Q:FOUND
 .S PRVTYPE=$$GET1^DIQ(9002274.4041,PRVREC_","_BILLIEN_",",.02,"I")
 .S PRVIEN=$$GET1^DIQ(9002274.4041,PRVREC_","_BILLIEN_",",.01,"I")
 .I PRV="",(TARGTYP[(U_PRVTYPE_U)) S FOUND=1_U_PRVIEN Q
 .I PRV'="" I (TARGTYP[(U_PRVTYPE_U)),(PRVIEN=PRV) S FOUND=1_U_PRVIEN
 .;IF NO PROVIDER CHOSEN THEN RETURN TRUE IF ANY ATTENDING/RENDERING PHYSICIAN FOUND INCLUDE BILL
 .;IF PROVIDER IS CHOSEN MATCHES PROVIDER TYPE OF ATTENDING OR RENDERING THEN INCLUDE BILL
 S DUZ(2)=DUZSAVE  ;bar*1.8*28 CR8345 HEAT224215
 Q FOUND
 ;start new bar*1.8*23 IHS/SD/POT
HITCR ;
 K DIR S (X,Y)=""
 S DIR(0)="E"
 S DIR("A")="Hit ENTER to continue"
 D ^DIR
 K DIR
 Q
 ;end new bar*1.8*23 IHS/SD/POT
 ;EOR - IHS/DIT/CPC 1.8*28