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

ACHS3PPA.m

Go to the documentation of this file.
ACHS3PPA ; IHS/ITSC/PMF - COMPILE CHS THIRD PARTY PAYMENT REPORT - INDIVIDUAL PAT ;   [ 10/16/2001   8:16 AM ]
 ;;3.1;CONTRACT HEALTH MGMT SYSTEM;;JUN 11, 2001
 ;
 S ACHSFAC=DUZ(2),ACHSPAT=0
GETPAT ;
 F  S ACHSPAT=$O(ACHSPAT(ACHSPAT)) Q:ACHSPAT=""  D
 .;PATIENT X-REF
 .I '$D(^ACHSF("AC",ACHSPAT)) S ^TMP("ACHS3PP",$J,ACHSPAT,0)="" Q
 .D GETDIEN
 ;
 K ACHSDOCR,X,Y,Z
 D ^ACHS3PPB         ;THIRD PARTY PAYMENT REPORT
 Q
 ;
 ;
GETDIEN ;
 S ACHSDIEN=""
 F  S ACHSDIEN=$O(^ACHSF("AC",ACHSPAT,ACHSFAC,ACHSDIEN)) Q:ACHSDIEN=""  D
 .I ACHSDIEN="",'$D(^TMP("ACHS3PP",$J,ACHSPAT)) S ^TMP("ACHS3PP",$J,ACHSPAT,0)="" Q
 .Q:'$D(^ACHSF(ACHSFAC,"D",ACHSDIEN,0))!'$D(^ACHSF(ACHSFAC,"D",ACHSDIEN,"PA"))
 .S ACHSDOCR=$G(^ACHSF(ACHSFAC,"D",ACHSDIEN,0))
 .Q:$P(ACHSDOCR,U,9)'>0
GETFY .;
 .S ACHSFY1=$P(ACHSDOCR,U,14)
 .I ACHSFY1="",'$D(^TMP("ACHS3PP",$J,ACHSPAT)) S ^TMP("ACHS3PP",$J,ACHSPAT,0)=""
 .Q:ACHSFY1=""
 .Q:ACHSFY1'=$E(ACHSFY,4)
 .S ACHSSERV=$P(ACHSDOCR,U,4)
 .Q:'(ACHSSER=4)&(ACHSSERV'=ACHSSER)
 .D GETIDT
 Q
GETIDT ;
 S ACHSIDT=$P(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