Close
Faqja 0 prej 2 FillimFillim 12 FunditFundit
Duke shfaqur rezultatin -19 deri 0 prej 32
  1. #1
    i/e regjistruar
    Anėtarėsuar
    26-04-2007
    Postime
    89

    Kam nevoj per ndihme ne VB.Net ose Access

    Pershendetje:
    Kam krijuar nje baze e te dhenave me 4 tabela
    tabela e pare Artikujt
    tabela e dyte hyrjet
    tabela e trete daljet
    tabela e 4 mbetjet

    me duhet kodi i vba ose i vb.net
    kur une beje hyrjet ka mundesi qe nje artikull ta blej me cmime te ndryshme
    por shiten me cmim te njejte
    ajo qe me nevojitet eshte kodi kur une blej psh
    Molla 100 kgx5 dhe
    Molla 100 kgx5.10
    Molla 100kgx5.15
    dhe gjithsej une i kam 300kg molla por me cmime te ndryshme
    dhe une krijoj fature 150kg molla x6 euro
    por ne tabelen mbetjet mua duhet te me figuroj
    1.Molla 50kgx5.10
    2.Molla 100x5.20 ju lutem sa me shpejte qe eshte e mundur te me gjej dikush nje kod
    por mos haroni se ne hyrje mund te jene me shume se nje artikuj,
    por shembullin e kam mare vetem me molla sa per ilustrim
    per informata me te holsishme me dergoni nje email info.blerim@gmail.com
    Skedarėt e Bashkėngjitur Skedarėt e Bashkėngjitur

  2. #2
    i/e regjistruar
    Anėtarėsuar
    16-04-2004
    Postime
    684
    Tungjatjeta Furkan,

    Si duket paske filluar te hyshe ne programim per afarizem, dhe shihen disa mangesi ne shtjellimin fillestar te problemit (modelimin). Do ti pershkruaj siperfaqesisht keto mangesi ne menyre qe ta parashtrosh problemin me kjartaz, e qe rrjedhimisht do te ndihmoj ne zgjidhjen e problemit.

    Ne kontabilitet keto module jane esenciale per mbajtjen e evidences elektronike:
    1. Moduli i pagesave/ Porosive (Accounts Payable/Purchasing Orders)
    2. Moduli i shitjes (Accounts Recievable)
    3. Moduli i mallrave (Inventory control)

    Per te kontrolluar rrjedhen e afarizmit nje prej informatave kyce eshte kostoja e mallit i cili shitet (natyrisht do te tentosh te shesesh mallin per profit, apo jo). Meqenese cmimi bleres i artikullit te njejte mund te ndryshoj (per shkak te furnizuesve te ndryshem ose per shkak te nderimit te cmimeve) ne kontabilitet perdoren disa metoda per gjetjen e kostos se artikullit te vecante (FIFO-First In First Out, LIFO-Last In First Out, si dhe Average Costing). Mvaresisht nga metoda e zgjedhur baza e shenimeve do te ket nevoje per ruajtje te shenimeve adekuate, si dhe per modifikim te modulit te blerjes se mallrave.

    Pra per te zgjedhur ne menyre adekuate problemin e parashtruar nga ana jote, se pari duhet percaktuar metoden e kostos se mallrave, dhe se dyti duhet bere modifikimet e nevojshme ne baze te shenimeve.

    P.S.
    Ne baze te postimit tend duket se preferohet FIFO, por nuk eshte plotesisht e kjarte, si dhe mbetja e "2.Molla 100x5.20" eshte e pakjarte sepse nuk figuron ne hyrje ... mos ke dashur te thuash "2.Molla 100x5.15" ?

  3. #3
    i/e regjistruar
    Anėtarėsuar
    26-04-2007
    Postime
    89

    Po une pikerisht kerkoj kode per metoden FIFO

    Po une pkerisht kerkoj ta zbatoj metoden FIFO por nese keni mundesi te me udhezoni per metoden e Kostos mesatare nuk ka problem por kjo eshte metoda me e preferuar qe une e praktikoj, me duhet vetem formula te VBA-se ose VB.Net
    Me kishe Shpetuar sikur te ma ipnit ndokush kete formule vellaut Kosovar

  4. #4
    i/e regjistruar Maska e hot_prinz
    Anėtarėsuar
    29-05-2007
    Vendndodhja
    Frankfurt
    Postime
    9,879
    Furkani Kompany


    per se shpejti e krijova nje shembull ne C#.NET, nese ke interes te ndihmoj me e kthy ne VB por vonoj nje cik se me duhet me e ndrru kaseten e VB.
    Ketu e ke nje forme qe lidhet me databazen e Accesit dhe menagjon shitjet dhe mbetjet ne inventar te mallit.
    E kam shtuar nje kolone tek hyrjet Cmimi i shitjes qe te mirret automatikisht nga Db por mund edhe te ndryshohet gjate shitjes ose ne DB.

    Kodi:
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Data;
    using System.Data.OleDb;
    using System.Windows.Forms;
    
    namespace Furkani
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
                mbushe_kombon();
            }
    
            private void mbushe_kombon()
            {
    
                comboBox1.Items.Clear();
    
                ArrayList strKodet = new ArrayList();
    
                OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\\Furkan_company.mdb");
                con.Open();
    
                string strSQL = "SELECT * FROM Hyrjet";
    
                OleDbCommand cmd = new OleDbCommand(strSQL, con);
                OleDbDataReader dr = cmd.ExecuteReader();
    
                while (dr.Read())
                {
                    bool ekziston = false;
    
                    foreach (string s in strKodet)
                    {
                        if (dr["Kodi"].ToString() == s)
                        {
                            ekziston = true;
                        }
                    }
                    if (!ekziston)
                        strKodet.Add(dr["kodi"].ToString());
                }
    
                foreach (string s in strKodet)
                {
                    comboBox1.Items.Add(s);
                }
    
                con.Close();
            }
    
            private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
            {
                OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\\Furkan_company.mdb");
                con.Open();
    
                string strSQL = "SELECT * FROM Hyrjet WHERE Kodi=" + comboBox1.Text;
    
                OleDbCommand cmd = new OleDbCommand(strSQL, con);
                OleDbDataReader dr = cmd.ExecuteReader();
    
                while (dr.Read())
                {
                    txtPershkrimi.Text = dr["Pershkrimi"].ToString();
                    txtNjm.Text = dr["Njm"].ToString();
                    txtCmimi.Text = dr["CmimiShitjes"].ToString();
                }
    
                con.Close();
    
                sasia_ne_inventar();
    
            }
    
            private void sasia_ne_inventar()
            {
                int sasiaDB = 0;
    
    
                OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\\Furkan_company.mdb");
                con.Open();
    
                string strSQL = "SELECT * FROM Hyrjet WHERE Kodi=" + comboBox1.Text;
    
                OleDbCommand cmd = new OleDbCommand(strSQL, con);
                OleDbDataReader dr = cmd.ExecuteReader();
    
                while (dr.Read())
                {
                    sasiaDB += Convert.ToInt32(dr["Sasia"].ToString());
                }
    
                txtDispozicioni.Text = sasiaDB.ToString() + " " + txtPershkrimi.Text;
    
    
                con.Close();
            }
    
            private void txtSasia_TextChanged(object sender, EventArgs e)
            {
                try
                {
                    txtVlera.Text = (Convert.ToDouble(txtCmimi.Text) * Convert.ToDouble(txtSasia.Text)).ToString();
                }
                catch (Exception)
                {
                    txtSasia.Text = "";
                }
                    
            }
    
            private void cmdShite_Click(object sender, EventArgs e)
            {
                bool malli_ne_disponim = false;
                int intSasia = 0;
    
                if (txtPershkrimi.Text != "")
                {
                    try
                    {
                        intSasia = int.Parse(txtSasia.Text);
    
                    
                        malli_ne_disponim = verteto_sasine(intSasia);
    
                        if (malli_ne_disponim)
                        {
                            while (intSasia > 0)
                            {
                                int tmpSasia = 0;
                                int tmpRow = 0;
    
                                OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\\Furkan_company.mdb");
                                con.Open();
    
                                string strSQL = "SELECT * FROM Hyrjet WHERE Kodi=" + comboBox1.Text;
    
                                OleDbCommand cmd = new OleDbCommand(strSQL, con);
                                OleDbDataReader dr = cmd.ExecuteReader();
    
                                while (dr.Read())
                                {
                                    tmpSasia = Convert.ToInt32(dr["Sasia"].ToString());
                                    tmpRow = Convert.ToInt32(dr["Id"].ToString());
                                    break;
                                }
    
                                if ((intSasia - tmpSasia) >= 0)
                                {
                                    intSasia -= tmpSasia;
                                    shlyje_rekordin(tmpRow);
                                }
                                else if ((intSasia - tmpSasia) == 0)
                                {
                                    shlyje_rekordin(tmpRow);
                                    intSasia -= tmpSasia;
                                }
                                else if ((intSasia - tmpSasia) < 0)
                                {
                                    tmpSasia -= intSasia;
                                    intSasia = 0;
                                    aktualizo_rekordin(tmpRow, tmpSasia);
                                }
    
                                con.Close();
                            }
    
                            fute_shitjen();
                            MessageBox.Show("Transaksioni perfundoi\n\nKeni shitur "+txtSasia.Text+" "+txtPershkrimi.Text);
    
                            mbushe_kombon();
    
                        }
                        else
                        {
                            sasia_ne_inventar();
                            MessageBox.Show("Ske " + txtPershkrimi.Text + " sa po do me shite!\nI ke " + txtDispozicioni.Text + " " + txtPershkrimi.Text + " e po do me i shite " + txtSasia.Text + " " + txtPershkrimi.Text + ".Tzzz.\n\nMule shko blej " + txtPershkrimi.Text + " tjera njeri!");
                            txtSasia.Text = "";
                        }
                    }
                    catch (Exception)
                    {
                        txtSasia.Text = "";
                        MessageBox.Show("Fute sasine!");
                    }
    
                }
                else
                {
                    MessageBox.Show("Zgjidhe nje mall!");
                }
            }
    
            private void fute_shitjen()
            {
                OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\\Furkan_company.mdb");
                con.Open();
    
                OleDbCommand cmd = new OleDbCommand("INSERT INTO Daljet (Kodi , Pershkrimi, Njm, Sasia, Cmimi, Vlera) VALUES ('" + comboBox1.Text + "','" + txtPershkrimi.Text + "','" + txtNjm.Text + "','" + txtSasia.Text + "','" + txtCmimi.Text + "','" + txtVlera.Text + "')", con);
    
                cmd.ExecuteNonQuery();
    
                con.Close();
            }
    
            private void aktualizo_rekordin(int tmpRow, int intSasia)
            {
                OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\\Furkan_company.mdb");
                con.Open();
    
                OleDbCommand cmd = new OleDbCommand("UPDATE Hyrjet SET Sasia =" + intSasia + " WHERE Id=" + tmpRow, con);
    
                cmd.ExecuteNonQuery();
    
                con.Close();
                sasia_ne_inventar();
                
            }
    
            private void shlyje_rekordin(int tmpRow)
            {
                OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\\Furkan_company.mdb");
                con.Open();
    
                OleDbCommand cmd = new OleDbCommand("DELETE FROM Hyrjet WHERE Id =" + tmpRow, con);
    
                cmd.ExecuteNonQuery();
    
                con.Close();
                sasia_ne_inventar();
            }
    
            private bool verteto_sasine(int intSasia)
            {
                int sasiaDB = 0;
    
                bool x = false;
    
                OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\\Furkan_company.mdb");
                con.Open();
    
                string strSQL = "SELECT * FROM Hyrjet WHERE Kodi=" + comboBox1.Text;
    
                OleDbCommand cmd = new OleDbCommand(strSQL, con);
                OleDbDataReader dr = cmd.ExecuteReader();
    
                while (dr.Read())
                {
                    sasiaDB += Convert.ToInt32(dr["Sasia"].ToString());
                }
    
                txtDispozicioni.Text = sasiaDB.ToString() + " " +txtPershkrimi.Text;
    
                if (sasiaDB >= intSasia)
                    x = true;
                else
                    x = false;
    
                con.Close();
    
                return x;
            }
    
        }
    }
    Skedarėt e Bashkėngjitur Skedarėt e Bashkėngjitur

  5. #5
    i/e regjistruar
    Anėtarėsuar
    26-04-2007
    Postime
    89

    ju Faleminderit por akoma kam telashe

    O vlla nuk po muj me paramendu sa i shpejte qenke ne pergjije,po me duket se nuk do te me ze java e ardhshme e une ta mos e zgjidhi problemin tim.
    Ajo qe une saktesisht po e kerkoj eshte zbatimi i metodes FIFO, por cmimi shites vendoset tek dalja jo tek hyrja, faktikisht Cmimi eshte cmimi shites ne tabelen dalja, por, ajo qe une kerkoj eshte kjo.
    ne hyrje hyne artikujt e njejte shume here por me cmime furnizuese te ndryshme,kurse shiten me cmim te njejte te gjithe , psh molla hyne me shume cmime psh 1,1.2,1,01 etj por ato duhet shitur 2euro, si ato qe jane blere 1eur sia to 1.2 eur, por mua me duhet nje kod qe ne tabelen mbetja apo edhe nese gjenerohet nje tabele automatike nuk prish pune te mi zbres stoqet duke shkuar ne forme te algoritmi psh.
    Molla kane hyre:
    1.Molla 100 kgx1.5eur
    2.Molla 200 Kgx1.6eur
    Por une do i shes 50 kgx2eur.
    e tash me duhet kodi qe ne tabelen mbetja te me figurojne te dhena.

    1.Molla 50kgx1.5eur
    2.Molla 100kgx1.6eur
    sepse une vetem 50 i shita faktikisht zbatimi i metodes FIFO.
    Kete nese ma bene ne kodin VB.Net me shpeton, se une nuk i njoh kodet e C#.Net, se programoj ne VB.Net dhe ne Delphi7.0;
    por me shume ne VB.Net por qe eshte problemi une jam edhe fillestar ne kete lemi se me pare kam punuar ne access, por kure nuk kam pasur pune me programe qe perdorin formula llogaritese.
    kjo me vene ne siklet saqe une ka raste kur nuk flej fare duke kerkuar tutorials ne youtube apo google, por nuk gjej formulen qe me nevojitet.
    dhe ndihma e juaj do te ishte shpetim per mua.
    Ju Faleminderit shume..
    Me Respekt Furkani nga Kosova.

  6. #6
    i/e regjistruar Maska e hot_prinz
    Anėtarėsuar
    29-05-2007
    Vendndodhja
    Frankfurt
    Postime
    9,879
    Tungat Furkan,


    ky shembulli perdor nje lloj FIFO, pasi qe nuk ekziston koha e blerjes ne tabelen e hyrjes, si FIFO i shtjellon rreshtat e artikujve sipas kolones ID qe shtohet automatikisht ne tabelen hyrja.
    Per FIFO te rregullt te nevojiten edhe datat e blerjes se artikujve ne tabelen e hyrjes e atehere para se te shtjellohet inventari, rradhiten rekordet e hyrjes sipas dates se blerjes.

    Cmimi i shitjes del te dalja, por perderisa dalja nuk eshte proceduar atehere do te ishte mire qe cmimi i shitjes te mund te lexohej ne nje tabele automatikisht, kjo e lehteson perdorimin e programit.
    Prandaj une cmimin e shitjes e vendosa te tabela hyrja, qe kur zgjidhet malli ne komboBox te aktualizohet automatikisht cmimi i shitjes. Por ti cmimin e shitjes mundesh me e vendose ku te dush, psh te tabela artikujt, ose mundesh mos me e vendose fare por gjithmone me e shtyp ne tastature, ose e shkrun ne leter e e lexon prej letre .

    Nuk e di a e ke shkarkuar dhe testuar programin por stoqet ne hyrje zbriten ashtu siq e ke cekur, duke filluar nga rekordi i pare ne tabelen hyrja, zbriten stoqet me radhe.


    Ja edhe kodi ne VB.NET:

    Kodi:
    
    Imports System.Data
    Imports System.Data.OleDb
    
    Public Class Form1
    
        Private Sub cboKodi_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboKodi.SelectedIndexChanged
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim strSQL As String = "SELECT * FROM Hyrjet WHERE Kodi=" + cboKodi.Text
    
            Dim cmd = New OleDbCommand(strSQL, con)
            Dim dr As OleDbDataReader = cmd.ExecuteReader
    
            While dr.Read()
                lblPershkrimi.Text = dr("Pershkrimi")
                lblNjm.Text = dr("Njm")
                lblCmimi.Text = dr("CmimiShitjes")
            End While
    
            con.Close()
    
            sasia_ne_inventar()
    
        End Sub
    
        Private Sub sasia_ne_inventar()
    
            Dim sasiaDB As Integer = 0
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim strSQL As String = "SELECT * FROM Hyrjet WHERE Kodi=" + cboKodi.Text
    
            Dim cmd = New OleDbCommand(strSQL, con)
            Dim dr As OleDbDataReader = cmd.ExecuteReader
    
            While dr.Read()
                sasiaDB += Convert.ToInt32(dr("Sasia"))
            End While
    
            lblDispo.Text = sasiaDB.ToString() + " " + lblPershkrimi.Text
    
            con.Close()
    
        End Sub
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
            mbushe_kombon()
    
        End Sub
    
        Private Sub mbushe_kombon()
    
            cboKodi.Items.Clear()
            Dim strKodi = New ArrayList()
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim strSQL As String = "SELECT * FROM Hyrjet"
    
            Dim cmd = New OleDbCommand(strSQL, con)
            Dim dr As OleDbDataReader = cmd.ExecuteReader
    
            While dr.Read()
                Dim ekziston As Boolean = False
    
                For Each s In strKodi
                    If dr("Kodi") = s Then
                        ekziston = True
                    End If
                Next
    
                If ekziston = False Then
                    strKodi.Add(dr("Kodi"))
                End If
    
            End While
    
            For Each s In strKodi
                cboKodi.Items.Add(s)
            Next
    
            con.Close()
    
        End Sub
    
        Private Sub txtSasia_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSasia.TextChanged
    
            Try
                lblVlera.Text = (Convert.ToDouble(lblCmimi.Text) * Convert.ToDouble(txtSasia.Text)).ToString()
            Catch Ex As Exception
                txtSasia.Text = ""
            End Try
    
        End Sub
    
        Private Sub cmdShite_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdShite.Click
    
            Dim malli_ne_disponim As Boolean = False
            Dim intSasia As Integer = 0
    
            If lblPershkrimi.Text <> "" Then
    
                Try
                    intSasia = Convert.ToInt32(txtSasia.Text)
                    malli_ne_disponim = verteto_sasine(intSasia)
    
                    If malli_ne_disponim = True Then
    
                        While intSasia > 0
    
                            Dim tmpSasia As Integer = 0
                            Dim tmpRow As Integer = 0
    
                            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
                            con.Open()
    
                            Dim strSQL As String = "SELECT * FROM Hyrjet WHERE Kodi=" + cboKodi.Text
    
                            Dim cmd = New OleDbCommand(strSQL, con)
                            Dim dr As OleDbDataReader = cmd.ExecuteReader
    
                            While dr.Read()
                                tmpSasia = Convert.ToInt32(dr("Sasia"))
                                tmpRow = Convert.ToInt32(dr("Id"))
                                Exit While
                            End While
    
                            If (intSasia - tmpSasia) >= 0 Then
                                intSasia -= tmpSasia
                                shlyje_rekordin(tmpRow)
                            ElseIf (intSasia - tmpSasia) = 0 Then
                                shlyje_rekordin(tmpRow)
                                intSasia -= tmpSasia
                            ElseIf (intSasia - tmpSasia) < 0 Then
                                tmpSasia -= intSasia
                                intSasia = 0
                                aktualizo_rekordin(tmpRow, tmpSasia)
                            End If
    
                            con.Close()
    
                        End While
    
                        fute_shitjen()
                        MessageBox.Show("Transaksioni perfundoi" & vbNewLine & "" & vbNewLine & "Keni shitur " + txtSasia.Text + " " + lblPershkrimi.Text)
                        mbushe_kombon()
                    Else
                        sasia_ne_inventar()
                        MessageBox.Show("Ske " + lblPershkrimi.Text + " sa po do me shite!" & vbNewLine & "I ke " + lblDispo.Text + " " + lblPershkrimi.Text + " e po do me i shite " + txtSasia.Text + " " + lblPershkrimi.Text + ".Tzzz." & vbNewLine & "" & vbNewLine & "Mule shko blej " + lblPershkrimi.Text + " tjera njeri!")
                        txtSasia.Text = ""
                    End If
    
                Catch Ex As Exception
                    txtSasia.Text = ""
                    MessageBox.Show("Fute sasine!")
                End Try
    
            Else
                MessageBox.Show("Zgjidhe nje mall!")
            End If
    
        End Sub
    
        Private Sub fute_shitjen()
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim cmd = New OleDbCommand("INSERT INTO Daljet (Kodi , Pershkrimi, Njm, Sasia, Cmimi, Vlera) VALUES ('" + cboKodi.Text + "','" + lblPershkrimi.Text + "','" + lblNjm.Text + "','" + txtSasia.Text + "','" + lblCmimi.Text + "','" + lblVlera.Text + "')", con)
    
            cmd.ExecuteNonQuery()
    
            con.Close()
    
        End Sub
    
        Private Sub aktualizo_rekordin(ByVal tmpRow, ByVal tmpSasia)
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim cmd = New OleDbCommand("UPDATE Hyrjet SET Sasia =" & tmpSasia & " WHERE Id=" & tmpRow, con)
    
            cmd.ExecuteNonQuery()
    
            con.Close()
            sasia_ne_inventar()
    
        End Sub
    
        Private Sub shlyje_rekordin(ByVal tmpRow)
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim cmd = New OleDbCommand("DELETE FROM Hyrjet WHERE ID =" & tmpRow & "", con)
            cmd.ExecuteNonQuery()
    
            con.Close()
            sasia_ne_inventar()
    
        End Sub
    
        Private Function verteto_sasine(ByVal intSasia) As Boolean
    
            Dim sasiaDB As Integer = 0
    
            Dim x As Boolean = False
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim strSQL As String = "SELECT * FROM Hyrjet WHERE Kodi=" + cboKodi.Text
    
            Dim cmd = New OleDbCommand(strSQL, con)
            Dim dr As OleDbDataReader = cmd.ExecuteReader
    
            While dr.Read()
                sasiaDB += Convert.ToInt32(dr("Sasia"))
            End While
    
            lblDispo.Text = sasiaDB.ToString() + " " + lblPershkrimi.Text
    
            If (sasiaDB >= intSasia) Then
                x = True
            Else
                x = False
            End If
    
            con.Close()
    
            verteto_sasine = x
    
        End Function
    
    End Class
    Projektin komplet nga Visual Studio nuk po muj me e vendose se po e tejkalon madhesine prej 100kb te lejuara. Ta dergoj me email.
    Skedarėt e Bashkėngjitur Skedarėt e Bashkėngjitur

  7. #7
    i/e regjistruar
    Anėtarėsuar
    26-04-2007
    Postime
    89

    Ky shembull funksionon mire por kam diqka te korigjuar.

    Faleminderit Vlla per ndihmen tuaj e ke fajllin te korigjuar, po funksionon mire ajo qe deshta une por po e shoh se cmimet furnizuese po mi perzien.
    e bera qe hyrjet ti ket edhe me daten e furnizimit.
    por problemi qendron se une nuk kam informata mbi KMSH-ne Kosto e mallit te shitur.

    Nese nuk te ve ne siklet kish ainsistu te kerkoj ndihme nga ju por nese ju mare kohen dhe jeni te nxene me punen tuaj, une sinqerisht te falenderoj per kontributin tend dhe te deshiroj shendet dhe sukses ne jete.

    Por programimi eshte ender e jetes sime, dhe beso se une zakonisht nuk me ze gjumi lehte duke menduar ne kodet e VB, e kam pasion kete pune, dhe nuk e kam ndermend te ndalem deri sa ta gjej zgjidhjen, por ndihma juaj ka qene nje hapje e rruges per mua ,por jo edhe fundi i problemit, une jam i kenqaur qe kam hasur ne dike qe eshte i gatshem te me ofroj ndihme ne momentin kur une kam nevoj per ndihme, ja edhe fajllin e ke te korigjuar dhe saldon qe e kerkoj e kerkoj ne tabelen Mbetja hyrjet nuk guxjne te luajne ne asnje menyre, ose mund ta krijosh nje tabele te posaqme qe i regjistron transaksionet qe kane levizur por jo t eme ndryshojne hyrjet.
    Ju faleminderit.
    Skedarėt e Bashkėngjitur Skedarėt e Bashkėngjitur

  8. #8
    i/e regjistruar Maska e hot_prinz
    Anėtarėsuar
    29-05-2007
    Vendndodhja
    Frankfurt
    Postime
    9,879
    Ska problem Furkan te ndihmoj me gjithe qejf,

    po ti vetem tregohu pak ma i qarte, se spo kuptoj pse po te perzihen cmimet furnizuese?

    Momentalisht ne tabelen Hyrja rekordet e mallerave fshihen kur sasia e tyre eshte zero, duke u varur nga FIFO apo LIFO. Ose cka po mendon me ba me rekordet e mallerave kur ato arrijne sasine zero ne tabelen Hyrjet?
    Mallnat e shitura i ke te tabela daljet. Nese don mundet njeri me i vendose cmimet e furnizimit edhe te tabelja e daljes keshtu qe nga daljet mund te llogaritet edhe fitimi, por atehere te daljet te duhet me i vendose nje lloj numri te raportit, sepse nje sasi e mallit nese eshte me e madhe se nje rekord ne hyrje mund te shitet me cmime te ndryshme te furnizimit, e atehere raporti mund te kete nje sasi malli te shitur me nje cmim shites por me cmime te ndryshme te furnizimit.

    Pastaj e kam vendose edhe nje Tab per Hyrje ku mundesh me e regjistru mallin e ri. Tani data dhe koha futen automatikisht kur behen hyrjet apo daljet.

    Tabela Mbetjet po me duket e panevojshme sepse mbetjet llogariten automatikisht te tabela hyrjet, sepse ne te kunderten duhet me e kerku nje artikull ne tabelen hyrjet dhe ne tabelen mbetjet.

    Cmimet e shitjes mundet njeri me i vendose te Tabela artikujt, qe nese e nderron cmimin te artikujt ai cmim me pase vlere per te gjithe artikujt me te njejtin pershkrim.

    Ca o KMSH-ne Kosto e mallit te shitur?

    Kodi:
    Imports System.Data
    Imports System.Data.OleDb
    
    Public Class Form1
    
        Private Sub cboKodi_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboKodi.SelectedIndexChanged
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim strSQL As String = "SELECT * FROM Hyrjet WHERE Kodi=" + cboKodi.Text
    
            Dim cmd = New OleDbCommand(strSQL, con)
            Dim dr As OleDbDataReader = cmd.ExecuteReader
    
            While dr.Read()
                lblPershkrimi.Text = dr("Pershkrimi")
                lblNjm.Text = dr("Njm")
            End While
    
            con.Close()
    
            sasia_ne_inventar()
    
        End Sub
    
        Private Sub sasia_ne_inventar()
    
            Dim sasiaDB As Integer = 0
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim strSQL As String = "SELECT * FROM Hyrjet WHERE Kodi=" + cboKodi.Text
    
            Dim cmd = New OleDbCommand(strSQL, con)
            Dim dr As OleDbDataReader = cmd.ExecuteReader
    
            While dr.Read()
                sasiaDB += Convert.ToInt32(dr("Sasia"))
            End While
    
            lblDispo.Text = sasiaDB.ToString() + " " + lblPershkrimi.Text
    
            con.Close()
    
        End Sub
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
            mbushe_kombon()
            rdFIFO.Checked = True
    
        End Sub
    
        Private Sub mbushe_kombon()
    
            cboKodi.Items.Clear()
            cmbHKodi.Items.Clear()
    
            Dim strKodi = New ArrayList()
            Dim strPershkrimi = New ArrayList()
            Dim strNjm = New ArrayList()
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim strSQL As String = "SELECT * FROM Hyrjet"
    
            Dim cmd = New OleDbCommand(strSQL, con)
            Dim dr As OleDbDataReader = cmd.ExecuteReader
    
            While dr.Read()
                Dim ekziston As Boolean = False
                Dim ekzistonP As Boolean = False
                Dim ekzistonN As Boolean = False
    
                For Each s In strKodi
                    If dr("Kodi") = s Then
                        ekziston = True
                    End If
                Next
    
                If ekziston = False Then
                    strKodi.Add(dr("Kodi"))
                End If
    
                For Each s In strPershkrimi
                    If dr("Pershkrimi") = s Then
                        ekzistonP = True
                    End If
                Next
    
                If ekzistonP = False Then
                    strPershkrimi.Add(dr("Pershkrimi"))
                End If
    
                For Each s In strNjm
                    If dr("Njm") = s Then
                        ekzistonN = True
                    End If
                Next
    
                If ekzistonN = False Then
                    strNjm.Add(dr("Njm"))
                End If
    
            End While
    
            strKodi.Sort()
    
            For Each s In strKodi
                cboKodi.Items.Add(s)
                cmbHKodi.Items.Add(s)
            Next
    
            For Each s In strPershkrimi
                cmbHPershkrimi.Items.Add(s)
            Next
    
            For Each s In strNjm
                cmbHNjm.Items.Add(s)
            Next
    
            con.Close()
    
        End Sub
    
        Private Sub txtSasia_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSasia.TextChanged
    
            'Try
            '    txtSasia.Text = Convert.ToDouble(txtSasia.Text).ToString()
            'Catch Ex As Exception
            '    txtSasia.Text = ""
            'End Try
    
            Try
                If txtCmimi.Text <> "" Then
                    lblVlera.Text = (Convert.ToDouble(txtSasia.Text) * Convert.ToDouble(txtCmimi.Text)).ToString()
                Else
                End If
    
            Catch Ex As Exception
                txtSasia.Text = ""
            End Try
    
        End Sub
    
        Private Sub cmdShite_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdShite.Click
    
            Dim malli_ne_disponim As Boolean = False
            Dim intSasia As Integer = 0
            Dim dCmimiShites As Double = 0
    
            If lblPershkrimi.Text <> "" Then
    
                Try
                    intSasia = Convert.ToInt32(txtSasia.Text)
                    malli_ne_disponim = verteto_sasine(intSasia)
    
                    If malli_ne_disponim = True Then
    
                        While intSasia > 0
    
                            Dim tmpSasia As Integer = 0
                            Dim tmpRow As Integer = 0
    
                            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
                            con.Open()
    
                            Dim strSQL As String
    
                            If rdFIFO.Checked = True Then
                                strSQL = "SELECT * FROM Hyrjet WHERE Kodi=" + cboKodi.Text + " ORDER BY Data ASC"
                            Else
                                strSQL = "SELECT * FROM Hyrjet WHERE Kodi=" + cboKodi.Text + " ORDER BY Data DESC"
                            End If
    
                            Dim cmd = New OleDbCommand(strSQL, con)
                            Dim dr As OleDbDataReader = cmd.ExecuteReader
    
                            While dr.Read()
                                tmpSasia = Convert.ToInt32(dr("Sasia"))
                                tmpRow = Convert.ToInt32(dr("Id"))
                                Exit While
                            End While
    
                            If (intSasia - tmpSasia) >= 0 Then
                                intSasia -= tmpSasia
                                shlyje_rekordin(tmpRow)
                            ElseIf (intSasia - tmpSasia) = 0 Then
                                shlyje_rekordin(tmpRow)
                                intSasia -= tmpSasia
                            ElseIf (intSasia - tmpSasia) < 0 Then
                                tmpSasia -= intSasia
                                intSasia = 0
                                aktualizo_rekordin(tmpRow, tmpSasia)
                            End If
    
                            con.Close()
    
                        End While
    
                        fute_shitjen()
                        MessageBox.Show("Transaksioni perfundoi" & vbNewLine & "" & vbNewLine & "Keni shitur " + txtSasia.Text + " " + lblPershkrimi.Text)
                        mbushe_kombon()
                    Else
                        sasia_ne_inventar()
                        MessageBox.Show("Ske " + lblPershkrimi.Text + " sa po do me shite!" & vbNewLine & "I ke " + lblDispo.Text + " " + lblPershkrimi.Text + " e po do me i shite " + txtSasia.Text + " " + lblPershkrimi.Text + ".Tzzz." & vbNewLine & "" & vbNewLine & "Mule shko blej " + lblPershkrimi.Text + " tjera njeri!")
                        txtSasia.Text = ""
                    End If
    
                Catch Ex As Exception
                    txtSasia.Text = ""
                    MessageBox.Show("Fute sasine!")
                End Try
    
            Else
                MessageBox.Show("Zgjidhe nje mall!")
            End If
    
        End Sub
    
        Private Sub fute_shitjen()
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim cmd = New OleDbCommand("INSERT INTO Daljet (Data, Kodi , Pershkrimi, Njm, Sasia, CmimiShites, Vlera) VALUES ('" + String.Format("{0:dd.MM.yyyy HH:mm:ss}", DateTime.Now) + "','" + cboKodi.Text + "','" + lblPershkrimi.Text + "','" + lblNjm.Text + "','" + txtSasia.Text + "','" + txtCmimi.Text + "','" + lblVlera.Text + "')", con)
    
            cmd.ExecuteNonQuery()
    
            con.Close()
    
        End Sub
    
        Private Sub aktualizo_rekordin(ByVal tmpRow, ByVal tmpSasia)
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim cmd = New OleDbCommand("UPDATE Hyrjet SET Sasia =" & tmpSasia & " WHERE Id=" & tmpRow, con)
    
            cmd.ExecuteNonQuery()
    
            con.Close()
            sasia_ne_inventar()
    
        End Sub
    
        Private Sub shlyje_rekordin(ByVal tmpRow)
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim cmd = New OleDbCommand("DELETE FROM Hyrjet WHERE ID =" & tmpRow & "", con)
            cmd.ExecuteNonQuery()
    
            con.Close()
            sasia_ne_inventar()
    
        End Sub
    
        Private Function verteto_sasine(ByVal intSasia) As Boolean
    
            Dim sasiaDB As Integer = 0
    
            Dim x As Boolean = False
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim strSQL As String = "SELECT * FROM Hyrjet WHERE Kodi=" + cboKodi.Text
    
            Dim cmd = New OleDbCommand(strSQL, con)
            Dim dr As OleDbDataReader = cmd.ExecuteReader
    
            While dr.Read()
                sasiaDB += Convert.ToInt32(dr("Sasia"))
            End While
    
            lblDispo.Text = sasiaDB.ToString() + " " + lblPershkrimi.Text
    
            If (sasiaDB >= intSasia) Then
                x = True
            Else
                x = False
            End If
    
            con.Close()
    
            verteto_sasine = x
    
        End Function
    
        Private Sub cmdRuaj_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdRuaj.Click
    
            If cmbHKodi.Text <> "" And cmbHPershkrimi.Text <> "" And cmbHNjm.Text <> "" And txtHSasia.Text <> "" And txtHCmimiFurnizues.Text <> "" Then
                Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
                con.Open()
    
                Dim cmd = New OleDbCommand("INSERT INTO Hyrjet (Data, Kodi, Pershkrimi, Njm, Sasia, CmimiFurnizues, Vlera) VALUES ('" + String.Format("{0:dd.MM.yyyy HH:mm:ss}", DateTime.Now) + "','" + cmbHKodi.Text + "','" + cmbHPershkrimi.Text + "','" + cmbHNjm.Text + "','" + txtHSasia.Text + "','" + txtHCmimiFurnizues.Text + "','" + (Convert.ToDouble(txtHSasia.Text) * Convert.ToDouble(txtHCmimiFurnizues.Text)).ToString() + "')", con)
    
                cmd.ExecuteNonQuery()
    
                MessageBox.Show(txtHSasia.Text & " " & cmbHPershkrimi.Text & " - u ruajten ne Databaze!")
    
                con.Close()
            Else
                MessageBox.Show("Nuk i keni futur te gjitha te dhenat!")
            End If
    
        End Sub
    
        Private Sub tabDaljet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tabDaljet.Click
    
            mbushe_kombon()
    
        End Sub
    
        Private Sub tabHyrjet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tabHyrjet.Click
    
            mbushe_kombon()
    
        End Sub
    
        Private Sub cmbHKodi_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbHKodi.SelectedIndexChanged
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim strSQL As String = "SELECT * FROM Hyrjet WHERE Kodi=" + cmbHKodi.Text
    
            Dim cmd = New OleDbCommand(strSQL, con)
            Dim dr As OleDbDataReader = cmd.ExecuteReader
    
            While dr.Read()
                cmbHPershkrimi.Text = dr("Pershkrimi")
                cmbHNjm.Text = dr("Njm")
            End While
    
            con.Close()
    
        End Sub
    
        Private Sub txtCmimi_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtCmimi.TextChanged
    
            Try
                If txtSasia.Text <> "" Then
                    lblVlera.Text = (Convert.ToDouble(txtSasia.Text) * Convert.ToDouble(txtCmimi.Text)).ToString()
                Else
                    MessageBox.Show("Mungon sasia!")
                End If
    
            Catch Ex As Exception
                txtCmimi.Text = ""
            End Try
    
        End Sub
    
    End Class

    Emaili nuk po te vjen ne ate adrese te emailit!
    Skedarėt e Bashkėngjitur Skedarėt e Bashkėngjitur

  9. #9
    i/e regjistruar Maska e hot_prinz
    Anėtarėsuar
    29-05-2007
    Vendndodhja
    Frankfurt
    Postime
    9,879
    E verejta qe programi nuk funksiononte per shkak te nderrimit te sistemeve operative 32 e 4 bit gjate kodimit. Tani si duket punon ne 32 dhe 64 bit, respektivisht visual studio 2008 dhe visual studio 2010.

    Te tabela daljet tani llogaritet nje cmimMesatarFurnizues dhe llogaritjen e fitimit ne kolonen fitimi per cdo transaksion.

    Kodi:
    Imports System.Data.OleDb
    
    
    Public Class Form1
    
        Private Sub cboKodi_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboKodi.SelectedIndexChanged
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim strSQL As String = "SELECT * FROM Hyrjet WHERE Kodi=" + cboKodi.Text
    
            Dim cmd = New OleDbCommand(strSQL, con)
            Dim dr As OleDbDataReader = cmd.ExecuteReader
    
            While dr.Read()
                lblPershkrimi.Text = dr("Pershkrimi")
                lblNjm.Text = dr("Njm")
            End While
    
            con.Close()
    
            sasia_ne_inventar()
    
        End Sub
    
        Private Sub sasia_ne_inventar()
    
            Dim sasiaDB As Integer = 0
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim strSQL As String = "SELECT * FROM Hyrjet WHERE Kodi=" + cboKodi.Text
    
            Dim cmd = New OleDbCommand(strSQL, con)
            Dim dr As OleDbDataReader = cmd.ExecuteReader
    
            While dr.Read()
                sasiaDB += Convert.ToInt32(dr("Sasia"))
            End While
    
            lblDispo.Text = sasiaDB.ToString() + " " + lblPershkrimi.Text
    
            con.Close()
    
        End Sub
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
            mbushe_kombon()
            rdFIFO.Checked = True
    
        End Sub
    
        Private Sub mbushe_kombon()
    
            cboKodi.Items.Clear()
            cmbHKodi.Items.Clear()
    
            Dim strKodi = New ArrayList()
            Dim strPershkrimi = New ArrayList()
            Dim strNjm = New ArrayList()
    
            Try
    
    
                Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
                con.Open()
    
    
                Dim strSQL As String = "SELECT * FROM Hyrjet"
    
                Dim cmd = New OleDbCommand(strSQL, con)
                Dim dr As OleDbDataReader = cmd.ExecuteReader
    
                While dr.Read()
                    Dim ekziston As Boolean = False
                    Dim ekzistonP As Boolean = False
                    Dim ekzistonN As Boolean = False
    
                    For Each s In strKodi
                        If dr("Kodi") = s Then
                            ekziston = True
                        End If
                    Next
    
                    If ekziston = False Then
                        strKodi.Add(dr("Kodi"))
                    End If
    
                    For Each s In strPershkrimi
                        If dr("Pershkrimi") = s Then
                            ekzistonP = True
                        End If
                    Next
    
                    If ekzistonP = False Then
                        strPershkrimi.Add(dr("Pershkrimi"))
                    End If
    
                    For Each s In strNjm
                        If dr("Njm") = s Then
                            ekzistonN = True
                        End If
                    Next
    
                    If ekzistonN = False Then
                        strNjm.Add(dr("Njm"))
                    End If
    
                End While
    
                strKodi.Sort()
    
                For Each s In strKodi
                    cboKodi.Items.Add(s)
                    cmbHKodi.Items.Add(s)
                Next
    
                For Each s In strPershkrimi
                    cmbHPershkrimi.Items.Add(s)
                Next
    
                For Each s In strNjm
                    cmbHNjm.Items.Add(s)
                Next
    
                con.Close()
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
    
        End Sub
    
        Private Sub txtSasia_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSasia.TextChanged
    
            'Try
            '    txtSasia.Text = Convert.ToDouble(txtSasia.Text).ToString()
            'Catch Ex As Exception
            '    txtSasia.Text = ""
            'End Try
    
            Try
                If txtCmimi.Text <> "" Then
                    lblVlera.Text = (Convert.ToDouble(txtSasia.Text) * Convert.ToDouble(txtCmimi.Text)).ToString()
                Else
                End If
    
            Catch Ex As Exception
                txtSasia.Text = ""
            End Try
    
        End Sub
    
        Private Sub cmdShite_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdShite.Click
    
            Dim malli_ne_disponim As Boolean = False
            Dim intSasia As Integer = 0
            Dim dCmimiShites As Double = 0
            Dim dCmimiFurnizuesMesatar As Double = 0
    
            If lblPershkrimi.Text <> "" Then
    
                Try
                    intSasia = Convert.ToInt32(txtSasia.Text)
                    malli_ne_disponim = verteto_sasine(intSasia)
    
                    If malli_ne_disponim = True Then
    
                        While intSasia > 0
    
                            Dim tmpSasia As Integer = 0
                            Dim tmpRow As Integer = 0
                            Dim tmpCmimiFurnizues As Double = 0
    
                            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
                            con.Open()
    
                            Dim strSQL As String
    
                            If rdFIFO.Checked = True Then
                                strSQL = "SELECT * FROM Hyrjet WHERE Kodi=" + cboKodi.Text + " ORDER BY Data ASC"
                            Else
                                strSQL = "SELECT * FROM Hyrjet WHERE Kodi=" + cboKodi.Text + " ORDER BY Data DESC"
                            End If
    
                            Dim cmd = New OleDbCommand(strSQL, con)
                            Dim dr As OleDbDataReader = cmd.ExecuteReader
    
                            While dr.Read()
                                tmpSasia = Convert.ToInt32(dr("Sasia"))
                                tmpRow = Convert.ToInt32(dr("Id"))
                                tmpCmimiFurnizues = Convert.ToDouble(dr("CmimiFurnizues"))
                                Exit While
                            End While
    
                            If (intSasia - tmpSasia) >= 0 Then
                                dCmimiFurnizuesMesatar += tmpCmimiFurnizues * intSasia
                                intSasia -= tmpSasia
                                shlyje_rekordin(tmpRow)
                            ElseIf (intSasia - tmpSasia) = 0 Then
                                dCmimiFurnizuesMesatar += tmpCmimiFurnizues * intSasia
                                shlyje_rekordin(tmpRow)
                                intSasia -= tmpSasia
                            ElseIf (intSasia - tmpSasia) < 0 Then
                                dCmimiFurnizuesMesatar += tmpCmimiFurnizues * intSasia
                                tmpSasia -= intSasia
                                intSasia = 0
                                aktualizo_rekordin(tmpRow, tmpSasia)
                            End If
    
                            con.Close()
    
                        End While
    
                        dCmimiFurnizuesMesatar = dCmimiFurnizuesMesatar / Convert.ToInt32(txtSasia.Text)
    
                        fute_shitjen(dCmimiFurnizuesMesatar)
                        MessageBox.Show("Transaksioni perfundoi" & vbNewLine & "" & vbNewLine & "Keni shitur " + txtSasia.Text + " " + lblPershkrimi.Text)
                        mbushe_kombon()
                    Else
                        sasia_ne_inventar()
                        MessageBox.Show("Ske " + lblPershkrimi.Text + " sa po do me shite!" & vbNewLine & "I ke " + lblDispo.Text + " " + lblPershkrimi.Text + " e po do me i shite " + txtSasia.Text + " " + lblPershkrimi.Text + ".Tzzz." & vbNewLine & "" & vbNewLine & "Mule shko blej " + lblPershkrimi.Text + " tjera njeri!")
                        txtSasia.Text = ""
                    End If
    
                Catch Ex As Exception
                    txtSasia.Text = ""
                    MessageBox.Show("Fute sasine!")
                End Try
    
            Else
                MessageBox.Show("Zgjidhe nje mall!")
            End If
    
        End Sub
    
        Private Sub fute_shitjen(ByVal dCmimiFurnizuesMesatar)
    
            Dim sCmimi As String = txtCmimi.Text.Replace(".", ",")
            Dim sVlera As Double = Convert.ToDouble(txtSasia.Text) * Convert.ToDouble(sCmimi)
            Dim sFitimi As Double = sVlera - (dCmimiFurnizuesMesatar * Convert.ToDouble(txtSasia.Text))
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim cmd = New OleDbCommand("INSERT INTO Daljet (Data, Kodi , Pershkrimi, Njm, Sasia, CmimiMesatarFurnizues, CmimiShites, Vlera, Fitimi) VALUES ('" + String.Format("{0:dd.MM.yyyy HH:mm:ss}", DateTime.Now) + "','" + cboKodi.Text + "','" + lblPershkrimi.Text + "','" + lblNjm.Text + "','" + txtSasia.Text + "','" + dCmimiFurnizuesMesatar.ToString() + "','" + sCmimi + "','" + sVlera.ToString() + "','" + sFitimi.ToString() + "')", con)
    
            cmd.ExecuteNonQuery()
    
            con.Close()
    
        End Sub
    
        Private Sub aktualizo_rekordin(ByVal tmpRow, ByVal tmpSasia)
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim cmd = New OleDbCommand("UPDATE Hyrjet SET Sasia =" & tmpSasia & " WHERE Id=" & tmpRow, con)
    
            cmd.ExecuteNonQuery()
    
            con.Close()
            sasia_ne_inventar()
    
        End Sub
    
        Private Sub shlyje_rekordin(ByVal tmpRow)
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim cmd = New OleDbCommand("DELETE FROM Hyrjet WHERE ID =" & tmpRow & "", con)
            cmd.ExecuteNonQuery()
    
            con.Close()
            sasia_ne_inventar()
    
        End Sub
    
        Private Function verteto_sasine(ByVal intSasia) As Boolean
    
            Dim sasiaDB As Integer = 0
    
            Dim x As Boolean = False
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim strSQL As String = "SELECT * FROM Hyrjet WHERE Kodi=" + cboKodi.Text
    
            Dim cmd = New OleDbCommand(strSQL, con)
            Dim dr As OleDbDataReader = cmd.ExecuteReader
    
            While dr.Read()
                sasiaDB += Convert.ToInt32(dr("Sasia"))
            End While
    
            lblDispo.Text = sasiaDB.ToString() + " " + lblPershkrimi.Text
    
            If (sasiaDB >= intSasia) Then
                x = True
            Else
                x = False
            End If
    
            con.Close()
    
            verteto_sasine = x
    
        End Function
    
        Private Sub cmdRuaj_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdRuaj.Click
    
    
            If cmbHKodi.Text <> "" And cmbHPershkrimi.Text <> "" And cmbHNjm.Text <> "" And txtHSasia.Text <> "" And txtHCmimiFurnizues.Text <> "" Then
    
                Dim sCmimi As String = txtHCmimiFurnizues.Text
                sCmimi = sCmimi.Replace(".", ",")
    
                Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
                con.Open()
    
                Dim cmd = New OleDbCommand("INSERT INTO Hyrjet (Data, Kodi, Pershkrimi, Njm, Sasia, CmimiFurnizues, Vlera) VALUES ('" + String.Format("{0:dd.MM.yyyy HH:mm:ss}", DateTime.Now) + "','" + cmbHKodi.Text + "','" + cmbHPershkrimi.Text + "','" + cmbHNjm.Text + "','" + txtHSasia.Text + "','" + sCmimi.ToString() + "','" + (Convert.ToDouble(txtHSasia.Text) * Convert.ToDouble(sCmimi)).ToString() + "')", con)
    
                cmd.ExecuteNonQuery()
    
                MessageBox.Show(txtHSasia.Text & " " & cmbHPershkrimi.Text & " - u ruajten ne Databaze!")
    
                con.Close()
            Else
                MessageBox.Show("Nuk i keni futur te gjitha te dhenat!")
            End If
    
        End Sub
    
        Private Sub tabDaljet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tabDaljet.Click
    
            mbushe_kombon()
    
        End Sub
    
        Private Sub tabHyrjet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tabHyrjet.Click
    
            mbushe_kombon()
    
        End Sub
    
        Private Sub cmbHKodi_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbHKodi.SelectedIndexChanged
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim strSQL As String = "SELECT * FROM Hyrjet WHERE Kodi=" + cmbHKodi.Text
    
            Dim cmd = New OleDbCommand(strSQL, con)
            Dim dr As OleDbDataReader = cmd.ExecuteReader
    
            While dr.Read()
                cmbHPershkrimi.Text = dr("Pershkrimi")
                cmbHNjm.Text = dr("Njm")
            End While
    
            con.Close()
    
        End Sub
    
        Private Sub txtCmimi_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtCmimi.TextChanged
    
            Try
    
                If txtSasia.Text <> "" Then
                    lblVlera.Text = (Convert.ToDouble(txtSasia.Text) * Convert.ToDouble(txtCmimi.Text)).ToString()
                Else
                    MessageBox.Show("Mungon sasia!")
                End If
    
            Catch Ex As Exception
    
                txtCmimi.Text = ""
    
            End Try
    
        End Sub
    
    End Class
    Skedarėt e Bashkėngjitur Skedarėt e Bashkėngjitur

  10. #10
    i/e regjistruar Maska e hot_prinz
    Anėtarėsuar
    29-05-2007
    Vendndodhja
    Frankfurt
    Postime
    9,879
    Tani nje ndryshim me pamje te inventarit per artikullin e zgjedhur, te tabela artikujt ruhen cmimet e shitjes, dhe kur nje artikull i ri hyn ne tabelen hyrja futet automatikisht edhe te tabela artikujt por pa cmimin shites, cmimi shites ndryshohet vetem te regjistri artikujt ose direkt ne db. Perdore Databazen ne kete shembull sepse ka ndryshime ne kolona te tabelave:

    Kodi:
    Imports System.Data.OleDb
    Imports System.ComponentModel
    
    
    Public Class Form1
    
        Private Sub cboKodi_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboKodi.SelectedIndexChanged
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
            Dim sCodi As String = cboKodi.Text
            Dim strSQL As String = "SELECT * FROM Hyrjet WHERE Kodi=" + sCodi
    
            Dim cmd = New OleDbCommand(strSQL, con)
            Dim dr As OleDbDataReader = cmd.ExecuteReader
    
            While dr.Read()
                lblPershkrimi.Text = dr("Pershkrimi")
                lblNjm.Text = dr("Njm")
            End While
    
            con.Close()
    
            txtCmimi.Text = fute_cmimin_e_shitjes(sCodi)
    
            mbushe_data_grid(dgwInventari, cboKodi.Text)
            sasia_ne_inventar()
    
        End Sub
    
        Private Function fute_cmimin_e_shitjes(ByVal sCodi)
            Dim bExziston As Boolean = False
            bExziston = ekziston_artikulli(sCodi)
            Dim s As String = ""
            If bExziston = True Then
    
                Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
                con.Open()
    
                Dim strSQL As String = "SELECT * FROM Artikujt WHERE Kodi=" + cboKodi.Text
    
                Dim cmd = New OleDbCommand(strSQL, con)
                Dim dr As OleDbDataReader = cmd.ExecuteReader
    
                While dr.Read()
                    If Not IsDBNull(dr("CmimiShitjes")) Then
                        s = dr("CmimiShitjes")
                    End If
                End While
    
                con.Close()
    
            End If
            fute_cmimin_e_shitjes = s
        End Function
    
        Private Sub mbushe_data_grid(ByRef dgwInventari, ByVal sCodi)
    
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim strSQL As String = "SELECT * FROM Hyrjet WHERE Kodi=" + sCodi
    
            Dim cmd = New OleDbCommand(strSQL, con)
            Dim dr As OleDbDataReader = cmd.ExecuteReader
    
            Dim dt = New DataTable()
    
            dt.Columns.Add("Data")
            dt.Columns.Add("Kodi")
            dt.Columns.Add("Pershkrimi")
            dt.Columns.Add("Njm")
            dt.Columns.Add("Sasia")
            dt.Columns.Add("CmimiFurnizues")
    
            While dr.Read()
                dt.Rows.Add(New Object() {dr("Data"), dr("Kodi"), dr("Pershkrimi"), dr("Njm"), dr("Sasia"), dr("CmimiFurnizues")})
            End While
    
            dgwInventari.DataSource = dt
            dgwInventari.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells)
            If rdFIFO.Checked = True Then
                dgwInventari.Sort(dgwInventari.Columns(0), ListSortDirection.Ascending)
            Else
                dgwInventari.Sort(dgwInventari.Columns(0), ListSortDirection.Descending)
            End If
            con.Close()
    
        End Sub
    
        Private Sub sasia_ne_inventar()
    
            Dim sasiaDB As Integer = 0
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim strSQL As String = "SELECT * FROM Hyrjet WHERE Kodi=" + cboKodi.Text
    
            Dim cmd = New OleDbCommand(strSQL, con)
            Dim dr As OleDbDataReader = cmd.ExecuteReader
    
            While dr.Read()
                sasiaDB += Convert.ToInt32(dr("Sasia"))
            End While
    
            lblDispo.Text = sasiaDB.ToString() + " " + lblPershkrimi.Text
    
            con.Close()
    
        End Sub
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
            mbushe_kombon()
            mbushe_kombon_artikujt()
            rdFIFO.Checked = True
    
        End Sub
    
        Private Sub mbushe_kombon()
    
            cboKodi.Items.Clear()
            cmbHKodi.Items.Clear()
            cmbHPershkrimi.Items.Clear()
            cmbHNjm.Items.Clear()
    
            Dim strKodi = New ArrayList()
            Dim strPershkrimi = New ArrayList()
            Dim strNjm = New ArrayList()
    
            Try
    
    
                Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
                con.Open()
    
    
                Dim strSQL As String = "SELECT * FROM Hyrjet"
    
                Dim cmd = New OleDbCommand(strSQL, con)
                Dim dr As OleDbDataReader = cmd.ExecuteReader
    
                While dr.Read()
                    Dim ekziston As Boolean = False
                    Dim ekzistonP As Boolean = False
                    Dim ekzistonN As Boolean = False
    
                    For Each s In strKodi
                        If dr("Kodi") = s Then
                            ekziston = True
                        End If
                    Next
    
                    If ekziston = False Then
                        strKodi.Add(dr("Kodi"))
                    End If
    
                    For Each s In strPershkrimi
                        If dr("Pershkrimi") = s Then
                            ekzistonP = True
                        End If
                    Next
    
                    If ekzistonP = False Then
                        strPershkrimi.Add(dr("Pershkrimi"))
                    End If
    
                    For Each s In strNjm
                        If dr("Njm") = s Then
                            ekzistonN = True
                        End If
                    Next
    
                    If ekzistonN = False Then
                        strNjm.Add(dr("Njm"))
                    End If
    
                End While
    
                strKodi.Sort()
    
                For Each s In strKodi
                    cboKodi.Items.Add(s)
                    cmbHKodi.Items.Add(s)
                Next
    
                For Each s In strPershkrimi
                    cmbHPershkrimi.Items.Add(s)
                Next
    
                For Each s In strNjm
                    cmbHNjm.Items.Add(s)
                Next
    
                con.Close()
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
    
        End Sub
    
        Private Sub txtSasia_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSasia.TextChanged
    
            Try
                If txtCmimi.Text <> "" Then
                    lblVlera.Text = (Convert.ToDouble(txtSasia.Text) * Convert.ToDouble(txtCmimi.Text)).ToString()
                Else
                End If
    
            Catch Ex As Exception
                txtSasia.Text = ""
            End Try
    
        End Sub
    
        Private Sub cmdShite_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdShite.Click
    
            Dim malli_ne_disponim As Boolean = False
            Dim intSasia As Integer = 0
            Dim dCmimiShites As Double = 0
            Dim dCmimiFurnizuesMesatar As Double = 0
            Dim sCodi As String = cboKodi.Text
    
            If lblPershkrimi.Text <> "" Then
    
                Try
                    intSasia = Convert.ToInt32(txtSasia.Text)
                    malli_ne_disponim = verteto_sasine(intSasia)
    
                    If malli_ne_disponim = True Then
    
                        While intSasia > 0
    
                            Dim tmpSasia As Integer = 0
                            Dim tmpRow As Integer = 0
                            Dim tmpCmimiFurnizues As Double = 0
    
                            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
                            con.Open()
    
                            Dim strSQL As String
    
                            If rdFIFO.Checked = True Then
                                strSQL = "SELECT * FROM Hyrjet WHERE Kodi=" + sCodi + " ORDER BY Data ASC"
                            Else
                                strSQL = "SELECT * FROM Hyrjet WHERE Kodi=" + sCodi + " ORDER BY Data DESC"
                            End If
    
                            Dim cmd = New OleDbCommand(strSQL, con)
                            Dim dr As OleDbDataReader = cmd.ExecuteReader
    
                            While dr.Read()
                                tmpSasia = Convert.ToInt32(dr("Sasia"))
                                tmpRow = Convert.ToInt32(dr("Id"))
                                tmpCmimiFurnizues = Convert.ToDouble(dr("CmimiFurnizues"))
                                Exit While
                            End While
    
                            If (intSasia - tmpSasia) >= 0 Then
                                dCmimiFurnizuesMesatar += tmpCmimiFurnizues * intSasia
                                intSasia -= tmpSasia
                                shlyje_rekordin(tmpRow)
                            ElseIf (intSasia - tmpSasia) = 0 Then
                                dCmimiFurnizuesMesatar += tmpCmimiFurnizues * intSasia
                                shlyje_rekordin(tmpRow)
                                intSasia -= tmpSasia
                            ElseIf (intSasia - tmpSasia) < 0 Then
                                dCmimiFurnizuesMesatar += tmpCmimiFurnizues * intSasia
                                tmpSasia -= intSasia
                                intSasia = 0
                                aktualizo_rekordin(tmpRow, tmpSasia)
                            End If
    
                            con.Close()
                            mbushe_data_grid(dgwInventari, sCodi)
    
                        End While
    
                        dCmimiFurnizuesMesatar = dCmimiFurnizuesMesatar / Convert.ToInt32(txtSasia.Text)
    
                        fute_shitjen(dCmimiFurnizuesMesatar)
                        MessageBox.Show("Transaksioni perfundoi" & vbNewLine & "" & vbNewLine & "Keni shitur " + txtSasia.Text + " " + lblPershkrimi.Text)
                        mbushe_kombon()
                    Else
                        sasia_ne_inventar()
                        MessageBox.Show("Ske " + lblPershkrimi.Text + " sa po do me shite!" & vbNewLine & "I ke " + lblDispo.Text + " " + lblPershkrimi.Text + " e po do me i shite " + txtSasia.Text + " " + lblPershkrimi.Text + ".Tzzz." & vbNewLine & "" & vbNewLine & "Mule shko blej " + lblPershkrimi.Text + " tjera njeri!")
                        txtSasia.Text = ""
                    End If
    
                Catch Ex As Exception
                    txtSasia.Text = ""
                    MessageBox.Show("Fute sasine/cmimin!")
                End Try
    
            Else
                MessageBox.Show("Zgjidhe nje mall!")
            End If
    
        End Sub
    
        Private Sub fute_shitjen(ByVal dCmimiFurnizuesMesatar)
    
            Dim sCmimi As String = txtCmimi.Text.Replace(".", ",")
            Dim sVlera As Double = Convert.ToDouble(txtSasia.Text) * Convert.ToDouble(sCmimi)
            Dim sFitimi As Double = sVlera - (dCmimiFurnizuesMesatar * Convert.ToDouble(txtSasia.Text))
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim cmd = New OleDbCommand("INSERT INTO Daljet (Data, Kodi , Pershkrimi, Njm, Sasia, CmimiMesatarFurnizues, CmimiShites, Vlera, Fitimi) VALUES ('" + String.Format("{0:dd.MM.yyyy HH:mm:ss}", DateTime.Now) + "','" + cboKodi.Text + "','" + lblPershkrimi.Text + "','" + lblNjm.Text + "','" + txtSasia.Text + "','" + dCmimiFurnizuesMesatar.ToString() + "','" + sCmimi + "','" + sVlera.ToString() + "','" + sFitimi.ToString() + "')", con)
    
            cmd.ExecuteNonQuery()
    
            con.Close()
    
        End Sub
    
        Private Sub aktualizo_rekordin(ByVal tmpRow, ByVal tmpSasia)
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim cmd = New OleDbCommand("UPDATE Hyrjet SET Sasia =" & tmpSasia & " WHERE Id=" & tmpRow, con)
    
            cmd.ExecuteNonQuery()
    
            con.Close()
            sasia_ne_inventar()
    
        End Sub
    
        Private Sub shlyje_rekordin(ByVal tmpRow)
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim cmd = New OleDbCommand("DELETE FROM Hyrjet WHERE ID =" & tmpRow & "", con)
            cmd.ExecuteNonQuery()
    
            con.Close()
            sasia_ne_inventar()
    
        End Sub
    
        Private Function verteto_sasine(ByVal intSasia) As Boolean
    
            Dim sasiaDB As Integer = 0
    
            Dim x As Boolean = False
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim strSQL As String = "SELECT * FROM Hyrjet WHERE Kodi=" + cboKodi.Text
    
            Dim cmd = New OleDbCommand(strSQL, con)
            Dim dr As OleDbDataReader = cmd.ExecuteReader
    
            While dr.Read()
                sasiaDB += Convert.ToInt32(dr("Sasia"))
            End While
    
            lblDispo.Text = sasiaDB.ToString() + " " + lblPershkrimi.Text
    
            If (sasiaDB >= intSasia) Then
                x = True
            Else
                x = False
            End If
    
            con.Close()
    
            verteto_sasine = x
    
        End Function
    
        Private Sub cmdRuaj_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdRuaj.Click
    
    
            If cmbHKodi.Text <> "" And cmbHPershkrimi.Text <> "" And cmbHNjm.Text <> "" And txtHSasia.Text <> "" And txtHCmimiFurnizues.Text <> "" Then
    
                Dim sCodi As String = cmbHKodi.Text
                Dim sCmimi As String = txtHCmimiFurnizues.Text
                sCmimi = sCmimi.Replace(".", ",")
    
                Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
                con.Open()
    
                Dim cmd = New OleDbCommand("INSERT INTO Hyrjet (Data, Kodi, Pershkrimi, Njm, Sasia, CmimiFurnizues, Vlera) VALUES ('" + String.Format("{0:dd.MM.yyyy HH:mm:ss}", DateTime.Now) + "','" + cmbHKodi.Text + "','" + cmbHPershkrimi.Text + "','" + cmbHNjm.Text + "','" + txtHSasia.Text + "','" + sCmimi.ToString() + "','" + (Convert.ToDouble(txtHSasia.Text) * Convert.ToDouble(sCmimi)).ToString() + "')", con)
    
                cmd.ExecuteNonQuery()
    
                MessageBox.Show(txtHSasia.Text & " " & cmbHPershkrimi.Text & " - u ruajten ne Databaze!")
    
    
    
                Dim bExziston As Double = False
                bExziston = ekziston_artikulli(sCodi)
    
                Dim cmdX
    
                If bExziston = False Then
                    cmdX = New OleDbCommand("INSERT INTO Artikujt (Kodi, Pershkrimi, Njm) VALUES ('" + cmbHKodi.Text + "','" + cmbHPershkrimi.Text + "','" + cmbHNjm.Text + "')", con)
                    cmdX.ExecuteNonQuery()
                End If
    
                con.Close()
    
                mbushe_data_grid(dgwHInventari, sCodi)
    
            Else
                MessageBox.Show("Nuk i keni futur te gjitha te dhenat!")
            End If
    
        End Sub
    
        Private Sub tabDaljet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tabDaljet.Click
    
            mbushe_kombon()
    
        End Sub
    
        Private Sub tabHyrjet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tabHyrjet.Click
    
            mbushe_kombon()
    
        End Sub
    
        Private Sub cmbHKodi_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbHKodi.SelectedIndexChanged
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim sCodi As String = cmbHKodi.Text
            Dim strSQL As String = "SELECT * FROM Hyrjet WHERE Kodi=" + cmbHKodi.Text
    
            Dim cmd = New OleDbCommand(strSQL, con)
            Dim dr As OleDbDataReader = cmd.ExecuteReader
    
            While dr.Read()
                cmbHPershkrimi.Text = dr("Pershkrimi")
                cmbHNjm.Text = dr("Njm")
            End While
    
            con.Close()
    
            mbushe_data_grid(dgwHInventari, sCodi)
    
        End Sub
    
        Private Sub txtCmimi_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtCmimi.TextChanged
    
            Try
    
                If txtSasia.Text <> "" Then
                    lblVlera.Text = (Convert.ToDouble(txtSasia.Text) * Convert.ToDouble(txtCmimi.Text)).ToString()
                End If
    
            Catch Ex As Exception
    
                txtCmimi.Text = ""
    
            End Try
    
        End Sub
    
        Private Sub rdFIFO_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdFIFO.CheckedChanged
    
            dgwInventari.Sort(dgwInventari.Columns(0), ListSortDirection.Ascending)
            'dgwHInventari.Sort(dgwInventari.Columns(0), ListSortDirection.Ascending)
            'dgwAInventari.Sort(dgwInventari.Columns(0), ListSortDirection.Ascending)
    
        End Sub
    
        Private Sub rdLIFO_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdLIFO.CheckedChanged
    
            dgwInventari.Sort(dgwInventari.Columns(0), ListSortDirection.Descending)
            'dgwHInventari.Sort(dgwInventari.Columns(0), ListSortDirection.Descending)
            'dgwAInventari.Sort(dgwInventari.Columns(0), ListSortDirection.Descending)
    
        End Sub
    
        Private Sub tabArtikujt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tabArtikujt.Click
            mbushe_kombon_artikujt()
        End Sub
    
        Private Sub mbushe_kombon_artikujt()
    
            cmbAKodi.Items.Clear()
            cmbAPershkrimi.Items.Clear()
            cmbANjm.Items.Clear()
    
            Dim strKodi = New ArrayList()
            Dim strPershkrimi = New ArrayList()
            Dim strNjm = New ArrayList()
    
            Try
    
    
                Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
                con.Open()
    
    
                Dim strSQL As String = "SELECT * FROM Artikujt"
    
                Dim cmd = New OleDbCommand(strSQL, con)
                Dim dr As OleDbDataReader = cmd.ExecuteReader
    
                While dr.Read()
                    Dim ekziston As Boolean = False
                    Dim ekzistonP As Boolean = False
                    Dim ekzistonN As Boolean = False
    
                    For Each s In strKodi
                        If dr("Kodi") = s Then
                            ekziston = True
                        End If
                    Next
    
                    If ekziston = False Then
                        strKodi.Add(dr("Kodi"))
                    End If
    
                    For Each s In strPershkrimi
                        If dr("Pershkrimi") = s Then
                            ekzistonP = True
                        End If
                    Next
    
                    If ekzistonP = False Then
                        strPershkrimi.Add(dr("Pershkrimi"))
                    End If
    
                    For Each s In strNjm
                        If dr("Njm") = s Then
                            ekzistonN = True
                        End If
                    Next
    
                    If ekzistonN = False Then
                        strNjm.Add(dr("Njm"))
                    End If
    
                End While
    
                strKodi.Sort()
    
                For Each s In strKodi
                    cmbAKodi.Items.Add(s)
                Next
    
                For Each s In strPershkrimi
                    cmbAPershkrimi.Items.Add(s)
                Next
    
                For Each s In strNjm
                    cmbANjm.Items.Add(s)
                Next
    
                con.Close()
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
    
        End Sub
    
        Private Sub cmbAKodi_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbAKodi.SelectedIndexChanged
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
            Dim sCodi As String = cmbAKodi.Text
            Dim strSQL As String = "SELECT * FROM Artikujt WHERE Kodi=" + sCodi
    
            Dim cmd = New OleDbCommand(strSQL, con)
            Dim dr As OleDbDataReader = cmd.ExecuteReader
    
            While dr.Read()
                cmbAPershkrimi.Text = dr("Pershkrimi")
                cmbANjm.Text = dr("Njm")
                If Not IsDBNull(dr("CmimiShitjes")) Then
                    txtACmimiShitjes.Text = dr("CmimiShitjes")
                End If
    
            End While
    
            con.Close()
            mbushe_data_grid(dgwAInventari, sCodi)
    
        End Sub
    
        Private Sub cmdArtikujt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdArtikujt.Click
    
            If cmbAKodi.Text <> "" And cmbAPershkrimi.Text <> "" And cmbANjm.Text <> "" And txtACmimiShitjes.Text <> "" Then
    
                Dim sCodi As String = cmbAKodi.Text
                Dim sCmimi As String = txtACmimiShitjes.Text
                Dim bExziston As Boolean = False
                sCmimi = sCmimi.Replace(".", ",")
    
                Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
                con.Open()
    
                bExziston = ekziston_artikulli(sCodi)
                Dim cmd
                If bExziston = True Then
                    cmd = New OleDbCommand("UPDATE Artikujt SET CmimiShitjes =" & txtACmimiShitjes.Text & " WHERE Kodi=" & cmbAKodi.Text, con)
                    cmd.ExecuteNonQuery()
                Else
                    cmd = New OleDbCommand("INSERT INTO Artikujt (Kodi, Pershkrimi, Njm, CmimiShitjes) VALUES ('" + cmbAKodi.Text + "','" + cmbAPershkrimi.Text + "','" + cmbANjm.Text + "','" + sCmimi + "')", con)
                    cmd.ExecuteNonQuery()
                End If
    
                MessageBox.Show("Te dhenat u ruajten ne Databaze!")
    
                con.Close()
                mbushe_data_grid(dgwAInventari, sCodi)
    
            Else
                MessageBox.Show("Nuk i keni futur te gjitha te dhenat!")
            End If
    
        End Sub
    
        Private Function ekziston_artikulli(ByVal sCodi) As Boolean
    
            Dim sasiaDB As Integer = 0
    
            Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\Furkan_company.mdb")
            con.Open()
    
            Dim strSQL As String = "SELECT * FROM Artikujt WHERE Kodi=" + sCodi
    
            Dim cmd = New OleDbCommand(strSQL, con)
            Dim dr As OleDbDataReader = cmd.ExecuteReader
    
            While dr.Read()
                sasiaDB += 1
            End While
    
            con.Close()
    
            If (sasiaDB >= 1) Then
                ekziston_artikulli = True
            Else
                ekziston_artikulli = False
            End If
    
        End Function
    
        Private Sub txtACmimiShitjes_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtACmimiShitjes.TextChanged
            Try
    
                If txtACmimiShitjes.Text <> "" Then
                    txtACmimiShitjes.Text = (Convert.ToDouble(txtACmimiShitjes.Text))
                End If
    
            Catch Ex As Exception
    
                txtCmimi.Text = ""
    
            End Try
        End Sub
    End Class
    Kodi momentalisht po duket si shpageti, po spo kam kohe shum me e vizatu ma mire.
    Skedarėt e Bashkėngjitur Skedarėt e Bashkėngjitur

  11. #11
    i/e regjistruar
    Anėtarėsuar
    26-04-2007
    Postime
    89

    Si taruaj DataGridView ne txt file

    Kam deshire qe dataGridViwer ne Vb.net 2008 ta ruaj si txt file si ta beje kete a ka dikush idene

  12. #12
    i/e regjistruar Maska e hot_prinz
    Anėtarėsuar
    29-05-2007
    Vendndodhja
    Frankfurt
    Postime
    9,879
    Kodi:
            'ndryshore qe mban permbajtjen e datagridit
            Dim permbajtja As String = String.Empty
    
            'per cdo rresht/row ne DataGridView
            For Each DataGridViewRow In DataGridView1.Rows
    
                'per cdo kolone te datagridit
                For i As Integer = 0 To DataGridView1.Columns.Count
    
                    Try
                        permbajtja += DataGridView1(i, DataGridViewRow.Index).Value.ToString() + ", "
                    Catch
                    End Try
    
                Next
    
                'pas cdo rreshti fut nje newLine
                permbajtja += vbNewLine
    
            Next
    
            'eksporto ne file "eksporti.txt"
            Dim fs As FileStream = New FileStream("ekspoti.txt", FileMode.Create, FileAccess.Write)
            Dim sw As StreamWriter = New StreamWriter(fs)
    
            sw.Write(permbajtja)
    
            sw.Close()
            fs.Close()
    DataGridView1 e ndryshon me emrin e DataGrid ne formen tende.
    Ndryshuar pėr herė tė fundit nga hot_prinz : 19-02-2011 mė 10:49

  13. #13
    i/e regjistruar
    Anėtarėsuar
    26-04-2007
    Postime
    89

    Edhe pak ndihme

    Pershendetje .
    Ai qe me ka ndihmuar n lidhje me metoden fifo e falenderoj shume, por kam edhe nja dy kerkesa nga ai, kerkesa e pare eshte te ma degoj komplet projektin ve info.blerim@gmail.com te kompresuar une perdori vb.net 2008, kurse kerkesa e dyte eshte qe rekordet qe shlyhen gjate shitjes nga tabela hyrjet dua te me kopjohen ne dnonje tabele tjeter sepse nuk kam kontroll cili artikull me cilin cmim eshte shitur.
    ne regull eshte qe shlyhet sepse ma krijone gjendjen e stoqeve reale te betura, por ato rekorde qe shlyhen kam nevoj me i pas si dosje ne ndonje tabele tjeter.

  14. #14
    i/e regjistruar Maska e hot_prinz
    Anėtarėsuar
    29-05-2007
    Vendndodhja
    Frankfurt
    Postime
    9,879
    pershendetje furkan,


    projektin nuk e kam me, ta dergova ate kohe projektin ne email por u refuzua, lexo postimet me larte para disa muajve.

    Per ti ruajtur shitjet ne nje tabele tjeter, krijo nje tabele identike me tabelen e shitjeve, kur ruhen te dhenat ne tabelen e shitjes atehere ato te dhena te ruhen edhe ne tabelen e re, per kete modifiko metoden [fute_shitjen]:


    Kodi PHP:

        
    Private Sub fute_shitjen(ByVal dCmimiFurnizuesMesatar)

            
    Dim sCmimi As String txtCmimi.Text.Replace("."",")
            
    Dim sVlera As Double Convert.ToDouble(txtSasia.Text) * Convert.ToDouble(sCmimi)
            
    Dim sFitimi As Double sVlera - (dCmimiFurnizuesMesatar Convert.ToDouble(txtSasia.Text))

            
    Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" Application.StartupPath "\Furkan_company.mdb")
            
    con.Open()

    'futja e shitjeve ne tabelen e shitjes

            Dim cmd = New OleDbCommand("INSERT INTO Daljet (Data, Kodi , Pershkrimi, Njm, Sasia, CmimiMesatarFurnizues, CmimiShites, Vlera, Fitimi) VALUES ('" + String.Format("
    {0:dd.MM.yyyy HH:mm:ss}", DateTime.Now) + "','" + cboKodi.Text + "','" + lblPershkrimi.Text + "','" + lblNjm.Text + "','" + txtSasia.Text + "','" + dCmimiFurnizuesMesatar.ToString() + "','" + sCmimi + "','" + sVlera.ToString() + "','" + sFitimi.ToString() + "')", con)

            cmd.ExecuteNonQuery()


    '
    futja e shitjeve ne tabelen e repsh me emrin [dosja]

            
    Dim cmdDosja = New OleDbCommand("INSERT INTO Dosja (Data, Kodi , Pershkrimi, Njm, Sasia, CmimiMesatarFurnizues, CmimiShites, Vlera, Fitimi) VALUES ('" String.Format("{0:dd.MM.yyyy HH:mm:ss}"DateTime.Now) + "','" cboKodi.Text "','" lblPershkrimi.Text "','" lblNjm.Text "','" txtSasia.Text "','" dCmimiFurnizuesMesatar.ToString() + "','" sCmimi "','" sVlera.ToString() + "','" sFitimi.ToString() + "')"con)

            
    cmdDosja .ExecuteNonQuery()


            
    con.Close()


        
    End Sub 
    tempus fugit, amor manet in aeternum corde

  15. #15
    i/e regjistruar
    Anėtarėsuar
    26-04-2007
    Postime
    89

    Ju faleminderit shum

    Faleminderit per ndihmen tuaj, kam provuar shume menyra por nuk kam mund ta realizoj kete lloj lgoritmi

    ne formen access i ke dy tabela nje tabele hyrje dhenje dalje
    ne hyrje jane vendosur vetem molla sa pershembull.
    i ke molla me tri cmime te ndrsyshme gjithsej jane 300 kg
    ajo qka une kerkoj
    nje kod
    per vendosjen ne tabelen per dalje

    komboboxi te jet i mbushur dhe molla me shfaqen ashtu si jane te evidentuara ne hyrje
    por kur shtypi sasine 200 te me insertohen ne datagrid view 100 nga reshti i pare te komboboxitdhe 100 nga reshti i dyte nga komboboxi
    nuk e di sa po me kuptoni.
    nese column1 i komboboxit i ka100 cop e column 2 apo si thiren ne vbnet listindex .
    300 jane gjithsej une i lypi200 ne dalje
    ne datagrid duate me fiurojne
    100 me 1 euro dhe 100 me 1.1. euro
    shum faleminderit
    Skedarėt e Bashkėngjitur Skedarėt e Bashkėngjitur

  16. #16
    i/e regjistruar Maska e hot_prinz
    Anėtarėsuar
    29-05-2007
    Vendndodhja
    Frankfurt
    Postime
    9,879
    Furkan,


    po don me ma hoger shpirtin me kto molla


    Kodet me larte funksionojne ashtu, ne DataGrid te lisohen mollat me cmime te ndryshme, opcional mundesh me i sortu mollat ne datagrid edhe ashtu si i sorton ti sasia do te largohet ne baze te sortimit.

    Kodi PHP:
                        While intSasia 0

                            Dim tmpSasia 
    As Integer 0
                            Dim tmpRow 
    As Integer 0
                            Dim tmpCmimiFurnizues 
    As Double 0

                            Dim con 
    = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" Application.StartupPath "\Furkan_company.mdb")
                            
    con.Open()

                            
    Dim strSQL As String

                            
    If rdFIFO.Checked True Then
                                strSQL 
    "SELECT * FROM Hyrjet WHERE Kodi=" cboKodi.Text " ORDER BY Data ASC"
                            
    Else
                                
    strSQL "SELECT * FROM Hyrjet WHERE Kodi=" cboKodi.Text " ORDER BY Data DESC"
                            
    End If

                            
    Dim cmd = New OleDbCommand(strSQLcon)
                            
    Dim dr As OleDbDataReader cmd.ExecuteReader

                            
    While dr.Read()
                                
    tmpSasia Convert.ToInt32(dr("Sasia"))
                                
    tmpRow Convert.ToInt32(dr("Id"))
                                
    tmpCmimiFurnizues Convert.ToDouble(dr("CmimiFurnizues"))
                                Exit While
                            
    End While

                            If (
    intSasia tmpSasia) >= 0 Then
                                dCmimiFurnizuesMesatar 
    += tmpCmimiFurnizues intSasia
                                intSasia 
    -= tmpSasia
                                shlyje_rekordin
    (tmpRow)
                            ElseIf (
    intSasia tmpSasia) = 0 Then
                                dCmimiFurnizuesMesatar 
    += tmpCmimiFurnizues intSasia
                                shlyje_rekordin
    (tmpRow)
                                
    intSasia -= tmpSasia
                            
    ElseIf (intSasia tmpSasia) < 0 Then
                                dCmimiFurnizuesMesatar 
    += tmpCmimiFurnizues intSasia
                                tmpSasia 
    -= intSasia
                                intSasia 
    0
                                aktualizo_rekordin
    (tmpRowtmpSasia)
                            
    End If

                            
    con.Close()

                        
    End While 
    tempus fugit, amor manet in aeternum corde

  17. #17
    i/e regjistruar Maska e valdetshala
    Anėtarėsuar
    15-03-2008
    Vendndodhja
    Pejė-Republika e Kosovės
    Postime
    2,366
    Citim Postuar mė parė nga hot_prinz Lexo Postimin
    Furkan,


    po don me ma hoger shpirtin me kto molla

    hahahahhahhha jo bre ma mire molla se cigare
    Me respekt,

    Valdet Shala

  18. #18
    i/e regjistruar
    Anėtarėsuar
    11-10-2009
    Postime
    7
    Citim Postuar mė parė nga furkan Lexo Postimin
    Po une pkerisht kerkoj ta zbatoj metoden FIFO por nese keni mundesi te me udhezoni per metoden e Kostos mesatare nuk ka problem por kjo eshte metoda me e preferuar qe une e praktikoj, me duhet vetem formula te VBA-se ose VB.Net
    Me kishe Shpetuar sikur te ma ipnit ndokush kete formule vellaut Kosovar
    Per ta lehtsu programimin ma se lehti kish qen me shkue me koston mesatare

  19. #19
    i/e regjistruar
    Anėtarėsuar
    11-10-2009
    Postime
    7
    Citim Postuar mė parė nga furkan Lexo Postimin
    Faleminderit per ndihmen tuaj, kam provuar shume menyra por nuk kam mund ta realizoj kete lloj lgoritmi

    ne formen access i ke dy tabela nje tabele hyrje dhenje dalje
    ne hyrje jane vendosur vetem molla sa pershembull.
    i ke molla me tri cmime te ndrsyshme gjithsej jane 300 kg
    ajo qka une kerkoj
    nje kod
    per vendosjen ne tabelen per dalje

    komboboxi te jet i mbushur dhe molla me shfaqen ashtu si jane te evidentuara ne hyrje
    por kur shtypi sasine 200 te me insertohen ne datagrid view 100 nga reshti i pare te komboboxitdhe 100 nga reshti i dyte nga komboboxi
    nuk e di sa po me kuptoni.
    nese column1 i komboboxit i ka100 cop e column 2 apo si thiren ne vbnet listindex .
    300 jane gjithsej une i lypi200 ne dalje
    ne datagrid duate me fiurojne
    100 me 1 euro dhe 100 me 1.1. euro
    shum faleminderit
    nje vrejtje per projektin:
    1. se pari duhesh qe te mendosh mir se qfar shenim don me rujt ne Database
    2.Te kujdesesh qe shenimet qe i run ne database mos te perseriten por te referencohen
    3. Te mendosh per integritetin e shenimeve ne database etj.
    dmth duhesh me pas kujdes ne dizajnin e bazes se shenimeve.
    Ktu tek kjo baza do te ishte e rruges me ba nje ket struktur:
    1. Fakturat
    2.Klientet
    3.Shenimet (ndrrimet hyrje-dalje)
    4.Artikujt
    Pastaj vendos relacionet.

    Perseri po tham se nuk jam naj expert por kto jan rregullat kryesore ne programimin e Bazave si ne Acces e ashtu edhe SQL etj.

  20. #20
    i/e regjistruar
    Anėtarėsuar
    16-04-2004
    Postime
    684
    Nje verrejtje per programuesit e ri. Koheve te fundit kam verejtur nje tendence tek programuesit e ri te cilen une e quaj "tejnormailizim". Ja per cka eshte fjala. Shumica e fillestareve kur vie puna tek dizajnimi i bazes se shenimeve, me zell te madh i percjellin tri normat e normalizimit te bazes por ne fund nuk e bejne denormalizimin e duhur. Denormailizimi si hapi i fundit eshte absolutisht i nevojshem neqoftese deshironi te keni nje platforme qe mund te shfrytezohet per nje kohe te gjate, sepse e mundeson mirembajtjen e shenimeve si dhe shpejteson raportet ne kurriz te rritjes minimale te bazes se shenimeve.

Faqja 0 prej 2 FillimFillim 12 FunditFundit

Ruaj Lidhjet

Regullat e Postimit

  • Ju nuk mund tė hapni tema tė reja.
  • Ju nuk mund tė postoni nė tema.
  • Ju nuk mund tė bashkėngjitni skedarė.
  • Ju nuk mund tė ndryshoni postimet tuaja.
  •