1 | ECXNUTDP ;ALB/JRC - Nut Division Worksheet Print ; 11/2/06 8:41am
|
---|
2 | ;;3.0;DSS EXTRACTS;**92,104**;Dec 22, 1997;Build 8
|
---|
3 | ;
|
---|
4 | EN ;entry point from option
|
---|
5 | ;Queue Report
|
---|
6 | N ZTDESC,ZTIO,ZTSAVE
|
---|
7 | S ZTIO=""
|
---|
8 | S ZTDESC="Nutrition Division Worksheet for DSS"
|
---|
9 | D EN^XUTMDEVQ("EN1^ECXNUTDP",ZTDESC,.ZTSAVE)
|
---|
10 | Q
|
---|
11 | EN1 ;Tasked entry point
|
---|
12 | ;Declare variables
|
---|
13 | N STOP,PAGENUM,LN,LTYPE
|
---|
14 | S (STOP,PAGENUM,LTYPE)=0,LN=""
|
---|
15 | K ^TMP($J)
|
---|
16 | F LTYPE="119.71","119.72" D I STOP D EXIT Q
|
---|
17 | .D HEADER I STOP D EXIT Q
|
---|
18 | .D GETDATA
|
---|
19 | .I '$D(^TMP($J,"ECX",LTYPE)) D Q
|
---|
20 | ..W !
|
---|
21 | ..W !,"***********************************************"
|
---|
22 | ..W !,"* NOTHING TO REPORT FOR "_$S(LTYPE=119.71:"PRODUCTION LOCATIONS",LTYPE=119.72:"DELIVERY LOCATIONS ",1:"")_" *"
|
---|
23 | ..W !,"***********************************************"
|
---|
24 | ..D WAIT
|
---|
25 | .D DETAIL I STOP D EXIT Q
|
---|
26 | .D FOOTER I STOP D EXIT Q
|
---|
27 | .D WAIT Q:STOP
|
---|
28 | .K ^TMP($J)
|
---|
29 | EXIT K ^TMP("ECXDSS",$J)
|
---|
30 | Q
|
---|
31 | GETDATA ;Get data
|
---|
32 | ;Init variables
|
---|
33 | N DIV,IEN,PLIEN,IENS,LOCATION,CNT,PDIV,FILE
|
---|
34 | S (DIV,LOCATION,PDIV)="",(IEN,PLIEN,IENS,CNT)=0
|
---|
35 | S DIV="" F S DIV=$O(^ECX(728.46,"B",DIV)) Q:DIV="" D
|
---|
36 | . ;Q:LTYPE'=$E(DIV,6,11)
|
---|
37 | . Q:LTYPE'=$E($P(DIV,"(",2),1,6)
|
---|
38 | . S IEN=$O(^ECX(728.46,"B",DIV,0)) Q:'IEN D
|
---|
39 | .. ;S PLIEN=$P(DIV,";",1),FILE=$E(DIV,6,11),CNT=$G(CNT)+1
|
---|
40 | .. S PLIEN=$P(DIV,";",1),FILE=$E($P(DIV,"(",2),1,6),CNT=$G(CNT)+1
|
---|
41 | .. I FILE'=LTYPE Q
|
---|
42 | .. S IENS=""_PLIEN_","_""
|
---|
43 | .. S LOCATION=$$GET1^DIQ(FILE,""_IENS_","_"",.01,"E")
|
---|
44 | .. S PDIV=$$GET1^DIQ(728.46,IEN,1,"I")
|
---|
45 | .. S PDIV=$$RADDIV^ECXDEPT(PDIV)
|
---|
46 | .. S ^TMP($J,"ECX",FILE)="1"
|
---|
47 | .. S ^TMP($J,"ECX",FILE,PLIEN)=PLIEN_U_LOCATION_U_PDIV
|
---|
48 | Q
|
---|
49 | HEADER ;print header
|
---|
50 | N TYPE
|
---|
51 | S PAGENUM=$G(PAGENUM)+1
|
---|
52 | S $P(LN,"=",9)="",TYPE=$S(LTYPE=119.71:"PRODUCTION",LTYPE=119.72:"DELIVERY",1:"")
|
---|
53 | W @IOF
|
---|
54 | W ?1,"RUN DATE: ",$$FMTE^XLFDT(DT,"5H"),?70,"PAGE ",PAGENUM
|
---|
55 | W !,?23,"NUTRITION DIVISION WORKSHEET"
|
---|
56 | W !!,?27,TYPE_" LOCATIONS"
|
---|
57 | W:TYPE="DELIVERY" !!,?2,TYPE
|
---|
58 | W:TYPE="PRODUCTION" !!,?1,TYPE
|
---|
59 | W ?26,TYPE,?50,"ASSIGNED"
|
---|
60 | W !,?1,"LOCATION #",?26,"LOCATIONS",?50,"DIVISION"
|
---|
61 | W !,?1,LN_"===",?26,LN,LN,?47,LN,LN
|
---|
62 | Q
|
---|
63 | ;
|
---|
64 | DETAIL ;Print detailed line
|
---|
65 | ;Input : ^TMP("ECXDSS",$J) full global reference
|
---|
66 | ; PLIEN - File 119.71 or 119.72 IEN
|
---|
67 | ; LOCATION - File 119.71 or 119.72 NAME
|
---|
68 | ; DIVISION - Assigned production division
|
---|
69 | ;Output : None
|
---|
70 | N FILE,NODE,PIEN
|
---|
71 | S FILE=0 F S FILE=$O(^TMP($J,"ECX",FILE)) Q:'FILE!STOP D
|
---|
72 | .S PIEN=0 F S PIEN=$O(^TMP($J,"ECX",FILE,PIEN)) Q:'PIEN!STOP D
|
---|
73 | ..S NODE=^TMP($J,"ECX",FILE,PIEN)
|
---|
74 | ..W !?3,$$RJ^XLFSTR($P(NODE,U),U,6),?26,$P(NODE,U,2),?50,$$RJ^XLFSTR($P(NODE,U,3),U,6)
|
---|
75 | ..I $Y>(IOSL-5) D WAIT Q:STOP D HEADER
|
---|
76 | ..Q
|
---|
77 | Q
|
---|
78 | ;
|
---|
79 | WAIT ;End of page logic
|
---|
80 | ;Input ; None
|
---|
81 | ;Output ; STOP - Flag indicating if printing should continue
|
---|
82 | ; 1 = Stop 0 = Continue
|
---|
83 | ;
|
---|
84 | S STOP=0
|
---|
85 | ;CRT - Prompt for continue
|
---|
86 | I $E(IOST,1,2)="C-"&(IOSL'>24) D Q
|
---|
87 | .F Q:$Y>(IOSL-3) W !
|
---|
88 | .N DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
|
---|
89 | .S DIR(0)="E"
|
---|
90 | .D ^DIR
|
---|
91 | .S STOP=$S(Y'=1:1,1:0)
|
---|
92 | ;Background task - check taskman
|
---|
93 | S STOP=$$S^%ZTLOAD()
|
---|
94 | I STOP D
|
---|
95 | .W !,"*********************************************"
|
---|
96 | .W !,"* PRINTING OF REPORT STOPPED AS REQUESTED *"
|
---|
97 | .W !,"*********************************************"
|
---|
98 | Q
|
---|
99 | FOOTER ;Print footer
|
---|
100 | N DIV,IEN
|
---|
101 | S DIV="",IEN=0
|
---|
102 | W !!!,?1,"INSTITUTION",!,"FILE/DIVISIONS",!,LN,LN
|
---|
103 | F S DIV=$O(^DG(40.8,"B",DIV)) Q:DIV=""!STOP D
|
---|
104 | .F S IEN=$O(^DG(40.8,"B",DIV,IEN)) Q:'IEN!STOP D Q:STOP
|
---|
105 | ..W !,?3,$$RJ^XLFSTR($$GETDIV^ECXDEPT(IEN),U,8)
|
---|
106 | ..I $Y>(IOSL-5) D WAIT Q:STOP D HEADER,FHEADER
|
---|
107 | Q
|
---|
108 | FHEADER ;Footer header
|
---|
109 | W !!!,?1,"INSTITUTION",!,"FILE/DIVISIONS",!,LN,LN
|
---|
110 | Q
|
---|