diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 4c116ea6f..2d8747e86 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -1294,7 +1294,8 @@ Public Class ClsPaginas ObjPS.Dispose() End Get End Property - Public Property GlobalDTPSSimplificado(CveEmpresa As Integer, Optional CveClasificacion As Integer = -1, Optional PSCodigo As String = "-1", Optional Estatus As Integer = 1, Optional AplicaParaVenta As Integer = -1, Optional CvePS As Integer = -1) As DataTable + Public Property GlobalDTPSSimplificado(CveEmpresa As Integer, Optional CveClasificacion As Integer = -1, Optional PSCodigo As String = "-1", Optional Estatus As Integer = 1, + Optional AplicaParaVenta As Integer = -1, Optional CvePS As Integer = -1, Optional Codigo As String = "-1") As DataTable Get Dim AppNombre As String = String.Format("GlobalDTPSSimplificado-{0}", CveEmpresa) If CveEmpresa <> -1 Then @@ -1312,6 +1313,8 @@ Public Class ClsPaginas Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveEmpresa) = CveEmpresa)) If CveClasificacion >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveClasificacion) = CveClasificacion)) If PSCodigo <> "-1" Then Cons = Cons.Where((Function(a) Convert.ToString(a!PSCodigo) = PSCodigo)) + Codigo = Codigo.ToUpper().Trim() + If Codigo <> "-1" Then Cons = Cons.Where((Function(a) Convert.ToString(a!Codigo).ToUpper().Trim() = Codigo)) If Estatus >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveEstado) = Estatus)) If AplicaParaVenta >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!AplicaParaVenta) = AplicaParaVenta)) If CvePS >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CvePS) = CvePS)) @@ -4619,6 +4622,7 @@ Public Class ClsPaginas PaginaDict.Add("/GPS/RepGastos.aspx".ToUpper(), 685) PaginaDict.Add("/GPS/RecursoConfiableTracking.aspx".ToUpper(), 692) PaginaDict.Add("/GPS/KimberlyClarkTracking.aspx".ToUpper(), -1) + PaginaDict.Add("/GPS/RepUnidades.aspx".ToUpper(), 780) #End Region 'INVENTARIOS #Region "Inventarios" @@ -4692,6 +4696,7 @@ Public Class ClsPaginas PaginaDict.Add("/Inventarios/EntregasPorRealizar.aspx".ToUpper(), 728) PaginaDict.Add("/Inventarios/CatAlmacenClasificacionSecciones.aspx".ToUpper(), 764) PaginaDict.Add("/Inventarios/ReconstruirCostos.aspx".ToUpper(), 764) + PaginaDict.Add("/Inventarios/RecepcionDevolucion.aspx".ToUpper(), 696) #End Region @@ -5078,6 +5083,7 @@ Public Class ClsPaginas PaginaDict.Add("/Ventas/MetasVendedores.aspx".ToUpper(), 722) PaginaDict.Add("/Ventas/CatMetasVendedores.aspx".ToUpper(), 723) PaginaDict.Add("/Ventas/RepAuxiliarFacturas.aspx".ToUpper(), 567) + PaginaDict.Add("/Ventas/CatAutorizacionLimites.aspx".ToUpper(), 781) #End Region @@ -5952,6 +5958,19 @@ Public Class ClsPaginas Dim TipoDocumentoRef As String = "" Dim AplicaPagare As String = "1" + Dim RFCReceptor As String = "" + + If String.IsNullOrEmpty(Vta.RFCReceptor) Then + RFCReceptor = Vta.Cliente.RFC + If Vta.FacturarSucursal Then + If Vta.ClienteSucursal IsNot Nothing Then + RFCReceptor = Vta.ClienteSucursal.RFC + End If + End If + Else + RFCReceptor = Vta.RFCReceptor + End If + Dim RutaCBB As String = String.Format("{0}CBB\{1}.jpg", Ruta, Vta.SerieFolio) Dim ImagenCBB As New System.IO.FileInfo(RutaCBB) Dim ImgCBB As String '= String.Format("{0}://{1}:{2}/Empresas/{3}/CBB/{4}.jpg", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa, Vta.SerieFolio) @@ -6081,7 +6100,7 @@ Public Class ClsPaginas 'Si no tiene CBB, SE GENERA If Not ImagenCBB.Exists Then Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar() - CBB.GenerarCBB(UsuarioActual.Empresa.RFC, Vta.Cliente.RFC, Vta.Total.ToString.ToDecimal, Vta.FolioFiscal, RutaCBB) + CBB.GenerarCBB(UsuarioActual.Empresa.RFC, RFCReceptor, Vta.Total.ToString.ToDecimal, Vta.FolioFiscal, RutaCBB) End If ImgCBB = String.Format("{0}://{1}:{2}/Empresas/{3}/CBB/{4}.jpg", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa, Vta.SerieFolio) @@ -6096,7 +6115,7 @@ Public Class ClsPaginas 'CLIENTE params.Add(New CrystalParametro("ClienteCodigo", Vta.Cliente.Codigo)) - params.Add(New CrystalParametro("ClienteNombre", If(Vta.ClienteSucursal.ImprimeNombreSucursal = "True", If(Vta.CveClienteSucursal > 0, Vta.ClienteSucursal.Sucursal, Vta.Cliente.Nombre), If(Vta.AtencionA <> "" AndAlso Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.RFC = "XAXX010101000", $"{Vta.Cliente.Nombre}({Vta.AtencionA})", Vta.Cliente.Nombre)))) + params.Add(New CrystalParametro("ClienteNombre", If(Vta.ClienteSucursal.ImprimeNombreSucursal = "True", If(Vta.CveClienteSucursal > 0, Vta.ClienteSucursal.Sucursal, Vta.Cliente.Nombre), If(Vta.AtencionA <> "" AndAlso Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso RFCReceptor = "XAXX010101000", $"{Vta.Cliente.Nombre}({Vta.AtencionA})", Vta.Cliente.Nombre)))) params.Add(New CrystalParametro("ClienteDireccion", ClienteDireccion)) params.Add(New CrystalParametro("ClienteLugar", ClienteLugar)) @@ -6128,7 +6147,7 @@ Public Class ClsPaginas params.Add(New CrystalParametro("SelloSAT", Vta.SelloSAT)) params.Add(New CrystalParametro("QR", ImgCBB)) - params.Add(New CrystalParametro("ClienteRFC", Vta.Cliente.RFC)) + params.Add(New CrystalParametro("ClienteRFC", RFCReceptor)) params.Add(New CrystalParametro("FormaPago", Vta.FormaPagoText)) params.Add(New CrystalParametro("Moneda", Vta.Moneda)) params.Add(New CrystalParametro("TipoCambio", Vta.TipoCambio.ToString)) @@ -6161,7 +6180,7 @@ Public Class ClsPaginas params.Add(New CrystalParametro("ClienteTelefono", Vta.ClienteSucursal.TelefonoSucursal)) Else params.Add(New CrystalParametro("ClienteContactoMail", Vta.Cliente.MailCotizacion)) - params.Add(New CrystalParametro("ClienteTelefono", If(Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.RFC = "XAXX010101000", Vta.TelefonoGenerico, Vta.Cliente.Telefono))) + params.Add(New CrystalParametro("ClienteTelefono", If(Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.Telefono.Length > 6, Vta.Cliente.Telefono, Vta.TelefonoGenerico))) End If If UsuarioActual.CveEmpresa.Contiene(17) Then @@ -6463,7 +6482,18 @@ Public Class ClsPaginas Dim NombreArchivoDescarga As String = "" Dim TipoDocumento As String = "" Dim TipoDocumentoRef As String = "" + Dim RFCReceptor As String = "" + If String.IsNullOrEmpty(Vta.RFCReceptor) Then + RFCReceptor = Vta.Cliente.RFC + If Vta.FacturarSucursal Then + If Vta.ClienteSucursal IsNot Nothing Then + RFCReceptor = Vta.ClienteSucursal.RFC + End If + End If + Else + RFCReceptor = Vta.RFCReceptor + End If Dim RutaCBB As String = String.Format("{0}CBB\{1}.jpg", Ruta, Vta.SerieFolio) Dim ImagenCBB As New System.IO.FileInfo(RutaCBB) @@ -6618,7 +6648,7 @@ Public Class ClsPaginas 'Si no tiene CBB, SE GENERA If Not ImagenCBB.Exists AndAlso Vta.CveCliente.ToEntero > 0 Then Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar() - CBB.GenerarCBB(UsuarioActual.Empresa.RFC, Vta.Cliente.RFC, Vta.Total.ToString.ToDecimal, Vta.FolioFiscal, RutaCBB) + CBB.GenerarCBB(UsuarioActual.Empresa.RFC, RFCReceptor, Vta.Total.ToString.ToDecimal, Vta.FolioFiscal, RutaCBB) End If ImgCBB = String.Format("{0}://{1}:{2}/Empresas/{3}/CBB/{4}.jpg", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa, Vta.SerieFolio) @@ -6636,17 +6666,17 @@ Public Class ClsPaginas 'CLIENTE If Vta.CveCliente.ToEntero > 0 Or Vta.CveEmpresaCRM.ToEntero > 0 Then params.Add(New ReportParameter("ClienteCodigo", Vta.Cliente.Codigo)) - params.Add(New ReportParameter("ClienteNombre", If(Vta.ClienteSucursal.ImprimeNombreSucursal = "True", If(Vta.CveClienteSucursal > 0, Vta.ClienteSucursal.Sucursal, Vta.Cliente.Nombre), If(Vta.AtencionA <> "" AndAlso Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.RFC = "XAXX010101000", $"{Vta.Cliente.Nombre}({Vta.AtencionA})", Vta.Cliente.Nombre)))) + params.Add(New ReportParameter("ClienteNombre", If(Vta.ClienteSucursal.ImprimeNombreSucursal = "True", If(Vta.CveClienteSucursal > 0, Vta.ClienteSucursal.Sucursal, Vta.Cliente.Nombre), If(Vta.AtencionA <> "" AndAlso Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso RFCReceptor = "XAXX010101000", $"{Vta.Cliente.Nombre}({Vta.AtencionA})", Vta.Cliente.Nombre)))) params.Add(New ReportParameter("ClienteDireccion", ClienteDireccion)) params.Add(New ReportParameter("ClienteLugar", ClienteLugar)) - params.Add(New ReportParameter("ClienteRFC", Vta.Cliente.RFC)) + params.Add(New ReportParameter("ClienteRFC", RFCReceptor)) End If If Vta.CveEmpresaCRM.ToEntero > 0 Then params.Add(New ReportParameter("ClienteCodigo", Vta.Cliente.Codigo)) params.Add(New ReportParameter("ClienteNombre", Vta.Cliente.Nombre)) params.Add(New ReportParameter("ClienteDireccion", ClienteDireccion)) params.Add(New ReportParameter("ClienteLugar", ClienteLugar)) - params.Add(New ReportParameter("ClienteRFC", Vta.Cliente.RFC)) + params.Add(New ReportParameter("ClienteRFC", RFCReceptor)) End If 'TOTALES @@ -6729,7 +6759,7 @@ Public Class ClsPaginas params.Add(New ReportParameter("ClienteTelefono", Vta.ClienteSucursal.TelefonoSucursal)) ElseIf Vta.CveCliente.ToEntero > 0 Then params.Add(New ReportParameter("ClienteContactoMail", Vta.Cliente.MailCotizacion)) - params.Add(New ReportParameter("ClienteTelefono", If(Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.Telefono.Length > 6, Vta.TelefonoGenerico, Vta.Cliente.Telefono))) + params.Add(New ReportParameter("ClienteTelefono", If(Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.Telefono.Length > 6, Vta.Cliente.Telefono, Vta.TelefonoGenerico))) End If If UsuarioActual.CveEmpresa.Contiene(17) Then diff --git a/App_Code/ClsSisUsuarios.vb b/App_Code/ClsSisUsuarios.vb index ed02a6324..09896ce69 100644 --- a/App_Code/ClsSisUsuarios.vb +++ b/App_Code/ClsSisUsuarios.vb @@ -821,7 +821,7 @@ Public Class ClsSisUsuarios Public Function AddUsuario(Usuario As String, Contraseña As String, Nombre As String, CveRol As Integer, Correo As String, CvePersonal As Integer, CveVendedor As Integer, CambiarContraseña As Boolean, CveUsuarioIng As Integer, CveEmpresa As Integer, CveSubProyecto As Integer, Optional Rol As String = "-1", Optional CveAlmacenAsignado As Integer = -1, Optional AsignarSubProyecto As Boolean = False, Optional AsignarOC As Boolean = False, - Optional CvePlataforma As Integer = -1, Optional CveClientePlataforma As Integer = -1, Optional CveProveedorPlataforma As Integer = -1, Optional DescuentoAutorizado As Double = 0, Optional CodigoAcceso As String = "-1") As Integer + Optional CvePlataforma As Integer = -1, Optional CveClientePlataforma As Integer = -1, Optional CveProveedorPlataforma As Integer = -1, Optional DescuentoAutorizado As Double = 0, Optional CodigoAcceso As String = "-1", Optional LimiteCreditoAutorizado As Decimal = 0) As Integer Dim Retorno = -1 DataAdapter("PA_Sis_UsuarioAdd") With SqlAdapter.SelectCommand.Parameters @@ -842,6 +842,7 @@ Public Class ClsSisUsuarios .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedorPlataforma .Add("@DescuentoAutorizado", SqlDbType.Float).Value = DescuentoAutorizado .Add("@CodigoAcceso", SqlDbType.VarChar).Value = CodigoAcceso + .Add("@LimiteCreditoAutorizado", SqlDbType.Money).Value = LimiteCreditoAutorizado .Add("@CveUsuario", SqlDbType.Int).Direction = ParameterDirection.Output End With @@ -940,7 +941,7 @@ Public Class ClsSisUsuarios End Function Public Function UpdateUsuario(Usuario As String, Nombre As String, CveRol As Integer, Correo As String, CvePersonal As Integer, CveVendedor As Integer, CambiarContraseña As Boolean, Activo As Boolean, CveEmpresa As Integer, CveUsuario As Integer, CveAlmacenAsignado As Integer, CveSubProyecto As Integer, Optional CveUsuarioModifico As Integer = -1, Optional AsignarSubProyecto As Boolean = False, Optional AsignarOC As Boolean = False, - Optional DescuentoAutorizado As Double = 0, Optional CodigoAcceso As String = "-1") As Boolean + Optional DescuentoAutorizado As Double = 0, Optional CodigoAcceso As String = "-1", Optional LimiteCreditoAutorizado As Decimal = 0) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Sis_UsuarioUpdate") @@ -962,6 +963,7 @@ Public Class ClsSisUsuarios .Add("@AsignarOC", SqlDbType.Bit).Value = AsignarOC .Add("@DescuentoAutorizado", SqlDbType.Float).Value = DescuentoAutorizado .Add("@CodigoAcceso", SqlDbType.VarChar).Value = CodigoAcceso + .Add("@LimiteCreditoAutorizado", SqlDbType.Money).Value = LimiteCreditoAutorizado End With Try diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 1046fd395..e4abc4166 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -4389,8 +4389,6 @@ Public Class ClsVentas Return Retorno End Function #End Region - - #Region " AUTORIZACION LIMITES " Public Function AutorizacionLimitesGet(CveCliente As Integer, CveCveVendedor As Integer, CveEstatus As Integer) As Boolean @@ -5093,6 +5091,81 @@ Public Class ClsVentas End Function #End Region + + Public Function AddAutorizacionLimite(CveEmpresa As Integer, CveCliente As Integer, CveVendedor As Integer, Importe As Decimal, CveEstatus As Integer, CveUsuario As Integer, TipoAutorizacion As Integer, TipoDocumento As String) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_AutorizacionLimitesAdd") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor + .Add("@Importe", SqlDbType.Money).Value = Importe + .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@TipoAutorizacion", SqlDbType.Int).Value = TipoAutorizacion + .Add("@TipoDocumento", SqlDbType.VarChar).Value = TipoDocumento + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los limites.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function GetAutorizacionLimite(CveEmpresa As Integer, CveCliente As Integer, CveVendedor As Integer, Optional CveEstatus As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_AutorizacionLimitesGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor + .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los limites.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + + Public Function UpdateAutorizacionLimite(CveAutorizacion As Integer, CveCliente As Integer, CveVenta As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_AutorizacionlimitesEstatusUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveAutorizacion", SqlDbType.Int).Value = CveAutorizacion + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar los limites.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function RemoveAutorizacionLimite(CveAutorizacion As Integer, CveCliente As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_AutorizacionLimitesRemove") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveAutorizacion", SqlDbType.Int).Value = CveAutorizacion + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar los limites.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + #Region "IDisposable Support" diff --git a/Ashx/E141.ashx b/Ashx/E141.ashx index e2ba8339d..90a17dc54 100644 --- a/Ashx/E141.ashx +++ b/Ashx/E141.ashx @@ -49,21 +49,13 @@ Public Class E141 : Implements IHttpHandler End Property Public ReadOnly Property TokenAutorizacion As String Get - If EsProduccion Then - Return "$2y$10$EZlXnFrhUc4aRVwjy5/v0.3JPdFNjyeANDc64YXJ5eHD8pMsv93Q." - Else - Return "$2y$10$8Mk3YeIkJESilIwD.U5dG.SsA4JloycJKbaGls8TNEw/AKBE1qane" - End If + Return "$2y$10$LGqtRWUloKQmAt.jcUldc.PmS5LJ6l.WU2w1G4PBOTLMVKZRNQFPS" 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 + Return "https://services.fidelityapps.mx/" End Get End Property @@ -1852,6 +1844,7 @@ Public Class E141 : Implements IHttpHandler httpClient.Timeout = New TimeSpan(0, 5, 0) Using request = New HttpRequestMessage(HttpMethod.Post, New Uri(url)) request.Headers.Add("X-PUBLIC-AUTH", TokenAutorizacion) + request.Headers.Add("X-Authentication", TokenAutorizacion) Using content = New StringContent(payload, Encoding.UTF8, "application/json") request.Content = content diff --git a/GPS/TrayectoDetalle.aspx b/GPS/TrayectoDetalle.aspx index c977aaab9..7348e02c5 100644 --- a/GPS/TrayectoDetalle.aspx +++ b/GPS/TrayectoDetalle.aspx @@ -360,8 +360,8 @@ - + diff --git a/GPS/TrayectoDetalle.aspx.vb b/GPS/TrayectoDetalle.aspx.vb index 7153f6f10..fe58efe5d 100644 --- a/GPS/TrayectoDetalle.aspx.vb +++ b/GPS/TrayectoDetalle.aspx.vb @@ -186,7 +186,17 @@ Partial Class GPS_TrayectoDetalle GvIgnicion.DataSource = DsDatos.Tables(1) GvIgnicion.DataBind() - GvExcesos.DataSource = DsDatos.Tables(2) + Dim DtExcesos As DataTable = DsDatos.Tables(2) + + Dim Direcciones = ConsultarDirecciones(DtExcesos) + + If Direcciones IsNot Nothing Then + For Each Dir As JObject In Direcciones + DtExcesos.Rows(Dir("Indice").ToEntero())("Direccion") = Dir("Direccion").ToString() + Next + End If + + GvExcesos.DataSource = DtExcesos GvExcesos.DataBind() GvRalenti.DataSource = DsDatos.Tables(3) diff --git a/Inventarios/PopUpExistenciasAlmacen.aspx b/Inventarios/PopUpExistenciasAlmacen.aspx index 3588e3237..6f5122421 100644 --- a/Inventarios/PopUpExistenciasAlmacen.aspx +++ b/Inventarios/PopUpExistenciasAlmacen.aspx @@ -135,6 +135,8 @@ +<%-- + --%> @@ -147,6 +149,7 @@ + diff --git a/Inventarios/RecepcionUsados.aspx.vb b/Inventarios/RecepcionUsados.aspx.vb index a50ab4f25..8af463766 100644 --- a/Inventarios/RecepcionUsados.aspx.vb +++ b/Inventarios/RecepcionUsados.aspx.vb @@ -2560,11 +2560,12 @@ Partial Class Inventarios_RecepcionUsados 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)) + CvePS = Row.DataKey("CvePS").ToEntero() + '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 + 'If drDatos IsNot Nothing Then + ' CvePS = drDatos.Item("CvePSCargo").ToString.ToEntero + 'End If End Select If CvePS > 0 Then @@ -3104,28 +3105,37 @@ Partial Class Inventarios_RecepcionUsados End If Dim drDatos As DataRow = GlobalDTAcumTamaños().FiltroPrimero(String.Format("CveTamaño = {0} AND CveEmpresa = {1}", CveTamaño, UsuarioActual.CveEmpresa)) + Dim Importe As Decimal = 0 + Dim drTamañoPS As DataRow = Nothing + + DtMovimientos.Rows.Clear() + + ' USADOS If drDatos IsNot Nothing Then - Dim Importe As Decimal = drDatos("Cargo").ToString.ToDecimal - Dim drTamañoPS As DataRow = Nothing + If RblUsadosAjuste.SelectedValue = "0" Then + CvePS = drDatos.Item("CvePSCargo").ToString.ToEntero + End If + Importe = drDatos("Cargo").ToString.ToDecimal + Else + Importe = TxtImporteAjuste.Text.ToDecimal + End If - 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 + 'AJUSTE/GARANTIA + If RblUsadosAjuste.SelectedValue = "1" Then + CvePS = DdlPSAjuste.SelectedValue.ToEntero + End If + If CvePS > 0 Then 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) + "", "-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 diff --git a/Sistemas/UsuarioDetalle.aspx b/Sistemas/UsuarioDetalle.aspx index 512355535..182c8df96 100644 --- a/Sistemas/UsuarioDetalle.aspx +++ b/Sistemas/UsuarioDetalle.aspx @@ -307,6 +307,13 @@ + + Límite Cédito Autorizado: + + + + + diff --git a/Sistemas/UsuarioDetalle.aspx.vb b/Sistemas/UsuarioDetalle.aspx.vb index e9948bffc..72683623b 100644 --- a/Sistemas/UsuarioDetalle.aspx.vb +++ b/Sistemas/UsuarioDetalle.aspx.vb @@ -447,6 +447,7 @@ Partial Class Sistemas_UsuarioDetalle If UsuarioActual.Empresa.Funcionalidad(531).ToString = "1" Then TrDescuentoAutorizado.Visible = True + TrLimiteAutorizacion.Visible = True End If If UsuarioActual.Empresa.Funcionalidad(599) = "1" Then @@ -586,8 +587,8 @@ Partial Class Sistemas_UsuarioDetalle LblFechaCaptura.Text = ObjUsuario.Fecha.ToShortDateString LblUsuarioCapturo.Text = ObjUsuario.UsuarioCreo - TxtDescuentoAutorizado.Text = ObjUsuario.DescuentoAutorizado.FormatoNumero - + TxtDescuentoAutorizado.Text = ObjUsuario.DescuentoAutorizado.FormatoNumero + TxtLimiteAutorizado.Text = ObjUsuario.DtResultados.Rows(0)("LimiteCreditoAutorizado").ToString() Else Alert("El Usuario Solicitado no existe, Revise su búsqueda.", TipoMensaje.MsgAdvertencia) BtnGuardar.Enabled = False @@ -831,7 +832,7 @@ Partial Class Sistemas_UsuarioDetalle 'REGISTRA O ACTUALIZA LOS DATOS GENERALES DEL USUARIO If CveUsuario = -1 Then - CveUsuario = ObjUsuarios.AddUsuario(TxtUsuario.Text.Trim, Encripta(ContraseñaPredeterminada), TxtNombre.Text.Trim, DdlRol.SelectedValue.ToEntero, TxtCorreo.Text.Trim, DdlPersonal.SelectedValue.ToEntero, DdlVendedor.SelectedValue.ToEntero, ChkCambiarContraseña.Checked, UsuarioActual.CveUsuario, DdlEmpresa.SelectedValue.ToEntero, DdlSubProyectos.SelectedValue.ToEntero, CveAlmacenAsignado:=DdlAlmacenGeneral.SelectedValue.ToEntero, AsignarSubProyecto:=ChkAsignarSubProyecto.Checked, AsignarOC:=ChkAsignarOC.Checked, DescuentoAutorizado:=TxtDescuentoAutorizado.Text.ToDouble, CodigoAcceso:=CodigoAcceso) + CveUsuario = ObjUsuarios.AddUsuario(TxtUsuario.Text.Trim, Encripta(ContraseñaPredeterminada), TxtNombre.Text.Trim, DdlRol.SelectedValue.ToEntero, TxtCorreo.Text.Trim, DdlPersonal.SelectedValue.ToEntero, DdlVendedor.SelectedValue.ToEntero, ChkCambiarContraseña.Checked, UsuarioActual.CveUsuario, DdlEmpresa.SelectedValue.ToEntero, DdlSubProyectos.SelectedValue.ToEntero, CveAlmacenAsignado:=DdlAlmacenGeneral.SelectedValue.ToEntero, AsignarSubProyecto:=ChkAsignarSubProyecto.Checked, AsignarOC:=ChkAsignarOC.Checked, DescuentoAutorizado:=TxtDescuentoAutorizado.Text.ToDouble, CodigoAcceso:=CodigoAcceso, LimiteCreditoAutorizado:=TxtLimiteAutorizado.Text.ToDecimal()) EsNuevoUsuario = True If CveUsuario = -1 Then TieneError = True @@ -843,7 +844,7 @@ Partial Class Sistemas_UsuarioDetalle End If Next Else - If Not ObjUsuarios.UpdateUsuario(TxtUsuario.Text.Trim, TxtNombre.Text.Trim, DdlRol.SelectedValue.ToEntero, TxtCorreo.Text.Trim, DdlPersonal.SelectedValue.ToEntero, DdlVendedor.SelectedValue.ToEntero, ChkCambiarContraseña.Checked, ChkEstatus.Checked, DdlEmpresa.SelectedValue.ToEntero, CveUsuario, DdlAlmacenGeneral.SelectedValue.ToEntero, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveUsuario, AsignarSubProyecto:=ChkAsignarSubProyecto.Checked, AsignarOC:=ChkAsignarOC.Checked, DescuentoAutorizado:=TxtDescuentoAutorizado.Text.ToDouble, CodigoAcceso:=CodigoAcceso) Then + If Not ObjUsuarios.UpdateUsuario(TxtUsuario.Text.Trim, TxtNombre.Text.Trim, DdlRol.SelectedValue.ToEntero, TxtCorreo.Text.Trim, DdlPersonal.SelectedValue.ToEntero, DdlVendedor.SelectedValue.ToEntero, ChkCambiarContraseña.Checked, ChkEstatus.Checked, DdlEmpresa.SelectedValue.ToEntero, CveUsuario, DdlAlmacenGeneral.SelectedValue.ToEntero, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveUsuario, AsignarSubProyecto:=ChkAsignarSubProyecto.Checked, AsignarOC:=ChkAsignarOC.Checked, DescuentoAutorizado:=TxtDescuentoAutorizado.Text.ToDouble, CodigoAcceso:=CodigoAcceso, LimiteCreditoAutorizado:=TxtLimiteAutorizado.Text.ToDecimal()) Then TieneError = True End If diff --git a/Ventas/ActualizarPrecios.aspx.vb b/Ventas/ActualizarPrecios.aspx.vb index b26f69ee9..ca172e5ec 100644 --- a/Ventas/ActualizarPrecios.aspx.vb +++ b/Ventas/ActualizarPrecios.aspx.vb @@ -559,7 +559,7 @@ Partial Class Ventas_ActualizarPrecios For Each Franquicia In Franquicias Dim CveFranquicia As Integer = Franquicia.ToEntero - Dim CvePS As Integer = GlobalDTPS(CveFranquicia, Codigo:=Codigo.ToUpper).FiltroPrimeroValor("CvePS", "").ToEntero + Dim CvePS As Integer = GlobalDTPSSimplificado(CveFranquicia, Codigo:=Codigo).FiltroPrimeroValor("CvePS", "").ToEntero Dim CvePrecioLisa As Integer = GlobalDTPrecioListas(CveFranquicia).FiltroPrimeroValor("CvePrecioLista", String.Format("PrecioLista = '{0}'", PrecioLista)).ToEntero If CvePS <= 0 Then diff --git a/Ventas/CatAutorizacionLimites.aspx b/Ventas/CatAutorizacionLimites.aspx new file mode 100644 index 000000000..b71f4c61e --- /dev/null +++ b/Ventas/CatAutorizacionLimites.aspx @@ -0,0 +1,156 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatAutorizacionLimites.aspx.vb" Inherits="Ventas_CatAutorizacionLimites" %> + + + + + + + + Catálogo de autorizaciones de límite de crédito + + + + + + +
  • + Agregar autorización
  • +
    +
    +
    + + + + + +
    +
    +
    + +
    +
    +
      +
    • Estatus: + + + + + + + + +
    • +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + diff --git a/Ventas/CatAutorizacionLimites.aspx.vb b/Ventas/CatAutorizacionLimites.aspx.vb new file mode 100644 index 000000000..0b450106d --- /dev/null +++ b/Ventas/CatAutorizacionLimites.aspx.vb @@ -0,0 +1,215 @@ + +Imports Extensiones + +Partial Class Ventas_CatAutorizacionLimites + Inherits ClsPaginas + +#Region "PROPIEDADES" + Private Property CveAutorizacion() As Integer Get + Return If(IsNothing(ViewState("CveAutorizacion")), -1, CInt(ViewState("CveAutorizacion"))) + End Get Set + ViewState("CveAutorizacion") = Value End Set End Property + Private Property Modalidad() As String Get + Return If(IsNothing(ViewState("Modalidad")), "", (ViewState("Modalidad").ToString)) + End Get Set + ViewState("Modalidad") = Value End Set End Property +#End Region + + Private Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load + If Not IsPostBack Then + CargaCombos() + CargaDatos() + End If + End Sub + +#Region "CARGAS" + Private Sub CargaCombos() + Dim EsWS = If(UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1", True, False) + If EsWS Then + DdlCliente.setEsWebService(True) + Else + DdlCliente.setEsWebService(False) + DdlCliente.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1) + DdlCliente.DataBind() + DdlCliente.ddl.Items.Insert(0, New ListItem("Seleccione", "-1")) + End If + + DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa) + DdlVendedor.DataBind() + + UpModal.Update() + End Sub + Private Sub CargaDatos() + Dim ObjGral As New ClsVentas + If ObjGral.GetAutorizacionLimite(UsuarioActual.CveEmpresa, -1, -1, CveEstatus:=DdlEstatus.SelectedValue.ToEntero()) Then + GvDatos.DataSource = ObjGral.DtResultados + End If + ObjGral.Dispose() + GvDatos.DataBind() + UpDatos.Update() + End Sub + + Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) + CargaDatos() + End Sub + +#End Region + +#Region "BOTONES" + Protected Sub LnkEliminar_Click(sender As Object, e As EventArgs) + Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + + Dim CveAutorizacion = gvRow.DataKey("CveAutorizacion").ToEntero() + Dim CveCliente = gvRow.DataKey("CveCliente").ToEntero() + + Dim ObjGral As New ClsVentas + If ObjGral.RemoveAutorizacionLimite(CveAutorizacion, CveCliente) Then + Alert("La autorización se elimino correctamente.", TipoMensaje.MsgInformacion) + End If + ObjGral.Dispose() + + CargaDatos() + End Sub + + Protected Sub LnkAgregar_Click(sender As Object, e As EventArgs) + LimpiaModal() + Modalidad = "A" + BtnGuardar.Text = "Agregar" + ltlMotititulo.Text = "Agregar autorización" UpModal.Update() + RegistraScript("$('#DModal').modal()") End Sub + Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) + If DdlTipoDocto.SelectedValue = "Ing" AndAlso DdlTipoAutorizacion.SelectedValue.ToEntero() <= 0 Then + Alert("Debe seleccionar un tipo de autorización", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + Dim CveEstatus As Integer = 1 + Dim TipoDocto As String = DdlTipoDocto.SelectedValue + Dim CveTipoAutorizacion As Integer = -1 + + Select Case TipoDocto + Case "Ing" + CveTipoAutorizacion = DdlTipoAutorizacion.SelectedValue.ToEntero() + Case "Egs" + CveTipoAutorizacion = -1 + End Select + + Dim ObjPS As New ClsVentas + If ObjPS.AddAutorizacionLimite(UsuarioActual.CveEmpresa, DdlCliente.SelectedValue.ToEntero(), DdlVendedor.SelectedValue.ToEntero(), TxtPrecio.Text.ToDecimal(), CveEstatus, UsuarioActual.CveUsuario, CveAutorizacion, TipoDocto) Then + RegistraScript("$('#DModal').modal('hide')") + Alert("La autorización se agregó correctamente.", TipoMensaje.MsgInformacion) + End If + ObjPS.Dispose() + + CargaDatos() + End Sub + +#End Region + +#Region "LIMPIAR" + Protected Sub LimpiaModal() Me.CveAutorizacion = -1 TxtPrecio.Text = "" + + DdlCliente.SelectedValue = "-1" DdlVendedor.SelectedValueExist("-1") End Sub + +#End Region + +#Region "GRIDVIEW" + Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.DBCampo("CveEstatus") = "0" Then + e.Row.FCLabel("LblEstatus").CssClass = "badge badge-secondary" + e.Row.FCLinkButton("LnkAutorizar").Visible = True + e.Row.FCLinkButton("LnkRechazar").Visible = True + ElseIf e.Row.DBCampo("CveEstatus") = "1" Then + e.Row.FCLabel("LblEstatus").CssClass = "badge badge-success" + e.Row.FCLinkButton("LnkAutorizar").Visible = False + e.Row.FCLinkButton("LnkRechazar").Visible = True + ElseIf e.Row.DBCampo("CveEstatus") = "2" Then + e.Row.FCLabel("LblEstatus").CssClass = "badge badge-primary" + e.Row.FCLinkButton("LnkAutorizar").Visible = False + e.Row.FCLinkButton("LnkRechazar").Visible = False + ElseIf e.Row.DBCampo("CveEstatus") = "3" Then + e.Row.FCLabel("LblEstatus").CssClass = "badge badge-danger" + e.Row.FCLinkButton("LnkAutorizar").Visible = False + e.Row.FCLinkButton("LnkRechazar").Visible = False + End If + 'If e.Row.DBCampo("Estatus") = "True" Then + ' e.Row.Cells(1).ForeColor = Drawing.Color.Green + ' e.Row.Cells(1).Font.Bold = True + ' e.Row.Cells(1).Text = "Activo" + 'Else + ' e.Row.Cells(1).Text = "Inactivo" + ' e.Row.Cells(1).ForeColor = Drawing.Color.Red + ' e.Row.Cells(1).Font.Bold = True + 'End If + End If + End Sub + +#End Region + + + + Protected Sub LnkAutorizar_Click(sender As Object, e As EventArgs) + Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + + Dim CveAutorizacion = gvRow.DataKey("CveAutorizacion").ToEntero() + Dim CveCliente = gvRow.DataKey("CveCliente").ToEntero() + Dim CveVendedor = gvRow.DataKey("CveVendedor").ToEntero() + Dim Importe = gvRow.DataKey("Importe").ToEntero() + Dim CveEstatusAutorizacion As Integer = 1 + + Dim ObjVentas As New ClsVentas + If ObjVentas.AutorizacionLimitesUpdate(CveAutorizacion, CveCliente, CveVendedor, Importe, CveEstatusAutorizacion) Then + Alert("El límite de crédito fue autorizado.") + End If + ObjVentas.Dispose() + + CargaDatos() + End Sub + + Protected Sub LnkRechazar_Click(sender As Object, e As EventArgs) + Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + + Dim CveAutorizacion = gvRow.DataKey("CveAutorizacion").ToEntero() + Dim CveCliente = gvRow.DataKey("CveCliente").ToEntero() + Dim CveVendedor = gvRow.DataKey("CveVendedor").ToEntero() + Dim Importe = gvRow.DataKey("Importe").ToEntero() + Dim CveEstatusAutorizacion As Integer = 3 + + Dim ObjVentas As New ClsVentas + If ObjVentas.AutorizacionLimitesUpdate(CveAutorizacion, CveCliente, CveVendedor, Importe, CveEstatusAutorizacion) Then + Alert("El límite de crédito fue rechazado.") + End If + ObjVentas.Dispose() + + CargaDatos() + End Sub + Protected Sub DdlTipoAutorizacion_SelectedIndexChanged(sender As Object, e As EventArgs) + DivImporte.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 1 + UpModal.Update() + End Sub + Protected Sub DdlCliente_SelectedIndexChanged(sender As Object, e As EventArgs) + Dim CveCliente As Integer = DdlCliente.SelectedValue.ToEntero() + If CveCliente > 0 Then + Using ObjClientes As New ClsClientes + If ObjClientes.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) AndAlso ObjClientes.DtResultados.Rows.Count > 0 Then + DdlVendedor.SelectedValueExist(ObjClientes.DtResultados.Rows(0)("CveVendedor")) + End If + End Using + End If + + UpModal.Update() + End Sub + Protected Sub DdlTipoDocto_SelectedIndexChanged(sender As Object, e As EventArgs) + Dim TipoDocto As String = DdlTipoDocto.SelectedValue.ToString() + Select Case TipoDocto + Case "Ing" + DivAutorizacion.Visible = True + DivImporte.Visible = True + Case "Egs" + DivAutorizacion.Visible = False + DivImporte.Visible = False + End Select + UpModal.Update() + End Sub +End Class diff --git a/Ventas/ClientesAbonar.aspx.vb b/Ventas/ClientesAbonar.aspx.vb index b5ff5408d..1e0415ffa 100644 --- a/Ventas/ClientesAbonar.aspx.vb +++ b/Ventas/ClientesAbonar.aspx.vb @@ -855,7 +855,7 @@ Partial Class Ventas_ClientesAbonar Dim tipoCambioVentaDiferenciaCambiaria As Double = 1 Dim EsAnticipoEspecial As Boolean = False - If gvr.DataKey("TipoDocto") = "Ant" AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119) Then EsAnticipoEspecial = True + If gvr.DataKey("TipoDocto") = "Ant" AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119, 158) Then EsAnticipoEspecial = True If dtConceptos IsNot Nothing Then For Each Row As DataRow In dtConceptos.Rows @@ -900,9 +900,9 @@ Partial Class Ventas_ClientesAbonar Else ConceptoMovimiento += $" TC:{tipoCambioVentaValuacion} ${ImporteMovimiento.FormatoNumero(2)}" IdCtaContable = If(EsAnticipoEspecial, IdCtaContMonedaComplementariaAnticipo, IdCtaContComplementaria) - If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa = 119) Then + If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa.Contiene(119, 158)) Then importeMX = ImporteMovimiento - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Referencia, If(gvr.DataKey("TipoDocto") = "Ant" AndAlso UsuarioActual.CveEmpresa = 119, 226, 207), ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.FCHyperLink("HplF2").Text.ToEntero, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=(ImporteMovimiento * tipoCambioVentaValuacion - ImporteMovimiento).RoundSQL, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioVentaValuacion) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Referencia, If(gvr.DataKey("TipoDocto") = "Ant" AndAlso UsuarioActual.CveEmpresa.Contiene(119, 158), 226, 207), ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.FCHyperLink("HplF2").Text.ToEntero, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=(ImporteMovimiento * tipoCambioVentaValuacion - ImporteMovimiento).RoundSQL, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioVentaValuacion) Then MsgError = "No se pudo insertar la póliza" End If End If @@ -2631,11 +2631,11 @@ Partial Class Ventas_ClientesAbonar End If - Dim UsaComplementaria As Boolean = False + Dim UsaComplementaria As Boolean = True - If UsuarioActual.CveEmpresa = 119 Then - UsaComplementaria = True - End If + 'If UsuarioActual.CveEmpresa = 119 Then + ' UsaComplementaria = True + 'End If If MsgError = "" Then diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index 3c943a27d..f01634812 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -4993,13 +4993,13 @@ Partial Class PV If CveVentaDetalle <= 0 AndAlso Not EsCargo Then Dim ListaPSCargo = CalculaUsados(Consec) If ListaPSCargo.Count > 0 Then - CalculaRecepcionUsados(CvePS, ListaPSCargo) + CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad) End If ElseIf CveVentaDetalle > 0 AndAlso Not EsCargo Then EliminarUsados() Dim ListaPSCargo = CalculaUsados(Consec, LimpiarUsados:=False) If ListaPSCargo.Count > 0 Then - CalculaRecepcionUsados(CvePS, ListaPSCargo) + CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad) End If End If @@ -7091,7 +7091,7 @@ Partial Class PV EmitirImprimirNew() End Sub - Private Sub CalculaRecepcionUsados(CvePS As Integer, ListaPSCargo As List(Of Integer)) + Private Sub CalculaRecepcionUsados(CvePS As Integer, ListaPSCargo As List(Of Integer), CantidadUsado As Decimal) If Modalidad = "U" Then If TmpDTRecepcionUsados.Rows.Count > 0 Then @@ -7139,14 +7139,14 @@ Partial Class PV Dim DrTamanio As DataRow = GlobalDTAcumTamaños.FiltroPrimero($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CvePSCargo = {DdlRecepcionUsados.SelectedValue}") If DdlRecepcionUsados.SelectedValue.ToEntero() > 0 Then - TotalCargos += 1D * DrTamanio("Cargo").ToString().ToDecimal - TotalCantidad += 1D + TotalCargos += CantidadUsado * DrTamanio("Cargo").ToString().ToDecimal + TotalCantidad += CantidadUsado StrTamanios.AppendFormat("{0},", DrTamanio("CodigoPS")) Dim Row As DataRow = TmpDTRecepcionUsados.NewRow() Row("CvePS") = DrTamanio("CvePSCargo").ToString().ToEntero Row("CvePSRelacionado") = CvePS - Row("Cantidad") = 1D + Row("Cantidad") = CantidadUsado Row("CveUM") = DrTamanio("CveUM").ToString().ToEntero Row("CveVentaDetalle") = -1 Row("PU") = DrTamanio("Cargo").ToString().ToDecimal @@ -7176,11 +7176,14 @@ Partial Class PV ' Exit Sub 'End If - For Each Dr As DataRow In TmpDT.FiltraParametros($"EsCargo = True AND EliminarDB = False AND CvePS IN ({StrCargos})").Rows + Dim DtUsadosFiltro As DataTable = TmpDT.FiltraParametros($"EsCargo = True AND EliminarDB = False AND CvePS IN ({StrCargos})") + Dim DivisorUsado = DtUsadosFiltro.Rows.Count.ToString().ToDecimal() + + For Each Dr As DataRow In DtUsadosFiltro.Rows Dim TotalAnterior As Decimal = Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal 'Dim PUActual As Decimal = (TotalAnterior - TotalCargos) / Dr("Cantidad").ToString.ToDecimal - Dim DescuentoCargo As Decimal = (TotalCargos / Dr("Cantidad").ToString.ToDecimal) + Dim DescuentoCargo As Decimal = (TotalCargos / DivisorUsado) If DescuentoCargo > (TotalAnterior - Dr("Descuento").ToString.ToDecimal()) Then DescuentoCargo = (TotalAnterior - Dr("Descuento").ToString.ToDecimal()) @@ -7218,20 +7221,23 @@ Partial Class PV Next TmpDT.AcceptChanges() If TotalCargos > 0 Then ' cuando se entrega más valor de usados, que los cargos hechos, se descuenta sobre el PU del producto de venta - For Each Dr As DataRow In TmpDT.FiltraParametros($"EsCargo = False AND EliminarDB = False AND CvePS={CvePS}").Rows + Dim DtPSFiltro As DataTable = TmpDT.FiltraParametros($"EsCargo = False AND EliminarDB = False AND CvePS={CvePS}") + Dim Divisor = DtPSFiltro.Rows.Count.ToString().ToDecimal() - Dim PUAnterior As Decimal = Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal - Dim DescuentoCargo As Decimal = (TotalCargos / Dr("Cantidad").ToString.ToDecimal) + For Each Dr As DataRow In DtPSFiltro.Rows - If DescuentoCargo > (PUAnterior - Dr("Descuento").ToString.ToDecimal()) Then - DescuentoCargo = (PUAnterior - Dr("Descuento").ToString.ToDecimal()) + Dim TotalAnterior As Decimal = Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal + Dim DescuentoCargo As Decimal = (TotalCargos / Divisor) + + If DescuentoCargo > (TotalAnterior - Dr("Descuento").ToString.ToDecimal()) Then + DescuentoCargo = (TotalAnterior - Dr("Descuento").ToString.ToDecimal()) End If 'Dim PUActual As Decimal = PUAnterior - DescuentoCargo Dim Descuento As Decimal = Dr("Descuento").ToString.ToDecimal + DescuentoCargo - Dim TotalCalculableImpuestos As Decimal = (Dr("Cantidad").ToString.ToDecimal * (PUAnterior)) - Descuento - TotalCargos += -DescuentoCargo + Dim TotalCalculableImpuestos As Decimal = (Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal) - Descuento + TotalCargos -= DescuentoCargo Dim drt As DataRow() = TmpDT.Select("Consec = " & Dr("Consec").ToString) Dim drr As DataRow = drt(0) diff --git a/Ventas/ProductosServicios.aspx.vb b/Ventas/ProductosServicios.aspx.vb index c6adff94b..8583d5742 100644 --- a/Ventas/ProductosServicios.aspx.vb +++ b/Ventas/ProductosServicios.aspx.vb @@ -2944,7 +2944,10 @@ Partial Class ProductosyServicios Return True End If End If + + GlobalDTPSSimplificado(CveEmpresaFranquicia) = Nothing Next + Return False End Function diff --git a/Ventas/RepPS.aspx.vb b/Ventas/RepPS.aspx.vb index cf7a1a120..7ff45a9fe 100644 --- a/Ventas/RepPS.aspx.vb +++ b/Ventas/RepPS.aspx.vb @@ -775,9 +775,9 @@ Partial Class Ventas_RepPS 'worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 9).Value = Row("PolizasCantidadAcumulada") worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 9).Formula = $"=SUM({worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 7).Name}:{worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 8).Name})" - worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 10).Value = Row("VentaAnterior") - worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 11).Value = Row("VentaDia") - 'worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 12).Value = Row("VentaAcumulada") + worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 10).Value = Row("ManoObraCantidadAnterior") + worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 11).Value = Row("ManoObraCantidadDia") + 'worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 12).Value = Row("ManoObraCantidadAcumulada") worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 12).Formula = $"=SUM({worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 10).Name}:{worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 11).Name})" Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxSucursalesServiciosAmortPolizas, 0, IdxSucursalesServiciosAmortPolizas, 12).Style diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index a223d5b9f..bef184d20 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -367,6 +367,9 @@
  • Relacionar Facturas
  • +
  • + Solicitar autorización de crédito +
  • @@ -3657,7 +3660,7 @@
    -
    +
    @@ -3765,23 +3768,23 @@ - +
    - +
    - - - + + +
    @@ -6239,7 +6242,7 @@
    -