-
Notifications
You must be signed in to change notification settings - Fork 0
/
CADBAN.PRG
160 lines (160 loc) · 4.7 KB
/
CADBAN.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
*****************************************************************************
* Funcao : CADBAN *
* Objetivo : Manuten‡Æo do Cadastro de BANCOS *
*****************************************************************************
FUNCTION CADBAN()
*
Local NCONTA, BANCO, AGENC, SALINI, SALATU, DTA
Local Tela, linha1, linha2
Private Getlist := {}
ABREBAN()
linha1 := savescreen(00,00,03,79)
linha2 := savescreen(21,00,24,79)
Setcolor ("bg+ /n,bg+ /n")
borda (03,00,21,79)
restscreen (00,00,03,79,linha1)
restscreen (21,00,24,79,linha2)
@ 02,41 say padc (" Cadastro de Contas ",38) color("w+/n")
Setcolor ("bg+ /n")
@ 08,14 clear to 15,65
@ 08,14 to 15,65
@ 09,16 say "N£mero da Conta..: "
@ 10,16 say "Conta / Banco....: "
@ 11,16 say "Agˆncia..........: "
@ 12,16 say "Saldo Inicial....: "
@ 13,16 say "Saldo Atual......: "
@ 14,16 say "Data.............: "
@ 22,01 clear to 22,78
@ 24,00 say padc("Esc-Sair Enter-Confirma F2-Consulta F5-Altera F6-Exclui "+chr(024)+chr(025)+chr(027)+chr(026)+" -Movimenta",78) color ("w+ /b")
Tela := Savescreen(00,00,24,79)
Do while .t.
SALINI := 0
SALATU := 0
DTA := date()
BANCO := space(30)
AGENC := 0
Restscreen(00,00,24,79,Tela)
set key -1 to l_ban()
set cursor on
Set Confirm on
BAN->(dBGoBottom())
NCONTA := ban->nconta + 1
if nconta = 1
banco := 'Conta do Caixa'
agenc := 0
@ 09,35 say nconta
@ 10,35 say BANCO
@ 11,35 say AGENC
@ 12,35 get SALINI pict "@e 999,999,999.99"
read
salatu := salini
@ 13,35 get SALATU pict "@e 999,999,999.99"
@ 14,35 get DTA
read
If Lastkey() = 27
Loop
Endif
If Confirma("InclusÆo")
BAN->(DBAPPEND())
BAN->NCONTA := NCONTA
BAN->BANCO := BANCO
BAN->AGENC := AGENC
BAN->SALINI := SALINI
BAN->SALATU := SALATU
BAN->DTA := DTA
Endif
loop
else
@ 09,35 get NCONTA pict "9999999999" valid NCONTA > 0
read
endif
@ 22,01 clear to 22,78
set key -1 to
set confirm off
If Lastkey() = 27
Exit
Endif
BAN->(dBSeek(str(NCONTA,10,0)))
if BAN->(Found())
set cursor off
@ 10,35 say BAN->BANCO
@ 11,35 say BAN->AGENC
@ 12,35 say transform(BAN->SALINI,"@e 999,999,999.99")
@ 13,35 say transform(BAN->SALatu,"@e 999,999,999.99")
@ 14,35 say BAN->DTA
Do While .t.
Inkey(0)
@ 22,01 clear to 22,78
If Lastkey() # 27 .and. Lastkey() # 13 .and. Lastkey() # -4 .and. Lastkey() # -5
Mens("Tecla Inv lida!!!",.t.,.t.)
Loop
Endif
Exit
Enddo
if lastkey() = 27 .or. lastkey() = 13
loop
endif
Do case
case Lastkey() = -5 && ExclusÆo
set cursor on
If Confirma("ExclusÆo")
if ban->nconta != 1
BAN->(Dbdelete())
else
mens('NÆo ‚ poss¡vel excluir conta do caixa !',.t.,.t.)
endif
Endif
Loop
case Lastkey() = -4 && Altera‡Æo
set cursor on
* NCONTA := BAN->NCONTA
BANCO := BAN->BANCO
AGENC := BAN->AGENC
SALINI := BAN->SALINI
SALATU := BAN->SALATU
DTA := BAN->DTA
* @ 09,35 get NCONTA pict "9999999999" valid nconta > 0
@ 10,35 get BANCO pict "@!" valid !empty(BANCO)
@ 11,35 get AGENC pict "99999"
@ 12,35 get SALINI pict "@e 999,999,999.99"
@ 13,35 get SALATU pict "@e 999,999,999.99"
@ 14,35 get DTA
read
If Lastkey() = 27
Loop
Endif
If Confirma("Altera‡Æo")
BAN->BANCO := BANCO
BAN->AGENC := AGENC
BAN->SALINI := SALINI
BAN->SALATU := SALATU
BAN->DTA := DTA
Endif
Loop
Endcase
else
@ 10,35 get BANCO pict "@!" valid !empty(BANCO)
@ 11,35 get AGENC pict "99999"
@ 12,35 get SALINI pict "@e 999,999,999.99"
read
salatu := salini
@ 13,35 get SALATU pict "@e 999,999,999.99"
@ 14,35 get DTA
read
If Lastkey() = 27
Loop
Endif
If Confirma("InclusÆo")
BAN->(DBAPPEND())
BAN->NCONTA := NCONTA
BAN->BANCO := BANCO
BAN->AGENC := AGENC
BAN->SALINI := SALINI
BAN->SALATU := SALATU
BAN->DTA := DTA
Endif
Endif
Enddo
Dbcloseall()
Set Cursor off
Return Nil