Ejemplo n.º 1
0
    public void Podaci_o_zadnjem_Obracunu()
    {
        SqlConnection connection = new SqlConnection();
        SqlCommand    command    = new SqlCommand();

        connection.ConnectionString = Mipsed7.Core.ApplicationDatabaseInformation.ConnectionString;
        command.Connection          = connection;
        command.CommandText         = "select max(idobracun) from obracun";
        connection.Open();
        try
        {
            SqlDataReader reader = command.ExecuteReader();
            reader.Read();
            if (!reader.IsDBNull(0))
            {
                OBRACUNDataAdapter adapter = new OBRACUNDataAdapter();
                OBRACUNDataSet     dataSet = new OBRACUNDataSet();
                adapter.FillByIDOBRACUN(dataSet, reader.GetString(0));
                this.mjesecobracuna.Value = RuntimeHelpers.GetObjectValue(dataSet.OBRACUN.Rows[0]["mjesecobracuna"]);
                this.godinaobracuna.Value = RuntimeHelpers.GetObjectValue(dataSet.OBRACUN.Rows[0]["godinaobracuna"]);
                this.mjesecisplate.Value  = RuntimeHelpers.GetObjectValue(dataSet.OBRACUN.Rows[0]["mjesecisplate"]);
                this.godinaisplate.Value  = RuntimeHelpers.GetObjectValue(dataSet.OBRACUN.Rows[0]["godinaisplate"]);
                this.mjesecnifond.Value   = RuntimeHelpers.GetObjectValue(dataSet.OBRACUN.Rows[0]["mjesecnifondsatiobracun"]);
                this.tjednifond.Value     = RuntimeHelpers.GetObjectValue(dataSet.OBRACUN.Rows[0]["tjednifondsatiobracun"]);

                //22.12.2016. --> ovo se mijenja radi novog izračuna plaća
                //this.osnovnioo.Value = RuntimeHelpers.GetObjectValue(dataSet.OBRACUN.Rows[0]["osnovnioo"]);
                this.osnovnioo.Value    = Convert.ToDecimal(3800); //--> OVO IDE TEK SA 1.1.2017
                this.osnovnioo.ReadOnly = true;

                this.obrosnovica.Value     = RuntimeHelpers.GetObjectValue(dataSet.OBRACUN.Rows[0]["obracunskaosnovica"]);
                this.txtOpisObracuna.Value = "";
            }
            else
            {
                this.mjesecobracuna.Value = RuntimeHelpers.GetObjectValue(Interaction.IIf(DateAndTime.Today.Month == 1, 12, DateAndTime.Today.Month - 1));
                this.godinaobracuna.Value = RuntimeHelpers.GetObjectValue(Interaction.IIf(DateAndTime.Today.Month == 1, DateAndTime.Today.Year - 1, DateAndTime.Today.Year));
                this.mjesecisplate.Value  = DateTime.Now.Month;
                this.godinaisplate.Value  = DateTime.Now.Year;
                this.mjesecobracuna.Value = DB.BrojVodeceNule(this.mjesecobracuna, 2, 0, false, "");
                this.mjesecisplate.Value  = DB.BrojVodeceNule(this.mjesecisplate, 2, 0, false, "");
                this.godinaobracuna.Value = DB.BrojVodeceNule(this.godinaobracuna, 4, 0, false, "");
                this.godinaisplate.Value  = DB.BrojVodeceNule(this.godinaisplate, 4, 0, false, "");
                this.mjesecnifond.Value   = 160;
                this.tjednifond.Value     = 40;
                //this.osnovnioo.Value = 0x708;
                this.osnovnioo.Value       = Convert.ToDecimal(3800); //--> Ovo je slučaj kad nema prethodnog obračuna
                this.osnovnioo.ReadOnly    = true;
                this.obrosnovica.Value     = 5108.84;
                this.txtOpisObracuna.Value = " ";
            }
        }
        catch (System.Exception exception1)
        {
            throw exception1;
        }
        connection.Close();
    }
