Autorizaciones de limite de credito

This commit is contained in:
2021-06-23 11:22:17 -07:00
parent 324744cd95
commit 61685fa0b0
9 changed files with 828 additions and 31 deletions

View File

@@ -1286,7 +1286,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
@@ -1304,6 +1305,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))
@@ -4610,6 +4613,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"
@@ -4683,6 +4687,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
@@ -5069,6 +5074,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
@@ -5943,6 +5949,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)
@@ -6072,7 +6091,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)
@@ -6087,7 +6106,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))
@@ -6119,7 +6138,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))
@@ -6152,7 +6171,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
@@ -6454,7 +6473,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)
@@ -6609,7 +6639,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)
@@ -6627,17 +6657,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
@@ -6720,7 +6750,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

View File

@@ -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

View File

@@ -4388,6 +4388,133 @@ Public Class ClsVentas
End Function
#End Region
#Region " AUTORIZACION LIMITES "
Public Function AutorizacionLimitesGet(CveCliente As Integer, CveCveVendedor As Integer, CveEstatus As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_AutorizacionLimitesGet", CommandType.StoredProcedure)
With SqlAdapter.SelectCommand.Parameters
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
.Add("@CveCveVendedor", SqlDbType.Int).Value = CveCveVendedor
.Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al obtener las Autorizaciones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function AutorizacionLimitesRemove(CveAutorizacion As Integer, CveCliente As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_AutorizacionLimitesRemove", CommandType.StoredProcedure)
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 la Autorización.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function AutorizacionLimitesAdd(CveCliente As Integer, CveVendedor As Integer, Importe As Decimal, CveUsuario As Integer, CveEstatus As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_AutorizacionLimitesAdd", CommandType.StoredProcedure)
With SqlAdapter.SelectCommand.Parameters
.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
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al agregar la Autorización.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function AutorizacionLimitesEstatusUpdate(CveAutorizacion As Integer, CveCliente As Integer, CveVenta As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_AutorizacionlimitesEstatusUpdate", CommandType.StoredProcedure)
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 la Autorización.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function AutorizacionLimitesUpdate(CveAutorizacion As Integer, CveCliente As Integer, CveVendedor As Integer, Importe As Decimal, CveEstatus As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_AutorizacionLimitesUpdate", CommandType.StoredProcedure)
With SqlAdapter.SelectCommand.Parameters
.Add("@CveAutorizacion", SqlDbType.Int).Value = CveAutorizacion
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
.Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor
.Add("@Importe", SqlDbType.Money).Value = Importe
.Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al actualizar el Estatus de la Autorización.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
#End Region
#Region "CANCELACION REMISION"
Public Function UpdateCancelaRemision(CveVenta As Integer, SeCancelaRemision As Boolean) As Boolean
@@ -4963,6 +5090,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"

View File

@@ -307,6 +307,13 @@
<ajax:FilteredTextBoxExtender ID="FTBEDescuentoAutorizado" TargetControlID="TxtDescuentoAutorizado" FilterType="Numbers,Custom" ValidChars="." runat="server" />
</td>
</tr>
<tr id="TrLimiteAutorizacion" runat="server" visible="false">
<td>Límite Cédito Autorizado:</td>
<td>
<asp:TextBox ID="TxtLimiteAutorizado" MaxLength="20" CssClass="form-control" runat="server"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTELimiteAutorizado" TargetControlID="TxtLimiteAutorizado" FilterType="Numbers,Custom" ValidChars="." runat="server" />
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>

View File

@@ -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

View File

@@ -0,0 +1,156 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatAutorizacionLimites.aspx.vb" Inherits="Ventas_CatAutorizacionLimites" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
<style>
.labelddl {
top: 0;
margin-bottom: 0;
font-size: 13px;
color: #888888;
opacity: 1;
}
</style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
Catálogo de autorizaciones de límite de crédito
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
<asp:UpdatePanel ID="UpAcciones" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<li>
<asp:LinkButton ID="LnkAgregar" OnClick="LnkAgregar_Click" runat="server"><i class="fa fa-plus"></i>Agregar autorización</asp:LinkButton></li>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="UPFiltros" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet solid grey-cascade portlet-filter" style="">
<div class="portlet-title portlet-filterT smalltitle " style="">
<div class="tools">
<asp:Button ID="BtnConsultar" OnClick="BtnConsultar_Click" runat="server" Text="Consultar" class="btn btn-primary" />
</div>
<div class="titlefiltros caption" style="margin-top: -8px;">
<ul class="list-inline" style="font-size: 12px;">
<li>Estatus:
<asp:DropDownList AppendDataBoundItems="true" ID="DdlEstatus" runat="server" Width="200px" DataTextField="Nombre" DataValueField="CveDispositivosGrupos" CssClass="form-control input-sm select2me">
<asp:ListItem Selected="True" Value="-1" Text="Todos"></asp:ListItem>
<asp:ListItem Value="0" Text="Solicitada"></asp:ListItem>
<asp:ListItem Value="1" Text="Autorizada"></asp:ListItem>
<asp:ListItem Value="2" Text="Aplicada"></asp:ListItem>
<asp:ListItem Value="3" Text="Rechazada"></asp:ListItem>
</asp:DropDownList>
</li>
</ul>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" DataKeyNames="CveAutorizacion,CveCliente,CveVendedor,Importe"
EmptyDataText="No se encontraron autorizaciones" ToolTip="Listado de autorizaciones"
CssClass="table table-striped table-advance table-hover ScrollAD mysmallbtn" data-sort="true" Width="100%" GridLines="None">
<Columns>
<asp:HyperLinkField DataTextField="NombreComercial" Target="_blank" HeaderText="Cliente" DataNavigateUrlFields="CveCliente" DataNavigateUrlFormatString="/Ventas/Clientes.aspx?CveCliente={0}" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="20%" />
<asp:BoundField DataField="Vendedor" HeaderText="Vendedor" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="15%" />
<asp:BoundField DataField="Importe" ItemStyle-Width="15%" HeaderText="Importe" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:N2}" />
<asp:BoundField DataField="LimiteCredito" ItemStyle-Width="15%" HeaderText="Limite Credito" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:N2}" />
<asp:BoundField DataField="Saldo" ItemStyle-Width="15%" HeaderText="Saldo" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:N2}" />
<asp:BoundField DataField="FechaIng" ItemStyle-Width="10%" HeaderText="Fecha de Ingreso" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:d}" />
<asp:BoundField DataField="TipoAutorizacionTexto" HeaderText="Tipo" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="10%" />
<asp:BoundField DataField="TipoDocumento" HeaderText="Tipo Documento" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="10%" />
<asp:BoundField DataField="Usuario" HeaderText="Usuario" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Left" />
<asp:TemplateField HeaderText="Estatus" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%">
<ItemTemplate>
<asp:Label ID="LblEstatus" Text='<%# Eval("Estatus") %>' runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="5%" HeaderText="Autorizar/Rechazar">
<ItemTemplate>
<asp:LinkButton data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea autorizar el limite?" data-btn-ok-label="si" ID="LnkAutorizar" OnClick="LnkAutorizar_Click" CssClass="btn btn-circle btn-sm green" runat="server" Text="<i class='fa fa-check'></i>"></asp:LinkButton>
<asp:LinkButton data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea rechazar el limite?" data-btn-ok-label="si" ID="LnkRechazar" OnClick="LnkRechazar_Click" CssClass="btn btn-circle btn-sm red" runat="server" Text="<i class='fa fa-times'></i>"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="5%" HeaderText="Eliminar">
<ItemTemplate>
<asp:LinkButton ID="LnkEliminar" OnClick="LnkEliminar_Click" runat="server" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea eliminar el limite?" data-btn-ok-label="si" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
<div id="DModal" class="modal ADS fade" role="dialog">
<asp:UpdatePanel class="modal-dialog" runat="server" ID="UpModal" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content">
<div class="modal-header ">
<h4 class="modal-title">
<asp:Literal ID="ltlMotititulo" Text="Medida" runat="server"> </asp:Literal></h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<label class="labelddl">Cliente:</label>
</div>
</div>
<div class="row">
<div class="col-md-12">
<ADS:Dropdownlost CssClassDdl="select2me" ID="DdlCliente" Width="100%" data-metodo="getcliente" runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" CssStyle="width: 100%;"></ADS:Dropdownlost>
</div>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlVendedor" CssClass="form-control marginFixRow select2me" runat="server" AppendDataBoundItems="true" DataTextField="Vendedor" DataValueField="CveVendedor" Width="100%">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVVendedor" runat="server" ControlToValidate="DdlVendedor" InitialValue="-1" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Vendedor''</b> es necesario, por favor seleccione uno." ValidationGroup="VgmGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEClasificacion" runat="server" HighlightCssClass="vco" TargetControlID="RFVVendedor" Width="300px"></ajax:ValidatorCalloutExtender>
<label for="<%= DdlVendedor.ClientID.ToString()%>">Vendedor:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlTipoDocto" runat="server" Width="100%" CssClass="form-control marginFixRow select2me" AutoPostBack="true" OnSelectedIndexChanged="DdlTipoDocto_SelectedIndexChanged">
<asp:ListItem Value="Ing" Selected="True" Text="Factura de Ingreso"></asp:ListItem>
<asp:ListItem Value="Egs" Text="Nota de crédito"></asp:ListItem>
</asp:DropDownList>
<label for="<%= DdlTipoDocto.ClientID.ToString()%>">Tipo Documento:</label>
</div>
<div id="DivAutorizacion" runat="server" class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlTipoAutorizacion" runat="server" Width="100%" CssClass="form-control marginFixRow select2me" AutoPostBack="true" OnSelectedIndexChanged="DdlTipoAutorizacion_SelectedIndexChanged">
<asp:ListItem Selected="True" Value="-1" Text="Seleccione"></asp:ListItem>
<asp:ListItem Value="1" Text="Importe"></asp:ListItem>
<asp:ListItem Value="2" Text="Vencimiento"></asp:ListItem>
</asp:DropDownList>
<label for="<%= DdlTipoAutorizacion.ClientID.ToString()%>">Tipo Autorización:</label>
</div>
<div id="DivImporte" runat="server" class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtPrecio" inputmode="numeric" runat="server" onkeyup="Recalcula();" CausesValidation="true" lang="nb" ClientIDMode="Static" Text="0.00" MaxLength="12" ValidationGroup="GrpAddVenta" Width="200px" CssClass="form-control "></asp:TextBox>
<%--<ajax:MaskedEditExtender ID="MEEPrecio" runat="server" TargetControlID="TxtPrecio" ClearMaskOnLostFocus="false" MaskType="Number" Mask="9,999.99" InputDirection="RightToLeft" DisplayMoney="Left"></ajax:MaskedEditExtender>--%>
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" runat="server" TargetControlID="TxtPrecio" FilterType="Custom, Numbers" ValidChars="." />
<asp:RequiredFieldValidator ID="RFVPrecio" runat="server" ControlToValidate="TxtPrecio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCPrecio" runat="server" HighlightCssClass="vco" TargetControlID="RFVPrecio" Width="300px"></ajax:ValidatorCalloutExtender>
<asp:CustomValidator ID="CVPrecio" runat="server" ClientValidationFunction="ValidaDecimal6digits" ControlToValidate="TxtPrecio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> no tiene el formato correcto. Por favor rectifique y vuelva a intentar." ValidateEmptyText="True" ValidationGroup="GrpAddVenta"></asp:CustomValidator>
<ajax:ValidatorCalloutExtender ID="VCEPrecio" runat="server" HighlightCssClass="vco" TargetControlID="CVPrecio" Width="300px"></ajax:ValidatorCalloutExtender>
<label for="<%= TxtPrecio.ClientID.ToString()%>">Importe:</label>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="BtnGuardar" OnClick="BtnGuardar_Click" runat="server" Text="Agregar" CssClass="btn btn-primary" ValidationGroup="VgmGuardar" />
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
</asp:Content>

View File

@@ -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()

View File

@@ -367,6 +367,9 @@
<li>
<asp:HyperLink ID="HlFacturasRelaciondas" Visible="false" NavigateUrl="#" data-toggle="modal" data-backdrop="static" data-keyboard="false" data-target="#DivFacturasRelaciondas" runat="server"><i class='fa fa-file'></i> Relacionar Facturas</asp:HyperLink>
</li>
<li>
<asp:LinkButton ID="LnkSolicitarCredito" Visible="false" runat="server"><i class="fa fa-plus"></i>Solicitar autorización de crédito</asp:LinkButton>
</li>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="LnkImprimir" EventName="Click" />
@@ -3657,7 +3660,7 @@
</div>
<div class="col-md-4" align="right">
<div class="row">
<div class="row">
<div class="col-md-12" align="right" style="padding-bottom: 15px;">
<asp:UpdatePanel ID="UpFacturar" runat="server" class="portlet light xspadding bordered " style="width: 300px;" align="right" UpdateMode="Conditional">
<Triggers>
@@ -3765,23 +3768,23 @@
<tr runat="server" id="Tr3">
<td align="center" style="" runat="server" id="tdAdjuntar">
<asp:LinkButton ID="BtnAdjuntar" runat="server" Text="Adjuntar" data-toggle="modal" data-target="#ModalAdjuntar" CssClass="btn myventasbutton btn-primary" />
<asp:LinkButton ID="BtnAdjuntar" runat="server" Text="Adjuntar" data-toggle="modal" data-target="#ModalAdjuntar" CssClass="btn myventasbutton btn-primary" />
</td>
<td align="left" style="display: none;" runat="server" id="tdAdjunto">
<div class="col-md-6">
<asp:LinkButton ID="BtnArchivoAdjunto" runat="server" Text="" Font-Size="14px" />
</div>
<div class="col-md-6" style="text-align: right;">
<asp:LinkButton ID="BtnEliminarAdjunto" runat="server" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="confirmar" data-btn-ok-label="si" Visible="false"/>
<asp:LinkButton ID="BtnEliminarAdjunto" runat="server" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="confirmar" data-btn-ok-label="si" Visible="false" />
</div>
</td>
</tr>
</table>
</div>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="BtnArchivoAdjunto" />
</Triggers>
<Triggers>
<asp:PostBackTrigger ControlID="BtnArchivoAdjunto" />
</Triggers>
</asp:UpdatePanel>
</div>
@@ -6239,7 +6242,7 @@
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Facturas Relacionadas</h4>
</div>
<div class="modal-body" style="width:900px;">
<div class="modal-body" style="width: 900px;">
<div class="row">
<div class="col-md-2">
<label>Relación:</label>
@@ -6267,7 +6270,7 @@
<label>Folio Fiscal:</label>
</div>
<div class="col-md-8">
<asp:TextBox ID="TxtFolioFiscalRelacionar" runat="server" Text="" Width="100%" CssClass="form-control input-sm"></asp:TextBox>
<asp:TextBox ID="TxtFolioFiscalRelacionar" runat="server" Text="" Width="100%" CssClass="form-control input-sm"></asp:TextBox>
</div>
<div class="col-md-2">
<asp:LinkButton ID="LnkAgregarFolioFiscalRelacionada" runat="server" CssClass="btn btn-sm btn-primary" OnClick="LnkAgregarFolioFiscalRelacionada_Click"><i class="fa fa-plus"></i>Agregar Folio</asp:LinkButton>
@@ -6312,8 +6315,9 @@
<asp:UpdatePanel runat="server" ID="UpdatePanel3" UpdateMode="Conditional">
<ContentTemplate>
<div class="row">
<div class="col-md-2"> Folio Fiscal</div>
<div class="col-md-10"> <asp:TextBox ID="TxtModalFolioFiscal" runat="server" Width="100%"></asp:TextBox></div>
<div class="col-md-2">Folio Fiscal</div>
<div class="col-md-10">
<asp:TextBox ID="TxtModalFolioFiscal" runat="server" Width="100%"></asp:TextBox></div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
@@ -7539,6 +7543,47 @@
</div>
</div>
<div id="DivModalSolicitarCredito" class="modal ADS fade" role="dialog">
<asp:UpdatePanel class="modal-dialog" runat="server" ID="UpModalSolicitud" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content">
<div class="modal-header ">
<h4 class="modal-title">Solicitar crédito</h4>
</div>
<div class="modal-body">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlTipoDocto" runat="server" Width="100%" CssClass="form-control marginFixRow select2me" AutoPostBack="true">
<asp:ListItem Value="Ing" Selected="True" Text="Factura de Ingreso"></asp:ListItem>
<asp:ListItem Value="Egs" Text="Nota de crédito"></asp:ListItem>
</asp:DropDownList>
<label for="<%= DdlTipoDocto.ClientID.ToString()%>">Tipo Documento:</label>
</div>
<div id="DivAutorizacion" runat="server" class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlTipoAutorizacion" runat="server" Width="100%" CssClass="form-control marginFixRow select2me" AutoPostBack="true">
<asp:ListItem Selected="True" Value="-1" Text="Seleccione"></asp:ListItem>
<asp:ListItem Value="1" Text="Importe"></asp:ListItem>
<asp:ListItem Value="2" Text="Vencimiento"></asp:ListItem>
</asp:DropDownList>
<label for="<%= DdlTipoAutorizacion.ClientID.ToString()%>">Tipo Autorización:</label>
</div>
<div id="DivImporteSolicitud" runat="server" class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtImporteSolicitud" inputmode="numeric" runat="server" CausesValidation="true" lang="nb" ClientIDMode="Static" Text="0.00" MaxLength="12" ValidationGroup="VgmGuardarAut" Width="200px" CssClass="form-control "></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTBImporteSolicitud" runat="server" TargetControlID="TxtImporteSolicitud" FilterType="Custom, Numbers" ValidChars="." />
<asp:RequiredFieldValidator ID="RFVImporteSolicitud" runat="server" ControlToValidate="TxtImporteSolicitud" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Importe''</b> es necesario, por favor ingréselo." ValidationGroup="VgmGuardarAut"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender6" runat="server" HighlightCssClass="vco" TargetControlID="RFVImporteSolicitud" Width="300px"></ajax:ValidatorCalloutExtender>
<asp:CustomValidator ID="CVImporteSolcitud" runat="server" ClientValidationFunction="ValidaDecimal6digits" ControlToValidate="TxtImporteSolicitud" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Importe''</b> no tiene el formato correcto. Por favor rectifique y vuelva a intentar." ValidateEmptyText="True" ValidationGroup="VgmGuardarAut"></asp:CustomValidator>
<ajax:ValidatorCalloutExtender ID="VCEImporteSolicitud" runat="server" HighlightCssClass="vco" TargetControlID="CVImporteSolcitud" Width="300px"></ajax:ValidatorCalloutExtender>
<label for="<%= TxtImporteSolicitud.ClientID.ToString()%>">Importe:</label>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="BtnSolicitarCredito" runat="server" Text="Agregar" CssClass="btn btn-primary" ValidationGroup="VgmGuardarAut" />
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
<script src="/Metronic/assets/global/scripts/jquery-sortable.js"></script>
@@ -7672,12 +7717,20 @@
Importe = ToDouble(Importe.toFixed(2));
if (Importe > 0) {
let pu = (ImporteTotal / CantidadPendiente);
if (pu > 0) {
TxtCantidad.value = (Importe / pu).toString();
}
const cantidadSugerida = (Importe / pu);
if (cantidadSugerida > CantidadPendiente) {
TxtCantidad.value = CantidadPendiente.toString();
}else {
TxtCantidad.value = cantidadSugerida.toString();
}
}else {
TxtCantidad.value = "0";
}
}else {
TxtCantidad.value = "0";
@@ -8616,7 +8669,7 @@
}
//Suma Totales
function FnSuma() {
function FnSuma() {
debugger;
$get('TxtSubTotal2').value = FormatoNumero(ToDouble($get('TxtSubTotal').value) - ToDouble($get('LblDescuentos').innerHTML) - ToDouble($get('LblAmortizacion').innerHTML), 2);
var totalVenta = ToDouble($get('TxtSubTotal2').value) + ToDouble($get('TxtIVA').value) + ToDouble($get('TxtIEPS') ? ToDouble($get('TxtIEPS').value) : 0) - ToDouble($get('TxtRetIVA') ? $get('TxtRetIVA').value : 0) - ToDouble($get('TxtRetISR') ? $get('TxtRetISR').value:0);

View File

@@ -1847,6 +1847,14 @@ Partial Class Ventas
ViewState("EsDiasCreditoFijo") = value
End Set
End Property
Private Property TieneDiasVencidos As Boolean
Get
Return CBool(IfNull(ViewState("TieneDiasVencidos"), "False", ViewState("TieneDiasVencidos")))
End Get
Set(value As Boolean)
ViewState("TieneDiasVencidos") = value
End Set
End Property
Private Property VentaSaldoAlmacen As Decimal
Get
Return ViewState("VentaSaldoAlmacen").ToString().ToDecimal
@@ -1952,6 +1960,15 @@ Partial Class Ventas
End Set
End Property
Private Property CveAutorizacion As Integer
Get
Return (IfNull(ViewState("CveAutorizacion"), "-1", ViewState("CveAutorizacion"))).ToString().ToEntero()
End Get
Set(value As Integer)
ViewState("CveAutorizacion") = value
End Set
End Property
#End Region
'#Region "AuxiliarConta"
@@ -2147,6 +2164,10 @@ Partial Class Ventas
DivPenalizacion.Visible = True
End If
If UsuarioActual.CveRol = 1 Then
LnkSolicitarCredito.Visible = True
End If
DdlSATPS.setEsWebService(True) : DdlSATPS.Attributes.Add("data-metodo", "getpssat")
DivPSSAT.Visible = True
@@ -4245,6 +4266,11 @@ Partial Class Ventas
LblNCSaldoAnticipo.Visible = True
ChkAplicaNCAnticipo.Visible = True
ChkAplicaNCAnticipo.Checked = True
If SaldoVenta > 0 And UsuarioActual.TienePermisoProceso(100) Then
HLPagar.Visible = True
HLPagar.NavigateUrl = $"/Bancos/PopIEVentas.aspx?CveVenta={CveVenta}&TB_iframe=true&height=500&width=675"
HlCuentaTerminal.Visible = True
End If
Me.SaldoAnticipo = DbRowVenta("SaldoAnticipo").ToString().ToDecimal
If SaldoAnticipo > 0 Then
InicializaDTAnticiposAmortizacion()
@@ -5503,6 +5529,7 @@ Partial Class Ventas
LnkAgregarCliente.Visible = False
ClienteEsDistribuidor = Boolean.Parse(ObjCliente.DtResultados.Rows(0)("EsDistribuidor").ToString())
TieneDiasVencidos = Boolean.Parse(ObjCliente.DtResultados.Rows(0)("TieneDiasVencidos").ToString())
If EstatusCliente = False And Not DdlTipoComprobante.SelectedValue.Contiene("Cot", "DPe") And (CveVenta <= 0 Or EsCreaApartirDe) Then
Alert("El Cliente seleccionado no esta activo", TipoMensaje.MsgAdvertencia)
@@ -7817,6 +7844,64 @@ Partial Class Ventas
Exit Sub
End If
Me.CveAutorizacion = -1
'SI ES A CREDITO DEBE VERIFICAR SI TIENE AUTORIZACIONES
If UsuarioActual.CveRol = 1 AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso CveCliente > 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Egs") AndAlso RBLPago.SelectedValue = "1" Then
Dim TipoDocumentoAutorizacion As String = ""
Dim ImporteAutorizacion As Decimal = 0
Dim TipoAutorizacion As Integer = 0
Dim CveVendedor As Integer = DdlVendedor.SelectedValue.ToEntero()
Dim ObjVentas As New ClsVentas
Try
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, CveEstatus:=1) Then
Dim RowAutorizacion As DataRow = ObjVentas.DtResultados.FiltroPrimero($"CveVenta IS NULL AND CveTipoDocumento='{DdlTipoComprobante.SelectedValue}'", Orderby:="TipoAutorizacion")
If RowAutorizacion IsNot Nothing Then
TipoDocumentoAutorizacion = RowAutorizacion("CveTipoDocumento").ToString()
ImporteAutorizacion = RowAutorizacion("Importe").ToString().ToDecimal()
CveAutorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero()
TipoAutorizacion = RowAutorizacion("TipoAutorizacion").ToString().ToEntero()
End If
End If
Catch ex As Exception
OnError("Ocurrió un error al obtener las autorizaciones", ex)
End Try
ObjVentas.Dispose()
If TipoDocumentoAutorizacion = "Ing" Then
If TipoAutorizacion = 1 Then
If ImporteAutorizacion < TxtTotal.Text.ToDecimal() Then
CveAutorizacion = -1
Alert($"El crédito autorizado es insuficiente. Crédito Disponible:{ImporteAutorizacion:N2}", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If TieneDiasVencidos Then
CveAutorizacion = -1
Alert($"El crédito no esta autorizado. El cliente tiene días vencidos", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
'SI NO SE ENCONTRO NINGUA AUTORIZACION
If TipoAutorizacion = 0 Then
If TieneDiasVencidos Then
CveAutorizacion = -1
Alert($"El crédito no esta autorizado. El cliente tiene días vencidos", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
End If
If DdlTipoComprobante.SelectedValue = "Egs" AndAlso CveAutorizacion <= 0 Then
CveAutorizacion = -1
Alert($"El crédito no esta autorizado. No tiene autorización para generar notas de crédito.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
EmitirImprimirNew(TipoDoctoViejo)
End Sub
@@ -10478,7 +10563,7 @@ Partial Class Ventas
End If
Dim totSubTotal As Decimal = Obj.SubTotal
Dim totSubTotal As Decimal = If(UsuarioActual.Empresa.CvePAC = 3, Obj.DtDetalle.SUMD("Total"), Obj.SubTotal) 'Obj.SubTotal
Dim totIVA As Decimal = Obj.IVA
Dim totRetIVA As Decimal = Obj.RetIVA
Dim totRetISR As Decimal = Obj.RetISR
@@ -11147,6 +11232,12 @@ Partial Class Ventas
factura.Timbre.Comprobante.Serie = ObjVentas.Serie
factura.Timbre.Comprobante.Folio = ObjVentas.Folio.ToString()
If UsuarioActual.CveRol = 1 AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso factura.TipoDocto = "Ing" AndAlso Me.CveAutorizacion > 0 Then
If Not ObjVentas.UpdateAutorizacionLimite(Me.CveAutorizacion, factura.CveCliente, factura.CveVenta) Then
ErrorList.Add("Error al guardar los limites de la autorizacion")
End If
End If
If ObjFactura.TipoDocto = "Ing" Then
If Not GuardarUsados(2, ObjVentas.IniciaTransacSQL, factura) Then
ErrorList.Add("Error al guardar usados")
@@ -31691,5 +31782,45 @@ Partial Class Ventas
BtnEliminarAdjunto.Visible = False
UpAdjuntar.Update()
End Sub
Protected Sub LnkSolicitarCredito_Click(sender As Object, e As EventArgs) Handles LnkSolicitarCredito.Click
If CveCliente <= 0 Then
Alert("Debe seleccionar un cliente", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If DdlVendedor.SelectedValue.ToEntero() <= 0 Then
Alert("Debe seleccionar un vendedor", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
TxtImporteSolicitud.Text = ""
RegistraScript("$('#DivModalSolicitarCredito').modal('show')")
UpModalSolicitud.Update()
End Sub
Protected Sub BtnSolicitarCredito_Click(sender As Object, e As EventArgs) Handles BtnSolicitarCredito.Click
Dim ObjPS As New ClsVentas
If ObjPS.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero(), TxtImporteSolicitud.Text.ToDecimal(), 0, UsuarioActual.CveUsuario, DdlTipoAutorizacion.SelectedValue.ToEntero(), TipoDocumento:=DdlTipoDocto.SelectedValue) Then
RegistraScript("$('#DivModalSolicitarCredito').modal('hide')")
Alert("La autorización se agregó correctamente.", TipoMensaje.MsgInformacion)
End If
ObjPS.Dispose()
UpModalSolicitud.Update()
End Sub
Protected Sub DdlTipoAutorizacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoAutorizacion.SelectedIndexChanged
DivImporteSolicitud.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 1
UpModalSolicitud.Update()
End Sub
Protected Sub DdlTipoDocto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoDocto.SelectedIndexChanged
Dim TipoDocto As String = DdlTipoDocto.SelectedValue.ToString()
Select Case TipoDocto
Case "Ing"
DivAutorizacion.Visible = True
DivImporteSolicitud.Visible = True
Case "Egs"
DivAutorizacion.Visible = False
DivImporteSolicitud.Visible = False
End Select
UpModalSolicitud.Update()
End Sub
End Class