Thursday, September 27, 2012

Fransiskus Sutris

TERIMA SERVICE KOMPUTER DAN LAPTOP PANGGILAN PALEMBANG

SKY-COMP

Kami menerima jasa perbaikan/service panggilan komputer dan laptop untuk di Kota Palembang.
Alamat kami di Jl. Sududuk Putih No. D61 Komplek Perwira. Dekat dengan Pura.

Untuk sementara waktu kami menerima panggilan service mulai dari pkl. 18.00 - 21.00 WIB atau jam 6 Sore.

Silahkan menghubungi saya di 0878.971 66 5 11 (Fransiskus Sutris)
Read More

Wednesday, September 19, 2012

Fransiskus Sutris

Flexible AutoNumber In VB.NET (English)


Flexible Auto number

By using this function you able to make the flexible auto number, why called flexible? Because my function not only generate from number only, but will generate the auto number contained the letter and number. Such as invoice number, purchase order number, etc.

See illustrate on the table below:
Recent Number
Next Number
1
2
3
And so on
00001
00002
00003
And so on
PO-0001
PO-0002
PO-0004
And so on
INV-20.09.2012-00001
INV-20.09.12-00002
INV-20.09.2012-00003
And so on

Let's look at an example of using this function is simply to be easily understood.
1.
Create new project on your VB Express/.NET. Give Name Of Your Project with FlexibleAutoNumber.

2.
Put two labels, two textbox and one button (can be arranged on the picture below).
3.
Add a class in your project and name it with the name clsFunction.vb, see picture below.
4.
Open clsFunction.vb by double-click, then remove the two lines of code there, and paste the following code:


Public Class clsFunction
    Function GetNextNumber(ByVal strBefore As String) As String
        Dim temp1 As String = vbNullString
        Dim lnStrBefore, lnTemp1 As Integer

        temp1 = Val(strBefore) + 1

       lnStrBefore = Len(strBefore)
        lnTemp1 = Len(temp1)

        If lnStrBefore > lnTemp1 Then
            Dim a As Integer
            For a = lnTemp1 To (lnStrBefore - 1)
                temp1 = "0" & temp1
            Next
        End If
        Return temp1
    End Function

    Function GetNextString(ByVal strBefore As String) As String
        Dim strAwal As String = vbNullString
        Dim temp1 As String = vbNullString
        Dim lnStrBefore As Integer

        lnStrBefore = Len(strBefore)
        Dim a, b As Integer
        Dim cKarakter As String

        b = lnStrBefore + 1
        For a = 1 To lnStrBefore
            b = b - 1
            cKarakter = Mid(strBefore, b, 1)

            If IsNumeric(cKarakter) = False Then
                strAwal = Left(strBefore, b)
                temp1 = Right(strBefore, a - 1)
                temp1 = strAwal & GetNextNumber(temp1)'CALLFUNCTION GetNextNumber
                Exit For
            End If
        Next
        Return temp1
    End Function

    Function FlexibleAutoNumber(ByVal strRecentNumber As String) As String
        If IsNumeric(strRecentNumber) Then
            Return GetNextNumber(strRecentNumber)
        Else
            Return GetNextString(strRecentNumber)
        End If
    End Function
End Class

5.
A brief description of 3 functions above.
a.    Function GetNextNumber used when the layout consists of digits Numeric only
b.    Function GetNextString used when the layout consists of the incorporation of letters and numeric.
c.    FlexibleAutoNumber function, this function will call one of  two functions above according to the type number.


6.
Immediately open the Form1 design, and double click on button1, then fill in the coding below:


Public Class Form1
    Dim c As New clsFunction
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim a As String = TextBox1.Text
        TextBox1.Text = c.FlexibleAutoNumber(a)
    End Sub
End Class

7.
Save your project and try to run it, please input sample number, eg INV-0001 after the Save button is clicked then the INV-0001 will turn into INV-0002, and so on.


 After button Save is clicked
8.
Please explore themselves to use this function in accordance with the program you have created. Good luck and hopefully useful.

Just clik Here if want to downlod the Project








Read More
Fransiskus Sutris

