diff --git a/App_Code/ClsClaseBase.vb b/App_Code/ClsClaseBase.vb index a51bde5ba..d5857b782 100644 --- a/App_Code/ClsClaseBase.vb +++ b/App_Code/ClsClaseBase.vb @@ -120,6 +120,83 @@ Public Class ClsClaseBase SqlAdapter.SelectCommand.Parameters.Add(name, tipo).Value = valor End If End Sub + + Public Function runQuerystr(Query As String, Optional Listaparametros As List(Of parametroQuery) = Nothing, Optional msgError As String = "", Optional mostrarError As Boolean = True) As Boolean + Dim retorno As Boolean = False + Try + If SqlConexion.State = ConnectionState.Open Then + SqlAdapter.SelectCommand.Parameters.Clear() + SqlAdapter.SelectCommand.CommandText = Query + SqlAdapter.SelectCommand.CommandType = CommandType.Text + Data = New DataTable() + If Not IsNothing(Listaparametros) Then + For Each pr As parametroQuery In Listaparametros + If Not IsNothing(pr.SqlDataType) Then + If Not IsNothing(pr.ParameterDirection) Then + SqlAdapter.SelectCommand.Parameters.Add(pr.ParameterName, pr.SqlDataType).Direction = pr.ParameterDirection + Else + SqlAdapter.SelectCommand.Parameters.Add(pr.ParameterName, pr.SqlDataType).Value = If(Not IsNothing(pr.SqlValue), pr.SqlValue, DBNull.Value) + End If + Else + SqlAdapter.SelectCommand.Parameters.AddWithValue(pr.ParameterName, pr.SqlValue) + End If + Next + End If + + SqlAdapter.Fill(Data) + retorno = True + Else + Dim InfoAdicional As String = "Se intenta realizar una conexion con una conexion cerrada" + InfoAdicional = $"{InfoAdicional}{Environment.NewLine}{msgError}{Environment.NewLine}" + GuardaLog(InfoAdicional) + End If + Catch sqEx As SqlException + retorno = False + setOnError(msgError, sqEx) + Catch ex As Exception + retorno = False + setOnError(msgError, ex) + End Try + Return retorno + End Function + Public Function ExecQuery(Query As String, Optional Listaparametros As List(Of parametroQuery) = Nothing, Optional msgError As String = "", Optional mostrarError As Boolean = True) As Integer + Dim retorno As Integer = -1 + Try + If SqlConexion.State = ConnectionState.Open Then + SqlAdapter.SelectCommand.Parameters.Clear() + SqlAdapter.SelectCommand.CommandText = Query + SqlAdapter.SelectCommand.CommandType = CommandType.Text + If Not IsNothing(Listaparametros) Then + For Each pr As parametroQuery In Listaparametros + If Not IsNothing(pr.SqlDataType) Then + If Not IsNothing(pr.ParameterDirection) Then + SqlAdapter.SelectCommand.Parameters.Add(pr.ParameterName, pr.SqlDataType).Direction = pr.ParameterDirection + Else + SqlAdapter.SelectCommand.Parameters.Add(pr.ParameterName, pr.SqlDataType).Value = If(Not IsNothing(pr.SqlValue), pr.SqlValue, DBNull.Value) + End If + Else + SqlAdapter.SelectCommand.Parameters.AddWithValue(pr.ParameterName, pr.SqlValue) + End If + Next + End If + + retorno = SqlAdapter.SelectCommand.ExecuteNonQuery() + Else + Dim InfoAdicional As String = "Se intenta realizar una conexion con una conexion cerrada" + InfoAdicional = $"{InfoAdicional}{Environment.NewLine}{msgError}{Environment.NewLine}" + GuardaLog(InfoAdicional) + End If + Catch sqEx As SqlException + retorno = -1 + setOnError(msgError, sqEx) + Catch ex As Exception + retorno = -1 + setOnError(msgError, ex) + End Try + Return retorno + End Function + + Protected Function RunQuery(msgOnError As String) As Boolean Dim retorno As Boolean = False @@ -203,3 +280,19 @@ Public Class ClsClaseBase End Sub End Class + +Public Class parametroQuery + Public Sub New(parameterName As String, sqlValue As Object, Optional sqlDataType As SqlDbType = Nothing, Optional parameterDirection As ParameterDirection = Nothing) + Me.ParameterName = parameterName + Me.SqlDataType = sqlDataType + Me.ParameterDirection = parameterDirection + Me.SqlValue = sqlValue + + End Sub + + Public Property ParameterName As String + Public Property SqlDataType As SqlDbType + Public Property ParameterDirection As ParameterDirection + Public Property SqlValue As Object + +End Class \ No newline at end of file diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index bc906fcd4..61f19b032 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -360,7 +360,7 @@ Public Class ClsInventarios End Function - Public Function AddAlmacen(Almacen As String, CveTipoAlmacen As Integer, IdCtaContable As Integer, Modalidad As Integer, CveUsuario As Integer, CveEmpresa As Integer, Inventariable As Byte, CveSubProyecto As Integer, Optional Orden As Integer = -1, Optional CveCuenta As Integer = -1, Optional CveUsuarioAutoriza As Integer = -1) As Boolean + Public Function AddAlmacen(Almacen As String, CveTipoAlmacen As Integer, IdCtaContable As Integer, Modalidad As Integer, CveUsuario As Integer, CveEmpresa As Integer, Inventariable As Byte, CveSubProyecto As Integer, Optional Orden As Integer = -1, Optional CveCuenta As Integer = -1, Optional CveUsuarioAutoriza As Integer = -1, Optional CveAlmacenVirtual As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_AlmacenesAdd") @@ -377,7 +377,7 @@ Public Class ClsInventarios .Add("@Orden", SqlDbType.SmallInt).Value = Orden .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta .Add("@CveUsuarioAutoriza", SqlDbType.Int).Value = CveUsuarioAutoriza - + .Add("@CveAlmacenVirtual", SqlDbType.Int).Value = CveAlmacenVirtual End With Try @@ -396,7 +396,7 @@ Public Class ClsInventarios Return Retorno End Function - Public Function UpdateAlmacen(Almacen As String, CveTipoAlmacen As Integer, IdCtaContable As Integer, Modalidad As Integer, Estatus As Boolean, CveAlmacen As Integer, Inventariable As Byte, CveSubProyecto As Integer, Optional Orden As Integer = -1, Optional CveCuenta As Integer = -1, Optional CveUsuarioAutoriza As Integer = -1) As Boolean + Public Function UpdateAlmacen(Almacen As String, CveTipoAlmacen As Integer, IdCtaContable As Integer, Modalidad As Integer, Estatus As Boolean, CveAlmacen As Integer, Inventariable As Byte, CveSubProyecto As Integer, Optional Orden As Integer = -1, Optional CveCuenta As Integer = -1, Optional CveUsuarioAutoriza As Integer = -1, Optional CveAlmacenVirtual As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_AlmacenesUpdate") @@ -413,6 +413,7 @@ Public Class ClsInventarios .Add("@Orden", SqlDbType.SmallInt).Value = Orden .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta .Add("@CveUsuarioAutoriza", SqlDbType.Int).Value = CveUsuarioAutoriza + .Add("@CveAlmacenVirtual", SqlDbType.Int).Value = CveAlmacenVirtual End With diff --git a/App_Code/ClsOC.vb b/App_Code/ClsOC.vb index 98e94a859..829a5b2f1 100644 --- a/App_Code/ClsOC.vb +++ b/App_Code/ClsOC.vb @@ -2524,7 +2524,7 @@ Public Class ClsOC End Function #End Region #Region "REP SOLICITUDES ANTICIPO" - Public Function GetRepSolicitudAnticipos(CveEmpresa As Integer, CveProveedor As Integer, FechaI As Date, FechaF As Date, CveEventoEstatus As Integer) As Boolean + Public Function GetRepSolicitudAnticipos(CveEmpresa As Integer, CveProveedor As Integer, FechaI As Date, FechaF As Date, CveEventoEstatus As Integer, Optional CveUsuario As Integer = -1, Optional CveSubProyecto As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_RepSolicitudAnticipoGet") @@ -2534,6 +2534,8 @@ Public Class ClsOC .Add("@FechaI", SqlDbType.DateTime).Value = FechaI .Add("@FechaF", SqlDbType.DateTime).Value = FechaF .Add("@CveEventoEstatus", SqlDbType.Int).Value = CveEventoEstatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto End With Try diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 58f52703a..a704afaf3 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -4860,6 +4860,7 @@ Public Class ClsPaginas PaginaDict.Add("/RH/SolicitudViaticos.aspx".ToUpper(), 663) PaginaDict.Add("/RH/ReporteViaticos.aspx".ToUpper(), 664) PaginaDict.Add("/RH/MiPerfil.aspx".ToUpper(), -1) ' se dejará libre el módulo para que cualquier que tenga cvepersonal, pueda acceder + PaginaDict.Add("/RH/CatChecadores.aspx".ToUpper(), 694) #End Region #Region "Sistema" 'Cargo las páginas que deben tener restricción @@ -6753,7 +6754,7 @@ Public Class ClsPaginas End If 'ECONOLLANTAS - AGREGAR QR DE DESCARGA - If UsuarioActual.CveEmpresa = 141 Then + If UsuarioActual.CveEmpresa.Contiene(141, 152, 159, 160, 161, 162, 163) Then Dim QRDescarga As String = "" Dim cfdi As New RVCFDI33.GeneraCFDI() diff --git a/App_Code/ClsProductosServicios.vb b/App_Code/ClsProductosServicios.vb index 016bdbaee..1a939af3d 100644 --- a/App_Code/ClsProductosServicios.vb +++ b/App_Code/ClsProductosServicios.vb @@ -2135,6 +2135,74 @@ Public Class ClsProductosServicios End Try Return Retorno - End Function + End Function + + Public Function GetProductosModificados(CveEmpresa As Integer, CvePrecioLista As Integer, Optional HorasDiferencia As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_ProductosModificadosGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista + .Add("@HorasDiferencia", SqlDbType.Int).Value = HorasDiferencia + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los productos modificados.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + Public Function GetPreciosModificados(CveEmpresa As Integer, CvePrecioLista As Integer, Optional HorasDiferencia As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_ProductosPreciosModificadosGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista + .Add("@HorasDiferencia", SqlDbType.Int).Value = HorasDiferencia + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los precios modificados.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetExistenciasEmpresa(Codigo As String, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_ProductosExistenciasEmpresaGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@Codigo", SqlDbType.VarChar).Value = Codigo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las existencias.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetVendedoresModificados(CveEmpresa As Integer, Optional HorasDiferencia As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_VendedoresModificadosGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@HorasDiferencia", SqlDbType.Int).Value = HorasDiferencia + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los vendedores.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function End Class diff --git a/App_Code/ClsRH.vb b/App_Code/ClsRH.vb index 5508900fd..de7538cf9 100644 --- a/App_Code/ClsRH.vb +++ b/App_Code/ClsRH.vb @@ -41,36 +41,36 @@ Public Class ClsRH Public Sub Commit() SqlTransacc.Commit() - End Sub - + End Sub + #End Region - + #Region "Propiedades" Public ReadOnly Property DSResultados() As DataSet Get DSResultados = DSet End Get - End Property - + End Property + #End Region - Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing) - - If TransaccionCompartida Is Nothing Then - SqlConexion = New SqlConnection - SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString - Try - SqlConexion.Open() - Catch ex As Exception - OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex) - End Try - Else - SqlConexion = TransaccionCompartida.Connection - SqlTransacc = TransaccionCompartida - EsTransaccionCompartida = True - End If - - SqlAdapter = New SqlDataAdapter("", SqlConexion) - ConexionAdd() + Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing) + + If TransaccionCompartida Is Nothing Then + SqlConexion = New SqlConnection + SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString + Try + SqlConexion.Open() + Catch ex As Exception + OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex) + End Try + Else + SqlConexion = TransaccionCompartida.Connection + SqlTransacc = TransaccionCompartida + EsTransaccionCompartida = True + End If + + SqlAdapter = New SqlDataAdapter("", SqlConexion) + ConexionAdd() End Sub Private Sub DataAdapter(pStrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure) With SqlAdapter.SelectCommand @@ -80,23 +80,23 @@ Public Class ClsRH End With Data = New DataTable End Sub - Private CveConexion As Integer = 0 - Private EsTransaccionCompartida As Boolean = False - - + Private CveConexion As Integer = 0 + Private EsTransaccionCompartida As Boolean = False + + #Region "Conexiones" - + Private Sub ConexionAdd() - If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then - - 'DataAdapter(String.Format("INSERT INTO Sis_Conexiones (Clase,Modulo) VALUES ('ClsRH','{0}')", "RH/CatMotivosBaja"), CommandType.Text) ' pendiente de terminar parra registrar el cveconexion, falta el rarámetro de módulo - - Try - DataAdapter("PA_Sis_RegistrarConexion") - With SqlAdapter.SelectCommand.Parameters - .Add("@Clase", SqlDbType.VarChar).Value = Me.GetType().Name - .Add("@Modulo", SqlDbType.VarChar).Value = String.Format("{0}?{1}", HttpContext.Current.Request.Url.AbsolutePath.ToString, HttpContext.Current.Request.QueryString.ToString) - .Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output + If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + + 'DataAdapter(String.Format("INSERT INTO Sis_Conexiones (Clase,Modulo) VALUES ('ClsRH','{0}')", "RH/CatMotivosBaja"), CommandType.Text) ' pendiente de terminar parra registrar el cveconexion, falta el rarámetro de módulo + + Try + DataAdapter("PA_Sis_RegistrarConexion") + With SqlAdapter.SelectCommand.Parameters + .Add("@Clase", SqlDbType.VarChar).Value = Me.GetType().Name + .Add("@Modulo", SqlDbType.VarChar).Value = String.Format("{0}?{1}", HttpContext.Current.Request.Url.AbsolutePath.ToString, HttpContext.Current.Request.QueryString.ToString) + .Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output End With SqlAdapter.Fill(Data) CveConexion = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString.ToEntero @@ -141,7 +141,7 @@ Public Class ClsRH Return Retorno End Function - Public Function AddAsistenciasInasistencias(Tipo As String, AplicaFalta As Boolean, AplicaAsistencia As Boolean, CveUsuario As Integer, CveEmpresa As Integer, + Public Function AddAsistenciasInasistencias(Tipo As String, AplicaFalta As Boolean, AplicaAsistencia As Boolean, CveUsuario As Integer, CveEmpresa As Integer, chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo As Boolean, chkAplicaAguinaldo As Boolean, chkAplicaUtilidades As Boolean) As Boolean Dim Retorno As Boolean = False @@ -178,7 +178,7 @@ Public Class ClsRH Return Retorno End Function - Public Function UpdateAsistenciasInasistencias(Tipo As String, AplicaFalta As Boolean, AplicaAsistencia As Boolean, Estatus As Boolean, CveAI As Integer, + Public Function UpdateAsistenciasInasistencias(Tipo As String, AplicaFalta As Boolean, AplicaAsistencia As Boolean, Estatus As Boolean, CveAI As Integer, chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo As Boolean, chkAplicaAguinaldo As Boolean, chkAplicaUtilidades As Boolean) As Boolean Dim Retorno As Boolean = False @@ -1549,7 +1549,7 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo CveDepartamento As Integer, CveRuta As Integer, CveEscolaridad As Integer, CveEstadoCivil As Integer, CveGenero As Integer, CveEstatusPersonal As Integer, CveSubProyecto As Integer, CveClienteAsignado As Integer, HorarioTrabajo As String, CveSupervisor As Integer, CveTipoPeriodo As Integer, CveMetodoPago As Integer, CveTipoContrato As Integer, CveMotivoBaja As Integer, CveProyecto As Integer, - FechaIFinContrato As String, FechaFFinContrato As String, FechaIIngreso As String, FechaFIngreso As String, SqlStr As String, NCaracteristicas As Integer, + FechaIFinContrato As String, FechaFFinContrato As String, FechaIIngreso As String, FechaFIngreso As String, SqlStr As String, NCaracteristicas As Integer, CveEmpresa As Integer, Optional TopSelect As Integer = 10000) As Boolean Dim Retorno As Boolean = False @@ -1820,8 +1820,8 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo .Add("@CelularPersonal", SqlDbType.VarChar).Value = CelularPersonal .Add("@TelefonoMarcadoRapido", SqlDbType.VarChar).Value = TelefonoMarcadoRapido .Add("@ContactoAlterno", SqlDbType.VarChar).Value = ContactoAlterno - .Add("@CveTipodeSalario", SqlDbType.Int).Value = CveTipodeSalario - + .Add("@CveTipodeSalario", SqlDbType.Int).Value = CveTipodeSalario + .Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue End With @@ -1937,8 +1937,8 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico .Add("@FechaActivo", SqlDbType.Date).Value = FechaActivo .Add("@FechaReingreso", SqlDbType.Date).Value = FechaReingreso - .Add("@CveTipodeSalario", SqlDbType.Int).Value = CveTipodeSalario - + .Add("@CveTipodeSalario", SqlDbType.Int).Value = CveTipodeSalario + End With Try @@ -1955,16 +1955,16 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo End Try Return Retorno - End Function - - Public Function UpdateSalariointegrado(CvePersonal As Integer, CveEmpresa As Integer, SDI As Double, SalarioDiario As Double) As Boolean + End Function + + Public Function UpdateSalariointegrado(CvePersonal As Integer, CveEmpresa As Integer, SDI As Double, SalarioDiario As Double) As Boolean Dim Retorno As Boolean = False SqlDataAdapter("PA_RH_PersonalUpdateSalarioIntegrado") With SqlAdapter.SelectCommand.Parameters .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@SDI", SqlDbType.Money).Value = SDI - .Add("@SalarioDiario", SqlDbType.Money).Value = SalarioDiario + .Add("@SalarioDiario", SqlDbType.Money).Value = SalarioDiario End With Try SqlAdapter.Fill(Data) @@ -1973,8 +1973,8 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo OnError("Ocurrió un error al intentar guardar los cambios en el Personal.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno - End Function - Public Function UpdateSalarios(CvePersonal As Integer, Fecha As String, CveEmpresa As Integer, SalarioDiario As Double, SDI As Double, SalarioDiarioSS As Double, SalarioDiarioPago As Double, Optional CalcularSDI As Boolean = False) As Boolean + End Function + Public Function UpdateSalarios(CvePersonal As Integer, Fecha As String, CveEmpresa As Integer, SalarioDiario As Double, SDI As Double, SalarioDiarioSS As Double, SalarioDiarioPago As Double, Optional CalcularSDI As Boolean = False) As Boolean Dim Retorno As Boolean = False SqlDataAdapter("PA_RH_PersonalUpdateSalarios") With SqlAdapter.SelectCommand.Parameters @@ -1985,7 +1985,7 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo .Add("@SalarioDiario", SqlDbType.Money).Value = SalarioDiario .Add("@SDI", SqlDbType.Money).Value = SDI .Add("@SalarioDiarioSS", SqlDbType.Money).Value = SalarioDiarioSS - .Add("@CalcularSDI", SqlDbType.Bit).Value = CalcularSDI + .Add("@CalcularSDI", SqlDbType.Bit).Value = CalcularSDI End With Try SqlAdapter.Fill(Data) @@ -1994,16 +1994,16 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo OnError("Ocurrió un error al intentar guardar los cambios en el Personal.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno - End Function - - - Public Function GetMovimientosToSUA(CveEmpresa As Integer, FechaI As String, FechaF As String) As Boolean + End Function + + + Public Function GetMovimientosToSUA(CveEmpresa As Integer, FechaI As String, FechaF As String) As Boolean Dim Retorno As Boolean = False SqlDataAdapter("PA_RH_MovimientosToSUA") With SqlAdapter.SelectCommand.Parameters .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@FechaI", SqlDbType.VarChar).Value = FechaI - .Add("@FechaF", SqlDbType.VarChar).Value = FechaF + .Add("@FechaF", SqlDbType.VarChar).Value = FechaF End With Try SqlAdapter.Fill(Data) @@ -2012,17 +2012,17 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo OnError("Ocurrió un error al intentar guardar los cambios en el Personal.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno - End Function - - - - Public Function UpdateRFCValidado(RFC As String, CveEmpresa As Integer, RFCValidadoisok As Boolean) As Boolean + End Function + + + + Public Function UpdateRFCValidado(RFC As String, CveEmpresa As Integer, RFCValidadoisok As Boolean) As Boolean Dim Retorno As Boolean = False SqlDataAdapter("PA_RH_PersonalUpdateRFCValidado") With SqlAdapter.SelectCommand.Parameters .Add("@RFC", SqlDbType.VarChar).Value = RFC .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@isOk", SqlDbType.Bit).Value = RFCValidadoisok + .Add("@isOk", SqlDbType.Bit).Value = RFCValidadoisok End With Try SqlAdapter.Fill(Data) @@ -2031,14 +2031,14 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo OnError("Ocurrió un error al intentar guardar los cambios en el Personal.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno - End Function - Public Function Updateestemporal(CvePersonal As Integer, CveEmpresa As Integer, estemporal As Boolean) As Boolean + End Function + Public Function Updateestemporal(CvePersonal As Integer, CveEmpresa As Integer, estemporal As Boolean) As Boolean Dim Retorno As Boolean = False SqlDataAdapter("PA_RH_PersonalUpdateesTemporal") With SqlAdapter.SelectCommand.Parameters .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@isOk", SqlDbType.Bit).Value = estemporal + .Add("@isOk", SqlDbType.Bit).Value = estemporal End With Try SqlAdapter.Fill(Data) @@ -2052,8 +2052,8 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo SalarioDiario As Double, SDI As Double, SalarioDiarioSS As Double, CvePersonal As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - + Dim Retorno As Boolean = False + SqlDataAdapter("PA_RH_PersonalUpdateMasivo") With SqlAdapter.SelectCommand.Parameters .Add("@CveTurno", SqlDbType.Int).Value = CveTurno @@ -2391,8 +2391,8 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo End Try Return Retorno - End Function - + End Function + Public Function AddAsistenciaMasiva2(CvePeriodo As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False @@ -2418,9 +2418,9 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo End Try Return Retorno - End Function + End Function #End Region - + #Region "Asistencias Detalles" Public Function GetAsistenciasDetalle() As Boolean Dim Retorno As Boolean = False @@ -3442,7 +3442,7 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo .Add("@CveTurno", SqlDbType.Int).Value = RHRequerido.CveTurno .Add("@Cantidad", SqlDbType.Int).Value = RHRequerido.Cantidad .Add("@CveUsuario", SqlDbType.Int).Value = RHRequerido.CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = RHRequerido.CveEmpresa + .Add("@CveEmpresa", SqlDbType.Int).Value = RHRequerido.CveEmpresa .Add("@CveDepartamento", SqlDbType.Int).Value = RHRequerido.CveDepartamento End With @@ -3464,8 +3464,8 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo .Add("@CveRequerimiento", SqlDbType.Int).Value = RHRequerido.CveRequerimiento .Add("@CveSubProyecto", SqlDbType.Int).Value = RHRequerido.CveSubProyecto .Add("@CveTurno", SqlDbType.Int).Value = RHRequerido.CveTurno - .Add("@Cantidad", SqlDbType.Int).Value = RHRequerido.Cantidad - .Add("@CveEmpresa", SqlDbType.Int).Value = RHRequerido.CveEmpresa + .Add("@Cantidad", SqlDbType.Int).Value = RHRequerido.Cantidad + .Add("@CveEmpresa", SqlDbType.Int).Value = RHRequerido.CveEmpresa .Add("@CveDepartamento", SqlDbType.Int).Value = RHRequerido.CveDepartamento End With @@ -3480,13 +3480,13 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo End Function Public Function RemovePersonalRequerido(CveRequerimiento As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False - - DataAdapter("PA_RH_PersonalRequeridoRemove") - + + DataAdapter("PA_RH_PersonalRequeridoRemove") + With SqlAdapter.SelectCommand.Parameters - .Add("@CveRequerimiento", SqlDbType.Int).Value = CveRequerimiento - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - + .Add("@CveRequerimiento", SqlDbType.Int).Value = CveRequerimiento + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With @@ -3504,10 +3504,10 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo End Try Return Retorno - End Function - + End Function + #End Region - + #Region "ClsRHReportePersonalNecesidades" Public Function GetReportePersonalNecesidades(CveTurno As Integer, CveProyecto As Integer, tCveSubProyeto As Integer, Estatus As Integer, CveEmpresa As Integer, CveDepartamento As Integer) As Boolean Dim Retorno As Boolean = False @@ -3529,9 +3529,9 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo OnError("Ocurrió un error al obtener el Reporte de Necesidades de Personal", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno - End Function + End Function #End Region - + #Region "ClsRHReporteRotacionPersonal" Public Function GetReporteRotacionPersonal(FechaInicio As Date, FechaFin As Date, CveTurno As Integer, CveProyecto As Integer, CveSubProyeto As Integer, CveEmpresa As Integer) As Boolean @@ -3634,92 +3634,6 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo #Region "C H E C A D O R E S T A C I O N E S" - Public Function ChecadorEstacionesAdd(CveChecadorTipo As Integer, CveZonaHoraria As Integer, CveUsuario As Integer, CveEmpresa As Integer, ChecadorEstacion As String, Ip As String, Puerto As Integer, Estatus As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_RH_ChecadorEstacionesAdd") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveChecadorTipo", SqlDbType.Int).Value = CveChecadorTipo - .Add("@CveZonaHoraria", SqlDbType.Int).Value = CveZonaHoraria - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@ChecadorEstacion", SqlDbType.VarChar).Value = ChecadorEstacion - .Add("@Ip", SqlDbType.VarChar).Value = Ip - .Add("@Puerto", SqlDbType.Int).Value = Puerto - .Add("@Estatus", SqlDbType.Int).Value = Estatus - - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar el checador de estaciones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function ChecadorEstacionesUpdate(CveChecadorEstacion As Integer, CveChecadorTipo As Integer, CveZonaHoraria As Integer, CveUsuario As Integer, CveEmpresa As Integer, ChecadorEstacion As String, Ip As String, Puerto As Integer, Estatus As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_RH_ChecadorEstacionesUpdate") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveChecadorEstacion", SqlDbType.Int).Value = CveChecadorEstacion - .Add("@CveChecadorTipo", SqlDbType.Int).Value = CveChecadorTipo - .Add("@CveZonaHoraria", SqlDbType.Int).Value = CveZonaHoraria - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@ChecadorEstacion", SqlDbType.VarChar).Value = ChecadorEstacion - .Add("@Ip", SqlDbType.VarChar).Value = Ip - .Add("@Puerto", SqlDbType.Int).Value = Puerto - .Add("@Estatus", SqlDbType.Int).Value = Estatus - - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el checador de estaciones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function ChecadorEstacionesRemove(CveChecadorEstacion As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_RH_ChecadorEstacionesRemove") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveChecadorEstacion", SqlDbType.Int).Value = CveChecadorEstacion - - - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar el checador de estaciones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function ChecadorEstacionesGet(CveChecadorEstacion As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_RH_ChecadorEstacionesGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveChecadorEstacion", SqlDbType.Int).Value = CveChecadorEstacion - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - - - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el checador de estaciones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function DdlChecadorTipoGet(CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_RH_DdlChecadorTipoGet") @@ -4158,16 +4072,16 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo Try SqlAdapter.Fill(Data) Retorno = True - Catch exs As SqlException - - - If exs.Message.Contains("Número: 547;") Then + Catch exs As SqlException + + + If exs.Message.Contains("Número: 547;") Then OnError("El Tema no se puede eliminar porque tiene registros relacionados..", exs, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) Else OnError("El Tema no se puede eliminar porque tiene registros relacionados. TemasRemove.", exs, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End If - - + End If + + 'If exs.ErrorCode = -2146232060 Then ' OnError("Ocurrió al Eliminar el Tema Existen registros relacionadados.", exs, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) 'Else @@ -4463,7 +4377,7 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@Telefono", SqlDbType.VarChar).Value = Telefono - .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones + .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones .Add("@Beneficiario", SqlDbType.Bit).Value = Beneficiario End With @@ -4498,9 +4412,9 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@Telefono", SqlDbType.VarChar).Value = Telefono .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones - .Add("@Beneficiario", SqlDbType.Int).Value = Beneficiario - - + .Add("@Beneficiario", SqlDbType.Int).Value = Beneficiario + + End With Try @@ -6747,9 +6661,9 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo ListaTagsDocumentost.Add(New TagsDocumentos("{FechaActual}", fechaActual)) ListaTagsDocumentost.Add(New TagsDocumentos("{FechaActualDF}", FechaActualDF)) - ListaTagsDocumentost.Add(New TagsDocumentos("{HoraInicioJornada}", DtResultados(0)("HorarioDe").ToString)) - ListaTagsDocumentost.Add(New TagsDocumentos("{HoraFinJornada}", DtResultados(0)("HorarioA").ToString)) - ListaTagsDocumentost.Add(New TagsDocumentos("{Salario}", "")) + ListaTagsDocumentost.Add(New TagsDocumentos("{HoraInicioJornada}", DtResultados(0)("HorarioDe").ToString)) + ListaTagsDocumentost.Add(New TagsDocumentos("{HoraFinJornada}", DtResultados(0)("HorarioA").ToString)) + ListaTagsDocumentost.Add(New TagsDocumentos("{Salario}", "")) ListaTagsDocumentost.Add(New TagsDocumentos("{MetodoPago}", DtResultados(0)("MetodoPago").ToString)) End If @@ -6875,22 +6789,97 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo OnError("Ocurrió un error al obtener los pagos de factura de personal.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno - End Function - + End Function + #End Region - - - 'Public msgsError As New StringBuilder() - 'Public Sub OnError(Mensaje As String, Exeption As Exception, Optional InfoAdicional As String = "") - ' GuardaLog(String.Format("{0} DESCRIPCIÓN DETALLADA: {1} {2} {3}", Mensaje, Exeption.ToString, vbCrLf, InfoAdicional)) - ' msgsError.AppendLine(Mensaje) - ' msgsError.Append("
") - ' 'Alert(Obj, Mensaje, TipoMensaje.MsgError) - ' 'If WebConfigurationManager.AppSettings("SiteName") IsNot Nothing AndAlso WebConfigurationManager.AppSettings("SiteName").ToString = "1" Then MandaCorreoError(String.Format("{0} DESCRIPCIÓN DETALLADA: {1} {2} {3}", Mensaje, Exeption.ToString, vbCrLf, InfoAdicional)) - 'End Sub - + +#Region "Checador" + Public Function GetChecadores(CveChecador As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_RH_ChecadorGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveChecador", SqlDbType.Int).Value = CveChecador + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el listado de checadores", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function AddChecadores(Checador As String, CveSubProyecto As Integer, IPLocal As String, Puerto As String, CveUsuario As Integer, Optional CveModelo As Integer = 1, Optional Estatus As Integer = 1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_RH_ChecadorAdd") + With SqlAdapter.SelectCommand.Parameters + .Add("@Checador", SqlDbType.NVarChar).Value = Checador + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@IPLocal", SqlDbType.NVarChar).Value = IPLocal + .Add("@Puerto", SqlDbType.NVarChar).Value = Puerto + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveModelo", SqlDbType.Int).Value = CveModelo + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar el checador", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function UpdateChecadores(CveChecador As Integer, Checador As String, CveSubProyecto As Integer, IPLocal As String, Puerto As String, Optional CveModelo As Integer = 1, Optional Estatus As Boolean = True) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_RH_ChecadorUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveChecador", SqlDbType.Int).Value = CveChecador + .Add("@Checador", SqlDbType.NVarChar).Value = Checador + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@IPLocal", SqlDbType.NVarChar).Value = IPLocal + .Add("@Puerto", SqlDbType.NVarChar).Value = Puerto + .Add("@CveModelo", SqlDbType.Int).Value = CveModelo + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el checador", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function RemoveChecadores(CveChecador As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_RH_ChecadorDelete") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveChecador", SqlDbType.Int).Value = CveChecador + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el checador", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function +#End Region + + + 'Public msgsError As New StringBuilder() + 'Public Sub OnError(Mensaje As String, Exeption As Exception, Optional InfoAdicional As String = "") + ' GuardaLog(String.Format("{0} DESCRIPCIÓN DETALLADA: {1} {2} {3}", Mensaje, Exeption.ToString, vbCrLf, InfoAdicional)) + ' msgsError.AppendLine(Mensaje) + ' msgsError.Append("
") + ' 'Alert(Obj, Mensaje, TipoMensaje.MsgError) + ' 'If WebConfigurationManager.AppSettings("SiteName") IsNot Nothing AndAlso WebConfigurationManager.AppSettings("SiteName").ToString = "1" Then MandaCorreoError(String.Format("{0} DESCRIPCIÓN DETALLADA: {1} {2} {3}", Mensaje, Exeption.ToString, vbCrLf, InfoAdicional)) + 'End Sub + #Region " IDisposable Support " - ' IDisposable + ' IDisposable Protected Overridable Sub Dispose(ByVal disposing As Boolean) 'If msgsError.ToString().Length > 0 Then ' Alert(msgsError.ToString(), TipoMensaje.MsgError) diff --git a/Ashx/E141.ashx b/Ashx/E141.ashx index 1afdca0b9..dd8ea7fcf 100644 --- a/Ashx/E141.ashx +++ b/Ashx/E141.ashx @@ -2,8 +2,9 @@ Imports System Imports System.Web -Imports System.Data +Imports System.Data Imports System.Net.Http +Imports System.Net Imports Newtonsoft.Json Imports Newtonsoft.Json.Linq Imports Extensiones @@ -28,8 +29,46 @@ Public Class E141 : Implements IHttpHandler End If End Get End Property + Public ReadOnly Property UsuarioWSE141 As String + Get + If IsNothing(System.Configuration.ConfigurationManager.AppSettings("UsuarioWSE141")) Then + Return "" + Else + Return System.Configuration.ConfigurationManager.AppSettings("UsuarioWSE141").ToString() + End If + End Get + End Property + Public ReadOnly Property PasswordWSE141 As String + Get + If IsNothing(System.Configuration.ConfigurationManager.AppSettings("PasswordWSE141")) Then + Return "" + Else + Return System.Configuration.ConfigurationManager.AppSettings("PasswordWSE141").ToString() + End If + End Get + End Property + Public ReadOnly Property TokenAutorizacion As String + Get + If EsProduccion Then + Return "$2y$10$AGCCDbEoGEpd0ys89fuBXedtWlunwUeLRlo4MdeLyxDvJF4GwpL7a" + Else + Return "$2y$10$8Mk3YeIkJESilIwD.U5dG.SsA4JloycJKbaGls8TNEw/AKBE1qane" + End If + End Get + End Property + + Public ReadOnly Property URLBase As String + Get + If EsProduccion Then + Return "https://services.fidelityapps.mx/" + Else + Return "https://econollantas-pruebas.fidelityapps.mx/" + End If + End Get + End Property Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest + context.Response.ContentType = "application/json" Dim retorno As String = "no se encontro la variable" Try Dim Params = If(context.Request("P") = Nothing, "", context.Request("P").ToString()) @@ -43,57 +82,379 @@ Public Class E141 : Implements IHttpHandler End If End If + + Dim Metodo = If(context.Request("Metodo") = Nothing, "", context.Request("Metodo").ToString()) + + Dim FiltrarTodos = If(context.Request("FiltrarTodos") = Nothing, "", context.Request("FiltrarTodos").ToString()) + + If Metodo = "CrearActualizarProductos" Then + retorno = CrearActualizarProductos(If(FiltrarTodos = "1", True, False)) + End If + + If Metodo = "ActualizarPrecios" Then + retorno = ActualizarPrecios(If(FiltrarTodos = "1", True, False)) + End If + + If Metodo = "ActualizarExistencias" Then + retorno = ActualizarExistencias(If(FiltrarTodos = "1", True, False)) + End If + + If Metodo = "ActualizarVendedores" Then + retorno = ActualizarVendedores(If(FiltrarTodos = "1", True, False)) + End If + + If Metodo = "GetExistencia" Then + Dim Codigo = If(context.Request("Sku") = Nothing, "", context.Request("Sku").ToString()) + retorno = GetExistencia(context, Codigo) + End If + Catch ex As Exception retorno = ex.ToString() ex.GuardaLog(ex.ToString()) - context.Response.Write(retorno) + End Try + context.Response.Write(retorno) End Sub + Private Function GetExistencia(ByVal context As HttpContext, Codigo As String) As String + Dim respuesta = New With {.isSuccess = False, .message = "", .products = New JArray} + If String.IsNullOrEmpty(Codigo) OrElse Codigo = "-1" Then + respuesta.message = "el parametro 'Sku' es invalido" + respuesta.isSuccess = False - 'Private Function DescargarFactura(CveVenta As Integer) As Byte() - ' Dim Url = New Uri(String.Format("{0}Compras/PopUpVerFactura.aspx?P={1}", ClsPaginas.UrlSitio, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=0", CveVenta)))) - ' Dim File As Byte() = Nothing - ' Try - ' Using httpClient = New HttpClient() - ' httpClient.Timeout = New TimeSpan(0, 15, 0) - ' Using request = New HttpRequestMessage(HttpMethod.Get, Url) - ' request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CVEUSUARIO=100", CveEmpresa, DateTime.UtcNow.Ticks))) - ' Dim response = httpClient.SendAsync(request).Result - ' If response.StatusCode = Net.HttpStatusCode.OK Then - ' File = response.Content.ReadAsByteArrayAsync().Result - ' End If - ' End Using - ' End Using - ' Catch ex As Exception - ' File = Nothing - ' OnError("Ocurrió un error al descargar la factura", ex) - ' End Try - - ' Return File + Return JsonConvert.SerializeObject(respuesta) + End If + + Dim unauthorized As Boolean = True + + Dim authHeader = context.Request.Headers("Authorization") + If authHeader IsNot Nothing Then + Dim basicAuth As String = authHeader.Replace("Basic ", "") + + Dim usernamePasswordArray = Encoding.UTF8.GetString(Convert.FromBase64String(basicAuth)).Split(":"c) + + Dim userName = usernamePasswordArray(0) + Dim password = usernamePasswordArray(1) + unauthorized = Not (userName = Me.UsuarioWSE141 AndAlso password = Me.PasswordWSE141) + + Else + respuesta.message = "el usuario y/o contraseña son requeridos" + respuesta.isSuccess = False + 'context.Response.StatusCode = 401 + + Return JsonConvert.SerializeObject(respuesta) + End If + + If unauthorized Then + respuesta.message = "el usuario y/o contraseña no son validos" + respuesta.isSuccess = False + 'context.Response.StatusCode = 401 + + Return JsonConvert.SerializeObject(respuesta) + End If + + Using ObjPS As New ClsProductosServicios() + If ObjPS.GetExistenciasEmpresa(Codigo, CveEmpresa) Then + Dim ArrayPS As New JArray + For Each RowPS As DataRow In ObjPS.DtResultados.Rows + Dim producto As New JObject( + New JProperty("sku", RowPS("Codigo")), + New JProperty("stock", RowPS("Existencia")) + ) + ArrayPS.Add(producto) + Next + + respuesta.products = ArrayPS + respuesta.isSuccess = True + respuesta.message = "La existencia se obtuvo correctamente" + Else + respuesta.isSuccess = False + respuesta.message = "Ocurrió un error al obtener la existencia" + End If + + End Using + + Return JsonConvert.SerializeObject(respuesta) + End Function + + Private Function EnviarInformacion(url As String, payload As String) As String + Dim Retorno As String = "{}" + Try + Using httpClient = New HttpClient() + Using request = New HttpRequestMessage(HttpMethod.Post, New Uri(url)) + request.Headers.Add("token", TokenAutorizacion) + + Using content = New StringContent(payload, Encoding.UTF8, "application/json") + request.Content = content + + Dim response = httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead).Result + + If response.StatusCode = Net.HttpStatusCode.OK Then + Retorno = response.Content.ReadAsStringAsync().Result + End If + End Using + + End Using + + End Using + Catch ex As Exception + Retorno = New JObject(New JProperty("Error", ex.ToString())).ToString() + OnError("Ocurrió un error al enviar la informacion", ex) + End Try + Return Retorno + End Function + + 'Private Function EnviarInformacion2(url As String, payload As String) As String + ' Dim Retorno As String = "{}" + ' Try + ' Dim Request As WebRequest = WebRequest.Create(url) + ' Request.Method = "post" + ' Request.ContentType = "application/json" + ' Request.Headers.Add("token", TokenAutorizacion) + + ' Dim byteArray As Byte() = Encoding.UTF8.GetBytes(payload) + ' Request.ContentLength = byteArray.Length + + ' Using dataStream As Stream = Request.GetRequestStream() + ' dataStream.Write(byteArray, 0, byteArray.Length) + ' Using tResponse As WebResponse = Request.GetResponse() + ' Using dataStreamResponse As Stream = tResponse.GetResponseStream() + ' Using tReader As New StreamReader(dataStreamResponse) + ' Retorno = tReader.ReadToEnd() + ' End Using + ' End Using + ' End Using + ' End Using + ' Catch ex As Exception + ' Retorno = New JObject(New JProperty("Error", ex.ToString())).ToString() + ' OnError("Ocurrió un error al enviar la informacion", ex) + ' End Try + ' Return Retorno 'End Function +#Region "C R E A C I Ó N / A C T U A L I Z A C I Ó N - P R O D U C T O S" + Private Function CrearActualizarProductos(Todos As Boolean) As String + Return EnviarInformacion($"{Me.URLBase}api/services/products/import", GetProductosModificados(Todos)) + End Function - Private Function DescargarFactura(FilePDF As String) As Byte() - Dim Url = New Uri(String.Format("{0}Compras/PopUpVerFactura.aspx?TipoDocto=Ing&File={1}&TipoArchivo=PDF", "http://localhost/", FilePDF)) - Dim File As Byte() = Nothing - Try - Using httpClient = New HttpClient() - httpClient.Timeout = New TimeSpan(0, 1, 0) - Using request = New HttpRequestMessage(HttpMethod.Get, Url) - request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CVEUSUARIO=100", CveEmpresa, DateTime.UtcNow.Ticks))) - Dim response = httpClient.SendAsync(request).Result - If response.StatusCode = Net.HttpStatusCode.OK Then - File = response.Content.ReadAsByteArrayAsync().Result - End If - End Using - End Using - Catch ex As Exception - File = Nothing - OnError("Ocurrió un error al descargar la factura", ex) - End Try - - Return File + Private Function GetProductosModificados(Todos As Boolean) As String + Dim Retorno As String = "{}" + + Dim DtPS As DataTable = Nothing + Using ObjPS As New ClsProductosServicios + 'OBTERNER PRECIOS DE PUBLICO GENERAL + If ObjPS.GetProductosModificados(CveEmpresa, 44, If(Todos, -1, 1)) Then + DtPS = ObjPS.DtResultados.Copy() + End If + End Using + + If DtPS IsNot Nothing Then + + Dim ArrayPS As New JArray + For Each RowPS As DataRow In DtPS.Rows + + Dim PSData As String() = RowPS("PS").ToString().Split(" ".ToCharArray()) + + Dim Measurement As String = "", Size As String = "", alt_code As String = "" + + If PSData.Length > 0 Then + Measurement = PSData(0) + End If + + If PSData.Length > 1 Then + Size = PSData(1) + End If + + alt_code = String.Concat(Measurement, Size) + + Dim producto As New JObject( + New JProperty("clasificacion", RowPS("Clasificacion")), + New JProperty("category", "Prod"), + New JProperty("pza", RowPS("Unidad")), + New JProperty("sku", RowPS("Codigo")), + New JProperty("name", RowPS("PS")), + New JProperty("measurement", Measurement), + New JProperty("size", Size), + New JProperty("brand", RowPS("Marca")), + New JProperty("price", RowPS("Precio")), + New JProperty("active", RowPS("Estado")), + New JProperty("user", RowPS("UsuarioModifico")), + New JProperty("alt_code", alt_code), + New JProperty("short_description", ""), + New JProperty("description", ""), + New JProperty("currency", 1), + New JProperty("promo_price", RowPS("PrecioPromocion")) + ) + + ArrayPS.Add(producto) + Next + Retorno = New JObject(New JProperty("products", ArrayPS)).ToString() + End If + + Return Retorno + End Function +#End Region + +#Region "A C T U A L I Z A R - P R E C I O S" + + Private Function ActualizarPrecios(Todos As Boolean) As String + Return EnviarInformacion($"{Me.URLBase}api/services/products/price-import", GetPreciosModificados(Todos)) + End Function + + Private Function GetPreciosModificados(Todos As Boolean) As String + Dim Retorno As String = "{}" + + Dim DtPS As DataTable = Nothing + Using ObjPS As New ClsProductosServicios + 'OBTERNER PRECIOS DE PUBLICO GENERAL + If ObjPS.GetPreciosModificados(CveEmpresa, 44, If(Todos, -1, 1)) Then + DtPS = ObjPS.DtResultados.Copy() + End If + End Using + + If DtPS IsNot Nothing Then + + Dim ArrayPS As New JArray + For Each RowPS As DataRow In DtPS.Rows + + Dim producto As New JObject( + New JProperty("sku", RowPS("Codigo")), + New JProperty("price", RowPS("Precio")), + New JProperty("promo_price", RowPS("PrecioPromocion")) + ) + + ArrayPS.Add(producto) + Next + Retorno = New JObject(New JProperty("products", ArrayPS)).ToString() + End If + + Return Retorno + End Function +#End Region + +#Region "A C T U A L I Z A R - E X I S T E N C I A S" + + Private Function ActualizarExistencias() As String + Return EnviarInformacion($"{Me.URLBase}api/services/products/stock", GetPSExistencias()) + End Function + + Private Function GetPSExistencias() As String + Dim Retorno As String = "{}" + + Dim DtPS As DataTable = Nothing + Using ObjPS As New ClsProductosServicios + 'OBTERNER PRECIOS DE PUBLICO GENERAL + If ObjPS.GetExistenciasEmpresa("-1", CveEmpresa) Then + DtPS = ObjPS.DtResultados.Copy() + End If + End Using + + If DtPS IsNot Nothing Then + + Dim ArrayPS As New JArray + For Each RowPS As DataRow In DtPS.Rows + + Dim producto As New JObject( + New JProperty("sku", RowPS("Codigo")), + New JProperty("branch_office_code", "01"), + New JProperty("stock", RowPS("Existencia")) + ) + + ArrayPS.Add(producto) + Next + Retorno = New JObject(New JProperty("stock", ArrayPS)).ToString() + End If + + Return Retorno + End Function +#End Region + + +#Region "A C T U A L I Z A R - E X I S T E N C I A S" + + Private Function ActualizarVendedores(Todos As Boolean) As String + Return EnviarInformacion($"{Me.URLBase}api/v1/sellers/import", GetVendedores(Todos)) + End Function + + Private Function GetVendedores(Todos As Boolean) As String + Dim Retorno As String = "{}" + + Dim DtVendedores As DataTable = Nothing + Using ObjPS As New ClsProductosServicios + 'OBTERNER PRECIOS DE PUBLICO GENERAL + If ObjPS.GetVendedoresModificados(CveEmpresa, If(Todos, -1, 1)) Then + DtVendedores = ObjPS.DtResultados.Copy() + End If + End Using + + If DtVendedores IsNot Nothing Then + + Dim ArrayVendedores As New JArray + For Each RowVendedor As DataRow In DtVendedores.Rows + + Dim VendedorData As String() = RowVendedor("Vendedor").ToString().Split(" ".ToCharArray()) + + Dim Nombre As String = "", Apellido As String = "" + + Select Case VendedorData.Length + Case 1 + Nombre = VendedorData(0) + Case 2 + Nombre = VendedorData(1) + Apellido = VendedorData(0) + Case 3 + Nombre = VendedorData(2) + Apellido = String.Concat(VendedorData(0), " ", VendedorData(1)) + Case 4 + Nombre = String.Concat(VendedorData(2), " ", VendedorData(3)) + Apellido = String.Concat(VendedorData(0), " ", VendedorData(1)) + End Select + + Dim vendedor As New JObject( + New JProperty("email", RowVendedor("Correo")), + New JProperty("password", RowVendedor("Correo")), + New JProperty("name", Nombre), + New JProperty("last_name", Apellido), + New JProperty("type_seller", "Administrador"), + New JProperty("state", RowVendedor("Estado")), + New JProperty("city", RowVendedor("Municipio")), + New JProperty("age", 0), + New JProperty("gender", 0), + New JProperty("address", ""), + New JProperty("code", "") + ) + + ArrayVendedores.Add(vendedor) + Next + Retorno = New JObject(New JProperty("sellers", ArrayVendedores)).ToString() + End If + + Return Retorno + End Function +#End Region + +#Region "D E S C A R G A - P D F" + + Private Function DescargarFactura(FilePDF As String) As Byte() + Dim Url = New Uri(String.Format("{0}Compras/PopUpVerFactura.aspx?TipoDocto=Ing&File={1}&TipoArchivo=PDF", "http://localhost/", FilePDF)) + Dim File As Byte() = Nothing + Try + Using httpClient = New HttpClient() + httpClient.Timeout = New TimeSpan(0, 1, 0) + Using request = New HttpRequestMessage(HttpMethod.Get, Url) + request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CVEUSUARIO=100", CveEmpresa, DateTime.UtcNow.Ticks))) + Dim response = httpClient.SendAsync(request).Result + If response.StatusCode = Net.HttpStatusCode.OK Then + File = response.Content.ReadAsByteArrayAsync().Result + End If + End Using + End Using + Catch ex As Exception + File = Nothing + OnError("Ocurrió un error al descargar la factura", ex) + End Try + + Return File End Function Public Sub ImprimirbytesPDF(ByVal context As HttpContext, bytes As Byte(), NombreArchivo As String) @@ -118,18 +479,20 @@ Public Class E141 : Implements IHttpHandler End Try End Sub - Private Function Parametros(Cadena As String) As Hashtable - Dim P1() As String = Cadena.Split("&"c) - Dim Tmp As String - Dim P2() As String - - Dim URLParametros As New Hashtable - - For Each Tmp In P1 - P2 = Tmp.Replace("%26%", "&").Split("="c) - URLParametros.Add(P2(0).ToString.ToUpper, P2(1)) - Next - Return URLParametros +#End Region + + Private Function Parametros(Cadena As String) As Hashtable + Dim P1() As String = Cadena.Split("&"c) + Dim Tmp As String + Dim P2() As String + + Dim URLParametros As New Hashtable + + For Each Tmp In P1 + P2 = Tmp.Replace("%26%", "&").Split("="c) + URLParametros.Add(P2(0).ToString.ToUpper, P2(1)) + Next + Return URLParametros End Function End Class \ No newline at end of file diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 2513846b6..b67198e7a 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -2688,77 +2688,88 @@ Partial Class Compras_Compras TmpDT.Columns.Add("CveContrato", GetType(Integer)) TmpDT.Columns.Add("DifPSSat", GetType(Integer)) - TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer)) - TmpDT.Columns.Add("CveCultivoCuadroDetalle", GetType(Integer)) + + If Not TmpDT.Columns.Contains("CveContratoDetalle") Then + TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer)) + End If + + + If Not TmpDT.Columns.Contains("CveCultivoCuadroDetalle") Then + TmpDT.Columns.Add("CveCultivoCuadroDetalle", GetType(Integer)) + End If + + + + GvPS.DataSource = TmpDT - GvPS.DataBind() - - If UsuarioActual.Empresa.UsaAC Then - CargaHidendsAC() - End If - - CalculaTotales(True) - - If UsuarioActual.Empresa.UsaInventarios Then - DtInv = TmpDT.FiltraParametros(String.Format("CveTipoPS = 2")).Copy - - If dr("Inventario").ToString = "1" Then - - CveMovimientoAlmacen = dr("CveMovimiento").ToString.ToEntero - - Dim Inv As New ClsInventarios - If Inv.GetMovimientosDetalle(dr("CveMovimiento").ToString.ToEntero, UsuarioActual.CveEmpresa) Then - 'Dim TempParametros = Encripta(String.Format("OP=Alm&CveMovimiento={0}", dr("CveMovimiento"))) - 'ImgImprimirAlmacen.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", TempParametros) - - ImgImprimirAlmacen.Visible = True - ImgImprimirAlmacen.NavigateUrl = String.Format("/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}", dr("CveMovimiento")) - - Dim drt As DataRow - 'actualizo el almacen - For Each dri As DataRow In DtInv.Rows - - drt = Inv.DtResultados.FiltroPrimero(String.Format("CvePS = {0} AND Cantidad = {1}", dri("CvePS"), dri("Cantidad"))) - If drt IsNot Nothing Then - Dim TmpDr As DataRow = TmpDT.Select($"Consec = {dri("Consec").ToString.ToEntero}")(0) 'Charlie - TmpDr("CveAlmacen") = drt("CveAlmacen") 'Charlie - - dri("CveAlmacen") = drt("CveAlmacen") - - End If - - Next - - End If - - 'Proceso Super Tramposo de Charlie - If Inv.GetMovimientosDetalle(dr("CveMovimiento").ToString.ToEntero, UsuarioActual.CveEmpresa, CveCompra:=-123) Then - Dim drt As DataRow - For Each dri As DataRow In DtInv.Rows - drt = Inv.DtResultados.FiltroPrimero(String.Format("CvePS = {0} AND Cantidad = {1}", dri("CvePS"), dri("Cantidad"))) - If drt IsNot Nothing Then - Dim TmpDr As DataRow = TmpDT.Select($"Consec = {dri("Consec").ToString.ToEntero}")(0) - TmpDr("CveAlmacen") = drt("CveAlmacen") - End If - Next - End If - - Inv.Dispose() + GvPS.DataBind() + If UsuarioActual.Empresa.UsaAC Then + CargaHidendsAC() End If - CargaGvInv() + CalculaTotales(True) - 'Ocultamos "Recibir Aqui" - GvInv.Columns(6).Visible = False - GvInv.Columns(7).Visible = False + If UsuarioActual.Empresa.UsaInventarios Then + DtInv = TmpDT.FiltraParametros(String.Format("CveTipoPS = 2")).Copy + If dr("Inventario").ToString = "1" Then + + CveMovimientoAlmacen = dr("CveMovimiento").ToString.ToEntero + + Dim Inv As New ClsInventarios + If Inv.GetMovimientosDetalle(dr("CveMovimiento").ToString.ToEntero, UsuarioActual.CveEmpresa) Then + 'Dim TempParametros = Encripta(String.Format("OP=Alm&CveMovimiento={0}", dr("CveMovimiento"))) + 'ImgImprimirAlmacen.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", TempParametros) + + ImgImprimirAlmacen.Visible = True + ImgImprimirAlmacen.NavigateUrl = String.Format("/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}", dr("CveMovimiento")) + + Dim drt As DataRow + 'actualizo el almacen + For Each dri As DataRow In DtInv.Rows + + drt = Inv.DtResultados.FiltroPrimero(String.Format("CvePS = {0} AND Cantidad = {1}", dri("CvePS"), dri("Cantidad"))) + If drt IsNot Nothing Then + Dim TmpDr As DataRow = TmpDT.Select($"Consec = {dri("Consec").ToString.ToEntero}")(0) 'Charlie + TmpDr("CveAlmacen") = drt("CveAlmacen") 'Charlie + + dri("CveAlmacen") = drt("CveAlmacen") + + End If + + Next + + End If + + 'Proceso Super Tramposo de Charlie + If Inv.GetMovimientosDetalle(dr("CveMovimiento").ToString.ToEntero, UsuarioActual.CveEmpresa, CveCompra:=-123) Then + Dim drt As DataRow + For Each dri As DataRow In DtInv.Rows + drt = Inv.DtResultados.FiltroPrimero(String.Format("CvePS = {0} AND Cantidad = {1}", dri("CvePS"), dri("Cantidad"))) + If drt IsNot Nothing Then + Dim TmpDr As DataRow = TmpDT.Select($"Consec = {dri("Consec").ToString.ToEntero}")(0) + TmpDr("CveAlmacen") = drt("CveAlmacen") + End If + Next + End If + + Inv.Dispose() + + End If + + CargaGvInv() + + 'Ocultamos "Recibir Aqui" + GvInv.Columns(6).Visible = False + GvInv.Columns(7).Visible = False + + End If End If - End If - DdlTipoComprobante.Enabled = False + DdlTipoComprobante.Enabled = False DdlTipoComprobante.SelectedValue = dr("TipoDocto").ToString If dr("TipoDocto").ToString = "Fac" Then ChkAplicaNotaCredito.Enabled = True diff --git a/Contratos/ContratoAvance.aspx b/Contratos/ContratoAvance.aspx index f52875650..c3960ce15 100644 --- a/Contratos/ContratoAvance.aspx +++ b/Contratos/ContratoAvance.aspx @@ -37,208 +37,222 @@ + + Avance de Contrato + + - + + + + +
+
+
+ +
+
+ + + +
+
+ + +
+
+
+ + +
+
+
+
+
+
+ + +
+ +
+ Fecha: +
+
+
+ + + + + + + + + + +
+
+ + +
+
+ " style="display: inline-block; margin-right: -20px; width: 150px; height: 25px; border-color: #89C4F4;" /> + " class="btn btn-circle btn-sm label-info"> +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
Producto / ServicioAvanceUltimo AvanceLevantamientoAnexo
+ +
+
+ + + + + + + + + + + + + <%# Eval("Abreviatura")%> + + + + + + <%# Eval("Cantidad", "{0:N2}")%> + + + + + + <%# Eval("Importe", "{0:N2}")%> + + + + + <%# Eval("Cantidad_Ultima", "{0:N2}")%> + + + + + <%# Eval("Importe_Ultima", "{0:N2}")%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+ + +
+
+ + + + +<%-- - - -
-
-
- -
-
- - - -
-
- - -
-
-
- - -
-
-
-
-
-
- - -
- -
- Fecha: -
-
-
- - - - - - - - - - -
-
- - -
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - -
Producto / ServicioAvanceUltimo AvanceLevantamientoAnexo
- -
-
- - - - - - - - - - - - - <%# Eval("Abreviatura")%> - - - - - - <%# Eval("Cantidad", "{0:N2}")%> - - - - - - <%# Eval("Importe", "{0:N2}")%> - - - - - <%# Eval("Cantidad_Ultima", "{0:N2}")%> - - - - - <%# Eval("Importe_Ultima", "{0:N2}")%> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
- - -
-
+
@@ -341,7 +355,7 @@ -
+
--%> diff --git a/Contratos/ContratoAvance.aspx.vb b/Contratos/ContratoAvance.aspx.vb index 66c961842..15d5ccce3 100644 --- a/Contratos/ContratoAvance.aspx.vb +++ b/Contratos/ContratoAvance.aspx.vb @@ -138,8 +138,8 @@ Partial Class Contratos_ContratoAvance DdlContratos.DataSource = GlobalDTContratos.FiltraParametros(String.Format($"CveContratoTipo in (30,31) AND CveEmpresa = {UsuarioActual.CveEmpresa}")) DdlContratos.DataBind() - DDlContratosEstimaciones.DataSource = GlobalDTContratos.FiltraParametros(String.Format($"CveContratoTipo in (30,31) AND CveEmpresa = {UsuarioActual.CveEmpresa}")) - DDlContratosEstimaciones.DataBind() + 'DDlContratosEstimaciones.DataSource = GlobalDTContratos.FiltraParametros(String.Format($"CveContratoTipo in (30,31) AND CveEmpresa = {UsuarioActual.CveEmpresa}")) + 'DDlContratosEstimaciones.DataBind() End Sub @@ -207,7 +207,7 @@ Partial Class Contratos_ContratoAvance If e.Row.DataKey("CveContratoDetalle").ToEntero > 0 Then Dim LnkAnexo As LinkButton = e.Row.FCLinkButton("LnkModalDropzone") - 'LnkAnexo.Visible = True + Dim DVAnexo As Control = DirectCast(e.Row.FindControl("ModalAnexoEvidencia"), Control) LnkAnexo.OnClientClick = $" $('#{DVAnexo.ClientID}').modal('show'); return false;" @@ -220,9 +220,20 @@ Partial Class Contratos_ContratoAvance Dim LnkGuardarAvance As LinkButton = e.Row.FCLinkButton("LnkGuardarAvance") LnkGuardarAvance.Visible = True + + If e.Row.DataKey("CantidadMax").ToDouble = 0 Then + LnkAnexo.Visible = False + e.Row.FCTextBox("TxtCantidad").Visible = False + LnkGuardarAvance.Visible = False + + End If + End If + + + End If End Sub Protected Sub GetAnexos(sender As Object, e As System.EventArgs) @@ -432,120 +443,120 @@ Partial Class Contratos_ContratoAvance #Region "ESTIMACION" - Private Sub CargaAvancesParaEstimar() - CveContratoEstimacion = -1 + 'Private Sub CargaAvancesParaEstimar() + ' CveContratoEstimacion = -1 - Dim ObjContratos As New ClsContratos() - Dim DTEstimaciones As New DataTable - Dim NumeroEstimacionActual As Integer = 0 + ' Dim ObjContratos As New ClsContratos() + ' Dim DTEstimaciones As New DataTable + ' Dim NumeroEstimacionActual As Integer = 0 - If ObjContratos.GetContratosAvanceEstimacion(DDlContratosEstimaciones.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, -1) Then - DTEstimaciones = ObjContratos.DtResultados + ' If ObjContratos.GetContratosAvanceEstimacion(DDlContratosEstimaciones.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, -1) Then + ' DTEstimaciones = ObjContratos.DtResultados - CveContratoEstimacion = DDlContratosEstimaciones.SelectedValue.ToEntero + ' CveContratoEstimacion = DDlContratosEstimaciones.SelectedValue.ToEntero - End If + ' End If - ObjContratos.Dispose() + ' ObjContratos.Dispose() - If DTEstimaciones.Rows.Count > 0 Then - GvEstimaciones.DataSource = DTEstimaciones - BtnGuardarEstimacion.Visible = True - Else - GvEstimaciones.DataSource = Nothing - BtnGuardarEstimacion.Visible = False - End If - GvEstimaciones.DataBind() + ' If DTEstimaciones.Rows.Count > 0 Then + ' GvEstimaciones.DataSource = DTEstimaciones + ' BtnGuardarEstimacion.Visible = True + ' Else + ' GvEstimaciones.DataSource = Nothing + ' BtnGuardarEstimacion.Visible = False + ' End If + ' GvEstimaciones.DataBind() - UpEstimaciones.Update() - End Sub + ' UpEstimaciones.Update() + 'End Sub - Private Sub BtnConsultarEstimaciones_Click(sender As Object, e As EventArgs) Handles BtnConsultarEstimaciones.Click + 'Private Sub BtnConsultarEstimaciones_Click(sender As Object, e As EventArgs) Handles BtnConsultarEstimaciones.Click - CargaAvancesParaEstimar() + ' CargaAvancesParaEstimar() - End Sub + 'End Sub - Private Sub GvEstimaciones_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEstimaciones.RowDataBound + 'Private Sub GvEstimaciones_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEstimaciones.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then + ' If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.DBCampo("CveContratoDetalle").ToString.ToEntero = 0 Then + ' If e.Row.DBCampo("CveContratoDetalle").ToString.ToEntero = 0 Then - If e.Row.DBCampo("CveSubFamilias").ToString.ToEntero = 0 Then - If e.Row.DBCampo("CveFamilias").ToString.ToEntero = 0 Then - e.Row.CssClass = "SubTotales" - Else - e.Row.CssClass = "SubTotales2" - End If - Else - e.Row.CssClass = "SubTotales3" - End If - End If - End If + ' If e.Row.DBCampo("CveSubFamilias").ToString.ToEntero = 0 Then + ' If e.Row.DBCampo("CveFamilias").ToString.ToEntero = 0 Then + ' e.Row.CssClass = "SubTotales" + ' Else + ' e.Row.CssClass = "SubTotales2" + ' End If + ' Else + ' e.Row.CssClass = "SubTotales3" + ' End If + ' End If + ' End If - End Sub + 'End Sub - Private Sub BtnGuardarEstimacion_Click(sender As Object, e As EventArgs) Handles BtnGuardarEstimacion.Click + 'Private Sub BtnGuardarEstimacion_Click(sender As Object, e As EventArgs) Handles BtnGuardarEstimacion.Click - CveEstimacionNueva = -1 - NuemeroEstimacionNuevo = -1 + ' CveEstimacionNueva = -1 + ' NuemeroEstimacionNuevo = -1 - Dim ObjContratos As New ClsContratos() - Dim ErrorProceso As Boolean = False + ' Dim ObjContratos As New ClsContratos() + ' Dim ErrorProceso As Boolean = False - ObjContratos.IniciaTransacSQL() + ' ObjContratos.IniciaTransacSQL() - If ObjContratos.AddContratosAvanceEstimacion(CveContratoEstimacion, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + ' If ObjContratos.AddContratosAvanceEstimacion(CveContratoEstimacion, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then - CveEstimacionNueva = ObjContratos.CveEstimacionNueva - NuemeroEstimacionNuevo = ObjContratos.NumeroEstimacionNueva + ' CveEstimacionNueva = ObjContratos.CveEstimacionNueva + ' NuemeroEstimacionNuevo = ObjContratos.NumeroEstimacionNueva - For Each GvRow As GridViewRow In GvEstimaciones.Rows + ' For Each GvRow As GridViewRow In GvEstimaciones.Rows - If GvRow.DataKey("CveContratoAvance").ToEntero > 0 Then - If Not ObjContratos.UpdateContratosAvanceEstimacion(GvRow.DataKey("CveContratoAvance").ToEntero, ObjContratos.CveEstimacionNueva, UsuarioActual.CveEmpresa) Then - ErrorProceso = True - Exit For - End If - End If - Next + ' If GvRow.DataKey("CveContratoAvance").ToEntero > 0 Then + ' If Not ObjContratos.UpdateContratosAvanceEstimacion(GvRow.DataKey("CveContratoAvance").ToEntero, ObjContratos.CveEstimacionNueva, UsuarioActual.CveEmpresa) Then + ' ErrorProceso = True + ' Exit For + ' End If + ' End If + ' Next - Else - ErrorProceso = True - End If + ' Else + ' ErrorProceso = True + ' End If - 'AddContratosAvanceEstimacion - 'UpdateContratosAvanceEstimacion + ' 'AddContratosAvanceEstimacion + ' 'UpdateContratosAvanceEstimacion - If Not ErrorProceso Then - ObjContratos.Commit() - Alert($"Estimación {NuemeroEstimacionNuevo} agregada correctamente.") + ' If Not ErrorProceso Then + ' ObjContratos.Commit() + ' Alert($"Estimación {NuemeroEstimacionNuevo} agregada correctamente.") - BtnGuardarEstimacion.Visible = False - BtnDescargarGenerado.Visible = True + ' BtnGuardarEstimacion.Visible = False + ' BtnDescargarGenerado.Visible = True - Else - ObjContratos.RollBack() - End If + ' Else + ' ObjContratos.RollBack() + ' End If - ObjContratos.Dispose() + ' ObjContratos.Dispose() - UpEstimaciones.Update() - End Sub + ' UpEstimaciones.Update() + 'End Sub - Private Sub BtnDescargarGenerado_Click(sender As Object, e As EventArgs) Handles BtnDescargarGenerado.Click + 'Private Sub BtnDescargarGenerado_Click(sender As Object, e As EventArgs) Handles BtnDescargarGenerado.Click - GeneraAnexo(CveEstimacionNueva, NuemeroEstimacionNuevo, Now, DDlContratosEstimaciones.SelectedItem.Text) + ' GeneraAnexo(CveEstimacionNueva, NuemeroEstimacionNuevo, Now, DDlContratosEstimaciones.SelectedItem.Text) - End Sub + 'End Sub Private Sub GeneraAnexo(CveEstimacion As Integer, NumeroEstimacion As Integer, FechaEstimacion As Date, NumeroContrato As String) diff --git a/Contratos/ContratoObra.aspx b/Contratos/ContratoObra.aspx index 86f5165e3..0b57d21c6 100644 --- a/Contratos/ContratoObra.aspx +++ b/Contratos/ContratoObra.aspx @@ -320,24 +320,20 @@
Datos del Contrato
-
- - - - +
- -
+ +
- -
+ +
@@ -345,16 +341,16 @@
- -
+ +
-