witam
mam duzy problem jak w temacie.
proszę o pomoc w napisaniu takowego programiku.
Pzdr
Jacek
mam duzy problem jak w temacie.
proszę o pomoc w napisaniu takowego programiku.
Pzdr
Jacek
Czy wolisz polską wersję strony elektroda?
Nie, dziękuję Przekieruj mnie tamDim Pesel As String
Private Sub Form_Load()
Dim Rocznik As Byte
Dim Miesiac As Byte
'Pobranie pesel
Pesel = InputBox("wpisz pesel", , "02070803628")
'kiedy nie jest pusto
If Pesel <> "" Then
'Wyliczenie rocznika
Miesiac = Mid(Pesel, 3, 2)
If Miesiac > 80 Then
Rocznik = 18
Miesiac = Miesiac - 80
ElseIf Miesiac > 60 Then
Rocznik = 22
Miesiac = Miesiac - 60
ElseIf Miesiac > 40 Then
Rocznik = 21
Miesiac = Miesiac - 40
ElseIf Miesiac > 20 Then
Rocznik = 20
Miesiac = Miesiac - 20
Else
Rocznik = 19
End If
'Wyswietlenie
MsgBox "Rok: " & Rocznik & Left(Pesel, 2)
MsgBox "Dzien: " & Mid(Pesel, 5, 2)
MsgBox "Miesiac: " & Miesiac
End If
End
End Subpesel = "02070803628"
INT male, year, month, day, evid, ok
ok = TestPesel(pesel, male, year, month, day, evid)
print "pesel:",pesel
print "data: ",year,".",month,".",day
print "evid: ",evid
if male then print "mezczyzna" else print "kobieta"
print "ok : ",ok
getch()
sub TestPesel(pesel:STRING, male:INT byref, year:INT byref, month:INT byref, day:INT byref, evid:INT byref),INT
INT xrok, ctrl, a
CHAR div[10]
year = val(left$(pesel,2))
month = val(mid$(pesel, 3, 2))
day = val(mid$(pesel, 5, 2))
evid = val(mid$(pesel, 7, 4))
male = (evid&1)
xrok = val(mid$(pesel, 3, 2))
if (xrok>=0) and (xrok <=12)
year+=1900
endif
if (xrok>=80) and (xrok <=12+80)
year+=1800
month-=80
endif
if (xrok>=20) and (xrok <=12+20)
year+=2000
month-=20
endif
if (xrok>=60) and (xrok <=12+60)
year+=2200
month-=60
endif
div = 1,3,7,9,1,3,7,9,1,3
ctrl = 0
for a = 0 to 9
ctrl += ((pesel[a]-48) * div[a])
next a
ctrl = ctrl%10
if ctrl=0 then ctrl=10
ctrl = 10-ctrl
return (ctrl = pesel[10]-48)
endsubPrivate Sub CommandButton1_Click()
Dim a, b, c, d, e, f, g, h, i, j, k, suma, reszta, kontrol As Integer
Dim a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, suma1, kontrol1 As Integer
Dim pesel, nip, plec, plec1, plec2 As String
Dim m, r, rok As Integer
pesel = TextPESEL.Text
a = CInt(Left(pesel, 1))
b = CInt(Mid(pesel, 2, 1))
c = CInt(Mid(pesel, 3, 1))
d = CInt(Mid(pesel, 4, 1))
e = CInt(Mid(pesel, 5, 1))
f = CInt(Mid(pesel, 6, 1))
g = CInt(Mid(pesel, 7, 1))
h = CInt(Mid(pesel, 8, 1))
i = CInt(Mid(pesel, 9, 1))
j = CInt(Mid(pesel, 10, 1))
k = CInt(Right(pesel, 1))
plec = CInt(Mid(pesel, 10, 1))
plec1 = plec Mod 2
If plec1 = 1 Then
plec2 = "mezczyzna"
Else: plec2 = "kobieta"
End If
suma = a * 1 + b * 3 + c * 7 + d * 9 + e * 1 + f * 3 + g * 7 + h * 9 + i * 1 + j * 3
reszta = suma Mod 10
kontrol = (10 - reszta) Mod 10
If k = kontrol Then
Label2 = "prawidlowy PESEL"
dz = CInt(Mid(pesel, 5, 2))
rok = CInt(Left(pesel, 2))
m = CInt(Mid(pesel, 3, 2))
If m <= 12 Then
r = 1900
rok1 = r + rok
ElseIf (m >= 21 And m <= 32) Then
m = m - 20
r = 2000 + m
rok1 = r + rok
ElseIf (m >= 41 And m <= 52) Then
m = m - 40
r = 2100 + m
rok1 = r + rok
ElseIf (m >= 61 And m <= 72) Then
m = m - 60
r = 1800 + m
rok1 = r + rok
End If
Label12.Caption = TextBox2.Value
Label13.Caption = TextBox3.Value
Label14.Caption = plec2
Label15.Caption = rok1 & " . " & m & " . " & dz
Label16.Caption = TextPESEL.Value
Else
Label2 = "nieprawidlowy PESEL"
End If
End Sub
Private Sub CommandButton2_Click()
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox4 = ""
TextBox5 = ""
TextPESEL = ""
TextBox7 = ""
Label2 = ""
Label11 = ""
Label12 = ""
Label13 = ""
Label14 = ""
Label15 = ""
Label16 = ""
UserForm1.Hide
End Sub
Private Sub CommandButton3_Click()
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox4 = ""
TextBox5 = ""
TextPESEL = ""
TextBox7 = ""
Label2 = ""
Label11 = ""
Label12 = ""
Label13 = ""
Label14 = ""
Label15 = ""
Label16 = ""
End Sub
Private Sub Label11_Click()
End Sub
Private Sub Label12_Click()
End Sub
Private Sub TextBox2_Change()
End Sub
Private Sub TextPESEL_Change()
End Sub
Private Sub UserForm_Click()
End Sub