/
Conprt.prg
608 lines (474 loc) · 14.8 KB
/
Conprt.prg
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
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
/*
Rental system - Bluegum Software
Module Conprt - Contracts Print Menu
17/12/86 T. Glynn
Last change: TG 14 Mar 2011 2:16 pm
*/
#include "winrent.ch"
static page_no
static mrow
Procedure ConPrt
local choice, mdet, oldscr := Box_Save()
local getlist := {}
local mhead1
local mrent
local m_conno
local mans
local aArray
local msite
local aflds
local cForExpr
local oPrinter
memvar mend, mstart, menq
while TRUE
Box_Restore( oldscr )
Heading('Contract Print Menu')
aArray := {}
aadd( aArray, { 'Exit', 'Return to Reports menu' } )
aadd( aArray, { 'Numerical', 'List of all contracts by numeric order' } )
aadd( aArray, { 'Alphabetic', 'List of all contracts by hirer surname' } )
aadd( aArray, { 'Bond List', 'Listing of all Bonds' } )
aadd( aArray, { 'Insurance', 'Insurance Listing' } )
aadd( aArray, { 'Location', 'Contracts Printed by Location' } )
choice := MenuGen( aArray, 03, 36, 'Contract' )
if choice < 2
dbcloseall()
return
endif
*
do case
case choice = 2
if NetUse( 'items' )
items->( ordsetfocus( 'contract' ) )
if NetUse( 'hirer' )
if NetUse( 'master' )
set relation to master->con_no into hirer,;
to master->con_no into items
Box_Save( 3, 06, 9, 74 )
Heading( 'Select contracts for Print' )
mstart := 0
@ 5,08 say 'Enter start Contract, <Return> for all or <Esc> to exit ' get mstart pict '######'
read
if lastkey() = K_ESC
loop
else
if mstart != 0
mend := 0
@ 6, 08 say 'Enter ending Contract no' get mend pict '999999' valid( mend >= mstart )
read
if !updated()
loop
endif
else
master->( dbgobottom() )
mend := master->con_no
master->( dbgotop() )
mstart := master->con_no
endif
mdet := NO
menq := NO
@ 7,08 say 'Details list ?' get mdet pict 'Y'
@ 7,40 say 'Enquiry Contracts Only' get menq pict 'Y'
read
select master
if !mdet
aFlds := {}
aadd( aflds, { 'master->con_no', 'Contract;Number', 9, 0, FALSE } )
aadd( aflds, RPT_SPACE )
aadd( aflds, { 'hirer->surname', 'Surname', 20, 0, FALSE } )
aadd( aflds, { 'hirer->first', 'First Name', 20, 0, FALSE } )
aadd( aflds, { 'trim(hirer->add1)+" "+trim(hirer->add2)+" "+trim(hirer->suburb)', 'Address', 30, 0, FALSE } )
aadd( aflds, { 'master->paid_to', 'Paid To', 8, 0, FALSE } )
aadd( aflds, { 'master->bal_bf', 'Balance;B/F', 10, 2, FALSE } )
#ifdef BYRNES
aadd( aflds, { 'master->install', 'Install', 10, 2, FALSE } )
aadd( aflds, RPT_SPACE )
aadd( aflds, { 'master->EndDate', 'End Date', 8, 0, FALSE } )
#endif
Reporter( aFlds, ; // Array
'Contract Listing - Numeric',; // Report Name
'',; // Group By
'' ,; // Group Heading
'',; // Sub Group By
'',; // Sub Group head
FALSE,; // Summary
"if( menq, master->inquiry, !master->inquiry )",; // For Condition
'( hirer->con_no >= ' + ns(mstart) + ' .and. hirer->con_no <= ' + ns(mend) + ' )' ,;
132 ;
)
else
mhead1 := " Contract Hirer's Name & Addr. Telephone Due Date"
mhead1 += ' Balance Items Desc'
oPrinter := PrintCheck( "Contract Listing" )
page_no := 1
mrow := 1
while !master->( eof() ) .and. inkey() != K_ESC .and. PinWheel()
if ( master->con_no >= mstart .and. master->con_no <= mend ) .and. ;
if( menq, master->inquiry, !master->inquiry )
if empty( master->term_rent )
mrent := 'm_rent'
else
mrent := master->term_rent + '_rent'
endif
Conout( mhead1, ,oPrinter )
endif
if inkey() = K_ESC
exit
endif
master->( dbskip() )
enddo
oPrinter:EndDoc()
oPrinter:Destroy()
endif
endif
endif
endif
endif
dbcloseall()
case choice = 3
if NetUse( "items" )
items->( ordsetfocus( 'contract' ) )
if NetUse( "master" )
if NetUse( "hirer" )
hirer->( ordsetfocus( 'surname' ) )
set relation to hirer->con_no into master,;
to hirer->con_no into items
Box_Save( 3, 06, 9, 74 )
Heading('Select contracts for print')
mans := 'A'
@ 5, 08 say 'Select a <R>ange or <A>ll contracts' get mans pict '!' valid( mans $ 'AR' )
read
mstart := 'AAA'
mend := 'ZZZ'
if mans = 'R'
mstart := space(3)
@ 6, 08 say 'First three letters of start surname' get mstart pict '!!!'
read
@ 7, 08 say ' First three letters of end surname' get mend pict '!!!'
read
endif
mdet := FALSE
menq := FALSE
@ 8, 08 say 'Details list ?' get mdet pict 'Y'
@ 8, 40 say 'Enquiry Contracts Only' get menq pict 'Y'
read
if mstart != 'AAA'
hirer->( dbseek( trim( mstart ) ) )
else
hirer->( dbgotop() )
endif
if !mdet
aflds := {}
aadd( aflds, { 'hirer->surname', 'Surname', 20, 0, FALSE } )
aadd( aflds, { 'hirer->first', 'First Name', 20, 0, FALSE } )
aadd( aflds, { "trim(hirer->add1)+' '+trim(hirer->add2)+' '+trim(hirer->suburb)", 'Address', 30, 0, FALSE } )
aadd( aflds, { 'hirer->con_no', 'Contract;Number', 8, 0, FALSE } )
aadd( aflds, { 'master->paid_to', 'Paid To', 8, 0, FALSE } )
aadd( aflds, { 'balanceTot()', 'Balance', 10, 0, FALSE } )
if menq
cForExpr := 'upper( hirer->surname ) >= "' + mstart + '" .and. upper( hirer->surname ) <= "' + mend + '"' +;
'.and. master->inquiry'
else
cForExpr := 'upper( hirer->surname ) >= "' + mstart + '" .and. upper( hirer->surname ) <= "' + mend + '"' +;
'.and. !master->inquiry'
endif
Reporter( aflds,;
'Contract Listing by Alpha', ;
'' ,;
'' ,;
'' ,;
'' ,;
FALSE,;
cForExpr,;
'' ,;
80 ;
)
else
mhead1 := " Contract Hirer's Name & Addr. Telephone Due Date"
mhead1 += ' Balance Items Desc'
oPrinter := PrintCheck( "Contract Listing" )
page_no := 1
mrow := 1
while !hirer->( eof() ) .and. inkey() != K_ESC .and. Pinwheel()
if ( mans = 'A' .or. ( mans = 'R' .and. upper( hirer->surname ) >= mstart .and. ;
upper( hirer->surname) <= mend ) ) .and. ;
if( menq, master->inquiry, !master->inquiry )
if empty( master->term_rent )
mrent := 'm_rent'
else
mrent := master->term_rent + '_rent'
endif
m_conno := hirer->con_no
Conout( mhead1, , oPrinter )
endif
if inkey() = K_ESC
exit
endif
hirer->( dbskip() )
enddo
oPrinter:EndDoc()
oPrinter:Destroy()
endif
endif
endif
endif
dbcloseall()
case choice = 4
if NetUse( "hirer" )
if NetUse( "master" )
set relation to master->con_no into hirer
Heading('Bond Listing')
if Isready()
master->( dbgotop() )
aFlds := {}
aadd( aflds, { 'transform( master->con_no, "9999999" )', 'Contract;Number', 11, 0, FALSE } )
aadd( aflds, RPT_SPACE )
aadd( aflds, { 'left( trim(hirer->first)+" "+trim(hirer->surname), 50 )', 'Hirer Name', 50, 0, FALSE } )
aadd( aflds, { 'master->bond_paid', 'Bond;Paid', 8, 0, TRUE } )
aadd( aflds, RPT_SPACE )
aadd( aflds, { 'master->bond_date', 'Bond Paid;Date', 9, 0, FALSE } )
aadd( aflds, { 'master->bond_ret', 'Bond;Returned', 8, 0, TRUE } )
aadd( aflds, RPT_SPACE )
aadd( aflds, { 'master->bond_ret_d', 'Date Bond;Returned', 9, 0, FALSE } )
Reporter( aFlds, ;
'Bond Listing',;
'',;
'' ,;
'',;
'',;
FALSE,;
'master->bond_paid > 0',;
'',;
132 ;
)
endif
endif
endif
dbcloseall()
case choice = 5
if NetUse("items" )
items->( ordsetfocus( 'contract' ) )
if NetUse("hirer" )
if NetUse( "master" )
set relation to master->con_no into hirer,;
to master->con_no into items
Heading('Insurance Listing')
if Isready()
aFlds := {}
aadd( aflds, { 'master->con_no', 'Contract;Number', 9, 0, FALSE } )
aadd( aflds, { 'trim(hirer->first)+" "+trim(hirer->surname)', 'Hirer Name', 30, 0, FALSE } )
aadd( aflds, { 'ins_amt( master->con_no )', 'Insurance;Amt', 10, 2, TRUE } )
Reporter( aFlds, ;
'Insurance Listing',;
'',;
'' ,;
'',;
'',;
FALSE,;
'',;
'master->insurance',;
80 ;
)
endif
endif
endif
endif
dbcloseall()
case choice = 6
if NetUse( 'sites' )
if NetUse( 'items' )
items->( ordsetfocus( 'contract' ) )
if NetUse( 'hirer' )
if NetUse( 'master' )
master->( ordsetfocus( 'site' ) )
set relation to master->con_no into hirer,;
to master->con_no into items
Box_Save( 3, 06, 9, 74 )
Heading( 'Select contracts for Print' )
msite := space( SITELEN )
@ 5,08 say 'Enter site, <Return> for all or <Esc> to exit ' get msite pict '@!'
read
if lastkey() = K_ESC
loop
else
if empty( msite )
master->( dbgotop() )
else
master->( dbseek( msite ) )
endif
mhead1 := " Contract Hirer's Name & Addr. Telephone Due Date"
mhead1 += ' Balance Items Desc'
oPrinter := PrintCheck( "Contracts Print by Location" )
page_no := 1
mrow := 1
while !master->( eof() ) .and. inkey() != K_ESC .and. PinWheel()
if ( master->site = msite .or. empty( msite ) ) .and. !master->inquiry
if empty( master->term_rent )
mrent := 'm_rent'
else
mrent := master->term_rent + '_rent'
endif
Conout( mhead1, master->site, oPrinter )
endif
if inkey() = K_ESC
exit
endif
master->( dbskip() )
enddo
oPrinter:EndDoc()
oPrinter:Destroy()
endif
endif
endif
endif
endif
dbcloseall()
endcase
enddo
return
*
function ins_amt ( mcon )
local mamt := 0
select items
sum items->insurance to mamt while items->con_no = mcon .and. !items->( eof() )
select master
return mamt
*
procedure conout ( mhead1, msite, oPrinter )
local int_row := 1
local msur
local mfirst
local madd1
local madd2
local msub
local mpc
local mtele
local mempl
local mrecno
local mcontract := hirer->con_no
default msite to space( SITELEN )
while int_row < 5
if mrow <= 5
oPrinter:Newline()
oPrinter:textout( replicate('-',130) )
oPrinter:Newline()
oPrinter:setpos( 10 * oPrinter:charWidth )
oPrinter:textout( trim( BVars( B_COMPANY ) ) )
oPrinter:setpos( 50 * oPrinter:charWidth )
oPrinter:textout( 'Contract Details' )
oPrinter:setpos( 118 * oPrinter:CharWidth )
oPrinter:textout( 'Page No ' + Ns( page_no ) )
oPrinter:Newline()
oPrinter:textout( replicate( '-', 130 ) )
oPrinter:Newline()
oPrinter:Newline()
oPrinter:textout( mhead1 )
page_no++
mrow := 7
endif
do case
case int_row = 1
msur := ''
mfirst := ''
madd1 := hirer->add1
madd2 := hirer->add2
msub := hirer->suburb
mpc := hirer->pcode
mtele := hirer->tele_priv
mempl := hirer->tele_empl
mrecno := hirer->( recno() )
while hirer->con_no = mcontract .and. !hirer->( eof() )
msur += trim( hirer->surname ) + '/'
mfirst += trim( hirer->first ) + '/'
hirer->( dbskip() )
enddo
hirer->( dbgoto( mrecno ) )
msur := left( msur, len( trim( msur ) ) -1 )
mfirst := left( mfirst, len( trim( mfirst ) ) -1 )
oPrinter:NewLine()
#ifdef MULTI_SITE
oPrinter:textout( trim( msite ) + transform( mContract, CON_NO_PICT ) )
#else
oPrinter:textout( transform( master->con_no, CON_NO_PICT ) )
#endif
oPrinter:setpos( 12 * oPrinter:CharWidth )
oPrinter:textout( left( msur, 26 ) )
#ifdef BYRNES
oPrinter:setpos( 38 * oPrinter:CharWidth )
oPrinter:textout( dtoc( master->commenced ) )
#else
oPrinter:setpos( 38 * oPrinter:CharWidth )
oPrinter:textout( mtele )
#endif
oPrinter:setpos( 50 * oPrinter:CharWidth )
oPrinter:textout( dtoc( master->paid_to ) )
oPrinter:setpos( 60 * oPrinter:CharWidth )
oPrinter:textout( transform( master->bal_bf, TOTAL_PICT ) )
#ifdef BYRNES
oPrinter:setpos( 70 * oPrinter:CharWidth )
oPrinter:textout( transform( master->install, TOTAL_PICT ) )
oPrinter:setpos( 82 * oPrinter:CharWidth )
oPrinter:textout( dtoc( master->EndDate ) )
#endif
case int_row = 2
oPrinter:NewLine()
if master->inquiry
oPrinter:textout( 'Enquiry' )
endif
oPrinter:setpos( 12 * oPrinter:CharWidth )
oPrinter:textout( left( mfirst, 26 ) )
#ifdef BYRNES
oPrinter:setpos( 38 * oPrinter:CharWidth )
oPrinter:textout( transform( master->install, TOTAL_PICT ) )
#else
oPrinter:setpos( 38 * oPrinter:CharWidth )
oPrinter:textout( mempl )
#endif
case int_row = 3
oPrinter:NewLine()
if master->inquiry
oPrinter:textout( replicate( '*', 7 ) )
endif
oPrinter:setpos( 12 * oPrinter:CharWidth )
oPrinter:textout( trim( madd1 ) + ' ' + madd2 )
oPrinter:setpos( 38 * oPrinter:CharWidth )
oPrinter:textout( master->comments1 )
case int_row = 4
oPrinter:NewLine()
oPrinter:setpos( 12 * oPrinter:CharWidth )
oPrinter:textout( trim( msub ) + ' ' + mpc )
oPrinter:setpos( 38 * oPrinter:CharWidth )
oPrinter:textout( master->comments2 )
endcase
items->( dbseek( mcontract ) )
items->( dbskip( int_row -1 ) )
if items->con_no = mcontract
oPrinter:setpos( 72 * oPrinter:CharWidth )
oPrinter:textout( items->item_code )
oPrinter:setpos( 90 * oPrinter:CharWidth )
oPrinter:textout( items->desc )
oPrinter:setpos( 120 * oPrinter:CharWidth )
oPrinter:textout( transform( items->( fieldget( items->( fieldpos( master->term_rent + '_rent' ) ) ) ), CURRENCY_PICT ) )
endif
int_row++
mrow++
if mrow > 60
oPrinter:NewPage()
mrow := 1
endif
enddo
oPrinter:NewLine()
mrow++
return
*
Function BalanceTot // Fixes installment total on ConAlpha.frm
local mamt := master->bal_bf, mrec := hirer->( recno() )
// Determine if selected hirer is first in line.
local oldord := hirer->( ordsetfocus( 'contract' ) )
hirer->( dbseek( hirer->con_no ) )
if hirer->( recno() ) != mrec // Must have been second ( or greater ) hirer
mamt := 0
endif
hirer->( ordsetfocus( oldord ) )
hirer->( dbgoto( mrec ) )
return mamt