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

DVBAPEND.m

Go to the documentation of this file.
DVBAPEND ;ALB/GTS-557/THM-PENDING REPORT ; 7/6/90  1:18 PM
 ;;2.7;AMIE;**17**;Apr 10, 1995
 ;
 D NOPARM^DVBAUTL2 G:$D(DVBAQUIT) KILL^DVBAUTIL
TERM D HOME^%ZIS W @IOF,!,"Pending 7131 Report",!!! K NOASK,^TMP($J)
 S DVBADD=^DD("DD"),(RONUM,Y)=0 D SORT^DVBAUTIL G:Y<0 KILL
 D SORTDIV^DVBAPND1 G:Y<0 KILL S %ZIS="Q" D ^%ZIS K %ZIS G:POP KILL
 ;
QUEUE I $D(IO("Q")) S ZTRTN="SETUP^DVBAPEND",ZTIO=ION,ZTDESC="AMIE PENDING REPORT",NOASK=1 F I="DIVNAM","SELDIV","DVBADD","RONUM","RO","NOASK","Y","DIVNUM" S ZTSAVE(I)=""
 I $D(IO("Q")) D ^%ZTLOAD W:$D(ZTSK) !!,"Request queued.",!! H 1 G KILL
 ;
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 U IO D HEADER^DVBAPND1
DATA N REQDTE S REQDTE=""
 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 U IO W *7,"No pending requests found for parameters entered.",!!
 ;
KILL S XRTN=$T(+0)
 D SPM^DVBCUTL4
 K ^TMP("DVBA","ADMIT",$J),^TMP($J),DVBAQUIT,SELDIV,DIVNUM,REQDTE
 K LPCNT1,PATDA,DIVNAM,XJ,XI,GDIVPTR,GDIVNUM,GINSTPT,GDIVNAM,GDIV
 D:$D(ZTQUEUED) KILL^%ZTLOAD G KILL^DVBAUTIL
 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^DVBAPND1 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 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