Esempio n. 1
0
        protected void btnguardar_Click(object sender, EventArgs e)
        {
            NuevoIngresoDAO nu     = new NuevoIngresoDAO();
            bool            existe = nu.BuscarPlanillaxPedido(txtpedido.Text);

            if (!existe)
            {
                Planilla pla = new Planilla();
                pla.Id_Cliente = Convert.ToInt32(ddlcliente.SelectedValue);
                string numero = txtpedido.Text;
                pla.Numero_Pedido = numero.PadLeft(8, '0');
                pla.Id_FormaPago  = Convert.ToInt32(ddlforma.SelectedValue);
                pla.Id_Vendedor   = Convert.ToInt32(ddlvendedor.SelectedValue);
                pla.Fecha         = txtfecha.Text;
                pla.Total         = Convert.ToDecimal(txttotal.Text);
                pla.Saldo         = Convert.ToDecimal(txttotal.Text);
                nu.Ingresar(pla);
                Response.Redirect("PlanillaCobranza.aspx", true);
            }
            else
            {
                txtmensaje.Text = "El pedido ya fue ingresado a la planilla.";
                string script = "openModal();";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "error", script, true);
            }
        }
Esempio n. 2
0
        public void agregarPlanillaEmpresaProcesadas(ref Planilla s, ref Colaborador c)
        {
            SqlCommand comando = _manejador.obtenerProcedimiento("InsertPlanillaProcesamiento");

            _manejador.agregarParametro(comando, "@tula", s.Tula, SqlDbType.VarChar);
            _manejador.agregarParametro(comando, "@manifiesto", s.manifiesto, SqlDbType.VarChar);
            _manejador.agregarParametro(comando, "@fecha", s.Fecha, SqlDbType.DateTime);
            _manejador.agregarParametro(comando, "@transportadora", s.Empresa, SqlDbType.TinyInt);
            _manejador.agregarParametro(comando, "@colaborador", c, SqlDbType.Int);
            _manejador.agregarParametro(comando, "@monto_tula", s.MontoTula, SqlDbType.Decimal);
            _manejador.agregarParametro(comando, "@monto_planilla", s.MontoPlanilla, SqlDbType.Decimal);
            _manejador.agregarParametro(comando, "@ID_PDV", s.IDPuntoVenta, SqlDbType.Int);
            _manejador.agregarParametro(comando, "@PDV", s.PuntoAtencion, SqlDbType.TinyInt);
            _manejador.agregarParametro(comando, "@tarifa", s.Tarifa, SqlDbType.Decimal);
            _manejador.agregarParametro(comando, "@recargo", s.Recargo, SqlDbType.Decimal);
            _manejador.agregarParametro(comando, "@total", s.Total, SqlDbType.Decimal);


            try
            {
                _manejador.ejecutarEscalar(comando);
                comando.Connection.Close();
            }
            catch (Exception)
            {
                comando.Connection.Close();
                //throw new Excepcion("ErrorSucursalRegistro");
            }
        }
