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

ACHS3PP3.m

Go to the documentation of this file.
ACHS3PP3 ; IHS/ITSC/PMF - COMPILE CHS THIRD PARTY PAYMENT (ALL PATIENTS) ;  [ 10/16/2001   8:16 AM ]
 ;;3.1;CONTRACT HEALTH MGMT SYSTEM;;JUN 11, 2001
 ;
 ;TPF RE-WRITTEN FROM ACHS3PPC
 ;
 ;
 I $D(ACHSPAT) D ^ACHS3PP1 Q
 S ACHSFAC=DUZ(2)
GETFY ;
 S ACHSFY1=""
 F  S ACHSFY1=$O(^ACHSF(ACHSFAC,"D","B",ACHSFY1)) Q:ACHSFY1=""  D
 .I '$D(^TMP("ACHS3PP",$J,ACHSFAC)) S ^TMP("ACHS3PP",$J,ACHSFAC,0)=""
 .S ACHSFYA=$E(ACHSFY1,2),ACHSFYB=$E(ACHSFY,4)
 .I ACHSFYA'=ACHSFYB Q
 .D GETDIEN
 K ACHSDOCR,X,Y,Z
 D ^ACHS3PP4    ;DO ALL PATIENTS
 Q
GETDIEN ;
 S ACHSDIEN=""
 F  S ACHSDIEN=$O(^ACHSF(ACHSFAC,"D","B",ACHSFY1,ACHSDIEN)) Q:ACHSDIEN=""  D
 .Q:'$D(^ACHSF(ACHSFAC,"D",ACHSDIEN,0))!'$D(^ACHSF(ACHSFAC,"D",ACHSDIEN,"PA"))
 .I $P($G(^ACHSF(ACHSFAC,"D",ACHSDIEN,0)),U,9)'>0 Q
 .S ACHSDOCR=$G(^ACHSF(ACHSFAC,"D",ACHSDIEN,0))
 .Q:ACHSDOCR=""
 .S ACHSSERV=$S($P(ACHSDOCR,U,4):$P(ACHSDOCR,U,4),1:"UNKN")
 .I '(ACHSSER=4),ACHSSERV'=ACHSSER Q
 .D GETIDT
 Q
GETIDT ;GET TRANSACTION RECORD INFORMATION
 S ACHSIDT=$P(ACHSDOCR,U,2),ACHSOBL=$P(ACHSD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