From a3c8a8872a74fc0c84fd40239f53185e3ccc3265 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Tue, 1 Dec 2020 10:13:05 -0700 Subject: [PATCH 1/9] web service econo --- App_Code/ClsProductosServicios.vb | 67 ++++- Ashx/E141.ashx | 470 ++++++++++++++++++++++++++---- 2 files changed, 481 insertions(+), 56 deletions(-) diff --git a/App_Code/ClsProductosServicios.vb b/App_Code/ClsProductosServicios.vb index 016bdbaee..d77dbbe60 100644 --- a/App_Code/ClsProductosServicios.vb +++ b/App_Code/ClsProductosServicios.vb @@ -2135,6 +2135,71 @@ Public Class ClsProductosServicios End Try Return Retorno - End Function + End Function + + Public Function GetProductosModificados(CveEmpresa As Integer, CvePrecioLista As Integer) 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 + 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) 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 + 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) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_VendedoresModificadosGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + 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/Ashx/E141.ashx b/Ashx/E141.ashx index 1afdca0b9..ee2b2f1e0 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,27 @@ 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 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 +63,395 @@ Public Class E141 : Implements IHttpHandler End If End If + + Dim Metodo = If(context.Request("Metodo") = Nothing, "", context.Request("Metodo").ToString()) + + If Metodo = "CrearActualizarProductos" Then + retorno = CrearActualizarProductos() + End If + + If Metodo = "ActualizarPrecios" Then + retorno = ActualizarPrecios() + End If + + If Metodo = "ActualizarExistencias" Then + retorno = ActualizarExistencias() + End If + + If Metodo = "ActualizarVendedores" Then + retorno = ActualizarVendedores() + 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 - 'End Function + Return JsonConvert.SerializeObject(respuesta) + End If - 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 + 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", "$2y$10$LGqtRWUloKQmAt.jcUldc.PmS5LJ6l.WU2w1G4PBOTLMVKZRNQFPS") + + 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", "$2y$10$LGqtRWUloKQmAt.jcUldc.PmS5LJ6l.WU2w1G4PBOTLMVKZRNQFPS") + + 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 + + ' var httpWebRequest = (httpWebRequest)WebRequest.Create("http://url"); + 'httpWebRequest.ContentType = "application/json"; + 'httpWebRequest.Method = "POST"; + + 'Using (var streamWriter = New StreamWriter(httpWebRequest.GetRequestStream())) + '{ + ' String json = "{\"user\":\"test\"," + + ' "\"password\":\"bla\"}"; + + ' streamWriter.Write(json); + '} + + 'var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse(); + 'Using (var streamReader = New StreamReader(httpResponse.GetResponseStream())) + '{ + ' var result = StreamReader.ReadToEnd(); + '} +#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() As String + Return EnviarInformacion2("https://services.fidelityapps/api/services/products/import", GetProductosModificados()) + End Function + + Private Function GetProductosModificados() 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) 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() As String + Return EnviarInformacion("https://services.fidelityapps/api/services/products/price-import", GetPreciosModificados()) + End Function + + Private Function GetPreciosModificados() 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) 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("https://services.fidelityapps/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() As String + Return EnviarInformacion("https://services.fidelityapps/api/v1/sellers/import", GetVendedores()) + End Function + + Private Function GetVendedores() 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) 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 +476,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 From 8953c5c94ce4b70604e4561d470a511e663785c8 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 2 Dec 2020 01:38:35 -0700 Subject: [PATCH 2/9] bdh --- Inventarios/RecepcionUsados.aspx | 2 +- Inventarios/RecepcionUsados.aspx.vb | 115 ++++++++++------ Ventas/Clientes.aspx | 85 +++--------- Ventas/Clientes.aspx.vb | 48 ++----- Ventas/Ventas.aspx | 203 +++++++++++++++------------- Ventas/Ventas.aspx.vb | 142 ++++++++++++++++--- 6 files changed, 338 insertions(+), 257 deletions(-) diff --git a/Inventarios/RecepcionUsados.aspx b/Inventarios/RecepcionUsados.aspx index 0a80a9302..f5b6dcc47 100644 --- a/Inventarios/RecepcionUsados.aspx +++ b/Inventarios/RecepcionUsados.aspx @@ -752,7 +752,7 @@ diff --git a/Inventarios/RecepcionUsados.aspx.vb b/Inventarios/RecepcionUsados.aspx.vb index 7c83727db..22e3f17ec 100644 --- a/Inventarios/RecepcionUsados.aspx.vb +++ b/Inventarios/RecepcionUsados.aspx.vb @@ -2489,7 +2489,6 @@ Partial Class Inventarios_RecepcionUsados For Each Row As GridViewRow In GvM.Rows If Row.RowType = DataControlRowType.DataRow Then - Dim CvePS As Integer = Row.DataKey("CvePS").ToEntero() Dim Cantidad As Decimal = Row.DataKey("Cantidad").ToDecimal() Dim PU As Decimal = Row.DataKey("PU").ToDecimal() Dim CveTamaño As Integer = Row.DataKey("CveTamaño").ToEntero() @@ -2502,29 +2501,45 @@ Partial Class Inventarios_RecepcionUsados Dim PS As String = "" Dim PorcentajeIVA As Decimal = 0D Dim IVA As Decimal = 0D - If CvePS > 0 Then - If SubTotal > 0 Then - Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).Rows(0) - If Dr IsNot Nothing Then - CveUnidadMedida = Dr("CveUnidadMedida").ToString.ToEntero - CveClasificacion = Dr("CveClasificacion").ToString.ToEntero - PS = Dr("PSCodigo").ToString - UnidadMedida = Dr("UnidadMedida").ToString - Clasificacion = Dr("Clasificacion").ToString + + Dim CvePS As Integer = 0 + + Select Case RblUsadosAjuste.SelectedValue + Case "0" ' USADOS + CvePS = Row.DataKey("CvePS").ToEntero() + Case "1" ' AJUSTE/GARANTIA + Dim drDatos As DataRow = GlobalDTAcumTamaños().FiltroPrimero(String.Format("CveTamaño = {0} AND CveEmpresa = {1}", CveTamaño, UsuarioActual.CveEmpresa)) + + If drDatos IsNot Nothing Then + CvePS = drDatos.Item("CvePSCargo").ToString.ToEntero End If - PorcentajeIVA = 0.16D - IVA = SubTotal * PorcentajeIVA + End Select + + If CvePS > 0 Then + Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).Rows(0) + If Dr IsNot Nothing Then + CveUnidadMedida = Dr("CveUnidadMedida").ToString.ToEntero + CveClasificacion = Dr("CveClasificacion").ToString.ToEntero + PS = Dr("PSCodigo").ToString + UnidadMedida = Dr("UnidadMedida").ToString + Clasificacion = Dr("Clasificacion").ToString End If + PorcentajeIVA = 0.16D + IVA = SubTotal * PorcentajeIVA + + AddPSRNC(ObjRemisionNC.DtDetalle, Cantidad, CveUnidadMedida, UnidadMedida, CveClasificacion, Clasificacion, CvePS, PS, "", PU, 0, -1, "", + ObjRemisionNC.CveSubProyecto, ObjRemisionNC.SubProyecto.SubProyecto, PorcentajeIVA:=PorcentajeIVA, CveTamaño:=CveTamaño) + Else + Alert("No se pudo cargar el producto", TipoMensaje.MsgError) End If - AddPSRNC(ObjRemisionNC.DtDetalle, Cantidad, CveUnidadMedida, UnidadMedida, CveClasificacion, Clasificacion, CvePS, PS, "", PU, 0, -1, "", - ObjRemisionNC.CveSubProyecto, ObjRemisionNC.SubProyecto.SubProyecto, PorcentajeIVA:=PorcentajeIVA, CveTamaño:=CveTamaño) End If Next + 'SI ES AJUSTE/GARANTIA If RblUsadosAjuste.SelectedValue = "1" Then 'agrego un registro extra del importe de ajuste - Dim PU As Decimal = TxtImporteAjuste.Text.ToDecimal + Dim PU As Decimal = TmpDTAjustes.SUMD("Importe") 'CONSULTA EL CONCEPTO DE NC Dim ArrayNC As String() = UsuarioActual.Empresa.Funcionalidad(591).Split(",".ToCharArray()) Dim NCAjuste As Integer = -1 @@ -2540,7 +2555,18 @@ Partial Class Inventarios_RecepcionUsados CveClasificacion = Dr("CveClasificacion").ToString.ToEntero CvePS = Dr("CvePS").ToString.ToEntero Dim PorcentajeIVA As Decimal = 0.16D - Dim Obs As String = $"Descuento por garantía. BCI: {DdlBCIAjuste.SelectedValue}" + + Dim SbBCI As New StringBuilder() + SbBCI.Append("BCI: ") + 'AGREGA LOS PRODUCTOS COMO OBSERVACION + For Each GvRow As GridViewRow In GvM.Rows + If GvRow.RowType = DataControlRowType.DataRow Then + SbBCI.AppendFormat("{0},", GvRow.DataKey("CodigoPS")) + End If + Next + SbBCI.Remove(SbBCI.Length - 1, 1) + + Dim Obs As String = SbBCI.ToString() AddPSRNC(ObjRemisionNC.DtDetalle, 1, CveUnidadMedida, "", CveClasificacion, "", CvePS, "", Obs, PU, 0, -1, "", ObjRemisionNC.CveSubProyecto, ObjRemisionNC.SubProyecto.SubProyecto, PorcentajeIVA:=PorcentajeIVA) @@ -2570,7 +2596,6 @@ Partial Class Inventarios_RecepcionUsados ObjRemisionNC.Total = Total ObjRemisionNC.TotalOtrosConceptos = 0 - ObjRemisionNC.DtMovimientosUsados = DtMovimientos ObjRemisionNC.CveAlmacen = DdlAlmacen.SelectedValue.ToEntero() ObjRemisionNC.ObservacionesMovimiento = TxtObservaciones.Text @@ -2646,6 +2671,10 @@ Partial Class Inventarios_RecepcionUsados End Sub Private Sub CargaPSAjuste() DdlPSAjuste.setEsWebService(True) + DdlPSAjuste.Attributes.Add("data-cvesubproyecto", "-1") + DdlPSAjuste.ddlWS.Attributes.Add("data-cveclasificacion", "-1") + DdlPSAjuste.ddlWS.Attributes.Add("data-pagina", "ventas/ventas") + DdlPSAjuste.ddlWS.Attributes.Add("data-Estatus", "1") End Sub Protected Sub DdlPSAjuste_selectedindexchange(sender As Object, e As EventArgs) @@ -2996,28 +3025,38 @@ Partial Class Inventarios_RecepcionUsados End If Dim ObjPS As New ClsProductosServicios - Dim CveTamaño As Integer = -1 - If ObjPS.GetPS(CvePS, -1, UsuarioActual.CveEmpresa) Then - CveTamaño = ObjPS.DtResultados.FiltroPrimeroValor("CveTamaño").ToEntero - End If - Dim drDatos As DataRow = GlobalDTAcumTamaños().FiltroPrimero(String.Format("CveTamaño = {0} AND CveEmpresa = {1}", CveTamaño, UsuarioActual.CveEmpresa)) - - If drDatos IsNot Nothing Then - Dim Importe As Decimal = drDatos("Cargo").ToString.ToDecimal - Dim drTamañoPS As DataRow = Nothing - - DtMovimientos.Rows.Clear() - - If ObjPS.GetPS(drDatos.Item("CvePSCargo").ToString.ToEntero, -1, UsuarioActual.CveEmpresa) Then - drTamañoPS = ObjPS.DtResultados.FiltroPrimero("") - 'CveTamaño = -1 'limpio esta variable para que no se registre dos veces en la clase Modelos - AddNew(drTamañoPS.Item("CvePS").ToString.ToEntero, drTamañoPS.Item("PSCodigo").ToString, drTamañoPS.Item("CveUM").ToString.ToEntero, drTamañoPS.Item("UnidadMedida").ToString, 1.0, Importe, - "", "-1", "-1", "-1", "", "", -1, "", "", CveTamaño) - + Try + Dim CveTamaño As Integer = -1 + If ObjPS.GetPS(CvePS, -1, UsuarioActual.CveEmpresa) Then + CveTamaño = ObjPS.DtResultados.FiltroPrimeroValor("CveTamaño").ToEntero End If - Else - Alert("No se pudo cargar el producto", TipoMensaje.MsgError) - End If + Dim drDatos As DataRow = GlobalDTAcumTamaños().FiltroPrimero(String.Format("CveTamaño = {0} AND CveEmpresa = {1}", CveTamaño, UsuarioActual.CveEmpresa)) + + If drDatos IsNot Nothing Then + Dim Importe As Decimal = drDatos("Cargo").ToString.ToDecimal + Dim drTamañoPS As DataRow = Nothing + + DtMovimientos.Rows.Clear() + + Select Case RblUsadosAjuste.SelectedValue + Case "0" ' USADOS + CvePS = drDatos.Item("CvePSCargo").ToString.ToEntero + Case "1" ' AJUSTE/GARANTIA + CvePS = DdlPSAjuste.SelectedValue.ToEntero + End Select + + If ObjPS.GetPS(CvePS, -1, UsuarioActual.CveEmpresa) Then + drTamañoPS = ObjPS.DtResultados.FiltroPrimero("") + 'CveTamaño = -1 'limpio esta variable para que no se registre dos veces en la clase Modelos + AddNew(drTamañoPS.Item("CvePS").ToString.ToEntero, drTamañoPS.Item("PSCodigo").ToString, drTamañoPS.Item("CveUM").ToString.ToEntero, drTamañoPS.Item("UnidadMedida").ToString, 1.0, Importe, + "", "-1", "-1", "-1", "", "", -1, "", "", CveTamaño) + End If + Else + Alert("No se pudo cargar el producto", TipoMensaje.MsgError) + End If + Catch ex As Exception + OnError("Ocurrió un error al agregar el producto", ex) + End Try ObjPS.Dispose() GuardaAjuste() diff --git a/Ventas/Clientes.aspx b/Ventas/Clientes.aspx index bab59dcf6..b168f7b82 100644 --- a/Ventas/Clientes.aspx +++ b/Ventas/Clientes.aspx @@ -4155,61 +4155,7 @@ - -
-
-
-
-
- - Usados resumen -
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - -
Puntos -
Importe Cargo$ - - - -
Importe Bonificación$ - - - -
- -
-
- - -
-
-
@@ -4219,23 +4165,28 @@
+
- - - - - - - - - - - +
+
+ + + + + + + + + + + +
+
diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index a996cf41b..55ce1f097 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -4783,7 +4783,7 @@ Partial Class Clientes Exit Select Case 6 TxtCuentaValor.Visible = True - TxtCuentaValor.TextMode = TextBoxMode.Number + TxtCuentaValor.TextMode = TextBoxMode.SingleLine If Requerido = 1 Then RFVCuentaValor1.Enabled = True @@ -4893,7 +4893,7 @@ Partial Class Clientes Exit Select Case 6 TxtCuentaValor.Visible = True - TxtCuentaValor.TextMode = TextBoxMode.Number + TxtCuentaValor.TextMode = TextBoxMode.SingleLine If Requerido = 1 Then RFVCuentaValor2.Enabled = True @@ -9135,45 +9135,27 @@ Partial Class Clientes Dim ObjAcum As New ClsAcumuladores Dim ImporteCargo As Decimal = 0D - Dim ImporteBonificacion As Decimal = 0D If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, TxtFechaIUsados.Text.ToDate, TxtFechaFUsados.Text.ToDate, CveConcepto:=DdlConceptoUsado.SelectedValue.ToEntero()) Then - GvAcum.DataSource = ObjAcum.DtResultados - - LblUsadosPuntos.Text = (ObjAcum.DtResultados.SUM("Puntos", " CveConcepto = 2 ") - ObjAcum.DtResultados.SUM("Puntos", " CveConcepto IN (1,3) ")).ToDecimal.FormatoNumero(2) - - ImporteCargo = ObjAcum.DtResultados.SUM("ImporteCargo", "(FacturadoCargo = 0 OR FacturadoCargo IS NULL) AND CveConcepto = 1 ").ToDecimal - ImporteBonificacion = ObjAcum.DtResultados.SUM("ImporteBonificacion", "(FacturadoBonificacion = 0 OR FacturadoBonificacion IS NULL) AND CveConcepto = 1 ").ToDecimal - - LblUsadosImpCargo.Text = ImporteCargo.FormatoNumero(2) - LblusadosImpBonificacion.Text = ImporteBonificacion.FormatoNumero(2) - - Else - GvAcum.DataSource = Nothing - - ImporteCargo = 0D - ImporteBonificacion = 0D - - LblUsadosImpCargo.Text = "" - LblusadosImpBonificacion.Text = "" - LblUsadosPuntos.Text = "" - - End If - - If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then + End If + + Dim ImporteBonificacion As Decimal = 0 + If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) AndAlso ObjAcum.DtResultados.Rows.Count > 0 Then GvUsadosResumen.DataSource = ObjAcum.DtResultados + ImporteBonificacion = ObjAcum.DtResultados.Rows(4)("Valor").ToString().ToDecimal() End If - GvUsadosResumen.DataBind() - - 'LnkFacturaUsadosCargos.Visible = If(ImporteCargo > 0, True, False) - LnkFacturaUsadosBonificacion.Visible = If(ImporteBonificacion > 0, True, False) - + GvUsadosResumen.DataBind() + + + 'LnkFacturaUsadosCargos.Visible = If(ImporteCargo > 0, True, False) + LnkFacturaUsadosBonificacion.Visible = If(ImporteBonificacion > 0, True, False) + ObjAcum.Dispose() GvAcum.DataBind() UpAcciones.Update() - UpUsadosResumen.Update() + 'UpUsadosResumen.Update() UpGvUsadosResumen.Update() UpAcum.Update() @@ -10187,7 +10169,7 @@ Partial Class Clientes Private Sub LnkUsadosReset_Click(sender As Object, e As EventArgs) Handles LnkUsadosReset.Click Dim Acum As New ClsAcumuladores - Dim Puntos As Decimal = -LblUsadosPuntos.Text.ToDecimal + Dim Puntos As Decimal = -GvUsadosResumen.Rows.Cast(Of GridViewRow).Where(Function(x) x.RowType = DataControlRowType.DataRow).FirstOrDefault(Function(gvr) gvr.RowIndex = 3).DataKey("Puntos").ToEntero() If Acum.DistribuidorMovtosAdd(CveCliente, 1, 1, 3, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Puntos, "Saldo Inicializado") Then Alert("Puntuación Inicializada") End If diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index cb3ea762a..7482a17fe 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -6273,12 +6273,21 @@
+
+ + + + + +
+
+
- Cargos +
@@ -8086,75 +8095,75 @@ function LimpiaModal() { $('#<%= TxtDireccion.ClientID %>').val(''); - $('#<%= TxtColonia.ClientID %>').val(''); - $('#<%= TxtCiudad.ClientID %>').val(''); - $('#<%= TxtEstado.ClientID %>').val(''); - $('#<%= TxtCP.ClientID %>').val(''); - } + $('#<%= TxtColonia.ClientID %>').val(''); + $('#<%= TxtCiudad.ClientID %>').val(''); + $('#<%= TxtEstado.ClientID %>').val(''); + $('#<%= TxtCP.ClientID %>').val(''); + } - function BtnMateriales() { - $('#BtnMateriales').click(); - } + function BtnMateriales() { + $('#BtnMateriales').click(); + } - function BtnEnviarMailCancelacion() { - $('#BtnEnviarMailCancelacion').click(); - } - function BtnRefacturacionConfirmar() { - $('#BtnRefacturacionConfirmar').click(); - } - function BtnRefacturacionConfirmarAceptacion(Liga) { - $('#BtnRefacturacionConfirmarAceptacion').click(); - } - function BtnRefrescarPagina() { - $('#BtnRefrescarPagina').click(); - } - function Recargar() { - $('#BtnRefrescarPagina').click(); - } - function BtnAplicaNuevaNC() { - $('#BtnAplicaNuevaNC').click(); - } + function BtnEnviarMailCancelacion() { + $('#BtnEnviarMailCancelacion').click(); + } + function BtnRefacturacionConfirmar() { + $('#BtnRefacturacionConfirmar').click(); + } + function BtnRefacturacionConfirmarAceptacion(Liga) { + $('#BtnRefacturacionConfirmarAceptacion').click(); + } + function BtnRefrescarPagina() { + $('#BtnRefrescarPagina').click(); + } + function Recargar() { + $('#BtnRefrescarPagina').click(); + } + function BtnAplicaNuevaNC() { + $('#BtnAplicaNuevaNC').click(); + } - $('.DdlPS').on("select2:open", function (e) { $('.select2-container.select2-container--default .select2-dropdown .select2anothertable').remove(); }); - $('.DdlPSPyME').on("select2:open", function (e) { $('.select2-container.select2-container--default .select2-dropdown .select2anothertable').remove(); }); + $('.DdlPS').on("select2:open", function (e) { $('.select2-container.select2-container--default .select2-dropdown .select2anothertable').remove(); }); + $('.DdlPSPyME').on("select2:open", function (e) { $('.select2-container.select2-container--default .select2-dropdown .select2anothertable').remove(); }); - $("body").on("mouseenter", ".select2-container.select2-container--default.select2-container--open .select2-dropdown li", function (event) { - var $this = $(this); - var ind = $this.index(); - $(".select2-container.select2-container--default.select2-container--open .select2-dropdown .select2anothertable tr.active").removeClass('active'); - $(".select2-container.select2-container--default.select2-container--open .select2-dropdown .select2anothertable tr:nth-child(" + (ind + 2) + ")").addClass('active'); - //log($this); - }); - var scrollfuncion = function () { - var stop = this.scrollTop; - $(".select2-container.select2-container--default.select2-container--open .select2-dropdown .select2anothertable").scrollTop(stop); - } - function CargaExistenciaAlmacenes(data, params) { - var div = $('
'); - $('.select2-container.select2-container--default.select2-container--open .select2-dropdown .select2anothertable').remove(); - $('.select2-container.select2-container--default.select2-container--open .select2-dropdown').prepend(div); - var table = $('
'); div.append(table); - var tbody = $(''); table.append(tbody); - $(".select2-container--default .select2-results>.select2-results__options").off("scroll", scrollfuncion); - $(".select2-container--default .select2-results>.select2-results__options").scroll(scrollfuncion); - var indexd = 0; - data.forEach(function (item) { - if (indexd == 0) { + $("body").on("mouseenter", ".select2-container.select2-container--default.select2-container--open .select2-dropdown li", function (event) { + var $this = $(this); + var ind = $this.index(); + $(".select2-container.select2-container--default.select2-container--open .select2-dropdown .select2anothertable tr.active").removeClass('active'); + $(".select2-container.select2-container--default.select2-container--open .select2-dropdown .select2anothertable tr:nth-child(" + (ind + 2) + ")").addClass('active'); + //log($this); + }); + var scrollfuncion = function () { + var stop = this.scrollTop; + $(".select2-container.select2-container--default.select2-container--open .select2-dropdown .select2anothertable").scrollTop(stop); + } + function CargaExistenciaAlmacenes(data, params) { + var div = $('
'); + $('.select2-container.select2-container--default.select2-container--open .select2-dropdown .select2anothertable').remove(); + $('.select2-container.select2-container--default.select2-container--open .select2-dropdown').prepend(div); + var table = $('
'); div.append(table); + var tbody = $(''); table.append(tbody); + $(".select2-container--default .select2-results>.select2-results__options").off("scroll", scrollfuncion); + $(".select2-container--default .select2-results>.select2-results__options").scroll(scrollfuncion); + var indexd = 0; + data.forEach(function (item) { + if (indexd == 0) { + var tr = $(''); tbody.append(tr); + var td; + for (var key in item) { + if (!(key == "text" || key == "id")) { td = $('' + key + ''); tr.append(td); } + } + } var tr = $(''); tbody.append(tr); + var td; for (var key in item) { - if (!(key == "text" || key == "id")) { td = $('' + key + ''); tr.append(td); } - } - } - var tr = $(''); tbody.append(tr); - - var td; - for (var key in item) { - if (!(key == "text" || key == "id")) { - if ((item[key] > 0)) { - td = $('' + item[key] + ''); tr.append(td); - } else { - if ('<%= UsuarioActual.Empresa.Funcionalidad(566) %>' == '1') { + if (!(key == "text" || key == "id")) { + if ((item[key] > 0)) { + td = $('' + item[key] + ''); tr.append(td); + } else { + if ('<%= UsuarioActual.Empresa.Funcionalidad(566) %>' == '1') { var buscarAlmacenes = "CargaExistenciasSucursales(" + item.id + ",'" + item.text + "');" td = $('' + item[key] + ' '); tr.append(td); } else { @@ -8361,44 +8370,44 @@ if (TotalAnticipos > 0) { $('#<%= BtnAceptarAnticipos.ClientID %>').prop('disabled', false); - } else { - $('#<%= BtnAceptarAnticipos.ClientID %>').prop('disabled', true); - } - } else { - $('#<%= BtnAceptarAnticipos.ClientID %>').prop('disabled', true); - } + } else { + $('#<%= BtnAceptarAnticipos.ClientID %>').prop('disabled', true); + } + } else { + $('#<%= BtnAceptarAnticipos.ClientID %>').prop('disabled', true); + } + } + + function showDivEC() { + $('#<%= TxtRFCCliente.ClientID %>').val(''); + $('#<%= TxtNombreCliente.ClientID %>').val(''); + $('#<%= TxtDireccionCliente.ClientID %>').val(''); + $('#<%= TxtNumExtCliente.ClientID %>').val(''); + $('#<%= TxtNumIntCliente.ClientID %>').val(''); + $('#<%= TxtCPCliente.ClientID %>').val(''); + $('#<%= TxtColoniaCliente.ClientID %>').val(''); + $('#<%= TxtTelefonoCliente.ClientID %>').val(''); + $('#<%= TxtCiudadCliente.ClientID %>').val(''); + $('#<%= TxtLocalidadCliente.ClientID %>').val(''); + $('#<%= DdlSATPais.ClientID %>').val(''); + $('#<%= DdlEstadoSAT.ClientID %>').val(''); + $('#<%= TxtCorreoCliente.ClientID %>').val(''); + + $('#divAgregarCliente').modal(); } - function showDivEC() { - $('#<%= TxtRFCCliente.ClientID %>').val(''); - $('#<%= TxtNombreCliente.ClientID %>').val(''); - $('#<%= TxtDireccionCliente.ClientID %>').val(''); - $('#<%= TxtNumExtCliente.ClientID %>').val(''); - $('#<%= TxtNumIntCliente.ClientID %>').val(''); - $('#<%= TxtCPCliente.ClientID %>').val(''); - $('#<%= TxtColoniaCliente.ClientID %>').val(''); - $('#<%= TxtTelefonoCliente.ClientID %>').val(''); - $('#<%= TxtCiudadCliente.ClientID %>').val(''); - $('#<%= TxtLocalidadCliente.ClientID %>').val(''); - $('#<%= DdlSATPais.ClientID %>').val(''); - $('#<%= DdlEstadoSAT.ClientID %>').val(''); - $('#<%= TxtCorreoCliente.ClientID %>').val(''); + function hideDivEC() { + $('#divAgregarCliente').modal('hide'); + } - $('#divAgregarCliente').modal(); - } - - function hideDivEC() { - $('#divAgregarCliente').modal('hide'); - } - - var ValidarRNC = false; - function AplicarValidarRNC(Valor) { - ValidarRNC = Valor; - } - function CompararNC() { - if (ValidarRNC) { - var TotalRem = ToDouble(document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').value); + var ValidarRNC = false; + function AplicarValidarRNC(Valor) { + ValidarRNC = Valor; + } + function CompararNC() { + if (ValidarRNC) { + var TotalRem = ToDouble(document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').value); var TotalNC = ToDouble(document.getElementById('<%= TxtNCImporte.ClientID %>').value); if (TotalRem == TotalNC) { diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 90038885c..18be4a942 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -14776,8 +14776,9 @@ Partial Class Ventas If NuevaFactura = 1 AndAlso UsuarioActual.TienePermisoProceso(222) Then If ObjVentas.GetVentaDetalle(ObjFacturaDevolucion.CveVenta) Then TmpDT = ObjVentas.DtResultados + TmpDT.Columns.Add("CveVentaDetalleRNC", GetType(Integer)) End If - ErrorCancelar = ProcesoPrepolizas(ObjConta, ObjFacturaDevolucion, -1, TmpDT, ObjAC, -1, ObjBancos, ObjVentas) + ErrorCancelar = ProcesoPrepolizaBtnAplicaNuevaNC_Clicks(ObjConta, ObjFacturaDevolucion, -1, TmpDT, ObjAC, -1, ObjBancos, ObjVentas) Else ErrorCancelar = ProcesoPrepolizas(ObjConta, ObjFacturaDevolucion, -1, TmpDT, ObjAC, -1, ObjBancos, ObjVentas) End If @@ -23582,7 +23583,7 @@ Partial Class Ventas End Sub Protected Sub DdlVentaUsado_SelectedIndexChanged(sender As Object, e As EventArgs) - CargaRNC(DdlVentaUsado.SelectedValue.ToEntero()) + RblRNCTipo_SelectedIndexChanged(RblRNCTipo, EventArgs.Empty) End Sub Private Sub InicializaAplicarNCMasiva() @@ -23603,7 +23604,9 @@ Partial Class Ventas 'LkNotaCredito.Visible = False DivGvCxC.Visible = True CargaCxC() - CargaRNC() + 'CARGAR RNC + RblRNCTipo_SelectedIndexChanged(RblRNCTipo, EventArgs.Empty) + TxtNCPorcentaje.Attributes.Add("onkeyup", "CalculaImporteNCMasivo();") TxtNCImporte.Text = "0.00" TxtNCImporte.Enabled = False @@ -23622,6 +23625,28 @@ Partial Class Ventas ObjMovtos.Dispose() GvCxC.DataBind() End Sub + + Protected Sub RblRNCTipo_SelectedIndexChanged(sender As Object, e As EventArgs) + Select Case RblRNCTipo.SelectedValue + Case "1" 'CARGOS + LtlCargos.Text = "CARGOS" + DivRNCCargo.Visible = True + DivRNCBon.Visible = False + CargaRNC(DdlVentaUsado.SelectedValue.ToEntero(), False, False) + + Case "2" 'BONIFICACIONES + DivRNCCargo.Visible = False + DivRNCBon.Visible = True + CargaRNC(-1, True, False) + + Case "3" 'AJUSTE/GARANTIAS + LtlCargos.Text = "AJUSTES/GARANTIAS" + DivRNCCargo.Visible = True + DivRNCBon.Visible = False + CargaRNC(DdlVentaUsado.SelectedValue.ToEntero(), False, True) + + End Select + End Sub Protected Sub ChkMostarProductosRNC_CheckedChanged(sender As Object, e As EventArgs) If ChkMostarProductosRNC.Checked Then DivRNCCargos.Visible = False @@ -23630,11 +23655,11 @@ Partial Class Ventas Else DivRNCCargos.Visible = True DivRNCCargosDetalle.Visible = False - CargaRNC(DdlVentaUsado.SelectedValue.ToEntero()) + RblRNCTipo_SelectedIndexChanged(RblRNCTipo, EventArgs.Empty) End If UpModalRemisionesNC.Update() End Sub - Private Sub CargaRNC(Optional CveVentaUsado As Integer = -1) + Private Sub CargaRNC(Optional CveVentaUsado As Integer = -1, Optional CargarBonificaciones As Boolean = False, Optional CargarSoloGarantias As Boolean = False) Dim DtNC As DataTable = Nothing Dim ObjMovtos As New ClsMovimientos() @@ -23643,16 +23668,24 @@ Partial Class Ventas End If ObjMovtos.Dispose() - TmpDTRNCBonificacionesSeleccionadas = Nothing - - GvRemisionesNC.DataSource = DtNC.FiltraParametros("TipoRNC = 1") - GvRemisionesNCBon.DataSource = TmpDTRNCBonificacionesSeleccionadas + Me.TmpDTRNCBonificacionesSeleccionadas = Nothing Me.TmpDTRNCBonificacionesCliente = DtNC.FiltraParametros("TipoRNC = 2") Me.TmpDTRNCBonificacionesCliente.Columns.Add("ImporteBonificacion", GetType(Decimal)) Me.TmpDTRNCBonificacionesCliente.Columns.Add("IVABonificacion", GetType(Decimal)) Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer)) + If CargarBonificaciones Then + Me.TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Copy() + End If + + If CargarSoloGarantias Then + GvRemisionesNC.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = True") + Else + GvRemisionesNC.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = False") + End If + GvRemisionesNCBon.DataSource = Me.TmpDTRNCBonificacionesSeleccionadas + GvRemisionesNC.DataBind() GvRemisionesNCBon.DataBind() @@ -24119,12 +24152,18 @@ Partial Class Ventas End If Else - For Each RNC In ListaRemisionesNC - DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero(), AplicaNCUsado:=(UsuarioActual.CveEmpresa = 140)), True, MissingSchemaAction.Ignore) - Next - For Each RNC In ListaNCBonificacion - DtImpuestosBonificacion.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero(), AplicaNCUsado:=(UsuarioActual.CveEmpresa = 140)), True, MissingSchemaAction.Ignore) - Next + If ListaRemisionesNC IsNot Nothing Then + For Each RNC In ListaRemisionesNC + DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero(), AplicaNCUsado:=(UsuarioActual.CveEmpresa = 140)), True, MissingSchemaAction.Ignore) + Next + End If + + If ListaNCBonificacion IsNot Nothing Then + For Each RNC In ListaNCBonificacion + DtImpuestosBonificacion.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero(), AplicaNCUsado:=(UsuarioActual.CveEmpresa = 140)), True, MissingSchemaAction.Ignore) + Next + End If + End If @@ -24320,12 +24359,11 @@ Partial Class Ventas For Each RNC In ListaNC Dim UltimoRenglonRNC As Integer = 1 Dim TotalAcumuladoRNC As Decimal = 0 + Dim Terminar As Boolean = False For Each RowUsado As DataRow In RNC.DtDetalle.Rows - Dim PorcentajeAplicado = (RNC.TotalRemNCAplicado / RNC.Total) - - Dim Cantidad As Decimal = RowUsado("Cantidad").ToString().ToDecimal() * PorcentajeAplicado + Dim Cantidad As Decimal = RowUsado("Cantidad").ToString().ToDecimal() Dim Obs = RowUsado("CodigoPS").ToString() @@ -24345,8 +24383,33 @@ Partial Class Ventas TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR) + 'SI EL IMPORTE ES MAYOR REALIZA EL AJUSTE + If TotalAcumuladoRNC > RNC.TotalRemNCAplicado Then + Terminar = True + 'RESTA LO SUMANDO DEL ACUMULADO + TotalAcumuladoRNC -= (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR) + + Dim Diferencia As Decimal = RNC.TotalRemNCAplicado - TotalAcumuladoRNC + + Dim TotalPartida As Decimal = (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR) + + Dim PorcentajePorAplicar As Decimal = (Diferencia / TotalPartida) + + Cantidad = Cantidad * PorcentajePorAplicar + + TotalCalculableImpuestos = (Cantidad * ImportePU) + ImporteIVA = (TotalCalculableImpuestos * RowUsado("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2) + ImporteIEPS = (TotalCalculableImpuestos * RowUsado("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2) + ImporteRetIVA = (TotalCalculableImpuestos * RowUsado("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2) + ImporteRetISR = (TotalCalculableImpuestos * RowUsado("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2) + + ImporteTotal = TotalCalculableImpuestos + + TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR) + End If + 'SI ES EL ULTIMO REGLON REALIZA UN AJUSTE - If UltimoRenglonRNC = RNC.DtDetalle.Rows.Count Then + If UltimoRenglonRNC = RNC.DtDetalle.Rows.Count OrElse Terminar Then Dim Ajuste As Decimal = 0 If Math.Abs(RNC.TotalRemNCAplicado - TotalAcumuladoRNC) > 0.00 Then Ajuste = RNC.TotalRemNCAplicado - TotalAcumuladoRNC @@ -24361,6 +24424,10 @@ Partial Class Ventas Obs, Cantidad, ImportePU, RowUsado("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowUsado("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA, RowUsado("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowUsado("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0.0, ImporteTotal, "", "", -1, -1, DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalle").ToString().ToEntero()) + + If Terminar Then + Exit For + End If Next Next @@ -24424,6 +24491,7 @@ Partial Class Ventas For Each RNCBonificacion In ListaNCBonificacion Dim UltimoRenglonRNC As Integer = 1 Dim TotalAcumuladoRNC As Decimal = 0 + Dim Terminar As Boolean = False Dim RNCCargo = ListaNC.Where(Function(f) f.CveVenta = RNCBonificacion.CveVentaRNCCargo).FirstOrDefault() @@ -24431,7 +24499,7 @@ Partial Class Ventas Dim PorcentajeAplicado = (RNCBonificacion.TotalRemNCAplicado / RNCBonificacion.Total) - Dim Cantidad As Decimal = RowCargo("Cantidad").ToString().ToDecimal() * PorcentajeAplicado + Dim Cantidad As Decimal = RowCargo("Cantidad").ToString().ToDecimal() '* PorcentajeAplicado Dim Obs = RowCargo("CodigoPS").ToString() @@ -24451,6 +24519,31 @@ Partial Class Ventas TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR) + 'SI EL IMPORTE ES MAYOR REALIZA EL AJUSTE + If TotalAcumuladoRNC > RNCBonificacion.TotalRemNCAplicado Then + Terminar = True + 'RESTA LO SUMANDO DEL ACUMULADO + TotalAcumuladoRNC -= (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR) + + Dim Diferencia As Decimal = RNCBonificacion.TotalRemNCAplicado - TotalAcumuladoRNC + + Dim TotalPartida As Decimal = (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR) + + Dim PorcentajePorAplicar As Decimal = (Diferencia / TotalPartida) + + Cantidad = Cantidad * PorcentajePorAplicar + + TotalCalculableImpuestos = (Cantidad * ImportePU) + ImporteIVA = (TotalCalculableImpuestos * RowCargo("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2) + ImporteIEPS = (TotalCalculableImpuestos * RowCargo("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2) + ImporteRetIVA = (TotalCalculableImpuestos * RowCargo("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2) + ImporteRetISR = (TotalCalculableImpuestos * RowCargo("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2) + + ImporteTotal = TotalCalculableImpuestos + + TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR) + End If + 'SI ES EL ULTIMO REGLON REALIZA UN AJUSTE If UltimoRenglonRNC = RNCCargo.DtDetalle.Rows.Count Then Dim Ajuste As Decimal = 0 @@ -24491,6 +24584,7 @@ Partial Class Ventas TmpDT = ObjVentas.DtResultados.Copy() TmpDT.Columns.Add("EntregaDirecta", GetType(Integer)) TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer)) + TmpDT.Columns.Add("CveVentaDetalleRNC", GetType(Integer)) End If If AplicaNCMasiva OrElse AplicaNCUsado Then @@ -27606,6 +27700,13 @@ Partial Class Ventas End If End If Next + + 'SI SON SOLO BONIFICACIONES GENERA LA NC PRINCIPAL EN BASE A ESAS + If RblRNCTipo.SelectedValue.ToString() = "2" AndAlso ListaRemisionesNC.Count = 0 Then + ListaRemisionesNC.AddRange(ListaNCBonificacion) + ListaNCBonificacion.Clear() + End If + End If TxtImportesRemisionesNC.Text = TotalRemNCAplicado.FormatoNumero @@ -28406,5 +28507,4 @@ Partial Class Ventas Public ImporteBonificacion As Decimal = 0 Public IVABonificacion As Decimal = 0 End Class - End Class \ No newline at end of file From 4f69db851d5ed4b9fc8be9b90335e53d3ac37ca2 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 2 Dec 2020 01:38:41 -0700 Subject: [PATCH 3/9] 141 --- Ashx/E141.ashx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Ashx/E141.ashx b/Ashx/E141.ashx index ee2b2f1e0..0d782b316 100644 --- a/Ashx/E141.ashx +++ b/Ashx/E141.ashx @@ -231,7 +231,7 @@ Public Class E141 : Implements IHttpHandler '} #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() As String - Return EnviarInformacion2("https://services.fidelityapps/api/services/products/import", GetProductosModificados()) + Return EnviarInformacion("https://services.fidelityapps.mx/api/services/products/import", GetProductosModificados()) End Function Private Function GetProductosModificados() As String @@ -295,7 +295,7 @@ Public Class E141 : Implements IHttpHandler #Region "A C T U A L I Z A R - P R E C I O S" Private Function ActualizarPrecios() As String - Return EnviarInformacion("https://services.fidelityapps/api/services/products/price-import", GetPreciosModificados()) + Return EnviarInformacion("https://services.fidelityapps.mx/api/services/products/price-import", GetPreciosModificados()) End Function Private Function GetPreciosModificados() As String @@ -332,7 +332,7 @@ Public Class E141 : Implements IHttpHandler #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("https://services.fidelityapps/api/services/products/stock", GetPSExistencias()) + Return EnviarInformacion("https://services.fidelityapps.mx/api/services/products/stock", GetPSExistencias()) End Function Private Function GetPSExistencias() As String @@ -370,7 +370,7 @@ Public Class E141 : Implements IHttpHandler #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() As String - Return EnviarInformacion("https://services.fidelityapps/api/v1/sellers/import", GetVendedores()) + Return EnviarInformacion("https://services.fidelityapps.mx/api/v1/sellers/import", GetVendedores()) End Function Private Function GetVendedores() As String From 7e7dbe28b84e96f48af0eb99d6702187e86fb4b8 Mon Sep 17 00:00:00 2001 From: JORGE LUIS CAUDILLO ESPARZA Date: Wed, 2 Dec 2020 13:41:41 -0700 Subject: [PATCH 4/9] --- App_Code/ClsClaseBase.vb | 93 ++++++++ Nomina/Aguinaldo.aspx | 97 +++++--- Nomina/Aguinaldo.aspx.cs | 479 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 635 insertions(+), 34 deletions(-) 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/Nomina/Aguinaldo.aspx b/Nomina/Aguinaldo.aspx index a4f20fae3..456282339 100644 --- a/Nomina/Aguinaldo.aspx +++ b/Nomina/Aguinaldo.aspx @@ -3,6 +3,26 @@ + @@ -51,7 +71,7 @@
-
+
@@ -59,35 +79,55 @@
- Total Aguinaldo + Total aguinaldo
-
+
-
+ +
Autorizado
-
+
-
+ +
Días ejercicio
+
+
+
+
+
+ +
+
+ UMA +
+
+
+
+
+
+
+ +
@@ -97,37 +137,31 @@ - + - + - + - + - + - + - + - + - + - + - - - - - - - + @@ -135,7 +169,13 @@ - + + + + + + + @@ -143,6 +183,7 @@ + <%-- @@ -174,7 +215,7 @@
diff --git a/Nomina/Aguinaldo.aspx.cs b/Nomina/Aguinaldo.aspx.cs index c0d0f5939..e1507fd52 100644 --- a/Nomina/Aguinaldo.aspx.cs +++ b/Nomina/Aguinaldo.aspx.cs @@ -1,7 +1,10 @@ using System; using System.Collections.Generic; +using System.Configuration; using System.Data; +using System.Data.SqlClient; using System.Linq; +using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; @@ -42,6 +45,7 @@ public partial class Nomina_Aguinaldo : ClsPaginas DdlTipoPeriodo.SelectedIndex = 0; } } + LtlUma.Text = "86.88"; } @@ -58,13 +62,14 @@ public partial class Nomina_Aguinaldo : ClsPaginas DTAguinaldos = objnom.DtResultados; GVCalcularAguinaldo.DataSource = DTAguinaldos; LtlTotal.Text = string.Format("{0:N2}", DTAguinaldos.SUM("Aguinaldo")); - LtlAutorizado.Text = string.Format("{0:N2}", DTAguinaldos.SUM("Aguinaldo","CveNomina>0")); - + LtlAutorizado.Text = string.Format("{0:N2}", DTAguinaldos.SUM("Aguinaldo", "CveNomina>0")); + LtldiasEjercicio.Text = string.Format("{0}/12/31", ejercicio).ToDate().DayOfYear.ToString(); } GVCalcularAguinaldo.DataBind(); LnkAutorizarModal.Visible = true; + BtnRecalcular_Click(sender, null); upDatosPA_N.Update(); } private void CargaPeriodos() @@ -149,7 +154,7 @@ public partial class Nomina_Aguinaldo : ClsPaginas { continuar = false; Alert("debe agregar un concepto para el calculo del aguinaldo", ModExtensiones.TipoMensaje.ToastAdventencia); - } + } } if (continuar) { @@ -169,9 +174,9 @@ public partial class Nomina_Aguinaldo : ClsPaginas ImporteGravado = row["AguinaldoGravado"].ToString().ToDecimal(); ImporteExento = Importe - ImporteGravado; ImporteValor = row["DiasLaborados"].ToString().ToDecimal(); - - if (CvePersonal > 0 && Importe>0 && row["CveNomina"].ToString().ToEntero()==0) + + if (CvePersonal > 0 && Importe > 0 && row["CveNomina"].ToString().ToEntero() == 0) { if (objNomina.GetNom_Nominas(-1, CvePersonal, CvePeriodoSeleccionado, -1, UsuarioActual.CveEmpresa)) { @@ -261,4 +266,466 @@ public partial class Nomina_Aguinaldo : ClsPaginas } } } -} \ No newline at end of file + + protected void BtnRecalcular_Click(object sender, EventArgs e) + { + decimal uma = 86.88m; + decimal aguiexentogral = uma * 30; + decimal salariodiario = 0; + decimal diasanio = 366; + decimal diaslaborados = 0; + decimal diasaguinaldo = 0; + decimal diasaguipago = 0; + decimal salariomensual = 0; + decimal aguinaldo = 0; + decimal aguinaldoexcento = 0; + decimal aguinaldogravado = 0; + decimal diasmes = 30.5m; + decimal FraccionI = 0; + decimal FraccionII_1 = 0; + decimal FraccionII_2 = 0; + decimal FraccionIII_1 = 0; + decimal FraccionIII_2 = 0; + decimal FraccionV = 0; + decimal FraccionIV = 0; + + decimal Aguinaldoapagar = 0; + decimal AguinaldoapagarTotal = 0; + StringBuilder str = new StringBuilder(); + using (ClsClaseBaseD objbase = new ClsClaseBaseD()) + { + + foreach (GridViewRow gvrow in GVCalcularAguinaldo.Rows) + { + salariodiario = gvrow.FCTextBox("TxtsueldoDiario").Text.ToDecimal(); + diaslaborados = gvrow.FCTextBox("TxtdiasLaborados").Text.ToDecimal(); + diasaguinaldo = gvrow.FCTextBox("TxtdiasAguinaldo").Text.ToDecimal(); + if (salariodiario > 0) + { + + diasaguipago = (diaslaborados / diasanio) * diasaguinaldo; + salariomensual = salariodiario * 30; + aguinaldo = diasaguipago * salariodiario; + aguinaldoexcento = (aguiexentogral > aguinaldo ? aguinaldo : aguiexentogral); + aguinaldogravado = aguinaldo - aguinaldoexcento; + if (aguinaldogravado > 0) { + FraccionI = (aguinaldogravado / diasanio) * diasmes; + FraccionII_1 = salariomensual + FraccionI; + str.Clear(); + str.AppendFormat("SELECT dbo.Fnc_NomValues(40, 0, 00, -1, {0}, {1}, {1}) isrFraccionII_2,", FraccionII_1, diasmes); + str.AppendFormat(" dbo.Fnc_NomValues(40, 0, 00, -1, {0}, {1}, {1}) isrFraccionIII_1", salariomensual, diasmes); + if (objbase.runQuerystr(str.ToString())) + { + DataRow drow = objbase.DtResultados.Rows[0]; + FraccionII_2 = drow["isrFraccionII_2"].ToString().ToDecimal(); + FraccionIII_1 = drow["isrFraccionIII_1"].ToString().ToDecimal(); + } + else { break; } + + FraccionIII_2 = FraccionII_2 - FraccionIII_1; + FraccionV = FraccionIII_2 / FraccionI; + FraccionIV = aguinaldogravado * FraccionV; + Aguinaldoapagar = aguinaldo - FraccionIV; + } + else + { + + FraccionIV = 0; + Aguinaldoapagar = aguinaldo - FraccionIV; + } + } + else + { + aguinaldo = 0; + Aguinaldoapagar = 0; + aguinaldogravado = 0; + FraccionIV = 0; + } + AguinaldoapagarTotal += Aguinaldoapagar; + gvrow.FCLabel("lblsueldoAguinaldoCompleto").Text = string.Format("${0:N2}", aguinaldo); + gvrow.FCLabel("lblAguinaldo").Text = string.Format("${0:N2}", Aguinaldoapagar); + gvrow.FCLabel("lblAguinaldoGravado").Text = string.Format("${0:N2}", aguinaldogravado); + gvrow.FCLabel("lblISRAguinaldo").Text = string.Format("${0:N2}", FraccionIV); + } + + } + LtlTotal.Text =string.Format("${0:N2}", AguinaldoapagarTotal); + + /* + * + * + + lblAguinaldo + lblAguinaldoGravado + lblISRAguinaldo + + salario diario +dias año +Dias laborados +dias Aguinaldo +dias aguinaldo(PAGO) +UMA +Salario mensual +Aguinaldo +Aguinaldo excento +Aguinaldo gravado + +dias mes +FraccionI +FraccionII +FraccionII +FraccionIII +FraccionIII +FraccionV +FraccionIV + +Aguinaldoapagar + + + + + * + */ + } +} + + class ClsClaseBaseD : IDisposable +{ + protected SqlConnection SqlConexion; + protected SqlDataAdapter SqlAdapter; + protected DataTable datos; + protected DataSet DTSet; + public DataTable DtResultados + { + get + { + return datos; + } + } + public DataSet DTSetResultados + { + get + { + return DTSet; + } + } + protected bool disposedValue = false; + protected bool EsTransaccion = false; + public string MyCurrentError; + // REGISTRAR CONEXIÓN + private int CveConexion = 0; + + public ClsClaseBaseD(ClsClaseBaseD adsObj = null) + { + if (adsObj != null && adsObj.SqlAdapter != null && adsObj.SqlAdapter.SelectCommand != null && adsObj.SqlAdapter.SelectCommand.Transaction != null) + { + SqlConexion = adsObj.SqlConexion; + SqlAdapter = adsObj.SqlAdapter; + EsTransaccion = true; + } + else + { + SqlConexion = new SqlConnection(); + SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString; + try + { + SqlConexion.Open(); + SqlAdapter = new SqlDataAdapter("", SqlConexion); + ConexionAdd(); + } + catch (Exception ex) + { + this.OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex); + } + } + } + + public void SqlDataAdapter(string StrSQL, CommandType TipoComando = CommandType.StoredProcedure) + { + if (SqlConexion.State == ConnectionState.Open) + { + SqlAdapter.SelectCommand.Parameters.Clear(); + SqlAdapter.SelectCommand.CommandText = StrSQL; + SqlAdapter.SelectCommand.CommandType = TipoComando; + datos = new DataTable(); + DTSet = new DataSet(); + } + } + protected void DataAdapter(string StrSQL, CommandType TipoComando = CommandType.Text) + { + + // if (SqlAdapter.SelectCommand == null) + // { + // if ((sqlCommand != null)) + // { + // SqlAdapter.SelectCommand = sqlCommand; + // } + // else + // { + // SqlAdapter.SelectCommand = new SqlCommand(); + // } + // SqlAdapter.SelectCommand.Connection = SqlConexion; + // } + + if (SqlConexion.State == ConnectionState.Open) + { + SqlAdapter.SelectCommand.Parameters.Clear(); + SqlAdapter.SelectCommand.CommandText = StrSQL; + SqlAdapter.SelectCommand.CommandType = TipoComando; + datos = new DataTable(); + DTSet = new DataSet(); + } + } + + private void ConexionAdd() + { + if (ConfigurationManager.AppSettings["RegistraConexion"] != null && ConfigurationManager.AppSettings["RegistraConexion"].ToString() == "1") + { + try + { + SqlDataAdapter("PA_Sis_RegistrarConexion"); + { + var withBlock = SqlAdapter.SelectCommand.Parameters; + withBlock.Add("@Clase", SqlDbType.VarChar).Value = this.GetType().Name; + withBlock.Add("@Modulo", SqlDbType.VarChar).Value = string.Format("{0}?{1}", HttpContext.Current.Request.Url.AbsolutePath.ToString(), HttpContext.Current.Request.QueryString.ToString()); + withBlock.Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output; + } + SqlAdapter.Fill(datos); + CveConexion = SqlAdapter.SelectCommand.Parameters["@IDConexion"].Value.ToString().ToEntero(); + } + catch (Exception ex) + { + this.OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()); + } + } + } + + private void ConexionClose() + { + if (CveConexion > 0 && ConfigurationManager.AppSettings["RegistraConexion"] != null && ConfigurationManager.AppSettings["RegistraConexion"].ToString() == "1") + { + SqlDataAdapter(string.Format("UPDATE Sis_Conexiones SET FechaCierre = GETDATE() WHERE CveConexion = {0}", CveConexion), CommandType.Text); + + try + { + SqlAdapter.Fill(datos); + } + catch (Exception ex) + { + this.OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()); + } + CveConexion = 0; + } + } + protected void addParameters(string name, SqlDbType tipo, object valor) + { + if (SqlConexion.State == ConnectionState.Open) + SqlAdapter.SelectCommand.Parameters.Add(name, tipo).Value = valor; + } + + public bool runQuerystr(string Query, List Listaparametros = null, string msgError = "", bool mostrarError = true) + { + bool retorno = false; + try + { + if (SqlConexion.State == ConnectionState.Open) + { + SqlAdapter.SelectCommand.Parameters.Clear(); + SqlAdapter.SelectCommand.CommandText = Query; + SqlAdapter.SelectCommand.CommandType = CommandType.Text; + datos = new DataTable(); + if (Listaparametros!= null) + { + foreach (parametroQuery pr in Listaparametros) + { + if (pr.SqlDataType != null) + { + if (pr.ParameterDirection != null) + SqlAdapter.SelectCommand.Parameters.Add(pr.ParameterName, pr.SqlDataType).Direction = pr.ParameterDirection; + else + SqlAdapter.SelectCommand.Parameters.Add(pr.ParameterName, pr.SqlDataType).Value = pr.SqlValue != null ? pr.SqlValue : DBNull.Value; + } + else + SqlAdapter.SelectCommand.Parameters.AddWithValue(pr.ParameterName, pr.SqlValue); + } + } + + SqlAdapter.Fill(datos); + retorno = true; + } + else + { + string InfoAdicional = "Se intenta realizar una conexion con una conexion cerrada"; + InfoAdicional = $"{InfoAdicional}{Environment.NewLine}{msgError}{Environment.NewLine}"; + ModExtensiones.GuardaLog(InfoAdicional); + } + } + catch (SqlException sqEx) + { + retorno = false; + setOnError(msgError, sqEx); + } + catch (Exception ex) + { + retorno = false; + setOnError(msgError, ex); + } + return retorno; + } + public int ExecQuery(string Query, List Listaparametros = null, string msgError = "", bool mostrarError = true) + { + int retorno = -1; + try + { + if (SqlConexion.State == ConnectionState.Open) + { + SqlAdapter.SelectCommand.Parameters.Clear(); + SqlAdapter.SelectCommand.CommandText = Query; + SqlAdapter.SelectCommand.CommandType = CommandType.Text; + if (Listaparametros!= null) + { + foreach (parametroQuery pr in Listaparametros) + { + if ( pr.SqlDataType != null) + { + if ( pr.ParameterDirection != null) + SqlAdapter.SelectCommand.Parameters.Add(pr.ParameterName, pr.SqlDataType).Direction = pr.ParameterDirection; + else + SqlAdapter.SelectCommand.Parameters.Add(pr.ParameterName, pr.SqlDataType).Value = pr.SqlValue != null ? pr.SqlValue : DBNull.Value; + } + else + SqlAdapter.SelectCommand.Parameters.AddWithValue(pr.ParameterName, pr.SqlValue); + } + } + + retorno = SqlAdapter.SelectCommand.ExecuteNonQuery(); + } + else + { + string InfoAdicional = "Se intenta realizar una conexion con una conexion cerrada"; + InfoAdicional = $"{InfoAdicional}{Environment.NewLine}{msgError}{Environment.NewLine}"; + this.GuardaLog(InfoAdicional); + } + } + catch (SqlException sqEx) + { + retorno = -1; + setOnError(msgError, sqEx); + } + catch (Exception ex) + { + retorno = -1; + setOnError(msgError, ex); + } + return retorno; + } + + + protected bool RunQuery(string msgOnError) + { + bool retorno = false; + + try + { + SqlAdapter.Fill(datos); + retorno = true; + } + catch (Exception ex) + { + retorno = false; + + setOnError(msgOnError, ex); + } + return retorno; + } + protected bool RunQueryDS(string msgOnError) + { + bool retorno = false; + + try + { + SqlAdapter.Fill(DTSet); + retorno = true; + } + catch (Exception ex) + { + retorno = false; + + setOnError(msgOnError, ex); + } + return retorno; + } + public void setOnError(string Mensaje, Exception Exeption) + { + string InfoAdicional = ""; + if (SqlAdapter != null && SqlAdapter.SelectCommand != null && SqlAdapter.SelectCommand.Parameters != null) + InfoAdicional = SqlAdapter.SelectCommand.Parameters.ParametrosInfo(); + MyCurrentError = string.Format("{0} DESCRIPCIÓN DETALLADA: {1} {2} {3}", Mensaje, Exeption.ToString(), "\r\n", InfoAdicional); + this.OnError(Mensaje, Exeption, InfoAdicional); + } + public void IniciaTransacSQL() + { + SqlAdapter.SelectCommand.Transaction = SqlConexion.BeginTransaction(); + EsTransaccion = true; + } + + public void Commit() + { + SqlAdapter.SelectCommand.Transaction.Commit(); + SqlConexion.Close(); + } + + public void RollBack() + { + SqlAdapter.SelectCommand.Transaction.Rollback(); + SqlConexion.Close(); + } + public void Dispose() + { + ConexionClose(); + if ((SqlConexion != null)) + { + if (SqlConexion.State == ConnectionState.Open) + { + try + { + if ((SqlAdapter != null)) + SqlAdapter.Dispose(); + + SqlConexion.Close(); + } + catch (Exception ex) + { + this.OnError("Ocurrió un error al intentar cerrar la base de datos.", ex); + } + } + SqlConexion.Dispose(); + } + + if (datos != null) + datos.Dispose(); + if (SqlAdapter != null) + SqlAdapter.Dispose(); + + if (DTSet != null) + DTSet.Dispose(); + + GC.SuppressFinalize(this); + } +} + +public class parametroQuery +{ + public parametroQuery(string parameterName, object sqlValue, SqlDbType sqlDataType = default(SqlDbType), ParameterDirection parameterDirection = default(ParameterDirection)) + { + this.ParameterName = parameterName; + this.SqlDataType = sqlDataType; + this.ParameterDirection = parameterDirection; + this.SqlValue = sqlValue; + } + + public string ParameterName { get; set; } + public SqlDbType SqlDataType { get; set; } + public ParameterDirection ParameterDirection { get; set; } + public object SqlValue { get; set; } +} From f69da7bd8c3ca5e61c90faf3a73f124f6faa96d4 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Wed, 2 Dec 2020 21:14:48 -0700 Subject: [PATCH 5/9] nuevos filtros al reporte de solicitudes anticipo y en ventas al se puede cancenlar una factura de tipo docto pedi2 --- App_Code/ClsOC.vb | 4 +++- OC/RepSolicitudesAnticipo.aspx | 15 ++++++++++++++- OC/RepSolicitudesAnticipo.aspx.cs | 15 ++++++++++++++- Ventas/Ventas.aspx.vb | 12 ++++++++++-- 4 files changed, 41 insertions(+), 5 deletions(-) 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/OC/RepSolicitudesAnticipo.aspx b/OC/RepSolicitudesAnticipo.aspx index 4c03a5549..14e80d0fe 100644 --- a/OC/RepSolicitudesAnticipo.aspx +++ b/OC/RepSolicitudesAnticipo.aspx @@ -30,7 +30,7 @@
- <%----%> +
@@ -81,6 +81,19 @@
diff --git a/OC/RepSolicitudesAnticipo.aspx.cs b/OC/RepSolicitudesAnticipo.aspx.cs index ae72827e5..67228491a 100644 --- a/OC/RepSolicitudesAnticipo.aspx.cs +++ b/OC/RepSolicitudesAnticipo.aspx.cs @@ -73,10 +73,23 @@ public partial class OC_RepSolicitudesAnticipo : ClsPaginas txtFechaI.Text = DateTime.Now.AddMonths(-1).FirstDayOfMonth().ToShortDateString(); txtFechaF.Text = DateTime.Now.ToShortDateString(); CveProveedor = -1; + CargaSubProyectos(); CargaProveedor(); + CargaUsuarios(); CargaDatos(); } + private void CargaSubProyectos() + { + CargarCentrosDeCosto(null,DdlSubProyecto,null,lblSubProyecto); + } + + private void CargaUsuarios() + { + DdlUsuarios.DataSource = get_GlobalDTUsuarios(CveEmpresa:UsuarioActual.CveEmpresa); + DdlUsuarios.DataBind(); + } + protected void CargaProveedor() { DdlProveedores.setEsWebService(true); @@ -93,7 +106,7 @@ public partial class OC_RepSolicitudesAnticipo : ClsPaginas FechaI = (txtFechaI.Text.ToString() != "" ? txtFechaI.Text.ToDateTime() : MinFecha); FechaF = (txtFechaF.Text.ToString() != "" ? txtFechaF.Text.ToDateTime() : DateTime.Now); - if (ObjOC.GetRepSolicitudAnticipos(UsuarioActual.CveEmpresa, CveProveedor, FechaI, FechaF, DdlEstatus.SelectedValue.ToEntero())) + if (ObjOC.GetRepSolicitudAnticipos(UsuarioActual.CveEmpresa, CveProveedor, FechaI, FechaF, DdlEstatus.SelectedValue.ToEntero(),DdlUsuarios.SelectedValue.ToEntero(),DdlSubProyecto.SelectedValue.ToEntero())) { DtDatos = ObjOC.DtResultados; GvSolicitudes.DataSource = DtDatos; diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 2a8583eed..bc64ed41d 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -3926,7 +3926,7 @@ Partial Class Ventas LblAlertRefacInv.Visible = True End If - If DdlTipoComprobante.SelectedValue.Contiene("Egs", "Ing", "Ant", "Dev", "Rem", "DPe", "RNC") AndAlso Not CveEstatus.Contiene(4, 5, 12, 13, 20) Then + If DdlTipoComprobante.SelectedValue.Contiene("Egs", "Ing", "Ant", "Dev", "Rem", "DPe", "RNC", "Pd2") AndAlso Not CveEstatus.Contiene(4, 5, 12, 13, 20) Then If UsuarioActual.TienePermisoProceso(159) Then Dim TienePermiso As String = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, -1).FiltroPrimeroValor("CveSubProyecto", String.Format("CveSubProyecto = {0}", DbRowVenta("CveSubProyecto"))) If TienePermiso <> "" Then @@ -20880,8 +20880,16 @@ Partial Class Ventas RegistraScript("$('#ModalCancelarDocumento').modal();") UpCancelarDocumento.Update() sb.Clear() + ElseIf DdlTipoComprobante.SelectedValue.Contiene("Pd2") Then + Dim ObjVentas As New ClsVentas + If ObjVentas.UpdateEstatusVenta(CveVenta, 22, UsuarioActual.CveEmpresa) Then + Dim redirectString As String = String.Format("document.location.href=""/Ventas/Ventas.aspx?CveVenta={0}""", CveVenta) + Alert("Pedido cancelado.", JSBtnAceptar:=redirectString) + ', "document.location.href=""/Ventas/Ventas.aspx?CveVenta=" & CveVenta + End If + ObjVentas.Dispose() Else - CancelarDocumento() + CancelarDocumento() End If End Sub From b010ff29660fe02e7705213288557b49151ccd1c Mon Sep 17 00:00:00 2001 From: Raul Pimienta Date: Wed, 2 Dec 2020 23:19:24 -0700 Subject: [PATCH 6/9] Cambios en el reporte de comisiones JAM --- Ventas/RepComisionesJAM.aspx | 2 +- Ventas/RepComisionesJAM.aspx.cs | 48 +++++++++++++++------------------ 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/Ventas/RepComisionesJAM.aspx b/Ventas/RepComisionesJAM.aspx index 8fac2b313..cf06867b3 100644 --- a/Ventas/RepComisionesJAM.aspx +++ b/Ventas/RepComisionesJAM.aspx @@ -102,7 +102,7 @@ diff --git a/Ventas/RepComisionesJAM.aspx.cs b/Ventas/RepComisionesJAM.aspx.cs index 1dfcf5071..721d3f7cf 100644 --- a/Ventas/RepComisionesJAM.aspx.cs +++ b/Ventas/RepComisionesJAM.aspx.cs @@ -113,28 +113,24 @@ public partial class Ventas_RepComisionesJAM : ClsPaginas if (e.Row.DBCampo("Transaccion").ToString() == "Pago" && ChkEsquemaNuevo.Checked) { e.Row.FCLinkButton("LnkInfo").Visible = true; - //if (e.Row.DBCampo("CveCategoria").ToEntero() < 1 && e.Row.DBCampo("Comision").ToDouble() == 0) - //{ - // //if (UsuarioActual.TienePermisoProceso(201)) - // //{ - // // e.Row.Cells[21].ToolTip = "No se encuentra dentro de alguna categoria que de comision ni a alguno de los productos especiales."; - // // e.Row.Cells[22].ToolTip = "No se encuentra dentro de alguna categoria que de comision ni a alguno de los productos especiales."; - // //} - // //else - // //{ - // e.Row.Cells[21].ToolTip = "No se encuentra dentro de alguna categoria que de comision ni a alguno de los productos especiales."; - // e.Row.Cells[22].ToolTip = "No se encuentra dentro de alguna categoria que de comision ni a alguno de los productos especiales."; - // //} - //}else if (e.Row.DBCampo("CveCategoria").ToEntero() > 0 ) - //{ - // e.Row.Cells[21].ToolTip = $"El producto obtuvo la comision porque se encuentra en la categoria: {get_GlobalDTGralCategorias(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Categoria",$"CveCategoria = {e.Row.DBCampo("CveCategoria").ToString()}")}."; - // e.Row.Cells[22].ToolTip = $"El producto obtuvo la comision porque se encuentra en la categoria: {get_GlobalDTGralCategorias(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Categoria", $"CveCategoria = {e.Row.DBCampo("CveCategoria").ToString()}")}."; - //}else if(e.Row.DBCampo("Comision").ToDouble() > 0) - //{ - // e.Row.Cells[21].ToolTip = "El producto obtuvo comision porque esta dentro de los de las comisiones especiales."; - // e.Row.Cells[22].ToolTip = "El producto obtuvo comision porque esta dentro de los de las comisiones especiales."; - //} - }else + if (!Convert.ToBoolean(e.Row.DataKey("TieneCategoriaValida")) && e.Row.DataKey("Comision").ToDouble() == 0) + { + e.Row.FCLinkButton("LnkInfo").ToolTip = $"No se encuentra dentro de alguna categoria que de comision ni alguno de los productos especiales. La categoria del producto es: {get_GlobalDTGralCategorias(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Categoria", $"CveCategoria = { e.Row.DataKey("CveCategoria").ToString()}")}. % Precio Publico: {e.Row.DataKey("PorcentajePrecioPublico").ToString()}. Dias Pago: {e.Row.DataKey("DiasPago").ToString()}."; + } + else if (Convert.ToBoolean(e.Row.DataKey("TieneCategoriaValida")) && e.Row.DataKey("Comision").ToDouble() > 0) + { + e.Row.FCLinkButton("LnkInfo").ToolTip = $"El producto obtuvo la comision porque se encuentra en la categoria: {get_GlobalDTGralCategorias(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Categoria", $"CveCategoria = {e.Row.DataKey("CveCategoria").ToString()}")} y esta dentro de los rangos de precio publico y dias validos. % Precio Publico: {e.Row.DataKey("PorcentajePrecioPublico").ToString()}. Dias Pago: {e.Row.DataKey("DiasPago").ToString()}."; + } + else if (Convert.ToBoolean(e.Row.DataKey("TieneCategoriaValida")) && e.Row.DataKey("Comision").ToDouble() == 0) + { + e.Row.FCLinkButton("LnkInfo").ToolTip = $"El producto se encuentra en la categoria: {get_GlobalDTGralCategorias(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Categoria", $"CveCategoria = {e.Row.DataKey("CveCategoria").ToString()}")} que da comision, pero no se encuentra dentro de los rangos de precio publico y dias validos. % Precio Publico: {e.Row.DataKey("PorcentajePrecioPublico").ToString()}. Dias Pago: {e.Row.DataKey("DiasPago").ToString()}."; + } + else if (e.Row.DataKey("Comision").ToDouble() > 0) + { + e.Row.FCLinkButton("LnkInfo").ToolTip = $"El producto obtuvo comision porque esta dentro de los de las comisiones especiales. La categoria del producto es: {get_GlobalDTGralCategorias(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Categoria", $"CveCategoria = { e.Row.DataKey("CveCategoria").ToString()}")}. El producto es: {e.Row.DataKey("CodigoPS").ToString()}. % Precio Publico: {e.Row.DataKey("PorcentajePrecioPublico").ToString()}. Dias Pago: {e.Row.DataKey("DiasPago").ToString()}."; + } + } + else { e.Row.FCLinkButton("LnkInfo").Visible = false; } @@ -357,19 +353,19 @@ public partial class Ventas_RepComisionesJAM : ClsPaginas if (!Convert.ToBoolean(gvRow.DataKey("TieneCategoriaValida")) && gvRow.DataKey("Comision").ToDouble() == 0) { - LblInfo.Text = $"No se encuentra dentro de alguna categoria que de comision ni alguno de los productos especiales.
La categoria del producto es: {get_GlobalDTGralCategorias(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Categoria", $"CveCategoria = { gvRow.DataKey("CveCategoria").ToString()}")}. "; + LblInfo.Text = $"No se encuentra dentro de alguna categoria que de comision ni alguno de los productos especiales.
La categoria del producto es: {get_GlobalDTGralCategorias(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Categoria", $"CveCategoria = { gvRow.DataKey("CveCategoria").ToString()}")}.
% Precio Publico: {gvRow.DataKey("PorcentajePrecioPublico").ToString()}
Dias Pago: {gvRow.DataKey("DiasPago").ToString()}"; } else if (Convert.ToBoolean(gvRow.DataKey("TieneCategoriaValida")) && gvRow.DataKey("Comision").ToDouble() > 0) { - LblInfo.Text = $"El producto obtuvo la comision porque se encuentra en la categoria: {get_GlobalDTGralCategorias(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Categoria", $"CveCategoria = {gvRow.DataKey("CveCategoria").ToString()}")} y esta dentro de los rangos de precio publico y dias validos. "; + LblInfo.Text = $"El producto obtuvo la comision porque se encuentra en la categoria: {get_GlobalDTGralCategorias(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Categoria", $"CveCategoria = {gvRow.DataKey("CveCategoria").ToString()}")} y esta dentro de los rangos de precio publico y dias validos.
% Precio Publico: {gvRow.DataKey("PorcentajePrecioPublico").ToString()}
Dias Pago: {gvRow.DataKey("DiasPago").ToString()}"; } else if (Convert.ToBoolean(gvRow.DataKey("TieneCategoriaValida")) && gvRow.DataKey("Comision").ToDouble() == 0) { - LblInfo.Text = $"El producto se encuentra en la categoria: {get_GlobalDTGralCategorias(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Categoria", $"CveCategoria = {gvRow.DataKey("CveCategoria").ToString()}")} que da comision, pero no se encuentra dentro de los rangos de precio publico y dias validos."; + LblInfo.Text = $"El producto se encuentra en la categoria: {get_GlobalDTGralCategorias(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Categoria", $"CveCategoria = {gvRow.DataKey("CveCategoria").ToString()}")} que da comision, pero no se encuentra dentro de los rangos de precio publico y dias validos.
% Precio Publico: {gvRow.DataKey("PorcentajePrecioPublico").ToString()}
Dias Pago: {gvRow.DataKey("DiasPago").ToString()}"; } else if (gvRow.DataKey("Comision").ToDouble() > 0) { - LblInfo.Text = $"El producto obtuvo comision porque esta dentro de los de las comisiones especiales.
La categoria del producto es: {get_GlobalDTGralCategorias(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Categoria", $"CveCategoria = { gvRow.DataKey("CveCategoria").ToString()}")}.
El producto es: {gvRow.DataKey("CodigoPS").ToString()}. "; + LblInfo.Text = $"El producto obtuvo comision porque esta dentro de los de las comisiones especiales.
La categoria del producto es: {get_GlobalDTGralCategorias(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Categoria", $"CveCategoria = { gvRow.DataKey("CveCategoria").ToString()}")}.
El producto es: {gvRow.DataKey("CodigoPS").ToString()}.
% Precio Publico: {gvRow.DataKey("PorcentajePrecioPublico").ToString()}
Dias Pago: {gvRow.DataKey("DiasPago").ToString()}"; } this.RegistraScript("$('#DModalInfo').modal();"); UpModalInformacion.Update(); From 7d655d3e135871ca872eac2650564c03d7939503 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Thu, 3 Dec 2020 11:08:07 -0700 Subject: [PATCH 7/9] Cambios API Econo --- App_Code/ClsProductosServicios.vb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/App_Code/ClsProductosServicios.vb b/App_Code/ClsProductosServicios.vb index d77dbbe60..1a939af3d 100644 --- a/App_Code/ClsProductosServicios.vb +++ b/App_Code/ClsProductosServicios.vb @@ -2137,12 +2137,13 @@ Public Class ClsProductosServicios Return Retorno End Function - Public Function GetProductosModificados(CveEmpresa As Integer, CvePrecioLista As Integer) As Boolean + 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) @@ -2153,12 +2154,13 @@ Public Class ClsProductosServicios Return Retorno End Function - Public Function GetPreciosModificados(CveEmpresa As Integer, CvePrecioLista As Integer) As Boolean + 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) @@ -2187,11 +2189,12 @@ Public Class ClsProductosServicios Return Retorno End Function - Public Function GetVendedoresModificados(CveEmpresa As Integer) As Boolean + 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) From b89799d7776c91789a7f5879f150c5ef1d9aa382 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Thu, 3 Dec 2020 11:09:36 -0700 Subject: [PATCH 8/9] Concepto de NC E140 --- Ashx/E141.ashx | 125 +++++++++++++++++++++--------------------- Ventas/Ventas.aspx | 2 +- Ventas/Ventas.aspx.vb | 40 +++++++++----- 3 files changed, 91 insertions(+), 76 deletions(-) diff --git a/Ashx/E141.ashx b/Ashx/E141.ashx index 0d782b316..dd8ea7fcf 100644 --- a/Ashx/E141.ashx +++ b/Ashx/E141.ashx @@ -47,6 +47,25 @@ Public Class E141 : Implements IHttpHandler 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" @@ -66,20 +85,22 @@ Public Class E141 : Implements IHttpHandler 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() + retorno = CrearActualizarProductos(If(FiltrarTodos = "1", True, False)) End If If Metodo = "ActualizarPrecios" Then - retorno = ActualizarPrecios() + retorno = ActualizarPrecios(If(FiltrarTodos = "1", True, False)) End If If Metodo = "ActualizarExistencias" Then - retorno = ActualizarExistencias() + retorno = ActualizarExistencias(If(FiltrarTodos = "1", True, False)) End If If Metodo = "ActualizarVendedores" Then - retorno = ActualizarVendedores() + retorno = ActualizarVendedores(If(FiltrarTodos = "1", True, False)) End If If Metodo = "GetExistencia" Then @@ -162,7 +183,7 @@ Public Class E141 : Implements IHttpHandler Try Using httpClient = New HttpClient() Using request = New HttpRequestMessage(HttpMethod.Post, New Uri(url)) - request.Headers.Add("token", "$2y$10$LGqtRWUloKQmAt.jcUldc.PmS5LJ6l.WU2w1G4PBOTLMVKZRNQFPS") + request.Headers.Add("token", TokenAutorizacion) Using content = New StringContent(payload, Encoding.UTF8, "application/json") request.Content = content @@ -184,63 +205,45 @@ Public Class E141 : Implements IHttpHandler 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", "$2y$10$LGqtRWUloKQmAt.jcUldc.PmS5LJ6l.WU2w1G4PBOTLMVKZRNQFPS") + '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 + ' 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 - - ' var httpWebRequest = (httpWebRequest)WebRequest.Create("http://url"); - 'httpWebRequest.ContentType = "application/json"; - 'httpWebRequest.Method = "POST"; - - 'Using (var streamWriter = New StreamWriter(httpWebRequest.GetRequestStream())) - '{ - ' String json = "{\"user\":\"test\"," + - ' "\"password\":\"bla\"}"; - - ' streamWriter.Write(json); - '} - - 'var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse(); - 'Using (var streamReader = New StreamReader(httpResponse.GetResponseStream())) - '{ - ' var result = StreamReader.ReadToEnd(); - '} + ' 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() As String - Return EnviarInformacion("https://services.fidelityapps.mx/api/services/products/import", GetProductosModificados()) + Private Function CrearActualizarProductos(Todos As Boolean) As String + Return EnviarInformacion($"{Me.URLBase}api/services/products/import", GetProductosModificados(Todos)) End Function - Private Function GetProductosModificados() As String + 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) Then + If ObjPS.GetProductosModificados(CveEmpresa, 44, If(Todos, -1, 1)) Then DtPS = ObjPS.DtResultados.Copy() End If End Using @@ -294,17 +297,17 @@ Public Class E141 : Implements IHttpHandler #Region "A C T U A L I Z A R - P R E C I O S" - Private Function ActualizarPrecios() As String - Return EnviarInformacion("https://services.fidelityapps.mx/api/services/products/price-import", GetPreciosModificados()) + Private Function ActualizarPrecios(Todos As Boolean) As String + Return EnviarInformacion($"{Me.URLBase}api/services/products/price-import", GetPreciosModificados(Todos)) End Function - Private Function GetPreciosModificados() As String + 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) Then + If ObjPS.GetPreciosModificados(CveEmpresa, 44, If(Todos, -1, 1)) Then DtPS = ObjPS.DtResultados.Copy() End If End Using @@ -332,7 +335,7 @@ Public Class E141 : Implements IHttpHandler #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("https://services.fidelityapps.mx/api/services/products/stock", GetPSExistencias()) + Return EnviarInformacion($"{Me.URLBase}api/services/products/stock", GetPSExistencias()) End Function Private Function GetPSExistencias() As String @@ -369,17 +372,17 @@ Public Class E141 : Implements IHttpHandler #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() As String - Return EnviarInformacion("https://services.fidelityapps.mx/api/v1/sellers/import", GetVendedores()) + Private Function ActualizarVendedores(Todos As Boolean) As String + Return EnviarInformacion($"{Me.URLBase}api/v1/sellers/import", GetVendedores(Todos)) End Function - Private Function GetVendedores() As String + 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) Then + If ObjPS.GetVendedoresModificados(CveEmpresa, If(Todos, -1, 1)) Then DtVendedores = ObjPS.DtResultados.Copy() End If End Using diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 7482a17fe..d4a7c2227 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -6314,7 +6314,7 @@ - + diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 18be4a942..21188219c 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -14778,7 +14778,7 @@ Partial Class Ventas TmpDT = ObjVentas.DtResultados TmpDT.Columns.Add("CveVentaDetalleRNC", GetType(Integer)) End If - ErrorCancelar = ProcesoPrepolizaBtnAplicaNuevaNC_Clicks(ObjConta, ObjFacturaDevolucion, -1, TmpDT, ObjAC, -1, ObjBancos, ObjVentas) + ErrorCancelar = ProcesoPrepolizas(ObjConta, ObjFacturaDevolucion, -1, TmpDT, ObjAC, -1, ObjBancos, ObjVentas) Else ErrorCancelar = ProcesoPrepolizas(ObjConta, ObjFacturaDevolucion, -1, TmpDT, ObjAC, -1, ObjBancos, ObjVentas) End If @@ -27569,6 +27569,18 @@ Partial Class Ventas Dim TotalRemNCAplicado As Decimal = 0 + Dim ArrayNC As String() = UsuarioActual.Empresa.Funcionalidad(591).Split(",".ToCharArray()) + Dim NCConcepto As Integer = -1 + + Select Case RblRNCTipo.SelectedValue + Case "1" 'CARGOS + NCConcepto = ArrayNC(3).ToEntero() + Case "2" 'BONIFICACIONES + NCConcepto = ArrayNC(4).ToEntero() + Case "3" 'AJUSTE/GARANTIAS + NCConcepto = ArrayNC(1).ToEntero() + End Select + If ChkMostarProductosRNC.Checked Then Me.AplicaRNCXDetalle = True @@ -27651,24 +27663,18 @@ Partial Class Ventas For Each RNC In ListaRemisionesNC.Where(Function(x) x.Num2 = 1) Dim Salir As Boolean = False - Dim ArrayNC As String() = UsuarioActual.Empresa.Funcionalidad(591).Split(",".ToCharArray()) - Dim NCAjuste As Integer = -1 - Dim NCGarantiaTotal As Integer = -1 - If ArrayNC.Length > 2 Then - NCAjuste = ArrayNC(1).ToEntero() - NCGarantiaTotal = ArrayNC(2).ToEntero() - End If - Using ObjAcum As New ClsAcumuladores If ObjAcum.GetGarantiasDetalle(RNC.CveVenta) Then 'SI ES GARANTIA TOTAL If ObjAcum.DtResultados.MAX("PorcentajeAjuste") = "1" Then - DdlNCPS.SelectedValueExist(NCGarantiaTotal) - DdlNCPS.Enabled = False + If ArrayNC.Length > 2 Then + NCConcepto = ArrayNC(2).ToEntero() + End If Salir = True Else - DdlNCPS.SelectedValueExist(NCAjuste) - DdlNCPS.Enabled = False + If ArrayNC.Length > 2 Then + NCConcepto = ArrayNC(1).ToEntero() + End If End If End If End Using @@ -27681,7 +27687,6 @@ Partial Class Ventas DdlNCPS.Enabled = True End If - For Each GvRow As GridViewRow In GvRemisionesNCBon.Rows If GvRow.RowType = DataControlRowType.DataRow Then If GvRow.FCCheckBox("ChkAplicar").Checked Then @@ -27709,6 +27714,13 @@ Partial Class Ventas End If + Dim DrPSSeleccionado As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=NCConcepto).FiltroPrimero("") + If DrPSSeleccionado IsNot Nothing Then + DdlNCPS.SelectedValueExistInsert(NCConcepto, DrPSSeleccionado("PS").ToString()) + DdlNCPS.Enabled = False + End If + + TxtImportesRemisionesNC.Text = TotalRemNCAplicado.FormatoNumero TxtNCImporte.Text = TotalRemNCAplicado.FormatoNumero From 480b6aaa5a48aff1132844e8444e45a7fdd88d14 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Thu, 3 Dec 2020 11:14:22 -0700 Subject: [PATCH 9/9] retroalimentacion de los filtros del reportes --- App_Code/ClsRH.vb | 274 +++++++++++++++--------------- OC/RepSolicitudesAnticipo.aspx | 3 +- OC/RepSolicitudesAnticipo.aspx.cs | 8 +- 3 files changed, 144 insertions(+), 141 deletions(-) diff --git a/App_Code/ClsRH.vb b/App_Code/ClsRH.vb index b7729c3f2..ba2f8a32e 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 @@ -4158,16 +4158,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 +4463,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 +4498,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 +6747,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,11 +6875,11 @@ 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 - -#Region "Checador" + +#Region "Checador" Public Function GetChecadores(CveChecador As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_RH_ChecadorGet") @@ -6894,18 +6894,18 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo OnError("Ocurrió un error al obtener el listado de checadores", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno - End Function - + 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("@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 @@ -6915,18 +6915,18 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo OnError("Ocurrió un error al agregar el checador", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno - End Function - + 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("@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 @@ -6936,8 +6936,8 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo OnError("Ocurrió un error al actualizar el checador", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno - End Function - + End Function + Public Function RemoveChecadores(CveChecador As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_RH_ChecadorDelete") @@ -6951,21 +6951,21 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo 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 - + 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/OC/RepSolicitudesAnticipo.aspx b/OC/RepSolicitudesAnticipo.aspx index 14e80d0fe..c5dff3a24 100644 --- a/OC/RepSolicitudesAnticipo.aspx +++ b/OC/RepSolicitudesAnticipo.aspx @@ -84,14 +84,13 @@
- +
Subproyecto:
-
diff --git a/OC/RepSolicitudesAnticipo.aspx.cs b/OC/RepSolicitudesAnticipo.aspx.cs index 67228491a..9efd1025c 100644 --- a/OC/RepSolicitudesAnticipo.aspx.cs +++ b/OC/RepSolicitudesAnticipo.aspx.cs @@ -94,7 +94,7 @@ public partial class OC_RepSolicitudesAnticipo : ClsPaginas { DdlProveedores.setEsWebService(true); DdlProveedores.Attributes.Add("data-metodo", "getproveedores"); - DdlProveedores.SelectedText = "Seleccione"; + DdlProveedores.SelectedText = "Todos"; DdlProveedores.SelectedValue = "-1"; } @@ -158,6 +158,10 @@ public partial class OC_RepSolicitudesAnticipo : ClsPaginas if (DdlProveedores.SelectedValue != "-1") { Proveedor = $" Proveedor: {DdlProveedores.ddl.SelectedItem.Text}"; } else { Proveedor = ""; } String Estatus; if (DdlEstatus.SelectedValue != "1") { Estatus = $" Estatus: {DdlEstatus.SelectedItem.Text}"; } else { Estatus = ""; } + String Usuario; + if (DdlUsuarios.SelectedValue != "-1") { Usuario = $" Usuario: {DdlUsuarios.SelectedItem.Text}"; } else { Usuario = ""; } + String SubProyectos; + if (DdlSubProyecto.SelectedValue != "-1") { SubProyectos = $" {lblSubProyecto.Text}: {DdlSubProyecto.SelectedItem.Text}"; } else { SubProyectos = ""; } if (DtDatos.Rows.Count > 0) { @@ -167,7 +171,7 @@ public partial class OC_RepSolicitudesAnticipo : ClsPaginas para.Add(new ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)); para.Add(new ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)); para.Add(new ReportParameter("Estatus", DdlEstatus.SelectedValue)); - String Agrupadores = $"{Proveedor}{FechaI}{FechaF}{Estatus}"; + String Agrupadores = $"{Proveedor}{FechaI}{FechaF}{Estatus}{Usuario}{SubProyectos}"; para.Add(new ReportParameter("AgrupadoPor", (Agrupadores == "" ? "": $"Agrupado Por: {Agrupadores}"))); if (Imagen.Exists) {