diff --git a/App_Code/ClsRH.vb b/App_Code/ClsRH.vb index 912ed24d9..bd72d8ceb 100644 --- a/App_Code/ClsRH.vb +++ b/App_Code/ClsRH.vb @@ -4,6 +4,7 @@ Option Explicit On Imports System.Data Imports System.Data.SqlClient Imports CrystalDecisions.[Shared].Json +Imports DocumentFormat.OpenXml.Presentation Imports Extensiones Imports Microsoft.Ajax.Utilities Imports Profact.TimbraCFDI40 @@ -2283,7 +2284,9 @@ Public Class ClsRH End Try Return Retorno End Function - Public Function UpdateSalarios(CvePersonal As Integer, Fecha As String, CveUsuario As Integer, CveEmpresa As Integer, SalarioDiario As Double, SDI As Double, SalarioDiarioSS As Double, SalarioDiarioPago As Double, Optional CalcularSDI As Boolean = False) As Boolean + Public Function UpdateSalarios(CvePersonal As Integer, Fecha As String, CveUsuario As Integer, CveEmpresa As Integer, SalarioDiario As Double, SDI As Double, + SalarioDiarioSS As Double, SalarioDiarioPago As Double, Optional CalcularSDI As Boolean = False, Optional ActualizaSalarioV As Boolean = False, + Optional OrigenU As String = "") As Boolean Dim Retorno As Boolean = False SqlDataAdapter("PA_RH_PersonalUpdateSalarios") With SqlAdapter.SelectCommand.Parameters @@ -2296,6 +2299,8 @@ Public Class ClsRH .Add("@SDI", SqlDbType.Money).Value = SDI .Add("@SalarioDiarioSS", SqlDbType.Money).Value = SalarioDiarioSS .Add("@CalcularSDI", SqlDbType.Bit).Value = CalcularSDI + .Add("@ActualizaSalarioV", SqlDbType.Bit).Value = ActualizaSalarioV + .Add("@OrigenU", SqlDbType.Bit).Value = OrigenU End With Try SqlAdapter.Fill(Data) diff --git a/App_Code/ClsTransportes.vb b/App_Code/ClsTransportes.vb index 07e43b962..e861b9e06 100644 --- a/App_Code/ClsTransportes.vb +++ b/App_Code/ClsTransportes.vb @@ -420,5 +420,24 @@ Public Class ClsTransportes Return Retorno End Function + + + Public Function VIA_FormularioTrip(cveTrip As Int32, cveUsuario As Int32, cveEmpresa As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_VIA_FormularioTrip", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTrip", SqlDbType.Int).Value = cveTrip + .Add("@CveUsuario", SqlDbType.Int).Value = cveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = cveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el importe.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function #End Region End Class diff --git a/Imagenes/autobus.png b/Imagenes/autobus.png new file mode 100644 index 000000000..cc13d8aa6 Binary files /dev/null and b/Imagenes/autobus.png differ diff --git a/Imagenes/sprinter.png b/Imagenes/sprinter.png new file mode 100644 index 000000000..c07dcc15e Binary files /dev/null and b/Imagenes/sprinter.png differ diff --git a/Nomina/Nomina.aspx.cs b/Nomina/Nomina.aspx.cs index 3ed9e79df..88f561110 100644 --- a/Nomina/Nomina.aspx.cs +++ b/Nomina/Nomina.aspx.cs @@ -555,7 +555,6 @@ public partial class Nomina_Nomina2 : ClsPaginas } private void CargaTiposPeriodo() { - set_GlobalDTTipoPeriodos(UsuarioActual.CveEmpresa, null); DdlTipoPeriodo.DataSource = get_GlobalDTTipoPeriodos(UsuarioActual.CveEmpresa); DdlTipoPeriodoCM.DataSource = DdlTipoPeriodo.DataSource; DdlTipoPeriodoSim.DataSource = DdlTipoPeriodo.DataSource; diff --git a/RH/CalculoSBC.aspx.cs b/RH/CalculoSBC.aspx.cs index 5f0c0dddc..b9800d94b 100644 --- a/RH/CalculoSBC.aspx.cs +++ b/RH/CalculoSBC.aspx.cs @@ -520,7 +520,8 @@ public partial class RH_CalculoSBC : ClsPaginas SDI = Salariodiario * factordeintegracion; SalarioCotizacion = Salariovariable + SDI; if (objpersonal.UpdateSalarios(CvePersonal, txtfechacargamasiva.Text.ToDate().ToString("yyyy/MM/dd"), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, - Salariodiario.ToString().ToDouble(), SDI.ToString().ToDouble(), SalarioCotizacion.ToString().ToDouble(), Salariodiario.ToString().ToDouble())) + Salariodiario.ToString().ToDouble(), SDI.ToString().ToDouble(), SalarioCotizacion.ToString().ToDouble(), Salariodiario.ToString().ToDouble(), + false,true,"C")) { { @@ -753,7 +754,9 @@ public partial class RH_CalculoSBC : ClsPaginas double SalarioVariableNuevo = item.DataKey("SalarioVariableNuevo").ToDouble(); double SalarioDiarioSS = Math.Round(item.DataKey("SalarioDiarioSS").ToDouble(), 2); if (continuar && (item.FCCheckBox("chkUpdate").Checked) &&//SalarioDiarioSSNuevo != SalarioDiarioSS && - (continuar = objrh.UpdateSalarios(CvePersonal, fecha, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, SalarioDiario, SDINuevo, SalarioDiarioSSNuevo, SalarioDiario))) + (continuar = objrh.UpdateSalarios(CvePersonal, fecha, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, SalarioDiario, SDINuevo, SalarioDiarioSSNuevo, SalarioDiario, + false,true,"D" + ))) { } diff --git a/RH/Personal.aspx.vb b/RH/Personal.aspx.vb index f599d9bc6..241a39359 100644 --- a/RH/Personal.aspx.vb +++ b/RH/Personal.aspx.vb @@ -7050,7 +7050,9 @@ Partial Class RH_Personal TxtSalarioDiarioIntegrado.Text = TxtFISalarioDiarioIntegrado.Text Using ObjPersonal As ClsRH = New ClsRH() ObjPersonal.IniciaTransacSQL() - If ObjPersonal.UpdateSalarios(CvePersonal, TxtFechamodSalario.Text.ToDate().ToString("yyyy/MM/dd"), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtSalarioDiarioM.Text.ToDecimal(), TxtFISalarioDiarioIntegrado.Text.ToDecimal(), TxtSalarioDiarioImSS.Text.ToDecimal(), TxtSalarioDiarioM.Text.ToDecimal()) Then + If ObjPersonal.UpdateSalarios(CvePersonal, TxtFechamodSalario.Text.ToDate().ToString("yyyy/MM/dd"), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, + TxtSalarioDiarioM.Text.ToDecimal(), TxtFISalarioDiarioIntegrado.Text.ToDecimal(), TxtSalarioDiarioImSS.Text.ToDecimal(), + TxtSalarioDiarioM.Text.ToDecimal(), False, False, "A") Then ObjPersonal.Commit() @@ -7085,7 +7087,7 @@ Partial Class RH_Personal Using ObjPersonal As ClsRH = New ClsRH() ObjPersonal.IniciaTransacSQL() If ObjPersonal.UpdateSalarios(CvePersonal, TxtFechamodIMSSSalario.Text.ToDate().ToString("yyyy/MM/dd"), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, - TxtSalarioDiario.Text.ToDecimal(), TxtMImssSDI.Text.ToDecimal(), TxtMImssSalarioDiarioImSS.Text.ToDecimal(), -1) Then + TxtSalarioDiario.Text.ToDecimal(), TxtMImssSDI.Text.ToDecimal(), TxtMImssSalarioDiarioImSS.Text.ToDecimal(), -1, False, True, "B") Then ObjPersonal.Commit() diff --git a/VIA/TripsChecks.aspx b/VIA/TripsChecks.aspx index 9fdf6fea5..a311cb5c2 100644 --- a/VIA/TripsChecks.aspx +++ b/VIA/TripsChecks.aspx @@ -1,19 +1,323 @@ <%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="TripsChecks.aspx.cs" Inherits="VYA_TripsChecks" %> - + - + + - + - + - + - + - + + + + + +
+
+ + + +
+
+
+
+
+ Paso 1: Seleccione el Tipo de Unidad +
+
+ + +
+
+
+
+
+
+
+ +
+
+ + +

