diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 130afb4dd..e4219e313 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -3485,7 +3485,7 @@ Public Class ClsVentas ''' ''' ''' - Public Function GetVta_ReporteCortesDetalle(CveCorte As Integer, CveSubProyecto As Integer, CveEmpresa As Integer, Opcion As Integer, Optional ConsultaIVA As Boolean = False) As Boolean + Public Function GetVta_ReporteCortesDetalle(CveCorte As Integer, CveSubProyecto As Integer, CveEmpresa As Integer, Opcion As Integer, Optional ConsultaIVA As Boolean = False, Optional FechaConsulta As Date = ModExtensiones.MaxFecha) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_ReporteCortesDetalleGet") @@ -3496,6 +3496,7 @@ Public Class ClsVentas .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@Opcion", SqlDbType.Int).Value = Opcion .Add("@ConsultaIVA", SqlDbType.Bit).Value = ConsultaIVA + .Add("@FechaConsulta", SqlDbType.Date).Value = FechaConsulta End With Try diff --git a/Bancos/RepCortes.aspx.vb b/Bancos/RepCortes.aspx.vb index 67ddada77..0f791b9dc 100644 --- a/Bancos/RepCortes.aspx.vb +++ b/Bancos/RepCortes.aspx.vb @@ -106,7 +106,7 @@ Partial Class Bancos_RepCortes #Region "G V - D A T O S " Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.DBCampo("CveCorte").ToString = "" Then + If e.Row.DBCampo("FechaInicial").ToString = "" Then e.Row.CssClass = "SubTotales2" If DtCortes IsNot Nothing Then e.Row.FCLiteral("LtlImporteInicial").Text = DtCortes.SUMD("ImporteInicial").FormatoNumero(2) @@ -189,10 +189,12 @@ Partial Class Bancos_RepCortes Protected Sub LbDescripcion_Click(sender As Object, e As EventArgs) Dim btn As LinkButton = DirectCast(sender, LinkButton) Dim gvr As GridViewRow = DirectCast(btn.NamingContainer, GridViewRow) - 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 + + CveCorte = gvr.DataKey("CveCorte").ToEntero() + + Dim Finalizado As Integer = gvr.DataKey("Finalizado").ToEntero() + Fecha = gvr.DataKey("FechaInicial") + Nombre = gvr.DataKey("Nombre") 'If ObjPuntoVenta.GetCortesDetalleVentas(CveCorte, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, 2) Then ' DtCortesVentas = ObjPuntoVenta.DtResultados.Copy() @@ -212,9 +214,17 @@ Partial Class Bancos_RepCortes ' GvPorIVA.DataSource = ObjVentas.DtResultados ' End If 'End If + Dim FechaConsulta = ModExtensiones.MaxFecha + + Dim ConsultaPorSucursal As Boolean = UsuarioActual.Empresa.Funcionalidad(382) = "1" + + If ConsultaPorSucursal Then + CveCorte = -1 + FechaConsulta = gvr.DataKey("FechaInicial").ToDate() + End If Dim ObjVentas As New ClsVentas - If ObjVentas.GetVta_ReporteCortesDetalle(CveCorte, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, Opcion:=2, ConsultaIVA:=UsuarioActual.CveEmpresa.Contiene(190, 192)) Then + If ObjVentas.GetVta_ReporteCortesDetalle(CveCorte, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, Opcion:=2, ConsultaIVA:=UsuarioActual.CveEmpresa.Contiene(190, 192), FechaConsulta:=FechaConsulta) Then Dim DsDatos = ObjVentas.DataSetResultados.Copy() If DsDatos IsNot Nothing Then 'DESGLOSE @@ -242,11 +252,12 @@ Partial Class Bancos_RepCortes End If End If - If ObjVentas.GetVta_MovimientosCajasReporte(CveCorte, -1) Then - GvIngresosRetiros.DataSource = ObjVentas.DtResultados.Copy() + If CveCorte > 0 Then + If ObjVentas.GetVta_MovimientosCajasReporte(CveCorte, -1) Then + GvIngresosRetiros.DataSource = ObjVentas.DtResultados.Copy() + End If End If - 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