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
|
/* * MARINAS-GUI - Harbour Multiplatform GUI library
* Libro de Guardia - Radiolibre -
* CopyRight 2012 Bruno Luciani <
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
>
* Programa de libre distribucion para radioaficionados
* Revised by IW1CUY Pierpaolo Martinello at 01/02/2015 12:05:44
* This demo is tested With Marinas-Ide 05.01.0003 and Marinas-Gui 03.01.0038 */
memvar nuevo, frec, mod, band, horadisp memvar fecha, licencia, reng, pagina, variable
#include "marinas-gui.ch" /* */ *------------------------------------------------------------------------------* Function Main () *------------------------------------------------------------------------------* nuevo := .F. ; frec := "" ; mod := "" ; band := "" ; horadisp := ""
REQUEST HB_LANG_ESWIN REQUEST HB_CODEPAGE_ES850 HB_CDPSELECT('ES850') HB_LANGSELECT('ESWIN')
REQUEST DBFCDX , DBFFPT RDDSETDEFAULT( "DBFCDX" )
SET DATE BRITISH SET DATE FORMAT "dd-mm-yyyy" set deleted on
SET ENTERTAB .T.
OpenTables()
CREATE WINDOW Form_1 ROW 0 COL 0 WIDTH 1024 HEIGHT 580 ICON "libro.png" CAPTION "RADIOLIBRE - Libro de Guardia" MAIN .T. ONRELEASE CloseTables() CREATE KEY ALT+V OF form_1 ACTION ver() END KEY CREATE KEY ALT+N OF form_1 ACTION nuevo() END KEY CREATE KEY ALT+B OF form_1 ACTION search() END KEY CREATE KEY ALT+C OF form_1 ACTION clip() END KEY
CREATE MAIN MENU CREATE POPUP "Menu" CREATE ITEM "Agregar Contacto" ONCLICK nuevo() END ITEM CREATE ITEM "Editar Contacto" ONCLICK search() END ITEM CREATE ITEM "Exportar Adif" ONCLICK export() END ITEM CREATE ITEM "Importar Archivo Adif" ONCLICK importar() END ITEM CREATE ITEM "Reconstruir Indice" ONCLICK index() END ITEM CREATE ITEM "Respaldar Informacion" ONCLICK respaldo() END ITEM CREATE ITEM "Imprimir Libro de Guardia" ONCLICK listado() END ITEM SEPARATOR CREATE ITEM "Salir" ONCLICK Form_1.Release() END ITEM END POPUP CREATE POPUP "Configurar" CREATE ITEM "Configuracion" ONCLICK configura() END ITEM END POPUP CREATE POPUP "Informacion" CREATE ITEM "Licencia" ONCLICK mg_MsgInfo( "Ud es libre de utilizar y distribuir este programa"+HB_OsNewLine()+"Uso exclusivo de Radioaficionados" , "Licencia" ) END ITEM CREATE ITEM "Version" ONCLICK mg_MsgInfo( "Version 0.4.0 - Marzo 2012"+HB_OsNewLine()+"Bruno Luciani -
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
" , "Version" ) END ITEM CREATE ITEM "Informacion" ONCLICK mg_MsgInfo( "Libro de guardia - Realizado por Bruno Luciani -
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
"+HB_OsNewLine()+"Si ud desea informar algun problema o sugerencia"+HB_OsNewLine()+" por favor contactese al email:
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
" ) END ITEM END POPUP CREATE POPUP "A&yuda" CREATE ITEM "Ayuda" // ONCLICK help() END ITEM END POPUP END MENU
CREATE TOOLBAR ToolBar_1
CREATE TOOLBUTTON Button_1 CAPTION "Agregar" PICTURE "ok2.png" ONCLICK nuevo() END TOOLBUTTON
CREATE TOOLBUTTON Button_5 CAPTION "Copiar" PICTURE "play.png" ONCLICK clip() END TOOLBUTTON
CREATE TOOLBUTTON Button_2 CAPTION "Buscar" PICTURE "lista.png" ONCLICK search() END TOOLBUTTON
CREATE TOOLBUTTON Button_3 CAPTION "Imprimir" PICTURE "imprimir.png" ONCLICK Listado() END TOOLBUTTON
CREATE TOOLBUTTON Butayuda CAPTION "Help" PICTURE "ayuda.png" // ONCLICK help() END TOOLBUTTON
END TOOLBAR
CREATE STATUSBAR CREATE LABEL StatusBar_Label1 VALUE " Marinas-GUI Power Ready !!! " FONTCOLOR {0,0,255} FONTITALIC .T. PERMANENT .F. END LABEL END STATUSBAR
CREATE BROWSE Browse_1 ROW 50 COL 10 WIDTH 880 HEIGHT 390 FONTCOLOR {57,134,101} BACKCOLOR { 237,236,173 } BACKCOLORDYNAMIC {|nRow| if( mod( nRow , 2 ) == 0 , {204,171,241} , NIL ) } SELECTIONFONTCOLOR { 237,236,173 } SELECTIONBACKCOLOR {57,134,101} COLUMNHEADERALL { "Fecha" , "Licencia", "Frecuencia", "Modo" , "Banda" ,"Pais", "Hora inicio" , "Hora Final", "Mi RST","RST Corresp","Nombre" } COLUMNWIDTHALL { 80 ,80 ,80 ,60 ,60 ,100 ,80 ,80 ,80 ,80,150 } WORKAREA "QSL" COLUMNFIELDALL { "fecha","licencia","frecuencia","modo","banda","pais","horainicio","horafinal","mirst","surst","nombre"} VALUE 1 ONDBLCLICK editar() // onheadclick {{||orden1()},{||orden2()},{||nil},{||nil},{||nil},{||nil},{||nil},{||nil},{||nil},{||nil},{||nil}} END BROWSE CREATE BUTTON new ROW 130 COL 920 CAPTION "Agregar" ONCLICK nuevo() PICTURE "ok2.png" END BUTTON CREATE BUTTON edit ROW 200 COL 920 CAPTION "Editar" ONCLICK editar() PICTURE "play.png" END BUTTON CREATE BUTTON borra ROW 270 COL 920 CAPTION "Borrar" ONCLICK borrar() PICTURE "menos.png" END BUTTON CREATE BUTTON search ROW 340 COL 920 CAPTION "Buscar" ONCLICK search() PICTURE "lista.png" END BUTTON
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return Nil /* */ *------------------------------------------------------------------------------* Procedure OpenTables() *------------------------------------------------------------------------------* IF ! FILE("qsl.cdx") Use qsl Alias qsl new exclusive if !used() mg_MsgInfo( "Error opening QSL Database !" , "Error !" ) Endif Index on qsl->FECHA TAG FECHA to qsl.cdx Index on qsl->licencia Tag ORDEN2 to qsl.cdx qsl->( DBCLOSEAREA() ) ENDIF Use config alias config Use qsl alias qsl index qsl new shared horadisp := config->horadisp Return /* */ *------------------------------------------------------------------------------* Procedure CloseTables() *------------------------------------------------------------------------------* close qsl close config Return /* */ *------------------------------------------------------------------------------* Procedure search() *------------------------------------------------------------------------------* local orden variable := "" variable := mg_InputDialog( "Ingrese Licencia a buscar:" , "Busqueda " , "" ) if empty( alltrim( variable ) ) form_1.browse_1.value:=1 // form_1.browse_1.refresh Return endif orden := UPPER(variable) dbsetorder(2) form_1.browse_1.refresh
IF qsl->(dbSEEK(orden)) // form_1.browse_1.value:=recno() mg_MsgWarning( "Se encontro una coincidencia!" , "Busqueda de registro" ) ELSE mg_MsgWarning( "No existe esa licencia !" , "Busqueda de registro" ) ENDIF Return /* */ *------------------------------------------------------------------------------* Procedure editar() *------------------------------------------------------------------------------* load window qsl
CREATE KEY ALT+G OF qsl ACTION grabar() END KEY
qsl.borrar.visible := .F. nuevo := .F. qsl->(dbrlock()) qsl.registro.value := str(recno()) qsl.fecha.value := qsl->fecha qsl.licencia.value := qsl->licencia qsl.nombre.value := qsl->nombre qsl.frecuencia.value := qsl->frecuencia qsl.modo.value := qsl->modo qsl.banda.value := qsl->banda qsl.pais.value := qsl->pais qsl.horainicio.value := qsl->horainicio qsl.horafinal.value := qsl->horafinal qsl.mirst.value := qsl->mirst qsl.surst.value := qsl->surst qsl.postal.value := qsl->postal qsl.etiqueta.value := qsl->etiqueta qsl.registro.enabled := .F.
qsl.licencia.setfocus center window qsl activate window qsl
Return /* */ *------------------------------------------------------------------------------* Procedure nuevo() *------------------------------------------------------------------------------* load window qsl nuevo := .T. qsl.registro.value := str(recno()) qsl.registro.enabled :=.F. qsl.fecha.value := date() if horadisp = "SI" qsl.horainicio.value:=time() endif CREATE KEY ALT+G OF qsl ACTION grabar() END KEY qsl.licencia.setfocus qsl.borrar.visible := .F.
center window qsl activate window qsl Return /* */ *------------------------------------------------------------------------------* Procedure clip() *------------------------------------------------------------------------------* load window qsl nuevo := .T. qsl.registro.value := str(recno()) qsl.registro.enabled := .F. qsl.fecha.value := date() if horadisp = "SI" qsl.horainicio.value := time() endif qsl.frecuencia.value := frec qsl.modo.value := mod qsl.banda.value := band CREATE KEY ALT+G OF qsl ACTION grabar() END KEY qsl.licencia.setfocus qsl.borrar.visible := .F.
center window qsl activate window qsl Return /* */ *------------------------------------------------------------------------------* Procedure grabar() *------------------------------------------------------------------------------* if nuevo =.T. qsl->(dbappend()) endif
qsl->fecha := qsl.fecha.value qsl->licencia := qsl.licencia.value qsl->nombre := qsl.nombre.value qsl->frecuencia := qsl.frecuencia.value frec := qsl.frecuencia.value qsl->modo := qsl.modo.value mod := qsl.modo.value qsl->banda := qsl.banda.value band := qsl.banda.value qsl->pais := qsl.pais.value qsl->horainicio := qsl.horainicio.value qsl->horafinal := qsl.horafinal.value qsl->mirst := qsl.mirst.value qsl->surst := qsl.surst.value qsl->postal := qsl.postal.value qsl->etiqueta := qsl.etiqueta.value qsl->(dbcommit()) QSL->(dbunlock()) qsl.release form_1.browse_1.refresh Return /* */ *------------------------------------------------------------------------------* Procedure borrar() *------------------------------------------------------------------------------*
local registro := recno()
if registro=0 mg_MsgWarning( "No selecciono ningun registro para borrar" , "Error al Borrar !" ) Return endif
qsl->(dbgoto(registro)) if mg_MsgOkCancel ("Esta seguro que desea "+HB_OsNewLine()+" borrar este registro?","Advertencia !!",,.F.,2) qsl->(dbrlock()) qsl->(dbdelete()) else form_1.browse_1.refresh Return endif qsl->(dbunlock()) form_1.browse_1.refresh Return /* */ *------------------------------------------------------------------------------* Procedure ver() *------------------------------------------------------------------------------*
load window qsl qsl.borrar.visible := .F. qsl.guardar.visible := .F. qsl.registro.value := str(recno()) qsl.fecha.value := qsl->fecha qsl.licencia.value := qsl->licencia qsl.nombre.value := qsl->nombre qsl.frecuencia.value := qsl->frecuencia qsl.modo.value := qsl->modo qsl.banda.value := qsl->banda qsl.pais.value := qsl->pais qsl.horainicio.value := qsl->horainicio qsl.horafinal.value := qsl->horafinal qsl.mirst.value := qsl->mirst qsl.surst.value := qsl->surst qsl.postal.value := qsl->postal qsl.etiqueta.value := qsl->etiqueta qsl.registro.enabled := .F. qsl.fecha.enabled := .F. qsl.licencia.enabled := .F. qsl.nombre.enabled := .F. qsl.frecuencia.enabled := .F. qsl.modo.enabled := .F. qsl.banda.enabled := .F. qsl.pais.enabled := .F. qsl.horainicio.enabled := .F. qsl.horafinal.enabled := .F. qsl.mirst.enabled := .F. qsl.surst.enabled := .F. qsl.postal.enabled := .F. qsl.etiqueta.enabled := .F. qsl.etiqueta.setfocus
center window qsl activate window qsl Return /* */ *------------------------------------------------------------------------------* Procedure configura() *------------------------------------------------------------------------------*
load window configura configura.qra.value :=config->qra configura.nombre.value :=config->nombre configura.grid_locat.value :=config->grid_locat configura.time_zone.value :=config->time_zone configura.itu_zone.value :=config->itu_zone configura.horadisp.value :=config->horadisp configura.qra.setfocus center window configura activate window configura Return /* */ *------------------------------------------------------------------------------* Procedure guardaconf() *------------------------------------------------------------------------------*
config->qra := configura.qra.value config->nombre := configura.nombre.value config->grid_locat := configura.grid_locat.value config->time_zone := configura.time_zone.value config->itu_zone := configura.itu_zone.value config->horadisp := configura.horadisp.value config->(dbcommit()) configura.release Return /* */ *------------------------------------------------------------------------------* Procedure orden1 *------------------------------------------------------------------------------* qsl->(dbsetorder(1)) form_1.browse_1.refresh form_1.browse_1.value := 1 Return /* */ *------------------------------------------------------------------------------* Procedure orden2 *------------------------------------------------------------------------------* qsl->(dbsetorder(2)) form_1.browse_1.refresh form_1.browse_1.value:=1 Return /* */ *------------------------------------------------------------------------------* Procedure index() *------------------------------------------------------------------------------* if used() qsl->( DBCLOSEAREA() ) Endif FERASE("qsl.cdx") Use qsl Alias qsl new exclusive Index on qsl->fecha TAG FECHA to qsl.cdx Index on qsl->licencia Tag ORDEN2 to qsl.cdx qsl->( DBCLOSEAREA() ) Use qsl alias qsl index qsl new shared form_1.browse_1.refresh mg_msginfo("Se reconstruyo el indice de la base de datos con exito","Reconstruccion") Return /* */ *------------------------------------------------------------------------------* Function respaldo() // The Backup *------------------------------------------------------------------------------* local cFolder := mg_GetCurrentFolder() local cFile := cFolder+HB_OsPathSeparator()+"backup.zip" Local cdestino //close qsl
if file(cFile) ferase (cFile) endif if hb_zipfile(cFile,{cFolder+HB_OsPathSeparator()+"qsl.dbf",cFolder+HB_OsPathSeparator()+"qsl.fpt",cfolder+HB_OsPathSeparator()+"qsl.cdx",cFolder+HB_OsPathSeparator()+"config.dbf"},.T.) mg_MsgWarning( "El backup fue creado correctamente!" , "Copia de Respaldo" ) else mg_MsgWarning( "Hubo algun error al crear el respaldo, verifique por favor !" , "Copia de Respaldo" ) Return Nil endif cdestino := mg_PutFile({ {"Zip Files","*.zip;*.ZIP"}}, "Guardar Archivo Comprimido como:" , cFolder,.F.,,.T. ) if empty(cdestino) // PlayExclamation() mg_MsgInfo( "No se pudo grabar el respaldo"+HB_OSnewline()+"Ud cancelo la seleccion del destino !" , "error al grabar !" ) mg_SetCurrentFolder( cfolder ) Return Nil else copy file (cFile) to (cdestino ) endif mg_SetCurrentFolder( cfolder )
Return Nil /* */ *------------------------------------------------------------------------------* Procedure listado() *------------------------------------------------------------------------------*
local reng := 0 local tituloimp := "Impresion de Libro de Guardia" private pagina := 0 qsl->(dbgotop()) RESET PRINTER
SET PRINTER UNITS TO QPrinter_Millimeter // Default SET PRINTER ORIENTATION TO QPrinter_Landscape SET PRINTER PAPERSIZE TO QPrinter_A4 //tamaño A4 el mas comun CREATE REPORT &tituloimp
CREATE STYLEFONT StyleFont_1 FONTSIZE 9 FONTNAME "mg_normal" END STYLEFONT SET STYLEFONT TO "StyleFont_1"
CREATE PAGEREPORT "Mypage"
pagina := 1 Phead()
DO WHILE !qsl->(EOF()) // the body reng ++
PRINT qsl->fecha ROW 25+(5*(reng-1)) COL 20 END PRINT // or use @ (25+(5*(reng-1))), 45 print qsl->Licencia @ (25+(5*(reng-1))), 70 print qsl->frecuencia @ (25+(5*(reng-1))),100 print qsl->modo @ (25+(5*(reng-1))),120 print qsl->banda @ (25+(5*(reng-1))),140 print qsl->pais @ (25+(5*(reng-1))),170 print qsl->horainicio @ (25+(5*(reng-1))),195 print qsl->horafinal @ (25+(5*(reng-1))),220 print qsl->mirst @ (25+(5*(reng-1))),250 print qsl->surst
qsl->(dbskip()) if reng > 35 // start a new page pagina ++ // increase a pagenumber reng := 0 // reset line starter // The footer PRINT LINE FROMXY { 18 , 205 } // {col,row} TOXY { 280 , 205 } // {col,row} END PRINT NEWPAGEREPORT Phead() endif END DO
END PAGEREPORT
END REPORT EXEC REPORT &tituloimp
DESTROY REPORT &tituloimp
release pagina Return /* */ *------------------------------------------------------------------------------* Procedure Phead () *------------------------------------------------------------------------------* @ 5,100 print "Libro de Guardia de "+ config->nombre +" Titular de " + config->qra+" Pagina Nro: "+str(pagina) @ 18,20 print "Fecha Licencia Frecuencia Modo" @ 18,120 print "Banda Pais Hora Inicio Hora Final Mi RST Su RST" PRINT LINE FROMXY { 18 , 23 } // {col,row} TOXY { 280 , 23 } // {col,row} END PRINT
return /* */ *------------------------------------------------------------------------------* Procedure Importar () *------------------------------------------------------------------------------* Local cfolder := mg_GetCurrentFolder() import(mg_getfile( { {"adif Files","*.adi"},{"ADIF Files","*.ADI "}} , "Abrir Archivo " , , .F. , .T.) ) mg_SetCurrentFolder( cfolder ) form_1.browse_1.refresh Return
|