-
Notifications
You must be signed in to change notification settings - Fork 0
/
History.prg
746 lines (580 loc) · 23.1 KB
/
History.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
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
#include "Appevent.ch"
#include "Directry.ch"
#include "Common.ch"
#include "Gra.ch"
#include "Font.ch"
#include "Xbp.ch"
#PRAGMA LIBRARY( "ASCOM10.LIB" )
Function ToothHistory(oPrevDlg, nPacientRec, nTooth, oPrevXbp)
LOCAL nEvent, mp1, mp2, oXbp, i, oBrowse, oSLE, oDialog, oDlg, HistoryRec
LOCAL aFields := { "Date", "Summa" }
LOCAL aHeader := { "„ â ", "‘⮨¬®áâì" }
//-----------------------------------------------------------------------------------------------------
LOCAL oStatic
LOCAL bKeyhandler
LOCAL aSize[2], aPos[2], oWinMenu
Local drawingArea, aControls:={}
aSize[1] = 350 // ˜¨à¨ ®ª
aSize[2] = 500 // ‚ëá®â ®ª
// PRIVATE oBrowseWin
oDlg := CreateModalWindow( oPrevDlg, {0,0}, aSize, "ˆáâ®à¨ï §ã¡ " )
Select Pacient
Go nPacientRec
Select tHistory
Zap
GO TOP
Select History
Seek Pacient->Code
Do While Code==Pacient->Code
IF NumTooth==nTooth
HistoryRec=RecNo()
Select tHistory
Append Blank
Replace tHistory->Rec with HistoryRec
Replace tHistory->Code with History->Code
Replace tHistory->Date with History->Date
Replace tHistory->Numtooth with History->Numtooth
Replace tHistory->ToothArray with History->ToothArray
Replace tHistory->Summa with History->Summa
Replace tHistory->Foto1 with History->Foto1
Replace tHistory->Foto2 with History->Foto2
Replace tHistory->Foto3 with History->Foto3
Replace tHistory->Foto4 with History->Foto4
Replace tHistory->Foto5 with History->Foto5
Replace tHistory->Foto6 with History->Foto6
Replace tHistory->cWork with History->cWork
Select History
ENDIF
Skip
EndDo
// DrawCircle( oPrevXbp, GRA_CLR_RED )
Select tHistory
Go Top
If RecCount()>2
IF IsCorrectCopy()==.F.
Zap
MsgBox( cLicenseText )
oDlg:destroy()
Return NIL
ENDIF
EndIf
//----------------------------------------------------------------------------------------------------------------------------------------------------
// oDlg := CreateModalWindow( oPrevDlg, {0,0}, aSize, "ˆáâ®à¨ï §ã¡ " )
drawingArea := oDlg:drawingArea
//-----------------------------------------------------------------------------------------------------
oDialog := oDlg
// oDialog := GuiStdDialog( "Address Data" )
// SetAppWindow( oDialog )
/*
* The SLE is required as entry field for the incremental
* search. It is related to the column of the browser in
* which the cursor is positioned.
* Whenever a key is pressed, the procedure IncrementalSearch()
* is called.
*/
// oSLE := XbpSLE():new( oDialog:drawingArea,,{0,aSize[2]-60},{aSize[1]-20,20}, , .t. )
// oSLE:keyboard := {|nKey,mp2,obj| IncrementalSearch( nKey, obj, ;
// oBrowse, aFields ) }
// oSLE:create()
// aSize[1] *= 0.98 // ˜¨à¨ ®ª
// aSize[2]=aSize[2]-70 // ‚ëá®â ®ª
// oBrowse := XbpColoredQuickBrowse():new( oDialog:drawingArea,,{0,50},{195,aSize[2]-110}, , .F. )
oBrowse := XbpColoredQuickBrowse():new( oDialog:drawingArea,,{0,0},{195,aSize[2]-35}, , .F. )
oBrowse:style := XBP_STYLE_SYSTEMDEFAULT
oBrowse:cursorMode := XBPBRW_CURSOR_CELL
oBrowse:dataLink := DacPagedDataStore():new( Alias(), aFields )
oBrowse:create()
// Resize( oSLE, oBrowse, oDialog:drawingArea:currentSize() )
/*
* Copy strings to header of columns.
*/
oBrowse:setHeader( aHeader )
/*
* Respecting the SLE, the browser fills the entire window. The cache
* size of DacPagedDataStore must be set according to the rows of the
* browser.
*/
// oDialog:drawingArea:resize := {|mp1,mp2,obj| Resize( oSLE, oBrowse, mp2 ) }
oOwner := oDlg:drawingArea
/*
oXbp := XbpPushButton():new( drawingArea,, {15,10}, {90,30} )
oXbp:caption := "®ª § âì"
oXbp:group := XBP_BEGIN_GROUP
oXbp:create()
oXbp:activate := {|| History(oBrowse, oDlg, 1,nPacientRec, nTooth) }
AAdd( aControls, oXbp )
*/
oXbp := XbpPushButton():new( drawingArea,, {220,400}, {90,30} )
oXbp:caption := "ˆ§¬¥¨âì"
oXbp:group := XBP_BEGIN_GROUP
oXbp:create()
oXbp:activate := {|| History(oBrowse, oDlg, 2,nPacientRec, nTooth) }
// oXbp:activate := {|| oBrowse:datalink:refresh() }
AAdd( aControls, oXbp )
oXbp := XbpPushButton():new( drawingArea,, {220,300}, {90,30} )
oXbp:caption := "„®¡ ¢¨âì"
oXbp:group := XBP_WITHIN_GROUP
oXbp:create()
oXbp:activate := {|| History(oBrowse, oDlg, 3, nPacientRec, nTooth) }
AAdd( aControls, oXbp )
oXbp := XbpPushButton():new( drawingArea,, {220,200}, {90,30} )
oXbp:caption := "“¤ «¨âì"
oXbp:group := XBP_WITHIN_GROUP
oXbp:create()
oXbp:activate := {|| DeleteHistoryRecord(oDlg, oBrowse) }
AAdd( aControls, oXbp )
oXbp := XbpPushButton():new( drawingArea,, {220,10}, {90,30} )
oXbp:caption := "‡ ªàëâì"
oXbp:group := XBP_WITHIN_GROUP
oXbp:create()
// oXbp:setName( ID_BTN_NEXT )
// oXbp:activate := {|| RefreshPacientWin(oBrowse)}
oXbp:activate := {|| CloseToothHistory(oDlg, oPrevXbp)}
// oXbp:activate := {|| PacientHistory()}
AAdd( aControls, oXbp )
bKeyHandler := {|nKey,x,obj| DlgKeyhandler( nKey, obj, aControls, oDlg ) }
AEval( aControls, {|o| o:keyBoard := bKeyHandler } )
// oSLE:show()
oBrowse:show()
// oDialog:show()
SetAppFocus( oBrowse )
Return Nil
PROCEDURE DeleteHistoryRecord(oPrevDlg, oBrowse)
LOCAL RecNo
Select tHistory
Go oBrowse:getData()
RefreshHistorytWin(oBrowse)
// MsgBox( Alias()+" "+Str(oBrowse:getData()) , "RecNo" )
If ConfirmBox( oPrevDlg, "“¤ «¨âì íâã § ¯¨áì ®â "+DtoC(tHistory->Date)+" "+LTrim(Str(Summa))+"àã¡.", ;
"‚¨¬ ¨¥", ;
XBPMB_YESNO , ;
XBPMB_QUESTION+XBPMB_APPMODAL+XBPMB_MOVEABLE ) == XBPMB_RET_YES
DeleteFile(cImageDir+Foto1)
DeleteFile(cImageDir+Foto2)
DeleteFile(cImageDir+Foto3)
DeleteFile(cImageDir+Foto4)
DeleteFile(cImageDir+Foto5)
DeleteFile(cImageDir+Foto6)
DbDelete()
MsgBox( If(Deleted(),"‡ ¯¨áì ãá¯¥è® ã¤ «¥ ","Žè¨¡ª 㤠«¥¨ï") , "" )
// Skip
// oBrowse:up()
RefreshHistorytWin(oBrowse)
ENDIF
Return
Function CloseToothHistory(oDlg, oXbp)
LOCAL lDeleted, nRec:=1
Select tHistory
GO nRec
Do While !EOF()
IF tHistory->Code!=0
lDeleted:=Deleted()
Select History
IF tHistory->Rec!=0
Go tHistory->Rec
RecLock()
ELSE
IF lDeleted==.F.
NetAppend()
// Append Blank
ENDIF
ENDIF
IF lDeleted==.F.
Replace History->Code with tHistory->Code
Replace History->Date with tHistory->Date
Replace History->Numtooth with tHistory->Numtooth
Replace History->ToothArray with tHistory->ToothArray
Replace History->Summa with tHistory->Summa
Replace History->Foto1 with tHistory->Foto1
Replace History->Foto2 with tHistory->Foto2
Replace History->Foto3 with tHistory->Foto3
Replace History->Foto4 with tHistory->Foto4
Replace History->Foto5 with tHistory->Foto5
Replace History->Foto6 with tHistory->Foto6
Replace History->cWork with tHistory->cWork
ELSE
DeleteFile(cImageDir+tHistory->Foto1)
DeleteFile(cImageDir+tHistory->Foto2)
DeleteFile(cImageDir+tHistory->Foto3)
DeleteFile(cImageDir+tHistory->Foto4)
DeleteFile(cImageDir+tHistory->Foto5)
DeleteFile(cImageDir+tHistory->Foto6)
IF tHistory->Rec!=0
DbDelete()
ENDIF
ENDIF
DbUnLock()
ENDIF
Select tHistory
nRec:=nRec+1
Go nRec
// Skip
EndDo
Zap
Select History
If oDlg!=NIL
oDlg:destroy()
EndIf
Return NIL
Function ReplaceToothArray(nPos, cVal)
If nPos==1
THISTORY->ToothArray := cVal+SubStr(THISTORY->ToothArray,2,29)
ELSE
If nPos==30
THISTORY->ToothArray := SubStr(THISTORY->ToothArray,1,29)+cVal
ELSE
THISTORY->ToothArray := SubStr(THISTORY->ToothArray,1,nPos-1)+cVal+SubStr(THISTORY->ToothArray,nPos+1,29-nPos)
ENDIF
ENDIF
Return NIL
Function TestToothArray(nPos)
LOCAL lValue:=.F.
If Val(SubStr(THISTORY->ToothArray,nPos,1))==1
lValue:=.T.
EndIf
Return lValue
Function RefreshHistorytWin(oBrowse)
LOCAL nRec
Select tHistory
oBrowse:datalink:refresh()
Return NIL
Function History(oBrowse, oPrevDlg, nMode, nPacientRec, nTooth, oPrevXbp)
LOCAL nEvent, mp1, mp2
LOCAL oDlg, oXbp, drawingArea, aEditControls := {}
LOCAL oView1,oView2,oView3,oView4
// oDlg := CreateModalWindow( oPrevDlg, {450,255}, {1016,480}, "‚믮«¥ ï à ¡®â " )
// oDlg := CreateModalWindow( oPrevDlg, , {1016,480}, "‚믮«¥ ï à ¡®â " )
oDlg := CreateModalWindow( oPrevDlg, , {990,480}, "‚믮«¥ ï à ¡®â " )
If nMode==1 .or. nMode==2
Select tHistory
Go oBrowse:getData()
EndIf
If nMode==3 // ¥¦¨¬ ¤®¡ ¢«¥¨ï § ¯¨á¨
Select Pacient
Go nPacientRec
Select tHistory
DbAppend()
Replace THISTORY->Code with Pacient->Code
Replace THISTORY->NumTooth with nTooth
Replace THISTORY->ToothArray with Replicate("0",30)
Replace THISTORY->Date with Date()
EndIf
If Len(THISTORY->ToothArray)!=30
THISTORY->ToothArray=Replicate("0",30)
ENDIF
drawingArea := oDlg:drawingArea
drawingArea:setFontCompoundName( "8.Helv" )
oDlg:show()
oDlg:close := {|mp1,mp2,obj| oDlg:destroy() }
oXbp := XbpStatic():new( drawingArea, , {168,396}, {36,24} )
oXbp:caption := "„ â :"
oXbp:clipSiblings := .T.
oXbp:options := XBPSTATIC_TEXT_VCENTER+XBPSTATIC_TEXT_RIGHT
oXbp:create()
oXbp := XbpSLE():new( drawingArea, , {216,396}, {72,24}, { { XBP_PP_BGCLR, XBPSYSCLR_ENTRYFIELD } } )
oXbp:bufferLength := 10
oXbp:tabStop := .T.
oXbp:dataLink := {|x| IIf( PCOUNT()==0, DtoC( THISTORY->DATE ), THISTORY->DATE := CtoD(x) ) }
oXbp:create():setData()
oXbp:killInputFocus := { |x,y,oSLE| oSLE:getData(), RefreshHistorytWin(oBrowse) }
AAdd ( aEditControls, oXbp )
SetAppFocus( oXbp )
oXbp := XbpStatic():new( drawingArea, , {300,396}, {60,24} )
oXbp:caption := "‘㬬 :"
oXbp:clipSiblings := .T.
oXbp:options := XBPSTATIC_TEXT_VCENTER+XBPSTATIC_TEXT_RIGHT
oXbp:create()
oXbp := XbpSLE():new( drawingArea, , {372,396}, {120,24}, { { XBP_PP_BGCLR, XBPSYSCLR_ENTRYFIELD } } )
oXbp:bufferLength := 10
oXbp:tabStop := .T.
oXbp:dataLink := {|x| IIf( PCOUNT()==0, LTrim(Transform( THISTORY->SUMMA, '@N' )), THISTORY->SUMMA := Val(x) ) }
oXbp:create():setData()
oXbp:killInputFocus := { |x,y,oSLE| oSLE:getData(), RefreshHistorytWin(oBrowse) }
AAdd ( aEditControls, oXbp )
oXbp := XbpMLE():new( drawingArea, , {180,72}, {312,300}, { { XBP_PP_BGCLR, XBPSYSCLR_ENTRYFIELD } } )
oXbp:ignoreTab := .T.
oXbp:tabStop := .T.
// oXbp:dataLink := {|x| IIf( PCOUNT()==0, THISTORY->CWORK, THISTORY->CWORK := x ) }
oXbp:dataLink := {|x| IIf( x==NIL, THISTORY->CWORK, THISTORY->CWORK := x ) }
oXbp:create():setData()
oXbp:killInputFocus := { |x,y,oSLE| oSLE:getData() }
AAdd ( aEditControls, oXbp )
oXbp := XbpCheckBox():new( drawingArea, , {36,396}, {96,24} )
oXbp:caption := "€ á⥧¨ï"
oXbp:tabStop := .T.
oXbp:selection:= TestToothArray(1)
oXbp:create()
oXbp:selected := {| mp1, mp2, oChk| ReplaceToothArray(1, IIf( oChk:getData(), "1", "0" )) }
oXbp := XbpCheckBox():new( drawingArea, , {36,372}, {96,24} )
oXbp:caption := "Œ âà¨æ "
oXbp:tabStop := .T.
oXbp:selection:= TestToothArray(2)
oXbp:create()
oXbp:selected := {| mp1, mp2, oChk| ReplaceToothArray(2, IIf( oChk:getData(), "1", "0" )) }
oXbp := XbpCheckBox():new( drawingArea, , {36,348}, {96,24} )
oXbp:caption := "«®¬¡ "
oXbp:tabStop := .T.
oXbp:selection:= TestToothArray(3)
oXbp:create()
oXbp:selected := {| mp1, mp2, oChk| ReplaceToothArray(3, IIf( oChk:getData(), "1", "0" )) }
oXbp := XbpCheckBox():new( drawingArea, , {36,324}, {108,24} )
oXbp:caption := "¥âà ªæ¨ï"
oXbp:tabStop := .T.
oXbp:selection:= TestToothArray(4)
oXbp:create()
oXbp:selected := {| mp1, mp2, oChk| ReplaceToothArray(4, IIf( oChk:getData(), "1", "0" )) }
oXbp := XbpCheckBox():new( drawingArea, , {36,300}, {96,24} )
oXbp:caption := "Š « ü1"
oXbp:tabStop := .T.
oXbp:selection:= TestToothArray(5)
oXbp:create()
oXbp:selected := {| mp1, mp2, oChk| ReplaceToothArray(5, IIf( oChk:getData(), "1", "0" )) }
oXbp := XbpCheckBox():new( drawingArea, , {36,276}, {96,24} )
oXbp:caption := "Š « ü2"
oXbp:tabStop := .T.
oXbp:selection:= TestToothArray(6)
oXbp:create()
oXbp:selected := {| mp1, mp2, oChk| ReplaceToothArray(6, IIf( oChk:getData(), "1", "0" )) }
oXbp := XbpCheckBox():new( drawingArea, , {36,252}, {96,24} )
oXbp:caption := "Š « ü3"
oXbp:tabStop := .T.
oXbp:selection:= TestToothArray(7)
oXbp:create()
oXbp:selected := {| mp1, mp2, oChk| ReplaceToothArray(7, IIf( oChk:getData(), "1", "0" )) }
oXbp := XbpCheckBox():new( drawingArea, , {36,228}, {96,24} )
oXbp:caption := "ப« ¤ª "
oXbp:tabStop := .T.
oXbp:selection:= TestToothArray(8)
oXbp:create()
oXbp:selected := {| mp1, mp2, oChk| ReplaceToothArray(8, IIf( oChk:getData(), "1", "0" )) }
oXbp := XbpCheckBox():new( drawingArea, , {36,204}, {96,24} )
oXbp:caption := "˜â¨äâ"
oXbp:tabStop := .T.
oXbp:selection:= TestToothArray(9)
oXbp:create()
oXbp:selected := {| mp1, mp2, oChk| ReplaceToothArray(9, IIf( oChk:getData(), "1", "0" )) }
oXbp := XbpCheckBox():new( drawingArea, , {36,180}, {96,24} )
oXbp:caption := " à 騢 ¨¥"
oXbp:tabStop := .T.
oXbp:selection:= TestToothArray(10)
oXbp:create()
oXbp:selected := {| mp1, mp2, oChk| ReplaceToothArray(10, IIf( oChk:getData(), "1", "0" )) }
oXbp := XbpCheckBox():new( drawingArea, , {36,156}, {96,24} )
oXbp:caption := "Šã«ìâï"
oXbp:tabStop := .T.
oXbp:selection:= TestToothArray(11)
oXbp:create()
oXbp:selected := {| mp1, mp2, oChk| ReplaceToothArray(11, IIf( oChk:getData(), "1", "0" )) }
oXbp := XbpCheckBox():new( drawingArea, , {36,132}, {96,24} )
oXbp:caption := "“‡ —¨á⪠"
oXbp:tabStop := .T.
oXbp:selection:= TestToothArray(12)
oXbp:create()
oXbp:selected := {| mp1, mp2, oChk| ReplaceToothArray(12, IIf( oChk:getData(), "1", "0" )) }
oXbp := XbpCheckBox():new( drawingArea, , {36,108}, {96,24} )
oXbp:caption := "à®â¥§"
oXbp:tabStop := .T.
oXbp:selection:= TestToothArray(13)
oXbp:create()
oXbp:selected := {| mp1, mp2, oChk| ReplaceToothArray(13, IIf( oChk:getData(), "1", "0" )) }
oView1:= ImageView():new( drawingArea, , {500,280}, {210,150} ):create()
oView1:autoScale := .T.
oView1:Load(cImageDir+Foto1)
oView1:display()
oView2:= ImageView():new( drawingArea, , {750,280}, {210,150} ):create()
oView2:autoScale := .T.
oView2:Load(cImageDir+Foto2)
oView2:display()
oView3:= ImageView():new( drawingArea, , {500,100}, {210,150} ):create()
oView3:autoScale := .T.
oView3:Load(cImageDir+Foto3)
oView3:display()
oView4:= ImageView():new( drawingArea, , {750,100}, {210,150} ):create()
oView4:autoScale := .T.
oView4:Load(cImageDir+Foto4)
oView4:display()
oXbp := XbpPushButton():new( drawingArea, , {420,12}, {96,24}, { { XBP_PP_BGCLR, XBPSYSCLR_BUTTONMIDDLE }, { XBP_PP_FGCLR, -58 } } )
oXbp:caption := "‡ ªàëâì"
oXbp:tabStop := .T.
oXbp:create()
oXbp:activate := {|| oDlg:destroy() }
oXbp := XbpPushButton():new( drawingArea, , {605,258}, {105,24}, { { XBP_PP_BGCLR, XBPSYSCLR_BUTTONMIDDLE }, { XBP_PP_FGCLR, -58 } } )
oXbp:caption := "”®â® ü1"
oXbp:tabStop := .T.
oXbp:create()
oXbp:activate := {|| OpenFileDialog(1, oView1) }
oXbp := XbpPushButton():new( drawingArea, , {500,258}, {105,24}, { { XBP_PP_BGCLR, XBPSYSCLR_BUTTONMIDDLE }, { XBP_PP_FGCLR, -58 } } )
oXbp:caption := "®«ë© íªà "
oXbp:tabStop := .T.
oXbp:create()
oXbp:activate := {|| FullView( cImageDir+Foto1, oDlg )}
oXbp := XbpPushButton():new( drawingArea, , {855,258}, {105,24}, { { XBP_PP_BGCLR, XBPSYSCLR_BUTTONMIDDLE }, { XBP_PP_FGCLR, -58 } } )
oXbp:caption := "”®â® ü2"
oXbp:tabStop := .T.
oXbp:create()
oXbp:activate := {|| OpenFileDialog(2, oView2) }
oXbp := XbpPushButton():new( drawingArea, , {750,258}, {105,24}, { { XBP_PP_BGCLR, XBPSYSCLR_BUTTONMIDDLE }, { XBP_PP_FGCLR, -58 } } )
oXbp:caption := "®«ë© íªà "
oXbp:tabStop := .T.
oXbp:create()
oXbp:activate := {|| FullView( cImageDir+Foto2 )}
oXbp := XbpPushButton():new( drawingArea, , {605,78}, {105,24}, { { XBP_PP_BGCLR, XBPSYSCLR_BUTTONMIDDLE }, { XBP_PP_FGCLR, -58 } } )
oXbp:caption := "”®â® ü3"
oXbp:tabStop := .T.
oXbp:create()
oXbp:activate := {|| OpenFileDialog(3, oView3)}
oXbp := XbpPushButton():new( drawingArea, , {500,78}, {105,24}, { { XBP_PP_BGCLR, XBPSYSCLR_BUTTONMIDDLE }, { XBP_PP_FGCLR, -58 } } )
oXbp:caption := "®«ë© íªà "
oXbp:tabStop := .T.
oXbp:create()
oXbp:activate := {|| FullView( cImageDir+Foto3 )}
oXbp := XbpPushButton():new( drawingArea, , {750,78}, {105,24}, { { XBP_PP_BGCLR, XBPSYSCLR_BUTTONMIDDLE }, { XBP_PP_FGCLR, -58 } } )
oXbp:caption := "®«ë© íªà "
oXbp:tabStop := .T.
oXbp:create()
oXbp:activate := {|| FullView( cImageDir+Foto4 )}
oXbp := XbpPushButton():new( drawingArea, , {855,78}, {105,24}, { { XBP_PP_BGCLR, XBPSYSCLR_BUTTONMIDDLE }, { XBP_PP_FGCLR, -58 } } )
oXbp:caption := "”®â® ü4"
oXbp:tabStop := .T.
oXbp:create()
oXbp:activate := {|| OpenFileDialog(4, oView4)}
Return NIL
Function OpenFileDialog(nFotoNum, oPreView)
LOCAL oDlg := XbpFiledialog():New(), cFile, cFoto:="Foto", Sel:=Select(), cPrevFile, cRndName
Select tHistory
cFoto:="tHistory->"+cFoto+AllTrim(Str(nFotoNum))
oDlg:Title := "”®â®"
oDlg:fileFilters := { {"”®â®£à 䨨 Jpg Bmp Gif Png", "*.JPG;*.BMP;*.GIF;*.PNG"} }
oDlg:Create()
// cFile := oDlg:Open(&cFoto)
cFile := oDlg:Open()
// cFile:=If(cFile==NIL,"", MyUpper(cFile))
cFile:=If(cFile==NIL,"", cFile)
// MsgBox( cImageDir+" "+cFile+" "+Str(AtNum(MyUpper(cImageDir),cFile)))
// oPreView:Load(cFile)
// oPreView:display()
// If !empty(cFile) .and. (AtNum(cImageDir, cFile))==0
IF !File(cImageDir+SubStr(cFile,atNum("\",cFile)))
SmallCopy(cFile, cImageDir+SubStr(cFile,atNum("\",cFile)+1) )
cFile:=SubStr(cFile,atNum("\",cFile)+1)
ELSE
// SmallCopy(cFile, cImageDir+SubStr(AllTrim(Str(Month(Date())))+AllTrim(Str(Day(Date())))+AllTrim(Str(Seconds())),1,8)+SubStr(cFile,atNum(".",cFile)) )
cRndName:=SubStr(AllTrim(Str(Month(Date())))+AllTrim(Str(Day(Date())))+AllTrim(Str(Seconds())),1,8)
Do While File(cImageDir+cRndName+SubStr(cFile,atNum(".",cFile))) == .T.
cRndName:=SubStr(AllTrim(Str(Val(cRndName)+1)),1,8)
ENDDO
SmallCopy(cFile, cImageDir+cRndName+SubStr(cFile,atNum(".",cFile)) )
cFile:=cRndName+SubStr(cFile,atNum(".",cFile))
// MsgBox( cRndName+SubStr(cFile,atNum(".",cFile)) )
// cFile:=SubStr(cFile,atNum("\",cFile)+1)
ENDIF
/*
IF File(cFile) .and. Upper(cFile)!=Upper( cImageDir+SubStr(cFile,atNum("\",cFile)+1) )
Copy File (cFile) to (cImageDir+SubStr(cFile,atNum("\",cFile)+1) )
ENDIF
*/
// MsgBox( cFile+Chr(13)+Chr(10)+cImageDir+SubStr(cFile,atNum("\",cFile)+1) )
// cFile:=MyUpper(cImageDir+SubStr(cFile,atNum("\",cFile)+1))
// cFile:=MyUpper(SubStr(cFile,atNum("\",cFile)+1))
// cFile:=SubStr(cFile,atNum("\",cFile)+1)
// EndIf
DO Case
Case nFotoNum==1
Replace Foto1 with cFile
Case nFotoNum==2
Replace Foto2 with cFile
Case nFotoNum==3
Replace Foto3 with cFile
Case nFotoNum==4
Replace Foto4 with cFile
ENDCASE
oPreView:Load(cImageDir+cFile)
oPreView:display()
Select(Sel)
Return NIL
function smallcopy(source,dest,row,col,pos)
LOCAL TMPFILE,Desc,Remain:=0,Size,Total,Buffer,Kol_Kl:=0
TmpFile:=Fopen(Source,0)
Total := FSEEK(TmpFile, 0, 2)
FSEEK(TmpFile, 0,0)
Desc:=FCreate(dest)
DO While .T.
IF (Remain+(512*20))<TOTAL
SIZE:=512*20
ELSE
SIZE:=Total-Remain
Buffer:=Space(SIZE)
FRead(TmpFile, @buffer, SIZE)
FWrite(Desc,buffer)
exit
ENDIF
buffer = space(SIZE)
Remain:=Remain+SIZE
FRead(TmpFile, @buffer, SIZE)
FWrite(Desc,buffer)
EndDo
FClose(Desc)
FClose(TmpFile)
RETURN NIL
FUNCTION MyUPPER(cStr)
Local i,cNewStr:=""
For i=1 To Len(cStr)
DO CASE
CASE ASC(Substr(cStr,i,1))>=160.and.ASC(Substr(cStr,i,1))<176
cNewStr=cNewStr+Chr(ASC(Substr(cStr,i,1))-32)
CASE ASC(Substr(cStr,i,1))>=224.and.ASC(Substr(cStr,i,1))<240
cNewStr=cNewStr+Chr(ASC(Substr(cStr,i,1))-80)
CASE ASC(Substr(cStr,i,1))>=97.and.ASC(Substr(cStr,i,1))<123
cNewStr=cNewStr+Chr(ASC(Substr(cStr,i,1))-32)
OTHERWISE
cNewStr=cNewStr+Substr(cStr,i,1)
ENDCASE
Next
Return cNewStr
Function GetPassword(oPrevDlg, lShowString)
LOCAL nEvent, mp1, mp2
LOCAL oDlg, oXbp, drawingArea, aEditControls := {}
lShowString:=If(lShowString==NIL, ".T.", lShowString)
oDlg := CreateModalWindow( oPrevDlg, , {327,139}, "‚¢¥¤¨â¥ ¯ ஫ì" )
drawingArea := oDlg:drawingArea
drawingArea:setFontCompoundName( "8.Helv" )
oDlg:show()
oDlg:close := {|mp1,mp2,obj| oDlg:destroy() }
// oDlg := XbpDialog():new( AppDesktop(), , {600,669}, {327,139}, , .F.)
// oDlg:title := "‚¢¥¤¨â¥ ¯ ஫ì"
// oDlg:create()
// drawingArea := oDlg:drawingArea
// drawingArea:setColorFG( GRA_CLR_BACKGROUND )
// drawingArea:setFontCompoundName( "12.Courier" )
/*
oXbp := XbpSLE():new( drawingArea, , {216,396}, {72,24}, { { XBP_PP_BGCLR, XBPSYSCLR_ENTRYFIELD } } )
oXbp:bufferLength := 10
oXbp:tabStop := .T.
oXbp:dataLink := {|x| IIf( PCOUNT()==0, DtoC( THISTORY->DATE ), THISTORY->DATE := CtoD(x) ) }
oXbp:create():setData()
oXbp:killInputFocus := { |x,y,oSLE| oSLE:getData(), RefreshHistorytWin(oBrowse) }
AAdd ( aEditControls, oXbp )
*/
oXbp := XbpSLE():new( drawingArea, , {108,60}, {168,24}, { { XBP_PP_BGCLR, XBPSYSCLR_ENTRYFIELD } } )
oXbp:bufferLength := 20
oXbp:tabStop := .T.
oXbp:unReadable := lShowString
oXbp:dataLink := {|x| IIf( PCOUNT()==0, cPassWord, cPassWord := LTrim(RTrim(x)) ) }
oXbp:create():setData()
oXbp:killInputFocus := { |x,y,oSLE| oSLE:getData() }
AAdd ( aEditControls, oXbp )
SetAppFocus(oXbp)
oXbp := XbpStatic():new( drawingArea, , {12,60}, {84,24}, { { XBP_PP_FGCLR, GRA_CLR_BLACK } } )
oXbp:caption := " ஫ì"
oXbp:clipSiblings := .T.
oXbp:options := XBPSTATIC_TEXT_VCENTER+XBPSTATIC_TEXT_RIGHT
oXbp:create()
oXbp := XbpPushButton():new( drawingArea, , {108,12}, {96,24}, { { XBP_PP_BGCLR, XBPSYSCLR_BUTTONMIDDLE }, { XBP_PP_FGCLR, -58 } } )
oXbp:caption := "ƒ®â®¢®"
oXbp:tabStop := .T.
oXbp:create()
// oXbp:activate := {|| NIL }
oXbp:activate := {|| oDlg:destroy(), MsgBox( " ஫ì ="+cPassWord) }
AAdd ( aEditControls, oXbp )
// oDlg:show()
Return NIL