View difference between Paste ID: VXRuSBjj and rDYdzHJj
SHOW: | | - or go back to the newest paste.
1
ub login()
2-
If Date > #2/28/2011# Then
2+
If Date > #2/28/2014# Then
3
MsgBox "O prazo de validade deste aplicativo expirou, pegue uma nova versão em www.sr2604.mg.caixa", vbCritical, "Proteção..."
4
End
5
End If
6
If Plan1.OptionButton4 = True Then
7
    If Plan1.TextBox1.TextLength < Plan1.TextBox1.MaxLength Or Plan1.TextBox2.TextLength < Plan1.TextBox2.MaxLength Then
8
        MsgBox "Preencha TODOS os campos do contrato!", vbCritical
9
        End
10
    End If
11
    If Plan1.OptionButton1 = True Then
12
        Load Form_Login
13
        Form_Login.Show
14
    End If
15
    Macro
16
End If
17
If Plan1.OptionButton5 = True Then
18
    If Plan1.TextBox4.TextLength < Plan1.TextBox4.MaxLength Or Plan1.TextBox5.TextLength < Plan1.TextBox5.MaxLength Then
19
        MsgBox "Preencha TODOS os campos do CPF!", vbCritical
20
        End
21
    End If
22
    Load Form_Login
23
    Form_Login.Show
24
    Macro2
25
End If
26
End Sub
27
Sub Macro()
28
    '--------------------------------------------------------------------------------------------
29
    Dim Sess0 As ExtraSession
30
    Dim System As ExtraSystem
31
    Dim tela As ExtraScreen
32
    Set System = CreateObject("EXTRA.System")
33
    Set Sess0 = System.ActiveSession
34
    If (Sess0 Is Nothing) Then
35
        MsgBox "Programa Rede Caixa não está aberto!", vbCritical
36
        Exit Sub
37
    End If
38
    Set tela = Sess0.Screen
39
    System.TimeoutValue = 5000
40
    tempo = 5000
41
    '--------------------------------------------------------------------------------------------
42
    If Plan1.OptionButton1 = True Then
43
        '--------------------------------------------------------------------------------------------
44
        If Trim(tela.GetString(17, 17, 10)) <> "SELECIONE" And _
45
        Trim(tela.GetString(17, 16, 10)) <> "SELECIONE" Then
46
            MsgBox "Você não está na Tela Incial do Rede Caixa!", vbCritical, "Erro Fatal!"
47
            tela.SendKeys ("<pf3><pf12><pf1>")
48
            End
49
        End If
50
        '--------------------------------------------------------------------------------------------
51
        tela.SendKeys ("<home>")
52
        tela.SendKeys ("520<enter>")
53
        '--------------------------------------------------------------------------------------------
54
        cont = 0
55
        Do While tela.GetString(16, 10, 5) <> "SIGLA" And cont < tempo:
56
            cont = cont + 1
57
        Loop
58
        If cont = tempo Then
59
            MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!"
60
            End
61
        End If
62
        '--------------------------------------------------------------------------------------------
63
        tela.SendKeys (Form_Login.login.Value)
64
        tela.SendKeys (Form_Login.senha.Value)
65
        tela.SendKeys ("<enter>")
66
        '--------------------------------------------------------------------------------------------
67
        cont = 0
68
        While tela.OIA.XStatus <> 0 And cont < tempo:
69
            cont = cont + 1
70
        Wend
71
        If cont = tempo Then
72
            MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!"
73
            End
74
        End If
75
        '--------------------------------------------------------------------------------------------
76
        tela.SendKeys ("<tab>6020<enter>")
77
        '--------------------------------------------------------------------------------------------
78
        cont = 0
79
        While tela.OIA.XStatus <> 0 And cont < tempo:
80
            cont = cont + 1
81
        Wend
82
        If cont = tempo Then
83
            MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!"
84
            End
85
        End If
86
        '--------------------------------------------------------------------------------------------
87
        If Trim(tela.GetString(5, 5, 6)) = "SENHOR" Then
88
            tela.SendKeys ("<enter>")
89
        End If
90
        '--------------------------------------------------------------------------------------------
91
        If Trim(tela.GetString(24, 1, 4)) = "BASE" Then
92
            MsgBox "BASE DE DADOS INDISPONIVEL NO MOMENTO!", vbCritical, "Erro Fatal!"
93
            End
