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

ADEGRL3.m

Go to the documentation of this file.
ADEGRL3 ; IHS/HQT/MJL - DENTAL ENTRY PART 4 ;
 ;;6.0;ADE;**10,12,23,26**;JUN 6, 2011;Build 13
 ;;IHS/OIT/GAB 10.2014 Modified for 2015 Code Updates - PATCH 26
 ;------->INIT
 D HRN
 S ADETITL="CURRENT VISIT ENTRIES TABLE"_$S(ADEDIR:" (DIRECT",1:" (CONTRACT")_" MODE)"
 ;------->GET CUR VIS STAT
 ;/IHS/OIT/GAB 11.2014 Patch #26 Changed the below two lines & added following two - update 9130 & 9140 codes to 9986 & 9987, but don't remove old codes yet!
 ;I '$D(ADEV("0000")),'$D(ADEV("0190")),'$D(ADEV("9130")),'$D(ADEV("9140")) D VSTAT^ADEGRL4 I Y=-1 S ADENOUPD=1 W !!,"***DATA ENTRY ABORTED***" G END
 ;I 'ADENEWVS,($D(ADEV("9130"))!$D(ADEV("9140"))) D LIST S ADENOUPD=1 W !!,"***UNEDITABLE RECORD (FAILED APPOINTMENT) -- USE DELETE OPTION TO DELETE***",*7 H 2 G END
 I '$D(ADEV("0000")),'$D(ADEV("0190")),'$D(ADEV("9130")),'$D(ADEV("9140")),'$D(ADEV("9986")),'$D(ADEV("9987")) D VSTAT^ADEGRL4 I Y=-1 S ADENOUPD=1 W !!,"***DATA ENTRY ABORTED***" G END
 I 'ADENEWVS,$D(ADEV("9130"))!$D(ADEV("9140"))!$D(ADEV("9986"))!$D(ADEV("9987")) D LIST S ADENOUPD=1 W !!,"***UNEDITABLE RECORD (FAILED APPOINTMENT) -- USE DELETE OPTION TO DELETE***",*7 H 2 G END
 ;------->GET TREATMENT HISTORY
 K ADEHXC,ADEHXO,ADEHXF
 D ^ADEGRL33
 ;Patch **12** removed call to IH^ADEGRL34 IHS/HMW 1-15-2003
 ;Begin IH Code Patch **10** IHS/ANMC/HMW 11-2-2001
 ;I '$$IH^ADEGRL34(ADEPAT,ADEVDATE) S ADENOUPD=1 W !!,"***DATA ENTRY ABORTED***" G END
 ;End IH Code Patch
CTRL ;------->CTRL
 S ADEY=1
 D LIST
 ;------->READ
 W !!,"Select ADA CODE (or Action): " R X:DTIME S:'$T X="^"
 ;------->CHECK FOR END OF DATA ENTRY, CONSISTENCY CHECKS
 I X=""!(X="^Q")!(X="^") S Y=0 D EXIT^ADEGRL31 G:Y END G CTRL
 ;IHS;SD;TPF 4/22/2011 WO 2011 CNI-100 PATCH 23
 ;DO DEPENDENCY CHECK
 G CTRL:$$DEPEND(X,.ADEV)
 ;END WO 2011 CNI-100
 D CHECKEX G:'ADEY CTRL
 D VERIFY^ADEGRL32 G:'ADEY CTRL
 ;------->I CON
 I ADECON D FEE^ADEGRL31 G:'ADEY CTRL
 I ADECON,$P(Y(0),U,9)="n" D QUANT G VALID
 I ADECON,$P(Y(0),U,9)'="n" D ^ADEGRL5 G VALID
 ;------->I DIR
 I 'ADEFAST,$P(Y(0),U,9)'="n" D ^ADEGRL5 G VALID
 D QUANT
 ;
VALID ;VALIDITY CHECKS -- Check that code is reportable given Pt Tx Hx.
 I $D(ADEV(ADECOD)) D ^ADEGRL5A D:$D(ADEXFLG) RETURN^ADEGRL5B K ADEREDO,ADEXFLG,ADENRP
 G CTRL
END Q
 ;
DEPEND(X,ADEV) ;DEPENDENCY CHECK
 I X=9221,'$D(ADEV(9220)) D  Q 1
 .W !!!,"CODE 9221 REQUIRES ENTRY OF CODE 9220 FIRST!" D DIRE
 I X=9242,'$D(ADEV(9241)) D  Q 1
 .W !!!,"CODE 9242 REQUIRES ENTRY OF CODE 9241 FIRST!" D DIRE
 Q 0
DIRE ;PRESS RETURN
 K DIR S DIR(0)="E" D ^DIR
 Q
 ;
