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

CRHDDR.m

Go to the documentation of this file.
CRHDDR ; CAIRO/CLC - RETRIEVE DNR ORDERS USING ORDER DIALOG ;4/23/08  13:06
 ;;1.0;CRHD;****;Jan 28, 2008;Build 19
 ;=================================================================
ENT(CRHDRTN,DFN,CRHDNRTT,CRHDDIV,CRHDMULT) ;
 N CRHDSDAT,CRHDFND,CRHDRN,CRHDEXDT,CRHDEXN,X,Y
 N CRHDSTS,CRHDDL,CRHDCT,CRHDFLG,CRHDIEN1,CRHDOI
 K CRHDRTN
 ;CRHDMULT = 1,if multi active orders displayed
 S CRHDMULT=+$G(CRHDMULT)
 I '$G(CRHDRN) S CRHDRN=1
 D DNRPARM(.CRHDNRTT,DUZ,.CRHDDIV)
 S CRHDFLG=0
 S CRHDSDAT=$$NOW^XLFDT
 S CRHDEXDT=0,CRHDCT=0
 F  S CRHDEXDT=$O(^OR(100,"AC",DFN_";DPT(",CRHDEXDT)) Q:'CRHDEXDT!(CRHDFLG)  D
 .S CRHDEXN="" F  S CRHDEXN=$O(^OR(100,"AC",DFN_";DPT(",CRHDEXDT,CRHDEXN)) Q:CRHDEXN=""!(CRHDFLG)  D
 ..S CRHDOI=0
 ..F  S CRHDOI=$O(^OR(100,CRHDEXN,.1,"B",CRHDOI)) Q:'CRHDOI!(CRHDFLG)  D
 ...I $D(CRHDNRTT(+CRHDOI)) D DETAIL("CRHDRTN",CRHDEXN,.CRHDFLG,.CRHDCT,.CRHDMULT)
 Q
 ;
DETAIL(CRHDY,CRHDIFN,CRHDFND,CRHDCNT,CRHDMDNR) ; -- Returns details of order CRHDIFN in CRHDY(#)
 N CRHDMCNT,X,CRHDX2,CRHDI,CRHDILOG,CRHD0,CRHD3,CRHD6,CRHDSEQ,CRHDITEM,CRHDPRMT
 N CRHDFIRT,CRHDTITL,CRHDINST,CRHDN,ORIGVIEW,ORFLG,CRHDII
 N DIWL,DIWR,DIWF,CRHDACTI,VAIN,CRHDOVW,ORNMSP,CRHDYT,CRHDDNR,CRHDXX,CRHDNX
 S CRHDIFN=+CRHDIFN,CRHD0=$G(^OR(100,CRHDIFN,0)),CRHD3=$G(^(3)),CRHD6=$G(^(6))
 Q:$P(CRHD3,"^",3)'=6
 K CRHDYT S CRHDOVW=1 D TEXT^CRHD8(.CRHDYT,+CRHDIFN_";"_+$P(CRHD3,U,7),254)
 ;CurrTx
 I $D(CRHDYT) D
 .I 'CRHDMDNR S CRHDFND=1
 .S CRHDN=0
 .;USE CRHDEXDT IN THE DATA NODE TO
 .I $D(@CRHDY) S CRHDCNT=CRHDCNT+1,@CRHDY@(CRHDCNT)=""
 .F CRHDII=1:1 S CRHDN=$O(CRHDYT(CRHDN)) Q:'CRHDN  D
 ..S CRHDCNT=CRHDCNT+1
 ..I CRHDII=1 S @CRHDY@(CRHDCNT)=CRHDEXDT_"~"_CRHDIFN_"~"_CRHDYT(CRHDN)
 ..E  S @CRHDY@(CRHDCNT)=CRHDYT(CRHDN)
 Q
DNRPARM(CRHDNRTT,DUZ,CRHDDIV) ;GET DNR TITLES
 N CRHDPAR,CRHDDIVI,CRHDDNRT
 K CRHDNRTT
 S CRHDDNRT=0
 I '+$G(CRHDDIV) S CRHDDIV=+$$SITE^VASITE
 S CRHDPAR="DIV.`"_+CRHDDIV D GETLST^XPAR(.CRHDDNRT,CRHDPAR,"CRHD DNR ORDERABLE ITEMS")
 I 'CRHDDNRT D
 .S CRHDDIVI=$O(^DIC(4,"D",CRHDDIV,0))
 .I CRHDDIVI S CRHDPAR="DIV.`"_CRHDDIVI D GETLST^XPAR(.CRHDDNRT,CRHDPAR,"CRHD DNR ORDERABLE ITEMS")
 I CRHDDNRT D
 .S CRHDN=0 F  S CRHDN=$O(CRHDDNRT(CRHDN)) Q:'CRHDN  D
 ..S:$P($G(CRHDDNRT(CRHDN)),"^",2)'="" CRHDNRTT($P(CRHDDNRT(CRHDN),"^",2))=""
 Q
LORDITM(CRHDY,CRHDFROM,CRHDDIR) ; Return a set of names from the ORDERABLE ITEMS file.
 ; copied from ORWU1
 ;  .CRHDY=returned list.
 ;  CRHDDIR=Direction to move through the x-ref with $O.
 ;  CRHDFROM=Starting name for this set.
 K CRHDRTN
 N CRHDNAME,CRHDNUMB,CRHDIEN1,CRHDMAX
 S CRHDI=0,CRHDMAX=44
 F  Q:CRHDI'<CRHDMAX  S CRHDFROM=$O(^ORD(101.43,"B",CRHDFROM),CRHDDIR) Q:CRHDFROM=""  D
 .S CRHDIEN1=""
 .F  S CRHDIEN1=$O(^ORD(101.43,"B",CRHDFROM,CRHDIEN1),CRHDDIR) Q:'CRHDIEN1  D
 ..I $D(^ORD(101.43,CRHDIEN1,.1)),+$G(^ORD(101.43,CRHDIEN1,.1)) I +^ORD(101.43,CRHDIEN1,.1)<$$DT^XLFDT Q
 ..S CRHDI=CRHDI+1,CRHDY(CRHDI)=CRHDIEN1_"^"_CRHDFROM
 Q