94
        End If
95
        '--------------------------------------------------------------------------------------------
96
        cont = 0
97
        While tela.OIA.XStatus <> 0 And cont < tempo:
98
            cont = cont + 1
99
        Wend
100
        If cont = tempo Then
101
            MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!"
102
            End
103
        End If
104
        '--------------------------------------------------------------------------------------------
105
        If Trim(tela.GetString(24, 1, 4)) = "BASE" Then
106
            MsgBox "BASE DE DADOS INDISPONIVEL NO MOMENTO!", vbCritical, "Erro Fatal!"
107
            End
108
        End If
109
        '--------------------------------------------------------------------------------------------
110
        tela.SendKeys ("01<enter>")
111
        '--------------------------------------------------------------------------------------------
112
    End If
113
    '--------------------------------------------------------------------------------------------
114
    cont = 0
115
    While tela.OIA.XStatus <> 0 And cont < tempo:
116
        cont = cont + 1
117
    Wend
118
    If cont = tempo Then
119
        MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!"
120
        End
121
    End If
122
    '--------------------------------------------------------------------------------------------
123
    If Plan1.OptionButton3.Value = True Then
124
        If Trim(tela.GetString(5, 2, 7)) <> "CLIENTE" Then
125
            MsgBox "Você não está na tela de dívida da Rede Caixa!", vbCritical
126
            End
127
        End If
128
        tela.SendKeys ("<home>              ")
129
    End If
130
    '--------------------------------------------------------------------------------------------
131
    If Plan1.OptionButton2.Value = False Then
132
       '--------------------------------------------------------------------------------------------
133
       tela.SendKeys ("<home>")
134
       tela.SendKeys (Plan1.TextBox1.Text)
135
       tela.SendKeys (Plan1.TextBox2.Text)
136
       tela.SendKeys (Plan1.TextBox3.Text)
137
       tela.SendKeys ("<enter>")
138
       '--------------------------------------------------------------------------------------------
139
       cont = 0
140
       While tela.OIA.XStatus <> 0 And cont < tempo:
141
            cont = cont + 1
142
       Wend
143
       If cont = tempo Then
144
            MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!"
145
            End
146
       End If
147
       '--------------------------------------------------------------------------------------------
148
    End If
149
    '--------------------------------------------------------------------------------------------
150
    Limpar
151
    '--------------------------------------------------------------------------------------------
152
    'PEGA OS DADOS NA TELA
153
    '--------------------------------------------------------------------------------------------
154
    SUREG = Trim(tela.GetString(4, 10, 2))
155
    AGENCIA = Trim(tela.GetString(4, 17, 4))
156
    OPER = Trim(tela.GetString(4, 29, 3))
157
    NUMCONTR = Trim(tela.GetString(4, 44, 7))
158
    DVCONTR = tela.GetString(4, 52, 2)
159
    CLIENTE = Trim(tela.GetString(5, 15, 35))
160
    DIA = Trim(tela.GetString(4, 67, 2))
161
    MES = Trim(tela.GetString(4, 72, 2))
162
    ANO = Trim(tela.GetString(4, 77, 4))
163
    VALOR = Trim(tela.GetString(10, 34, 46))
164
    '--------------------------------------------------------------------------------------------
165
    If VALOR = "--------" Then
166
        VALOR = Trim(tela.GetString(9, 34, 46))
167
        MsgBox "O Contrato está em CA!", vbCritical
168
    End If
169
    '--------------------------------------------------------------------------------------------
170
    'JOGA OS DADOS NO FORMULÁRIO
171
    '--------------------------------------------------------------------------------------------
172
    Plan1.Range("AA6") = SUREG
173
    Plan1.Range("AF6") = AGENCIA
174
    Plan1.Range("AK6") = OPER
175
    Plan1.Range("AP6") = NUMCONTR
176
    Plan1.Range("AY6") = DVCONTR
177
    Plan1.Label8.Caption = CLIENTE
178
    Plan1.Range("D6") = CLIENTE
179
    Plan1.Range("AI10") = DIA
180
    Plan1.Range("AK10") = "/   " + MES
181
    Plan1.Range("AN10") = "/ " + ANO
182
    Plan1.Range("A62") = "R$ " + VALOR
183
    Plan1.Range("I26") = "0"
