-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrmoportunidades.scx.xml
2528 lines (2426 loc) · 49.8 KB
/
crmoportunidades.scx.xml
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
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version = "1.0" encoding="UTF-8" standalone="yes"?>
<VFPData>
<record>
<platform>COMMENT</platform>
<uniqueid>Screen</uniqueid>
<timestamp>0</timestamp>
<class/>
<classloc/>
<baseclass/>
<objname/>
<parent/>
<properties/>
<protected/>
<methods/>
<objcode/>
<ole/>
<ole2/>
<reserved1>VERSION = 3.00</reserved1>
<reserved2/>
<reserved3/>
<reserved4/>
<reserved5/>
<reserved6/>
<reserved7/>
<reserved8/>
<user/>
</record>
<record>
<platform>WINDOWS</platform>
<uniqueid>_49D0VSGLT</uniqueid>
<timestamp>1177581116</timestamp>
<class>dataenvironment</class>
<classloc/>
<baseclass>dataenvironment</baseclass>
<objname>Dataenvironment</objname>
<parent/>
<properties>Name = "Dataenvironment"
</properties>
<protected/>
<methods/>
<objcode/>
<ole/>
<ole2/>
<reserved1/>
<reserved2>1</reserved2>
<reserved3/>
<reserved4>2</reserved4>
<reserved5/>
<reserved6/>
<reserved7/>
<reserved8/>
<user/>
</record>
<record>
<platform>WINDOWS</platform>
<uniqueid>_49D0VSGLU</uniqueid>
<timestamp>1178369547</timestamp>
<class>formamsl</class>
<classloc>..\..\msllib60\msllib60.vcx</classloc>
<baseclass>form</baseclass>
<objname>Formamsl1</objname>
<parent/>
<properties>Height = 450
Width = 780
DoCreate = .T.
Caption = "Oportunidades"
noporttotreg = 0
Name = "Formamsl1"
Marco.Name = "Marco"
</properties>
<protected/>
<methods>PROCEDURE Activate
*
* Activade
*
* Cargar las oportunidades que cumplan con las restricciones
*
DoDefault()
With ThisForm
* Evaluar si se han agregado mas oportunidades
If Reccount('Oport') <> .nOportTotReg
* Consultar oportunidades
.Consultar.Click()
Else
* Actualizar la informacion del temporal
Select Temp
nRecno = Recno()
Scan
If Seek(Temp.NUMOPORT,'Oport')
* Obtener el status
cStatus = ''
Do Case
Case Oport.STATUS == 0
cStatus = 'Nueva'
Case Oport.STATUS == 1
cStatus = 'Trabajando'
Case Oport.STATUS == 2
cStatus = 'Esperando'
Case Oport.STATUS == 3
cStatus = 'Ganada'
Case Oport.STATUS == 4
cStatus = 'Perdida'
EndCase
* Actualizar la informacion del registro
Select Temp
Replace Temp.RESUMEN With Allt(Oport.ASUNTO),;
Temp.STATUS With cStatus,;
Temp.VALOR With Oport.IMPORTE
EndIf
Select Temp
EndScan
* Irme al registro activo
If Between(nRecno,1,Reccount())
Goto nRecno
EndIf
* Actualizar el grid
.Grid1.Refresh()
EndIf
EndWith
ENDPROC
PROCEDURE Init
If Not OpenDbf('Oport','NUMOPORT') Or;
Not OpenDbf('Contactos','NUMCONT') Or;
Not OpenDbf('Crm','ID') Or;
Not OpenDbf('Usuarios','NUMUSER') Or;
Not OpenDbf('Cia')
Return .F.
EndIf
With ThisForm
* Cargar los tipos de oportunidades
.TiposdeOport()
* Cargar los tipos de probabilidad de cierre
.TiposdeProb()
* Mostrar los usuarios
With ThisForm.Usuario
.RowSourceType = 6
.RowSource = 'Usuarios.NOMUSER'
* Mostrar el usuario actual
Select Usuarios
Seek(m.NumUser)
.Value = Usuarios.NOMUSER
.InteractiveChange()
EndWith
* Cargar los status
With ThisForm.Status
.AddItem('Todas')
.AddItem('Nuevas')
.AddItem('Trabajando')
.AddItem('Esperando')
.AddItem('Ganadas')
.AddItem('Perdidas')
.Value = 1
EndWith
* Cargar los filtros
With ThisForm.Filtro
.AddItem('Por Trabajar')
.AddItem('Creadas del')
.AddItem('Ganadas del')
.AddItem('Perdidas del')
.AddItem('Contactar del')
.Value = 1
EndWith
* Mostrar la fecha final
.FechaFin.SetValue(Date())
* Mostrar las lineas de los grid del color del formulario
.Grid1.GridLineColor = .BackColor
.Grid2.GridLineColor = .BackColor
.Grid3.GridLineColor = .BackColor
* Cargar las oportunidades
.Consultar.Click()
EndWith
ENDPROC
PROCEDURE Unload
*
* UnLoad
*
* Borrar los temporales
DelAlias('Temp')
DelAlias('TempOpor')
DelAlias('TempProb')
DelAlias('TipoOpor')
DelAlias('TipoProb')
ENDPROC
PROCEDURE tiposdeoport
*
* TiposdeOport
*
* Cargar los tipos de oportunidades
*
With ThisForm
Local i,cTipos,cTipoOport
* Obtener los tipos de oportunidades desde el Config.msl
cTipos = GetMsl('CrmTiposOport')
cTipoOport = ''
* Crear el temporal donde se van a almacenar los tipos
Create Cursor TipoOpor(TIPO C(15))
Index On Upper(TIPO) Tag Tipo
* Agregarlos al temporal
i = 1
Do While .T.
cTipoOport = SubLin(cTipos,i)
If Empty(cTipoOport)
Exit
Endif
Insert Into TipoOpor Values (cTipoOport)
i=i+1
EndDo
.Tipo.RowSourceType = 6
.Tipo.RowSource = 'TipoOpor.TIPO'
EndWith
ENDPROC
PROCEDURE tiposdeprob
*
* TiposdeProb
*
* Cargar los tipos de probabilidad de cierre
*
With ThisForm
Local i,cTipos,cTipoProb
* Obtener los tipos de probabilidad de cierre desde el Config.msl
cTipos = GetMsl('CrmProbCierre')
cTipoProb = ''
* Crear el temporal donde se van a almacenar los tipos
Create Cursor TipoProb(TIPO C(15))
Index On Upper(TIPO) Tag Tipo
* Agregarlos al temporal
i = 1
Do While .T.
cTipoProb = SubLin(cTipos,i)
If Empty(cTipoProb)
Exit
Endif
Insert Into TipoProb Values (cTipoProb)
i=i+1
EndDo
.ProbCierre.RowSourceType = 6
.ProbCierre.RowSource = 'TipoProb.TIPO'
EndWith
ENDPROC
PROCEDURE totoport
*
* TotOport
*
* Totalizar por tipos de oportunidad
*
With ThisForm
* Obtener las oportunidades por tipo de oportunidad
Select TIPO, Count(TIPO) As Cant, Sum(VALOR) As Valor From Temp Group By 1 Order By 3 Into Cursor TempOpor
* Obtener los totales
Select TempOpor
Sum CANT,VALOR To .CantOport.Value,.ValorOport.Value
* Muestra los datos del temporal
.LockScreen = .T.
With ThisForm.Grid2
.RecordSourceType = 1
.RecordSource = 'TempOpor'
.Column1.ControlSource = 'Allt(TempOpor.TIPO)'
.Column2.ControlSource = 'TempOpor.CANT'
.Column3.ControlSource = 'TempOpor.VALOR'
* Irme al inicio del temporal
Select TempOpor
Go Top
.Refresh()
EndWith
.LockScreen = .F.
EndWith
ENDPROC
PROCEDURE totprobcierre
*
* TotProbCierre
*
* Totalizar por probabilidad de cierre
*
With ThisForm
* Obtener las oportunidades por probabilidad de cierre
Select PROBCIERRE, Count(PROBCIERRE) As Cant, Sum(VALOR) As Valor From Temp Group By PROBCIERRE Order By 3 Into Cursor TempProb
* Obtener los totales
Select TempProb
Sum CANT,VALOR To .CantProbCierre.Value,.ValorProbCierre.Value
* Muestra los datos del temporal
.LockScreen = .T.
With ThisForm.Grid3
.RecordSourceType = 1
.RecordSource = 'TempProb'
.Column1.ControlSource = 'Allt(TempProb.PROBCIERRE)'
.Column2.ControlSource = 'TempProb.CANT'
.Column3.ControlSource = 'TempProb.VALOR'
* Irme al inicio del temporal
Select TempProb
Go Top
.Refresh()
EndWith
.LockScreen = .F.
EndWith
ENDPROC
</methods>
<objcode/>
<ole/>
<ole2/>
<reserved1/>
<reserved2/>
<reserved3>cnumuser
activerecno
noporttotreg
*tiposdeprob
*tiposdeoport
*totoport
*totprobcierre
</reserved3>
<reserved4/>
<reserved5/>
<reserved6/>
<reserved7/>
<reserved8/>
<user/>
</record>
<record>
<platform>WINDOWS</platform>
<uniqueid>_49D0VSGLT</uniqueid>
<timestamp>1178369352</timestamp>
<class>combobox</class>
<classloc/>
<baseclass>combobox</baseclass>
<objname>usuario</objname>
<parent>Formamsl1</parent>
<properties>FontSize = 8
Height = 20
Left = 15
Style = 2
TabIndex = 1
ToolTipText = "Agente"
Top = 17
Width = 150
Name = "usuario"
</properties>
<protected/>
<methods>PROCEDURE InteractiveChange
*
* Usuario
*
* Almacena en una propiedad de la forma el numero de usuario
ThisForm.cNumUser = Usuarios.NUMUSER
ENDPROC
PROCEDURE KeyPress
LPARAMETERS nKeyCode, nShiftAltCtrl
* Borrar el usuario al presionar [Del]
If nKeyCode==7
This.Value = ''
ThisForm.cNumUser = ''
EndIf
ENDPROC
</methods>
<objcode/>
<ole/>
<ole2/>
<reserved1/>
<reserved2/>
<reserved3/>
<reserved4/>
<reserved5/>
<reserved6/>
<reserved7/>
<reserved8/>
<user/>
</record>
<record>
<platform>WINDOWS</platform>
<uniqueid>_49D0VSGLT</uniqueid>
<timestamp>1178369352</timestamp>
<class>combobox</class>
<classloc/>
<baseclass>combobox</baseclass>
<objname>status</objname>
<parent>Formamsl1</parent>
<properties>FontSize = 8
Height = 20
Left = 166
Style = 2
TabIndex = 2
ToolTipText = "Status"
Top = 17
Width = 90
Name = "status"
</properties>
<protected/>
<methods/>
<objcode/>
<ole/>
<ole2/>
<reserved1/>
<reserved2/>
<reserved3/>
<reserved4/>
<reserved5/>
<reserved6/>
<reserved7/>
<reserved8/>
<user/>
</record>
<record>
<platform>WINDOWS</platform>
<uniqueid>_49D0VYEBI</uniqueid>
<timestamp>1178369352</timestamp>
<class>combobox</class>
<classloc/>
<baseclass>combobox</baseclass>
<objname>filtro</objname>
<parent>Formamsl1</parent>
<properties>FontSize = 8
Height = 20
Left = 257
Style = 2
TabIndex = 3
ToolTipText = "Filtro"
Top = 17
Width = 90
Name = "filtro"
</properties>
<protected/>
<methods/>
<objcode/>
<ole/>
<ole2/>
<reserved1/>
<reserved2/>
<reserved3/>
<reserved4/>
<reserved5/>
<reserved6/>
<reserved7/>
<reserved8/>
<user/>
</record>
<record>
<platform>WINDOWS</platform>
<uniqueid>_49D0VSGLT</uniqueid>
<timestamp>1178369352</timestamp>
<class>leefecha</class>
<classloc>..\..\msllib60\msllib60.vcx</classloc>
<baseclass>container</baseclass>
<objname>fechaini</objname>
<parent>Formamsl1</parent>
<properties>Top = 17
Left = 348
Width = 95
Height = 21
TabIndex = 4
Name = "fechaini"
Container1.Name = "Container1"
Fecha.Name = "Fecha"
Buscar.Name = "Buscar"
</properties>
<protected/>
<methods/>
<objcode/>
<ole/>
<ole2/>
<reserved1/>
<reserved2/>
<reserved3/>
<reserved4/>
<reserved5/>
<reserved6/>
<reserved7/>
<reserved8/>
<user/>
</record>
<record>
<platform>WINDOWS</platform>
<uniqueid>_49D0VYEBJ</uniqueid>
<timestamp>1178369352</timestamp>
<class>leyenda</class>
<classloc>..\..\msllib60\msllib60.vcx</classloc>
<baseclass>label</baseclass>
<objname>Leyenda1</objname>
<parent>Formamsl1</parent>
<properties>Caption = "al"
Height = 16
Left = 444
Top = 19
Width = 10
TabIndex = 5
Name = "Leyenda1"
</properties>
<protected/>
<methods/>
<objcode/>
<ole/>
<ole2/>
<reserved1/>
<reserved2/>
<reserved3/>
<reserved4/>
<reserved5/>
<reserved6/>
<reserved7/>
<reserved8/>
<user/>
</record>
<record>
<platform>WINDOWS</platform>
<uniqueid>_49D0VYEBK</uniqueid>
<timestamp>1178369352</timestamp>
<class>leefecha</class>
<classloc>..\..\msllib60\msllib60.vcx</classloc>
<baseclass>container</baseclass>
<objname>fechafin</objname>
<parent>Formamsl1</parent>
<properties>Top = 17
Left = 455
Width = 95
Height = 21
TabIndex = 6
Name = "fechafin"
Container1.Name = "Container1"
Fecha.Name = "Fecha"
Buscar.Name = "Buscar"
</properties>
<protected/>
<methods/>
<objcode/>
<ole/>
<ole2/>
<reserved1/>
<reserved2/>
<reserved3/>
<reserved4/>
<reserved5/>
<reserved6/>
<reserved7/>
<reserved8/>
<user/>
</record>
<record>
<platform>WINDOWS</platform>
<uniqueid>_49D0WNJT3</uniqueid>
<timestamp>1178369352</timestamp>
<class>leernombre</class>
<classloc>..\..\msllib60\msllib60.vcx</classloc>
<baseclass>container</baseclass>
<objname>LeeContacto</objname>
<parent>Formamsl1</parent>
<properties>Top = 40
Left = 271
Width = 279
Height = 23
TabIndex = 9
calias = Contactos
ccampoclave = Contactos.NUMCONT
ccamponombre = Contactos.NOMCONT
cformabusqueda = BuscarContacto()
nanchoclave = 6
ctagclave = NumCont
ctagnombre = NomCont
Name = "LeeContacto"
Container1.Top = 0
Container1.Left = 50
Container1.Width = 227
Container1.Height = 21
Container1.Name = "Container1"
List1.Name = "List1"
Nombre.Height = 17
Nombre.Left = 52
Nombre.Top = 2
Nombre.Width = 209
Nombre.Name = "Nombre"
Leyenda1.Top = 2
Leyenda1.Name = "Leyenda1"
Clave.Left = 200
Clave.Top = 4
Clave.Name = "Clave"
</properties>
<protected/>
<methods/>
<objcode/>
<ole/>
<ole2/>
<reserved1/>
<reserved2/>
<reserved3/>
<reserved4/>
<reserved5/>
<reserved6/>
<reserved7/>
<reserved8/>
<user/>
</record>
<record>
<platform>WINDOWS</platform>
<uniqueid>_49P0V0RCY</uniqueid>
<timestamp>1178369352</timestamp>
<class>combobox</class>
<classloc/>
<baseclass>combobox</baseclass>
<objname>probcierre</objname>
<parent>Formamsl1</parent>
<properties>FontSize = 8
Height = 21
Left = 146
Style = 2
TabIndex = 8
ToolTipText = "Probabilidad de Cierre"
Top = 40
Width = 110
ZOrderSet = 8
Name = "probcierre"
</properties>
<protected/>
<methods>PROCEDURE KeyPress
LPARAMETERS nKeyCode, nShiftAltCtrl
* Borrar el tipo de probabilidad de cierre al presionar [Del]
If nKeyCode==7
This.Value = ''
EndIf
ENDPROC
</methods>
<objcode/>
<ole/>
<ole2/>
<reserved1/>
<reserved2/>
<reserved3/>
<reserved4/>
<reserved5/>
<reserved6/>
<reserved7/>
<reserved8/>
<user/>
</record>
<record>
<platform>WINDOWS</platform>
<uniqueid>_49P0V0RCZ</uniqueid>
<timestamp>1178369352</timestamp>
<class>combobox</class>
<classloc/>
<baseclass>combobox</baseclass>
<objname>tipo</objname>
<parent>Formamsl1</parent>
<properties>FontSize = 8
Height = 21
Left = 15
Style = 2
TabIndex = 7
ToolTipText = "Tipo de oportunidad"
Top = 40
Width = 110
ZOrderSet = 9
Name = "tipo"
</properties>
<protected/>
<methods>PROCEDURE KeyPress
LPARAMETERS nKeyCode, nShiftAltCtrl
* Borrar el tipo de oportunidad al presionar [Del]
If nKeyCode==7
This.Value = ''
EndIf
ENDPROC
</methods>
<objcode/>
<ole/>
<ole2/>
<reserved1/>
<reserved2/>
<reserved3/>
<reserved4/>
<reserved5/>
<reserved6/>
<reserved7/>
<reserved8/>
<user/>
</record>
<record>
<platform>WINDOWS</platform>
<uniqueid>_49D0WNJT4</uniqueid>
<timestamp>1178369547</timestamp>
<class>boton</class>
<classloc>..\..\msllib60\msllib60.vcx</classloc>
<baseclass>commandbutton</baseclass>
<objname>consultar</objname>
<parent>Formamsl1</parent>
<properties>Top = 16
Left = 553
Height = 40
Width = 60
Picture = ..\..\msllib60\pantalla.bmp
Caption = "C\<onsultar"
TabIndex = 10
Name = "consultar"
</properties>
<protected/>
<methods>PROCEDURE Click
*
* Consultar
*
* Realiza la consulta de oportunidades segun las restricciones
*
With ThisForm
* Deshabilitar el boton de excel
.Excel.Enabled = .F.
* Quitar los temporal de los grid
.Grid1.RecordSource = ''
.Grid2.RecordSource = ''
.Grid3.RecordSource = ''
* Borrar los temporales
DelAlias('Temp')
DelAlias('TempOpor')
DelAlias('TempProb')
* Inicializar variables
Do Case
Case .Status.Value == 2
* Nuevas
nStatus = 0
Case .Status.Value == 3
* Trabajando
nStatus = 1
Case .Status.Value == 4
* Esperando
nStatus = 2
Case .Status.Value == 5
* Ganadas
nStatus = 3
Case .Status.Value == 6
* Perdidas
nStatus = 4
OtherWise
* Todas
nStatus = 5
EndCase
nFiltro = .Filtro.Value
dFechaIni = .FechaIni.Value
dFechaFin = .FechaFin.Value
cTipo = Allt(.Tipo.Value)
cProbCierre = Allt(.ProbCierre.Value)
* Localizar al contacto
cNumCont = ''
If Not Empty(.LeeContacto.Nombre.Value)
cNumCont = .LeeContacto.Clave.Value
EndIf
* Formar la consulta
cSql = 'Select Oport.NUMOPORT As NumOport, Oport.CREADA As Creada, Oport.TIPO As Tipo, Contactos.EMPRESA As Empresa, '+;
'Contactos.NOMCONT As Contacto, Oport.ASUNTO As Resumen, '+;
'IIF(Oport.STATUS==0,"Nueva ",IIF(Oport.STATUS==1,"Trabajando",IIF(Oport.STATUS==2,"Esperando ",IIF(Oport.STATUS==3,"Ganada ","Perdida ")))) As Status, '+;
'Oport.IMPORTE As Valor, NVL(Usuarios.NOMUSER,Space(50)) As Agente, Oport.PROBCIERRE As ProbCierre '+;
'From Oport '+;
'Left Join Contactos On Oport.NUMCONT == Contactos.NUMCONT '+;
'Left Join Usuarios On Oport.NUMUSER == Usuarios.NUMUSER '+;
'Order By 1 '+;
'Where '+;
IIF(Empty(.cNumUser), '.T.', '(Empty(Oport.NUMUSER) Or Oport.NUMUSER == m.Val1)')+' And '+;
IIF(nStatus == 5, '.T.', 'Oport.STATUS == m.Val2')+' And '+;
IIF(Empty(cTipo), '.T.', 'Allt(Oport.TIPO) == m.Val3')+' And '+;
IIF(Empty(cProbCierre), '.T.', 'Allt(Oport.PROBCIERRE) == m.Val4')+' And '+;
IIF(Empty(cNumCont), '.T.', 'Oport.NUMCONT == m.Val5')+' And '
Do Case
Case nFiltro == 1
* Por Trabajar
cSql = cSql + '(Oport.STATUS == 0 Or Oport.STATUS == 1 Or (Oport.STATUS == 2 And Oport.SIGLLAMADA <= m.Val7))'
Case nFiltro == 2
* Creadas del ...
cSql = cSql + 'Between(Oport.CREADA,m.Val6,m.Val7)'
Case nFiltro == 3
* Ganadas del ...
cSql = cSql + 'Between(Oport.GANADA,m.Val6,m.Val7)'
Case nFiltro == 4
* Perdidas del ...
cSql = cSql + 'Between(Oport.PERDIDA,m.Val6,m.Val7)'
Case nFiltro == 5
* Contactar del ...
cSql = cSql + 'Between(Oport.SIGLLAMADA,m.Val6,m.Val7)'
EndCase
* Hacer la consulta
If Not SqlMsl('Temp',cSql,.cNumUser,nStatus,cTipo,cProbCierre,cNumCont,dFechaIni,dFechaFin)
Return
EndIf
* Muestra los datos del temporal
.LockScreen = .T.
With ThisForm.Grid1
.RecordSourceType = 1
.RecordSource = 'Temp'
.Column1.ControlSource = 'Allt(Temp.NUMOPORT)'
.Column2.ControlSource = 'Allt(Temp.EMPRESA)'
.Column3.ControlSource = 'Allt(Temp.CONTACTO)'
.Column4.ControlSource = 'Allt(Temp.RESUMEN)'
.Column5.ControlSource = 'Temp.STATUS'
.Column6.ControlSource = 'Temp.VALOR'
.Column7.ControlSource = 'Allt(Temp.AGENTE)'
.Column8.ControlSource = 'MexDate3(Temp.CREADA)'
.Column9.ControlSource = 'Allt(Temp.TIPO)'
* Irme al inicio del temporal
Select Temp
Go Top
* Poner el cursor en el grid
.SetFocus()
EndWith
.LockScreen = .F.
* Almacenar en una propiedad de la forma el total de registros de Oport.dbf
.nOportTotReg = Reccount('Oport')
* Mostrar aviso si no se encontro informacion
If Reccount('Temp') == 0
Alerta('No se encontró información')
Else
* Habilitar el boton de excel
.Excel.Enabled = .T.
* Totalizar por tipos de oportunidad
.TotOport()
* Totalizar por probabilidad de cierre
.TotProbCierre()
EndIf
EndWith
ENDPROC
</methods>
<objcode/>
<ole/>
<ole2/>
<reserved1/>
<reserved2/>
<reserved3/>
<reserved4/>
<reserved5/>
<reserved6/>
<reserved7/>
<reserved8/>
<user/>
</record>
<record>
<platform>WINDOWS</platform>
<uniqueid>_49D0VSGLT</uniqueid>
<timestamp>1178369352</timestamp>
<class>boton</class>
<classloc>..\..\msllib60\msllib60.vcx</classloc>
<baseclass>commandbutton</baseclass>
<objname>nueva</objname>
<parent>Formamsl1</parent>
<properties>Top = 16
Left = 613
Height = 40
Width = 50
Picture = ..\..\msllib60\agregar.bmp
Caption = "\<Nueva"
TabIndex = 12
Name = "nueva"
</properties>
<protected/>
<methods>PROCEDURE Click
*
* Nueva
*
* Agregar una nueva oportunidad
*
Do DoModal With 'CrmCrearOport' In Crm
ENDPROC
</methods>
<objcode/>
<ole/>
<ole2/>
<reserved1/>
<reserved2/>
<reserved3/>
<reserved4/>
<reserved5/>
<reserved6/>
<reserved7/>
<reserved8/>
<user/>
</record>
<record>
<platform>WINDOWS</platform>
<uniqueid>_49D0WNJT6</uniqueid>
<timestamp>1178369352</timestamp>
<class>boton</class>
<classloc>..\..\msllib60\msllib60.vcx</classloc>
<baseclass>commandbutton</baseclass>
<objname>excel</objname>
<parent>Formamsl1</parent>
<properties>Top = 16
Left = 728
Height = 40
Width = 40
Picture = ..\..\msllib60\excel.bmp
Caption = "E\<xcel"
TabIndex = 14
Name = "excel"
</properties>
<protected/>
<methods>PROCEDURE Click
*
* Excel
*
* Envia a Excel la consulta
cNomCia = Allt(Cia.NOMCIA)
cTitulo = ThisForm.Caption
cColumnas = 'Id^Fecha^Tipo^Empresa^Contacto^Resúmen^Status^Valor^Agente^Prob. Cierre'
cMascaras = 'C^D^C^C^C^C^999,999,999.99^C^C'
OpenExcel(cNomCia,cTitulo,cColumnas,cMascaras)
ENDPROC
</methods>
<objcode/>
<ole/>
<ole2/>
<reserved1/>
<reserved2/>
<reserved3/>
<reserved4/>
<reserved5/>
<reserved6/>
<reserved7/>
<reserved8/>
<user/>
</record>
<record>
<platform>WINDOWS</platform>
<uniqueid>_49D0WNJT7</uniqueid>
<timestamp>1178369352</timestamp>
<class>grid</class>