diff --git a/App_Code/ClsProductosServicios.vb b/App_Code/ClsProductosServicios.vb index 17d7860aa..65d76357c 100644 --- a/App_Code/ClsProductosServicios.vb +++ b/App_Code/ClsProductosServicios.vb @@ -1052,7 +1052,7 @@ Public Class ClsProductosServicios Return Retorno End Function - Public Function AddPSAdicionales(CvePS As Integer, CvePSAdicional As Integer, Cantidad As Decimal) As Boolean + Public Function AddPSAdicionales(CvePS As Integer, CvePSAdicional As Integer, Cantidad As Decimal, Tipo As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Gral_ProductosServiciosAdicionalesAdd") @@ -1061,7 +1061,7 @@ Public Class ClsProductosServicios .Add("@CvePS", SqlDbType.Int).Value = CvePS .Add("@CvePSAdicional", SqlDbType.Int).Value = CvePSAdicional .Add("@Cantidad", SqlDbType.Money).Value = Cantidad - + .Add("@Tipo", SqlDbType.TinyInt).Value = Tipo End With Try @@ -1081,7 +1081,7 @@ Public Class ClsProductosServicios Return Retorno End Function - Public Function UpdatePSAdicionales(CvePS As Integer, CvePSAdicional As Integer, CvePSAdicionalAnterior As Integer, Cantidad As Decimal) As Boolean + Public Function UpdatePSAdicionales(CvePS As Integer, CvePSAdicional As Integer, CvePSAdicionalAnterior As Integer, Cantidad As Decimal, Tipo As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Gral_ProductosServiciosAdicionalesUpdate") @@ -1091,7 +1091,7 @@ Public Class ClsProductosServicios .Add("@CvePSAdicional", SqlDbType.Int).Value = CvePSAdicional .Add("@CvePSAdicionalAnterior", SqlDbType.Int).Value = CvePSAdicionalAnterior .Add("@Cantidad", SqlDbType.Money).Value = Cantidad - + .Add("@Tipo", SqlDbType.TinyInt).Value = Tipo End With Try diff --git a/App_Code/ClsPuntoVenta.vb b/App_Code/ClsPuntoVenta.vb index 66181f187..c076cc1c9 100644 --- a/App_Code/ClsPuntoVenta.vb +++ b/App_Code/ClsPuntoVenta.vb @@ -17,19 +17,25 @@ Public Class ClsPuntoVenta Private SqlCommand As SqlCommand Private SqlTransacc As SqlTransaction Private Data As DataTable + Private Dataset As DataSet 'Atributos de la clase Private disposedValue As Boolean = False ' Para detectar llamadas redundantes 'PARA REGISTRAR CONEXION - Private CveConexion As Integer = 0 - + Private CveConexion As Integer = 0 + #End Region - + #Region "Propiedades" Public ReadOnly Property DtResultados() As DataTable Get DtResultados = Data End Get + End Property + Public ReadOnly Property DataSetResultados() As DataSet + Get + DataSetResultados = Dataset + End Get End Property Public Property CveCorte As Integer @@ -222,6 +228,37 @@ Public Class ClsPuntoVenta Return Retorno End Function + ''' + ''' Desglose del reporte de cortes, resumen e IVA + ''' + ''' + ''' + ''' + ''' + ''' + Public Function GetVta_ReporteCortesDetalle(CveCorte As Integer, CveSubProyecto As Integer, CveEmpresa As Integer, Opcion As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Vta_ReporteCortesDetalleGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCorte", SqlDbType.Int).Value = CveCorte + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Opcion", SqlDbType.Int).Value = Opcion + End With + + Try + Dataset = New DataSet() + SqlAdapter.Fill(Dataset) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los detalle de cortes", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + 'Public Function GetCortesPorCuenta(CveCuenta As Integer, CveEmpresa As Integer) As Boolean ' Dim Retorno As Boolean = False @@ -389,7 +426,8 @@ Public Class ClsPuntoVenta If Not Me.disposedValue Then If disposing Then ' TODO: dispose managed state (managed objects). - If Not Data Is Nothing Then Data.Dispose() : Data = Nothing + If Not Data Is Nothing Then Data.Dispose() : Data = Nothing + If Not Dataset Is Nothing Then Dataset.Dispose() : Dataset = Nothing If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() : SqlAdapter = Nothing If Not SqlCommand Is Nothing Then SqlCommand.Dispose() : SqlCommand = Nothing If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() : SqlTransacc = Nothing 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 diff --git a/Bancos/RepCortes.aspx.vb b/Bancos/RepCortes.aspx.vb index abd49cce6..140876f91 100644 --- a/Bancos/RepCortes.aspx.vb +++ b/Bancos/RepCortes.aspx.vb @@ -110,7 +110,7 @@ Partial Class Bancos_RepCortes e.Row.CssClass = "SubTotales2" If DtCortes IsNot Nothing Then e.Row.FCLiteral("LtlImporteInicial").Text = DtCortes.SUMD("ImporteInicial").FormatoNumero(2) - End If + End If Else If UsuarioActual.CveRol = 1 Then If e.Row.DBCampo("VentasCorte").ToDecimal.RoundSQL <> e.Row.DBCampo("VentaTotalIngreso").ToDecimal + e.Row.DBCampo("VentaTotalRemision").ToDecimal.RoundSQL Then @@ -192,39 +192,62 @@ Partial Class Bancos_RepCortes CveCorte = gvr.DataKey("CveCorte").ToString.ToEntero Dim Finalizado As Integer = gvr.DataKey("Finalizado").ToString.ToEntero Fecha = gvr.DataKey("FechaInicial").ToString - Nombre = gvr.DataKey("Nombre").ToString + Nombre = gvr.DataKey("Nombre").ToString - Dim ObjVentas As New ClsVentas + 'If ObjPuntoVenta.GetCortesDetalleVentas(CveCorte, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, 2) Then + ' DtCortesVentas = ObjPuntoVenta.DtResultados.Copy() + ' GvD.DataSource = DtCortesVentas + + ' divDetalle.Visible = True + 'End If + + 'If ObjVentas.GetCortesDetalleVentasResumen(CveCorte, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then + ' GvP.DataSource = ObjVentas.DtResultados + ' DtCortesVentasResumen = ObjVentas.DtResultados + 'End If + + 'If UsuarioActual.CveEmpresa.Contiene(190, 192) Then + ' DivIVA.Visible = True + ' If ObjVentas.GetCortesDetalleVentasResumenIVA(CveCorte, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then + ' GvPorIVA.DataSource = ObjVentas.DtResultados + ' End If + 'End If + + Dim ObjPuntoVenta As New ClsPuntoVenta + If ObjPuntoVenta.GetVta_ReporteCortesDetalle(CveCorte, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, 2) Then + Dim DsDatos = ObjPuntoVenta.DataSetResultados.Copy() + If DsDatos IsNot Nothing Then + 'DESGLOSE + DtCortesVentas = DsDatos.Tables(0) + GvD.DataSource = DtCortesVentas - If ObjVentas.GetCortesDetalleVentasResumen(CveCorte, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then - GvP.DataSource = ObjVentas.DtResultados - DtCortesVentasResumen = ObjVentas.DtResultados - End If + divDetalle.Visible = True + 'RESUMEN + DtCortesVentasResumen = DsDatos.Tables(1) + GvP.DataSource = DtCortesVentasResumen - If UsuarioActual.CveEmpresa.Contiene(190, 192) Then - DivIVA.Visible = True - If ObjVentas.GetCortesDetalleVentasResumenIVA(CveCorte, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then - GvPorIVA.DataSource = ObjVentas.DtResultados + 'RESUMEN - IVA + If UsuarioActual.CveEmpresa.Contiene(190, 192) Then + DivIVA.Visible = True + GvPorIVA.DataSource = DsDatos.Tables(2) + End If + End If End If + If ObjPuntoVenta.GetVta_MovimientosCajasReporte(CveCorte, -1) Then + GvIngresosRetiros.DataSource = ObjPuntoVenta.DtResultados.Copy() + End If + ObjPuntoVenta.Dispose() + + Dim ObjVentas As New ClsVentas If Not UsuarioActual.CveEmpresa.Contiene(140, 141) AndAlso ObjVentas.GetCortesDetalleDepositosCaja(CveCorte, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then GvDep.DataSource = ObjVentas.DtResultados If ObjVentas.DtResultados.Rows.Count > 0 Then DivDep.Visible = True End If - End If - - If ObjVentas.GetCortesDetalleVentas(CveCorte, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, 2) Then - DtCortesVentas = ObjVentas.DtResultados.Copy() - GvD.DataSource = DtCortesVentas - - divDetalle.Visible = True - End If - - If ObjVentas.GetVta_MovimientosCajasReporte(CveCorte, -1) Then - GvIngresosRetiros.DataSource = ObjVentas.DtResultados.Copy() End If + ObjVentas.Dispose() If (DtCortesVentasResumen IsNot Nothing AndAlso DtCortesVentasResumen.Rows.Count > 0) Or (DtCortesVentas IsNot Nothing AndAlso DtCortesVentas.Rows.Count > 0) Then HplDownPDF.Visible = True @@ -235,22 +258,13 @@ Partial Class Bancos_RepCortes HplDownPDF.Visible = False HplDownEXCEL.Visible = False End If - ObjVentas.Dispose() - - - + GvD.DataBind() GvP.DataBind() GvDep.DataBind() GvPorIVA.DataBind() GvIngresosRetiros.DataBind() - - GvD.DataBind() - GvP.DataBind() - GvDep.DataBind() - GvPorIVA.DataBind() - If UsuarioActual.CveEmpresa.Contiene(189, 193, 195, 196, 197) Then DivAnexo.Visible = True Dim CveCuenta As Integer = 0 diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 38d5b90a6..7f44dc9dc 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -9780,7 +9780,7 @@ Partial Class Compras_Compras - + Dim TCAnt As Decimal = If(DdlMoneda.SelectedValue = "1", 1, If(CveCompra > 0, LblTC.Text.ToDecimal, TxtTC.Text.ToDecimal)) If UsuarioActual.Empresa.CveEmpresa.Contiene(13, 83) Then @@ -9792,7 +9792,7 @@ Partial Class Compras_Compras e.Row.DBCampo("CveMoneda"), e.Row.DBCampo("TCCompra").ToDouble, DdlMoneda.SelectedValue, - IIf(DdlMoneda.SelectedValue = "1", 1, TxtTC.Text), + TCAnt, e.Row.FCTextBox("TxtComision").ClientID )) 'SI ES UNA COMPRA NUEVA SE PONE EL TOTAL, SI NO EL SALDO @@ -9824,7 +9824,7 @@ Partial Class Compras_Compras e.Row.DBCampo("CveMoneda"), e.Row.DBCampo("TCCompra").ToDouble, DdlMoneda.SelectedValue, - IIf(DdlMoneda.SelectedValue = "1", 1, TxtTC.Text) + TCAnt )) 'SI ES UNA COMPRA NUEVA SE PONE EL TOTAL, SI NO EL SALDO e.Row.FCTextBox("TxtAnticipo").Attributes.Add("onKeyUp", String.Format("FnCambiaAnt({0},this,{1},{2},{3},{4},{5});", diff --git a/Contabilidad/RegPrePolizaS.aspx.vb b/Contabilidad/RegPrePolizaS.aspx.vb index ab4a57400..07148d380 100644 --- a/Contabilidad/RegPrePolizaS.aspx.vb +++ b/Contabilidad/RegPrePolizaS.aspx.vb @@ -1690,7 +1690,7 @@ Partial Class ContabilidadC_RegPrePolizaS End If - If DdlPlantilla.SelectedValue.ToEntero <> 53 Then + If DdlPlantilla.SelectedValue.ToEntero <> 53 And Not CvePrePoliza > 0 Then Dim x As Integer = 0 For Each gvRow As GridViewRow In GvMov.Rows @@ -1769,7 +1769,7 @@ Partial Class ContabilidadC_RegPrePolizaS DtMovimientos.AcceptChanges() - If DdlPlantilla.SelectedValue.ToEntero <> 53 Then + If DdlPlantilla.SelectedValue.ToEntero <> 53 And Not CvePrePoliza > 0 Then GvMov.DataSource = DtMovimientos GvMov.DataBind() GvPrePoliza.DataBind() diff --git a/Transportes/RepContratosCalendario.aspx.vb b/Transportes/RepContratosCalendario.aspx.vb index 51d1e7939..5695af9fd 100644 --- a/Transportes/RepContratosCalendario.aspx.vb +++ b/Transportes/RepContratosCalendario.aspx.vb @@ -62,7 +62,7 @@ Partial Class RepContratosCalendario Private Sub CargaCronograma(Optional TipoVista As Integer = -1) If DtAvance IsNot Nothing Then - Dim DtUnidades As DataTable = GlobalDTActivoFijos(UsuarioActual.CveEmpresa).FiltraParametros("Codigo <> '' AND MedidaVehicular IN (2,3)", Orderby:=" SubTipoActivoFijo DESC, CodigoNumeroOrden ASC", DistinctColumns:={"Codigo", "CveActivoFijo"}) + Dim DtUnidades As DataTable = GlobalDTActivoFijos(UsuarioActual.CveEmpresa).FiltraParametros("Codigo <> '' AND MedidaVehicular IN (2,3)", Orderby:=" TipoActivoFijo ASC, CodigoNumeroOrden ASC", DistinctColumns:={"Codigo", "CveActivoFijo"}) 'For Each Row As DataRow In DtAvance.Rows ' If String.IsNullOrEmpty(Row("CodigoAF").ToString()) Then diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index eb52f60bb..9f3afc3cf 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -295,7 +295,9 @@ Partial Class Ventas_PVCobranza 'SI TIENE SALDO, QUE APLIQUE EL PAGO If e.Row.DBCampo("Saldo").ToDecimal() > 0 Then e.Row.FCLinkButton("BtnPagar").Visible = True - e.Row.FCLinkButton("LnkImprimir").Visible = False + If Not e.Row.DBCampo("TipoEntrega") = "2" Then + e.Row.FCLinkButton("LnkImprimir").Visible = False + End If Else e.Row.FCLinkButton("BtnPagar").Visible = False End If diff --git a/Ventas/ProductosServicios.aspx b/Ventas/ProductosServicios.aspx index d551e714c..ce4071fea 100644 --- a/Ventas/ProductosServicios.aspx +++ b/Ventas/ProductosServicios.aspx @@ -80,9 +80,9 @@
  • -
  • - -
  • +
  • + +
  • @@ -358,7 +358,6 @@
    - a
    @@ -482,7 +481,7 @@
    - + @@ -642,7 +641,7 @@
    - Cargar Archivo + Cargar Archivo
    @@ -823,7 +822,7 @@ -
    - -
    - - -
    -
    + +
    + + +
    +

    @@ -1421,7 +1420,7 @@
    - +
    @@ -1449,7 +1448,7 @@ ValidationGroup="GrpGuardar">
    - + @@ -2091,44 +2090,44 @@