184
    Plan2.Range("B25") = "Liquidação do contrato " + AGENCIA + "." + OPER + "." + NUMCONTR + "-" + DVCONTR + " de "
185
    Plan2.Range("B27") = CLIENTE + " em operação de renovação."
186
    
187
End Sub
188
Sub Macro2()
189
    '--------------------------------------------------------------------------------------------
190
    Dim Sess0 As ExtraSession
191
    Dim System As ExtraSystem
192
    Dim tela As ExtraScreen
193
    Set System = CreateObject("EXTRA.System")
194
    Set Sess0 = System.ActiveSession
195
    If (Sess0 Is Nothing) Then
196
        MsgBox "Programa Rede Caixa não está aberto!", vbCritical
197
        Exit Sub
198
    End If
199
    Set tela = Sess0.Screen
200
    System.TimeoutValue = 5000
201
    tempo = 5000
202
    '--------------------------------------------------------------------------------------------
203
    If Trim(tela.GetString(17, 17, 10)) <> "SELECIONE" And _
204
        Trim(tela.GetString(17, 16, 10)) <> "SELECIONE" Then
205
        MsgBox "Você não está na Tela Incial do Rede Caixa!", vbCritical, "Erro Fatal!"
206
        tela.SendKeys ("<pf3><pf12><pf1>")
207
        End
208
    End If
209
    '--------------------------------------------------------------------------------------------
210
    tela.SendKeys ("<home>")
211
    tela.SendKeys ("520<enter>")
212
    '--------------------------------------------------------------------------------------------
213
    cont = 0
214
    Do While tela.GetString(16, 10, 5) <> "SIGLA" And cont < tempo:
215
        cont = cont + 1
216
    Loop
217
    If cont = tempo Then
218
        MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!"
219
        End
220
    End If
221
    '--------------------------------------------------------------------------------------------
222
    tela.SendKeys (Form_Login.login.Value)
223
    tela.SendKeys (Form_Login.senha.Value)
224
    tela.SendKeys ("<enter>")
225
    '--------------------------------------------------------------------------------------------
226
    cont = 0
227
    While tela.OIA.XStatus <> 0 And cont < tempo:
228
        cont = cont + 1
229
    Wend
230
    If cont = tempo Then
231
        MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!"
232
        End
233
    End If
234
    '--------------------------------------------------------------------------------------------
235
    tela.SendKeys ("<tab>0520<enter>")
236
    '--------------------------------------------------------------------------------------------
237
    cont = 0
238
    While tela.OIA.XStatus <> 0 And cont < tempo:
239
        cont = cont + 1
240
    Wend
241
    If cont = tempo Then
242
        MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!"
243
        End
244
    End If
245
    '--------------------------------------------------------------------------------------------
246
    If Trim(tela.GetString(5, 5, 6)) = "SENHOR" Then
247
        tela.SendKeys ("<enter>")
248
    End If
249
    '--------------------------------------------------------------------------------------------
250
    If Trim(tela.GetString(24, 1, 4)) = "BASE" Then
251
        MsgBox "BASE DE DADOS INDISPONIVEL NO MOMENTO!", vbCritical, "Erro Fatal!"
252
        End
253
    End If
254
    '--------------------------------------------------------------------------------------------
255
    cont = 0
256
    While tela.OIA.XStatus <> 0 And cont < tempo:
257
        cont = cont + 1
258
    Wend
259
    If cont = tempo Then
260
        MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!"
261
        End
262
    End If
263
    '--------------------------------------------------------------------------------------------
264
    If Trim(tela.GetString(24, 1, 4)) = "BASE" Then
265
        MsgBox "BASE DE DADOS INDISPONIVEL NO MOMENTO!", vbCritical, "Erro Fatal!"
266
        End
267
    End If
268
    '--------------------------------------------------------------------------------------------
269
    tela.SendKeys ("1<enter>")
270
    '--------------------------------------------------------------------------------------------
271
    cont = 0
272
    While tela.OIA.XStatus <> 0 And cont < tempo:
273
        cont = cont + 1
274
    Wend
275
    If cont = tempo Then
276
        MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!"
277
        End
278
    End If
279
    '--------------------------------------------------------------------------------------------
280
    tela.SendKeys (Plan1.TextBox4.Text)
281
    tela.SendKeys ("<tab>")
282
    tela.SendKeys (Plan1.TextBox5.Text)
283
    tela.SendKeys ("<enter>")