CHECKEX I X="?" S XQH="ADE-DVIS-ADACODES" D EN^XQH K XQH D ^ADECLS,^ADEHELP S ADEY=0 Q
 I X="??" D ^ADEHELP S ADEY=0 Q
 ;I X="^L" D FAC^ADEGRL4 K DIC S ADEY=0 Q
 I X="^D" D REPD^ADEGRL4 K DIC S ADEY=0 Q
 I X="^H",'ADECON D PROV^ADEGRL4 K DIC S ADEY=0 Q
 I X="^N" D NOTE^ADEGRL4 S ADEY=0 Q
 I X="^W",'ADECON N ADETITL S ADETITL="  WAITING",ADEWAI=1,ADEREC=0,ADEREF=0,ADETYP="w" D EN^ADEMNG S ADEY=0 Q
 I X="^R",'ADECON N ADETITL S ADETITL="  RECALL",ADEWAI=0,ADEREC=1,ADEREF=0,ADETYP="rc" D EN^ADEMNG S ADEY=0 Q
 I ADECON,X="^C" D TFEE^ADEGRL31 S ADEY=0 Q
 I ADEDIR,X="^S" D EN^ADEATT S ADEY=0 Q
 I X="^P",'$D(ADEPLET) S ADEPLET=1,ADEY=0 Q
 I X="^P" K ADEPLET S ADEY=0 Q
 I X="^V" D EN2^ADERVW Q
 I X="@" D DEL^ADEGRL31 S ADEY=0 Q
 I X["@",$P(X,"@",2)]"",$D(ADEV($P(X,"@",2))) K ADEV($P(X,"@",2)),ADEDES($P(X,"@",2)) S ADEY=0 Q
 Q
QUANT ;
 S $P(ADEV(ADECOD),U)=1 ;IHS/HMW 9-24-90 IF 'NO OPSITE' STUFF QTY=1
 ;IHS/SD/TPF 4/22/2010 WO 2011 CNI-100 PATCH
 I ADECOD="0240"!(ADECOD=9221)!(ADECOD=9242) D
 .K DIR,DTOUT,DTOUT
 .S DIR("B")="Enter Quntity"
 .S DIR(0)="N^1:6"
 .D ^DIR
 .Q:$D(DTOUT)!($D(DUOUT))
 .S $P(ADEV(ADECOD),U)=Y
 ;END WO 2011 CNI-100 
 Q
LIST ;EP
 N ADENONR
 D ^ADECLS,LINE
 W !,"Patient: ",ADEPNM,?40,"Chart#: ",ADEHRN,?57,"Date: ",ADEVDATE,!,"Location: ",ADELOE W:('ADEFAST)&ADEDIR !,"Hygienist/Therapist: ",ADEPVNM W !,"Attending Dentist: ",ADERDNM,!
 I $D(ADENOTE),ADENOTE]"",ADENOTE'="@" W "Dental Note: ",ADENOTE,!
 I ADECON S (ADETFE,L)=0 F K=0:0 S L=$O(ADEV(L)) Q:L=""  S ADETFE=ADETFE+($P(ADEV(L),U,3)*$P(ADEV(L),U))
 I ADECON S:'ADETCHF ADETCH=ADETFE W "Total Fees: $",$J(ADETFE,4,2),?30,"Total Charge this Visit: $",$J(ADETCH,4,2),!
 W !,"ADA CODE",?10,"DESCRIPTION",?27,"QTY"
 W:ADECON ?32,"UNIT",?40,"TOTAL"
 W:ADECON ?50,"OPSITE" W:ADEDIR ?35,"OPSITE"
 S J=0
L1 S J=$O(ADEV(J)) G:J="" L2
 W !?2,J
 I $P(ADEV(J),U,2)="",$P(ADEV(J),U,5)]"" W "*" S ADENONR=1
 W ?10,ADEDES(J),?27,$J($P(ADEV(J),U),3) W:ADECON ?32,$P(ADEV(J),U,3),?40,$P(ADEV(J),U,3)*$P(ADEV(J),U)
 S ADECNT=0 F K=1:1:$L($P(ADEV(J),U,2),",") S ADEPC=$P($P(ADEV(J),U,2),",",K) D L3
 G L1
L2 K J W:$D(ADENONR) !,"*=Unreportable Procedures" W !,ADELIN Q
L3 ;DISPLAY OP SITE
 Q:ADEPC=""  ;IHS/HMW 5-12-90
 I $D(ADEPLET),$P(^ADEOPS(ADEPC,0),U,4)]"" S ADEPC=$P(^ADEOPS(ADEPC,0),U,4) ;IHS/HMW 5-12-90
 E  S ADEPC=^ADEOPS(ADEPC,88) ;IHS/HMW 5-12-90
 I $P($P(ADEV(J),U,4),",",K)]"" S ADEPC=ADEPC_"["_$P($P(ADEV(J),U,4),",",K)_"]"
 I $P($P(ADEV(J),U,5),",",K)]"" S ADEPC=ADEPC_"*",ADENONR=1
 S ADECNT=$L(ADEPC)+ADECNT+1
 I ADECNT>$S(ADECON:15,ADEDIR:30) S ADECNT=0 W:ADEDIR !,?35,ADEPC_" " W:ADECON !,?50,ADEPC_" " Q
 W:ADEDIR ?35,ADEPC_" " W:ADECON ?50,ADEPC_" " Q
LINE W $E(ADELIN,1,40-($L(ADETITL)/2)),ADETITL,$E(ADELIN,1,39-($L(ADETITL)/2)) Q
CON ;EP
 R !,"(Press ENTER to continue) ",X:DTIME K X Q
HRN ;EP
 S ADEPNM=$P(^DPT(ADEPAT,0),U) S ADENOUPD=0
 S ADEHRN="" I $D(^AUPNPAT(ADEPAT,41,DUZ(2),0)) S ADEHRN=$P(^(0),U,2)
 Q