forked from rperez1989/CodeRevisor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ProcedureNLQREP_ShipTicket.txt
261 lines (186 loc) · 6.24 KB
/
ProcedureNLQREP_ShipTicket.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
======OBJECT = ProcedureNLQREP_ShipTicket === Shipping ticket report=====
=== RULES ===
Parm(in:&pLqTskID);
output_file("NLQShipReport", "PDF");
=== PROCEDURE SOURCE ===
/*
2016-03-04 RP Created
*/
&message.Description = '&pLqTskID = ' + &pLqTskID.ToString()
PTraceLog.Call(&Pgmname, &message)
&LQList.FromXml( &Session.Get('TnfListPrint'))
printfile("xml")
printfile(&LQList.ToXml())
if &pLqTskID = 0
for &indexLqTskId in &LQList
For each
where LqTskId = &indexLqTskId.TnfID
&LqTskID = LqTskId
endfor
do 'PrintTicket'
endfor
else
&LqTskID = &pLqTskID
do 'PrintTicket'
endif
Sub 'PrintTicket'
&LineSDT = new() //laz 11-11-04
&TypeHeading = 'Liquidation'
&NEW_BK_ID = PGetPr21.Udp()
&USED_BK_ID = PGetPr22.Udp()
&reprint0 = ''
&reprint1 = ''
&reprint2 = ''
//MB 2014-10-21. #2113
&Code = &LqTskID.ToString()
&Code = &Code.Trim()
&TemporalPath = PGetPr10.Udp()
&Path = &TemporalPath.Trim() + &Code + '.gif'
PgenerateBarcode.Call(&Path,&Code)
&barcode = loadbitmap(&Path)
//END MB--------------
print header
&total = 0
&lastPage = Boolean.FALSE
for each
Order LqTskId
where LqTskId = &LqTskID
&STRNUMBER = LqTskShStr
&UNTNUMBER = LqTskShUnt
NLqGetLiquidatorName.Call(LQRId,&LQRName)
&LQTskStrDsc = LqTskStrDsc
print body
&message.Description = '&Inside first foreach'
PTraceLog.Call(&Pgmname, &message)
for each
where LqTskId = &LqTskID
&message.Description = '&Inside second foreach'
PTraceLog.Call(&Pgmname, &message)
&BkISBN = LqTskBEAN
&BkTitle = LqTskBTtl
&BkAuthor = LqTskBAthr
PClsGt01.Call(LqTskBCls,&BkClsName)
&LqTskBShNQ = LqTskBShNQ
&LqTskBShUQ = LqTskBShUQ
&PriceNew = LqTskBPRSN
&PriceUse = LqTskBPRSU
&LqPrice = LqTskBPrc
Do 'Print'
endfor
endfor
// Print line from SDT
do 'PrintLineFromSDT'
&totalStr = '$' + Trim(&total.ToString())
print bottom
&lastPage = Boolean.TRUE
print Tracking
do 'getTrackingInfo'
footer
if &lastPage = Boolean.TRUE
print footer
endif
end
eject // added by cdm on 10-24-2011
EndSub
sub 'getTrackingInfo'
&TrkNumbers = ''
for each Order LqTskId
where LqTskId = &LqTskID
&TrkNumbers = LqTrckNbr.Trim()
&TspPrvName = TspPrvName.Trim()
print TrackingLine
endfor
endsub
sub 'PrintNew'
if &LqTskBShNQ > 0
&message.Type = MessageTypes.Verbose
&message.Description = 'Print New'
PTraceLog.Call(&Pgmname, &message)
&division = &NEW_BK_ID
&Price = &LqPrice //Liquidation Price
//&CPriceNew = '$' + trim(&PriceNew.ToString())
//&CPriceUse = ''
&LQQty = &LqTskBShNQ
&lineTotal = &Price * &LqTskBShNQ
&total += &lineTotal
&priceStr = '$' + Trim(&Price.ToString())
&lineTotalStr= '$' + Trim(&lineTotal.ToString())
// print line
&LineItem.Division = &division
//&LineItem.PriceNew = &CPriceNew
//&LineItem.PriceUsed = &CPriceUse
&LineItem.TnfQty = &LQQty
&LineItem.TnfPrice = &priceStr
&LineItem.LineTotal = &lineTotalStr
endif
endsub
sub 'PrintUsed'
if &LqTskBShUQ > 0
&message.Type = MessageTypes.Verbose
&message.Description = 'Sub Print Used '
PTraceLog.Call(&Pgmname, &message)
&division = &USED_BK_ID
&Price = &LqPrice //Liquidation Price
//&CPriceNew = ''
//&CPriceUse = '$' + trim(&PriceUse.ToString())
&LQQty = &LqTskBShUQ
&lineTotal = &Price * &LqTskBShUQ
&total += &lineTotal
&priceStr = '$' + Trim(&Price.ToString())
&lineTotalStr = '$' + Trim(&lineTotal.ToString())
// print line
&LineItem.Division = &division
//&LineItem.PriceNew = &CPriceNew
//&LineItem.PriceUsed = &CPriceUse
&LineItem.TnfQty = &LQQty
&LineItem.TnfPrice = &priceStr
&LineItem.LineTotal = &lineTotalStr
endif
endsub
Sub 'Print'
&message.Type = MessageTypes.Verbose
&message.Description = 'Sub Print. NewQty = '+ &LqTskBShNQ.ToString() + 'UsdQty= ' + &LqTskBShUQ.ToString()
PTraceLog.Call(&Pgmname, &message)
//LAZ 2011-11-23: There must be two new() if there are two lines... each line must have its own new.
// I don't understand how this worked before...
if &LqTskBShNQ > 0 //LAZ 2011-11-13
&LineItem = new ShipReceiveTicketLine.ShipReceiveTicketLineItem() //LAZ 2011-11-13
// Load SDT book data
&LineItem.BkISBN = &BkISBN
&LineItem.BKTitle = &BkTitle
&LineItem.BKAuthor = &BkAuthor
&LineItem.BkClsName = &BkClsName //RP 2015-1-09
do 'PrintNew'
&LineSDT.Add(&LineItem) //LAZ 2011-11-13
endif
if &LqTskBShUQ > 0 //LAZ 2011-11-13
&LineItem = new ShipReceiveTicketLine.ShipReceiveTicketLineItem()
// Load SDT book data
&LineItem.BkISBN = &BkISBN
&LineItem.BKTitle = &BkTitle
&LineItem.BKAuthor = &BkAuthor
&LineItem.BkClsName = &BkClsName
do 'PrintUsed'
&LineSDT.Add(&LineItem)
endif
EndSub
Sub 'PrintLineFromSDT'
&message.Type = MessageTypes.Verbose
&message.Description = 'Sub PrintLineFromSDT. ' + &LineSDT.ToXml()
PTraceLog.Call(&Pgmname, &message)
&LineSDT.Sort("BkAuthor, BkTitle, BkISBN, BkClsAbr")
For &LineItem in &LineSDT
&BkISBN = &LineItem.BkISBN
&BkTitle = &LineItem.BKTitle
&BkAuthor = &LineItem.BKAuthor
&BkClsAbr = &LineItem.BkClsAbr
&division = &LineItem.Division
//&CPriceNew = &LineItem.PriceNew
//&CPriceUse = &LineItem.PriceUsed
&LQQty = &LineItem.TnfQty
&priceStr = &LineItem.TnfPrice
&lineTotalStr = &LineItem.LineTotal
&BkClsName = &LineItem.BkClsName
print line
endfor
EndSub