--FIX merge
This commit is contained in:
@@ -1665,7 +1665,6 @@ Partial Class Ventas
|
||||
ViewState("CveOC") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property RegistroxOC As Boolean
|
||||
Get
|
||||
Return CBool(IfNull(ViewState("RegistroxOC"), False))
|
||||
@@ -1674,8 +1673,6 @@ Partial Class Ventas
|
||||
ViewState("RegistroxOC") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
Private Property EnviarCorreoCliente As Boolean
|
||||
Get
|
||||
Return CBool(IfNull(ViewState("EnviarCorreoCliente"), False))
|
||||
@@ -2598,10 +2595,6 @@ Partial Class Ventas
|
||||
CargaGestionCobranza()
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(595) = "2" Then
|
||||
LnkSolicitarCredito.Visible = True
|
||||
End If
|
||||
|
||||
DdlSATPS.setEsWebService(True) : DdlSATPS.Attributes.Add("data-metodo", "getpssat")
|
||||
DivPSSAT.Visible = True
|
||||
|
||||
@@ -7709,6 +7702,8 @@ Partial Class Ventas
|
||||
Private Sub CargaRestriccionesCreditoCliente(Optional Alertas As Boolean = False, Optional CveVenta As Integer = -1)
|
||||
|
||||
Dim ValorAutorizacion As String = UsuarioActual.Empresa.Funcionalidad(595)
|
||||
'solo para bdh, que se generen NC
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then DdlSolCreditoTipoDocto.Items.Add(New ListItem("Nota de crédito", "Egs"))
|
||||
|
||||
'OBLIGAR PAGO DE CONTADO SI EL CLIENTE NO PERMITE CREDITO
|
||||
If Not EsFilial AndAlso (Not UsuarioActual.Empresa.Funcionalidad(702).Contiene("1")) AndAlso Me.PermiteCredito = False AndAlso ((DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot") AndAlso CveVenta < 1) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso EsCreaApartirDe) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveVenta > 0)) Then
|
||||
@@ -7750,7 +7745,7 @@ Partial Class Ventas
|
||||
|
||||
If Me.PermiteCredito Then
|
||||
If IfNull(Request("Op"), "").ToString() = "Cot" OrElse (DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0) Then
|
||||
Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero())
|
||||
Dim CreditoDispo As Decimal = GetSaldoCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero())
|
||||
If CreditoDispo > 0 Then
|
||||
TrCreditoDisponible.Visible = True
|
||||
LblCreditoDisponible.Text = String.Format("{0:C}", CreditoDispo)
|
||||
@@ -7778,7 +7773,7 @@ Partial Class Ventas
|
||||
UPCondicionesPago.Update()
|
||||
End If
|
||||
|
||||
Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero())
|
||||
Dim CreditoDispo As Decimal = GetSaldoCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero())
|
||||
|
||||
If CreditoDispo > 0 Then
|
||||
TrCreditoDisponible.Visible = True
|
||||
@@ -7801,7 +7796,7 @@ Partial Class Ventas
|
||||
If Not EsCreaApartirDe AndAlso (DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0) Then
|
||||
DdlTipoComprobante.SelectedValueExist("Cot")
|
||||
Else
|
||||
If UsuarioActual.Empresa.Funcionalidad(595) = "1" Then
|
||||
If ValorAutorizacion = "1" Then
|
||||
DdlTipoComprobante.SelectedValueExistInsert("PA", "Autorización")
|
||||
DdlTipoComprobante.SelectedValue = "PA"
|
||||
|
||||
@@ -7814,7 +7809,7 @@ Partial Class Ventas
|
||||
If IfNull(Request("Op"), "").ToString() = "Cot" OrElse (DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0) Then DdlTipoComprobante.SelectedValue = "Cot"
|
||||
|
||||
'quito remisión y factura
|
||||
If UsuarioActual.Empresa.Funcionalidad(595) <> "2" Then
|
||||
If ValorAutorizacion = "1" Then
|
||||
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing"))
|
||||
If Not UsuarioActual.TienePermisoProceso(325) Then
|
||||
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant"))
|
||||
@@ -7839,7 +7834,6 @@ Partial Class Ventas
|
||||
|
||||
If Bloqueo AndAlso ValorAutorizacion = "2" Then
|
||||
Dim Autorizacion As Integer = 0
|
||||
|
||||
Dim ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero, "Ing", CveEstatus:=1) Then
|
||||
Dim RowAutorizacion As DataRow = Nothing
|
||||
@@ -7862,6 +7856,16 @@ Partial Class Ventas
|
||||
TieneBloqueoPorCreditoVencimiento = 0
|
||||
Alert("El cliente tiene una autorización aprobada", TipoMensaje.ToastInformacion)
|
||||
End If
|
||||
LnkSolicitarCredito.Visible = True
|
||||
DdlTipoAutorizacion.SelectedValueExist("1")
|
||||
End If
|
||||
|
||||
If Bloqueo AndAlso ValorAutorizacion = "3" Then ' autorización con vinculación a una venta registrada
|
||||
TrCredito1.Visible = True
|
||||
ChkSolicitudAutorizacionCredito.Checked = True
|
||||
LnkSolicitarCredito.Visible = True
|
||||
divModalidad2.Visible = False
|
||||
divModalidad3.Visible = True
|
||||
End If
|
||||
|
||||
'SI ES AUTORIZACION DEBE PERMITIR GENERARLA
|
||||
@@ -7999,16 +8003,7 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
Case "2" 'Autorizacion desde una solicitud del catalogo de autorizaciones
|
||||
'RMF. validacion temporal
|
||||
'verifica si tiene autorizaciones de Nota de crédito autorizadas
|
||||
'Dim ObjVentas As New ClsVentas
|
||||
'If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, -1, "Ing", CveEstatus:=1) Then
|
||||
' Dim RowAutorizacion As DataRow = ObjVentas.DtResultados.FiltroPrimero($"CveVenta IS NULL AND CveTipoDocumento='Egs'", Orderby:="TipoAutorizacion")
|
||||
' If RowAutorizacion IsNot Nothing Then
|
||||
' DdlTipoComprobante.SelectedValueExistInsert("Egs", "Egresos")
|
||||
' End If
|
||||
'End If
|
||||
'ObjVentas.Dispose()
|
||||
|
||||
Dim Vta As New ClsVentas
|
||||
Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa)
|
||||
Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón: <br> <br> {0}", Vta.SerieVenta)
|
||||
@@ -8128,7 +8123,7 @@ Partial Class Ventas
|
||||
|
||||
'CREDITO NO SUFICIENTE
|
||||
If Opcion = 3 Then
|
||||
'Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero())
|
||||
'Dim CreditoDispo As Decimal = GetSaldoCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero())
|
||||
'If CreditoDispo < 0 AndAlso RBLPago.SelectedValue = "1" Then
|
||||
' BloquearCliente = True
|
||||
'End If
|
||||
@@ -8295,7 +8290,7 @@ Partial Class Ventas
|
||||
Alert("La Sucursal/Departamento del cliente se encuentra inactivo", TipoMensaje.MsgAdvertencia)
|
||||
Else
|
||||
RBLPago.Items(0).Enabled = True
|
||||
Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero(), ObjVentas)
|
||||
Dim CreditoDispo As Decimal = GetSaldoCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero(), ObjVentas)
|
||||
|
||||
TrCreditoDisponible.Visible = True
|
||||
LblCreditoDisponible.Text = String.Format("{0:C}", CreditoDispo)
|
||||
@@ -8435,7 +8430,7 @@ Partial Class Ventas
|
||||
UpCliente.Update()
|
||||
UpEmitirTransitorio.Update()
|
||||
End Sub
|
||||
Private Function CargaCreditoDisponible(tCveCliente As Integer, tCveSucursalCliente As Integer, Optional ByRef ObjVentas As ClsVentas = Nothing) As Decimal
|
||||
Private Function GetSaldoCreditoDisponible(tCveCliente As Integer, tCveSucursalCliente As Integer, Optional ByRef ObjVentas As ClsVentas = Nothing) As Decimal
|
||||
Dim Retorno As Decimal = 0
|
||||
Dim ObjVentasAplciar As ClsVentas = Nothing
|
||||
If ObjVentas IsNot Nothing Then
|
||||
@@ -9083,9 +9078,9 @@ Partial Class Ventas
|
||||
GvPS.DataBind()
|
||||
End Sub
|
||||
Protected Sub GvPS_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvPS.RowUpdating
|
||||
'Dim TipoDescuento As Integer
|
||||
Dim CvePSNuevo As Integer = GvPS.Rows(e.RowIndex).FCDropDownLost("DdlPS").SelectedValue.ToEntero()
|
||||
|
||||
Dim CvePSNuevo As Integer = GvPS.Rows(e.RowIndex).FCDropDownLost("DdlPS").SelectedValue.ToEntero()
|
||||
Dim CvePSAnterior As Integer = GvPS.Rows(e.RowIndex).DataKey("CvePS").ToEntero
|
||||
Dim Cantidad, PU As Decimal
|
||||
Dim ObjDescuento As New Modelos.VentaDescuentos
|
||||
Dim CuentaPredial As String
|
||||
@@ -9112,7 +9107,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
'SI ESTA HABILITADO LA OPCION DE DESCUENTO, SE AGREGO UN DESCUENTO MANUAL Y NO TIENE PROMOCION
|
||||
If GvPS.Rows(e.RowIndex).FCTextBox("TxtDescuento").Enabled Then
|
||||
If GvPS.Rows(e.RowIndex).FCTextBox("TxtDescuento").Enabled AndAlso CvePSAnterior = CvePSNuevo Then 'AndAlso (ObjDescuento.CvePromocionDetalle <= 0 AndAlso ObjDescuento.ImporteDescuento <= 0) Then
|
||||
ObjDescuento.ImporteDescuento = DescuentoManual
|
||||
End If
|
||||
|
||||
@@ -10904,6 +10899,35 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
If ErrorList.Count = 0 AndAlso ObjFactura.CveVenta > 0 AndAlso ChkSolicitudAutorizacionCredito.Checked Then
|
||||
' crea la solicitud de autorización de crédito
|
||||
Dim tCveTipoAutorizacion As Integer = 1
|
||||
If ObjVentas.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero(), TxtTotal.Text.ToDecimal(), 0, UsuarioActual.CveUsuario, tCveTipoAutorizacion, TipoDocumento:=DdlTipoComprobante.SelectedValue, DiasVencidos:=25, CveVenta:=ObjFactura.CveVenta) Then
|
||||
Alert("La autorización se agregó correctamente.", TipoMensaje.MsgInformacion)
|
||||
Dim Arr As New ArrayList
|
||||
|
||||
Arr.Add(NombreCliente)
|
||||
Arr.Add($" $ {TxtTotal.Text.ToDecimal}")
|
||||
Arr.Add(DdlSubProyectoDatos.SelectedItem.Text)
|
||||
Dim dtt As DataTable = Nothing
|
||||
Dim ObjProceso As New ClsSisProcesos
|
||||
If ObjProceso.GetUsuariosconProceso(379, UsuarioActual.CveEmpresa) Then 'proceso para autorizar
|
||||
dtt = ObjProceso.DtResultados.FiltraParametros("", DistinctColumns:={"CveUsuario", "Celular"})
|
||||
End If
|
||||
If dtt IsNot Nothing AndAlso dtt.Rows.Count > 0 Then
|
||||
For Each dr As DataRow In dtt.Rows
|
||||
Dim NumeroTelefono = "526621143532"
|
||||
If EsProduccion Then
|
||||
NumeroTelefono = String.Format("52{0}", dr("Celular").ToString())
|
||||
End If
|
||||
EnviarNotificacionWhatsAppPlantilla(NumeroTelefono, "solicitud_autorizacion_credito2", Arr)
|
||||
'ClsSisNotificaciones.EnviarAlerta("Solicitud de Autorización de crédito", $"Solicitud de autorización de crédito Folio: {Folio} <br/><a href='/Ventas/Clientes.aspx?CveCliente={CveCliente}&op=ant'>Ir Activar</a>", dr("CveUsuario").ToString, Tipo:=TipoNotificacion.ToastInformacionB)
|
||||
Next
|
||||
End If
|
||||
ObjProceso.Dispose()
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
'Paso CRM actualizar importe de acercamiento y guardar en bitacora
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveEmpresaCRM > 0 AndAlso CveAcercamientoCRM > 0 Then
|
||||
@@ -25097,7 +25121,6 @@ Partial Class Ventas
|
||||
TxtCorreoCliente.Text = ""
|
||||
TxtTelefonoCliente.Text = ""
|
||||
|
||||
|
||||
If UsuarioActual.CveEmpresa = 189 Then
|
||||
TxtRFCNombre.Text = ""
|
||||
|
||||
@@ -26073,16 +26096,16 @@ Partial Class Ventas
|
||||
|
||||
Dim RestringirAlmacenes As Integer = -1
|
||||
|
||||
Dim BuscarEnTabla As Boolean = True
|
||||
|
||||
Dim ObjInventarios As New ClsInventarios()
|
||||
If ObjInventarios.GetExistenciasProducto(GvRow.DataKey("CvePS").ToEntero(), -1, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"),
|
||||
ExcluyeApartados:=-1, ExcluyeAdelantado:=1, CveSubProyecto:=-1,
|
||||
ExcluyeTransitorios:=1, RestringirAlmacenes:=RestringirAlmacenes, TopSelect:=100, BuscarEnTabla:=BuscarEnTabla) Then
|
||||
GvVerExistencias.DataSource = ObjInventarios.DtResultados.Copy()
|
||||
End If
|
||||
ObjInventarios.Dispose()
|
||||
|
||||
Dim BuscarEnTabla As Boolean = True
|
||||
|
||||
Dim ObjInventarios As New ClsInventarios()
|
||||
If ObjInventarios.GetExistenciasProducto(GvRow.DataKey("CvePS").ToEntero(), -1, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"),
|
||||
ExcluyeApartados:=-1, ExcluyeAdelantado:=1, CveSubProyecto:=-1,
|
||||
ExcluyeTransitorios:=1, RestringirAlmacenes:=RestringirAlmacenes, TopSelect:=100, BuscarEnTabla:=BuscarEnTabla) Then
|
||||
GvVerExistencias.DataSource = ObjInventarios.DtResultados.Copy()
|
||||
End If
|
||||
ObjInventarios.Dispose()
|
||||
|
||||
GvVerExistencias.DataBind()
|
||||
|
||||
UpVerExistencias.Update()
|
||||
@@ -37336,11 +37359,16 @@ Partial Class Ventas
|
||||
UpModalSolicitud.Update()
|
||||
End Sub
|
||||
Protected Sub BtnSolicitarCredito_Click(sender As Object, e As EventArgs) Handles BtnSolicitarCredito.Click
|
||||
If UsuarioActual.Empresa.Funcionalidad(595) = "3" Then
|
||||
RegistraScript("$('#DivModalSolicitarCredito').modal('hide')")
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim DiasVencidos As Integer = 0
|
||||
Dim CveEstatus As Integer = 0
|
||||
Dim TipoDocto As String = DdlSolCreditoTipoDocto.SelectedValue
|
||||
Dim CveTipoAutorizacion As Integer = DdlTipoAutorizacion.SelectedValue.ToEntero()
|
||||
If CveTipoAutorizacion <= 0 Then
|
||||
If UsuarioActual.Empresa.Funcionalidad(595) <> "3" AndAlso CveTipoAutorizacion <= 0 Then
|
||||
Alert("Debe seleccionar un tipo de autorización", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
@@ -37364,8 +37392,11 @@ Partial Class Ventas
|
||||
UpModalSolicitud.Update()
|
||||
End Sub
|
||||
Protected Sub DdlTipoAutorizacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoAutorizacion.SelectedIndexChanged
|
||||
DivImporteSolicitud.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 1
|
||||
DivDiasVencidos.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 2
|
||||
DivImporteSolicitud.Visible = DdlTipoAutorizacion.SelectedValue = "1"
|
||||
DivDiasVencidos.Visible = DdlTipoAutorizacion.SelectedValue = "2"
|
||||
If Not UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
|
||||
TxtDiasVencidos.Text = "25"
|
||||
End If
|
||||
UpModalSolicitud.Update()
|
||||
End Sub
|
||||
|
||||
@@ -39863,18 +39894,18 @@ Partial Class Ventas
|
||||
End Function
|
||||
Protected Sub GvVerExistencias_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If e.Row.DBCampo("CveAlmacen") = "" Then
|
||||
e.Row.CssClass = "Totales"
|
||||
If e.Row.DBCampo("CveAlmacen") = "" Then
|
||||
e.Row.CssClass = "Totales"
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaGiro()
|
||||
Dim Dt As DataTable = GlobalDTClienteClasificaciones(UsuarioActual.CveEmpresa)
|
||||
DdlGiro.DataSource = Dt
|
||||
DdlGiro.DataBind()
|
||||
DdlGiro.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
UpAgregarCliente.Update()
|
||||
Private Sub CargaGiro()
|
||||
Dim Dt As DataTable = GlobalDTClienteClasificaciones(UsuarioActual.CveEmpresa)
|
||||
DdlGiro.DataSource = Dt
|
||||
DdlGiro.DataBind()
|
||||
DdlGiro.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
UpAgregarCliente.Update()
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user