Validacion de remisiones con garantia, correcion al amortizar una factura existente
This commit is contained in:
@@ -3219,7 +3219,7 @@ Partial Class Ventas
|
||||
|
||||
If ObjPVenta.DtResultados.Rows.Count > 0 Then
|
||||
CveCorte = ObjPVenta.CveCorte
|
||||
Dim FechaICorte = ObjPVenta.FechaInicial.Date'.AddDays(-5)
|
||||
Dim FechaICorte = ObjPVenta.FechaInicial.Date '.AddDays(-5)
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso FechaICorte < Now.Date Then
|
||||
DebeCerrarCorte = True
|
||||
LblMotivoBloqueo.Text = $"Existe un corte del día <b>{FechaICorte.ToString("dd/MM/yyyy")}</b>. Favor de cerrarlo para iniciar un nuevo corte."
|
||||
@@ -4254,16 +4254,8 @@ Partial Class Ventas
|
||||
Dim DbRowVenta As DataRow = ObjVentas.DtResultados.Rows(0)
|
||||
Dim CveCliente As Integer = DbRowVenta("CveCliente").ToString().ToEntero()
|
||||
HdnCveVenta.Value = CveVenta.ToString()
|
||||
Dim DtUsadosPendientes As DataTable = Nothing
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
Dim ObjUsados As New ClsVentas
|
||||
|
||||
If ObjUsados.GetVentasUsados(CveVenta, -1, DbRowVenta("Fecha").ToString().ToDateTime, UsuarioActual.CveEmpresa) Then
|
||||
DtUsadosPendientes = ObjUsados.DtResultados
|
||||
End If
|
||||
ObjUsados.Dispose()
|
||||
End If
|
||||
Me.EsGarantia = CBool(DbRowVenta("EsGarantia"))
|
||||
|
||||
RFCReceptorVenta = DbRowVenta("RFCReceptor").ToString()
|
||||
'Adjuntar archivo
|
||||
@@ -4284,7 +4276,7 @@ Partial Class Ventas
|
||||
|
||||
ViewState("CveSubProyectoVenta") = DbRowVenta("CveSubProyecto").ToString().ToEntero()
|
||||
|
||||
Me.EsGarantia = CBool(DbRowVenta("EsGarantia"))
|
||||
|
||||
|
||||
Me.CveEstatusFacturaPadre = DbRowVenta("CveEstatusFacturaPadre").ToString().ToEntero()
|
||||
'CargaEncabezado
|
||||
@@ -5198,13 +5190,47 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
'Si es Empresa de Acumuladores
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
'Si ya se surtió y recibió
|
||||
If (DbRowVenta("SaldoAlmacen").ToString().ToDecimal > 0 And (DtUsadosPendientes Is Nothing Or DtUsadosPendientes.Rows.Count = 0)) OrElse (TmpDT.MAX("CveTipoPS") = "1") Then
|
||||
BtnsFacturar.Visible = True
|
||||
Else
|
||||
BtnsFacturar.Visible = False
|
||||
If CveVenta > 0 AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso DbRowVenta("TipoDocto").ToString() = "Rem" AndAlso (GlobalDTEstatusFactura().FiltroPrimeroValor("TipoEstatus", $"CveEstatusFactura = {Me.CveEstatus}").ToEntero() <> 5) Then
|
||||
|
||||
BtnsFacturar.Visible = False
|
||||
|
||||
Dim DtUsadosPendientes As DataTable = Nothing
|
||||
Dim DtGarantiasPendientes As DataTable = Nothing
|
||||
|
||||
Dim ObjUsados As New ClsVentas
|
||||
|
||||
If ObjUsados.GetVentasUsados(CveVenta, -1, DbRowVenta("Fecha").ToString().ToDateTime, UsuarioActual.CveEmpresa) Then
|
||||
DtUsadosPendientes = ObjUsados.DtResultados.Copy()
|
||||
End If
|
||||
|
||||
If ObjUsados.GetVentasGarantiaPendiente(CveVenta, Now, UsuarioActual.CveEmpresa) Then
|
||||
DtGarantiasPendientes = ObjUsados.DtResultados.Copy()
|
||||
End If
|
||||
|
||||
'If ObjUsados.GetVentasGarantiaPendiente(CveVenta, -1, Now, UsuarioActual.CveEmpresa) Then
|
||||
' DtGarantiasPendientes = ObjUsados.DtResultados.Copy()
|
||||
'End If
|
||||
ObjUsados.Dispose()
|
||||
|
||||
'Si ya se surtió y recibió
|
||||
If DbRowVenta("SaldoAlmacen").ToString().ToDecimal > 0 OrElse TmpDT.MAX("CveTipoPS") = "1" Then
|
||||
BtnsFacturar.Visible = True
|
||||
End If
|
||||
|
||||
'VERIFICA SI TIENE USADOS O GARANTIAS PENDIENTES
|
||||
If BtnsFacturar.Visible Then
|
||||
If (Not EsGarantia AndAlso (DtUsadosPendientes IsNot Nothing AndAlso DtUsadosPendientes.Rows.Count > 0)) Then
|
||||
BtnsFacturar.Visible = False
|
||||
Alert("Tiene usados pendiente de recibir", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
If (EsGarantia AndAlso (DtGarantiasPendientes IsNot Nothing AndAlso DtGarantiasPendientes.Rows.Count > 0)) Then
|
||||
Alert("Tiene garantías pendientes de recibir", TipoMensaje.MsgAdvertencia)
|
||||
BtnsFacturar.Visible = False
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
|
||||
End If
|
||||
|
||||
@@ -5335,6 +5361,14 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
If DdlTipoComprobante.SelectedValue = "Rem" Then
|
||||
If GlobalDTEstatusFactura().FiltroPrimeroValor("TipoEstatus", $"CveEstatusFactura = {Me.CveEstatus}").ToEntero() = 5 Then
|
||||
BtnsFacturar.Visible = False
|
||||
BtnEmitirImprimir.Visible = False
|
||||
BtnPermisoEditarRemision.Visible = False
|
||||
End If
|
||||
End If
|
||||
|
||||
UpPS.Update()
|
||||
UpContado.Update()
|
||||
UpEstatus.Update()
|
||||
@@ -6713,19 +6747,21 @@ Partial Class Ventas
|
||||
Else
|
||||
|
||||
'VERIFICAR RESTRICCIONES DEL CLIENTE
|
||||
If DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0 AndAlso RBLPago.SelectedValue = "2" Then
|
||||
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
|
||||
Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
|
||||
BtnsFacturar.Visible = False
|
||||
BtnGenerarRemision.Visible = False
|
||||
If Not UsuarioActual.Empresa.Funcionalidad(702).ToEntero() > 0 Then
|
||||
If DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0 AndAlso RBLPago.SelectedValue = "2" Then
|
||||
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
|
||||
Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
|
||||
BtnsFacturar.Visible = False
|
||||
BtnGenerarRemision.Visible = False
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
|
||||
UPPCreditoDisponible.Update()
|
||||
@@ -11504,7 +11540,7 @@ Partial Class Ventas
|
||||
DdlTipoComprobante.Enabled = False
|
||||
End If
|
||||
|
||||
TAB.ActiveTab = TabGenerales
|
||||
Tab.ActiveTab = TabGenerales
|
||||
TabGenerales.Enabled = True
|
||||
Updatetabs.Update()
|
||||
UPObservaciones.Update()
|
||||
@@ -11570,7 +11606,7 @@ Partial Class Ventas
|
||||
ContratoDetalles.Visible = False
|
||||
UPEstimaciones.Update()
|
||||
|
||||
TAB.ActiveTab = TabGenerales
|
||||
Tab.ActiveTab = TabGenerales
|
||||
TabGenerales.Enabled = True
|
||||
Updatetabs.Update()
|
||||
End If
|
||||
@@ -15342,7 +15378,7 @@ Partial Class Ventas
|
||||
ErrorConta = True
|
||||
End If
|
||||
|
||||
If Not ErrorConta AndAlso Not ObjConta.PrePolizaSimplificacion(ObjFactura.CvePrePoliza, UsuarioActual.CveEmpresa) Then
|
||||
If Not ErrorConta AndAlso Not ObjConta.PrePolizaSimplificacion(CvePrepoliza, UsuarioActual.CveEmpresa) Then
|
||||
Alert("No se pudo simplificar los movimientos", TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
@@ -16507,7 +16543,7 @@ Partial Class Ventas
|
||||
If objcompras.GetCompraDetallealmacen(0, DdlNCFactura.SelectedValue.ToEntero()) Then
|
||||
GvInvNC.DataSource = objcompras.DtResultados
|
||||
If objcompras.DtResultados.Rows.Count > 0 Then
|
||||
TAB.ActiveTabIndex = 1
|
||||
Tab.ActiveTabIndex = 1
|
||||
Updatetabs.Update()
|
||||
End If
|
||||
Else
|
||||
@@ -16787,7 +16823,7 @@ Partial Class Ventas
|
||||
|
||||
End If
|
||||
UpParametros.Update()
|
||||
TAB.ActiveTab = TabGenerales
|
||||
Tab.ActiveTab = TabGenerales
|
||||
Else
|
||||
Alert("La empresa no contiene un producto asignado a la estimació", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
@@ -23621,7 +23657,7 @@ Partial Class Ventas
|
||||
DdlContratosModal.Items.Insert(0, New ListItem("Seleccione", "0"))
|
||||
UPEstimaciones.Update()
|
||||
|
||||
TAB.ActiveTab = TabE
|
||||
Tab.ActiveTab = TabE
|
||||
TabGenerales.Enabled = False
|
||||
Updatetabs.Update()
|
||||
|
||||
@@ -29911,7 +29947,7 @@ Partial Class Ventas
|
||||
ContratoDetalles.Visible = False
|
||||
UPEstimaciones.Update()
|
||||
|
||||
TAB.ActiveTab = TabGenerales
|
||||
Tab.ActiveTab = TabGenerales
|
||||
TabGenerales.Enabled = True
|
||||
Updatetabs.Update()
|
||||
|
||||
@@ -30472,7 +30508,7 @@ Partial Class Ventas
|
||||
DdlMonedaModalPedido2.DataBind()
|
||||
DdlMonedaModalPedido2.Items.Insert(0, New ListItem("Todas", "-1"))
|
||||
|
||||
TAB.ActiveTab = TabGenerales
|
||||
Tab.ActiveTab = TabGenerales
|
||||
TabGenerales.Enabled = True
|
||||
Updatetabs.Update()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user