-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInvoice.wfm
518 lines (470 loc) · 15.9 KB
/
Invoice.wfm
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
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
** END HEADER -- do not remove this line
//
// Generated on 22/11/2024
//
parameter bModal
local f
f = new InvoiceForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class InvoiceForm of BASECFORM from :DT_Custom2:Base.cfm
set procedure to :DT_Custom2:mycontrols2.cc additive
set procedure to :FormControls:seeker.cc additive
set procedure to Invoice.dmd additive
with (this)
onOpen = class::FORM_ONOPEN
left = 545.0
top = -19.0
text = "Invoices"
endwith
this.INVOICEDATAMODULE1 = new INVOICEDATAMODULE()
this.INVOICEDATAMODULE1.parent = this
with (this.INVOICEDATAMODULE1)
left = 50.0
top = 33.0
width = 100.0
height = 37.0
endwith
with (this.MYTITLETEXT1)
height = 32.0
left = 0.0
top = 0.0
width = 802.0
text = "INVOICES FORM"
endwith
this.CUSTOMERSTEXTLABEL = new MYTEXTLABEL(this)
with (this.CUSTOMERSTEXTLABEL)
height = 22.0
left = 228.0
top = 36.0
width = 84.0
text = "Customers:"
endwith
this.SEEKER1 = new SEEKER(this)
with (this.SEEKER1)
height = 22.0
left = 328.0
top = 35.0
width = 267.0
endwith
this.CUSTOMERSGRID = new MYGRID(this)
with (this.CUSTOMERSGRID)
dataLink = form.invoicedatamodule1.customer1.rowset
columns["COLUMN1"] = new GRIDCOLUMN(form.CUSTOMERSGRID)
with (columns["COLUMN1"])
dataLink = form.invoicedatamodule1.customer1.rowset.fields["last name"]
editorType = 1 // EntryField
width = 166.0
endwith
columns["COLUMN2"] = new GRIDCOLUMN(form.CUSTOMERSGRID)
with (columns["COLUMN2"])
dataLink = form.invoicedatamodule1.customer1.rowset.fields["first name"]
editorType = 1 // EntryField
width = 200.0
endwith
columns["COLUMN3"] = new GRIDCOLUMN(form.CUSTOMERSGRID)
with (columns["COLUMN3"])
dataLink = form.invoicedatamodule1.customer1.rowset.fields["phone"]
editorType = 1 // EntryField
width = 179.0
endwith
columns["COLUMN4"] = new GRIDCOLUMN(form.CUSTOMERSGRID)
with (columns["COLUMN4"])
dataLink = form.invoicedatamodule1.customer1.rowset.fields["city"]
editorType = 1 // EntryField
width = 300.0
endwith
with (columns["COLUMN1"].headingControl)
value = "Last Name"
endwith
with (columns["COLUMN2"].headingControl)
value = "First Name"
endwith
with (columns["COLUMN3"].headingControl)
value = "Phone"
endwith
with (columns["COLUMN4"].headingControl)
value = "City"
endwith
hScrollBar = 2 // Auto
height = 205.0
left = 31.0
top = 76.0
width = 733.0
endwith
this.INVOICECONTAINER = new MYCONTAINER(this)
with (this.INVOICECONTAINER)
left = 211.0
top = 302.0
width = 406.0
height = 202.0
endwith
this.INVOICECONTAINER.INVOICESCONTAINERTEXTLABEL = new MYTEXTLABEL(this.INVOICECONTAINER)
with (this.INVOICECONTAINER.INVOICESCONTAINERTEXTLABEL)
height = 22.0
left = 24.0
top = 9.0
width = 84.0
text = "Invoices:"
pageno = 0
endwith
this.INVOICECONTAINER.INVOICEBTNCONTAINER = new MYCONTAINER(this.INVOICECONTAINER)
with (this.INVOICECONTAINER.INVOICEBTNCONTAINER)
left = 131.0
top = 5.0
width = 170.0
height = 36.0
borderStyle = 3 // None
pageno = 0
endwith
this.INVOICECONTAINER.INVOICEBTNCONTAINER.ADDINVOICE = new MYPUSHBUTTON(this.INVOICECONTAINER.INVOICEBTNCONTAINER)
with (this.INVOICECONTAINER.INVOICEBTNCONTAINER.ADDINVOICE)
onClick = class::ADDINVOICE_ONCLICK
height = 32.0
left = 8.0
top = 1.0
width = 32.0
text = ""
upBitmap = "filename :Glyfx:\Aero\CE\Dbase Aero\PNG\24x24\favourites_24.png"
speedTip = "Add an invoice"
pageno = 0
endwith
this.INVOICECONTAINER.INVOICEBTNCONTAINER.EDITINVOICE = new MYPUSHBUTTON(this.INVOICECONTAINER.INVOICEBTNCONTAINER)
with (this.INVOICECONTAINER.INVOICEBTNCONTAINER.EDITINVOICE)
onClick = class::EDITINVOICE_ONCLICK
height = 32.0
left = 48.0
top = 1.0
width = 32.0
text = ""
upBitmap = "filename :Glyfx:\Aero\CE\Dbase Aero\PNG\24x24\document_open_24.png"
speedTip = "Edit this invoice"
pageno = 0
endwith
this.INVOICECONTAINER.INVOICEBTNCONTAINER.DELETEINVOICE = new MYPUSHBUTTON(this.INVOICECONTAINER.INVOICEBTNCONTAINER)
with (this.INVOICECONTAINER.INVOICEBTNCONTAINER.DELETEINVOICE)
onClick = class::DELETEINVOICE_ONCLICK
height = 32.0
left = 89.0
top = 1.0
width = 32.0
text = ""
upBitmap = "filename :Glyfx:\Aero\CE\Dbase Aero\PNG\24x24\delete_24.png"
speedTip = "Delete this invoice"
pageno = 0
endwith
this.INVOICECONTAINER.INVOICEBTNCONTAINER.PRINTINVOICE = new MYPUSHBUTTON(this.INVOICECONTAINER.INVOICEBTNCONTAINER)
with (this.INVOICECONTAINER.INVOICEBTNCONTAINER.PRINTINVOICE)
onClick = class::PRINTINVOICE_ONCLICK
height = 32.0
left = 126.0
top = 1.0
width = 32.0
text = ""
upBitmap = "filename :Glyfx:\Aero\CE\Dbase Aero\PNG\24x24\print_24.png"
speedTip = "Print this invoice"
pageno = 0
endwith
this.INVOICECONTAINER.MYGRID1 = new MYGRID(this.INVOICECONTAINER)
with (this.INVOICECONTAINER.MYGRID1)
dataLink = form.invoicedatamodule1.invoice1.rowset
columns["COLUMN1"] = new GRIDCOLUMN(form.INVOICECONTAINER.MYGRID1)
with (columns["COLUMN1"])
dataLink = form.invoicedatamodule1.invoice1.rowset.fields["invoice id"]
editorType = 1 // EntryField
width = 110.0
endwith
columns["COLUMN2"] = new GRIDCOLUMN(form.INVOICECONTAINER.MYGRID1)
with (columns["COLUMN2"])
dataLink = form.invoicedatamodule1.invoice1.rowset.fields["order date"]
editorType = 3 // SpinBox
width = 120.0
endwith
columns["COLUMN3"] = new GRIDCOLUMN(form.INVOICECONTAINER.MYGRID1)
with (columns["COLUMN3"])
dataLink = form.invoicedatamodule1.invoice1.rowset.fields["pay type"]
editorType = 1 // EntryField
width = 80.0
endwith
with (columns["COLUMN1"].headingControl)
value = "Invoice ID"
endwith
with (columns["COLUMN2"].editorControl)
rangeMax = {20/03/2017}
rangeMin = {10/12/2016}
endwith
with (columns["COLUMN2"].headingControl)
value = "Order Date"
endwith
with (columns["COLUMN3"].headingControl)
value = "Pay Type"
endwith
vScrollBar = 1 // On
pageno = 0
height = 128.0
left = 41.0
top = 51.0
width = 347.0
endwith
this.LINEITEMCONTAINER = new MYCONTAINER(this)
with (this.LINEITEMCONTAINER)
left = 65.0
top = 554.0
width = 683.0
height = 200.0
endwith
this.LINEITEMCONTAINER.LINEITEMSTEXTLABEL = new MYTEXTLABEL(this.LINEITEMCONTAINER)
with (this.LINEITEMCONTAINER.LINEITEMSTEXTLABEL)
height = 22.0
left = 174.0
top = 12.0
width = 84.0
text = "Line Items:"
pageno = 0
endwith
this.LINEITEMCONTAINER.LINEITEMBTNCONTAINER = new MYCONTAINER(this.LINEITEMCONTAINER)
with (this.LINEITEMCONTAINER.LINEITEMBTNCONTAINER)
left = 263.0
top = 4.0
width = 132.0
height = 45.0
borderStyle = 3 // None
pageno = 0
endwith
this.LINEITEMCONTAINER.LINEITEMBTNCONTAINER.ADDLINEITEM = new MYPUSHBUTTON(this.LINEITEMCONTAINER.LINEITEMBTNCONTAINER)
with (this.LINEITEMCONTAINER.LINEITEMBTNCONTAINER.ADDLINEITEM)
onClick = class::ADDLINEITEM_ONCLICK
height = 32.0
left = 6.0
top = 4.0
width = 32.0
text = ""
upBitmap = "filename :Glyfx:\Aero\CE\Dbase Aero\PNG\24x24\favourites_24.png"
speedTip = "Add new line item"
pageno = 0
endwith
this.LINEITEMCONTAINER.LINEITEMBTNCONTAINER.EDITLINEITEM = new MYPUSHBUTTON(this.LINEITEMCONTAINER.LINEITEMBTNCONTAINER)
with (this.LINEITEMCONTAINER.LINEITEMBTNCONTAINER.EDITLINEITEM)
onClick = class::EDITLINEITEM_ONCLICK
height = 32.0
left = 43.0
top = 4.0
width = 32.0
text = ""
upBitmap = "filename :Glyfx:\Aero\CE\Dbase Aero\PNG\24x24\document_open_24.png"
speedTip = "Edit this line item"
pageno = 0
endwith
this.LINEITEMCONTAINER.LINEITEMBTNCONTAINER.DELETELINEITEM = new MYPUSHBUTTON(this.LINEITEMCONTAINER.LINEITEMBTNCONTAINER)
with (this.LINEITEMCONTAINER.LINEITEMBTNCONTAINER.DELETELINEITEM)
onClick = class::DELETELINEITEM_ONCLICK
height = 32.0
left = 80.0
top = 5.0
width = 32.0
text = ""
upBitmap = "filename :Glyfx:\Aero\CE\Dbase Aero\PNG\24x24\delete_24.png"
speedTip = "Delete this line item"
pageno = 0
endwith
this.LINEITEMCONTAINER.MYGRID1 = new MYGRID(this.LINEITEMCONTAINER)
with (this.LINEITEMCONTAINER.MYGRID1)
dataLink = form.invoicedatamodule1.lineitem1.rowset
columns["COLUMN1"] = new GRIDCOLUMN(form.LINEITEMCONTAINER.MYGRID1)
with (columns["COLUMN1"])
dataLink = form.invoicedatamodule1.lineitem1.rowset.fields["item id"]
editorType = 4 // ComboBox
width = 265.0
endwith
columns["COLUMN2"] = new GRIDCOLUMN(form.LINEITEMCONTAINER.MYGRID1)
with (columns["COLUMN2"])
dataLink = form.invoicedatamodule1.lineitem1.rowset.fields["qty"]
editorType = 3 // SpinBox
width = 212.0
endwith
with (columns["COLUMN1"].editorControl)
style = 1 // DropDownList
dropDownHeight = 132.0
endwith
with (columns["COLUMN1"].headingControl)
value = "Description"
endwith
with (columns["COLUMN2"].editorControl)
rangeMax = 100
rangeMin = 1
endwith
with (columns["COLUMN2"].headingControl)
value = "Qty"
endwith
vScrollBar = 1 // On
pageno = 0
height = 117.0
left = 58.0
top = 51.0
width = 561.0
endwith
this.rowset = this.invoicedatamodule1.customer1.rowset
function ADDINVOICE_onClick()
local fInvoice
set procedure to invoiceEdit.wfm
fInvoice = new InvoiceEditForm()
// add a custom property (note that the
// form.rowset is pointing to the customer rowset)
fInvoice.CustomerID = form.rowset.fields["customer id"].value
// let the invoice form know we're in "Append" mode
fInvoice.Mode = "Append"
// open the form:
fInvoice.readModal()
// close the procedure file:
close procedure invoiceEdit.wfm
if form.invoicedatamodule1.lineitem1.rowset.endOfSet
// go to last row, which is the one we just added
form.invoicedatamodule1.invoice1.rowset.last()
// because an invoice is useless without a line item
class::AddLineItem_onClick()
endif
// refresh the controls on screen ...
form.invoicedatamodule1.invoice1.rowset.refreshControls()
return
function ADDLINEITEM_onClick()
local fLineItem
// don't allow it if there's no invoice:
if not form.INVOICEDATAMODULE1.invoice1.rowset.endOfSet
set procedure to LineItemEdit.wfm
fLineItem = new LineItemEditForm()
// add some custom properties:
fLineItem.Mode = "Append"
fLineItem.InvoiceID = ;
form.INVOICEDATAMODULE1.invoice1.rowset.fields["Invoice ID"].value
// open the form:
fLineItem.readModal()
close procedure LineItemEdit.wfm
form.INVOICEDATAMODULE1.lineitem1.rowset.last()
form.INVOICEDATAMODULE1.lineitem1.rowset.refreshControls()
else
msgbox( "There is no invoice to assign line items to!", ;
"Can't do that!", 16 )
endif
return
function DELETEINVOICE_onClick()
// shorten the rowset reference:
r = form.invoicedatamodule1.Invoice1.rowset
// check for endOfSet
if r.endOfSet
msgbox( "Cannot delete -- there are no rows to delete!",;
"Can't do it!", 16 )
else
// otherwise check to see if they really want to
// delete this row!
if ( msgbox("You are about to delete the current row." ;
+ chr(13) ;
+ "Click Yes to delete the current row.", ;
"Alert", 4) == 6 )
// delete it:
r.delete()
// move to previous row, unless we're at
// the first one, and then step off
// the endOfSet marker ...
if ( r.next( -1 ) )
r.next()
endif
endif
endif
return
function DELETELINEITEM_onClick()
// shorten the rowset reference:
r = form.invoicedatamodule1.LineItem1.rowset
// check for endOfSet
if r.endOfSet
msgbox( "Cannot delete -- there are no rows to delete!",;
"Can't do it!", 16 )
else
// otherwise check to see if they really want to
// delete this row!
if ( MSGBOX("You are about to delete the current row." ;
+ CHR(13) ;
+ "Click Yes to delete the current row.", ;
"Alert", 4) == 6 )
// delete it:
r.delete()
// move to previous row, unless we're at
// the first one, and then step off
// the endOfSet marker ...
if ( r.next( -1 ) )
r.next()
endif
endif
endif
return
function EDITINVOICE_onClick()
// Check to make sure we have a row to edit:
if not form.invoicedatamodule1.invoice1.rowset.endOfSet
local fInvoice
set procedure to invoiceEdit.wfm additive
fInvoice = new InvoiceEditForm()
// add some custom properties:
fInvoice.CustomerID = form.rowset.fields["customer id"].value
fInvoice.InvoiceID = ;
form.invoicedatamodule1.invoice1.rowset.fields["Invoice ID"].value
fInvoice.Mode = "Edit"
// open the form ...
fInvoice.readModal()
close procedure invoiceEdit.wfm
form.invoicedatamodule1.invoice1.rowset.refreshControls()
else
msgbox( "There is nothing to edit!", "Can't do that!", 16 )
endif
return
function EDITLINEITEM_onClick()
local rLineItem
// Check to make sure we have a row to edit:
rLineItem = form.invoicedatamodule1.lineItem1.rowset
if not rLineItem.endOfSet
local fLineItem
set procedure to LineItemEdit.wfm additive
fLineItem = new LineItemEditForm()
// add some custom properties
fLineItem.Mode = "Edit"
fLineItem.InvoiceID = ;
form.invoicedatamodule1.invoice1.rowset.fields["Invoice ID"].value
// In the next statement, we're getting the actual
// item ID as opposed to the description, which we'd
// normally get if we just used the field's value
// property ...
fLineItem.ItemID =;
rLineItem.fields["Item ID"].lookupRowset.fields[ 1 ].value
// open the form ...
fLineItem.readModal()
close procedure LineItemEdit.wfm
form.invoicedatamodule1.lineitem1.rowset.refreshControls()
else
msgbox( "There is nothing to edit!", "Can't do that!", 16 )
endif
return
function PRINTINVOICE_onClick()
// check to see if we're at the endOfSet (i.e.,
// no invoices), otherwise we'll do the print
// routine:
r = form.INVOICEDATAMODULE1.invoice1.rowset
if not r.endOfSet
// store the primary key field needed
// in the _app object as custom property
_app.InvoiceID = r.fields["Invoice ID"].value
// Call the report with the preview form ...
do preview.wfm with "Invoice.rep", true // modal!!
_app.InvoiceID = NULL // cleanup
else
msgbox( "There is nothing to Print!", "Can't do that!", 16 )
endif
return
function form_onOpen()
// Call the onOpen method of the dataform custom
// form. Note we must use the Source Alias:
set procedure to :DT_Custom2:dataform.cfm additive
dataformCForm::form_onOpen()
return
endclass