Ejemplo n.º 2
0
 public virtual void Fill()
 {
     this.PreFill();
     this.dsOBRACUNDataSet1 = new OBRACUNDataSet();
     this.m_StartRow        = 0;
     this.Cursor            = Cursors.WaitCursor;
     this.m_GridLoading     = true;
     ThreadPool.QueueUserWorkItem(new WaitCallback(this.FillDataThread), Thread.CurrentPrincipal);
 }
Ejemplo n.º 3
0
 private void Obrisi()
 {
     this.cm = (CurrencyManager)this.BindingContext[this.PregledObracunaDataSet1, "PregledObracuna"];
     if (this.cm.Count != 0)
     {
         if (Operators.ConditionalCompareObjectEqual(this.drv["zaklj"], true, false))
         {
             Interaction.MsgBox("Obračun je zaključan! Brisanje nije moguće!", MsgBoxStyle.Critical, "Obračun plaća");
         }
         else
         {
             this.drv = (DataRowView)this.cm.Current;
             if (Conversions.ToString(this.drv["idobracun"]) == this.Sifra_Zadnjeg_Obracuna(Conversions.ToString(this.drv["mjesecisplate"]), Conversions.ToString(this.drv["godinaisplate"])))
             {
                 if (Interaction.MsgBox("Molim da potvrdite brisanje obračuna!", MsgBoxStyle.YesNo, null) == MsgBoxResult.Yes)
                 {
                     SqlCommand    command    = new SqlCommand();
                     SqlConnection connection = new SqlConnection {
                         ConnectionString = Configuration.ConnectionString
                     };
                     command.Connection  = connection;
                     command.CommandType = CommandType.Text;
                     connection.Open();
                     command.CommandText = "DELETE FROM RSMA1 WHERE IDENTIFIKATOROBRASCA = '" + DB.N2T(RuntimeHelpers.GetObjectValue(this.drv["IDENTIFIKATOROBRASCA"]), "") + "'";
                     command.ExecuteNonQuery();
                     command.CommandText = "DELETE FROM RSMA WHERE IDENTIFIKATOROBRASCA = '" + DB.N2T(RuntimeHelpers.GetObjectValue(this.drv["IDENTIFIKATOROBRASCA"]), "") + "'";
                     command.ExecuteNonQuery();
                     connection.Close();
                     OBRACUNDataSet set = new OBRACUNDataSet();
                     this.ObrisiObracun(Conversions.ToString(this.drv["idobracun"]));
                     this.drv.Delete();
                     this.drv = null;
                 }
             }
             else
             {
                 Interaction.MsgBox("Brisanje obračuna nije moguće!", MsgBoxStyle.OkOnly, null);
             }
         }
     }
 }
Ejemplo n.º 4
0
 private void Obrisi()
 {
     this.cm = (CurrencyManager)this.BindingContext[this.V_DD_PREGLED_OBRACUNADataSet1, "V_DD_PREGLED_OBRACUNA"];
     if (this.cm.Count != 0)
     {
         this.drv = (DataRowView)this.cm.Current;
         string mjesecisplate = this.drv["ddobracunidobracun"].ToString().Substring(5, 2);
         string godinaisplate = this.drv["ddobracunidobracun"].ToString().Substring(0, 4);
         if (Operators.ConditionalCompareObjectEqual(this.drv["ddobracunidobracun"], this.zadnji_obracun(mjesecisplate, godinaisplate), false))
         {
             if (Interaction.MsgBox("Molim da potvrdite brisanje obračuna!", MsgBoxStyle.YesNo, null) == MsgBoxResult.Yes)
             {
                 OBRACUNDataSet set = new OBRACUNDataSet();
                 this.ObrisiObracun(Conversions.ToString(this.drv["ddobracunidobracun"]));
                 this.drv.Delete();
                 this.drv = null;
             }
         }
         else
         {
             Interaction.MsgBox("Brisanje obračuna nije moguće!", MsgBoxStyle.OkOnly, null);
         }
     }
 }