From 0aba7c56d247e08007d5c68716f56f5e12464c51 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Thu, 27 Jun 2024 15:01:05 -0700 Subject: [PATCH 1/2] --Impresion en reporte de cortes --- Bancos/RepCortes.aspx | 2 +- Bancos/RepCortes.aspx.vb | 4 ++-- Compras/PopUpVerFactura.aspx.vb | 34 ++++++++++++++++++++++++++------- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/Bancos/RepCortes.aspx b/Bancos/RepCortes.aspx index 65f77f716..0f8f26f74 100644 --- a/Bancos/RepCortes.aspx +++ b/Bancos/RepCortes.aspx @@ -131,7 +131,7 @@ - + diff --git a/Bancos/RepCortes.aspx.vb b/Bancos/RepCortes.aspx.vb index 0f791b9dc..b387fecd9 100644 --- a/Bancos/RepCortes.aspx.vb +++ b/Bancos/RepCortes.aspx.vb @@ -269,8 +269,8 @@ Partial Class Bancos_RepCortes If (DtCortesVentasResumen IsNot Nothing AndAlso DtCortesVentasResumen.Rows.Count > 0) Or (DtCortesVentas IsNot Nothing AndAlso DtCortesVentas.Rows.Count > 0) Then HplDownPDF.Visible = True HplDownEXCEL.Visible = True - HplDownPDF.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=CORT&CVECORTE={0}&FORMATO={1}&CVESUBPROYECTO={2}", CveCorte, "PDF", DdlSubProyectos.SelectedValue.ToEntero))) - HplDownEXCEL.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=CORT&CVECORTE={0}&FORMATO={1}&CVESUBPROYECTO={2}", CveCorte, "EXCEL", DdlSubProyectos.SelectedValue.ToEntero))) + HplDownPDF.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=CORT&CVECORTE={0}&FORMATO={1}&CVESUBPROYECTO={2}&FECHA={3}", CveCorte, "PDF", DdlSubProyectos.SelectedValue.ToEntero, FechaConsulta.ToString("yyyy-MM-dd")))) + HplDownEXCEL.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=CORT&CVECORTE={0}&FORMATO={1}&CVESUBPROYECTO={2}&FECHA={3}", CveCorte, "EXCEL", DdlSubProyectos.SelectedValue.ToEntero, FechaConsulta.ToString("yyyy-MM-dd")))) Else HplDownPDF.Visible = False HplDownEXCEL.Visible = False diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index 5ae8eb43b..ba0dfeefc 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -1381,12 +1381,17 @@ Partial Class PopUpVerFactura If UrlParametros("OP").ToString = "CORT" Then - If UrlParametros("CVECORTE") IsNot Nothing AndAlso UrlParametros("CVECORTE").ToString.ToEntero > 0 Then + If (UrlParametros("CVECORTE") IsNot Nothing AndAlso UrlParametros("CVECORTE").ToString.ToEntero > 0) OrElse UsuarioActual.Empresa.Funcionalidad(382) = "1" Then Dim CveSubProyecto As Integer = -1 + Dim FechaConsulta As Date = ModExtensiones.MaxFecha + If UrlParametros("CVESUBPROYECTO") IsNot Nothing Then CveSubProyecto = UrlParametros("CVESUBPROYECTO").ToString.ToEntero End If - ImprimeCorte(UrlParametros("CVECORTE").ToString.ToEntero, UrlParametros("FORMATO").ToString, CveSubProyecto) + If UrlParametros("FECHA") IsNot Nothing Then + FechaConsulta = UrlParametros("FECHA").ToString.ToDate() + End If + ImprimeCorte(UrlParametros("CVECORTE").ToString.ToEntero, UrlParametros("FORMATO").ToString, CveSubProyecto, FechaConsulta) End If End If @@ -1554,7 +1559,7 @@ Partial Class PopUpVerFactura #Region "OP = CORT - IMPRIMIR CORTE" - Private Sub ImprimeCorte(CveCorte As Integer, Formato As String, Optional CveSubProyecto As Integer = -1) + Private Sub ImprimeCorte(CveCorte As Integer, Formato As String, Optional CveSubProyecto As Integer = -1, Optional FechaConsulta As Date = ModExtensiones.MaxFecha) Dim DtCortesVentasResumen As DataTable = Nothing Dim DtCortesVentas As DataTable = Nothing Dim DtReporteCorte As DataTable = Nothing @@ -1565,9 +1570,15 @@ Partial Class PopUpVerFactura Dim OpcionDetallado As Integer = 1 If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.CveEmpresa = 197 Then OpcionDetallado = 2 + Dim ConsultaPorSucursal As Boolean = UsuarioActual.Empresa.Funcionalidad(382) = "1" + + If ConsultaPorSucursal Then + CveCorte = -1 + End If + Dim ObjVenta As New ClsVentas - If ObjVenta.GetVta_ReporteCortesDetalle(CveCorte, CveSubProyecto, UsuarioActual.CveEmpresa, 2) Then + If ObjVenta.GetVta_ReporteCortesDetalle(CveCorte, CveSubProyecto, UsuarioActual.CveEmpresa, 2, ConsultaIVA:=UsuarioActual.CveEmpresa.Contiene(190, 192), FechaConsulta:=FechaConsulta) Then Dim DsDatos = ObjVenta.DataSetResultados.Copy() If DsDatos IsNot Nothing Then DtCortesVentas = DsDatos.Tables(0) @@ -1600,9 +1611,14 @@ Partial Class PopUpVerFactura End If If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.CveEmpresa = 197 Then - If ObjVenta.GetVta_ReporteCortes(UsuarioActual.CveEmpresa, MinFecha, MaxFecha, CveSubProyecto, CveCorte:=CveCorte) Then - DtReporteCorte = ObjVenta.DtResultados.FiltraParametros("CveCorte > 0") - Fecha = DtReporteCorte.FiltroPrimeroValor("FechaInicial", "") + If ObjVenta.GetVta_ReporteCortes(UsuarioActual.CveEmpresa, FechaConsulta, FechaConsulta, CveSubProyecto, CveCorte:=CveCorte) Then + If ConsultaPorSucursal Then + DtReporteCorte = ObjVenta.DtResultados.FiltraParametros("FechaInicial IS NOT NULL") + Fecha = FechaConsulta.ToString("dd/MM/yyyy") + Else + DtReporteCorte = ObjVenta.DtResultados.FiltraParametros("CveCorte > 0") + Fecha = DtReporteCorte.FiltroPrimeroValor("FechaInicial", "") + End If End If If ObjVenta.GetVta_MovimientosCajas(CveCorte, -1) Then @@ -1618,6 +1634,10 @@ Partial Class PopUpVerFactura Dim FechaCorte As String = $" Fecha fin {Fecha}" + If ConsultaPorSucursal Then + FechaCorte = $" Fecha: {Fecha}" + End If + Dim Usuario As String = $" Usuario {Nombre}" If DtCortesVentas.Rows.Count > 0 Or DtCortesVentasResumen.Rows.Count > 0 Then Dim lrds As New List(Of ReportDataSource) From 5347e982353a3e06940785087ebf5b712ae899e9 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 28 Jun 2024 12:15:53 -0700 Subject: [PATCH 2/2] --FIX depositos e impresiones en cortes --- App_Code/ClsVentas.vb | 11 ++++++++--- Bancos/RepCortes.aspx.vb | 4 ++-- Compras/PopUpVerFactura.aspx.vb | 24 +++++++----------------- 3 files changed, 17 insertions(+), 22 deletions(-) diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 23f442f65..b3b8a15d1 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -3597,13 +3597,15 @@ Public Class ClsVentas ' Return Retorno 'End Function - Public Function GetVta_MovimientosCajas(CveCorte As Integer, TipoMovimiento As Integer) As Boolean + Public Function GetVta_MovimientosCajas(CveCorte As Integer, TipoMovimiento As Integer, Optional CveSubProyecto As Integer = -1, Optional FechaConsulta As Date = ModExtensiones.MaxFecha) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_MovimientosCajasGet") With SqlAdapter.SelectCommand.Parameters .Add("@CveCorte", SqlDbType.Int).Value = CveCorte .Add("@TipoMovimiento", SqlDbType.Int).Value = TipoMovimiento + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@FechaConsulta", SqlDbType.Date).Value = FechaConsulta End With Try @@ -3616,13 +3618,15 @@ Public Class ClsVentas Return Retorno End Function - Public Function GetVta_MovimientosCajasReporte(CveCorte As Integer, TipoMovimiento As Integer) As Boolean + Public Function GetVta_MovimientosCajasReporte(CveCorte As Integer, TipoMovimiento As Integer, Optional CveSubProyecto As Integer = -1, Optional FechaConsulta As Date = ModExtensiones.MaxFecha) 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 + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@FechaConsulta", SqlDbType.Date).Value = FechaConsulta End With Try @@ -3658,7 +3662,7 @@ Public Class ClsVentas ' Return Retorno 'End Function - Public Function GetCortesDetalleDepositosCaja(CveCorte As Integer, CveSubProyecto As Integer, CveEmpresa As Integer) As Boolean + Public Function GetCortesDetalleDepositosCaja(CveCorte As Integer, CveSubProyecto As Integer, CveEmpresa As Integer, Optional FechaConsulta As Date = ModExtensiones.MaxFecha) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_CortesDetalleDepositosCajaGet") @@ -3667,6 +3671,7 @@ Public Class ClsVentas .Add("@CveCorte", SqlDbType.Int).Value = CveCorte .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@FechaConsulta", SqlDbType.Date).Value = FechaConsulta End With Try diff --git a/Bancos/RepCortes.aspx.vb b/Bancos/RepCortes.aspx.vb index b387fecd9..86d87a132 100644 --- a/Bancos/RepCortes.aspx.vb +++ b/Bancos/RepCortes.aspx.vb @@ -253,12 +253,12 @@ Partial Class Bancos_RepCortes End If If CveCorte > 0 Then - If ObjVentas.GetVta_MovimientosCajasReporte(CveCorte, -1) Then + If ObjVentas.GetVta_MovimientosCajasReporte(CveCorte, -1, CveSubProyecto:=DdlSubProyectos.SelectedValue.ToEntero(), FechaConsulta:=FechaConsulta) 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 + If Not UsuarioActual.CveEmpresa.Contiene(140, 141) AndAlso ObjVentas.GetCortesDetalleDepositosCaja(CveCorte, DdlSubProyectos.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, FechaConsulta:=FechaConsulta) Then GvDep.DataSource = ObjVentas.DtResultados If ObjVentas.DtResultados.Rows.Count > 0 Then DivDep.Visible = True diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index ba0dfeefc..691ebe226 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -1586,19 +1586,7 @@ Partial Class PopUpVerFactura DtCortesVentasResumen = DsDatos.Tables(1) End If End If - ' If ObjVenta.GetCortesDetalleVentasResumen(CveCorte, CveSubProyecto, UsuarioActual.CveEmpresa) Then - ' DtCortesVentasResumen = ObjVenta.DtResultados.Copy() - 'End If - 'If ObjPuntoVenta.GetCortesDetalleVentas(CveCorte, CveSubProyecto, UsuarioActual.CveEmpresa, OpcionDetallado) Then - ' DtCortesVentas = ObjPuntoVenta.DtResultados.Copy() - ' If DtCortesVentas.Rows.Count > 0 Then - ' Dim RowInfo As DataRow = DtCortesVentas.FiltroPrimero("CveVenta > 0") - - ' Fecha = RowInfo("FechaInicial").ToString - ' Nombre = RowInfo("Nombre").ToString - ' End If - 'End If If DtCortesVentas.Rows.Count > 0 Then Dim RowInfo As DataRow = DtCortesVentas.FiltroPrimero("CveVenta > 0") @@ -1611,21 +1599,23 @@ Partial Class PopUpVerFactura End If If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.CveEmpresa = 197 Then - If ObjVenta.GetVta_ReporteCortes(UsuarioActual.CveEmpresa, FechaConsulta, FechaConsulta, CveSubProyecto, CveCorte:=CveCorte) Then - If ConsultaPorSucursal Then + If ConsultaPorSucursal Then + If ObjVenta.GetVta_ReporteCortes(UsuarioActual.CveEmpresa, FechaConsulta, FechaConsulta, CveSubProyecto) Then DtReporteCorte = ObjVenta.DtResultados.FiltraParametros("FechaInicial IS NOT NULL") Fecha = FechaConsulta.ToString("dd/MM/yyyy") - Else + End If + Else + If ObjVenta.GetVta_ReporteCortes(UsuarioActual.CveEmpresa, MinFecha, MaxFecha, CveSubProyecto, CveCorte:=CveCorte) Then DtReporteCorte = ObjVenta.DtResultados.FiltraParametros("CveCorte > 0") Fecha = DtReporteCorte.FiltroPrimeroValor("FechaInicial", "") End If End If - If ObjVenta.GetVta_MovimientosCajas(CveCorte, -1) Then + If ObjVenta.GetVta_MovimientosCajas(CveCorte, -1, CveSubProyecto:=CveSubProyecto, FechaConsulta:=FechaConsulta) Then DtIngresosRetiros = ObjVenta.DtResultados.Copy() End If - If Not UsuarioActual.CveEmpresa.Contiene(140, 141) AndAlso ObjVenta.GetCortesDetalleDepositosCaja(CveCorte, CveSubProyecto, UsuarioActual.CveEmpresa) Then + If Not UsuarioActual.CveEmpresa.Contiene(140, 141) AndAlso ObjVenta.GetCortesDetalleDepositosCaja(CveCorte, CveSubProyecto, UsuarioActual.CveEmpresa, FechaConsulta:=FechaConsulta) Then DtDepositos = ObjVenta.DtResultados.Copy() End If End If