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

ABMUUTL.m

Go to the documentation of this file.
ABMUUTL ; IHS/SD/SDR - 3PB/UFMS Check for pseudo TIN   
 ;;2.6;IHS 3P BILLING SYSTEM;;NOV 12, 2009
 ; New routine - v2.5 p12
 ;
 ; IHS/SD/SDR - v2.5 p13 - IM25962
 ;   Fix for missing TIN check; was failing on Bens
 ;
PTINCK ;EP - check bills about to be exported for
 ; pseudo TINs
 S ABMPTINF=0,ABMMTINF=0
 S ABMI=0
 F  S ABMI=$O(ABMC(ABMI)) Q:+ABMI=0  D
 .S ABMDZ=""
 .F  S ABMDZ=$O(ABMC(ABMI,ABMDZ)) Q:ABMDZ=""  D
 ..S ABMFD=0
 ..F  S ABMFD=$O(ABMC(ABMI,ABMDZ,ABMFD)) Q:+ABMFD=0  D
 ...S ABMBA=0
 ...S ABMLOOP=10
 ...S ABMDUZ=$S(ABMDZ="POS":1,1:ABMDZ)
 ...S:ABMDUZ=1 ABMLOOP=20
 ...F  S ABMBA=$O(^ABMUCASH(ABMLOC,ABMLOOP,ABMDUZ,20,ABMFD,11,ABMBA)) Q:+ABMBA=0  D
 ....S ABMBDAC=$P($G(^ABMUCASH(ABMLOC,ABMLOOP,ABMDUZ,20,ABMFD,11,ABMBA,0)),U)
 ....S ABMCDFN=0
 ....F  S ABMCDFN=$O(^ABMUCASH(ABMLOC,ABMLOOP,ABMDUZ,20,ABMFD,11,ABMBA,2,ABMCDFN)) Q:+ABMCDFN=0  D
 .....S ABMDUZ2=$P($G(^ABMUCASH(ABMLOC,ABMLOOP,ABMDUZ,20,ABMFD,11,ABMBA,2,ABMCDFN,0)),U,2)
 .....S ABMBIEN=$P($G(^ABMUCASH(ABMLOC,ABMLOOP,ABMDUZ,20,ABMFD,11,ABMBA,2,ABMCDFN,0)),U,3)
 .....S ABMAINS=$P($G(^ABMDBILL(ABMDUZ2,ABMBIEN,0)),U,8)
 .....S ABMTIN=$P($G(^AUTNINS(ABMAINS,0)),U,11)
 .....I $G(ABMTIN)="",($P($G(^ABMUCASH(ABMLOC,ABMLOOP,ABMDUZ,20,ABMFD,11,ABMBA,0)),U)'="I") D  Q  ;missing TIN
 ......S ABMMTINF=1  ;flag for missing TIN
 ......S ABMMT(ABMAINS)=ABMFD
 .....S ABMTIN=$E(ABMTIN,$L(ABMTIN))
 .....I $A(ABMTIN)>64&($A(ABMTIN)<91) S ABMPTINF=1,ABMPT(ABMAINS)=ABMTIN  ;pseudo TIN
 Q
ABBREVCK ;EP - check bills about to be exported for
 ; visit location abbreviations
 S ABMVDFNF=0
 S ABMI=0
 F  S ABMI=$O(ABMC(ABMI)) Q:+ABMI=0  D
 .S ABMDZ=""
 .F  S ABMDZ=$O(ABMC(ABMI,ABMDZ)) Q:ABMDZ=""  D
 ..S ABMFD=0
 ..F  S ABMFD=$O(ABMC(ABMI,ABMDZ,ABMFD)) Q:+ABMFD=0  D
 ...S ABMBA=0
 ...S ABMLOOP=10
 ...S ABMDUZ=$S(ABMDZ="POS":1,1:ABMDZ)
 ...S:ABMDUZ=1 ABMLOOP=20
 ...F  S ABMBA=$O(^ABMUCASH(ABMLOC,ABMLOOP,ABMDUZ,20,ABMFD,11,ABMBA)) Q:+ABMBA=0  D
 ....S ABMBDAC=$P($G(^ABMUCASH(ABMLOC,ABMLOOP,ABMDUZ,20,ABMFD,11,ABMBA,0)),U)
 ....S ABMCDFN=0
 ....F  S ABMCDFN=$O(^ABMUCASH(ABMLOC,ABMLOOP,ABMDUZ,20,ABMFD,11,ABMBA,2,ABMCDFN)) Q:+ABMCDFN=0  D
 .....S ABMDUZ2=$P($G(^ABMUCASH(ABMLOC,ABMLOOP,ABMDUZ,20,ABMFD,11,ABMBA,2,ABMCDFN,0)),U,2)
 .....S ABMBIEN=$P($G(^ABMUCASH(ABMLOC,ABMLOOP,ABMDUZ,20,ABMFD,11,ABMBA,2,ABMCDFN,0)),U,3)
 .....S ABMVDFN=$P($G(^ABMDBILL(ABMDUZ2,ABMBIEN,0)),U,3)
 .....S ABMVABB=$P($G(^AUTTLOC(ABMVDFN,0)),U,7)
 .....I $G(ABMVABB)="",($P($G(^ABMUCASH(ABMLOC,ABMLOOP,ABMDUZ,20,ABMFD,11,ABMBA,0)),U)'="I") D  Q  ;missing abbrev
 ......S ABMVDFNF=1  ;flag for missing abbrev
 ......S ABMMABB(ABMVDFN)=ABMFD
 Q
ACTIVCK(ABMLOC,ABMSDT,ABMDUZ) ;EP - check if session has activity
 S ABMAFLG=0
 S ABMBA=0
 I +ABMDUZ'=0 D
 .F  S ABMBA=$O(^ABMUCASH(ABMLOC,10,ABMDUZ,20,ABMSDT,11,ABMBA)) Q:+ABMBA=0  D
 ..F ABMSEC=1,2,3 D
 ...I +$O(^ABMUCASH(ABMLOC,10,ABMDUZ,20,ABMSDT,11,ABMBA,ABMSEC,0))'=0 S ABMAFLG=1
 .F ABMSEC=12,13 D
 ..I +$O(^ABMUCASH(ABMLOC,10,ABMDUZ,20,ABMSDT,ABMSEC,0))'=0 S ABMAFLG=1
 Q ABMAFLG
 ;
CASHTOTP ;EP
 K ABMABILL,ABMABAMT
 K ABMEBILL,ABMEBAMT
 S ABMBA=0
 S ABMTRIBL=$P($G(^ABMDPARM(ABMLOC,1,4)),U,14)
 S ABMUSER=1
 F  S ABMBA=$O(^ABMUCASH(ABMLOC,20,ABMUSER,20,ABMFD,11,ABMBA)) Q:+ABMBA=0  D
 .S ABMBDAC=$P($G(^ABMUCASH(ABMLOC,20,ABMUSER,20,ABMFD,11,ABMBA,0)),U)
 .I $G(ABMTRIBL)=1,(ABMBDAC="I") Q  ;if exporting and Ben insurer type
 .S ABMCDFN=0
 .F  S ABMCDFN=$O(^ABMUCASH(ABMLOC,20,ABMUSER,20,ABMFD,11,ABMBA,2,ABMCDFN)) Q:+ABMCDFN=0  D
 ..S ABMBAL(ABMBDAC,"ABILLS")=+$G(ABMBAL(ABMBDAC,"ABILLS"))+1  ;total approved bills by budget activity
 ..S ABMABILL=+$G(ABMABILL)+1  ;total approved bills
 ..S ABMSBTOT=+$G(ABMSBTOT)+1
 ..S ABMDUZ2=$P($G(^ABMUCASH(ABMLOC,20,ABMUSER,20,ABMFD,11,ABMBA,2,ABMCDFN,0)),U,2)
 ..S ABMBDFN=$P($G(^ABMUCASH(ABMLOC,20,ABMUSER,20,ABMFD,11,ABMBA,2,ABMCDFN,0)),U,3)
 ..S ABMBAL(ABMBDAC,"ABAMT")=+$G(ABMBAL(ABMBDAC,"ABAMT"))+($P($G(^ABMDBILL(ABMDUZ2,ABMBDFN,2)),U))
 ..S ABMSATOT=(+$G(ABMSATOT))+($P($G(^ABMDBILL(ABMDUZ2,ABMBDFN,2)),U))
 ..S ABMABAMT=$G(ABMABAMT)+($P($G(^ABMDBILL(ABMDUZ2,ABMBDFN,2)),U))  ;total approved bill amount
 ..;now check if bill is part of 3P UFMS Exclusion Table
 ..Q:$$BILL^ABMUEAPI(ABMDUZ2,$P($G(^ABMUCASH(ABMLOC,20,ABMUSER,20,ABMFD,11,ABMBA,2,ABMCDFN,0)),U,3))=1
 ..S ABMBAL(ABMBDAC,"EBILLS")=+$G(ABMBAL(ABMBDAC,"EBILLS"))+1
 ..S ABMEBILL=+$G(ABMEBILL)+1
 ..S ABMBAL(ABMBDAC,"EBAMT")=+$G(ABMBAL(ABMBDAC,"EBAMT"))+($P($G(^ABMDBILL(ABMDUZ2,ABMBDFN,2)),U))
 ..S ABMEBAMT=+$G(ABMEBAMT)+($P($G(^ABMDBILL(ABMDUZ2,ABMBDFN,2)),U))
 ..S ABMTEBIL=+$G(ABMTEBIL)+1  ;total bills (multiple sessions)
 ..S ABMTEBAM=+$G(ABMTEBAM)+($P($G(^ABMDBILL(ABMDUZ2,ABMBDFN,2)),U))  ;total amount (multiple sessions)
 ;
 ;cancelled bills
 K ABMCBILL,ABMCBAMT
 S ABMBA=0
 F  S ABMBA=$O(^ABMUCASH(ABMLOC,20,ABMUSER,20,ABMFD,11,ABMBA)) Q:+ABMBA=0  D
 .S ABMBDAC=$P($G(^ABMUCASH(ABMLOC,20,ABMUSER,20,ABMFD,11,ABMBA,0)),U)
 .S ABMCDFN=0
 .F  S ABMCDFN=$O(^ABMUCASH(ABMLOC,20,ABMUSER,20,ABMFD,11,ABMBA,3,ABMCDFN)) Q:+ABMCDFN=0  D
 ..S ABMBAL(ABMBDAC,"CBILLS")=+$G(ABMBAL(ABMBDAC,"CBILLS"))+1
 ..S ABMCBILL=$G(ABMCBILL)+1  ;session total
 ..S ABMTCBIL=+$G(ABMTCBIL)+1  ;total bills (multiple sessions)
 ..S ABMDUZ2=$P($G(^ABMUCASH(ABMLOC,20,ABMUSER,20,ABMFD,11,ABMBA,3,ABMCDFN,0)),U,2)
 ..S ABMBDFN=$P($G(^ABMUCASH(ABMLOC,20,ABMUSER,20,ABMFD,11,ABMBA,3,ABMCDFN,0)),U,3)
 ..S ABMBAL(ABMBDAC,"CBAMT")=+$G(ABMBAL(ABMBDAC,"CBAMT"))+($P($G(^ABMDBILL(ABMDUZ2,ABMBDFN,2)),U))
 ..S ABMCBAMT=+$G(ABMCBAMT)+($P($G(^ABMDBILL(ABMDUZ2,ABMBDFN,2)),U))  ;session total
 ..S ABMTCBAM=+$G(ABMTCBAM)+($P($G(^ABMDBILL(ABMDUZ2,ABMBDFN,2)),U))  ;total amount (multiple sessions)
 ;
 Q