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
|
If ObjPVenta.DtResultados.Rows.Count > 0 Then
|
||||||
CveCorte = ObjPVenta.CveCorte
|
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
|
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso FechaICorte < Now.Date Then
|
||||||
DebeCerrarCorte = True
|
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."
|
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 DbRowVenta As DataRow = ObjVentas.DtResultados.Rows(0)
|
||||||
Dim CveCliente As Integer = DbRowVenta("CveCliente").ToString().ToEntero()
|
Dim CveCliente As Integer = DbRowVenta("CveCliente").ToString().ToEntero()
|
||||||
HdnCveVenta.Value = CveVenta.ToString()
|
HdnCveVenta.Value = CveVenta.ToString()
|
||||||
Dim DtUsadosPendientes As DataTable = Nothing
|
|
||||||
|
|
||||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
Me.EsGarantia = CBool(DbRowVenta("EsGarantia"))
|
||||||
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
|
|
||||||
|
|
||||||
RFCReceptorVenta = DbRowVenta("RFCReceptor").ToString()
|
RFCReceptorVenta = DbRowVenta("RFCReceptor").ToString()
|
||||||
'Adjuntar archivo
|
'Adjuntar archivo
|
||||||
@@ -4284,7 +4276,7 @@ Partial Class Ventas
|
|||||||
|
|
||||||
ViewState("CveSubProyectoVenta") = DbRowVenta("CveSubProyecto").ToString().ToEntero()
|
ViewState("CveSubProyectoVenta") = DbRowVenta("CveSubProyecto").ToString().ToEntero()
|
||||||
|
|
||||||
Me.EsGarantia = CBool(DbRowVenta("EsGarantia"))
|
|
||||||
|
|
||||||
Me.CveEstatusFacturaPadre = DbRowVenta("CveEstatusFacturaPadre").ToString().ToEntero()
|
Me.CveEstatusFacturaPadre = DbRowVenta("CveEstatusFacturaPadre").ToString().ToEntero()
|
||||||
'CargaEncabezado
|
'CargaEncabezado
|
||||||
@@ -5198,13 +5190,47 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
'Si es Empresa de Acumuladores
|
'Si es Empresa de Acumuladores
|
||||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
If CveVenta > 0 AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso DbRowVenta("TipoDocto").ToString() = "Rem" AndAlso (GlobalDTEstatusFactura().FiltroPrimeroValor("TipoEstatus", $"CveEstatusFactura = {Me.CveEstatus}").ToEntero() <> 5) 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 = False
|
||||||
BtnsFacturar.Visible = True
|
|
||||||
Else
|
Dim DtUsadosPendientes As DataTable = Nothing
|
||||||
BtnsFacturar.Visible = False
|
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
|
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)
|
LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -5335,6 +5361,14 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
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()
|
UpPS.Update()
|
||||||
UpContado.Update()
|
UpContado.Update()
|
||||||
UpEstatus.Update()
|
UpEstatus.Update()
|
||||||
@@ -6713,19 +6747,21 @@ Partial Class Ventas
|
|||||||
Else
|
Else
|
||||||
|
|
||||||
'VERIFICAR RESTRICCIONES DEL CLIENTE
|
'VERIFICAR RESTRICCIONES DEL CLIENTE
|
||||||
If DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0 AndAlso RBLPago.SelectedValue = "2" Then
|
If Not UsuarioActual.Empresa.Funcionalidad(702).ToEntero() > 0 Then
|
||||||
Dim Vta As New ClsVentas
|
If DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0 AndAlso RBLPago.SelectedValue = "2" Then
|
||||||
Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa)
|
Dim Vta As New ClsVentas
|
||||||
Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón: <br> <br> {0}", Vta.SerieVenta)
|
Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa)
|
||||||
Vta.Dispose()
|
Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón: <br> <br> {0}", Vta.SerieVenta)
|
||||||
If Opcion > 0 Then
|
Vta.Dispose()
|
||||||
Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
|
If Opcion > 0 Then
|
||||||
BtnsFacturar.Visible = False
|
Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
|
||||||
BtnGenerarRemision.Visible = False
|
BtnsFacturar.Visible = False
|
||||||
|
BtnGenerarRemision.Visible = False
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
UPPCreditoDisponible.Update()
|
UPPCreditoDisponible.Update()
|
||||||
@@ -11504,7 +11540,7 @@ Partial Class Ventas
|
|||||||
DdlTipoComprobante.Enabled = False
|
DdlTipoComprobante.Enabled = False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
TAB.ActiveTab = TabGenerales
|
Tab.ActiveTab = TabGenerales
|
||||||
TabGenerales.Enabled = True
|
TabGenerales.Enabled = True
|
||||||
Updatetabs.Update()
|
Updatetabs.Update()
|
||||||
UPObservaciones.Update()
|
UPObservaciones.Update()
|
||||||
@@ -11570,7 +11606,7 @@ Partial Class Ventas
|
|||||||
ContratoDetalles.Visible = False
|
ContratoDetalles.Visible = False
|
||||||
UPEstimaciones.Update()
|
UPEstimaciones.Update()
|
||||||
|
|
||||||
TAB.ActiveTab = TabGenerales
|
Tab.ActiveTab = TabGenerales
|
||||||
TabGenerales.Enabled = True
|
TabGenerales.Enabled = True
|
||||||
Updatetabs.Update()
|
Updatetabs.Update()
|
||||||
End If
|
End If
|
||||||
@@ -15342,7 +15378,7 @@ Partial Class Ventas
|
|||||||
ErrorConta = True
|
ErrorConta = True
|
||||||
End If
|
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)
|
Alert("No se pudo simplificar los movimientos", TipoMensaje.MsgError)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -16507,7 +16543,7 @@ Partial Class Ventas
|
|||||||
If objcompras.GetCompraDetallealmacen(0, DdlNCFactura.SelectedValue.ToEntero()) Then
|
If objcompras.GetCompraDetallealmacen(0, DdlNCFactura.SelectedValue.ToEntero()) Then
|
||||||
GvInvNC.DataSource = objcompras.DtResultados
|
GvInvNC.DataSource = objcompras.DtResultados
|
||||||
If objcompras.DtResultados.Rows.Count > 0 Then
|
If objcompras.DtResultados.Rows.Count > 0 Then
|
||||||
TAB.ActiveTabIndex = 1
|
Tab.ActiveTabIndex = 1
|
||||||
Updatetabs.Update()
|
Updatetabs.Update()
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
@@ -16787,7 +16823,7 @@ Partial Class Ventas
|
|||||||
|
|
||||||
End If
|
End If
|
||||||
UpParametros.Update()
|
UpParametros.Update()
|
||||||
TAB.ActiveTab = TabGenerales
|
Tab.ActiveTab = TabGenerales
|
||||||
Else
|
Else
|
||||||
Alert("La empresa no contiene un producto asignado a la estimació", TipoMensaje.MsgInformacion)
|
Alert("La empresa no contiene un producto asignado a la estimació", TipoMensaje.MsgInformacion)
|
||||||
End If
|
End If
|
||||||
@@ -23621,7 +23657,7 @@ Partial Class Ventas
|
|||||||
DdlContratosModal.Items.Insert(0, New ListItem("Seleccione", "0"))
|
DdlContratosModal.Items.Insert(0, New ListItem("Seleccione", "0"))
|
||||||
UPEstimaciones.Update()
|
UPEstimaciones.Update()
|
||||||
|
|
||||||
TAB.ActiveTab = TabE
|
Tab.ActiveTab = TabE
|
||||||
TabGenerales.Enabled = False
|
TabGenerales.Enabled = False
|
||||||
Updatetabs.Update()
|
Updatetabs.Update()
|
||||||
|
|
||||||
@@ -29911,7 +29947,7 @@ Partial Class Ventas
|
|||||||
ContratoDetalles.Visible = False
|
ContratoDetalles.Visible = False
|
||||||
UPEstimaciones.Update()
|
UPEstimaciones.Update()
|
||||||
|
|
||||||
TAB.ActiveTab = TabGenerales
|
Tab.ActiveTab = TabGenerales
|
||||||
TabGenerales.Enabled = True
|
TabGenerales.Enabled = True
|
||||||
Updatetabs.Update()
|
Updatetabs.Update()
|
||||||
|
|
||||||
@@ -30472,7 +30508,7 @@ Partial Class Ventas
|
|||||||
DdlMonedaModalPedido2.DataBind()
|
DdlMonedaModalPedido2.DataBind()
|
||||||
DdlMonedaModalPedido2.Items.Insert(0, New ListItem("Todas", "-1"))
|
DdlMonedaModalPedido2.Items.Insert(0, New ListItem("Todas", "-1"))
|
||||||
|
|
||||||
TAB.ActiveTab = TabGenerales
|
Tab.ActiveTab = TabGenerales
|
||||||
TabGenerales.Enabled = True
|
TabGenerales.Enabled = True
|
||||||
Updatetabs.Update()
|
Updatetabs.Update()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user