Module CustomerListWP.rv
1Use dfrptvw.pkg
2Use DataDict.pkg
3Use dfRadio.pkg
4Use Windows.pkg
5Use cWinReport2.pkg
6Use CUSTOMER.DD
7
8ACTIVATE_VIEW Activate_oCustomerListWP FOR oCustomerListWP
9
10Object oCustomerListWP is a ReportView
11
12 Property Boolean pbComments False
13
14 Set Label to "Customer List"
15 Set Location to 6 6
16 Set Size to 95 180
17
18 Object Customer_DD is a Customer_DataDictionary
19 Send DefineAllExtendedFields
20 End_Object // Customer_DD
21
22 Set Main_DD to Customer_DD
23 Set Server to Customer_DD
24
25 Object oPrintTo is a RadioGroup
26 Set Size to 50 80
27 Set Location to 5 5
28 Set Label to "Send Report to"
29 Object oScreenRadio is a Radio
30 Set Label to "Report Viewer"
31 Set Size to 10 61
32 Set Location to 15 10
33 Set Status_Help to "Preview the report to screen"
34 End_Object // oScreenRadio
35
36 Object oPrinterRadio is a Radio
37 Set Label to "Printer"
38 Set Size to 10 37
39 Set Location to 30 10
40 Set Status_Help to "Send the report to the default printer"
41 End_Object // oPrinterRadio
42
43 Function IsToPrinter Returns boolean
44 integer iRadio
45 Get Current_radio to iRadio
46 Function_return (iRadio=1)
47 End_Function // IsToPrinter
48
49 End_Object // oPrintTo
50
51 Object oOrder is a RadioGroup
52 Set Size to 50 80
53 Set Location to 5 95
54 Set Label to "Report Order"
55 Object oNumberRadio is a Radio
56 Set Label to "Number"
57 Set Size to 10 41
58 Set Location to 15 10
59 Set Status_Help to "Sort by customer number"
60 End_Object // oNumberRadio
61
62 Object oNameRadio is a Radio
63 Set Label to "Name"
64 Set Size to 10 35
65 Set Location to 30 10
66 Set Status_Help to "Sort by customer name"
67 End_Object // oNameRadio
68
69 Function IsSortedByNumber Returns boolean
70 integer iRadio
71 Get Current_radio to iRadio
72 Function_return (iRadio=1)
73 End_Function // IsSortedByNumber
74
75 End_Object // oOrder
76
77 Object oCommentsCkBx is a CheckBox
78 Set Label to "Print Comments"
79 Set Size to 10 65
80 Set Location to 59 95
81
82 End_Object // oCommentsCkBx
83
84 Object oBtnPrint is a Button
85 Set Label to "Print"
86 Set Location to 76 7
87
88 Procedure OnClick
89 Send StartReport
90 End_Procedure
91
92 End_Object // oBtnPrint
93
94 Object oBtnCancel is a Button
95 Set Label to "Cancel"
96 Set Location to 76 65
97
98 Procedure OnClick
99 Send Close_Panel
100 End_Procedure
101
102 End_Object // oBtnCancel
103
104 Object oBtnPrinterSetup is a Button
105 Set Label to "Printer Setup"
106 Set Location to 76 123
107
108 Procedure OnClick
109 Boolean bSetupOk
110 Get DFPrintSetupDialog of oReport to bSetupOk
111 End_Procedure
112
113 End_Object // oBtnPrinterSetup
114
115 Object oReport is a cWinReport2
116 Set Report_Title to "Customer List"
117
118 // Set DDO, Index and breaks for the report
119 Set Server to Customer_DD
120 Set Ordering to 1
121
122 // Report_Breaks file.field // no breaks in this report
123
124 Property Boolean pbLandscape false
125
126 Function Starting_Main_Report Returns Integer
127 Integer iIndex
128 Boolean bOn bErr
129
130 Send DFSetMetrics wpm_cm
131 Send DFSetmargins 1 1 1 1
132
133 Get pbComments to bOn
134 Send DFSetLandscape (if(bOn,True,false)) // This can be used to force a page orientation
135 Get DFGetLandscape to bOn
136 Set pbLandscape to bOn
137
138 Forward Get Starting_Main_Report To bErr
139
140 Function_return bErr
141 End_Function
142
143 // Page_Top is printed first at the top margin of each page
144 Procedure Page_Top
145 string sFont
146 integer iFontSize iStyle
147
148 Move "arial" to sFont
149 Move 8 to iFontSize
150 Move (Font_Default) to iStyle
151
152 DFFont sFont
153 DFFontSize iFontSize
154 DFBeginHeader DFPageTop
155 DFHeaderFrame Hdr_NoFrame
156 DFHeaderPos Hdr_Left
157 DFWriteLn ("Page:" * "#pagecount#") iStyle
158 DFEndHeader
159
160 End_Procedure
161
162 Procedure Page_Header
163 integer iFill iBorder iStyle
164 string sFont sReportTitle
165 integer iFontSize
166
167 Move "arial" to sFont
168 Move 16 to iFontSize
169 Move (Font_bold + rgb_White) to iStyle
170 Move (rgb_dGrey) to iFill
171 Move (rgb_dGrey) to iBorder
172 Get Report_Title to sReportTitle
173
174 DFFont sFont
175 DFFontSize iFontSize
176 DFBeginHeader DFPageHeader
177 DFHeaderPos Hdr_Left
178 DFHeaderFrame Hdr_Margins 0.01 iBorder iFill
179 DFWritelnPos sReportTitle 0.1 iStyle
180 DFHeaderMargin HM_BottomOuter 0.08
181 DFEndHeader
182
183 End_Procedure // Page_Header
184
185 Procedure Page_Title
186 string sFont
187 integer iFontSize iHeaderStyle iFill iBorder
188 Boolean bOn
189
190 Get pbLandscape to bOn
191
192 Move "arial" to sFont
193 Move 8 to iFontSize
194 Move (Font_Bold + rgb_dBlue) to iHeaderStyle
195 Move (rgb_Grey) to iFill
196 Move (rgb_Grey) to iBorder
197
198 DFFont sFont
199 DFFontSize iFontSize
200 DFBeginHeader DFPageTitle
201 DFHeaderPos Hdr_Left
202 DFHeaderFrame Hdr_Margins 0 iBorder iFill
203 DfHeaderMargin HM_TopInner 0.01
204 DfHeaderMargin HM_BottomInner 0.01
205 DFHeaderMargin HM_BottomOuter 0.16
206
207 DfWritePos "Number" 0.1 (iHeaderStyle)
208 DfWritePos "Customer Name" 2 (iHeaderStyle)
209 DfWritePos "Address" 7 (iHeaderStyle)
210 DfWritePos "City" 12 (iHeaderStyle)
211 DfWritePos "St." 15 (iHeaderStyle)
212 DfWritePos "Zip" 17 (iHeaderStyle)
213
214 If bOn begin
215 DfWritePos "Comments" 19 (iHeaderStyle)
216 end
217 DfWriteln
218 DFEndHeader
219
220 End_Procedure // Page_Title
221
222 Procedure Body
223 string sFont
224 integer iFontSize iStyle
225 Boolean bOn
226
227 Send Update_Status (String(Customer.Customer_number))
228
229 Get pbLandscape to bOn
230
231 Move "arial" to sFont
232 Move 8 to iFontSize
233 Move (font_default) to iStyle
234
235 DFFont sFont
236 DFFontSize iFontSize
237 DFLineCheck 5
238
239 DfWritePos Customer.Customer_Number 0.8 (iStyle + Font_Right) 0
240 DfWritePos Customer.Name 2 iStyle -1 4.98
241 DfWritePos Customer.Address 7 iStyle -1 4.98
242 DfWritePos Customer.City 12 iStyle -1 3.98
243 DfWritePos Customer.State 15 iStyle -1 0.98
244 DfWritePos Customer.Zip 17 iStyle -1 1.98
245
246 If bOn begin
247 DfWritePos Customer.Comments 19 iStyle -1 0
248 dfWriteln
249 end
250 dfWriteln
251 End_Procedure // Body
252
253 // Page_Bottom is printed last at the bottom margin of each page
254 Procedure Page_Bottom
255 string sFont
256 integer iFontSize iBorder iStyle iFill
257 DateTime dtDT
258
259 Move (CurrentDateTime()) to dtDT
260
261 Move "arial" to sFont
262 Move 8 to iFontSize
263 Move (font_default) to iStyle
264 Move (rgb_dGrey) to iBorder
265 Move (rgb_White) to iFill
266
267 DFFont sFont
268 DFFontSize iFontSize
269 DFBeginHeader DFPageBottom
270 DFHeaderFrame Hdr_Margins 0 iBorder iFill
271 DFHeaderPos Hdr_Center // Write data in center
272 DFWriteln ("Report Printed on" * string(dtDT)) (iStyle)
273 DFEndHeader
274
275 End_Procedure // Page_Bottom
276
277 End_Object // oReport
278
279 Procedure StartReport
280 Boolean bToPrinter bComments bSortByNumber
281
282 // determine if direct print
283 Get IsToPrinter of oPrintTo to bToPrinter
284 Set OutPut_Device_Mode of oReport to (If(bToPrinter, PRINT_TO_PRINTER, PRINT_TO_WINDOW))
285
286 // determine if sort order is by number or name
287 Get IsSortedByNumber of oOrder to bSortByNumber
288 Set Ordering of oReport to (if(bSortByNumber, 2, 1))
289
290 Get Checked_State of oCommentsCkBx to bComments
291 Set pbComments to bComments
292
293 // run the report
294 Send Run_Report of oReport
295
296 End_Procedure // StartReport
297
298End_Object // oCustomerListWP
299