HojaExtra en anomalias
This commit is contained in:
@@ -2377,6 +2377,29 @@ Public Class ClsInventarios
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
|
||||
Public Function GetInventarioFisicoProductosExcluidos(CveInventarioFisico As Integer, CveEmpresa As Integer) As Boolean
|
||||
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Inv_InventarioFisicoProductosExcluidosGet")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveInventarioFisico", SqlDbType.Int).Value = CveInventarioFisico
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al consultar los productos excluidos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function RemoveInventarioFisicoAlamacen(CveInventarioFisico As Integer) As Boolean
|
||||
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
@@ -509,6 +509,8 @@ Partial Class Inventarios_RepAnomalias
|
||||
|
||||
'GvF.ExportToExcel("Reporte de Inventario Fisico - Productos que Faltan " & Now.ToShortDateString)
|
||||
|
||||
|
||||
|
||||
ExportarExcelGembox(GvTemp, "Reporte de Inventario Fisico - Productos que Faltan " & Now.ToShortDateString, UsuarioActual, "Reporte de Inventario Fisico - Productos que Faltan", DatosFiltros:=SbFiltros.ToString())
|
||||
|
||||
End Sub
|
||||
@@ -589,7 +591,17 @@ Partial Class Inventarios_RepAnomalias
|
||||
|
||||
SbFiltros.AppendFormat("Estatus: {0}|", lbEstatus.Text)
|
||||
|
||||
ExportarExcelGembox(GvGrupos, "Reporte de Inventario Fisico" & Now.ToShortDateString, UsuarioActual, "Reporte de Inventario Fisico", DatosFiltros:=SbFiltros.ToString())
|
||||
|
||||
Dim ObjInventarios As New ClsInventarios
|
||||
Dim DTExtra As New DataTable
|
||||
|
||||
If ObjInventarios.GetInventarioFisicoProductosExcluidos(CveInventarioFisico, UsuarioActual.CveEmpresa) Then
|
||||
DTExtra = ObjInventarios.DtResultados
|
||||
DTExtra.TableName = "ProductosExcluidos"
|
||||
End If
|
||||
ObjInventarios.Dispose()
|
||||
|
||||
ExportarExcelGembox(GvGrupos, "Reporte de Inventario Fisico" & Now.ToShortDateString, UsuarioActual, "Reporte de Inventario Fisico", DatosFiltros:=SbFiltros.ToString(), DTExtra:=DTExtra)
|
||||
|
||||
End Sub
|
||||
|
||||
@@ -808,7 +820,7 @@ Partial Class Inventarios_RepAnomalias
|
||||
End Sub
|
||||
|
||||
|
||||
Public Sub ExportarExcelGembox(GridView As GridView, NombreArchivoXLSx As String, Usuario As Usuario, Titulo As String, Optional DatoTituloExtra As String = "", Optional DatosFiltros As String = "", Optional AnchoImagen As Integer = 100, Optional AlturaImagen As Integer = 100)
|
||||
Public Sub ExportarExcelGembox(GridView As GridView, NombreArchivoXLSx As String, Usuario As Usuario, Titulo As String, Optional DatoTituloExtra As String = "", Optional DatosFiltros As String = "", Optional AnchoImagen As Integer = 100, Optional AlturaImagen As Integer = 100, Optional DTExtra As DataTable = Nothing)
|
||||
|
||||
Dim sw1 As New StringWriter()
|
||||
Dim htw1 As New HtmlTextWriter(sw1)
|
||||
@@ -955,6 +967,49 @@ Partial Class Inventarios_RepAnomalias
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
If DTExtra IsNot Nothing Then
|
||||
|
||||
Dim NombreTabla As String = ""
|
||||
|
||||
If DTExtra.TableName IsNot Nothing Then
|
||||
NombreTabla = DTExtra.TableName
|
||||
End If
|
||||
|
||||
If NombreTabla.Trim = "" Then
|
||||
NombreTabla = "hoja2"
|
||||
End If
|
||||
|
||||
'excel.Worksheets.Add(NombreTabla)
|
||||
|
||||
Dim workbookDTExtra = New ExcelFile
|
||||
Dim worksheetDTExtra = workbookDTExtra.Worksheets.Add(NombreTabla)
|
||||
|
||||
|
||||
worksheetDTExtra.InsertDataTable(DTExtra,
|
||||
New InsertDataTableOptions() With
|
||||
{
|
||||
.ColumnHeaders = True,
|
||||
.StartRow = 0
|
||||
})
|
||||
|
||||
|
||||
|
||||
Dim columnCount = worksheetDTExtra.CalculateMaxUsedColumns()
|
||||
For i As Integer = 0 To columnCount - 1
|
||||
worksheetDTExtra.Columns(i).AutoFit(1, worksheetDTExtra.Rows(1), worksheetDTExtra.Rows(worksheetDTExtra.Rows.Count - 1))
|
||||
worksheetDTExtra.Cells(0, i).Style.FillPattern.SetSolid(Drawing.ColorTranslator.FromHtml("#4b77be"))
|
||||
|
||||
Next
|
||||
|
||||
|
||||
excel.Worksheets.AddCopy(NombreTabla, worksheetDTExtra)
|
||||
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
excel.Save(HttpContext.Current.Response, $"{NombreArchivoXLSx}.xlsx")
|
||||
|
||||
Reference in New Issue
Block a user