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

DVBAB57.m

Go to the documentation of this file.
DVBAB57 ;ALB/KLB - AMIE GUI PENDING 7131 REPORT ;09/7/00
 ;;2.7;AMIE;**35,42,185**;Apr 10, 1995;Build 18
 ;
STRT(MSG,SELDIV,DIV,DVBADLMTR) ;
 S DVBADLMTR=$S(DVBADLMTR=1:",",1:0)
 S RO="N"
 S RONUM=0
 S DIVNUM="",MSGCNT=1
 K ^TMP($J),^TMP("CAPRI")
 I RO="Y",RONUM="" S MSG(1)="To sort by RO Number, please enter the RO Number."
 I RO="Y",RONUM="" Q
 I SELDIV="Y",DIV="" S MSG(1)="To sort by Division, please enter the Division."
 I SELDIV="Y",DIV="" Q
 I DIV'="" S DIVNUM=$O(^DG(40.8,"C",DIV,DIVNUM)),DIVNAM=$S($D(^DG(40.8,+DIVNUM,0)):$P(^(0),"^",1),1:"Unknown Division")
SETUP D STM^DVBCUTL4
 S FDT(0)=$$FMTE^XLFDT(DT,"5DZ"),(PG,DVBAQUIT)=0
 S HEAD="PENDING REQUEST REPORT FOR "_$P(^DVB(396.1,1,0),U,1)
 S HEAD2=$S(RO="Y":"FOR REGIONAL OFFICE "_RONUM,1:"ALL REGIONAL OFFICES")
 S HEAD2=HEAD2_$S(SELDIV="Y":", FOR DIVISION "_DIVNAM,1:", ALL DIVISIONS")
 S PROCDT="Processed on: "_FDT(0)
 S QQ=1,NODTA=0
 I $G(DVBADLMTR)="," D  G DATA
 . S ^TMP("CAPRI",$J,MSGCNT)=HEAD_$C(13),MSGCNT=MSGCNT+1,^TMP("CAPRI",$J,MSGCNT)=""""_HEAD2_""""_$C(13),MSGCNT=MSGCNT+1,^TMP("CAPRI",$J,MSGCNT)=PROCDT_$C(13)_$C(13),MSGCNT=MSGCNT+1
 . S ^TMP("CAPRI",$J,MSGCNT)=$S(SELDIV="Y":"Division",SELDIV="N":"Original Division",1:"")_DVBADLMTR_"Patient Name"_DVBADLMTR_"SSN"_DVBADLMTR_"Claim no."_DVBADLMTR_"Activity/Admission Date"_DVBADLMTR_"Request Date"_DVBADLMTR
 . S ^TMP("CAPRI",$J,MSGCNT)=^TMP("CAPRI",$J,MSGCNT)_"** Discharged"_DVBADLMTR_"Elapsed Days"_DVBADLMTR_"Items Pending"_DVBADLMTR_"Requested by Name"_DVBADLMTR_"Requested by Division"_$C(13),MSGCNT=MSGCNT+1
 I $G(DVBADLMTR)=0 D
 . S ^TMP("CAPRI",MSGCNT)="Pending 7131 Report"_"^",MSGCNT=MSGCNT+1
 . S ^TMP("CAPRI",MSGCNT)=""_"^",MSGCNT=MSGCNT+1
 . S ^TMP("CAPRI",MSGCNT)=HEAD_"^",MSGCNT=MSGCNT+1
 . S ^TMP("CAPRI",MSGCNT)=HEAD2_"^",MSGCNT=MSGCNT+1
 . S ^TMP("CAPRI",MSGCNT)=PROCDT_"^",MSGCNT=MSGCNT+1
 . S ^TMP("CAPRI",MSGCNT)=""_"^",MSGCNT=MSGCNT+1
DATA N REQDTE S REQDTE="",CNT=0
 S:SELDIV="Y" ADIV=DIVNAM
 F J=0:0 S REQDTE=$O(^DVB(396,"E",REQDTE)) Q:REQDTE=""  F DA=0:0 S DA=$O(^DVB(396,"E",REQDTE,DA)) Q:DA=""  I $D(^DVB(396,DA,1)),($P(^DVB(396,DA,1),U,12)="")  D:SELDIV="N" ADIV  D MAKUTL
 S (ADIV,REQDTE)=""
 F L=0:0 S REQDTE=$O(^TMP($J,REQDTE)) Q:REQDTE=""  D LVL2LP
 ;
