diff --git a/Bancos/DepositosCaja.aspx.vb b/Bancos/DepositosCaja.aspx.vb index c3e8473b4..e99be126b 100644 --- a/Bancos/DepositosCaja.aspx.vb +++ b/Bancos/DepositosCaja.aspx.vb @@ -157,6 +157,11 @@ Partial Class Bancos_DepositosCaja Private Sub BtnDepositar_Click(sender As Object, e As EventArgs) Handles BtnDepositar.Click + + If Not Validaciones() Then + Exit Sub + End If + Dim TotalImporte As Decimal = 0 Dim TotalImportePrePoliza As Decimal Dim Comision As Decimal = TxtComision.Text.ToDecimal @@ -465,8 +470,58 @@ Partial Class Bancos_DepositosCaja lblValorTotalSeleccionado.Text = "0.0" CargaDatos() ObjConta.Dispose() - End Sub - + End Sub + + Private Function Validaciones() As Boolean + + Dim Respuesta As Boolean = True + + If Not ValidaCobranza() Then + Respuesta = False + End If + + Return Respuesta + + End Function + + + Private Function ValidaCobranza() As Boolean + Dim Respuesta As Boolean = False + + If UsuarioActual.CveEmpresa.Contiene(195) Then + + Dim ObjMovtos As New ClsMovimientos() + Dim FechaI, FechaF As Date + FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim().ToDate, MinFecha) + FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim().ToDate, MaxFecha).AddDays(1) + + If ObjMovtos.GetRemisionesCobranza(UsuarioActual.CveEmpresa, DdlSubProyectos.SelectedValue.ToEntero, FechaI, FechaF) Then + Dim dtt As DataTable = ObjMovtos.DtResultados.FiltraParametros($"CveVenta > 0 AND (CveUsuarioCobranza IS NULL OR CveUsuarioCobranza = {UsuarioActual.CveUsuario}) AND TipoDocto IN ('Ing','Rem')") + 'Dim Dtta As DataTable = dtt.FiltraParametros($"CveUsuarioCobranza = {UsuarioActual.CveUsuario} ") + 'If Dtta IsNot Nothing AndAlso Dtta.Rows.Count > 0 Then dtt = Dtta + + If dtt.Rows.Count = 0 Then + Respuesta = True + Else + Respuesta = False + Alert("Se detectaron cobros pendientes.", TipoMensaje.MsgAdvertencia) + End If + + Else + Alert("Error al consultarcobros pendientes.", TipoMensaje.MsgAdvertencia) + Respuesta = False + End If + + ObjMovtos.Dispose() + + Else + Respuesta = True + End If + + Return Respuesta + End Function + + Private Sub ObtenerTotalImporta() Dim Total As Double = 0