DGFFPLM1 ;ALB/SCK - FUGITIVE FELON PROGRAM LIST MANAGER - 2 ; 12/6/02
 ;;5.3;Registration;**485**;Aug 13, 1993
 ;
SEL(DFN) ;
 N DIC
 ;
 W ! S DIC="^DPT(",DIC(0)="AEQMZ"
 D ^DIC
 S DFN=+Y
 Q
 ;
EN(DFN,DGARY,DGSTART,DGCNT) ;
 N VAROOT,DGADD,VAPA,DGTMP,DGLINE,TXT,X,Y,DGDT,DGCLN,TEMP,DGFFP,TMPARY,DGWARD
 ;
 S VAPA("P")=""
 S VAROOT="DGADD" D ADD^VADPT
 K VAPA
 S VAROOT="DGTMP" D ADD^VADPT
 I '+DGTMP(9)>0 K DGTMP
 ;
 S DGLINE=DGSTART,DGCNT=0
 ;
 ; FF Program Information
 S DGFFP=$G(^DPT(DFN,"FFP"))
 S X=$$SETSTR^VALM1("Date Set:","",5,15)
 S X=$$SETSTR^VALM1($$FMTE^XLFDT($P(DGFFP,U,3),"D"),X,20,20)
 S X=$$SETSTR^VALM1("Set By:",X,40,12)
 S X=$$SETSTR^VALM1($$GET1^DIQ(200,$P(DGFFP,U,2),.01),X,53,30)
 D SET(DGARY,DGLINE,X,.DGCNT) S DGLINE=DGLINE+1
 ;
 S X=$$SETSTR^VALM1("Date Cleared:","",5,15)
 S X=$$SETSTR^VALM1($$FMTE^XLFDT($P(DGFFP,U,5),"D"),X,20,20)
 S X=$$SETSTR^VALM1("Cleared By:",X,40,12)
 S X=$$SETSTR^VALM1($$GET1^DIQ(200,$P(DGFFP,U,4),.01),X,53,30)
 D SET(DGARY,DGLINE,X,.DGCNT) S DGLINE=DGLINE+1
 ;
 S X=$$SETSTR^VALM1("Closing Remark:","",5,18)
 S X=$$SETSTR^VALM1($P(DGFFP,U,9),X,23,110)
 D SET(DGARY,DGLINE,X,.DGCNT) S DGLINE=DGLINE+1
 ;
 D SET(DGARY,DGLINE,"",.DGCNT) S DGLINE=DGLINE+1
 ;
 ; Address Information
 S X=$$SETSTR^VALM1("Permanent Address:","",5,30)
 S X=$$SETSTR^VALM1("Temporary Address:",X,35,30)
 D SET(DGARY,DGLINE,X,.DGCNT) S DGLINE=DGLINE+1
 ;
 S X=$$SETSTR^VALM1("==================","",5,30)
 S X=$$SETSTR^VALM1("==================",X,35,30)
 D SET(DGARY,DGLINE,X,.DGCNT) S DGLINE=DGLINE+1
 ;
 S X=$$SETSTR^VALM1(DGADD(1),"",5,30)
 S X=$$SETSTR^VALM1($G(DGTMP(1)),X,35,30)
 D SET(DGARY,DGLINE,X,.DGCNT) S DGLINE=DGLINE+1
 ;
 S X=$$SETSTR^VALM1(DGADD(2),"",5,30)
 S X=$$SETSTR^VALM1($G(DGTMP(2)),X,35,30)
 D SET(DGARY,DGLINE,X,.DGCNT) S DGLINE=DGLINE+1
 ;
 S X=$$SETSTR^VALM1(DGADD(4),"",5,30)
 S X=$$SETSTR^VALM1($G(DGTMP(4)),X,35,30)
 D SET(DGARY,DGLINE,X,.DGCNT) S DGLINE=DGLINE+1
 ;
 S X=$$SETSTR^VALM1($P(DGADD(5),U,2),"",5,30)
 S X=$$SETSTR^VALM1($P($G(DGTMP(5)),U,2),X,35,30)
 D SET(DGARY,DGLINE,X,.DGCNT) S DGLINE=DGLINE+1
 ;
 S X=$$SETSTR^VALM1($P(DGADD(11),U,2),"",5,30)
 S X=$$SETSTR^VALM1($P($G(DGTMP(11)),U,2),X,35,30)
 D SET(DGARY,DGLINE,X,.DGCNT) S DGLINE=DGLINE+1
 ;
 I +$G(DGTMP(9))>0 D
 . S X=$$SETSTR^VALM1("Effective Date: ","",35,20)
 . S X=$$SETSTR^VALM1($P($G(DGTMP(9)),U,2),X,55,20)
 . D SET(DGARY,DGLINE,X,.DGCNT) S DGLINE=DGLINE+1
 . S X=$$SETSTR^VALM1("End Date: ",X,35,20)
 . S X=$$SETSTR^VALM1($P($G(DGTMP(10)),U,2),X,55,20)
 . D SET(DGARY,DGLINE,X,.DGCNT) S DGLINE=DGLINE+1
 ;
 N XCNT
 F XCNT=DGLINE:1:VALM("LINES") D
 . D SET(DGARY,DGLINE,"",.DGCNT) S DGLINE=DGLINE+1
 ;
 ; Inpatient Information
 N DGIN
 ;
 S VAROOT="DGIN"
 D IN5^VADPT
 I DGIN(1)>0 D
 . S X=$$SETSTR^VALM1("Last Inpatient Movement:","",5,30)
 . D SET(DGARY,DGLINE,X,.DGCNT) S DGLINE=DGLINE+1
 . S X=$$SETSTR^VALM1("========================",X,5,30)
 . D SET(DGARY,DGLINE,X,.DGCNT) S DGLINE=DGLINE+1
 . ;
 . S X=$$SETSTR^VALM1($P(DGIN(2),U,2),X,5,20)
 . S X=$$SETSTR^VALM1($$FMTE^XLFDT($P(DGIN(3),U,1),"D"),X,21,14)
 . D SET(DGARY,DGLINE,X,.DGCNT) S DGLINE=DGLINE+1
 . ;
 . S X="",X=$$SETSTR^VALM1("Room/Bed:",X,8,12)
 . S X=$$SETSTR^VALM1($P(DGIN(6),U,2),X,20,20)
 . S X=$$SETSTR^VALM1("Ward:",X,40,5)
 . S X=$$SETSTR^VALM1($P(DGIN(5),U,2),X,48,20)
 . D SET(DGARY,DGLINE,X,.DGCNT) S DGLINE=DGLINE+1
 . D SET(DGARY,DGLINE,"",.DGCNT) S DGLINE=DGLINE+1
 ;
 ; Future Scheduled Admission
 S X=$$SETSTR^VALM1("Future Scheduled Admissions:","",5,30)
 D SET(DGARY,DGLINE,X,.DGCNT) S DGLINE=DGLINE+1
 S X=$$SETSTR^VALM1("============================",X,5,30)
 D SET(DGARY,DGLINE,X,.DGCNT) S DGLINE=DGLINE+1
 ;
 S TMPARY="^TMP(""DGFFPFU"",$J)"
 K @TMPARY
 D GETFUADM^DGFFP03(DFN,TMPARY)
 ;
 S DGDT=0
 F  S DGDT=$O(@TMPARY@(DGDT)) Q:'DGDT  D
 . S X=$$SETSTR^VALM1("Scheduled:","",5,10)
 . S X=$$SETSTR^VALM1($$FMTE^XLFDT(DGDT,"1P"),X,17,30)
 . S DGWARD=$P(@TMPARY@(DGDT),U,8)
 . S X=$$SETSTR^VALM1("Ward:",X,47,5)
 . S X=$$SETSTR^VALM1($$GET1^DIQ(42,DGWARD,.01),X,53,80)
 . D SET(DGARY,DGLINE,X,.DGCNT) S DGLINE=DGLINE+1
 ;
 D SET(DGARY,DGLINE,"",.DGCNT) S DGLINE=DGLINE+1
 D SET(DGARY,DGLINE,"",.DGCNT) S DGLINE=DGLINE+1
 K @TMPARY
 ;
 ; Outpatient Information
 N TEMP
 ;
 S TEMP="^TMP(""DGFFPOP"",$J)"
 K @TEMP
 D GETAPT^DGFFP03(DFN,TEMP)
 ;
 S X=""
 S X=$$SETSTR^VALM1("Future Appointments:",X,5,30)
 D SET(DGARY,DGLINE,X,.DGCNT) S DGLINE=DGLINE+1
 S X=$$SETSTR^VALM1("====================",X,5,30)
 D SET(DGARY,DGLINE,X,.DGCNT) S DGLINE=DGLINE+1
 ;
 S DGCLN=""
 F  S DGCLN=$O(@TEMP@(DGCLN)) Q:DGCLN']""  D
 . S X=$$SETSTR^VALM1(DGCLN,"",5,30)
 . D SET(DGARY,DGLINE,X,.DGCNT) S DGLINE=DGLINE+1
 . S DGDT=0
 . F  S DGDT=$O(@TEMP@(DGCLN,DGDT)) Q:'DGDT  D
 . . S X=$$SETSTR^VALM1($$FMTE^XLFDT(DGDT,"1P"),"",10,40)
 . . D SET(DGARY,DGLINE,X,.DGCNT) S DGLINE=DGLINE+1
 K @TEMP
 D SET(DGARY,DGLINE,"",.DGCNT) S DGLINE=DGLINE+1
 D SET(DGARY,DGLINE,"",.DGCNT) S DGLINE=DGLINE+1
 Q
 ;
SET(DGARY,DGLINE,DGTEXT,DGCNT) ;
 N X
 ;
 S:DGLINE>DGCNT DGCNT=DGLINE
 S X=$S($D(^TMP(DGARY,$J,DGLINE,0)):^(0),1:"")
 S ^TMP(DGARY,$J,DGLINE,0)=DGTEXT
 S ^TMP(DGARY_"IDX",$J,DGLINE,DGLINE)=DGLINE
 S DGLINE=DGLINE+1
 Q
