--Foramto de reporte de cortes Empresa 190

This commit is contained in:
2024-03-15 18:44:54 -07:00
parent 6bb2e3ff33
commit fe3fc85bd9
2 changed files with 128 additions and 11 deletions

View File

@@ -267,15 +267,15 @@ Public Class ClsPuntoVenta
End Function End Function
Public Function GetVta_ReporteCortes(CveEmpresa As Integer, FechaI As Date, FechaF As Date, Optional CveSubProyecto As Integer = -1) As Boolean 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 Dim Retorno As Boolean = False
DataAdapter("PA_Vta_ReporteCortesGet") DataAdapter("PA_Vta_ReporteCortesGet")
SqlAdapter.SelectCommand.Parameters.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa SqlAdapter.SelectCommand.Parameters.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
SqlAdapter.SelectCommand.Parameters.Add("@FechaInicio", SqlDbType.Date).Value = FechaI SqlAdapter.SelectCommand.Parameters.Add("@FechaInicio", SqlDbType.Date).Value = FechaI
SqlAdapter.SelectCommand.Parameters.Add("@FechaFin", SqlDbType.Date).Value = FechaF SqlAdapter.SelectCommand.Parameters.Add("@FechaFin", SqlDbType.Date).Value = FechaF
SqlAdapter.SelectCommand.Parameters.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto SqlAdapter.SelectCommand.Parameters.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
SqlAdapter.SelectCommand.Parameters.Add("@CveCorte", SqlDbType.Int).Value = CveCorte
Try Try
SqlAdapter.Fill(Data) SqlAdapter.Fill(Data)
Retorno = True Retorno = True

View File

