--validacion de cancelaciones de rnc,validacion de pagos y refacturacion con pagos, obligar devolucion al cancelar con la funcionalidad 567, validaciones del pv.aspx
This commit is contained in:
@@ -2354,7 +2354,10 @@ Partial Class Ventas
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
|
||||
If UsuarioActual.CveEmpresa.Contiene(141, 152, 153, 160, 161, 162) Then System.Threading.Thread.Sleep(2000)
|
||||
If EsProduccion Then
|
||||
If UsuarioActual.CveEmpresa.Contiene(141, 152, 153, 160, 161, 162) Then System.Threading.Thread.Sleep(2000)
|
||||
End If
|
||||
|
||||
If Not IsPostBack Then
|
||||
|
||||
If IfNull(Request("Opcionx"), "").ToString = "Saldar" And UsuarioActual.CveUsuario = 100 Then
|
||||
@@ -2847,7 +2850,7 @@ Partial Class Ventas
|
||||
If CveVenta <= 0 Then
|
||||
'REMOVER EVENTO PARA RECARGAR ALMACEN
|
||||
HdnCargarInventario.Value = "False"
|
||||
spanAlmacen.Attributes.Remove("onclick")
|
||||
'spanAlmacen.Attributes.Remove("onclick")
|
||||
Tab.ActiveTabIndex = 1
|
||||
Updatetabs.Update()
|
||||
End If
|
||||
@@ -15323,6 +15326,22 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim ModalidadRefacturacion As Integer = UsuarioActual.Empresa.Funcionalidad(586).ToEntero()
|
||||
|
||||
'REFACTURACION CON PAGOS, DEBE CANCELAR SALDOS DEL DOCUMENTO ANTERIOR Y TRASPASAR PAGOS AL NUEVO
|
||||
If ModalidadRefacturacion = 2 AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Ant") AndAlso ObjFactura.NuevaFactura = 1 Then
|
||||
If Not ObjConta.TraspasarSaldosPrePolizasRefacturacion(ObjFacturaNC.CveVenta, ObjFactura.CveVenta, ObjFactura.CvePrePoliza, CvePlantilaPoliza, UsuarioActual.CveEmpresa) Then
|
||||
ErrorList.Add("Ocurrió un error al traspasos saldos en refacturación")
|
||||
End If
|
||||
Else
|
||||
'EN CASO DE SER REFACTURACION DE ANTICIPO SE ACTUALIZAN LAS VENTAS APLICADAS HACIA EL NUEVO
|
||||
If NuevaFactura = 1 AndAlso CveDevolucion > 0 AndAlso ObjFactura.TipoDocto.Contiene("Ant") Then
|
||||
If Not ObjVentas.TraspasaVentasAplicadasAnt(ObjFactura.CveVenta, CveDevolucion, UsuarioActual.CveEmpresa, ObjFactura.CvePrePoliza) Then
|
||||
ErrorPrepoliza = True
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 2) Then
|
||||
If ObjConta.ValorPolizaDescuadre > 0 Then
|
||||
If ObjConta.ValorPolizaDescuadre = 2 Then
|
||||
@@ -15339,21 +15358,6 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
'EN CASO DE SER REFACTURACION DE ANTICIPO SE ACTUALIZAN LAS VENTAS APLICADAS HACIA EL NUEVO
|
||||
If NuevaFactura = 1 AndAlso CveDevolucion > 0 AndAlso ObjFactura.TipoDocto.Contiene("Ant") Then
|
||||
If Not ObjVentas.TraspasaVentasAplicadasAnt(ObjFactura.CveVenta, CveDevolucion, UsuarioActual.CveEmpresa, ObjFactura.CvePrePoliza) Then
|
||||
ErrorPrepoliza = True
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim ModalidadRefacturacion As Integer = UsuarioActual.Empresa.Funcionalidad(586).ToEntero()
|
||||
|
||||
'REFACTURACION CON PAGOS, DEBE CANCELAR SALDOS DEL DOCUMENTO ANTERIOR Y TRASPASAR PAGOS AL NUEVO
|
||||
If ModalidadRefacturacion = 2 AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Ant") AndAlso ObjFactura.NuevaFactura = 1 Then
|
||||
If Not ObjConta.TraspasarSaldosPrePolizasRefacturacion(ObjFacturaNC.CveVenta, ObjFactura.CveVenta, ObjFactura.CvePrePoliza, CvePlantilaPoliza, UsuarioActual.CveEmpresa) Then
|
||||
ErrorList.Add("Ocurrió un error al traspasos saldos en refacturación")
|
||||
End If
|
||||
End If
|
||||
|
||||
Return ErrorPrepoliza
|
||||
Catch ex As Exception
|
||||
@@ -23103,7 +23107,7 @@ Partial Class Ventas
|
||||
Dim TienePagos As Boolean = ((Not (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0)) AndAlso (DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0)) OrElse AmortizacionNC > 0
|
||||
|
||||
'SI LA VENTA ES NUEVA VALIDAR TAMBIEN LOS PAGOS DE CONTADO
|
||||
If UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso CveVenta <= 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") Then
|
||||
If UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso ((CveVenta <= 0 OrElse EsCreaApartirDe OrElse TipoDoctoViejo = "Cot") AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant")) Then
|
||||
|
||||
If Not PermiteCredito AndAlso Not TienePagos AndAlso TxtTotal.Text.ToDecimal > 0 Then
|
||||
If MostrarAlertas Then
|
||||
@@ -23576,6 +23580,13 @@ Partial Class Ventas
|
||||
DivDevAlm.Visible = True
|
||||
TieneAlmacen = True
|
||||
End If
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Rem", "Dev") Then
|
||||
ChkDevAlm.Checked = True
|
||||
LiDevolucionAlmacen.Visible = True
|
||||
If DdlTipoComprobante.SelectedValue = "Dev" Then
|
||||
LblDevAlm.Text = "Salida de almacen"
|
||||
End If
|
||||
End If
|
||||
CargaGVInv(ObjInv.DtResultados)
|
||||
End If
|
||||
End If
|
||||
@@ -24748,14 +24759,6 @@ Partial Class Ventas
|
||||
Dim RowVenta As DataRow = ObjVentas.DtResultados.Rows(0)
|
||||
|
||||
SaldoAlmacen = RowVenta("SaldoAlmacen").ToString().ToDecimal()
|
||||
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Rem", "Dev") AndAlso SaldoAlmacen <> 0 Then
|
||||
ChkDevAlm.Checked = True
|
||||
LiDevolucionAlmacen.Visible = True
|
||||
If DdlTipoComprobante.SelectedValue = "Dev" Then
|
||||
LblDevAlm.Text = "Salida de almacen"
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
PermiteCancelar = False
|
||||
End If
|
||||
@@ -24763,19 +24766,26 @@ Partial Class Ventas
|
||||
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
|
||||
|
||||
If SaldoVenta <> 0 Then
|
||||
|
||||
If UsuarioActual.TienePermisoProceso(269) AndAlso Not DevolucionAlmacen = 2 Then
|
||||
DivDevAlm.Visible = True
|
||||
TieneAlmacen = True
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(567) = "1" Then
|
||||
ChkDevAlm.Checked = True
|
||||
ChkDevAlm.Enabled = False
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Dev", "Egs") Then
|
||||
@@ -32899,7 +32909,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
'REMOVER EVENTO PARA RECARGAR ALMACEN
|
||||
spanAlmacen.Attributes.Remove("onclick")
|
||||
'spanAlmacen.Attributes.Remove("onclick")
|
||||
Tab.ActiveTabIndex = 1
|
||||
HdnCargarInventario.Value = "False"
|
||||
Updatetabs.Update()
|
||||
@@ -36587,10 +36597,11 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
'REMOVER EVENTO PARA RECARGAR ALMACEN
|
||||
spanAlmacen.Attributes.Remove("onclick")
|
||||
Tab.ActiveTabIndex = 1
|
||||
'spanAlmacen.Attributes.Remove("onclick")
|
||||
'Tab.ActiveTabIndex = 1
|
||||
HdnCargarInventario.Value = "False"
|
||||
Updatetabs.Update()
|
||||
'Updatetabs.Update()
|
||||
UpINV.Update()
|
||||
End Sub
|
||||
Protected Sub LBAplicaDevolucion_Click(sender As Object, e As EventArgs)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user