Desglose

Anuncio
desglose.txt
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
14/05/2005 11:28
'-----------------------------------------------------------------------------'// Programa ..... DESGLOSE MONETARIO
'// Autor ........ Jesús P.M. (zttSoft.com)
'// Fecha ........ 12/05/2005 * Mod 13/05/2005
'-----------------------------------------------------------------------------Option Explicit
Dim Resto As Double
Dim pEntera As Double
Dim pDecimal As Double
Dim Imagen(14) As Picture
Dim Valor(14) As Double
Dim Tipos(14) As Double
'-----------------------------------------------------------------------------Public Function Centimos(N As Double, T As Double) As Integer
Centimos = Int(Round((N / T), 3))
pDecimal = ((N / T) - Centimos) * T
End Function
'-----------------------------------------------------------------------------Public Function Desglose(N As Double, T As Double) As Integer
Desglose = N \ T
Resto = N Mod T
End Function
'-----------------------------------------------------------------------------Private Sub cmdBORRAR_Click()
Caja.Locked = False
Caja.Text = ""
Caja.Locked = True
End Sub
'-----------------------------------------------------------------------------Private Sub cmdDESGLOSE_Click()
Dim Cantidad As Double
Dim i As Integer
Dim Subtotal As Double
Cantidad = Text1.Text
pEntera = Int(Cantidad)
pDecimal = Round(Cantidad - Int(Cantidad), 3)
Tipos(0) = Desglose(pEntera, 500)
Tipos(1) = Desglose(Resto, 200)
Tipos(2) = Desglose(Resto, 100)
Tipos(3) = Desglose(Resto, 50)
Tipos(4) = Desglose(Resto, 20)
Tipos(5) = Desglose(Resto, 10)
Tipos(6) = Desglose(Resto, 5)
Tipos(7) = Desglose(Resto, 2)
Tipos(8) = Desglose(Resto, 1)
Tipos(9) = Centimos(pDecimal, 0.5)
Tipos(10) = Centimos(pDecimal, 0.2)
Tipos(11) = Centimos(pDecimal, 0.1)
Tipos(12) = Centimos(pDecimal, 0.05)
Tipos(13) = Centimos(pDecimal, 0.02)
Tipos(14) = Centimos(pDecimal, 0.01)
'----------------------------------------------Caja.Locked = False
Caja.Text = ""
Caja.SetFocus
Caja.SelFontSize = 16
Caja.SelCharOffset = 400
For i = 0 To 14
If Tipos(i) <> 0 Then
Clipboard.Clear
Clipboard.SetText Str(Tipos(i)) + " de "
SendKeys "^{V}", True
Clipboard.Clear
Clipboard.SetData Imagen(i)
SendKeys "^{V}", True
Subtotal = Tipos(i) * Valor(i)
Clipboard.Clear
Clipboard.SetText " = " + Str(Subtotal) + " €"
SendKeys "^{V}", True ' Ctrl+V
SendKeys "~", True 'intro
End If
Page 1 of 2
desglose.txt
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
14/05/2005 11:28
Next
Caja.Locked = True
End Sub
'-----------------------------------------------------------------------------Private Sub cmdSALIR_Click()
End
End Sub
'-----------------------------------------------------------------------------Private Sub Form_Load()
Dim Moneda(14) As String
Dim i As Integer
Valor(0) = 500
Valor(1) = 200
Valor(2) = 100
Valor(3) = 50
Valor(4) = 20
Valor(5) = 10
Valor(6) = 5
Valor(7) = 2
Valor(8) = 1
Valor(9) = 0.5
Valor(10) = 0.2
Valor(11) = 0.1
Valor(12) = 0.05
Valor(13) = 0.02
Valor(14) = 0.01
For i = 0 To 14
Set Imagen(i) = ImageList1.ListImages(i + 1).Picture
Next
End Sub
'-----------------------------------------------------------------------------Private Sub Text1_GotFocus()
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub
'-----------------------------------------------------------------------------Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii < 44 Or KeyAscii > 57 Then
If KeyAscii = 8 Then
'Borra <Else
KeyAscii = 0
Beep
End If
Else
Select Case KeyAscii
Case 42 ' por *
Ope = "*"
n1 = Res
Case 43 ' mas +
Ope = "+"
n1 = Res
Case 44
' coma ,
Case 45
' menos Case 46 ' punto .
KeyAscii = 44
Case 47 ' barra /
KeyAscii = 0
End Select
End If
End Sub
'-----------------------------------------------------------------------------'----------------------- FIN
----------------------------------'
'
'
'
'
'
Page 2 of 2
Descargar