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

ABMUCAPI.m

Go to the documentation of this file.
  1. ABMUCAPI ; IHS/SD/SDR - 3PB/UFMS CAN crosswalk API
  1. ;;2.6;IHS 3P BILLING SYSTEM;;NOV 12, 2009
  1. ;
  1. ; New routine - v2.5 p12 SDD item 4.2
  1. ; Budget activity and Cost Center will be used along with the
  1. ; ASUFAC to find the CAN in the IE for UFMS. The CAN tables
  1. ; will be maintained in the IE.
  1. ;
  1. EP(W,X,Y,Z) ;PEP - Returns BUDGET ACTIVITY^COST CENTER or -1 for ea. if
  1. ; it can't find effective entry
  1. ;w=insurer type
  1. ;x=clinic ptr
  1. ;y=date/time approved (FM format)
  1. ;z=ASUFAC for location
  1. S ABMIT=W
  1. S ABMC=$P($G(^DIC(40.7,X,0)),U,2) ;clinic code
  1. S ABMDT=Y
  1. S ABMASUF=Z
  1. ;
  1. S U="^"
  1. S ABMRTURN=""
  1. ;
  1. ;acct pt/federal loc
  1. ;S ABMACTPT=""
  1. ;S ABMFLOC=""
  1. ;S ABMTIEN=$O(^ABMUAPFL("C",ABMASUF,0))
  1. ;I +ABMTIEN'=0 D
  1. ;.S ABMEFDT=$P($G(^ABMUAPFL(ABMTIEN,0)),U,5)
  1. ;.S ABMENDT=$P($G(^ABMUAPFL(ABMTIEN,0)),U,6)
  1. ;.I (ABMEFDT=ABMDT!(ABMEFDT<ABMDT)),((ABMENDT="")!(ABMENDT>ABMDT)) D
  1. ;..S ABMACTPT=$P($G(^ABMUAPFL(ABMTIEN,0)),U,3)
  1. ;..S ABMFLOC=$P($G(^ABMUAPFL(ABMTIEN,0)),U,4)
  1. ;S ABMACTPT=$$FMT^ABMERUTL(ABMACTPT,"3NR")
  1. ;S ABMFLOC=$$FMT^ABMERUTL(ABMFLOC,"4NR")
  1. ;S ABMRTURN=ABMACTPT_ABMFLOC
  1. ;
  1. ;budget activity
  1. S ABMTIEN=0
  1. S ABMAFLG=0
  1. S ABMAREA=$E(ABMASUF,1,2)
  1. S ABMAREA=$O(^AUTTAREA("C",ABMAREA,0))
  1. F S ABMTIEN=$O(^ABMUITBA("C",ABMAREA,ABMIT,ABMTIEN)) Q:+ABMTIEN=0 D Q:ABMAFLG=1
  1. .S ABMREC=$G(^ABMUITBA(ABMTIEN,0))
  1. .S ABMEFDT=$P(ABMREC,U,3)
  1. .S ABMENDDT=$P(ABMREC,U,4)
  1. .I (ABMEFDT=ABMDT!(ABMEFDT<ABMDT)),((ABMENDDT="")!(ABMENDDT>ABMDT)) D
  1. ..S ABMAFLG=1
  1. S ABMRTURN=ABMRTURN_$$FMT^ABMERUTL($S(+ABMTIEN'=0:$P($G(^ABMUITBA(ABMTIEN,0)),U,2),1:""),"10R")
  1. ;
  1. ;cost center
  1. S ABMAFLG=0
  1. S ABMTIEN=0
  1. S:$G(ABMC)="" ABMC="XX" ;default
  1. F S ABMTIEN=$O(^ABMUCTCC("B",ABMC,ABMTIEN)) Q:+ABMTIEN=0 D Q:ABMAFLG=1
  1. .S ABMREC=$G(^ABMUCTCC(ABMTIEN,0))
  1. .S ABMEFDT=$P(ABMREC,U,4)
  1. .S ABMENDDT=$P(ABMREC,U,5)
  1. .I (ABMEFDT=ABMDT!(ABMEFDT<ABMDT)),((ABMENDDT="")!(ABMENDDT>ABMDT)) D
  1. ..S ABMAFLG=1
  1. S ABMRTURN=ABMRTURN_$$FMT^ABMERUTL($S(+ABMTIEN'=0:$P($G(^ABMUCTCC(ABMTIEN,0)),U,3),1:""),"3R")
  1. ;
  1. Q ABMRTURN
  1. ;
  1. COSTCENT(X,Y) ;PEP - return cost center and cost center desc. only
  1. ;x=clinic ptr
  1. ;y=date/time approved (FM format)
  1. S ABMC=$P($G(^DIC(40.7,X,0)),U,2) ;clinic code
  1. S ABMDT=Y
  1. ;
  1. S ABMAFLG=0
  1. S ABMTIEN=0
  1. S:$G(ABMC)="" ABMC="XX" ;default
  1. F S ABMTIEN=$O(^ABMUCTCC("B",ABMC,ABMTIEN)) Q:+ABMTIEN=0 D Q:ABMAFLG=1
  1. .S ABMREC=$G(^ABMUCTCC(ABMTIEN,0))
  1. .S ABMEFDT=$P(ABMREC,U,4)
  1. .S ABMENDDT=$P(ABMREC,U,5)
  1. .I (ABMEFDT=ABMDT!(ABMEFDT<ABMDT)),((ABMENDDT="")!(ABMENDDT>ABMDT)) D
  1. ..S ABMAFLG=1
  1. S:+ABMTIEN'=0 ABMRTURN=$P($G(^ABMUCTCC(ABMTIEN,0)),U,3)_"^"_$P($G(^ABMUCTCC(ABMTIEN,0)),U,6)
  1. Q ABMRTURN