From e9e9cde5ea44b411e8d6ee62533dd675ebe24d34 Mon Sep 17 00:00:00 2001 From: rrene Date: Fri, 31 May 2024 20:04:47 -0700 Subject: [PATCH] --ajustes de cortes --- App_Code/ClsPuntoVenta.vb | 61 ------------------------------------ App_Code/ClsVentas.vb | 65 +++++++++++++++++++++++++++++++++++++++ Bancos/RepCortes.aspx.vb | 41 +++++++++++++++--------- 3 files changed, 91 insertions(+), 76 deletions(-) diff --git a/App_Code/ClsPuntoVenta.vb b/App_Code/ClsPuntoVenta.vb index cc16fe654..66181f187 100644 --- a/App_Code/ClsPuntoVenta.vb +++ b/App_Code/ClsPuntoVenta.vb @@ -221,29 +221,6 @@ Public Class ClsPuntoVenta Return Retorno End Function - - Public Function GetCortesDetalleVentas(CveCorte As Integer, CveSubProyecto As Integer, CveEmpresa As Integer, Opcion As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_Vta_CortesDetalleVentasGet") - - 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 - SqlAdapter.Fill(Data) - - 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 @@ -268,25 +245,6 @@ Public Class ClsPuntoVenta 'End Function - Public Function GetVta_ReporteCortes(CveEmpresa As Integer, FechaI As Date, FechaF As Date, Optional CveSubProyecto As Integer = -1, Optional CveCorte As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Vta_ReporteCortesGet") - - SqlAdapter.SelectCommand.Parameters.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - SqlAdapter.SelectCommand.Parameters.Add("@FechaInicio", SqlDbType.Date).Value = FechaI - SqlAdapter.SelectCommand.Parameters.Add("@FechaFin", SqlDbType.Date).Value = FechaF - SqlAdapter.SelectCommand.Parameters.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - SqlAdapter.SelectCommand.Parameters.Add("@CveCorte", SqlDbType.Int).Value = CveCorte - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Reporte de Cortes.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function GetVta_MetodosPago(CveCorte As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_MetodosPagoGet") @@ -406,25 +364,6 @@ Public Class ClsPuntoVenta Return Retorno End Function - - Public Function GetVta_MovimientosCajasReporte(CveCorte As Integer, TipoMovimiento As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Vta_MovimientosCajasRepGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCorte", SqlDbType.Int).Value = CveCorte - .Add("@TipoMovimiento", SqlDbType.Int).Value = TipoMovimiento - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el reporte de caja del cortes del punto de venta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function Public Function GetVta_VentasPago(CveCorte As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index a90f706f1..81aa27261 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -3450,6 +3450,52 @@ Public Class ClsVentas #End Region #Region "Punto Venta" + Public Function GetVta_ReporteCortes(CveEmpresa As Integer, FechaI As Date, FechaF As Date, Optional CveSubProyecto As Integer = -1, Optional CveCorte As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_CortesRep") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@FechaInicio", SqlDbType.Date).Value = FechaI + .Add("@FechaFin", SqlDbType.Date).Value = FechaF + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveCorte", SqlDbType.Int).Value = CveCorte + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Reporte de Cortes.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + + Public Function GetCortesDetalleVentas(CveCorte As Integer, CveSubProyecto As Integer, CveEmpresa As Integer, Opcion As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Vta_CortesDetalleVentasGet") + + 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 + SqlAdapter.Fill(Data) + + 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 AddVtaCortesDetalles(CveCorte As Integer, CveMetodoPago As Integer, Importe As Double) As Boolean Dim Retorno As Boolean = False @@ -3495,6 +3541,25 @@ Public Class ClsVentas Return Retorno End Function + Public Function GetVta_MovimientosCajasReporte(CveCorte As Integer, TipoMovimiento As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_MovimientosCajasRepGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCorte", SqlDbType.Int).Value = CveCorte + .Add("@TipoMovimiento", SqlDbType.Int).Value = TipoMovimiento + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el reporte de caja del cortes del punto de venta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function GetCortesDetalleVentasResumenIVA(CveCorte As Integer, CveSubProyecto As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False diff --git a/Bancos/RepCortes.aspx.vb b/Bancos/RepCortes.aspx.vb index bd784469f..abd49cce6 100644 --- a/Bancos/RepCortes.aspx.vb +++ b/Bancos/RepCortes.aspx.vb @@ -79,11 +79,11 @@ Partial Class Bancos_RepCortes Dim FechaI As Date = If(txtFechaVI.Text <> "", txtFechaVI.Text.ToDate, MinFecha) Dim FechaF As Date = If(txtFechaVF.Text <> "", txtFechaVF.Text.ToDate, MaxFecha) - Dim ObjPuntoVenta As New ClsPuntoVenta - If ObjPuntoVenta.GetVta_ReporteCortes(UsuarioActual.CveEmpresa, FechaI, FechaF, DdlSubProyectos.SelectedValue.ToEntero) Then - DtCortes = ObjPuntoVenta.DtResultados.Copy() + Dim ObjVenta As New ClsVentas + If ObjVenta.GetVta_ReporteCortes(UsuarioActual.CveEmpresa, FechaI, FechaF, DdlSubProyectos.SelectedValue.ToEntero) Then + DtCortes = ObjVenta.DtResultados.Copy() End If - ObjPuntoVenta.Dispose() + ObjVenta.Dispose() If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then GvDatos.Columns(3).Visible = True @@ -110,7 +110,18 @@ 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 + e.Row.Cells(2).ForeColor = Drawing.Color.Red + e.Row.Cells(2).ToolTip = (e.Row.DBCampo("VentasCorte").ToDecimal - (e.Row.DBCampo("VentaTotalIngreso").ToDecimal + e.Row.DBCampo("VentaTotalRemision").ToDecimal)).ToString + End If + If e.Row.DBCampo("VentasCorte").ToDecimal.RoundSQL <> e.Row.DBCampo("VentasContado").ToDecimal + e.Row.DBCampo("VentasCredito").ToDecimal.RoundSQL Then + e.Row.Cells(6).ForeColor = Drawing.Color.Red + e.Row.Cells(6).ToolTip = (e.Row.DBCampo("VentasCorte").ToDecimal - (e.Row.DBCampo("VentasContado").ToDecimal + e.Row.DBCampo("VentasCredito").ToDecimal)).ToString + End If + End If End If End If End Sub @@ -181,8 +192,8 @@ 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 - Dim ObjPuntoVenta As New ClsPuntoVenta + Nombre = gvr.DataKey("Nombre").ToString + Dim ObjVentas As New ClsVentas If ObjVentas.GetCortesDetalleVentasResumen(CveCorte, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then @@ -204,15 +215,15 @@ Partial Class Bancos_RepCortes End If End If - If ObjPuntoVenta.GetCortesDetalleVentas(CveCorte, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, 2) Then - DtCortesVentas = ObjPuntoVenta.DtResultados.Copy() + If ObjVentas.GetCortesDetalleVentas(CveCorte, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, 2) Then + DtCortesVentas = ObjVentas.DtResultados.Copy() GvD.DataSource = DtCortesVentas divDetalle.Visible = True End If - If ObjPuntoVenta.GetVta_MovimientosCajasReporte(CveCorte, -1) Then - GvIngresosRetiros.DataSource = ObjPuntoVenta.DtResultados.Copy() + If ObjVentas.GetVta_MovimientosCajasReporte(CveCorte, -1) Then + GvIngresosRetiros.DataSource = ObjVentas.DtResultados.Copy() End If If (DtCortesVentasResumen IsNot Nothing AndAlso DtCortesVentasResumen.Rows.Count > 0) Or (DtCortesVentas IsNot Nothing AndAlso DtCortesVentas.Rows.Count > 0) Then @@ -224,10 +235,10 @@ Partial Class Bancos_RepCortes HplDownPDF.Visible = False HplDownEXCEL.Visible = False End If - ObjVentas.Dispose() - ObjPuntoVenta.Dispose() - - + ObjVentas.Dispose() + + + GvD.DataBind() GvP.DataBind() GvDep.DataBind()