Mejoras en cambios de almacen
This commit is contained in:
@@ -600,11 +600,13 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
||||
|
||||
//
|
||||
|
||||
if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 1 && e.Row.DBCampo("CveEstatusFactura").ToString().ToEntero() == 23)
|
||||
if (e.Row.DBCampo("CveEstatusFactura").ToString().ToEntero() == 23)
|
||||
{
|
||||
e.Row.FCLinkButton("LnkValidarRefac").Visible = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (e.Row.DBCampo("PuedeRefacturar") == "0" && e.Row.DBCampo("CveEstatusFactura") == "23" && e.Row.DBCampo("CveVentaSustitucion").ToEntero() > 0)
|
||||
{
|
||||
if (e.Row.FCLinkButton("LnkCancelar") != null) e.Row.FCLinkButton("LnkCancelar").Visible = true;
|
||||
|
||||
@@ -18310,8 +18310,8 @@ Partial Class Ventas
|
||||
Return False
|
||||
End If
|
||||
|
||||
If PU <= 0 AndAlso UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
|
||||
Alert("El precio debe ser mayor a 0", TipoMensaje.MsgAdvertencia)
|
||||
If PU <= 0 Then
|
||||
Alert("No se puede vender a un importe de cero", TipoMensaje.MsgAdvertencia)
|
||||
Return False
|
||||
End If
|
||||
|
||||
@@ -18323,10 +18323,10 @@ Partial Class Ventas
|
||||
ObjVentas.Dispose()
|
||||
|
||||
'VALIDA PRECIO CERO (0)
|
||||
If UsuarioActual.Empresa.Funcionalidad(139).ToString().ToEntero() > 0 And PU = 0 And DtPromociones.FiltroPrimeroValor("PUPromocion", $"CvePS = {CvePS}").ToDecimal > 0 Then
|
||||
Alert($"El producto <b>{HdnPS.Value}</b>. No se puede vender a un importe de cero ($0)", TipoMensaje.MsgAdvertencia)
|
||||
Return False
|
||||
End If
|
||||
'If UsuarioActual.Empresa.Funcionalidad(139).ToString().ToEntero() > 0 And PU = 0 And DtPromociones.FiltroPrimeroValor("PUPromocion", $"CvePS = {CvePS}").ToDecimal > 0 Then
|
||||
' Alert($"El producto <b>{HdnPS.Value}</b>. No se puede vender a un importe de cero ($0)", TipoMensaje.MsgAdvertencia)
|
||||
' Return False
|
||||
'End If
|
||||
|
||||
'SI NO TIENE LA FUNCIONALIDAD VALIDARA LAS MONEDAS
|
||||
If UsuarioActual.Empresa.Funcionalidad(524) <> "" Then
|
||||
@@ -23659,16 +23659,44 @@ Partial Class Ventas
|
||||
Protected Sub LBDevolucionAlmacen_Click(sender As Object, e As EventArgs)
|
||||
Dim SaldoAlmacen As Decimal = 0
|
||||
|
||||
Dim ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=True) Then
|
||||
If ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||
Dim DbRowVenta As DataRow = ObjVentas.DtResultados.Rows(0)
|
||||
Me.DevolucionAlmacen = DbRowVenta("EsDevolucionVenta").ToString().ToEntero()
|
||||
SaldoAlmacen = DbRowVenta("SaldoAlmacen").ToString().ToDecimal()
|
||||
Dim ErrorVerificacion As Boolean = False
|
||||
|
||||
Using ObjInv As New ClsInventarios
|
||||
If ObjInv.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
If ObjInv.DtResultados.Rows.Count > 0 Then
|
||||
TieneAlmacen = True
|
||||
End If
|
||||
Else
|
||||
ErrorVerificacion = True
|
||||
End If
|
||||
End Using
|
||||
|
||||
If ErrorVerificacion Then
|
||||
Alert("No se pudieron verificar los movimientos de almacen del documento.", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If SaldoAlmacen >= 0 Then
|
||||
If Not TieneAlmacen Then
|
||||
Alert("El documento no tiene movimientos de almacen.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Using ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=True) Then
|
||||
If ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||
Dim DbRowVenta As DataRow = ObjVentas.DtResultados.Rows(0)
|
||||
Me.DevolucionAlmacen = DbRowVenta("EsDevolucionVenta").ToString().ToEntero()
|
||||
SaldoAlmacen = DbRowVenta("SaldoAlmacen").ToString().ToDecimal()
|
||||
End If
|
||||
End If
|
||||
End Using
|
||||
|
||||
If DdlTipoComprobante.SelectedValue.ToString() = "Rem" AndAlso SaldoAlmacen = 0 Then
|
||||
Alert("El documento ya fue devuelto.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If DdlTipoComprobante.SelectedValue.ToString() = "Ing" AndAlso SaldoAlmacen = 0 Then
|
||||
Alert("El movimiento ya fue devuelto.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
@@ -23676,17 +23704,17 @@ Partial Class Ventas
|
||||
If Me.DevolucionAlmacen.Contiene(2) Then
|
||||
InicializaDevolucionAlmacen()
|
||||
UpnTools.Update()
|
||||
ObjVentas.Dispose()
|
||||
Alert("El movimiento ya fue devuelto.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim EstatusDevolucion = If(Me.DevolucionAlmacen = 0, 1, 0)
|
||||
|
||||
If ObjVentas.UpdateVentasDevolucionAlmacen(EstatusDevolucion, CveVenta) Then
|
||||
Dim ObjV As New ClsVentas
|
||||
If ObjV.UpdateVentasDevolucionAlmacen(EstatusDevolucion, CveVenta) Then
|
||||
Alert("La solicitud de Devolución de Almacén se guardó correctamente")
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
ObjV.Dispose()
|
||||
|
||||
Me.DevolucionAlmacen = EstatusDevolucion
|
||||
|
||||
@@ -24678,28 +24706,9 @@ Partial Class Ventas
|
||||
End Sub
|
||||
|
||||
Private Sub LbCancelarDocumento_Click(sender As Object, e As EventArgs) Handles LbCancelarDocumento.Click
|
||||
Dim SaldoAlmacen As Decimal = 0
|
||||
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Dev", "Egs") Then
|
||||
|
||||
Dim sb As New StringBuilder()
|
||||
Dim sbExtra As New StringBuilder()
|
||||
sb.Append("La factura se encuentra en el siguiente estatus del SAT:<br/>")
|
||||
|
||||
Dim TotalT As Decimal = TxtTotal.Text.ToDecimal
|
||||
Dim RFCReceptor As String = ""
|
||||
|
||||
If String.IsNullOrEmpty(Me.RFCReceptorVenta) Then
|
||||
RFCReceptor = LblRFC.Text.Trim
|
||||
|
||||
'SI SE FACTURO LA SUCURSAL DEL CLIENTE TOMA EL RFC DE ESTA
|
||||
If FacturarSucursal AndAlso Me.ClienteSucursal IsNot Nothing Then
|
||||
RFCReceptor = Me.ClienteSucursal.RFC
|
||||
End If
|
||||
Else
|
||||
RFCReceptor = Me.RFCReceptorVenta
|
||||
End If
|
||||
|
||||
Dim SaldoAlmacen As Decimal = 0
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Dev") Then
|
||||
|
||||
Dim PermiteCancelar As Boolean = True
|
||||
Using ObjVentas As New ClsVentas
|
||||
@@ -24722,12 +24731,41 @@ Partial Class Ventas
|
||||
Else
|
||||
PermiteCancelar = False
|
||||
End If
|
||||
|
||||
If PermiteCancelar And SaldoVenta <> 0 Then
|
||||
If UsuarioActual.TienePermisoProceso(269) AndAlso Not DevolucionAlmacen = 2 Then
|
||||
DivDevAlm.Visible = True
|
||||
TieneAlmacen = True
|
||||
End If
|
||||
End If
|
||||
|
||||
End Using
|
||||
|
||||
If Not PermiteCancelar Then
|
||||
Alert("La venta no se puede cancelar si no ha sido surtida previamente", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Dev", "Egs") Then
|
||||
|
||||
Dim sb As New StringBuilder()
|
||||
Dim sbExtra As New StringBuilder()
|
||||
sb.Append("La factura se encuentra en el siguiente estatus del SAT:<br/>")
|
||||
|
||||
Dim TotalT As Decimal = TxtTotal.Text.ToDecimal
|
||||
Dim RFCReceptor As String = ""
|
||||
|
||||
If String.IsNullOrEmpty(Me.RFCReceptorVenta) Then
|
||||
RFCReceptor = LblRFC.Text.Trim
|
||||
|
||||
'SI SE FACTURO LA SUCURSAL DEL CLIENTE TOMA EL RFC DE ESTA
|
||||
If FacturarSucursal AndAlso Me.ClienteSucursal IsNot Nothing Then
|
||||
RFCReceptor = Me.ClienteSucursal.RFC
|
||||
End If
|
||||
Else
|
||||
RFCReceptor = Me.RFCReceptorVenta
|
||||
End If
|
||||
|
||||
|
||||
Dim SWatch As New Stopwatch
|
||||
@@ -25042,7 +25080,7 @@ Partial Class Ventas
|
||||
' CancelarRefacturada()
|
||||
'End If
|
||||
|
||||
Dim ObjFacturaCancelacion As New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=True)
|
||||
Dim ObjFacturaCancelacion As New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=True, VerificaAlmacen:=True)
|
||||
Try
|
||||
Dim resp As Modelos.Factura.MCancelacionVentaMensaje = Nothing
|
||||
Dim strMensaje As New StringBuilder()
|
||||
|
||||
Reference in New Issue
Block a user