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

GMRCAD.m

Go to the documentation of this file.
GMRCAD ;ABV/PIJ - Consults Report by Released by Policy. Patch GMRC*3.0*107 ;7/5/18 07:36
 ;;3.0;CONSULT/REQUEST TRACKING;**107**;DEC 27, 1997;Build 27
 ;
 ; LOCAL VISTA REPORT BY CONSULT
 ;
 ; Screen Title: Admin Released Consults-Title
 ;
EN ; -- main entry point for GMRC RPT ADMIN RELEASE CONSULT
 ;
 N GMRCDT1,GMRCDT2,GMRCEDT1,GMRCEDT2
 ;
 D EN^VALM("GMRC RPT ADMIN RELEASE CONSULT")
 Q
 ;
EN1 ;Ask for date range
 ;
 S DIR(0)="DA",DIR("A")="Enter Consult Released Starting Date: "
 D ^DIR
 I $D(DUOUT)!($D(DTOUT)) S GMRCQUT=1 Q
 S GMRCDT1=+Y I 'GMRCDT1 G EN1
 W "  (",$$FMTE^XLFDT(GMRCDT1)_")"
 ;
 K DIR
 S DIR(0)="DA",DIR("A")="Enter Consult Released Ending Date: "
 D ^DIR
 I $D(DTOUT)!($D(DUOUT)) K GMRCDT1 S GMRCQUT=1 G EXIT
 I +Y<GMRCDT1 W !!,$C(7),"Ending Date Can Not Be Before Starting Date.",! G EN1
 I $G(GMRCDT2)="" S GMRCDT2=+Y
 W "  (",$$FMTE^XLFDT(GMRCDT2)_")"
 ;
 ; Retrieve External Date
 D LISTDATE^GMRCSTU1(GMRCDT1,GMRCDT2,.GMRCEDT1,.GMRCEDT2)
 ;
 Q
 ;
HDR ; -- header code
 N GMRCSITE
 S GMRCSITE=$P($$SITE^VASITE(),U,2)
 S VALMHDR(1)="VAMC: "_GMRCSITE
 S VALMHDR(2)="From: "_$G(GMRCEDT1)_"   To: "_$G(GMRCEDT2)
 Q
 ;
BLDLIST ; -- init variables and list array
 N I,IENS,LINE,ORDITEM,ORIEN,RELBY
 N FMRELDT
 ;
 S (FMRELDT,ORIEN,LINEVAR)=""
 S LINECNT=0
 ;
 K ^TMP("GMRCAD",$J)
 ;
 F  S FMRELDT=$O(^OR(100,"AADMINKEY",FMRELDT)) Q:FMRELDT=""  D
 . F I=GMRCDT1:1:GMRCDT2 I $P(I,".",1)=$P(FMRELDT,".",1) D
 .. ;
 .. F  S ORIEN=$O(^OR(100,"AADMINKEY",FMRELDT,"Y",ORIEN)) Q:ORIEN=""  D
 ... S IENS="1,"_ORIEN
 ... S ORDITEM=$$GET1^DIQ(100.001,IENS,.01) ; Orderable Item
 ... I '$D(^TMP("GMRCAD",$J,ORDITEM)) S ^TMP("GMRCAD",$J,ORDITEM)=0
 ... S ^TMP("GMRCAD",$J,ORDITEM)=^TMP("GMRCAD",$J,ORDITEM)+1
 ... ;
 ... S RELBY=$$GET1^DIQ(100.008,IENS,17)    ; Released by
 ... I '$D(^TMP("GMRCAD",$J,ORDITEM,RELBY)) S ^TMP("GMRCAD",$J,ORDITEM,RELBY)=0
 ... S ^TMP("GMRCAD",$J,ORDITEM,RELBY)=^TMP("GMRCAD",$J,ORDITEM,RELBY)+1
 Q
 ;
INIT ;
 K ^TMP("VALMAR",$J)
 N DTOUT,DIR,DUOUT,DIRUT,GMRCQUT,X,Y,TOTAL
 ;
 S (GMRCDT1,GMRCDT2,GMRCEDT1,GMRCEDT2,GMRCQUT)=""
 S (LINECNT,TOTAL,VALMCNT)=0
 ;
 D EN1
 I GMRCQUT S VALMQUIT="",VALMBCK="Q" Q
 ;
 D BLDLIST ;build the list for List Manager
 N NUM,ORDITEM,RELBY
 S ORDITEM=""
 S (LINE,LINECNT,NUM)=0
 ;
 S LINEVAR=""
 ;
 F  S ORDITEM=$O(^TMP("GMRCAD",$J,ORDITEM)) Q:ORDITEM=""  D
 . S LINECNT=LINECNT+1
 . S LINEVAR=$$SETFLD^VALM1(ORDITEM,LINEVAR,"USER")
 . ;
 . S NUM=^TMP("GMRCAD",$J,ORDITEM)
 . S TOTAL=TOTAL+NUM
 . S LINEVAR=$$SETFLD^VALM1(NUM,LINEVAR,"NUM")
 . D VALM10(LINEVAR)  ; Print first group
 . ;
 . S RELBY=""
 . F  S RELBY=$O(^TMP("GMRCAD",$J,ORDITEM,RELBY)) D:RELBY="" VALM10("") Q:RELBY=""  D
 .. S LINEVAR=$$SETFLD^VALM1("  "_RELBY,LINEVAR,"USER")
 .. ;
 .. S NUM=^TMP("GMRCAD",$J,ORDITEM,RELBY)
 .. S LINEVAR=$$SETFLD^VALM1(NUM,LINEVAR,"NUM")
 .. ;
 .. D VALM10(LINEVAR)
 ;
 D VALM10("") ; Enter blank line
 S LINEVAR="GRAND TOTAL "_TOTAL
 D SET^VALM10(LINE,LINEVAR)
 ;
 S VALMBCK="R"
 ;
 K ^TMP("GMRCAD",$J)
 K LINECNT
 Q
 ;
VALM10(LINEVAR) ;
 S LINE=LINE+1
 D SET^VALM10(LINE,LINEVAR)
 S VALMCNT=LINE
 Q
 ;
HELP ; -- help code
 S X="?" D DISP^XQORM1 W !!
 Q
 ;
EXIT ; -- exit code
 K ^TMP("VALMAR",$J)
 Q
 ;
EXPND ; -- expand code
 Q
 ;
DTRES ;Restore old date in case user '^' out.
 I $D(GMRCDTS1) S GMRCDT1=GMRCDTS1
 I $D(GMRCDTS2) S GMRCDT2=GMRCDTS2
 K GMRCDTS1,GMRCDTS2
 Q