284
    '--------------------------------------------------------------------------------------------
285
    cont = 0
286
    While tela.OIA.XStatus <> 0 And cont < tempo:
287
        cont = cont + 1
288
    Wend
289
    If cont = tempo Then
290
        MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!"
291
        End
292
    End If
293
    '--------------------------------------------------------------------------------------------
294
    tela.SendKeys ("<enter>")
295
    '--------------------------------------------------------------------------------------------
296
    cont = 0
297
    While tela.OIA.XStatus <> 0 And cont < tempo:
298
        cont = cont + 1
299
    Wend
300
    If cont = tempo Then
301
        MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!"
302
        End
303
    End If
304
    '--------------------------------------------------------------------------------------------
305
    Limpar
306
    '--------------------------------------------------------------------------------------------
307
    Plan1.Label8.Caption = Trim(tela.GetString(5, 31, 50)) 'Nome do Cliente
308
    '--------------------------------------------------------------------------------------------
309
    PAGINA = 0
310
    cont2 = 0
311
    While Trim(tela.GetString(20, 77, 4)) <> PAGINA And cont < tempo:
312
        '--------------------------------------------------------------------------------------------
313
        If Trim(tela.GetString(10, 24, 4)) = "" Then
314
            MsgBox "O CLIENTE NÃO POSSUI CONTRATOS!", vbCritical, "Erro Fatal!"
315
            End
316
        End If
317
        '--------------------------------------------------------------------------------------------
318
        If Trim(tela.GetString(11, 2, 19)) = "NORMAL" Or Trim(tela.GetString(11, 2, 19)) = "CREDITO EM ATRASO" Then
319
            Plan1.ComboBox1.AddItem (Trim(tela.GetString(10, 24, 4)) + Trim(tela.GetString(10, 29, 3)) + Trim(tela.GetString(10, 33, 7)))
320
        End If
321
        '--------------------------------------------------------------------------------------------
322
        If Trim(tela.GetString(14, 2, 19)) = "NORMAL" Or Trim(tela.GetString(14, 2, 19)) = "CREDITO EM ATRASO" Then
323
            Plan1.ComboBox1.AddItem (Trim(tela.GetString(13, 24, 4)) + Trim(tela.GetString(13, 29, 3)) + Trim(tela.GetString(13, 33, 7)))
324
        End If
325
        '--------------------------------------------------------------------------------------------
326
        If Trim(tela.GetString(17, 2, 19)) = "NORMAL" Or Trim(tela.GetString(17, 2, 19)) = "CREDITO EM ATRASO" Then
327
            Plan1.ComboBox1.AddItem (Trim(tela.GetString(16, 24, 4)) + Trim(tela.GetString(16, 29, 3)) + Trim(tela.GetString(16, 33, 7)))
328
        End If
329
        '--------------------------------------------------------------------------------------------
330
        PAGINA = Trim(tela.GetString(20, 77, 4))
331
        '--------------------------------------------------------------------------------------------
332
        tela.SendKeys ("<pf8>")
333
        '--------------------------------------------------------------------------------------------
334
        cont2 = cont2 + 1
335
        '--------------------------------------------------------------------------------------------
336
        cont = 0
337
        While tela.OIA.XStatus <> 0 And cont < tempo:
338
            cont = cont + 1
339
        Wend
340
        If cont = tempo Then
341
            MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!"
342
            End
343
        End If
344
        
345
    Wend
346
    '--------------------------------------------------------------------------------------------
347
    If cont2 = tempo Then
348
        MsgBox "Ocorreu um erro no processamento das informações , repita o procedimento!", vbCritical, "Erro Fatal!"
349
        End
350
    End If
351
    '--------------------------------------------------------------------------------------------
352
    tela.SendKeys ("<pf3>")
353
    '--------------------------------------------------------------------------------------------
354
    cont = 0
355
    While tela.OIA.XStatus <> 0 And cont < tempo:
356
        cont = cont + 1
357
    Wend
358
    If cont = tempo Then
359
        MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!"
360
        End
361
    End If
362
    '--------------------------------------------------------------------------------------------
363
    tela.SendKeys ("<pf3>")
364
    '--------------------------------------------------------------------------------------------
365
    cont = 0
366
    While tela.OIA.XStatus <> 0 And cont < tempo:
367
        cont = cont + 1
368
    Wend
369
    If cont = tempo Then
