-- cambio para utilizar la FNC 595, con valor 2, que son las autorizaciones por solicitud, como lo tiene BDH

This commit is contained in:
2024-06-19 19:11:31 -07:00
parent b448757c45
commit e96003fdb4

View File

@@ -2562,15 +2562,13 @@ Partial Class Ventas
thPoliza2.Visible = True thPoliza2.Visible = True
End If End If
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso UsuarioActual.CveUsuario = 100 Then If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso UsuarioActual.CveUsuario = 100 Then DivPenalizacion.Visible = True
DivPenalizacion.Visible = True End If
End If
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then If UsuarioActual.Empresa.Funcionalidad(595) = "2" Then
LnkSolicitarCredito.Visible = True LnkSolicitarCredito.Visible = True
End If 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
@@ -2881,8 +2879,6 @@ Partial Class Ventas
BtnCrearApartirDe.Visible = True BtnCrearApartirDe.Visible = True
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then BtnCrearApartirDe.Visible = False If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then BtnCrearApartirDe.Visible = False
If DdlTipoComprobante.SelectedValue = "Ped" Then If DdlTipoComprobante.SelectedValue = "Ped" Then
BtnPermisoEditarRemision.Text = "Editar Pedido" BtnPermisoEditarRemision.Text = "Editar Pedido"
BtnEditarRemision.Text = "Actualizar Pedido" BtnEditarRemision.Text = "Actualizar Pedido"
@@ -3969,7 +3965,7 @@ Partial Class Ventas
Alert("Se ha cerrado el turno correctamente.", TipoMensaje.MsgInformacion, Liga) Alert("Se ha cerrado el turno correctamente.", TipoMensaje.MsgInformacion, Liga)
End If End If
Else Else
Alert("Debe especificar el efectivo en caja", TipoMensaje.MsgAdvertencia) Alert("Debe especificar el efectivo en caja", TipoMensaje.ToastAdventencia)
RegistraScript("window.onload = function MuestraPantallaBloqueo() { document.getElementById(""C_btnShowBloqueo"").click(); }") RegistraScript("window.onload = function MuestraPantallaBloqueo() { document.getElementById(""C_btnShowBloqueo"").click(); }")
End If End If
ObjPVenta.Dispose() ObjPVenta.Dispose()
@@ -7208,7 +7204,6 @@ Partial Class Ventas
Alert("Ocurrió un error al cargar los datos del cliente. Por favor vuelva a intentar.", TipoMensaje.MsgError) Alert("Ocurrió un error al cargar los datos del cliente. Por favor vuelva a intentar.", TipoMensaje.MsgError)
End If End If
CveAlmacenAsignado = ObjCliente.CveAlmacenAsignado CveAlmacenAsignado = ObjCliente.CveAlmacenAsignado
End If End If
@@ -7565,7 +7560,7 @@ Partial Class Ventas
RBLPago.Items(0).Enabled = False RBLPago.Items(0).Enabled = False
RBLPago_SelectedIndexChanged(Nothing, Nothing) RBLPago_SelectedIndexChanged(Nothing, Nothing)
'GENERAR UNA AUTORIZACIÓN SI EL CLIENTE NO PERMITE CREDITO 'GENERAR UNA AUTORIZACIÓN SI EL CLIENTE NO PERMITE CREDITO
If UsuarioActual.Empresa.Funcionalidad(595) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(268) Then If ValorAutorizacion = "1" AndAlso Not UsuarioActual.TienePermisoProceso(268) Then
'SI LLEGÓ POR LA OPCIÓN DE COTIZACIÓN NO DEBE DE RESTRINGUIR 'SI LLEGÓ POR LA OPCIÓN DE COTIZACIÓN NO DEBE DE RESTRINGUIR
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
DdlTipoComprobante.SelectedValue = "Cot" DdlTipoComprobante.SelectedValue = "Cot"
@@ -7615,7 +7610,6 @@ Partial Class Ventas
UPCondicionesPago.Update() UPCondicionesPago.Update()
End If End If
Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero())
If CreditoDispo > 0 Then If CreditoDispo > 0 Then
@@ -7652,7 +7646,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(531) <> "1" Then If UsuarioActual.Empresa.Funcionalidad(595) <> "2" 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"))
@@ -7671,7 +7665,7 @@ Partial Class Ventas
Bloqueo = True Bloqueo = True
End If End If
If Bloqueo AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" 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
@@ -7694,7 +7688,7 @@ Partial Class Ventas
If Autorizacion > 0 Then If Autorizacion > 0 Then
Bloqueo = False Bloqueo = False
TieneBloqueoPorCreditoVencimiento = 0 TieneBloqueoPorCreditoVencimiento = 0
Alert("El cliente tiene una autorización aprobada") Alert("El cliente tiene una autorización aprobada", TipoMensaje.ToastInformacion)
End If End If
End If End If
@@ -7713,10 +7707,8 @@ Partial Class Ventas
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
TieneBloqueoPorCreditoVencimiento = 1 TieneBloqueoPorCreditoVencimiento = 1
End If End If
End If End If
Else Else
' el cliente tiene crédito disponible, no tiene bloqueo ' el cliente tiene crédito disponible, no tiene bloqueo
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("PA")) DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("PA"))
@@ -7837,15 +7829,54 @@ Partial Class Ventas
Case "2" 'Autorizacion desde una solicitud del catalogo de autorizaciones Case "2" 'Autorizacion desde una solicitud del catalogo de autorizaciones
'RMF. validacion temporal 'RMF. validacion temporal
'verifica si tiene autorizaciones de Nota de crédito autorizadas 'verifica si tiene autorizaciones de Nota de crédito autorizadas
Dim ObjVentas As New ClsVentas 'Dim ObjVentas As New ClsVentas
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, -1, "Ing", CveEstatus:=1) Then '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") ' Dim RowAutorizacion As DataRow = ObjVentas.DtResultados.FiltroPrimero($"CveVenta IS NULL AND CveTipoDocumento='Egs'", Orderby:="TipoAutorizacion")
If RowAutorizacion IsNot Nothing Then ' If RowAutorizacion IsNot Nothing Then
DdlTipoComprobante.SelectedValueExistInsert("Egs", "Egresos") ' DdlTipoComprobante.SelectedValueExistInsert("Egs", "Egresos")
End If ' 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)
Vta.Dispose()
If Opcion > 0 Then
If Alertas Then Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
Else
If Alertas Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia)
End If End If
ObjVentas.Dispose() LnkSolicitarCredito.Visible = True
Case Else 'SI NO TIENE NINGUN TIPO DE AUTORIZACION CONFIGURADO DdlTipoAutorizacion.SelectedValueExist("1")
If Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "PA") 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
'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO
If TieneDiasVencidos Then
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion IN(1,2) AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
Else
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
End If
If RowAutorizacion IsNot Nothing Then
Autorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero()
End If
End If
ObjVentas.Dispose()
'SI NO TIENE AUTORIZACION, MANTIENE EL BLOQUEO POR CONDICIONES DE CREDITO
If Autorizacion <= 0 Then
BtnEmitirImprimir.Visible = False
TieneBloqueoPorCreditoVencimiento = 1
End If
End If
Case Else 'SI NO TIENE NINGUN TIPO DE AUTORIZACION CONFIGURADO
'VERIFICAR CANDADOS DE VENTA 'VERIFICAR CANDADOS DE VENTA
If DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0 Then If DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0 Then
Dim Vta As New ClsVentas Dim Vta As New ClsVentas
@@ -7871,37 +7902,6 @@ Partial Class Ventas
'este codigo no es temporal 'este codigo no es temporal
If Alertas Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia) If Alertas Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia)
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
LnkSolicitarCredito.Visible = True
DdlTipoAutorizacion.SelectedValueExist("1")
If Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "PA") 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
'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO
If TieneDiasVencidos Then
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion IN(1,2) AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
Else
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
End If
If RowAutorizacion IsNot Nothing Then
Autorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero()
End If
End If
ObjVentas.Dispose()
'SI NO TIENE AUTORIZACION, MANTIENE EL BLOQUEO POR CONDICIONES DE CREDITO
If Autorizacion <= 0 Then
BtnEmitirImprimir.Visible = False
TieneBloqueoPorCreditoVencimiento = 1
End If
End If
End If
End If End If
End Select End Select
@@ -8063,25 +8063,19 @@ Partial Class Ventas
End If End If
End If End If
'CUANDO SEA COTIZACION Y SEA COMPUPROVEEDORES (EMPRESA 72) NO DEBE ENVIAR CORREO AL CLIENTE If DdlTipoComprobante.SelectedValue.Contiene("Rem", "PeC", "PA", "Ped") Then
If UsuarioActual.CveEmpresa = 72 AndAlso DdlTipoComprobante.SelectedValue = "Cot" Then 'ENVIO DE FACTURA
ChkEnviarFactura.Checked = False ChkEnviarFactura.Checked = False
ChkEnviarFactura.Visible = False ChkEnviarFactura.Visible = True
LblEnviarMail.Visible = False LblEnviarMail.Visible = True
If CveVenta > 0 AndAlso EnviarCorreoCliente Then ChkEnviarFactura.Checked = EnviarCorreoCliente
Else Else
If DdlTipoComprobante.SelectedValue.Contiene("Rem", "PeC", "PA", "Ped") Then ChkEnviarFactura.Checked = EnviarCorreoCliente
'ENVIO DE FACTURA ChkEnviarFactura.Visible = True
ChkEnviarFactura.Checked = False LblEnviarMail.Visible = True
ChkEnviarFactura.Visible = True
LblEnviarMail.Visible = True
If CveVenta > 0 AndAlso EnviarCorreoCliente Then ChkEnviarFactura.Checked = EnviarCorreoCliente
Else
ChkEnviarFactura.Checked = EnviarCorreoCliente
ChkEnviarFactura.Visible = True
LblEnviarMail.Visible = True
End If
End If End If
End Sub End Sub
@@ -9711,46 +9705,38 @@ Partial Class Ventas
Me.CveAutorizacion = -1 Me.CveAutorizacion = -1
'SI ES A CREDITO DEBE VERIFICAR SI TIENE AUTORIZACIONES 'SI ES A CREDITO DEBE VERIFICAR SI TIENE AUTORIZACIONES
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso CveCliente > 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing") AndAlso RBLPago.SelectedValue = "1" Then If UsuarioActual.Empresa.Funcionalidad(595) = "2" AndAlso CveCliente > 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing") AndAlso RBLPago.SelectedValue = "1" Then
Dim TipoDocumentoAutorizacion As String = "" Dim TipoDocumentoAutorizacion As String = ""
Dim ImporteAutorizacion As Decimal = 0 Dim ImporteAutorizacion As Decimal = 0
Dim TipoAutorizacion As Integer = 0 Dim TipoAutorizacion As Integer = 0
Dim DiasVencidosAutorizacion As Integer = 0 Dim DiasVencidosAutorizacion As Integer = 0
Dim CveVendedor As Integer = DdlVendedor.SelectedValue.ToEntero() Dim CveVendedor As Integer = DdlVendedor.SelectedValue.ToEntero()
Dim ObjVentas As New ClsVentas Dim ObjVentas As New ClsVentas
Try
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, "Ing", CveEstatus:=1) Then
Dim RowAutorizacion As DataRow = Nothing
'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO
If TieneDiasVencidos Then
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion IN(1,2) AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
Else
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
End If
If RowAutorizacion IsNot Nothing Then
TipoDocumentoAutorizacion = RowAutorizacion("CveTipoDocumento").ToString()
ImporteAutorizacion = RowAutorizacion("Importe").ToString().ToDecimal()
CveAutorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero()
TipoAutorizacion = RowAutorizacion("TipoAutorizacion").ToString().ToEntero()
DiasVencidosAutorizacion = RowAutorizacion("DiasVencidos").ToString().ToEntero()
End If
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, "Ing", CveEstatus:=1) Then
Dim RowAutorizacion As DataRow = Nothing
'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO
If TieneDiasVencidos Then
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion IN(1,2) AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
Else
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
End If End If
Catch ex As Exception
OnError("Ocurrió un error al obtener las autorizaciones", ex) If RowAutorizacion IsNot Nothing Then
End Try TipoDocumentoAutorizacion = RowAutorizacion("CveTipoDocumento").ToString()
ImporteAutorizacion = RowAutorizacion("Importe").ToString().ToDecimal()
CveAutorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero()
TipoAutorizacion = RowAutorizacion("TipoAutorizacion").ToString().ToEntero()
DiasVencidosAutorizacion = RowAutorizacion("DiasVencidos").ToString().ToEntero()
End If
End If
ObjVentas.Dispose() ObjVentas.Dispose()
If TipoDocumentoAutorizacion = "Ing" Then If TipoDocumentoAutorizacion = "Ing" Then
If TipoAutorizacion = 1 Then If TipoAutorizacion = 1 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
If ImporteAutorizacion < TxtTotal.Text.ToDecimal() Then If ImporteAutorizacion < TxtTotal.Text.ToDecimal() Then
Dim BloquearCredito As Boolean = True Dim BloquearCredito As Boolean = True
CveAutorizacion = -1 CveAutorizacion = -1
@@ -9850,7 +9836,6 @@ Partial Class Ventas
End If End If
End If End If
'VALIDA PRECIO AL AGREGAR A ALMACEN 'VALIDA PRECIO AL AGREGAR A ALMACEN
If Not UsuarioActual.TienePermisoProceso(169) Then If Not UsuarioActual.TienePermisoProceso(169) Then
If (DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "PA") AndAlso NuevaFactura <> 1) Or (DdlTipoComprobante.SelectedValue = "Cot" AndAlso BtnEmitirImprimir.Text = "Facturar") Or (DdlTipoComprobante.SelectedValue.Contiene("Cot") And UsuarioActual.CveEmpresa.Contiene(119)) Then If (DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "PA") AndAlso NuevaFactura <> 1) Or (DdlTipoComprobante.SelectedValue = "Cot" AndAlso BtnEmitirImprimir.Text = "Facturar") Or (DdlTipoComprobante.SelectedValue.Contiene("Cot") And UsuarioActual.CveEmpresa.Contiene(119)) Then
@@ -10781,10 +10766,10 @@ Partial Class Ventas
OnError("Ocurrió un error al generar el directorio de xml", ex) OnError("Ocurrió un error al generar el directorio de xml", ex)
End Try End Try
Dim SeTimbro As Boolean = False Dim SeTimbro As Boolean = False
Dim SeTimbroNC As Boolean = False Dim SeTimbroNC As Boolean = False
Dim EstatusSMS As Integer = 0 Dim EstatusSMS As Integer = 0
Dim MsgErrorTimbrado As String = ""
Dim MsgCancelacionRefacturacion As Modelos.Factura.MCancelacionVentaMensaje = Nothing Dim MsgCancelacionRefacturacion As Modelos.Factura.MCancelacionVentaMensaje = Nothing
@@ -10808,8 +10793,6 @@ Partial Class Ventas
DebeTimbrar = False DebeTimbrar = False
End If End If
If DebeTimbrar AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Egs", "Ant", "Dev") Then If DebeTimbrar AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Egs", "Ant", "Dev") Then
If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso (UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1) Then If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso (UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1) Then
@@ -10842,7 +10825,7 @@ Partial Class Ventas
End Try End Try
Dim FolioFiscalFactura As String = ObjTimbrado.UUID Dim FolioFiscalFactura As String = ObjTimbrado.UUID
Dim MsgErrorTimbrado As String = ObjTimbrado.MensajeErrorCFDI MsgErrorTimbrado = ObjTimbrado.MensajeErrorCFDI
ObjTimbrado = Nothing ObjTimbrado = Nothing
'NOTA DE CREDITO - REFACTURADA - CASO ESPECIAL, TIMBRADO E IMPRESION 'NOTA DE CREDITO - REFACTURADA - CASO ESPECIAL, TIMBRADO E IMPRESION
@@ -10872,9 +10855,9 @@ Partial Class Ventas
EstatusSMS = EnviarSMSTimbrado(ObjEventos) EstatusSMS = EnviarSMSTimbrado(ObjEventos)
End If End If
If Not SeTimbro Then 'If Not SeTimbro Then
Alert(MsgErrorTimbrado, TipoMensaje.MsgError) ' Alert(MsgErrorTimbrado, TipoMensaje.MsgError)
End If 'End If
'CANCELAR FACTURA ANTERIOR 'CANCELAR FACTURA ANTERIOR
Try Try
@@ -10955,6 +10938,12 @@ Partial Class Ventas
OnError("Ocurrió un error al enviar el PDF", ex) OnError("Ocurrió un error al enviar el PDF", ex)
End Try End Try
Else Else
'ERROR DE NO TIMBRADO
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Egs", "Dev") Then
Dim StrEr As String = $"<br/><div id = 'DivTipoCambioAdvertencia' class='alert alert-warning' style='padding: 5px; margin-bottom: 5px; padding-right: 25px;'><strong style = 'font-size: 20px; margin-right: 25px;' > Comprobante no emitido : </strong> {MsgErrorTimbrado}<br/>Por favor inténtelo de nuevo a través del botón Emitir.</div>"
MensajeAlert.Append(StrEr)
End If
'PARA PRUEBAS, GENERAR PDF AUNQUE NO ESTE TIMBRADA 'PARA PRUEBAS, GENERAR PDF AUNQUE NO ESTE TIMBRADA
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
Try Try
@@ -11029,10 +11018,6 @@ Partial Class Ventas
End If End If
End If End If
'ERROR DE NO TIMBRADO
If Not SeTimbro And (DdlTipoComprobante.SelectedValue = "Ing" Or DdlTipoComprobante.SelectedValue.Contiene("Egs", "Dev") Or DdlTipoComprobante.SelectedValue = "Ant") Then
MensajeAlert.AppendFormat("La factura no se pudo timbrar.</b> Por favor intentelo de nuevo a traves del boton Emitir.")
End If
'ERROR DE NO TIMBRADO NC 'ERROR DE NO TIMBRADO NC
If Not IsNothing(ObjNC) AndAlso ObjNC.Count > 0 AndAlso Not SeTimbroNC Then If Not IsNothing(ObjNC) AndAlso ObjNC.Count > 0 AndAlso Not SeTimbroNC Then
@@ -13876,6 +13861,17 @@ Partial Class Ventas
CveAlmacenTraspasoDestino = drr("CveAlmacenAsignado").ToString.ToEntero '' cuando Fuera de Línea CveAlmacenTraspasoDestino = drr("CveAlmacenAsignado").ToString.ToEntero '' cuando Fuera de Línea
End If End If
End If End If
Else
Dim drr As DataRow = GlobalDTCliente(UsuarioActual.CveEmpresa, CveCliente:=CveCliente).FiltroPrimero("")
If drr IsNot Nothing Then
If RBLTipoVenta.SelectedValue.Contiene("3") Then 'cuando es A-vista
CveAlmacenTraspasoDestino = drr("CveAlmacenAlterno").ToString.ToEntero
ElseIf RBLTipoVenta.SelectedValue.Contiene("4") Then 'cuando es Consignación
CveAlmacenTraspasoDestino = drr("CveAlmacenConsignacion").ToString.ToEntero
Else
CveAlmacenTraspasoDestino = drr("CveAlmacenAsignado").ToString.ToEntero '' cuando Fuera de Línea
End If
End If
End If End If
If Not CveAlmacenTraspasoDestino > 0 Then ' para consignación es salida directa If Not CveAlmacenTraspasoDestino > 0 Then ' para consignación es salida directa
@@ -14073,7 +14069,7 @@ Partial Class Ventas
factura.Timbre.Comprobante.Serie = ObjVentas.Serie factura.Timbre.Comprobante.Serie = ObjVentas.Serie
factura.Timbre.Comprobante.Folio = ObjVentas.Folio.ToString() factura.Timbre.Comprobante.Folio = ObjVentas.Folio.ToString()
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso Me.CveAutorizacion > 0 Then If UsuarioActual.Empresa.Funcionalidad(595) = "2" AndAlso Me.CveAutorizacion > 0 Then
If Not ObjVentas.UpdateAutorizacionLimite(Me.CveAutorizacion, factura.CveCliente, factura.CveVenta) Then If Not ObjVentas.UpdateAutorizacionLimite(Me.CveAutorizacion, factura.CveCliente, factura.CveVenta) Then
ErrorList.Add("Error al guardar los limites de la autorizacion") ErrorList.Add("Error al guardar los limites de la autorizacion")
End If End If
@@ -16794,7 +16790,6 @@ Partial Class Ventas
End If End If
End If End If
If e.Row.DBCampo("Tipo").ToString() = "NC" And e.Row.DataKey("CveVenta").ToEntero() > 0 OrElse (e.Row.DBCampo("Tipo").Contiene("Ant", "IxC") And e.Row.DataKey("CveMoneda").ToEntero() = 1 AndAlso DdlMoneda.SelectedValue.ToEntero() = 2) Then If e.Row.DBCampo("Tipo").ToString() = "NC" And e.Row.DataKey("CveVenta").ToEntero() > 0 OrElse (e.Row.DBCampo("Tipo").Contiene("Ant", "IxC") And e.Row.DataKey("CveMoneda").ToEntero() = 1 AndAlso DdlMoneda.SelectedValue.ToEntero() = 2) Then
'If e.Row.DBCampo("CveMoneda").ToString().ToEntero() = 2 Then 'If e.Row.DBCampo("CveMoneda").ToString().ToEntero() = 2 Then
' tipoCambio = e.Row.DBCampo("TipoCambioHoy").ToString().ToDecimal ' tipoCambio = e.Row.DBCampo("TipoCambioHoy").ToString().ToDecimal
@@ -18787,7 +18782,6 @@ Partial Class Ventas
Dim Existencia As Decimal = 0D Dim Existencia As Decimal = 0D
''CveAlamcenFiltroDdl
If RBLTipoVenta.SelectedValue.ToEntero = 6 Then If RBLTipoVenta.SelectedValue.ToEntero = 6 Then
Existencia = ObjInventarios.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, CveAlamcenFiltroDdl, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=-1, Existencia = ObjInventarios.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, CveAlamcenFiltroDdl, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=-1,
@@ -22412,7 +22406,6 @@ Partial Class Ventas
Private Sub ObtenerFechaVencimientoCER() Private Sub ObtenerFechaVencimientoCER()
Try Try
Dim CerFile As New FileStream(Ruta & "Certificados\" & UsuarioActual.Empresa.ArchivoCer, FileMode.Open, FileAccess.Read) Dim CerFile As New FileStream(Ruta & "Certificados\" & UsuarioActual.Empresa.ArchivoCer, FileMode.Open, FileAccess.Read)
Dim Size As Integer = CerFile.Length.ToString().ToEntero() Dim Size As Integer = CerFile.Length.ToString().ToEntero()
Dim Data As Byte() = New Byte(Size - 1) {} Dim Data As Byte() = New Byte(Size - 1) {}
@@ -22424,11 +22417,7 @@ Partial Class Ventas
x509.Import(Data) x509.Import(Data)
If x509.NotAfter <= NowADS() Then If x509.NotAfter <= NowADS() Then
TrVistaPrevia.Visible = False Alert("La fecha del certificado ha expirado.", TipoMensaje.MsgAdvertencia)
TrEmitir.Visible = False
BtnEmitirImprimir.Visible = False
BtnCrearApartirDe.Enabled = False
Alert("La fecha del certificado ha expirado", TipoMensaje.MsgAdvertencia)
End If End If
Catch ex As Exception Catch ex As Exception
@@ -36091,6 +36080,10 @@ Partial Class Ventas
If ObjPS.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero(), TxtImporteSolicitud.Text.ToDecimal(), CveEstatus, UsuarioActual.CveUsuario, CveTipoAutorizacion, TipoDocumento:=DdlTipoDocto.SelectedValue, DiasVencidos:=DiasVencidos, Motivo:=Motivo) Then If ObjPS.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero(), TxtImporteSolicitud.Text.ToDecimal(), CveEstatus, UsuarioActual.CveUsuario, CveTipoAutorizacion, TipoDocumento:=DdlTipoDocto.SelectedValue, DiasVencidos:=DiasVencidos, Motivo:=Motivo) Then
RegistraScript("$('#DivModalSolicitarCredito').modal('hide')") RegistraScript("$('#DivModalSolicitarCredito').modal('hide')")
Alert("La autorización se agregó correctamente.", TipoMensaje.MsgInformacion) Alert("La autorización se agregó correctamente.", TipoMensaje.MsgInformacion)
'signal
Dim mensaje = "<br/> <a target='_blank' href='https://www.w3schools.com'>La autorización se agregó correctamente.</a>"
ClsSisNotificaciones.EnviarAlerta("Autorización Crédito", mensaje, "100", Tipo:=TipoNotificacion.ToastInformacionB)
End If End If
ObjPS.Dispose() ObjPS.Dispose()
UpModalSolicitud.Update() UpModalSolicitud.Update()
@@ -36100,18 +36093,6 @@ Partial Class Ventas
DivDiasVencidos.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 2 DivDiasVencidos.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 2
UpModalSolicitud.Update() UpModalSolicitud.Update()
End Sub 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
Protected Sub DdlTipoDocto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoDocto.SelectedIndexChanged Protected Sub DdlTipoDocto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoDocto.SelectedIndexChanged
Dim TipoDocto As String = DdlTipoDocto.SelectedValue.ToString() Dim TipoDocto As String = DdlTipoDocto.SelectedValue.ToString()
@@ -36129,30 +36110,6 @@ Partial Class Ventas
UpModalSolicitud.Update() UpModalSolicitud.Update()
End Sub End Sub
'Private Sub CargaVendedoresSubProyectos()
' DdlVendedor.Items.Clear()
' DdlVendedor.SelectedValue = Nothing
' Dim DtVendedoresSucursales = GlobalDTClientesVendedoresSubProyectos(UsuarioActual.CveEmpresa, CveCliente:=Me.CveCliente, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero())
' If DtVendedoresSucursales IsNot Nothing AndAlso DtVendedoresSucursales.Rows.Count > 0 Then
' DdlVendedor.DataSource = DtVendedoresSucursales
' DtVendedoresSucursales.Dispose()
' Else
' If UsuarioActual.Empresa.Funcionalidad(302) = "1" AndAlso DdlSubProyectoDatos.SelectedValue.ToEntero() > 0 Then
' DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveSubProyecto = {0}", DdlSubProyectoDatos.SelectedValue)).FiltraParametros("VendedorTipo = 1")
' Else
' DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltraParametros("VendedorTipo = 1")
' End If
' End If
' DdlVendedor.DataBind()
' DdlVendedor.Items.Insert(0, New ListItem("Sin Asignar", "0"))
' UpParametros.Update()
'End Sub
Protected Sub LnkEditarDir_Click(sender As Object, e As EventArgs) Protected Sub LnkEditarDir_Click(sender As Object, e As EventArgs)
DdlDireccionEnvio.Enabled = True DdlDireccionEnvio.Enabled = True
ChkDireccionEnvio.Enabled = True ChkDireccionEnvio.Enabled = True
@@ -38168,7 +38125,7 @@ Partial Class Ventas
CveAlamcenFiltroDdl = -1 CveAlamcenFiltroDdl = -1
Dim tCveAlmacenExistencia As Integer = -1 Dim tCveAlmacenExistencia As Integer = -1
If UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1 Then If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then
If DdlSucursalCliente.SelectedValue.ToEntero > 0 Then If DdlSucursalCliente.SelectedValue.ToEntero > 0 Then
Dim drr As DataRow = GlobalDTClientesSucursales(UsuarioActual.CveEmpresa, CveCliente).FiltroPrimero($"CveClienteSucursal={DdlSucursalCliente.SelectedValue}") Dim drr As DataRow = GlobalDTClientesSucursales(UsuarioActual.CveEmpresa, CveCliente).FiltroPrimero($"CveClienteSucursal={DdlSucursalCliente.SelectedValue}")
If drr IsNot Nothing Then If drr IsNot Nothing Then
@@ -38180,18 +38137,28 @@ Partial Class Ventas
tCveAlmacenExistencia = drr("CveAlmacenAsignado").ToString.ToEntero tCveAlmacenExistencia = drr("CveAlmacenAsignado").ToString.ToEntero
End If End If
End If End If
Else
Dim drr As DataRow = GlobalDTCliente(UsuarioActual.CveEmpresa, CveCliente:=CveCliente).FiltroPrimero("")
If drr IsNot Nothing Then
If RBLTipoVenta.SelectedValue.Contiene("6") Then 'cuando es A-vista
tCveAlmacenExistencia = drr("CveAlmacenAlterno").ToString.ToEntero
ElseIf RBLTipoVenta.SelectedValue.Contiene("5") Then 'cuando es Consignación
tCveAlmacenExistencia = drr("CveAlmacenConsignacion").ToString.ToEntero
Else
tCveAlmacenExistencia = drr("CveAlmacenAsignado").ToString.ToEntero '' cuando Fuera de Línea
End If
End If
End If End If
CveAlamcenFiltroDdl = tCveAlmacenExistencia
If Not CveAlamcenFiltroDdl > 0 Then If Not CveAlamcenFiltroDdl > 0 Then
CveAlamcenFiltroDdl = If(CveAlmacenAsignado > 0, CveAlmacenAsignado, -1) CveAlamcenFiltroDdl = If(CveAlmacenAsignado > 0, CveAlmacenAsignado, -1)
End If End If
DdlPS.ddlWS.Attributes.Remove("data-CveAlmacen") DdlPS.ddlWS.Attributes.Remove("data-CveAlmacen")
DdlPS.ddlWS.Attributes.Add("data-CveAlmacen", tCveAlmacenExistencia.ToString) DdlPS.ddlWS.Attributes.Add("data-CveAlmacen", CveAlamcenFiltroDdl.ToString)
End If End If
End Sub End Sub
#End Region #End Region
Protected Sub LnkCancelarSoloCFDI_Click(sender As Object, e As EventArgs) Protected Sub LnkCancelarSoloCFDI_Click(sender As Object, e As EventArgs)