[614] | 1 | BSDX35 ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ;
|
---|
[1142] | 2 | ;;1.5T1;BSDX;;Apr 06, 2011
|
---|
[614] | 3 | ;
|
---|
| 4 | ;
|
---|
| 5 | Q
|
---|
| 6 | ;
|
---|
| 7 | RSRCLTRD(BSDXY,BSDXLIST) ;EP
|
---|
| 8 | ;Entry point for debugging
|
---|
| 9 | ;
|
---|
| 10 | ;D DEBUG^%Serenji("RSRCLTR^BSDX35(.BSDXY,BSDXLIST)")
|
---|
| 11 | Q
|
---|
| 12 | ;
|
---|
| 13 | RSRCLTR(BSDXY,BSDXLIST) ;EP
|
---|
| 14 | ;
|
---|
| 15 | ;Return recordset of RESOURCES and associated LETTERS
|
---|
| 16 | ;Used in generating rebook letters for a clinic
|
---|
| 17 | ;BSDXLIST is a |-delimited list of BSDX RESOURCE iens. (The last |-piece is null, so discard it.)
|
---|
| 18 | ;Called by BSDX RESOURCE LETTERS
|
---|
| 19 | ;
|
---|
| 20 | ;
|
---|
| 21 | S X="ERROR^BSDX35",@^%ZOSF("TRAP")
|
---|
| 22 | S BSDXY="^BSDXTMP("_$J_")"
|
---|
| 23 | N BSDXIEN,BSDX,BSDXLTR,BSDXNOS,BSDXCAN,BSDXIEN1
|
---|
| 24 | S BSDXI=0
|
---|
| 25 | S ^BSDXTMP($J,BSDXI)="I00010RESOURCEID^T00030RESOURCE_NAME^T00030LETTER_TEXT^T00030NO_SHOW_LETTER^T00030CLINIC_CANCELLATION_LETTER"_$C(30)
|
---|
| 26 | ;
|
---|
| 27 | ;
|
---|
| 28 | ;If BSDXLIST is a list of resource NAMES, look up each name and convert to IEN
|
---|
| 29 | F BSDXJ=1:1:$L(BSDXLIST,"|")-1 S BSDX=$P(BSDXLIST,"|",BSDXJ) D S $P(BSDXLIST,"|",BSDXJ)=BSDY
|
---|
| 30 | . S BSDY=""
|
---|
| 31 | . I BSDX]"",$D(^BSDXRES(BSDX,0)) S BSDY=BSDX Q
|
---|
| 32 | . I BSDX]"",$D(^BSDXRES("B",BSDX)) S BSDY=$O(^BSDXRES("B",BSDX,0)) Q
|
---|
| 33 | . Q
|
---|
| 34 | ;
|
---|
| 35 | ;Get letter text from wp fields
|
---|
| 36 | S BSDXIEN=0
|
---|
| 37 | F BSDX=1:1:$L(BSDXLIST,"|")-1 S BSDXIEN=$P(BSDXLIST,"|",BSDX) D
|
---|
| 38 | . Q:'$D(^BSDXRES(BSDXIEN))
|
---|
| 39 | . S BSDXNAM=$P(^BSDXRES(BSDXIEN,0),U)
|
---|
| 40 | . S BSDXLTR=""
|
---|
| 41 | . I $D(^BSDXRES(BSDXIEN,1)) D
|
---|
| 42 | . . S BSDXIEN1=0 F S BSDXIEN1=$O(^BSDXRES(BSDXIEN,1,BSDXIEN1)) Q:'+BSDXIEN1 D
|
---|
| 43 | . . . S BSDXLTR=BSDXLTR_$G(^BSDXRES(BSDXIEN,1,BSDXIEN1,0))
|
---|
| 44 | . . . S BSDXLTR=BSDXLTR_$C(13)_$C(10)
|
---|
| 45 | . S BSDXNOS=""
|
---|
| 46 | . I $D(^BSDXRES(BSDXIEN,12)) D
|
---|
| 47 | . . S BSDXIEN1=0 F S BSDXIEN1=$O(^BSDXRES(BSDXIEN,12,BSDXIEN1)) Q:'+BSDXIEN1 D
|
---|
| 48 | . . . S BSDXNOS=BSDXNOS_$G(^BSDXRES(BSDXIEN,12,BSDXIEN1,0))
|
---|
| 49 | . . . S BSDXNOS=BSDXNOS_$C(13)_$C(10)
|
---|
| 50 | . S BSDXCAN=""
|
---|
| 51 | . I $D(^BSDXRES(BSDXIEN,13)) D
|
---|
| 52 | . . S BSDXIEN1=0 F S BSDXIEN1=$O(^BSDXRES(BSDXIEN,13,BSDXIEN1)) Q:'+BSDXIEN1 D
|
---|
| 53 | . . . S BSDXCAN=BSDXCAN_$G(^BSDXRES(BSDXIEN,13,BSDXIEN1,0))
|
---|
| 54 | . . . S BSDXCAN=BSDXCAN_$C(13)_$C(10)
|
---|
| 55 | . S BSDXI=BSDXI+1
|
---|
| 56 | . S ^BSDXTMP($J,BSDXI)=BSDXIEN_U_BSDXNAM_U_BSDXLTR_U_BSDXNOS_U_BSDXCAN_$C(30)
|
---|
| 57 | ;
|
---|
| 58 | S BSDXI=BSDXI+1
|
---|
| 59 | S ^BSDXTMP($J,BSDXI)=$C(31)
|
---|
| 60 | Q
|
---|
| 61 | ;
|
---|
| 62 | ERROR ;
|
---|
| 63 | D ERR("RPMS Error")
|
---|
| 64 | Q
|
---|
| 65 | ;
|
---|
| 66 | ERR(ERRNO) ;Error processing
|
---|
| 67 | S:'$D(BSDXI) BSDXI=999
|
---|
| 68 | I +ERRNO S BSDXERR=ERRNO+134234112 ;vbObjectError
|
---|
| 69 | E S BSDXERR=ERRNO
|
---|
| 70 | S BSDXI=BSDXI+1
|
---|
| 71 | S ^BSDXTMP($J,BSDXI)="^^^^"_$C(30)
|
---|
| 72 | S BSDXI=BSDXI+1
|
---|
| 73 | S ^BSDXTMP($J,BSDXI)=$C(31)
|
---|
| 74 | Q
|
---|