--Foramto de reporte de cortes Empresa 190
This commit is contained in:
@@ -267,15 +267,15 @@ Public Class ClsPuntoVenta
|
||||
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
|
||||
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("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
|
||||
SqlAdapter.SelectCommand.Parameters.Add("@CveCorte", SqlDbType.Int).Value = CveCorte
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
|
||||
@@ -1566,13 +1566,15 @@ Partial Class PopUpVerFactura
|
||||
Dim ObjPuntoVenta As New ClsPuntoVenta
|
||||
Dim DtCortesVentasResumen As DataTable = Nothing
|
||||
Dim DtCortesVentas As DataTable = Nothing
|
||||
Dim DtReporteCorte As DataTable = Nothing
|
||||
|
||||
Dim Fecha As String = "", Nombre As String = ""
|
||||
If ObjVenta.GetCortesDetalleVentasResumen(CveCorte, CveSubProyecto, UsuarioActual.CveEmpresa) Then
|
||||
DtCortesVentasResumen = ObjVenta.DtResultados
|
||||
DtCortesVentasResumen = ObjVenta.DtResultados.Copy()
|
||||
End If
|
||||
|
||||
If ObjPuntoVenta.GetCortesDetalleVentas(CveCorte, CveSubProyecto, UsuarioActual.CveEmpresa) Then
|
||||
DtCortesVentas = ObjPuntoVenta.DtResultados
|
||||
DtCortesVentas = ObjPuntoVenta.DtResultados.Copy()
|
||||
If DtCortesVentas.Rows.Count > 0 Then
|
||||
Dim RowInfo As DataRow = DtCortesVentas.FiltroPrimero("CveVenta > 0")
|
||||
|
||||
@@ -1581,27 +1583,142 @@ Partial Class PopUpVerFactura
|
||||
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()
|
||||
ObjPuntoVenta.Dispose()
|
||||
|
||||
Dim FechaCorte As String = $" <b>Fecha fin:</b> {Fecha}"
|
||||
Dim Usuario As String = $" <b>Usuario:</b> {Nombre}"
|
||||
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)
|
||||
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
||||
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
||||
params.Add(New ReportParameter("FechaImpresion", NowADS().ToDateTime.ToShortDateString))
|
||||
params.Add(New ReportParameter("AgrupoPor", $"{FechaCorte}{Usuario}"))
|
||||
params.Add(New ReportParameter("LogoPath", RutaImagenLogo))
|
||||
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)
|
||||
ImprimirPDF("Empresas/Grales/Formatos/RepCortes.rdlc", lrds, params, "ReporteCortes", Formato)
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
|
||||
If DtReporteCorte IsNot Nothing Then
|
||||
Dim DtTT = GenerateTransposedTable(DtReporteCorte)
|
||||
Dim DtDatosResumen As New DataTable()
|
||||
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 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
|
||||
|
||||
#Region " OP = FACTURA - IMPRIME COMPRA"
|
||||
|
||||
Reference in New Issue
Block a user