EXIT I NODTA=0 S MSG(1)="No pending requests found for parameters entered."
 I NODTA>0,$G(DVBADLMTR)=0 S MSG=$NA(^TMP("CAPRI"))
 I NODTA>0,$G(DVBADLMTR)="," S MSG=$NA(^TMP("CAPRI",$J))
 ;
KILL S XRTN=$T(+0)
 D SPM^DVBCUTL4
 K ^TMP("DVBA","ADMIT",$J),^TMP($J),DVBAQUIT,SELDIV,DIVNUM,REQDTE,PROCDT,QQ,RO,RONUM,XRTN,CNT,MSGCNT,NODTA
 K LPCNT1,PATDA,DIVNAM,XJ,XI,GDIVPTR,GDIVNUM,GINSTPT,GDIVNAM,GDIV,ADIV,CFLOC,DA,DIV,FDT,HEAD,HEAD2,J,L,PG,DVBADLMTR
 Q
 ;
LVL2LP  ;  ** 2nd level of the 2nd loop in the DATA tag - search ADIV **
 F J=0:0 S ADIV=$O(^TMP($J,REQDTE,ADIV)) Q:ADIV=""  D LPLVL3
 Q
 ;
LPLVL3 ;  **  2nd level of the loop in the LVL2LP tag - search DA **
 F DA=0:0 S DA=$O(^TMP($J,REQDTE,ADIV,DA)) Q:DA=""  D PRINT^DVBAB67 S:DVBAQUIT=1 ADIV="ZZZZ",DA=999999999,REQDTE=9999999 S QQ=1
 Q
 ;
MAKUTL ;  **  Sort on Request Date to set up a temporary utility global  **
 S PATDA=$P(^DVB(396,DA,0),"^",1)
 ;S REQDTE=$P(^DVB(396,DA,1),"^",1),PATDA=$P(^DVB(396,DA,0),"^",1)
 S CFLOC=$$STATION^DVBAUTL1(PATDA)
 S:CFLOC=-1 CFLOC=0
 I SELDIV="Y"&(RO="Y") I CFLOC=RONUM D CHKDIV D:$D(DVBAFND) SETARY
 I SELDIV="Y"&(RO="N") D CHKDIV D:$D(DVBAFND) SETARY
 I SELDIV="N"&(RO="Y") I CFLOC=RONUM D SETARY
 I SELDIV="N"&(RO="N") D SETARY
 K DVBAFND
 QUIT
 ;
SETARY ;  ** Set temporary utility global **
 S ^TMP($J,REQDTE,ADIV,DA)=""
 QUIT
 ;
ADIV S ADIV=$S($D(^DVB(396,DA,2)):$P(^(2),U,9),1:"") S ADIV=$S($D(^DG(40.8,+ADIV,0)):$P(^(0),U,1),1:"Unknown Division")
 Q
 ;
CHKDIV ;**Check for selected Div
 N FLDVAR
 I $D(^DVB(396,DA,6)) DO
 .F FLDVAR=7,9,11,13,15,17,19,21,23,26,28 Q:$D(DVBAFND)  DO
 ..I ($P(^DVB(396,DA,6),U,FLDVAR)=DIVNUM) DO
 ...I FLDVAR=7 S:$P(^DVB(396,DA,1),U,FLDVAR)="P" DVBAFND=""
 ...I FLDVAR'=7 S:$P(^DVB(396,DA,0),U,FLDVAR)="P" DVBAFND=""
 I $D(^DVB(396,DA,2)),('$D(DVBAFND)) DO  ;**Check Routing Loc Division
 .I $D(^DVB(396,DA,1)) DO
 ..I $P(^DVB(396,DA,2),U,9)=DIVNUM,($P(^DVB(396,DA,1),U,12)="") DO
 ...S DVBAFND=""
 Q