Membuat Fungsi Fleksible AutoNumber di VB.NET


Flexible Autonumber

Dengan fungsi yang saya buat ini anda bisa membuat autonumber yang fleksibel, kenapa fleksibel karena fungsi ini tidak sebatas hanya pada jenis numbering yang berisikan digit angka saja melainkan gabungan dari Huruf dan angka juga bisa dilakukan secara otomatis oleh fungsi ini.
Contoh untuk membuat penomoran otomatis pada Nota Penjualan, Nota Pembelian, dll.
Perhatikan ilustrasi pada table berikut :

No. Saat ini
No. Berikutnya
1
2
3
dst
00001
00002
00003
dst
PO-0001
PO-0002
PO-0004
dst
INV-20.09.2012-00001
INV-20.09.12-00002
INV-20.09.2012-00003
dst

Mari kita lihat contoh penggunaan fungsi ini secara sederhana agar mudah dipahami.
1.
Langkah awal buatlah sebuah project baru di VB Express / VB.net Anda.

2.
Letakan 2 buah label, 2 buah textbox dan 1 buah button (boleh diatur sesuai gambar di bawah ini).

3.
Tambahkan 1 buah class di project Anda dan beri nama class tersebut dengan nama clsFunction.vb, lihat gambar di bawah ini
 
4.
Silahkan buka clsFunction.vb dengan cara double click, lalu hapus dua baris code di sana, dan pastekan coding berikut ini:


Public Class clsFunction
    Function GetNextNumber(ByVal strBefore As String) As String
        Dim temp1 As String = vbNullString
        Dim lnStrBefore, lnTemp1 As Integer

        temp1 = Val(strBefore) + 1

       lnStrBefore = Len(strBefore)
        lnTemp1 = Len(temp1)

        If lnStrBefore > lnTemp1 Then
            Dim a As Integer
            For a = lnTemp1 To (lnStrBefore - 1)
                temp1 = "0" & temp1
            Next
        End If
        Return temp1
    End Function

    Function GetNextString(ByVal strBefore As String) As String
        Dim strAwal As String = vbNullString
        Dim temp1 As String = vbNullString
        Dim lnStrBefore As Integer

        lnStrBefore = Len(strBefore)
        Dim a, b As Integer
        Dim cKarakter As String

        b = lnStrBefore + 1
        For a = 1 To lnStrBefore
            b = b - 1
            cKarakter = Mid(strBefore, b, 1)

            If IsNumeric(cKarakter) = False Then
                strAwal = Left(strBefore, b)
                temp1 = Right(strBefore, a - 1)
                temp1 = strAwal & GetNextNumber(temp1)'CALLFUNCTION GetNextNumber
                Exit For
            End If
        Next
        Return temp1
    End Function

    Function FlexibleAutoNumber(ByVal strRecentNumber As String) As String
        If IsNumeric(strRecentNumber) Then
            Return GetNextNumber(strRecentNumber)
        Else
            Return GetNextString(strRecentNumber)
        End If
    End Function
End Class

5.
Penjelasan singkat 3 buah function diatas
a.    Function GetNextNumber digunakan ketika susunan nomor terdiri dari digit angka saja
b.    Function GetNextString digunakan ketika susunan nomor terdiri dari penggabungan huruf dan angka.
c.    Function FlexibleAutoNumber, fungsi ini yang akan memanggil salah satu dari kedua fungsi diatas sesuai dengan jenis nomornya.


6.
Langsung saja bukalah form1 design, dan double click pada button1, kemudian isikan coding di bawah ini:


Public Class Form1
    Dim c As New clsFunction
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim a As String = TextBox1.Text
        TextBox1.Text = c.FlexibleAutoNumber(a)
    End Sub
End Class

7.
Simpan project anda dan coba jalankan, silahkan masukan contoh nomor, misal INV-0001 maka setelah tombol Save di-click maka INV-0001 akan berubah menjadi INV-0002, dst.


8.
Silahkan explore sendiri untuk penggunaan fungsi ini sesuai dengan program yang anda buat. Dan Selamat mencoba semoga bermanfaat.

download projectnya.


Read More