370
        MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!"
371
        End
372
    End If
373
    '--------------------------------------------------------------------------------------------
374
    tela.SendKeys ("<pf3>")
375
    '--------------------------------------------------------------------------------------------
376
    cont = 0
377
    While tela.OIA.XStatus <> 0 And cont < tempo:
378
        cont = cont + 1
379
    Wend
380
    If cont = tempo Then
381
        MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!"
382
        End
383
    End If
384
    '--------------------------------------------------------------------------------------------
385
    tela.SendKeys ("<tab>6020<enter>")
386
    '--------------------------------------------------------------------------------------------
387
    cont = 0
388
    While tela.OIA.XStatus <> 0 And cont < tempo:
389
        cont = cont + 1
390
    Wend
391
    If cont = tempo Then
392
        MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!"
393
        End
394
    End If
395
    '--------------------------------------------------------------------------------------------
396
    If Trim(tela.GetString(5, 5, 6)) = "SENHOR" Then
397
        tela.SendKeys ("<enter>")
398
    End If
399
    '--------------------------------------------------------------------------------------------
400
    cont = 0
401
    While tela.OIA.XStatus <> 0 And cont < tempo:
402
        cont = cont + 1
403
    Wend
404
    If cont = tempo Then
405
        MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!"
406
        End
407
    End If
408
    '--------------------------------------------------------------------------------------------
409
    If Trim(tela.GetString(24, 1, 4)) = "BASE" Then
410
        MsgBox "BASE DE DADOS INDISPONIVEL NO MOMENTO!", vbCritical, "Erro Fatal!"
411
        End
412
    End If
413
    '--------------------------------------------------------------------------------------------
414
    tela.SendKeys ("01<enter>")
415
    '--------------------------------------------------------------------------------------------
416
    cont = 0
417
    While tela.OIA.XStatus <> 0 And cont < tempo:
418
        cont = cont + 1
419
    Wend
420
    If cont = tempo Then
421
        MsgBox "A REDE CAIXA não RESPONDE, repita o procedimento!", vbCritical, "Erro Fatal!"
422
        End
423
    End If
424
     '--------------------------------------------------------------------------------------------
425
End Sub
426
427
Sub Limpar()
428
429
    Plan1.Range("AA6") = " "
430
    Plan1.Range("AF6") = " "
431
    Plan1.Range("AK6") = " "
432
    Plan1.Range("AP6") = " "
433
    Plan1.Range("AY6") = " "
434
    Plan1.Range("D6") = " "
435
    Plan1.Range("AI10") = " "
436
    Plan1.Range("AK10") = " "
437
    Plan1.Range("AN10") = " "
438
    Plan1.Range("A62") = "0,00"
439
    Plan1.Range("I26") = "0,00"
440
    Plan1.Range("D16") = " "
441
    Plan1.Range("L16") = " "
442
    Plan1.Range("P16") = "0,00"
443
    Plan1.Range("AA16") = " "
444
    Plan1.Range("AF16") = "0,00"
445
    Plan1.Range("AO16") = " "
446
    Plan1.Range("AT16") = "0,00"
447
    Plan1.Range("D21") = " "
448
    Plan1.Range("P21") = "0,00"
449
    Plan1.Range("AA21") = " "
450
    Plan1.Range("AF21") = "0,00"
451
    Plan1.Range("AO21") = " "
452
    Plan1.Range("AT21") = "0,00"
453
    Plan1.Range("AF26") = " "
454
    Plan1.Range("AO26") = " "
455
    Plan1.Range("AT26") = "0,00"
456
    Plan2.Range("B25") = " "
457
    Plan1.Label8.Caption = "" 'Cliente
458
    '--------------------------------------------------------------------------------------------
459
    If Plan1.OptionButton4 = True Then
460
        Plan1.TextBox1.Text = "" 'AG
461
        Plan1.TextBox2.Text = "" 'OP
462
        Plan1.TextBox3.Text = "" 'Nº Conta
463
    End If
464
    '--------------------------------------------------------------------------------------------
465
    If Plan1.OptionButton5 = True Then
466
        Plan1.TextBox4.Text = "" 'CPF
467
        Plan1.TextBox5.Text = "" 'CPF DV
468
        Plan1.ComboBox1.Clear 'Contratos
469
    End If
470
    '--------------------------------------------------------------------------------------------
471
End Sub