forked from rperez1989/CodeRevisor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WebComponentHBNBatchPrintInboxWC2.txt
348 lines (246 loc) · 7.47 KB
/
WebComponentHBNBatchPrintInboxWC2.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
======OBJECT = WebComponentHBNBatchPrintInboxWC2 === HBNBatch Print Inbox WC2=====
=== RULES ===
=== EVENTS SOURCE ===
Event Start
/* Generated by DVelop Work With Plus Pattern [Start] - Do not change */
&STRNUMBER.Visible = False
InboxGrid.Rows = 10
/* Generated by DVelop Work With Plus Pattern [End] - Do not change */
PLoadContext.Call(&AuxContext)
&StrNumber = &AuxContext.FilterStore
&UsrId = &AuxContext.UserID
// Get Batch Size Parameter
PGetParmBatchSize(&BatchSize)
&FilterTask = Tasks.ALL
&SortBy = SortInbox.Created
&ReceivingStr.SetEmpty()
&ShippingStr.SetEmpty()
&TnfIdFilter.SetEmpty()
&FromDate = nullvalue(&FromDate)
&ToDate = nullvalue(&ToDate)
&totalTasks = 0
&new = 0
do 'doSearch'
EndEvent
Event InboxGrid.Load
/* Generated by DVelop Work With Plus Pattern [Start] - Do not change */
//this code should be inside the For Each used to load the grid
/* Generated by DVelop Work With Plus Pattern [End] - Do not change */
&GridSelected.Enabled = true
&new = 0
For &InboxSDTItem in &InboxSDT
&GridSelected = &InboxSDTItem.GrdSelected
&TnfFStrNum = &InboxSDTItem.TnffstrNum
&TnfToStrNum = &InboxSDTItem.TnfToStrNum
&TnfFStrDsc = &InboxSDTItem.FromStoreName.Trim()
&TnfToStrDsc = &InboxSDTItem.ToStoreName.Trim()
//&TnfTask = Tasks.EnumerationDescription(&InboxSDTItem.TnfTask)
&TnfTask = &InboxSDTItem.TnfTask
&TnfId2 = &InboxSDTItem.TnfID
&TnfWLstId = &InboxSDTItem.TnfWLstId
&TnfInsOnDT = &InboxSDTItem.TnfDate
&TnfWFId = &InboxSDTItem.TnfWFId
&TnfTknBy = &InboxSDTItem.TakenByUID
&image2.FromImage(ActionDisabled)
&image2.Tooltiptext= ''
if &InboxSDTItem.PrintedFlag = Boolean.TRUE
&image2.FromImage(PrinterOk)
&image2.Tooltiptext = 'Printed'
else
&image2.FromImage(NotDone)
&image2.Tooltiptext = 'Not Printed'
endif
do 'GetSelectedListFromSession'
do 'CheckSelected'
if &InboxSDTItem.TakenByUID.IsEmpty()
&Taken.FromImage(MailClosed)
&Taken.Tooltiptext = "New"
&new += 1
else
if &InboxSDTItem.TakenByUID = &AuxContext.UserId
&Taken.FromImage(MailOpen)
&Taken.Tooltiptext = "In Process"
else
&Taken.FromImage(MailAssigned)
endif
endif
load
endfor
&totalTasks = &InboxSDT.Count
&Selcount = &TnfList.Count
&count = &totalTasks
//Summary
txtsummary.Caption = 'Summary: Inbox ' + &totalTasks.ToString().Trim() + ' - New ' + &new.ToString().Trim() + ' - Selected: ' + &Selcount.ToString().Trim()
&Session.Set("TN2InboxCount",trim(str(&count)))
&TnfIdFilter.Setfocus()
EndEvent
Event 'DoPrintSelectedBtn'
/* Generated by DVelop Work With Plus Pattern [Start] - Do not change */
/* Generated by DVelop Work With Plus Pattern [End] - Do not change */
&TnfList.Clear()
&message.Description = '&FilterTask = ' + &FilterTask.ToString()
PTraceLog.Call(&Pgmname, &message)
Do case
Case &FilterTask = Tasks.ALL
msg('You should select a task type')
Case &FilterTask = Tasks.SHIP or &FilterTask = Tasks.RECEIVE
for each line in InboxGrid
if (&GridSelected = true)
PTRSetPrintFlag(&TnfID2,TransferCategory.Internal)
//add to tnflist
&tnflistitem.TnfID = &TnfID2
&TnfList.Add(&tnflistitem)
&tnflistitem = new()
endif
endfor
commit
//call report in popup
&workitemsxml2 = &TnfList.ToXml()
&Session.Set("TnfListPrint",&workitemsxml2)
RBNREP_ShipReceiveTicket.Popup(0, '')
&TnfList.Clear()
//Refresh
InboxGrid.Refresh()
Case &FilterTask = Tasks.LQD
for each line in InboxGrid
if (&GridSelected = true)
PTRSetPrintFlag(&TnfID2,TransferCategory.Liquidation)
//add to tnflist
&tnflistitem.TnfID = &TnfID2
&TnfList.Add(&tnflistitem)
&tnflistitem = new()
endif
endfor
commit
//call report in popup
&workitemsxml2 = &TnfList.ToXml()
&Session.Set("TnfListPrint",&workitemsxml2)
NLQREP_ShipTicket.Popup(0)
&TnfList.Clear()
//Refresh
InboxGrid.Refresh()
endcase
EndEvent
Event Enter
do 'ApplyFilters'
do 'doSearch'
InboxGrid.Refresh()
/* Generated by DVelop Work With Plus Pattern [Start] - Do not change */
/* Generated by DVelop Work With Plus Pattern [End] - Do not change */
EndEvent
Event &TnfID2.Click
ploadContext.Call(&AuxContext)
if (&TnfTknBy.IsEmpty()) or (&TnfTknBy = &AuxContext.UserId)
if &TnfTask = Tasks.SHIP
HPOShip.Popup(&TnfID2)
else
if &TnfTask = Tasks.LQD
&TransferCategory = TransferCategory.Liquidation
NLQShip.Popup(&TnfID2,&TransferCategory)
else
HPOReceive.Popup(&TnfID2)
endif
endif
endif
//Refresh
InboxGrid.Refresh()
EndEvent
Event &SortBy.Click
do 'doSearch'
InboxGrid.Refresh()
EndEvent
Event &SelFirst50.Click
&qtySelected = 0
if (&SelFirst50=true)
&selectedState = true
else
&selectedState = false
endif
//Refresh
InboxGrid.Refresh()
EndEvent
Event &LQRId.Click
if not &LQRId.IsEmpty() and &LQRId <> 0
&FilterTask = Tasks.LQD
else
if &LQRId = 0
&FilterTask = Tasks.ALL
endif
endif
EndEvent
Sub 'doSearch'
PInboxSDTLoad(&StrNumber, &ReceivingStr, &LQRId, &ShippingStr, &TnfIdFilter, &FromDate, &ToDate, &FilterTask, &SortBy, &InboxSDT)
For &InboxSDTItem in &InboxSDT
&InboxSDTItem.GrdSelected = &selectedState
&qtySelected +=1
if (&qtySelected=50)
exit
endif
EndFor
EndSub
Sub 'CheckSelected'
&Selected = Boolean.FALSE
for &IndexTnfID in &TnfList
if &IndexTnfID.TnfID = &TnfId2
&Selected = Boolean.TRUE
exit
endif
endfor
EndSub
Sub 'GetSelectedListFromSession'
&TnfList.FromXml(&Session.Get('TnfList'))
EndSub
Sub 'ApplyFilters'
&Message.Description ='Sub ApplyFilters &TnfIdFilter=' + &TnfIdFilter.ToString().Trim()
PTraceLog.Call(&Pgmname, &Message)
if(not &TnfIdFilter.IsEmpty())
&ExisteTnfId = Boolean.FALSE
for each
where TnfID = &TnfIdFilter
where TnfRdyFlg = 1
if &StrNumber = 0 or
( TnfSts = TnfStatus.Request and TnfFStrNum = &StrNumber ) or
( TnfSts = TnfStatus.Shipped and TnfToStrNum = &StrNumber )
&ExisteTnfId = Boolean.TRUE
if TnfSts = TnfStatus.Request
&AuxTnfTask = Tasks.SHIP
&AuxTnfTknBy = iif(TnfShpTknBy.IsEmpty(), 0, TnfShpTknBy)
else
&AuxTnfTask = Tasks.RECEIVE
&AuxTnfTknBy = iif(TnfRcvTknBy.IsEmpty(), 0, TnfRcvTknBy)
endif
endif
when none
for each
where LqTskId = &TnfIdFilter
where LqTskRFlg = true
where LqTskSts = TnfStatus.Request
&ExisteTnfId = Boolean.TRUE
&AuxTnfTask = Tasks.LQD
&AuxTnfTknBy = iif(LqTskTknBy.IsEmpty(), 0, LqTskTknBy)
endfor
endfor
if(&ExisteTnfId = Boolean.TRUE)
do 'ExecuteSelectedTransfer'
endif
endif
EndSub
Sub 'ExecuteSelectedTransfer'
ploadContext.Call(&AuxContext)
if (&AuxTnfTknBy.IsEmpty()) or (&AuxTnfTknBy = &AuxContext.UserId)
if &AuxTnfTask = Tasks.SHIP
HPOShip.Popup(&TnfIdFilter)
&TnfIdFilter.SetEmpty()
else
if &AuxTnfTask = Tasks.RECEIVE
HPOReceive.Popup(&TnfIdFilter)
&TnfIdFilter.SetEmpty()
else
&AuxTnfTask = Tasks.LQD
NLQShip.Popup(&TnfIdFilter, TransferCategory.Liquidation)
&TnfIdFilter.SetEmpty()
endif
endif
endif
refresh
EndSub