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

ACHS3PPC.m

Go to the documentation of this file.
ACHS3PPC ; IHS/ITSC/PMF - COMPILE CHS THIRD PARTY PAYMENT (ALL PATIENTS) ;   [ 04/17/2002  1:56 PM ]
 ;;3.1;CONTRACT HEALTH MGMT SYSTEM;**4,16**;JUN 11, 2001
 ;ACHS*3.1*4 repair quit statement
 ;ACHS*3.1*16 IHS.OIT.FCJ Added amount for insurers
 ;
 I '$D(ACHSPAT(0)) G ^ACHS3PPA   ;THIRD PARTY PAYMENT REPORT
 ;
 S ACHSFAC=DUZ(2),ACHSFY1=""
GETFY ;
 S ACHSFY1=$O(^ACHSF(ACHSFAC,"D","B",ACHSFY1))
 I ACHSFY1="",'$D(^TMP("ACHS3PP",$J,ACHSFAC)) S ^TMP("ACHS3PP",$J,ACHSFAC,0)=""
 ;
 I ACHSFY1="" K ACHSDOCR,X,Y,Z G ^ACHS3PPP  ;PRINT THIRD PARTY PAYMENT REPORT (ALL PATS)
 ;
 S ACHSFYA=$E(ACHSFY1,2),ACHSFYB=$E(ACHSFY,4)
 I ACHSFYA'=ACHSFYB G GETFY
 ;
 D GETDIEN
 G GETFY
 Q
 ;
 ;MAIN LOOP
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"))
 .;
 .;SKIP IF 'TOTAL AMOUNT OBLIGATED' ?????WHAT ABOUT NEGATIVES?????
 .Q:$P($G(^ACHSF(ACHSFAC,"D",ACHSDIEN,0)),U,9)'>0
 .S ACHSDOCR=$G(^ACHSF(ACHSFAC,"D",ACHSDIEN,0))     ;GET DOCUMENT 0 NODE
 .;
 .;GET 'TYPE OF SERVICE'
 .S ACHSSERV=$S($P(ACHSDOCR,U,4):$P(ACHSDOCR,U,4),1:"UNKN")
 .;
 .;ACHSSER=4 MEANS ALL TYPES
 .Q:'(ACHSSER=4)&(ACHSSERV'=ACHSSER)
 .D GETIDT
 Q
 ;
GETIDT ;
 S ACHSIDT=$P(ACHSDOCR,U,2)      ;'ORDER DATE'
 S ACHSOBL=$P(ACHSDOCR,U,9)      ;'TOTAL OBLIGATED AMOUNT'
 K Z
 ;
 ;GO THROUGH TRANSACTIONS
 F %=0:0 S %=$O(^ACHSF(ACHSFAC,"D",ACHSDIEN,"T",%)) Q:'%  D
 .S X=$G(^ACHSF(ACHSFAC,"D",ACHSDIEN,"T",%,0))
 .;
 .S Y=$P(X,U,2)        ;'TRANSACTION TYPE'
 .;
 .;IF 'TRANSACTION TYPE' IS NOT "INITIAL" AND NOT "CANCEL" 
 .I Y'="I",Y'="C" D
 ..S Z("I")=$G(Z("I"))+$P(X,U,4)       ;ADD IN 'IHS PAYMENT AMOUNT'
 ..S Z("3")=$G(Z("3"))+$P(X,U,8)       ;ADD IN 'THIRD PARTY PAY AMT'
 ..;ACHS*3.1*16 IHS.OIT.FCJ ADDED NXT SECTION FOR DETAIL TP INSURER
 ..I (ACHSRTYP="T")!(ACHSRTYP="P") D
 ...I $P(X,U,12)="",$P(X,U,8)>0 S:'$D(Z("TP","U")) Z("TP","U")=0 S Z("TP","U")=Z("TP","U")+$P(X,U,8) Q   ;UNIDENTIFIED INSURANCE
 ...I $P(X,U,12)="",$P(X,U,8)<1 S:'$D(Z("TP","I")) Z("TP","I")=0 S Z("TP","I")=Z("TP","I")+$P(X,U,4) Q  ;IHS PAY DOCUMENTS
 ...I '$D(Z("T",$P(X,U,12))) S Z("T",$P(X,U,12))=$P(X,U,8)
 ...E  S Z("T",$P(X,U,12))=Z("T",$P(X,U,12))+$P(X,U,8)
 ;
 ;ACHS*3.1*4  3/26/02  pmf  just wanna quit  Q:'$D(Z) GETDIEN
 I '$D(Z) Q  ;  ACHS*3.1*4```````1=($G(^AUTTLOC(ACHSFAC,0)),U,4),0)),U,3)_$E($P($G(^AUTTLOC(ACHSFAC,0)),U,17),2,3)_"-"_$P(ACHSDOCR,U)
 ;
 ;GET 'FISCAL YEAR' _ 'PREFIX/REGION' _ 'FINANCIAL LOCATION CODE' _
 ;'ORDER NUMBER'
 S ACHSDOC=$P(ACHSDOCR,U,14)_"-"_$P($G(^AUTTAREA($P($G(^AUTTLOC(ACHSFAC,0)),U,4),0)),U,3)_$E($P($G(^AUTTLOC(ACHSFAC,0)),U,17),2,3)_"-"_$P(ACHSDOCR,U)
 ;
 S ^TMP("ACHS3PP",$J,ACHSFAC,ACHSDOC)=ACHSIDT_U_ACHSOBL_U_Z("3")_U_Z("I")_U_ACHSSERV
 ;ACHS*3.1*16 IHS.OIT.FCJ ADDED 3 NXT LINES
 I (ACHSRTYP="T")!(ACHSRTYP="P") D
 .F X="I","U" S:$D(Z("TP",X)) ^TMP("ACHS3PP",$J,ACHSFAC,X,ACHSDOC)=Z("TP",X)
 .S X="" F  S X=$O(Z("T",X)) Q:X=""  S ^TMP("ACHS3PP",$J,ACHSFAC,"T",X,ACHSDOC)=Z("T",X)
 Q
 ;