--FIX merge

This commit is contained in:
2024-12-30 12:11:45 -07:00
parent 0697ed1d86
commit 25f6044e62

View File

@@ -1665,7 +1665,6 @@ Partial Class Ventas
ViewState("CveOC") = value ViewState("CveOC") = value
End Set End Set
End Property End Property
Private Property RegistroxOC As Boolean Private Property RegistroxOC As Boolean
Get Get
Return CBool(IfNull(ViewState("RegistroxOC"), False)) Return CBool(IfNull(ViewState("RegistroxOC"), False))
@@ -1674,8 +1673,6 @@ Partial Class Ventas
ViewState("RegistroxOC") = value ViewState("RegistroxOC") = value
End Set End Set
End Property End Property
Private Property EnviarCorreoCliente As Boolean Private Property EnviarCorreoCliente As Boolean
Get Get
Return CBool(IfNull(ViewState("EnviarCorreoCliente"), False)) Return CBool(IfNull(ViewState("EnviarCorreoCliente"), False))
@@ -2598,10 +2595,6 @@ Partial Class Ventas
CargaGestionCobranza() CargaGestionCobranza()
End If End If
If UsuarioActual.Empresa.Funcionalidad(595) = "2" Then
LnkSolicitarCredito.Visible = True
End If
DdlSATPS.setEsWebService(True) : DdlSATPS.Attributes.Add("data-metodo", "getpssat") DdlSATPS.setEsWebService(True) : DdlSATPS.Attributes.Add("data-metodo", "getpssat")
DivPSSAT.Visible = True DivPSSAT.Visible = True
@@ -7709,6 +7702,8 @@ Partial Class Ventas
Private Sub CargaRestriccionesCreditoCliente(Optional Alertas As Boolean = False, Optional CveVenta As Integer = -1) Private Sub CargaRestriccionesCreditoCliente(Optional Alertas As Boolean = False, Optional CveVenta As Integer = -1)
Dim ValorAutorizacion As String = UsuarioActual.Empresa.Funcionalidad(595) 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 '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 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 Me.PermiteCredito Then
If IfNull(Request("Op"), "").ToString() = "Cot" OrElse (DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0) 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 If CreditoDispo > 0 Then
TrCreditoDisponible.Visible = True TrCreditoDisponible.Visible = True
LblCreditoDisponible.Text = String.Format("{0:C}", CreditoDispo) LblCreditoDisponible.Text = String.Format("{0:C}", CreditoDispo)
@@ -7778,7 +7773,7 @@ Partial Class Ventas
UPCondicionesPago.Update() UPCondicionesPago.Update()
End If End If
Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) Dim CreditoDispo As Decimal = GetSaldoCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero())
If CreditoDispo > 0 Then If CreditoDispo > 0 Then
TrCreditoDisponible.Visible = True TrCreditoDisponible.Visible = True
@@ -7801,7 +7796,7 @@ Partial Class Ventas
If Not EsCreaApartirDe AndAlso (DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0) Then If Not EsCreaApartirDe AndAlso (DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0) Then
DdlTipoComprobante.SelectedValueExist("Cot") DdlTipoComprobante.SelectedValueExist("Cot")
Else Else
If UsuarioActual.Empresa.Funcionalidad(595) = "1" Then If ValorAutorizacion = "1" Then
DdlTipoComprobante.SelectedValueExistInsert("PA", "Autorización") DdlTipoComprobante.SelectedValueExistInsert("PA", "Autorización")
DdlTipoComprobante.SelectedValue = "PA" 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" If IfNull(Request("Op"), "").ToString() = "Cot" OrElse (DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0) Then DdlTipoComprobante.SelectedValue = "Cot"
'quito remisión y factura 'quito remisión y factura
If UsuarioActual.Empresa.Funcionalidad(595) <> "2" Then If ValorAutorizacion = "1" Then
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing")) DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing"))
If Not UsuarioActual.TienePermisoProceso(325) Then If Not UsuarioActual.TienePermisoProceso(325) Then
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant"))
@@ -7839,7 +7834,6 @@ Partial Class Ventas
If Bloqueo AndAlso ValorAutorizacion = "2" Then If Bloqueo AndAlso ValorAutorizacion = "2" Then
Dim Autorizacion As Integer = 0 Dim Autorizacion As Integer = 0
Dim ObjVentas As New ClsVentas Dim ObjVentas As New ClsVentas
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero, "Ing", CveEstatus:=1) Then If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero, "Ing", CveEstatus:=1) Then
Dim RowAutorizacion As DataRow = Nothing Dim RowAutorizacion As DataRow = Nothing
@@ -7862,6 +7856,16 @@ Partial Class Ventas
TieneBloqueoPorCreditoVencimiento = 0 TieneBloqueoPorCreditoVencimiento = 0
Alert("El cliente tiene una autorización aprobada", TipoMensaje.ToastInformacion) Alert("El cliente tiene una autorización aprobada", TipoMensaje.ToastInformacion)
End If 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 End If
'SI ES AUTORIZACION DEBE PERMITIR GENERARLA 'SI ES AUTORIZACION DEBE PERMITIR GENERARLA
@@ -7999,16 +8003,7 @@ Partial Class Ventas
End If End If
End If End If
Case "2" 'Autorizacion desde una solicitud del catalogo de autorizaciones 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 Vta As New ClsVentas
Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa) 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) 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 'CREDITO NO SUFICIENTE
If Opcion = 3 Then 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 'If CreditoDispo < 0 AndAlso RBLPago.SelectedValue = "1" Then
' BloquearCliente = True ' BloquearCliente = True
'End If 'End If
@@ -8295,7 +8290,7 @@ Partial Class Ventas
Alert("La Sucursal/Departamento del cliente se encuentra inactivo", TipoMensaje.MsgAdvertencia) Alert("La Sucursal/Departamento del cliente se encuentra inactivo", TipoMensaje.MsgAdvertencia)
Else Else
RBLPago.Items(0).Enabled = True 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 TrCreditoDisponible.Visible = True
LblCreditoDisponible.Text = String.Format("{0:C}", CreditoDispo) LblCreditoDisponible.Text = String.Format("{0:C}", CreditoDispo)
@@ -8435,7 +8430,7 @@ Partial Class Ventas
UpCliente.Update() UpCliente.Update()
UpEmitirTransitorio.Update() UpEmitirTransitorio.Update()
End Sub 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 Retorno As Decimal = 0
Dim ObjVentasAplciar As ClsVentas = Nothing Dim ObjVentasAplciar As ClsVentas = Nothing
If ObjVentas IsNot Nothing Then If ObjVentas IsNot Nothing Then
@@ -9083,9 +9078,9 @@ Partial Class Ventas
GvPS.DataBind() GvPS.DataBind()
End Sub End Sub
Protected Sub GvPS_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvPS.RowUpdating 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 Cantidad, PU As Decimal
Dim ObjDescuento As New Modelos.VentaDescuentos Dim ObjDescuento As New Modelos.VentaDescuentos
Dim CuentaPredial As String Dim CuentaPredial As String
@@ -9112,7 +9107,7 @@ Partial Class Ventas
End If End If
'SI ESTA HABILITADO LA OPCION DE DESCUENTO, SE AGREGO UN DESCUENTO MANUAL Y NO TIENE PROMOCION '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 ObjDescuento.ImporteDescuento = DescuentoManual
End If End If
@@ -10904,6 +10899,35 @@ Partial Class Ventas
End If End If
End If 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 'Paso CRM actualizar importe de acercamiento y guardar en bitacora
If DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveEmpresaCRM > 0 AndAlso CveAcercamientoCRM > 0 Then If DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveEmpresaCRM > 0 AndAlso CveAcercamientoCRM > 0 Then
@@ -25097,7 +25121,6 @@ Partial Class Ventas
TxtCorreoCliente.Text = "" TxtCorreoCliente.Text = ""
TxtTelefonoCliente.Text = "" TxtTelefonoCliente.Text = ""
If UsuarioActual.CveEmpresa = 189 Then If UsuarioActual.CveEmpresa = 189 Then
TxtRFCNombre.Text = "" TxtRFCNombre.Text = ""
@@ -26073,16 +26096,16 @@ Partial Class Ventas
Dim RestringirAlmacenes As Integer = -1 Dim RestringirAlmacenes As Integer = -1
Dim BuscarEnTabla As Boolean = True Dim BuscarEnTabla As Boolean = True
Dim ObjInventarios As New ClsInventarios() 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"), 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, ExcluyeApartados:=-1, ExcluyeAdelantado:=1, CveSubProyecto:=-1,
ExcluyeTransitorios:=1, RestringirAlmacenes:=RestringirAlmacenes, TopSelect:=100, BuscarEnTabla:=BuscarEnTabla) Then ExcluyeTransitorios:=1, RestringirAlmacenes:=RestringirAlmacenes, TopSelect:=100, BuscarEnTabla:=BuscarEnTabla) Then
GvVerExistencias.DataSource = ObjInventarios.DtResultados.Copy() GvVerExistencias.DataSource = ObjInventarios.DtResultados.Copy()
End If End If
ObjInventarios.Dispose() ObjInventarios.Dispose()
GvVerExistencias.DataBind() GvVerExistencias.DataBind()
UpVerExistencias.Update() UpVerExistencias.Update()
@@ -37336,11 +37359,16 @@ Partial Class Ventas
UpModalSolicitud.Update() UpModalSolicitud.Update()
End Sub End Sub
Protected Sub BtnSolicitarCredito_Click(sender As Object, e As EventArgs) Handles BtnSolicitarCredito.Click 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 DiasVencidos As Integer = 0
Dim CveEstatus As Integer = 0 Dim CveEstatus As Integer = 0
Dim TipoDocto As String = DdlSolCreditoTipoDocto.SelectedValue Dim TipoDocto As String = DdlSolCreditoTipoDocto.SelectedValue
Dim CveTipoAutorizacion As Integer = DdlTipoAutorizacion.SelectedValue.ToEntero() 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) Alert("Debe seleccionar un tipo de autorización", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
End If End If
@@ -37364,8 +37392,11 @@ Partial Class Ventas
UpModalSolicitud.Update() UpModalSolicitud.Update()
End Sub End Sub
Protected Sub DdlTipoAutorizacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoAutorizacion.SelectedIndexChanged Protected Sub DdlTipoAutorizacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoAutorizacion.SelectedIndexChanged
DivImporteSolicitud.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 1 DivImporteSolicitud.Visible = DdlTipoAutorizacion.SelectedValue = "1"
DivDiasVencidos.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 2 DivDiasVencidos.Visible = DdlTipoAutorizacion.SelectedValue = "2"
If Not UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
TxtDiasVencidos.Text = "25"
End If
UpModalSolicitud.Update() UpModalSolicitud.Update()
End Sub End Sub
@@ -39863,18 +39894,18 @@ Partial Class Ventas
End Function End Function
Protected Sub GvVerExistencias_RowDataBound(sender As Object, e As GridViewRowEventArgs) Protected Sub GvVerExistencias_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("CveAlmacen") = "" Then If e.Row.DBCampo("CveAlmacen") = "" Then
e.Row.CssClass = "Totales" e.Row.CssClass = "Totales"
End If End If
End If End If
End Sub End Sub
Private Sub CargaGiro() Private Sub CargaGiro()
Dim Dt As DataTable = GlobalDTClienteClasificaciones(UsuarioActual.CveEmpresa) Dim Dt As DataTable = GlobalDTClienteClasificaciones(UsuarioActual.CveEmpresa)
DdlGiro.DataSource = Dt DdlGiro.DataSource = Dt
DdlGiro.DataBind() DdlGiro.DataBind()
DdlGiro.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlGiro.Items.Insert(0, New ListItem("Seleccione", "-1"))
UpAgregarCliente.Update() UpAgregarCliente.Update()
End Sub End Sub