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

AMQQMULR.m

Go to the documentation of this file.
AMQQMULR ; IHS/CMI/THL - COLLECTS MULTIPLE VALUES FOR REFUSAL TYPES ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ;-----
VAR F I=1:1:19 D
 .S X=$P("GR;ID;ST;FIN;LAST;VAL1;SPEC;UATN;MLT;T;NVAR;FVAR;ITR;NNA;STRT;MSS;MPC;MULZ;USQN",";",I)
 .S @("AMQQ"_X)=$P(AMQQX,";",I)
 I '$D(AMQQAG) S AMQQAG="AG"
 S AMQQVAL1=+AMQQVAL1
 S AMQQMPC=1
 S AMQQMSS=0
 S AMQQ=U_AMQQGR_"(""AC"",AMQP(0))"
 S AMQQHOLD=0
 S AMQT(AMQQT)=0
 S AMQQLCNT=0
 K ^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN)
 I $E(AMQQST)?1P,'$D(AMQQSQVN) D REL^AMQQMULS
 I AMQQMULZ S AMQQMUNV=AMQQNVAR,AMQQMUFV=AMQQFVAR,AMQQMULL=AMQQMULZ
 I '$D(AMQQSQVN),'$D(@AMQQ) S AMQT(AMQQT)=0 G NULL
 I $G(AMQQSPEC)="EXISTS",AMQQSTRT=2,'AMQQST,'AMQQUSQN,AMQQFIN=9999999,AMQQLAST=9999999 S ^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,1)="+",AMQP(AMQQFVAR)="+",AMQT(AMQQT)=1 G EXIT
RUN S AMQQVNO=0
 D INC
SQ I $D(AMQV("SQ")) D ^AMQQMULS
 I $D(^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN)),AMQQSPEC="NULL"!(AMQQSPEC="INVERSE") K ^(AMQQUATN) G EXIT
 I $D(^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN)) G TRUE
NULL I AMQQSPEC'="NULL",AMQQSPEC'="ANY",AMQQSPEC'="INVERSE"
 E  S ^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,1)="-",AMQP(AMQQFVAR)="-",AMQT(AMQQT)=1
 G EXIT
TRUE I AMQQSPEC="EXISTS" K ^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN) S ^(AMQQUATN,1)="+",AMQP(AMQQFVAR)="+"
 S AMQT(AMQQT)=1
EXIT I AMQQAG="SAG" K ^UTILITY("AMQQ",$J,"SAG",AMQQUATN)
 D EXIT3^AMQQKILL
 Q
 ;
INC S AMQQDA=$G(AMQP(4))
 I 'AMQQDA,$G(AMQP(0)) D PAT Q
 I 'AMQQDA,'$G(AMQP(0)) D ALL Q
INC1 S %=$G(^AUPNPREF(AMQQDA,0))
 N AMQQVALU,AMQQDATE,AMQQREAS
 S AMQQVALU=$P(%,U)
 S AMQP(0)=$P(%,U,2)
 S AMQQDATE=$P(%,U,3)
 S AMQQREAS=$P(%,U,4)
 S AMQQPT=$P(%,U,6)
 D SET
 I AMQQLCNT=AMQQLAST D LASTEVAL^AMQQMULT I $D(AMQQQUIT) K AMQQQUIT Q
 I AMQQSPEC="EXISTS"!(AMQQSPEC="NULL"),AMQQLCNT,'$D(AMQV("SQ")) S AMQQLCNT=-1 Q
 Q
 ;
SET I AMQQVALU="" Q
 I $D(^UTILITY("AMQQ TAX",$J,AMQQVAL1,AMQQVALU,"REFUSAL")),'$D(^UTILITY("AMQQ TAX",$J,AMQQVAL1,AMQQVALU,"REFUSAL",+AMQQPT)) Q
 I '$D(^UTILITY("AMQQ TAX",$J,AMQQVAL1,AMQQVALU)),'$D(^("*")),'$D(^("-")) Q
S1 S AMQQHOLD=AMQQHOLD+1
 S AMQQLCNT=AMQQLCNT+1
 S ^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,AMQQHOLD)=AMQQVALU_U_AMQQDATE_U_AMQQREAS_U_AMQQDA
 K AMQQOK
 Q
 ;
ALL ;PROCESS ALL TYPES OF REFUSALS
 N REF,REFDA
 S REF=""
 F  S REF=$O(^AUTTREFT("B",REF)) Q:REF=""  D
 .S REFDA=0
 .F  S REFDA=$O(^AUTTREFT("B",REF,REFDA)) Q:'REFDA  D
 ..S AMQQDA=0
 ..F  S AMQQDA=$O(^AUPNPREF("B",REFDA,AMQQDA)) Q:'AMQQDA  D
 ...D INC1:'$D(^UTILITY("AMQQ REFUSAL",$J,AMQQDA))
 ...S ^UTILITY("AMQQ REFUSAL",$J,AMQQDA)=""
 S AMQP(.1)=99999999999
 Q
PAT ;PROCESS REFUSALS FOR A PATIENT
 N REF,REFDA
 S REFDA=0
 F  S AMQQDA=$O(^AUPNPREF("AC",AMQP(0),AMQQDA)) Q:'AMQQDA  D
 .D INC1
 Q