Esempio n. 3
0
        public void Actualizar(ref Planilla s)
        {
            SqlCommand    comando    = _manejador.obtenerProcedimiento("UpdatePlanillas");
            SqlDataReader datareader = null;

            _manejador.agregarParametro(comando, "@ID", s.Grupo, SqlDbType.TinyInt);
            _manejador.agregarParametro(comando, "@empresa", s.Empresa, SqlDbType.TinyInt);
            _manejador.agregarParametro(comando, "@fecha", s.Fecha, SqlDbType.DateTime);
            _manejador.agregarParametro(comando, "@Codigo", s.manifiesto, SqlDbType.NVarChar);

            try
            {
                datareader = _manejador.ejecutarConsultaDatos(comando);

                //if (datareader.Read())
                //{
                //    string nombre = (string)datareader["Nombre"];
                //    //short numero = (short)datareader["Numero"];

                //    //existe = numero != s.Codigo;
                //    existe = nombre;

                //    //s.ID = id;
                //}

                comando.Connection.Close();
            }
            catch (Exception)
            {
                comando.Connection.Close();
                //throw new Excepcion("ErrorVerificarSucursalDuplicada");
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Registrar una planilla.
        /// </summary>
        /// <param name="s">Objeto planilla con los datos de la planilla</param>

        public int verificarPlanillaProcesamiento(ref Planilla s)
        {
            int existe = 0;

            SqlCommand    comando    = _manejador.obtenerProcedimiento("SelectExistePlanillaProcesamiento");
            SqlDataReader datareader = null;

            _manejador.agregarParametro(comando, "@manifiesto", s.manifiesto, SqlDbType.NVarChar);
            _manejador.agregarParametro(comando, "@fecha", s.Fecha, SqlDbType.DateTime);
            _manejador.agregarParametro(comando, "@transportadora", s.Empresa, SqlDbType.TinyInt);

            try
            {
                datareader = _manejador.ejecutarConsultaDatos(comando);

                if (datareader.Read())
                {
                    int id = (int)datareader["pk_ID"];
                    //string numero = (string)datareader["Codigo"];

                    //existe = numero != s.Codigo;
                    existe = id;
                }

                comando.Connection.Close();
            }
            catch (Exception)
            {
                comando.Connection.Close();
                //throw new Excepcion("ErrorVerificarSucursalDuplicada");
            }

            return(existe);
        }
 public IQueryable <VW_Planilla> _InsertPlanilla(Planilla entity)
 {
     db.Planillas.InsertOnSubmit(entity);
     db.SubmitChanges();
     return(db.VW_Planillas);
     //return db.VW_Planillas.SingleOrDefault(p => p.PlanillaID == entity.PlanillaID);
 }
Esempio n. 6
0
 public void Fill(CargarDatosContext datacontext)
 {
     baseFill(datacontext);
     Trabajador = datacontext.context.Trabajador.FirstOrDefault(x => x.TrabajadorId == TrabajadorId);
     Edificio   = datacontext.context.Edificio.FirstOrDefault(x => x.EdificioId == EdificioId);
     if (PlanillaId.HasValue)
     {
         Planilla planilla = datacontext.context.Planilla.FirstOrDefault(x => x.PlanillaId == PlanillaId.Value);
         this.TrabajadorId        = planilla.TrabajadorId;
         this.UnidadTiempoId      = planilla.UnidadTiempoId;
         this.HorasExtras         = planilla.HorasExtras;
         this.Feriado             = planilla.Feriado;
         this.AdelantoQuincena    = planilla.AdelantoQuincena;
         this.SegundaQuincena     = planilla.SegundaQuincena;
         this.ESSALUD             = planilla.ESSALUD;
         this.AporteObligatorio   = planilla.AporteObligatorio;
         this.PrimaSeguro         = planilla.PrimaSeguro;
         this.ComisionAFP         = planilla.ComisionAFP;
         this.TotalDescuentos     = planilla.TotalDescuentos;
         this.SueldoTotalNeto     = planilla.SueldoTotalNeto;
         this.SegundaQuincenaNeto = planilla.SegundaQuincenaNeto;
         this.CTSMes = planilla.CTSMes;
         this.ReemplazoVacaciones = planilla.ReemplazoVacaciones;
     }
 }
Esempio n. 7
0
        protected void btnactualizar_Click(object sender, EventArgs e)
        {
            PagoDAO pagod = new PagoDAO();

            foreach (GridViewRow f in grvplanilla.Rows)
            {
                Planilla p  = new Planilla();
                Pago     pg = new Pago();
                p.Id_Planilla = Convert.ToInt32(f.Cells[0].Text);
                TextBox pago = (TextBox)f.FindControl("txtpago");
                pg.Id_Planilla = Convert.ToInt32(f.Cells[0].Text);
                pg.Monto       = Convert.ToDecimal(pago.Text);
                pg.Fecha       = txtfechafinal.Text;
                DropDownList tipo = (DropDownList)f.FindControl("ddlentrada");
                pg.Tipo = tipo.SelectedItem.Text;
                p.Saldo = Convert.ToDecimal(f.Cells[7].Text);

                if (pg.Monto > 0)
                {
                    pagod.ActualizarSaldo(pg.Monto, p.Id_Planilla);
                    pagod.Ingresar(pg);
                    Response.Redirect("PlanillaCobranza.aspx", true);
                }
            }
        }
        public async Task <ActionResult <Planilla> > PostPlanilla(Planilla planilla)
        {
            _context.Planilla.Add(planilla);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPlanilla", new { id = planilla.PanillaId }, planilla));
        }
Esempio n. 9
0
        public bool EjecutarProcedimientoInsertarPlanilla(Planilla planilla)
        {
            int filasAfectadas = 0;

            AdaptadorDeDatos = new SqlDataAdapter("InsertarPlanilla", Conexion);
            AdaptadorDeDatos.SelectCommand.CommandType = CommandType.StoredProcedure;

            AdaptadorDeDatos.SelectCommand.Parameters.Add("@IdColaborador", SqlDbType.Int);
            AdaptadorDeDatos.SelectCommand.Parameters["@IdColaborador"].Value = planilla.Id_Colaborador;

            AdaptadorDeDatos.SelectCommand.Parameters.Add("@NumeroHoras", SqlDbType.Int);
            AdaptadorDeDatos.SelectCommand.Parameters["@NumeroHoras"].Value = planilla.Numero_Horas;

            AdaptadorDeDatos.SelectCommand.Parameters.Add("@PrecioHoras", SqlDbType.Money);
            AdaptadorDeDatos.SelectCommand.Parameters["@PrecioHoras"].Value = planilla.Precio_Horas;

            AdaptadorDeDatos.SelectCommand.Parameters.Add("@Fecha", SqlDbType.Date);
            AdaptadorDeDatos.SelectCommand.Parameters["@Fecha"].Value = planilla.Fecha.Date;

            AdaptadorDeDatos.SelectCommand.Parameters.Add("@MontoPrestamo", SqlDbType.Money);
            AdaptadorDeDatos.SelectCommand.Parameters["@MontoPrestamo"].Value = planilla.Prestamo;

            filasAfectadas = AdaptadorDeDatos.SelectCommand.ExecuteNonQuery();

            if (filasAfectadas > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 10
0
        public virtual Planilla GetFromReader(IDataReader reader)
        {
            Planilla p = new Planilla();

            p.Id             = int.Parse(reader["IdPlanilla"].ToString());
            p.NumeroPlanilla = reader["NuPlanilla"].ToString();
            p.Fecha          = DateTime.Parse(reader["FePlanilla"].ToString());
            p.Usuario        = new Usuario()
            {
                Id = int.Parse(reader["IdUsuario"].ToString())
            };
            p.Sucursal = new Sucursal()
            {
                Id = int.Parse(reader["IdSucursal"].ToString())
            };
            p.Periodo = new Periodo()
            {
                Id = int.Parse(reader["IdPeriodo"].ToString())
            };
            p.Area = new Area()
            {
                Id = int.Parse(reader["IdArea"].ToString())
            };
            p.EstaActivo = bool.Parse(reader["FlActivo"].ToString());

            return(p);
        }
Esempio n. 11
0
        /// <summary>
        /// Valida las inconsistencias
        /// </summary>
        private void btnValidar_Click(object sender, EventArgs e)
        {
            if (dgvValidacion.Rows.Count > 0)
            {
                btnAceptar.Enabled            = false;
                tcManejoPlanillas.SelectedTab = tcInconsistencias;
                Planilla incon = (Planilla)dgvValidacion.Rows[0].DataBoundItem;
                cbEmpresas.SelectedItem = incon.Empresa;
                EmpresaTransporte nueva = (EmpresaTransporte)cbEmpresas.SelectedItem;
                dtpFechaInconsistencia.Value = Convert.ToDateTime(dgvValidacion.Rows[0].Cells["FechaT"].Value);
                cbEstado.SelectedIndex       = (byte)Estado.Pendiente;
                ListarInconsistencias();



                /// Inconsistencias Procesamiento
                ///
                //btnAceptar.Enabled = false;

                //Planilla inconproc = (Planilla)dgvValidacion.Rows[0].DataBoundItem;
                //cbEmpresas.SelectedItem = incon.Empresa;
                //EmpresaTransporte nueva = (EmpresaTransporte)cbEmpresas.SelectedItem;
                //dtpFechaInconsistencia.Value = Convert.ToDateTime(dgvValidacion.Rows[0].Cells["FechaT"].Value);
                //cbEstado.SelectedIndex = (byte)Estado.Pendiente;
                ListarInconsistenciasProcesamiento();
            }
        }
        public Planilla CodigoPlanilla(string strUsuWebLogin)
        {
            Planilla         objPlanillaRS = null;
            var              nmOracle      = new Conexion();
            OracleConnection connection;

            using (connection = new OracleConnection(nmOracle.strCadena))
            {
                if (nmOracle.Connect(connection, false))
                {
                    nmOracle.SP_Command(nmOracle.Esquema + ".PKG_PERSONAL.SP_PERS_OBTIENE_X_LOGIN", nmOracle.strStoredProcedure);
                    nmOracle.AgregarParametro("pVarLogin_in", strUsuWebLogin.ToString(), OracleDbType.Varchar2, ParameterDirection.Input);
                    nmOracle.AgregarParametro("pCurResult_out", null, OracleDbType.RefCursor, ParameterDirection.Output);

                    var datareade = nmOracle._ExecuteReader(false);

                    if (datareade.HasRows)
                    {
                        while (datareade.Read())
                        {
                            objPlanillaRS = new Planilla
                            {
                                strIdEmpresaPlanilla = nmOracle.LeeColumnasDataReader(datareade, "ID_EMPRESA_PLANILLA", "-1"),
                                strIdCodigoPlanilla  = nmOracle.LeeColumnasDataReader(datareade, "ID_CODIGO_PLANILLA", "-1")
                            };
                        }
                    }
                }
            }

            return(objPlanillaRS);
        }
Esempio n. 13
0
        public static string createPlanilla(Planilla planilla)
        {
            string mensaje = string.Empty;

            try
            {
                NpgsqlConnection cnn;
                cnn = new NpgsqlConnection(connectionString);
                cnn.Open();

                NpgsqlCommand command;
                string        sql, Output = string.Empty;
                planilla.Estado = "A";
                int anho = Convert.ToInt32(planilla.AnhoLectivo.Replace(".", string.Empty));

                sql = $"insert into dbo.planilla(idcurso, idmateria, iddocente, estado, anho_lectivo, idinstitucion, titulo, descripcion)" +
                      $"values ({planilla.CursoID}, {planilla.MateriaID}, {planilla.DocenteID}, '{planilla.Estado}', " +
                      $"{anho}, {planilla.InstitucionID}, '{planilla.Titulo}', '{planilla.Descripcion}')";

                command = new NpgsqlCommand(sql, cnn);
                command.ExecuteNonQuery();
                mensaje = "OK";
                command.Dispose(); cnn.Close();
            }

            catch (Exception e)
            {
                mensaje = "Ha ocurrido un error al insertar la planilla.";
            }

            return(mensaje);
        }
Esempio n. 14
0
        public void altaPlanilla(Planilla pla)
        {
            string cadenaInsertPregunta = @"INSERT INTO Planilla VALUES(@texto, @fecha, @idEmp, @hab, @eli);";

            try
            {
                using (SqlConnection con = new SqlConnection(Utilidades.conn))
                {
                    using (SqlCommand cmd = new SqlCommand(cadenaInsertPregunta, con))
                    {
                        cmd.Parameters.AddWithValue("@texto", pla.Texto);
                        cmd.Parameters.AddWithValue("@fecha", DateTime.Now);
                        cmd.Parameters.AddWithValue("@idEmp", pla.empleado.Id);
                        cmd.Parameters.AddWithValue("@hab", pla.Habilitada);
                        cmd.Parameters.AddWithValue("@eli", pla.Eliminado);

                        con.Open();

                        cmd.ExecuteNonQuery();
                    }
                }
            }
            catch (Exception ex)
            {
                throw new ProyectoException("Error: " + ex.Message);
            }
        }
Esempio n. 15
0
        public async Task <IHttpActionResult> PutPlanilla(int id, Planilla planilla)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != planilla.id)
            {
                return(BadRequest());
            }

            db.Entry(planilla).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PlanillaExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 16
0
        public static bool Actualizar(Planilla planilla)
        {
            bool exito = false;
            int  id    = planilla.Id;

            using (TransactionScope trx = new TransactionScope(TransactionScopeOption.Required, System.TimeSpan.MaxValue))
            {
                exito = AppProvider.PlanillaDetalle.Eliminar(planilla.Id);
                if (exito)
                {
                    for (int i = 0; i < planilla.Detalle.Count; i++)
                    {
                        if (planilla.Detalle[i].Id == 0)
                        {
                            exito = AppProvider.PlanillaDetalle.Insertar(planilla.Detalle[i], id);
                        }
                        else
                        {
                            exito = AppProvider.PlanillaDetalle.Actualizar(planilla.Detalle[i]);
                        }
                        if (!exito)
                        {
                            return(false);
                        }
                    }
                }

                if (!exito)
                {
                    throw new Exception("Error desconocido al grabar la planilla");
                }
                trx.Complete();
            }
            return(exito);
        }
        public async Task <IActionResult> PutPlanilla(int id, Planilla planilla)
        {
            if (id != planilla.PanillaId)
            {
                return(BadRequest());
            }

            _context.Entry(planilla).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PlanillaExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 18
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            try
            {
                Planilla planilla = new Planilla();
                planilla.Fecha = Convert.ToDateTime(dtpBuscarPlanilla.Text);
                GestorPlanillas.ConsultarPlanilla(planilla, dgvPlanilla);
                dgvPlanilla.Columns[0].Visible = false;
                dgvPlanilla.Columns[1].HeaderText = "Nombre";
                dgvPlanilla.Columns[2].HeaderText = "Cédula";
                dgvPlanilla.Columns[3].HeaderText = "Número de Horas";
                dgvPlanilla.Columns[4].HeaderText = "Precio por hora";
                dgvPlanilla.Columns[5].HeaderText = "Total Bruto";
                dgvPlanilla.Columns[6].HeaderText = "Monto de Prestamo";
                dgvPlanilla.Columns[7].HeaderText = "Total de Deducciones";
                dgvPlanilla.Columns[8].HeaderText = "total Neto";
                btnModificar.Enabled = true;
                btnEliminar.Enabled = true;
            }
            catch (Exception)
            {

                MessageBox.Show("¡Seleccione la fecha de la planilla!", "¡Error!",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
                                   
        }
Esempio n. 19
0
 private void btnImprimir_Click(object sender, EventArgs e)
 {
     Planilla planilla = new Planilla();
     planilla.Fecha = Convert.ToDateTime(dtpBuscarPlanilla.Text);
     frmReportesPlanillas reportePlanilla = new frmReportesPlanillas(planilla);
     reportePlanilla.ShowDialog();
 }
Esempio n. 20
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            Planilla planilla = new Planilla();
            try
            {
                planilla.Id_Planilla = Convert.ToInt32(dgvPlanilla.CurrentRow.Cells[0].Value.ToString());
                DialogResult respuesta = MessageBox.Show("¿Desea eliminar este registro?",
                "Eliminar Registro", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

                if (respuesta == DialogResult.Yes)
                {
                    if (GestorPlanillas.EliminarPlanilla(planilla))
                    {
                        MessageBox.Show("¡Registro eliminado correctamente", "¡Exito!",
                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                        btnBuscar_Click(sender, e);
                    }
                    else
                    {
                        MessageBox.Show("¡No se pudo eliminar registro!", "¡Error!",
                            MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception)
            {

                MessageBox.Show("¡Ocurrio un problema!", "¡Error!",
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 21
0
        public static string updatePlanilla(Planilla planilla)
        {
            string mensaje = string.Empty;

            try
            {
                NpgsqlConnection cnn;
                cnn = new NpgsqlConnection(connectionString);
                cnn.Open();

                NpgsqlCommand command;
                string        sql, Output = string.Empty;
                int           anho = Convert.ToInt32(planilla.AnhoLectivo.Replace(".", string.Empty));
                planilla.Estado = planilla.Estado != "I" || planilla.Estado != "A" ? "A" : planilla.Estado;

                sql = $"update dbo.planilla set idcurso = {planilla.CursoID}, idmateria = {planilla.MateriaID}, iddocente = {planilla.DocenteID}, " +
                      $"estado = '{planilla.Estado}', anho_lectivo = {anho}, idinstitucion = {planilla.InstitucionID}, " +
                      $"titulo = '{planilla.Titulo}', descripcion = '{planilla.Descripcion}' where id = {planilla.ID}";

                command = new NpgsqlCommand(sql, cnn);
                command.ExecuteNonQuery();
                mensaje = "OK";
                command.Dispose(); cnn.Close();
            }

            catch (Exception e)
            {
                mensaje = "Ha ocurrido un error al editar la planilla.";
            }

            return(mensaje);
        }
Esempio n. 22
0
        public void CadenaConexionIncorrectaShouldReturnFalse()
        {
            String   cadena = "data source = Aqui Fallo; initial catalog = Taller; integrated security = True;";
            Planilla p      = new Planilla();

            p.coneccion = new Coneccion();
            Assert.IsFalse(p.Conexion(cadena));
        }
Esempio n. 23
0
        private void button4_Click(object sender, EventArgs e)
        {
            string   texto    = Texto1.Text;
            int      sem      = Int32.Parse(texto);
            Planilla planilla = new Planilla();

            planilla.Select(dataGridView1, sem);
        }
Esempio n. 24
0
        public ActionResult VerDetalle(string id)
        {
            var             longid    = Convert.ToInt64(id);
            List <Planilla> planillas = (List <Planilla>)Session["planillas"];
            Planilla        planilla  = planillas.Where(x => x.ID == longid).SingleOrDefault();

            return(View(planilla));
        }
Esempio n. 25
0
        public void CadenaConexionCorrectaShouldReturnTrue()
        {
            String   cadena = "data source = HILBERTPC; initial catalog = Taller; integrated security = True;";
            Planilla p      = new Planilla();

            p.coneccion = new Coneccion();
            Assert.IsTrue(p.Conexion(cadena));
        }
Esempio n. 26
0
        public bool ModificarPlanilla(Planilla planilla)
        {
            ConexionBD.AbrirConexion();
            bool seModifico;

            seModifico = ConexionBD.EjecutarProcedimientoModificarPlanilla(planilla);
            ConexionBD.CerrarConexion();
            return(seModifico);
        }
Esempio n. 27
0
        public Planilla obtener(int id)
        {
            Planilla planilla             = null;
            string   cadenaSelectPlanilla = "SELECT * FROM PLANILLA WHERE id=@id";

            try
            {
                using (SqlConnection con = new SqlConnection(Utilidades.conn))
                {
                    con.Open();
                    using (SqlCommand cmd = new SqlCommand(cadenaSelectPlanilla, con))
                    {
                        cmd.Parameters.AddWithValue("@id", id);
                        using (SqlDataReader dr = cmd.ExecuteReader())
                        {
                            dr.Read();
                            if (dr.HasRows)
                            {
                                planilla = new Planilla
                                {
                                    Id         = Convert.ToInt32(dr["Id"]),
                                    Texto      = dr["Texto"].ToString(),
                                    Fecha      = Convert.ToDateTime(dr["FechaAlta"]),
                                    Habilitada = Convert.ToBoolean(dr["Habilitada"]),
                                    Eliminado  = Convert.ToBoolean(dr["Eliminado"]),
                                    empleado   = new Empleado {
                                        Id = Convert.ToInt32(dr["IdEmpleado"])
                                    },
                                    Empleados = new List <Empleado>()
                                };
                                //FALTA TRAER TODOS LOS EMPLEADOS QUE FIRMARON
                            }
                        }
                        cmd.Parameters.Clear();
                        cmd.CommandText = "SELECT p.*, u.* FROM PLANILLAEMPLEADO p, USUARIO u WHERE p.PlanillaId=@idPlanilla AND p.EmpleadoId=u.Id;";
                        cmd.Parameters.AddWithValue("@idPlanilla", id);
                        using (SqlDataReader dr = cmd.ExecuteReader())
                        {
                            while (dr.Read())
                            {
                                planilla.Empleados.Add(new Empleado {
                                    Id       = Convert.ToInt32(dr["EmpleadoId"]),
                                    Nombre   = dr["Nombre"].ToString(),
                                    Apellido = dr["Apellido"].ToString(),
                                });
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new ProyectoException("Error: " + ex.Message);
            }

            return(planilla);
        }
Esempio n. 28
0
        public bool EliminarPlanilla(Planilla planilla)
        {
            ConexionBD.AbrirConexion();
            bool seElimino;

            seElimino = ConexionBD.EjecutarProcedimientoEliminarPlanilla(planilla);
            ConexionBD.CerrarConexion();
            return(seElimino);
        }
Esempio n. 29
0
        public bool InsertarPlanilla(Planilla nuevaPlanilla)
        {
            ConexionBD.AbrirConexion();
            bool seInserto;

            seInserto = ConexionBD.EjecutarProcedimientoInsertarPlanilla(nuevaPlanilla);
            ConexionBD.CerrarConexion();
            return(seInserto);
        }
Esempio n. 30
0
 public ActionResult AddEditPlanilla(AddEditPlanillaViewModel ViewModel)
 {
     if (!ModelState.IsValid)
     {
         ViewModel.FillComboUnidadTiempo(CargarDatosContext());
         ViewModel.Fill(CargarDatosContext());
         PostMessage(MessageType.Error, "Ha ocurrido un error, verifique los datos ingresados.");
         return(View(ViewModel));
     }
     try
     {
         if (ViewModel.PlanillaId.HasValue)
         {
             Planilla planilla = context.Planilla.FirstOrDefault(x => x.PlanillaId == ViewModel.PlanillaId.Value);
             planilla.AdelantoQuincena     = planilla.AdelantoQuincena;
             planilla.AporteObligatorio    = planilla.AporteObligatorio;
             planilla.ComisionAFP          = planilla.ComisionAFP;
             planilla.CTSMes               = planilla.CTSMes;
             planilla.ESSALUD              = planilla.ESSALUD;
             planilla.Feriado              = planilla.Feriado;
             planilla.HorasExtras          = planilla.HorasExtras;
             planilla.PrimaSeguro          = planilla.PrimaSeguro;
             planilla.ReemplazoVacaciones  = planilla.ReemplazoVacaciones;
             planilla.SegundaQuincena      = planilla.SegundaQuincena;
             planilla.SegundaQuincenaNeto  = planilla.SegundaQuincenaNeto;
             planilla.SueldoTotalNeto      = planilla.SueldoTotalNeto;
             planilla.TotalDescuentos      = planilla.TotalDescuentos;
             planilla.UnidadTiempoId       = ViewModel.UnidadTiempoId;
             context.Entry(planilla).State = System.Data.Entity.EntityState.Modified;
         }
         else
         {
             Planilla planilla = new Planilla();
             planilla.TrabajadorId        = ViewModel.TrabajadorId;
             planilla.AdelantoQuincena    = ViewModel.AdelantoQuincena.ToDecimal();
             planilla.AporteObligatorio   = ViewModel.AporteObligatorio.ToDecimal();
             planilla.ComisionAFP         = ViewModel.ComisionAFP.ToDecimal();
             planilla.CTSMes              = ViewModel.CTSMes.ToDecimal();
             planilla.ESSALUD             = ViewModel.ESSALUD.ToDecimal();
             planilla.Feriado             = ViewModel.Feriado.ToDecimal();
             planilla.HorasExtras         = ViewModel.HorasExtras.ToDecimal();
             planilla.PrimaSeguro         = ViewModel.PrimaSeguro.ToDecimal();
             planilla.ReemplazoVacaciones = ViewModel.ReemplazoVacaciones.ToDecimal();
             planilla.SegundaQuincena     = ViewModel.SegundaQuincena.ToDecimal();
             planilla.SegundaQuincenaNeto = ViewModel.SegundaQuincenaNeto.ToDecimal();
             planilla.SueldoTotalNeto     = ViewModel.SueldoTotalNeto.ToDecimal();
             planilla.TotalDescuentos     = ViewModel.TotalDescuentos.ToDecimal();
             planilla.UnidadTiempoId      = ViewModel.UnidadTiempoId;
             context.Planilla.Add(planilla);
         }
         context.SaveChanges();
         PostMessage(MessageType.Success);
     }
     catch { PostMessage(MessageType.Error); }
     return(RedirectToAction("LstPlanillaAdmin", new { EdificioId = ViewModel.EdificioId, TrabajadorId = ViewModel.TrabajadorId }));
 }
Esempio n. 31
0
        public List<Fichaje> GetFichajePorFichadoraEntreFechas(Planilla.Trabajador iFichadora, 
                                                                DateTime iFechaInicio,
                                                                DateTime iFechaFin)
        {
            List<Fichaje> fichaje = new List<Fichaje>();
            try
            {
                DataSet data = new DataSet();

                this.Conexion.NombrePaquete = "administra_detallefichaje";
                this.Conexion.QuerySQL = "getfichajeporfichadorayfechas";

                this.Conexion.SetValorParametroInput("i_idfichador", iFichadora.Id);
                this.Conexion.SetValorParametroInput("i_fechainicio", iFechaInicio);
                this.Conexion.SetValorParametroInput("i_fechafin", iFechaFin);

                this.Conexion.ExecuteProcedure(out data);

                this.Conexion.ValidaRespuesta("o_codigo", "o_mensaje");

                if (!Funcion.IsDataSetEmpty(data))
                    if (!Funcion.IsDataTableEmpty(data.Tables[0]))
                    {
                        data.Tables[0].Columns["idorden"].ColumnName = "Orden.Id";
                        data.Tables[0].Columns["idfichador"].ColumnName = "Trabajador.Id";
                        data.Tables[0].Columns["fechaproceso"].ColumnName = "AuditoriaSistema.FechaSistema";
                        data.Tables[0].Columns["monto"].ColumnName = "Monto";
                        data.Tables[0].Columns["estado"].ColumnName = "Estado";

                        fichaje = Funcion.ConvertToList<Fichaje>(data.Tables[0]);
                    }
            }
            catch (Exception)
            {
                throw;
            }
            return fichaje;
        }
Esempio n. 32
0
        public decimal GetMontoMulta(Planilla.Trabajador iFichadora, DateTime iFecha)
        {
            var multa = 0M;
            try
            {
                this.Conexion.NombrePaquete = "administra_multa";
                this.Conexion.QuerySQL = "getmultaporfichadorayfecha";

                this.Conexion.SetValorParametroInput("i_idfichador", iFichadora.Id);
                this.Conexion.SetValorParametroInput("i_fechaproceso", iFecha);

                this.Conexion.ExecuteProcedure();

                this.Conexion.ValidaRespuesta("o_codigo", "o_mensaje");
                multa = this.Conexion.GetValue<int>("o_montomulta");

            }
            catch (Exception)
            {
                throw;
            }
            return multa;
        }