Пример #1
0
        public void MaasOde(Maas m)
        {
            SqlCommand comm = new SqlCommand("Insert into MaasHareketleri(PersonelID, Donem, CalistigiGun, Hakedis, Alacak, Borc) values(@PersonelID, @Donem, @CalistigiGun, @Hakedis, @Alacak, @Borc)", conn);

            comm.Parameters.Add("@PersonelID", SqlDbType.Int).Value     = m.PersonelID;
            comm.Parameters.Add("@Donem", SqlDbType.VarChar).Value      = m.Donem;
            comm.Parameters.Add("@CalistigiGun", SqlDbType.Float).Value = m.CalistigiGun;
            comm.Parameters.Add("@Hakedis", SqlDbType.Float).Value      = m.Hakedis;
            comm.Parameters.Add("@Alacak", SqlDbType.Float).Value       = m.Alacak;
            comm.Parameters.Add("@Borc", SqlDbType.Float).Value         = m.Borc;
            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            try
            {
                if (Convert.ToBoolean(comm.ExecuteNonQuery()))
                {
                    XtraMessageBox.Show("Seçilen personelin maaşı ödendi.");
                }
            }
            catch (SqlException ex)
            {
                string hata = ex.Message;
            }
            finally { conn.Close(); }
        }
Пример #2
0
        public double CalistigiGunHesapla(Maas m)
        {
            SqlCommand comm = new SqlCommand("Select Count(Donem) from MesaiHareketleri where PersonelID=@PersonelID and Donem=@Donem", conn);

            comm.Parameters.Add("@PersonelID", SqlDbType.Int).Value = m._personelID;
            comm.Parameters.Add("@Donem", SqlDbType.VarChar).Value  = m._donem;
            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            CalistigiGun = Convert.ToDouble(comm.ExecuteScalar());
            conn.Close();
            return(CalistigiGun);
        }
Пример #3
0
        public double SabitMaasGetir(Maas m)
        {
            SqlCommand comm = new SqlCommand("Select SabitMaas from Personel where PersonelID=@PersonelID", conn);

            comm.Parameters.Add("@PersonelID", SqlDbType.Int).Value = m._personelID;
            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            SqlDataReader dr = comm.ExecuteReader();

            dr.Read();
            Personel p = new Personel();

            p.SabitMaas = Convert.ToDouble(dr["SabitMaas"]);
            dr.Close();
            conn.Close();
            return(p.SabitMaas);
        }
Пример #4
0
        private DataSet MaasHesapla(Maas m)
        {
            SqlCommand comm = new SqlCommand("Insert into MaasHareketleri(PersonelID,Donem,CalistigiGun,Hakedis,Alacak,Borc) values(@PersonelID,@Donem,@CalistigiGun,@Hakedis,@Alacak,@Borc)", conn);

            comm.Parameters.Add("@PersonelID", SqlDbType.Int).Value     = m._personelID;
            comm.Parameters.Add("@Donem", SqlDbType.VarChar).Value      = m._donem;
            comm.Parameters.Add("@CalistigiGun", SqlDbType.Float).Value = m._calistigiGun;
            comm.Parameters.Add("@Hakedis", SqlDbType.Money).Value      = m._hakedis;

            comm.Parameters.Add("@Alacak", SqlDbType.Money).Value = m._alacak;
            comm.Parameters.Add("@Borc", SqlDbType.Money).Value   = m._borc;
            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            SqlDataAdapter da = new SqlDataAdapter();
            DataSet        ds = new DataSet();

            da.Fill(ds);
            conn.Close();
            return(ds);
        }
Пример #5
0
        public double HakedisHesapla(Maas m)
        {
            TabanMaas = (SabitMaasGetir(m) / 22) * CalistigiGunHesapla(m);
            SqlCommand comm = new SqlCommand("Select sum(FazlaMesai), sum(EksikMesai) from MesaiHareketleri where PersonelID=@PersonelID", conn);

            comm.Parameters.Add("@PersonelID", SqlDbType.Int).Value = m._personelID;
            comm.Parameters.Add("@Donem", SqlDbType.VarChar).Value  = m._donem;
            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            SqlDataReader dr = comm.ExecuteReader();

            dr.Read();
            FazlaMesaiSaati  = Convert.ToDouble(dr[0]);
            FazlaMesaiUcreti = FazlaMesaiSaati * 20;
            CezaSaati        = Convert.ToDouble(dr[1]);
            CezaUcreti       = CezaSaati * 10;
            Hakedis          = TabanMaas + FazlaMesaiUcreti - CezaUcreti;
            dr.Close();
            conn.Close();
            return(Hakedis);
        }
Пример #6
0
        public void MaaslariGetir(ListView liste, ComboBox SeciliDonem, string ID)
        {
            liste.Items.Clear();
            Maas m = new Maas();

            m._personelID = Convert.ToInt32(ID);
            m._donem      = SeciliDonem.SelectedItem.ToString();
            string     calistigiGun = CalistigiGunHesapla(m).ToString();
            string     hakedilen    = HakedisHesapla(m).ToString();
            List <int> list         = EksikFazlaMesaiToplamGetir(SeciliDonem, ID);
            SqlCommand comm         = new SqlCommand("Select p.PersonelID, PersonelAd, PersonelSoyad, mh.Donem, SabitMaas from Personel p inner join MesaiHareketleri mh on p.PersonelID = mh.PersonelID where p.silindi = 0 and Donem=@Donem and p.PersonelID=@PersonelID", conn);

            comm.Parameters.Add("@Donem", SqlDbType.VarChar).Value  = SeciliDonem.SelectedItem.ToString();
            comm.Parameters.Add("@PersonelID", SqlDbType.Int).Value = Convert.ToInt32(ID);
            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            SqlDataReader dr = comm.ExecuteReader();

            if (dr.HasRows)
            {
                dr.Read();

                liste.Items.Add(dr[0].ToString());
                liste.Items[0].SubItems.Add(dr[1].ToString());
                liste.Items[0].SubItems.Add(dr[2].ToString());
                liste.Items[0].SubItems.Add(dr[3].ToString());
                liste.Items[0].SubItems.Add(dr[4].ToString());
                liste.Items[0].SubItems.Add(list[0].ToString());
                liste.Items[0].SubItems.Add(list[1].ToString());
                liste.Items[0].SubItems.Add(hakedilen);
                liste.Items[0].SubItems.Add(calistigiGun);
            }
            dr.Close();
            conn.Close();
        }