TRIP AUTOBUS

+ +
+
+ + +

TRIP SPRINTER

+
+
+
+ +
+
+ +
+ + +
+
+
+
+
+ Paso 2: CHECK PT +
+
+ + +
+
+
+
+
+
+
+ +
+
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+
+
+ + +
+
+
+
+ + +
+
+ + + + +
+ + +
+
+
+
+ +
+
+
+ + + +
+ +
+
+
+ +
+ + + +
+
+ +
+
+
+
+ + +
+
+
+ +
+ + +
+
+
+
+
+ Paso 3: +
+
+ + +
+
+
+
+
+
+ +
+
+
+
+
+
- + + diff --git a/VIA/TripsChecks.aspx.cs b/VIA/TripsChecks.aspx.cs index a8e28c66e..57b77ff75 100644 --- a/VIA/TripsChecks.aspx.cs +++ b/VIA/TripsChecks.aspx.cs @@ -1,13 +1,274 @@ -using System; +using CrystalDecisions.Shared.Json; +using System; +using System.Activities.Expressions; using System.Collections.Generic; +using System.Data; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; +using Extensiones; -public partial class VYA_TripsChecks : System.Web.UI.Page +public partial class VYA_TripsChecks : ClsPaginas { + + #region "Propiedades" + + private int Paso + { + get + { + return ViewState["Paso"].ToEntero(); + } + + set + { + PnlPaso1.Visible = (value == 1); + PnlPaso2.Visible = (value == 2 || value == 3); + PnlPaso3.Visible = (value == 3 || value == 2); + ViewState["Paso"] = value; + } + } + private int _currentFormIndex + { + get + { + return ViewState["_currentFormIndex"].ToEntero(); + } + + set + { + ViewState["_currentFormIndex"] = value; + } + } + private DataTable _dtPreguntas + { + get + { + if (ViewState["_dtPreguntas"] != null) + return (DataTable)ViewState["_dtPreguntas"]; + else + return null; + } + + set + { + ViewState["_dtPreguntas"] = value; + } + } + #endregion protected void Page_Load(object sender, EventArgs e) + { + + if (!IsPostBack) + { + Paso = (Request["Paso"] != null && Request["Paso"].ToString().ToEntero() > 0) ? Request["Paso"].ToString().ToEntero() : 1; + _currentFormIndex = (Request["FormIndex"] != null && Request["FormIndex"].ToString().ToEntero() > 0) ? Request["FormIndex"].ToString().ToEntero() : 1; + CargaCombos(); + LoadData(); + BindForm(); + } + } + + public void CargaCombos() + { + + DataTable dttipoaf = get_GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa).FiltraParametros("MedidaVehicularClave IN (2,3)"); + DdlTipoUnidad.DataSource = dttipoaf; + DdlTipoUnidad.Items.Insert(0, new ListItem("Todos", "-1")); + DdlTipoUnidad.DataBind(); + + //CvePuesto =702 valor fijo V&A + DataTable dtchofer = get_GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltraParametros("CvePuesto = 702 and CveEstatusPersonal = 1", "NombreCompleto"); + DdlChofer.DataSource = dtchofer; + DdlChofer.DataBind(); + DdlChofer.Items.Insert(0, new ListItem("-", "-1")); + } + public void cargaUnidades() + { + DataTable dt = get_GlobalDTActivoFijos(UsuarioActual.CveEmpresa).FiltraParametros(string.Format(" EstadoActivoFijo= 'Activo' ", DdlTipoUnidad.SelectedValue)); + DdlAF.DataSource = dt; + DdlAF.DataBind(); + DdlAF.Items.Insert(0, new ListItem("-", "-1")); + + } + #region "Paso 1" + protected void ImgBtnAutobus_Click(object sender, ImageClickEventArgs e) + { + DdlTipoUnidad.SelectedValue = "181"; + Paso = 2; + cargaUnidades(); + } + + protected void ImgBtnSprinter_Click(object sender, ImageClickEventArgs e) + { + DdlTipoUnidad.SelectedValue = "184"; + Paso = 2; + cargaUnidades(); + } + #endregion + + protected void DdlTipoUnidad_SelectedIndexChanged(object sender, EventArgs e) + { + cargaUnidades(); + + } + + + #region "Formulario" + private void LoadData() + { + _dtPreguntas = new DataTable(); + using(ClsTransportes nom =new ClsTransportes()) + { + if(nom.VIA_FormularioTrip(-1,UsuarioActual.CveUsuario,UsuarioActual.CveEmpresa)) + { + _dtPreguntas =nom.DtResultados; + } + } + //// Para la demostración, aquí va un código para llenar el DataTable con datos ficticios. + //_dtPreguntas.Columns.Add("CveFormulario", typeof(int)); + //_dtPreguntas.Columns.Add("Formulario", typeof(string)); + //_dtPreguntas.Columns.Add("CvePregunta", typeof(int)); + //_dtPreguntas.Columns.Add("Pregunta", typeof(string)); + //_dtPreguntas.Columns.Add("Valor", typeof(int)); + //_dtPreguntas.Columns.Add("OrdenPregunta", typeof(int)); + //_dtPreguntas.Columns.Add("OrdenFormulario", typeof(int)); + + //// Agregar datos de prueba + //_dtPreguntas.Rows.Add(1, "Formulario 1", 1, "Pregunta 1", null, 1, 1); + //_dtPreguntas.Rows.Add(1, "Formulario 1", 2, "Pregunta 2", null, 2, 1); + //_dtPreguntas.Rows.Add(2, "Formulario 2", 3, "Pregunta 3", null, 1, 2); + //_dtPreguntas.Rows.Add(2, "Formulario 2", 4, "Pregunta 4", null, 2, 2); + //_dtPreguntas.Rows.Add(2, "Formulario 2", 5, "Pregunta 5", null, 1, 3); + //_dtPreguntas.Rows.Add(2, "Formulario 2", 6, "Pregunta 6", null, 2, 3); + } + + private void BindForm() + { + var filteredRowsant = _dtPreguntas.FiltraParametros($"OrdenFormulario = {_currentFormIndex - 1}"); + var filteredRowsnext = _dtPreguntas.FiltraParametros($"OrdenFormulario = {_currentFormIndex + 1}"); + btnAnt.Visible = filteredRowsant.Rows.Count > 0; + btnNext.Visible = filteredRowsnext.Rows.Count > 0; + btnGuardar.Visible = !(filteredRowsnext.Rows.Count > 0); + var filteredRows = _dtPreguntas.Select($"OrdenFormulario = {_currentFormIndex}"); + var sortedRows = filteredRows.CopyToDataTable(); + if(sortedRows.Rows.Count > 0) + { + lblFormulario.Text = $"{sortedRows.Rows[0]["Formulario"]}:"; + lblFormularioobserv.Text = $"Observaciones {sortedRows.Rows[0]["Formulario"]}"; + + } + gvPreguntas.DataSource = sortedRows; + gvPreguntas.DataBind(); + UpDatos.Update(); + } + protected void gvPreguntas_RowDataBound(object sender, GridViewRowEventArgs e) + { + if (e.Row.RowType == DataControlRowType.DataRow) + { + string valor = e.Row.DataKey("Valor"); + + // Botón btnOk + Button btnOk = (Button)e.Row.FindControl("btnOk"); + if (btnOk != null) + { + btnOk.CssClass = valor == "1" ? "btn btn-primary" : "btn btn-default"; + } + + // Botón btnDetected + Button btnDetected = (Button)e.Row.FindControl("btnDetected"); + if (btnDetected != null) + { + btnDetected.CssClass = valor == "0" ? "btn btn-primary" : "btn btn-default"; + } + } + } + + private void UpdateValue(int cvePregunta, int newValue) + { + foreach (DataRow row in _dtPreguntas.Rows) + { + if (Convert.ToInt32(row["CvePregunta"]) == cvePregunta) + { + row["Valor"] = newValue; + break; + } + } + } + protected void btnOk_Click(object sender, EventArgs e) + { + Button btnOk = (Button)sender; + GridViewRow row = (GridViewRow)btnOk.NamingContainer; + int cvePregunta = row.DataKey("CvePregunta").ToEntero(); + + UpdateValue(cvePregunta, 1); + BindForm(); + } + + protected void btnDetected_Click(object sender, EventArgs e) + { + Button btnDetected = (Button)sender; + GridViewRow row = (GridViewRow)btnDetected.NamingContainer; + int cvePregunta = row.DataKey("CvePregunta").ToEntero(); + + UpdateValue(cvePregunta, 0); + BindForm(); + } + public bool ValidarGridView() + { + bool ok = true; + + foreach (GridViewRow row in gvPreguntas.Rows) + { + // Obtener el valor del DataKey correspondiente a la fila actual + string valor = row.DataKey("Valor"); + + // Verificar si el valor es diferente de '0' o '1' + if (valor != "0" && valor != "1") + { + ok = false; + + // Marcar lblPregunta como requerido si el valor es diferente + Label lblPregunta = (Label)row.FindControl("lblPregunta"); + if (lblPregunta != null) + { + lblPregunta.CssClass = "requerido"; // Añade tu clase CSS para marcar como requerido + } + } + } + + return ok; + } + + protected void btnNext_Click(object sender, EventArgs e) + { + if (ValidarGridView()) + { + // Incrementar el índice del formulario + _currentFormIndex++; + BindForm(); + } + } + protected void btnAnt_Click(object sender, EventArgs e) + { + _currentFormIndex--; + BindForm(); + } + + protected void BtnCancel_Click(object sender, EventArgs e) + { + Paso = 1; + } + #endregion + + + protected void btnGuardar_Click(object sender, EventArgs e) + { + + } + + protected void btnContinuar_Click(object sender, EventArgs e) { }