-
Notifications
You must be signed in to change notification settings - Fork 0
/
reservas.FRM
1320 lines (1010 loc) · 35.2 KB
/
reservas.FRM
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
VERSION 5.00
Object = "{F856EC8B-F03C-4515-BDC6-64CBD617566A}#6.0#0"; "fpSpr60.ocx"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Object = "{0002E558-0000-0000-C000-000000000046}#1.0#0"; "OWC11.DLL"
Begin VB.Form reservas_FRM
Caption = "Reservas"
ClientHeight = 9330
ClientLeft = 60
ClientTop = 450
ClientWidth = 14745
Icon = "reservas.frx":0000
LinkTopic = "Form1"
ScaleHeight = 9330
ScaleWidth = 14745
StartUpPosition = 2 'CenterScreen
Begin VB.Frame Frame3
Height = 7935
Left = 4995
TabIndex = 21
Top = 1305
Width = 9690
Begin OWC11.ChartSpace ChartSpace1
Height = 7665
Left = 90
OleObjectBlob = "reservas.frx":038A
TabIndex = 22
Top = 180
Width = 9510
End
End
Begin MSComDlg.CommonDialog ComOrigen
Left = 90
Top = 8775
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin MSComctlLib.ImageList ImageList1
Left = 585
Top = 8685
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 5
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "reservas.frx":105C
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "reservas.frx":13F6
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "reservas.frx":1790
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "reservas.frx":1B2A
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "reservas.frx":1EC4
Key = ""
EndProperty
EndProperty
End
Begin VB.Frame frmWellID
Height = 1275
Left = 90
TabIndex = 15
Top = 3825
Visible = 0 'False
Width = 4905
Begin VB.CommandButton cmdBuscarWellID
Height = 285
Left = 4320
Picture = "reservas.frx":225E
Style = 1 'Graphical
TabIndex = 19
Top = 405
Width = 510
End
Begin VB.ComboBox cmdWellID
Height = 315
Left = 135
TabIndex = 18
Top = 405
Width = 4110
End
Begin VB.CommandButton cmdCancelar
Caption = "&Cancelar"
Height = 285
Left = 3015
TabIndex = 17
Top = 855
Width = 1185
End
Begin VB.CommandButton cmdAgregarPozo
Caption = "&Agregar"
Height = 285
Left = 1755
TabIndex = 16
Top = 855
Width = 1185
End
Begin VB.Label Label5
Caption = "Well ID"
Height = 195
Left = 180
TabIndex = 20
Top = 180
Width = 2085
End
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 420
Left = 0
TabIndex = 14
Top = 0
Width = 14745
_ExtentX = 26009
_ExtentY = 741
ButtonWidth = 3281
Appearance = 1
TextAlignment = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 5
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Buscar pozos"
Key = "imp_pozos"
ImageIndex = 1
Style = 5
BeginProperty ButtonMenus {66833FEC-8583-11D1-B16A-00C0F0283628}
NumButtonMenus = 9
BeginProperty ButtonMenu1 {66833FEE-8583-11D1-B16A-00C0F0283628}
Key = "500m"
Text = "500"
EndProperty
BeginProperty ButtonMenu2 {66833FEE-8583-11D1-B16A-00C0F0283628}
Key = "550m"
Text = "550"
EndProperty
BeginProperty ButtonMenu3 {66833FEE-8583-11D1-B16A-00C0F0283628}
Key = "600m"
Text = "600"
EndProperty
BeginProperty ButtonMenu4 {66833FEE-8583-11D1-B16A-00C0F0283628}
Key = "650m"
Text = "650"
EndProperty
BeginProperty ButtonMenu5 {66833FEE-8583-11D1-B16A-00C0F0283628}
Key = "700m"
Text = "700"
EndProperty
BeginProperty ButtonMenu6 {66833FEE-8583-11D1-B16A-00C0F0283628}
Key = "750m"
Text = "750"
EndProperty
BeginProperty ButtonMenu7 {66833FEE-8583-11D1-B16A-00C0F0283628}
Key = "800m"
Text = "800"
EndProperty
BeginProperty ButtonMenu8 {66833FEE-8583-11D1-B16A-00C0F0283628}
Key = "850m"
Text = "850"
EndProperty
BeginProperty ButtonMenu9 {66833FEE-8583-11D1-B16A-00C0F0283628}
Key = "900m"
Text = "900"
EndProperty
EndProperty
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Agregar un pozo"
Key = "agregar_pozo"
ImageIndex = 2
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Eliminar un pozo"
Key = "eliminar_pozo"
ImageIndex = 3
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Importar producción"
Key = "imp_prod_actual"
ImageIndex = 1
Style = 5
BeginProperty ButtonMenus {66833FEC-8583-11D1-B16A-00C0F0283628}
NumButtonMenus = 3
BeginProperty ButtonMenu1 {66833FEE-8583-11D1-B16A-00C0F0283628}
Key = "pozo_actual"
Text = "Pozo actual desde Capitulo IV"
EndProperty
BeginProperty ButtonMenu2 {66833FEE-8583-11D1-B16A-00C0F0283628}
Key = "todos_pozos"
Text = "Todos los Pozos desde Capitulo IV"
EndProperty
BeginProperty ButtonMenu3 {66833FEE-8583-11D1-B16A-00C0F0283628}
Key = "pozo_actual_excel"
Text = "Pozo actual desde Excel"
EndProperty
EndProperty
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Graficar curva tipo"
Key = "graficar_curva"
ImageIndex = 5
Style = 5
BeginProperty ButtonMenus {66833FEC-8583-11D1-B16A-00C0F0283628}
NumButtonMenus = 2
BeginProperty ButtonMenu1 {66833FEE-8583-11D1-B16A-00C0F0283628}
Key = "36m"
Text = "36 meses"
EndProperty
BeginProperty ButtonMenu2 {66833FEE-8583-11D1-B16A-00C0F0283628}
Key = "120m"
Text = "120 meses"
EndProperty
EndProperty
EndProperty
EndProperty
BorderStyle = 1
End
Begin VB.Frame frmProd
Height = 5415
Left = 90
TabIndex = 10
Top = 3825
Width = 4905
Begin FPSpreadADO.fpSpread spdProd
Height = 4965
Left = 180
TabIndex = 11
Top = 360
Width = 4605
_Version = 393216
_ExtentX = 8123
_ExtentY = 8758
_StockProps = 64
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
SpreadDesigner = "reservas.frx":25E8
End
Begin VB.Label Label6
Caption = "Producción"
Height = 195
Left = 225
TabIndex = 12
Top = 135
Width = 960
End
End
Begin VB.Frame Frame2
Height = 2535
Left = 90
TabIndex = 7
Top = 1305
Width = 4905
Begin FPSpreadADO.fpSpread spdCercanos
Height = 2085
Left = 180
TabIndex = 8
Top = 360
Width = 4605
_Version = 393216
_ExtentX = 8123
_ExtentY = 3678
_StockProps = 64
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
SpreadDesigner = "reservas.frx":27BC
End
Begin VB.Label Label4
Caption = "Pozos Cercanos"
Height = 195
Left = 225
TabIndex = 9
Top = 135
Width = 1275
End
End
Begin VB.TextBox Text2
Height = 285
Left = 5805
TabIndex = 3
Top = 855
Width = 2445
End
Begin VB.Frame Frame1
Height = 825
Left = 90
TabIndex = 0
Top = 450
Width = 14595
Begin VB.CommandButton cmdTamano
Caption = "Maximizar gráfico"
Height = 330
Left = 13140
TabIndex = 23
Top = 360
Width = 1365
End
Begin VB.ComboBox cboUniqueID
Height = 315
Left = 135
TabIndex = 13
Text = "Combo1"
Top = 405
Width = 2445
End
Begin VB.CommandButton cmdBuscarUniqueID
Height = 285
Left = 2610
Picture = "reservas.frx":2990
Style = 1 'Graphical
TabIndex = 6
Top = 405
Width = 510
End
Begin VB.TextBox Text1
Height = 285
Left = 3375
TabIndex = 2
Top = 405
Width = 2220
End
Begin VB.Label Label3
Caption = "Northing"
Height = 195
Left = 5850
TabIndex = 5
Top = 180
Width = 2085
End
Begin VB.Label Label2
Caption = "Easting"
Height = 195
Left = 3420
TabIndex = 4
Top = 180
Width = 2085
End
Begin VB.Label Label1
Caption = "Unique ID"
Height = 195
Left = 180
TabIndex = 1
Top = 180
Width = 2085
End
End
End
Attribute VB_Name = "reservas_FRM"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim lngLeft, lngWidth As Long
Dim blnMax As Boolean
'fill grilla con produccion segun pozo seleccionado
'
Private Sub graficarCurva(ByVal strMeses As String)
Dim strT, strWellIDaux As String
Dim intI, intPozos As Integer
Dim rsCur, rsCer As ADODB.Recordset
'dim arrays
Dim asSeriesNames(1)
Dim aiValues()
'check si no selecciono ubicacion, exit
If Me.cboUniqueID.ListIndex < 0 Then
intI = MsgBox("No ha seleccionado un Unique ID aún.", vbCritical + vbApplicationModal, "Atención...")
Exit Sub
End If
'puntero mouse reloj
Screen.MousePointer = vbHourglass
strT = "select * from ubicacionesCurvasGra_vw where uniqueID = '" & Me.cboUniqueID.Text & "' order by orden"
'get datos
Set rsCur = SQLexec(strT)
'check error
If Not SQLparam.CnErrNumero = -1 Then
SQLError
SQLclose
'recupero puntero mouse
Screen.MousePointer = vbDefault
End
End If
strT = "select * from ubicacionesNorma_vw where IDcercano = " & Me.cboUniqueID.ItemData(Me.cboUniqueID.ListIndex) & " order by wellID, orden"
'get datos
Set rsCer = SQLexec(strT)
'check error
If Not SQLparam.CnErrNumero = -1 Then
SQLError
SQLclose
'recupero puntero mouse
Screen.MousePointer = vbDefault
End
End If
'
'comienzo de sistema de graficación
'
'initialize
intI = 0
'while valores curva tipo
Do While Not rsCur.EOF And intI < Val(strMeses)
'check si primera pasada
If intI = 0 Then
'asign nombre a serie
asSeriesNames(0) = rsCur!nombre
End If
'add 1 a contador
intI = intI + 1
'redim array
ReDim Preserve aiValues(intI)
'asign valor
aiValues(intI) = rsCur!OILdia
'siguiente
rsCur.MoveNext
Loop
'clear grafico
ChartSpace1.Clear
'build grafico dinamicamente
Set chConstants = ChartSpace1.Constants
'Add grafico
Set chtnewchart = ChartSpace1.Charts.Add
'set color fondo blanco
chtnewchart.PlotArea.Interior.Color = "white"
'Specify tipo de chart
chtnewchart.Type = chConstants.chChartTypeLineMarkers
'asign nombre de serie
chtnewchart.SetData chConstants.chDimSeriesNames, chConstants.chDataLiteral, asSeriesNames
'asign valores a serie1 curva tipo
chtnewchart.SeriesCollection(0).SetData chConstants.chDimValues, chConstants.chDataLiteral, aiValues
'set tañamo de marca de referencia
chtnewchart.SeriesCollection(0).Marker.Size = 2
'set color para linea, verde
chtnewchart.SeriesCollection(0).Line.Color = RGB(0, 100, 0)
'set color blanco interior
chtnewchart.Interior.Color = RGB(255, 255, 255)
'initialize
intPozos = 0
strWellIDaux = ""
'while produccion pozos cercanos
Do While Not rsCer.EOF
'clear array
For intI = 0 To Val(strMeses)
aiValues(intI) = Null
Next
'initialize
intI = 0
'add 1 a contador pozos
intPozos = intPozos + 1
'asign nombre serie
asSeriesNames(0) = rsCer!WellID
'save wellID anterior
strWellIDaux = rsCer!WellID
'while not EOF y mismo wellID
Do While Not rsCer.EOF
'check si wellID actual <> wellID anterior
If rsCer!WellID <> strWellIDaux Then
Exit Do
End If
'add 1 a contador
intI = intI + 1
'check contador de valores <= meses a graficar
If intI < Val(strMeses) Then
'asign valor
aiValues(intI) = rsCer!OILmes
End If
'siguiente
rsCer.MoveNext
Loop
'add serie nueva
chtnewchart.SeriesCollection.Add
'asign nombre de serie
chtnewchart.SeriesCollection(intPozos).SetData chConstants.chDimSeriesNames, chConstants.chDataLiteral, asSeriesNames
'asign valores a serie2...3...4...etc. para pozos cercanos
chtnewchart.SeriesCollection(intPozos).SetData chConstants.chDimValues, chConstants.chDataLiteral, aiValues
'set tañamo de marca de referencia
chtnewchart.SeriesCollection(intPozos).Marker.Size = 2
' 'set color para linea, verde
' Me.ChartSpace1.Charts(0).SeriesCollection(intPozos).Line.Color = RGB(0, 100, 0)
Loop
'set habilita logatitmo, lineas horizontales, color gris, unidad 10, titulo, tamaño letra
chtnewchart.Axes(chConstants.chAxisPositionValue).Scaling.Type = chScaleTypeLogarithmic
chtnewchart.Axes(chConstants.chAxisPositionValue).HasMinorGridlines = True
chtnewchart.Axes(chConstants.chAxisPositionValue).MajorGridlines.Line.Color = RGB(220, 220, 220)
chtnewchart.Axes(chConstants.chAxisPositionValue).MinorGridlines.Line.Color = RGB(220, 220, 220)
chtnewchart.Axes(chConstants.chAxisPositionValue).MajorUnit = 10
chtnewchart.Axes(chConstants.chAxisPositionValue).MinorUnit = 1
chtnewchart.Axes(chConstants.chAxisPositionValue).HasTitle = True
chtnewchart.Axes(chConstants.chAxisPositionValue).Title.Font.Size = 9
chtnewchart.Axes(chConstants.chAxisPositionValue).Title.Font.Bold = True
chtnewchart.Axes(chConstants.chAxisPositionValue).Title.Caption = "Rate (m3opd)"
'set habilita logatitmo, lineas horizontales, color gris, unidad 10, titulo, tamaño letra
chtnewchart.Axes(chConstants.chAxisPositionCategory).HasTitle = True
chtnewchart.Axes(chConstants.chAxisPositionCategory).Title.Font.Size = 9
chtnewchart.Axes(chConstants.chAxisPositionCategory).Title.Font.Bold = True
chtnewchart.Axes(chConstants.chAxisPositionCategory).Title.Caption = "Time months"
'check si 36 meses, set espacio 1, sino 5
If Val(strMeses) = 36 Then
chtnewchart.Axes(chConstants.chAxisPositionCategory).TickLabelSpacing = 1
Else
chtnewchart.Axes(chConstants.chAxisPositionCategory).TickLabelSpacing = 5
End If
'set leyenda series
chtnewchart.HasLegend = True
chtnewchart.Legend.Position = chLegendPositionTop
'close
SQLclose
'recupero puntero mouse
Screen.MousePointer = vbDefault
End Sub
'fill grilla con pozos cercanos, segun ubicacion seleccionada en comboBox
'
Private Sub fillPozos(ByVal intIDubicacion As Integer)
Dim rs As ADODB.Recordset
'build query
strT = "select * from ubiBuscaCercanos_vw where IDubicacion = " & str(intIDubicacion) & " order by [oil (m3/d)] desc"
'get datos
Set rs = SQLexec(strT)
'check error
If Not SQLparam.CnErrNumero = -1 Then
SQLError
SQLclose
End
End If
'clear
Me.spdCercanos.ClearRange 1, 1, Me.spdCercanos.MaxRows, Me.spdCercanos.MaxCols, True
'assign rs a grilla
Me.spdCercanos.DataSource = rs.DataSource
'close
SQLclose
End Sub
'fill grilla con produccion segun pozo seleccionado
'
Private Sub fillPozoPM(ByVal intIDcercano As Integer, ByVal intIDpozo As Integer)
Dim rs As ADODB.Recordset
'puntero mouse reloj
Screen.MousePointer = vbHourglass
'build query
strT = "select * from ubiBuscaCercanosPM_vw where IDcercano = " & str(intIDcercano) & " and IDpozo = " & intIDpozo & " order by date desc"
'get datos
Set rs = SQLexec(strT)
'check error
If Not SQLparam.CnErrNumero = -1 Then
SQLError
SQLclose
'recupero puntero mouse
Screen.MousePointer = vbDefault
End
End If
'activa cambio en background
Me.spdProd.ReDraw = False
'clear
Me.spdProd.ClearRange 1, 1, Me.spdProd.MaxRows, Me.spdProd.MaxCols, True
'assign rs a grilla
Me.spdProd.DataSource = rs.DataSource
'activa cambio en foreground
Me.spdProd.ReDraw = True
'close
SQLclose
'recupero puntero mouse
Screen.MousePointer = vbDefault
End Sub
'llena comboBox con ubicaciones, permite busqueda
'
Private Sub fillUbicaciones(ByVal strCriterio As String)
'build condicion
If strCriterio = "" Then
strCriterio = "%"
Else
strCriterio = "%" & strCriterio & "%"
End If
'build query
strT = "select id, uniqueID, IDcurva from ubicaciones where uniqueID like '" & strCriterio & "' order by uniqueID"
'get ubicaciones
Set rs = SQLexec(strT)
'chequeo error
If Not SQLparam.CnErrNumero = -1 Then
SQLError
SQLclose
End
End If
'clear combo
Me.cboUniqueID.Clear
'recorro
While Not rs.EOF
'add texto y id a combo
Me.cboUniqueID.AddItem rs!uniqueID
Me.cboUniqueID.ItemData(Me.cboUniqueID.NewIndex) = rs!ID
'siguiente
rs.MoveNext
Wend
'close
SQLclose
End Sub
'get pozos Cercanos segun ubicacion seleccionada en comboBox
'
Private Sub cboUniqueID_Click()
Dim blnB As Boolean
'check si no selecciono item, exit
If Me.cboUniqueID.ListIndex < 0 Then
Exit Sub
End If
'fill cercanos
Call fillPozos(Me.cboUniqueID.ItemData(Me.cboUniqueID.ListIndex))
End Sub
'importa pozos cercanos segun distancia
'
Private Sub importarPozos(ByVal strDistancia As String)
Dim intI As Integer
'check si no selecciono ubicacion, exit
If Me.cboUniqueID.ListIndex < 0 Then
intI = MsgBox("No ha seleccionado Unique ID aún.", vbCritical + vbApplicationModal, "Atención...")
Exit Sub
End If
'check si existen pozos
If Me.spdCercanos.DataRowCnt > 0 Then
intI = MsgBox("Se encontraron pozos ya importados, si desea continuar, los mismos serán reemplazados.", vbQuestion + vbYesNo, "Atención...")
If intI = 7 Then
Exit Sub
End If
End If
'build
strT = "exec ubiImportarPozos_INS_sp " & Me.cboUniqueID.ItemData(Me.cboUniqueID.ListIndex) & "," & strDistancia
'exec
Set rs = SQLexec(strT)
'chequeo error
If Not SQLparam.CnErrNumero = -1 Then
SQLError
SQLclose
End
End If
'call cercanos
Call fillPozos(Me.cboUniqueID.ItemData(Me.cboUniqueID.ListIndex))
End Sub
'importa producción mensual T: para todos los pozos, A: para pozo actual
'
Private Sub importarProdCapituloIV(ByVal strCriterio As String)
Dim intRow, intRow1, intRow2, intI As Integer
Dim varIDcercano, varIDpozo As Variant
Dim rs As ADODB.Recordset
'check si puede importar
If Me.spdCercanos.DataRowCnt = 0 Then
intI = MsgBox("No hay pozos dsiponibles.", vbCritical + vbApplicationModal, "Atención...")
Exit Sub
End If
'puntero mouse reloj
Screen.MousePointer = vbHourglass
'set limites
If strCriterio = "T" Then
intRow1 = 1
intRow2 = Me.spdCercanos.DataRowCnt
Else
intRow1 = Me.spdCercanos.ActiveRow
intRow2 = Me.spdCercanos.ActiveRow
End If
'while pozos cercanos
For intRow = intRow1 To intRow2
'get IDubicacion
Me.spdCercanos.GetText 5, intRow, varIDcercano
'get IDpozo
Me.spdCercanos.GetText 6, intRow, varIDpozo
'build
strT = "exec ubiImportarProdCapituloIV_INS_sp " & varIDcercano & "," & varIDpozo
'exec
Set rs = SQLexec(strT)
'chequeo error
If Not SQLparam.CnErrNumero = -1 Then
SQLError
SQLclose
'recupero puntero mouse
Screen.MousePointer = vbDefault
End
End If
Next
'close
SQLclose
'recupero puntero mouse
Screen.MousePointer = vbDefault
'show mensaje
intI = MsgBox("La importación se realizó con éxito.", vbInformation + vbApplicationModal, "Atención...")
'fill grilla con produccion para pozo cercano actual
Call fillPozoPM(varIDcercano, varIDpozo)
End Sub
'importa producción mensual para todos los pozos desde axcel
'
Private Sub importarProdExcel()
Dim intRow, intI As Integer
Dim strWellID As String
Dim dtmFecha As Date
Dim sngVolumen As Single
Dim rs As ADODB.Recordset
Dim excApp As Excel.Application
Dim excInfo As Excel.Workbook
Dim varIDcercano, varIDpozo As Variant
'check si puede importar
If Me.spdCercanos.DataRowCnt = 0 Then
intI = MsgBox("No hay pozos dsiponibles.", vbCritical + vbApplicationModal, "Atención...")
Exit Sub
End If
'si formato excel filtro xls
Me.ComOrigen.Filter = "Archivos de Excel (*.xls)|*.xls"
'titulo de ventana
Me.ComOrigen.DialogTitle = "Seleccionar archivo..."
Me.ComOrigen.FileName = ""
'abro cuadro de dialogo
Me.ComOrigen.ShowOpen
'si cancelar salgo
If Me.ComOrigen.FileName = "" Then
Exit Sub
End If
'open excel
Set excApp = New Excel.Application
Set excInfo = excApp.Workbooks.Open(Me.ComOrigen.FileName)
'check error de apertura
'puntero mouse reloj
Screen.MousePointer = vbHourglass
'get IDubicacion
Me.spdCercanos.GetText 5, Me.spdCercanos.ActiveRow, varIDcercano
'get IDpozo
Me.spdCercanos.GetText 6, Me.spdCercanos.ActiveRow, varIDpozo
'build, delete pozo
strT = "exec ubiImportarProdExcel_ELI_sp " & varIDcercano & "," & varIDpozo
'exec
Set rs = SQLexec(strT)
'chequeo error
If Not SQLparam.CnErrNumero = -1 Then
SQLError
SQLclose
'recupero puntero mouse
Screen.MousePointer = vbDefault
End
End If
'initialize
intRow = 2
'while excel cuando no encuentra wellID, corta
Do While excInfo.Sheets.Application.Cells(intRow, 1).Text <> ""
'save wellID, fecha, volumen
strWellID = excInfo.Sheets.Application.Cells(intRow, 1).Text
dtmFecha = excInfo.Sheets.Application.Cells(intRow, 2).Text
sngVolumen = excInfo.Sheets.Application.Cells(intRow, 3).Text
'check si null, asign 0
If IsNull(sngVolumen) Then
sngVolumen = 0
End If
'check si wellID de excel = a WellID de grilla pozos
intI = Me.spdCercanos.SearchCol(1, Me.spdCercanos.ActiveRow - 1, Me.spdCercanos.ActiveRow, strWellID, SearchFlagsNone)
'check si encontro WellID en grilla pozos
If intI > 0 Then
'build, insert pozo
strT = "exec ubiImportarProdExcel_INS_sp " & varIDcercano & "," & varIDpozo & ",'" & dateToIso(dtmFecha) & "'," & sngVolumen
'exec
Set rs = SQLexec(strT)
'chequeo error
If Not SQLparam.CnErrNumero = -1 Then
SQLError
SQLclose
'recupero puntero mouse
Screen.MousePointer = vbDefault
End
End If
End If
'add 1 contador fila
intRow = intRow + 1
Loop
'close Workbook y Excel
excInfo.Close
excApp.Quit
'recupero puntero mouse
Screen.MousePointer = vbDefault
intI = MsgBox("La importación se realizó con éxito..", vbInformation + vbApplicationModal, "Atención...")
'fill grilla con produccion
Call fillPozoPM(varIDcercano, varIDpozo)
End Sub
'agrega pozo en forma manual
'
Private Sub cmdAgregarPozo_Click()
Dim intI As Integer
'check si no selecciono ubicacion, exit
If Me.cmdWellID.ListIndex < 0 Then
intI = MsgBox("No ha seleccionado un WellID aún.", vbCritical + vbApplicationModal, "Atención...")
Exit Sub
End If