Module SigCJReportControlDemo - Table.vw
1Use Windows.pkg
2Use DFClient.pkg
3Use Customer.DD
4Use SalesP.DD
5Use OrderHea.DD
6Use Vendor.DD
7Use Invt.DD
8Use OrderDtl.DD
9Use cSigCjReportControl.pkg
10Use cSigCJFieldChooser.pkg
11Use cSigCjProgressBar.pkg
12Use cSigCjPushButton.pkg
13
14Define CR_LF for (Character(13)+Character(10))
15
16Deferred_View Activate_SigCjReportControlDemo_Table_View for ;
17Object SigCjReportControlDemo_Table_View is a dbView
18 Set Border_Style to Border_Thick
19 Set Size to 216 450
20 Set Location to 2 2
21 Set Label to "Codejock Demo - Report Control - Table"
22 Set Maximize_Icon to True
23 Set Icon to "SIG.ico"
24
25 Object oVendor_DD is a Vendor_DataDictionary
26 End_Object
27
28 Object oInvt_DD is a Invt_DataDictionary
29 Set DDO_Server to oVendor_DD
30
31 Procedure OnConstrain
32 // Constrain Invt.Item_ID eq "MENU"
33 End_Procedure
34
35 End_Object
36
37 Object oSalesp_DD is a Salesp_DataDictionary
38
39 Procedure OnConstrain
40 // Constrain Salesp.ID eq "LM"
41 End_Procedure
42
43 End_Object
44
45 Object oCustomer_DD is a Customer_DataDictionary
46 End_Object
47
48 Object oOrderhea_DD is a OrderHea_DataDictionary
49 Set DDO_Server to oSalesp_DD
50 Set DDO_Server to oCustomer_DD
51 End_Object
52
53 Object oOrderdtl_DD is a OrderDtl_DataDictionary
54 Set DDO_Server to oInvt_DD
55 Set DDO_Server to oOrderhea_DD
56
57 Procedure OnConstrain
58 Constrain OrderDtl.Qty_Ordered gt 0
59 End_Procedure
60 End_Object
61
62 Set Main_DD to oOrderdtl_DD
63 Set Server to oOrderdtl_DD
64
65 Object oFilter_Group is a Group
66 Set Size to 28 441
67 Set Location to 4 4
68 Set peAnchors to anTopLeftRight
69
70 Object oFilter_Search_Form is a Form
71 Set Size to 13 107
72 Set Location to 10 60
73 Set peAnchors to anTopLeft
74 Set Label_Col_Offset to 2
75 Set Label_Justification_Mode to JMode_Right
76 Set Label to "Filter Search"
77
78 Set Form_Button 0 to Form_Button_Prompt
79 Set Form_Button_Bitmap 0 to "ieref.bmp"
80 Set Prompt_Button_Mode to PB_PromptOn
81 On_Key kClear Send Prompt
82 On_Key kEnter Send Prompt
83
84 Procedure OnChange
85 String sValue
86
87 Get Value to sValue
88 If (Trim(sValue) = "") Begin
89 Send Filter_Rows of oSigCJReportControl1 sValue
90 End
91 End_Procedure
92
93 Procedure Prompt
94 String sValue
95
96 Get Value to sValue
97 Send Filter_Rows of oSigCJReportControl1 sValue
98 End_Procedure
99 End_Object
100
101 Object oRows_Form is a Form
102 Set Size to 13 25
103 Set Location to 10 193
104 Set Label to "Rows"
105 Set Label_Justification_Mode to JMode_Right
106 Set Label_Col_Offset to 2
107 End_Object
108
109 Object oFilter_Rows_Form is a Form
110 Set Size to 13 25
111 Set Location to 10 268
112 Set Label to "Filtered Rows"
113 Set Label_Justification_Mode to JMode_Right
114 Set Label_Col_Offset to 2
115 End_Object
116
117 Object oSelected_Rows_Form is a Form
118 Set Size to 13 25
119 Set Location to 10 348
120 Set Label to "Selected Rows"
121 Set Label_Justification_Mode to JMode_Right
122 Set Label_Col_Offset to 2
123 End_Object
124
125// Object oButton1 is a Button
126// Set Size to 14 59
127// Set Location to 9 378
128// Set Label to 'Double Order'
129// Set psToolTip to ("This will Double the the number of rows of all orders" + CR_LF + "this is for speed testing only" + CR_LF + CR_LF + "Speed testing should not be done in Debug mode")
130//
131//
132// // fires when the button is clicked
133// Procedure OnClick
134// Send DoProcess of Double_Orders_bpo
135// End_Procedure
136//
137// End_Object
138
139 End_Object
140
141 //-------------------------------------------------------------------------
142 //Progress bar and data load button
143
144 Object oSigCJProgressBar1 is a cSigCJProgressBar
145 Set Size to 13 387
146 Set Location to 199 59
147 Set peAnchors to anBottomLeftRight
148 Set peStyle to ePR_BarSmooth
149 Set pbFlatStyle to True
150 Set piBarColor to (RGB(128,197,255))
151
152 Procedure Do_Update Integer iVal
153 Set ComValue to iVal
154 Set ComText to ("Loading Data Please Wait..." * String(iVal))
155 End_Procedure
156
157 Procedure Reset_Bar
158 Set ComValue to 0
159 Set ComText to ""
160 End_Procedure
161 End_Object
162
163 //-------------------------------------------------------------------------
164
165 Object oSigCJReportControl1 is a cSigCJReportControl
166 Set Size to 159 440
167 Set Location to 36 5
168
169 Set peAnchors to anAll
170 Set phoDD to (Server(Self))
171 Set piTable_Index to 1
172 Set pbActive_Track to True
173 Set pbRow_Colors to True
174 Set pbRow_Item to True
175 Set pbRowID_Mode to True
176 Set pbPX_Save_Layout to True
177 Set psPX_Tag to (Label(Parent(Self)))
178 Set piLoad_Monitor to 5
179 Set pbAuto_Fill to False
180 Set piLoad_Monitor to True
181 Set pbItem_Colors to True
182 // Set pbDescending to True
183// Set psGridFontName to "Calibri"
184// Set pnGridFontSize to 11
185// Set psPreviewFontName to "Calibri"
186// Set pnPreviewFontSize to 11
187
188 Object oSigCJContextMenu is a cSigCJContextMenu
189 Send Add_MenuItem "Rebuild" "Rebuild_Report" False ""
190 Send Add_MenuItem "Refresh" "Refresh_Report" False ""
191 If (phoFieldChooser(Self)) Begin
192 Send Add_MenuItem "Field Chooser" "FieldChooser" True ""
193 Send Add_MenuItem "Default Layout" "DefaultLayout" False ""
194 End
195 Send Add_MenuItem "Select All" "SelectAll" True ""
196 Send Add_MenuItem "Deselect All" "DeselectAll" False ""
197 Send Add_MenuItem "Invert Selection" "Invert_Selection" False ""
198 Send Add_MenuItem "Preview Report" "PreviewReport" True ""
199 Send Add_MenuItem "Print Report" "PrintReport" False ""
200 Send Add_MenuItem "Export To CSV" "CSV_Export" False ""
201 Send Add_MenuItem "Process Selected Rows" "Process_Rows" True ""
202 End_Object
203
204 Procedure OnDefine_Columns
205 Send Add_Report_Column "Order" 80 eRC_Integer eRC_Standard "OrderDtl.Order_Number"
206 Send Add_Report_Column "Line" 80 eRC_Integer eRC_Standard "OrderDtl.Detail_Number"
207 Send Add_Report_Column "Item" 100 eRC_String eRC_Standard "OrderDtl.Item_ID"
208 Send Add_Report_Column "Qty" 80 eRC_Integer eRC_Standard "OrderDtl.Qty_Ordered"
209 Send Add_Report_Column "Price" 80 eRC_Currency eRC_Standard "OrderDtl.Price"
210 Send Add_Report_Column "Line Total" 100 eRC_Currency eRC_Standard "OrderDtl.Extended_Price"
211 Send Add_Report_Column "Sales Person" 100 eRC_String eRC_Standard "SalesP.Name"
212 Send Add_Report_Column "Customer" 150 eRC_String eRC_Standard "Customer.Name"
213 Send Add_Report_Column "Dated" 80 eRC_Date eRC_Standard "OrderHea.Order_Date"
214 Send Add_Report_Column "Order Total" 100 eRC_Currency eRC_Standard "OrderHea.Order_Total"
215 Send Add_Report_Column "!" 100 eRC_String eRC_Standard "OrderHea.Order_Total" ;
216 "(If(OrderHea.Order_Total > 10000 , 'Large Order' , ''))"
217 Send Add_Report_Column "Customer" 0 eRC_String eRC_Preview "Customer.Comments"
218 End_Procedure
219
220 Procedure OnDouble_Click_RowID RowID Row_ID
221 Boolean bFound
222 String sOrder
223
224 Move (FindByRowId(OrderDtl.File_Number, Row_ID)) to bFound
225 If (bFound) Begin
226 Send Activate_Order_View OrderDtl.Order_Number
227 End
228 End_Procedure
229
230 Procedure OnProcess_Rows_RowID RowID Row_ID
231 Boolean bFound
232
233 Move (FindByRowId(OrderDtl.File_Number, Row_ID)) to bFound
234
235// Showln Customer.Name " " OrderHea.Order_Total " " OrderDtl.Qty_Ordered
236 End_Procedure
237
238 Procedure OnComRowRClick Variant llRow Variant llItem
239 Send Popup of oSigCJContextMenu
240 End_Procedure
241
242 Procedure OnSetRowColor Integer iColumn String sValue
243 If (iColumn = 0) Begin
244 If (Mod(Integer(sValue),2)=0) Set piRow_BackColor to clAqua
245 End
246 End_Procedure
247
248 Procedure OnCreateRowItem Integer iColumn Handle hoItem String sValue
249 If (iColumn = 10) Begin
250 If (Trim(sValue) > "") Set psImage of hoItem to "FlagUK_16.bmp"
251 End
252 End_Procedure
253
254 Procedure OnSetItemColor Integer iColumn String sValue
255 If (iColumn = 9) Begin
256 If (Number(sValue) > 5000) Begin
257 Set piItem_BackColor to clLime
258 End
259 If (Number(sValue) < 1000) Begin
260 Set piItem_BackColor to clLime
261 End
262 End
263 If (iColumn = 10) Begin
264 If (sValue > "") Begin
265 Set piItem_ForeColor to clRed
266 Set piItem_BackColor to clYellow
267 End
268 End
269 End_Procedure
270
271 Procedure OnReport_Row_Count Integer iRow_Count
272 Set Value of oRows_Form to iRow_Count
273 End_Procedure
274
275 Procedure OnFiltered_Row_Count Integer iFiltered_Count
276 Set Value of oFilter_Rows_Form to iFiltered_Count
277 End_Procedure
278
279 Procedure OnSelected_Row_Count Integer iSelectedCount
280 Set Value of oSelected_Rows_Form to iSelectedCount
281 End_Procedure
282
283 //---------------------------------------------------------------------
284 //Data Load Progress Events
285 Procedure OnLoad_Start Integer iMax_Rows
286 If (iMax_Rows = 0) Begin
287 Get_Attribute DF_FILE_RECORDS_USED of (Main_File(Server(Self))) to iMax_Rows
288 End
289 Set ComMax of oSigCJProgressBar1 to iMax_Rows
290 End_Procedure
291
292 Procedure OnLoad_Monitor Integer iRow_Count
293 Integer iOuter iInner iMax_Rows iMax
294
295 Get ComMax of oSigCJProgressBar1 to iMax_Rows
296 Move (iMax_Rows/20) to iMax
297 While (iMax < iRow_Count)
298 Move (iMax + iMax) to iMax
299 Loop
300 If (iMax = iRow_Count) Send Do_Update of oSigCJProgressBar1 iRow_Count
301 End_Procedure
302
303 Procedure OnLoad_End Integer iRow_Count
304 Send Reset_bar of oSigCJProgressBar1
305 Send sigInfo_Box ("Load Time for" * String(iRow_Count) * "rows is" * String(ptsTimeSpan_Load(Self)) ) "Load Times"
306 End_Procedure
307
308 //---------------------------------------------------------------------
309
310 End_Object
311
312 Object oSigCJPushButton1 is a cSigCJPushButton
313 Set Location to 199 5
314 Set psCaption to " Load Data"
315 Set peAnchors to anBottomLeft
316
317 Procedure OnClick
318 Send Refresh_Report of oSigCJReportControl1
319 End_Procedure
320 End_Object
321
322
323 Object Double_Orders_bpo is a BusinessProcess
324 Object oVendor_DD is a Vendor_DataDictionary
325 End_Object
326
327 Object oInvt_DD is a Invt_DataDictionary
328 Set DDO_Server to oVendor_DD
329 End_Object
330
331 Object oSalesp_DD is a Salesp_DataDictionary
332 End_Object
333
334 Object oCustomer_DD is a Customer_DataDictionary
335 End_Object
336
337 Object oOrderhea_DD is a OrderHea_DataDictionary
338 Set DDO_Server to oSalesp_DD
339 Set DDO_Server to oCustomer_DD
340 End_Object
341
342 Object oOrderdtl_DD is a OrderDtl_DataDictionary
343 Set Constrain_file to OrderHea.File_number
344 Set DDO_Server to oInvt_DD
345 Set DDO_Server to oOrderhea_DD
346 End_Object
347
348 Set Main_DD to oOrderdtl_DD
349 Set Server to oOrderdtl_DD
350
351 Procedure OnProcess
352 Integer iFile iFile_Invt iCount iDetail_Num
353 String sValue1 sValue3 sValue4 sValue5 sValue6
354
355 Move OrderDtl.File_Number to iFile
356 Move Invt.File_Number to iFile_Invt
357 Send Clear of oOrderhea_DD
358 Send Find of oOrderhea_DD GE 1
359 While (Found)
360 Get Field_Current_Value of oOrderhea_DD Field OrderHea.Last_Detail_Num to iDetail_Num
361 For iCount from 1 to iDetail_Num
362 Move iCount to OrderDtl.Detail_Number
363 Send Find of oOrderdtl_DD EQ 1
364 If (Found) Begin
365 Get_Field_Value iFile 3 to sValue3
366 Get_Field_Value iFile 4 to sValue4
367 Get_Field_Value iFile 5 to sValue5
368 Get_Field_Value iFile 6 to sValue6
369 Send Clear of oOrderdtl_DD
370 Set_Field_Value iFile_Invt 1 to sValue3
371 Send Find of oInvt_DD EQ 1
372 Set_Field_Value iFile 4 to sValue4
373 Set_Field_Value iFile 5 to sValue5
374 Set_Field_Value iFile 6 to sValue6
375 Send Request_Save of oOrderdtl_DD
376 End
377 Loop
378 Send Find of oOrderhea_DD Gt 1
379 Loop
380 End_Procedure
381 End_Object
382
383
384Cd_End_Object
385