@@ -1566,13 +1566,15 @@ Partial Class PopUpVerFactura
Dim ObjPuntoVenta As New ClsPuntoVenta Dim ObjPuntoVenta As New ClsPuntoVenta
Dim DtCortesVentasResumen As DataTable = Nothing Dim DtCortesVentasResumen As DataTable = Nothing
Dim DtCortesVentas As DataTable = Nothing Dim DtCortesVentas As DataTable = Nothing
Dim DtReporteCorte As DataTable = Nothing
Dim Fecha As String = "", Nombre As String = "" Dim Fecha As String = "", Nombre As String = ""
If ObjVenta.GetCortesDetalleVentasResumen(CveCorte, CveSubProyecto, UsuarioActual.CveEmpresa) Then If ObjVenta.GetCortesDetalleVentasResumen(CveCorte, CveSubProyecto, UsuarioActual.CveEmpresa) Then
DtCortesVentasResumen = ObjVenta.DtResultados DtCortesVentasResumen = ObjVenta.DtResultados.Copy()
End If End If
If ObjPuntoVenta.GetCortesDetalleVentas(CveCorte, CveSubProyecto, UsuarioActual.CveEmpresa) Then If ObjPuntoVenta.GetCortesDetalleVentas(CveCorte, CveSubProyecto, UsuarioActual.CveEmpresa) Then
DtCortesVentas = ObjPuntoVenta.DtResultados DtCortesVentas = ObjPuntoVenta.DtResultados.Copy()
If DtCortesVentas.Rows.Count > 0 Then If DtCortesVentas.Rows.Count > 0 Then
Dim RowInfo As DataRow = DtCortesVentas.FiltroPrimero("CveVenta > 0") Dim RowInfo As DataRow = DtCortesVentas.FiltroPrimero("CveVenta > 0")
@@ -1581,27 +1583,142 @@ Partial Class PopUpVerFactura
End If End If
End If End If
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
If ObjPuntoVenta.GetVta_ReporteCortes(UsuarioActual.CveEmpresa, MinFecha, MaxFecha, CveSubProyecto, CveCorte:=CveCorte) Then
DtReporteCorte = ObjPuntoVenta.DtResultados.FiltraParametros("CveCorte > 0")
End If
End If
ObjVenta.Dispose() ObjVenta.Dispose()
ObjPuntoVenta.Dispose() ObjPuntoVenta.Dispose()
Dim FechaCorte As String = $"&emsp;<b>Fecha fin:</b> {Fecha}" Dim FechaCorte As String = $"&emsp;<b>Fecha fin:</b> {Fecha}"
Dim Usuario As String = $"&emsp;<b>Usuario:</b> {Nombre}" Dim Usuario As String = $"&emsp;<b>Usuario:</b> {Nombre}"
If DtCortesVentas.Rows.Count > 0 Or DtCortesVentasResumen.Rows.Count > 0 Then If DtCortesVentas.Rows.Count > 0 Or DtCortesVentasResumen.Rows.Count > 0 Then
Dim lrds As New List(Of ReportDataSource)
Dim rds As New ReportDataSource With {.Name = "DataSet1", .Value = DtCortesVentasResumen}
lrds.Add(rds)
Dim rds2 As New ReportDataSource With {.Name = "DataSet2", .Value = DtCortesVentas}
lrds.Add(rds2)
Dim DirFormato As String = "Empresas/Grales/Formatos/RepCortes.rdlc"
If File.Exists(UsuarioActual.Empresa.Ruta + "\Formatos\RepCortes.rdlc") Then
DirFormato = UsuarioActual.Empresa.Ruta + "\Formatos\RepCortes.rdlc"
End If
Dim params As New List(Of ReportParameter) Dim params As New List(Of ReportParameter)
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
params.Add(New ReportParameter("FechaImpresion", NowADS().ToDateTime.ToShortDateString)) params.Add(New ReportParameter("FechaImpresion", NowADS().ToDateTime.ToShortDateString))
params.Add(New ReportParameter("AgrupoPor", $"{FechaCorte}{Usuario}")) params.Add(New ReportParameter("AgrupoPor", $"{FechaCorte}{Usuario}"))
params.Add(New ReportParameter("LogoPath", RutaImagenLogo)) params.Add(New ReportParameter("LogoPath", RutaImagenLogo))
Dim lrds As New List(Of ReportDataSource)
Dim rds As New ReportDataSource With {.Name = "DataSet1", .Value = DtCortesVentasResumen} If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
lrds.Add(rds) If DtReporteCorte IsNot Nothing Then
Dim rds2 As New ReportDataSource With {.Name = "DataSet2", .Value = DtCortesVentas} Dim DtTT = GenerateTransposedTable(DtReporteCorte)
lrds.Add(rds2) Dim DtDatosResumen As New DataTable()
ImprimirPDF("Empresas/Grales/Formatos/RepCortes.rdlc", lrds, params, "ReporteCortes", Formato) DtDatosResumen.Columns.Add(New DataColumn("Orden", GetType(Integer)))
DtDatosResumen.Columns.Add(New DataColumn("Columna", GetType(String)))
DtDatosResumen.Columns.Add(New DataColumn("Importe", GetType(Decimal)))
For Each row As DataRow In DtTT.Rows
Dim Total = row(1).ToString()
If IsNumeric(Total) Then
Dim Orden As Integer = 0
Dim rowData = DtDatosResumen.NewRow()
Select Case row(0).ToString()
Case "ImporteInicial"
rowData("Columna") = "Importe Inicial"
Orden = 1
Case "VentasCorte"
rowData("Columna") = "Total Ventas"
Orden = 2
Case "NotasCredito"
rowData("Columna") = "N.C."
Orden = 3
Case "VentasCredito"
rowData("Columna") = "Ventas Crédito"
Orden = 4
'Case "TotalEfectivo"
' rowData("Columna") = "Total Efectivo"
'Case "TotalCheque"
' rowData("Columna") = "Total Cheque"
'Case "TarjDebito"
' rowData("Columna") = "Tarj. Débito"
'Case "TarjCredito"
' rowData("Columna") = "Tarj. Crédito"
'Case "VentasTransferencia"
' rowData("Columna") = "Total Transf."
Case "TotalRetiros"
rowData("Columna") = "Total Retiro"
Orden = 6
Case "TotalIngresos"
rowData("Columna") = "Total Ingreso"
Orden = 5
Case "Devoluciones"
rowData("Columna") = "Devoluciones"
Orden = 7
Case "TotalCaja"
rowData("Columna") = "Total Caja"
Orden = 8
'Case "TotalCorte"
' rowData("Columna") = "Total Corte"
Case Else
rowData("Columna") = row(0).ToString()
Orden = 0
End Select
rowData("Importe") = Total.ToDecimal()
rowData("Orden") = Orden
DtDatosResumen.Rows.Add(rowData)
End If
Next
Dim rds3 As New ReportDataSource With {.Name = "DataSet3", .Value = DtDatosResumen.FiltraParametros("Orden > 0", "Orden")}
lrds.Add(rds3)
'params.Add(New ReportParameter("VentasCorte", RowCorte("VentasCorte").ToString()))
'params.Add(New ReportParameter("NotasCredito", RowCorte("NotasCredito").ToString()))
'params.Add(New ReportParameter("NotasCredito", RowCorte("NotasCredito").ToString()))
'params.Add(New ReportParameter("VentasCredito", RowCorte("VentasCorte").ToString()))
'params.Add(New ReportParameter("VentasCorte", RowCorte("VentasCorte").ToString()))
'params.Add(New ReportParameter("VentasCorte", RowCorte("VentasCorte").ToString()))
End If
End If
ImprimirPDF(DirFormato, lrds, params, "ReporteCortes", Formato)
End If End If
End Sub End Sub
Private Function GenerateTransposedTable(ByVal inputTable As DataTable) As DataTable
Dim outputTable As DataTable = New DataTable()
outputTable.Columns.Add(inputTable.Columns(0).ColumnName.ToString())
For Each inRow As DataRow In inputTable.Rows
Dim newColName As String = inRow(0).ToString()
outputTable.Columns.Add(newColName)
Next
For rCount As Integer = 1 To inputTable.Columns.Count - 1
Dim newRow As DataRow = outputTable.NewRow()
newRow(0) = inputTable.Columns(rCount).ColumnName.ToString()
For cCount As Integer = 0 To inputTable.Rows.Count - 1
Dim colValue As String = inputTable.Rows(cCount)(rCount).ToString()
newRow(cCount + 1) = colValue
Next
outputTable.Rows.Add(newRow)
Next
Return outputTable
End Function
#End Region #End Region
#Region " OP = FACTURA - IMPRIME COMPRA" #Region " OP = FACTURA - IMPRIME COMPRA"